4.8 0 False C:\users\wouter\My Documents\studie\ma\mahd\implementation\SCARA\05_stepper\stepper_103H5208_controller.emx 2020-7-22 15:25:39 '; type Mainmodel end; implementation bg submodels C 976 392 description ' 4.2 1 False Bond Graph\C.emx 2011-11-29 15:58:35 '; type C ports power in p; signal out state; restrictions causality preferred out p; end; icon bg bottom figures text 'C' 976 392 color 0 18 bold; end; implementation eq parameters real c = 0.00001; equations state = int(p.f); p.e = state / c; implementation_end; I2 1024 272 description ' 4.2 1 False Bond Graph\I.emx 2011-11-29 15:55:55 '; type I ports power in p; signal out state; restrictions causality preferred in p; end; icon bg bottom figures text 'I' 1024 272 color 0 18 bold; end; implementation eq parameters real i = 8e-5 {kg.m2}; equations state = int(p.e); p.f = state / i; implementation_end; OneJunction 1024 336 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports rotation knot duplicatable none p [1]; signal knot out flow [1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 1024 336 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction1 936 392 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports rotation knot duplicatable none p [1]; signal knot out flow [1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 936 392 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; R 896 392 description ' 4.2 1 False Bond Graph\R.emx 2011-11-29 16:35:37 '; type R ports power in p; end; icon bg bottom figures text 'R' 896 392 color 0 18 bold; end; implementation eq parameters real r = 100; equations p.e = r * p.f; implementation_end; Square 432 336 description ' 4.0 1 False Signal\Sources\WaveGenerator-Square.emx 2009-3-5 16:05:33 '; type 'WaveGenerator-Square' ports signal out output; end; icon bg bottom figures rectangle 416.1 320 447.9 352 color 0 fill 15132390; line 420.1 323.9 419.9 350.2 color 0 fill 0; line 417.9 348.1 443.9 348.1 color 0 fill 0; line 420.1 348.1 424 348.1 424 336 color 16711680 fill 0; line 432 336 424 336 432 336 color 16711680 fill 0; line 432 348.1 432 336 432 348.1 color 16711680 fill 0; line 440 336 440 348.1 440 336 color 16711680 fill 0; line 443.9 336.1 439.7 336.1 color 16711680 fill 0; line 432 348.1 440 348.1 color 16711680 fill 0; end; implementation eq parameters real amplitude = 50; // amplitude of the wave real omega = 2 {rad/s}; // angular frequency of the wave variables real hidden s, half; boolean hidden change; equations "calculate at least 2 points per period (just after the change in sign)" half = pi / omega; change = frequencyevent (half, 1e-14); "calculate the square wave" s = sign (sin (omega * time)); output = if( s == 0 ) then amplitude else (amplitude / 2) * (s + 1) end; implementation_end; stepper_control 584 336 description ' 4.8 1 Motor\stepper_control.emx 2020-7-22 15:25:26 '; type Submodel ports signal in setpoint {rad} ; signal out output {rad} ; end; implementation bg submodels Acceleration_int 648 336 description ' 4.3 1 False Signal\Block Diagram\Integrate.emx 2013-3-8 14:47:42 '; type Integrate ports signal in input; signal out output; end; icon bg bottom figures rectangle 632 320 664 352 color 0 fill 15132390; text '∫' 648 336.3 color 16711680 'Lucida Sans' 21 italic; end; implementation eq parameters real initial = 0; // initial value equations output = int (input, initial); implementation_end; Acceleration_limit 568 336 description '4.01False Signal\Block Diagram Non-Linear\SignalLimiter-Limit.emx 2007-9-26 12:47:40 '; type 'SignalLimiter-Limit' ports signal in input; signal out output; end; icon bg bottom figures group rectangle 552 320 584 352 color 0 fill 15132390; line 567.9 324.5 567.9 349 color 0 fill 15132390; line 555 336.2 580.7 336.2 color 0 fill 15132390; spline 561.9 343.1 573.9 329.4 color 16711680 fill 15132390 width 2; spline 573.3 330.2 581.9 329.8 color 16711680 fill 15132390 width 2; spline 555 343.6 561.9 343.1 color 16711680 fill 15132390 width 2; end; end; implementation eq parameters real maximum = 200; real minimum = -200; equations output = limit (input, minimum, maximum); implementation_end; plug setpoint 136 336; plug output 791 336; PlusMinus1 240 336 description '4.01False Signal\Block Diagram\PlusMinus.emx 2007-9-27 10:15:13 '; knot PlusMinus ports signal knot duplicatable in plus [1]; signal knot duplicatable in minus [1]; signal knot out output [1]; end; icon bg ellipse figures ellipse 232 328 248 344 color 0 fill 16777215; end; implementation eq equations output = sum (collect (plus)) - sum (collect (minus)); implementation_end; PlusMinus2 432 336 description '4.01False Signal\Block Diagram\PlusMinus.emx 2007-9-27 10:15:13 '; knot PlusMinus ports signal knot duplicatable in plus [1]; signal knot duplicatable in minus [1]; signal knot out output [1]; end; icon bg ellipse figures ellipse 424 328 440 344 color 0 fill 16777215; end; implementation eq equations output = sum (collect (plus)) - sum (collect (minus)); implementation_end; Position_control 296 336 description ' 4.0 1 False Signal\Control\PID Control\Continuous\PD.emx 2008-1-17 10:49:7 '; type PD ports signal in error; signal out output; end; icon bg bottom figures rectangle 280 320 312 352 color 0 fill 15132390; text 'PD' 296.5 336.1 color 16711680 18 bold; end; implementation eq parameters real kp = 4 {}; // Proportional gain real tauD = 100 {s}; // Derivative time constant: tauD > 0 real beta = 0.4 {}; // Tameness constant: 0 < beta << 1 real maximum = 25; variables real state, rate; equations rate = (kp * error - output) / (beta * tauD); state = int (rate); output = state + kp * error / beta; implementation_end; Splitter3 688 336 description '4.0 Signal\Block Diagram\Splitter.emx 2008-01-17 11:28:29 1 False '; knot Splitter ports signal knot duplicatable out output [1]; signal knot in input [1]; end; icon bg ellipse figures ellipse 684.8 332.8 691.2 339.2 color -1 fill 0; ellipse 683.7 331.7 692.3 340.3 color -1; terminals input 688 336 fixed; end; implementation eq equations collect (output) = input; implementation_end; Splitter4 752 336 description '4.0 Signal\Block Diagram\Splitter.emx 2008-01-17 11:28:29 1 False '; knot Splitter ports signal knot duplicatable out output [1]; signal knot in input [1]; end; icon bg ellipse figures ellipse 748.8 332.8 755.2 339.2 color -1 fill 0; ellipse 747.7 331.7 756.3 340.3 color -1; terminals input 752 336 fixed; end; implementation eq equations collect (output) = input; implementation_end; Velocity_control 480 336 description ' 4.0 1 False Signal\Control\PID Control\Continuous\PD.emx 2008-1-17 10:49:7 '; type PD ports signal in error; signal out output; end; icon bg bottom figures rectangle 464 320 496 352 color 0 fill 15132390; text 'PD' 480.5 336.1 color 16711680 18 bold; end; implementation eq parameters real kp = 12 {}; // Proportional gain real tauD = 10 {s}; // Derivative time constant: tauD > 0 real beta = 0.4 {}; // Tameness constant: 0 < beta << 1 real maximum = 100; variables real state, rate; equations rate = (kp * error - output) / (beta * tauD); state = int (rate); output = state + kp * error / beta; implementation_end; Velocity_int 720 336 description ' 4.3 1 False Signal\Block Diagram\Integrate.emx 2013-3-8 14:47:42 '; type Integrate ports signal in input; signal out output; end; icon bg bottom figures rectangle 704 320 736 352 color 0 fill 15132390; text '∫' 720 336.3 color 16711680 'Lucida Sans' 21 italic; end; implementation eq parameters real initial = 0; // initial value equations output = int (input, initial); implementation_end; Velocity_limit 376 336 description '4.01False Signal\Block Diagram Non-Linear\SignalLimiter-Limit.emx 2007-9-26 12:47:40 '; type 'SignalLimiter-Limit' ports signal in input; signal out output; end; icon bg bottom figures group rectangle 360 320 392 352 color 0 fill 15132390; line 375.9 324.5 375.9 349 color 0 fill 15132390; line 363 336.2 388.7 336.2 color 0 fill 15132390; spline 369.9 343.1 381.9 329.4 color 16711680 fill 15132390 width 2; spline 381.3 330.2 389.9 329.8 color 16711680 fill 15132390 width 2; spline 363 343.6 369.9 343.1 color 16711680 fill 15132390 width 2; end; end; implementation eq parameters real maximum = 25; real minimum = -25; equations output = limit (input, minimum, maximum); implementation_end; end; connections Acceleration_int\output -> Splitter3\input; Acceleration_limit\output -> Acceleration_int\input; PlusMinus1\output -> Position_control\error; PlusMinus2\output -> Velocity_control\error; Position_control\output -> Velocity_limit\input; setpoint -> PlusMinus1\plus; Splitter3\output -> PlusMinus2\minus 688 288 432 288; Splitter3\output -> Velocity_int\input; Splitter4\output -> output; Splitter4\output -> PlusMinus1\minus 752 400 240 400; Velocity_control\output -> Acceleration_limit\input; Velocity_int\output -> Splitter4\input; Velocity_limit\output -> PlusMinus2\plus; end; implementation_end; stepper_model 768 336 description ' 4.8 1 Motor\stepper_model.emx 2020-7-22 15:25:37 parameters real I_phase = 3.4 {mH}; real R_phase = 2.9 {ohm}; real u_max = 3.4 {V}; real RotorInertia = 5.6e-6 {kg.m2}; real StepperMass = 0.29 {kg}; real angle_step = 1.8 {deg}; real n_phase = 2 {none}; real fluxLinkage = 0.0022 {Wb}; real detentTorque = 0.01 {N.m}; variables real omega; real p; // rotor division initialequations p = 2 * pi / (2 * n_phase * angle_step); omega = 200; '; type Submodel ports signal in angle; rotation out p; end; implementation bg submodels I 560 104 description ' 4.2 1 False Bond Graph\I.emx 2011-11-29 15:55:55 '; type I ports power in p; signal out state; restrictions causality preferred in p; end; icon bg bottom figures text 'I' 560 104 color 0 18 bold; end; implementation eq parameters real global I_phase; equations state = int(p.e); p.f = state / I_phase; implementation_end; I1 608 328 description ' 4.2 1 False Bond Graph\I.emx 2011-11-29 15:55:55 '; type I ports power in p; signal out state; restrictions causality preferred in p; end; icon bg bottom figures text 'I' 608 328 color 0 18 bold; end; implementation eq parameters real global I_phase; equations state = int(p.e); p.f = state / I_phase; implementation_end; I2 752 160 description ' 4.2 1 False Bond Graph\I.emx 2011-11-29 15:55:55 '; type I ports power in p; signal out state; restrictions causality preferred in p; end; icon bg bottom figures text 'I' 752 160 color 0 18 bold; end; implementation eq parameters real i = 8e-5 {kg.m2}; real global RotorInertia; equations state = int(p.e); p.f = state / (RotorInertia); implementation_end; MGY_a 656 160 description ' 4.2 1 False Bond Graph\MGY.emx 2011-11-29 16:03:53 '; type MGY ports power in p1; power out p2; signal in r; restrictions causality constraint equal p1 p2; end; icon bg bottom figures text 'MGY' 656 160 color 0 18 bold; end; implementation eq equations p1.e = r * p2.f; p2.e = r * p1.f; implementation_end; MGY_b 656 272 description ' 4.2 1 False Bond Graph\MGY.emx 2011-11-29 16:03:53 '; type MGY ports power in p1; power out p2; signal in r; restrictions causality constraint equal p1 p2; end; icon bg bottom figures text 'MGY' 656 272 color 0 18 bold; end; implementation eq equations p1.e = r * p2.f; p2.e = r * p1.f; implementation_end; MSe_a 512 160 description ' 4.2 1 False Bond Graph\MSe.emx 2011-11-29 16:12:33 '; type MSe ports electric out p; signal in effort; restrictions causality fixed out p; end; icon bg bottom figures text 'MSe' 512 160 color 0 18 bold; end; implementation eq variables real flow; equations p.e = effort; flow = p.f; implementation_end; MSe_b 512 272 description ' 4.2 1 False Bond Graph\MSe.emx 2011-11-29 16:12:33 '; type MSe ports electric out p; signal in effort; restrictions causality fixed out p; end; icon bg bottom figures text 'MSe' 512 272 color 0 18 bold; end; implementation eq variables real flow; equations p.e = effort; flow = p.f; implementation_end; plug angle 200 216; plug p 1472 216; OneJunction1 840 216 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports rotation knot duplicatable none p [1]; signal knot out flow [1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 840 216 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction2 584 160 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports electric knot duplicatable none p [1]; signal knot out flow [1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 584 160 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction3 584 272 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports electric knot duplicatable none p [1]; signal knot out flow [1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 584 272 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction4 752 216 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports rotation knot duplicatable none p [1]; signal knot out flow [1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 752 216 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; phase_control 512 216 description '4.0 Template\Submodel-Equation.emx 1 False 2007-11-1 22:32:1 False '; type Submodel ports signal in angle; signal out a; signal out b; end; icon bg figures rectangle 472 200 552 232 color 0 fill 15132390; text 'name' 512 216 color 0 'Clear Sans' 16; end; implementation eq parameters real global u_max {V}; real global angle_step; real max_a {m/s2}; variables real current_angle; real c,s; real global p; boolean hidden eventa, eventb; equations a = u_max * (cos (p*angle)); eventa = event(a); b = u_max * -(sin (p*angle)); eventb = event(b); current_angle = angle; implementation_end; R 608 104 description ' 4.2 1 False Bond Graph\R.emx 2011-11-29 16:35:37 '; type R ports power in p; end; icon bg bottom figures text 'R' 608 104 color 0 18 bold; end; implementation eq parameters real global R_phase; equations p.e = R_phase * p.f; implementation_end; R1 560 328 description ' 4.2 1 False Bond Graph\R.emx 2011-11-29 16:35:37 '; type R ports power in p; end; icon bg bottom figures text 'R' 560 328 color 0 18 bold; end; implementation eq parameters real global R_phase; equations p.e = R_phase * p.f; implementation_end; R2 824 264 description ' 4.2 1 False Bond Graph\R.emx 2011-11-29 16:35:37 '; type R ports power in p; end; icon bg bottom figures text 'R' 824 264 color 0 18 bold; end; implementation eq parameters real r = 1.0e-3; equations p.e = r * p.f; implementation_end; RotorAngle 656 216 description '4.0 Template\Submodel-Equation.emx 1 False 2007-11-1 22:32:1 False '; type Submodel ports signal out output_b; signal out output_a; signal in omega {rad/s} ; signal out output_d; end; icon bg figures rectangle 616 200 696 232 color 0 fill 15132390; text 'name' 656 216 color 0 'Clear Sans' 16; end; implementation eq parameters real global fluxLinkage; real global detentTorque; variables real global p; real angle {rad}; equations angle = int(omega); output_a = -p * fluxLinkage * sin(p * angle); output_b = p * fluxLinkage * sin(p * angle - pi / 2); output_d = detentTorque * sin(2 * p * angle); implementation_end; Se 752 272 description ' 4.2 1 False Bond Graph\MSe.emx 2011-11-29 16:12:33 '; type MSe ports power out p; signal in effort; restrictions causality fixed out p; end; icon bg bottom figures text 'MSe' 752 272 color 0 18 bold; end; implementation eq variables real flow; equations p.e = effort; flow = p.f; implementation_end; end; connections angle -> phase_control\angle; I2\p <= OneJunction4\p; MGY_a\p2 => OneJunction4\p; MGY_b\p2 => OneJunction4\p; MSe_b\p => OneJunction3\p; OneJunction1\p => p; OneJunction2\p <= MSe_a\p; OneJunction2\p => I\p; OneJunction2\p => MGY_a\p1; OneJunction2\p => R\p; OneJunction3\p => I1\p; OneJunction3\p => MGY_b\p1; OneJunction3\p => R1\p; OneJunction4\flow -> RotorAngle\omega; OneJunction4\p => OneJunction1\p; OneJunction4\p => R2\p; phase_control\a -> MSe_a\effort; phase_control\b -> MSe_b\effort; RotorAngle\output_a -> MGY_a\r; RotorAngle\output_b -> MGY_b\r; RotorAngle\output_d -> Se\effort; Se\p => OneJunction4\p; end; implementation_end; ZeroJunction1 936 336 description ' 4.2 1 False Bond Graph\ZeroJunction.emx 2011-11-29 16:45:16 '; knot ZeroJunction ports rotation knot duplicatable none p [1]; signal knot out effort [1]; restrictions causality constraint one_in p; end; icon bg figures text '0' 936 336 color 0 18 bold; end; implementation eq equations sum (direct (p.f)) = 0; equal (collect (p.e)); effort = first (p.e); implementation_end; end; connections C\p <= OneJunction1\p; OneJunction\p => I2\p; OneJunction1\p => R\p; OneJunction1\p => ZeroJunction1\p; Square\output -> stepper_control\setpoint; stepper_control\output -> stepper_model\angle; stepper_model\p => ZeroJunction1\p; ZeroJunction1\p => OneJunction\p; end; implementation_end; ]]> Experiment 1 4.8 stepper_model\phase_control\max_a m/s2 0 C\state_initial 0 I2\state_initial 0 stepper_control\Position_control\state_initial 0 stepper_control\Velocity_control\state_initial 0 stepper_model\I1\state_initial 0 stepper_model\I2\state_initial 0 stepper_model\I\state_initial 0 stepper_model\RotorAngle\angle_initial rad 0 time stepper_model\I2\p.e stepper_model\I2\p.f stepper_model\RotorAngle\angle stepper_model\MSe_a\effort stepper_model\MSe_b\effort stepper_model\Submodel2\a stepper_model\Submodel2\b stepper_control\Integrate\input stepper_control\Integrate\output stepper_control\Integrate1\output Square\output stepper_control\PD\error stepper_control\PD1\error GraphPlot 1 false 16777215 true true 15780518 12624260 0 10 10 10 false 16777215 true 1 model true Arial 12 34 400 0 0 0 0 Arial 12 34 400 0 0 0 0 Arial 10 34 400 0 0 0 0 Arial 12 34 400 0 0 0 0 true false false 0.0 2.0 true 3 -0.025 0.025 true 2 -25.0 25.0 true 2 3355111 1 3355111 0 true 1 1 1 true true time true stepper_model\I2\p.e 6076255 1 6076255 0 true 1 1 1 true true time true stepper_model\I2\p.f true 0 16777215 GraphPlot 2 false 16777215 true true 15780518 12624260 0 10 10 10 false 16777215 true 1 model(2) true Arial 12 34 400 0 0 0 0 Arial 12 34 400 0 0 0 0 Arial 10 34 400 0 0 0 0 Arial 12 34 400 0 0 0 0 true true false 0.0 2.0 true 3 -30.0 70.0 true 2 -1.5 3.5 true 2 3355111 1 3355111 0 true 1 1 1 true true time true stepper_model\RotorAngle\angle 6076255 1 6076255 0 true 1 1 1 true true time true Square\output true 0 16777215 GraphPlot 3 false 16777215 true true 15780518 12624260 0 10 10 10 false 16777215 true 1 model(1) true Arial 12 34 400 0 0 0 0 Arial 12 34 400 0 0 0 0 Arial 10 34 400 0 0 0 0 Arial 12 34 400 0 0 0 0 true true false 0.0 2.0 true 3 -250.0 250.0 true 1 -400.0 600.0 true 1 -400.0 600.0 true 1 -400.0 600.0 true 1 -400.0 600.0 true 1 3355111 1 3355111 0 true 1 1 1 true true time true stepper_control\Integrate\input 6076255 1 6076255 0 true 1 1 1 true true time true stepper_control\Integrate\output 12553035 1 12553035 0 true 1 1 1 true true time true stepper_control\Integrate1\output 15086320 1 15086320 0 true 1 1 1 true true time true stepper_control\PD\error 15790150 1 15790150 0 true 1 1 1 true true time true stepper_control\PD1\error true 0 16777215 GraphPlot 4 false 16777215 true true 15780518 12624260 0 10 10 10 false 16777215 true 1 Window 2 true Arial 12 34 400 0 0 0 0 Arial 12 34 400 0 0 0 0 Arial 10 34 400 0 0 0 0 Arial 12 34 400 0 0 0 0 true true false 0.0 2.0 true 3 -5.0 5.0 true 2 -5.0 5.0 true 2 -5.0 5.0 true 2 -5.0 5.0 true 2 3355111 1 3355111 0 true 1 1 1 true true time true stepper_model\Submodel2\a 6076255 1 6076255 0 true 1 1 1 true true time true stepper_model\MSe_a\effort 12553035 1 12553035 0 true 1 1 1 true true time true stepper_model\MSe_b\effort 15086320 1 15086320 0 true 1 1 1 true true time true stepper_model\Submodel2\b true 0 16777215 1 true Window 1 0 1 2 3 Base 2 false Window 2 2 4 Base 0.0260417 0.025 0.908854 0.872222 0.172917 0.158333 0.841667 0.919444 0.0 2.0 false false false false 0.1 1.0e-6 1.0e-7 false true Euler 0.01 false BackwardEuler 1.0e-5 1.0e-5 1.0e-5 1.0e-5 0.01 1.0 AdamsBashforth 0.01 false RungeKutta2 0.01 false RungeKutta4 1.0e-4 false RungeKutta8 false 0.0 false 0.0 1.0e-6 1.0e-6 0.9 0.33 6.0 0.0 false 100000 false 1000 RungeKuttaFehlberg false 0.0 false 0.0 1.0e-6 1.0e-6 VodeAdams false 0.0 false 0.0 1.0e-6 1.0e-6 false true BDFMethod 1.0e-5 1.0e-5 1.0e-5 1.0e-5 false 0.0 false 0.0 MeBDFiMethod 1.0e-5 1.0e-5 1.0e-5 1.0e-5 false 0.0 false 0.0 8 20 false false true false false 1 0.0 false Optimization true Submodel3\RotorAngle\angle Square\output UseIntegralAbsolute 0.001 BroydonFletcherGoldfarbShanno stepper_control\PD1\kp 1.0 50.0 Linear Uniform 15.0 3.75 1.0 10.0 stepper_control\PD1\tauD 1.0 50.0 Linear Uniform 6.0 1.5 1.0 10.0 true true true true false 1.0