如何在OpenModelica中使用我自己的包中的现有库组件?
我试图在开放模型中模拟布雷顿循环。我下载了ThermoPower库,Modelica标准库中还有一些组件可用。但我不能简单地将现有库的组件拖放到我自己的包中,以创建布雷顿循环(例如,热交换器的拖放)。我也试着在课堂上做同样的事情 这是我的代码:如何在OpenModelica中使用我自己的包中的现有库组件?,modelica,openmodelica,Modelica,Openmodelica,我试图在开放模型中模拟布雷顿循环。我下载了ThermoPower库,Modelica标准库中还有一些组件可用。但我不能简单地将现有库的组件拖放到我自己的包中,以创建布雷顿循环(例如,热交换器的拖放)。我也试着在课堂上做同样的事情 这是我的代码: package brayton1 extends Modelica.Icons.Package; extends ThermoPower.PowerPlants.GasTurbine.Examples.GasTur
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翻译错误
由于类专门化包,无法实例化bsr_brayton1
[2] 17:23:55翻译通知
[热电天然气:2956:7-2956:63]:从这里:
[3] 17:23:55翻译错误
[Modelica.Fluid.Examples.HeatExchanger:74:5-76:35]:重复元件(由于>继承元件)不相同:
第一个元素是:outer.ThermoPower.System“系统范围属性”
第二个元素是:inner.Modelica.Fluid.System(energyDynamics=>Modelica.Fluid.Types.Dynamics.SteadyStateInitial,使用\u eps\u Re=true)
[4] 17:23:55翻译错误
展平模型bsr_brayton1时出错
我的方法是否有错误,或者OpenModelica的本质只是这样?我认为您可以使用以下代码:
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;
您显示的日志中的第一个错误是:无法实例化xyz,因为它是一个包。你只能实例化(和模拟)一个模型。好吧,这是我的错误。但是其他的错误呢?我不能使用现有库的组件。我不确定您到底做了什么,但从现有组件构建系统应该是绝对可能的,当然也可以使用拖放和混合库中的组件(只要接口兼容)。由于这是非常基本的,我会推荐一些介绍性教程,例如:本教程:或该系列的任何内容:我看过口语教程系列,但即使在那里,我也从未见过使用现有组件的示例。您无法更改现有示例,例如HeatExchangeSimulation。但您可以在模型中复制此示例的代码,然后使用拖放更改它。