Skip to content
Snippets Groups Projects
Commit d2b2b7d3 authored by Charukeshi Mayuresh Joglekar's avatar Charukeshi Mayuresh Joglekar
Browse files

Delete ACS_V9.ipynb

parent 5dcce606
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:6abc5329-fdea-4f76-ad5f-f6e8ecc8cdac tags:
Design and Simulation of a Grid Forming Inverter
System definition
This notebook presents the complete design and verification of an inverter working as grid forming
%% Cell type:code id:bc402d67 tags:
``` octave
clear all
% Set the Octave Engine to run the simulation
SetSimulationEnvironment;
% Input Data
Rf = 0.1
Lf = 0.01
Rc = 0.01
Cf = 0.001
Rl = 10
Ll = 0.1
om = 2*pi*50
Vref = sqrt(3)*220
```
%% Cell type:markdown id:446033c6 tags:
Current Loop
First thing we design the current loop compensating the pole of the inductance and fixing the
bandwidth
%% Cell type:code id:02055711 tags:
``` octave
ombc = 600*2*pi
Kpc = ombc*Lf
Kic = ombc*Rf
```
%% Cell type:markdown id:d3944599 tags:
As result we have the following frequency responses
Open loop current
%% Cell type:code id:6a86cc64 tags:
``` octave
Gc = tf(1,[Lf Rf])
bode(Gc)
```
%% Cell type:markdown id:556532ab tags:
Adding the controller to the open loop
%% Cell type:code id:bd6ffa04 tags:
``` octave
Rcur = tf([Kpc Kic],[1 0])
Gopenc = Rcur*Gc
bode(Gopenc)
```
%% Cell type:markdown id:9415b65d tags:
Voltage Loop
The design is performed by tuning the PI control and assuming that ESR does not play a role and
that the current loop is too fast for the voltage loop
%% Cell type:code id:ac110f53 tags:
``` octave
ombv = 100*2*pi
fim = 60*pi/180
Gv = tf(1,[Cf 0])
[Go Fo]= bode(Gv,ombv)
Fo = Fo*pi/180;
Kpv = cos(-pi+fim-Fo)/Go
Kiv = -sin(-pi+fim-Fo)*ombv/Go
```
%% Cell type:code id:4dead95b tags:
``` octave
Rv = tf([Kpv Kiv],[1 0])
Gopenv = Rv*Gv
margin(Gopenv)
```
%% Cell type:code id:9d1a0433 tags:
``` octave
% Set the Octave Engine to run the simulation
SetSimulationEnvironment;
tini = 0;
tfinal = 0.1;
dt = 0.0001;
nflows = 44;
nnode = 23;
maxn = 20;
toll = 0.0001;
% Creating an hybrid diagram containing a power network and control
hy = HybridSystem(nnode,nflows,tini,tfinal,dt,maxn,toll);
% POWER NETWORK TOPOLOGY - Inverter+Filter+Load
% Voltage Source
c1{1} = Signal2Source(1,0,24);
c1{2} = Signal2Source(2,0,25);
c1{3} = Signal2Source(3,0,26);
% Resistor
c1{4} = Resistance(1,4,Rf);
c1{5} = Resistance(2,5,Rf);
c1{6} = Resistance(3,6,Rf);
% Inductor
c1{7} = Inductor(4,7,Lf);
c1{8} = Inductor(5,8,Lf);
c1{9} = Inductor(6,9,Lf);
% Current Sensors
c1{10} = CurrentSensor(7,10,29);
c1{11} = CurrentSensor(8,11,30);
c1{12} = CurrentSensor(9,12,31);
% Capacitor Resistances
c1{13} = Resistance(10,20,Rc);
c1{14} = Resistance(11,21,Rc);
c1{15} = Resistance(12,22,Rc);
% Capacitor Filter
c1{16} = Capacitor(20,23,Cf);
c1{17} = Capacitor(21,23,Cf);
c1{18} = Capacitor(22,23,Cf);
% Line/Load Resistance
c1{19} = Resistance(10,13,Rl);
c1{20} = Resistance(11,14,Rl);
c1{21} = Resistance(12,15,Rl);
% Line/Load Inductor
c1{22} = Inductor(13,16,Ll);
c1{23} = Inductor(14,17,Ll);
c1{24} = Inductor(15,18,Ll);
% Current sensors on line
c1{25} = CurrentSensor(16,19,34);
c1{26} = CurrentSensor(17,19,35);
c1{27} = CurrentSensor(18,19,36);
% Voltage sensors across capacitors
c1{28} = VoltageSensor(10,23,39);
c1{29} = VoltageSensor(11,23,40);
c1{30} = VoltageSensor(12,23,41);
% Adding all the components to the network diagram
hy.AddListComponents2Network(c1);
CONTROL SYSTEM
% Voltage Control
b1{1} = Constant(1,Vref);
b1{2} = Constant(2,0);
b1{3} = Sum(1,42,3,1,-1);
b1{4} = Sum(2,43,4,1,-1);
b1{5} = PI(3,5,Kpv,Kiv,0);
b1{6} = PI(4,6,Kpv,Kiv,0);
% Feedforward and decoupling voltage loop
b1{7} = Sum(5,8,9,1,1);
b1{8} = Sum(6,7,10,1,-1);
b1{9} = Gain(43,8,2*pi*50*Cf);
b1{10} = Gain(42,7,2*pi*50*Cf);
b1{11} = Sum(9,37,11,1,1);
b1{12} = Sum(10,38,12,1,1);
% Current Control
b1{13} = Sum(11,32,13,1,-1);
b1{14} = Sum(12,33,14,1,-1);
b1{15} = PI(13,15,Kpc,Kic,0);
b1{16} = PI(14,17,Kpc,Kic,0);
% Feedforward and decoupling current loop
b1{17} = Sum(15,16,19,1,1);
b1{18} = Sum(17,18,20,1,-1);
b1{19} = Gain(33,16,2*pi*50*Lf);
b1{20} = Gain(32,18,2*pi*50*Lf);
b1{21} = Sum(19,42,21,1,1);
b1{22} = Sum(20,43,22,1,1);
% Park Output Voltage Reference
b1{23} = InvPark(21,22,2,24,25,26,23);
% Angle Reference
b1{24} = Constant(27,2*pi*50);
b1{25} = Integrator(27,23,0);
% Measurement Current Filter
b1{26} = Park(29,30,31,32,33,44,23);
% Measurement Voltage Filter
b1{27} = Park(39,40,41,42,43,44,23);
% Measurement Current Load
b1{28} = Park(34,35,36,37,38,44,23);
% Adding all the components to the Control Schema
hy.AddListComponents2Schema(b1);
% Initialization
hy.Init();
p=1;
% Simulation Loop
while hy.Step()
time(p) = hy.GetTime();
% Park Voltage
out(1,p) = hy.GetFlow(42);
out(2,p) = hy.GetFlow(43);
% Park Currents
out(3,p) = hy.GetFlow(32);
out(4,p) = hy.GetFlow(33);
% Phase Voltages
out(5,p) = hy.GetFlow(39);
out(6,p) = hy.GetFlow(40);
out(7,p) = hy.GetFlow(41);
% Phase Currents
out(8,p) = hy.GetFlow(34);
out(9,p) = hy.GetFlow(35);
out(10,p) = hy.GetFlow(36);
p=p+1;
end
```
%% Cell type:markdown id:d03968d1 tags:
Park Voltages on the filter
%% Cell type:code id:754899a0 tags:
``` octave
plot(time,out(1,:),time,out(2,:));
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment