-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
199 changed files
with
1,014 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
%% This function estimates the admittance as transfer functions between Idc vs Vdc | ||
%using transfer function estimation function available in control system | ||
%tool box. | ||
function sys=dcAdmittancescanPRBS(Vdc,f,data,o) | ||
arguments | ||
Vdc {mustBeGreaterThanOrEqual(Vdc,0)} % Should be the amplitude of D axis disturbance in PU | ||
f {mustBeVector} % Disturbance frequency vector in Hz | ||
data {mustBeNonempty} % Should be a output structure containing the simulation data | ||
o {mustBeNumeric} % Should be a numeric value defining the order of the model | ||
end | ||
w =2*pi*f; | ||
if(Vdc>1e-6) | ||
GDCfrd = frestimate(data.dataDC,w,'rad/s'); % Transfer function YDC | ||
figure; | ||
opt = tfestOptions('InitializeMethod','n4sid','Display','off','SearchMethod','lsqnonlin'); | ||
sysDC = tfest(GDCfrd,o,opt);% Filtered transfer function YDD | ||
plotAdmittanceDC(sysDC,f) %Plots the Bode plots for D-axis admittance | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function plotAdmittanceDC(sysDC,f) | ||
h1=bodeplot(sysDC,{f(1)*2*pi,f(end)*2*pi}); % Bode plot | ||
setoptions(h1,'FreqUnits','Hz','grid','on','PhaseWrapping','off'); | ||
legend('Y_DC','Location','best'); | ||
title('DC Admittances'); | ||
figure; | ||
subplot(2,1,1) | ||
nichols(sysDC) | ||
ngrid | ||
title('Admittance Nichols Chart'); % Nichols Chart for YDD | ||
subplot(2,1,2) | ||
pzplot(sysDC) | ||
title('Poles and Zeros'); % Eigen plot for YDD | ||
end |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
%% Simulation Parameters | ||
% This file sets the parameters for all the blocks and variables used in the simulation model | ||
%% Renewable plant parameters | ||
BatteryStoragePVPlantGFMParameters;% PV and Battery plant parameters | ||
WindFarmGFMControlParameters;% Wind plant parameters | ||
% windTurbine.turbineRadius=90; % Turbine radius in m | ||
% base.kV=4.16e3; | ||
% base.mVA=50e6; %Base MVA | ||
% base.z=(base.kV)^2/base.mVA; | ||
%% Configure Mppt parameters | ||
% sweepTurbine; | ||
% plotPowerCurves; | ||
% mpptPower=maxPower*0.98; | ||
% mpptWindSpeed=windSpeedv; | ||
% mpptOmega=maxPowerRPM; | ||
%% HVDC Station Parameters | ||
HVDC.L=3.1e-5; | ||
HVDC.C=0.085; | ||
HVDC.Vdc=250e3; | ||
HVDC.Vdcbase=10e3; | ||
HVDC.Imaxpu=1.2; | ||
windTransformer.hv1=HVDC.Vdc/(1.3*sqrt(2)); | ||
base.kV1=windTransformer.hv1; | ||
grid.sensorTime=2*Ts; | ||
Grid.governor_droop=1e-3; | ||
Grid.H=0.1;%0.1; | ||
Grid.MVA=80e6;%100e6; | ||
%%% | ||
%% | ||
%% Admittance Scan parameters | ||
scan.end=2;% time to end frequency scan | ||
scan.start=1.0;% time to start frequency scan | ||
scan.samplingfrequency=5e3;% Sampling frequency of frequency scan | ||
scan.Vd=0.02;% Disturbance voltage magnitude in PU | ||
scan.Vq=0.0;% Disturbance voltage magnitude in PU | ||
scan.f=[1:1e4]/(2*pi); % Range of disturbance frequency in Hz | ||
modelorder=4; % Model order to obtain a reduced ordered admittance model of the system | ||
Tsim=scan.end+0.2; | ||
%% Event timings | ||
time.renewablevariation=11;% time to change renewable power | ||
time.fault=11;% time to to create ac onshore fault | ||
time.load=11;% time to change load power | ||
time.dcfault=11;% time to create dc fault |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
% Copyright 2023 The MathWorks, Inc. | ||
%% Simulation Parameters | ||
T=5e-5; % Step size [s] | ||
Ts=5e-5; % Control time step [s] | ||
Tsim=10; % Simulation time span | ||
tevent=5; % Time [s] at which events are triggered | ||
time.fault=Tsim+1; % Fault instant [s] | ||
time.load=Tsim+1; % load change instant [s] | ||
time.wind=Tsim+1; % Wind velocity instant [s] | ||
time.island=Tsim+1; % Islanded instant [s] | ||
time.lineTrip=Tsim+1; % Line trip instant [s] | ||
islanded=0; % Flag on islanding | ||
%% Wind Transformer | ||
windTransformer.lv=4.16e3; % Wind transformer lv side L-L voltage in V | ||
windTransformer.hv=230e3; % Wind transformer hv side L-L voltage in V | ||
windTransformer.va=2.5e9; % Wind transformer VA rating | ||
windTransformer.windingResistance=0.002; % Winding resistance in pu | ||
windTransformer.windingLekageReactance=0.04; % Winding lekage reactance in pu | ||
windTransformer.zeroSequenceReactance=0.1; % Winding zero sequence reactance in pu | ||
%% Grid Parameters | ||
grid.voltage=230e3; % Actual supply L-L voltage used for simulating the system, | ||
grid.frequency=60; % Supply frequency in Hz | ||
grid.rs=0.01; % Grid source resistance in ohms 0.01; | ||
grid.ls=0.3e-3; % Grid source inductance in Henry 3e-3; | ||
%%Grid Parameters | ||
grid.voltage=0.98*230e3; % Supply L-L voltage | ||
grid.governorDroop=0.1/(2*pi*grid.frequency); % Grid generator governor droop in (pu) | ||
grid.damping=0.2; % Grid generator damping ratio | ||
grid.mva=100e6; % Grid generator VA base | ||
grid.H=0.4; % Grid generator inertia in (sec) | ||
grid.pRef=0.5; % Grid generator real power reference | ||
grid.sensorTime=8e-5; % Speed sensor tim delay in (sec) | ||
%% Parameters of Wind Turbine | ||
load('wind_turbine_Cp.mat') % Loading wind turbine power coefficient table | ||
load('wind_MPPT.mat') % Loading MPPT characteristics -power/omega vs wind speed | ||
load('wind_derating.mat') % Loading derating table - wind speed vs pitch angle | ||
% Rotor hub parameters | ||
windTurbine.turbineRadius = 83; % (m) Turbine radius | ||
windTurbine.inertia = 3.2e8; % Inertia in kgm^2 | ||
windTurbine.airDensity = 1.225; % (kg/m^3) Air density | ||
windTurbine.vWindThreshold = 0.01; % (m/s) Threshold wind velocity to avoid divison by zero in Tip Speed Ratio calculation | ||
windTurbine.wThreshold = 0.01; % (rad/s) Threshold wind turbine velocity for numerical convergence | ||
windTurbine.cpBraking = -0.001; % Power coefficient for aerodynamic braking | ||
windTurbine.turbineRatedPower = 6.5; % Power turbine rated power | ||
% Turbine state machine parameters | ||
windTurbine.vWindCutInLower = 4; % (m/s) Cut in lower wind speed | ||
windTurbine.vWindCutOut = 23; % (m/s) Cut out wind speed | ||
windTurbine.vWindCutInUpper = 0.9*windTurbine.vWindCutOut; % (m/s) Cut in upper wind speed | ||
windTurbine.vWindRated = 11; % (m/s) Rated wind speed | ||
% Extending power coefficient table in aerodynamic pitch brake region | ||
windTurbine.numTSR = size(cp,2); % Estimating size of power coefficient table | ||
windTurbine.pitch = [pitch,90,95]; % (deg) Extending pitch angle vector to brake region | ||
windTurbine.cp = [cp;windTurbine.cpBraking*ones(2,windTurbine.numTSR)]; % Power coefficient table extension to braking region | ||
windTurbine.TSR = TSR; | ||
%% | ||
% *Wind Inverter Parameters* | ||
windInverter.imaxPU=1.2; % Max current limit of inverter in (pu). | ||
windInverter.vdc=windTransformer.lv*sqrt(2)*2/(1*sqrt(3))*1.25; % Calculation of required dc voltage of inverter | ||
windInverter.c=1e-2; % Inverter dc bus capacitance | ||
windInverter.l=(2*0.5e-3); % Inverter ac side filter inductance | ||
windInverter.cFilter=1.1e-3; % Inverter ac side filter capacitance | ||
%Define base for Wind controller design | ||
base.kV=4.16e3; %Base KV | ||
base.mVA=100e6; %Base MVA | ||
base.z=(base.kV)^2/base.mVA; %Base impedance | ||
%% Wind Controller Parameters | ||
%Current controller Wind inverter | ||
windController.tSensor=2e-5; % Sensor time constant | ||
windController.kpic=1.5; % Proportional gain | ||
windController.kiic=250; % Integral gain | ||
windController.kd=0; % Derivative gain | ||
% AC Voltage controller Wind inverter | ||
windController.mv=0.05; % Volatge controller gain | ||
windController.vRef=1.0; % Volatge controller reference | ||
%DC bus Voltage_controller | ||
windController.kpv=4; % Proportional gain | ||
windController.kiv=0.5; % Integral gain | ||
windController.kdv=0.0; % Derivative gain | ||
windController.vdcBase=1e3; % Dc side base voltage in (Volts) | ||
%GFM wind controller parameters | ||
windController.kpvgfm=0.05; %Voltage controller proportional gain | ||
windController.kivgfm=0.3; %Voltage controller integral gain | ||
windController.kdvgfm=0; %Voltage controller derevative gain | ||
%% GFM using Dc link voltage control by GSC (G-GFM) | ||
%Parameters of G-GFM Transfer function | ||
gGFM.kt=10.5; %GFM tracking cofficient | ||
gGFM.kj=0.05; %GFM inertia cofficient | ||
gGFM.kd=100; %GFM damping cofficient | ||
gGFMTf=tf([1 gGFM.kt],[gGFM.kj gGFM.kd]); % G-GFM Real power vs Frequency Transfer function | ||
%Converting the Transfer Function Parameters to descrete domain | ||
gGFMTfz=c2d(gGFMTf,Ts/10); | ||
%Reactive Power and Current Limiter Parameters | ||
gGFM.qref=0.01; %GFM reactive power reference | ||
gGFM.kq=0.3; %GFM reactive power droop cofficient | ||
gGFM.vref=1.0; %GFM voltage reference | ||
gGFM.fref=60; %GFM frequency reference | ||
gGFM.Imax=0.4; %Current limit | ||
gGFM.x_vir=3e-1; %Virtual reactance | ||
gGFM.r_vir=5e-2; %Virtual resistance | ||
%% GFM using Dc link voltage control by MSC (M-GFM) | ||
mGFM.d=0.7; %GFM damping cofficient | ||
mGFM.h=0.1; %GFM inertia cofficient | ||
mGFM.kp=0.07; %GFM active power droop cofficient | ||
mGFM.kq=1.95; %GFM reactive power droop cofficient | ||
mGFM.Vd=1.0; %GFM voltage reference | ||
mGFM.fref=60; %GFM frequency reference | ||
mGFM.kpdc=0.3; %DC bus voltage controller proportional gain | ||
mGFM.kidc=0.8; %DC bus voltage controller integral gain 0.2 | ||
mGFM.Imax=0.35; %Current Limit | ||
mGFM.x_vir=0.3; %Virtual reactance | ||
mGFM.r_vir=0.05; %Virtual resistance | ||
|
||
%% Machine Parameters | ||
pmsm.pmax = 50.5e6; % Maximum power [W] | ||
pmsm.ld = 1.6e-4; % Stator d-axis inductance [H] | ||
pmsm.lq = 1.6e-4; % Stator q-axis inductance [H] | ||
pmsm.rs = 8.2e-5; % Stator resistance per phase [Ohm] | ||
pmsm.psim = 9; % Permanent magnet flux linkage [Wb] | ||
pmsm.p = 26; % Number of pole pairs | ||
pmsm.alpha=6000; % pmsm Current controller cofficient | ||
%% Transmission Line Parameters | ||
line.r=0.03; % Resistance in Ohms per Km | ||
line.l=0.6; % Inductance in mH per Km | ||
line.m=0.1; % Mutual inductance in mH per Km | ||
line.cll=1.731e-2;% Capacitance line to line in micr0-farad per Km | ||
line.clg=6.751e-2;% Line to ground capacitance in micro-farad per Km | ||
line.mr=0; % Line mutual resistance in ohms per km | ||
line.length1=100; % Line length in Km | ||
%% Feeder Parameters | ||
feeder.r=0.026; % Feeder resistance in Ohms per Km | ||
feeder.l=2.1e-4; % Feeder inductance in Henry per Km | ||
feeder.length=0.5; % Feeder length in Km | ||
%% Loads | ||
loads.P1=5e6; %Load 1 real power | ||
loads.Q1=1e6; %Load 1 reactive power | ||
loads.P2=1e6; %Load 2 real power | ||
%% Grid Code Settings | ||
%(Following the IEEE 2800 standards) | ||
lvrt.time=[0.32,0.32,0.32,1.2,3,6,inf,inf,1800,1,1,0.015,0.003,0.001,0.0002]; % Trip time vs Volatge (PU) | ||
lvrt.voltage=[0,0.1,0.25,0.5,0.7,0.9,0.91,1.05,1.051,1.11,1.19,1.2,1.4,1.6,1.7]; | ||
%Volatge vs Reactive Current Injection (Following the German Grid Code) | ||
lvrt.iq=[1,1,0.2,0,0]; % Reactive current vs Volatge (PU) | ||
lvrt.voltageiq=[0,.5,.9,.91,1]; | ||
% Frequency Ride Through characteristics: Frequency (Hz) vs Tripping Time (sec) (Following the IEEE 2800 standards) | ||
frt.time=[0.1,299,inf,299,299,0.1,0.1]; | ||
frt.frequency=([-0.2,-0.05,-0.02,0.021,0.03,0.031,0.2]+1)*grid.frequency; | ||
code.vh=1.1; %Voltage upper limit | ||
code.vl=0.9; %Voltage lower limit | ||
code.fh=61.2; %Frequency upper limit | ||
code.fl=58.8; %Frequency lower limit | ||
gridCode="IEEE 2800"; %Default grid code for tests | ||
%% PLL Parameteters | ||
pll.kp=100; %Proportional PLL gain | ||
pll.ki=2000; %Integral PLL gain | ||
WindControl=1; %Choose Grid Model 1 for grid forming G-GFM and 2 for M-GFM control | ||
WindVSMControlDClink=Simulink.Variant(' WindControl == 1 '); | ||
WindVSMControlTurbineInertia =Simulink.Variant(' WindControl == 2 '); | ||
%% Standard Compliance Table | ||
TableIII=readtable('BatteryStoragePVPlantGFMTableComplianceIEEEStd.xlsx','VariableNamingRule', 'preserve'); | ||
TableIII.('Satisfied'){1}= char(hex2dec('2713')); | ||
TableIII.('Satisfied'){2}= char(hex2dec('2713')); | ||
TableIII.('Satisfied'){3}= char(hex2dec('2713')); | ||
TableIII.('Satisfied'){4}= char(hex2dec('2713')); | ||
TableIII.('Satisfied'){5}= char(hex2dec('2713')); | ||
TableIII=table(TableIII,'VariableNames',{'Table: Compliance on Key Criteria mentioned in Standards'}); | ||
%% Initilazation of model with GGFM control as default wind GFM Controller | ||
imGFM=0; %Set flag to 1 for initating the initilization process with MGFM control | ||
%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
function plotHVDC(Data,Tsim) | ||
%UNTITLED2 Summary of this function goes here | ||
PS1 = getsamples(Data.PST1,find(Data.tout==0.2):find(Data.tout==Tsim))/1e6; | ||
PS2 = getsamples(Data.PST2,find(Data.tout==0.2):find(Data.tout==Tsim))/1e6; | ||
PS3 = getsamples(Data.PST3,find(Data.tout==0.2):find(Data.tout==Tsim))/1e6; | ||
PS4 = getsamples(Data.PST4,find(Data.tout==0.2):find(Data.tout==Tsim))/1e6; | ||
PS5 = getsamples(Data.PST5,find(Data.tout==0.2):find(Data.tout==Tsim))/1e6; | ||
PS6 = getsamples(Data.PST6,find(Data.tout==0.2):find(Data.tout==Tsim))/1e6; | ||
V1 = getsamples(Data.Vabc,find(Data.tout==0.2):find(Data.tout==Tsim)); | ||
I1 = getsamples(Data.Iabc,find(Data.tout==0.2):find(Data.tout==Tsim)); | ||
V = getsamples(Data.Vmag,find(Data.tout==0.2):find(Data.tout==Tsim)); | ||
F = getsamples(Data.f,find(Data.tout==0.2):find(Data.tout==Tsim)); | ||
aboveLinev = (V.Data>1.1 | V.Data<0.9); | ||
% Create 2 copies of v | ||
bottomLinev = V.Data; | ||
topLinev = V.Data; | ||
% Set the values you don't want to get drawn to nan | ||
bottomLinev(aboveLinev) = NaN; | ||
topLinev(~aboveLinev) = NaN; | ||
%% | ||
aboveLinef = (F.Data>61.2 | F.Data<58.8); | ||
% Create 2 copies of v | ||
bottomLinef = F.Data; | ||
topLinef = F.Data; | ||
% Set the values you don't want to get drawn to nan | ||
bottomLinef(aboveLinef) = NaN; | ||
topLinef(~aboveLinef) = NaN; | ||
c=figure; | ||
subplot(2,2,1) | ||
plot(PS1) | ||
hold on; | ||
plot(PS2); | ||
plot(PS3); | ||
xlim([0.5 Tsim]) | ||
ylim([0 500]) | ||
ylabel('MW'); | ||
grid on; | ||
legend('P_{Station 1}','P_{Station 2}','P_{Station 3}',Location='best'); | ||
title('Real Power From Onshore Stations') | ||
subplot(2,2,2) | ||
plot(PS4) | ||
hold on; | ||
plot(PS5); | ||
plot(PS6); | ||
xlim([0.5 Tsim]) | ||
ylabel('MW'); | ||
grid on; | ||
legend('P_{Station 4}','P_{Station 5}','P_{Station 6}',Location='best'); | ||
title('Real Power From Offshore Stations') | ||
subplot(2,2,3) | ||
plot(V.Time,bottomLinev,V.time,topLinev); | ||
hold on; | ||
plot(Data.tout,1.1*ones(size(Data.tout)),'--g'); | ||
plot(Data.tout,0.9*ones(size(Data.tout)),'--g'); | ||
xlim([0.5 Tsim]); | ||
xlabel('Time (sec)'); | ||
ylabel('PU'); | ||
grid on; | ||
d=find(V.Data>1.1 | V.Data<0.9); | ||
if(length(d)>0) | ||
lgd=legend('V_{mag}','V_{out of limit}','V_{limits}',Location='best'); | ||
else | ||
lgd=legend('V_{mag}','','V_{limits}',Location='best'); | ||
end | ||
title('Volatge Magnitude at Onshore Station 1') | ||
subplot(2,2,4) | ||
plot(F.Time,bottomLinef,F.time,topLinef); | ||
hold on; | ||
plot(Data.tout,61.2*ones(size(Data.tout)),'--g'); | ||
plot(Data.tout,58.8*ones(size(Data.tout)),'--g'); | ||
xlim([0.5 Tsim]); | ||
xlabel('Time (sec)'); | ||
ylabel('Hz'); | ||
grid on; | ||
df=find(F.Data>61.2 | F.Data<58.8); | ||
if(length(df)>0) | ||
lgd=legend('F','F_{out of limit}','F_{limits}',Location='best'); | ||
else | ||
lgd=legend('F','','F_{limits}',Location='best'); | ||
end | ||
title('Onshore Frequency at POI') | ||
set(c,'position',[0,0,700,400]); | ||
d=figure; | ||
subplot(2,1,1) | ||
plot(V1); | ||
xlim([0.5 Tsim]) | ||
ylim([-2 2]) | ||
ylabel('PU'); | ||
grid on; | ||
title('Volatges at Onshore Station 1') | ||
subplot(2,1,2) | ||
plot(I1); | ||
xlim([0.5 Tsim]) | ||
ylim([-2 2]) | ||
ylabel('PU'); | ||
grid on; | ||
title('Currents at Onshore Station 1') | ||
end |
Oops, something went wrong.