1


Example heading with h2 size

Example heading with h3 size

Following is sample java co'':

import sys
import os
import time
from win32com.client import Dispatch
import globals

# Ensure the clr module is available
try:
    import clr
except ImportError:
    raise ImportError("The clr module requires pythonnet. Install it with 'pip install pythonnet'.")

# Adding .NET references
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)

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

        return globals.DemoMAPort, globals.MyValueFactory

    except TestbenchPortException as ex:
        print("A TestbenchPortException occurred:")
        print(f"CodeDescription: {ex.CodeDescription}")
        print(f"VendorCodeDescription: {ex.VendorCodeDescription}")
        raise

def tearDown():
    if globals.DemoMAPort is not None:
        globals.DemoMAPort.Dispose()
        globals.DemoMAPort = None