Hi all,
I am currently trying to implement a PID controller. I am fairly new to PSoC so this is going to be a bit of a challenge for me. The goal of the project is to control the output RMS of a DC-to-AC converter. The way this is done is the following, the RMS value is obtained through the sampling of the output sine wave. A SIMULINK diagram of the whole operation can be seen below.
The RMS is subtracted from whatever RMS value I set. The error then passes through a PI controller and then is multiplied with the control sine wave signal. I am generating the control sine wave and triangle waves in PSoC using the WaveDAC component. Since I am trying to use the sine wave as a control signal, from my understanding, I have to pass it through some ADC in order to multiply it by the output of the PI controller.
My problem the following: I have read articles on PID using C, and from what I have read, you need to use 16 bits for floating point math. I am using the PSoC
Thanks,
Solved! Go to Solution.
molinac5,
Since you are operating in slow-time domain (60Hz), there is no need for fast math; do PID using float or double precision. Divide project into independent sections: (1) RMS measurement, (2) PID control, (3) PWM output with sine modulation.
1. RMS measurement project example:
Measuring an RMS signal on a PSoC5 - Hackster.io
2. for PID code example, check links in this thread
3. PSoC is able to produce modulated PWM digitally - no need for using a comparator and triangulation of analog sine.
Finally, you should estimate the time budget for this endeavor realistically - this is not a weekend project.
/odissey1
Maybe you can refer to community thread PSoC 5LP PID Control and let me know if it helps.
molinac5,
Since you are operating in slow-time domain (60Hz), there is no need for fast math; do PID using float or double precision. Divide project into independent sections: (1) RMS measurement, (2) PID control, (3) PWM output with sine modulation.
1. RMS measurement project example:
Measuring an RMS signal on a PSoC5 - Hackster.io
2. for PID code example, check links in this thread
3. PSoC is able to produce modulated PWM digitally - no need for using a comparator and triangulation of analog sine.
Finally, you should estimate the time budget for this endeavor realistically - this is not a weekend project.
/odissey1