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

Systeme is underdetermined

Systeme is underdetermined

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

Edited by: Félicia - Jun-03-14 14:43:02

Re: Systeme is underdetermined

If you use the model "instantiate Model" on the left side of the button "Check Model", the flattened model appears in a small window,
so you may check the number of variables and equations.

Re: Systeme is underdetermined

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

Re: Systeme is underdetermined

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

Re: Systeme is underdetermined

Hi Felicia,

It would be helpful if you give all the models as they all are interdependent. I cannot instantiate the turbine model that you have given. It cannot find "Gemco.Water.StandardWater", water.FlangeA, water.FlangeB. If these are already in some Modelica Library, please do tell where they are located.

As for the Instantiate Model issue, Instantiate does not solve the model. It merely gets all the equations, variables etc from everything that you have included in your Turbine model and shows it together.

Regards,
Sanjay

Re: Systeme is underdetermined

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

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