我在 OpenModelica 上做了一个模型,简单地将固定体积源与恒压源连接起来。但是,我收到错误并且无法设置它。你能帮我吗,我是这个软件的新手?谢谢你的帮助,艾玛
Modelica.Fluid.Vessels.ClosedVolume volume(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, V = 6e-4, nPorts = 1, p_start = 40e5, use_portsData = false) annotation(
Placement(visible = true, transformation(origin = {-174, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-170, 150}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary1(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, nPorts = 1, p = 100000) annotation(
Placement(visible = true, transformation(origin = {154, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Modelica.Media.Air.SimpleAir, diameter = 8e-3, length = 351.4e-3, nParallel = 1) annotation(
Placement(visible = true, transformation(origin = {-72, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
CurvedBendModel curvedBendModel(redeclare package Medium = Modelica.Media.Air.SimpleAir, geometry = Geometry(d_hyd = 8e-3, R_0 = 25.5e-3, delta = 90)) annotation(
Placement(visible = true, transformation(origin = {-2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe1(redeclare package Medium = Modelica.Media.Air.SimpleAir, diameter = 8e-3, length = 166e-3, nParallel = 1) annotation(
Placement(visible = true, transformation(origin = {76, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(volume.ports[1], pipe.port_a) annotation(
Line(points = {{-164, 0}, {-82, 0}}, color = {0, 127, 255}));
connect(pipe.port_b, curvedBendModel.port_a) annotation(
Line(points = {{-62, 0}, {-12, 0}}, color = {0, 127, 255}));
connect(curvedBendModel.port_b, pipe1.port_a) annotation(
Line(points = {{8, 0}, {66, 0}}, color = {0, 127, 255}));
connect(pipe1.port_b, boundary1.ports[1]) annotation(
Line(points = {{86, 0}, {144, 0}}, color = {0, 127, 255}));
protected
annotation(enter image description here
我调整了现有“CurvedBend”组件的代码(因为我无法让它工作)。这就解释了为什么它对你来说不存在。
model CurvedBendModel
extends Modelica.Fluid.Dissipation.Utilities.Icons.PressureLoss.Bend_i;
extends Modelica.Fluid.Interfaces.PartialPressureLoss;
parameter Geometry geometry
"Geometry of curved bend"
annotation (Placement(transformation(extent={{-20,0},{0,20}})));
protected
parameter Medium.AbsolutePressure dp_small(min=0)=
Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_DP(
Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_con(
d_hyd=geometry.d_hyd,
delta=geometry.delta,
K=geometry.K,
R_0=geometry.R_0),
Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_var(
rho=Medium.density(state_dp_small),
eta=Medium.dynamicViscosity(state_dp_small)),
m_flow_small)
"Default small pressure drop for regularization of laminar and zero flow (calculated from m_flow_small)";
equation
if allowFlowReversal then
m_flow = Modelica.Fluid.Fittings.BaseClasses.Bends.CurvedBend.massFlowRate(
dp, geometry, d_a, d_b, eta_a, eta_b, dp_small, m_flow_small);
else
m_flow = Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_MFLOW(
Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_con(
d_hyd=geometry.d_hyd,
delta=geometry.delta,
K=geometry.K,
R_0=geometry.R_0),
Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_var(rho=d_a, eta=eta_a), dp);
end if;
end CurvedBendModel;
啊,是的,对不起。我调整了现有“CurvedBend”组件的代码(因为我无法让它工作)。这就解释了为什么它对你来说不存在。
model CurvedBendModel
extends Modelica.Fluid.Dissipation.Utilities.Icons.PressureLoss.Bend_i;
extends Modelica.Fluid.Interfaces.PartialPressureLoss;
parameter Geometry geometry
"Geometry of curved bend"
annotation (Placement(transformation(extent={{-20,0},{0,20}})));
protected
parameter Medium.AbsolutePressure dp_small(min=0)=
Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_DP(
Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_con(
d_hyd=geometry.d_hyd,
delta=geometry.delta,
K=geometry.K,
R_0=geometry.R_0),
Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_var(
rho=Medium.density(state_dp_small),
eta=Medium.dynamicViscosity(state_dp_small)),
m_flow_small)
"Default small pressure drop for regularization of laminar and zero flow (calculated from m_flow_small)";
equation
if allowFlowReversal then
m_flow = Modelica.Fluid.Fittings.BaseClasses.Bends.CurvedBend.massFlowRate(
dp, geometry, d_a, d_b, eta_a, eta_b, dp_small, m_flow_small);
else
m_flow = Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_MFLOW(
Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_con(
d_hyd=geometry.d_hyd,
delta=geometry.delta,
K=geometry.K,
R_0=geometry.R_0),
Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_var(rho=d_a, eta=eta_a), dp);
end if;
end CurvedBendModel;