Some fixes

This commit is contained in:
2026-03-08 23:43:57 +01:00
parent 3bb0a04d4c
commit cc906cbd23
4 changed files with 138 additions and 10 deletions

View File

@@ -11,7 +11,7 @@ package BondGraphLib
parameter Real s[N] = fill(1.0, N)
"Bond orientation signs used in the effort balance";
BondPort P[N] "Power ports" annotation(
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {0, 80}, extent = {{-10, -10}, {10, 10}})));
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(extent = {{-10, -10}, {10, 10}})));
Real f;
equation
// Efforts sum to zero, with signs from bond directions
@@ -31,7 +31,7 @@ package BondGraphLib
parameter Real s[N] = fill(1.0, N)
"Bond orientation signs used in the effort balance";
BondPort P[N] "Power ports" annotation(
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {0, 80}, extent = {{-10, -10}, {10, 10}})));
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(extent = {{-10, -10}, {10, 10}})));
Real e;
equation
// Flows sum to zero, with signs from bond directions
@@ -48,7 +48,7 @@ package BondGraphLib
partial model OnePortPassive "One-port passive bond graph element"
BondPort p "Generic power port" annotation(
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {0, 80}, extent = {{-10, -10}, {10, 10}})));
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(extent = {{-10, -10}, {10, 10}})));
end OnePortPassive;
partial model OnePortEnergetic "One-port storage element"
@@ -91,7 +91,7 @@ package BondGraphLib
model Se "Effort source"
BondPort p annotation(
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {80, 0}, extent = {{-10, -10}, {10, 10}})));
input Real e0 "Imposed effort";
parameter Real e0 "Imposed effort";
equation
p.e = e0;
annotation(
@@ -101,7 +101,7 @@ package BondGraphLib
model Sf "Flow source"
BondPort p annotation(
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {80, 0}, extent = {{-10, -10}, {10, 10}})));
input Real f0 "Imposed flow";
parameter Real f0 "Imposed flow";
equation
p.f = f0;
annotation(
@@ -189,6 +189,32 @@ package BondGraphLib
Icon(graphics = {Text(extent = {{-60, 100}, {60, -100}}, textString = "mGY")}));
end mGY;
model fsensor
BondPort p annotation(
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-80, 0}, extent = {{-10, -10}, {10, 10}})));
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}})));
equation
// Ideal flow sensor in bond-graph form: zero effort loading.
p.e = 0;
f = p.f;
annotation(
Icon(graphics = {Text(extent = {{-80, 100}, {80, -100}}, textString = "f", textStyle = {TextStyle.Italic})}));
end fsensor;
model esensor
BondPort p annotation(
Placement(transformation(origin = {-44, 18}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-80, 0}, extent = {{-10, -10}, {10, 10}})));
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}})));
equation
// Ideal effort sensor in bond-graph form: zero flow loading.
p.f = 0;
e = p.e;
annotation(
Icon(graphics = {Text(extent = {{-80, 100}, {80, -100}}, textString = "e", textStyle = {TextStyle.Italic})}));
end esensor;
annotation(
Icon(graphics = {Text(origin = {50, 0}, extent = {{-50, 100}, {50, -100}}, textString = "R"), Line(origin = {-45.22, 20.19}, points = {{-58.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)}),
uses(Modelica(version = "4.1.0")));