Hello everyone, I'm an engineer student and I'm trying to develop a circuit to reuse some energy that is stored as kinetic energy in an AC motor. It will be used when the motor have to break, so the energy stored can be used to give it back to the companies, so we'll have an economy. The circuit I'm trying to develop is sketched in PSIM software. The aim of the circuit is to control the velocity of the motor with a PWM microcontroller (programmed in C, as the block in the circuit shows), and the same microcontroller will control the reuse of the energy again with a PWM. But the circuit isn't working like I want. Can anyone here help me or send me some material to study about this project? That's all, thanks.
* The circuit image is in the attachments and the code of the C blocks is here below.
//PWM
float senoide[3], val = 0.1, freq = 40*3.14;
int tempo_total = 5;
if (t <= (tempo_total*0.75)){
y5 = 1;
senoide[0] = sin(freq*t);
senoide[1] = sin(freq*t - (120*3.14/180));
senoide[2] = sin(freq*t + (120*3.14/180));
if(senoide[0] >= val){
y1 = 1;
} else {
y1 = 0;
}
if(senoide[1] >= val){
y2 = 1;
} else {
y2 = 0;
}
if(senoide[2] >= val){
y3 = 1;
} else {
y3 = 0;
}
} else {
y1 = 0;
y2 = 0;
y3 = 0;
y4 = 1;
y5 = 0;
}
------------------------------------------------------------------------
//Controle da corrente fornecida para a rede
float corrente_max = 1;
if(x1 == 1){
if(x2 > corrente_max){
y1 = 1;
} else {
y1 = 0;
}
if(x3 > corrente_max){
y2 = 1;
} else {
y2 = 0;
}
if(x4 > corrente_max){
y3 = 1;
} else {
y3 = 0;
}
}
* The circuit image is in the attachments and the code of the C blocks is here below.
//PWM
float senoide[3], val = 0.1, freq = 40*3.14;
int tempo_total = 5;
if (t <= (tempo_total*0.75)){
y5 = 1;
senoide[0] = sin(freq*t);
senoide[1] = sin(freq*t - (120*3.14/180));
senoide[2] = sin(freq*t + (120*3.14/180));
if(senoide[0] >= val){
y1 = 1;
} else {
y1 = 0;
}
if(senoide[1] >= val){
y2 = 1;
} else {
y2 = 0;
}
if(senoide[2] >= val){
y3 = 1;
} else {
y3 = 0;
}
} else {
y1 = 0;
y2 = 0;
y3 = 0;
y4 = 1;
y5 = 0;
}
------------------------------------------------------------------------
//Controle da corrente fornecida para a rede
float corrente_max = 1;
if(x1 == 1){
if(x2 > corrente_max){
y1 = 1;
} else {
y1 = 0;
}
if(x3 > corrente_max){
y2 = 1;
} else {
y2 = 0;
}
if(x4 > corrente_max){
y3 = 1;
} else {
y3 = 0;
}
}