4.8 0 False C:\users\wouter\My Documents\studie\ma\mahd\implementation\SCARA\02_physics\scara_physics.emx 2020-7-15 11:18:58 parameters real A = 0.05 {m}; real B = 0.05 {m}; variables real J0_1_BF1[2]; real J1_2_BF1[2]; real J1_2_BF2[2]; real EE1_BF2[2]; initialequations J0_1_BF1 = [A/2;0]; J1_2_BF1 = [-A/2;0]; J1_2_BF2 = [B/2;0]; EE1_BF2 = [-B/2;0]; '; type Mainmodel end; implementation bg submodels COM1 424 584 description '4.81parameters real mass = 1 {kg};'; type Submodel ports power in p [2,1]; signal in mass {kg} ; end; icon bg ellipse bottom figures ellipse 416 576 432 592 color 0 fill 15132390; line 424 576 424 592 color 0 fill 15132390; line 416 584 432 584 color 0 fill 15132390; end; implementation bg submodels Gain 368 408 description '4.01False Signal\Block Diagram\Gain.emx 2007-9-26 12:15:12 '; type Gain ports signal in input; signal out output [2,1]; end; icon bg bottom figures rectangle 352.1 392 383.9 424 color 0 fill 15132390; text 'K' 368 408 color 16711680 16 bold; end; implementation eq equations output = [0;-g_n] * input; implementation_end; I 248 520 description '4.01False Bond Graph\2D\I-2.emx 2007-9-25 12:7:37 '; type 'I-2' ports power in p [2,1]; signal out state [2,1]; signal in mass {kg} ; restrictions causality preferred in p; end; icon bg bottom figures text 'I' 248 520 color 0 18 bold; end; implementation eq equations state = int(p.e); p.f = inverse ([mass,0;0,mass]) * state; implementation_end; plug p 304 468; plug mass 208 408; OneJunction2 304 520 description '4.01False Bond Graph\OneJunction.emx 2007-9-27 9:51:18 '; knot OneJunction ports power knot duplicatable none p [2,1]; signal knot out flow [2,1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 304 520 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; Sg 368 520 description '4.01False Bond Graph\2D\MSe-2.emx 2007-9-25 12:7:58 '; type 'MSe-2' ports power out p [2,1]; signal in effort [2,1]; restrictions causality fixed out p; end; icon bg bottom figures text 'MSe' 368 520 color 0 18 bold; end; implementation eq variables real flow[2]; equations p.e = effort; flow = p.f; implementation_end; Splitter1 248 408 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 244.8 404.8 251.2 411.2 color -1 fill 0; ellipse 243.7 403.7 252.3 412.3 color -1; terminals input 248 408 fixed; end; implementation eq equations collect (output) = input; implementation_end; end; connections Gain\output -> Sg\effort; I\p <= OneJunction2\p; mass -> Splitter1\input; p => OneJunction2\p; Sg\p => OneJunction2\p; Splitter1\output -> Gain\input; Splitter1\output -> I\mass; end; implementation_end; COM2 824 584 description '4.81parameters real mass = 1 {kg};'; type Submodel ports power in p [2,1]; signal in mass {kg} ; end; icon bg ellipse figures ellipse 816 576 832 592 color 0 fill 15132390; line 824 576 824 592 color 0 fill 15132390; line 816 584 832 584 color 0 fill 15132390; end; implementation bg submodels Gain 368 408 description '4.01False Signal\Block Diagram\Gain.emx 2007-9-26 12:15:12 '; type Gain ports signal in input; signal out output [2,1]; end; icon bg bottom figures rectangle 352.1 392 383.9 424 color 0 fill 15132390; text 'K' 368 408 color 16711680 16 bold; end; implementation eq equations output = [0;-g_n] * input; implementation_end; I 248 520 description '4.01False Bond Graph\2D\I-2.emx 2007-9-25 12:7:37 '; type 'I-2' ports power in p [2,1]; signal out state [2,1]; signal in mass {kg} ; restrictions causality preferred in p; end; icon bg bottom figures text 'I' 248 520 color 0 18 bold; end; implementation eq equations state = int(p.e); p.f = inverse ([mass,0;0,mass]) * state; implementation_end; plug p 304 468; plug mass 208 408; OneJunction2 304 520 description '4.01False Bond Graph\OneJunction.emx 2007-9-27 9:51:18 '; knot OneJunction ports power knot duplicatable none p [2,1]; signal knot out flow [2,1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 304 520 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; Sg 368 520 description '4.01False Bond Graph\2D\MSe-2.emx 2007-9-25 12:7:58 '; type 'MSe-2' ports power out p [2,1]; signal in effort [2,1]; restrictions causality fixed out p; end; icon bg bottom figures text 'MSe' 368 520 color 0 18 bold; end; implementation eq variables real flow[2]; equations p.e = effort; flow = p.f; implementation_end; Splitter1 248 408 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 244.8 404.8 251.2 411.2 color -1 fill 0; ellipse 243.7 403.7 252.3 412.3 color -1; terminals input 248 408 fixed; end; implementation eq equations collect (output) = input; implementation_end; end; connections Gain\output -> Sg\effort; I\p <= OneJunction2\p; mass -> Splitter1\input; p => OneJunction2\p; Sg\p => OneJunction2\p; Splitter1\output -> Gain\input; Splitter1\output -> I\mass; end; implementation_end; I 432 176 description ' 4.2 1 False Bond Graph\I.emx 2011-11-29 15:55:55 '; type I ports power in p; signal out state; signal in i; restrictions causality preferred in p; end; icon bg bottom figures text 'I' 432 176 color 0 18 bold; end; implementation eq equations state = int(p.e); p.f = state / i; implementation_end; I1 824 176 description ' 4.2 1 False Bond Graph\I.emx 2011-11-29 15:55:55 '; type I ports power in p; signal out state; signal in i; restrictions causality preferred in p; end; icon bg bottom figures text 'I' 824 176 color 0 18 bold; end; implementation eq equations state = int(p.e); p.f = state / i; implementation_end; inverse_kinematics 304 32 description ' 4.8 SCARA\inverse_kinematics_v1.emx 1 False 2020-7-10 12:26:18 False '; type 'Submodel-Equation' ports signal in input [2,1] {m} ; signal out angle1 {rad} ; signal out angle2 {rad} ; signal out a {rad} ; signal out b {rad} ; signal out c {rad} ; signal out phi {rad} ; end; implementation eq parameters real A_length = 0.065 {m}; // length of first arm real B_length = 0.05 {m}; // length of second arm real to_rad = 1 {rad}; variables real x {m}, y {m}; real C_length {m}; // length to x and y. real angle_sum {rad}; // test angle equations x = input[1]; y = input[2]; phi = atan2(y, x); C_length = sqrt(x^2 + y^2); a = arccos ((B_length^2 + C_length^2 - A_length^2) / (2 * B_length * C_length)); b = arccos ((A_length^2 + C_length^2 - B_length^2) / (2 * A_length * C_length)); c = arccos ((A_length^2 + B_length^2 - C_length^2) / (2 * A_length * B_length)); angle1 = b + phi; angle2 = angle1 - pi * to_rad + c; implementation_end; MSe1 624 192 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' 624 192 color 0 18 bold; end; implementation eq variables real flow; equations p.e = effort; flow = p.f; implementation_end; MSe2 248 176 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' 248 176 color 0 18 bold; end; implementation eq variables real flow; equations p.e = effort; flow = p.f; implementation_end; MXTF 352.3 288 description ' 4.8 1 False Z:\home\wouter\Documents\20-sim\library\Bond Graph\2D\MXTF-2.emx 2020-7-14 17:06:13 True '; type 'TF-2' ports power in p1; power out p2 [2,1]; signal in p [2,1]; restrictions causality constraint not_equal p1 p2; causality fixed in p2; causality fixed out p1; end; icon bg bottom figures text 'MXTF' 352.3 288 color 0 18 bold; end; implementation eq variables real r[2]; equations r = [-p[2];p[1]]; p1.e = transpose (r) * p2.e; p2.f = r * p1.f;implementation_end; OneJunction 424 368 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports power knot duplicatable none p [2,1]; signal knot out flow [2,1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 424 368 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction1 424 520 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports power knot duplicatable none p [2,1]; signal knot out flow [2,1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 424 520 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction10 824 232 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' 824 232 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction11 984 512 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports power knot duplicatable none p [2,1]; signal knot out flow [2,1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 984 512 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction12 704 368 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports power knot duplicatable none p [2,1]; signal knot out flow [2,1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 704 368 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction3 432 232 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' 432 232 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction5 272.3 368 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports power knot duplicatable none p [2,1]; signal knot out flow [2,1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 272.3 368 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction6 272 520 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports power knot duplicatable none p [2,1]; signal knot out flow [2,1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 272 520 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction7 824 368 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports power knot duplicatable none p [2,1]; signal knot out flow [2,1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 824 368 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction8 824 520 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports power knot duplicatable none p [2,1]; signal knot out flow [2,1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 824 520 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; OneJunction9 984 368 description ' 4.2 1 False Bond Graph\OneJunction.emx 2011-11-29 16:17:51 '; knot OneJunction ports power knot duplicatable none p [2,1]; signal knot out flow [2,1]; restrictions causality constraint one_out p; end; icon bg figures text '1' 984 368 color 0 18 bold; end; implementation eq equations sum (direct (p.e)) = 0; equal (collect (p.f)); flow = first (p.f); implementation_end; PID 248 112 description ' 4.0 1 False Signal\Control\PID Control\Continuous\PID.emx 2008-1-17 10:49:30 '; type PID ports signal in error; signal out output; end; icon bg bottom figures rectangle 232 96 264 128 color 0 fill 15132390; text 'PID' 248 111.5 color 16711680 18 bold; end; implementation eq parameters real kp = 0.05 {}; // Proportional gain real tauD = 1.0 {s}; // Derivative time constant: tauD > 0 real beta = 0.001 {}; // Tameness constant: 0 < beta << 1 real tauI = 1.0 {s}; // Integral time constant: tauI > 0 variables real pdout, pdrate, pdstate; real pirate, pistate; equations pdrate = (kp * error - pdout) / (beta * tauD); pdstate = int (pdrate); pdout = pdstate + (kp * error / beta); pirate = pdout / tauI; pistate = int (pirate); output = pistate + pdout; implementation_end; PID1 624 136 description ' 4.0 1 False Signal\Control\PID Control\Continuous\PID.emx 2008-1-17 10:49:30 '; type PID ports signal in error; signal out output; end; icon bg bottom figures rectangle 608 120 640 152 color 0 fill 15132390; text 'PID' 624 135.5 color 16711680 18 bold; end; implementation eq parameters real kp = 0.02 {}; // Proportional gain real tauD = 1.0 {s}; // Derivative time constant: tauD > 0 real beta = 0.001 {}; // Tameness constant: 0 < beta << 1 real tauI = 0.05 {s}; // Integral time constant: tauI > 0 variables real pdout, pdrate, pdstate; real pirate, pistate; equations pdrate = (kp * error - pdout) / (beta * tauD); pdstate = int (pdrate); pdout = pdstate + (kp * error / beta); pirate = pdout / tauI; pistate = int (pirate); output = pistate + pdout; implementation_end; PlusMinus1 632 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 624 392 640 408 color 0 fill 16777215; end; implementation eq equations output = sum (collect (plus)) - sum (collect (minus)); implementation_end; PlusMinus2 304 112 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 296 104 312 120 color 0 fill 16777215; end; implementation eq equations output = sum (collect (plus)) - sum (collect (minus)); implementation_end; PlusMinus3 568 136 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 560 128 576 144 color 0 fill 16777215; end; implementation eq equations output = sum (collect (plus)) - sum (collect (minus)); implementation_end; R1 624 272 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' 624 272 color 0 18 bold; end; implementation eq parameters real r = 0.001; equations p.e = r * p.f; implementation_end; R2 248 280 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' 248 280 color 0 18 bold; end; implementation eq parameters real r = 0.001; equations p.e = r * p.f; implementation_end; rectanglepath 64 32 description ' 4.8 setpoint\rectanglepath.emx 1 False 2020-7-10 12:30:38 False '; type 'Submodel-Equation' ports signal out output [2,1]; end; implementation eq /* This will generate coordinates for the box that has to be drawn */ parameters real w = 0.07{m} ; real h = 0.05 {m}; real t = 1 {s}; real origin[2] = [0.01,0.03]{m}; variables real v {m/s}; real t_w {s}; real t_h {s}; real period {s}; real test1, test2, test3; initialequations v = (2*w + 2*h)/t; t_w = w / v; t_h = h / v; equations period = floor(time / t) * t; output[1] = v*(ramp(period+t_h) - ramp(period + t_w+t_h) - ramp(period + t_w + t_h + t_h)) + origin[1]; output[2] = v*(ramp(period) - ramp(period + t_h) - ramp(period + t_h + t_w) + ramp(period + 2 * t_h + t_w))+ origin[2]; implementation_end; RTF 424 456 description ' 4.8 1 False Bond Graph\2D\RTF-2.emx 2020-7-14 12:43:04 '; type 'TF-2' ports power in p1 [2,1]; power out p2 [2,1]; signal in angle {rad} ; restrictions causality constraint not_equal p1 p2; end; icon bg bottom figures text 'RTF' 424 456 color 0 18 bold; end; implementation eq /* 2D rotation transformer. Takes an angle as input and then rotates the dimensions */ variables real r[2,2]; equations r = [cos(angle), -sin(angle); sin(angle), cos(angle)]; p1.e = transpose (r) * p2.e; p2.f = r * p1.f; implementation_end; RTF1 632 368 description ' 4.8 1 False Bond Graph\2D\RTF-2.emx 2020-7-14 12:43:04 '; type 'TF-2' ports power in p1 [2,1]; power out p2 [2,1]; signal in angle {rad} ; restrictions causality constraint not_equal p1 p2; end; icon bg bottom figures text 'RTF' 632 368 color 0 18 bold; end; implementation eq /* 2D rotation transformer. Takes an angle as input and then rotates the dimensions */ variables real r[2,2]; equations r = [cos(angle), -sin(angle); sin(angle), cos(angle)]; p1.e = transpose (r) * p2.e; p2.f = r * p1.f; implementation_end; RTF2 272 432 description ' 4.8 1 False Bond Graph\2D\RTF-2.emx 2020-7-14 12:43:04 '; type 'TF-2' ports power in p1 [2,1]; power out p2 [2,1]; signal in angle {rad} ; restrictions causality constraint not_equal p1 p2; end; icon bg bottom figures text 'RTF' 272 432 color 0 18 bold; end; implementation eq /* 2D rotation transformer. Takes an angle as input and then rotates the dimensions */ variables real r[2,2]; equations r = [cos(angle), -sin(angle); sin(angle), cos(angle)]; p1.e = transpose (r) * p2.e; p2.f = r * p1.f; implementation_end; RTF3 824 432 description ' 4.8 1 False Bond Graph\2D\RTF-2.emx 2020-7-14 12:43:04 '; type 'TF-2' ports power in p1 [2,1]; power out p2 [2,1]; signal in angle {rad} ; restrictions causality constraint not_equal p1 p2; end; icon bg bottom figures text 'RTF' 824 432 color 0 18 bold; end; implementation eq /* 2D rotation transformer. Takes an angle as input and then rotates the dimensions */ variables real r[2,2]; equations r = [cos(angle), -sin(angle); sin(angle), cos(angle)]; p1.e = transpose (r) * p2.e; p2.f = r * p1.f; implementation_end; RTF4 984 424 description ' 4.8 1 False Bond Graph\2D\RTF-2.emx 2020-7-14 12:43:04 '; type 'TF-2' ports power in p1 [2,1]; power out p2 [2,1]; signal in angle {rad} ; restrictions causality constraint not_equal p1 p2; end; icon bg bottom figures text 'RTF' 984 424 color 0 18 bold; end; implementation eq /* 2D rotation transformer. Takes an angle as input and then rotates the dimensions */ variables real r[2,2]; equations r = [cos(angle), -sin(angle); sin(angle), cos(angle)]; p1.e = transpose (r) * p2.e; p2.f = r * p1.f; implementation_end; Sf 192 520 description '4.01False Bond Graph\2D\Sf-2.emx 2007-9-25 12:7:5 '; type 'Sf-2' ports power out p [2,1]; restrictions causality fixed in p; end; icon bg bottom figures text 'Sf' 192 520 color 0 18 bold; end; implementation eq parameters real flow[2,1] = [0.0; 0.0]; variables real effort [2]; equations p.f = flow; effort = p.e; implementation_end; Sf1 152 232 description ' 4.2 1 False Bond Graph\Sf.emx 2011-11-29 16:38:03 '; type Sf ports power out p; restrictions causality fixed in p; end; icon bg bottom figures text 'Sf' 152 232 color 0 18 bold; end; implementation eq parameters real flow = 0; variables real effort; equations p.f = flow; effort = p.e; implementation_end; Splitter1 384 400 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 380.8 396.8 387.2 403.2 color -1 fill 0; ellipse 379.7 395.7 388.3 404.3 color -1; terminals input 384 400 fixed; end; implementation eq equations collect (output) = input; implementation_end; Splitter2 800 400 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 796.8 396.8 803.2 403.2 color -1 fill 0; ellipse 795.7 395.7 804.3 404.3 color -1; terminals input 800 400 fixed; end; implementation eq equations collect (output) = input; implementation_end; Splitter3 304 400 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 300.8 396.8 307.2 403.2 color -1 fill 0; ellipse 299.7 395.7 308.3 404.3 color -1; terminals input 304 400 fixed; end; implementation eq equations collect (output) = input; implementation_end; Splitter4 704 400 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 700.8 396.8 707.2 403.2 color -1 fill 0; ellipse 699.7 395.7 708.3 404.3 color -1; terminals input 704 400 fixed; end; implementation eq equations collect (output) = input; implementation_end; Submodel3 352 480 description '4.0 Template\Submodel-Equation.emx 1 False 2007-11-1 22:32:1 False '; type 'Submodel-Equation' ports signal in angle_velocity {rad/s} ; signal out angle {rad} ; signal in velocity [2,1] {m/s} ; signal out position [2,1] {m} ; signal out mass {kg} ; signal out angular_momentum {N.m.s} ; signal out joint1 [2,1]; signal out joint2 [2,1]; end; implementation eq /* Equation Submodel Enter your equations here. You can use the Toolbar buttons at the top ( Add , f(x) etc. ). */ parameters real density = 1400 {kg/m3}; real dimension[3] = [0.005;0.065;0.01] {m}; real initial_position[2] = [0.0325;0] {m}; real initial_angle = 0 {rad}; variables real body_angle[3]; real body_position[3]; real body_size[3]; real moment[3]; initialequations mass = dimension[1] * dimension[2] * dimension[3] * density; moment[1] = mass/12 * ( dimension[2]^2 + dimension[3]^2); moment[2] = mass/12 * ( dimension[1]^2 + dimension[3]^2); moment[3] = mass/12 * ( dimension[1]^2 + dimension[2]^2); angular_momentum = moment[1]; equations angle = int(angle_velocity,initial_angle); body_angle = [angle;0;0]; position = int(velocity,initial_position); body_position = [0; position[1];position[2]]; joint1=[-dimension[2]/2;0]; joint2=[dimension[2]/2;0]; implementation_end; Submodel4 744 480 description '4.0 Template\Submodel-Equation.emx 1 False 2007-11-1 22:32:1 False '; type 'Submodel-Equation' ports signal in angle_velocity {rad/s} ; signal out angle {rad} ; signal in velocity [2,1] {m/s} ; signal out position [2,1] {m} ; signal out mass {kg} ; signal out angular_momentum {N.m.s} ; signal out joint1 [2,1]; signal out joint2 [2,1]; end; icon bg figures rectangle 704 464 784 496 color 0 fill 15132390; text 'name' 744 480 color 0 16; end; implementation eq /* Equation Submodel Enter your equations here. You can use the Toolbar buttons at the top ( Add , f(x) etc. ). */ parameters real density = 1400 {kg/m3}; real dimension[3] = [0.005;0.05;0.01] {m}; real initial_position[2] = [0.09;0.0] {m}; real initial_angle = 0.0 {rad}; variables real body_angle[3]; real body_position[3]; real body_size[3]; real moment[3]; initialequations mass = dimension[1] * dimension[2] * dimension[3] * density; moment[1] = mass/12 * ( dimension[2]^2 + dimension[3]^2); moment[2] = mass/12 * ( dimension[1]^2 + dimension[3]^2); moment[3] = mass/12 * ( dimension[1]^2 + dimension[2]^2); angular_momentum = moment[1]; equations angle = int(angle_velocity,initial_angle); body_angle = [angle;0;0]; position = int(velocity,initial_position); body_position = [0; position[1];position[2]]; joint1=[-dimension[2]/2;0]; joint2=[dimension[2]/2;0]; implementation_end; TF 504 288 description ' 4.8 1 False Z:\home\wouter\Documents\20-sim\library\Bond Graph\2D\MXTF-2.emx 2020-7-14 16:54:28 True '; type 'TF-2' ports power in p1; power out p2 [2,1]; signal in p [2,1]; restrictions causality constraint not_equal p1 p2; causality fixed in p2; causality fixed out p1; end; icon bg bottom figures text 'MXTF' 504 288 color 0 18 bold; end; implementation eq variables real r[2]; equations r = [-p[2];p[1]]; p1.e = transpose (r) * p2.e; p2.f = r * p1.f;implementation_end; TF2 904 288 description ' 4.8 1 False Z:\home\wouter\Documents\20-sim\library\Bond Graph\2D\MXTF-2.emx 2020-7-14 17:06:13 True '; type 'TF-2' ports power in p1; power out p2 [2,1]; signal in p [2,1]; restrictions causality constraint not_equal p1 p2; causality fixed in p2; causality fixed out p1; end; icon bg bottom figures text 'MXTF' 904 288 color 0 18 bold; end; implementation eq variables real r[2]; equations r = [-p[2];p[1]]; p1.e = transpose (r) * p2.e; p2.f = r * p1.f;implementation_end; TF3 808 288 description ' 4.8 1 False Z:\home\wouter\Documents\20-sim\library\Bond Graph\2D\MXTF-2.emx 2020-7-14 16:54:28 True '; type 'TF-2' ports power in p1; power out p2 [2,1]; signal in p [2,1]; restrictions causality constraint not_equal p1 p2; causality fixed in p2; causality fixed out p1; end; icon bg bottom figures text 'MXTF' 808 288 color 0 18 bold; end; implementation eq variables real r[2]; equations r = [-p[2];p[1]]; p1.e = transpose (r) * p2.e; p2.f = r * p1.f;implementation_end; ZeroJunction 504 368 description ' 4.2 1 False Bond Graph\ZeroJunction.emx 2011-11-29 16:45:16 '; knot ZeroJunction ports power knot duplicatable none p [2,1]; signal knot out effort [2,1]; restrictions causality constraint one_in p; end; icon bg figures text '0' 504 368 color 0 18 bold; end; implementation eq equations sum (direct (p.f)) = 0; equal (collect (p.e)); effort = first (p.e); implementation_end; ZeroJunction1 352.3 368 description ' 4.2 1 False Bond Graph\ZeroJunction.emx 2011-11-29 16:45:16 '; knot ZeroJunction ports power knot duplicatable none p [2,1]; signal knot out effort [2,1]; restrictions causality constraint one_in p; end; icon bg figures text '0' 352.3 368 color 0 18 bold; end; implementation eq equations sum (direct (p.f)) = 0; equal (collect (p.e)); effort = first (p.e); implementation_end; ZeroJunction2 904 368 description ' 4.2 1 False Bond Graph\ZeroJunction.emx 2011-11-29 16:45:16 '; knot ZeroJunction ports power knot duplicatable none p [2,1]; signal knot out effort [2,1]; restrictions causality constraint one_in p; end; icon bg figures text '0' 904 368 color 0 18 bold; end; implementation eq equations sum (direct (p.f)) = 0; equal (collect (p.e)); effort = first (p.e); implementation_end; ZeroJunction3 752.3 368 description ' 4.2 1 False Bond Graph\ZeroJunction.emx 2011-11-29 16:45:16 '; knot ZeroJunction ports power knot duplicatable none p [2,1]; signal knot out effort [2,1]; restrictions causality constraint one_in p; end; icon bg figures text '0' 752.3 368 color 0 18 bold; end; implementation eq equations sum (direct (p.f)) = 0; equal (collect (p.e)); effort = first (p.e); implementation_end; ZeroJunction4 624 232 description ' 4.2 1 False Bond Graph\ZeroJunction.emx 2011-11-29 16:45:16 '; knot ZeroJunction ports power knot duplicatable none p [1]; signal knot out effort [1]; restrictions causality constraint one_in p; end; icon bg figures text '0' 624 232 color 0 18 bold; end; implementation eq equations sum (direct (p.f)) = 0; equal (collect (p.e)); effort = first (p.e); implementation_end; ZeroJunction5 248 232 description ' 4.2 1 False Bond Graph\ZeroJunction.emx 2011-11-29 16:45:16 '; knot ZeroJunction ports power knot duplicatable none p [1]; signal knot out effort [1]; restrictions causality constraint one_in p; end; icon bg figures text '0' 248 232 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 I\p <= OneJunction3\p; I1\p <= OneJunction10\p; inverse_kinematics\angle1 -> PlusMinus2\plus; inverse_kinematics\angle2 -> PlusMinus3\plus; inverse_kinematics\input <- rectanglepath\output; MSe1\effort <- PID1\output; MSe1\p => ZeroJunction4\p; MSe2\effort <- PID\output; MXTF\p2 => ZeroJunction1\p; OneJunction\p => RTF\p1; OneJunction\p => ZeroJunction\p; OneJunction\p => ZeroJunction1\p; OneJunction1\flow -> Submodel3\velocity 344 520; OneJunction1\p => COM1\p; OneJunction10\flow -> Submodel4\angle_velocity 728 288 728 424; OneJunction10\p => TF2\p1; OneJunction10\p => TF3\p1; OneJunction3\flow -> Submodel3\angle_velocity 328 264 328 440; OneJunction3\p => MXTF\p1; OneJunction3\p => TF\p1; OneJunction3\p => ZeroJunction4\p; OneJunction5\p => RTF2\p1; OneJunction7\p => RTF3\p1; OneJunction7\p => ZeroJunction2\p; OneJunction7\p => ZeroJunction3\p; OneJunction8\flow -> Submodel4\velocity 744 520; OneJunction8\p => COM2\p; OneJunction9\p => RTF4\p1; PlusMinus1\output -> RTF1\angle; PlusMinus2\output -> PID\error; PlusMinus3\output -> PID1\error; RTF\p2 => OneJunction1\p; RTF1\p2 => OneJunction12\p; RTF2\p2 => OneJunction6\p; RTF3\p2 => OneJunction8\p; RTF4\p2 => OneJunction11\p; Sf\p => OneJunction6\p; Sf1\p => ZeroJunction5\p; Splitter1\output -> PlusMinus1\plus; Splitter1\output -> RTF\angle 400 416 400 432; Splitter1\output -> Splitter3\input; Splitter2\output -> RTF3\angle 800 408; Splitter2\output -> RTF4\angle 952 400; Splitter2\output -> Splitter4\input; Splitter3\output -> PlusMinus2\minus 304 160; Splitter3\output -> RTF2\angle 296 400; Splitter4\output -> PlusMinus1\minus; Splitter4\output -> PlusMinus3\minus 568 208; Submodel3\angle -> Splitter1\input 368 448 368 416; Submodel3\angular_momentum -> I\i 320 440 320 264; Submodel3\joint1 -> MXTF\p 392 320; Submodel3\joint2 -> TF\p; Submodel3\mass -> COM1\mass 336 528 416 528 416 568; Submodel4\angle -> Splitter2\input; Submodel4\angular_momentum -> I1\i 720 424 720 288; Submodel4\joint1 -> TF3\p; Submodel4\joint2 -> TF2\p; Submodel4\mass -> COM2\mass 736 528 736 584; TF\p2 => ZeroJunction\p; TF2\p2 => ZeroJunction2\p; TF3\p2 => ZeroJunction3\p; ZeroJunction\p => RTF1\p1; ZeroJunction1\p => OneJunction5\p; ZeroJunction2\p => OneJunction9\p; ZeroJunction3\p => OneJunction12\p; ZeroJunction4\p => OneJunction10\p; ZeroJunction4\p => R1\p; ZeroJunction5\p <= MSe2\p; ZeroJunction5\p => OneJunction3\p; ZeroJunction5\p => R2\p; end; implementation_end; ]]> Experiment 1 4.8 I1\state_initial 0 I\state_initial 0 PID1\pdstate_initial 0 PID1\pistate_initial 0 PID\pdstate_initial 0 PID\pistate_initial 0 COM1\I\p.e_initial 2 1 0 0 COM2\I\p.e_initial 2 1 0 0 time Submodel4\position[2] Submodel4\position[1] Submodel3\body_position[1] Submodel3\body_position[2] Submodel3\body_position[3] Submodel3\body_angle[1] Submodel3\body_angle[2] Submodel3\body_angle[3] Submodel3\dimension[1] Submodel3\dimension[2] Submodel3\dimension[3] Submodel4\dimension[1] Submodel4\dimension[2] Submodel4\dimension[3] Submodel4\body_angle[1] Submodel4\body_angle[2] Submodel4\body_angle[3] Submodel4\body_position[1] Submodel4\body_position[2] Submodel4\body_position[3] PlusMinus2\output PlusMinus3\output 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.04357977129155497 0.09 true 3 -0.010000000000000004 0.09 true 1 6076255 1 6076255 0 true 1 1 1 true true Submodel4\position[1] true Submodel4\position[2] true 0.9024193548387097 0.0308411214953271 0 16777215 GraphPlot 2 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 10.0 true 3 -2.5 2.5 true 2 0.0 235.918450873204 true 2 3355111 1 3355111 0 true 1 1 1 true true time true PlusMinus2\output 6076255 1 6076255 0 true 1 1 1 true true time true PlusMinus3\output true 0 16777215 D3DPlot 3 false 16777215 true 3D Animation 137 true false 4294967295 Gradients\BlueWhite.png true 1.0 1.0 1 1 1 true Reference Frame Bryant false false false false false false 1 1 1 false Default Lights and Cameras Bryant false false false false false false false Ambient 1 1 Direct3D false false false false false false 0 0.3 0.3 0.3 1 1 1 true 0.3 0.3 0.3 1 1 1 true true false false false Parallel -3 5 3 0.457495710997814 -0.762492851663023 -0.457495710997814 0.235379601434674 -0.392299335724456 0.889211827642101 Direct3D false false false false false false 3 0.5 0.5 0.5 1 1 1 true 1.0 0.0 0.0 0.5 0.5 0.5 1 1 1 true 0.5 0.5 0.5 1 1 1 true false true true false Spot Light 1 -3 -5 1 0.50709255283711 0.845154254728517 -0.169030850945703 0.0869656553478673 0.144942758913112 0.985610760609162 Direct3D false false false false false false 2 0.5 0.5 0.5 1 1 1 true 1.0 0.05 0.05 1.0471975511965976 1.0471975511965976 0.0 0.5 0.5 0.5 1 1 1 true 0.5 0.5 0.5 1 1 1 true false true true false Spot Light 2 2 -3 -1 -0.534522483824849 0.801783725737273 0.267261241912424 0.14824986333222 -0.22237479499833 0.963624111659432 Direct3D false false false false false false 2 1 1 1 1 1 1 true 1.0 0.05 0.05 1.5707963267948966 1.5707963267948966 0.0 1 1 1 1 1 1 true 0.5 0.5 0.5 1 1 1 true false true true false Camera Looking at Origin 3.38324006301254 -0.579670639853894 1.16932529227831 -0.932987163169101 0.159854239065772 -0.322461742869407 -0.317830371400678 0.0544557676438669 0.946582497400847 Direct3D false false false false false false 0.01 100.0 true 0.003926990816987242 45.0 -10.0 10.0 10.0 -10.0 true -9.99200722162641e-016 1.76247905159244e-015 -3.05678199886544e-015 true 1 true true true false Front(XY)-Camera 10 -1 1 Direct3D false false false false false false 0.01 100.0 true 9.999999999999998 45.0 -9.999999999999998 9.999999999999998 9.999999999999998 -9.999999999999998 true true 1 true false false false Side(YZ)-Camera 10 -1 1 Direct3D false false false false false false 0.01 100.0 true 9.999999999999998 45.0 -9.999999999999998 9.999999999999998 9.999999999999998 -9.999999999999998 true true 1 true false false false Top(XZ)-Camera 10 -1 1 Direct3D false false false false false false 0.01 100.0 true 9.999999999999998 45.0 -9.999999999999998 9.999999999999998 9.999999999999998 -9.999999999999998 true true 1 true false false 1 1 1 false Scenery Bryant false false false false false false 10 10 10 false Reference Frame Bryant false false false false false false
Center
1.0 true 4 Submodel3\dimension[1] 0.005 Submodel3\dimension[2] 0.065 Submodel3\dimension[3] 0.01 true 1 1 1 1.0 1 1 1 true 0.498039215686275 0.498039215686275 0.498039215686275 14.298713684082 false false Block Submodel3\body_position[1] 0.0 Submodel3\body_position[2] -0.003324486493480361 Submodel3\body_position[3] 0.0322803662779697 Submodel3\body_angle[1] 1.6732325429015287 Submodel3\body_angle[2] 0.0 Submodel3\body_angle[3] 0.0 Euler false false false false false false
Center
1.0 true 4 Submodel4\dimension[1] 0.005 Submodel4\dimension[2] 0.05 Submodel4\dimension[3] 0.01 true 1 1 1 1.0 1 1 1 true 0.5 0.5 0.5 15 false false Block Submodel4\body_position[1] 0.0 Submodel4\body_position[2] 0.01712950212216267 Submodel4\body_position[3] 0.07220095787584248 Submodel4\body_angle[1] 0.3105772067921056 Submodel4\body_angle[2] 0.0 Submodel4\body_angle[3] 0.0 Euler false false false false false false
1 true Window 1 0 1 2 Base 2 true Window 2 0 3 Base 0.125 0.0851852 0.904167 0.898148 0.171354 0.140741 0.811458 0.834259
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.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 true 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 0.125