1

I am trying to automate and create a Canoe simulation.

My usecase :

I have a configuration (LibraryTest.cfg) with a CAN Network and a node ACAN in the network. I want to create another node BCAN automatically into the existing configuration along with ACAN. I am trying this using C# .NET Canoe Library for this.

        CANoe.Application mApp;
        CANoe.Measurement mMsr;
        CANoe.Networks mNet;            
        mApp = new CANoe.Application();

        string ConfigFile= 
      "C:\\Users\\deepasreeraj\\Desktop\\GAC\\TestUnit1\\LibraryTest.cfg";
        try
        {
            mApp.Open(ConfigFile, true, true);
            mMsr = (CANoe.Measurement)mApp.Measurement;
            mNet = mApp.Networks;
            CANoe.Simulation mSim = mApp.Simulation;        

            if (mNet != null)
            {
                if(mNet != null)
                {
                    int count = mNet.Count;
                    for (int i = 0; i < count; i++)
                    {
                        mNet.Add("BCAN");
                        string Nodename = mNet[i].NetworkInterfaces;
                    }                    

                }
            }
        }
        catch (System.Exception ex)
        {
            System.Console.WriteLine(ex.Message);
        }
    }

In this, while the code reaches mNet.Add("BCAN"); it gives an exception "The method or operation is not implemented." Can someone please help me with this?

dan1st
  • 12,568
  • 8
  • 34
  • 67
hellogeek
  • 13
  • 6

1 Answers1

1

If you want to add a node, the Networks property is wrong.

You have to use mApp.Configuration.SimulationSetup.Buses.Nodes. There you can call Add to add a new node.

Just check the page Technical References -> COM Interface -> Object Hierarchy in the CANoe help for the complete API Reference.

MSpiller
  • 3,500
  • 2
  • 12
  • 24
  • Hi , Thanks a lot. That solved my proble. I was wondering where do we have the Technical References -> COM Interface -> Object Hierarchy ? All I have got is https://assets.vector.com/cms/content/know-how/_application-notes/AN-IND-1-011_Using_CANoe_NET_API.pdf . Could you please tell me if there is any other document as well? Thanks in advance – hellogeek May 30 '19 at 05:51
  • It’s part of the CANoe help. Just hit F1 – MSpiller May 30 '19 at 06:31
  • I have found them. Thanks a lot :) – hellogeek May 30 '19 at 08:51
  • I was just wondering if you know about any API or script for automating the Import Canoe System Environment and Symbols and build the vTestStudio project as well? – hellogeek Jun 04 '19 at 09:33