Skip to main content

Module plcopen

Module plcopen 

Source
Expand description

One axis as PLCopen motion sees it: the function blocks MC_Power, MC_Home, MC_MoveAbsolute, MC_MoveRelative, MC_Stop and MC_Reset, and of synchronised motion MC_GearIn, MC_GearOut, MC_CamIn and MC_CamOut, as handshake variables, and the axis state machine behind them.

Each axis runs its own profile here and the link streams the positions to the controller with Command::Setpoint, one per setpoint interval, as a PLC drives servo drives over a fieldbus. So axes move independently and at the same time, MC_Stop brakes in the middle of a move, and a new move takes over from the one under way at the position and speed the axis has.

The profile is a trapezoid: velocity, acceleration and deceleration are kept, jerk is not. The controller interpolates linearly between the streamed setpoints, so within one interval the speed is constant anyway. Parameters above the axis limits are cut to the limits.

Synchronised motion (PLCopen Motion Control Part 1): the blocks sit in the slave’s folder and name their master by its axis id (GearIn.Master, CamIn.Master). The slave follows the master’s setpoint (MasterValueSource mcSetValue) in the same setpoint interval, the master moved first (advance_all). MC_GearIn brings the slave’s speed to the ratio times the master’s with its Acceleration (its Deceleration where the slave has to slow down), then holds the slave on the master’s travel times the ratio: InGear. MC_CamIn holds the slave on the cam table at the master’s position from its start: InSync. The table is the client’s (CamIn.Table, CamTableID 0) or the machine’s own electronic cam for this axis (CamTableID 1, Machine::cam), whose master may also be the machine’s virtual one (CamIn.Master empty), run up to the cam’s master speed. MC_GearOut and MC_CamOut end the coupling: the slave goes on at its speed (ContinuousMotion) until another block takes it over. Another block started on the slave aborts the coupling; a master that goes into ErrorStop or Disabled ends it with an error, the slave braking.

Structs§

Axis
Fb
A function block’s inputs and outputs. Active reads the same as Busy: there is no buffering. done is MC_GearIn’s InGear and MC_CamIn’s InSync, true beside busy while the slave is coupled.

Enums§

State
PLCopen axis states, numbered as in TwinCAT’s MC_AxisStates.

Constants§

ERR_BUSY
ERR_CRASH
The drives went off because the machine ran into an obstacle (effects.crash).
ERR_DRIVES_OFF
ERR_MASTER
MC_GearIn, MC_CamIn: no axis of that id, the slave itself, a master that is a slave itself, or no virtual master (the machine has no cam); or the master went into ErrorStop or Disabled while coupled.
ERR_NOT_POWERED
ErrorID values.
ERR_PARAMETER
ERR_RANGE
ERR_REFUSED
ERR_STATE
ERR_TABLE
MC_CamIn: the client’s cam table cannot be read, or the machine has no cam of its own (CamTableID 1).
FBS
The function blocks with an Execute input, in this order, and their numeric inputs.
TEXTS
The text inputs, block and name: the master’s axis id and the client’s cam table.

Functions§

advance_all
One setpoint interval t of every axis (Axis::advance, setpoints where the controller’s setpoint stands for each): the axes that follow no axis first, then the slaves at their masters’ new places.
cam_table
A cam table as the client writes it (CamIn.Table): lines of segments master span, slave rise, law (the laws of Law::from_name), or of points master, slave[, slope] (sim_components::cam::parse_table). None where it cannot be read.
execute_in
Execute of block k of axis i written (Axis::execute), with MC_GearIn’s and MC_CamIn’s master found among axes by its id: not the slave itself, and no slave of an axis itself (ERR_MASTER else); an empty id is the machine’s virtual cam master (MC_CamIn only).