VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Arrays for Custom Devices

Hi Folks,

 

I have been asked to look at how one might add array support to a Veristand custom device. The reason we want to do this is to reduce channel count. We have rather a lot of channels and it can be hard to manage them all.

 

I think the short answer is no. You can't even map an array (vector) to the custom device.

 

However you may be able to use waveforms. But it looks like there are limitations on waveforms. I have not found good doc on waveforms to understand the limitations. (How would waveform data move from a model to a custom device?)

 

Any suggestions?

 

Thanks!

 

 

0 Kudos
Message 1 of 4
(1,228 Views)

can you narrow down your question a bit,

 

What type of custom device do you intend to use, asynchronous or inline?

 

What target are you running on? PXI, cRio, Windows, etc 

 

Are these inputs or outputs?

 

If inputs, where do they come from and do you need determinism?

 

If outputs, whats the use for the data once left the custom device? Just logging or used by another part of the project, is determinism required?

0 Kudos
Message 2 of 4
(1,222 Views)

What type of custom device do you intend to use, asynchronous or inline?

    asynchrounous

What target are you running on? PXI, cRio, Windows, etc

    The main system is running on a PXI, but it may be run on Windows. When run on Windows it is for debug purposes and we don't expect the same performance.

Are these inputs or outputs?

    Maybe either

If inputs, where do they come from and do you need determinism?

    A PLC and we are not running a control loop. This is for a HIL simulation. Too much delay and the simulation becomes unworkable.

If outputs, whats the use for the data once left the custom device? Just logging or used by another part of the project, is determinism required?

    It is information, usually remote I/O data, for the PLC. So another part of the project. Also not a control loop, but too much delay would impact the simulation.

0 Kudos
Message 3 of 4
(1,210 Views)

ok cool

 

the next question i suppose is how are you passing data between your PLC and PXI but without needing that here is my sugeestion given that you are using an asynchronous custom device you can take advantage of the model command loop in your custom device (part 3 in the link) which allows you to send and recieve string data to and from your custom device

 

http://zone.ni.com/reference/en-XX/help/372846M-01/veristandmerge/asynchronous_cds/

 

you would need a vi running on your host PC that talks to your PLC (probably over ethernet) and talks to your custom device using the Custom Device Communication library, shown below

 

CD message.PNG

 

you will need a queue setup between your model command loop and data loop (part 4 of the above link) to send data back and forth between these loops in your custom device

 

you will need to use the flatten/unflatten string library to send and recieve your arrays as strings, shown below 

 

flat string.PNG

when sending an array of data to your custom device from your PLC your intermediary host PC vi will flatten your array data from your PLC into a string and send a Data In message to your custom device without need for a reply, the model command loop will unflatten the string into an array and your queue system will send it to your data loop to work on the input data 

 

when receiving data from your custom device your intemediary host PC vi sends a Get Data message to your custom device, upon reciveing this message your model command loop sends a Get Data mesage to your data loop and waits for data from that loop by way of queue, it then flattens the array into a string and sends it as a response to your original Get Data message from the host PC vi.  Once your host PC vi recieves the response from its Get Data message it can unflatten it and send it on to your PLC 

 

there is obviously some latency in doing all this but this all depends on how fast your simulation is running, etc, but seeing as your using an asynchronous device you can run this much faster then your Veristand engine

hope this helps 

0 Kudos
Message 4 of 4
(1,189 Views)