How to generate Sine or Ramp reference in Embedded Applications?
2 views (last 30 days)
Do you have any idea or suggestions or experience on how to generate a Sine or Ramp reference in Embedded Applications (e.g. C2000 Processors)?
First, I tried to use 'Sine wave' blocks but was told they will generate code that is not optimised for embedded applications.
Now, I am using 'C2000 Ramp Generator' block to generate ramp reference (0 .. 2) at 50 Hz and from there using '_IQsin' from 'C2000 Trig Fcn IQN' get sine waveform; and eventually using dq0/abc transformation get all three phases. See figure and attachment (R2015a).
I can replicate the example in the Help File to get 1.9531 Hz and the closest I can get is 49.937 Hz with Sample Time = 0.00002 and Scaling 2^-29. Can I get 50 Hz or 60 Hz exactly? I have some resonant filters tuned to that frequency later in the code. Block '_IQsin' gives sine output, but 'C2000 Inverse Park Transformation', does not work - not a big problem now as I plan to implement my dq0/abc transformation block.
Is this the most optimal way or are there any better, more optimised ways of generating sine reference in Embedded Applications?