如何在Open Modelica中使用我自己的包中的现有库组件?

时间:2017-05-31 04:37:33

标签: modelica openmodelica

我试图在Open Modelica中模拟Brayton循环。我下载了ThermoPower库,还有Modelica标准库中的一些组件。但是我无法简单地将现有库的组件拖放到我自己的包中以创建brayton循环。(例如,拖放热交换器)。我也试过在课堂上做同样的事情。

这是我的代码:

package brayton1 

  extends Modelica.Icons.Package; 

  extends ThermoPower.PowerPlants.GasTurbine.Examples.GasTurbineSimplified; 

  extends Modelica.Fluid.Examples.HeatExchanger.HeatExchangerSimulation; 

  extends ThermoPower.Gas.Compressor ; 

  annotation( 
    Documentation(info = "This package tries to implement the brayton cycle simulation with the help of 4 basic componenets -Source, Sink, Compressor, Turbine. Let's see how far it goes...")); 
end brayton1; 

这些是我得到的错误:

  

[1] 17:23:55翻译错误   由于类专门化PACKAGE,无法实例化bsr_brayton1。

     

[2] 17:23:55翻译通知   [ThermoPower.Gas:2956:7-2956:63]:从这里:

     

[3] 17:23:55翻译错误   [Modelica.Fluid.Examples.HeatExchanger:74:5-76:35]:重复元素(由于>继承元素)不相同:    第一个元素是:外部.ThermoPower.System系统"系统范围的属性"    第二个元素是:inner .Modelica.Fluid.System系统(energyDynamics => Modelica.Fluid.Types.Dynamics.SteadyStateInitial,use_eps_Re = true)

     

[4] 17:23:55翻译错误   展平模型bsr_brayton1

时发生错误

我的方法中是否存在错误,或者Open Modelica的性质是否仅限于此?

1 个答案:

答案 0 :(得分:1)

我认为您可以使用此代码:

package brayton1 

  extends Modelica.Icons.Package;

  model GasTurbineSimplified
    extends ThermoPower.PowerPlants.GasTurbine.Examples.GasTurbineSimplified;
  end GasTurbineSimplified;

  model HeatExchangerSimulation
    extends Modelica.Fluid.Examples.HeatExchanger.HeatExchangerSimulation;
  end HeatExchangerSimulation;

  model Compressor
    extends ThermoPower.Gas.Compressor;
  end Compressor;

  model myExample
    GasTurbineSimplified gasTurbineSimplified1 annotation(
      Placement(visible = true, transformation(origin = {-72, 38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  end myExample;

  annotation( 
    Documentation(info = "This package tries to implement the brayton cycle simulation with the help of 4 basic componenets -Source, Sink, Compressor, Turbine. Let's see how far it goes...")); 
end brayton1;