反park变换(anit_park)
将 D Q轴的参考坐标信号转变为 alphe bate 坐标系的电气信号。
原先是参考 “慧净foc”点击视频的,用simulink仿真,奈何水平有限。另辟蹊径先用arduino做出波形。后续会出simulink仿真。
代码
int d = 1;
int q = 4;
int i = 0;
float theat = 0;
float bate = 0;
float alphe = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
for(i = 0;i<628;i++)
{
theat = theat+0.1;
alphe = d*cos(theat)-q*sin(theat);
bate = d*sin(theat)-q*cos(theat);
Serial.print(alphe);
Serial.print(",");
Serial.print(bate);
Serial.print(",");
Serial.print("\n");
}
i = 0;
//Serial.print(analogRead(xpin));
}
输出
调试说明
改变变量D Q 的值即可改变 alphe bate 输出幅值
alphe = dcos(theat)-qsin(theat);
bate = dsin(theat)-qcos(theat);