0

I used OpenModelica 1.9.4~dev-675-gb524b08 And try to create model for simulate gas plant. When I try to redeclare a Medium according examples

model Block_Prep_ASIDGAS
 import Modelica.Fluid.Interfaces;
 import SI=Modelica.SIunits;
 redeclare replaceable package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater constrainedby Modelica.Media.Interfaces.PartialMedium "Medium in the component" annotation(choicesAllMatching = true);
 Interfaces.FluidPort_a port_a (redeclare package Medium = Medium)  "Порт ввода газа" annotation(Placement(visible = true, transformation(origin = {-584, 42}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-100, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
 Interfaces.FluidPort_b port_b    annotation(Placement(visible = true, transformation(origin = {586, 46}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {102, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
 annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-92, 91}, extent = {{190, 1}, {-8, -1}}, textString = "Блок подготовки кислого газа", fontSize = 40), Rectangle(lineThickness = 2, borderPattern = BorderPattern.Engraved, extent = {{-100, 98}, {100, -98}}, radius = 2), Text(origin = {-8, -3}, lineColor = {255, 0, 0}, extent = {{-70, 79}, {96, -77}}, textString = "B_PAG", fontSize = 200)}), Diagram(coordinateSystem(extent = {{-600, -400}, {600, 400}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.02));
end Block_Prep_ASIDGAS;

I got errors:

[1] Translation Error
[Seneca.BlockModels.Block_Prep_ASIDGAS.Medium: 10:26-10:92]: Illegal redeclare of element Medium, no inherited element with that name exists.
[2] Translation Error
Error occurred while flattening model Seneca.BlockModels.Block_Prep_ASIDGAS

I find two request in OpenModelica trac #2959 and #2079

Advice me how to correct my model for correct simulation in OpenModelica?

StephenKing
  • 36,187
  • 11
  • 83
  • 112
vserge
  • 43
  • 5

2 Answers2

1

It should work as you do it but without a full model is hard to debug and see where the problem is.

Adrian Pop
  • 4,034
  • 13
  • 16
  • I can encapsulate this model in new model with fixed boundary as a sources and end of flow. It's help you to debug it? – vserge Feb 01 '16 at 12:40
  • That would help, yes. Also, if your model is not public you can just send it to us at openmodelica@ida.liu.se and we will only use it for debugging and then delete it. – Adrian Pop Feb 01 '16 at 14:05
  • Ok I prepare model and wil sent it – vserge Feb 02 '16 at 15:53
0

you missed redeclaring the package in port_b, the rest seems to be ok.

victor.aer
  • 106
  • 5