有一个复杂的连接器,在传播它时,我只想修改一组变量中的一个变量,而不必为其他变量显式编写所有等式方程。
理想的将是一个连接语句和一个特定变量的覆盖。
class FluidClass
String name(start="name")"name";
Real fl(start=1000)"flow [l/h]";
Real p(start=1)"pressure [bar]";
Real T(start=25)"temperature [degC]";
Real DS(start=80)"dry substance [%]";
Real rho(start=100)"viscosity [mPas]";
end FluidClass;
connector fl "flow"
extends FluidClass;
end fl;
model setParam "set parameter"
fl fli annotation(Placement(
transformation(extent={{-5,-5},{5,5}}),
iconTransformation(extent={{-105,-5},{-95,5}})));
fl flo "flow output" annotation(Placement(
transformation(extent={{-50,0},{-40,10}}),
iconTransformation(extent={{95,-5},{105,5}})));
input Modelica.Blocks.Interfaces.RealInput u "set value";
parameter EnumType1 var "variable to change";
type EnumType1 = enumeration(
fl "Flow rate",
p "Pressure",
T "Temperature",
DS "Dry substance",
rho "Viscosity");
equation
// enter your equations here
if var ==1 then //flow
flo.name=fli.name;
flo.fl=u;
flo.p=fli.p;
flo.T=fli.T;
flo.DS=fli.DS;
flo.rho=fli.rho;
end if;
if var ==2 then //pressure
flo.name=fli.name;
flo.fl=fli.fl;
flo.p=u;
flo.T=fli.T;
flo.DS=fli.DS;
flo.rho=fli.rho;
end if;
if var ==3 then //temperature
flo.name=fli.name;
flo.fl=fli.fl;
flo.p=fli.p;
flo.T=u;
flo.DS=fli.DS;
flo.rho=fli.rho;
end if;
if var ==4 then //DS
flo.name=fli.name;
flo.fl=fli.fl;
flo.p=fli.p;
flo.T=fli.T;
flo.DS=u;
flo.rho=fli.rho;
end if;
if var ==5 then //viscosity
flo.name=fli.name;
flo.fl=fli.fl;
flo.p=fli.p;
flo.T=fli.T;
flo.DS=fli.DS;
flo.rho=u;
end if;
end setParam;
我非常感谢您的帮助。