Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling CANoe TestCases in LabVIEW over ActiveX

Solved!
Go to solution

Hi,

 

I want to run CANoe TestCases in LabVIEW using ActiveX.

Handling envVars and sysVars in CANoe was not a big deal and there are a lot of examples here.

But handling TestCases is quite difficult. The CANoe help file shows this way in the object hierarchy:

 

Application

Configuration

TestSetup

TestEnvironments

TestEnvironment

TestModules

TSTestModule

TestSequence

TestCase

 

But I didn't find any way to realize it. I ended up in the following:

 

IApplication3

IConfiguration4

ITestSetup

ITestEnvironments

ITestEnvironment

ITestSetupItems

ITestSetupItem

 

 

 

 

 ITestSetupItem is an object without any methods. I don't know how to access the TestCases without the linking objects in between.

 

Greetings,

Ludwig.

0 Kudos
Message 1 of 7
(9,749 Views)
Solution
Accepted by Ludwig72

I've solved the problem with the help of Vector Support. They send me the following C# Example:

            CANoe.Application mApp = new CANoe.Application();
            CANoe.Configuration mConf = (CANoe.Configuration)mApp.Configuration;
            CANoe.TestSetup mTestSetup = (CANoe.TestSetup)mConf.TestSetup; //Test SetUp Window
            CANoe.TestEnvironments mTestEnvs = (CANoe.TestEnvironments)mTestSetup.TestEnvironments;
            CANoe.TestEnvironment mTestEnv = (CANoe.TestEnvironment)mTestEnvs[1]; // Test Environment (*.tse File)
            Console.WriteLine("Name " + mTestEnv.Name);

            CANoe.TestSetupFolders mTestSetupFolders = (CANoe.TestSetupFolders)mTestEnv.Folders;
            CANoe.TSTestModule mTSTestmodule = (CANoe.TSTestModule)mTestEnv.TestModules[1];
            Console.WriteLine("Name " + mTSTestmodule.Name);

            CANoe.TestSequence mTestSequence = (CANoe.TestSequence)mTSTestmodule.Sequence;
            Console.WriteLine("TestSequence Count " + mTestSequence.Count);
            CANoe.TestCase mTestCase = (CANoe.TestCase)mTestSequence[1];
            Console.WriteLine("Testcase Name " + mTestCase.Name);
            mTestCase.Enabled = false; // deactivate testcase - XML and structured NET module only.

            //CANoe.TestReport mTestReport =(CANoe.TestReport) mTSTestmodule.Report; // Access To report

            CANoe.Measurement mMeasurement = (CANoe.Measurement)mApp.Measurement;
            if (!mMeasurement.Running)
                mMeasurement.Start();
            
            mTSTestmodule.Start();

 I've realized that you can cast ActiveX object references to another child class in the following way:

Casting.png

 

This was the correct solution and I want to share it with you. 

Message 2 of 7
(9,510 Views)

Hello Ludwig72,

I know this post is very old but i'm very new to active X with LabVIEW. Can you please share me some sample code.It will be so helpful.

 

Thanks

0 Kudos
Message 3 of 7
(5,031 Views)
Solution
Accepted by Ludwig72

@sunny7569650 wrote:

Hello Ludwig72,

I know this post is very old but i'm very new to active X with LabVIEW. Can you please share me some sample code.It will be so helpful.

 

Thanks


Here you are:

CANoe.png

0 Kudos
Message 4 of 7
(5,012 Views)

Thank You @Ludwig72

0 Kudos
Message 5 of 7
(5,004 Views)

hello. Ludwing72,

do you know is there any method to load CANoe.RTCFG file with Labview programming?

the VECTOR device will work in standalone mode. I just want to load the .rtcfg file to device with labview. 

could you please share any experiences if you know about it?

thank you.

0 Kudos
Message 6 of 7
(57 Views)

Hello,

As you can see from the date of the last post, this thread is from 2019. Since then, I haven't been working with the CAN protocol anymore.

My experience back then was that NI couldn't keep up with the development of the CAN protocol. Unfortunately, there wasn't much support from NI's side on this matter.

I had to program most of the functionality myself - initially even the CAN interface itself, until NI caught up.

For this reason, it proved to be more practical to use the Vector CANoe API and control it remotely via ActiveX.

As for the current state of driver support for CAN, I'm afraid I can't say, as I'm now working on different topics.

Best regards Ludwig.

0 Kudos
Message 7 of 7
(36 Views)