diff --git a/R2015a/2-Level/L-Filter/LoadFlow_VSC.m b/R2015a/2-Level/L-Filter/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2015a/2-Level/L-Filter/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2015a/2-Level/L-Filter/LoadFlow_VSC_v2.m b/R2015a/2-Level/L-Filter/LoadFlow_VSC_v2.m deleted file mode 100644 index 27137a1..0000000 --- a/R2015a/2-Level/L-Filter/LoadFlow_VSC_v2.m +++ /dev/null @@ -1,65 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - %set_param(VSC_idx{i}, 'LinkStatus', 'inactive'); - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); - %set_param(VSC_idx{i}, 'LinkStatus', 'restore'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2015a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx b/R2015a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx index 0a12c5e..0c33044 100644 Binary files a/R2015a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx and b/R2015a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx differ diff --git a/R2015a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx b/R2015a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx deleted file mode 100644 index d4a413c..0000000 Binary files a/R2015a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx and /dev/null differ diff --git a/R2015a/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx b/R2015a/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx index 5c93129..bb7c80b 100644 Binary files a/R2015a/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx and b/R2015a/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx differ diff --git a/R2015a/2-Level/LCL-filter/LoadFlow_VSC.m b/R2015a/2-Level/LCL-filter/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2015a/2-Level/LCL-filter/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2015a/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx b/R2015a/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx index 7903547..d73e244 100644 Binary files a/R2015a/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx and b/R2015a/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx differ diff --git a/R2015a/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx b/R2015a/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx index 0c79002..7800dae 100644 Binary files a/R2015a/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx and b/R2015a/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx differ diff --git a/R2015a/2-Level/examples/29bus/GFo_29bus.slx b/R2015a/2-Level/examples/29bus/GFo_29bus.slx index 07e935b..ad78a34 100644 Binary files a/R2015a/2-Level/examples/29bus/GFo_29bus.slx and b/R2015a/2-Level/examples/29bus/GFo_29bus.slx differ diff --git a/R2015a/2-Level/examples/29bus/LoadFlow_VSC.m b/R2015a/2-Level/examples/29bus/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2015a/2-Level/examples/29bus/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2015a/2-Level/examples/5bus/GFo_5bus.slx b/R2015a/2-Level/examples/5bus/GFo_5bus.slx index ca61b86..90cca9e 100644 Binary files a/R2015a/2-Level/examples/5bus/GFo_5bus.slx and b/R2015a/2-Level/examples/5bus/GFo_5bus.slx differ diff --git a/R2015a/2-Level/examples/5bus/LoadFlow_VSC.m b/R2015a/2-Level/examples/5bus/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2015a/2-Level/examples/5bus/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2015a/2-Level/examples/WSCC/WSCC.slx b/R2015a/2-Level/examples/WSCC/WSCC.slx index 8c44a79..7092abc 100644 Binary files a/R2015a/2-Level/examples/WSCC/WSCC.slx and b/R2015a/2-Level/examples/WSCC/WSCC.slx differ diff --git a/R2015a/Library/GFo_Lib.slx b/R2015a/Library/GFo_Lib.slx index 22d1692..59240d7 100644 Binary files a/R2015a/Library/GFo_Lib.slx and b/R2015a/Library/GFo_Lib.slx differ diff --git a/R2015a/Library/VSC_Lib.slx b/R2015a/Library/VSC_Lib.slx index f9c4cad..dbaf3c2 100644 Binary files a/R2015a/Library/VSC_Lib.slx and b/R2015a/Library/VSC_Lib.slx differ diff --git a/R2015b/2-Level/L-Filter/LoadFlow_VSC.m b/R2015b/2-Level/L-Filter/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2015b/2-Level/L-Filter/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2015b/2-Level/L-Filter/LoadFlow_VSC_v2.m b/R2015b/2-Level/L-Filter/LoadFlow_VSC_v2.m deleted file mode 100644 index 27137a1..0000000 --- a/R2015b/2-Level/L-Filter/LoadFlow_VSC_v2.m +++ /dev/null @@ -1,65 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - %set_param(VSC_idx{i}, 'LinkStatus', 'inactive'); - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); - %set_param(VSC_idx{i}, 'LinkStatus', 'restore'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2015b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx b/R2015b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx index 1ae7ede..1cff8b4 100644 Binary files a/R2015b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx and b/R2015b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx differ diff --git a/R2015b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx b/R2015b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx deleted file mode 100644 index cd24e9b..0000000 Binary files a/R2015b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx and /dev/null differ diff --git a/R2015b/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx b/R2015b/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx index 417740d..d7ad512 100644 Binary files a/R2015b/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx and b/R2015b/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx differ diff --git a/R2015b/2-Level/LCL-filter/LoadFlow_VSC.m b/R2015b/2-Level/LCL-filter/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2015b/2-Level/LCL-filter/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2015b/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx b/R2015b/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx index daf8ee3..058db59 100644 Binary files a/R2015b/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx and b/R2015b/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx differ diff --git a/R2015b/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx b/R2015b/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx index 86a9a7a..55cc6ee 100644 Binary files a/R2015b/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx and b/R2015b/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx differ diff --git a/R2015b/2-Level/examples/29bus/GFo_29bus.slx b/R2015b/2-Level/examples/29bus/GFo_29bus.slx index b37e4ef..adb317b 100644 Binary files a/R2015b/2-Level/examples/29bus/GFo_29bus.slx and b/R2015b/2-Level/examples/29bus/GFo_29bus.slx differ diff --git a/R2015b/2-Level/examples/29bus/LoadFlow_VSC.m b/R2015b/2-Level/examples/29bus/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2015b/2-Level/examples/29bus/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2015b/2-Level/examples/5bus/GFo_5bus.slx b/R2015b/2-Level/examples/5bus/GFo_5bus.slx index ffe1949..1119062 100644 Binary files a/R2015b/2-Level/examples/5bus/GFo_5bus.slx and b/R2015b/2-Level/examples/5bus/GFo_5bus.slx differ diff --git a/R2015b/2-Level/examples/5bus/LoadFlow_VSC.m b/R2015b/2-Level/examples/5bus/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2015b/2-Level/examples/5bus/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2015b/2-Level/examples/WSCC/WSCC.slx b/R2015b/2-Level/examples/WSCC/WSCC.slx index c60e557..902d44c 100644 Binary files a/R2015b/2-Level/examples/WSCC/WSCC.slx and b/R2015b/2-Level/examples/WSCC/WSCC.slx differ diff --git a/R2015b/Library/GFo_Lib.slx b/R2015b/Library/GFo_Lib.slx index fe43193..f14fd2f 100644 Binary files a/R2015b/Library/GFo_Lib.slx and b/R2015b/Library/GFo_Lib.slx differ diff --git a/R2015b/Library/VSC_Lib.slx b/R2015b/Library/VSC_Lib.slx index f1ee85c..3c9fbcf 100644 Binary files a/R2015b/Library/VSC_Lib.slx and b/R2015b/Library/VSC_Lib.slx differ diff --git a/R2016a/2-Level/L-Filter/LoadFlow_VSC.m b/R2016a/2-Level/L-Filter/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2016a/2-Level/L-Filter/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2016a/2-Level/L-Filter/LoadFlow_VSC_v2.m b/R2016a/2-Level/L-Filter/LoadFlow_VSC_v2.m deleted file mode 100644 index 27137a1..0000000 --- a/R2016a/2-Level/L-Filter/LoadFlow_VSC_v2.m +++ /dev/null @@ -1,65 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - %set_param(VSC_idx{i}, 'LinkStatus', 'inactive'); - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); - %set_param(VSC_idx{i}, 'LinkStatus', 'restore'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2016a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx b/R2016a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx index 287ab56..24a1eed 100644 Binary files a/R2016a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx and b/R2016a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx differ diff --git a/R2016a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx b/R2016a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx deleted file mode 100644 index 99c74a1..0000000 Binary files a/R2016a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx and /dev/null differ diff --git a/R2016a/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx b/R2016a/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx index 9c220bc..25eda36 100644 Binary files a/R2016a/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx and b/R2016a/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx differ diff --git a/R2016a/2-Level/LCL-filter/LoadFlow_VSC.m b/R2016a/2-Level/LCL-filter/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2016a/2-Level/LCL-filter/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2016a/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx b/R2016a/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx index b3b7a51..0ddec55 100644 Binary files a/R2016a/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx and b/R2016a/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx differ diff --git a/R2016a/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx b/R2016a/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx index bc1cb7b..91d82a4 100644 Binary files a/R2016a/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx and b/R2016a/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx differ diff --git a/R2016a/2-Level/examples/29bus/GFo_29bus.slx b/R2016a/2-Level/examples/29bus/GFo_29bus.slx index adf7b3f..b795bc4 100644 Binary files a/R2016a/2-Level/examples/29bus/GFo_29bus.slx and b/R2016a/2-Level/examples/29bus/GFo_29bus.slx differ diff --git a/R2016a/2-Level/examples/29bus/LoadFlow_VSC.m b/R2016a/2-Level/examples/29bus/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2016a/2-Level/examples/29bus/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2016a/2-Level/examples/5bus/GFo_5bus.slx b/R2016a/2-Level/examples/5bus/GFo_5bus.slx index 57cec62..cf95a60 100644 Binary files a/R2016a/2-Level/examples/5bus/GFo_5bus.slx and b/R2016a/2-Level/examples/5bus/GFo_5bus.slx differ diff --git a/R2016a/2-Level/examples/5bus/LoadFlow_VSC.m b/R2016a/2-Level/examples/5bus/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2016a/2-Level/examples/5bus/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2016a/2-Level/examples/WSCC/WSCC.slx b/R2016a/2-Level/examples/WSCC/WSCC.slx index a9ceba9..b5b5173 100644 Binary files a/R2016a/2-Level/examples/WSCC/WSCC.slx and b/R2016a/2-Level/examples/WSCC/WSCC.slx differ diff --git a/R2016a/Library/GFo_Lib.slx b/R2016a/Library/GFo_Lib.slx index d63757b..b86163d 100644 Binary files a/R2016a/Library/GFo_Lib.slx and b/R2016a/Library/GFo_Lib.slx differ diff --git a/R2016a/Library/VSC_Lib.slx b/R2016a/Library/VSC_Lib.slx index 3c907d3..1ef4dba 100644 Binary files a/R2016a/Library/VSC_Lib.slx and b/R2016a/Library/VSC_Lib.slx differ diff --git a/R2016b/2-Level/L-Filter/LoadFlow_VSC.m b/R2016b/2-Level/L-Filter/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2016b/2-Level/L-Filter/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2016b/2-Level/L-Filter/LoadFlow_VSC_v2.m b/R2016b/2-Level/L-Filter/LoadFlow_VSC_v2.m deleted file mode 100644 index 27137a1..0000000 --- a/R2016b/2-Level/L-Filter/LoadFlow_VSC_v2.m +++ /dev/null @@ -1,65 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - %set_param(VSC_idx{i}, 'LinkStatus', 'inactive'); - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); - %set_param(VSC_idx{i}, 'LinkStatus', 'restore'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2016b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx b/R2016b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx index 4f311fb..56cd4c2 100644 Binary files a/R2016b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx and b/R2016b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx differ diff --git a/R2016b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx b/R2016b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx deleted file mode 100644 index a40e2fe..0000000 Binary files a/R2016b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx and /dev/null differ diff --git a/R2016b/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx b/R2016b/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx index 5f25f1c..1f3189f 100644 Binary files a/R2016b/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx and b/R2016b/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx differ diff --git a/R2016b/2-Level/LCL-filter/LoadFlow_VSC.m b/R2016b/2-Level/LCL-filter/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2016b/2-Level/LCL-filter/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2016b/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx b/R2016b/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx index 6797be3..44ec725 100644 Binary files a/R2016b/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx and b/R2016b/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx differ diff --git a/R2016b/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx b/R2016b/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx index 825eda4..2cc8c77 100644 Binary files a/R2016b/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx and b/R2016b/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx differ diff --git a/R2016b/2-Level/examples/29bus/GFo_29bus.slx b/R2016b/2-Level/examples/29bus/GFo_29bus.slx index e29a472..c66fdeb 100644 Binary files a/R2016b/2-Level/examples/29bus/GFo_29bus.slx and b/R2016b/2-Level/examples/29bus/GFo_29bus.slx differ diff --git a/R2016b/2-Level/examples/29bus/LoadFlow_VSC.m b/R2016b/2-Level/examples/29bus/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2016b/2-Level/examples/29bus/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2016b/2-Level/examples/5bus/GFo_5bus.slx b/R2016b/2-Level/examples/5bus/GFo_5bus.slx index ab8a133..628da23 100644 Binary files a/R2016b/2-Level/examples/5bus/GFo_5bus.slx and b/R2016b/2-Level/examples/5bus/GFo_5bus.slx differ diff --git a/R2016b/2-Level/examples/5bus/LoadFlow_VSC.m b/R2016b/2-Level/examples/5bus/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2016b/2-Level/examples/5bus/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2016b/2-Level/examples/WSCC/WSCC.slx b/R2016b/2-Level/examples/WSCC/WSCC.slx index b9a67d7..8d65be3 100644 Binary files a/R2016b/2-Level/examples/WSCC/WSCC.slx and b/R2016b/2-Level/examples/WSCC/WSCC.slx differ diff --git a/R2016b/Library/GFo_Lib.slx b/R2016b/Library/GFo_Lib.slx index 2abd4f2..0fce635 100644 Binary files a/R2016b/Library/GFo_Lib.slx and b/R2016b/Library/GFo_Lib.slx differ diff --git a/R2016b/Library/VSC_Lib.slx b/R2016b/Library/VSC_Lib.slx index 12e266d..d95d16a 100644 Binary files a/R2016b/Library/VSC_Lib.slx and b/R2016b/Library/VSC_Lib.slx differ diff --git a/R2017a/2-Level/L-Filter/LoadFlow_VSC.m b/R2017a/2-Level/L-Filter/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2017a/2-Level/L-Filter/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2017a/2-Level/L-Filter/LoadFlow_VSC_v2.m b/R2017a/2-Level/L-Filter/LoadFlow_VSC_v2.m deleted file mode 100644 index 27137a1..0000000 --- a/R2017a/2-Level/L-Filter/LoadFlow_VSC_v2.m +++ /dev/null @@ -1,65 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - %set_param(VSC_idx{i}, 'LinkStatus', 'inactive'); - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); - %set_param(VSC_idx{i}, 'LinkStatus', 'restore'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2017a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx b/R2017a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx index 2882e7e..1802a8e 100644 Binary files a/R2017a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx and b/R2017a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency.slx differ diff --git a/R2017a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx b/R2017a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx deleted file mode 100644 index fbc7395..0000000 Binary files a/R2017a/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx and /dev/null differ diff --git a/R2017a/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx b/R2017a/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx index d9460f7..7580f93 100644 Binary files a/R2017a/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx and b/R2017a/2-Level/L-Filter/VSC_GFo_Variable_Frequency.slx differ diff --git a/R2017a/2-Level/LCL-filter/LoadFlow_VSC.m b/R2017a/2-Level/LCL-filter/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2017a/2-Level/LCL-filter/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2017a/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx b/R2017a/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx index da86954..8289126 100644 Binary files a/R2017a/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx and b/R2017a/2-Level/LCL-filter/VSC_GFo_Fixed_Frequency_LCL.slx differ diff --git a/R2017a/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx b/R2017a/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx index d5f3fbc..6c1ff8d 100644 Binary files a/R2017a/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx and b/R2017a/2-Level/LCL-filter/VSC_GFo_Variable_Frequency_LCL.slx differ diff --git a/R2017a/2-Level/examples/29bus/GFo_29bus.slx b/R2017a/2-Level/examples/29bus/GFo_29bus.slx index 738c351..513824b 100644 Binary files a/R2017a/2-Level/examples/29bus/GFo_29bus.slx and b/R2017a/2-Level/examples/29bus/GFo_29bus.slx differ diff --git a/R2017a/2-Level/examples/29bus/LoadFlow_VSC.m b/R2017a/2-Level/examples/29bus/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2017a/2-Level/examples/29bus/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2017a/2-Level/examples/5bus/GFo_5bus.slx b/R2017a/2-Level/examples/5bus/GFo_5bus.slx index b366dd5..aa83154 100644 Binary files a/R2017a/2-Level/examples/5bus/GFo_5bus.slx and b/R2017a/2-Level/examples/5bus/GFo_5bus.slx differ diff --git a/R2017a/2-Level/examples/5bus/LoadFlow_VSC.m b/R2017a/2-Level/examples/5bus/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2017a/2-Level/examples/5bus/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2017a/2-Level/examples/WSCC/WSCC.slx b/R2017a/2-Level/examples/WSCC/WSCC.slx index e2a6d29..a3e01ac 100644 Binary files a/R2017a/2-Level/examples/WSCC/WSCC.slx and b/R2017a/2-Level/examples/WSCC/WSCC.slx differ diff --git a/R2017a/Library/GFo_Lib.slx b/R2017a/Library/GFo_Lib.slx index 58932b6..45afae6 100644 Binary files a/R2017a/Library/GFo_Lib.slx and b/R2017a/Library/GFo_Lib.slx differ diff --git a/R2017a/Library/VSC_Lib.slx b/R2017a/Library/VSC_Lib.slx index 94d9256..c9d064d 100644 Binary files a/R2017a/Library/VSC_Lib.slx and b/R2017a/Library/VSC_Lib.slx differ diff --git a/R2017b/2-Level/L-Filter/LoadFlow_VSC.m b/R2017b/2-Level/L-Filter/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2017b/2-Level/L-Filter/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2017b/2-Level/L-Filter/LoadFlow_VSC_v2.m b/R2017b/2-Level/L-Filter/LoadFlow_VSC_v2.m deleted file mode 100644 index 27137a1..0000000 --- a/R2017b/2-Level/L-Filter/LoadFlow_VSC_v2.m +++ /dev/null @@ -1,65 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - %set_param(VSC_idx{i}, 'LinkStatus', 'inactive'); - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); - %set_param(VSC_idx{i}, 'LinkStatus', 'restore'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2017b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx b/R2017b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx deleted file mode 100644 index 7c40b11..0000000 Binary files a/R2017b/2-Level/L-Filter/VSC_GFo_Fixed_Frequency_variable.slx and /dev/null differ diff --git a/R2017b/2-Level/LCL-filter/LoadFlow_VSC.m b/R2017b/2-Level/LCL-filter/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2017b/2-Level/LCL-filter/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2017b/2-Level/examples/29bus/LoadFlow_VSC.m b/R2017b/2-Level/examples/29bus/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2017b/2-Level/examples/29bus/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file diff --git a/R2017b/2-Level/examples/5bus/LoadFlow_VSC.m b/R2017b/2-Level/examples/5bus/LoadFlow_VSC.m deleted file mode 100644 index 363a0c3..0000000 --- a/R2017b/2-Level/examples/5bus/LoadFlow_VSC.m +++ /dev/null @@ -1,63 +0,0 @@ -%% Search all VSC block by looking for the MaskType -model2update = bdroot; -VSC_idx = find_system(model2update,'MaskType','VSC'); - -%% Search All Voltage Source with Inertia by looking for the Masktype -Inertia_idx = find_system(model2update,'MaskType','Inertial_Voltage_source'); - -%% Enable All Fake Voltage Source for LF computation and reset the parameters of voltage sources blocks -for i=1:length(VSC_idx) - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','off','Frequency','fb','PhaseAngle','0','Voltage','Un2'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','on'); - set_param([VSC_idx{i} '/Mean_model/Three-Phase Source'],'Voltage','Vvsc0*Un1','PhaseAngle','Theta_vsc0','Frequency','fb'); -end - -for i=1:length(Inertia_idx) - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','off'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','on'); -end - -%% Compute Loadflow -LF = power_loadflow('-v2',model2update,'solve'); - -Pb_LF = LF.basePower; - -%% Update all VSC with a Masktype equal to 'VSC' -for i=1:length(VSC_idx) - block_name = get_param(VSC_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(VSC_idx{i},'Sn')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(VSC_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC),'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([VSC_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([VSC_idx{i} '/Output_Transformer'],'Commented','off'); - set_param([VSC_idx{i} '/Mean_model'],'Commented','off'); -end - -%% Disable All fake voltage source in Voltage Source with Inertia blocks -for i=1:length(Inertia_idx) - block_name = get_param(Inertia_idx{i},'Name'); - test=find(strcmp({LF.bus.ID},block_name)); - Pb_VSC = eval(get_param(Inertia_idx{i},'Sc')); - - if (isempty(test)==0) - %set_param(VSC_idx{i},'V_mag_0',num2str(LF.bus(test).vbase * abs(LF.bus(test).Vbus) / sqrt(3)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - %set_param(VSC_idx{i},'V0',num2str(abs(LF.bus(test).Vbus)),'Theta0',num2str(angle(LF.bus(test).Vbus) * 180/pi)); - set_param(Inertia_idx{i},'P0',num2str(real(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); %,'Q0',num2str(imag(LF.bus(test).Sbus)*Pb_LF/Pb_VSC)); - - %p.setParameters('V_mag_0') = LF.bus(test).vbase * LF.bus(test).vref / sqrt(3); - %p.setParameters('Theta0') = LF.bus(test).angle; - end - - set_param([Inertia_idx{i} '/Source_For_LF'],'Commented','on'); - set_param([Inertia_idx{i} '/Mean_model'],'Commented','off'); -end \ No newline at end of file