4.8 0 False Motor\stepper_103H5208.emx 2020-7-21 18:09:21 parameters real I_phase = 3.4 {mH}; real R_phase = 2.9 {ohm}; 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 = 15.0e-4 {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 Mainmodel end; implementation bg submodels Cycloid 352 216 description '4.01False Signal\Sources\SignalGenerator-Cycloid.emx 2007-9-27 16:0:53 '; type 'SignalGenerator-Cycloid' ports signal out output; end; icon bg bottom figures rectangle 336 200 368 232 color 0 fill 15132390; line 338.9 224 365.1 224 color 0; line 341.1 208 341.1 226.2 color 0; spline 341 224 345.8 222.1 352.2 212.8 364.3 210.7 color 16711680 fill 15132390; line 361.8 224 361.8 210.7 color 0 fill 15132390 dotted; end; implementation eq parameters real amplitude = 25 {none}; real start_time = 0.0 {s}; real stop_time = 2.0 {s}; variables real hidden tDelta, cycl; boolean hidden change; equations "calculate at least at the start and stop time" change = timeevent (start_time) or timeevent (stop_time); "calculate the cycliod signal" tDelta = 2 * pi * (time - start_time) / (stop_time - start_time); cycl = amplitude * (tDelta - sin (tDelta)) / twopi; output = if tDelta < 0.0 then 0 else if tDelta >= 0.0 and tDelta <= twopi then cycl else amplitude end end; implementation_end; 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 / (i+RotorInertia); implementation_end; Integrate 424 216 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 408 200 440 232 color 0 fill 15132390; text '∫' 424 216.3 color 16711680 'Lucida Sans' 21 italic; end; implementation eq parameters real initial = 0; // initial value equations output = int (input, initial); 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; OneJunction 896 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' 896 216 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction1 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; OneJunction2 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; OneJunction3 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; PlusMinus1 448 160 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 440 152 456 168 color 0 fill 16777215; end; implementation eq equations output = sum (collect (plus)) - sum (collect (minus)); implementation_end; PlusMinus2 448 272 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 440 264 456 280 color 0 fill 16777215; end; implementation eq equations output = sum (collect (plus)) - sum (collect (minus)); 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; 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; Splitter1 720 216 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 716.8 212.8 723.2 219.2 color -1 fill 0; ellipse 715.7 211.7 724.3 220.3 color -1; terminals input 720 216 fixed; end; implementation eq equations collect (output) = input; implementation_end; Square 448 96 description ' 4.0 1 False Signal\Sources\WaveGenerator-Square.emx 2009-3-5 16:05:33 '; type WaveGenerator ports signal out output; end; icon bg bottom figures rectangle 432.1 80 463.9 112 color 0 fill 15132390; line 436.1 83.9 435.9 110.2 color 0 fill 0; line 433.9 108.1 459.9 108.1 color 0 fill 0; line 436.1 108.1 440 108.1 440 96 color 16711680 fill 0; line 448 96 440 96 448 96 color 16711680 fill 0; line 448 108.1 448 96 448 108.1 color 16711680 fill 0; line 456 96 456 108.1 456 96 color 16711680 fill 0; line 459.9 96.1 455.7 96.1 color 16711680 fill 0; line 448 108.1 456 108.1 color 16711680 fill 0; end; implementation eq parameters real amplitude = 3.4; // amplitude of the wave variables real global omega; // angular frequency of the wave 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; Square1 384 272 description ' 4.0 1 False Signal\Sources\WaveGenerator-Square.emx 2009-3-5 16:05:33 '; type WaveGenerator ports signal out output; end; icon bg bottom figures rectangle 368.1 256 399.9 288 color 0 fill 15132390; line 372.1 259.9 371.9 286.2 color 0 fill 0; line 369.9 284.1 395.9 284.1 color 0 fill 0; line 372.1 284.1 376 284.1 376 272 color 16711680 fill 0; line 384 272 376 272 384 272 color 16711680 fill 0; line 384 284.1 384 272 384 284.1 color 16711680 fill 0; line 392 272 392 284.1 392 272 color 16711680 fill 0; line 395.9 272.1 391.7 272.1 color 16711680 fill 0; line 384 284.1 392 284.1 color 16711680 fill 0; end; implementation eq parameters real amplitude = -3.4; // amplitude of the wave variables real global omega; // angular frequency of the wave 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 + pi/2)); output = if( s == 0 ) then amplitude else (amplitude / 2) * (s + 1) end; implementation_end; Square2 384 160 description ' 4.0 1 False Signal\Sources\WaveGenerator-Square.emx 2009-3-5 16:05:33 '; type WaveGenerator ports signal out output; end; icon bg bottom figures rectangle 368.1 144 399.9 176 color 0 fill 15132390; line 372.1 147.9 371.9 174.2 color 0 fill 0; line 369.9 172.1 395.9 172.1 color 0 fill 0; line 372.1 172.1 376 172.1 376 160 color 16711680 fill 0; line 384 160 376 160 384 160 color 16711680 fill 0; line 384 172.1 384 160 384 172.1 color 16711680 fill 0; line 392 160 392 172.1 392 160 color 16711680 fill 0; line 395.9 160.1 391.7 160.1 color 16711680 fill 0; line 384 172.1 392 172.1 color 16711680 fill 0; end; implementation eq parameters real amplitude = -3.4; // amplitude of the wave variables real global omega; // angular frequency of the wave 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 + pi)); output = if( s == 0 ) then amplitude else (amplitude / 2) * (s + 1) end; implementation_end; Square3 448 336 description ' 4.0 1 False Signal\Sources\WaveGenerator-Square.emx 2009-3-5 16:05:33 '; type WaveGenerator ports signal out output; end; icon bg bottom figures rectangle 432.1 320 463.9 352 color 0 fill 15132390; line 436.1 323.9 435.9 350.2 color 0 fill 0; line 433.9 348.1 459.9 348.1 color 0 fill 0; line 436.1 348.1 440 348.1 440 336 color 16711680 fill 0; line 448 336 440 336 448 336 color 16711680 fill 0; line 448 348.1 448 336 448 348.1 color 16711680 fill 0; line 456 336 456 348.1 456 336 color 16711680 fill 0; line 459.9 336.1 455.7 336.1 color 16711680 fill 0; line 448 348.1 456 348.1 color 16711680 fill 0; end; implementation eq parameters real amplitude = 3.4; // amplitude of the wave variables real global omega; // angular frequency of the wave 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 - pi/2)); output = if( s == 0 ) then amplitude else (amplitude / 2) * (s + 1) end; implementation_end; Submodel2 512 216 description '4.0 Template\Submodel-Equation.emx 1 False 2007-11-1 22:32:1 False '; type 'Submodel-Equation' ports signal in angle; signal out a; signal out b; 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 = -sign (cos (p*angle)); eventa = event(a); b = sign (sin (p*angle)); eventb = event(b); implementation_end; end; connections Cycloid\output -> Integrate\input; I2\p <= OneJunction3\p; Integrate\output -> Submodel2\angle; MGY_a\p2 => OneJunction3\p; MGY_b\p2 => OneJunction3\p; MSe_a\p => OneJunction1\p; MSe_b\p => OneJunction2\p; OneJunction1\p => I\p; OneJunction1\p => MGY_a\p1; OneJunction1\p => R\p; OneJunction2\p => I1\p; OneJunction2\p => MGY_b\p1; OneJunction2\p => R1\p; OneJunction3\flow -> Splitter1\input; OneJunction3\p => OneJunction\p; RotorAngle\output_a -> MGY_a\r; RotorAngle\output_b -> MGY_b\r; RotorAngle\output_d -> Se\effort; Se\p => OneJunction3\p; Splitter1\output -> RotorAngle\omega; Square\output -> PlusMinus1\plus; Square1\output -> PlusMinus2\plus; Square2\output -> PlusMinus1\plus; Square3\output -> PlusMinus2\plus; Submodel2\a -> MSe_a\effort; Submodel2\b -> MSe_b\effort; end; implementation_end; ]]> Experiment 1 4.8 Submodel2\max_a m/s2 0 u_max V 0 I1\state_initial 0 I2\state_initial 0 I\state_initial 0 RotorAngle\angle_initial rad 0 time I2\p.e I2\p.f RotorAngle\angle omega Submodel2\c MSe_a\effort MSe_b\effort Submodel2\s 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 true false 0.0 5.207213548315313 true 3 -10.0 10.0 true 2 -0.05 0.05 true 2 3355111 1 3355111 0 true 1 1 1 true true time true I2\p.e 6076255 1 6076255 0 true 1 1 1 true true time true 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 5.207213548315313 true 3 -0.19999999999999993 0.8 true 2 3355111 1 3355111 0 true 1 1 1 true true time true RotorAngle\angle 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 5.207213548315313 true 3 -50.0 450.0 true 1 3355111 1 3355111 0 true 1 1 1 true true time true omega true 0 16777215 GraphPlot 4 false 16777215 true true 15780518 12624260 0 10 10 10 false 16777215 true 1 Plot 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 5.207213548315313 true 3 -2.5 2.5 true 2 0.0 10.0 true 2 0.0 10.0 true 2 0.0 10.0 true 2 3355111 1 3355111 0 true 1 1 1 true true time true Submodel2\c 6076255 1 6076255 0 true 1 1 1 true true time true MSe_a\effort 12553035 1 12553035 0 true 1 1 1 true true time true MSe_b\effort 15086320 1 15086320 0 true 1 1 1 true true time true Submodel2\s true 0 16777215 1 true Window 1 0 1 2 3 Base 2 true Window 2 2 4 StripChart 0.130729 0.114815 0.9375 0.896296 0 0.0259259 1 1 0.0 20.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 10 false true true false true 0 0.0 true MultipleRun true UseEndValue 0.001 BroydonFletcherGoldfarbShanno true true true true false 1.0