Skip to content

Commit

Permalink
[iss-52]
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 8498671
Author: Joaquin <[email protected]>
Date:   Fri Aug 20 09:45:18 2021 -0300

    Updated N2D model variables.
  • Loading branch information
joaquinffernandez committed Aug 20, 2021
1 parent e9a195b commit ba9f5ab
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 94 deletions.
22 changes: 11 additions & 11 deletions test/mccprograms/flatter/N2D.mo
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,22 @@ class ConstantVoltage
end ConstantVoltage;

model RCcell
Resistor resistor;
Resistor resistor1;
Capacitor capacitor;
Capacitor capacitor1;
Resistor R1;
Resistor R2;
Capacitor C1;
Capacitor C2;
Pin l;
Pin d;
Pin r;
Pin u;
equation
connect(resistor.n, capacitor.p);
connect(resistor1.n, capacitor1.p);
connect(resistor1.n, capacitor.p);
connect(resistor.p, l);
connect(capacitor.n, r);
connect(resistor1.p, u);
connect(capacitor1.n, d);
connect(R1.n, C1.p);
connect(R2.n, C2.p);
connect(R2.n, C1.p);
connect(R1.p, l);
connect(C1.n, r);
connect(R2.p, u);
connect(C2.n, d);
end RCcell;

model N2D
Expand Down
22 changes: 11 additions & 11 deletions test/mccprograms/flatter/OM_flatter_package.mo
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,22 @@ package GT_MODELS
end RRLC;

model RCcell
Resistor resistor;
Resistor resistor1;
Capacitor capacitor;
Capacitor capacitor1;
Resistor R1;
Resistor R2;
Capacitor C1;
Capacitor C2;
Pin l;
Pin d;
Pin r;
Pin u;
equation
connect(resistor.n, capacitor.p);
connect(resistor1.n, capacitor1.p);
connect(resistor1.n, capacitor.p);
connect(resistor.p, l);
connect(capacitor.n, r);
connect(resistor1.p, u);
connect(capacitor1.n, d);
connect(R1.n, C1.p);
connect(R2.n, C2.p);
connect(R2.n, C1.p);
connect(R1.p, l);
connect(C1.n, r);
connect(R2.p, u);
connect(C2.n, d);
end RCcell;

model N2D
Expand Down
144 changes: 72 additions & 72 deletions test/mccprograms/flatter/mcc_N2D.mo
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
model N2D
constant Integer N=10;
constant Integer M=10;
parameter Real Cell_resistor_R[N, M](each start=1);
parameter Real Cell_resistor_T_ref[N, M]=fill(300.15,N,M);
parameter Real Cell_resistor_alpha[N, M]=fill(0,N,M);
Real Cell_resistor_v[N, M];
Real Cell_resistor_i[N, M];
Real Cell_resistor_p_v[N, M];
Real Cell_resistor_p_i[N, M];
Real Cell_resistor_n_v[N, M];
Real Cell_resistor_n_i[N, M];
Real Cell_resistor_LossPower[N, M];
Real Cell_resistor_T_heatPort[N, M](each start=288.15);
Real Cell_resistor_R_actual[N, M];
parameter Real Cell_resistor1_R[N, M](each start=1);
parameter Real Cell_resistor1_T_ref[N, M]=fill(300.15,N,M);
parameter Real Cell_resistor1_alpha[N, M]=fill(0,N,M);
Real Cell_resistor1_v[N, M];
Real Cell_resistor1_i[N, M];
Real Cell_resistor1_p_v[N, M];
Real Cell_resistor1_p_i[N, M];
Real Cell_resistor1_n_v[N, M];
Real Cell_resistor1_n_i[N, M];
Real Cell_resistor1_LossPower[N, M];
Real Cell_resistor1_T_heatPort[N, M](each start=288.15);
Real Cell_resistor1_R_actual[N, M];
Real Cell_capacitor_v[N, M](each start=0);
Real Cell_capacitor_i[N, M];
Real Cell_capacitor_p_v[N, M];
Real Cell_capacitor_p_i[N, M];
Real Cell_capacitor_n_v[N, M];
Real Cell_capacitor_n_i[N, M];
parameter Real Cell_capacitor_C[N, M](each start=1);
Real Cell_capacitor1_v[N, M](each start=0);
Real Cell_capacitor1_i[N, M];
Real Cell_capacitor1_p_v[N, M];
Real Cell_capacitor1_p_i[N, M];
Real Cell_capacitor1_n_v[N, M];
Real Cell_capacitor1_n_i[N, M];
parameter Real Cell_capacitor1_C[N, M](each start=1);
parameter Real Cell_R1_R[N, M](each start=1);
parameter Real Cell_R1_T_ref[N, M]=fill(300.15,N,M);
parameter Real Cell_R1_alpha[N, M]=fill(0,N,M);
Real Cell_R1_v[N, M];
Real Cell_R1_i[N, M];
Real Cell_R1_p_v[N, M];
Real Cell_R1_p_i[N, M];
Real Cell_R1_n_v[N, M];
Real Cell_R1_n_i[N, M];
Real Cell_R1_LossPower[N, M];
Real Cell_R1_T_heatPort[N, M](each start=288.15);
Real Cell_R1_R_actual[N, M];
parameter Real Cell_R2_R[N, M](each start=1);
parameter Real Cell_R2_T_ref[N, M]=fill(300.15,N,M);
parameter Real Cell_R2_alpha[N, M]=fill(0,N,M);
Real Cell_R2_v[N, M];
Real Cell_R2_i[N, M];
Real Cell_R2_p_v[N, M];
Real Cell_R2_p_i[N, M];
Real Cell_R2_n_v[N, M];
Real Cell_R2_n_i[N, M];
Real Cell_R2_LossPower[N, M];
Real Cell_R2_T_heatPort[N, M](each start=288.15);
Real Cell_R2_R_actual[N, M];
Real Cell_C1_v[N, M](each start=0);
Real Cell_C1_i[N, M];
Real Cell_C1_p_v[N, M];
Real Cell_C1_p_i[N, M];
Real Cell_C1_n_v[N, M];
Real Cell_C1_n_i[N, M];
parameter Real Cell_C1_C[N, M](each start=1);
Real Cell_C2_v[N, M](each start=0);
Real Cell_C2_i[N, M];
Real Cell_C2_p_v[N, M];
Real Cell_C2_p_i[N, M];
Real Cell_C2_n_v[N, M];
Real Cell_C2_n_i[N, M];
parameter Real Cell_C2_C[N, M](each start=1);
Real Cell_l_v[N, M];
Real Cell_l_i[N, M];
Real Cell_d_v[N, M];
Expand All @@ -58,28 +58,28 @@ model N2D
Real G_p_i;
equation
for _Index_0 in 1:N,_Index_1 in 1:M loop
Cell_resistor_R_actual[_Index_0,_Index_1] = Cell_resistor_R[_Index_0,_Index_1]*(1+Cell_resistor_alpha[_Index_0,_Index_1]*(Cell_resistor_T_heatPort[_Index_0,_Index_1]-Cell_resistor_T_ref[_Index_0,_Index_1]));
Cell_resistor_v[_Index_0,_Index_1] = Cell_resistor_R_actual[_Index_0,_Index_1]*Cell_resistor_i[_Index_0,_Index_1];
Cell_resistor_LossPower[_Index_0,_Index_1] = Cell_resistor_v[_Index_0,_Index_1]*Cell_resistor_i[_Index_0,_Index_1];
Cell_resistor_T_heatPort[_Index_0,_Index_1] = Cell_resistor_T_ref[_Index_0,_Index_1];
Cell_resistor_v[_Index_0,_Index_1] = Cell_resistor_p_v[_Index_0,_Index_1]-Cell_resistor_n_v[_Index_0,_Index_1];
0 = Cell_resistor_p_i[_Index_0,_Index_1]+Cell_resistor_n_i[_Index_0,_Index_1];
Cell_resistor_i[_Index_0,_Index_1] = Cell_resistor_p_i[_Index_0,_Index_1];
Cell_resistor1_R_actual[_Index_0,_Index_1] = Cell_resistor1_R[_Index_0,_Index_1]*(1+Cell_resistor1_alpha[_Index_0,_Index_1]*(Cell_resistor1_T_heatPort[_Index_0,_Index_1]-Cell_resistor1_T_ref[_Index_0,_Index_1]));
Cell_resistor1_v[_Index_0,_Index_1] = Cell_resistor1_R_actual[_Index_0,_Index_1]*Cell_resistor1_i[_Index_0,_Index_1];
Cell_resistor1_LossPower[_Index_0,_Index_1] = Cell_resistor1_v[_Index_0,_Index_1]*Cell_resistor1_i[_Index_0,_Index_1];
Cell_resistor1_T_heatPort[_Index_0,_Index_1] = Cell_resistor1_T_ref[_Index_0,_Index_1];
Cell_resistor1_v[_Index_0,_Index_1] = Cell_resistor1_p_v[_Index_0,_Index_1]-Cell_resistor1_n_v[_Index_0,_Index_1];
0 = Cell_resistor1_p_i[_Index_0,_Index_1]+Cell_resistor1_n_i[_Index_0,_Index_1];
Cell_resistor1_i[_Index_0,_Index_1] = Cell_resistor1_p_i[_Index_0,_Index_1];
Cell_capacitor_i[_Index_0,_Index_1] = Cell_capacitor_C[_Index_0,_Index_1]*der(Cell_capacitor_v[_Index_0,_Index_1]);
Cell_capacitor_v[_Index_0,_Index_1] = Cell_capacitor_p_v[_Index_0,_Index_1]-Cell_capacitor_n_v[_Index_0,_Index_1];
0 = Cell_capacitor_p_i[_Index_0,_Index_1]+Cell_capacitor_n_i[_Index_0,_Index_1];
Cell_capacitor_i[_Index_0,_Index_1] = Cell_capacitor_p_i[_Index_0,_Index_1];
Cell_capacitor1_i[_Index_0,_Index_1] = Cell_capacitor1_C[_Index_0,_Index_1]*der(Cell_capacitor1_v[_Index_0,_Index_1]);
Cell_capacitor1_v[_Index_0,_Index_1] = Cell_capacitor1_p_v[_Index_0,_Index_1]-Cell_capacitor1_n_v[_Index_0,_Index_1];
0 = Cell_capacitor1_p_i[_Index_0,_Index_1]+Cell_capacitor1_n_i[_Index_0,_Index_1];
Cell_capacitor1_i[_Index_0,_Index_1] = Cell_capacitor1_p_i[_Index_0,_Index_1];
Cell_R1_R_actual[_Index_0,_Index_1] = Cell_R1_R[_Index_0,_Index_1]*(1+Cell_R1_alpha[_Index_0,_Index_1]*(Cell_R1_T_heatPort[_Index_0,_Index_1]-Cell_R1_T_ref[_Index_0,_Index_1]));
Cell_R1_v[_Index_0,_Index_1] = Cell_R1_R_actual[_Index_0,_Index_1]*Cell_R1_i[_Index_0,_Index_1];
Cell_R1_LossPower[_Index_0,_Index_1] = Cell_R1_v[_Index_0,_Index_1]*Cell_R1_i[_Index_0,_Index_1];
Cell_R1_T_heatPort[_Index_0,_Index_1] = Cell_R1_T_ref[_Index_0,_Index_1];
Cell_R1_v[_Index_0,_Index_1] = Cell_R1_p_v[_Index_0,_Index_1]-Cell_R1_n_v[_Index_0,_Index_1];
0 = Cell_R1_p_i[_Index_0,_Index_1]+Cell_R1_n_i[_Index_0,_Index_1];
Cell_R1_i[_Index_0,_Index_1] = Cell_R1_p_i[_Index_0,_Index_1];
Cell_R2_R_actual[_Index_0,_Index_1] = Cell_R2_R[_Index_0,_Index_1]*(1+Cell_R2_alpha[_Index_0,_Index_1]*(Cell_R2_T_heatPort[_Index_0,_Index_1]-Cell_R2_T_ref[_Index_0,_Index_1]));
Cell_R2_v[_Index_0,_Index_1] = Cell_R2_R_actual[_Index_0,_Index_1]*Cell_R2_i[_Index_0,_Index_1];
Cell_R2_LossPower[_Index_0,_Index_1] = Cell_R2_v[_Index_0,_Index_1]*Cell_R2_i[_Index_0,_Index_1];
Cell_R2_T_heatPort[_Index_0,_Index_1] = Cell_R2_T_ref[_Index_0,_Index_1];
Cell_R2_v[_Index_0,_Index_1] = Cell_R2_p_v[_Index_0,_Index_1]-Cell_R2_n_v[_Index_0,_Index_1];
0 = Cell_R2_p_i[_Index_0,_Index_1]+Cell_R2_n_i[_Index_0,_Index_1];
Cell_R2_i[_Index_0,_Index_1] = Cell_R2_p_i[_Index_0,_Index_1];
Cell_C1_i[_Index_0,_Index_1] = Cell_C1_C[_Index_0,_Index_1]*der(Cell_C1_v[_Index_0,_Index_1]);
Cell_C1_v[_Index_0,_Index_1] = Cell_C1_p_v[_Index_0,_Index_1]-Cell_C1_n_v[_Index_0,_Index_1];
0 = Cell_C1_p_i[_Index_0,_Index_1]+Cell_C1_n_i[_Index_0,_Index_1];
Cell_C1_i[_Index_0,_Index_1] = Cell_C1_p_i[_Index_0,_Index_1];
Cell_C2_i[_Index_0,_Index_1] = Cell_C2_C[_Index_0,_Index_1]*der(Cell_C2_v[_Index_0,_Index_1]);
Cell_C2_v[_Index_0,_Index_1] = Cell_C2_p_v[_Index_0,_Index_1]-Cell_C2_n_v[_Index_0,_Index_1];
0 = Cell_C2_p_i[_Index_0,_Index_1]+Cell_C2_n_i[_Index_0,_Index_1];
Cell_C2_i[_Index_0,_Index_1] = Cell_C2_p_i[_Index_0,_Index_1];
end for;
S_v = S_V;
S_v = S_p_v-S_n_v;
Expand All @@ -100,16 +100,16 @@ equation
end for;
Cell_d_i[10,1]+S_n_i+sum(Cell_d_i[10:1:10, 2:1:10]) = 0;
for i in 1:1:10,j in 1:1:10 loop
Cell_resistor_p_i[i,j]+(-Cell_l_i[i,j]) = 0;
Cell_R1_p_i[i,j]+(-Cell_l_i[i,j]) = 0;
end for;
for i in 1:1:10,j in 1:1:10 loop
Cell_capacitor_n_i[i,j]+(-Cell_r_i[i,j]) = 0;
Cell_C1_n_i[i,j]+(-Cell_r_i[i,j]) = 0;
end for;
for i in 1:1:10,j in 1:1:10 loop
Cell_resistor1_p_i[i,j]+(-Cell_u_i[i,j]) = 0;
Cell_R2_p_i[i,j]+(-Cell_u_i[i,j]) = 0;
end for;
for i in 1:1:10,j in 1:1:10 loop
Cell_capacitor1_n_i[i,j]+(-Cell_d_i[i,j]) = 0;
Cell_C2_n_i[i,j]+(-Cell_d_i[i,j]) = 0;
end for;
for i in 1:1:9,j in 1:1:9 loop
Cell_l_i[i,j+1]+Cell_r_i[i,j] = 0;
Expand All @@ -121,7 +121,7 @@ equation
Cell_l_i[i,1]+Cell_r_i[i,10] = 0;
end for;
for i in 1:1:10,j in 1:1:10 loop
Cell_capacitor1_p_i[i,j]+Cell_resistor1_n_i[i,j]+Cell_capacitor_p_i[i,j]+Cell_resistor_n_i[i,j] = 0;
Cell_C1_p_i[i,j]+Cell_R1_n_i[i,j]+Cell_R2_n_i[i,j]+Cell_C2_p_i[i,j] = 0;
end for;
for i in 1:1:9,j in 1:1:1 loop
Cell_u_i[i+1,10] = 0;
Expand All @@ -137,24 +137,24 @@ equation
end for;
G_p_i = 0;
for i in 1:1:10,j in 1:1:10 loop
Cell_capacitor1_p_v[i,j] = Cell_resistor1_n_v[i,j];
Cell_capacitor1_p_v[i,j] = Cell_capacitor_p_v[i,j];
Cell_capacitor1_p_v[i,j] = Cell_resistor_n_v[i,j];
Cell_C1_p_v[i,j] = Cell_R1_n_v[i,j];
Cell_C1_p_v[i,j] = Cell_R2_n_v[i,j];
Cell_C1_p_v[i,j] = Cell_C2_p_v[i,j];
end for;
for i in 1:1:9,j in 1:1:9 loop
Cell_l_v[i,j+1] = Cell_r_v[i,j];
end for;
for i in 1:1:10,j in 1:1:10 loop
Cell_capacitor1_n_v[i,j] = Cell_d_v[i,j];
Cell_C2_n_v[i,j] = Cell_d_v[i,j];
end for;
for i in 1:1:10,j in 1:1:10 loop
Cell_resistor1_p_v[i,j] = Cell_u_v[i,j];
Cell_R2_p_v[i,j] = Cell_u_v[i,j];
end for;
for i in 1:1:10,j in 1:1:10 loop
Cell_capacitor_n_v[i,j] = Cell_r_v[i,j];
Cell_C1_n_v[i,j] = Cell_r_v[i,j];
end for;
for i in 1:1:10,j in 1:1:10 loop
Cell_resistor_p_v[i,j] = Cell_l_v[i,j];
Cell_R1_p_v[i,j] = Cell_l_v[i,j];
end for;
for i in 1:1:9,j in 1:1:9 loop
Cell_d_v[i,j] = Cell_u_v[i+1,j];
Expand Down

0 comments on commit ba9f5ab

Please sign in to comment.