LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a PID control in FPGA target

Solved!
Go to solution

Hello all!

 

I'm new at LabVIEW and I could really use your help!

 

I'm trying to control my EC motor in order to apply a constant force in my model. 

Before, I used to control it by a PWM signal by introducing the current that I wanted to apply. I have a load cell that then tells me how much force is being applied.

 

However, when the model moves this force changes with the model dynamics of course but the standard deviation is quite big and the mean force does not match the force that I wanted. For example applying a 7N constant force, this force will vary between 5 and 10 N and the mean force will be close to 8N. So I'm trying to implement a PID control. However, it's not working. Basically I wanted the PID control to compare the setpoint force I wanted to apply with the force variable being read by my load cell and then control the input current used to control the motor.

 

I've uploaded the project here for you to see.

 

Any help would be very much appreciated!

 

Best wishes,

Anita

 

0 Kudos
Message 1 of 3
(730 Views)
Solution
Accepted by topic author AnitaL

Hello Anita

 

Here's a few points I noticed:

  • You're on a FPGA target. Are you sure you want to use that many SGL numbers? These are quite "expensive" on a FPGA target. However, when using FXP, you might also want to check how many bits you actually need. For instance your LC Offset is a FXP+-52,10 data type (!!!).
  • The limits for the PID seem swapped. It excepts high/low limits, but you feed in low/high limits. This will basically restrict the PID output to a constant.
  • To scale the "Force Setpoint" you subtract gain, then divide by Offset. That's obviously swapped as well, and with an offset of 0 will lead to Inf.
  • Are you sure you need to apply the gain & offset to both values (AI2 and Force Setpoint)? To me it looks like you try scaling the AI2 value to physical units, but scale the Force setpoint to raw. Either you work with the raw values (voltages) or with physical units, but don't mix them.
  • Does AI2 really provide a FXP+-26,5 data type?
  • The logic to set the "reset" variable to False can be replaced by a False constant wired to the reset local variable.
    dan_u_1-1700074120962.png

     

Best,

Daniel

 

Message 2 of 3
(666 Views)

Hi Daniel! It worked! Thank you for your help 😄

 

Best wishes,

 

Anita

0 Kudos
Message 3 of 3
(475 Views)