我正在使用OpenModelica为一个集中的太阳能热电厂建模。我已经为泵和冷凝器创建了一个模型,他们在单独测试时成功计算出口条件。但是出于测试目的,当我在闭环中连接泵和冷凝器模型时,模型将无法模拟,并且我收到以下错误:
[1] 22:16:26 Translation Error
Internal error Circular Equalities Detected for Variables:
condenser2.o.mdot
condenser2.i.mdot
----------------------------------
pump2.i.mdot
condenser2.o.mdot
----------------------------------
pump2.o.mdot
pump2.i.mdot
----------------------------------
[2] 22:16:26 Symbolic Error
[PTC: 995:5-995:122]: Model is structurally singular, error found sorting equations
这很可能与连接器和质量流量有关,但是,我不知道需要改变什么才能解决这个问题。
系统模型如下所示:
model Pump_condenser
PTC.Pump2 pump2 annotation();
PTC.Condenser2 condenser2 annotation();
equation
connect(condenser2.o, pump2.i) annotation();
connect(pump2.o, condenser2.i) annotation();
end Pump_condenser;
泵的型号如下所示:
model Pump2
extends PTC.PartialModels.PartialCSTComponentSISO;
// Imports
import Modelica.SIunits.*;
import ThermoCycle.Media.*;
import Modelica.Constants;
// Outlet isentropic state
Medium.ThermodynamicState state_isentropic;
// Parameters
parameter Length D = 2 "Diameter of pump";
parameter Length w = 1 "Width of pump";
parameter Real eta(unit = "1") = 0.7 "Isentropic efficiency of pump";
constant Real pi = 2 * Modelica.Math.asin(1.0) "3.14159265358979";
// Variables
Power Wdot "Power input to pump";
SpecificEntropy s_i "Specific entropy at inlet";
SpecificEnthalpy hs "Specific enthalpy after isentropic compression";
initial equation
medium_i.T = 363;
medium_i.p = 80000;
medium_o.T = 450;
medium_o.p = 800000;
i.h = Medium.specificEnthalpy(medium_i.state);
equation
// Energy balance
m * der(u) = (-Wdot) + i.mdot * actualStream(i.h) + o.mdot * actualStream(o.h);
// Isentropic efficiency
s_i = Medium.specificEntropy(medium_i.state) "Get inlet entropy";
state_isentropic = Medium.setState_ps(medium_o.p, s_i) "Isentropic state";
hs = Medium.specificEnthalpy(state_isentropic);
eta = (hs - medium_i.h) / (medium_o.h - medium_i.h) "Isentropic efficiency";
// Inlet pressure
medium_i.p = 80000;
// Mass
m = pi * D ^ 2 * w * d / 4 "Mass of fluid in control volume";
// Simulation parameters
annotation();
annotation();
end Pump2;
冷凝器的型号如下所示:
model Condenser2
extends PTC.PartialModels.PartialCSTComponentSISO;
// Imports
import Modelica.SIunits.*;
// Parameters
parameter Length L = 5 "Length of one tube";
parameter Area A = 0.02 "Cross sectional area of tubes";
parameter Integer N(unit = "1") = 10 "Number of tubes";
parameter Temperature Tinf = 298 "Ambient temperature";
parameter CoefficientOfHeatTransfer k = 3000 "Convection coefficient";
// Variables
HeatFlowRate Qdot "Heat flow rate from power block to condenser fluid";
Temperature T "Average temp in CV";
initial equation
medium_i.T = 450;
medium_i.p = 8000000;
medium_o.T = 363;
medium_o.p = 80000;
i.h = Medium.specificEnthalpy(medium_i.state);
equation
// Energy balance
m * der(u) = Qdot + i.mdot * actualStream(i.h) + o.mdot * actualStream(o.h);
// Inlet pressure
medium_i.p = 8000000;
// Average temperature
T = (medium_i.T + medium_o.T) / 2;
// Heat flow rate
Qdot = -k * (T - Tinf) "Newtons law of cooling";
// Mass
m = N * L * A * d "Mass of fluid in CV";
// Simulation parameters
annotation();
annotation();
end Condenser2;
两种模型都扩展了以下部分模型:
partial model PartialCSTComponentSISO
// Imports
import Modelica.SIunits.*;
// Fluid imports
replaceable package Medium = Modelica.Media.Water.StandardWater annotation(
choicesAllMatching = true);
// Set up inlet and outlet media
Medium.BaseProperties medium_i;
Medium.BaseProperties medium_o;
// Connectors
PTC.inlet i(redeclare package Medium = Medium) annotation();
PTC.outlet o(redeclare package Medium = Medium) annotation();
// Variables
SpecificInternalEnergy u "Average specific internal energy in CV (control volume)";
Mass m "Mass contained in CV";
Density d "Average density of fluid in CV";
// Parameters
parameter MassFlowRate mdotCV = 3.0 "Mass flow rate through CV";
equation
// Fluid equations
medium_i.h = i.h;
medium_i.p = i.p;
medium_o.p = o.p;
medium_o.h = o.h;
// Mass flow rate
i.mdot = mdotCV;
o.mdot + i.mdot = 0 "Mass balance";
// Internal energy
u = (medium_i.u + medium_o.u) / 2 "Internal energy in CV is average of inlet and outlet u";
// Miscellaneous
d = (medium_i.d + medium_o.d) / 2 "d in CV is average of inlet and outlet densities";
end PartialCSTComponentSISO;
入口和出口连接器具有以下结构:
connector inlet
// Imports //
import Modelica.SIunits.*;
// Fluid imports //
replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model" annotation(
choicesAllMatching = true);
// Energy variables //
Medium.AbsolutePressure p;
stream Medium.SpecificEnthalpy h;
// Flow variables //
flow Medium.MassFlowRate mdot;
annotation();
end inlet;