04-07-2014 05:04 AM
Hello
I am working with a piezo-motor system and a test machine.
-I send a comand every 20 ms to a motor to generate a movement on a strenght test machine.
I have a timed while loop where I send the comands to the motor. The data I send is a SGL format number.
-I read the force (with an other device) generated by the motor movement.
(The device generate internally measures every 20 ms and save it on the device memory. The measures include force data and time stamp).
I have a second parallel timed loop where I send a command every 20 ms to read the last data on the device memory
What I need is to get a measure with the last sended motor position and the force value at that time (synchron) every 20 ms (as accurate as possible). I know its not possible because I am not working with a real time system. What I would like to know is the best way to do it as accurate as possible.
I am using local variables to get the data from the motor and the force device. I have a third parallel while loop where I read both local variables every 20 ms. The quesions are:
-Since I cant not use queues or notifiers to pass data between loops because the loops sould be timed loops, witch is the best way to past the data between loops (local variable)?
-Should I use one of my device loops (motor loop, or force device loop) as a master and get the value there of the other device?
I cant post my code because the motor and the force device have small subVIs with license. Sorry.
Thanks
04-07-2014 01:30 PM
correct me if i am wrong , what i understand that you send a motor movement command with a regular interval of 20ms, as you send the command you also want to read force sensor (for the motor movement ) which is the result of your your last sended motor movement command.
are you communicating with these sensors via serial ports or usb. you can use a single timed loop for both of these operations by opening two serial ports (if you are reading writing via serial) outsidede timed loop, and read and write these serial ports inside your timed loop.
04-07-2014 07:51 PM - edited 04-07-2014 07:52 PM
@Navarro_ wrote:
Hello
I am working with a piezo-motor system and a test machine.
-I send a comand every 20 ms to a motor to generate a movement on a strenght test machine.
I have a timed while loop where I send the comands to the motor. The data I send is a SGL format number.
-I read the force (with an other device) generated by the motor movement.
(The device generate internally measures every 20 ms and save it on the device memory. The measures include force data and time stamp).
I have a second parallel timed loop where I send a command every 20 ms to read the last data on the device memory
What I need is to get a measure with the last sended motor position and the force value at that time (synchron) every 20 ms (as accurate as possible). I know its not possible because I am not working with a real time system. What I would like to know is the best way to do it as accurate as possible.
I am using local variables to get the data from the motor and the force device. I have a third parallel while loop where I read both local variables every 20 ms. The quesions are:
-Since I cant not use queues or notifiers to pass data between loops because the loops sould be timed loops, witch is the best way to past the data between loops (local variable)?
-Should I use one of my device loops (motor loop, or force device loop) as a master and get the value there of the other device?
I cant post my code because the motor and the force device have small subVIs with license. Sorry.
Thanks
I'm not sure you need something so accurately timed? The motor movement isn't going to be instantaneous, so when were you planning on starting the event? When will the resulting measurement be valid? I suppose there will be ringing?
Or maybe the motor movement needs to be continuous and you take measurements at very accurate time intervals.
04-08-2014 01:36 AM
Hi, and thanks for the answers.
The communication with the devices is usb for both. I generate a ramp movement. The ramp should be as fine as possible and with a speed selected by the user. The hole movement takes between 5 and 60 minutes depending on the material test, and starts when the user press start.
That means, so many steps so fine its my ramp (the motor have time enough to finish a small movement in 20 ms, I already tested). Should I try less steps but bigger and with longer period to do it more fine?
I open the comunication and do the set up for the devices before my while loops starts. And the reading of the force device and the writing of the motor command takes less than 20ms each.
As I say, the problem is to find a structure/loop so constant/regular in time as possible. So, its better to use a separate loop and with local variables for the measures, or its better to write everything on the same loop and do the priod longer?
Thanks
04-08-2014 02:52 AM - edited 04-08-2014 02:58 AM
hmmm hang on...
I think you might want to consult on someone more familiar with making force measurements. I just keep thinking there has to be an easier way to do this than what you have in mind...