NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to release process model sequence file object?

Calling engine's method GetStationModelSequenceFile we get the reference to the process model sequence file object. According to TestStand Help, you should "Release this reference when you are done using it." The question is: how do you release it? Call engine's method ReleaseSequenceFileEx passing the reference to the model sequence file gotten from GetStationModelSequenceFile won't work, it returns FALSE which means the sequence file can't be released. Similar problems exist with methods SequenceFile.GetModelSequenceFile, Execution.GetModelSequenceFile. My aplication is written in VB. Using the statement like
Set modelSequenceFile = Nothing also does not solve the problem.  I want to get some information of process model, such as version number, so I call those API functions in my code, which was developed under TestStand 3.1. I post this question because when I ran my application with TestStand 3.5 or 4.0 beta, I got the warning dialog when loading a sequence file and then closing the application. The dialog listed all the unreleased objects which I figured out is due to that the process model file was not released. Because message in the dialog is as following:
 
The following top-level objects were not released:
        Sequences [1 object(s) not released]
            Sequence #1:
                Name: Test UUTs

        Type Definitions [43 object(s) not released]
            Type Definition #1:
                Name: TimeDetails
            Type Definition #2:
                Name: ReportOptions
 
         ....
 
Of course there are more in the list, but the sequence file loaded into the application is released correctly by calling engine's method ReleaseSequenceFileEx, so it does not appear in the list.
 
Any help will be greatly appreciated.
0 Kudos
Message 1 of 5
(3,589 Views)
Hi maplebridge,

What happens when you call either of the following functions on your sequence file?

Engine.CanUnload

Engine.IsExecuting

Also, is it possible that you could have multiple load references to the sequence file as discussed in the TestStand help?

Regards,
0 Kudos
Message 2 of 5
(3,562 Views)

Here are what I did after launch the operator interface:

1) Call Engine.GetSequenceFileEx to get a reference to a sequence file.

2) Display steps of MainSequence of the sequence file in GUI.

3) Call Engine.GetStationModelSequenceFile to get a reference to the station process model sequence file. The variable used to save the reference of process model sequence file is modelSequenceFile.

4) Loop through all the sequences in process model sequence file, get the references of entrypoint sequences in the process model and put them in a container (VB Collection).

At this point,

Calling modelSequenceFile.CanUnload returns TRUE

Calling modelSequenceFile.IsExecuting returns FALSE

Calling Engine.ReleaseSequenceFileEx(modelSequenceFile, ReleaseSeqFile_UnloadFile) returns FALSE

There is no other loaded process model sequence file reference at this point.

0 Kudos
Message 3 of 5
(3,556 Views)
Releasing a reference depends on the environment you are using.  If you are using VB, you would set the variable to Nothing.

For the particular method you describe, GetSTationModelSequenceFile, you do not need to call ReleaseSequenceFileEx.  This is only neccesary if you called GetSequenceFileEx or NewSequenceFile.

When ReleaseSequenceFileEx returns false, it does not mean that the sequence file cannot be released.  It is just informing you that there are still load references to the sequence file in use, or the file is executing an unload callback.  Since you are trying to release the station model, the engine is still holding a load reference.  This is not anything to worry about.

The dialog describes that Sequences are not being released, which is different than a SequenceFile.  Are there any places in your code where you are getting Sequence objects?

Allen P.
NI
0 Kudos
Message 4 of 5
(3,550 Views)

Thanks for the hint, Allen. It turns out that the references of entry point sequences of process model file are held in a VB collection entryPointSequences. The code to release these sequences is taken over from operator interface for TestStand v2, probably from NI's operator interface example:

Set entryPointSequences = New Collection

This code does not really release the sequences in the container. I have to loop through each reference of sequence to set it to Nothing:

For i =1 to entryPointSequences.Count

    Set entryPointSequences(i) = Nothing

Next i

This eliminates the warning of unreleased objects.

0 Kudos
Message 5 of 5
(3,535 Views)