1

我正在使用 Dymola 2014 (Modelica) 并尝试编写模型的代码。我无法“检查”模型,Dymola 给了我以下信息。使用 Dymola 的人告诉我,这可能是来自缺少“其他”的问题,但我没有看到任何缺失。

每个“if”开头的条件 xxx.activePort 来自代码中的 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
4

1 回答 1

1

我终于解决了这个问题。

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

于 2014-11-17T19:14:35.067 回答