我使用 Modelica 在 ANSYS Twin Builder 中编写了一个代码。它给我一个错误:“调用函数 Medium.density():只能调用具有一个算法部分或外部函数规范的函数”你能帮我解释为什么会出现这个错误吗?谢谢..
//Component(s)
Real f[2*T_per/(T_per/10)];
Real time_interval;
parameter Real opening_HP;
Real opening_NP;
parameter Real N;
parameter Real T_per;
parameter Real V_tod;
parameter Real V_unten;
Modelica.Fluid.Valves.ValveIncompressible NP (
dp_nominal = 65.21,
opening = opening_NP,
rho_nominal = 998.388,
Kv = 0.02178066,
V_flow(start = 0.0000488573),
dp = dp(start = 65.211094),
m_flow(start = 0.048778537));
Modelica.Fluid.Valves.ValveIncompressible HP (
Kv = 0.021549519,
opening=opening_HP,
dp_nominal = 66.6175,
rho_nominal = 1019.921,
V_flow(start = 0.0000478258),
dp(start = 66.6175),
m_flow(start = 0.048778537));
Modelica.Fluid.Machines.SweptVolume Swept1 (pistonCrossArea = 0.0001131, clearance = 0.000002, portsData = false);
Modelica.Fluid.Vessels.OpenTank tank (vessel_ps_static = 400000);
Modelica.Fluid.Vessels.OpenTank tank1 (vessel_ps_static = 50000000);
equation
T_per=pi/(180*3600*N/60);//Radian
time_interval=T_per/10;
for i in 1:2*T_per/(T_per/10) loop
f[i]=((V_unten_V_tod)/2)*sin((2*pi*i*time_interval/T_per)+(V_tod+(V_unten-V_tod)/2));
end for;
if der(f)>=0 then
opening_NP=1;
opening_HP=0;
else
opening_NP=0;
opening_HP=1;
end if;
//Connection(s)
connect(NP.port_a, Swept1.ports[1]);
connect(HP.port_b, Swept1.ports[2]);
connect(HP.opening, tank1.ports[1]);
connect(NP.opening, tank.ports[1]);
end Hochdruckreiniger2;