Modelica "Resolve error : no match for overloaded binary operator "

1.7k views Asked by At

I'm using Dymola 2014 (Modelica) and trying to write the code of a model. I am not able to "check" the model, Dymola gives me the following message. Someone using Dymola told me that it may be a problem coming from a missing "else" but I don't see anything missing.

The conditions xxx.activePort at the beginning of every "if" come from a stateGraph loop in the code. Please note that not all the code is here but I can post it if needed. The check only returns that part of the code, so I assume that the problem is here. You may also note that the entire code contains both equation and algorithm sections. The code below is a part of the equation section.

I'm quite a noob with Modelica so it may be simple but I did not find anything to solve my problem on the internet.

Thank you !

Romain

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

There are 1 answers

0
Romain Bonabe de Rougé On

I finally solved this problem.

The problem was due to a wrong declaration, in the code the coefficient "j" was declared as an array while here a scalar was needed.