VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Building a Model with 2D array fails

I am running a LV model build with a model to which I just added a 2D array of Num set as a parameter (as opposed to an input)... the build fails and returns:


Getting subsystem information...done.

Copying template project...done.
Setting Template Project properties... done.
Scripting model_info.vi ...done.
Scripting model_core.vi...ERROR:
Code: 0
Source: NI VeriStand 2009 interface only supports scalar
and 1D datatypes.

Error occurred. No DLL produced.


Why does it say 2009 interface anyway while I am using VS 2011?  A 1D array works though...

 

My initial intent was to use a 2D array as a model parameter, and use the API call Set Parameter Value VI. I can live with 1D array, however the API seems to play more tricks here: 

 

If the instance is set to accept 1D array, it is in fact used to set multiple parameters at once, so not why I am looknig for. The other instance accepts a 2D array, with a single parameter name, which indicated that our parameter is a 2D array object, however the build model fails to build such array...

 

So how can I set a single parameter 1D array? I could "up" 1D array as a 2D array and pass it to the API call, but still the model does not let me build a 2D array as described above.

 

set parameters.png

 

Thx,

 

L.

 

 

VS 2011.0.0.201

LV 2011

Win 7 - 32

0 Kudos
Message 1 of 19
(7,729 Views)

Hello L,

 

Models in control systems are usually single point.  This is how Veristand was designed.  Can you maybe tell me a little bit more about why you want to pass in an array?  Channels can only be scalar values, so how would you pass an array into your model?

 

Regards,

Matt M.

Applications Engineer
National Instruments
0 Kudos
Message 2 of 19
(7,713 Views)

Hi Matt,

 

See this post for a backgrounder.

 

Single-point for a model iteration, yes I agree, but a lookup table could be a 1D or 2D array, and the model using it at run time to get a single-point every time.... Why if there is no way of passing 2D parameter to VS, does the API offers a 2D array parameter with a a single parameter name, hinting at the a parameter that is a 2D array ?

 

0 Kudos
Message 3 of 19
(7,708 Views)

Hi L,

 

Here is the help topic on Models in Veristand:  http://zone.ni.com/reference/en-XX/help/372846C-01/veristandmerge/gen_vs_model/

 

Note  NI VeriStand supports the following data types for model inports, outports, and parameters:

  • Numerics
  • Booleans
  • 1D arrays of numerics
  • 1D arrays of Booleans
  • Clusters containing the preceding data types

You cannot use a 2D Array as an input.  You can have a 2D array parameter that is created at runtime (using the stated VIs), but you cannot pass in a 2D array to the model.

 

Also, the 1D array input creates multiple channels one for each value in the array, that is how Veristand works in passing the values, since channels are all scalars.

 

I read your previous post.  You will have to generate the lookup table at run-time based on some paramters, or have it be a constant in your model.  There's no way to pass it in to the model

 

Regards,

Matt M.

Applications Engineer
National Instruments
0 Kudos
Message 4 of 19
(7,701 Views)

This is really limiting.

I just want to pass a 1D array to manipulate it as described in the previous post. Again, this would be no problem simply using RT.

 

How does what is described in the help here can then be interpreted ? Isn't it about a 2D parameter with 1 single name parameter, implying my parameter is a 2D object?

 

L.

0 Kudos
Message 5 of 19
(7,699 Views)

Hi L,

 

A parameter is not just what is passed into the model.  It can also be used as a data storage object while the model is running.  You can create a 2D array parameter using that VI, and then get those values somewhere else in your code without passing the 2D array around.  You can also get the value of that 2D parameter outside the model using the API, so the value can be created/read, but you cannot pass a 2D array into the model to start with.

 

1D arrays become lists of channels in Veristand because channels are double values, and there's no way to create a channel that is an array.  This means that there would be no way to pass an array into the model.

 

Is it possible for you to generate the lookup table programatically at run-time on the first iteration of the model, or, if you can't generate it, just create a constant that is the lookup table?

 

Regards,

Matt M.

Applications Engineer
National Instruments
0 Kudos
Message 6 of 19
(7,693 Views)

WIth a constant 1D array it works. It is just that it is not great to choose a set of these constant at runtime without hardcoding things... I can have a parameter numeric (1,2,3..) pointing to a differrnt lookup table, but this is not the best way to do it... ideally you could pick a lookup table somewhere.

 

Passing it as a parameters appears a no go as you describe, soI tried to read the lookup table from a file on the RT side, but so far no luck. Is there any trick in reading a file on located on the RT computer,  from a model? 

L

0 Kudos
Message 7 of 19
(7,688 Views)

Reading a file on RT is pretty much the same as on a normal PC.  The caveat is how pathing works.  Refer to this KB for the details on how to read files on Real-Time Systems: http://digital.ni.com/public.nsf/allkb/BBCAD1AB08F1B6BB8625741F0082C2AF?OpenDocument

 

cRIO-900x, cRIO-908x, Real-Time Desktop PCs, and all PXIs run Pharlap.  All other Compact-Rios run VXWorks.

 

Regards,

Matt M.

Applications Engineer
National Instruments
Message 8 of 19
(7,686 Views)

To clarify, the file is located on a RT machine, and would be read from a Veristand Model.  On the FTP interface the file is located under c:\temp\ACLookup, for instance:

c:\temp\ACLookup\lookup.csv.  Can this very same path be used in a path constant in the model?

0 Kudos
Message 9 of 19
(7,683 Views)

Yep, the model is running on the controller, so it should reference paths just like that (c:\temp\ACLookup\lookup.csv).

 

Matt M.

Applications Engineer
National Instruments
0 Kudos
Message 10 of 19
(7,680 Views)