06-22-2012 01:11 PM
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.
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.
Win 7 - 32
06-25-2012 11:35 AM
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?
06-25-2012 11:47 AM - edited 06-25-2012 11:49 AM
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 ?
06-25-2012 12:00 PM
Here is the help topic on Models in Veristand: http://zone.ni.com/reference/en-XX/help/372846C-01
Note NI VeriStand supports the following data types for model inports, outports, and parameters:
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
06-25-2012 12:04 PM - edited 06-25-2012 12:08 PM
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?
06-25-2012 12:17 PM - edited 06-25-2012 12:17 PM
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?
06-25-2012 12:55 PM
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?
06-25-2012 01:03 PM
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/BBCAD1AB08F
cRIO-900x, cRIO-908x, Real-Time Desktop PCs, and all PXIs run Pharlap. All other Compact-Rios run VXWorks.
06-25-2012 01:07 PM
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?