- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Initializing error
Initializing error
Initializing error
Hi,
I have been trying to teach myself Modelica by starting from the examples and changeing simple things here and there. Goal is to be able to create big thermohydraulic models for work.
My model compiles fine, but has multitudes of errors (division by zero) on initializing. It works fine when I uncomment the output definitions. However, I do not need these, and I do not understand why this creates an error.
Ideas anyone?
Code:
model OneMass "Cooling of one hot mass"
extends Modelica.Icons.Example;
parameter Modelica.SIunits.Temperature TAmb(displayUnit="degC")=293.15
"Ambient temperature";
parameter Modelica.SIunits.Temperature TMass(displayUnit="degC")=313.15
"Initial temperature of mass";
// output Modelica.SIunits.TemperatureDifference dTMass=
// heatCapacitor.port.T-TAmb "Mass over Ambient";
// output Modelica.SIunits.TemperatureDifference dTtoPipe=heatCapacitor.port.T-pipe.T_q
// "Mass over Coolant";
// output Modelica.SIunits.TemperatureDifference dTCoolant=pipe.dT
// "Coolant's temperature increase";
Modelica.Thermal.FluidHeatFlow.Sources.Ambient ambient1(
constantAmbientPressure=0,constantAmbientTemperature=TAmb, medium=Modelica.Thermal.FluidHeatFlow.Media.Water(), useTemperatureInput = true)
annotation (Placement(transformation(extent={{-60,-10},{-80,10}})));
Modelica.Thermal.FluidHeatFlow.Sources.VolumeFlow pump(
T0=TAmb,
constantVolumeFlow=1,
m= 1,medium=Modelica.Thermal.FluidHeatFlow.Media.Water(),
useVolumeFlowInput= false)
annotation (Placement(transformation(extent={{-40,-10},{-20,10}})));
Modelica.Thermal.FluidHeatFlow.Components.Pipe pipe(
T0=TAmb,
T0fixed=true, V_flow(start = 1),
V_flowLaminar=0.1,
V_flowNominal=1,
dpLaminar(displayUnit="Pa") = 0.1,
dpNominal(displayUnit="Pa") = 1,
h_g=0,
m= 1,medium=Modelica.Thermal.FluidHeatFlow.Media.Water(),
useHeatPort=true)
annotation (Placement(transformation(extent={{0,-10},{20,10}})));
Modelica.Thermal.FluidHeatFlow.Sources.Ambient ambient2(
constantAmbientPressure=0,constantAmbientTemperature=TAmb, medium=Modelica.Thermal.FluidHeatFlow.Media.Water())
annotation (Placement(transformation(extent={{40,-10},{60,10}})));
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor(
C= 10, T( fixed=true,start=TMass))
annotation (Placement(transformation(
origin={10,-60},
extent={{10,-10},{-10,10}},
rotation=180)));
Modelica.Thermal.HeatTransfer.Components.ThermalConductor thermalConductor(G=1)
annotation (Placement(transformation(
origin={10,-30},
extent={{-10,-10},{10,10}},
rotation=90)));
Modelica.Blocks.Sources.Ramp ramp(duration = 5, height = 10, offset = TAmb, startTime = 5) annotation(
Placement(visible = true, transformation(origin = {-136, -6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(ambient1.flowPort, pump.flowPort_a) annotation(
Line(points = {{-60, 0}, {-40, 0}}, color = {255, 0, 0}));
connect(pump.flowPort_b, pipe.flowPort_a) annotation(
Line(points = {{-20, 0}, {0, 0}}, color = {255, 0, 0}));
connect(pipe.flowPort_b, ambient2.flowPort) annotation(
Line(points = {{20, 0}, {40, 0}}, color = {255, 0, 0}));
connect(thermalConductor.port_a, heatCapacitor.port) annotation(
Line(points = {{10, -40}, {10, -45}, {10, -50}}, color = {191, 0, 0}));
connect(pipe.heatPort, thermalConductor.port_b) annotation(
Line(points = {{10, -10}, {10, -20}}, color = {191, 0, 0}));
connect(ambient1.ambientTemperature, ramp.y) annotation(
Line(points = {{-80, -6}, {-124, -6}, {-124, -6}, {-124, -6}}, color = {0, 0, 127}));
annotation(
Documentation(info = "<html>
<p>
7th test example: OneMass
</p>
A thermal capacity is coupled with a coolant flow.
Different initial temperatures of thermal capacity and pipe's coolant get ambient's temperature,
the time behaviour depending on coolant flow.
</html>"),
experiment(StopTime = 1.0, Interval = 0.001),
uses(Modelica(version = "3.2.3")));
end OneMass;
Re: Initializing error
It seems strange, because I am getting no error with your model, just a traslation warning.
Which soft are you using?
Re: Initializing error
Re: Initializing error
Hi,
I'm getting similar errors when using the new frontend, but no error with the old, that is the one I am using by default.
Could you try to go to Simulation Setup, Translation flags, and activate the check box Enable old frontend for code generation?
Re: Initializing error
Well they are just changing now from the old frontend to the new, that is much faster in translation. But, till now, it seems more limited than the old one. We need to wait for its improvement.
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Initializing error