From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TestStand performances running sequence using HMI and calling Engine

Hello,

 

I'm making many tests with TestStand to run the same sequence using the TestStand Editor and calling the Engine with a .NET application.

 

For the same custom step, it takes approximatively 1.5 secondes to run the step starting the sequence calling the engine using a .NET application and only 0.75 secondes running the same step using the TestStand Editor.

 

Here the code calling the sequence using .NET API.

Engine.NewExecution(seqFile, "Single Pass", seqFileModel, false, 0, null, null, null);

 

I don't understand why. What is the difference between the 2 ways ?

 

Best Regards,

CFOE

0 Kudos
Message 1 of 4
(4,573 Views)

Is the main thread of your .NET program (the one that originally created the engine) processing Window messages (i.e. in a run loop of some sort)? When an execution gets created, UIMessages are sent to the main thread of the program using Window messages, so if the main thread is not regularly processing such messages, it could delay the execution of the sequence.

 

Hope this helps,

-Doug

0 Kudos
Message 2 of 4
(4,439 Views)

Hello,

 

Of course the main thread is processing UIMessages messages :

I do it in two ways, the first using the UIMessageEvent and the second polling the UIMessageQueue.

 

        // Constructor        
        public TestStandController()
        {
            _engine = new Engine();
            _engine.LoadTypePaletteFilesEx();
            _engine.UIMessageEvent += new _TEEngineEvents_UIMessageEventEventHandler(_engine_UIMessageEvent);
            InitUIMessagePolling();
        }

        void _engine_UIMessageEvent(UIMessage msg)
        {
            if (msg.Execution != null)
            {
                Trace.WriteLine("Execution id: " + msg.Execution.Id + " - " + msg.Event);
            }
            switch (msg.Event)
            {
                case UIMessageCodes.UIMsg_Trace:
                    Step curStep = CurrentStep(msg);
                    if (curStep != null)
                    {
                        Debug.WriteLine("trace : " + curStep.Name);
                    }
                    break;
                case UIMessageCodes.UIMsg_UserMessageBase:
                    // Reception d'un message utilisateur
                    UserMessageBase(msg);
                    break;
                case UIMessageCodes.UIMsg_EndExecution:
                    // Fin d'exécution d'une séquence
                    EndExecution(msg);
                    break;
                case UIMessageCodes.UIMsg_ShutDownComplete:
                    // Lorsque le moteur d'exécution est arrêté ... on ferme l'application
                    // Todo : A voir quoi faire en fin de shutdown du moteur testStand
                    break;
            }
        }

        private void InitUIMessagePolling()
        {
            _engine.UIMessagePollingEnabled = true;
            _checkStateTimer = new DispatcherTimer();
            _checkStateTimer.Tick += new EventHandler(_checkStateTimer_Tick);
            _checkStateTimer.Interval = new TimeSpan(0, 0, 0, 0, 100);
            _checkStateTimer.Start();
        }

        private void _checkStateTimer_Tick(object sender, EventArgs e)
        {
            while (!_engine.IsUIMessageQueueEmpty)
            {
                UIMessage msg = _engine.GetUIMessage();
                // messages from a execution
                if (msg.Execution != null)
                {
                    FireTsExecutionMessage(msg.Execution.Id, msg.Event);
                }
                msg.Acknowledge();
            }
        }

 

 I don't know if it's the right way to do it.

 

Best regards,

CFOE

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

Boujour tous le monde,

 

 

ma question au cours d'execution de teststand

myExecution = myEngine.NewExecution(mySqFile, "Test UUTs", mySqFile.GetModelSequenceFile(out sDummyString), false, 0, null, null, null);

 je veut veut recuperer a chaque instent la sequence qui est entraint d'exucter de l'afficher dans un listview en c#

est ce que quelqu'un peut m'aider recuperer la sequence en cours d'execution?

 

merci

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