我编写建模程序作为文凭的一部分,并寻找 Modelica 作为输入语言。
但在标准规范中,我找不到如何实现该功能:
例如我有一些模型:
model circuit1
Resistor R1(R=10);
Capacitor C(C=0.01);
Resistor R2(R=100);
Inductor L(L=0.1);
VsourceAC AC;
Ground G;
equation
connect (AC.p, R1.p);
connect (R1.n, C.p);
connect (C.n, AC.n);
connect (R1.p, R2.p);
connect (R2.n, L.p);
connect (L.n, C.n);
connect (AC.n, G.p);
end circuit1
如何将此模型用作不同模型的一部分?
像那样:
model circuit2
Resistor R1(R=10);
circuit1 circ(); // ! Define some circuit1
Resistor R2(R=100);
Inductor L(L=0.1);
VsourceAC AC;
Ground G;
equation
connect (AC.p, R1.p);
connect (R1.n, C.p);
connect (circ.somePin1, AC.n); // ! Connect circuit1 pins
connect (R1.p, R2.p);
connect (R2.n, L.p);
connect (L.n, circ.somePin2); // ! Connect circuit1 pins
connect (AC.n, G.p);
end circuit2
编辑
model circuit1
extends somePin1; //
extends somePin2; //
Resistor R1(R=10);
Capacitor C(C=0.01);
Resistor R2(R=100);
Inductor L(L=0.1);
VsourceAC AC;
Ground G;
equation
connect (AC.p, R1.p);
connect (R1.n, C.p);
connect (C.n, AC.n);
connect (R1.p, R2.p);
connect (R2.n, L.p);
connect (L.n, C.n);
connect (AC.n, G.p);
connect (AC.n, somePin1); //
connect (R1.n, somePin2); //
end circuit1