Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

how to control DC motor in a simulation loop??

Hi,
 
I am Xiaofei, a beginner of LV. We plan to use feedback control on 2 DC motors using Simulation loop. Now the question is: i am not quite sure if the simulation loop is only a virtual simulation of the system, or it can be used to control the real system. We will use 2 encoders to detect the actual postion of the motor shafts, and the decoding code works well in a while loop, as the attached VI. But we don't know how to make it work in a simulation loop. Whenever we put it in a simulation loop and click "run", there's no response  no matter what we do on the system. So if you know, could you tell me if the simulation loop is suitable for our application and what we can do to run the encoders in it? Thanks a million!! 
 
Xiaofei
0 Kudos
Message 1 of 4
(3,774 Views)
 

Hi Xiaofei,

Thanks for posting on the NI forums!  Can you tell me a little more about your setup?  What do you mean by Simulation loop?  Do you mean Simulation Module or Simulation Interface Toolkit (now called Model Interface Toolkit)?  What hardware are you using to control the motors and read the encoder feedback?  What kind of motors do you have?  Can you read the encoder inputs in LabVIEW when you turn the motors by hand?

Thanks,

 
Maclean G.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 4
(3,764 Views)

Hi Maclean,

thank you for your reply! The simulation loop is in simulation module. We use DAQCard 6062E to get the feedback from the encoder and send command signal to the amplifier connected to the motor. It's a DC motor. We've made a code for quadrature decoding in while loop and it works well, but this code involves case structures that cannot be used in a simulation loop.  Hope these information can make you understand our setup and then give us some suggestions. thanks a million!!

 

Regards,
Xiaofei

 

0 Kudos
Message 3 of 4
(3,761 Views)
Xiaofei
 
To use other LabVIEW structures as For Loop or While Loop inside Simulation Structure, you just need to place them inside a SubVI and configure the VI to be discrete. Notice that you have to configure the SubVI to run as a point-by-point VI, i.e., you can only interate once and store the information.
 
Please refer to examples for more information. Hope this helps.
Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 4 of 4
(3,754 Views)