LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control and simulation and DAQ

Solved!
Go to solution

Hi,

 

I am doing a motor control application in Labview. I am sampling the speed out from DC motor real time through a DAQ. (my sampling time is 1000 samples per second)

 

Then the speed in input to a Simulation loop (Control design and simulation) and inside the simulation loop I have a PID controller. The PID has the motor actual speed from DAQ and motor reference speed as the input.

 

Motor reference speed is taken from the signal generator (Control design and simulation- Simulation) and is a square waveform.

My step size to the motor is 1000.

I am running this application real time and plotting the reference signal and motor actual signals.I am running in to several problems with regard to timing.

 

1. When I change the step size of the simulation loop , the reference squarewave frequency also seems to change. Eg. When step size=1000 , pulse length= 1s. When step size=100 ,  pulse length=0.1 .(My pulse frequency is 1Hz , Simulation clock - 10KHz) . How can the step size affect the pulse width.

 

2. Also can some one please explain to me the relationship between  DAQ sampling time , Simulation loop step size , Simulation loop period.

 

3. If I want to gather different data sets using different sampling times , it is OK to change DAQ sampling time without changing Step size of the simulation.

 

Also would like to highlight that the DAQmx timing under sample clock mode is placed in front of simulation loop and the output is fed to the simulation loop.

 

Appreciate any help.

 

 

0 Kudos
Message 1 of 2
(2,930 Views)
Solution
Accepted by topic author nilush

Hello,

 

Perhaps some screenshots of your code would help. Additionally, what do you have your samples to read set at with your DAQ VIs?

 

1) If you have a square waveform, the output is specified as:

20133i4121F78FA0D3C807

Thus, if you change the step size of the simulation loop, you alter the simulation times that are fed into the signal generator and that affects the waveform that you see if you do not have a small enough step size to characterize the waveform you generate.

 2) DAQ sampling rate is a the rate at which samples are taken on the DAQ card itself. Simulation step size, from the help. "Specifies the interval between the times at which the ODE solver evaluates the model and updates the model output, in seconds." Simulation loop period, again from the help, "Specifies the amount of time that elapses between two subsequent iterations of the Control & Simulation Loop." The step size simply determine the value of t that is fed into the functions you are using within the simulation loop whereas the simulation loop period simply controls how fast you are changing to the next value of t. The DAQ sampling rate is a completely separate hardware clock controlling the analog-to-digital converter on the DAQ card so that you can get a deterministic dt between the samples being acquired.

3) You can change the DAQ timing but you will have to restart it each time for those changes to take effect. If you change the DAQ timing and want your values to correlate with your simulation, you will need to change your step size as well.

 

-Zach

 

-Zach

0 Kudos
Message 2 of 2
(2,901 Views)