首页 文章

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

提问于
浏览
1

我试图在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]:重复元素(由于>继承元素)不相同:第一个元素是:outer .ThermoPower.System系统“系统范围属性”第二个元素是:inner .Modelica.Fluid.System system(energyDynamics => Modelica . Fluid.Types.Dynamics.SteadyStateInitial,use_eps_Re = true)[4] 17:23:55平移错误在展平模型bsr_brayton1时发生错误

在我的方法中是否存在一些错误,或者只是这样的Open Modelica的性质?

1 回答

  • 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;
    

相关问题