From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID vi problem (simple question)

I am trying to create a boat that maintain a specific direction, for that I use a rudder to change direction of the boat the rudder is controller by a servomotor, and a gyroscope to measure the angle on which the boat is pointing at.

I want to know if the logic of my connection to the PID function are correct :

  • my setpoint is 0 degrees
  • my process variable is the value of my gyroscope in degrees
  • my output range is 0.0525 to 0.675 (the middle point of my rudder is 0.06), ( they have this value to send it to the rubber and change the direction of max of 17.5 degrees of the rudder)
  • my output is going to the rudder

the part I am really confuse is: If I put my set point to be 0 degrees I want the rudder to change the direction to stabilize the system if the boat is not at 0 degrees, but I don't know if the PID function knows if the values of the gyroscope and the rudder are related to each other or not, because the process value I am working is from the degrees of the gyroscope and the output I put to be is the rudder with that range of values, when trying in real life the PID it didn't work. and I don't know if it is because of my logic of or what 

Wottrich_0-1699414693936.png

 

0 Kudos
Message 1 of 2
(439 Views)

Hi Wottrich,

 


@Wottrich wrote:

the part I am really confuse is: If I put my set point to be 0 degrees I want the rudder to change the direction to stabilize the system if the boat is not at 0 degrees, but I don't know if the PID function knows if the values of the gyroscope and the rudder are related to each other or not, because the process value I am working is from the degrees of the gyroscope and the output I put to be is the rudder with that range of values, when trying in real life the PID it didn't work. and I don't know if it is because of my logic of or what 


And what are your PID gains? They determine the relation between sp, pv and output!

 

On your VI:

  • The "case value" should be blue, aka integer!
  • The "gauge" and "PID gains" belong before the case structure, "Turn Duty…" afterwards! No locals needed!
  • The wait belongs into the main loop, not just into one case.
  • The dt input of the PID is WRONG!
  • All those comparisons on ElapsedTime can be simplified using either InRangeAndCoeerce or a simple array function like Threshold1DArray…
  • Several controls/indicators are bound to SharedVariables, that makes it very hard to verify your code: we miss all the definitions and connections…

Example:

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 2
(410 Views)