Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

data type error

data type error

I have the following code. when simulating it shows the following problem.


For algorithm
for count3 in (1:maxlim2) loop
iIr := Wcor*Ir+(1-Wcor)*(IL-I0_GranTurismo*(exp((Vr+Ir*Rs)/(ns*Vt))-1)-(Vr+ Ir*Rs)/Rsh_real);
if (abs(iIr-Ir) < accuracy) then
Iout_GranTurismo[count2] := iIr;
else
// No equations
end if;
Ir := iIr;
Iout_GranTurismo[count2] := iIr;
count3 := count3+1;
end for;
Vout_GranTurismo[count2] := Vr;
Pout_max := 0;

Assignment of Real to Integer.


is there any way i change the type to include both?



model Photovoltaic
  import Photovoltaic;
extends SinglePhase.Interfaces.OnePortGrounded;

  import Modelica.ComplexMath.'abs';
parameter Real Gstc = 1000;
    parameter Integer maxlim2= 1000;
    parameter Integer matrixsize = 10000;
    parameter Real Impp_real, Pout_max, iVoc_real, Tstc=298, Vr;
    parameter Integer   count2, count3;
    parameter Integer  Vout_GranTurismo[:] = zeros( matrixsize);
    parameter Integer   Iout_GranTurismo[:] = zeros( matrixsize);
    parameter Integer Pout_GranTurismo[:] = zeros(matrixsize);
    parameter Integer iIr, Ir;
    input Real  Ki, Kv,  T_real;
    input Integer G_real;
    output Real IL; //Iphotocurrent calculated with new values pg12
    output Real Rsh_real,Vmpp_GranTurismo, Voc_real=28, Isc_real;
    output Real I0_GranTurismo; // Diode Current,


equation
   I0_GranTurismo =  (Isc_real - (Voc_real - Isc_real * Rs) / Rsh_real) * exp(-Voc_real / (ns * Vt)); //eqn 2.23
   Ir =  Isc_real;
algorithm
      count2 =0;

        for Vr in 0:Voc_real loop
               count3 = 1;
               count2 = count2 + 1;


          for count3 in 1:maxlim2 loop
       iIr :=Wcor*Ir + (1 - Wcor)*(IL - I0_GranTurismo*(exp((Vr + Ir*Rs)/(ns*Vt))
       - 1) - (Vr + Ir*Rs)/Rsh_real);

       if  abs(iIr - Ir) < accuracy then
        Iout_GranTurismo[count2] :=iIr;
        else

       end if;

       Ir :=iIr;
       Iout_GranTurismo[count2] :=iIr;
      count3 :=count3 + 1;//counter to limit number of iterations
     end for;


     Vout_GranTurismo[count2] :=Vr;
    end for;
    Pout_max :=0;

       if  G_real < 0.0001 then
        Vmpp_GranTurismo :=0;
        Impp_real :=0;
      else
        for count4 in 1:count2 loop
          Pout_GranTurismo[count4] :=Vout_GranTurismo[count4]*Iout_GranTurismo[
        count4];
          if  Pout_GranTurismo[count4] > Pout_max then
            Vmpp_GranTurismo :=Vout_GranTurismo[count4];
            Impp_real :=Iout_GranTurismo[count4];
            else
          end if;
        end for;
       end if;

end Photovoltaic

There are 0 guests and 0 other users also viewing this topic
You are here: