4.80FalseMotor\stepper_103H5208.emx2020-7-21 18:09:21parameters
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.01FalseSignal\Sources\SignalGenerator-Cycloid.emx2007-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.21FalseBond Graph\I.emx2011-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.21FalseBond Graph\I.emx2011-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.21FalseBond Graph\I.emx2011-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.31FalseSignal\Block Diagram\Integrate.emx2013-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.21FalseBond Graph\MGY.emx2011-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.21FalseBond Graph\MGY.emx2011-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.21FalseBond Graph\MSe.emx2011-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.21FalseBond Graph\MSe.emx2011-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.21FalseBond Graph\OneJunction.emx2011-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.21FalseBond Graph\OneJunction.emx2011-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.21FalseBond Graph\OneJunction.emx2011-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.21FalseBond Graph\OneJunction.emx2011-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.01FalseSignal\Block Diagram\PlusMinus.emx2007-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.01FalseSignal\Block Diagram\PlusMinus.emx2007-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.21FalseBond Graph\R.emx2011-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.21FalseBond Graph\R.emx2011-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.0Template\Submodel-Equation.emx1False2007-11-1 22:32:1False';
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.21FalseBond Graph\MSe.emx2011-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.0Signal\Block Diagram\Splitter.emx2008-01-17 11:28:291False';
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.01FalseSignal\Sources\WaveGenerator-Square.emx2009-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.01FalseSignal\Sources\WaveGenerator-Square.emx2009-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.01FalseSignal\Sources\WaveGenerator-Square.emx2009-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.01FalseSignal\Sources\WaveGenerator-Square.emx2009-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.0Template\Submodel-Equation.emx1False2007-11-1 22:32:1False';
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 14.8Submodel2\max_am/s20u_maxV0I1\state_initial0I2\state_initial0I\state_initial0RotorAngle\angle_initialrad0timeI2\p.eI2\p.fRotorAngle\angleomegaSubmodel2\cMSe_a\effortMSe_b\effortSubmodel2\sGraphPlot1false16777215truetrue15780518126242600101010false16777215true1modeltrueArial12344000000Arial12344000000Arial10344000000Arial12344000000truetruefalse0.05.207213548315313true3-10.010.0true2-0.050.05true23355111133551110true111truetruetimetrueI2\p.e6076255160762550true111truetruetimetrueI2\p.ftrue016777215GraphPlot2false16777215truetrue15780518126242600101010false16777215true1model(2)trueArial12344000000Arial12344000000Arial10344000000Arial12344000000truetruefalse0.05.207213548315313true3-0.199999999999999930.8true23355111133551110true111truetruetimetrueRotorAngle\angletrue016777215GraphPlot3false16777215truetrue15780518126242600101010false16777215true1model(1)trueArial12344000000Arial12344000000Arial10344000000Arial12344000000truetruefalse0.05.207213548315313true3-50.0450.0true13355111133551110true111truetruetimetrueomegatrue016777215GraphPlot4false16777215truetrue15780518126242600101010false16777215true1PlottrueArial12344000000Arial12344000000Arial10344000000Arial12344000000truetruefalse0.05.207213548315313true3-2.52.5true20.010.0true20.010.0true20.010.0true23355111133551110true111truetruetimetrueSubmodel2\c6076255160762550true111truetruetimetrueMSe_a\effort125530351125530350true111truetruetimetrueMSe_b\effort150863201150863200true111truetruetimetrueSubmodel2\strue0167772151trueWindow 10123Base2trueWindow 224StripChart
0.130729 0.114815 0.9375 0.896296
0 0.0259259 1 1
0.020.0falsefalsefalsefalse0.11.0e-61.0e-7falsetrueEuler0.01falseBackwardEuler1.0e-51.0e-51.0e-51.0e-50.011.0AdamsBashforth0.01falseRungeKutta20.01falseRungeKutta41.0e-4falseRungeKutta8false0.0false0.01.0e-61.0e-60.90.336.00.0false100000false1000RungeKuttaFehlbergfalse0.0false0.01.0e-61.0e-6VodeAdamsfalse0.0false0.01.0e-61.0e-6falsetrueBDFMethod1.0e-51.0e-51.0e-51.0e-5false0.0false0.0MeBDFiMethod1.0e-51.0e-51.0e-51.0e-5false0.0false0.0810falsetruetruefalsetrue00.0trueMultipleRuntrueUseEndValue0.001BroydonFletcherGoldfarbShannotruetruetruetruefalse1.0