0

I designed a controller in Simulink, which I want to compile in HDL and flash to an FPGA. Therefore I have to define the used data types in fixed point style rather than the standard double that Simulink chooses.
Every block I am using is working exactly the same as before after the datatype changes (apart from the precision in some cases of course) except for the discrete-time integrator block. With a fixed point data type (no matter which word or fraction length) the output value can only decrease and if it hits the bottom value limit of the datatype it jumps to the top one and decreases again.
I added a picture to clarify the difference. The integrator with double type was used and a second integrator exaclty the same except fpr the data type was logged at the same time.

Signal of integrator with double and with fixed point data types

What am I doing wrong? And how can I solve this problem? Thank you!

Jonnnny
  • 95
  • 1
  • 2
  • 6
  • 1
    Have you verified the data input to integrator is correct? It is possible the jump is because the computation is wrapping around. Try setting overflow option to saturate. – Navan May 12 '16 at 13:07
  • looks also like you have a signed/unsigned problem too – percusse May 12 '16 at 13:56
  • I tried saturation. However that only means the value is stuck at the lower saturation limit after some time. All the data types around that block are signed values so in case I don't miss anything important there it shouldn't be an unsigned / signed problem. – Jonnnny May 13 '16 at 06:34

0 Answers0