CompareSynGenResults.m 2.83 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/SynGenVBREmt_ABCFault_PLECS/Voltages_and_currents.csv'); 
%Te_PLECS = csvread('../../vsa/Results/SynGenVBREmt_ABCFault_PLECS/electrical_torque.csv'); 
omega_PLECS = csvread('../../../vsa/Results/SynGenVBREmt_ABCFault_PLECS/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/Testing/data_vt.csv');
CurrentVector = csvread('../../../vsa/Results/Testing/data_j.csv');
Log_SynGen = csvread('../../../vsa/Results/Testing/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
23
24
plot(Results_PLECS(:,1),Results_PLECS(:,2),'--');
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');
Viviane Sapucaia's avatar
Viviane Sapucaia committed
27
legend('va DPSim','vb DPSim', 'vc DPSim','va PLECS','vb PLECS','vc PLECS');
28
%legend('va DPSim','vb DPSim', 'vc DPSim','va Simulink','vb Simulink','vc 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
38
39
plot(Results_PLECS(:,1),Results_PLECS(:,5),'--');
plot(Results_PLECS(:,1),Results_PLECS(:,6),'--');
plot(Results_PLECS(:,1),Results_PLECS(:,7),'--');
Viviane Sapucaia's avatar
Viviane Sapucaia committed
40
41
42

title('Phase Currents');
legend('ia DPSim','ib DPSim','ic DPSim','ia PLECS','ib PLECS','ic PLECS');
43
%legend('ia DPSim','ib DPSim','ic DPSim','ia Simulink','ib Simulink','ic 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
74
75
76
77
78
79
figure(3)
hold off
plot(Log_SynGen(:,1),Log_SynGen(:,8));
hold on
plot(Results_PLECS(:,1),omega_PLECS);

title('Rotor speed');
legend('\omega DPSim','\omega PLECS');
80
81
82
83
84
85
86
87
88
% 
% figure(4)
% hold off
% plot(Log_SynGen(:,1),Log_SynGen(:,7));
% hold on
% plot(Results_PLECS(:,1),Te_PLECS);
% 
% 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');