Modelica“解决错误:重载二进制运算符不匹配”

时间:2014-11-17 13:45:59

标签: if-statement modelica dymola binary-operators

我正在使用Dymola 2014(Modelica)并尝试编写模型的代码。 我无法检查"模型,Dymola给了我以下信息。 有人使用Dymola告诉我,这可能是一个问题来自失踪的"否则"但我没有看到任何遗漏。

条件xxx.activePort在每个&#34的开头;如果"来自代码中的stateGraph循环。 请注意,并非所有代码都在这里,但我可以根据需要发布。 检查只返回代码的那一部分,所以我假设问题在这里。 您可能还注意到整个代码包含方程和算法部分。 下面的代码是等式部分的一部分。

我和Modelica很相似,所以它可能很简单,但我没有找到任何解决我在互联网上的问题。

谢谢!

罗曼

Check of CHP.Composants.Stirling:

Resolve error: No match for overloaded binary operator
in the equation
if (PR1.activePort or PR2.activePort or PR3.activePort) then 
 if (PR1.activePort) then 
  Q_HX = 0;
  P_brut = 0;
  P_net = P_brut-P_auxiliaires-P_electronique;
 elseif (PR2.activePort) then 
  Q_HX = Q_HX_nom*(1-exp( -(time-tps_debut_PR2)/Tau_PR_Q));
  P_brut = 0;
  P_net = P_brut-P_auxiliaires-P_electronique;
 elseif (PR3.activePort) then 
  Q_HX = Q_HX_nom*(1-exp( -(time-tps_debut_PR2)/Tau_PR_Q));
  P_net = P_net_nom*(1-exp( -(time-tps_debut_PR3)/Tau_PR_P));
  P_brut = P_net+P_auxiliaires+P_electronique;
 else
  Q_HX = 0;
  P_net = 0;
  P_brut = 0;
 end if;
 mdot_comb = P_comb_nom/PCS_J_kg;
 mdot_condensats_max = mdot_comb*H2O_kg;
 V_H2O_exh = V_H2O*(1-mdot_condensats/mdot_condensats_max);
 DH_N2_exh = (H_Texh[1, 5]-H_T0[1, 5])*pc_N2_exh_w;
 DH_CO2_exh = (H_Texh[1, 6]-H_T0[1, 6])*pc_CO2_exh_w;
 DH_O2_exh = (H_Texh[1, 9]-H_T0[1, 9])*pc_O2_exh_w;
 DH_H2O_exh = (H_Texh[1, 10]-H_T0[1, 10])*pc_H2O_exh_w;
 dH_exh_sens = (DH_N2_exh+DH_CO2_exh+DH_O2_exh+DH_H2O_exh)/Mm_exh*1000;
 mdot_air = mdot_comb*V_a_kg*(1+exces_air);
 mdot_exh = mdot_comb+mdot_air;
 P_comb = mdot_comb*PCS_J_kg;
 Hdot_comb = mdot_comb*dH_comb;
 Hdot_air = mdot_air*cp_air*(T_air-T_0);
 Hdot_exh_sen = mdot_exh*dH_exh_sens;
 Hdot_exh_lat = L_v_H2O*(mdot_condensats_max-mdot_condensats);
 mdot_CO2 = mdot_comb*i_CO2_comb;
elseif (Fct_normal.activePort) then 
 Q_HX = Q_HX_nom+C_charge*g+(T_cwi-T_cwi_nom)*c1+(T_cwi-T_cwi_nom)^2*c2+( mdot_cw-mdot_cw_nom)*d1+(mdot_cw-mdot_cw_nom)^2*d2;
 P_net = P_net_nom+C_charge*h+(T_cwi-T_cwi_nom)*e1+(T_cwi-T_cwi_nom)^2*e2+( mdot_cw-mdot_cw_nom)*f1+(mdot_cw-mdot_cw_nom)^2*f2;
 P_comb = P_comb_nom+C_charge*j+(T_cwi-T_cwi_nom)*a1+(T_cwi-T_cwi_nom)^2*a2+( mdot_cw-mdot_cw_nom)*b1+(mdot_cw-mdot_cw_nom)^2*b2;
 P_brut = P_net+P_auxiliaires+P_electronique;
 mdot_comb = P_comb/PCS_J_kg;
 mdot_condensats_max = mdot_comb*H2O_kg;
 V_H2O_exh = V_H2O*(1-mdot_condensats/mdot_condensats_max);
 DH_N2_exh = (H_Texh[1, 5]-H_T0[1, 5])*pc_N2_exh_w;
 DH_CO2_exh = (H_Texh[1, 6]-H_T0[1, 6])*pc_CO2_exh_w;
 DH_O2_exh = (H_Texh[1, 9]-H_T0[1, 9])*pc_O2_exh_w;
 DH_H2O_exh = (H_Texh[1, 10]-H_T0[1, 10])*pc_H2O_exh_w;
 dH_exh_sens = (DH_N2_exh+DH_CO2_exh+DH_O2_exh+DH_H2O_exh)/Mm_exh*1000;
 mdot_air = mdot_comb*V_a_kg*(1+exces_air);
 mdot_exh = mdot_comb+mdot_air-mdot_condensats;
 Hdot_comb = mdot_comb*dH_comb;
 Hdot_air = mdot_air*cp_air*(T_air-T_0);
 Hdot_exh_sen = mdot_exh*dH_exh_sens;
 Hdot_exh_lat = L_v_H2O*(mdot_condensats_max-mdot_condensats);
 mdot_CO2 = mdot_comb*i_CO2_comb;
elseif (RF.activePort) then 
 Q_HX = Q_HX_nom*exp( -(time-tps_debut_RF)/Tau_RF);
 P_brut = E_elec_RF/t_fin_RF;
 P_net = P_brut-P_auxiliaires-P_electronique;
 mdot_comb = 0;
 mdot_air = P_comb_nom/PCS_J_kg*V_a_kg*(1+exces_air);
 mdot_exh = mdot_air;
 P_comb = 0;
 Hdot_comb = 0;
 Hdot_air = mdot_air*cp_air*(T_air-T_0);
 Hdot_exh_sen = mdot_exh*cp_air*(T_exh-T_0);
 Hdot_exh_lat = 0;
 mdot_CO2 = 0;
 mdot_condensats_max = 0;
 V_H2O_exh = 0;
 DH_N2_exh = 0;
 DH_CO2_exh = 0;
 DH_O2_exh = 0;
 DH_H2O_exh = 0;
 dH_exh_sens = (DH_N2_exh+DH_CO2_exh+DH_O2_exh+DH_H2O_exh)/Mm_exh*1000;
elseif (Arret.activePort) then 
 Q_HX = 0;
 P_brut = 0;
 P_net = P_brut-P_electronique;
 mdot_comb = 0;
 mdot_air = 0;
 mdot_exh = 0;
 P_comb = 0;
 Hdot_comb = 0;
 Hdot_air = 0;
 Hdot_exh_sen = 0;
 Hdot_exh_lat = 0;
 mdot_CO2 = 0;
 mdot_condensats_max = 0;
 V_H2O_exh = 0;
 DH_N2_exh = 0;
 DH_CO2_exh = 0;
 DH_O2_exh = 0;
 DH_H2O_exh = 0;
 dH_exh_sens = (DH_N2_exh+DH_CO2_exh+DH_O2_exh+DH_H2O_exh)/Mm_exh*1000;
else
 Q_HX = 0;
 P_brut = 0;
 P_net = P_brut-P_electronique;
 mdot_comb = 0;
 mdot_air = 0;
 mdot_exh = 0;
 P_comb = 0;
 Hdot_comb = 0;
 Hdot_air = 0;
 Hdot_exh_sen = 0;
 Hdot_exh_lat = 0;
 mdot_CO2 = 0;
 mdot_condensats_max = 0;
 V_H2O_exh = 0;
 DH_N2_exh = 0;
 DH_CO2_exh = 0;
 DH_O2_exh = 0;
 DH_H2O_exh = 0;
 dH_exh_sens = (DH_N2_exh+DH_CO2_exh+DH_O2_exh+DH_H2O_exh)/Mm_exh*1000;
end if;

Missing declarations.

Check aborted.

ERROR: 1 error was found

1 个答案:

答案 0 :(得分:1)

我终于解决了这个问题。

问题是由于错误的声明,在代码中系数" j"被声明为数组,而这里需要一个标量。