Author Topic: ---  (Read 2441 times)

0 Members and 1 Guest are viewing this topic.

Offline marzigTopic starter

  • Newbie
  • Posts: 1
---
« on: April 20, 2015, 09:20:11 pm »
-
« Last Edit: November 20, 2022, 04:59:40 pm by marzig »
 

Offline albert22

  • Regular Contributor
  • *
  • Posts: 177
Re: Problems with a motor transfer function
« Reply #1 on: April 22, 2015, 12:25:18 am »
R and L are correct on the equation but they are reversed in the description.
IMHO many steps are required to get eq. 1. Which looks like a small signal AC model of the PWM. Implying a linearization around an operating point.
This linear model is required because otherwise you cannot apply the laplace transform and get eq  2. Which is not the "motor transfer function". The author is modeling just a winding of the motor (given its inductance L and its resistance R). That is just an RL circuit excited with a PWM.  And the transfer function refers to the input: duty cycle,  to the output:  winding current.
"u" then in not a voltage is the duty cycle, it is a ratio so it is  dimensionless.
The PI loop should output u as a value for the duty cycle.
 

Offline albert22

  • Regular Contributor
  • *
  • Posts: 177
Re: Problems with a motor transfer function
« Reply #2 on: April 22, 2015, 04:54:24 pm »
To get a linear ac model for the pwm, you need to write the equations for the average voltage applied to the RL circuit. This gives the operating point around which you apply a small perturbation signal. In this case a small perturbation of the duty cycle. The resulting eq is linearized by discarding high order terms.
Here is an example:
http://www.planetanalog.com/author.asp?section_id=3049&doc_id=563779

the function:
int CalcPI1(int currentReference,int currentMeasurement)
...
return PI_out1;                 //controller voltage output

Says it returns voltage. I think that to be sure of what is the output of the PI controller you need to know the units of the gains G0,p1,p2...
Ultimately  the DsPic  output is a pwm pulsed output. There is no voltage control, only duty cycle is varied.  Somewhere in the source code a conversion from PI_out to duty cycle should be done.  I didnt find it in a first read may be I can take a second look later.
« Last Edit: April 22, 2015, 05:04:18 pm by albert22 »
 

Offline albert22

  • Regular Contributor
  • *
  • Posts: 177
Re: Problems with a motor transfer function
« Reply #3 on: April 22, 2015, 05:05:42 pm »
update:
Quote
{     
                //PI controller for winding 1
              pwmOut1 = CalcPI1(stepAmplitudeRef1,current1);
              pwmOut1 = (int)((((long)pwmOut1*DC_2_PWM))>>15);        //convert from voltage scale to PWM duty cycle
         
                //make sure the output value is in the acceptable PWM range
              if(pwmOut1>PWM_MAX)
                 pwmOut1 = PWM_MAX;
              if(pwmOut1<-PWM_MAX)
                 pwmOut1 = -PWM_MAX;
 

Offline albert22

  • Regular Contributor
  • *
  • Posts: 177
Re: Problems with a motor transfer function
« Reply #4 on: April 23, 2015, 11:52:41 pm »
Duty cycle is typically from 0 to 1.Seems like that the author used that for the model. Anyhow the eq of the linearized model are only valid for small perturbations around the operating point. I am not sure that you can go thru the full range on your simulations.
The system will be non linear for large variations and that is partially handled by the anti windup mechanism.
A fixed point implementation of the discrete controller, as mentioned in eq 6 will have different gains and probably a scaled duty cycle. Which no longer go from 0 to 1.
You need to read very carefully the source code to understand what is happening there.
Good luck
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf