From 91f9a21b237b009f9186f11d33d845e9fd0af9c3 Mon Sep 17 00:00:00 2001 From: Wouter Horlings Date: Thu, 30 Jul 2020 10:19:32 +0200 Subject: [PATCH] Update library --- implementation/library/Motor/SG90.emx | 15 + implementation/library/Motor/stepper.emx | 924 ++++++++++++++++++ implementation/library/Motor/stepper2.emx | 22 + .../library/Motor/stepper_control.emx | 26 +- .../library/Motor/stepper_model.emx | 12 +- 5 files changed, 986 insertions(+), 13 deletions(-) create mode 100644 implementation/library/Motor/SG90.emx create mode 100644 implementation/library/Motor/stepper.emx create mode 100644 implementation/library/Motor/stepper2.emx diff --git a/implementation/library/Motor/SG90.emx b/implementation/library/Motor/SG90.emx new file mode 100644 index 0000000..414bf76 --- /dev/null +++ b/implementation/library/Motor/SG90.emx @@ -0,0 +1,15 @@ + + + + + + + 4.8 +1 + Motor\SG90.emx + 2020-7-27 10:46:51 + +'; type Submodel ports signal in effort; power out p; end; implementation bg submodels GY1 592 296 description ' 4.2 1 False Bond Graph\GY.emx 2011-11-29 15:53:45 '; type GY ports power in p1; power out p2; restrictions causality constraint equal p1 p2; end; icon bg bottom figures text 'GY' 592 296 color 0 18 bold; end; implementation eq parameters real r = 0.4; equations p1.e = r * p2.f; p2.e = r * p1.f; implementation_end; I 536 352 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' 536 352 color 0 18 bold; end; implementation eq parameters real i = 0.1 {mH}; equations state = int(p.e); p.f = state / i; implementation_end; Integrate 704 400 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 688 384 720 416 color 0 fill 15132390; text '∫' 704 400.3 color 16711680 'Lucida Sans' 21 italic; end; implementation eq parameters real initial = 0; // initial value equations output = int (input, initial); implementation_end; MSe 456 296 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' 456 296 color 0 18 bold; end; implementation eq variables real flow; equations p.e = effort; flow = p.f; implementation_end; plug effort 536 488; plug p 744 296; OneJunction1 536 296 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports power knot duplicatable none p [1]; signal knot out flow [1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 536 296 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction2 704 296 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports power knot duplicatable none p [1]; signal knot out flow [1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 704 296 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; PD 456 400 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 440 384 472 416 color 0 fill 15132390; text 'PD' 456.5 400.1 color 16711680 18 bold; end; implementation eq parameters real kp = 1.0 {}; // Proportional gain real tauD = 1.0 {s}; // Derivative time constant: tauD > 0 real beta = 0.1 {}; // Tameness constant: 0 < beta << 1 variables real state, rate; equations rate = (kp * error - output) / (beta * tauD); state = int (rate); output = state + kp * error / beta; implementation_end; PlusMinus1 536 400 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 528 392 544 408 color 0 fill 16777215; end; implementation eq equations output = sum (collect (plus)) - sum (collect (minus)); implementation_end; R 536 240 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' 536 240 color 0 18 bold; end; implementation eq parameters real r = 7.84 {ohm}; equations p.e = r * p.f; implementation_end; TF1 648 296 description ' 4.2 1 False Bond Graph\TF.emx 2011-11-29 16:43:47 '; type TF ports power in p1; power out p2; restrictions causality constraint not_equal p1 p2; end; icon bg bottom figures text 'TF' 648 296 color 0 18 bold; end; implementation eq parameters real r = 120; equations p1.e = r * p2.e; p2.f = r * p1.f; implementation_end; end; connections effort -> PlusMinus1\plus; GY1\p2 => TF1\p1; Integrate\output -> PlusMinus1\minus; MSe\p => OneJunction1\p; OneJunction1\p => GY1\p1; OneJunction1\p => I\p; OneJunction1\p => R\p; OneJunction2\flow -> Integrate\input; OneJunction2\p => p; PD\output -> MSe\effort; PlusMinus1\output -> PD\error; TF1\p2 => OneJunction2\p; end; implementation_end; ]]> + + + diff --git a/implementation/library/Motor/stepper.emx b/implementation/library/Motor/stepper.emx new file mode 100644 index 0000000..342d3b1 --- /dev/null +++ b/implementation/library/Motor/stepper.emx @@ -0,0 +1,924 @@ + + + + + + 4.8 +0 + False + Motor\stepper.emx + 2020-7-22 10:04:43 + +'; + type Mainmodel + end; + implementation bg + submodels + stepper 464 224 + description ' + + 4.8 +1 + False + True + Motor\stepper2.emx + 2020-7-22 10:04:39 + +'; + type Submodel + ports + signal in angle; + rotation out p; + end; + icon bg bottom + figures + rectangle 432 208 496 240 color 0 fill 15132390; + text 'name' 464 224 color 0 'Clear Sans' 16; + 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 / (i+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 406.3 216; + plug p 896.6 216; + OneJunction 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; + 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; + 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; + 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; + 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 +if time < 10 then + a = u_max * -sign (cos (p*angle)); + eventa = event(a); + b = u_max * sign (sin (p*angle)); + eventb = event(b); + current_angle = angle; +else + a = u_max * -sign (cos (p*current_angle)); + eventa = event(a); + b = u_max * sign (sin (p*current_angle)); + eventb = event(b); +end; + + + + + implementation_end; + end; + connections + angle -> Submodel2\angle; + I2\p <= OneJunction3\p; + MGY_a\p2 => OneJunction3\p; + MGY_b\p2 => OneJunction3\p; + MSe_a\p => OneJunction1\p; + MSe_b\p => OneJunction2\p; + OneJunction\p => 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; + OneJunction3\p => R2\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; + Submodel2\a -> MSe_a\effort; + Submodel2\b -> MSe_b\effort; + end; + implementation_end; + end; + connections + end; + implementation_end; +]]> + + + + + + + Experiment 1 + + + + 4.8 + + + + + + angle_step + 0 + + + detentTorque + 0 + + + fluxLinkage + 0 + + + I_phase + 0 + + + R_phase + 0 + + + RotorInertia + 0 + + + Submodel2\max_a + m/s2 + 0 + + + u_max + V + 0 + + + + + Stepper\I1\state_initial + 0 + + + Stepper\I2\state_initial + 0 + + + Stepper\I\state_initial + 0 + + + Stepper\RotorAngle\angle_initial + 0 + + + + + + time + + + + GraphPlot + + 1 + false + 16777215 + true + + + true + 15780518 + 12624260 + 0 + 10 + 10 + 10 + false + + 16777215 + true + 1 + Stepper + 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 + 10.0 + true + 3 + + + + + + 0.0 + 10.0 + true + 2 + + + + + + + + 3355111 + 1 + 3355111 + 0 + true + 1 + 1 + 1 + true + + true + time + + + + + true + 0 + 16777215 + + + + + + 1 + true + Window 1 + 0 + + 1 + + Base + + + + +0.130729 0.114815 0.9375 0.896296 + + + + + + 0.0 + 10.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 + 0.01 + false + + + RungeKutta8 + false + 0.001 + false + 1.0 + 1.0e-6 + 1.0e-6 + 0.9 + 0.33 + 6.0 + 0.0 + false + 100000 + false + 1000 + + + RungeKuttaFehlberg + false + 0.001 + false + 1.0 + 1.0e-6 + 1.0e-6 + + + VodeAdams + false + 0.001 + false + 1.0 + 1.0e-6 + 1.0e-6 + true + true + + + BDFMethod + 1.0e-5 + 1.0e-5 + 1.0e-5 + 1.0e-5 + false + 0.001 + false + 1.0 + + + MeBDFiMethod + 1.0e-5 + 1.0e-5 + 1.0e-5 + 1.0e-5 + false + 0.001 + false + 1.0 + + 8 + + + + 10 + false + true + true + false + true + 0 + 0.0 + true + MultipleRun + true + + UseEndValue + 0.001 + BroydonFletcherGoldfarbShanno + + + + + true + true + true + true + + + false + + + + + + + + + + + diff --git a/implementation/library/Motor/stepper2.emx b/implementation/library/Motor/stepper2.emx new file mode 100644 index 0000000..91d8129 --- /dev/null +++ b/implementation/library/Motor/stepper2.emx @@ -0,0 +1,22 @@ + + + + + + + + + + + + 4.8 +1 + False + True + Motor\stepper2.emx + 2020-7-22 10:04:39 + +'; type Submodel ports signal in angle; rotation out p; end; icon bg bottom figures rectangle 432 208 496 240 color 0 fill 15132390; text 'name' 464 224 color 0 'Clear Sans' 16; 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 / (i+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 406.3 216; plug p 896.6 216; OneJunction 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; 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; 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; 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; 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 if time < 10 then a = u_max * -sign (cos (p*angle)); eventa = event(a); b = u_max * sign (sin (p*angle)); eventb = event(b); current_angle = angle; else a = u_max * -sign (cos (p*current_angle)); eventa = event(a); b = u_max * sign (sin (p*current_angle)); eventb = event(b); end; implementation_end; end; connections angle -> Submodel2\angle; I2\p <= OneJunction3\p; MGY_a\p2 => OneJunction3\p; MGY_b\p2 => OneJunction3\p; MSe_a\p => OneJunction1\p; MSe_b\p => OneJunction2\p; OneJunction\p => 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; OneJunction3\p => R2\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; Submodel2\a -> MSe_a\effort; Submodel2\b -> MSe_b\effort; end; implementation_end; ]]> + + + diff --git a/implementation/library/Motor/stepper_control.emx b/implementation/library/Motor/stepper_control.emx index f912944..eb44165 100644 --- a/implementation/library/Motor/stepper_control.emx +++ b/implementation/library/Motor/stepper_control.emx @@ -1,15 +1,27 @@ - + + + + + + - + 4.8 1 - Motor\stepper_control.emx - 2020-7-22 15:25:26 + Z:\home\wouter\Documents\studie\ma\mahd\implementation\library\Motor\stepper_control.emx + 2020-7-23 13:09:57 -'; 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; ]]> - - + + parameters + real max_acceleration = 100 {rad/s2}; + real max_velocity = 25 {rad/s}; + real initial_velocity = 0 {rad/s}; + real initial_angle = 0 {rad}; + +'; type Submodel ports signal in setpoint {rad} ; signal out output {rad} ; end; icon bg bottom figures rectangle 648 576 760 608 color 0 fill 15132390; text 'name' 704 592 color 0 'Clear Sans' 16; 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 global initial_velocity; // initial value equations output = int (input, initial_velocity); 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 global max_acceleration {rad/s2}; equations output = limit (input, -max_acceleration, max_acceleration); 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 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 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 global initial_angle; // initial value equations output = int (input, initial_angle); 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 global max_velocity {rad/s}; equations output = limit (input, -max_velocity, max_velocity); 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; ]]> + + diff --git a/implementation/library/Motor/stepper_model.emx b/implementation/library/Motor/stepper_model.emx index 8be3bf6..e4eb972 100644 --- a/implementation/library/Motor/stepper_model.emx +++ b/implementation/library/Motor/stepper_model.emx @@ -1,13 +1,13 @@ - + - + 4.8 1 Motor\stepper_model.emx - 2020-7-22 15:25:37 + 2020-7-23 10:54:47 parameters @@ -27,7 +27,7 @@ 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; ]]> - - +'; 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}; variables 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); 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; ]]> + +