BradPID Posted July 16, 2015 Report Share Posted July 16, 2015 Hi, I have faced the chalenge with setting values and synchronising measurement using multiple number of instruments. I use cRIO. The orginal application is a bigger but I will try to describe the main issue and my approach. I would like to listen to your feedback or better solution. Let's imagine: - device A (comunication over CANOpen) controlling speed. - device B (communication over RS232) controlling temperature - device C (NI analog inputs module) The goal is to generate sequence of setpoints for temperature and speed and at the same time measuring current speed, temperature (using the same instruments) and measuring voltages using analog inputs. Setpoint for speed should be generated quite quickly (it depends on perspective what means 'quickly' but period is 10ms), setpoints for temperature can be generated slower (period 100ms or bigger). I can't wait for response from device B while I want to generate setpoints for device A (which is faster) so I decicde that I will divide these proceses. My solution: I placed device A controller into Timed Loop where it does three operations in sequence: writes setpoint, read current value and gets command from queue ( Timeout is 0 so I am not waiting for element and it is used only to stop a loop or perform initialisation - non deterministic tasks). The device B is in a similar loop but have different time rate. I wanted to keep instruments and logic separate so I added a third 'Control' Timed Loop which is responsible for generation setpoints at higer rates (1ms). The third loop 'publish' setpoints to other loops using 'single process variable with one element fifo' (one variable per setpoint) - in this way processes doesn't have to wait. All Timed Loops are grouped and starts at the same time. Now, it is time for FPGA. In order to have every mearuement correlated ( corresponding to each other), values measured by instruments are sent to FPGA. On FPGA I acquire values measured by instruments along with analog inputs and send back to the host using FIFO. I am receiving these values in non derministic acquisition loop. Control loop is also responsible for triggering the acquisition. The problem seems to be common but described solution is the only one which I found to be correct and seems to be quite complicated (number of communication methods). Well, I hope I will get some advices to simplify it. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.