随着我对OpenModelica的了解越来越多,并且意识到自己的经验不足,在OpenModelica中进行调试的难度越来越大。
我已经阅读了许多《 OpenModelica调试》文献,并且大多数文章似乎只是在调试时摸不着头脑。我读过的最有帮助的文章是Martin Sjolund撰写的“用于基于方程的模型的分析,调试和性能改进的工具和方法”,这是Modelica社区中非常著名的人物。不幸的是,我没有足够的背景/经验来学习Sjlund博士的全部著作。 甚至《 OpenModelica用户指南》似乎也几乎没有遍历整个调试过程,其余的要在用户端弄清楚。
我不知道在成功完成模型后会发生什么1.检查并展平(实例化)。对我来说,算法调试器仍然是个谜。
编辑:我遇到的模型代码
模型HRSG_WaterDrum_HXVersion
////当前版本:相位状态:待解释/猜测。可以切换回去。量也应探讨。 。 。从库模型中获取的体积相对于小质量流量而言非常小。当前版本:V&SA = 1 ///
ThermoPower.Water.Drum Drum(
Cm = 4.08e6 * 1.195e-2,
DrumOrientation = 1,
Kcs = 0.01,
Ks = 100,
L = 1.455,
afd = 0.0,
gl = 300,
gv = 150,
hlstart = 203.22e3,
hvstart = 203.22e3,
lm = 19,
pstart =
100e5,
rext = 0.125,
rint = 0.115,
tauc = 5,
tauev = 15) annotation(
Placement(visible = true, transformation(origin = {-49, 3}, extent =
{{-21, -21}, {21, 21}}, rotation = 0)));
ThermoPower.Water.SinkMassFlow Blowdown annotation(
Placement(visible = true, transformation(origin = {-10, -32}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.Flow1DFV2ph Downcomer(
A = 1.903e-3,
Cfnom = 0.01,
Dhyd = 0.04922,
DynamicMomentum = false,
FFtype = ThermoPower.Choices.Flow1D.FFtypes.Colebrook,
H = -15.923,
Kfc = 1,
L = 15.923,
N = 2,
dpnom = 100,
e = 6.1e-4,
hstartin = 1407.6e3,
hstartout = 1407.6e3,
omega = 0.1546,
pstart = 100e5,
wnf = 0.3,
wnom = 21.5) annotation(
Placement(visible = true, transformation(origin = {-64, -50}, extent =
{{-10, -10}, {10, 10}}, rotation = -90)));
ThermoPower.Thermal.MetalTubeFV Downcomer_Wall(
L = 15.923,
Nw = 1,
Tstart1 = 540,
TstartN = 540,
WallRes = true,
lambda = 19,
rext = 0.03015,
rhomcm = 4.08e6,
rint = 0.02461) annotation(
Placement(visible = true, transformation(origin = {-48, -50}, extent =
{{-10, -10}, {10, 10}}, rotation = 90)));
ThermoPower.Water.Header HeaderLower(
Cm = 4.08e6 * 4.51e-4,
S = 1,
Tmstart = 540,
V = 1,
gamma = 2000,
hstart = 1407.6e3,
noInitialPressure = true,
pstart = 101.18e5) annotation(
Placement(visible = true, transformation(origin = {-30, -96}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.PressDrop PressureDrop(
A = 5.62e-5,
FFtype = ThermoPower.Choices.PressDrop.FFtypes.Kinetic,
K = 3,
Kfc = 2,
dpnom = 80000,
wnf = 0.1,
wnom = 21.5) annotation(
Placement(visible = true, transformation(origin = {38, -96}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.Header HeaderUpper(
Cm = 4.08e6 * 4.51e-4,
FluidPhaseStart = ThermoPower.Choices.FluidPhase.FluidPhases.TwoPhases,
S = 1,
Tmstart = 311.1 + 273.15,
V = 1,
gamma = 2000,
hstart = 2724.7e3,
noInitialPressure = true,
pstart = 100.2e5) annotation(
Placement(visible = true, transformation(origin = {72, -36}, extent =
{{-10, -10}, {10, 10}}, rotation = 90)));
ThermoPower.Water.Flow1DFV2ph Pipe2Drum(
A = 5.557e-4,
Cfnom = 0.01,
Dhyd = 0.0266,
FFtype = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
H = 2.779,
HydraulicCapacitance = ThermoPower.Choices.Flow1D.HCtypes.Upstream,
L = 2.779,
N = 2,
Nt = 1,
dpnom = 17000,
e = 9.9e-4,
hstartin = 2724.7e3,
hstartout = 2724.7e3,
noInitialPressure = true,
omega = 0.0835,
pstart = 100e5,
wnf = 0.1,
wnom = 21.5) annotation(
Placement(visible = true, transformation(origin = {19, -9}, extent =
{{-11, 11}, {11, -11}}, rotation = 180)));
ThermoPower.Thermal.MetalTubeFV Pipe2Drum_Wall(
L = 2.779,
Nw = 1,
Tstart1 = 584.25,
TstartN = 584.25,
WallRes = true,
lambda = 19,
rext = 0.0167,
rhomcm = 4.08e6,
rint = 0.0133) annotation(
Placement(visible = true, transformation(origin = {19, 9}, extent = {{-11,
-11}, {11, 11}}, rotation = 180)));
ThermoPower.Water.Flow1DFV2ph Pipe2SH(
A = 3.301 - 4,
Cfnom = 0.004,
Dhyd = 0.0205,
DynamicMomentum = false,
FFtype = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
H = 0,
HydraulicCapacitance = ThermoPower.Choices.Flow1D.HCtypes.Downstream,
L = 11.48,
N = 2,
Nt = 1,
dpnom = 2000,
hstartin = 2724.7e3,
hstartout = 2724.7e3,
omega = 0.0644,
pstart = 100e5,
wnom = 0.06) annotation(
Placement(visible = true, transformation(origin = {-20, 50}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Thermal.MetalTubeFV Pipe2SH_Wall(
L = 11.480,
Nw = 1,
Tstart1 = 584.25,
TstartN = 584.25,
WallRes = true,
lambda = 19,
rext = 0.01305,
rhomcm = 4.08e6,
rint = 0.01025) annotation(
Placement(visible = true, transformation(origin = {-20, 66}, extent =
{{-10, -10}, {10, 10}}, rotation = 180)));
ThermoPower.Water.ValveVap VaporValve(
Av = 2.7e-5,
CvData = ThermoPower.Choices.Valve.CvTypes.Av,
dpnom = 2e+06,
pnom = 95e5,
useThetaInput = true,
wnom = 2 * 0.06) annotation(
Placement(visible = true, transformation(origin = {70, 50}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Thermal.MetalTubeFV Pipe2Valve_Wall(
L = 6.6,
Nw = 1,
Tstart1 = 633.15,
TstartN = 633.15,
WallRes = true,
lambda = 19,
rext = 0.01275,
rhomcm = 4.08e6,
rint = 0.0100) annotation(
Placement(visible = true, transformation(origin = {40, 66}, extent =
{{-10, -10}, {10, 10}}, rotation = 180)));
ThermoPower.Water.Flow1DFV2ph Pipe2Valve(
A = 3.142e-4,
Cfnom = 0.004,
Dhyd = 0.02,
DynamicMomentum = false,
FFtype = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
H = 0,
HydraulicCapacitance = ThermoPower.Choices.Flow1D.HCtypes.Upstream,
L = 6.6,
N = 2,
Nt = 1,
dpnom = 1000,
hstartin = 2962.1e3,
hstartout = 2962.1e3,
omega = 0.0628,
pstart = 96e5,
wnf = 0.1,
wnom = 0.06) annotation(
Placement(visible = true, transformation(origin = {40, 50}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SinkPressure Sink(
p0 = 95e5) annotation(
Placement(visible = true, transformation(origin = {100, 50}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
inner ThermoPower.System system annotation(
Placement(visible = true, transformation(origin = {-90, 90}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput DrumPressure annotation(
Placement(visible = true, transformation(origin = {110, -10}, extent =
{{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110,
-10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput DrumLevel annotation(
Placement(visible = true, transformation(origin = {110, -38}, extent =
{{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110,
-38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealInput Valve_Opening annotation(
Placement(visible = true, transformation(origin = {90, 80}, extent = {{8,
-8}, {-8, 8}}, rotation = 0), iconTransformation(origin = {90, 80}, extent
= {{8, -8}, {-8, 8}}, rotation = 0)));
ThermoPower.PowerPlants.HRSG.Components.HE SH(
Cfnom_F = 0.01,
Cfnom_G = 0.01,
FFtype_F = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
FFtype_G = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
Kfnom_F = 0,
Kfnom_G = 0,
N_F = 2,
N_G = 2,
Tstartbar_G(displayUnit = "K") = 787.72,
dpnom_F = 100,
dpnom_G = 100,
exchSurface_F = 2.752,
exchSurface_G = 2.752,
extSurfaceTub = 5.504,
fluidNomFlowRate = 21.5,
fluidNomPressure = 1e+07,
fluidVol = 0.01376,
gasNomFlowRate = 169.755,
gasNomPressure = 101325,
gasVol = 0.01376,
lambda = 19,
metalVol = 0.01376,
pstart_F = 1e+07,
pstart_G = 101325,
rhomcm = 4.08e6,
rhonom_F(displayUnit = "kg/m3") = 997,
rhonom_G = 1) annotation(
Placement(visible = true, transformation(origin = {10, 50}, extent = {{10,
-10}, {-10, 10}}, rotation = 90)));
ThermoPower.Gas.SourceMassFlow Source_FlueGas(
redeclare package Medium = ThermoPower.Media.FlueGas,
T = 514.57 + 273.15, Xnom = {0.23, 0.02, 0.01, 0.04, 0.7},
p0 = 101325,
w0 = 167.755) annotation(
Placement(visible = true, transformation(origin = {0, 90}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.PowerPlants.HRSG.Components.HE Economizer(
Cfnom_F = 0.01,
Cfnom_G = 0.01,
FFtype_G = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
Kfnom_G = 0,
N_F = 2,
N_G = 2,
Tstartbar_G = 604.74,
dpnom_F = 100,
dpnom_G = 100,
exchSurface_F = 2.752,
exchSurface_G = 2.752,
extSurfaceTub = 5.504,
fluidNomFlowRate = 21.5,
fluidNomPressure = 1e+07,
fluidVol = 0.01376,
gasNomFlowRate = 169.755,
gasNomPressure = 101325,
gasVol = 0.01376,
lambda = 19,
metalVol = 0.01376,
pstart_F = 1e+07,
pstart_G = 101325,
rhomcm = 4.08e6,
rhonom_F(displayUnit = "kg/m3") = 997,
rhonom_G = 1) annotation(
Placement(visible = true, transformation(origin = {-132, 0}, extent =
{{-10, -10}, {10, 10}}, rotation = 90)));
ThermoPower.Water.Flow1DFV2ph Pipe2DrumFeed(
A = 3.301e-4,
Cfnom = 0.004,
Dhyd = 0.0205,
DynamicMomentum = false,
FFtype = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
FluidPhaseStart = ThermoPower.Choices.FluidPhase.FluidPhases.Liquid,
H = 0,
HydraulicCapacitance = ThermoPower.Choices.Flow1D.HCtypes.Downstream,
L = 10,
N = 2,
Nt = 1,
dpnom = 2000,
hstartin = 1407.6e3,
hstartout = 1407.6e3,
omega = 0.0644,
pstart = 100e5,
wnom = 0.06) annotation(
Placement(visible = true, transformation(origin = {-96, 0}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Thermal.MetalTubeFV Pipe2DrumFeed_Wall(
L = 11.480,
Nw = 1,
Tstart1 = 584.25,
TstartN = 584.25,
WallRes = true,
lambda = 19,
rext = 0.01305,
rhomcm = 4.08e6,
rint = 0.01025) annotation(
Placement(visible = true, transformation(origin = {-96, 16}, extent =
{{-10, -10}, {10, 10}}, rotation = 180)));
ThermoPower.Gas.SinkPressure Sink_FlueGas(
redeclare package Medium = ThermoPower.Media.FlueGas, T = 185.25 + 273.15,
Xnom = {0.23, 0.02, 0.01, 0.04, 0.7},
p0 = 101325) annotation(
Placement(visible = true, transformation(origin = {-122, 34}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SourceMassFlow Source_Water(
T = 46.45 + 273.15,
h = 203.22e3,
p0 = 100.0e5,
use_T = true,
w0 = 21.5) annotation(
Placement(visible = true, transformation(origin = {-164, 0}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.PowerPlants.HRSG.Components.HE Risers(
Cfnom_F = 0.01,
Cfnom_G = 0.01,
Kfnom_F = 0,
Kfnom_G = 0,
N_F = 2,
N_G = 2,
Tstartbar_G(displayUnit = "K") = 760.17,
dpnom_F = 100,
dpnom_G = 100,
exchSurface_F = 2.752,
exchSurface_G = 2.752,
extSurfaceTub = 5.504,
fluidNomFlowRate = 21.5,
fluidNomPressure = 1e+07,
fluidVol = 0.01376,
gasNomFlowRate = 169.755,
gasNomPressure = 101325,
gasVol = 0.01376,
lambda = 19,
metalVol = 0.01376,
pstart_F = 1e+07,
pstart_G = 101325,
rhomcm = 4.08e6,
rhonom_F(displayUnit = "kg/m3") = 997,
rhonom_G = 1) annotation(
Placement(visible = true, transformation(origin = {72, -72}, extent =
{{-10, -10}, {10, 10}}, rotation = 180)));
equation
connect(Valve_Opening, VaporValve.theta) annotation(
Line(points = {{90, 80}, {70, 80}, {70, 58}}, color = {0, 0, 127},
thickness = 0.75));
connect(Pipe2Drum_Wall.int, Pipe2Drum.wall) annotation(
Line(points = {{19, 6}, {19, -4.3}}, color = {255, 127, 0}, thickness =
0.75));
connect(Downcomer.wall, Downcomer_Wall.int) annotation(
Line(points = {{-59, -50}, {-51, -50}}, color = {255, 127, 0}, thickness =
0.75));
connect(Pipe2Valve_Wall.int, Pipe2Valve.wall) annotation(
Line(points = {{40, 63}, {40, 55}}, color = {255, 127, 0}, thickness =
0.75));
connect(Pipe2SH_Wall.int, Pipe2SH.wall) annotation(
Line(points = {{-20, 63}, {-20, 56}}, color = {255, 127, 0}, thickness =
0.75));
connect(Pipe2DrumFeed_Wall.int, Pipe2DrumFeed.wall) annotation(
Line(points = {{-96, 13}, {-96, 6}}, color = {255, 127, 0}, thickness =
0.75));
connect(HeaderUpper.outlet, Pipe2Drum.infl) annotation(
Line(points = {{72, -26}, {72, -9.5}, {30, -9.5}, {30, -9}}, color = {0,
0, 255}, thickness = 1));
connect(Pipe2Drum.outfl, Drum.riser) annotation(
Line(points = {{8, -9}, {-33, -9}}, color = {0, 0, 255}, thickness = 1));
connect(Drum.steam, Pipe2SH.infl) annotation(
Line(points = {{-37, 18}, {-36.82, 18}, {-36.82, 49.7}, {-30.82, 49.7}},
color = {0, 0, 255}, thickness = 1));
connect(SH.gasOut, Risers.gasIn) annotation(
Line(points = {{10, 40}, {10, 40}, {10, 20}, {92, 20}, {92, -72}, {82,
-72}, {82, -72}}, color = {159, 159, 223}, thickness = 0.75));
connect(Risers.gasOut, Economizer.gasIn) annotation(
Line(points = {{62, -72}, {-132, -72}, {-132, -10}, {-132, -10}}, color =
{159, 159, 223}, thickness = 0.75));
connect(HeaderUpper.inlet, Risers.waterOut) annotation(
Line(points = {{72, -46}, {72, -46}, {72, -62}, {72, -62}}, color = {0, 0,
255}, thickness = 1));
connect(PressureDrop.outlet, Risers.waterIn) annotation(
Line(points = {{48, -96}, {72, -96}, {72, -82}, {72, -82}, {72, -82}},
color = {0, 0, 255}, thickness = 1));
connect(Economizer.gasOut, Sink_FlueGas.flange) annotation(
Line(points = {{-132, 10}, {-132, 10}, {-132, 34}, {-132, 34}}, color =
{159, 159, 223}, thickness = 0.75));
connect(Blowdown.flange, Drum.blowdown) annotation(
Line(points = {{-20, -32}, {-49, -32}, {-49, -18}}, color = {0, 0, 255},
thickness = 1));
connect(Source_Water.flange, Economizer.waterIn) annotation(
Line(points = {{-154, 0}, {-142, 0}, {-142, 0}, {-142, 0}}, color = {0, 0,
255}, thickness = 1));
connect(Economizer.waterOut, Pipe2DrumFeed.infl) annotation(
Line(points = {{-122, 0}, {-106, 0}, {-106, 0}, {-106, 0}}, color = {0, 0,
255}, thickness = 1));
connect(Pipe2DrumFeed.outfl, Drum.feedwater) annotation(
Line(points = {{-86, 0}, {-69, 0}}, color = {0, 0, 255}, thickness = 1));
connect(Drum.downcomer, Downcomer.infl) annotation(
Line(points = {{-64, -12}, {-64, -12}, {-64, -40}, {-64, -40}}, color =
{0, 0, 255}, thickness = 1));
connect(Downcomer.outfl, HeaderLower.inlet) annotation(
Line(points = {{-64, -60}, {-64, -96}, {-40, -96}}, color = {0, 0, 255},
thickness = 1));
connect(Source_FlueGas.flange, SH.gasIn) annotation(
Line(points = {{10, 90}, {10, 90}, {10, 60}, {10, 60}, {10, 60}, {10,
60}}, color = {159, 159, 223}, thickness = 0.75));
connect(Pipe2SH.outfl, SH.waterIn) annotation(
Line(points = {{-10, 50}, {0, 50}, {0, 50}, {0, 50}, {0, 50}, {0, 50}},
color = {0, 0, 255}, thickness = 1));
connect(SH.waterOut, Pipe2Valve.infl) annotation(
Line(points = {{20, 50}, {30, 50}, {30, 50}, {30, 50}}, color = {0, 0,
255}, thickness = 1));
connect(VaporValve.outlet, Sink.flange) annotation(
Line(points = {{80, 50}, {90, 50}}, color = {0, 0, 255}, thickness = 1));
connect(Pipe2Valve.outfl, VaporValve.inlet) annotation(
Line(points = {{50, 50}, {60, 50}}, color = {0, 0, 255}, thickness = 1));
connect(HeaderLower.outlet, PressureDrop.inlet) annotation(
Line(points = {{-20, -96}, {28, -96}}, color = {0, 0, 255}, thickness =
1));
DrumPressure = Drum.p;
DrumLevel = Drum.y;
annotation(
uses(ThermoPower(version = "3.1"), Modelica(version = "3.2.3")));end
HRSG_WaterDrum_HXVersion;
答案 0 :(得分:6)
运行该模型(至少使用我拥有的ThermoPower版本)会立即停止:
错误:一次检测到以下错误:0外部半径 必须大于内部半径失败条件: SH.metalTube.rext> 0.01
原因是ThermoPower.PowerPlants.HRSG.Components.HE具有:
Thermal.MetalTubeFV metalTube(
rint=fluidVol*4/exchSurface_F/2,
rext=(metalVol + fluidVol)*4/extSurfaceTub/2,
对于extSurfaceTub
,exchSurface_F
和SH
,您将Economizer
设置为Risers
的两倍。
通常,我要说的第一步是问为什么要调试模型?
否则我根本不解释为什么要调试。
然后调试任何模型的第一步是:
更正先前的错误会在初始化过程中停止模型,但是Dymola中有两种警告表明应纠正的问题:
未完全指定初始条件。 Dymola选择了默认的初始条件。
假定连续状态的固定起始值为
Economizer.fluidFlow.htilde [] Economizer.gasFlow.Xtilde [] Risers.fluidFlow.htilde [] Risers.gasFlow.Xtilde [] SH.gasFlow.p(开始= SH.gasFlow.pstart) SH.gasFlow.Xtilde []
起始值冲突
已将变量Economizer.fluidFlow.htilde [1]的起始值选择为Pipe2DrumFeed.hstart [1]作为默认初始条件。 但是,已经从具有相同优先级的冲突起始值的一组别名变量中选择了起始值。 1407600.0,将Pipe2DrumFeed.h [1]的起始值指定为Pipe2DrumFeed.hstart [1]。 100000.0,将Economizer.fluidFlow.htilde [1]的起始值指定为Economizer.fluidFlow.hstart [2]。
已选择迭代变量SH.fluidFlow.htilde [1]以具有猜测值Pipe2Valve.hstart [1]。 但是,已经从具有相同优先级的冲突起始值的一组别名变量中选择了起始值。 2962100.0,将Pipe2Valve.h [1]的起始值指定为Pipe2Valve.hstart [1]。 100000.0,SH.fluidFlow.htilde [1]的起始值为SH.fluidFlow.hstart [2]。
已选择迭代变量HeaderUpper.p以具有猜测值HeaderUpper.pstart。 但是,已经从具有相同优先级的冲突起始值的一组别名变量中选择了起始值。 10020000.0,HeaderUpper.p的起始值指定为HeaderUpper.pstart。 10000000.0,将Pipe2Drum.p的起始值指定为Pipe2Drum.pstart。
已选择迭代变量VaporValve.w以具有猜测值VaporValve.wnom。 但是,已经从具有相同优先级的冲突起始值的一组别名变量中选择了起始值。 0.12,VaporValve.inlet.m_flow的起始值指定为VaporValve.wnom。 -0.12,VaporValve.outlet.m_flow的起始值指定为-VaporValve.wnom。 -0.06,Pipe2Valve.outfl.m_flow的起始值指定为-Pipe2Valve.wnom。