-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathFOC_Demo_SVPWM.m
58 lines (49 loc) · 1.3 KB
/
FOC_Demo_SVPWM.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%%
% This file is designed to help the user understand how sinusoidal signals
% actually translate to force vectors in a brushless motor.
%%
clear all;
close all;
clc;
pos = linspace(0, 2*pi, 1000);
Vq = 0;
Vd = 1;
Va = (Vd * cos(pos) - Vq * sin(pos));
Vb = (Vd * sin(pos) + Vq * cos(pos));
plot(Va);
hold on;
plot(Vb, 'r');
legend('Va','Vb');
title('Inverse Park Transform Output');
V1 = Vb;
V2 = (-Vb + sqrt(3) * Va)./ 2;
V3 = (-Vb - sqrt(3) * Va)./ 2;
figure;
hold on;
plot(V1, 'r');
plot(V2, 'g');
plot(V3, 'b');
legend('V1','V2','V3');
title('Inverse Clark Transform Output');
%%SPACE VECTOR MODULATION%%
slmin = 0;
slmax = 2*pi;
hsl = uicontrol('Style','slider','Min',slmin,'Max',slmax,...
'SliderStep',[1 1]./(slmax-slmin),'Value',1,...
'Position',[0 0 200 20]);
set(hsl,'Callback',@(hObject,eventdata) plot(round(get(hObject,'Value'))) )
%InvClarkOut InverseClarke(InvParkOut pP)
%{
% InvClarkOut returnVal;
% returnVal.Vr1 = pP.Vb;
% returnVal.Vr2 = (-pP.Vb / 2 + (SQRT_3_2 * pP.Va));
% returnVal.Vr3 = (-pP.Vb / 2 - (SQRT_3_2 * pP.Va));
% return(returnVal);
%}
%InvParkOut InversePark(float Vd, float Vq, float position)
%{
% InvParkOut returnVal;
% returnVal.Va = Vd * cosf(theta) - Vq * sinf(position);
% returnVal.Vb = Vd * sinf(theta) + Vq * cosf(position);
% return(returnVal);
%}