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

output function

output function

Hello,

    I  got this error when i run my model

Variable pvte500cr1.y[1] does not have any remaining equation to be solved in.  The original equations were:


Code:


model PVTE500CR
extends Modelica.Blocks.Interfaces.MIMO(nin=3);
extends Modelica.Blocks.Interfaces.MIMO(nout=3);

input Real Va;
input Real TaC;
input Real G;
//outputs
output Real Ia[:];
output Real p;
output Real pj;

//outputs
//% Define variables
Real TaK ;
Real Isc ;
Real Iph ;
Real Ir;
Real Vt_Ta ;
constant Real k=Modelica.Constants.k;
constant Real e_ch=Modelica.Constants.q;
//***************
parameter Real n = 1.62 ;
parameter Real Eg = 1.12;
parameter Real Ns = 36;
parameter Real TrK = 298;
parameter Real Voc_TrK = 22.30/Ns;
parameter Real Isc_TrK = 3.90;
parameter Real a = 0.95e-3;
parameter Real b= Eg * e_ch /(n * k);
parameter Real Vt_TrK = n * k * TrK / e_ch;
parameter Real Ir_TrK = Isc_TrK / (exp(Voc_TrK / Vt_TrK) -1);
parameter Real dVdI_Voc = -1.0/Ns;
parameter Real Xv = Ir_TrK / Vt_TrK * exp(Voc_TrK / Vt_TrK);
parameter Real Rs = - dVdI_Voc - 1/Xv;


equation
TaK = 273 + TaC;

Iph = G * Isc;
Isc = Isc_TrK * (1 + (a * (TaK - TrK)));
Ir = Ir_TrK * (TaK / TrK)^(3/n) * exp(-b * (1 / TaK -1 / TrK));
Vt_Ta = n * k * TaK / e_ch;
Ia[1]=0;

for i in 2:4 loop
  Ia[i]=Ia[i-1]-(Iph - Ia[i-1]-Ir.*(exp(((Ia[i-1]*Rs)+(Va/Ns))./Vt_Ta)-1))./(-1-Ir*(Rs./Vt_Ta).*exp(((Va/Ns) + Ia[i-1]* Rs) ./ Vt_Ta));
end for;

p=Ia[size(Ia,1)]*Va;
pj= Rs*(Ia[size(Ia,1)]^2)*Ns;//% + (( (Va+Rs*Ia)^2)/Rsh);


end PVTE500CR;

I would like to test my model if it works very well, I tried to inject constant inputs but it returns me errors when I simulate it

Code:


model test_pvt2
  Modelica.Blocks.Sources.Constant const(k = 1200)  annotation(
      Placement(visible = true, transformation(origin = {-150, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
    Modelica.Blocks.Sources.Constant const1(k = 25)  annotation(
      Placement(visible = true, transformation(origin = {-150, -28}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
    Modelica.Blocks.Sources.Constant const2(k = 38)  annotation(
      Placement(visible = true, transformation(origin = {-150, -70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  PVTE500CR pvte500cr1 annotation(
    Placement(visible = true, transformation(origin = {34, -22}, extent = {{-28, -28}, {28, 28}}, rotation = 0)));
equation
connect(const2.y, pvte500cr1.u[3]) annotation(
    Line(points = {{-138, -70}, {-56, -70}, {-56, -22}, {0, -22}}, color = {0, 0, 127}));
connect(const1.y, pvte500cr1.u[2]) annotation(
    Line(points = {{-138, -28}, {-58, -28}, {-58, -22}, {0, -22}}, color = {0, 0, 127}));
connect(const.y, pvte500cr1.u[1]) annotation(
    Line(points = {{-138, 30}, {-58, 30}, {-58, -22}, {0, -22}}, color = {0, 0, 127}));

    end test_pvt2;

can any one help me please?

Edited by: Abderezakabidi - Jan-04-20 01:54:07
There are 0 guests and 0 other users also viewing this topic