minute read

Configuration

You are reading our Automation1 API documentation for the .NET programming language.

The Basics

In the .NET API, Configuration lets you change various aspects of the controller behavior. These changes do not have an effect until the next controller reset.

Aerotech recommends that you use Machine Setup in Studio to configure your controller. See the Configure Workspace page.

You can configure the following items for your Automation1 controller through the .NET API:

  • 1D Calibration
  • 2D Calibration
  • Controller Name
  • Controller Start Up
  • Galvo 2D Calibration
  • Galvo Power Correction
  • HyperWire Card
  • HyperWire Communication
  • Parameters
  • Program Automation

How to Use

All configuration items are accessed through the Controller.Configuration property. Each configuration item has a corresponding property that then has GetConfiguration and SetConfiguration methods. You can get a configuration item, inspect it, modify it, and set it. If a configuration item has never been set, the GetConfiguration method will throw an exception. Refer to the example that follows.

Copy
CalibrationFile calibrationFile1D = controller.Configuration.Calibration1DFile.GetConfiguration();
CalibrationFile calibrationFile2D = controller.Configuration.Calibration2DFile.GetConfiguration();
ConfiguredParameters configuredParameters = controller.Configuration.Parameters.GetConfiguration();
ConfiguredProgramAutomation configuredProgramAutomation = controller.Configuration.ProgramAutomation.GetConfiguration();
 
controller.Configuration.Calibration1DFile.SetConfiguration(CalibrationFile value);
controller.Configuration.Calibration2DFile.SetConfiguration(CalibrationFile value);
controller.Configuration.Parameters.SetConfiguration(ConfiguredParameters value);
controller.Configuration.ProgramAutomation.SetConfiguration(ConfiguredProgramAutomation value);

Configured Parameters

Controller parameters dictate how the controller behaves and they are categorized into axis, task, and system categories. See The Three Controller Categories: Axis, Task, and System. Axis controller parameters configure things like units, axis names, and jog speeds and are dependent on the electrical and mechanical device that make up that axis. Task controller parameters configure things like task-based coordinated motion. System controller parameters configure things like memory allocation and communication.

In general, you should not need to change the controller parameters that are already configured. Usually, the parameters that Machine Setup gives you are what you will always want to use.

Changes to Active Parameters are not persisted and the active controller parameter values are lost after a controller reset. You can change most of the controller parameters at runtime. But there are some parameters that you can change only in the configured parameters. These parameters require a controller reset before they have an effect.

Controller parameters have different data types. They are either 32-bit integers, single-precision floating-point numbers, double-precision floating-point numbers, or strings.

Example Code

This example program shows you how to do the operations that follow:

  • Get the currently configured parameters from your controller.
  • Change the values of configured parameters.
  • Set the configured parameters on your controller.
Copy
// Get the current configured controller parameters. This will throw an exception if parameters are not configured.
ConfiguredParameters configuredParameters = controller.Configuration.Parameters.GetConfiguration();
 
// Modify X axis MaxJogSpeed.
configuredParameters.Axis["X"].Motion.MaxJogSpeed.Value = 1.0;
 
// Set the modified controller parameters to be used on the next controller reset.
controller.Configuration.Parameters.SetConfiguration(configuredParameters);

Configured Program Automation

In the .NET API, Configured Program Automation gives you a way to:

  • Configure compiled AeroScript programs to load or run automatically on a task when the controller starts.

  • Configure AeroScript source files to be included automatically when compiling other AeroScript programs and libraries.

  • Configure AeroScript libraries to be loaded and automatically imported when compiling other AeroScript programs and libraries.

Configured Program Automation in the .NET API uses the ConfiguredProgramAutomation class. You can construct a new instance of this class, or you can use the Controller.Configuration.ProgramAutomation.GetConfiguration() method to get an instance of this class that has the current program automation configuration of the controller.

To configure an AeroScript program to automatically load or run on a task when the controller starts, add a new ConfiguredProgramAutomation.CompiledProgram instance to the ConfiguredProgramAutomation.CompiledProgramsToLoad or the ConfiguredProgramAutomation.CompiledProgramsToRun list. A compiled program must be loaded or run on a task. One task cannot load or run more than one compiled program at a time.

To configure an AeroScript source file to be included automatically during AeroScript compilation, add a new ConfiguredProgramAutomation.ProgramSourceFile instance to the ConfiguredProgramAutomation.ProgramSourceFilesToInclude list. If you include an AeroScript source file, you will expose all preprocessor directives defined in the source file to the program being compiled. For more information, see the Preprocessor page.

To configure a compiled AeroScript library to be loaded onto the controller, add a new ConfiguredProgramAutomation.CompiledLibrary instance to the ConfiguredProgramAutomation.CompiledLibrariesToLoad list. When a compiled AeroScript library is loaded onto the controller, it can be imported dynamically. For more information, see Libraries. When you create the ConfiguredProgramAutomation.CompiledLibrary instance and shouldAutoImport is set to true, the compiled library will import automatically during AeroScript compilation.

Example Code

This example program shows you how to do the operations that follow:

  • Get the currently configured program automation from your controller.
  • Add new compiled programs, source files, and compiled libraries.
  • Set the configured program automation on your controller.
Copy
// Get the current configured program automation from the controller. This will throw an exception if Program Automation is not configured.
ConfiguredProgramAutomation configuredProgramAutomation = controller.Configuration.ProgramAutomation.GetConfiguration();

// NOTE: The following code modifies the currently configured program automation. If you wish to start from scratch, create a new ConfiguredProgramAutomation instance.

// Add a compiled program to automatically run on task 2 whenever the controller starts.
configuredProgramAutomation.CompiledProgramsToRun.Add(new ConfiguredProgramAutomation.CompiledProgram("/compiledprogram.a1exe", 2));

// Add a program source file to automatically include during AeroScript compilation.
configuredProgramAutomation.ProgramSourceFilesToInclude.Add(new ConfiguredProgramAutomation.ProgramSourceFile("/sourcefile.ascript"));

// Add a compiled library that will be automatically imported during AeroScript compilation.
configuredProgramAutomation.CompiledLibrariesToLoad.Add(new ConfiguredProgramAutomation.CompiledLibrary("/compiledlibrary.a1lib", true));

// Set the configuration on the controller.
controller.Configuration.ProgramAutomation.SetConfiguration(configuredProgramAutomation);

Thread Safety

The Controller.Configuration property is not thread safe. Only one thread at a time can access this property. If it is necessary for two or more threads to access or modify this property, you must use locks to limit the access.