Я пишу программу моделирования как часть диплома и ищу 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