11-01-2013 09:02 AM
VeriStand 2013 now has the capability to initialize Simulink model parameters (reference: Mapping to Signals and Initial Conditions in a Simulink Model).
The question is: Can this be done via API calls in LabVIEW? I would like the user to be able to select the initialization filename in my Host code.
I have a temporary workaround to have the user selected filename copied to a temporary location/name that is defined in VeriStand System Explorer, but it's certainly not an elegant solution.
Solved! Go to Solution.
11-01-2013 09:52 AM
Currently the only way to change the default parameter values for a system definition is to:
1. Update the system definition to point to a different file.
2. Update the contents of the file that's already pointed to in the system definition.
#2 sounds like the most straightforward recommended approach for your use-case.
One thing that might make your solution slightly easier would be to use the subscript feature in the model parameter initialization file. What you can do is the following:
1. (Optional) Create various model calibration files in advance that you want to test with. Name them sub1.txt, sub2.txt, etc. (Or name them whatever you want.)
2. Configure your system definition to point to an empty model calibration file named Main.txt.
3. Before you deploy your system definition, edit the main.txt file to add the following line (assuming comma-delimited here because it's hard to type tabs in a web browser):
subscript,c:\whatever\sub1.txt
You can also have multiple subscript files if you want to mix and match. Just add additional lines.
The advantages of this approach is:
a) You can easily use pre-prepared model calibration files.
b) You don't have to copy files around
c) The file writing you have to do before deploying is very very simple.