This guide provides step-by-step instructions on how to create a mechanical closed-loop system using the API and the PMP simulator.
During this guide you will learn how to:
Create a position controller using a predefined template provided by PMP.
Create a second-order mechanical plant using a predefined template provided by PMP.
Interconnect all components to establish a closed-loop system.
Configure control parameters and limits.
Use a configuration XML file to upload pre-configured settings.
Use an axis command sequence to perform a relative move.
Configure a scope and trace the behavior of the simulated plant.
In a mechanical closed-loop system, a feedback tracking device is used to transmit the output signal of a plant to a controller to account for expected errors.
The controller evaluates the error between the setpoint command and the actual feedback of the plant and adjusts the system behavior accordingly.
A typical mechanical closed-loop system can be described as follows:
In this guide a simulated mechanical plant model is used.
Since we are using a simulated system, all of the required components can be created and controlled under a logical axis control provided by the Arcas 5EG top-controller.
Axis control - A container for all functionality required to control an axis.
Setpoint - Position reference value, which is commanded by the user and calculated by the axis control trajectory interpolator.
Position controller - A position feedback controller, which automatically adjusts and reacts to the calculated error between the setpoint and the mechanical plant output.
Mechanical plant - Representation of the mechanical system, which includes an actuator and sensor model.
Note
All of the above components can be created using the API.
However, in this guide a configuration XML file is used to configure the different components (except the top-controller, which is configured using a controller description XML file).
This reduces API calls, allows quicker initialization of the system and quicker configuration of multiple top-controllers.
Before continuing with the quick-start guide, please make sure that the following prerequisites are met:
PMP should be installed with Simulator and Tooling features.
Follow the Installation quick-start guide if this is not yet the case.
A Typical installation includes the required Simulator and Tooling features.
The closed-loop system quick start project files should be available.
These files can be downloaded from Downloads.
System description file:
A system description file system.xml, which describes the system properties and includes the controllers’ description.
Controller description file:
A top-controller (Arcas) controller_arcas_5eg.xml, which describes the controller’s main properties, such as templates, number of axes, processing blocks, updatables, and more.
A sub-controller (Arcas FPGA) controller_arcas_5eg_slave, which includes digital IOs.
Configuration file:
A configuration file configuration.xml, which is used to configure a controller.
Position controller processing block binary:
A simple position controller processing block binary PositionControlSimple-windows-x86_64.bin, which is used to control the position set-points.
Mechanical plant processing block binary:
A second order mechanical plant processing block binary PlantSecondOrderMechanical-windows-x86_64.bin, which is used to simulate a mechanical plant.
First, it is required to establish a connection with a top-controller.
In this guide, the simulated system of the Create a simulator quick-start guide is used.
If not already the case follow the Create a simulator quick-start guide to the point where the Arcas 5EG-1 is first started and in Config state.
Note
It is also possible to follow this quick-start guide on a physical Arcas 5EG controller.
As an additional prerequisite make sure the processing block binaries for the physical controller are available, i.e. PositionControlSimple-bb-armv8a_64.bin and PlantSecondOrderMechanical-bb-armv8a_64.bin
So far, we defined a configuration XML file to instantiate an axis control, a mechanical plant, and a position control processing block.
To create a closed-loop system, it is required to establish connections between the different axis control functionalities.
The connections define the information exchange between the components.
Based on the connections PMP can determine the order in which the components need to be calculated.
Component interconnections shows the required connections to form a minimal closed-loop system.
To establish a connection, each signal indicated with a needs to be connected to it’s corresponding input indicated with a .
In Component interconnections it can be seen that a signal of PositionControl is connected to an input of Plant and a signal of Plant is connected to an input of PositionControl.
These connections create a circular dependency.
To indicate to PMP which processing block needs to be calculated first the CalculationStart attribute of the Plant processing block needs to be set to True.
The control parameters of the TrajectoryGenerator, PositionControl and Plant need to be configured to perform (simulated) closed loop motion.
For this guide the position controller is configured as a PD controller and the plant as a mass with viscous friction.
So far we have learned how to create and instantiate templates, interconnect the components and configure signals values using a configuration XML file.
The following code can be used to apply the configuration XML on the controller:
The acquisition closed-loop-system-relmove.msf file can be found in the project folder and opened in the PMP Tooling.
The relative move sequence should look as follows:
In case no additional usage of the controller is required, the simulation can be cleaned up.
To dispose/destroy the simulator, the following code can be used: