VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Reload Simulation Model via .NET API

We work with many system definition files that share certain models and I would like to be able to programmatically reload a model in each of the system definition files after it's been updated (either a .lvmodel or .dll from Simulink).  Normally, this simply consists of clicking the "Reload Simulation Model" in the System Definition Explorer.  However, with the numerous system defintions that we have, this becomes quite cumbersome.

 

I was able to find the RefreshModelInformation method for the model class but I'm getting an error:

 

Error 1172 occurred at Invoke Node Error calling method NationalInstruments.VeriStand.SystemDefinitionAPI.Model.RefreshModelInformation, (System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 Inner Exception: System.ArgumentException: The path is not of a legal form.)

 

Regardless of the error, I'm concerned that this method will import ALL signals and parameters whereas I need to preserve everything about the original model configuration (e.g. only having select parameters imported in to the system definition).

 

Does anyone have any ideas as to why this method is not working for me?  Or better yet, does anyone know how to duplicate the "Reload Simulation Model" functionality via the .NET API?

 

I have attached my test VI's and VeriStand project.  "Update System Models.vi" is my code where I try to use the "RefreshModelInformation" method. "Extract Model Information.vi" is one I downloaded from the forums (by JarrodS. IIRC).

 

Note:  Using LabVIEW and VeriStand 2013 SP1

0 Kudos
Message 1 of 3
(4,171 Views)

There is a function available in the System Definition API in VeriStand 2015 that does exactly what you want, called ReloadModelFromPath. It does not throw this error, and it just reloads the current configuration of the model, meaning it doesn't import all signals and parameters like you were afraid of. Is upgrading out of the question? (sorry to ask)

Jarrod S.
National Instruments
0 Kudos
Message 2 of 3
(4,161 Views)

As long as the function doesn't change any of the imported parameters then it would work perfectly (i.e. I don't want any new parameters to be imported; changes to the models will rarely affect the interface with VS).

 

However, upgrading is not possible at this point since we have numerous applications and deployments making it very difficult to upgrade anything without significant time (and system downtime) being dedicated to the task.

0 Kudos
Message 3 of 3
(4,153 Views)