NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading appropriate process model from specified .env

Solved!
Go to solution

Hi,

 

I have two envs, one is for debug use and the other is for production use. The debug env uses "debug_batchmodel" and the production uses "batchmodel". Is there a way to force TS to use the correct model for the specific env? In other words, I want to use the "debug_batchmodel" when I am in the debug environment and use the "batchmodel" when I am in the production environment. It keeps loading the last model I use.

 

Thank you.

0 Kudos
Message 1 of 5
(1,211 Views)

Add SequenceFileLoad callback to your client sequence.  In the callback, add an if block to check if you are using the debug environment; if you are using the debug environment then using TestStand API set the Engine Station Model to your debug model otherwise set it your production model.

0 Kudos
Message 2 of 5
(1,180 Views)
Solution
Accepted by topic author TTLN4

Hi ee-jallen,

 

Thank you for the quick response...

 

So I added SequenceFileLoad to both batch models (production and debug). Each model will read a .ini file to determine if it should use debug or production but the debug model doesn't get loaded using the statements below. What do you think I am missing? The production model does, however.

 

if debug:

RunState.Engine.StationOptions.AllowOtherModels = True,
RunState.Engine.StationOptions.StationModelSequenceFilePath = "C:\\Project_Path\\Process Model\\BatchModel_DEBUG.seq",

RunState.Engine.StationOptions.UseStationModel = True

 

else:

RunState.Engine.StationOptions.AllowOtherModels = True,
RunState.Engine.StationOptions.StationModelSequenceFilePath = "C:\\Project_Path\\Process Mode\\BatchModel.seq",

RunState.Engine.StationOptions.UseStationModel = True

0 Kudos
Message 3 of 5
(1,158 Views)
Solution
Accepted by topic author TTLN4

Put the callback in your normal client sequence not in the process models.  Also if you have two different environments that can be loaded, you can just check which environment is in use with.

RunState.Engine.GetEnvironmentPath() == "[replace with your path to debug environment file]"

 

I just used your code from your post with a conditional that checks the environment path/file and I was able to branch into the if or the else condition and set different process models.

0 Kudos
Message 4 of 5
(1,155 Views)

Thank you. That works. 

0 Kudos
Message 5 of 5
(1,140 Views)