CompareSynGenResults.m 2.96 KB
Newer Older
1
2
3
% Compare voltage and current of c++ simulation with voltage and currents
% from PLECS simulation

Viviane Sapucaia's avatar
Viviane Sapucaia committed
4
5
%% read PLECS results

6
7
8
Results_PLECS = csvread('../../../vsa/Results/TestExciterAndTurbine/SynGenDqEMTExciter_loadChange_Simulink/Voltages_and_currents.csv'); 
%Te_PLECS = csvread('../../../vsa/Results/SynGenDqEmt_ABCFault_PLECS/electrical_torque.csv'); 
omega_PLECS = csvread('../../../vsa/Results/TestExciterAndTurbine/SynGenDqEMTExciter_loadChange_Simulink/omega.csv'); 
9
%theta_PLECS = csvread('../../vsa/Results/SynGenVBREmt_ABCFault_PLECS/theta.csv'); 
10
%% read results from c++ simulation
11
12
13
VoltageVector = csvread('../../../vsa/Results/TestExciterAndTurbine/SynGenVBREmtExciter_LoadChange_DPsim/data_vt.csv');
CurrentVector = csvread('../../../vsa/Results/TestExciterAndTurbine/SynGenVBREmtExciter_LoadChange_DPsim/data_j.csv');
Log_SynGen = csvread('../../../vsa/Results/TestExciterAndTurbine/SynGenVBREmtExciter_LoadChange_DPsim/SynGen_gen.csv');
14
15
 %% Plot
figure(1)
16
17
18
hold off
plot(VoltageVector(:,1),VoltageVector(:,2));
hold on
19
20
%plot(VoltageVector(:,1),VoltageVector(:,3));
%plot(VoltageVector(:,1),VoltageVector(:,4));
Viviane Sapucaia's avatar
Viviane Sapucaia committed
21

22
plot(Results_PLECS(:,1),Results_PLECS(:,2),'--');
23
24
%plot(Results_PLECS(:,1),Results_PLECS(:,3),'--');
%plot(Results_PLECS(:,1),Results_PLECS(:,4),'--');
Viviane Sapucaia's avatar
Viviane Sapucaia committed
25

26
title('Phase Voltages');
27
28
%legend('va DPSim','vb DPSim', 'vc DPSim','va PLECS','vb PLECS','vc PLECS');
legend('va DPSim','va Simulink');
29
30
31

figure(2)
hold off
32
plot(CurrentVector(:,1),CurrentVector(:,2));
33
hold on
34
35
%plot(CurrentVector(:,1),CurrentVector(:,3));
%plot(CurrentVector(:,1),CurrentVector(:,4));
Viviane Sapucaia's avatar
Viviane Sapucaia committed
36

37
plot(Results_PLECS(:,1),Results_PLECS(:,5),'--');
38
39
%plot(Results_PLECS(:,1),Results_PLECS(:,6),'--');
%plot(Results_PLECS(:,1),Results_PLECS(:,7),'--');
Viviane Sapucaia's avatar
Viviane Sapucaia committed
40
41

title('Phase Currents');
42
43
%legend('ia DPSim','ib DPSim','ic DPSim','ia PLECS','ib PLECS','ic PLECS');
legend('ia DPSim','ia Simulink');
44

Viviane Sapucaia's avatar
Viviane Sapucaia committed
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
% figure(3)
% hold off
% plot(Log_SynGen(:,1),Log_SynGen(:,2));
% hold on
% plot(Log_SynGen(:,1),Log_SynGen(:,3));
% plot(Log_SynGen(:,1),Log_SynGen(:,4));
% title ('Fluxes');
% legend('q','d','fd');
% 
% figure(4)
% hold off
% plot(Log_SynGen(:,1),Log_SynGen(:,5));
% hold on
% plot(Log_SynGen(:,1),Log_SynGen(:,6));
% plot(Log_SynGen(:,1),Log_SynGen(:,7));
% title ('dq voltages');
% legend('q','d','fd');
% 
% figure(5)
% hold off
% plot(Log_SynGen(:,1),Log_SynGen(:,8));
% hold on
% plot(Log_SynGen(:,1),Log_SynGen(:,9));
% plot(Log_SynGen(:,1),Log_SynGen(:,10));
% title ('dq currents');
% legend('q','d','fd');

72
73
figure(3)
hold off
74
plot(Log_SynGen(:,1),Log_SynGen(:,9));
75
76
77
78
hold on
plot(Results_PLECS(:,1),omega_PLECS);

title('Rotor speed');
79
80
81
82
83
84
85
legend('\omega DPSim','\omega Simulink');
% % 
% figure(4)
% hold off
% plot(Log_SynGen(:,1),Log_SynGen(:,20));
% hold on
% plot(Results_PLECS(:,1),-Te_PLECS);
86
% 
87
88
% title('Electrical Torque');
% legend('Te DPSim','Te PLECS');
89
90
91
92
93
94
95
96
97
% 
% figure(5)
% hold off
% plot(Log_SynGen(:,1),Log_SynGen(:,4));
% hold on
% plot(Results_PLECS(:,1),theta_PLECS);
% 
% title('Rotor position');
% legend('\theta DPSim','\theta PLECS');