### Install Dependencies Source: https://github.com/mat-docs/atlas.automationapi.examples/blob/master/HelloWorld.python/README.md Install the required Python packages by running this command in your terminal. ```bash pip install -r requirements.txt ``` -------------------------------- ### Setup Python Environment for ATLAS Source: https://context7.com/mat-docs/atlas.automationapi.examples/llms.txt Configures the .NET Core runtime and references necessary ATLAS Automation DLLs. ```python # Python - Complete environment setup import os from time import sleep from pythonnet import load # Load .NET Core runtime with ATLAS runtime config load( "coreclr", runtime_config=r"C:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Host.runtimeconfig.json", ) import clr # Add references to system assemblies clr.AddReference("System.Collections") clr.AddReference("System.Core") clr.AddReference("System.IO") # Add ATLAS Automation DLLs AUTOMATION_API_DLL_PATH = r"C:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Api.dll" AUTOMATION_CLIENT_DLL_PATH = r"C:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Client.dll" if not os.path.isfile(AUTOMATION_API_DLL_PATH): raise Exception(f"Couldn't find Automation API DLL at {AUTOMATION_API_DLL_PATH}.") clr.AddReference(AUTOMATION_API_DLL_PATH) clr.AddReference(AUTOMATION_CLIENT_DLL_PATH) # Import ATLAS modules from MAT.Atlas.Automation.Api.Enums import * from MAT.Atlas.Automation.Api.Models import * from MAT.Atlas.Automation.Client.Services import * # Connect to ATLAS with retry logic application_service_client = ApplicationServiceClient() for i in range(10): try: application_service_client.Connect("MyPythonApp") break except Exception as e: print(f"Unable to connect: {e}. Retrying...") sleep(1) else: raise RuntimeError("Failed to connect to ATLAS.") ``` -------------------------------- ### Get Sets and Create Waveform Display in C# Source: https://context7.com/mat-docs/atlas.automationapi.examples/llms.txt Retrieves all configured sets and creates a new waveform display if one with the specified name does not exist. Ensure sets are configured before running. ```csharp // C# - Get sets and create a waveform display using MAT.Atlas.Automation.Client.Services; // Get all configured sets in the workbook var sets = WorkbookServiceClient.Call(client => client.GetSets()); if (sets == null || sets.Length == 0) { Console.WriteLine("No Sets Configured"); return; } var setId = sets[0].Id; // Get all existing displays var displays = WorkbookServiceClient.Call(client => client.GetDisplays()); // Find existing display or create a new waveform display var display = displays.FirstOrDefault(d => d.Name == "Demo Waveform") ?? WorkbookServiceClient.Call(client => client.CreateDisplay("Waveform", "Demo Waveform")); ``` -------------------------------- ### Read and Process Parameter Data in Python Source: https://context7.com/mat-docs/atlas.automationapi.examples/llms.txt Initializes clients for session and parameter data access. This snippet serves as a starting point for reading telemetry data from session parameters. ```python # Python - Read and process parameter data from MAT.Atlas.Automation.Client.Services import ( SessionServiceClient, ParameterDataAccessServiceClient ) session_service_client = SessionServiceClient() parameter_data_access_service_client = ParameterDataAccessServiceClient() ``` -------------------------------- ### Get Parameters and Create Transient Parameter in C# Source: https://context7.com/mat-docs/atlas.automationapi.examples/llms.txt Demonstrates retrieving session time base, a specific parameter, and adding a transient parameter. Transient parameters are temporary and exist only for the current session. Ensure session and timestamp/value data are available. ```csharp // C# - Get parameters and create a transient parameter using MAT.Atlas.Automation.Client.Services; var sessionId = sessions[0].Id; // Get the session time base (start and end times) var timebase = SessionServiceClient.Call(client => client.GetSessionTimeBase(sessionId)); // Get a specific parameter by name var parameter = SessionServiceClient.Call(client => client.GetSessionParameter(sessionId, "vCar:Chassis")); // Create a transient parameter with identifier, name, description, groups, min, and max values var transientParameter = SessionServiceClient.Call( client => client.AddTransientParameter( sessionId, "vCar2 Demo", // Identifier "vCar2 Demo", // Name "vCar2 Demo", // Description new string[] { "" }, // Groups 0, // Minimum value 800)); // Maximum value // Write calculated data to the transient parameter SessionServiceClient.Call( client => client.AddTimeDataToTransientParameter( sessionId, transientParameter.Identifier, timestamps.ToArray(), values.ToArray())); ``` -------------------------------- ### Get Composite Sessions from Set in Python Source: https://context7.com/mat-docs/atlas.automationapi.examples/llms.txt Retrieves composite sessions loaded into a specific set. This requires a WorkbookServiceClient and SetServiceClient to be initialized. Exits if no sets or sessions are found. ```python # Python - Get composite sessions from a set from MAT.Atlas.Automation.Client.Services import SetServiceClient, WorkbookServiceClient workbook_service_client = WorkbookServiceClient() set_service_client = SetServiceClient() # Get the first available set sets_list = workbook_service_client.GetSets() if len(sets_list) == 0: print("No Sets Configured") exit() set_id = sets_list[0].Id # Get composite sessions loaded in the set sessions_list = set_service_client.GetCompositeSessions(set_id) if len(sessions_list) == 0: print("No Sessions Loaded") exit() session_id = sessions_list[0].Id print(f"Working with session: {session_id}") ``` -------------------------------- ### Configure Display Parameters in VBA Source: https://context7.com/mat-docs/atlas.automationapi.examples/llms.txt Shows how to create a waveform display and manage parameters associated with it. ```vba ' VBA - Add parameters to a waveform display Dim displayService As New DisplayServiceClient Dim workbookService As New WorkbookServiceClient ' Create a new waveform display Dim display As MAT_Atlas_Automation_Api.display Set display = workbookService.CreateDisplay("Waveform", "VBA Demo") ' Add original parameter to the waveform Call displayService.AddDisplayParameter(display.ID, parameter.Identifier) ' Add transient calculated parameter to the waveform Call displayService.AddDisplayParameter(display.ID, transientParameter.Identifier) ' Retrieve all parameters currently in a display Dim displayParameters() As MAT_Atlas_Automation_Api.parameter displayParameters = displayService.GetDisplayParameters(display.ID) ``` -------------------------------- ### Retrieve and Process Session Data in Python Source: https://context7.com/mat-docs/atlas.automationapi.examples/llms.txt Demonstrates fetching session parameters, estimating sample counts, and reading data samples for processing. ```python # Get parameter and timebase parameter = session_service_client.GetSessionParameter(session_id, "vCar:Chassis") timebase = session_service_client.GetSessionTimeBase(session_id) # Estimate sample count for the time range sample_count = parameter_data_access_service_client.GetSamplesCountEstimate( session_id, parameter.Identifier, timebase.StartTime, timebase.EndTime ) # Position cursor at the start of the time base parameter_data_access_service_client.Goto( session_id, parameter.Identifier, timebase.StartTime ) # Read samples parameter_values = parameter_data_access_service_client.GetNextSamples( session_id, parameter.Identifier, sample_count ) # Process data - calculate vCar * 2 data = list(parameter_values.Data) data2 = [element * 2 for element in data] timestamps = list(parameter_values.Time) ``` -------------------------------- ### Automate ATLAS data analysis in MATLAB Source: https://context7.com/mat-docs/atlas.automationapi.examples/llms.txt Initializes service clients, retrieves session data, performs calculations on parameters, and creates transient parameters. Requires ATLAS to be running and the specified DLLs to be accessible. ```matlab % MATLAB - Complete automation example function WCFAPIExample() % Load ATLAS Automation DLLs NET.addAssembly('C:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Api.dll') NET.addAssembly('C:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Client.dll') import MAT.Atlas.Automation.Api.Enums.*; import MAT.Atlas.Automation.Api.Models.*; import MAT.Atlas.Automation.Client.Services.*; % Initialize service clients workbookServiceClient = WorkbookServiceClient; setServiceClient = SetServiceClient; sessionServiceClient = SessionServiceClient; parameterDataAccessServiceClient = ParameterDataAccessServiceClient; displayServiceClient = DisplayServiceClient; % Get first set and session setsList = workbookServiceClient.GetSets(); setId = setsList(1).Id; sessionsList = setServiceClient.GetCompositeSessions(setId); sessionId = sessionsList(1).Id; % Read parameter data parameter = sessionServiceClient.GetSessionParameter(sessionId, 'vCar:Chassis'); timebase = sessionServiceClient.GetSessionTimeBase(sessionId); sampleCount = parameterDataAccessServiceClient.GetSamplesCountEstimate(... sessionId, parameter.Identifier, timebase.StartTime, timebase.EndTime); parameterDataAccessServiceClient.Goto(sessionId, parameter.Identifier, timebase.StartTime); parameterValues = parameterDataAccessServiceClient.GetNextSamples(... sessionId, parameter.Identifier, sampleCount); % Calculate derived parameter data = double(parameterValues.Data); data2 = data * 2.0; timestamps2 = int64(parameterValues.Time); % Create and populate transient parameter groups = NET.createArray('System.String', 0); transientParameter = sessionServiceClient.AddTransientParameter(... sessionId, 'vCar2 Demo', 'vCar2 Demo', 'vCar2 Demo', groups, 0, 800); sessionServiceClient.AddTimeDataToTransientParameter(... sessionId, transientParameter.Identifier, timestamps2, data2); % Cleanup resources workbookServiceClient.Dispose(); setServiceClient.Dispose(); sessionServiceClient.Dispose(); parameterDataAccessServiceClient.Dispose(); displayServiceClient.Dispose(); end ``` -------------------------------- ### Load Sessions in C# Source: https://context7.com/mat-docs/atlas.automationapi.examples/llms.txt Connects to ATLAS and loads sessions from SQL Race databases using connection strings. ```csharp // C# - Load a session from database into a set using MAT.Atlas.Automation.Client.Services; // Connection strings for different database types: // SQL Server: "server=SQLServer\InstanceName;Initial Catalog=databaseName;Trusted_Connection=True;" // SQLite ssn2: "DbEngine=SQLite;Data Source=path\to\file.ssn2;Pooling=false;" // SQLite ssndb: "DbEngine=SQLite;Data Source=path\to\file.ssndb;Pooling=false;" var applicationService = new ApplicationServiceClient( Path.GetFileNameWithoutExtension(AppDomain.CurrentDomain.FriendlyName)); // Load sessions into a set using session keys and connection strings applicationService.Call(client => client.LoadSqlRaceSessions( setId, new[] { "0000-0000-0000-0000-0000" }, // Session keys new[] { @"DbEngine=SQLite;Data Source=C:\data\session.ssn2;Pooling=false;" } )); // Wait for session to fully load var loadedSessions = SetServiceClient.Call(client => client.GetCompositeSessions(setId)); while (loadedSessions.Any(s => string.IsNullOrWhiteSpace(s.Name))) { Thread.Sleep(1000); loadedSessions = SetServiceClient.Call(client => client.GetCompositeSessions(setId)); } ``` -------------------------------- ### Register COM Libraries with regsvr32.exe Source: https://github.com/mat-docs/atlas.automationapi.examples/blob/master/README.md Register the COM host DLLs using regsvr32.exe after dscom registration. This makes the libraries usable from COM clients. ```bash cd C:\Windows\System32\ .\regsvr32.exe "C:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Api.comhost.dll" ``` ```bash .\regsvr32.exe "C:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Client.comhost.dll" ``` -------------------------------- ### Register Atlas Automation API DLLs Source: https://github.com/mat-docs/atlas.automationapi.examples/blob/master/README.md Use these commands to register the API and Client DLLs. Ensure you run cmd.exe as administrator and navigate to the regasm.exe location. ```batch .\regasm "c:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Api.dll" /register /tlb /codebase ``` ```batch .\regasm "c:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Client.dll" /register /tlb /codebase ``` -------------------------------- ### Register COM Libraries with dscom.exe Source: https://github.com/mat-docs/atlas.automationapi.examples/blob/master/README.md Use dscom.exe to export and register COM libraries for ATLAS Automation API. Ensure cmd.exe is run as administrator. ```bash .\dscom.exe tlbexport "c:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Api.dll" --out "c:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Api.tlb" .\dscom.exe tlbregister "c:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Api.tlb" ``` ```bash .\dscom.exe tlbexport "c:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Client.dll" --out "c:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Client.tlb" .\dscom.exe tlbregister "c:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Client.tlb" ``` -------------------------------- ### Unregister COM Libraries with regsvr32.exe Source: https://github.com/mat-docs/atlas.automationapi.examples/blob/master/README.md Unregister the COM host DLLs using regsvr32.exe with the /u flag. This removes the libraries from the registry. ```bash cd C:\Windows\System32 .\regsvr32.exe /u "C:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Api.comhost.dll" ``` ```bash .\regsvr32.exe /u "C:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Client.comhost.dll" ``` -------------------------------- ### Unregister COM Libraries with dscom.exe Source: https://github.com/mat-docs/atlas.automationapi.examples/blob/master/README.md Use dscom.exe to unregister COM libraries. This is typically done before upgrading or removing previous registrations. ```bash .\dscom.exe tlbunregister "c:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Api.tlb" .\dscom.exe tlbunregister "c:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Client.tlb" ``` -------------------------------- ### Unregister Atlas Automation API DLLs Source: https://github.com/mat-docs/atlas.automationapi.examples/blob/master/README.md Use these commands to unregister the API and Client DLLs. Ensure you run cmd.exe as administrator and navigate to the regasm.exe location. ```batch .\regasm "c:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Api.dll" /unregister /tlb ``` ```batch .\regasm "c:\Program Files\McLaren Applied Technologies\ATLAS 10\MAT.Atlas.Automation.Client.dll" /unregister /tlb ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.