Related
I want to model the positioning of a pump with only little available NPSH with PumpMonitoringNPSH in MSL/Fluid. But simulation always fails, when I add a suction side pressure loss. It does not matter how large the suction side pressure of a tank or source or how big of a diameter I choose. The moment I comment out the monitoring and switch to ConstantPropertyLiquidWater the simulation works.
The full model is available here.
version: OpenModellica 1.20.0~dev-250-gb17e1a0
model PumpenTeststand
// monitor
Modelica.Units.NonSI.Pressure_bar p_r;
// system
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-90, 90}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
// media
replaceable package Medium = Modelica.Media.Water.StandardWater;
//Modelica.Media.Water.ConstantPropertyLiquidWater;
// aggregate
Modelica.Fluid.Machines.PrescribedPump pumpe(
redeclare package Medium = Medium,
m_flow_start = 1,
redeclare function flowCharacteristic = Modelica.Fluid.Machines.BaseClasses.PumpCharacteristics.quadraticFlow(
V_flow_nominal={0.0556,0.1665,0.2778},
head_nominal={3.75e1,3e1,1.9e1}),
redeclare model Monitoring = Modelica.Fluid.Machines.BaseClasses.PumpMonitoring.PumpMonitoringNPSH,
N_nominal = 1482,
p_a_start = 1e5,
p_b_start = 1e5) annotation(
Placement(visible = true, transformation(origin = {-10, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
// leitungen
Modelica.Fluid.Pipes.StaticPipe leitung(
redeclare package Medium = Medium,
diameter = 0.4,
length = 0.1,
nParallel = 1) annotation(
Placement(visible = true, transformation(origin = {-50, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
// grenzen
Modelica.Fluid.Sources.FixedBoundary quelle(
redeclare package Medium = Medium,
nPorts = 1,
p = system.p_ambient) annotation(
Placement(visible = true, transformation(origin = {-90, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT senke(
redeclare package Medium = Medium,
p = system.p_ambient,
T=system.T_ambient,
use_p_in=true, nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {70, -10}, extent = {{-10, 10}, {10, -10}}, rotation = 180)));
// regelung
Modelica.Blocks.Sources.Ramp rampe(duration = 10, height = 5e5, offset = 1e5) annotation(
Placement(visible = true, transformation(origin = {50, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
p_r = Modelica.Units.Conversions.to_bar(pumpe.port_b.p - pumpe.port_a.p);
connect(rampe.y, senke.p_in) annotation(
Line(points = {{62, 30}, {92, 30}, {92, -2}, {82, -2}}, color = {0, 0, 127}));
connect(pumpe.port_b, senke.ports[1]) annotation(
Line(points = {{0, -10}, {60, -10}}, color = {0, 127, 255}));
connect(quelle.ports[1], leitung.port_a) annotation(
Line(points = {{-80, -10}, {-60, -10}}, color = {0, 127, 255}));
connect(leitung.port_b, pumpe.port_a) annotation(
Line(points = {{-40, -10}, {-20, -10}}, color = {0, 127, 255}));
annotation(experiment(StopTime=10));
end PumpenTeststand;
/tmp/OpenModelica_dh/OMEdit/Druckverlust.PumpenTeststand/PumpenTeststand -port=38349 -logFormat=xmltcp -override=startTime=0,stopTime=10,stepSize=0.02,tolerance=1e-06,solver=dassl,outputFormat=mat,variableFilter=.* -r=/tmp/OpenModelica_dh/OMEdit/Druckverlust.PumpenTeststand/PumpenTeststand_res.mat -w -lv=LOG_STATS -inputPath=/tmp/OpenModelica_dh/OMEdit/Druckverlust.PumpenTeststand -outputPath=/tmp/OpenModelica_dh/OMEdit/Druckverlust.PumpenTeststand
IF97 medium function tsat called with too low pressure
p = -161336 Pa <= 611.657 Pa (triple point pressure)
Failed to solve the initialization problem with global homotopy with equidistant step size.
Unable to solve initialization problem.
simulation terminated by an assertion at initialization
Simulation process failed. Exited with code 255.
I'm trying to use the integerChange block from the Modelica Standard library
It doesn't seem to work however. What am i doing wrong? I would have expected a spike at each change,but i get a constant "false". I'm using OpenModelica 1.17
Here is the simple model
model integerChangeTest
Modelica.Blocks.Math.IntegerChange integerChange annotation(
Placement(visible = true, transformation(origin = {26, 24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.RealToInteger realToInteger annotation(
Placement(visible = true, transformation(origin = {-6, 24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Sine sine(amplitude = 5, freqHz = 5) annotation(
Placement(visible = true, transformation(origin = {-48, 26}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(realToInteger.y, integerChange.u) annotation(
Line(points = {{5, 24}, {13, 24}}, color = {255, 127, 0}));
connect(sine.y, realToInteger.u) annotation(
Line(points = {{-37, 26}, {-19, 26}, {-19, 24}}, color = {0, 0, 127}));
annotation(
uses(Modelica(version = "3.2.3")));
end integerChangeTest;
The block works, but plotting change(x) is complicated in many Modelica tools.
The reason is that at an event there are a number of intermediate values, and to avoid plotting too many values one common solution is to just store the first and last; that also simplifies the implementation since it avoids a callback for storing values during the event iteration. Unfortunately change is only true in intermediate values during event iterations - and thus plotting it becomes meaningless.
I don't know if OpenModelica has some special mode for including them as well.
If you want to see that it changes you can use the code in the comment or graphically add not+OnDelay
model integerChangeTest
Modelica.Blocks.Math.IntegerChange integerChange annotation (
Placement(visible = true, transformation(origin = {26, 24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.RealToInteger realToInteger annotation (
Placement(visible = true, transformation(origin = {-6, 24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Sine sine(amplitude = 5, freqHz = 5) annotation (
Placement(visible = true, transformation(origin = {-48, 26}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Logical.Not not1
annotation (Placement(transformation(extent={{46,14},{66,34}})));
Modelica.Blocks.MathBoolean.OnDelay onDelay(delayTime=1e-3)
annotation (Placement(transformation(extent={{82,20},{90,28}})));
equation
connect(realToInteger.y, integerChange.u) annotation (
Line(points={{5,24},{14,24}}, color = {255, 127, 0}));
connect(sine.y, realToInteger.u) annotation (
Line(points={{-37,26},{-18,26},{-18,24}}, color = {0, 0, 127}));
connect(integerChange.y, not1.u)
annotation (Line(points={{37,24},{44,24}}, color={255,0,255}));
connect(onDelay.u, not1.y)
annotation (Line(points={{80.4,24},{67,24}}, color={255,0,255}));
annotation (
uses(Modelica(version="3.2.2")));
end integerChangeTest;
I have modeled the nonlinear inductor with Modelica, but the circuit can not be solved by trapezoidal integration, It is appreciated someone can help me to solve the circuit.
model NonlinearInductor
import Modelica.SIunits.MagneticFlux;
extends Modelica.Electrical.Analog.Interfaces.OnePort;
parameter Real T[:,2]=[-1.0015,-1200;-0.0015,-200;0,0;0.0015,200;1.0015,1200]
"piecewiselinear current versus flux relation";
Integer nbPoints = size(T,1) "Number of interpolation points";
Real L; //Slop of line flux-Current; inductance
MagneticFlux flux( start=0);
equation
v = der(flux); // Faraday's Low
algorithm
// Definition of Piecewise nonlinear inductance
if i < T[2,1] then
L := ((T[1,2] - T[2,2]) / (T[1,1] - T[2,1]));
flux := L * (i-T[1,1]) + T[1,2];
elseif i >= T[nbPoints-1,1] then
L := (( T[nbPoints-1,2] - T[nbPoints,2]) / (T[nbPoints-1,1] - T[nbPoints,1]));
flux := L * (i-T[nbPoints-1,1]) + T[nbPoints-1,2];
else
for iter in 2:(nbPoints-2) loop
if i >= T[iter,1] and i <T[iter+1,1] then
L := (( T[iter,2] - T[iter+1,2]) / (T[iter,1] - T[iter+1,1]));
flux := L * (i-T[iter,1]) + T[iter,2];
end if;
end for;
end if;
end NonlinearInductor;
and I have prepared and example as below:
model NonlinearInductorTest
Modelica.Electrical.Analog.Sources.CosineVoltage cosineVoltage1(V = 25e3 * sqrt(2), freqHz = 50,
phase=1.5707963267949) annotation (
Placement(visible = true, transformation(origin = {-80, 20}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Electrical.Analog.Basic.Resistor resistor1(R = 1000e6) annotation (
Placement(visible = true, transformation(origin = {-14, 20}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Electrical.Analog.Basic.Ground ground1 annotation (
Placement(visible = true, transformation(origin = {-80, -12}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Electrical.Analog.Basic.Capacitor capacitor1(C=0.4e-9) annotation (
Placement(visible = true, transformation(origin = {-50, 42}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
NonlinearInductor L annotation(
Placement(visible = true, transformation(origin = {28, 20}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
equation
connect(L.n, ground1.p) annotation(
Line(points = {{28, 10}, {28, 10}, {28, -2}, {-80, -2}, {-80, -2}}, color = {0, 0, 255}));
connect(L.p, capacitor1.n) annotation(
Line(points = {{28, 30}, {28, 30}, {28, 42}, {-40, 42}, {-40, 42}}, color = {0, 0, 255}));
connect(capacitor1.p, cosineVoltage1.p) annotation(
Line(points = {{-60, 42}, {-80, 42}, {-80, 30}}, color = {0, 0, 255}));
connect(capacitor1.n, resistor1.p) annotation(
Line(points = {{-40, 42}, {-14, 42}, {-14, 30}}, color = {0, 0, 255}));
connect(resistor1.n, ground1.p) annotation(
Line(points = {{-14, 10}, {-14, -2}, {-80, -2}}, color = {0, 0, 255}));
connect(ground1.p, cosineVoltage1.n) annotation(
Line(points = {{-80, -2}, {-80, 10}}, color = {0, 0, 255}));
annotation (
uses(Modelica(version="3.2.2")),
experiment(StartTime = 0, StopTime = 0.1, Tolerance = 1e-6, Interval = 2e-05));
end NonlinearInductorTest;
Please run the example by solver Trapezoidal, StopTime = 0.1, Interval = 2e-05
Your model can be drastically simplified by using the interpolate function of the MSL.
As far as I understood, your code does the same as this function: using linear interpolation inside the defined interval and linear extrapolation outside.
Here is the updated code:
model NonlinearInductor2
extends Modelica.Electrical.Analog.Interfaces.OnePort;
parameter Real T[:,2]=[-1.0015,-1200;
-0.0015,-200;
0,0;
0.0015,200;
1.0015,1200] "piecewiselinear current versus flux relation";
Modelica.SIunits.MagneticFlux flux( start=0);
protected
final parameter Real[:] i_vec = T[:, 1];
final parameter Real[:] flux_vec = T[:, 2];
equation
v = der(flux); // Faraday's Law
flux = Modelica.Math.Vectors.interpolate(i_vec,flux_vec,i);
end NonlinearInductor2;
Apart from making your model much simpler to understand, the usage of the interpolate function brings also these benefits:
The function has the smoothOrder annotation defined, which allows the Modelica translator to differentiate your flux variable analytically .
(With the annotations smooth and smoothOrder you can define up to which order the derivative is continuous)
Instead of the algorithm section we can use a single equation section.
(You should avoid algorithm sections to describe physical behavior, as it limits the Modelica translator in manipulating your equations to create a solvable system. With algorithm sections you force the code to be evaluated exactly how you have written it, which is against the principle of a-causal physical modeling)
Unfortunately, OpenModelica still has some trouble to simulate the new model with your simulation setup (trapezoidal rule, tolerance=1e-6). By reducing the tolerance to 1e-4 the simulation finishes, but still showing the warning
Restart Kinsol: change linear solver to KINDense.
many many times. Maybe an OpenModelica expert can help on that.
Dymola by the way has no troubles with the new code, regardless of the selected solver.
This is one of the most common errors I receive when working with OpenModelica Software.
I already understand how this error is usually triggered, when system parameters are conflicting and disagree with one another.
I've already tried omitting system parameters that I've deemed not an necessity to my system however nothing seems to fix the error.
My system is already very simple to begin with. Currently, I'm working on a sub-assembly verification process in order to correctly build a working Rankine Power model. The sub assembly focuses on a (1) of (2) heat exchangers that would be used in a dual HX system incorporating a reheat process inbetween the High Pressure and Low Pressure turbines.
This sub assembly is trying to describe water coming from a pump at a condensed liquid state where it will travel through a heat exchanger "super heater" where it will change the state from a compressed liquid to a superheated vapor. This vapor will then be fed into the High Pressure turbine and return into a Pressure Sink.
I've already completed a hand calculated thermodynamic analysis of my system and know outlet temperatures and enthalpies. However, these outlet parameters are some of which I chose to remove for I felt I would let the system solve for them instead of telling it what it should calculate. Removing these values to solve the error did not work as well.
If you have any thoughts, advice or considerations please let me know! Below I've posted the code to what I have been working on. Thanks again!
CODE:
model HX_Pump_2_Superheater_2_HPTurbine
//Heat Exchanger - Steam entering HX (compressed liquid) --> Steam exiting
HX (super heated vapor)//
//Steam Turbine - High Pressure Turbine and is (1) of (2) in series with one
another. Exit pressure should be intermediate pressure level before being
reheated and directed towards Low Pressure Turbine//
ThermoPower.PowerPlants.HRSG.Components.HE HX(
FluidPhaseStart = ThermoPower.Choices.FluidPhase.FluidPhases.Liquid,
Tstartbar_G (displayUnit = "K") = 787.87,
dpnom_F(displayUnit = "Pa") = 0,
dpnom_G = 0,
exchSurface_F = 4.739,
exchSurface_G = 4.739,
extSurfaceTub = 9.479,
fluidNomFlowRate = 26.397,
fluidNomPressure = 8e+06,
fluidVol = 0.0296,
gasNomFlowRate = 169.755,
gasNomPressure = 101325,
gasVol = 0.0296,
lambda = 20,
metalVol = 5,
pstart_F = 8e+06,
pstart_G = 101325,
rhomcm = 1,
rhonom_F(displayUnit = "kg/m3") = 0.6,
rhonom_G(displayUnit = "kg/m3") = 0.33) annotation(
Placement(visible = true, transformation(origin = {-1.9984e-15, 14}, extent
= {{-20, -20}, {20, 20}}, rotation = 0)));
ThermoPower.Gas.SinkPressure sinkPressure1(
redeclare package Medium = ThermoPower.Media.FlueGas,
T = 106.86 + 273,
p0 = 101325) annotation(
Placement(visible = true, transformation(origin = {92, 14}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.Gas.SensT sensT1(
redeclare package Medium = ThermoPower.Media.FlueGas,
allowFlowReversal = false) annotation(
Placement(visible = true, transformation(origin = {-50, 18}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.Gas.SensT sensT2(
redeclare package Medium = ThermoPower.Media.FlueGas,
allowFlowReversal = false) annotation(
Placement(visible = true, transformation(origin = {50, 18}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SinkPressure sinkPressure2(
redeclare package Medium = ThermoPower.Water.StandardWater,
T = 165 + 273,
h = 2536.2092e5,
p0 = 7.0e5) annotation(
Placement(visible = true, transformation(origin = {92, -60}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SensT sensT3(
redeclare package Medium = ThermoPower.Water.StandardWater) annotation(
Placement(visible = true, transformation(origin = {4, 64}, extent = {{-10,
-10}, {10, 10}}, rotation = -90)));
ThermoPower.Water.SensT sensT4(
redeclare package Medium = ThermoPower.Water.StandardWater,
allowFlowReversal = false) annotation(
Placement(visible = true, transformation(origin = {4, -32}, extent = {{-10,
-10}, {10, 10}}, rotation = -90)));
inner ThermoPower.System system annotation(
Placement(visible = true, transformation(origin = {-90, 90}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.Gas.SourceMassFlow sourceMassFlow1(
redeclare package Medium = ThermoPower.Media.FlueGas,
T = 514 + 273,
p0 = 101325,
w0 = 169.755) annotation(
Placement(visible = true, transformation(origin = {-90, 14}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SourceMassFlow sourceMassFlow2(
redeclare package Medium = ThermoPower.Water.StandardWater,
T = 42.88 + 273,
h = 183.1e3,
p0 = 80e5,
use_T = true,
w0 = 26.397) annotation(
Placement(visible = true, transformation(origin = {2, 92}, extent = {{-10,
-10}, {10, 10}}, rotation = -90)));
ThermoPower.Water.SteamTurbineStodola steamTurbineStodola1(
Kt = 0.01328,
PRstart = 11.43,
explicitIsentropicEnthalpy = false,
pnom = 80.0e5,
pout(fixed = false),
w(fixed = false),
wnom = 26.397,
wstart = 26.397) annotation(
Placement(visible = true, transformation(origin = {12, -72}, extent = {{-14,
-14}, {14, 14}}, rotation = 0)));
equation
connect(sensT2.outlet, sinkPressure1.flange) annotation(
Line(points = {{56, 14}, {82, 14}}, color = {159, 159, 223}));
connect(steamTurbineStodola1.outlet, sinkPressure2.flange) annotation(
Line(points = {{24, -60}, {82, -60}, {82, -60}, {82, -60}}, color = {0, 0,
255}));
connect(sensT4.outlet, steamTurbineStodola1.inlet) annotation(
Line(points = {{0, -38}, {0, -38}, {0, -60}, {0, -60}}, color = {0, 0,
255}));
connect(HX.waterOut, sensT4.inlet) annotation(
Line(points = {{0, -6}, {0, -26}}, color = {0, 0, 255}));
connect(sourceMassFlow1.flange, sensT1.inlet) annotation(
Line(points = {{-80, 14}, {-56, 14}}, color = {159, 159, 223}));
connect(sensT3.outlet, HX.waterIn) annotation(
Line(points = {{0, 58}, {0, 58}, {0, 34}, {0, 34}}, color = {0, 0, 255}));
connect(sourceMassFlow2.flange, sensT3.inlet) annotation(
Line(points = {{0, 82}, {0, 70}}, color = {0, 0, 255}));
connect(HX.gasOut, sensT2.inlet) annotation(
Line(points = {{20, 14}, {44, 14}, {44, 14}, {44, 14}}, color = {159, 159,
223}));
connect(sensT1.outlet, HX.gasIn) annotation(
Line(points = {{-44, 14}, {-20, 14}, {-20, 14}, {-20, 14}}, color = {159,
159, 223}));
annotation(
uses(ThermoPower(version = "3.1"), Modelica(version = "3.2.3")));end
HX_Pump_2_Superheater_2_HPTurbine;
The error message in Dymola says:
The model HX_Pump_2_Superheater_2_HPTurbine is structurally singular.
The problem is structurally singular for the element type Real.
The number of scalar Real unknown elements are 93. The number of
scalar Real equation elements are 93.
The following variables are considered as unknowns, but are not
appearing in the equations. steamTurbineStodola1.phi
Part of the problem for Real elements is overdetermined. There are 1
scalar equations too many in the set:
...
The important part is that steamTurbineStodola1.phi does not appear in the equations. That is the angle of turbine shaft, and it indicates that the turbine-shaft is just "free floating".
Adding an inertia and connecting it to the shaft avoids that problem:
public
Modelica.Mechanics.Rotational.Components.Inertia inertia
annotation (Placement(transformation(extent={{28,-82},{48,-62}})));
equation
connect(steamTurbineStodola1.shaft_b, inertia.flange_a)
annotation (Line(points={{20.96,-72},{28,-72}}, color={0,0,0}));
but then there are other issues related to low pressure etc.
Obviously adding just an inertia with default inertia isn't the correct model - but I believe it indicates what to do.
I have an openmodelica interface.
block InputInterfaceBlock
CPSModel.ConnectionObjects.SocketConnection con = CPSModel.ConnectionObjects.SocketConnection("/pathToSocket/rpcSocket");
Modelica.Blocks.Interfaces.RealOutput y annotation(
Placement(visible = true, transformation(origin = {194, 2}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {106, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
algorithm
while true loop
y := CPSModel.Functions.readFromSocket(con);
print("Message from server : " + String(y) + "\n");
end while;
annotation(
__OpenModelica_simulationFlags(jacobian = "coloredNumerical", s = "dassl", lv = "LOG_STATS"),
uses(Modelica(version = "3.2.2")),
Icon(graphics = {Text(origin = {4, -1}, extent = {{-62, 73}, {62, -73}}, textString = "Input\nInterface", fontName = "DejaVu Sans Mono Bold")}));
annotation(
Placement(visible = true, transformation(origin = {-70, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
end InputInterfaceBlock;
I have an interface block (InputInterfaceBlock) which reads from a socket which is defined in the path. I want this interface block to connect to another block (OutputInterfaceBlock).
block OutputInterfaceBlock
CPSModel.ConnectionObjects.SocketConnection con = CPSModel.ConnectionObjects.SocketConnection("pathToModel/rpcSocket");
Modelica.Blocks.Interfaces.RealInput y annotation(
Placement(visible = true, transformation(origin = {194, 2}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {106, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
algorithm
print("Trying to send : " + String(y) + "\n");
CPSModel.Functions.writeToSocket(con, y);
print("Message send to server." + "\n");
annotation(
__OpenModelica_simulationFlags(jacobian = "coloredNumerical", s = "dassl", lv = "LOG_STATS"),
uses(Modelica(version = "3.2.2")),
Icon(graphics = {Text(origin = {4, -1}, extent = {{-62, 73}, {62, -73}}, textString = "Output\nInterface", fontName = "DejaVu Sans Mono")}));
annotation(
Placement(visible = true, transformation(origin = {-70, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
end OutputInterfaceBlock;
My model is as follows.
model MechatronicSystem
CPSModel.Models.InputInterfaceBlock Input annotation(
Placement(visible = true, transformation(origin = {-90, 8}, extent = {{-28, -28}, {28, 28}}, rotation = 0)));
CPSModel.Models.OutputInterfaceBlock Output annotation(
Placement(visible = true, transformation(origin = {72, 12}, extent = {{28, 28}, {-28, -28}}, rotation = 0)));
equation
connect(Input.y, Output.y) annotation(
Line(points = {{-60, 8}, {44, 8}, {44, 12}, {42, 12}}, color = {0, 0, 127}));
annotation(
uses(Modelica(version = "3.2.2")));
end MechatronicSystem;
I can receive the data in the InputInterfaceBlock from the socket to the model, but when I try to send that data to OutputInterfaceBlock. It is not getting received in the OutputInterfaceBlock.
How can I fix it ?
You are using a while true loop in InputInterfaceBlock, but the different algorithms in Modelica are not co-routines but normal algorithms.
You could replace that with when sample(0.1,0.1) then ... end when; or similarly, which will run the code every 0.1s seconds.
The while-loop causes the model should be stuck in InputInterfaceBlock and OutputInterfaceBlock not be called.