02-22-2012 10:10 AM - edited 02-22-2012 10:11 AM
General Background:
We are building an application that accesses VeriStand via the .net API (C++).
We managed the complete setup and everything is working well now,
however the question of parameter names keeps confusing us and our customers (they are using our application).
I should mention that we are not users of VeriStand, nor trained, so some of the information might be in your training material.
We have checked your help but there we did not find sufficient information to answer our questions.
I will be referring to 2010/11.
Questions:
What is the name of a parameter? How do I influence the name and the default value?
To illustrate:
Open the system explorer for the sinewave_delay demo you ship.
Navigate to the Sinewave Delay/Targets/Controller/Simulation Models/Models/.
There inspect the Parameter nodes for all 4 models.
You see duplicate names, like Order for both delay_random and delay_sineware,
or Amplitude and Bias for both random and sinewave.
When using GetParameterList() of the .net API, you get the following parameters:
Parameter 0: delay_sinewave/z-block/Order
Parameter 1: Amplitude
Parameter 2: Bias
Parameter 3: Frequency
Parameter 4: Gain
Parameter 5: Phase
Parameter 6: delay_random/z-block/Order
So when I set Amplitude, do I set BOTH amplitudes? Or just one?
Where do I set the name of the parameters used in the .net API?
Can I influence it and if not, how are they built?
In the Expression window I can see a close match, but
there I find delay/z-block/Order and delay/z-block/Order,
when in the .net API the "delay" seems substituted with the model instance names.
Right? Wrong?
Currently, any parameter that has the same name has the same value.
Is that a coincidence or are we accessing the same object via a given name?
If so, which name? The one in the .net API?
How is that mapping controlled?
How can I tell, e.g. that there are two Amplitudes with two different values then?
Any help is appreciated!
Regards,
- AJ
Solved! Go to Solution.
02-22-2012 11:13 AM
Good question.
There are two types of parameters inside NI VeriStand. Global parameters that are shared throughout the entire system (similar to The MathWorks, Inc. MATLAB® workspace variables), or there are block parameters that are not global and only apply to that model.
Unfortunatley this isn't documented very well as you noticed, but there is some documentation in the comments of the model frame work C code you can find here if you install the model frame work option of the NIVS installer: "C:\VeriStand\2011\ModelInterface\custom\sinewave\sinewave.c"
// When a model has parameters of the form: "modelname/parameter", these model parameters are considered workspace variables in veristand
// When a model has parameters of the form: "modelname/block/paramter" these model paramters are NOT considered workspace variables in NI VeriStand
// A model should only contain either workspace variables or parameters. Never both.
So for the sinewave delay example the get parameter list shows parameter 1-5 are global and parameter 0 and 6 are local to that specific model.
Depending on what software you are using to create the models... they have different settings for how you want the parameters exposed in the model. For example, in The MathWorks, Inc. Simulink ® software when you configure the model build with The MathWorks, Inc. Real-Time Workshop ® one of the optimization options is to "inline" parameters. If you select this, then you compile in selected workspace variables as parameters. If this is unselected (default), then block variables are the parameters.
02-22-2012 01:15 PM
Hi,
thanks for taking the time to respond!
Are you saying that the distinction between global or local is reflected in the name with or w/o path, respectively?
Indepent of this, what about multiple parameters with the same name (e.g. Amblitude and Bias)?
Are these the SAME parameters with a single value effecting the different components referencing it?
Regards,
- AJ
02-22-2012 01:29 PM
andreas.junghanns@qtronic.de wrote:
Hi,
thanks for taking the time to respond!
Are you saying that the distinction between global or local is reflected in the name with or w/o path, respectively? Yes
Indepent of this, what about multiple parameters with the same name (e.g. Amblitude and Bias)? If they have no block name in the path then they will all be the same.
Are these the SAME parameters with a single value effecting the different components referencing it? Parameters with no block name in the path have unique instances under each model if you look in the system definition tree... but if multiple models have the same parameter name with no block path... they will always have the same value.
Regards,
- AJ