Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
490 changes: 490 additions & 0 deletions +SimplusGT/+Class/DoublyFedInductionGenerator.asv

Large diffs are not rendered by default.

490 changes: 490 additions & 0 deletions +SimplusGT/+Class/DoublyFedInductionGenerator.m

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion +SimplusGT/+Class/ModelAdvance.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
% ### Public properties
% Public can be set to []
properties
Ts = 1e-4; % Sampling period (s)
Ts = 1e-6; % Sampling period (s)
Para = []; % Apparatus parameters
end

Expand Down
429 changes: 429 additions & 0 deletions +SimplusGT/+Class/SynchronousMachineFullOrder.m

Large diffs are not rendered by default.

Binary file added +SimplusGT/+Class/mymodel_v1.slx.autosave
Binary file not shown.
8 changes: 8 additions & 0 deletions +SimplusGT/+Simulink/SimAddApparatus.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
Name_Apparatus{i} = ['VSI-Droop' num2str(Bus)];
FullName_Apparatus{i} = [Name_Model '/' Name_Apparatus{i}];
add_block([Name_LibFile '/Grid-Forming Voltage-Source Inverter (dq-Frame System Object)'],FullName_Apparatus{i});
case 003
Name_Apparatus{i} = ['SM-Detailed' num2str(Bus)];
FullName_Apparatus{i} = [Name_Model '/' Name_Apparatus{i}];
add_block([Name_LibFile '/Synchronous Machine Full Order (dq-Frame System Object)'],FullName_Apparatus{i});
case 006
Name_Apparatus{i} = ['DFIG' num2str(Bus)];
FullName_Apparatus{i} = [Name_Model '/' Name_Apparatus{i}];
add_block([Name_LibFile '/Doubly-fed Induction Generator (dq-Frame System Object)'],FullName_Apparatus{i});
case 009
Name_Apparatus{i} = ['Inf-Bus' num2str(Bus)];
FullName_Apparatus{i} = [Name_Model '/' Name_Apparatus{i}];
Expand Down
Binary file added +SimplusGT/+Simulink/mymodel_v1.slx.autosave
Binary file not shown.
67 changes: 59 additions & 8 deletions +SimplusGT/+Toolbox/ApparatusModelCreate.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@
% =======================================
% ### Synchronous generator
case 0 % Type 0-9
Apparatus = SimplusGT.Class.SynchronousMachine('ApparatusType',Type);
Apparatus.Para = [ Para.J;
Para.D;
Para.wL;
Para.R;
Para.w0]; % (5)

if Type ~= 6
Apparatus = SimplusGT.Class.SynchronousMachine('ApparatusType',Type);
Apparatus.Para = [ Para.J;
Para.D;
Para.wL;
Para.R;
Para.w0]; % (5)
end

% ### Grid-following inverter
case 1 % Type 10-19
Expand Down Expand Up @@ -80,6 +83,51 @@
Para.fvdq;
Para.fidq;
Para.w0];

% ### Detailed synchronous generator
case 3 % Type 30-39
Apparatus = SimplusGT.Class.SynchronousMachineFullOrder('ApparatusType',Type);
Apparatus.Para = [Para.x_d;
Para.x_dd; % X_dd represents Xd'
Para.x_ddd;
Para.x_q;
Para.x_qd; % X_qd represents Xq'
Para.x_qdd;
Para.x_l; % or x_2, x_ls in some practical cases
Para.R_a;

Para.T_dd; % T_dd represents Td'
Para.T_ddd;
Para.T_qd;
Para.T_qdd;

Para.H; % Inertial constant

Para.SaturationA;
Para.SaturationB;
Para.SaturationN;

Para.D; % Damp constant
Para.SpeedPara; % simplified governor parameters
Para.K_A; % exciter parameters

Para.EnableSaturation; % Saturation setting
Para.wb;
]; % (21 parameters)

% ### Doubly-fed Induction Generator
case 6 % Type 60-69
Apparatus = SimplusGT.Class.DoublyFedInductionGenerator('ApparatusType',Type);
Apparatus.Para = [Para.f; % Default frequency (Hz)
Para.Sbase; % Rated Capacity
Para.Vbase; % Rated Voltage
Para.Vdc_ref; % Voltage of the DC Capacitor
Para.Igq_ref; % The Q from the GSC
Para.rPLLp; % p in the RSC PLL
Para.rPLLi; % I in the RSC PLL
Para.gPLLp;
Para.gPLLi;
]; % (9)

% ### Ac infinite bus
case 9
Expand Down Expand Up @@ -142,8 +190,8 @@

%% Calculate the linearized state space model
Apparatus.ApparatusType = Type; % Apparatus type
Apparatus.Ts = Ts; % Samping period
Apparatus.PowerFlow = PowerFlow; % Power flow data
Apparatus.Ts = Ts; % Samping period
Apparatus.PowerFlow = PowerFlow; % Power flow data
Apparatus.SetString(Apparatus); % Set strings automatically
Apparatus.SetEquilibrium(Apparatus); % Calculate the equilibrium
[x_e,u_e,y_e,xi] = Apparatus.GetEquilibrium(Apparatus); % Get the equilibrium
Expand Down Expand Up @@ -215,6 +263,9 @@
% No need for frame dynamics embedding
elseif (Type>=1000 && Type<2000)
% No need for frame dynamics embedding
elseif (Type == 60)
% For DFIG with RSC and GSC, global dynamic is chosen.

else

%% Frame transformation: local swing frame dq -> local steady frame d'q'
Expand Down
2 changes: 1 addition & 1 deletion +SimplusGT/+Toolbox/BusTypeVIF.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
ibus = [];
fbus = [];
for i = 1:length(ApparatusType)
if ((ApparatusType{i} >= 0) && (ApparatusType{i} <= 9)) || (ApparatusType{i} == 90) || ((ApparatusType{i} >= 20) && (ApparatusType{i} <= 29))
if ((ApparatusType{i} >= 0) && (ApparatusType{i} <= 9)) || (ApparatusType{i} == 30) || (ApparatusType{i} == 60) || (ApparatusType{i} == 90) || ((ApparatusType{i} >= 20) && (ApparatusType{i} <= 29))
vbus(l) = i;
l = l+1;
elseif ((ApparatusType{i} >= 10) && (ApparatusType{i} <= 19))
Expand Down
90 changes: 45 additions & 45 deletions +SimplusGT/+Toolbox/Main.m
Original file line number Diff line number Diff line change
Expand Up @@ -289,32 +289,32 @@
%
% Only support ac system analysis at this stage.
%
fprintf('\n')
fprintf('==================================\n')
fprintf('Grid Strength Analysis\n')
fprintf('==================================\n')
if isempty(FlagDcArea)
fprintf('Plot grid strength.\n')
FigN = 300;
PlotGridStrength(ApparatusType,ListLineNew,FigN);
else
fprintf('Warning: The plot of grid strength is disabled.\n')
end
% fprintf('\n')
% fprintf('==================================\n')
% fprintf('Grid Strength Analysis\n')
% fprintf('==================================\n')
% if isempty(FlagDcArea)
% fprintf('Plot grid strength.\n')
% FigN = 300;
% PlotGridStrength(ApparatusType,ListLineNew,FigN);
% else
% fprintf('Warning: The plot of grid strength is disabled.\n')
% end

%%
% ==================================================
% Synchronization analysis
% ==================================================
fprintf('\n')
fprintf('==================================\n')
fprintf('Synchronization Analysis\n')
fprintf('==================================\n')
EnableSynchronisationAnalysis = 0;
if EnableSynchronisationAnalysis
SimplusGT.Synchron.MainSynchron();
else
fprintf('Warning: The synchronisation analysis is disabled.\n')
end
% fprintf('\n')
% fprintf('==================================\n')
% fprintf('Synchronization Analysis\n')
% fprintf('==================================\n')
% EnableSynchronisationAnalysis = 0;
% if EnableSynchronisationAnalysis
% SimplusGT.Synchron.MainSynchron();
% else
% fprintf('Warning: The synchronisation analysis is disabled.\n')
% end

%%
% ==================================================
Expand Down Expand Up @@ -445,28 +445,28 @@ function PlotAdmittanceSpectrum(NumBus,ApparatusBus,ApparatusType,GsysSs,PortBus
%
% Author(s): Yitong Li

function PlotGridStrength(ApparatusType,ListLine,FigN)

figure(FigN);

[Ydiag,Ybus] = SimplusGT.Toolbox.BusStrength(ApparatusType,ListLine);
[~,~,GraphFigure] = SimplusGT.Toolbox.PlotLayoutGraph(Ybus);
[vbus,ibus,fbus] = SimplusGT.Toolbox.BusTypeVIF(ApparatusType);

highlight(GraphFigure,vbus,'NodeColor','green');
highlight(GraphFigure,ibus,'NodeColor','red');
highlight(GraphFigure,fbus,'NodeColor',[0.7,0.7,0.7]); % gray

x = GraphFigure.XData';
y = GraphFigure.YData';
z = log10(abs(Ydiag))';

SimplusGT.Toolbox.PlotHeatMap(x,y,z);
uistack(GraphFigure,'top');

h = colorbar;
h.Label.String = "log_{10}(Bus Admittance)";

title('Grid Strength')
% function PlotGridStrength(ApparatusType,ListLine,FigN)
%
% figure(FigN);
%
% [Ydiag,Ybus] = SimplusGT.Toolbox.BusStrength(ApparatusType,ListLine);
% [~,~,GraphFigure] = SimplusGT.Toolbox.PlotLayoutGraph(Ybus);
% [vbus,ibus,fbus] = SimplusGT.Toolbox.BusTypeVIF(ApparatusType);

end
% highlight(GraphFigure,vbus,'NodeColor','green');
% highlight(GraphFigure,ibus,'NodeColor','red');
% highlight(GraphFigure,fbus,'NodeColor',[0.7,0.7,0.7]); % gray
%
% x = GraphFigure.XData';
% y = GraphFigure.YData';
% z = log10(abs(Ydiag))';
%
% SimplusGT.Toolbox.PlotHeatMap(x,y,z);
% uistack(GraphFigure,'top');
%
% h = colorbar;
% h.Label.String = "log_{10}(Bus Admittance)";
%
% title('Grid Strength')
%
% end
50 changes: 48 additions & 2 deletions +SimplusGT/+Toolbox/RearrangeListApparatus.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
end

% Error check
if (ColumnMax_Apparatus>12)
if (ColumnMax_Apparatus>25)
error(['Error: Apparatus data overflow.']);
end

Expand Down Expand Up @@ -158,6 +158,50 @@
Para0020.fidq =600; % current control bandwidth
Para0020.w0 = W0;

% ======================================
% Detailed Synchronous generator
% ======================================
Para0030.x_d = 1.50;
Para0030.x_dd = 0.50; % X_dd represents Xd'
Para0030.x_ddd = 0.32;
Para0030.x_q = 1.00;
Para0030.x_qd = 1.00; % X_qd represents Xq'
Para0030.x_qdd = 0.45;
Para0030.x_l = 0.20; % or x_2, x_ls in some practical cases
Para0030.R_a = 0.02;

Para0030.T_dd = 9.00; % T_dd represents Td'
Para0030.T_ddd = 0.05;
Para0030.T_qd = 2.00;
Para0030.T_qdd = 0.09;

Para0030.H = 2.1028; % Inertial constant

Para0030.SaturationA = 1;
Para0030.SaturationB = 0.1030;
Para0030.SaturationN = 10.6599;

Para0030.D = 0.02056; % Damp constant
Para0030.SpeedPara = 200; % simplified governor parameters
Para0030.K_A = 20; % exciter parameters

Para0030.EnableSaturation = 0; % Saturation setting
Para0030.wb = W0;

% ======================================
% Doubly-fed Induction Generator
% ======================================

Para0060.f = 60; % Default frequency (Hz)
Para0060.Sbase = 2e6; % Rated Capacity
Para0060.Vbase = 690; % Rated Voltage
Para0060.Vdc_ref = 1200; % Voltage of the DC Capacitor
Para0060.Igq_ref = 0; % The Q from the GSC
Para0060.rPLLp = 800; % p in the RSC PLL
Para0060.rPLLi = 16000; % i in the RSC PLL
Para0060.gPLLp = 800;
Para0060.gPLLi = 16000;

% ======================================
% Ac infinite bus (short-circuit in small-signal)
% ======================================
Expand Down Expand Up @@ -224,7 +268,9 @@
case 2
ParaCell{i} = Para0020; % Grid-forming inverter
case 3
% Yue's Full-Order Machine
ParaCell{i} = Para0030; % Detailed synchronous machine
case 6
ParaCell{i} = Para0060; % Doubly-fed induction generator
case 9
ParaCell{i} = Para0090; % Ac inifnite bus
case 10
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/Library/SimplexPS.slx
/Library/SimplusPS.slx
/Library/SimplusGT.slx
/Library/SimplusGT.slx
/slprj
/+SimplusGT/+Simulink/slprj
/+SimplusGT/+Class/slprj
/Examples/AcPowerSystem/SingleApparatusInfiniteBus/slprj
/Examples/AcPowerSystem/IEEE_14Bus/slprj
/Library/slprj
Binary file added Examples/AcPowerSystem/IEEE_14Bus/precious.slxc
Binary file not shown.
Loading