10-13-2011 02:43 PM
Hi,
I have a very simple model that can do three things as defined by a ModelAction control: it either have the input directly fed through the ouput, or adds noise, or multiplies the input by 0.5 and substract noise.
If I defined ModelAction, Signal Input, and Noise Level (&) as Required in the connector pane, all three appear as Model Inputs in the VS System Def. file.
ModelAction would be user-defined, same for the noise level. For the signal input it could either be a user-defined, or an actual AI channel.
This is where I am getting somewhat confused. Shouldn't model inputs always be linked to hardware channels? And parameters to user controls?
From the VS Workspace, I can drop controls linked to all 3 : ModelAction, Signal Input, and Noise Level (&) and run the model.
In the LV API though, one can only access model parameters.
So I presume I would have to use the Workspace API to Set a Channel instead if it was defined as a Required/Model Input.which may be counter intuitive...
So in short: should Model inputs only used for hardware inputs only?
and also: Is it possible to dynamically, assign a channel (hardware or otherwise) to a model input?
Thx.
L.
10-13-2011 11:30 PM
10-19-2011 12:44 PM - edited 10-19-2011 12:45 PM
Following up on this, where you say that Parameters can be set from the Calibration controls: I have one parameter defined in a LV Model.
The parameter appears in the VS system explorer tree as a parameter. So all good.
On the VS workspace though, the Model Calibration Control pops up a windows with "Available Calibration", but it is empty. I was expecting seeing my parameters in there. What am I missing ?
Thx
L.
10-19-2011 01:09 PM
You might have to be running to see the list of available parameters. Not sure.
Also, make sure you have "added" the parameter to the system definition. Clicking parameters in the tree and seeing it as available in the right pane is not enough. you must then click it and say add.
10-19-2011 02:19 PM
Ah yes, you are right... It works, sort of, as I have one of the parameters that does not seem to have its changes taken into account, only the one that is only supposed to be used a t0, this being built-in the LV model...
Generally speaking, are parameters only taken into account when the model initialized / Start ?
...It may be easier for what I do to just treat all LV model controls as Inputs...
L.
10-19-2011 02:31 PM
Parameters can be changed when your model is running. If it's not working correctly, I expect it's probably how you are using this value in your LabVIEW code. For example, if this value is being used to set the initial value of a feedback node, it will only actually have an effect on the first iteration of your model, and changing it at run-time won't affect anything.
10-19-2011 02:42 PM - edited 10-19-2011 02:51 PM
I suspect something possibly wrong at the level you describe.
However that very same parameter was previously used as an input, and accessed via a control on VS workspace and it worked fine. Nothing has been changed on the LV code, except making the "Required" - "Recommended" change in the connecting pane to change my controls from "Input" to "Parameter" respectively.
At every iteration the parameter should be read and acts on the model output. Here is what the model looks like:
CurrentIn_A (Inputs) and CurrentAccumulationCoeff (Parameter) should be changeable on the fly. VoltageIn_t0 is the second paramter that is taken into account only once.
Laurent
10-19-2011 04:27 PM
You don't need the while loop since you're not using shift registers. Would make your code cleaner and potentially better performing without it.
Note that you cannot select parameters from numeric controls, only from model calibration controls. Also, check to see if the parameter is in the list inside tools -> model parameter manager.
Can you post your VI?
10-19-2011 04:29 PM
Actually, I didn't read enough of the thread. Sorry.
Devin is correct, the only reason your parameter is only read once is because it is going into the initial value of the feedback node. You probably don't want to be doing that. Just remove the feedback node for that and the whole while loop.
10-19-2011 06:18 PM - edited 10-19-2011 06:18 PM
ah... yes the while loop is useless now.
My initial post is missing one sentence... I agree with you on why this paramter is read once. The ones that did not make sense though - and that is what was missing from the previous post - is the CurrentAccumulationCoeff (Parameter).
L.