OneCompiler

sub

242

Example heading with h2 size

Example heading with h3 size

Following is sample java code.



import clr
import sys, os
import time
from win32com.client import Dispatch

clr.AddReference("ASAM.XIL.Implementation.TestbenchFactory, "
                 "Version=2.1.0.0, Culture=neutral, PublicKeyToken=fc9d65855b27d387")
clr.AddReference("ASAM.XIL.Interfaces, Version=2.1.0.0, Culture=neutral, "
                 "PublicKeyToken=bf471dff114ae984")
clr.AddReference("ASAM.XIL.Implementation.FrameworkFactory, Version=2.1.0.0, "
                 "Culture=neutral, PublicKeyToken=d64b0277da8a2c74")

# Import XIL API .NET classes from the .NET assemblies
from ASAM.XIL.Implementation.TestbenchFactory.Testbench import TestbenchFactory
from ASAM.XIL.Interfaces.Testbench.Common.Error import TestbenchPortException
from ASAM.XIL.Interfaces.Testbench.MAPort.Enum import MAPortState


def setUp():
    global DemoMAPort, MyValueFactory
    MAPortConfigFile = r"D:\AUD_FRAMEWORK\python_files\MAPortConfigSCALEXIO.xml"

    WorkingDir = os.path.dirname(sys.argv[0])
    if not os.path.isdir(WorkingDir):
        WorkingDir = os.getcwd()
    if not os.path.isdir(WorkingDir):
        os.mkdir(WorkingDir)

    MAPortConfigFile = os.path.join(WorkingDir, MAPortConfigFile)

    DemoMAPort = None

    try:

        MyTestbenchFactory = TestbenchFactory()
        MyTestbench = MyTestbenchFactory.CreateVendorSpecificTestbench("dSPACE GmbH", "XIL API", "2018-B")
        MyMAPortFactory = MyTestbench.MAPortFactory
        MyValueFactory = MyTestbench.ValueFactory
        print("Creating MAPort instance...")
        # Create an MAPort object using the MAPortFactory
        DemoMAPort = MyMAPortFactory.CreateMAPort("DemoMAPort")
        print("...done.\n")
        # Load the MAPort configuration
        print("Configuring MAPort...")
        DemoMAPortConfig = DemoMAPort.LoadConfiguration(MAPortConfigFile)
        # Apply the MAPort configuration
        DemoMAPort.Configure(DemoMAPortConfig, False)
        print("...done.\n")
        if DemoMAPort.State != MAPortState.eSIMULATION_RUNNING:
            # Start the simulation
            print("Starting simulation...")
            DemoMAPort.StartSimulation()
            print("...done.\n")

        return DemoMAPort, MyValueFactory


    except TestbenchPortException as ex:
        print("A TestbenchPortException occurred:")
        print("CodeDescription: %s" % ex.CodeDescription)
        print("VendorCodeDescription: %s" % ex.VendorCodeDescription)
        raise


def tearDown():
    if DemoMAPort != None:
        DemoMAPort.Dispose()
        DemoMAPort = None