Commit bbb210ca authored by Angioni's avatar Angioni

minor updated

parent 30a2833c
......@@ -99,7 +99,7 @@ if strcmp(GridData.type_of_model,'single_phase')==1
var_err_rectangular_mat_IRI = diag(Rx_rectangular_IRI);
std_err_rectangular_mat_IRI = sqrt(var_err_rectangular_mat_IRI);
rotV = calc_rotV( GridData,PowerData);
rotV = calc_rotV( GridData,PowerData,use_pu);
rotI = calc_rotI( GridData,PowerData,use_pu);
%we apply the rotor
Rx_polar_VRI = rotV*Rx_rectangular_VRI*rotV';
......@@ -132,7 +132,7 @@ if strcmp(GridData.type_of_model,'single_phase')==1
W = full(W);H_VRI=full(H_VRI);H_IRI=full(H_IRI);
Rx_rectangular_IRI = inv(H_IRI'*W*H_IRI);
Rx_rectangular_VRI = inv(H_VRI'*W*H_VRI);
rotV = calc_rotV( GridData,PowerData);
rotV = calc_rotV( GridData,PowerData,use_pu);
rotI = calc_rotI( GridData,PowerData,use_pu);
% here we remove the contribution of the slack bus voltage phase angle state (or
% slack bus voltage imaginary state)
......
......@@ -20,7 +20,7 @@
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [ rotV ] = calc_rotV( GridData,PowerData)
function [ rotV ] = calc_rotV( GridData,PowerData,use_pu)
rm_column = 1;
if rm_column == 1
rotV = zeros(2*GridData.Nodes_num-1,2*GridData.Nodes_num-1);
......@@ -28,6 +28,12 @@ else
rotV = zeros(2*GridData.Nodes_num,2*GridData.Nodes_num);
end
if use_pu == 0
PowerDataVmagn = PowerData.Vmagn * GridData.base_voltage;
else
PowerDataVmagn = PowerData.Vmagn ;
end
for x = 1 : GridData.Nodes_num
if rm_column == 1
if x == 1
......@@ -35,14 +41,14 @@ for x = 1 : GridData.Nodes_num
else
rotV(2*(x-1)+1-1,2*(x-1)+1-1) = cos(PowerData.Vph(x,1));
rotV(2*(x-1)+1-1,2*(x-1)+2-1) = sin(PowerData.Vph(x,1));
rotV(2*(x-1)+2-1,2*(x-1)+1-1) = - sin(PowerData.Vph(x,1))/PowerData.Vmagn(x,1);
rotV(2*(x-1)+2-1,2*(x-1)+2-1) = cos(PowerData.Vph(x,1))/PowerData.Vmagn(x,1);
rotV(2*(x-1)+2-1,2*(x-1)+1-1) = - sin(PowerData.Vph(x,1))/PowerDataVmagn(x,1);
rotV(2*(x-1)+2-1,2*(x-1)+2-1) = cos(PowerData.Vph(x,1))/PowerDataVmagn(x,1);
end
else
rotV(2*(x-1)+1,2*(x-1)+1) = cos(PowerData.Vph(x,1));
rotV(2*(x-1)+1,2*(x-1)+2) = sin(PowerData.Vph(x,1));
rotV(2*(x-1)+2,2*(x-1)+1) = - sin(PowerData.Vph(x,1))/PowerData.Vmagn(x,1);
rotV(2*(x-1)+2,2*(x-1)+2) = cos(PowerData.Vph(x,1))/PowerData.Vmagn(x,1);
rotV(2*(x-1)+2,2*(x-1)+1) = - sin(PowerData.Vph(x,1))/PowerDataVmagn(x,1);
rotV(2*(x-1)+2,2*(x-1)+2) = cos(PowerData.Vph(x,1))/PowerDataVmagn(x,1);
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment