minute read
Active Parameters
You are reading our Automation1 API documentation for the .NET programming language.
The Basics
In the .NET API, Parameters lets you get and set active controller parameters on the Automation1 controller. Controller parameters dictate how the controller behaves and they are categorized into axis, task, and system categories:
- Axis controller parameters depend on the electrical and mechanical devices that make up an axis. They configure things like units, axis names, and jog speeds.
- Task controller parameters configure things like task-based coordinated motion.
- System controller parameters configure things like memory allocation and communication.
See The Three Controller Categories: Axis, Task, and System for more information.
Controller Parameters That You Can Adjust at Runtime
Typically, it is not necessary for you to change the active controller parameters. The parameters that Machine Setup configures for you are almost always the best ones to use. But you can adjust most of the controller parameters at runtime, such as the servo loop gains.
The changes that you make to active controller parameters have an effect immediately, but they are not permanent. This occurs because the values that you specify for these parameters are erased after you reset the controller. To permanently save your changes to the controller parameters, use the Configured Parameters controller feature under Configuration.
Controller Parameters That You Cannot Adjust at Runtime
There are some controller parameters that you cannot change at runtime. You must change them in the configured parameters. Then reset the controller for these changes to have an effect.
Controller Parameter Data Types
Controller parameters have different data types. They are as follows:
- 32-bit integers,
- single-precision floating-point numbers,
- double-precision floating-point numbers,
- strings.
How to Use
In the .NET API, Parameters is part of the Controller.Runtime property. For all the APIs that operate under this property, the Automation1 controller must be running before you can get or set the active controller parameters. For more information about this property, see the Controller page.
First, access the Controller.Runtime.Parameters property. All the controller parameters are categorized into axis, task, and system categories:
- Axis controller parameters require you to specify the axis from which to get the parameter. You can specify an axis by its axis name or axis index.
- Task controller parameters require you to specify the task from which to get the parameter. You can specify a task by its task name or task index.
- The Automation1 controller is the only system. The System property does not require you to specify a system from which to get or set the parameters.
You can access specific controller parameters by using the Axis, Task, and System properties.
controller.Runtime.Parameters.Axes[string axisName]
controller.Runtime.Parameters.Tasks[string taskName]
controller.Runtime.Parameters.System
In each category, parameters are further organized into groups for convenience and filtering. See The Three Controller Categories: Axis, Task, and System. You can access the controller parameters through these groups. Or you can ignore these groups and use the collection of all the controller parameters.
To get or set the value of a controller parameter, use the Value property. If you go through the parameter groups, this property will be strongly typed. If you go through the collection of controller parameters, this property will not be typed and will return an object reference.
double value = controller.Runtime.Parameters.Axes[string axisName].Motion.MaxJogSpeed.Value;
object value = controller.Runtime.Parameters.Axes[string axisName][AxisParameterId axisParameterId].Value;
Example Code
// Get the value of the MaxJogSpeed active controller parameter through the Motion parameter group.
double maxJogSpeedValue = controller.Runtime.Parameters.Axes["X"].Motion.MaxJogSpeed.Value;
// Set the value of the MaxJogSpeed active controller parameter through the collection of all the axis parameters.
controller.Runtime.Parameters.Axes["X"][AxisParameterId.MaxJogSpeed].Value = 1.0;
Thread Safety
All the methods and properties that operate under the Controller.Runtime.Parameters property are thread safe. You can call them from two or more threads without interference.