VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

passing model data via pointers

Am I able to pass data (arrays of bytes) from a model to a custom device using pointers, possibly using the "Veristand data library" toolkit  instead of through normal channel data. My channel count is too high and just slowing down everything

0 Kudos
Message 1 of 12
(3,110 Views)

Hi Arlrob,

I'm not sure that's possible. In general arrays are meant to be passed between models and not between model and custom device. 

 

ZK
Technical Support Engineer | NI | Not actually retired but I don't know how to change that
0 Kudos
Message 2 of 12
(3,082 Views)

I must be missing something.  I need to send larger UDP messages that mostly consist of arrays of U8s.  The data for those messages are generated in my models.  Making a channel for each byte slows my simulation down considerably. The UDP data link custom device currently will create a pointer and allow for a model or custom device to just fill the memory at that location.  I just have no idea how to do that.  Ideally I could do this with my simulink models..

0 Kudos
Message 3 of 12
(3,073 Views)

What about to use the NI Linux RT Inter-Process Communication for NI RT Linux based targets?

CLA, CTA, CLED
0 Kudos
Message 4 of 12
(3,062 Views)

Using the Linux utilities causes my cRIO to crash the same way. I have no idea what I am doing wrong.

 

 

0 Kudos
Message 5 of 12
(3,037 Views)

I have similar problem. I read/send TCP data to a device.

I have tested two ways:

- Inline model custom device with an asynchronous task to collect/send the packets. But custom device do not support arrays and I have a lot of data, so mapping is a nightmare.

- Labview vi compiled as model for Veristand. The main vi launch an asynchrous vi to collect/send packets. The comunication between main vi and the task uses RT queus.

                            Problem-> The asynchronous vi do not load in veristand engine.

                            Workaround -> Compile the main vi using the option "Retain intermediate files in destination folder", open the project, add the asynchronous vi in the dll build specification. Build the dll and rename the file XXXXX_core.dll to XXXX.lvmodel.

 

 

 

0 Kudos
Message 6 of 12
(3,016 Views)

Am i able to set the input of a model directly from my custom device using API calls?

 

My model has a vector input and I need a way to set it

0 Kudos
Message 7 of 12
(2,773 Views)
 

The response to the question is Yes and No.

 

- Yes. Use  "Set Channel Value by Data Reference.vi".

You can use this VI in the Execute Model case of an Inline Model Interface custom device, or in the Read Data from HW or Write Data to HW cases of an Inline Hardware Interface custom device. Do not use this VI outside of an inline custom device.

This vi only transfer the value of a double, but you can hack the vi and send an array. The vi is a call to moveblock, and the values of the arrays are consecutive in the memory, so the hack is very easy.

 

 - No. If you use an asynchronous vi, you cant set the input. In this case, I use queue between the custom device and a new model as workaround.

        - Create a queue in the vi of the Custom device to sent the array value

        - Create a vi in labview with the array as output. The vi read the queue and set the value  of the output.

        - Convert the vi to model and insert in your veristand configuration.

        - Connect the output of the new model with the input of your model.

Message 8 of 12
(2,756 Views)

Thank you, this was very helpful. 

 

How do I get the reference required for the Set Channel by Data Reference.vi?

 

I believe my custom device was developed using the inline async custom device wizard and its execution mode is Inline HW Interface.  So does that mean my Custom device uses an asynchronous VI? or is an Inline HW interface?

 

Thank you again

0 Kudos
Message 9 of 12
(2,746 Views)

When I create a queue in my custom device I do not seem to be able to see it by my model.  I am using the same queue name.

 

I have also run a test with my custom device built for windows running on windows and a labiew VI does not seem to find the queue

0 Kudos
Message 10 of 12
(2,731 Views)