-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from HevertonLemos/adp
Adp
- Loading branch information
Showing
12 changed files
with
282 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% | ||
% Generate 1ph PMU reference to frequency test steady state. | ||
% | ||
% Usage: | ||
% | ||
% magnitude = Reference phasor magnitude; | ||
% initial_frequency = Initial frequency in the test (Hz); | ||
% delta_frequency = The increase/decrease of frequency in Hz for each step; | ||
% number_of_steps = The total amount of frequency steps; | ||
% time_per_step = The time, in seconds, per step; | ||
% frames_per_second = Reference Fps (frames per second); | ||
% initial_angle = Refenrece initial angle; | ||
% | ||
% Return | ||
% phasor: Struct of the PMU reference to frequency steady state. | ||
% | ||
% Heverton de Lemos 24/10/2017 | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
function phasor = pmu_reference_1ph_freq_delta_freq(magnitude, | ||
initial_frequency, | ||
delta_frequency, | ||
number_of_steps, | ||
time_per_step, | ||
frames_per_second, | ||
initial_angle) | ||
Va = []; | ||
freq = []; | ||
rocof = []; | ||
% implement check of all input values; | ||
lenght_frame_step = ceil(frames_per_second * time_per_step); | ||
for i=1:number_of_steps | ||
instantaneous_frequency = initial_frequency + (i - 1) * delta_frequency; | ||
tmp_Va = ss_generic(magnitude, | ||
initial_angle, | ||
instantaneous_frequency, | ||
frames_per_second, | ||
lenght_frame_step); | ||
|
||
Va = [Va tmp_Va]; | ||
freq = [freq ones(1, lenght_frame_step) * instantaneous_frequency]; | ||
rocof = [rocof zeros(1, lenght_frame_step)]; | ||
endfor | ||
|
||
phasor = struct(); | ||
phasor.("VA") = Va; | ||
phasor.("frequency") = freq; | ||
phasor.("rocof") = rocof; | ||
return; | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
clc | ||
clear all | ||
|
||
source("../start_lib.m"); | ||
|
||
start_lib("../"); | ||
|
||
voltage_magnitude = 115; | ||
current_magnitude = 5; | ||
Initial_frequency = 45; | ||
delta_frequency = 1; | ||
time_per_step = 2; % two seconds | ||
number_of_steps = 11; | ||
initial_angle = 0; | ||
frames_per_second = 50; | ||
time = linspace(0, number_of_steps * time_per_step, | ||
frames_per_second * number_of_steps * time_per_step); | ||
phasor = struct(); | ||
tmp_phasor = pmu_reference_1ph_freq_delta_freq(voltage_magnitude, | ||
Initial_frequency, | ||
delta_frequency, | ||
number_of_steps, | ||
time_per_step, | ||
frames_per_second, | ||
initial_angle); | ||
phasor.VA = tmp_phasor.VA; | ||
phasor.frequency = tmp_phasor.frequency; | ||
phasor.rocof = tmp_phasor.rocof; | ||
tmp_phasor = pmu_reference_1ph_freq_delta_freq(voltage_magnitude, | ||
Initial_frequency, | ||
delta_frequency, | ||
number_of_steps, | ||
time_per_step, | ||
frames_per_second, | ||
initial_angle + 120); | ||
phasor.VB = tmp_phasor.VA; | ||
tmp_phasor = pmu_reference_1ph_freq_delta_freq(voltage_magnitude, | ||
Initial_frequency, | ||
delta_frequency, | ||
number_of_steps, | ||
time_per_step, | ||
frames_per_second, | ||
initial_angle - 120); | ||
|
||
phasor.VC = tmp_phasor.VA; | ||
tmp_phasor = pmu_reference_1ph_freq_delta_freq(current_magnitude, | ||
Initial_frequency, | ||
delta_frequency, | ||
number_of_steps, | ||
time_per_step, | ||
frames_per_second, | ||
initial_angle); | ||
phasor.IA = tmp_phasor.VA; | ||
tmp_phasor = pmu_reference_1ph_freq_delta_freq(current_magnitude, | ||
Initial_frequency, | ||
delta_frequency, | ||
number_of_steps, | ||
time_per_step, | ||
frames_per_second, | ||
initial_angle + 120); | ||
phasor.IB = tmp_phasor.VA; | ||
tmp_phasor = pmu_reference_1ph_freq_delta_freq(current_magnitude, | ||
Initial_frequency, | ||
delta_frequency, | ||
number_of_steps, | ||
time_per_step, | ||
frames_per_second, | ||
initial_angle - 120); | ||
phasor.IC = tmp_phasor.VA; | ||
|
||
plot(time, phasor.VA(1,:)); | ||
figure(); | ||
plot(time, phasor.VA(2,:)); | ||
figure(); | ||
plot(time, phasor.frequency); | ||
figure(); | ||
plot(time, phasor.rocof); |
Oops, something went wrong.