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

help!

help!

My code is below.
i am getting the following error. can someone help!

Trying to assign a parameter a value with higher variability:
iVt = Wcor*Vt+(1-Wcor)*(Impp*Rs+Vmpp-Voc)/(ns*log(((Isc-Impp)*(Rs+Rsh)-Vmpp)/( Isc*(Rs+Rsh)-Voc)));

Trying to assign a parameter a value with higher variability:
iRs = Wcor*Rs+(1-Wcor)*(Voc-Vmpp+ns*Vt*log(ns*Vt*(Impp*Rs+Impp*Rsh-Vmpp)/(Isc*Rs *Vmpp+Isc*Rsh*Vmpp+Impp*Voc*Rs-Impp*Isc*Rs*Rs-Isc*Impp*Rsh*Rs-Vmpp*Voc)))/Impp;

Trying to assign a parameter a value with higher variability:
iRsh = Wcor*Rsh+(1-Wcor)*(ns*Vt*Rs+ns*Vt*Rsh+Rs*exp((Isc*Rs-Voc)/(ns*Vt))*(Isc* Rs+Isc*Rsh-Voc))/(ns*Vt+Rs*exp((Isc*Rs-Voc)/(ns*Vt))*(Isc*Rs+Isc*Rsh-Voc));

Error detected in
algorithm
for count1 in (1:maxlim1) loop
iVt := Wcor*Vt+(1-Wcor)*(Impp*Rs+Vmpp-Voc)/(ns*log(((Isc-Impp)*(Rs+Rsh)- Vmpp)/(Isc*(Rs+Rsh)-Voc)));
iRs := Wcor*Rs+(1-Wcor)*(Voc-Vmpp+ns*Vt*log(ns*Vt*(Impp*Rs+Impp*Rsh-Vmpp)/ (Isc*Rs*Vmpp+Isc*Rsh*Vmpp+Impp*Voc*Rs-Impp*Isc*Rs*Rs-Isc*Impp*Rsh*Rs- Vmpp*Voc)))/Impp;
iRsh := Wcor*Rsh+(1-Wcor)*(ns*Vt*Rs+ns*Vt*Rsh+Rs*exp((Isc*Rs-Voc)/(ns*Vt)) *(Isc*Rs+Isc*Rsh-Voc))/(ns*Vt+Rs*exp((Isc*Rs-Voc)/(ns*Vt))*(Isc*Rs+Isc* Rsh-Voc));
if (abs((iVt-Vt)/iVt) < accuracy) then
if (abs(iRs-Rs) < accuracy) then
if (abs((iRsh-Rsh)/iRsh) < accuracy/10) then
Vt := iVt;
Rs := iRs;
Rsh := iRsh;
else
Vt := 0;
Rs := 0;
Rsh := 0;
end if;
else
Vt := 0;
Rs := 0;
Rsh := 0;
end if;
else
Vt := 0;
Rs := 0;
Rsh := 0;
end if;
end for;
I0 := (Isc-(Voc-Isc*Rs)/Rsh)*exp( -Voc/(ns*Vt));




model Photovoltaic1
extends SinglePhase.Interfaces.OnePortGrounded;

  import Modelica.ComplexMath.'abs';
  import Modelica.ComplexMath.real;
  import Modelica.ComplexMath.imag;
  import Modelica.ComplexMath.conj;
  import Modelica.Constants.k;

    parameter Modelica.SIunits.ActivePower Pnom = 500e3 "nominal power";
  parameter String profileFileName = "NoName" "File where matrix is stored"
    annotation (Dialog(
      loadSelector(filter="Text files (*.txt);;MATLAB MAT-files (*.mat)",
          caption="Open file in which table is present")));
  parameter String profileName = "NoName" "Table name on file";

//    Modelica.Blocks.Sources.CombiTimeTable pvProfile(
//     tableOnFile = true,
//     tableName = profileName,
//     fileName = profileFileName,
//     table = fill(0.0, 0, 4),
//     extrapolation = Modelica.Blocks.Types.Extrapolation.Periodic);
//
//     Real irrad = pvProfile.y[1] + pvProfile.y[2];
//     Real temp = pvProfile.y[3];

  //pv origins
   input Real Voc, Isc, Vmpp, Impp, Nss, Npp, Wcor;
   output Real I0, Vt, Rs, Rsh, ns;
    parameter Real maxlim1 = 3000;
    parameter Real accuracy = 0.001;
    parameter Real count1;
    parameter Real Voc_out, Vmpp_out, Impp_out, Isc_out, iVt, iRs, iRsh;

equation
  //-----------------------------------------------------------------------PV_ORIGINS-------------------------------------------------------------------------------------------------------------------------------------------------------------//
// Calculation of parameter for ITERATION
  Voc_out =  Voc * Nss;
  Isc_out =  Isc * Npp;
  Vmpp_out =  Vmpp* Nss;
  Impp_out =  Impp * Npp;
  ns =  Nss;

  //applying SUR - successive-under relaxation
  //finding intial data for iterations
  Vt =  (Impp * Rs + Vmpp - Voc) / (ns * log(((Isc - Impp) * (Rs + Rsh) - Vmpp) / (Isc * (Rs + Rsh) - Voc))); // eqn 2.17 jUNCTION vOLTAGE
  //all the variables with additional "i" in cycles are used for cycling purpose

algorithm
  for  count1 in 1:maxlim1 loop //when used only previous data in calculations-less steps required
    iVt:=Wcor*Vt + (1 - Wcor)*((Impp*Rs + Vmpp - Voc)/(ns*log(((Isc - Impp)*(Rs +
      Rsh) - Vmpp)/(Isc*(Rs + Rsh) - Voc))));                                                           //Eq.2.27
    iRs:=Wcor*Rs + (1 - Wcor)*((Voc - Vmpp + ns*Vt*log(ns*Vt*(Impp*Rs + Impp*
      Rsh - Vmpp)/(Isc*Rs*Vmpp + Isc*Rsh*Vmpp + Impp*Voc*Rs - Impp*Isc*Rs*Rs -
      Isc*Impp*Rsh*Rs - Vmpp*Voc)))/Impp);                                                                                                    //Eq.2.28
    iRsh:=Wcor*Rsh + (1 - Wcor)*((ns*Vt*Rs + ns*Vt*Rsh + Rs*exp((Isc*Rs - Voc)/(
      ns*Vt))*(Isc*Rs + Isc*Rsh - Voc))/(ns*Vt + Rs*exp((Isc*Rs - Voc)/(ns*Vt))*
      (Isc*Rs + Isc*Rsh - Voc)));                                                                                                    //Eq.2.21
    if abs((iVt-Vt)/iVt)<accuracy then
        if abs(iRs-Rs)<accuracy then //Rs can be close to 0, so absolute is used
            if abs((iRsh-Rsh)/iRsh)<(accuracy/10) then//Rsh differs in order, comapred to Vt and Rs
                Vt:=iVt;
                Rs:=iRs;
                Rsh:=iRsh;
            else
               Vt:=0;
                Rs:=0;
                Rsh:=0;
            end if;
        else
           Vt:=0;
           Rs:=0;
           Rsh:=0;
        end if;
    else
       Vt:=0;
       Rs:=0;
       Rsh:=0;
    end if;

  end for;
  I0 :=(Isc - (Voc - Isc*Rs)/Rsh)*exp(-Voc/(ns*Vt));            //eqn 2.23 diode or dark saturation current

annotation (
  Icon(
     coordinateSystem(
        preserveAspectRatio=false,
        extent={{-100,-100},{100,100}},
        grid={2,2}),
      graphics={
        Line(
          points={{0,100},{0,50}},
          color={0,0,0}),
        Ellipse(
          extent={{-50,50},{50,-50}}),
        Text(
          extent={{-100,-100},{100,-60}},
          textString = "//Pnom"),
        Text(
          extent={{-30,30},{30,-30}},
          textString="PV")}),
  Documentation(info="<html>   
  <p>
  The model is according to the paper \"A novel model for photovoltaic array performance prediction\" by Wei Zhou et al.
  </p> 
 
</html>"));
end Photovoltaic1;

There are 0 guests and 0 other users also viewing this topic