Library mode and new icons

This commit is contained in:
2026-03-09 00:20:32 +01:00
parent cc906cbd23
commit e580b9840e
8 changed files with 139 additions and 37 deletions

View File

@@ -1,3 +1,4 @@
within BondGraph;
package BondGraphLib package BondGraphLib
connector BondPort "Bond graph power port" connector BondPort "Bond graph power port"
@@ -23,7 +24,8 @@ package BondGraphLib
end for; end for;
f = P[1].f; f = P[1].f;
annotation( annotation(
Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "1")})); Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "1"), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end J1; end J1;
model J0 "Bond graph 0-junction (common effort, flows sum to zero)" model J0 "Bond graph 0-junction (common effort, flows sum to zero)"
@@ -43,7 +45,8 @@ package BondGraphLib
end for; end for;
e = P[1].e; e = P[1].e;
annotation( annotation(
Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "0")})); Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "0"), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end J0; end J0;
partial model OnePortPassive "One-port passive bond graph element" partial model OnePortPassive "One-port passive bond graph element"
@@ -65,7 +68,8 @@ package BondGraphLib
der(state) = p.f; der(state) = p.f;
p.e = state / c; p.e = state / c;
annotation( annotation(
Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "C")})); Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "C"), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end C; end C;
model I "Bond graph I element" model I "Bond graph I element"
@@ -76,7 +80,8 @@ package BondGraphLib
der(state) = p.e; der(state) = p.e;
p.f = state / I; p.f = state / I;
annotation( annotation(
Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "I")})); Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "I"), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end I; end I;
model R "Bond graph resistor" model R "Bond graph resistor"
@@ -85,7 +90,8 @@ package BondGraphLib
equation equation
p.e = R * p.f; p.e = R * p.f;
annotation( annotation(
Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "R")})); Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "R"), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end R; end R;
model Se "Effort source" model Se "Effort source"
@@ -95,7 +101,8 @@ package BondGraphLib
equation equation
p.e = e0; p.e = e0;
annotation( annotation(
Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "Se")})); Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "Se"), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end Se; end Se;
model Sf "Flow source" model Sf "Flow source"
@@ -105,7 +112,8 @@ package BondGraphLib
equation equation
p.f = f0; p.f = f0;
annotation( annotation(
Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "Sf")})); Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "Sf"), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end Sf; end Sf;
model TF "Bond graph transformer" model TF "Bond graph transformer"
@@ -119,7 +127,8 @@ package BondGraphLib
p1.e = n * p2.e; p1.e = n * p2.e;
p2.f = n * p1.f; p2.f = n * p1.f;
annotation( annotation(
Icon(graphics = {Text(extent = {{-80, 100}, {80, -100}}, textString = "TF")})); Icon(graphics = {Text(extent = {{-80, 100}, {80, -100}}, textString = "TF"), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end TF; end TF;
model GY "Bond graph gyrator" model GY "Bond graph gyrator"
@@ -132,7 +141,8 @@ package BondGraphLib
p1.e = r * p2.f; p1.e = r * p2.f;
p2.e = r * p1.f; p2.e = r * p1.f;
annotation( annotation(
Icon(graphics = {Text(extent = {{-80, 100}, {80, -100}}, textString = "GY")})); Icon(graphics = {Text(extent = {{-80, 100}, {80, -100}}, textString = "GY"), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end GY; end GY;
model mSe "Bond graph modulated effort source" model mSe "Bond graph modulated effort source"
@@ -144,7 +154,8 @@ package BondGraphLib
equation equation
p.e = e0; p.e = e0;
annotation( annotation(
Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "mSe")})); Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "mSe"), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end mSe; end mSe;
model mSf "Bond graph modulated flow source" model mSf "Bond graph modulated flow source"
@@ -156,7 +167,8 @@ package BondGraphLib
equation equation
p.f = f0; p.f = f0;
annotation( annotation(
Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "mSf")})); Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "mSf"), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end mSf; end mSf;
model mTF "Bond graph modulated transformer" model mTF "Bond graph modulated transformer"
@@ -171,7 +183,7 @@ package BondGraphLib
p2.f = m * p1.f; p2.f = m * p1.f;
annotation( annotation(
Diagram(graphics), Diagram(graphics),
Icon(graphics = {Text(extent = {{-60, 100}, {60, -100}}, textString = "mTF")})); Icon(graphics = {Text(extent = {{-60, 100}, {60, -100}}, textString = "mTF"), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}));
end mTF; end mTF;
model mGY "Bond graph modulated gyrator" model mGY "Bond graph modulated gyrator"
@@ -186,33 +198,34 @@ package BondGraphLib
p2.e = m * p1.f; p2.e = m * p1.f;
annotation( annotation(
Diagram(graphics), Diagram(graphics),
Icon(graphics = {Text(extent = {{-60, 100}, {60, -100}}, textString = "mGY")})); Icon(graphics = {Text(extent = {{-60, 100}, {60, -100}}, textString = "mGY"), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}));
end mGY; end mGY;
model fsensor model fsensor
BondPort p annotation( BondPort p annotation(
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-80, 0}, extent = {{-10, -10}, {10, 10}}))); Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-52, 0}, extent = {{-10, -10}, {10, 10}})));
Modelica.Blocks.Interfaces.RealOutput f "Flow output" annotation( Modelica.Blocks.Interfaces.RealOutput f "Flow output" annotation(
Placement(transformation(origin = {-8, -64}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {82, 0}, extent = {{-8, -8}, {8, 8}}))); Placement(transformation(origin = {-8, -64}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {58, 0}, extent = {{-8, -8}, {8, 8}})));
equation equation
// Ideal flow sensor in bond-graph form: zero effort loading. // Ideal flow sensor in bond-graph form: zero effort loading.
p.e = 0; p.e = 0;
f = p.f; f = p.f;
annotation( annotation(
Icon(graphics = {Text(extent = {{-80, 100}, {80, -100}}, textString = "f", textStyle = {TextStyle.Italic})})); Icon(graphics = {Text(origin = {-10, 0}, extent = {{-50, 60}, {50, -60}}, textString = "f", textStyle = {TextStyle.Italic}), Ellipse(origin = {-2, 0}, lineThickness = 5, extent = {{-50, 50}, {50, -50}})}));
end fsensor; end fsensor;
model esensor model esensor
BondPort p annotation( BondPort p annotation(
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-80, 0}, extent = {{-10, -10}, {10, 10}}))); Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-52, 0}, extent = {{-10, -10}, {10, 10}})));
Modelica.Blocks.Interfaces.RealOutput e "Effort output" annotation( Modelica.Blocks.Interfaces.RealOutput e "Effort output" annotation(
Placement(transformation(origin = {-8, -64}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {82, 0}, extent = {{-8, -8}, {8, 8}}))); Placement(transformation(origin = {-8, -64}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {58, 0}, extent = {{-8, -8}, {8, 8}})));
equation equation
// Ideal effort sensor in bond-graph form: zero flow loading. // Ideal effort sensor in bond-graph form: zero flow loading.
p.f = 0; p.f = 0;
e = p.e; e = p.e;
annotation( annotation(
Icon(graphics = {Text(extent = {{-80, 100}, {80, -100}}, textString = "e", textStyle = {TextStyle.Italic})})); Icon(graphics = {Text(origin = {-10, 0}, extent = {{-50, 60}, {50, -60}}, textString = "e", textStyle = {TextStyle.Italic}), Ellipse(origin = {-2, 0}, lineThickness = 5, extent = {{-50, 50}, {50, -50}})}),
Diagram(graphics));
end esensor; end esensor;
annotation( annotation(

View File

@@ -0,0 +1,18 @@
BondPort
J1
J0
OnePortPassive
OnePortEnergetic
C
I
R
Se
Sf
TF
GY
mSe
mSf
mTF
mGY
fsensor
esensor

View File

@@ -1,3 +1,4 @@
within BondGraph;
package BondGraphLib2D package BondGraphLib2D
connector BondPort "Bond graph 2D multibond power port" connector BondPort "Bond graph 2D multibond power port"
@@ -25,7 +26,7 @@ package BondGraphLib2D
end for; end for;
f = P[1].f; f = P[1].f;
annotation( annotation(
Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "1", textStyle = {TextStyle.Bold, TextStyle.UnderLine}) })); Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "1", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}));
end J1; end J1;
model J0 "Bond graph 2D 0-junction (common effort, flows sum to zero)" model J0 "Bond graph 2D 0-junction (common effort, flows sum to zero)"
@@ -47,7 +48,8 @@ package BondGraphLib2D
end for; end for;
e = P[1].e; e = P[1].e;
annotation( annotation(
Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "0", textStyle = {TextStyle.Bold, TextStyle.UnderLine}) })); Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "0", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end J0; end J0;
partial model OnePortPassive "One-port passive 2D multibond element" partial model OnePortPassive "One-port passive 2D multibond element"
@@ -69,7 +71,8 @@ package BondGraphLib2D
der(state) = p.f; der(state) = p.f;
c * p.e = state; c * p.e = state;
annotation( annotation(
Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "C", textStyle = {TextStyle.Bold, TextStyle.UnderLine}) })); Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "C", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end C; end C;
model I "Bond graph 2D I element" model I "Bond graph 2D I element"
@@ -80,7 +83,8 @@ package BondGraphLib2D
der(state) = p.e; der(state) = p.e;
I * p.f = state; I * p.f = state;
annotation( annotation(
Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "I", textStyle = {TextStyle.Bold, TextStyle.UnderLine}) })); Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "I", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end I; end I;
model R "Bond graph 2D resistor" model R "Bond graph 2D resistor"
@@ -89,7 +93,8 @@ package BondGraphLib2D
equation equation
p.e = R * p.f; p.e = R * p.f;
annotation( annotation(
Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "R", textStyle = {TextStyle.Bold, TextStyle.UnderLine}) })); Icon(graphics = {Text(extent = {{-100, 100}, {100, -100}}, textString = "R", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end R; end R;
model Se "Effort source" model Se "Effort source"
@@ -99,7 +104,8 @@ package BondGraphLib2D
equation equation
p.e = e0; p.e = e0;
annotation( annotation(
Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "Se", textStyle = {TextStyle.Bold, TextStyle.UnderLine}) })); Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "Se", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end Se; end Se;
model Sf "Flow source" model Sf "Flow source"
@@ -109,7 +115,8 @@ package BondGraphLib2D
equation equation
p.f = f0; p.f = f0;
annotation( annotation(
Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "Sf", textStyle = {TextStyle.Bold, TextStyle.UnderLine}) })); Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "Sf", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end Sf; end Sf;
model TF "Bond graph 2D transformer" model TF "Bond graph 2D transformer"
@@ -123,7 +130,8 @@ package BondGraphLib2D
p1.e = n * p2.e; p1.e = n * p2.e;
transpose(n) * p1.f = p2.f; transpose(n) * p1.f = p2.f;
annotation( annotation(
Icon(graphics = {Text(extent = {{-80, 100}, {80, -100}}, textString = "TF", textStyle = {TextStyle.Bold, TextStyle.UnderLine}) })); Icon(graphics = {Text(extent = {{-80, 100}, {80, -100}}, textString = "TF", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end TF; end TF;
model GY "Bond graph 2D gyrator" model GY "Bond graph 2D gyrator"
@@ -136,7 +144,8 @@ package BondGraphLib2D
p1.e = r * p2.f; p1.e = r * p2.f;
p2.e = transpose(r) * p1.f; p2.e = transpose(r) * p1.f;
annotation( annotation(
Icon(graphics = {Text(extent = {{-80, 100}, {80, -100}}, textString = "GY", textStyle = {TextStyle.Bold, TextStyle.UnderLine}) })); Icon(graphics = {Text(extent = {{-80, 100}, {80, -100}}, textString = "GY", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end GY; end GY;
model mSe "Bond graph modulated effort source" model mSe "Bond graph modulated effort source"
@@ -148,7 +157,8 @@ package BondGraphLib2D
equation equation
p.e = e0; p.e = e0;
annotation( annotation(
Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "mSe", textStyle = {TextStyle.Bold, TextStyle.UnderLine}) })); Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "mSe", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end mSe; end mSe;
model mSf "Bond graph modulated flow source" model mSf "Bond graph modulated flow source"
@@ -160,7 +170,8 @@ package BondGraphLib2D
equation equation
p.f = f0; p.f = f0;
annotation( annotation(
Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "mSf", textStyle = {TextStyle.Bold, TextStyle.UnderLine}) })); Icon(graphics = {Text(origin = {-20, 0}, extent = {{-80, 100}, {80, -100}}, textString = "mSf", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}),
Diagram(graphics));
end mSf; end mSf;
model mTF "Bond graph modulated transformer" model mTF "Bond graph modulated transformer"
@@ -175,7 +186,7 @@ package BondGraphLib2D
transpose(m) * p1.f = p2.f; transpose(m) * p1.f = p2.f;
annotation( annotation(
Diagram(graphics), Diagram(graphics),
Icon(graphics = {Text(extent = {{-60, 100}, {60, -100}}, textString = "mTF", textStyle = {TextStyle.Bold, TextStyle.UnderLine}) })); Icon(graphics = {Text(extent = {{-60, 100}, {60, -100}}, textString = "mTF", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}));
end mTF; end mTF;
model mGY "Bond graph modulated gyrator" model mGY "Bond graph modulated gyrator"
@@ -190,7 +201,7 @@ package BondGraphLib2D
p2.e = transpose(m) * p1.f; p2.e = transpose(m) * p1.f;
annotation( annotation(
Diagram(graphics), Diagram(graphics),
Icon(graphics = {Text(extent = {{-60, 100}, {60, -100}}, textString = "mGY", textStyle = {TextStyle.Bold, TextStyle.UnderLine}) })); Icon(graphics = {Text(extent = {{-60, 100}, {60, -100}}, textString = "mGY", textStyle = {TextStyle.Bold, TextStyle.UnderLine}), Text(origin = {50, 80}, textColor = {0, 0, 255}, extent = {{-50, 20}, {50, -20}}, textString = "%name")}));
end mGY; end mGY;
package TransRotUtils package TransRotUtils

View File

@@ -0,0 +1,17 @@
BondPort
J1
J0
OnePortPassive
OnePortEnergetic
C
I
R
Se
Sf
TF
GY
mSe
mSf
mTF
mGY
TransRotUtils

10
BondGraph/package.mo Normal file
View File

@@ -0,0 +1,10 @@
within ;
package BondGraph
extends Modelica.Icons.Package;
annotation(
Diagram(graphics),
Icon(graphics = {Line(origin = {-45.22, 20.19}, points = {{-50.7774, -20.1934}, {21.2226, -20.1934}, {-38.7774, 19.8066}}, thickness = 5), Line(origin = {-9.81, -8.19}, points = {{-10.1934, 48.1934}, {-10.1934, -31.8066}}, thickness = 5), Line(origin = {156.78, 20.19}, points = {{-60.7774, -20.1934}, {-134.777, -20.1934}, {-76.7774, 19.8066}}, thickness = 5), Line(origin = {28.19, -8.19}, points = {{-10.1934, 48.1934}, {-10.1934, -31.8066}}, thickness = 5), Line(origin = {66, 12}, points = {{-26, 0}, {30, 0}}, thickness = 5)}));
end BondGraph;

2
BondGraph/package.order Normal file
View File

@@ -0,0 +1,2 @@
BondGraphLib2D
BondGraphLib

28
test.mo Normal file
View File

@@ -0,0 +1,28 @@
model test
BondGraphLib.J1 j1(Nin = 1, Nout = 3) annotation(
Placement(transformation(extent = {{-10, -10}, {10, 10}})));
BondGraphLib.R r annotation(
Placement(transformation(origin = {0, 40}, extent = {{-10, -10}, {10, 10}})));
BondGraphLib.C c(c = 0.5) annotation(
Placement(transformation(origin = {0, -40}, extent = {{-10, -10}, {10, 10}})));
Modelica.Blocks.Sources.Step step(height = 1, startTime = 1) annotation(
Placement(transformation(origin = {-90, 0}, extent = {{-10, -10}, {10, 10}})));
BondGraphLib.mSe mSe annotation(
Placement(transformation(origin = {-40, 0}, extent = {{-10, -10}, {10, 10}})));
BondGraphLib.I i(I = 0.1) annotation(
Placement(transformation(origin = {40, 0}, extent = {{-10, -10}, {10, 10}})));
equation
connect(j1.Pout[1], c.p) annotation(
Line(points = {{0, 8}, {0, -32}}, color = {0, 0, 127}));
connect(j1.Pout[2], r.p) annotation(
Line(points = {{0, 8}, {0, 48}}, color = {0, 0, 127}));
connect(mSe.p, j1.Pin[1]) annotation(
Line(points = {{-32, 0}, {0, 0}, {0, 8}}, color = {0, 0, 127}));
connect(step.y, mSe.e0) annotation(
Line(points = {{-78, 0}, {-40, 0}, {-40, -8}}, color = {0, 0, 127}));
connect(i.p, j1.Pout[3]) annotation(
Line(points = {{40, 8}, {40, 0}, {0, 0}, {0, 8}}, color = {0, 0, 127}));
annotation(
uses(Modelica(version = "4.1.0")),
experiment(StartTime = 0, StopTime = 12, Tolerance = 1e-06, Interval = 0.024));
end test;

View File

@@ -1,4 +1,7 @@
model test2d model test2d
import BondGraphLib = BondGraph.BondGraphLib;
import BondGraphLib2D = BondGraph.BondGraphLib2D;
BondGraphLib.J1 w_com(N = 3, s = {1, -1, -1}) annotation( BondGraphLib.J1 w_com(N = 3, s = {1, -1, -1}) annotation(
Placement(transformation(origin = {0, 120}, extent = {{-10, -10}, {10, 10}}))); Placement(transformation(origin = {0, 120}, extent = {{-10, -10}, {10, 10}})));
BondGraphLib.Sf sf(f0 = 1) annotation( BondGraphLib.Sf sf(f0 = 1) annotation(
@@ -40,8 +43,6 @@ equation
Line(points = {{40, 40}, {40, 8}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6)); Line(points = {{40, 40}, {40, 8}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
connect(v_p_bff.P[2], rTF1.p1) annotation( connect(v_p_bff.P[2], rTF1.p1) annotation(
Line(points = {{-40, 40}, {-40, 8}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6)); Line(points = {{-40, 40}, {-40, 8}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
connect(w_com.P[3], wsensor.p) annotation(
Line(points = {{0, 120}, {42, 90}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
connect(wsensor.f, w2phi.u) annotation( connect(wsensor.f, w2phi.u) annotation(
Line(points = {{58, 90}, {78, 90}}, color = {0, 0, 127})); Line(points = {{58, 90}, {78, 90}}, color = {0, 0, 127}));
connect(w2phi.y, rTF1.phi) annotation( connect(w2phi.y, rTF1.phi) annotation(
@@ -54,10 +55,12 @@ equation
Line(origin = {1, 0},points = {{40, -8}, {40, -40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6)); Line(origin = {1, 0},points = {{40, -8}, {40, -40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
connect(v_com_in.P[2], mass.p) annotation( connect(v_com_in.P[2], mass.p) annotation(
Line(points = {{40, -40}, {80, -40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6)); Line(points = {{40, -40}, {80, -40}}, color = {0, 85, 0}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
connect(w_com.P[3], wsensor.p) annotation(
Line(points = {{0, 120}, {44, 90}}, color = {0, 0, 127}, thickness = 0.75, arrow = {Arrow.None, Arrow.Half}, arrowSize = 6));
annotation( annotation(
uses(Modelica(version = "4.1.0")), uses(Modelica(version = "4.1.0")),
experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.02), experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.02),
Diagram(coordinateSystem(extent = {{-60, 140}, {120, -60}}), graphics = {Text(origin = {-40, -52}, extent = {{-12, 4}, {12, -4}}, textString = "v_p"), Text(origin = {40, -52}, extent = {{-12, 4}, {12, -4}}, textString = "v_com"), Text(origin = {0, 134}, extent = {{-12, 4}, {12, -4}}, textString = "w_com")}), Diagram(coordinateSystem(extent = {{-60, 140}, {120, -60}})),
Icon(coordinateSystem(extent = {{-200, -200}, {200, 200}})), Icon(coordinateSystem(extent = {{-200, -200}, {200, 200}})),
version = ""); version = "");
end test2d; end test2d;