From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

control two different parameters at the same time

Two motors were connected each other rigidly. One motor controlled torque and the other motor controlled speed. I generated some torque and speed data which represented one cycle of motion from a motor simulation. I like to send these two different data sets (torque and speed) to two different motors at the same time. Torque data sends to one motor and speed data sends to the other motor to see the response of the load profile. In order to do this, I thought about using multithread, but I am not sure it will work for this application. Usually multithreading delay the CPU time so the overall control process might be delayed, right? If you have better idea, please let me know.
0 Kudos
Message 1 of 6
(3,167 Views)
If you are using one motion controller to control both motors, you will probably run into problems if you try to use multithreading on the PC. However, you can execute up to 10 programs (threads) at a time, in addition to host communication, using on-board programming. For more information on on-board programming please refer to the following tutorial: Developer Zone Tutorial: On-board Programming in FlexMotion

Best wishes!
Dawna P.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(3,167 Views)
I am not sure multithreading will work for synchronizing command signals in two different axes. I need to send out two command files to two motors though analog output channels at the same speed. Could I use some other method? Is there any way to synchronize two axis to send out two different data files (torque and speed) to be sent to the motor at the same time? Thank you.
0 Kudos
Message 3 of 6
(3,167 Views)
I like to add one more comment.
The motion controller has the feature of synchronizing data by using RTSI bus in PXI and sending a signal to AI channels in DAQ in use of breakpoint. I wonder if there is a way of sending out control signals to analog output channel at the same time. Two signal commands are speed in 'Load velocity in RPM' and voltage in 'Load torque limit'.
0 Kudos
Message 4 of 6
(3,167 Views)
Actually, all you need to do is load the parameter for each axis and then call Start Motion.flx. This VI starts motion on multiple axes simultaneously. Since a start is preemptive, it will use the most recently loaded values of velocity and torque.

In summary, you will call the Load Velocity in RPM.flx on axis 1, Load Torque Limit.flx on axis 2, and then Start Motion.flx. You will need to set the Axis or Vector Space input of Start Motion to "Axis Control", and set the Axis/VS Map input to true for Axis 1 and Axis 2.

I hope this helps! Best wishes.
Dawna
0 Kudos
Message 5 of 6
(3,167 Views)
Thank you for your answer. It works fine but I got another problem. I created about 500 data points and I collected eight analog input signals from sensors. To record the AI data, 'AI vi's are inside while loop and they seems like reduce the execution speed. I mean I ran two motors at the same time but the execution speed was too slow. Is there any way to control the speed, too? I am synchronizing the collecting data speed by using periodic breakpoint. Also, I included five wavefrom chart to monitor DAC values, speed, torque, etc in real time.
0 Kudos
Message 6 of 6
(3,167 Views)