Reputation: 1
I am currently simulating a cooling circuit in OpenModelica. I want to give the simulation a starting value of the temperature. To do this, I insert the model of the medium into the circuit and specify an initial value with 'initial equation'. The temperature specification should only be used for the start. Since the circuit is closed, the temperatures for the next loop should calculate themselves through the heat flows in the circuit. Unfortunately, the code does not work as expected. Does anyone know how I can give the medium a start value without needing any further input afterwards?
model Glysantin_FC_G20 "properties of Glysantin FC G20"
// Parameter
parameter SpecificHeatCapacity cp = 3560;
parameter Density rho = 1042;
parameter Temperature T = 338.15;
Interfaces.FluidPort_a inflow annotation(...);
Interfaces.FluidPort_b outflow annotation(...);
initial equation
outflow.T = T;
outflow.m_flow = -inflow.m_flow;
outflow.V_flow = -inflow.V_flow;
inflow.p = outflow.p;
equation
outflow.T = inflow.T;
outflow.m_flow = -inflow.m_flow;
outflow.V_flow = -inflow.V_flow;
inflow.p = outflow.p;
annotation(...);
end Glysantin_FC_G20;
Upvotes: 0
Views: 328
Reputation: 12527
It's a bit difficult to fully answer without the full model and error message. However, the initial equations are combined with the normal equations so they should not be duplicated giving just:
initial equation
outflow.T = T;
Alternatively you can remove all initial equation and write it as:
Interfaces.FluidPort_b outflow(T(start=T),fixed=true) annotation(...);
or possibly even without the fixed=true.
Upvotes: 1