LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA PID outputs NaN

Solved!
Go to solution

Hello,

 

I'm working on a LabView project to drive DC motors from the FPGA part of a compactRIO 9063.

I've implemented a small VI to do so, based on optical encoders to retrieve the current motor axis positions and a PID to control the motor courses.

 

For some reasons I cannot explain, the PID outputs always send as NaN (as far as I can see using the indicator).

Any idea why I have such a behavior ?

 

Find below a snapshot of my VI.

 

thanks for your help,

Regards,

Christophe.

0 Kudos
Message 1 of 5
(2,512 Views)

Which outputs read NaN? Do you use indicators that are not shown in the picture to see these outputs?

CLA - Kudos is how we show our appreciation for comments that helped us!
0 Kudos
Message 2 of 5
(2,503 Views)

Oups, sorry.

The indicator connected to the output of PID, in my VI, its name is 'Sorties (-1;1)'.

 

0 Kudos
Message 3 of 5
(2,494 Views)
Solution
Accepted by topic author christophe.lyonnaz

No problem!

 

I am not very familiar with the PID vi, but I can offer some general debugging advice:

  • Are you sure your inputs are appropriate? Moreover, are the appropriate at all times? Could it be possible that at 0 time, you feed in 0 values into the input? There are few divides and multiplies that occur to your inputs. If these values default to 0 you could be inputting NaNs. I am not sure how the PID will recover from being fed a NaN. It might not!
  • I always recommend to implement low level FPGA logic on your host PC first. Then you can do testing and debugging in the full environment rather than trying to untangle the black box that is the FPGA! Once it works on the host you can port the code to the FPGA. I am not sure if you can rely on this though as the PID vi may not work in the host context. You might get away with using a host PID vi (I am sure there will be one) but it may act differently!

To get around the valid inputs problem you could implement some kind of default values on the front panel controls (which you know are valid), which are overwritten when a new value comes from the host. Host updates could even be checked for validity before they are fed into the PID. Though really you should do this sort of validity checking on the host!!

 

Good luck!

CLA - Kudos is how we show our appreciation for comments that helped us!
0 Kudos
Message 4 of 5
(2,479 Views)

Thx, your advice helped a lot !

You were right, I had bad initialisation values that probably set my PID in a weird state !

 

Many thanks for the help !

0 Kudos
Message 5 of 5
(2,442 Views)