- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Wrong number of subscripts
Page Start Prev 1 Next End
Wrong number of subscripts
Wrong number of subscripts
Jan-25-16 15:30:55
I'm try to create new media based on MixtureGasNasa and used it in test examples NonCircularPipes (copy standard MSL example to new file).
When I try to check model I get new errors:
Code:
[9] 17:54:03 Translation Error
[Modelica.Media.IdealGases.Common: 1305:5-1305:67]: Wrong number of subscripts in data[j].MM (1 subscripts for 0 dimensions).
[10] 17:54:03 Translation Error
[Modelica.Media.IdealGases.Common: 1305:5-1305:67]: Variable data[j].MM not found in scope Modelica.Fluid.Sources.Boundary_pT$boundary.Medium.molarMass.$foriter loop scope$.
[11] 17:54:03 Translation Error
Error occurred while flattening model Example_NonCircularPipes
For describe situation in details include here code of models.
Code:
package ACIDGas_1 "Определение проектной смеси для установки по очистке серы"
import Modelica.Fluid;
function phase_stat "функция расчета диаграммы состояний для бинарных газов/жидкостей относительно серы"
end phase_stat;
import Modelica.Media.IdealGases.Common.MixtureGasNasa;
extends MixtureGasNasa(mediumName = "ACIDGas", data = {Common.SingleGasesData.H2S, Common.SingleGasesData.SO2, Common.SingleGasesData.H2O, Common.SingleGasesData.O2, Common.SingleGasesData.N2, Common.SingleGasesData.H2, Common.SingleGasesData.CO, Common.SingleGasesData.CO2, Common.SingleGasesData.COS, Common.SingleGasesData.CS2, Common.SingleGasesData.CH4, Common.SingleGasesData.C2H6, Common.SingleGasesData.C3H8, Common.SingleGasesData.C4H10_isobutane, Common.SingleGasesData.C4H10_n_butane, Common.SingleGasesData.C5H12_i_pentane, Common.SingleGasesData.NC3H12, Common.SingleGasesData.NH3, Common.SingleGasesData.S, Common.SingleGasesData.S2, Common.SingleGasesData.S3, Common.SingleGasesData.S4, Common.SingleGasesData.S5, Common.SingleGasesData.S6, Common.SingleGasesData.S7, Common.SingleGasesData.S8}, fluidConstants = {Common.FluidData.H2S, Common.FluidData.SO2, Common.FluidData.H2O, Common.FluidData.O2, Common.FluidData.N2, Common.FluidData.H2, Common.FluidData.CO, Common.FluidData.CO2, Common.FluidData.COS, Common.FluidData.CS2, Common.FluidData.CH4, Common.FluidData.C2H6, Common.FluidData.C3H8, Common.FluidData.C4H10_isobutane, Common.FluidData.C4H10_n_butane, Common.FluidData.C5H12_i_pentane, Common.FluidData.NC3H12, Common.FluidData.NH3, Common.FluidData.S, Common.FluidData.S2, Common.FluidData.S3, Common.FluidData.S4, Common.FluidData.S5, Common.FluidData.S6, Common.FluidData.S7, Common.FluidData.S8}, substanceNames = {"H2S", "SO2,", "H2O", "O2", "N2", "H2", "CO", "CO2", "COS", "CS2", "CH4", "C2H6", "C3H8", "C4H10_isobutane", "C4H10_n_butane", "C5H12_i_pentane", "NH3", "S", "S2", "S3", "S4", "S5", "S6", "S7", "S8"}, reference_X = {0.0, 0.0, 0.0, 0.232, 0.768, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0});
annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})));
end ACIDGas_1;
Code:
model Example_NonCircularPipes
import Modelica.Media;
import Modelica.Fluid;
replaceable package Medium = ACIDGas_1 "Medium in the component";
extends Modelica.Icons.Example;
constant Real odim = 0.015;
constant Real idim = 0.005;
inner Modelica.Fluid.System system(energyDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial) annotation(Placement(visible = true, transformation(origin = {-80, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Medium, nPorts = 2, p = 10.0e5, T = 293.15) annotation(Placement(visible = true, transformation(origin = {-80, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_T massflowsink1(redeclare package Medium = Medium, nPorts = 1, m_flow = -0.1, T = 293.15) annotation(Placement(visible = true, transformation(origin = {40, 40}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_T massflowsink2(redeclare package Medium = Medium, nPorts = 1, m_flow = -0.1, T = 293.15) annotation(Placement(visible = true, transformation(origin = {40, -40}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe circular_pipe(redeclare package Medium = Medium, length = 100, diameter = 0.01, T_start = 293.15, p_a_start = 10.0e5, p_b_start = 10.0e5) annotation(Placement(visible = true, transformation(origin = {-20, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe annulus_pipe(redeclare package Medium = Medium, length = 100, crossArea = Modelica.Constants.pi * (odim ^ 2 - idim ^ 2) / 4, perimeter = Modelica.Constants.pi * (odim + idim), isCircular = false, diameter = 0, p_a_start = 1000000, p_b_start = 1000000, T_start = 293.15) annotation(Placement(visible = true, transformation(origin = {-20, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(boundary.ports[1], circular_pipe.port_a) annotation(Line(points = {{-70, 2}, {-60, 2}, {-60, 40}, {-30, 40}}, color = {0, 127, 255}));
connect(boundary.ports[2], annulus_pipe.port_a) annotation(Line(points = {{-70, -2}, {-60, -2}, {-60, -40}, {-30, -40}}, color = {0, 127, 255}));
connect(circular_pipe.port_b, massflowsink1.ports[1]) annotation(Line(points = {{-10, 40}, {30, 40}}, color = {0, 127, 255}));
connect(annulus_pipe.port_b, massflowsink2.ports[1]) annotation(Line(points = {{-10, -40}, {30, -40}}, color = {0, 127, 255}));
annotation(experiment(StopTime = 1), Library = Seneca, Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})));
end Example_NonCircularPipes;
What I do wrong?
Re: Wrong number of subscripts
Jan-25-16 15:37:02
The error message link to Modelica.Media.IdealGases.Common
and in function
Code:
redeclare function density_derX "Return density derivative by mass fraction"
extends Modelica.Icons.Function;
input ThermodynamicState state "Thermodynamic state record";
output Density[nX] dddX "Derivative of density w.r.t. mass fraction";
algorithm
dddX := array(-state.p / (state.T * gasConstant(state)) * molarMass(state) / data[i].MM for i in 1:nX);
annotation(Inline = true, smoothOrder = 2);
end density_derX;
where data[i] not declare. Is it correct?
Page Start Prev 1 Next End
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Wrong number of subscripts
There are 0 guests and 0 other users also viewing this topic