Работа в Dymola, сбой в OpenModelica - PullRequest
1 голос
/ 07 апреля 2020

У меня есть код, сгенерированный в Dymola и работающий там, но не работающий с переводом при запуске в OpenModelica.

Ошибка: Компонент cellGeometry параметра изменчивости имеет привязку 'cellGeometry' с более высокой непрерывностью изменчивости.

.. в части кода:

Lib_thermosyphon.Thermosyphon.ThermosiphonCells.RefrigerantCellExt refrigerantCell[nCells](each refrigerantType = refrigerantType, each cellGeometry = cellGeometry, each hInit = hInit, each pInit = pInit, each initialSteadyState = initialSteadyState, each steadyPressureInit = steadyPressureInit, each m_flowStart = m_flowStart, redeclare each HTmodel heatTransfer, redeclare each PressureDropModel dpl, each dp_g(start = 0)) annotation(Placement(transformation(extent = {{-10, 12}, {10, 32}})));
Lib_thermosyphon.Thermosyphon.ThermosiphonCells.Geometry.CellGeometry cellGeometry(length = length / nCells, volume = volume / nCells, hydraulicDiameter = diameter, freeFlowArea = diameter ^ 2 * pi / 4, heatTransferArea = diameter * pi * length / nCells) annotation(
    Placement(transformation(extent = {{-12, 36}, {8, 56}})));

... где в коде RefrigerantCellExt указано следующее:

model RefrigerantCellExt "represents a control volume of a refrigerant cell with extensions"
  import Modelica.SIunits;
  parameter Geometry.CellGeometry cellGeometry "used for HT and pressure drop correlations" annotation(
    Placement(transformation(extent = {{-40, 20}, {-20, 40}}, rotation = 0)));
  /****************** connectors *******************/
  Lib_thermosyphon.Thermosyphon.Ports.RefrigerantPortA portA(m_flow(start = m_flowStart), mediumName = refrigerant.name) annotation(
    Placement(transformation(extent = {{-110, -10}, {-90, 10}}, rotation = 0)));
  Lib_thermosyphon.Thermosyphon.Ports.RefrigerantPortB portB(m_flow(start = -m_flowStart), mediumName = refrigerant.name) annotation(
    Placement(transformation(extent = {{90, -10}, {110, 10}}, rotation = 0)));
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort annotation(
    Placement(transformation(extent = {{-10, -90}, {10, -70}}, rotation = 0)));
  /****************** Init values *******************/
  parameter SIunits.SpecificEnthalpy hInit "|Initinit value for specific enthalpy";
  parameter SIunits.Pressure pInit "|Initinit value for pressure";
  parameter Boolean initialSteadyState = true "|Initif true, simulation starts in steady state";
  parameter Boolean steadyPressureInit = false "|Init|if true, pressure initialize in steady state";
  parameter SIunits.MassFlowRate m_flowStart = 0.02 "start value for mass flow";
  Real eVec[3];
  SIunits.Pressure dp_g;
  SIunits.Pressure dp_im_counter;
  /****************** Refrigerant models *******************/
  Lib_thermosyphon.Media.Refrigerant_Media.Refrigerant_StandardCell refrigerant(final refrigerantType = refrigerantType, p(start = pInit, fixed = false), h(start = hInit, fixed = false)) "Refrigerant model" annotation(
    Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  replaceable parameter Lib_thermosyphon.Media.Refrigerant_Media.Refrigerant_Constants.R134a refrigerantType constrainedby Lib_thermosyphon.Media.Refrigerant_Media.Refrigerant_Constants.Refrigerant_Base annotation(
     choicesAllMatching = true);
  /****************** Properties of control volumes *******************/
  SIunits.Mass mass "Mass of refrigerant in cell";
  Real dpdt "Derivative of pressure wrt time";
  Real drhodt "Derivative of density wrt time";
  /****************** heat transfer *******************/
  SIunits.HeatFlowRate Q_dot "transfered heat";
  replaceable HeatExchangers.TransportPhenomena.TubeSideHeatTransfer.PartialTubeSideHeatTransfer heatTransfer(cellGeometry = cellGeometry, m_flow = m_flow, properties = properties, Q_dot = Q_dot, h_A = portA.h, h_B = portB.h, wallTemp = heatPort.T) annotation(
    Placement(transformation(extent = {{-10, -42}, {10, -22}})));
  /****************** pressure drop *******************/
  SIunits.Pressure dp(start = 100) "pressure drop";
  replaceable HeatExchangers.TransportPhenomena.TubeSidePressureDrop_ext.PartialTubeSidePressureDrop dpl(cellGeometry = cellGeometry, m_flow = m_flow, properties = properties, dp_g = dp_g) annotation(
    Placement(transformation(extent = {{26, -10}, {46, 10}})));
  /****************** hydraulic properties for HT and pressure drop correlation *******************/
  SIunits.MassFlowRate m_flow "refrigerant massflow";
  /****************** properties *******************/
protected
  Lib_thermosyphon.Media.FluidPropertyRecord properties(final d = refrigerant.d, final h = refrigerant.h, final p = refrigerant.p, final T = refrigerant.T, final x = refrigerant.x1, final Pr = refrigerant.Pr, final Pr_l = refrigerant.Prl, final Pr_v = refrigerant.Prv, final nu = refrigerant.nu, final lambda = refrigerant.lambda, final p_crit = refrigerant.pc, final nu_l = refrigerant.nul, final nu_v = refrigerant.nuv, final lambda_l = refrigerant.lambdal, final medium = refrigerant.name, final h_l = refrigerant.hl, final h_v = refrigerant.hv, final d_l = refrigerant.dl, final d_v = refrigerant.dv);

... и т. д.

... и cellGeometry имеет следующий код:

record CellGeometry "geometry of fluid cell"
  extends Lib_thermosyphon.Utilities.Types.RecordIcon;
  import Modelica.SIunits;
  import Modelica.Constants;
  constant Real pi = Constants.pi;
  parameter SIunits.Length length "length";
  parameter SIunits.Volume volume = length * freeFlowArea "volume";
  parameter SIunits.Diameter hydraulicDiameter "hydraulic diameter";
  parameter SIunits.Area freeFlowArea = hydraulicDiameter * hydraulicDiameter * pi / 4 "flow cross section area";
  parameter SIunits.Area heatTransferArea = hydraulicDiameter * pi * length "area of heat transfer";
end CellGeometry;

Не могли бы вы помочь?

1 Ответ

1 голос
/ 07 апреля 2020

CellGeometry, который вы отправляете в RefrigerantCell в качестве модификатора, должен быть определен как параметр:

Lib_thermosyphon.Thermosyphon.ThermosiphonCells.RefrigerantCellExt refrigerantCell[nCells](each refrigerantType = refrigerantType, each cellGeometry = cellGeometry, each hInit = hInit, each pInit = pInit, each initialSteadyState = initialSteadyState, each steadyPressureInit = steadyPressureInit, each m_flowStart = m_flowStart, redeclare each HTmodel heatTransfer, redeclare each PressureDropModel dpl, each dp_g(start = 0)) annotation(Placement(transformation(extent = {{-10, 12}, {10, 32}})));
parameter Lib_thermosyphon.Thermosyphon.ThermosiphonCells.Geometry.CellGeometry cellGeometry(length = length / nCells, volume = volume / nCells, hydraulicDiameter = diameter, freeFlowArea = diameter ^ 2 * pi / 4, heatTransferArea = diameter * pi * length / nCells) annotation(
    Placement(transformation(extent = {{-12, 36}, {8, 56}})));

, как и в RefrigerantCellExt, cellGeometry определяется как параметр.

...