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
  • Index
  • » Users
  • » Félicia
  • » Profile

Posts

Posts

Hi,

I want to create a java interface and simulate my model OpenModelica to this interface.
But I don't know how link the both language.

thanks
Felicia

Good Morning,


I have a problem with the thermodynamic use in Openmodelica. I want calculate properties of my fluid. So I test functions in Openmodelica.Media. When I use function s_ph to return entropy with input pressure and enthalpy, I get a wrong   value. I verified this value with three different solver.

Is there a revision of these tables thermodynamics ? Or a library more exact?

thanks

I have a connector with

flow Medium.MassFlowRate m_flow
Medium.AbsolutePressure p
  stream Medium.SpecificEnthalpy h_outflow

When I connect 2 components and I instantiate the model, I have 2 equations for pressure and mass flow.
But no equations for the enthlapy. The enthalpy of first components isn't transfered  to other components.

I create a new library with the components which I need

When I instantiate I get :

class testturbine
  parameter Boolean system.allowFlowReversal = true "= false to restrict to design flow direction (flangeA -> flangeB)";
  parameter enumeration(DynamicFreeInitial, FixedInitial, SteadyStateInitial, SteadyState) system.Dynamics = Gemco.Choices.System.Dynamics.DynamicFreeInitial;
  parameter Real turbine1.eta_iso = 0.92 "Nominal isentropic efficiency";
  parameter Real turbine1.eta_mech = 0.98 "Mechanical efficiency";
  Real turbine1.w(quantity = "MassFlowRate", unit = "kg/s") "Mass flow rate";
  Real turbine1.hin(quantity = "SpecificEnergy", unit = "J/kg") "Inlet enthalpy";
  Real turbine1.hout(quantity = "SpecificEnergy", unit = "J/kg") "Outlet enthalpy";
  Real turbine1.hiso(quantity = "SpecificEnergy", unit = "J/kg") "Isentropic outlet enthalpy";
  Real turbine1.sin(quantity = "SpecificEntropy", unit = "J/(kg.K)") "Inlet entropy";
  Real turbine1.pin(quantity = "Pressure", unit = "Pa", displayUnit = "bar", min = 0.0, nominal = 100000.0) "inlet pressure";
  Real turbine1.pout(quantity = "Pressure", unit = "Pa", displayUnit = "bar", min = 0.0, nominal = 100000.0) = 400000.0 "Outlet pressure";
  Real turbine1.Pm(quantity = "Power", unit = "W") "Mechanical power input";
  Real turbine1.inlet.m_flow(quantity = "MassFlowRate.WaterIF97", unit = "kg/s", min = if turbine1.allowFlowReversal then -9.999999999999999e+059 else 0.0, max = 100000.0) "Mass flow rate from the connection point into the component";
  Real turbine1.inlet.p(quantity = "Pressure", unit = "Pa", displayUnit = "bar", min = 0.0, max = 100000000.0, start = 100000.0, nominal = 100000.0) "Thermodynamic pressure in the connection point";
  Real turbine1.inlet.h_outflow(quantity = "SpecificEnergy", unit = "J/kg", min = -10000000000.0, max = 10000000000.0, nominal = 1000000.0) "Specific thermodynamic enthalpy close to the connection point if m_flow < 0";
  Real turbine1.outlet.m_flow(quantity = "MassFlowRate.WaterIF97", unit = "kg/s", min = -100000.0, max = if turbine1.allowFlowReversal then 9.999999999999999e+059 else 0.0) "Mass flow rate from the connection point into the component";
  Real turbine1.outlet.p(quantity = "Pressure", unit = "Pa", displayUnit = "bar", min = 0.0, max = 100000000.0, start = 100000.0, nominal = 100000.0) "Thermodynamic pressure in the connection point";
  Real turbine1.outlet.h_outflow(quantity = "SpecificEnergy", unit = "J/kg", min = -10000000000.0, max = 10000000000.0, nominal = 1000000.0) "Specific thermodynamic enthalpy close to the connection point if m_flow < 0";
  parameter Boolean turbine1.allowFlowReversal = system.allowFlowReversal "= true to allow flow reversal, false restricts to design direction";
  parameter Real sourcew1.w0(quantity = "MassFlowRate", unit = "kg/s") = 100.0 "Nominal mass flowrate";
  parameter Real sourcew1.p0(quantity = "Pressure", unit = "Pa", displayUnit = "bar") = 1000000.0 "Nominal pressure";
  parameter Real sourcew1.G(quantity = "HydraulicConductance", unit = "(kg/s)/Pa") = 0.0 "Hydraulic conductance";
  parameter Real sourcew1.h(quantity = "SpecificEnergy", unit = "J/kg") = 2500000.0 "Nominal specific enthalpy";
  Real sourcew1.w(quantity = "MassFlowRate", unit = "kg/s") "Mass flowrate";
  Real sourcew1.flange.m_flow(quantity = "MassFlowRate.WaterIF97", unit = "kg/s", min = -100000.0, max = if sourcew1.allowFlowReversal then 9.999999999999999e+059 else 0.0) "Mass flow rate from the connection point into the component";
  Real sourcew1.flange.p(quantity = "Pressure", unit = "Pa", displayUnit = "bar", min = 0.0, max = 100000000.0, start = 100000.0, nominal = 100000.0) "Thermodynamic pressure in the connection point";
  Real sourcew1.flange.h_outflow(quantity = "SpecificEnergy", unit = "J/kg", min = -10000000000.0, max = 10000000000.0, nominal = 1000000.0) "Specific thermodynamic enthalpy close to the connection point if m_flow < 0";
  input Real sourcew1.in_w0;
  input Real sourcew1.in_h;
  parameter Boolean sourcew1.allowFlowReversal = system.allowFlowReversal "= true to allow flow reversal, false restricts to design direction";
equation
  turbine1.hin = smooth(0, if turbine1.inlet.m_flow > 0.0 then sourcew1.flange.h_outflow else turbine1.inlet.h_outflow);
  turbine1.hout = turbine1.outlet.h_outflow;
  turbine1.pin = turbine1.inlet.p;
  turbine1.pout = turbine1.outlet.p;
  turbine1.w = turbine1.inlet.m_flow;
  turbine1.sin = Modelica.Media.Water.IF97_Utilities.s_ph(turbine1.pin, turbine1.hin, 0, 0);
  turbine1.hiso = Modelica.Media.Water.IF97_Utilities.h_ps(turbine1.pin, turbine1.sin, 0, 0);
  turbine1.hout = turbine1.hin + (turbine1.hiso - turbine1.hin) / turbine1.eta_iso;
  turbine1.Pm = turbine1.eta_mech * turbine1.w * (turbine1.hin - turbine1.hout);
  turbine1.inlet.m_flow + turbine1.outlet.m_flow = 0.0;
  sourcew1.flange.m_flow = -sourcew1.w;
  sourcew1.w = sourcew1.in_w0;
  sourcew1.in_w0 = sourcew1.w0;
  sourcew1.flange.h_outflow = sourcew1.in_h;
  sourcew1.in_h = sourcew1.h;
  turbine1.inlet.m_flow + sourcew1.flange.m_flow = 0.0;
  turbine1.outlet.m_flow = 0.0;
  sourcew1.flange.p = turbine1.inlet.p;
end testturbine;


I have turbine.outlet.m_flow =0 but I fixed a source of mass flow
A equation is missing for the connectror between sourcew and turbine for the enthalpy

I check "instantiate Model" I have a problem with mass flow. I give a value but it give 0 for inlet abd outlet

Yes but Check Model give just the number. Can we the list of variable and equation ?

My model is :


model Turbine
  replaceable package Medium = Gemco.Water.StandardWater constrainedby Modelica.Media.Interfaces.PartialMedium;
  parameter Real eta_iso = 0.92 "Nominal isentropic efficiency";
  parameter Real eta_mech = 0.98 "Mechanical efficiency";
  //parameter MassFlowRate wnom "Inlet nominal flowrate";
  //parameter Pressure pnom "Nominal inlet pressure";
  parameter Boolean allowFlowReversal = system.allowFlowReversal "= true to allow flow reversal, false restricts to design direction";
  outer Gemco.System system "System wide properties";
  flow MassFlowRate w "Mass flow rate";
  SI.SpecificEnthalpy hin "Inlet enthalpy";
  SI.SpecificEnthalpy hout "Outlet enthalpy";
  SI.SpecificEnthalpy hiso "Isentropic outlet enthalpy";
  SI.SpecificEntropy sin "Inlet entropy";
  SI.AbsolutePressure pin "inlet pressure";
  SI.AbsolutePressure pout "Outlet pressure";
  Power Pm "Mechanical power input";
  Water.FlangeA inlet(redeclare package Medium = Medium, m_flow(min = if allowFlowReversal then -Modelica.Constants.inf else 0)) annotation(Placement(transformation(extent = {{-100, 60}, {-60, 100}}, rotation = 0)));
  Water.FlangeB outlet(redeclare package Medium = Medium, m_flow(max = if allowFlowReversal then +Modelica.Constants.inf else 0)) annotation(Placement(transformation(extent = {{60, 60}, {100, 100}}, rotation = 0)));
equation
  //Conditions entres sortie
  hin = inStream(inlet.h_outflow);
  hout = outlet.h_outflow;
  pin = inlet.p;
  pout = outlet.p;
  w = inlet.m_flow;
  //Bilans
  sin = Modelica.Media.Water.IF97_Utilities.s_ph(pin, hin) "entropie inlet";
  hiso = Modelica.Media.Water.IF97_Utilities.h_ps(pin, sin) "Enthalpie cas isentropique";
  hout = hin + (hiso - hin) / eta_iso "Computation of outlet enthalpy";
  Pm = eta_mech * w * (hin - hout) "Mechanical power from the steam";
  inlet.m_flow + outlet.m_flow = 0 "Mass balance";
  annotation(Icon(graphics = {Polygon(points = {{-28, 76}, {-28, 28}, {-22, 28}, {-22, 82}, {-60, 82}, {-60, 76}, {-28, 76}}, lineColor = {0, 0, 0}, lineThickness = 0.5, fillColor = {0, 0, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{26, 56}, {32, 56}, {32, 76}, {60, 76}, {60, 82}, {26, 82}, {26, 56}}, lineColor = {0, 0, 0}, lineThickness = 0.5, fillColor = {0, 0, 255}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-60, 8}, {60, -8}}, lineColor = {0, 0, 0}, fillPattern = FillPattern.Sphere, fillColor = {160, 160, 164}), Polygon(points = {{-28, 28}, {-28, -26}, {32, -60}, {32, 60}, {-28, 28}}, lineColor = {0, 0, 0}, lineThickness = 0.5, fillColor = {0, 0, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-130, -60}, {128, -100}}, textString = "%name")}), Diagram(graphics));
end Turbine;



I check I have 12 equations and 14 variables
I agree for 14 variables but I have only 10 equations

I create a condenser and a turbin. But when I simulate I have too few equation.

How can I a list of my variables and equations?  Can I know which variable isn't calculate?

Thanks
Dubret Félicia

I want to add a new component in the library ThermoPower.

I added a new package in ThermoPower package.mo.  Then I added mypackage.mo in the file of thermopower. And I added the name of my package in the file .order

But when I wanted to open package of thermopower, it wrote "missing name water thermal ..." All package already present in thermopower.

How can I add a new component in the existing library?

Thanks

Best regards
Dubret Félicia

Thank you
It help me

May-19-14 17:46:06
Category: Programming

Hello,

I want to use a function of thermofluid package in my model of thermopower.
I import  ThermoFluid.BaseClasses.MediumModels.SteamIF97;

and in the part equation i call my function
(Ts,hvs,hls,rhovs,rhols) = ThermoFluid.BaseClasses.MediumModels.SteamIF97.boundaryvals_p(p);

But I have a error

ThermoFluid.BaseClasses.MediumModels.SteamIF97.boundaryvals_p not found in scope ThermoPower.Gemco.condenseur (looking for a function or record).
Error: Error occurred while flattening model ThermoPower.Gemco.condenseur

Have I make a error in the synthaxe ?

Thanks
Best regards

I want simulate a condenser fo power plant. I take a source pressure, a source masse flow, a condenser and a sinkpressure.
When I cheked my system, I had the same nomber of equations and variables.
But I simulated and I obtain a errror :

An independent subset of the model has imbalanced number of equations (29) and variables (30).

I don't understand and I don't know how debugg my model.


Best regards

Félicia

May-15-14 15:13:16
Problems when running fluid exampls in OMEditor

I have the same error message when I simulate only a pump.

I have a pressure source and masslfow source before my pump and a sink pressure after.
Must I use a other compiler ? I don't understand why openmodelica don't solve non linear problem.

Thanks

May-14-14 15:23:01
Category: Programming

Hello,

I begin with Modelica. I must simulate a power plant with boiler, condenser, turbine and pump. Also I am trying to simulate only one pump but I have a error message :
Process crashed
Simulation process exited with code -1

I don't understand why.

My model is

model pompe
  ThermoPower.Water.SourcePressure sourcepressure1(use_in_p0 = true, use_in_h = true, p0 = 10000000) annotation(Placement(visible = true, transformation(origin = {-40,0}, extent = {{-10,-10},{10,10}}, rotation = 0)));

  ThermoPower.Water.ThroughMassFlow throughmassflow1(w0 = 200, use_in_w0 = true) annotation(Placement(visible = true, transformation(origin = {0,0}, extent = {{-10,-10},{10,10}}, rotation = 0)));

  ThermoPower.Water.Pump pump1(V = 0.01, hstart = 0, wstart = 0, usePowerCharacteristic = false, n0 = 120, w0 = 200, dp0 = 3000000, redeclare function flowCharacteristic = ThermoPower.Functions.PumpCharacteristics.quadraticFlow(q_nom = {0,0.001,0.0015}, head_nom = {60,30,0}), initOpt = ThermoPower.Choices.Init.Options.steadyState) annotation(Placement(visible = true, transformation(origin = {40,0}, extent = {{-10,-10},{10,10}}, rotation = 0)));

  ThermoPower.Water.SinkPressure sinkpressure1(use_in_p0 = true, p0 = 1000000) annotation(Placement(visible = true, transformation(origin = {80,0}, extent = {{-10,-10},{10,10}}, rotation = 0)));

  Modelica.Blocks.Sources.Constant pressure_in(k = 100000) annotation(Placement(visible = true, transformation(origin = {-60,40}, extent = {{-10,-10},{10,10}}, rotation = 0)));

  Modelica.Blocks.Sources.Constant enthalpy_in(k = 1000000) annotation(Placement(visible = true, transformation(origin = {-60,80}, extent = {{-10,-10},{10,10}}, rotation = 0)));

  Modelica.Blocks.Sources.Constant massflow_in(k = 150) annotation(Placement(visible = true, transformation(origin = {-20,80}, extent = {{-10,-10},{10,10}}, rotation = 0)));

  inner ThermoPower.System system annotation(Placement(visible = true, transformation(origin = {-80,-80}, extent = {{-10,-10},{10,10}}, rotation = 0)));

  Modelica.Blocks.Sources.Constant pressure_out(k = 600000) annotation(Placement(visible = true, transformation(origin = {60,80}, extent = {{-10,-10},{10,10}}, rotation = 0)));
equation
  connect(pressure_out.y,sinkpressure1.in_p0) annotation(Line(points = {{71,80},{75.98569999999999,80},{75.98569999999999,8.960570000000001},{75.98569999999999,8.960570000000001}}));
  connect(massflow_in.y,throughmassflow1.in_w0) annotation(Line(points = {{-9,80},{-3.89118,80},{-3.89118,7.13382},{-3.89118,7.13382}}));
  connect(enthalpy_in.y,sourcepressure1.in_h) annotation(Line(points = {{-49,80},{-35.8312,80},{-35.8312,10.0522},{-35.8312,10.0522}}));
  connect(pressure_in.y,sourcepressure1.in_p0) annotation(Line(points = {{-49,40},{-44.1,40},{-44.1,10.7007},{-44.1,10.7007}}));
  connect(pump1.outfl,sinkpressure1.flange) annotation(Line(points = {{46,7},{68.5796,7},{68.5796,0.860832},{68.5796,0.860832}}));
  connect(throughmassflow1.outlet,pump1.infl) annotation(Line(points = {{10,0},{31.2769,0},{31.2769,1.72166},{31.2769,1.72166}}));
  connect(sourcepressure1.flange,throughmassflow1.inlet) annotation(Line(points = {{-30,0},{-9.18221,0},{-9.18221,-0.573888},{-9.18221,-0.573888}}));
  annotation(Icon(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2})), Diagram(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2})));
end pompe;


Thank you for your help

  • Index
  • » Users
  • » Félicia
  • » Profile
You are here: