Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Error when start simulation

Error when start simulation

Dear all,

I tried to run a heat model that modified according to a example in OpenModelica v1.14.0-dev-26550-g915982a816 (64-bit), check of models completed successfully but the simulation can't execute.

Code:

model SSHPTest


package Medium1 = Buildings.Media.Water "Medium model";
package Medium2 = Buildings.Media.Water "Medium model";

  parameter Modelica.SIunits.TemperatureDifference dTEva_nominal = -3
    "Temperature difference evaporator outlet-inlet, panel side, 2018/03/25";
  parameter Modelica.SIunits.TemperatureDifference dTCon_nominal = 3
    "Temperature difference condenser outlet-inlet, waterloop side, 2018/03/25";
  parameter Modelica.SIunits.HeatFlowRate QCon_flow_nominal = 4570
    "Condenser heat flow rate, 2018/03/25,12:07";
  parameter Modelica.SIunits.MassFlowRate m1_flow_nominal = QCon_flow_nominal/dTCon_nominal/4200
    "Nominal mass flow rate at condenser";

  Buildings.Fluid.HeatPumps.Carnot_TCon SSHP(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    QCon_flow_max = 5500,
    QCon_flow_nominal = QCon_flow_nominal,
    allowFlowReversal1 = false,
    allowFlowReversal2 = false,
    dTCon_nominal = dTCon_nominal,
    dTEva_nominal = dTEva_nominal,
    dp1_nominal = 5000,
    dp2_nominal = 5000,
    etaCarnot_nominal = 0.7,
    m1_flow_nominal = m1_flow_nominal,
    show_T = true,
    use_eta_Carnot_nominal = true)  annotation(
    Placement(visible = true, transformation(origin = {10, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
   
  Buildings.Fluid.Sources.MassFlowSource_T LOOPin(
  redeclare package Medium = Medium1,
  T = 286,
  m_flow = m1_flow_nominal,
  nPorts = 1)  annotation(
    Placement(visible = true, transformation(origin = {-50, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
 
  Buildings.Fluid.Sources.FixedBoundary LOOPout(
  redeclare package Medium = Medium1,
  nPorts = 1)  annotation(
    Placement(visible = true, transformation(origin = {70, 30}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
 
  Buildings.Fluid.Sources.MassFlowSource_T PANELin(
  redeclare package Medium = Medium2,
  nPorts = 1, use_T_in = true)  annotation(
    Placement(visible = true, transformation(origin = {70, -10}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
 
  Buildings.Fluid.Sources.FixedBoundary PANELout(
  redeclare package Medium = Medium2,
  nPorts = 1)  annotation(
    Placement(visible = true, transformation(origin = {-50, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

Modelica.Blocks.Sources.Constant TCon(k = 299)  annotation(
    Placement(visible = true, transformation(origin = {-50, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

Modelica.Blocks.Sources.Ramp PANELtem(duration = 60, height = 15, offset = 273 +10, startTime = 60)  annotation(
    Placement(visible = true, transformation(origin = {70, -70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.Add QEva(k2 = -1)  annotation(
    Placement(visible = true, transformation(origin = {50, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.Gain mEva(k = -1 / cp2_default / dTEva_nominal)  annotation(
    Placement(visible = true, transformation(origin = {10, -70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

final parameter Modelica.SIunits.SpecificHeatCapacity cp2_default=
    Medium2.specificHeatCapacityCp(Medium2.setState_pTX(
      Medium2.p_default,
      Medium2.T_default,
      Medium2.X_default))
    "Specific heat capacity of medium 2 at default medium state";

equation
  connect(LOOPin.ports[1], SSHP.port_a1) annotation(
    Line(points = {{-40, 30}, {-20, 30}, {-20, 16}, {0, 16}, {0, 16}}, color = {0, 127, 255}));
  connect(SSHP.port_b1, LOOPout.ports[1]) annotation(
    Line(points = {{20, 16}, {40, 16}, {40, 30}, {60, 30}, {60, 30}}, color = {0, 127, 255}));
  connect(PANELin.ports[1], SSHP.port_a2) annotation(
    Line(points = {{60, -10}, {40, -10}, {40, 4}, {20, 4}, {20, 4}}, color = {0, 127, 255}));
  connect(PANELout.ports[1], SSHP.port_b2) annotation(
    Line(points = {{-40, -10}, {-20, -10}, {-20, 4}, {0, 4}, {0, 4}}, color = {0, 127, 255}));
  connect(SSHP.TSet, TCon.y) annotation(
    Line(points = {{-2, 20}, {-10, 20}, {-10, 70}, {-38, 70}, {-38, 70}}, color = {0, 0, 127}));
  connect(PANELin.T_in, PANELtem.y) annotation(
    Line(points = {{82, -6}, {94, -6}, {94, -50}, {42, -50}, {42, -50}}, color = {0, 0, 127}));
  connect(QEva.u1, SSHP.QCon_flow) annotation(
    Line(points = {{38, -44}, {32, -44}, {32, 20}, {22, 20}, {22, 20}}, color = {0, 0, 127}));
  connect(SSHP.P, QEva.u2) annotation(
    Line(points = {{22, 10}, {26, 10}, {26, -56}, {38, -56}, {38, -56}}, color = {0, 0, 127}));
  connect(QEva.y, mEva.u) annotation(
    Line(points = {{62, -30}, {68, -30}, {68, -46}, {-20, -46}, {-20, -70}, {-2, -70}, {-2, -70}}, color = {0, 0, 127}));
  connect(mEva.y, PANELin.m_flow_in) annotation(
    Line(points = {{22, -70}, {52, -70}, {52, -52}, {88, -52}, {88, -2}, {82, -2}, {82, -2}}, color = {0, 0, 127}));

annotation(
    uses(Buildings(version = "5.1.0"), Modelica(version = "3.2.2")));end SSHPTest;

I would really appreciate any kind of hints/help.

Best wishes,

Re: Error when start simulation

Mingzhe37 wrote:

but the simulation can't execute

is there any error messages why the simulation would not execute?

Re: Error when start simulation

Hi Arinomo23, thank you for your reply, this is the error message
"The following assertion has been violated during initialization at time 0.000000
noEvent(abs(SSHP.eva.Q_flow) < 200.0 * SSHP.eva.vol.steBal.cp_default * max(0.001 * SSHP.eva.vol.steBal.m_flow_small, abs(PANELin.m_flow)))"
"In SSHPTest.SSHP.eva.vol.steBal: Energy may not be conserved for small mass flow rates.
   The implementation may require prescribedHeatFlowRate = false."

Re: Error when start simulation

Mingzhe37 wrote:

"In SSHPTest.SSHP.eva.vol.steBal: Energy may not be conserved for small mass flow rates.
   The implementation may require prescribedHeatFlowRate = false."

if i understand correctly, there is your problem. The simulation won't run because the assertion condition is not fulfilled.

Re: Error when start simulation

HI Arinomo23, thank you for your help, can you explain the assertion condition here in more detail?

Re: Error when start simulation

Code:

 noEvent(abs(SSHP.eva.Q_flow) < 200.0 * SSHP.eva.vol.steBal.cp_default * max(0.001 * SSHP.eva.vol.steBal.m_flow_small, abs(PANELin.m_flow))) 

is the condition.

And according to the message:

Code:

In SSHPTest.SSHP.eva.vol.steBal: Energy may not be conserved for small mass flow rates.

   The implementation may require prescribedHeatFlowRate = false.

is your mass flow rates too small and it suggest you set the  prescribedHeatFlowRate = false.

maybe it will help you. I've never used the building library, but that is what i can understand from the error message. Hope the information helps you .

Cheers
A

Edited by: Arinomo23 - Jul-02-19 08:34:08

Re: Error when start simulation

Thank your again Arinomo23, I will try to reset the parameters.

There are 0 guests and 0 other users also viewing this topic