Notes on the documentation

This description is only intended for the use of trained specialists in control and automation engineering who are familiar with the applicable national standards.
It is essential that the following notes and explanations are followed when installing and commissioning these components.

The responsible staff must ensure that the application or use of the products described satisfy all the requirements for safety, including all the relevant laws, regulations, guidelines and standards.

Disclaimer

The documentation has been prepared with care. The products described are, however, constantly under development.
For that reason the documentation is not in every case checked for consistency with performance data, standards or other characteristics.
In the event that it contains technical or editorial errors, we retain the right to make alterations at any time and without warning.
No claims for the modification of products that have already been supplied may be made on the basis of the data, diagrams and descriptions in this documentation.

Trademarks

Beckhoff®, TwinCAT®, EtherCAT®, Safety over EtherCAT®, TwinSAFE® and XFC® are registered trademarks of and licensed by Beckhoff Automation GmbH.
Other designations used in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owners.

Patent Pending

The TwinCAT Technology is covered, including but not limited to the following patent applications and patents:
EP0851348, US6167425 with corresponding applications or registrations in various other countries.

Copyright

© Beckhoff Automation GmbH.
The reproduction, distribution and utilization of this document as well as the communication of its contents to others without express authorization are prohibited.
Offenders will be held liable for the payment of damages. All rights reserved in the event of the grant of a patent, utility model or design.


TcPlcHydraulics

PLC libraries: TcPlcHydraulics

Overview

The TcPlcHydraulics PLC library brings together a range of blocks and functions relevant to hydraulic axes, along with the data types they use. It extends the support for this type of drive technology by making it possible to operate axes whose properties (limit frequency, highly scattered behaviour) is not suitable for positional control, or whose tasks differ sharply from those that are usual for electrical servos.

The function block are designed according to the definitions of the user group of IEC61131 (PLCopen) and are certified to be complient in November 2004.

When starting to build Version V3.0 of the library there have been technical reasons to become incompatible to de previous structures. The support of Version V2.1 will be continued and the documentation will be available. Version 3.0 is still under test and its documentation is under construction.

Functions by group | Remark
Administrative functions | Function blocks for administration and accessing of axes.
Single axis motion | Starting and monitoring of single axis motion functions.
Multiple axis functions | Starting and monitoring of multiple axis motion functions.
Drives | Blocks for calculation of setpoint values for output devices.
Encoders | Blocks for calculation of actual process values form input data supplied from peripheral devices.
Parameter handling | Blocks for reading, writing and communicating parameters.
Profile generators | Setpoint generators for active axis movements.
Controllers | Variants of controllers for position, velocity, pressure.
Table functions | Table lookup functions.
Message logging | Blocks for message logging and handling.
Runtime | A set of runtime functions.
Data types | Enummerations and structured types used by the library.


TcPlcHydraulics: PLCopen Motion Control: Funktionen, Bausteine und Typen

Functions, blocks and types

Note: All the functions, blocks and data types present in the library are listed here. You will find answers to frequently asked questions and notes on the use of the library, setting up and problem analysis in the Knowledge Base.

Some of the components listed here are not intended to be used by an application. Their presence, interface and behaviour is therefore not guaranteed. Because, however, a TwinCAT PLC library is strictly open, it is not possible to hide these internal components. It is, nevertheless, essential to avoid calling these components, identified with (internal use only) or (not recommended), directly from an application. If one of these components would, in practice, be useful for you, please make contact with our Support Department. We will then examine the possibility of making the block available to you, independently of the library, and for you to then take the responsibility for using it.

If the library contains blocks, types or constants that are not listed in the documentation, then these are elements that have not yet been approved, and are the subject of current software maintenance and development work. These elements must never be directly used in an application, because they are, as a general rule, not yet tested.

Note: The hydraulic library only offers a restricted range of functions, even in connection with electrical drives. TwinCAT NC PTP, NC I and CNC offer a significantly broader spectrum and more comprehensive support for commissioning and diagnosis.

PLC open Motion Control

The blocks listed here are oriented towards:

Technical Specification

PLCopen - Technical Comittee 2 - Task Force

Function blocks for motion control

Version 1.0 Part 1 and Part 2 (Definition not yet finalised)

The names of these blocks begin with MC_ and end with _BkPlcMc.

Note: Parts of the PLCopen definitions are not yet finalised. There may be changes in future releases of this library. These changes may affect

  • names, behaviour or even existence of functions, function blocks or derived data types
  • names, behaviour, types or presence of input or output signals

Administrative Function Blocks

Name | Description
MC_CamTableSelect_BkPlcMc | Initialises a variable of type ST_TcPlcMcCamId and prepaires a camming table for being used in a coupling of two axes.
MC_Power_BkPlcMc | Function block to control an external actuator.
MC_ReadActualPosition_BkPlcMc | The actual position of an axis is determined.
MC_ReadActualTorque_BkPlcMc | The actual force rsp. pressure of an axis is determined. (Definition not yet finalised)
MC_ReadActualVelocity_BkPlcMc | The actual velocity of an axis is determined. (Definition not yet finalised)
MC_ReadAxisError_BkPlcMc | The current error code of an axis is found.
MC_ReadBoolParameter_BkPlcMc | The boolean parameters of an axis are read.
MC_ReadDigitalOutput_BkPlcMc | The actual state of an output of a digital cam is determined. (Definition not yet finalised)
MC_ReadParameter_BkPlcMc | The non-boolean parameters of an axis are read.
MC_ReadStatus_BkPlcMc | The state of the axis is decoded.
MC_Reset_BkPlcMc | The axis is placed in a state ready for operation.
MC_ResetAndStop_BkPlcMc | The axis is placed in a state ready for operation and is stationary.
MC_SetOverride_BkPlcMc | The override of the axis is set. (Definition not yet finalised)
MC_SetPosition_BkPlcMc | The actual position of the axis is set. (Definition not yet finalised)
MC_SetReferenceFlag_BkPlcMc | The reference flag for the axis is placed in defined. (Block is not defined by PLCopen)
MC_WriteBoolParameter_BkPlcMc | The boolean parameters of an axis are written.
MC_WriteDigitalOutput_BkPlcMc | The actual state of an output of a digital cam is written. (Definition not yet finalised)
MC_WriteParameter_BkPlcMc | The non-boolean parameters of an axis are written.

Motion Function Blocks, Single Axis

Name | Description
MC_DigitalCamSwitch_BkPlcMc | Under construction. (Definition not yet finalised)
MC_Home_BkPlcMc | Initiation and monitoring of a reference travel.
MC_MoveAbsolute_BkPlcMc | Start and monitoring of a positioning process at a specifiable velocity to absolutely stated target co-ordinates.
MC_MoveJoySticked_BkPlcMc | Start and monitoring of a joystick controlled positioning process.
MC_MoveVelocity_BkPlcMc | Start and monitoring of a positioning process at a specifiable velocity but with no specified target.
MC_MoveRelative_BkPlcMc | Start and monitoring of a positioning process at a specifiable velocity over an absolutely stated distance.
MC_Stop_BkPlcMc | Stopping a movement without reaching the target position.

Motion Function Blocks, Multiple Axis

Name | Description
MC_CamIn_BkPlcMc | Starts and monitors a a coupling of two axes by using a camming table.
MC_CamOut_BkPlcMc | Releases a camming table coupling of two axes.
MC_GearIn_BkPlcMc | Start and monitor the coupling of two axes.
MC_GearOut_BkPlcMc | Release the coupling of two axes.

System Function Blocks, Drive

Name | Description
MC_AxRtDrive_BkPlcMc | Preparation of the control value for the axis for it to be output on a hardware module.
MC_AxRtDriveAx2000_BkPlcMc | (internal use only) Preparation of the control value for the axis so that it can be output on an AX2000 servo amplifier.
MC_AxRtDriveKL2521_BkPlcMc | (internal use only) Preparation of the control value for the axis so that it can be output on a KL2521 pulse output terminal.
MC_AxRtDriveKL2531_BkPlcMc | (internal use only) Preparation of the control value for the axis so that it can be output on a KL2531 direct stepper output terminal.
MC_AxRtDriveKL2541_BkPlcMc | (internal use only) Preparation of the control value for the axis so that it can be output on a KL2541 direct stepper output terminal.
MC_AxRtDriveKL4032_BkPlcMc | (internal use only) Preparation of the control value for the axis so that it can be output on a KL4032 ±10 V output terminal.
MC_AxRtDriveLowCostStepper_BkPlcMc | (internal use only) Preparation of the control value for the axis so that it can be output on digital output terminals.
MC_AxRtDriveM2400_BkPlcMc | (internal use only) Preparation of the control value for the axis so that it can be output on one of the four channels of a ±10 V M2400 output box.

System Function Blocks, Encoder

Name | Description
MC_AxRtEncoder_BkPlcMc | Determination of the actual position of the axis from the input information of a hardware module.
MC_AxRtEncoderAx2000_BkPlcMc | (internal use only) Determination of the actual position of the axis from the input data of an AX2000 servo amplifier.
MC_AxRtEncoderDigCam_BkPlcMc | (internal use only) Determination of the position cam byte from four digital input signals.
MC_AxRtEncoderDigInc_BkPlcMc | (internal use only) Determination of the actual position of the axis from two digital input signals.
MC_AxRtEncoderKL2521_BkPlcMc | (internal use only) Determination of the actual position of the axis from the output pulses acquired from a KL2521 pulse output terminal.
MC_AxRtEncoderKL2531_BkPlcMc | (internal use only) Determination of the actual position of the axis from the output or encoder pulses acquired from a KL2531 direct stepper output terminal.
MC_AxRtEncoderKL2541_BkPlcc | (internal use only) Determination of the actual position of the axis from the output pulses acquired from a KL2541 direct stepper output terminal.
MC_AxRtEncoderKL3042_BkPlcMc | (internal use only) Determination of the actual position of the axis from the input data of a KL3042 0..20mA input terminal.
MC_AxRtEncoderKL5001_BkPlcMc | (internal use only) Determination of the actual position of the axis from the input data of a KL5001 SSI terminal.
MC_AxRtEncoderKL5101_BkPlcMc | (internal use only) Determination of the actual position of the axis from the input data of a KL5101 incremental terminal.
MC_AxRtEncoderLowCostStepper_BkPlcMc | (internal use only) Determination of the actual position of the axis from the output data of an MC_AxRtDriveLowCostStepper_BkPlcMc block.
MC_AxRtEncoderM3120_BkPlcMc | (internal use only) Determination of the actual position of the axis from the input data of a M3120 Lightbus box.
MC_AxRtEncoderSimulation_BkPlcMc | (internal use only) Determination of the actual position of the axis from the output data of an MC_AxRuntime_BkPlcMc block.
MC_AxRtReadPressureDiff_BkPlcMc | (internal use only) Determination of the actual pressure of the axis from the input data of two analog input terminals.
MC_AxRtReadPressureSingle_BkPlcMc | (internal use only) Determination of the actual pressure of the axis from the input data of an analog input terminal.
MC_AxRtVirtuelEncoder | (internal use only) In preparation.

System Function Blocks, Parameter

Name | Description
MC_AxAdsCommServer_BkPlcMc | The application is given the capacity to function as an ADS server.
MC_AxAdsReadDecoder_BkPlcMc | The function block decodes ADS read accesses for an ADS server.
MC_AxAdsWriteDecoder_BkPlcMc | The function block decodes ADS write accesses for an ADS server.
MC_AxParamLoad_BkPlcMc | Load the parameters for an axis from a file.
MC_AxParamSave_BkPlcMc | Write the parameters for an axis into a file.

System Function Blocks, Generators

Name | Description
MC_AxRuntime_BkPlcMc | Control value generation for the axis.
MC_AxRuntimeCos_BkPlcMc | (not recommended) The profile of an acceleration phase, a displacement-referenced braking phase following a cosine curve, and a target approach at creep velocity is generated.
MC_AxRuntimeCtrlBased_BkPlcMc | (not recommended) The profile of an acceleration phase, a displacement-referenced braking phase following a cosine curve, and a target approach at creep velocity is generated.
MC_AxRuntimeTcPc_BkPlcMc | (not recommended) The profile of two acceleration phases, a displacement-referenced braking phase following a square root curve, and a target approach at creep velocity is generated.
MC_AxRunTimeTimeRamp_BkPlcMc | (not recommended) The profile of time-referenced acceleration and braking and a target approach at creep velocity is generated.

System Function Blocks, Controllers

Name | Description
MC_AxCtrlAutoZero_BkPlcMc | Automatic adjustment of the offset compensation.
MC_AxCtrlPressure_BkPlcMc | A block for closing a pressure control loop.
MC_AxCtrlPressureCompensation_BkPlcMc | A block for adapting the output values of a valve according to the valves pressure drop.
MC_AxCtrlPullbackOnPressure_BkPlcMc | A block for correcting the position setpoint of the axis to keep the actual pressure from exceeding a requested setpoint.
MC_AxCtrlSlowDownOnPressure_BkPlcMc | A block for slowing down an axis as much as is needed to keep the actual pressure from exceeding a requested setpoint.
MC_AxCtrlStepperDeStall_BkPlcMc | A block for monitoring the movement of a stepper motor, that is combined with an encoder.
MC_AxCtrlVelocity_BkPlcMc | A block for closing a velocity control loop.
MC_AxCtrlVeloMoving_BkPlcMc | A block for closing a velocity control loop while the axis is actively moved.

System Function Blocks, TableFunctions

Name | Description
MC_AxTableReadOutNonCyclic_BkPlcMc | (not recommended) A block for determining the slave values corresponding to a master value by using a data table.

System Function Blocks, Message Logging

Name | Beschreibung
MC_AxRtLogAxisEntry_BkPlcMc | An axis related message is entered into the LogBuffer of the library.
MC_AxRtLogClear_BkPlcMc | All entrys of the LogBuffer are cleared and initialised.
MC_AxRtLogEntry_BkPlcMc | A message is entered into the LogBuffer of the library.
MC_AxRtLoggerDeSpool_BkPlcMc | A block that keeps the librarys logging buffer from overrunning.
MC_AxRtLoggerRead_BkPlcMc | Reading a message from the LogBuffer of the library.
MC_AxRtLoggerSpool_BkPlcMc | A block that forwardings messages from the librarys buffer to the Windows event logger.

System Function Blocks, Runtime

Name | Description
MC_AxRtFinish_BkPlcMc | Adaptation of the generated control value to the special features of the axis.
MC_AxRtCheckSyncDistance_BkPlcMc | Monitoring of the distance between reference cam and sync pulse.
MC_AxRtGoErrorState_BkPlcMc | (not recommended) The axis is placed into an error state.
MC_AxRtMoveChecking_BkPlcMc | Monitoring the movement of an axis.
MC_AxRtSetActPos_BkPlcMc | (not recommended) Update the zero offset shift of an axis.
MC_AxRtSetControllerEnable_BkPlcMc | Updates the control bit for the controller enable.
MC_AxRtSetFeedEnableMinus_BkPlcMc | Updates the control bit for directional advance enable in the negative direction.
MC_AxRtSetFeedEnablePlus_BkPlcMc | Updates the control bit for directional advance enable in the positive direction.
MC_AxRtSetReferencingCamSignal_BkPlcMc | Updates the control bit for the referencing cam.
MC_AxStandardBody_BkPlcMc | Calls the usual sub-components for an axis (encoder, generator, finish, drive).
MC_AxUtiAverageDerivative_BkPlcMc | Calculates the derivative of a value by numerical differentiation over multiple cycles.
MC_AxUtiCancelMonitoring_BkPlcMc | Aborts the monitoring of a function.
MC_AxUtiCheckTypedPointers | Safeguarding the pointer structure of the axis.
MC_AxUtiSlidingAverage_BkPlcMc | Performes the calculation of a sliding average.
MC_AxUtiStandardInit_BkPlcMc | Initialises and monitors the components of the axis.
MC_HomeOnBlock_BkPlcMc | (internal use only) Initiation and monitoring of a reference travel with referencing at the block.
MC_HomeOnIndex_BkPlcMc | (internal use only) Initiation and monitoring of a reference travel with referencing at a cam edge.
MC_HomeOnSync_BkPlcMc | (internal use only) Initiation and monitoring of a reference travel with referencing with cam edge and zero pulse.

Data types: Enumerations

Name | Description
E_TcMcCurrentStep | The constants in this enumeration are used to identify the internal states of the setpoint generators.
E_TcMcDriveType | The constants in this enumeration are used to identify the hardware used to output the control values for an axis.
E_TcMcEncoderType | The constants in this enumeration are used to identify the hardware used to acquire the actual values for an axis.
E_TcMCFbState | This enumeration supplies codes for the current state of an axis.
E_TcMcHomingType | This enumeration supplies codes for the referencing method used by an axis.
E_TcMCParameter | The constants listed here are used for numbering parameters.
E_TcMcProfileType | The constants listed here are used for identifying control value generators.
E_TcMCSetPositionMode | The constants listed here are used to identify the referencing method of the axes.
MC_Direction_BkPlcMc | This enumeration supplies codes for the direction of movement if this information is not contained in other data or cannot be in determined on the basis of the situation.
MC_StartMode_BkPlcMc | The constants listed here are used to identify the starting method of the axes.

Data types: Structures

Name | Description
Axis_Ref_BkPlcMc | A variable of this type contains all the necessary variables or pointers to variables that are associated with an axis.
MC_CAM_ID_BkPlcMc | This structure contains the decription of a camming table, that is ready for use.
MC_CAM_REF_BkPlcMc | This structure contains the raw decription of a camming table.
MC_CAMSWITCH_REF_BkPlcMc | Under construction. (Definition not yet finalised)
MC_OUTPUT_REF_BkPlcMc | Under construction. (Definition not yet finalised)
MC_TRACK_REF_BkPlcMc | Under construction. (Definition not yet finalised)
ST_TcMcAuxDataLabels | A variable of this type contains text labels for the customer specific parameters of the axis.
ST_TcHydAxParam | A variable of this type contains all the parameters for an axis.
ST_TcHydAxRtData | A variable of this type contains the runtime data for an axis.
ST_TcPlcMcLogBuffer | A variable of this type contains the logging buffer of the library.
ST_TcPlcMcLogEntry | A variable of this type contains one message of the logging buffer of the library.
ST_TcPlcMcEncoderIn | A variable of this type contains the input image variables for an encoder.
ST_TcPlcMcEncoderOut | This structure contains the output image variables for an encoder.
ST_TcPlcMcAx2000In | This structure contains the input image variables for an AX2000 drive actuator.
ST_TcPlcMcAx2000Out | A variable of this type contains the output image variables for an AX2000 drive actuator.
ST_TcPlcMcDriveIn | This structure contains the input image variables for a drive.
ST_TcPlcMcDriveOut | A variable of this type contains the output image variables for a drive.


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_CamTableSelect_BkPlcMc

FUNCTION_BLOCK MC_CamTableSelect_BkPlcMc

This function block initialises a variable of type ST_TcPlcMcCamId and is prepairing a camming table for being used in a coupling of two axes.

VAR_INPUT
    Execute:		BOOL;
    Periodic:		BOOL;
    MasterAbsolute:	BOOL;
    SlaveAbsolute:	BOOL;
ND_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
    CamTableId:	MC_CAM_ID_BkPlcMc;
END_VAR
VAR_INOUT
    Master:		Axis_Ref_BkPlcMc;
    Slave:		Axis_Ref_BkPlcMc;
    CamTable:		MC_CAM_REF_BkPlcMc;
END_VAR

Execute: The comand is initiated by a rising edge at this input.

Periodic: Not supported: Apply FALSE here.

MasterAbsolute: Not supported: Apply TRUE here.

SlaveAbsolute: Not supported: Apply TRUE here.

Busy: A pending command is indicated here.

Done: Successful processing of the initialisation is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID: An encoded indication of the cause of the error is provided here.

CamTableId: The address of a variable of type MC_CAM_ID_BkPlcMc is returned here. This variable can now be used for a block of type MC_CamIn_BkPlcMc.

Master, Slave: The addresses of variables of type Axis_Ref_BkPlcMc are to be passed here.

CamTable: The address of a variable of type MC_CAM_REF_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If CamTable.pTable is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • If CamTable.nLastIdx is not bigger than CamTable.nFirstIdx, the block responds with Error and ErrorID:=dwTcHydErrCdTblEntryCount.
  • If CamTable.nFirstIdx and CamTable.nLastIdx define a table that holds more than 100 lines, the block responds with Error and ErrorID:=dwTcHydErrCdTblLineCount.
  • If MasterAbsolute or SlaveAbsolute are set to FALSE or Periodic is set to TRUE, the block responds with Error and ErrorID:=dwTcHydErrCdNotSupport.

If these checkings can be done without any problems the block will initialise CamTableId. The data from CamTable and the input data of the block are copied. CamTableId is marked as valid and changed. Done is set to signal the execution of the comand.

A falling edge on Execute will clear all pending outputs.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_Power_BkPlcMc

FUNCTION_BLOCK MC_Power_BkPlcMc

The block is used to control an external device. For more see FAQ #9.

VAR_INPUT
    Enable:		BOOL;
    Enable_Positive:	BOOL;
    Enable_Negative:	BOOL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Status:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Enable: A TRUE at this input activates an external device of an axis.

Enable_Positive: A TRUE at this input activates the directional enable of an external device of an axis for movements in a positive direction.

Enable_Negative: A TRUE at this input activates the directional enable of an external device of an axis for movements in a positive direction.

Busy: A pending command is indicated here.

Status: Readiness for operation is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID: An encoded error message is provided here.

Axis: The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

This block is used to control external devices. These can be modules for valve control (the valve's onboard power stage or some switch cabinet assembly), frequency converters or servoamplifiers. These devices usually require a digital signal to enable the output of energy through a power stage. Depending on the design of the device, it is also possible for the "positive" and "negative" movement directions to be individually activated.

The block's input signals are passed on through the interface to the peripheral device. Enable also activates error monitoring.

Note: This block can be omitted if it is not necessary to control and monitor an external device.

The block checks the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. Status is then FALSE.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. Status is then FALSE.
  • If the value iTcMc_DriveAx2000 is set as nDrive_Type in pStAxRtData:
    • The pointers pStAxAx2000In and pStAxAx2000Out in Axis_Ref_BkPlcMc are checked. If these pointers have not been initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcDriveIn or dwTcHydErrCdPtrPlcDriveOut. Status is then FALSE.
    • If a problem is detected in the communication to the AX device or a fault is detected in the ST_TcPlcMcAx2000In interface the block responds with Error and ErrorID defined in the Global Constants. Status is then FALSE, and the axis is placed into a fault state with a reported error code dwTcHydErrCdDriveNotReady.
    • Otherwise, the value of Enable is returned as the Status.
  • If the value iTcMc_DriveKL2531 or iTcMc_DriveKL2541 is set as nDrive_Type in pStAxRtData:
    • The pointers pStAxDriveInput and pStAxDriveOutput in Axis_Ref_BkPlcMc are checked. If these pointers have not been initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcDriveIn or dwTcHydErrCdPtrPlcDriveOut. Status is then FALSE.
    • If a problem is detected in the communication to the I/O device or a fault is detected in the pStAxDriveInput interface the block responds with Error and ErrorID defined in the Global Constants. Status is then FALSE, and the axis is placed into a fault state with a reported error code dwTcHydErrCdDriveNotReady.
    • Enable is used to enable or disable the output stage of the terminal by defining a bit in pStAxDriveOutput.bKL2531Ctrl.
    • The ready signal from pStAxDriveInput.bKL2531State of the terminal is returned as the Status.
  • Otherwise the pointers pStAxDriveInput and pStAxDriveOutput in Axis_Ref_BkPlcMc are checked. If these pointers have not been initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcDriveIn or dwTcHydErrCdPtrPlcDriveOut. Status is then FALSE.
    • Otherwise, the value of bPowerOk from pStAxDriveInput is returned as the Status.
  • If the drive interface is operating without error, the value of Enable is entered with the mask dwTcHydDcDwCtrlEnable in the nDeCtrlDWord of pStAxRtData.
  • If the drive interface is operating without error, the value of Enable_Positive is entered with the mask dwTcHydDcDwFdPosEna in the nDeCtrlDWord of pStAxRtData.
  • If the drive interface is operating without error, the value of Enable_Negative is entered with the mask dwTcHydDcDwFdNegEna in the nDeCtrlDWord of pStAxRtData.

Note: The execution of this blocks commands will not take any time. The output Busy will become TRUE under no circumstances and is supported for compatibility reasons only.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_ReadActualPosition_BkPlcMc

FUNCTION_BLOCK MC_ReadActualPosition_BkPlcMc

This function block reads the actual position of an axis.

VAR_INPUT
    Enable:		BOOL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
    Position:		LREAL;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Enable : Updating of the position value is initiated by a rising edge at this input.

Busy: A pending command is indicated here.

Done : Successful determination of the actual position is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Position : The actual position.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Enable, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the axis is already in a fault state, and if the cause lies with an encoder problem, it responds with Error and ErrorID:=the encoder's error code.

The actual position is determined and reported with Done if these checks can be carried out without problems.

A falling edge at Enable clears all the pending output signals.

Note: The execution of this blocks commands will not take any time. The output Busy will become TRUE under no circumstances and is supported for compatibility reasons only.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_ReadActualTorque_BkPlcMc

FUNCTION_BLOCK MC_ReadActualTorque_BkPlcMc

This function block reads the actual force rsp. pressure of an axis.

VAR_INPUT
    Enable:		BOOL;
END_VAR
VAR_OUTPUT
    Done:		BOOL;
    Busy:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
    Torque:		LREAL;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Enable: Updating of the position value is initiated by a rising edge at this input.

Done: Successful determination of the actual position is indicated here.

Busy: This output is set to TRUE during the execution of the command.

Erro: The occurrence of an error is indicated here.

ErrorID: An encoded indication of the cause of the error is provided here.

Torque: The actual force rsp. pressure.

Axis: The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Enable, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the axis is already in a fault state, and if the cause lies with an encoder problem, it responds with Error and ErrorID:=the encoder's error code.

The actual force rsp. pressure is determined and reported with Done if these checks can be carried out without problems.

A falling edge at Enable clears all the pending output signals.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_ReadActualVelocity_BkPlcMc

FUNCTION_BLOCK MC_ReadActualVelocity_BkPlcMc

This function block reads the actual velocity of an axis.

VAR_INPUT
    Enable:		BOOL;
END_VAR
VAR_OUTPUT
    Done:		BOOL;
    Busy:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
    Velocity:		LREAL;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Enable: Updating of the position value is initiated by a rising edge at this input.

Done: Successful determination of the actual position is indicated here.

Busy: This output is set to TRUE during the execution of the command.

Error: The occurrence of an error is indicated here.

ErrorID: An encoded indication of the cause of the error is provided here.

Velocity: The actual velocity.

Axis: The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Enable, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the axis is already in a fault state, and if the cause lies with an encoder problem, it responds with Error and ErrorID:=the encoder's error code.

The actual velocity is determined and reported with Done if these checks can be carried out without problems.

A falling edge at Enable clears all the pending output signals.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_ReadAxisError_BkPlcMc

FUNCTION_BLOCK MC_ReadAxisError_BkPlcMc

This function block determines the current error code of an axis.

VAR_INPUT
    Enable:		BOOL;
END_VAR
VAR_OUTPUT
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Enable : Updating of the error code is initiated by a rising edge at this input.

Busy: A pending command is indicated here.

Done : Successful determination of the actual position is indicated here.

Error: The current error or error code is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Enable, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the axis is already in a fault state the block responds with Error and ErrorID:=the error code of the axis.

A falling edge at Enable clears all the pending output signals.

Note: The execution of this blocks commands will not take any time. The output Busy will become TRUE under no circumstances and is supported for compatibility reasons only.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_ReadBoolParameter_BkPlcMc

FUNCTION_BLOCK MC_ReadBoolParameter_BkPlcMc

This function block reads the boolean parameters of an axis. The block MC_ReadParameter_BkPlcMc is available for non-boolean parameters.

VAR_INPUT
    Enable:		BOOL;
    ParameterNumber:	INT;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
    Value:		BOOL;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Enable : A reading process is initiated by a rising edge at this input.

ParameterNumber : This code number specifies the parameter that is to be read. Only named constants from E_TcMCParameter should be used.

Busy: A pending command is indicated here.

Done : Successful execution of the reading process is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Value : The value of the parameter is made available here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Enable, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If an unsupported value is given to ParameterNumber the block responds with Error and ErrorID:=dwTcHydErrCdNotSupport.

The desired parameter value is made available at Value, and Done is asserted if these checks can be carried out without problems.

A falling edge at Enable clears all the pending output signals.

Note: The execution of this blocks commands will not take any time. The output Busy will become TRUE under no circumstances and is supported for compatibility reasons only.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_ReadDigitalOutput_BkPlcMc

FUNCTION_BLOCK MC_ReadDigitalOutput_BkPlcMc

This function block reads the actual state of an output of a digital cam.

VAR_INPUT
    Enable:		BOOL;
    OutputNumber:	INT;
END_VAR
VAR_OUTPUT
    Valid:		BOOL;
    Busy:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
    Value:		BOOL;
END_VAR
VAR_INOUT
    Outputs:		MC_OUTPUT_REF_BkPlcMc;
END_VAR

Enable: Updating of the state is initiated by a rising edge at this input.

OutputNumber: The number of the requested output.

Valid: Successful determination of the actual state is indicated here.

Busy: This output is set to TRUE during the execution of the command.

Error: The occurrence of an error is indicated here.

ErrorID: An encoded indication of the cause of the error is provided here.

Value: The actual state.

Outputs: The address of a variable of type MC_OUTPUT_REF_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a TRUE Enable, and investigates the parameters that has been passed to it. A problem can be detected and reported during this process:

  • If OutputNumber is not in the accepted range [0..31], the block responds with Error and ErrorID:=dwTcHydErrCdIllegalOutputNumber.

The actual state is determined and reported with Valid if these checks can be carried out without problems.

A falling edge at Enable clears all the pending output signals.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_ReadParameter_BkPlcMc

FUNCTION_BLOCK MC_ReadParameter_BkPlcMc

This function block reads the non-boolean parameters of an axis. The block MC_ReadBoolParameter_BkPlcMc is available for boolean parameters.

VAR_INPUT
    Enable:		BOOL;
    ParameterNumber:	INT;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
    Value:		LREAL;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Enable : A reading process is initiated by a rising edge at this input.

ParameterNumber : This code number specifies the parameter that is to be read. Only named constants from E_TcMCParameter should be used.

Busy: A pending command is indicated here.

Done : Successful execution of the reading process is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Value : The value of the parameter is made available here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Enable, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If an unsupported value is given to ParameterNumber the block responds with Error and ErrorID:=dwTcHydErrCdNotSupport.

The desired parameter value is made available at Value, and Done is asserted if these checks can be carried out without problems.

A falling edge at Enable clears all the pending output signals.

Note: The execution of this blocks commands will not take any time. The output Busy will become TRUE under no circumstances and is supported for compatibility reasons only.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_ReadStatus_BkPlcMc

FUNCTION_BLOCK MC_ReadStatus_BkPlcMc

This function block determines the current error code of an axis.

VAR_INPUT
    Enable:			BOOL;
END_VAR
VAR_OUTPUT
    Busy:			BOOL;
    Done:			BOOL;
    Error:			BOOL;
    ErrorID:			UDINT;
    Errorstop:		BOOL;
    Stopping:			BOOL;
    StandStill:		BOOL;
    DiscreteMotion:		BOOL;
    ContinousMotion:		BOOL;
    SynchronizedMotion:	BOOL;
    Homing:			BOOL;
    ConstantVelocity:		BOOL;
    Accelerating:		BOOL;
    Decelerating:		BOOL;
END_VAR
VAR_INOUT
    Axis:			Axis_Ref_BkPlcMc;
END_VAR

Enable : A TRUE state at this input causes the block to update.

Busy: A pending command is indicated here.

Done : Successful determination of the actual position is indicated here.

Error: The current error or error code is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Errorstop : This signal indicates that the axis associated with an error has been placed in a state in which it is not able to operate. This state can only be cleared by activating either a MC_Reset_BkPlcMc or a MC_ResetAndStop_BkPlcMc block.

Stopping : This signal indicates that an active movement of the axis is being stopped by a MC_Stop_BkPlcMc or by a MC_ResetAndStop_BkPlcMc block. This signal is cleared as soon as the axis is stationary.

StandStill : This signal indicates that the axis is neither in a fault state nor is it active.

DiscreteMotion : This signal indicates that the axis is executing an autonomous movement (not resulting from a coupling) with a defined target.

ContinousMotion : This signal indicates that the axis is executing an autonomous movement (not resulting from a coupling) with a defined velocity but not with a specified target.

SynchronizedMotion : This signal indicates that the axis is being controlled by a gear coupling.

Homing : This signal indicates that the axis is executing a reference travel.

ConstantVelocity : This signal indicates that the axis is being moved with constant velocity.

Accelerating: This signal indicates that the velocity of an axis is reaching a specified value. Note: This does not always mean that the velocity is increasing: when an axis that is already in movement is started, it can happen that the axis accelerates in the direction opposite the current sense of the velocity in order to achieve a specified velocity in the other direction. From the point of view of the original movement this is a deceleration, although from the point of the current (new) movement it is still an acceleration.

Decelerating: This signal indicates that the axis is reducing its velocity in order to continue a movement with a velocity lower than the current velocity, or in order to end it.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it if TRUE is asserted at Enable. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.

A LOW state at Enable clears all the pending output signals.

Note: The execution of this blocks commands will not take any time. The output Busy will become TRUE under no circumstances and is supported for compatibility reasons only.


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_SetReferenceFlag_BkPlcMc

FUNCTION_BLOCK MC_SetReferenceFlag_BkPlcMc

(Block is not defined by PLCopen) This function block defines the reference flag for the axis.

VAR_INPUT
    Execute:		BOOL;
    ReferenceFlag:	BOOL;
END_VAR
VAR_OUTPUT
    Done:		BOOL;
    Busy:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : The command is initiated by a rising edge at this input.

ReferenceFlag: The new state of the reference flag of the axis.

Done : Successful processing of the command is indicated here.

Busy: This output is set to TRUE during the execution of the command.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.

If these checks can be carried out without problems the block will update the reference flag in ST_TcHydAxRtData.nStateDWord automatically. The bit is set or reset depending on ReferenceFlag by use of dwTcHydNsDwReferenced. The succesfull execution of the block is signaled with Done. A falling edge on Execute will clear all the pending output signals.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_Reset_BkPlcMc

FUNCTION_BLOCK MC_Reset_BkPlcMc

This function block is reseting a fault state and is placing the axis in a functional state.

VAR_INPUT
    Execute:		BOOL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : An axis reset is initiated by a rising edge at this input.

Busy: A pending command is indicated here.

Done : Successful execution of the axis reset is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.

If it is possible to carry out these checks without problem, the axis reset is executed, the axis is placed, as far as possible, into a state in which it is ready to operate, and the Done signal is given. If this is not possible, the block reacts with Error and ErrorID:= the ErrorCode of the axis.

A falling edge at Execute clears all the pending output signals.

Note: For some drive types the reset operation includes the exchange of signals with an external device. The block cannot respond with a final result (Done or Error) while this communication is still under progress. To signal this situation it will set Busy until the operation is finished.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_ResetAndStop_BkPlcMc

FUNCTION_BLOCK MC_ResetAndStop_BkPlcMc

This function block is placing an axis in a fault state in an operable state. If the axis is running a motion command this command will be aborted. The stop operation is monitored.

VAR_INPUT
    Execute:		BOOL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : An axis reset and a stop operation are initiated by a rising edge at this input.

Done : Successful execution of the axis reset is indicated here.

Done : Successful execution of the axis reset is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If it is not possible to successfully clear an existing fault state for an axis through a reset operation, the block reacts with Error and ErrorID:= the ErrorCode for the axis.
  • If the axis is placed into an error state in the course of a stop operation that may have been necessary, the block reacts with Error and ErrorID:= the ErrorCode for the axis.

Successful completion of both operations is reported with Done. The axis is then without error and stationary.

A falling edge at Execute clears all the pending output signals.

Note: If the axis is moving it will be decellerated completely. For some drive types a reset operation includes the exchange of signals with an external device. The block cannot respond with a final result (Done or Error) while these activities are still under progress. To signal this situation it will set Busy until the operation is finished.


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_SetOverride_BkPlcMc

FUNCTION_BLOCK MC_SetOverride_BkPlcMc

This function block sets the override for the axis.

Attention: This block is working only in combination with profile type iTcMc_ProfileCtrlBased.

VAR_INPUT
    Execute:		BOOL;
    VelFactor:	LREAL;
END_VAR
VAR_OUTPUT
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : The command is initiated by a rising edge at this input.

VelFactor: The requested value for the override of the axis.

Done : Successful processing of the command is indicated here.

Busy: This output is set to TRUE during the execution of the command.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.

If these checks can be carried out without problems the block will limit the value given as VelOverride to the range 0.0 to 1.0 and place it at Axis.pStAxParams^.fOverride. Done is set to TRUE.

A falling edge on Execute will clear all the pending output signals.

All velocity changes caused by a change of the override are limited according the maximum acceptable accelerations and decelerations defined by the axis parameters.

Hint: To guarantee a reproducible behaviour in the targeting operation the override will not reduce the moving speed below pStAxParams.fCreepSpeed. Because of this an axis cannot be stopped over in an active move by applying a 0.0 as the override.


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_SetPosition_BkPlcMc

FUNCTION_BLOCK MC_SetPosition_BkPlcMc

This function block sets the actual position for the axis.

VAR_INPUT
    Execute:		BOOL;
    Position:		LREAL;
    Mode:		BOOL;
END_VAR
VAR_OUTPUT
    Done:		BOOL;
    Busy:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : The command is initiated by a rising edge at this input.

Position : The requested value for the actual position of the axis.

Mode: This parameter defines the rules for the command. For Mode=TRUE the actual position is changed for Position, for Mode=FALSE the actual position is set to Position.

Done : Successful processing of the command is indicated here.

Busy: This output is set to TRUE during the execution of the command.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • The possibility that the new position value specified by Position and Mode is located behind an active software limit switch is checked next. In this case the block will react by asserting Error with ErrorID:=dwTcHydErrCdSoftEnd.
  • Depending on the encoder type specified in Axis.pStAxParams^.nEnc_Type either ST_TcHydAxRtData.fEnc_RefShift or ST_TcHydAxParam.fEnc_ZeroShift are modified to change the actual position to the requested value. If the encoder type is unknown or the encoder is not supporting this functionality the block will react by asserting Error with ErrorID:=dwTcHydErrCdEncType.

If these checks can be carried out without problems the block will update all related elements in ST_TcHydAxRtData automatically. Therefor the block can be used even for an axis that is active moving. The succesfull execution of the block is signaled with Done. A falling edge on Execute will clear all the pending output signals.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_WriteBoolParameter_BkPlcMc

FUNCTION_BLOCK MC_WriteBoolParameter_BkPlcMc

This function block writes the boolean parameters of an axis. The block MC_WriteParameter_BkPlcMc is available for non-boolean parameters.

VAR_INPUT
    Enable:		BOOL;
    ParameterNumber:	INT;
    Value:		BOOL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Enable : A write process is initiated by a rising edge at this input.

ParameterNumber : This code number specifies the parameter that is to be read. Only named constants from E_TcMCParameter should be used.

Value : The value of the parameter is to be provided here.

Busy: A pending command is indicated here.

Done : Successful execution of the writing process is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Enable, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If an unsupported value is given to ParameterNumber the block responds with Error and ErrorID:=dwTcHydErrCdNotSupport.

The desired parameter value can be written with Value and Done is asserted if these checks can be carried out without problems.

A falling edge at Enable clears all the pending output signals.

Note: The execution of this blocks commands will not take any time. The output Busy will become TRUE under no circumstances and is supported for compatibility reasons only.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_WriteDigitalOutput_BkPlcMc

FUNCTION_BLOCK MC_WriteDigitalOutput_BkPlcMc

This function block reads the actual state of an output of a digital cam.

VAR_INPUT
    Execute:		BOOL;
    OutputNumber:	INT;
    Value:		BOOL;
END_VAR
VAR_OUTPUT
    Done:		BOOL;
    Busy:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Outputs:		MC_OUTPUT_REF_BkPlcMc;
END_VAR

Execute: Updating of the state is initiated by a rising edge at this input.

OutputNumber: The number of the requested output.

Value: The requested state.

Done: Successful execution of the command is indicated here.

Busy: This output is set to TRUE during the execution of the command.

Error: The occurrence of an error is indicated here.

ErrorID: An encoded indication of the cause of the error is provided here.

Axis: The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge on Execute, and investigates the parameters that has been passed to it. A problem can be detected and reported during this process:

  • If OutputNumber is not in the accepted range [0..31], the block responds with Error and ErrorID:=dwTcHydErrCdIllegalOutputNumber.

The state is defined and reported with Done if these checks can be carried out without problems.

A falling edge at Execute clears all the pending output signals.


TcPlcHydraulics: PLCopen Motion Control: Administrative: MC_WriteParameter_BkPlcMc

FUNCTION_BLOCK MC_WriteParameter_BkPlcMc

This function block writes the non-boolean parameters of an axis. The MC_WriteBoolParameter_BkPlcMc block is available for boolean parameters .

VAR_INPUT
    Enable:		BOOL;
    ParameterNumber:	INT;
    Value:		LREAL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Enable : A write process is initiated by a rising edge at this input.

ParameterNumber : This code number specifies the parameter that is to be read. Only named constants from E_TcMCParameter should be used.

Value : The value of the parameter is to be provided here.

Busy: A pending command is indicated here.

Done : Successful execution of the writing process is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Enable, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If an unsupported value is given to ParameterNumber the block responds with Error and ErrorID:=dwTcHydErrCdNotSupport.

The desired parameter value can be written with Value and Done is asserted if these checks can be carried out without problems.

A falling edge at Enable clears all the pending output signals.

Note: The execution of this blocks commands will not take any time. The output Busy will become TRUE under no circumstances and is supported for compatibility reasons only.


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_CamIn_BkPlcMc

FUNCTION_BLOCK MC_CamIn_BkPlcMc

This function block starts and monitors a a coupling of two axes by using a camming table.

VAR_INPUT
    Execute:		BOOL;
    MasterOffset:	LREAL:=0.0;
    SlaveOffset:	LREAL:=0.0;
    MasterScaling:	LREAL:=0.0;
    SlaveScaling:	LREAL:=0.0;
    StartMode:	MC_StartMode_BkPlcMc:=MC_StartMode_Absolute;
    CamTableId:	MC_CAM_ID_BkPlcMc;
ND_VAR
VAR_OUTPUT
    Busy:		BOOL;
    InSync:		BOOL;
    CommandAborted:	BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
    EndOfProfile:	BOOL;
END_VAR
VAR_INOUT
    Master:		Axis_Ref_BkPlcMc;
    Slave:		Axis_Ref_BkPlcMc;
END_VAR

Execute: The comand is initiated by a rising edge at this input.

MasterOffset, MasterScaling: These values are used for translating the masters actual position before it is searching for in the master row of the camming table.

SlaveOffset, SlaveScaling: These values are used for translating the slave position from the camming table.

StartMode: A value from MC_StartMode_BkPlcMc, that is determining the behaviour of the slave axis at the start of the coupling.

CamTableId: The address of a variable of type MC_CAM_ID_BkPlcMc is to be passed here. The variable has to be initialised by a block of type MC_CamTableSelect_BkPlcMc.

Busy: A pending command is indicated here.

InSync: Here the first succesful synchrinisation of the axes is signaled. This signal will not change if the synchronicity is lost later.

CommandAborted : Abortion of the movement is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID: An encoded indication of the cause of the error is provided here.

EndOfProfile: This flag signals, that the end of the camming table is reached.

Master, Slave: The addresses of variables of type Axis_Ref_BkPlcMc are to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If CamTableId.bValidated is not initialised by a block of type MC_CamTableSelect_BkPlcMc, the block responds with Error and ErrorID:=dwTcHydErrCdTblNoInit.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised for the master or the slave, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised for the master or the slave, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If either the master or the slave are not in the idle state, the block responds with Error and ErrorID:=dwTcHydErrCdNotStartable.
  • If StartMode is set to MC_StartMode_RampIn, the block responds with Error and ErrorID:=dwTcHydErrCdNotSupport.

The coupling is initiated if these checks can be carried out without problems. Depending on StartMode the base position for the slave axis is set to 0.0 or the actual position of the Slave. The axis is now in the McState_Synchronizedmotion state, and the block begins to calculate and monitor the coupling.

The setpoints for the slaves position and velocity are caclulated depending on the actual position and velocity setpoint of the master and the table.

If the slave is reaching the velocity requested from the coupling InSync is set. Because the coupling can be activated only in idle state this will occur imediately. If the slave cannot follow the requested motion later InSync will not change.

If the movement algorithm reports an error code while the coupling is being executed, the block responds with Error and ErrorID:=the movement algorithm's error code.

A falling edge at Execute will not stop the calculation nor the monitoring. This can be acheaved only by releasing the coupling by use of a block of type MC_CamOut_BkPlcMc or by an error condition. This will clear all pending output signals as well.


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_CamOut_BkPlcMc

FUNCTION_BLOCK MC_CamOut_BkPlcMc

This function block releases a camming table coupling of two axes, that has been started by a block of type MC_CamIn_BkPlcMc.

VAR_INPUT
    Execute:		BOOL;
ND_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Slave:		Axis_Ref_BkPlcMc;
END_VAR

Execute: The comand is initiated by a rising edge at this input.

Busy: A pending command is indicated here.

Done: Successful processing of the command is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID: An encoded indication of the cause of the error is provided here.

Slave: The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the axis is not coupled the block will respond by signaling Done without any further checking or activity.
  • If the current velocity of the axis is lower than the velocity specified by pStAxParams.fCreepSpeed the axis is imediately placed in McState_Standstill state and is braking from any remaining velocity. Done is signaled and there will be no further checking or other activities.

If these checks can be carried out without problems and Done is not allready signaled for one of the reasons discussed obove the coupling is converted into an endless move with the same velocity and direction, but independend from the masters activities. If this conversion is successfull Done is signaled, otherwise the block will respond with Error and ErrorID:=the movement algorithm's error code.


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_DigitalCamSwitch_BkPlcMc

FUNCTION_BLOCK MC_DigitalCamSwitch_BkPlcMc

This function .

VAR_INPUT
    Enable:		BOOL;
    EnableMask:	DWORD;
END_VAR
VAR_OUTPUT
    InOperation:	BOOL;
    Busy:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
    Switches:		ARRAY [ciBkPlcMc_CamSwitchRef_MinIdx..ciBkPlcMc_CamSwitchRef_MaxIdx] OF MC_CAMSWITCH_REF_BkPlcMc;
    Outputs:		MC_OUTPUT_REF_BkPlcMc;
    TrackOptions:	ARRAY [ciBkPlcMc_TrackRef_MinIdx..ciBkPlcMc_TrackRef_MaxIdx] OF MC_TRACK_REF_BkPlcMc;
END_VAR

Enable: This input is controlling all activities of the block.

EnableMask: The bits in this mask are controlling the bits in Outputs.

InOperation: This output is set to TRUE while the block is actively executing its operation.

Busy: This output is set to TRUE during the execution of the command.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Switches: Hier ist ein Array vom Typ MC_CAMSWITCH_REF_BkPlcMc zu übergeben.

Outputs: The address of a variable of type MC_OUTPUT_REF_BkPlcMc is to be passed here.

TrackOptions: The address of a variable of type MC_TRACK_REF_BkPlcMc is to be passed here.

Behaviour of the block:


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_GearIn_BkPlcMc

FUNCTION_BLOCK MC_GearIn_BkPlcMc

This function block starts and monitors the coupling of two axes.

VAR_INPUT
    Execute:		BOOL;
    RatioNumerator:	INT;
    RatioDenominator:	INT;
    Acceleration:	LREAL;
    Deceleration:	LREAL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    InGear:		BOOL;
    CommandAborted:	BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Master:		Axis_Ref_BkPlcMc;
    Slave:		Axis_Ref_BkPlcMc;
END_VAR

Execute : The coupling is initiated by a rising edge at this input.

RatioNumerator, RatioDenominator: These parameters describe the coupling in the form of a gear box.

Acceleration : The required acceleration of the movement in the actual position units used by the axis per second squared.

Deceleration : The required deceleration of the movement in the actual position units used by the axis per second squared.

Busy: A pending command is indicated here.

InGear: Here the first succesful synchrinisation of the axes is signaled. This signal will not change if the synchronicity is lost later.

CommandAborted : Abortion of the movement is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID: An encoded indication of the cause of the error is provided here.

Master, Slave: The addresses of variables of type Axis_Ref_BkPlcMc are to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc for master or slave is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc for master or slave is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • The possibility that RatioDenominator is set to 0 is checked next. In this case the block will react by asserting Error with ErrorID:=dwTcHydErrCdIllegalGearFactor.
  • By now the coupling cannot be activated if either master or slave is not in idle state. If this is not true the block responds with Error and ErrorID:=dwTcHydErrCdNotStartable.
  • If the axis is already in a fault state, or if it is in the process of carrying out a stop operation, it responds with Error and ErrorID:=dwTcHydErrCdNotReady.
  • If the movement algorithm is already indicating an error code, the block responds with Error and ErrorID:= the movement algorithm's error code.

The coupling is initiated if these checks can be carried out without problems. The axis is now in the McState_Synchronizedmotion state, and the block begins to monitor the coupling.

When the slave axis is reaching the requested velocity for the first time InGear is signaled. Because of the fact that the coupling can be activated only in idle state this will happen imediately. If the slave axis is not able to follow the master InGear will remain unchanged.

If the movement algorithm reports an error code while the coupling is being executed, the block responds with Error and ErrorID:=the movement algorithm's error code.

A falling edge at Execute clears all the pending output signals. If, while the coupling is still active, Execute is set to FALSE, execution of the coupling continues unaffected. The signals provided at the end of the movement (Error, ErrorID, CommandAborted, InGear) are made available for one cycle.


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_GearOut_BkPlcMc

FUNCTION_BLOCK MC_GearOut_BkPlcMc

This function block releases the coupling of two axes.

VAR_INPUT
    Execute:		BOOL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Slave:		Axis_Ref_BkPlcMc;
END_VAR

Execute : The coupling is released by a rising edge at this input.

Busy: A pending command is indicated here.

Done : Successful processing of the movement is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Slave: The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the axis is not in a coupled state the block is imediately reponding with Done and will not do any further checking or perform any activities.
  • If the current velocity of the axis is lower than the velocity specified by pStAxParams.fCreepSpeed the axis is imediately placed in McState_Standstill state and is braking from any remaining velocity. Done is signaled and there will be no further checking or other activities.

If these checks can be carried out without problems and Done is not allready signaled for one of the reasons discussed obove the coupling is converted into an endless move with the same velocity and direction, but independend from the masters activities. If this conversion is successfull Done is signaled, otherwise the block will respond with Error and ErrorID:=the movement algorithm's error code.


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_Home_BkPlcMc

FUNCTION_BLOCK MC_Home_BkPlcMc

This function block starts and monitors the reference travel of an axis. Blocks of types MC_HomeOnBlock_BkPlcMc, MC_HomeOnIndex_BkPlcMc or MC_HomeOnSync_BkPlcMc are called for this purpose.

VAR_INPUT
    Execute:		BOOL;
    Position:		LREAL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    CommandAborted:	BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : The reference travel is initiated by a rising edge at this input.

Position : The reference position.

Busy: A pending command is indicated here.

Done : Successful processing of the reference travel is indicated here.

CommandAborted : Abortion of the reference travel is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • A reference travel can only be started from a stationary condition without errors. If that is not the case, the block will react by asserting Error with ErrorID:=dwTcHydErrCdNotStartable or with the error code that is passed to it.
  • If the axis is already in a fault state, or if it is in the process of carrying out a stop operation, it responds with Error and ErrorID:=dwTcHydErrCdNotReady.
  • If one of the velocities stated in the axis parameters is too small (less than 1% of the reference velocity) the block responds with Error and ErrorID:=dwTcHydErrCdSetVelo.

The reference travel begins if these checks are carried out without problems. The precise process of nEnc_HomingType is specified in the axis parameters.

If the movement algorithm reports an error code while the reference travel is being executed, the block responds with Error and ErrorID:=the movement algorithm's error code. If completion of the reference travel is prevented by the activity of another block, the block responds with CommandAborted. Successful completion of the reference travel is reported with Done.

A falling edge at Execute clears all the pending output signals. If, while the reference travel is still active, Execute is set to FALSE, execution of the reference travel that had started continues unaffected. The signals provided at the end of the movement (Error, ErrorID, CommandAborted, Done) are made available for one cycle.

Note: fEnc_DefaultHomePosition in pStAxParams is provided for circumstances in which the application does not itself specify a reference position and a value saved with the machine data is to be loaded for use instead. If different values are required, depending on the situation, use should be made of fCustomerData[] in pStAxParams.


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_MoveAbsolute_BkPlcMc

FUNCTION_BLOCK MC_MoveAbsolute_BkPlcMc

This function block starts and monitors the movement of an axis.

VAR_INPUT
    Execute:		BOOL;
    Position:		LREAL;
    Velocity:		LREAL;
    Acceleration:	LREAL;
    Deceleration:	LREAL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    CommandAborted:	BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : The movement is initiated by a rising edge at this input.

Position : The target of the movement in the actual position units appropriate to the axis.

Velocity : The required velocity of the movement in the actual position units used by the axis per second.

Acceleration : The required acceleration of the movement in the actual position units used by the axis per second squared.

Deceleration : The required deceleration of the movement in the actual position units used by the axis per second squared.

Busy: A pending command is indicated here.

Done : Successful processing of the movement is indicated here.

CommandAborted : Abortion of the movement is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • The possibility that Position is located behind an active software limit switch is checked next. In this case the block will react by asserting Error with ErrorID:=dwTcHydErrCdSoftEnd.
  • Depending on the movement algorithm specified in Axis.pStAxParams^.nProfile the axis may either only be able to begin the movement initiated here when stationary, or may be able to begin from another movement that has not yet been completed. If it is unable at the present time to accept this new order, the block responds with Error and ErrorID:=dwTcHydErrCdNotStartable.
  • If the axis is already in a fault state, or if it is in the process of carrying out a stop operation, it responds with Error and ErrorID:=dwTcHydErrCdNotReady.
  • If Velocity is too small (less than 1% of the reference velocity) the block reacts with Error and ErrorID:=dwTcHydErrCdSetVelo.
  • If Acceleration is too small (the Velocity cannot be reached within 100 seconds) the block reacts with Error and ErrorID:=dwTcHydErrCdAcc.
  • If Deceleration is too small (the Velocity cannot be reached within 100 seconds) the block reacts with Error and ErrorID:=dwTcHydErrCdDec.
  • If the movement algorithm is already indicating an error code, the block responds with Error and ErrorID:= the movement algorithm's error code.

The movement begins if these checks can be carried out without problems. This is done by limiting the parameters Position, Velocity, Acceleration and Deceleration to the maximum permissible values and passing them to the movement algorithm. The axis is now in the McState_DiscreteMotion state, and the block begins to monitor the movement.

If the movement algorithm reports an error code while the movement is being executed, the block responds with Error and ErrorID:=the movement algorithm's error code. If completion of the movement is prevented by the activity of another block, the block responds with CommandAborted. If the movement algorithm achieves the target conditions for the axis, the block reacts with Done.

A falling edge at Execute clears all the pending output signals. If, while the movement is still active, Execute is set to FALSE, execution of the movement that had started continues unaffected. The signals provided at the end of the movement (Error, ErrorID, CommandAborted, Done) are made available for one cycle.

Hint: The monitoring of the movement may be aborted by calling a block of type MC_AxUtiCancelMonitoring_BkPlcMc. This will cause the block to signal CommandAborted. A subsequent call with Execute=FALSE will place the block in its idle state..


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_MoveJoySticked_BkPlcMc

FUNCTION_BLOCK MC_MoveJoySticked_BkPlcMc

This function block starts and monitors the movement of an axis.

Note: This function is supported only for axes that are controlled by blocks of type MC_AxRuntimeCtrlBased_BkPlcMc (in preparation: MC_AxRunTimeTimeRamp_BkPlcMc). The selection of these blocks is done by placing the appropriate constant from E_TcMcProfileType in nProfileType in ST_TcHydAxParam.

VAR_INPUT
    Execute:		BOOL;
    JoyStick:		LREAL;
    Acceleration:	LREAL;
    Deceleration:	LREAL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    CommandAborted:	BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute: The movement is initiated by a rising edge at this input.

JoyStick: A controling speed override value from the input device. The value has to be normalised to the range on ±1.

Acceleration : The required acceleration of the movement in the actual position units used by the axis per second squared.

Deceleration : The required deceleration of the movement in the actual position units used by the axis per second squared.

Busy: A pending command is indicated here.

CommandAborted : Abortion of the movement is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the axis is already in a fault state, or if it is in the process of carrying out a stop operation, it responds with Error and ErrorID:=dwTcHydErrCdNotReady.
  • If the movement algorithm is already indicating an error code, the block responds with Error and ErrorID:= the movement algorithm's error code.
  • Depending on the movement algorithm specified in Axis.pStAxParams^.nProfile the axis may be unable to support the requested function. In this case the block responds with Error and ErrorID:=dwTcHydErrCdNotCompatible.

If these checks can be carried out without problems the movement algorithm is switched into iTcHydStateExtGenerated state and the axis is placed in McState_Synchronizedmotion. Now the function block is controlling the speed of the axis according to JoyStick und ST_TcHydAxParam.fRefVelo. Any change of velocity is done acording to ST_TcHydAxParam.fMaxAcc. If the axis is approaching an active software limit the speed is limited in a way that keeps the axis from exceeding the limit.

On a falling edge at Execute the movement algorithms state is changed to iTcHydStateTcDecP or iTcHydStateTcDecM and the axis is placed in McState_Standstill state. If the axis is moving the movement will be canceled according to ST_TcHydAxParam.fStopRamp. Then the axis state is changed to iTcHydStateIdle.


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_MoveRelative_BkPlcMc

FUNCTION_BLOCK MC_MoveRelative_BkPlcMc

This function block starts and monitors the movement of an axis.

VAR_INPUT
    Execute:		BOOL;
    Distance:		LREAL;
    Velocity:		LREAL;
    Acceleration:	LREAL;
    Deceleration:	LREAL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    InVelocity:	BOOL;
    CommandAborted:	BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute: The movement is initiated by a rising edge at this input.

Distance: The distance to the target of the movement in the actual position units appropriate to the axis.

Velocity: The required velocity of the movement in the actual value position used by the axis per second.

Acceleration: The required acceleration of the movement in the actual position units used by the axis per second squared.

Deceleration: The required deceleration of the movement in the actual position units used by the axis per second squared.

Busy: A pending command is indicated here.

Done : Successful processing of the movement is indicated here.

CommandAborted: Abortion of the movement is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID: An encoded indication of the cause of the error is provided here.

Axis: The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • The possibility that moving through Distance will lead to a conflict with an active software limit switch is checked next. In this case the block will react by asserting Error with ErrorID:=dwTcHydErrCdSoftEnd.
  • Depending on the movement algorithm specified in Axis.pStAxParams^.nProfile the axis may either only be able to begin the movement initiated here when stationary, or may be able to begin from another movement that has not yet been completed. If it is unable at the present time to accept this new order, the block responds with Error and ErrorID:=dwTcHydErrCdNotStartable.
  • If the axis is already in a fault state, or if it is in the process of carrying out a stop operation, it responds with Error and ErrorID:=dwTcHydErrCdNotReady.
  • If Velocity is too small (less than 1% of the reference velocity) the block reacts with Error and ErrorID:=dwTcHydErrCdSetVelo.
  • If Acceleration is too small (the Velocity cannot be reached within 100 seconds) the block reacts with Error and ErrorID:=dwTcHydErrCdAcc.
  • If Deceleration is too small (the Velocity cannot be reached within 100 seconds) the block reacts with Error and ErrorID:=dwTcHydErrCdDec.
  • If the movement algorithm is already indicating an error code, the block responds with Error and ErrorID:= the movement algorithm's error code.

The movement begins if these checks can be carried out without problems. This is done by limiting the parameters Distance, Velocity, Acceleration and Deceleration to the maximum permissible values and passing them to the movement algorithm. The axis is now in the McState_DiscreteMotion state, and the block begins to monitor the movement.

If the movement algorithm reports an error code while the movement is being executed, the block responds with Error and ErrorID:=the movement algorithm's error code. If completion of the movement is prevented by the activity of another block, the block responds with CommandAborted. If the movement algorithm achieves the target conditions for the axis, the block reacts with Done.

A falling edge at Execute clears all the pending output signals. If, while the movement is still active, Execute is set to FALSE, execution of the movement that had started continues unaffected. The signals provided at the end of the movement (Error, ErrorID, CommandAborted, Done) are made available for one cycle.


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_MoveVelocity_BkPlcMc

FUNCTION_BLOCK MC_MoveVelocity_BkPlcMc

This function block starts and monitors the movement of an axis.

VAR_INPUT
    Execute:		BOOL;
    Velocity:		LREAL;
    Acceleration:	LREAL;
    Deceleration:	LREAL;
    Direction:	MC_Direction_BkPlcMc;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    InVelocity:	BOOL;
    CommandAborted:	BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : The movement is initiated by a rising edge at this input.

Velocity : The required velocity of the movement in the actual position units used by the axis per second.

Acceleration : The required acceleration of the movement in the actual position units used by the axis per second squared.

Deceleration : The required deceleration of the movement in the actual position units used by the axis per second squared.

Direction : A specification of direction encoded in accordance with MC_Direction_BkPlcMc.

Busy: A pending command is indicated here.

InVelocity: This output will become TRUE when the axis reaches the requested velocity for the first time.

CommandAborted : Abortion of the movement is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • Depending on the movement algorithm specified in Axis.pStAxParams^.nProfile the axis may either only be able to begin the movement initiated here when stationary, or may be able to begin from another movement that has not yet been completed. If it is unable at the present time to accept this new order, the block responds with Error and ErrorID:=dwTcHydErrCdNotStartable.
  • If the axis is already in a fault state, or if it is in the process of carrying out a stop operation, it responds with Error and ErrorID:=dwTcHydErrCdNotReady.
  • If Velocity is too small (less than 1% of the reference velocity) the block reacts with Error and ErrorID:=dwTcHydErrCdSetVelo.
  • If the movement algorithm is already indicating an error code, the block responds with Error and ErrorID:= the movement algorithm's error code.

The movement begins if these checks can be carried out without problems. This is done by selecting a value for the target position depending on Direction and the parameters for the software limit switches. The parameters Velocity, Acceleration and Deceleration are then limited to the maximum permissible values and are passed to the movement algorithm. The axis is now in the McState_Continuousmotion state, and the block begins to monitor the movement.

If the movement algorithm reports an error code while the movement is being executed, the block responds with Error and ErrorID:=the movement algorithm's error code. If completion of the movement is prevented by the activity of another block, the block responds with CommandAborted. If the movement algorithm achieves the requested velocity, the block reacts by setting InVelocity.

A falling edge at Execute clears all the pending output signals. If, while the movement is still active, Execute is set to FALSE, execution of the movement that had started continues unaffected. The signals provided at the end of the movement (Error, ErrorID, CommandAborted, InVelocity) are made available for one cycle.

Hint: The monitoring of the movement may be aborted by calling a block of type MC_AxUtiCancelMonitoring_BkPlcMc. This will cause the block to signal CommandAborted. A subsequent call with Execute=FALSE will place the block in its idle state..


TcPlcHydraulics: PLCopen Motion Control: Motion: MC_Stop_BkPlcMc

FUNCTION_BLOCK MC_Stop_BkPlcMc

This function block cancels an active motion operation and monitors the stopping operation of an axis.

VAR_INPUT
    Execute:		BOOL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : A rising edge at this input ends a movement being carried out by the axis.

Busy: A pending command is indicated here.

Done : Successful processing of the operation is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • The stop can only be executed if the axis is actively carrying out a movement. If it is stationary, the block immediately asserts the Done signal.
  • If the axis is already in a fault state, or if it is in the process of carrying out a stop operation, it responds with Error and ErrorID:=dwTcHydErrCdNotReady.

The Stop operation begins if these checks can be carried out without problems.

If the movement algorithm reports an error code while the movement is being executed, the block responds with Error and ErrorID:=the movement algorithm's error code. If completion of the movement is prevented by the activity of another block, the block responds with CommandAborted. Successful completion of the operation is reported with Done.

A falling edge at Execute clears all the pending output signals. If, while the stop operation is still active, Execute is set to FALSE, execution of the operation that had started continues unaffected. The signals provided at the end of the movement (Error, ErrorID, Done) are made available for one cycle.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: Axis_Ref_BkPlcMc

TYPE Axis_Ref_BkPlcMc (up to including V2.1)

The variables in this structure are integrating all subcomponents of the axis. A variable of this typ is supplied to most of the function blocks of the library. So this type is comparable to the AXIS_REF data typ og the PlcOpen.

TYPE Axis_Ref_BkPlcMc:
STRUCT
    sAxisName:	STRING := 'NoName';
    pStAxParams:	POINTER TO ST_TcHydAxParam:=0;
    pStAxRtData:	POINTER TO ST_TcHydAxRtData:=0;
    pStAxLogBuffer:	POINTER TO ST_TcMcLogBuffer:=0;
    pStAxEncInput:	POINTER TO ST_TcPlcMcEncoderIn:=0;
    pStAxEncOutput:	POINTER TO ST_TcPlcMcEncoderOut:=0;
    pStAxDriveInput:	POINTER TO ST_TcPlcMcDriveIn:=0;
    pStAxDriveOutput:	POINTER TO ST_TcPlcMcDriveOut:=0;
    pStAxAx2000In:	POINTER TO ST_TcPlcMcAx2000In:=0;
    pStAxAx2000Out:	POINTER TO ST_TcPlcMcAx2000Out:=0;
    pStAxAuxLabels:	POINTER TO ST_TcMcAuxDataLabels:=0;
    nActiveRequest:	UDINT:=0;
    bParamsEnable:	BOOL:=FALSE;
    nState:		E_TcMCFbState:=McState_Standstill;
    nInitState:	INT:=0;
    nInitError:	DINT:=0;
    nInterfaceType:	UINT := 16#FFFF;
    nRtDataType:	UINT := 16#FFFF;
    nParamType:	UINT := 16#FFFF;
    nEncInType:	UINT := 16#FFFF;
    nEncOutType:	UINT := 16#FFFF;
    nDriveInType:	UINT := 16#FFFF;
    nDriveOutType:	UINT := 16#FFFF;
    nAx2000InType:	UINT := 16#FFFF;
    nAx2000OutType:	UINT := 16#FFFF;
    nLogBufferType:	UINT := 16#FFFF;
    nLogLevel:	DINT := 0;
END_STRUCT
END_TYPE

sAxisName: The text name of the axes.

pStAxParams: The address a variable of type ST_TcHydAxParam. This variable contains the parameters of the axis.

pStAxRtData: The address of a variable of type ST_TcHydAxRtData. This variable contains the runtime data of the axis.

pStAxLogBuffer: The address of a variable of type ST_TcMcLogBuffer. This variable contains the LogBuffer of the library.

pStAxEncInput: The address of a variable of type ST_TcPlcMcEncoderIn. This variable contains the encoder input interface of the axis.

pStAxEncOutput: In the address of a variable of type ST_TcPlcMcEncoderOut. This variable contains the encoder output interface of the axis.

pStAxDriveInput: The address of a variable of type ST_TcPlcMcDriveIn. This variable contains the drive input interface of the axis.

pStAxDriveOutput: The address of a variable of type ST_TcPlcMcDriveOut. This variable contains the drive output interface of the axis.

pStAxAx2000In: The address of a variable of type ST_TcPlcMcAx2000In. This variable contains the drive input interface of the axis.

pStAxAx2000Out: The address of a variable of type ST_TcPlcMcAx2000Out. This variable contains the drive output interface of the axis.

pStAxAuxLabels: The address of a variable of type ST_TcMcAuxDataLabels. This variable contains the text labels for the applacation parameters in ST_TcHydAxParam:fCustomerData[..].

nActiveRequest: Every block sets a code here that starts a function on this axis. After this, the block monitors this variable to see if it is changed by another block that is taking over control through another function. In this way any block can tell whether a function that it has started has been interrupted by another block, and can generate appropriate signals.

bParamsEnable: This variable is only TRUE if the parameters have been placed into a valid state by being loaded from the file. Saving the parameters will also assert this signal, because this also ensures consistency between the data in the parameter structure and in the file. The axis is not ready to operate while this variable is not TRUE. Note: At run-time, write accesses to the parameter structure temporarily set this variable to FALSE, after which it is returned to its previous state.

nState: The current state of the axis is stored here, encoded in accordance with E_TcMCFbState.

nInitState: The current state of the initialising process.

nInitError: An encoded error message from the initialising process is provided here.

nInterfaceType: The type code of the structure type in use.

nRtDataType: The type code of the structure type in use.

nParamType: The type code of the structure type in use.

nEncInType: The type code of the structure type in use.

nEncOutType: The type code of the structure type in use.

nDriveInType: The type code of the structure type in use.

nDriveOutType: The type code of the structure type in use.

nAx2000InType: The type code of the structure type in use.

nAx2000OutType: The type code of the structure type in use.


TcPlcHydraulics: PLCopen Motion Control: Data types: MC_CAM_ID_BkPlcMc

TYPE MC_CAM_ID_BkPlcMc

(internal use only) .

TYPE MC_CAM_ID_BkPlcMc:
STRUCT
    stCamRef:		MC_CAM_REF_BkPlcMc;
    bValidated:	BOOL:=FALSE;
    bPeriodic:	BOOL:=FALSE;
    bMasterAbs:	BOOL:=FALSE;
    bSlaveAbs:	BOOL:=FALSE;
    bIsChanged:	BOOL:=TRUE;
END_STRUCT
END_TYPE

stCamRef: A copy of the MC_CAM_REF_BkPlcMc structure.

bValidated: Here the struktur is marked as valid if it is initialised by a block of type MC_CamTableSelect_BkPlcMc.

bPeriodic: Reserved.

bMasterAbs: This flag marks the data in the master row of the table as absolute or as relative to the masters position at coupling.

bSlaveAbs: This flag marks the data in the slave row of the table as absolute or as relative to the slaves position at coupling.

bIsChanged: Reserved.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: MC_CAM_REF_BkPlcMc

SPS libraries: TcPlcHydraulics

TYPE MC_CAM_REF_BkPlcMc

(internal use only) .

TYPE MC_CAM_REF_BkPlcMc:
STRUCT
    pTable:		POINTER TO LREAL:=0;
    nFirstIdx:	UDINT:=1;
    nLastIdx:		UDINT:=1;
    bEquiDistant:	BOOL:=FALSE;
END_STRUCT
END_TYPE

pTable: The adresse of the camming data table.

nFirstIdx: The index of the first table line.

nLastIdx: The index of the last table line.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: MC_CAMSWITCH_REF_BkPlcMc

TYPE MC_CAMSWITCH_REF_BkPlcMc

TYPE MC_CAMSWITCH_REF_BkPlcMc:
STRUCT
    TrackNumber:	INT;
    FirstOnPosition:	LREAL;
    LastOnPosition:	LREAL;
    AxisDirection:	INT;
    CamSwitchMode: 	INT;
    Duration:		LREAL;
    (* private members, do not touch *)
    bCurrentState:	BOOL;
    fTimer:		LREAL;
    (**)
END_STRUCT
END_TYPE

TrackNumber: This is an index into an ARRAY [ciBkPlcMc_TrackRef_MinIdx..ciBkPlcMc_TrackRef_MaxIdx] OF MC_TRACK_REF_BkPlcMc, passed to a block of type MC_DigitalCamSwitch_BkPlcMc.

FirstOnPosition:

LastOnPosition:

AxisDirection: This value controles the direction, that is activating the cam: 0 = both directions, 1 = positive direction, 2 = negative direction.

CamSwitchMode: The working mode of the cam: set to 0 for position controlled cams and to 1 for time controlled cams.

Duration: For time controlled cams the signalling duration has to be placed hier.

The elements below are runtime variables and must not be changed or used by the application.

bCurrentState:

fTimer:


TcPlcHydraulics: PLCopen Motion Control: Datentypen: MC_Direction_BkPlcMc

TYPE MC_Direction_BkPlcMc

The constants listed here are used to identify the direction in which axes are moving.

TYPE MC_Direction_BkPlcMc:
(
MC_Positive_Direction_BkPlcMc := 1,
MC_Shortest_Way_BkPlcMc,
MC_Negative_Direction_BkPlcMc,
MC_Current_Direction_BkPlcMc
);
END_TYPE

MC_Positive_Direction_BkPlcMc: The movement is in the direction of rising values of position.

MC_Shortest_Way_BkPlcMc: The direction of movement is selected so that the distance covered is as short as possible.

MC_Negative_Direction_BkPlcMc: The movement is in the direction of falling values of position.

MC_Current_Direction_BkPlcMc: The movement is in the same direction as the most recently executed movement.


TcPlcHydraulics: PLCopen Motion Control: Data types: MC_OUTPUT_REF_BkPlcMc

TYPE MC_OUTPUT_REF_BkPlcMc

TYPE MC_OUTPUT_REF_BkPlcMc:
STRUCT
    OutputBits: UDINT:=0;
END_STRUCT
END_TYPE

OutputBits: The output signals adressed by this structure.


TcPlcHydraulics: PLCopen Motion Control: Data types: MC_StartMode_BkPlcMc

TYPE MC_StartMode_BkPlcMc

The constants listed here are used to identify the starting method of the axes.

TYPE MC_StartMode_BkPlcMc:
(
    MC_StartMode_Absolute:=1,
    MC_StartMode_Relative,
    MC_StartMode_RampIn
);
END_TYPE

MC_StartMode_Absolute: Slave setpoints calculated by blocks of type MC_CamIn_BkPlcMc are assumed to be absolute.

MC_StartMode_Relative: Slave setpoints calculated by blocks of type MC_CamIn_BkPlcMc are assumed to be relative to the coupling point.

MC_StartMode_RampIn: Not suported.


TcPlcHydraulics: PLCopen Motion Control: Data types: MC_TRACK_REF_BkPlcMc

TYPE MC_TRACK_REF_BkPlcMc

TYPE MC_TRACK_REF_BkPlcMc:
STRUCT
    OnCompensation:	LREAL;
    OffCompensation:	LREAL;
    Hysteresis:	LREAL;
END_STRUCT
END_TYPE

OnCompensation: The dead time in seconds that has to be compensated on the rising edge of the output signal.

OffCompensation: The dead time in seconds that has to be compensated on the falling edge of the output signal.

Hysteresis: not supported

A positive value for the dead time compensation will cause a delayed signaling. For a negative value the signaling will be done in advance.

Hint: The given time cannot be maintained accurately if rate of change of the controlling value is varying. If the controlling value is the actual position of an axis the actual velocity has to be constant.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: E_TcMcCurrentStep

TYPE E_TcMcCurrentStep

The constants listed here are used to identify the internal states of the setpoint generators.

Hinweis: Not all states are used and supported by all setpoint generators.

TYPE E_TcMcCurrentStep :(
iTcHydStateIdle,
iTcHydStateTcAccP,
iTcHydStateTcAccM,
iTcHydStatePcAccP,
iTcHydStatePcAccM,
iTcHydStateConstVeloP,
iTcHydStateConstVeloM,
iTcHydStatePcDecP,
iTcHydStatePcDecM,
iTcHydStateCreepVeloP,
iTcHydStateCreepVeloM,
iTcHydStateTcDecP,
iTcHydStateTcDecM,
iTcHydStateFeedStopPos,
iTcHydStateFeedStopNeg,
iTcHydStateCoupling := 1000,
iTcHydStateCoupled,
iTcHydStateExtGenerated := 2000,
iTcHydStateEmergencyBreak := -9999,
iTcHydStateFault := -9998
);
END_TYPE

iTcHydStateIdle: The axis is not performing an active move operation. Its behaviour is determined by ST_TcHydAxParam.fLagAmp, ST_TcHydAxParam.fTargetClamping and ST_TcHydAxParam.fReposDistance.

iTcHydStateTcAccP: The axis is raising a positive setpoint according to ST_TcHydAxRtData.fDestAcc. This internal parameter is set to the parameters of a motion command by a starting function block. If the setpoint is coming up to the requested value the state is changed to iTcHydStateConstVeloP. If the braking operation is to be started before coming up to the requested value the state is changed to iTcHydStatePcDecP. If the feed enable is dropped the state is changed to iTcHydStateFeedStopPos.

iTcHydStateTcAccM: The axis is raising a negative setpoint according to ST_TcHydAxRtData.fDestAcc. This internal parameter is set to the parameters of a motion command by a starting function block. If the setpoint is coming up to the requested value the state is changed to iTcHydStateConstVeloM. If the braking operation is to be started before coming up to the requested value the state is changed to iTcHydStatePcDecM. If the feed enable is dropped the state is changed to iTcHydStateFeedStopNeg.

iTcHydStatePcAccP: The axis is in a position controlled acceleration state of a move in positive direction. The setpoint is raised according to ST_TcHydAxRtData.fDestAcc. When the setpoint has been coming up to the requested value from the motion command the state is changed to iTcHydStateConstVeloP.

iTcHydStatePcAccM: The axis is in a position controlled acceleration state of a move in negative direction. The setpoint is raised according to ST_TcHydAxRtData.fDestAcc. When the setpoint has been coming up to the requested value from the motion command the state is changed to iTcHydStateConstVeloM.

iTcHydStateConstVeloP: The axis is moving in positive direction. The constant setpoint is defined by the values of the motion command.

iTcHydStateConstVeloM: The axis is moving in negative direction. The constant setpoint is defined by the values of the motion command.

iTcHydStatePcDecP: The axis is in a position controlled deceleration state of a move in positive direction. The setpoint is decreased according to ST_TcHydAxRtData.fDestDec. When the setpoint has been reaching ST_TcHydAxParam.fCreepSpeed the state is changed to iTcHydStateCreepVeloP.

iTcHydStatePcDecM: The axis is in a position controlled deceleration state of a move in negative direction. The setpoint is decreased according to ST_TcHydAxRtData.fDestDec. When the setpoint has been reaching ST_TcHydAxParam.fCreepSpeed the state is changed to iTcHydStateCreepVeloM.

iTcHydStateCreepVeloP: The axis is moving in positive direction. The constant setpoint is defined by ST_TcHydAxParam.fCreepSpeed.

iTcHydStateCreepVeloM: The axis is moving in negative direction. The constant setpoint is defined by ST_TcHydAxParam.fCreepSpeed.

iTcHydStateTcDecP: The axis is running a regular stop operation from a move in positive direction. The setpoint is decreased according to ST_TcHydAxParam.fStopRamp. When the setpoint is reaching zero the state is changed to iTcHydStateIdle.

iTcHydStateTcDecM: The axis is running a regular stop operation from a move in negative direction. The setpoint is decreased according to ST_TcHydAxParam.fStopRamp. When the setpoint is reaching zero the state is changed to iTcHydStateIdle.

iTcHydStateFeedStopPos: The axis is running an intermediate stop operation from a move in positive direction because in ST_TcHydAxRtData.nDeCtrlDWord the feed enable dwTcHydDcDwFdPosEna is dropped to FALSE. The setpoint is decreased according to ST_TcHydAxParam.fStopRamp. When the setpoint is reaching zero the axis is waiting for the feed enable changing to TRUE.

iTcHydStateFeedStopNeg: The axis is running an intermediate stop operation from a move in negative direction because in ST_TcHydAxRtData.nDeCtrlDWord the feed enable dwTcHydDcDwFdNegEna is dropped to FALSE. The setpoint is decreased according to ST_TcHydAxParam.fStopRamp. When the setpoint is reaching zero the axis is waiting for the feed enable changing to TRUE.

iTcHydStateCoupling: The axis is in an internediate state and will change state to iTcHydStateCoupled.

iTcHydStateCoupled: The setpoint of the axis is calculated from the setpoint of another axis according the rules of a gear box functionality.

iTcHydStateExtGenerated: The setpoint of the axis is generated by some other function block. This can be a function block from the library or from the application.

iTcHydStateEmergencyBreak: The axis is running an emergency stop operation from a move in any direction. The setpoint is decreased according to ST_TcHydAxParam.fEmergencyRamp. When the setpoint is reaching zero the presence of a fault state (ST_TcHydAxRtData.nErrorCode unequal to 0) is checked. In this case the state is changed to iTcHydStateFault, otherwise the new state is iTcHydStateIdle.

iTcHydStateFault: The axis is in a fault state. It is not performing any kind of controlled movement and will not accept motion commands. Use a MC_Reset_BkPlcMc or MC_ResetAndStop_BkPlcMc function block to put the axis into a functional state.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: E_TcMcDriveType

TYPE E_TcMcDriveType

The constants listed here are used to identify the hardware used to output the control values for an axis.

TYPE E_TcMcDriveType :(
(*
The existing sequence may not be changed.
New types must be added at the end.
If a type is to be omitted, it must be replaced by a dummy,
so that the numerical assignments are still guaranteed.
*)
iTcMc_Drive_Customized,
iTcMc_DriveLowCostStepper,
iTcMc_DriveKL2521,
iTcMc_DriveKL4032,
iTcMc_DriveAx2000,
iTcMc_DriveM2400_D1,
iTcMc_DriveM2400_D2,
iTcMc_DriveM2400_D3,
iTcMc_DriveM2400_D4,
iTcMc_DriveLowCostStepperHS,
iTcMc_DriveLowCostStepperFS,
iTcMc_DriveIx2512_1Coil,
iTcMc_DriveIx2512_2Coil,
iTcMc_DriveKL2531,
iTcMc_DriveKL2541,
iTcMc_DriveEL4032
);
END_TYPE

iTcMc_Drive_Customized: The control value for the drive has not been prepared for output on any particular hardware. This process must be carried out by the PLC application itself.

iTcMc_DriveLowCostStepper: Incremental changes to the set position are generated as the digital output signals for a directly driven stepper motor. This code continues to be supported for reasons of compatibility, and has the same meaning as iTcMc_DriveLowCostStepperHS.

iTcMc_DriveKL2521: The set value for the drive has been appropriately processed for output on a KL2521 Pulse Train terminal.

iTcMc_DriveKL4032: The set value for the drive has been appropriately processed for output on a ±10 V KL4032 analog output terminal.

iTcMc_DriveAx2000: The set value for the drive has been appropriately processed for output on an AX2000 actuator on the Beckhoff II/O or on the Sercos fieldbus.

iTcMc_DriveM2400_D1: The set value for the drive has been appropriately processed for output on the first channel of an M2400 Box on the Beckhoff II/O.

iTcMc_DriveM2400_D2: The set value for the drive has been appropriately processed for output on the second channel of an M2400 Box on the Beckhoff II/O.

iTcMc_DriveM2400_D3: The set value for the drive has been appropriately processed for output on the third channel of an M2400 Box on the Beckhoff II/O.

iTcMc_DriveM2400_D4: The set value for the drive has been appropriately processed for output on the fourth channel of an M2400 Box on the Beckhoff II/O.

iTcMc_DriveLowCostStepperHS: Incremental changes to the set position are generated as the digital output signals for a directly driven stepper motor. Half-stepping is being used.

iTcMc_DriveLowCostStepperFS: Incremental changes to the set position are generated as the digital output signals for a directly driven stepper motor. Full-stepping is being used.

iTcMc_DriveIx2512_1Coil: The set value for the drive has been appropriately processed for output on a fieldbus box IP/IE2512. The rules for one coil valves are applied.

iTcMc_DriveIx2512_2Coil: The set value for the drive has been appropriately processed for output on a fieldbus box IP/IE2512. The rules for two coil valves are applied.

iTcMc_DriveKL2531: reserved.

iTcMc_DriveKL2541: reserved.

iTcMc_DriveEL4032: reserved.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: E_TcMcEncoderType

TYPE E_TcMcEncoderType

The constants listed here are used to identify the hardware used to acquire the actual values for an axis.

TYPE E_TcMcEncoderType :(
(*
The existing sequence may not be changed.
New types must be added at the end.
If a type is to be omitted, it must be replaced by a dummy,
so that the numerical assignments are still guaranteed.
*)
iTcMc_EncoderSim,
iTcMc_EncoderDigIncrement,
iTcMc_EncoderLowCostStepper,
iTcMc_EncoderKL2521,
iTcMc_EncoderKL3042,
iTcMc_EncoderKL5001,
iTcMc_EncoderKL5101,
iTcMc_EncoderAx2000,
iTcMc_EncoderDigCam,
iTcMc_EncoderIx5009,
iTcMc_EncoderM2510,
iTcMc_EncoderKL3002,
iTcMc_EncoderKL2531,
iTcMc_EncoderKL5111,
iTcMc_EncoderAbs32,
iTcMc_EncoderM3120,
iTcMc_EncoderKL2541,
iTcMc_EncoderEL3002,
iTcMc_EncoderEL3042,
iTcMc_EncoderEL5001,
iTcMc_EncoderEL5101
);
END_TYPE

iTcMc_EncoderSim: The virtual actual position of the axis is a copy of the set position. Warning: On a real machine this type must only be used for virtual axes. Otherwise the axis will carry out uncontrolled and unpredictable movements.

iTcMc_EncoderDigIncrement: The incremental actual value of the axis is formed by evaluating two digital input bits. These represent the A and B tracks of an incremental encoder, and are evaluated, in accordance with the principle of a quadrature decoder, using quadruple evaluation. Warning: Only one of the input bits may change its state in each PLC cycle. This means that the maximum velocity is one increment per TCycle.

iTcMc_EncoderLowCostStepper: Incremental changes to the actual position are generated from the output signals for a digitally operated stepper motor.

iTcMc_EncoderKL2521: The incremental actual position is generated from the pulse counter of a KL2521 Pulse Train terminal.

iTcMc_EncoderKL3042: The absolute actual position is formed from the A/D converter value from a KL3042 0..20 mA analog input terminal.

iTcMc_EncoderKL5001: The absolute actual position is formed from the counter value from a KL5001 SSI input terminal.

iTcMc_EncoderKL5101: The incremental actual position is formed from the counter value from a KL5101 input terminal.

iTcMc_EncoderAx2000: The incremental actual position is determined from the counter value of an AX2000 actuator on the Beckhoff II/O or Sercos fieldbus.

iTcMc_EncoderDigCam: The position cams byte is formed from four digital input signals.

iTcMc_EncoderIx5009: The absolute actual position is formed from the counter value from a IP/IE5009 SSI fieldbus box.

iTcMc_EncoderM2510: The absolute actual position is formed from the A/D converter value from a M2510 ±10V analog input box.

iTcMc_EncoderKL3002: The absolute actual position is formed from the A/D converter value from a KL3002 ±10V analog input terminal.

iTcMc_EncoderKL2531: The incremental actual position is generated from the pulse counter of a KL2531 stepper motor terminal.

iTcMc_EncoderKL5111: The incremental actual position is formed from the counter value from a KL5111 input terminal.

iTcMc_EncoderAbs32: The absolute actual position is formed from the 32 bit value from a nonspecialised input device.

iTcMc_EncoderM3120: The incremental actual position is formed from the counter value from a M3120 Lightbus box.

iTcMc_EncoderKL2541: reserved.

iTcMc_EncoderEL3002: reserved.

iTcMc_EncoderEL3042: reserved.

iTcMc_EncoderEL5001: reserved.

iTcMc_EncoderEL5101: reserved.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: E_TcMCFbState

TYPE E_TcMCFbState

The constants listed here are used to identify the runtime states of the axes.

TYPE E_TcMCFbState :
(
McState_Standstill := 0,
McState_DiscreteMotion,
McState_Continousmotion,
McState_Synchronizedmotion,
McState_Stopping,
McState_Errorstop
);
END_TYPE

McState_Standstill: The axis does not have a motion command. Active position control, automatic reposit monitoring, the output of a press control value or none of these will be carried out, depending on the parameterisation.

McState_DiscreteMotion: The axis executes a movement with a defined destination position and velocity.

McState_Continousmotion: The axis executes a movement without any defined destination position. Only the velocity is specified.

McState_Synchronizedmotion: The axis executes a movement that is defined in dependency of the movement of another axis.

McState_Stopping: The axis is carrying out a stop.

McState_Errorstop: The axis has been stopped because of a problem. It cannot at present be started, and requires a reset before it will be in a condition from which it can start.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: E_TcMcHomingType

TYPE E_TcMcHomingType

The constants listed here are used to identify the referencing method of the axes.

TYPE E_TcMcHomingType :(
iTcMc_HomingOnBlock,
iTcMc_HomingOnIndex,
iTcMc_HomingOnSync
);
END_TYPE

iTcMc_HomingOnBlock: The axis is moved in the direction specified by ST_TcHydAxParam.bEnc_RefIndexPositive with ST_TcHydAxParam.fEnc_RefIndexVelo. If no movement is detected over a period of 2 seconds, the fixed stop (block) is considered to have been reached. The actual value for the axis is set to the value of the reference position.

iTcMc_HomingOnIndex: The axis is moved in the direction specified by ST_TcHydAxParam.bEnc_RefIndexPositive with ST_TcHydAxParam.fEnc_RefIndexVelo. The axis is stopped if the reference cam (bit 5, dwTcHydDcDwRefIndex) is detected in ST_TcHydAxRtData.nDeCtrlDWord. It is then moved with ST_TcHydAxParam.fEnc_RefSyncVelo in the direction specified by ST_TcHydAxParam.bEnc_RefSyncPositive until the reference cam has again been left. The actual value for the axis is set to the value of the reference position.

iTcMc_HomingOnSync: The axis is moved in the direction specified by ST_TcHydAxParam.bEnc_RefIndexPositive with ST_TcHydAxParam.fEnc_RefIndexVelo. The axis is stopped if the reference cam (bit 5, dwTcHydDcDwRefIndex) is detected in ST_TcHydAxRtData.nDeCtrlDWord. It is then moved with ST_TcHydAxParam.fEnc_RefSyncVelo in the direction specified by ST_TcHydAxParam.bEnc_RefSyncPositive until the reference cam has again been left. The encoder's hardware latch is then activated, and the axis is moved on until the latch becomes valid. After the axis has stopped, the actual value for the axis is set to a value that is calculated from the reference position and from the distance covered since the encoder's sync pulse was detected.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: E_TcMCParameter

TYPE E_TcMCParameter

The constants listed here are used for numbering parameters.

TYPE E_TcMCParameter :
(
(*
=================================================================
= W A R N I N G =
=================================================================
= These codes are also used to identify parameters =
= in the files. Changing the code would =
= make the files (not detectably) incompatible and could =
= lead to a system crash! =
=================================================================
= THE ONLY possibility therefore is to add new codes! =
=================================================================
= These codes are also used for ADS communication =
=================================================================
*)
McPara_CommandedPosition := 1,
McPara_SWLimitPos,
McPara_SWLimitNeg,
McPara_EnableLimitPos,
McPara_EnableLimitNeg,
McPara_MaxVelocitySystem,
McPara_MaxVelocityAppl,
McPara_ActualVelocity,
McPara_CommandedVelocity,
McPara_MaxAccelerationSystem,
McPara_MaxAccelerationAppl,
McPara_MaxDecelerationSystem,
McPara_MaxDecelerationAppl,
(* ============================================================== *)
McPara_BkPlcMc_ProfilType:=1000, (* Typ-Codes *)
McPara_BkPlcMc_EnvCycletime,
McPara_BkPlcMc_AxName,
(* Encoder-Parameter *)
McPara_BkPlcMc_EncoderType:=1100,
McPara_BkPlcMc_EncoderHomingType,
McPara_BkPlcMc_EncoderZeroShift,
McPara_BkPlcMc_EncoderIncWeighting,
McPara_BkPlcMc_EncoderRefIndexVelo,
McPara_BkPlcMc_EncoderRefIndexPositive,
McPara_BkPlcMc_EncoderRefSyncVelo,
McPara_BkPlcMc_EncoderRefSyncPositive,
(* Ventil-Parameter *)
McPara_BkPlcMc_ValveOverlapComp:=1200,
McPara_BkPlcMc_ValveBendPointVelo,
McPara_BkPlcMc_ValveBendPointOutput,
(* Achs-Parameter *)
McPara_BkPlcMc_DriveType:=1300,
McPara_BkPlcMc_AreaRatio,
(* Beschleunigungsphase *)
McPara_BkPlcMc_StartRamp:=1400,
McPara_BkPlcMc_PosCtrlAccEna,
McPara_BkPlcMc_StartAccDistance,
(* Bremsphase *)
McPara_BkPlcMc_StopRamp:=1500,
McPara_BkPlcMc_EmergencyRamp,
(* Zielannäherung *)
McPara_BkPlcMc_CreepSpeed:=1600,
McPara_BkPlcMc_CreepDistance,
McPara_BkPlcMc_BrakeDistance,
McPara_BkPlcMc_BrakeDeadTime,
(* Ruhezustand *)
McPara_BkPlcMc_LagAmp:=1700,
McPara_BkPlcMc_LagAmpAdaptLimit,
McPara_BkPlcMc_LagAmpAdaptFactor,
McPara_BkPlcMc_ZeroCompensation,
McPara_BkPlcMc_TargetClamping,
McPara_BkPlcMc_ReposDistance,
(* Diverse Signale *)
McPara_BkPlcMc_MonPositionRange:=1800,
McPara_BkPlcMc_MonTargetRange,
McPara_BkPlcMc_MonTargetFilter,
(* Handfahrt *)
McPara_BkPlcMc_JogVeloFast:=1900,
McPara_BkPlcMc_JogVeloSlow,
(* Kundendaten *)
McPara_BkPlcMc_CustomerData:=2000,
(**)
McPara_BkPlcMc_
);
END_TYPE


TcPlcHydraulics: PLCopen Motion Control: Datentypen: E_TcMcProfileType

TYPE E_TcMcProfileType

The constants listed here are used to identify the rules used to generate the control value for an axis.

TYPE E_TcMcProfileType :
(
iTcMc_ProfileConstAcc,
iTcMc_ProfileTimePosCtrl,
iTcMc_ProfileCosine,
iTcMc_ProfileCtrlBased,
iTcMc_ProfileTimeRamp
);
END_TYPE

iTcMc_ProfileConstAcc: The control value for the drive is assembled from sections of constant acceleration and deceleration. Time (acceleration, change of velocity, stop) and distance (positioning) function as controlling values.

iTcMc_ProfileTimePosCtrl: The control value for the drive is assembled from sections of constant acceleration and deceleration. Time (acceleration, stop) and distance (acceleration, positioning) function as controlling values.

iTcMc_ProfileCosine: The control value for the drive is assembled from sections of acceleration and deceleration having cosine curves. Time (starting, stop) and distance (acceleration, positioning) function as controlling values.

iTcMc_ProfileCtrlBased: The control value for the drive is assembled from sections of constant acceleration and deceleration. Time (acceleration, change of velocity, stop) and distance (positioning) function as controlling values.

iTcMc_ProfileTimeRamp: The control value for the drive is assembled from ramping functions. Time (acceleration, change of velocity, stop) and distance (breaking, stopping) function as controlling values.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: E_TcMCSetPositionMode

TYPE E_TcMCSetPositionMode

The constants listed here are used to identify the referencing method of the axes.

TYPE E_TcMCSetPositionMode:(
RELATIVE := 0,
ABSOLUTE :=1
);
END_TYPE

RELATIVE: The actual position for the axis is changed for the reguested difference.

ABSOLUTE: The actual position for the axis is changed to the reguested value.


TYPE ST_TcHydAxParam

This structure is containing all parameters of the axis.

TYPE ST_TcHydAxParam :
STRUCT
    (* ===========================================================================
    this section isn't saved / dieser Bereich wird nicht gesichert
    =========================================================================== *)
    sParamFileName:		STRING := 'DefAxParmFile.dat';

    (* ===========================================================================
    from this point all parameters are saved / von hier an werden alle Parameter gesichert
    =========================================================================== *)
    nProfileType:		E_TcMcProfileType:=iTcMc_ProfileConstAcc;
    (*
    Valve parameters / Ventilparameter
    *)
    fValve_OverlapComp:	LREAL := 0.0; (* Valve overlap compensation / Überdeckungskompensation *)
    fValve_BendPointVelo:	LREAL := 0.0;
    fValve_BendPointOutput:	LREAL := 0.0;
    (*
    Encoder parameters / Enkoderparameter
    *)
    nEnc_Type:		E_TcMcEncoderType:=iTcMc_EncoderSim;
    nEnc_HomingType:		E_TcMcHomingType:=iTcMc_HomingOnBlock;
    fEnc_ZeroShift:		LREAL := 0.0; (* Zero shift / Nullpunktverschiebung *)
    fEnc_IncWeighting:		LREAL := 0.001; (* Increment weighting factor / Inkrement-Bewertung *)
    fEnc_IncInterpolation:	LREAL := 1.000; (* Increment interpolation factor / Inkrement-Interpolation *)
    fEnc_RefIndexVelo:		LREAL := 0.1; (* Speed for index search / Geschwindigkeit für Nockensuche *)
    bEnc_RefIndexPositive:	BOOL := FALSE; (* Direction for index search is positive / Richtung für Nockensuche ist positiv *)
    fEnc_RefSyncVelo:		LREAL := 0.1; (* Speed for sync pulse search / Geschwindigkeit für Referenzpulssuche *)
    bEnc_RefSyncPositive:	BOOL := FALSE; (* Direction for sync pulse search is positive / Richtung für Referenzpulssuche ist positiv *)
    fEnc_DefaultHomePosition:	LREAL := 0.0; (* / *)
    bEnc_Reversed:		BOOL := FALSE; (* Encoder is reversed / Enkoder zählt umgekehrt *)
    (*
    Environment parameters / Umgebungsparameter
    *)
    fCycletime:		LREAL := 0.010; (* Cycle time of calling PLC task / Zykluszeit der aufrufenden PLC Task *)
    (*
    Axis parameters / Achsparameter
    *)
    nDrive_Type:		E_TcMcDriveType:=iTcMc_DriveKL4032;
    fRefVelo:			LREAL := 500.0; (* Reference velocity, unit mm/sec / Bezugsgeschwindigkeit, Einheit mm/sek *)
    fAreaRatio:		LREAL := 1.0; (* Ratio of cylinder areas, unit none / Verhältnis der Zylinderflächen, Einheit ohne *)
    bDrive_Reversed:		BOOL := FALSE; (* Drive is reversed / Antrieb fährt umgekehrt *)
    (*
    Logical end of path / Software-Endschalter
    *)
    bSoftEndMinEna:		BOOL := FALSE; (* Enable for lower logical end of path / Freigabe für untere Software-Endlage *)
    fSoftEndMin:		LREAL := 0.0; (* Lower logical end of path, unit mm / Untere Software-Endlage, Einheit mm *)
    bSoftEndMaxEna:		BOOL := FALSE; (* Enable for upper logical end of path / Freigabe für obere Software-Endlage *)
    fSoftEndMax:		LREAL := 10000.0; (* Upper logical end of path, unit mm / Obere Software-Endlage, Einheit mm *)
    (*
    time controlled ramp up / zeitgesteuerte Beschleunigungsfunktion
    *)
    fStartRamp:		LREAL := 1.0; (* time to ref speed, unit second / Zeit bis zur Refferenzgeschwindigkeit, Einheit Sekunde *)
    (*
    position controled ramp up / weggesteuerte Beschleunigungsfunktion
    *)
    bPosCtrlAccEna:		BOOL := FALSE; (* Enable for position controled ramp up / Freigabe für weggesteuerte Beschleunigungsfunktion *)
    fStartAccDistance:		LREAL := 1.0; (* Displacement, unit mm / Abstand, Einheit mm *)
    fAcc:			LREAL := 2000.0; (* Acceleration, unit mm/second^2 / Beschleunigung, Einheit mm/Sekunde^2 *)
    (*
    position controled ramp down / weggesteuerte Bremsfunktion
    *)
    fDec:			LREAL := 500.0; (* Deceleration / Verzögerung *)
    (*
    targeting / Zielanfahrt
    *)
    fCreepSpeed:		LREAL := 80.0; (* creeping speed / Kriechgeschwindigkeit *)
    fCreepDistance:		LREAL := 1.0; (* creeping distance / Kriechstrecke *)
    fBrakeDistance:		LREAL := 0.03; (* braking distance / Bremsweg *)
    fBrakeDeadTime:		LREAL := 0.0; (* braking dead time / Bremstotzeit *)
    (*
    stop function / Anhaltefunktion
    *)
    fEmergencyRamp:		LREAL := 0.1;
    fStopRamp:		LREAL := 1.0;
    (*
    idling function / Ruhezustand
    *)
    fLagAmp:			LREAL := 0.05; (* lag error amplification / Lagereglerverstärkung *)
    fLagAmpAdaptLimit:		LREAL := 0.0;
    fLagAmpAdaptFactor:	LREAL := 0.0;
    fZeroCompensation:		LREAL := 0.0; (* offset compensation / Offsetabgleich *)
    fTargetClamping:		LREAL := 0.0; (* clamping output at target / Anpressdruck im Ziel *)
    fReposDistance:		LREAL := 0.0; (* distance from target to reposition *)
    (*
    monitoring / Überwachung
    *)
    fMonPositionRange:		LREAL := 1.0;
    fMonTargetRange:		LREAL := 1.0;
    fMonTargetFilter:		LREAL := 1.0;
    (*
    Jog velocitys / Handfahrgeschwindigkeiten
    *)
    fJogVeloFast:		LREAL := 100.0; (* Jog velocity fast, unit mm/sec / Schnelle Handfahrgeschwindigkeit, Einheit mm/sek *)
    fJogVeloSlow:		LREAL := 25.0; (* Jog velocity slow, unit mm/sec / Langsame Handfahrgeschwindigkeit, Einheit mm/sek *)
    (*
    Application limits / Begrenzungen der Anwendung
    *)
    fMaxVelo:			LREAL := 500.0; (* Max. enabled velocity, unit mm/sec / Zugelassene Maximalgeschwindigkeit, Einheit mm/sek *)
    fMaxAcc:			LREAL := 500.0; (* Max. enabled acceleration, unit mm/sec^2 / Zugelassene Beschleunigung, Einheit mm/sek^2 *)
    fMaxDec:			LREAL := 500.0; (* Max. enabled deceleration, unit mm/sec^2 / Zugelassene Verzögerung, Einheit mm/sek^2 *)
    (*
    *)
    fBrakeOnDelay:		LREAL := 500.0; (* Brake delay ON / Bremsverzögerung EIN *)
    fBrakeOffDelay:		LREAL := 500.0; (* Brake delay OFF / Bremsverzögerung AUS *)
    (*
    Customer data / Kundendaten
    *)
    fCustomerData:		ARRAY [1..iTcHydfCustDataMaxIdx] OF LREAL;
    (*-------------------------------------------------------------------------------------------------------------*)
END_STRUCT
END_TYPE

Notes on setting up an axis can be found under Setup.

sParamFileName | Effect / Reaction
MC_AxParamLoad_BkPlcMc, MC_AxParamSave_BkPlcMc | The filename (including the path) with which the parameters for this axis are to be loaded and saved is specified here.
nProfileType | Effect / Reaction
MC_AxRuntime_BkPlcMc, MC_MoveAbsolute_BkPlcMc, MC_MoveVelocity_BkPlcMc, MC_MoveRelative_BkPlcMc | Depending on this parameter, a generator block to create control values is called. The MC_Move blocks check the possibility of executing a positioning task in accordance with this parameter. Note: Only values from E_TcMcProfileType are permitted.
fValve_OverlapComp Effect / Reaction
MC_AxRuntime_BkPlcMc, MC_AxRtFinish_BkPlcMc As soon as the axis is actively being moved, the generator blocks set this value, with the correct arithmetic sign, as the current effective overlap compensation. This value is added as a component of the output to the control value by the MC_AxRtFinish blocks. Typical values for valves with overlap are 0.1 to 0.2 for 10 to 20%. It is usually possible to take this value accurately enough from the valve's data sheet.

Note: The overlapping of the valve is a result of the way the valve is constructed. In a region close to the central position of the valve, both the A and the B side are either shut off or are opened with only a small cross section, being only connected to the tank. This prevents excessive leakage oil, and the axis is held firmly.

Note: The overlap is to be set to 0.0 for zero-crossing valves.

Note: Only a range up to 1.0 is available for fOverlapComp in order to represent the range of velocities from 0 up to fRefVelo. This is taken into account by the MC_AxRtFinish block.

fValve_BendPointVelo fValve_BendPointOutput | Effect / Reaction
MC_AxRtFinish_BkPlcMc | If fBendPoint1Velo is > 0.0 the active control range of the control value is divided into two regions with different gradients. Typical values are 0.4 or 0.6 for 40% or 60% as the fBendPoint1Output and 0.1 to 0.2 for 10% to 20% as fBendPoint1Velo. The conversion curve is specified by three reference points: Control value = fOverlapComp for velocity = 0.0 Control value = fBendPointOutput for velocity = fBendPointVelo * fRefVelo Control value = 1.0 for velocity = fRefVelo Note: The bend in the characteristic curve is a result of the way the valve is constructed. The diaphragm is only built with one stage, both in the positive and in the negative control range of the valve slider . The result of this is that low velocities can be more accurately adjusted, without having to reduce the maximum velocity. Note: These parameters should be set to 0.0 for valves without a bend in the characteristic curve.
nEnc_Type | Effect / Reaction
MC_AxRtEncoder_BkPlcMc, MC_Home_BkPlcMc | Depending on this parameter, an encoder block for the acquisition of the actual values is called. The reference travel reacts correspondingly. Note: Only values from E_TcMcEncoderType are permitted.
nEnc_HomingType | Effect / Reaction
MC_Home_BkPlcMc | This parameter specifies the procedure to be used for the reference travel. Note: Only values from E_TcMcHomingType are permitted.
fEnc_ZeroShift | Effect / Reaction
MC_AxRtEncoder_BkPlcMc | This parameter is used for a zero offset shift in absolute displacement measurement systems.
fEnc_IncWeighting | Effect / Reaction
MC_AxRtEncoder_BkPlcMc | This parameter specifies the incremental evaluation of absolute and incremental displacement measurement systems.
fEnc_RefIndexVelo | Effect / Reaction
MC_Home_BkPlcMc | The search for the cam or the fixed stop is carried out during the reference travel with the velocity specified here.
bEnc_RefIndexPositive | Effect / Reaction
MC_Home_BkPlcMc | This parameter defines the direction of the movement when searching for the cam or for the fixed stop. If set to TRUE, the search direction of such a travel is taken in the direction of increasing position values.
fEnc_RefSyncVelo | Effect / Reaction
MC_Home_BkPlcMc | The cam is left during the reference travel with the velocity specified here. If iTcMc_HomingOnSync is set as the nEnc_HomingType the encoder's synchronisation pulse is looked for subsequently with this velocity.
bEnc_RefSyncPositive | Effect / Reaction
MC_Home_BkPlcMc | This parameter defines the direction of the movement when searching for the encoder's synchronisation pulse. If set to TRUE, the search direction of such a travel is taken in the direction of increasing position values.
fCycletime Effect / Reaction
MC_AxRuntime_BkPlcMc The PLC task cycle time is to be set here.

Note: This value is used as a parameter for all the time-referenced or time-dependent procedures. The result of an incorrect value is that control value ramps are executed too fast or too slowly, or that monitoring times are not correctly adhered to.

Note: This parameter is used when determining the actual velocity. An incorrect value will result in incorrect actual values.

nDrive_Type | Effect / Reaction
MC_AxRtDrive_BkPlcMc | Depending on this parameter, a drive block to output control values is called. Note: Only values from E_TcMcDriveType are permitted.
fRefVelo Effect / Reaction

MC_AxRtFinish_BkPlcMc

This parameter is used to convert physical velocities (e.g. in mm/s, value range ±fRefVelo) into standardised velocities (no unit, value range ±1.0).

Note: In order to obtain an initial entry, an approximate calculation using data sheet figures can be carried out: fRefVelo = 167 * Qnom / F with Qnom in litre/minute and F = min (A, B) in cm2.

Note: The highest velocity with which travel can be carried out should always be given as fRefVelo. This also applies to differential cylinders. In that case, the entry should be made for the "faster" direction.

Note: An incorrect value will cause the magnitude of the control value to be incorrectly calculated. The reaction of the axis is then in the opposite sense to the error: Too small a figure for fRefVelo results in excessively high axis velocities, and vice-versa.

Note: An incorrect figure will cause the overlap compensation and the bend compensation to be wrongly executed. The result of this will that the velocities during acceleration or deceleration will follow a more or less distinctly non-linear pattern.

fAreaRatio Effect / Reaction

MC_AxRtFinish_BkPlcMc

This parameter indicates the ratio of the surface areas of the piston's A and B sides. In this context, the A side refers to the side which results in a movement whose actual positions are increasingly positive when subjected to pressure or fluid flow. This value can be directly extracted from details of the mechanical construction, and is used to calculate the control value on the basis of the set velocity. Its effect is that in order to achieve the same set velocity in the slower direction, the control value output is correspondingly larger.

Note: The value is to be set to 1.0 for synchronising cylinders. The value is to be set greater than or smaller than 1.0 for differential cylinders,

Note: A value > 1.0 is interpreted in such a way that fRefVelo applies to movement in the direction in which the actual values become more negative. It follows that in the direction of increasingly positive values, only fRefVelo / fAreaRatio is available.

Note: A value < 1.0 is interpreted in such a way that fRefVelo applies to movement in the direction in which the actual values become more positive. It follows that in the direction of increasingly negative values, only fRefVelo / fAreaRatio is available.

bSoftEndMinEna | Effect / Reaction
 | If this signal is present, the target position associated with a start command in fTargetPos is checked to see whether it is equal to or greater than bSoftEndMin.
bSoftEndMin | Effect / Reaction
 | If bSoftEndMinEna is set, the target position associated with a start command in fTargetPos is checked to see whether it is equal to or greater than this value.
bSoftEndMaxEna | Effect / Reaction
 | If this signal is present, the target position associated with a start command in fTargetPos is checked to see whether it is equal to or smaller than bSoftEndMax.
bSoftEndMax | Effect / Reaction
 | If bSoftEndMaxEna is set, the target position associated with a start command in fTargetPos is checked to see whether it is equal to or smaller than this value.
fStartRamp | Effect / Reaction
 | Specifies the gradient of a time-referenced acceleration ramp. It specifies the time in which the set velocity reaches fRefVelo. If acceleration is undertaken to a lower velocity, the time required for this is correspondingly shorter. Note: A value t < fCycletime is not accepted. Note: The following formula should be used in order to convert this time value into an acceleration: A = fRefVelo / fStartRamp.
 | Specifies the gradient of a time-referenced acceleration ramp. It specifies the time in which the set velocity reaches fRefVelo. If acceleration is undertaken to a lower velocity, the time required for this is correspondingly shorter. Note: A value t < fCycletime is not accepted. Note: In order to be able to leave the starting point, a time-referenced initiation function is needed. This works with the fStartRamp parameter. This parameter should also be set to a relatively large value of some tens of seconds. On the one hand this enables reliable starting up, and is also done so as not to unnecessarily impair the low excitation movement guidance.
bPosCtrlAccEna | Effect / Reaction
fStartAccDistance Effect / Reaction
If the displacement-referenced acceleration ramp is used, the reference point for the calculation of the control value can be shifted with reference to the starting point.

Note: Special settings have to be made in this and other parameters in order to achieve a displacement-referenced or a 2-part acceleration ramp. This is discussed in more detail below.

Note: If a pure time-referenced acceleration ramp is desired, the parameter should be set to a larger positive value such as perhaps 100.0.

fAcc Effect / Reaction
This parameter specifies the acceleration when the displacement-referenced acceleration ramp is used.

Note: Special settings have to be made in this and other parameters in order to achieve a displacement-referenced or a 2-part acceleration ramp. This is discussed in more detail below.

Note: If a pure time-referenced acceleration ramp is desired, the parameter should be set to a smaller positive value (significantly smaller than the converted acceleration described under fStartRamp) such as perhaps 1.0.

Note: The following formula should be used in order to convert this acceleration into a time value: T = fRefVelo / fAcc.

This parameter specifies the maximum acceleration to be used in the course of the start-up ramp.

Note: In order to be able to leave the starting point, a time-referenced initiation function is needed. This works with the fStartRamp parameter. This parameter should also be set to a relatively large value of some tens of seconds. On the one hand this enables reliable starting up, and is also done so as not to unnecessarily impair the low excitation movement guidance.
fDec Effect / Reaction
The deceleration set here is used when braking from the travel velocity down to fCreepSpeed.

Note: Because the braking procedure is being executed under the control of a displacement-referenced deceleration ramp, this value is not maintained precisely. The deviations are determined by the principle of work, and the purpose is to bring the axis to the target position without superimposing position control on the operation mode in use.

Note: If it is found in practice that the deceleration that occurs differs significantly from the value set here, and/or that it varies sharply in the course of a braking procedure, this is usually a sign that the deceleration is too high, or that other parameters (such as fOverlapComp, fRefVelo, Ben compensation) have significantly incorrect values.

Note: The following formula should be used in order to convert this deceleration into a time value: T = fRefVelo / fDec.

This parameter specifies the maximum deceleration to be used in the course of the start-up ramp.
fCreepSpeed | Effect / Reaction
 | The target position is approached with the velocity specified here. Note: This parameter has a significant influence on the precision that can be achieved. If this velocity is multiplied by the cycle time, fCycletime, the result is the scatter that would, in theory, occur during repeated travels. This estimate only, however, applies if the creep distance specified in fCreepDistance is at least large enough for the actual velocity of the axis to become stable.
fCreepDistance Effect / Reaction
The control value reduced to fCreepSpeed at this distance from the target. The final approach to the target is made with fCreepSpeed.

Note: This parameter should be selected so that the actual velocity of the axis has become stable by the time the switch off point is reached.

Note: If the axis approaches the target with significantly varying velocities, this can be a sign that the value in this parameter is too small.

fBrakeDistance | Effect / Reaction
 | The control value is finally switched off at this distance from the target. The axis returns to the set idle behaviour. Note: If the axis is found to finish at the target with a significant tendency to be on one side (always, or almost always in front of or behind the target, bearing in mind the direction of the movement) this is usually a sign that the value in this parameter is not correct.
fBrakeDeadTime Effect / Reaction
This delay time can also be used instead of (or in combination with) a distance in order to decide about transferring to the idle behaviour. The product of the actual velocity and of this delay time is subtracted from the distance to the target before making the comparison with fBrakeDistance. This procedure improves the repeatability, by partially compensating for the scattering effect of the control value on the actual velocity as the target is approached.

Note: If the axis is found to finish at the target with a significant tendency to be on one side (always, or almost always in front of or behind the target, bearing in mind the direction of the movement) this is usually a sign that the value in this parameter is not correct.

Note: Unexpected reactions can result from this form of compensation, such as stopping long before reaching the target. You will find some explanation about this in the Knowledge Base under Trouble Shooting, KP3.

fEmergencyRamp Effect / Reaction
If a reset is given at the command interface while the axis is moving, the control value must be removed as fast as can reasonably be done. In order to avoid problems caused by immediate switch off (damage to machines, workpieces, valves as a result, for instance, of forces generated, pressure peaks or cavitation) it is possible to specify the deceleration ramp for this case.

Note: It is helpful for the value entered for this parameter to be significantly lower than that in fStopRamp.

Note: It is helpful for the value entered for this parameter to be significantly lower than that obtained by calculating a time value from fDec.

Note: The following formula should be used in order to convert this time value into a deceleration: A = fRefVelo / fEmergencyRamp.

fStopRamp Effect / Reaction
Specifies the gradient of a time-referenced deceleration ramp. It specifies the time in which the set value is reduced from fRefVelo to 0.0. If deceleration is undertaken from a lower velocity, the time required for this is correspondingly shorter.

Note: This ramp is used when entering the idle state to reduce the control value from fCreepSpeed to zero.

Note: A value t < fCycletime is not accepted.

Note: The following formula should be used in order to convert this time value into a deceleration: A = fRefVelo / fStopRamp.

fLagAmp Effect / Reaction
This is the positional control factor when the axis is in the idle state. The value is to be given in units_of_RefVelo per unit_of_actual_position. If the velocities are represented in mm/s, and the positions in mm, then the resulting unit is 1/s. To arrive at the commonly used unit of (m/min)/mm it is necessary to multiply by a factor of 100/6.

Note: The best position control results are achieved with position-controlled zero-crossing valves.

Note: If position control is not desired, this parameter should be set to 0.0.

Note: If an output is active because of the fTargetClamping parameter, position control is not carried out. If this output is reset, position control is activated.

Note: If the position of the axis at the target is too far from the set position, the value selected for this parameter is too small. It may be that either the axis or the valve is not suitable for position control, and that a different idle behaviour should be chosen.

Note: If the axis flutters noticeably at the target, or if it vibrates, the value chosen for this parameter is too high. It may be that either the axis or the valve is not suitable for position control, and that a different idle behaviour should be chosen.

fLagAmpAdaptLimit | Effect / Reaction
fLagAmpAdaptFactor | Effect / Reaction
fZeroCompensation | Effect / Reaction
 | This is the offset compensation for the analog control value output.
fTargetClamping Effect / Reaction
If the axis has reached its target as a result of an active travel, then this control value is subsequently output in the idle state. This can be used to press actively against the stop.

Note: This value is not output if the travel is interrupted as a result of a reset or of withdrawal of the enables.

Note: If a reset is triggered in the idle state after the target has been reached, or if the directional enable or the regulator enable become invalid, output of this value ceases.

Note: fTargetClamping must not be active together with automatic repositioning. Otherwise there would be a risk that overshooting the target would cause repositioning in a sense opposite to the original direction of travel, followed by the subsequent output of a set value in a direction opposite to what was intended. This would then cause the axis to swing backwards and forwards continuously, preventing the intended output of a control value that generates a pressure.

Note: If an output of this control value is active, position control is not carried out. If this control value is reset, position control is activated.

fReposDistance Effect / Reaction
If, when the axis is in the idle state, the actual position is further from the target position than the value set here, then an active movement state is adopted without the need for an external start command. The axis approaches the target with fCreepSpeed again. After this it returns to the idle state.

Note: If automatic repositioning is not desired, this parameter should be set to 0.0.

Note: If fReposDistance < fBrakeDistance automatic repositioning will not be carried out.

Note: Automatic repositioning must not be active together with fTargetClamping. Otherwise there would be a risk that overshooting the target would cause repositioning in a sense opposite to the original direction of travel, followed by the subsequent output of a set value in a direction opposite to what was intended. This would then cause the axis to swing backwards and forwards continuously, preventing the intended output of a control value that generates a pressure.

Note: If the axis continuously repositions in alternating directions when at the target, the value selected for this parameter is too small.

fMonPositionRange | Effect / Reaction
 | If the difference between the actual position and the target position of the axis is smaller than the value set here, then this is indicated through dwTcHydNsDwInTargRng (bit 3) in nStateDWord.
fMonTargetRange, fMonTargetFilter | Effect / Reaction
 | If the difference between the actual position and the target position of the axis remains for at least the time set in fMonTargetFilter at a value smaller than the setting of fMonTargetRange, this is indicated through dwTcHydNsDwInTarget (bit 4) in nStateDWord.
fJogVeloFast | Effect / Reaction
 | Set velocity for rapid manual travel.
fJogVeloSlow | Effect / Reaction
 | Set velocity for slow manual travel.
fMaxVelo | Effect / Reaction
fMaxAcc | Effect / Reaction
fMaxDec | Effect / Reaction
fCustomerData | Effect / Reaction
MC_AxParamLoad_BkPlcMc, MC_AxParamSave_BkPlcMc | This Array[1..iTcHydfCustDataMaxIdx] OF LREAL is saved and loaded along with the axis parameters. The values are, however, freely available to the application. Note: Consistency of this data is not assured during a loading process. Appropriate precautions must be taken in the application.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: ST_TcHydAxRtData

TYPE ST_TcHydAxRtData

The variables in this structure are detailing the runtime state of the axis.

TYPE ST_TcHydAxRtData :
STRUCT
    (*-------------------------------------------------------------------------------------------------------------*)
    (* Data in this Area has to be supplied by the application *)
    (* Daten in diesem Bereich sind durch die Applikation bereitzustellen *)
    (*-------------------------------------------------------------------------------------------------------------*)
    fActPos:		LREAL := 0.0;
    bActPosCams:	BYTE := 0;
    fActPressure:	LREAL := 0.0;
    nDeCtrlDWord:	DWORD := 0;
    (*-------------------------------------------------------------------------------------------------------------*)
    (* Data in this Area may to be used by the application *)
    (* Daten in diesem Bereich können durch die Applikation verwendet werden *)
    (* Do not change data in this area *)
    (* Daten in diesem Bereich dürfen nicht verändert werden *)
    (*-------------------------------------------------------------------------------------------------------------*)
    iValveOut:	INT := 0;
    iReserve:		WORD := 0;
    fOutput:		LREAL := 0.0;
    nStateDWord:	DWORD := 0;
    nAxisState:	DWORD := 0;
    nCalibrationState:	DWORD := 0;
    fActVelo:		LREAL := 0.0;
    fClampingOutput:	LREAL := 0.0;
    fPosError:	LREAL:=0.0;
    fVeloError:	LREAL:=0.0;
    fLagCtrlOutput:	LREAL := 0.0;
    fDistanceToTarget:	LREAL := 0.0;
    nErrorCode:	DWORD := 0;
    (*-------------------------------------------------------------------------------------------------------------*)
    (* Do not change data in this area *)
    (* Daten in diesem Bereich dürfen nicht verändert werden *)
    (*-------------------------------------------------------------------------------------------------------------*)
    iCurrentStep:	E_TcMcCurrentStep;
    fInternalOutput:	LREAL := 0.0;
    fActiveOverlap:	LREAL := 0.0;
    fStartPos:	LREAL := 0.0;
    fStartRampAnchor:	LREAL := 0.0;
    fDestRampEnd:	LREAL := 0.0;
    fDestPos:		LREAL := 0.0;
    fDestSpeed:	LREAL := 0.0;
    fStartRamp:	LREAL := 0.0;
    fDestAcc:		LREAL := 0.0;
    fDestDec:		LREAL := 0.0;
    fSetSpeed:	LREAL := 0.0;
    fSetSpeedOld:	LREAL := 0.0;
    fSetPos:		LREAL := 0.0;
    fSetPosOld:	LREAL := 0.0;
    fTimerTPM:	LREAL := 0.0;
    fDecDist:		LREAL := 0.0;
    fDecTime:		LREAL := 0.0;
    fAccDist:		LREAL := 0.0;
    fAccTime:		LREAL := 0.0;
    (*-------------------------------------------------------------------------------------------------------------*)
    fGearSetting:	LREAL := 0.0;
    fGearActive:	LREAL := 0.0;
    pMasterRtData:	DWORD := 0;
    pMasterParam:	DWORD := 0;
    (*-------------------------------------------------------------------------------------------------------------*)
    bEncDoLatch:	BOOL := FALSE;
    bEncLatchValid:	BOOL := FALSE;
    fEnc_RefShift:	LREAL := 0.0; (* Homing offset / Refferenzverschiebung *)
    fLatchedPos:	LREAL := 0.0;
    (*-------------------------------------------------------------------------------------------------------------*)
END_STRUCT
END_TYPE
fActPos | Effect / Reaction
MC_AxRuntime_BkPlcMc | This is the central actual axis value (to be provided by the PLC application) for axes with true position acquisition: a number of different blocks evaluate this variable in order to calculate control values, for (optional) position control, for (optional) repositioning and for switching between travel states.
bActPosCams | Effect / Reaction
 | This is the central actual axis value (to be provided by the PLC application) for axes without true position acquisition. There are at present no positioning procedures that work with this variable.
fActPressure | Effect / Reaction
 | This is an optional, auxiliary actual axis value (to be provided by the PLC application).
nDeCtrlDWord Effect / Reaction
MC_AxRtSetControllerEnable_BkPlcMc, MC_AxRtSetFeedEnableMinus_BkPlcMc, MC_AxRtSetFeedEnablePlus_BkPlcMc, MC_AxRtSetReferencingCamSignal_BkPlcMc Enables and other control bits for the axis:
Bit | Signal assignment
0 | Regulator enable = dwTcHydDcDwCtrlEnable
1 | Directional advance enable, positive = dwTcHydDcDwFdPosEna
2 | Directional advance enable, negative = dwTcHydDcDwFdNegEna
3 | reserved
4 | reserved
5 | Referencing cam = dwTcHydDcDwRefIndex
6 | reserved
7 | reserved
8 | reserved
9 | reserved
10 | reserved
11 | reserved
12 | reserved
13 | reserved
14 | reserved
15 | reserved

iValveOut | Effect / Reaction
MC_AxRtFinish_BkPlcMc, MC_AxRuntime_BkPlcMc | The control value is output here as an INT in the range from -32768 to +32767. The control value can be output immediately in this form for analog outputs, e.g. to terminals of types KL4032, KL4034, KL4132, IP4132 or IE4132.
iM2400Out | Effect / Reaction
FB_TcHydRtExtM2400 | A control value previously processed by a FB_TcHydAxRtFinish block is adapted here to the data format of the M2400 module.
fOutput | Effect / Reaction
MC_AxRtFinish_BkPlcMc | The control value is output here as an LREAL in the range from -1.0 to +1.0. This form can usefully be used for Scope recordings or for conversion into non-standard output formats.
nStateDWord Effect / Reaction

MC_AxRuntime_BkPlcMc

Axis status bits. Bit masks are stored under global constants.
Bit | Signal assignment
0 | Axis is ready for operation = dwTcHydNsDwFunctional
1 | Axis has been referenced = dwTcHydNsDwReferenced
2 | Axis is logically stationary, not actively moving = dwTcHydNsDwSteady
3 | Axis is within the target range window = dwTcHydNsDwInTargRng
4 | Axis in target position = dwTcHydNsDwInTarget
5 | reserved
6 | reserved
7 | Axis has been stopped or is carrying out a stop procedure = dwTcHydNsDwStopped
8 | Axis is executing a movement order = dwTcHydNsDwBusy
9 | Axis is moving in at the direction of positive positions = dwTcHydNsDwMoveUp
10 | Axis is moving in the direction of negative positions = dwTcHydNsDwMoveDown
11 | reserved
12 | Axis is moving with constant velocity = dwTcHydNsDwConstVelo
13 | reserved
14 | reserved
15 | reserved
16 | reserved
17 | reserved
18 | reserved
19 | reserved
20 | reserved
21 | reserved
22 | reserved
23 | reserved
24 | reserved
25 | reserved
26 | reserved
27 | reserved
28 | reserved
29 | reserved
30 | reserved
31 | Axis is in an error state = dwTcHydNsDwErrState
nAxisState Effect / Reaction
MC_AxRuntime_BkPlcMc The current state of the movement of the axis is represented here in a numerical code:
0 | Idle, no movement order
1 | not used
2 | not used
3 | Axis is moving with constant velocity
4 | Axis is accelerating
5 | Axis is decelerating

fActVelo | Effect / Reaction
MC_AxRuntime_BkPlcMc | The block executes numerical differentiation to determine the actual velocity of the axis.
fClampingOutput | Effect / Reaction
MC_AxRuntime_BkPlcMc | The currently effective control value component of the clamping output is stored here. Note: The value can be manipulated. Compatibility with the behaviour of the block must be considered in such cases. The application must be checked when the library is updated.
fDistanceToTarget | Effect / Reaction
MC_AxRuntime_BkPlcMc | The remaining distance to the target is stored here.
nErrorCode | Effect / Reaction
MC_AxRuntime_BkPlcMc | The error code currently applicable to the axis. This value is cleared when the axis is reset or started, after which it is set to an error code the first time that an error occurs. The values that occur are stored under global constants.
iCurrentStep | Effect / Reaction
MC_AxRuntime_BkPlcMc | The current travel status of the axis is encoded in this variable. The constants are specified in E_TcHydCurrentStep. Note: This value is calculated when an axis is started, and must not be manipulated.
fInternalOutput | Effect / Reaction
MC_AxRtFinish_BkPlcMc | This is an intermediate value used internally by the blocks. Note: This value is calculated when an axis is started, and must not be manipulated.
fActiveOverlap | Effect / Reaction
MC_AxRuntime_BkPlcMc, MC_AxRtFinish_BkPlcMc | This is an intermediate value used internally by the blocks. Note: This value is calculated when an axis is started, and must not be manipulated.
fStartPos | Effect / Reaction
MC_AxRuntime_BkPlcMc | fActPos is copied here at the time of a start command.
fStartRampEnd | Effect / Reaction
MC_AxRuntime_BkPlcMc | This is the reference value for displacement-referenced acceleration. Note: This value is calculated when an axis is started, and must not be manipulated.
fDestRampEnd | Effect / Reaction
MC_AxRuntime_BkPlcMc | This is the reference value for displacement-referenced braking . Note: This value is calculated when an axis is started, and must not be manipulated.
fDestPos | Effect / Reaction
MC_AxRuntime_BkPlcMc | The target position is copied here from the order at the time of the start command.
fSetSpeed | Effect / Reaction
MC_AxRuntime_BkPlcMc, MC_AxRtFinish_BkPlcMc | This is an intermediate value used internally by the blocks. Note: This value is calculated during the movement of an axis, and must not be manipulated.
fTimerTPM | Effect / Reaction
MC_AxRuntime_BkPlcMc | This is an intermediate value used internally by the blocks. Note: This value is calculated when an axis is started, and must not be manipulated.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: ST_TcMcAuxDataLabels

TYPE ST_TcMcAuxDataLabels

This structure is containing text labels for the customer specific parameters of the axis. A structure of this type can be made a component of an axis by supplying a pointer to the MC_AxUtiStandardInit_BkPlcMc block of the axis that will connect it by placing the pointer in the Axis_Ref_BkPlcMc structure of the axis.

TYPE ST_TcMcAuxDataLabels:
STRUCT
    stLabel:		ARRAY [1..20] OF STRING(20);
END_STRUCT
END_TYPE

stLabel: The text labels.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: ST_TcPlcMcAx2000In

TYPE ST_TcPlcMcAx2000In

This structure contains the input image variables for a drive.

TYPE ST_TcPlcMcAx2000In :
STRUCT
    DriveError:	UDINT:=0;
    ActualTorque:	ARRAY [0..1] OF UINT:=0;
    ActualVelo:	ARRAY [0..1] OF UINT:=0;
    ActualPos:	ARRAY [0..1] OF UINT:=0;
    DriveState:	ARRAY [0..4] OF USINT:=0;
    ActualPosEx:	ARRAY [0..1] OF UINT:=0;
    DigInputs:	DWORD:=0;
    AnaInputs:	ARRAY [0..1] OF UINT:=0;
    (**)
    bPowerOk:		BOOL:=FALSE;
    bReserved:	BOOL:=FALSE;
    (**)
    BoxState:		UINT:=0;
    btemp:		BYTE:=0;
END_STRUCT
END_TYPE

nDriveError: Blocks of type MC_Power_BkPlcMc monitor the operating state of an external power section here.

ActualPos: Blocks of type MC_AxRtEncoderAx2000_BkPlcMc use this value to determine the actual position.

uiBoxState: State word of an external power section.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: ST_TcPlcMcAx2000Out

TYPE ST_TcPlcMcAx2000Out

This structure contains the output image variables for a drive.

TYPE ST_TcPlcMcAx2000Out :
STRUCT
    DriveCtrl:	ARRAY [0..3] OF USINT:=0;
    NominalTorque:	ARRAY[0..1] OF UINT:=0;
    NominalVelo:	DINT:=0;
    DigOutputs:	WORD:=0;
    AnaOutputs:	ARRAY[0..1] OF UINT:=0;
    LED_Control:	BYTE:=0;
    LEDs1:		BYTE:=0;
    LEDs2:		BYTE:=0;
    LEDs3:		BYTE:=0;
    TermDiag:		UINT:=0;
    Ctrl0:		BYTE:=0;
    Ctrl1:		BYTE:=0;
END_STRUCT
END_TYPE

DriveCtrl: Blocks of type MC_Power_BkPlcMc provide activation signals for an external power section here.

NominalVelo: A block of type MC_AxRtDriveAx2000_BkPlcMc provides the output value for the set velocity here.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: ST_TcPlcMcDriveIn

TYPE ST_TcPlcMcDriveIn

This structure contains the input image variables for a drive.

TYPE ST_TcPlcMcDriveIn :
STRUCT
    bPowerOk:		BOOL:=FALSE;
    bEnAck:		BOOL:=FALSE;
    bReady:		BOOL:=FALSE;
    (**)
    bKL2531State:	BYTE:=0;
    uiKL2531State2:	WORD:=0;
    (**)
    uiBoxState:	UINT:=0;
    (**)
    nReserve:		ARRAY [1..20] OF BYTE;
END_STRUCT
END_TYPE

bPowerOk: This signal is monitored by blocks of type MC_Power_BkPlcMc.

bEnAck: reserved.

bReady: reserved.

bKL2531State: Status byte of a KL2531 direct stepper output terminal. This signal is monitored by blocks of type MC_AxRtDriveKL2531_BkPlcMc.

uiKL2531State2: Status word of a KL2531 direct stepper output terminal.

uiBoxState: State word of the bus coupler.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: ST_TcPlcMcDriveOut

TYPE ST_TcPlcMcDriveOut

This structure contains the output image variables for a drive.

TYPE ST_TcPlcMcDriveOut :
STRUCT
    nDacOut:		INT:=0;
    bDigOutAp:	BOOL:=FALSE;
    bDigOutAn:	BOOL:=FALSE;
    bDigOutBp:	BOOL:=FALSE;
    bDigOutBn:	BOOL:=FALSE;
    uiCount:		UINT:=0;
    (**)
    bPowerOn:		BOOL:=FALSE;
    bEnable:		BOOL:=FALSE;
    bEnablePos:	BOOL:=FALSE;
    bEnableNeg:	BOOL:=FALSE;
    (**)
    uiDacOutA:	UINT:=0;
    uiDacOutB:	UINT:=0;
    bMovePos:		BOOL:=FALSE;
    bMoveNeg:		BOOL:=FALSE;
    (**)
    bBrakeOff:	BOOL:=FALSE;
    bBrakeOffInverted:	BOOL:=FALSE;
    (**)
    bKL2531Ctrl:	BYTE:=0;
    uiKL2531Ctrl2:	WORD:=0;
    (**)
    nReserve:		ARRAY [1..20] OF BYTE;
    (**)
END_STRUCT
END_TYPE

nDacOut: This analog output signal is generated by blocks of types MC_AxRtDriveKL4032_BkPlcMc, MC_AxRtDriveM2400_BkPlcMc or MC_AxRtDriveKL2521_BkPlcMc.

bDigOutAp, bDigOutAn, bDigOutBp, bDigOutBn: These digital signals are generated by blocks of type MC_AxRtDriveLowCostStepper_BkPlcMc.

uiCount: This signal is generated by blocks of type MC_AxRtDriveLowCostStepper_BkPlcMc, and is evaluated by blocks of type MC_AxRtEncoderLowCostStepper_BkPlcMc.

bPowerOn, bEnable, bEnablePos, bEnableNeg: These signals are updated by blocks of type MC_Power_BkPlcMc.

uiDacOutA, uiDacOutA: These analog output signal is generated by blocks of type MC_AxRtDriveIx2512_BkPlcMc.

bMovePos, bMoveNeg: These signals are updated according the sign of the control value.

bKL2531Ctrl: Control byte of a KL2531 direct stepper output terminal. This signal is generated by blocks of type MC_AxRtDriveKL2531_BkPlcMc.

uiKL2531Ctrl2: Control word of a KL2531 direct stepper output terminal.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: ST_TcPlcMcEncoderIn

TYPE ST_TcPlcMcEncoderIn

This structure contains the input image variables for an encoder.

TYPE ST_TcPlcMcEncoderIn :
STRUCT
    uiCount:		UINT:=0;
    uiLatch:		UINT:=0;
    usiStatus:	USINT:=0;

    uiPZDL_RegDaten:	UINT:=0; (* KL5001 *)
    uiPZDH:		UINT:=0; (* KL5001 *)
    usiRegStatus:	USINT:=0; (* KL5001 *)

    bDigInA:		BOOL:=FALSE;
    bDigInB:		BOOL:=FALSE;

    bDigCamMM:	BOOL:=FALSE; (* DigCam *)
    bDigCamM:		BOOL:=FALSE; (* DigCam *)
    bDigCamP:		BOOL:=FALSE; (* DigCam *)
    bDigCamPP:	BOOL:=FALSE; (* DigCam *)
END_STRUCT
END_TYPE

uiCount: This counter signal is evaluated by blocks of type MC_AxRtEncoderKL3042_BkPlcMc.

uiLatch: This counter signal is evaluated by blocks of type MC_AxRtEncoderKL5101_BkPlcMc.

usiStatus: This status byte is evaluated by blocks of type MC_AxRtEncoderKL5001_BkPlcMc.

uiPZDL_RegDaten, uiPZDH: This counter signal is evaluated by blocks of type MC_AxRtEncoderKL5101_BkPlcMc.

usiRegStatus: This status byte is evaluated by blocks of type MC_AxRtEncoderKL5001_BkPlcMc.

bDigInA, bDigInB: These digital input signals are evaluated by blocks of type MC_AxRtEncoderDigInc_BkPlcMc.

bDigCamMM, bDigCamM, bDigCamP, bDigCamPP: These digital input signals are evaluated by blocks of type MC_AxRtEncoderDigCam_BkPlcMc.


TcPlcHydraulics: PLCopen Motion Control: Datentypen:ST_TcPlcMcEncoderOut

TYPE ST_TcPlcMcEncoderOut

This structure contains the output image variables for an encoder.

TYPE ST_TcPlcMcEncoderOut :
STRUCT
    usiCtrl:		USINT:=0;
END_STRUCT
END_TYPE

usiCtrl: This control byte is used by blocks of type MC_AxRtEncoderKL5101_BkPlcMc.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: ST_TcPlcMcLogBuffer

TYPE ST_TcPlcMcLogBuffer

A variable of this structured type is used to hold the message logging buffer of the library. More information about creating a logging buffer can be found at FAQ #10 of the Knowledge Base.

Warning: Data in this structure must not be modified by the application.

TYPE ST_TcMcLogBuffer:
STRUCT
    ReadIdx:		INT:=0;
    WriteIdx:		INT:=0;
    MessageArr:	ARRAY [0..19] OF ST_TcPlcMcLogEntry;
END_STRUCT
END_TYPE

ReadIdx: The write index of the buffer.

WriteIdx: The read index of the buffer.

MessageArr: The current stored set of messages.


TcPlcHydraulics: PLCopen Motion Control: Datentypen: ST_TcPlcMcLogEntry

TYPE ST_TcPlcMcLogEntry

A variable of this structured type holds one message in the message logging buffer of the library. It is used in ST_TcPlcMcLogBuffer. More information about creating a logging buffer can be found at FAQ #10 of the Knowledge Base.

Warning: Data in this structure must not be modified by the application.

TYPE ST_TcPlcMcLogEntry:
STRUCT
    TimeLow:		UDINT:=0;
    TimeHigh:		UDINT:=0;
    LogLevel:		DWORD:=0;
    Source:		DWORD:=0;
    Message:		STRING(255);
    ArgType:		INT:=0;
    diArg:		DINT:=0;
    lrArg:		LREAL:=0;
    sArg:		STRING(255);
END_STRUCT
END_TYPE

TimeLow, TimeHigh: The timestamp of the message. The creation time of the message is recorded here.

LogLevel: The level of importance of the message. A set of acceptable values is defined by the library.

Source: A coded information about the source of the message. A set of acceptable values is defined by the library.

Message: The message text, optionally containing variable format specifiers.

ArgType: The type of the optional variable part of the message.

diArg: If there is a variable message part of type DINT the value is stored here.

lrArg: If there is a variable message part of type LREAL the value is stored here.

sArg: If there is a variable message part of type STRING the value is stored here.


TcPlcHydraulics: PLCopen Motion Control: System: Controller: MC_AxCtrlAutoZero_BkPlcMc

FUNCTION_BLOCK MC_AxCtrlAutoZero_BkPlcMc

The function block is performing an automatic offset adjustment.

VAR_INPUT
    Enable:		BOOL:=FALSE;
    EnableOnMoving:	BOOL:=FALSE;
    OffsetLimit:	LREAL:=0.0;
    Tn:		LREAL:=0.0;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
    Active:		BOOL;
    Limiting:		BOOL;
END_VAR

Enable: This input controls the activity of the controller.

EnableOnMoving: This input controls the activity of the controller.

Tn: The integrating time constant of the controller.

OffsetLimit: The value of fZeroCompensation will be limited to this range.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded error message is provided here.

Active: The activity of the adjustment process on fZeroCompensation in ST_TcHydAxParam is signaled here.

Limiting: This limiting of fZeroCompensation in ST_TcHydAxParam is signaled here.

Axis: The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.

A long as Enable is set to FALSE the block will be inactive. Is Enable set to TRUE the block is deciding to be active or inactive itself. For an axis in iTcHydStateIdle state the values of fPosError and fActVelo are tested. If EnableOnMoving is set to TRUE too the block will be active, if the axis is in an active and functional state too, if the values of fSetSpeed and fActVelo enable this decision.

In the active state the value of fZeroCompensation in ST_TcHydAxParam is adjusted to make sure the axis is moving in the right direction anyhow. For a permanent high error Tn is defining the time to arrive at maximum control value. In the inactive state Error and Active are set to FALSE, ErrorID is 0 and the block is not updating fZeroCompensation.

Note: The limiting action to the range defined by OffsetLimit is active even if the block is inactive. The Output Limiting is updated.

Note: The values of OffsetLimit and fZeroCompensation are regarded to be offset voltages. So the value 10.0 is the maximum control value. Depending on the application this parameter should be in the range of 0.1 to 1.

Integrating the block into the applikation

In the calling sequence of the blocks for an axis the MC_AxCtrlAutoZero_BkPlcMc is to be placed directly before the MC_AxRtFinish_BkPlcMc block. For projects replacing the single blocks by an MC_AxStandardBody_BkPlcMc block the MC_AxCtrlAutoZero_BkPlcMc has to be called before this block.

Attention: If there are situation during the operation of the axis where the control enable of the axis is HIGH, but the axis is not showing normal movement the MC_AxCtrlAutoZero_BkPlcMc block has to be disabled. This may be caused by a blockage with or without changeover into pressure control or a reduction or shut down of the energy supply. If this is not handled correct the value of fZeroCompensation in ST_TcHydAxParam will rise to the limitation with a randomly choosen sign. When the axis becomes functional later a potentionally dangerous action of the axis is to be expected. After this the positioning performance of the axis will be poor. If the axes is operated without EnableOnMoving the disadjusted offset may be not readjusted automatically. The axis will stop outside the target range and may be it will never signal the command as done.

Note: In combination with an MC_AxStandardBody_BkPlcMc block all reactions of the MC_AxCtrlAutoZero_BkPlcMc block will be delayed for one PLC cycle. Usually this is not a problem. If this delay is causing trouble the basic blocks for encoder etc. have to be used and the MC_AxCtrlAutoZero_BkPlcMc block has to be called right before the MC_AxRtFinish_BkPlcMc block.


TcPlcHydraulics: PLCopen Motion Control: System: Controller: MC_AxCtrlPressure_BkPlcMc

FUNCTION_BLOCK MC_AxCtrlPressure_BkPlcMc

The function block is closing a pressure control loop on the axis to maintain the requested value in ST_TcHydAxRtData.fActPressure.

Note: In most cases the read back of the actual pressure can be done by using blocks of type MC_AxRtReadPressureSingle_BkPlcMc or MC_AxRtReadPressureDiff_BkPlcMc.

VAR_INPUT
    Enable:		BOOL:=FALSE;
    Reset:		BOOL:=TRUE;
    kP:		LREAL:=0.0;
    Tn:		LREAL:=0.0;
    SetPressure:	LREAL:=0.0;
    PreSet:		LREAL:=0.0;
    WindupLimit:	LREAL:=0.0;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR

Enable: This input controls the activity of the controller.

Reset: This input controls the activity of the controller and will clear the integrating part of the controller.

kP: The proportional gain factor of the controller.

Tn: The integrating time constant of the controller.

SetPressure: The pressure setpoint.

PreSet: The integrating part of the controller is precharged to this value on change into the active state.

WindupLimit: The response of the integrating part of the controller is limited to this value.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded error message is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.

A TRUE on Reset input will force the block into idle state without taking care for other control signals. In this state the proportional and the integrating part are cleared. If Reset is FALSE Enable is controling the change into an active state.

The block checks for state changes into or out of the active state by monitoring the Enable input. On a rising edge the integrating functionality is precharged to PreSet. If the output value matching SetPressure is known this information can be used to shortcut the settling time of the control loop. In the active state the controller is using kP and Tn to calculate a proportional and integrating response. The total of these partial responses is stored as setpoint in ST_TcHydAxRtData.fSetSpeed. Because this controller is taking over the task of a setpoint generator it is clearing ST_TcHydAxRtData.fLagCtrlOutput. The MC_AxRtFinish_BkPlcMc block placed behind the pressure controller is taking this response into account automatically.

The state change into the idle state clears the responses of the controller.

Integrating the block into the applikation

A block of this type has to be placed behind the blocks for reading the actual position and pressure information. It is taking over full control of the axis and replaces a setpoint generator if present.

Note: If there is a setpoint generator as well as a MC_AxCtrlPressure_BkPlcMc block these blocks have to be called alternatively or the MC_AxCtrlPressure_BkPlcMc block has to be called last to enable it to overwrite the setpoint generators output.

Setup

The four parameters kP, Tn, PreSet and WindupLimit enable the adaptation of the controller to a range of different tasks.

Attention: During the setup procedure the axis can be applied full system pressure or the pressure may show damped or undamped oscillation in a wide frequency range. If this can cause damage to the axis or its environment use adequate precautions. Be sure to have measures to deactivate the controller, anyway.

At the start Tn and Preset should be set to 0.0 and WindupLimit should be set to 1.0. The controller is now a pure proportional controller. After going to a block position and activation of the controller (Enable:=TRUE, Reset:=FALSE, SetPressure:=setpoint) the maximum applicable value for kP can be found. This is done by increasing the parameter stepwise until the loop becomes instable. Please check the loop stability by activating and deactivating the controller. In prectical work the value will be in the range of 0.1 to 0.5.

The next parameter to setup is Tn. Start of by applying a reasonable big value like 0.5. Now the actual pressure should adapt to the setpoint very slowly. By stepwise reducing the minimum setting can be found. Please check the loop stability by activating and deactivating the controller, again. If the axis starts tending to oscillate in a damped way on activation of the controller the Tn setting is to small.

The setting of WindupLimit is biasing the controller behaviour in an indirect way. This parameter is rather used for affecting the changeover performance. If the controller can build up pressure imediately because the axis doesn not need to move the value of WindupLimit should be set to a value that keeps the integrating response from going beyond about three to four times the value the valve needs in respect to its characteristics. This will short cut the time for settling of the control loop reasonably. If the axis has to travel a reasonable distance a small value will dominate the move of the axis. If the value is small the axis may approach very slowly or even fail at all. On the other hand a high value for WindupLimit may make the axis approach with high speed and cause a steep rise of the actual pressure. The peek pressure can show excessive values.

Note: If possible the pressure controller should not be activated if the axis is not at least at about the working position.

The value of PreSet can be used for two reasons. If the pressure controller should continue the work of another block the other blocks output can be used for calculating the PreSet value. By doing so jump of the setpoint on the activation of the controller is reduced or even prevented.

If the setpoint to be produced by the block the value of PreSet can be about that value. By doing so the time to build up this response in the integrating part of the controller can be reduced. Because the proportional part is active as well the applied value should be somewhat higher than the exact value.

Note: In fact the settings of the parameters have to be found by varying the value in small steps. By analysing and judging the controllers behaviour against the applications needs an adequate set of parameters have to be found.

Example for the controllers baviour on an axis that has to travel some distance before being enabled to create the requested pressure.

Example for the controllers baviour on an axis that is enabled to create the requested pressure imediately.


TcPlcHydraulics: PLCopen Motion Control: System: Controller: MC_AxCtrlPressureCompensation_BkPlcMc

FUNCTION_BLOCK MC_AxCtrlPressureCompensation_BkPlcMc

The block is adapting the output values for a valve according to the valves pressure drop. The result is resembling the effect of a pressure compensator.

Note: The use of this block requirres the sensing of the system pressure and the cylinder pressure with adequate resolution, accuracy and sample rate.

Warning: This block is replacing a block of type MC_AxRtFinish_BkPlcMc, that must not be called for this axis.

VAR_INPUT
    SystemPressure:	LREAL:=0.0;
    NominalPressure:	LREAL:=0.0;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR

SystemPressure: The system pressure level has to be passed here.

NominalPressure: The nominal valve pressure (from the makers data sheet) has to be passed here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded error message is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.

The valve pressure drop is calculated from SystemPressure und ST_TcHydAxRtData.fActPressure. All vallues raleted to the opening of the valve are adapted according to NominalPressure. Then the work of a block of type MC_AxRtFinish_BkPlcMc are carried out:

  • The control value for the advance and the positional control reaction are combined to form the output control value.
  • Area compensation is taken into account.
  • Compensation is applied for a bend in the characteristic curve.
  • The overlap compensation, the press control value and the offset compensation are included in the calculation.


TcPlcHydraulics: PLCopen Motion Control: System: Controller: MC_AxCtrlPullbackOnPressure_BkPlcMc

FUNCTION_BLOCK MC_AxCtrlPullbackOnPressure_BkPlcMc

The function block is correcting the position setpoint of the axis to keep ST_TcHydAxRtData.fActPressure from exceeding a requested setpoint.

Note: In most cases the read back of the actual pressure can be done by using blocks of type MC_AxRtReadPressureSingle_BkPlcMc or MC_AxRtReadPressureDiff_BkPlcMc.

VAR_INPUT
    EnableP:		BOOL:=FALSE;
    EnableM:		BOOL:=FALSE;
    LowerLimit:	LREAL:=0.0;
    UpperLimit:	LREAL:=1000000.0;
    kP:		LREAL:=0.0;
    Tn:		LREAL:=0.0;
    SetPressure:	LREAL:=0.0;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    LowLimiting:	BOOL;
    UpLimiting:	BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR

EnableP: A TRUE at this input enable the controller to modify the setpoint in positive direction

EnableM: A TRUE at this input enable the controller to modify the setpoint in negative direction

LowerLimit: The lower limit for the position setpoint.

UpperLimit: The upper limit for the position setpoint.

kP: The proportional gain factor of the controller.

Tn: The integrating time constant of the controller.

SetPressure: The pressure setpoint.

LowLimiting: A TRUE at this output signals, that the position setpoint has reached the value of LowerLimit.

UpLimiting: A TRUE at this output signals, that the position setpoint has reached the value of UpperLimit.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded error message is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.

The behaviour of the block is ruled by the inputs EnableP and EnableM. Depending on them the block will work in positive or negative direction. If EnableM is set the position setpoint is shifted in negative direction if the actual pressure is exceeding a requested value. For an actual pressure in the opposite direction EnableP in enabling a reaction in positive direction.

First the block decides, if it has to become active by checking EnableP, EnableM and the difference between SetPressure and ST_TcHydAxRtData.fActPressure.

In the active state a proportional response and an integrating response are calculated using kP and Tn. The total of these partial responses is a velocity, that is used for updating the position setpoint.

In the idle state all partial responses of the controller ar cleared.

Integrating the block into the applikation

A block of this type has to be placed behind the blocks for reading the actual position and pressure information and the block for the setpoint generation. If the application is calling blocks to close a velocity or position control loop they have to be placed behind the pressure controller.

The controller is calculating a response and is placing it directly into the ST_TcHydAxRtData structure. This block must not be active while the axis is actively moved.


TcPlcHydraulics: PLCopen Motion Control: System: Controller: MC_AxCtrlSlowDownOnPressure_BkPlcMc

FUNCTION_BLOCK MC_AxCtrlSlowDownOnPressure_BkPlcMc

The function block is slowing down an axis as much as is needed to keep the ST_TcHydAxRtData.fActPressure from exceeding a requested setpoint.

Note: In most cases the read back of the actual pressure can be done by using blocks of type MC_AxRtReadPressureSingle_BkPlcMc or MC_AxRtReadPressureDiff_BkPlcMc.

VAR_INPUT
    EnableP:		BOOL:=FALSE;
    EnableM:		BOOL:=FALSE;
    Reset:		BOOL:=TRUE;
    kP:		LREAL:=0.0;
    Tn:		LREAL:=0.0;
    SetPressure:	LREAL:=0.0;
    PreSet:		LREAL:=0.0;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    Response:		LREAL;
    Active:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR

EnableP: This input enables the controller to become active when the axis is traveling in positive direction.

EnableM: This input enables the controller to become active when the axis is traveling in negative direction.

Reset: This input controls the activity of the controller and will clear the integrating part of the controller.

kP: The proportional gain factor of the controller.

Tn: The integrating time constant of the controller.

SetPressure: The pressure setpoint.

PreSet: The integrating part of the controller is precharged to this value on change into the active state.

Response: The output signal of the controller.

Active: A TRUE state signals, that the controller is creating a response to close the pressure control loop.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded error message is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.

A TRUE on Reset input will force the block into idle state without taking care for other control signals. In this state the proportional and the integrating part are cleared, Active is FALSE and Response is 0.0.

In the idle state the behaviour is determined by EnableP and EnableM. They set the rules for the block becoming active while traveling in positive or negative direction. To make a decision about a state change from idle to active the block checks the sign of ST_TcHydAxRtData.fSetSpeed dnd the difference between SetPressure and ST_TcHydAxRtData.fActPressure.

If the block changes its state to active the integrating functionality is precharged in a way that adds to the output of a setpoint generator to an output value matching PreSet. If the output value matching SetPressure is known this information can be used to shortcut the settling time of the control loop. In practical work the value of this parameter should reflect the behaviour of the control path. This is strongly effected by the compressability of the object, but also biased by the used velocity. If the pressure rise is slow in respect to the choosen Tn the actual setpoint in ST_TcHydAxRtData.fSetSpeed is a good choice for PreSet. For a sharp pressure rise the PreSet value has to be calculated from the pressure setpoint in respect of the pressure transfer characteristics of the valve.

In the active state the controller is using kP and Tn to calculate a proportional and integrating response. The total of these partial responses is presented as Response and Active is TRUE.

The change into idle state cleares the controller response and Active becomes FALSE.

Integrating the block into the applikation

A block of this type has to be placed behind the blocks for reading the actual position and pressure information and the setpoint generator. If there are blocks for closing a velocity or position control loop as well as a MC_AxCtrlSlowDownOnPressure_BkPlcMc block the responses of these controllers have to be combined carefully.

The controller is calculating a response, but does not write it to the ST_TcHydAxRtData structure. This has to be done by the application depending on Active and signals from other controllers. Usually Response is stored in ST_TcHydAxRtData.fLagCtrlOutput zugewiesen. The MC_AxRtFinish_BkPlcMc block that has to be called behind the MC_AxCtrlSlowDownOnPressure_BkPlcMc block is taking the response into account automatically.


TcPlcHydraulics: PLCopen Motion Control: System: Controller: MC_AxCtrlStepperDeStall_BkPlcMc

FUNCTION_BLOCK MC_AxCtrlStepperDeStall_BkPlcMc

The block is monitoring the movement of a stepper motor, that is combined with an encoder.

Hint: The usage of a real encoder (not an encoder emulation, done by counting the output pulses of an output terminal) is unafordable here.

Hint: Even this block cannot avoid stall situations. The velocity of the axis cannot be assumed to be constant.

VAR_INPUT
    EnableAcc:	BOOL:=FALSE;
    EnableDec:	BOOL:=FALSE;
    Reset:		BOOL:=FALSE;
    VeloLimit:	LREAL:=0.0;
    LimitFilter:	LREAL:=0.0;
    UpdateFilter:	LREAL:=0.0;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    Active:		BOOL;
    Activated:	BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR

EnableAcc, EnableDec: These inputs set the rules for the activities of the block.

Reset: This input will force the block into the inactive state.

VeloLimit: This parameter defines the limit for the velocity error, that will be used for detecting a stall situation.

LimitFilter: This is the minimum time, the velocity error has to exceed the limit.

UpdateFilter: This time constant is used for adapting the velocity setpoint to the actual velocity in a stall situation.

Active: This output is signaling a stall situation.

Activated: This output is signaling, that there has been a stall situation since the last start of an active axis movement.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block first investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.

On each call the checks for reasons to change its state. It is placed in the active state if this is enabled by the motion phase in consideration of EnableAcc, EnableDec and the velocity error is exceeding VeloLimit for at least LimitFilter. EnableAcc enables a change to the active state if the velocity is constant or rising, EnableDec enables a change on constant or falling velocity. The block is signaling a change into the active state is by setting Active and Activated.

The block is placed in the inactive state if the velocity error is below half of the VeloLimit threshold. Active is cleared on this state change.

In the active state the setpoint is adapted to the actual velocity by using UpdateFilter as a time constant. If this parameter is set to 0.0 the setpoint is updated imediately.

In the inactive state Activated is cleared if the exis is starting an active movement.

Note: The block is monitoring the difference between velocity setpoint and actual velocity. It is important to use a proper seting for the reference velocity to avoid false alarms and unwanted activation of the stall handling mechanism.

The scope view below demonstrates a move that is interfered two times by mechanical collisions. In both situations the axis is stopped completely.

Integrating the block into the applikation

A block of this type has to be placed behind the blocks for reading the actual position and the setpoint generator. The block will modify the response of the setpoint generator and writes the result to the ST_TcHydAxRtData structure. The MC_AxRtFinish_BkPlcMc block that has to be called behind the block is taking the response into account automatically.


TcPlcHydraulics: PLCopen Motion Control: System: Controller: MC_AxCtrlVelocity_BkPlcMc

FUNCTION_BLOCK MC_AxCtrlVelocity_BkPlcMc

The block is closing a velocity control loop.

Note: Usually the speed of a hydraulic axis is not controlled by a closed loop because the accuracy of the positioning by use of calculated setpoints and adaptive ramping is acceptable in allmost all applications. In some special cases it makes sense to close this control loop to satisfy a request of an application or to create an active damping for an instable axis.

Note: For closing a velocity control loop while the axis is actively moved use a block of type MC_AxCtrlVeloMoving_BkPlcMc.

VAR_INPUT
    Enable:		BOOL:=FALSE;
    Reset:		BOOL:=FALSE;
    KpVelo:		LREAL:=0.0;
    TnVelo:		LREAL:=0.0;
    PreSet:		LREAL:=0.0;
    WindupLimit:	LREAL:=0.0;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR

Enable: This input is controling the activity of the controller.

Reset: This input is controling the activity and will clear the integrating part of the controller.

KpVelo: The proportional gain factor of the controller.

TnVelo: The integrating time constant of the controller.

PreSet: The integrating part of the controller is precharged to this value on change into the active state.

WindupLimit: The response of the integrating part of the controller is limited to this value.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded error message is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.

The block checks Enable and Reset to detect a state change. If the state changes from idle to active the integrating part of the controller is precharged to PreSet. In the active state the block calculates the difference between ST_TcHydAxRtData.fActVelo and ST_TcHydAxRtData.fSetSpeed * ST_TcHydAxParam.fRefVelo and creates a response by using its parameters KpVelo and TnVelo. This response is stored in ST_TcHydAxRtData.fLagCtrlOutput. The response of the integrating part of the controller is limited to WindupLimit. To disable the integrating functionality of the controller apply a TnVelo value of 0.0.

Integrating the block into the applikation

A block of this type has to be placed behind the blocks for reading the actual position and pressure information, the setpoint generation and the position control block. If there are blocks that are performing pressure control they have to be placed behind the MC_AxCtrlVeloMoving block or the rsponse of the controller blocks have to be merged carefully.

The block is calculating a response and is placing it into the ST_TcHydAxRtData structur. The MC_AxRtFinish_BkPlcMc block following the controller block is taking this response into account automatically.


TcPlcHydraulics: PLCopen Motion Control: System: Controller: MC_AxCtrlVeloMoving_BkPlcMc

FUNCTION_BLOCK MC_AxCtrlVeloMoving_BkPlcMc

The block is closing a velocity control loop while the axis is actively moved.

Note: Usually the speed of a hydraulic axis is not controlled by a closed loop because the accuracy of the positioning by use of calculated setpoints and adaptive ramping is acceptable in allmost all applications. In some special cases it makes sense to close this control loop to satisfy a request of an application or to create an active damping for an instable axis.

Note: For closing a constantly acive velocity control loop use a block of type MC_AxCtrlVelocity_BkPlcMc.

VAR_INPUT
    KpVelo:		LREAL:=0.0;
    TnVelo:		LREAL:=0.0;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR

KpVelo: The proportional gain factor of the controller.

TnVelo: The integrating time constant of the controller.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded error message is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc.

The block checks ST_TcHydAxRtData.iCurrentStep and ST_TcHydAxRtData.nCalibrationState to detect an active moving state of the axis. If this is true, the block starts to calculate the difference between ST_TcHydAxRtData.fActVelo and ST_TcHydAxRtData.fSetSpeed * ST_TcHydAxParam.fRefVelo and to create a response by using its parameters KpVelo and TnVelo. This response is stored in ST_TcHydAxRtData.fLagCtrlOutput.. To disable the integrating functionality of the controller apply a TnVelo value of 0.0.

During a home operation the actual position is presetted at least once. This is causing an actual position change, that is interpreted as a very high velocity for one PLC cycle. The block is detecting this situation and is using the actual velocity from the previous cycle to substitute the incorrect value of the current cycle.

Integrating the block into the applikation

A block of this type has to be placed behind the blocks for reading the actual position and pressure information, the setpoint generation and the position control block. If there are blocks that are performing pressure control they have to be placed behind the MC_AxCtrlVeloMoving block or the rsponse of the controller blocks have to be merged carefully.

The block is calculating a response and is placing it into the ST_TcHydAxRtData structur. The MC_AxRtFinish_BkPlcMc block following the controller block is taking this response into account automatically.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtDrive_BkPlcMc

FUNCTION_BLOCK MC_AxRtDrive_BkPlcMc

The function block performs preparation of the control value for the axis for it to be output on a hardware module. For this purpose, a block of type MC_AxRtDriveAx2000_BkPlcMc, MC_AxRtDriveKL2521_BkPlcMc, MC_AxRtDriveKL2531_BkPlcMc, MC_AxRtDriveKL2541_BkPlcMc, MC_AxRtDriveKL4032_BkPlcMc, MC_AxRtDriveLowCostStepper_BkPlcMc, MC_AxRtDriveM2400_BkPlcMc or MC_AxRtDriveIx2512_BkPlcMc is called, depending on what value has been specified for the nDrive_Type in Axis.pStAxParam.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. If the pointer pStAxRtData for the axis has been initialised, it is placed into a fault state.
  • If nDrive_Type in pStAxParams is set to an unacceptable value, the block reacts with Error and ErrorID:=dwTcHydErrCdDriveType. If the pointer pStAxRtData for the axis has been initialised, it is placed into a fault state.
  • If one of the specific sub-blocks detects a problem, it will (if possible) place the axis into a fault state. This error is then echoed at the outputs of the MC_AxRtDrive_BkPlcMc.

If it is possible to carry out these checks without encountering any problems, the control value for the axis is processed appropriately for the nDrive_Type in Axis.pStAxParams.

Note: Information about the necessary linking of I/O components with the input and output structures of the axis may be found in the Knowledge Base under FAQ #7.

Note: If only the usual blocks (encoder, generator, finish, drive) for the axis are going to be called, then a block of type MC_AxStandardBody_BkPlcMc should be used for the sake of simplicity.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtDriveAx2000_BkPlcMc

FUNCTION_BLOCK MC_AxRtDriveAx2000_BkPlcMc

(internal use only) The function block prepares the control value of the axis for output on an AX2000 servo amplifier on the Beckhoff LightBus or Sercos fieldbus. It is called by blocks of the MC_AxRtDrive_BkPlcMc type if the value iTcMc_DriveAx2000 is set as the nDrive_Type in Axis.pStAxParam.

Note: The hydraulic library only offers a restricted range of functions, even in connection with electrical drives. TwinCAT NC PTP, NC I and CNC offer a significantly broader spectrum and more comprehensive support for commissioning and diagnosis.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxAx2000In in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcDriveIn. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxAx2000Out in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcDriveOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If fEnc_IncWeighting in pStAxParams is set to an unacceptable value, the block reacts with Error and ErrorID:=dwTcHydErrCdEncScaling. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.

If it is possible to carry out these checks without encountering any problems, the control value for the axis is made available in Axis. pStAxAx2000Out in accordance with the rules of the AX amplifier.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtDriveIx2512_BkPlcMc

FUNCTION_BLOCK MC_AxRtDriveIx2512_BkPlcMc

(internal use only) The function block performs preparation of the control value for the axis so that it can be output on a PWM output terminal. It is called by blocks of the MC_AxRtDrive_BkPlcMc type if the value iTcMc_DriveIx2512_1Coil or iTcMc_DriveIx2512_2Coil is set as the nDrive_Type in Axis.pStAxParam.

VAR_INPUT
    Coils:		INT;
END_VAR
VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Coils: The number of coils (1 or 2) is provided here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxDriveOutput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcDriveOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.

If it is possible to carry out these checks without encountering any problems, the control value for the axis is made available in Axis.pStAxDriveOutput as an integral within the range ±32767. If Coils=1 the control value is stored in uiDacOutA according to these rules:

  • For positive controll values uiDacOutA is in the range of 16385 to 32767.
  • For negative controll values uiDacOutA is in the range of 0 to 16383.
  • For a controll values 0.0 uiDacOutA ist set to 16384.

If Coils is set to 2 the control value is stored in uiDacOutA and uiDacOutB according to these rules:

  • For positive controll values uiDacOutA is used. uiDacOutB is set to 0.
  • For negative controll values uiDacOutB is used. uiDacOutA is set to 0.
  • For a controll values 0.0 uiDacOutA and uiDacOutB are set to 0.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtDriveKL2521_BkPlcMc

FUNCTION_BLOCK MC_AxRtDriveKL2521_BkPlcMc

(internal use only) The function block performs preparation of the control value for the axis so that it can be output on a KL2521 pulse output terminal. It is called by blocks of the MC_AxRtDrive_BkPlcMc type if the value iTcMc_DriveKL2521 is set as the nDrive_Type in Axis.pStAxParam.

Note: The hydraulic library only offers a restricted range of functions, even in connection with electrical drives. TwinCAT NC PTP, NC I and CNC offer a significantly broader spectrum and more comprehensive support for commissioning and diagnosis.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxDriveOutput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcDriveOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.

If it is possible to carry out these checks without encountering any problems, the control value for the axis is made available in Axis.pStAxDriveOutput as an integral within the correct range of magnitudes.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtDriveKL2531_BkPlcMc

FUNCTION_BLOCK MC_AxRtDriveKL2531_BkPlcMc

(internal use only) The function block performs preparation of the control value for the axis so that it can be output on a KL2531 direct stepper output terminal. It is called by blocks of the MC_AxRtDrive_BkPlcMc type if the value iTcMc_DriveKL2531 is set as the nDrive_Type in Axis.pStAxParam.

Note: The hydraulic library only offers a restricted range of functions, even in connection with electrical drives. TwinCAT NC PTP, NC I and CNC offer a significantly broader spectrum and more comprehensive support for commissioning and diagnosis.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxDriveOutput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcDriveOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.

If it is possible to carry out these checks without encountering any problems, the control value for the axis is made available in Axis.pStAxDriveOutput as an integral within the correct range of magnitudes.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtDriveKL2541_BkPlcMc

FUNCTION_BLOCK MC_AxRtDriveKL2541_BkPlcMc

(internal use only) The function block performs preparation of the control value for the axis so that it can be output on a KL2541 direct stepper output terminal. It is called by blocks of the MC_AxRtDrive_BkPlcMc type if the value iTcMc_DriveKL2541 is set as the nDrive_Type in Axis.pStAxParam.

Note: The hydraulic library only offers a restricted range of functions, even in connection with electrical drives. TwinCAT NC PTP, NC I and CNC offer a significantly broader spectrum and more comprehensive support for commissioning and diagnosis.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxDriveOutput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcDriveOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.

If it is possible to carry out these checks without encountering any problems, the control value for the axis is made available in Axis.pStAxDriveOutput as an integral within the correct range of magnitudes.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtDriveKL4032_BkPlcMc

FUNCTION_BLOCK MC_AxRtDriveKL4032_BkPlcMc

(internal use only) The function block performs preparation of the control value for the axis so that it can be output on a ±10 V output terminal. It is called by blocks of the MC_AxRtDrive_BkPlcMc type if the value iTcMc_DriveKL4032 is set as the nDrive_Type in Axis.pStAxParam.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxDriveOutput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcDriveOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.

If it is possible to carry out these checks without encountering any problems, the control value for the axis is made available in nDacOut in Axis.pStAxDriveOutput as an integral within the range ±32767.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtDriveLowCostStepper_BkPlcMc

FUNCTION_BLOCK MC_AxRtDriveLowCostStepper_BkPlcMc

(internal use only) The function block performs preparation of the control value for the axis so that it can be output on a digital output terminal. It is called by blocks of the MC_AxRtDrive_BkPlcMc type if the value iTcMc_DriveLowCostStepper, iTcMc_DriveLowCostStepperHS or iTcMc_DriveLowCostStepperFS is set as the nDrive_Type in Axis.pStAxParam.

VAR_INPUT
    FullStep:		BOOL;
END_VAR
VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

FullStep: This specifies whether the motor is operated in half stepping or full stepping mode.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxDriveOutput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcDriveOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.

If it is possible to carry out these checks without encountering any problems, the control value for the axis is made available in Axis.pStAxDriveOutput as a bit pattern within the correct range of magnitudes.

Note: This block is most often employed together with an MC_AxRtEncoderLowCostStepper_BkPlcMc block.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtDriveM2400_BkPlcMc

FUNCTION_BLOCK MC_AxRtDriveM2400_BkPlcMc

(internal use only) The function block performs preparation of the control value for the axis so that it can be output on one of the four channels of a ±10 V M2400 output box. It is called by blocks of the MC_AxRtDrive_BkPlcMc type if one of the values iTcMc_DriveM2400_D1, iTcMc_DriveM2400_D2, iTcMc_DriveM2400_D3 or iTcMc_DriveM2400_D4 is set as the nDrive_Type in Axis.pStAxParam.

VAR_INPUT
    nMask:		WORD;
END_VAR
VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

nMask: The calling MC_AxRtDrive_BkPlcMc block passes a mask that addresses the desired channel in the output box in this parameter.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxDriveOutput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcDriveOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.

If it is possible to carry out these checks without encountering any problems, the control value for the axis is made available in Axis.pStAxDriveOutput as an integral within the correct range of magnitudes, and with the mask displayed in nDacOut.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtEncoder_BkPlcMc

FUNCTION_BLOCK MC_AxRtEncoder_BkPlcMc

This function block determines the actual position of the axis from the input information of a hardware module. For this purpose, a block of type MC_AxRtEncoderAx2000_BkPlcMc, MC_AxRtEncoderDigInc_BkPlcMc, MC_AxRtEncoderKL2521_BkPlcMc, MC_AxRtEncoderKL2531_BkPlcMc, MC_AxRtEncoderKL2541_BkPlcMc, MC_AxRtEncoderKL3042_BkPlcMc, MC_AxRtEncoderKL5001_BkPlcMc, MC_AxRtEncoderKL5101_BkPlcMc, MC_AxRtEncoderM3120_BkPlcMc, MC_AxRtEncoderLowCostStepper_BkPlcMc or MC_AxRtEncoderDigCam_BkPlcMc is called, depending on what value has been specified for the nEnc_Type in Axis.pStAxParam.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. If the pointer pStAxRtData for the axis has been initialised, it is placed into a fault state.
  • If nEnc_Type in pStAxParams is set to an unacceptable value, the block reacts with Error and ErrorID:=dwTcHydErrCdEncType. If the pointer pStAxRtData for the axis has been initialised, it is placed into a fault state.
  • If one of the specific sub-blocks detects a problem, it will (if possible) place the axis into a fault state. This error is then echoed at the outputs of the MC_AxRtEncoder_BkPlcMc.

If it is possible to carry out these checks without encountering any problems, the actual value of the axis is determined by calling a type-specific block corresponding to the nEnc_Type in Axis.pStAxParams.

Note: Information about the necessary linking of I/O components with the input and output structures of the axis may be found in the Knowledge Base under FAQ #4.

Note: If only the usual blocks (encoder, generator, finish, drive) for the axis are going to be called, then a block of type MC_AxStandardBody_BkPlcMc should be used for the sake of simplicity.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtEncoderKL5001_BkPlcMc

FUNCTION_BLOCK MC_AxRtDriveAx2000_BkPlcMc

(internal use only) The function block performs determination of the actual position of the axis from the input data of an AX2000 servo amplifier. It is called by blocks of the MC_AxRtEncoder_BkPlcMc type if the value iTcMc_EncoderAx2000 is set as the nEnc_Type in Axis.pStAxParam.

Note: The hydraulic library only offers a restricted range of functions, even in connection with electrical drives. TwinCAT NC PTP, NC I and CNC offer a significantly broader spectrum and more comprehensive support for commissioning and diagnosis.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxAx2000In in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncIn. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If it is found during a reference travel that the distance between the falling edge of the cam and the point where the latch becomes valid is less than one eighth of one rotation of the resolver, the block reacts with Error and ErrorID:=dwTcHydErrCdEncSyncDist. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.

If it is possible to carry out these checks without encountering any problems, the actual value of the axis is determined by evaluating the variables in Axis.pStAxAx2000In. fEnc_IncWeighting and fEnc_ZeroShift from Axis.pStAxParam are used to convert to the displacement units appropriate to the axis.

Note: This block supports the iTcMc_HomingOnBlock, iTcMc_HomingOnIndex and iTcMc_HomingOnSync referencing methods.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtEncoderDigCam_BkPlcMc

FUNCTION_BLOCK MC_AxRtEncoderDigCam_BkPlcMc

(internal use only) The function block is forming the position cam byte from four digital input signals. It is called by blocks of the MC_AxRtEncoder_BkPlcMc type if the value iTcMc_EncoderDigCam is set as the nEnc_Type in Axis.pStAxParam.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialized, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxEncInput in Axis_Ref_BkPlcMc is not initialized, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncIn. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialized, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If bEncDoLatch in Axis.ST_TcHydAxRtData becomes valid, the block reacts with Error and ErrorID:=dwTcHydErrCdHomingType. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData. This situation occurs if the value iTcMc_HomingOnSync is entered as the nEnc_HomingType in Axis.ST_TcHydAxParam.

If it is possible to carry out these checks without encountering any problems, the actual value of the position cam byte of the axis is formed from the four digital variables bDigCamPP, bDigCamP, bDigCamM and bDigCamMM in Axis.pStAxEncInput.

Note: This block is not supporting any kind of referencing operation.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtEncoderDigInc_BkPlcMc

FUNCTION_BLOCK MC_AxRtEncoderDigInc_BkPlcMc

(internal use only) The function block performs determination of the actual position of the axis from two digital input bits in accordance with the principle of a quadrature decoder, using quadruple evaluation. It is called by blocks of the MC_AxRtEncoder_BkPlcMc type if the value iTcMc_EncoderDigIncrement is set as the nEnc_Type in Axis.pStAxParam.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxEncInput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncIn. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If both the inputs bDigInA and bDigInB in Axis.pStAxEncInput change their values in the same cycle, the block reacts with Error and ErrorID:=dwTcHydErrCdEncCutOff. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If bEncDoLatch in Axis.ST_TcHydAxRtData becomes valid, the block reacts with Error and ErrorID:=dwTcHydErrCdHomingType. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData. This situation occurs if the value iTcMc_HomingOnSync is entered as the nEnc_HomingType in Axis.ST_TcHydAxParam.

If it is possible to carry out these checks without encountering any problems, the actual value of the axis is determined by monitoring the variables bDigInA and bDigInB in Axis.pStAxEncInput. fEnc_IncWeighting and fEnc_ZeroShift from Axis.pStAxParam are used to convert to the displacement units appropriate to the axis.

Note: This block supports the iTcMc_HomingOnBlock and iTcMc_HomingOnIndex referencing methods, but not, however, iTcMc_HomingOnSync.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtEncoderKL2521_BkPlcMc

FUNCTION_BLOCK MC_AxRtEncoderKL2521_BkPlcMc

(internal use only) The function block performs determination of the actual position of the axis from the output pulses acquired from a KL2521 pulse output terminal. It is called by blocks of the MC_AxRtEncoder_BkPlcMc type if the value iTcMc_EncoderKL2521 is set as the nEnc_Type in Axis.pStAxParam.

Note: The hydraulic library only offers a restricted range of functions, even in connection with electrical drives. TwinCAT NC PTP, NC I and CNC offer a significantly broader spectrum and more comprehensive support for commissioning and diagnosis.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxEncInput in ST_TcMc Axis_Ref_BkPlcMc AxInterface is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncIn. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxEncOuput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If bEncDoLatch in Axis.ST_TcHydAxRtData becomes valid, the block reacts with Error and ErrorID:=dwTcHydErrCdHomingType. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData. This situation occurs if the value iTcMc_HomingOnSync is entered as the nEnc_HomingType in Axis.ST_TcHydAxParam.

If it is possible to carry out these checks without encountering any problems, the actual value of the axis is determined by evaluating the variables in Axis.pStAxEncInput. fEnc_IncWeighting and fEnc_ZeroShift from Axis.pStAxParam are used to convert to the displacement units appropriate to the axis.

Note: This block supports the iTcMc_HomingOnBlock and iTcMc_HomingOnIndex referencing methods, but not, however, iTcMc_HomingOnSync.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtEncoderKL2541_BkPlcMc

FUNCTION_BLOCK MC_AxRtEncoderKL2541_BkPlcMc

(internal use only) The function block performs determination of the actual position of the axis from the output or encoder pulses acquired from a KL2541 direct stepper output terminal. It is called by blocks of the MC_AxRtEncoder_BkPlcMc type if the value iTcMc_EncoderKL2541 is set as the nEnc_Type in Axis.pStAxParam.

Note: The hydraulic library only offers a restricted range of functions, even in connection with electrical drives. TwinCAT NC PTP, NC I and CNC offer a significantly broader spectrum and more comprehensive support for commissioning and diagnosis.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxEncInput in ST_TcMc Axis_Ref_BkPlcMc AxInterface is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncIn. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxEncOuput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If bEncDoLatch in Axis.ST_TcHydAxRtData becomes valid, the block reacts with Error and ErrorID:=dwTcHydErrCdHomingType. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData. This situation occurs if the value iTcMc_HomingOnSync is entered as the nEnc_HomingType in Axis.ST_TcHydAxParam.

If it is possible to carry out these checks without encountering any problems, the actual value of the axis is determined by evaluating the variables in Axis.pStAxEncInput. fEnc_IncWeighting and fEnc_ZeroShift from Axis.pStAxParam are used to convert to the displacement units appropriate to the axis.

Note: This block supports the iTcMc_HomingOnBlock and iTcMc_HomingOnIndex referencing methods, but not, however, iTcMc_HomingOnSync.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtEncoderKL3042_BkPlcMc

FUNCTION_BLOCK MC_AxRtEncoderKL3042_BkPlcMc

(internal use only) The function block performs determination of the actual position of the axis from the input data of a 0..20 mA input terminal of type KL3042. It is called by blocks of the MC_AxRtEncoder_BkPlcMc type if the value iTcMc_EncoderKL3042 or iTcMc_EncoderKL3002 is set as the nEnc_Type in Axis.pStAxParam.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

PlusOnly: With a TRUE on this input the block will reject negativ input values.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxEncInput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncIn. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If bEncDoLatch in Axis.ST_TcHydAxRtData becomes valid, the block reacts with Error and ErrorID:=dwTcHydErrCdHomingType. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData. This situation occurs if the value iTcMc_HomingOnSync is entered as the nEnc_HomingType in Axis.ST_TcHydAxParam.

If it is possible to carry out these checks without encountering any problems, the actual value of the axis is determined by evaluating the variables in Axis.pStAxEncInput. fEnc_IncWeighting and fEnc_ZeroShift from Axis.pStAxParam are used to convert to the displacement units appropriate to the axis.

Note: This block supports the iTcMc_HomingOnBlock and iTcMc_HomingOnIndex referencing methods, but not, however, iTcMc_HomingOnSync.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtEncoderKL5001_BkPlcMc

FUNCTION_BLOCK MC_AxRtEncoderKL5001_BkPlcMc

(internal use only) This function block determines the actual position of the axis from the input data of a type KL5001 SSI terminal. It is called by blocks of the MC_AxRtEncoder_BkPlcMc type if the value iTcMc_EncoderKL5001 is set as the nEnc_Type in Axis.pStAxParam.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxEncInput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncIn. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxEncOuput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If bEncDoLatch in Axis.ST_TcHydAxRtData becomes valid, the block reacts with Error and ErrorID:=dwTcHydErrCdHomingType. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData. This situation occurs as soon as a reference travel is triggered, regardless of the value entered for nEnc_HomingType in Axis.ST_TcHydAxParam.
  • If a problem is detected when evaluating the input data from the I/O hardware, the block responds with Error and ErrorID:=dwTcHydErrCdSsi. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.

If it is possible to carry out these checks without encountering any problems, the actual value of the axis is determined by evaluating the variables uiPZDL_RegDaten and uiPZDH in Axis.pStAxEncInput. fEnc_IncWeighting and fEnc_ZeroShift from Axis.pStAxParam are used to convert to the displacement units appropriate to the axis.

Note: This block supports the iTcMc_HomingOnBlock and iTcMc_HomingOnIndex referencing methods, but not, however, iTcMc_HomingOnSync.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtEncoderKL5101_BkPlcMc

FUNCTION_BLOCK MC_AxRtEncoderKL5101_BkPlcMc

(internal use only) This function block determines the actual position of the axis from the input data of a type KL5101 incremental input terminal. It is called by blocks of the MC_AxRtEncoder_BkPlcMc type if the value iTcMc_EncoderKL5101 is set as the nEnc_Type in Axis.pStAxParam.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxEncInput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncIn. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxEncOuput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.

If it is possible to carry out these checks without encountering any problems, the actual value of the axis is determined by evaluating the variables in Axis.pStAxEncInput. fEnc_IncWeighting from Axis.pStAxParam and fEnc_RefShift from Axis. pStAxRtData are used to convert to the displacement units appropriate to the axis.

Note: To determine fEnc_RefShift in Axis. pStAxRtData automatically, the desired mode must be entered for nEnc_HomingType in Axis.pStAxParam, and a reference travel executed by the axis associated with this encoder.

Note: This block supports the iTcMc_HomingOnBlock, iTcMc_HomingOnIndex and iTcMc_HomingOnSync referencing methods.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtEncoderLowCostStepper_BkPlcMc

FUNCTION_BLOCK MC_AxRtEncoderLowCostStepper_BkPlcMc

(internal use only) This function block determines the actual position of the axis from the output data of an MC_AxRtDriveLowCostStepper_BkPlcMc block. It is called by blocks of the MC_AxRtEncoder_BkPlcMc type if the value iTcMc_EncoderLowCostStepper is set as the nEnc_Type in Axis.pStAxParam.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxDriveOutput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcDriveOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If bEncDoLatch in Axis.ST_TcHydAxRtData becomes valid, the block reacts with Error and ErrorID:=dwTcHydErrCdHomingType. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData. This situation occurs if the value iTcMc_HomingOnSync is entered as the nEnc_HomingType in Axis.ST_TcHydAxParam.

If it is possible to carry out these checks without encountering any problems, the actual value of the axis is determined by evaluating the uiCount variables in Axis.pStAxEncInput. fEnc_IncWeighting and fEnc_ZeroShift from Axis.pStAxParam are used to convert to the displacement units appropriate to the axis.

Note: This block is most often employed together with an MC_AxRtDriveLowCostStepper_BkPlcMc block.

Note: This block supports the iTcMc_HomingOnBlock and iTcMc_HomingOnIndex referencing methods, but not, however, iTcMc_HomingOnSync.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtEncoderM3120_BkPlcMc

FUNCTION_BLOCK MC_AxRtEncoderM3120_BkPlcMc

(internal use only) This function block determines the actual position of the axis from the input data of a type M3120 Lightbus box. It is called by blocks of the MC_AxRtEncoder_BkPlcMc type if the value iTcMc_EncoderM3120 is set as the nEnc_Type in Axis.pStAxParam.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxEncInput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncIn. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxEncOuput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.

If it is possible to carry out these checks without encountering any problems, the actual value of the axis is determined by evaluating the variables in Axis.pStAxEncInput. fEnc_IncWeighting from Axis.pStAxParam and fEnc_RefShift from Axis. pStAxRtData are used to convert to the displacement units appropriate to the axis.

Note: To determine fEnc_RefShift in Axis. pStAxRtData automatically, the desired mode must be entered for nEnc_HomingType in Axis.pStAxParam, and a reference travel executed by the axis associated with this encoder.

Note: This block supports the iTcMc_HomingOnBlock, iTcMc_HomingOnIndex and iTcMc_HomingOnSync referencing methods.


TcPlcHydraulics: PLCopen Motion Control: System:MC_AxRtEncoderSimulation_BkPlcMc

FUNCTION_BLOCK MC_AxRtEncoderSimulation_BkPlcMc

(internal use only) The function block performs determination of the actual position of the axis from the output data of a MC_AxRuntime_BkPlcMc function block. It is called by blocks of the MC_AxRtEncoder_BkPlcMc type if the value iTcMc_EncoderSim is set as the nEnc_Type in Axis.pStAxParam.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If bEncDoLatch in Axis.ST_TcHydAxRtData becomes valid, the block reacts with Error and ErrorID:=dwTcHydErrCdHomingType. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData. This situation occurs if the value iTcMc_HomingOnSync is entered as the nEnc_HomingType in Axis.ST_TcHydAxParam.

If it is possible to carry out these checks without encountering any problems, the actual value of the axis is determined by evaluating the variable uiCount in Axis.pStAxDriveOutput. fEnc_IncWeighting and fEnc_ZeroShift from Axis.pStAxParam are used to convert to the displacement units appropriate to the axis.

Note: This block is applied in the development process of a project or for virtual axes.

Note: This block supports the iTcMc_HomingOnBlock and iTcMc_HomingOnIndex referencing methods, but not, however, iTcMc_HomingOnSync.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtReadPressureDiff_BkPlcMc

FUNCTION_BLOCK MC_AxRtReadPressureDiff_BkPlcMc

The function block performs determination of the actual pressure of the axis from the input data of two analog input terminals.

Note: If there is just one pressure transducer a function block of type MC_AxRtReadPressureSingle_BkPlcMc should be used.

VAR_INPUT
    AdcValueA:	INT:=0;
    AdcValueB:	INT:=0;
    ScaleFactorA:	LREAL:=0.0;
    ScaleOffsetA:	LREAL:=0.0;
    ScaleFactorB:	LREAL:=0.0;
    ScaleOffsetB:	LREAL:=0.0;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

AdcValueA, AdcValueB: The input data of the analog terminals.

ScaleFactorA, ScaleFactorB: The weighting factors. These values define the pressure change equivalent to one ADC step.

ScaleOffsetA, ScaleOffsetB: These offsets are used for shifting the zero point of the pressure scales.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A problem can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.

If it is possible to carry out these checks without encountering any problems, the actual pressure of the axis is determined by evaluating the variables AdcValueA und AdcValueB. The result is stored in ST_TcHydAxRtData.fActPressure.

Note: The parameter values associated with an axis can be stored along with the axis parameters by holding them in ST_TcHydAxParam.fCustomerData[...]. The associated parameters will be loaded, stored, saved and if needed even exported and imported along with the standard parameters of the axis.

Setup procedure A

For this procedure it is required that both mechanical ends of the axes travel can be pressed at by the full system pressure. If this cannot be done the axes travel can be limited by applying temporarily mounted mechanical limits or even by blocking the axis completely because a real move of the axis is not required.

  • All function blocks have to be deactivated that would be responding on the value of ST_TcHydAxRtData.fActPressure.
  • At a low speed level the axis has to moved against the lower mechanical limit. The value of AdcValueA and AdcValueB have to be documented. In this situation the B-side should be applied the system pressure and the A-side should be supplied the storage pressure. If this is by any reason not true the pressure on A- and B-side have to be determined and documented, too.
  • At a low speed level the axis has to moved against the upper mechanical limit. Here the value of AdcValueA and AdcValueB and the pressure values have to be documented, too.
  • The parameter values have to be calculated like this:

    ScaleFactorA := (PressureAMAX - PressureAMIN) / (AdcValueAMAX - AdcValueAMIN);

    ScaleFactorB := (PressureBMAX - PressureBMIN) / (AdcValueBMAX - AdcValueBMIN);

    ScaleOffsetA := PressureAMIN - ScaleFactorA * AdcValueAMIN;

    ScaleOffsetB := PressureBMIN - ScaleFactorB * AdcValueBMIN;

Setup procedure B

As an alternative the setup can be done without any activity of the axis. This procedure cannot reach the accuracy of procedure A.

  • The axis has to completely decompressed. The compressor has to be deactivated and accumulator has to be released.
  • Be sure that the axis is not creating pressure itself. Block the axis mechanically to avoid pressure buildup by external forces like gravity. Release stored pressure in closed cavities by opening the valve in both directions.
  • Now the values of AdcValueA and AdcValueB have to be documented. In this situation the B-side should be applied the system pressure and the A-side should be supplied the storage pressure. If this is by any reason not true the pressure on A- and B-side have to be determined and documented, too. The results from this step have to be used as MIN values in the formulas above.
  • From the data sheets of the pressure transducers find the pressure for the upper limit (10 Volts, 20 mA). For AdcValueA and AdcValueB the full scale value for the converted electrical signal is assumed. These values have to be used as MAX values in the formulas above.
  • Now the parameter values can be calculated as above.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtReadPressureSingle_BkPlcMc

FUNCTION_BLOCK MC_AxRtReadPressureSingle_BkPlcMc

The function block performs determination of the actual pressure of the axis from the input data of an analog input terminals.

Note: If there is a pressure transducer on the A- and B-side of the axis a function block of type MC_AxRtReadPressureDiff_BkPlcMc should be used.

VAR_INPUT
    AdcValue:		INT:=0;
    ScaleFactor:	LREAL:=0.0;
    ScaleOffset:	LREAL:=0.0;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

AdcValue: The input data of the analog terminal.

ScaleFactor: The weighting factor. This value defines the pressure change equivalent to one ADC step.

ScaleOffset: This offset is used for shifting the zero point of the pressure scales.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A problem can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.

If it is possible to carry out these checks without encountering any problems, the actual pressure of the axis is determined by evaluating the variable AdcValue. The result is stored in ST_TcHydAxRtData.fActPressure.

Note: The parameter values associated with an axis can be stored along with the axis parameters by holding them in ST_TcHydAxParam.fCustomerData[...]. The associated parameters will be loaded, stored, saved and if needed even exported and imported along with the standard parameters of the axis.

Setup procedure A

For this procedure it is required that both mechanical ends of the axes travel can be pressed at by the full system pressure. If this cannot be done the axes travel can be limited by applying temporarily mounted mechanical limits or even by blocking the axis completely because a real move of the axis is not required.

  • All function blocks have to be deactivated that would be responding on the value of ST_TcHydAxRtData.fActPressure.
  • At a low speed level the axis has to moved against the lower mechanical limit. The value of AdcValue has to be documented. In this situation the B-side should be applied the system pressure and the A-side should be supplied the storage pressure. If this is by any reason not true the pressure on A- and B-side have to be determined and documented, too.
  • At a low speed level the axis has to moved against the upper mechanical limit. Here the value of AdcValue and the pressure values have to be documented, too.
  • The parameter values have to be calculated like this:

    ScaleFactor := (PressureMAX - PressureMIN) / (AdcValueMAX - AdcValueMIN);

    ScaleOffset := PressureMIN - ScaleFactor * AdcValueMIN;

Setup procedure B

As an alternative the setup can be done without any activity of the axis. This procedure cannot reach the accuracy of procedure A.

  • The axis has to completely decompressed. The compressor has to be deactivated and accumulator has to be released.
  • Be sure that the axis is not creating pressure itself. Block the axis mechanically to avoid pressure buildup by external forces like gravity. Release stored pressure in closed cavities by opening the valve in both directions.
  • Now the value of AdcValue has to be documented. In this situation the B-side should be applied the system pressure and the A-side should be supplied the storage pressure. If this is by any reason not true the pressure on A- and B-side have to be determined and documented, too. The results from this step have to be used as MIN values in the formulas above.
  • From the data sheets of the pressure transducer find the pressure for the upper limit (10 Volts, 20 mA). For AdcValue the full scale value for the converted electrical signal is assumed. This value has to be used as MAX values in the formulas above.
  • Now the parameter values can be calculated as above.


TcPlcHydraulics: PLCopen Motion Control: System: TableFunctions: MC_AxTableReadOutNonCyclic_BkPlcMc

FUNCTION_BLOCK MC_AxTableReadOutNonCyclic_BkPlcMc

(not recommended) The function block determines the slave values corresponding to a master value by using a data table.

Note: The block is a subcomponent of an axis cam or other similar nonlinear gear. Usually it is not directly called by the application.

VAR_INPUT
    pTable:		POINTER TO LREAL:=0;
    fMasterValue:	LREAL:=0.0;
    nFirstIdx:	UDINT:=1;
    nLastIdx:		UDINT:=1;
    bReInit:		BOOL:=FALSE;
END_VAR
VAR_OUTPUT
    fSlaveValue:	LREAL:=0.0;
    fSlaveGear:	LREAL:=0.0;
    bUnderRange:	BOOL;
    bOverRange:	BOOL;
END_VAR

pTable: The address of an ARRAY[nFirstIdx..nLastIdx,1..2] is to be passed here.

Attention: An invalid information here may cause a crash of the PLC application by triggering fatal runtime errors (Page Fault Exception).

fMasterValue: Here the master value is to be passed, that has to be converted in a slave value.

nFirstIdx: The lower boundary index of the ARRAY is to be passed here.

Attention: An invalid information here may cause a crash of the PLC application by triggering fatal runtime errors (Page Fault Exception).

nLastIdx: The upper boundary index of the ARRAY is to be passed here.

Attention: An invalid information here may cause a crash of the PLC application by triggering fatal runtime errors (Page Fault Exception).

bReInit: This signal is forcing the block to reinitialise the search precedure to tha start of the table.

fSlaveValue: The slave value corresponding fMasterValue is output here.

fSlaveGear: Here the lokal derivative of the slave values at the location defined by the master value is supplied.

bUnderRange: This signal is TRUE if the master value is matching or exceeding the lower border of the table.

bOverRange: This signal is TRUE if the master value is matching or exceeding the upper border of the table.

Behaviour of the block:

The block is searching the table for a pair of master values that matches or contains the supplied fMasterValue. In the identified interval a linear interpolation is calculated. The result is output as fSlaveValue. The local derivative found by this calculation is presented as fSlaveGear.

If the fMasterValue is below the range of values in the table bUnderRange is signalled. fSlaveValue is set to the value at the lower border of the table. fSlaveGear is set to 0.0.

If the fMasterValue is above the range of values in the table bOverRange is signalled. fSlaveValue is set to the value at the upper border of the table. fSlaveGear is set to 0.0.

The output value fSlaveGear is the ratio of the first derivative of fMasterValue and fSlaveValue. If fMasterValue is a position or a virtual time the slave velocity setpoint can be calculated by multiplying the master velocity and fSlaveGear. This can be used for creating a velocity feed forward. For this purpose the velocity setpoint has to be divided by ST_TcHydAxParam.fRefVelo of the slave and the result is to be written into the ST_TcHydAxRtData.fSetSpeed of the slave.


TcPlcHydraulics: PLCopen Motion Control: System: Generators: MC_AxRuntime_BkPlcMc

FUNCTION_BLOCK MC_AxRuntime_BkPlcMc

This function block performs the task of a set point generator. For this purpose, a block of type MC_AxRuntimeTcPc_BkPlcMc, MC_AxRuntimeCos_BkPlcMc, MC_AxRuntimeCtrlBased_BkPlcMc or MC_AxRunTimeTimeRamp_BkPlcMc is called, depending on what value has been specified for the nProfile_Type in Axis.pStAxParam.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If one of the pointers has not been initialised the block reacts with Error and with ErrorID:=dwTcHydErrCdPtrPlcMc or dwTcHydErrCdPtrMcPlc.

If it is possible to carry out these checks without encountering any problems, the set value generation is executed by calling an appropriate block corresponding to the nProfileType in Axis.pStAxParams.

The following generators are presently available:

nProfileType Description
iTcMc_ProfileConstAcc Standardprofil: Single-stage time-referenced acceleration, displacement-referenced (square root) braking ramp, target approach at creep velocity, selectable behaviour when stationary.

Generally it is possible to execute a start for an axis that is already travelling (new target, new velocity etc.).

Warning: Overshooting the new target can happen even if the axis is in front of the target position at the time of the start.

Hint: The functionality of this profile type is covered by the profile type iTcMc_ProfileCtrlBased. Internally a iTcMc_ProfileCtrlBased profile is generated.

iTcMc_ProfileCtrlBased Standardprofil: Single-stage time-referenced acceleration, displacement-referenced (square root) braking ramp, target approach at creep velocity, selectable behaviour when stationary.

With the exception of fault states and external or geared setpoint generating states the axis can be startet without care for current states.

Warning: Overshooting the new target can happen even if the axis is in front of the target position at the time of the start.

Warning: Depending on and controlled by parameter settings the block is able to perform an automatic start and change the axis state into active motion.

iTcMc_ProfileTimePosCtrl Specialised profil: Two stage acceleration (initially time-referenced, then displacement-referenced following square root curve), displacement-referenced (square root) braking ramp, target approach at creep velocity, selectable behaviour when stationary.

It is not possible to execute a start for an axis that is already travelling (new target, new velocity etc.).

iTcMc_ProfileCosine Specialised profil: Two stage acceleration (initially time-referenced, then displacement-referenced following cosine curve), displacement-referenced (cosine) braking ramp, target approach at creep velocity, selectable behaviour when stationary.

It is not possible to execute a start for an axis that is already travelling (new target, new velocity etc.).

iTcMc_ProfileTimeRamp Specialised profil: Single-stage time-referenced acceleration, time-referenced braking ramp, target approach at creep velocity, selectable (some restrictions) behaviour when stationary. This generator is using digital position cams instead of an encoder.

Starting an active moving axis is possible.

Note: If only the usual blocks (encoder, generator, finish, drive) for the axis are going to be called, then a block of type MC_AxStandardBody_BkPlcMc should be used for the sake of simplicity.


TcPlcHydraulics: PLCopen Motion Control: System: Generators: MC_AxRuntimeCos_BkPlcMc

FUNCTION_BLOCK MC_AxRuntimeCos_BkPlcMc

(not recommended) This function block performs the task of a set value generator, if the constant iTcMc_ProfileCosine from E_TcMcProfileType is specified as the nProfileType in ST_TcHydAxParam. The block is usually called by a MC_AxRuntime_BkPlcMc block.

VAR_INOUT
    stAxParams:	ST_TcHydAxParam;
    stAxRtData:	ST_TcHydAxRtData;
END_VAR

stAxParams: The address of a variable of type ST_TcHydAxRtData is to be passed here.

stAxRtData: The address of a variable of type ST_TcHydAxRtData is to be passed here.

Behaviour of the block:

The profile of an acceleration phase, a position-referenced braking phase following a cosine curve, and a target approach at creep velocity is generated.

The arrows on the profile of the control value suggest how the shape of the curve can be affected through the parameters of the move order or of the axis. The axis initially accelerates following a time-controlled ramp function "1" to the velocity at which the position-referenced cosine ramp function takes over the control, completing the acceleration to the required travel velocity "3". This control value is maintained until a displacement, calculated previously when the movement started, is reached. After this point, a position-referenced cosine ramp "4" is followed to brake down from the main travel velocity to the creep velocity "6"; this control value is reached at a specified distance, "5", from the target. This control value is retained until the target has been approached to within a specified remaining distance. The axis is then switched to its idle behaviour.

Parameters active in the travel profile

Start ramp "1": fStartRamp has an effect in ST_TcHydAxParam.

Travel phase "2": The smallest of the following values is the effective one: fMaxAcc and fAcc in ST_TcHydAxParam, Acceleration of the block used to start the axis (for example: MC_MoveAbsolute_BkPlcMc).

Travel phase "3": The smallest of the following values is the effective one: fRefVelo and fMaxVelo in ST_TcHydAxParam, Velocity of the block used to start the axis (for example: MC_MoveAbsolute_BkPlcMc).

Braking ramp "4": The smallest of the following values is the effective one: fMaxDec and fDec in ST_TcHydAxParam, Deceleration of the block used to start the axis (for example: MC_MoveAbsolute_BkPlcMc).

Creep phase "5", "6": The values of fCreepSpeed and fCreepDistance in ST_TcHydAxParam have an effect.

Transfer to target "7": The fBrakeDistance and/or fBrakeDeadTime in ST_TcHydAxParam have an effect.


TcPlcHydraulics: PLCopen Motion Control: System: Generators: MC_AxRuntimeCtrlBased_BkPlcMc

FUNCTION_BLOCK MC_AxRuntimeCtrlBased_BkPlcMc

(not recommended) The function block performs the task of a set value generator, if the constant iTcMc_ProfileCtrlBased from E_TcMcProfileType is specified as the nProfileType in ST_TcHydAxParam. The block is usually called by a MC_AxRuntime_BkPlcMc block.

VAR_INOUT
    stAxParams:	ST_TcHydAxParam;
    stAxRtData:	ST_TcHydAxRtData;
END_VAR

stAxParams: The address of a variable of type ST_TcHydAxRtData is to be passed here.

stAxRtData: The address of a variable of type ST_TcHydAxRtData is to be passed here.

Behaviour of the block:

The profile of an acceleration phase, a displacement-referenced braking phase following a square root curve, and a target approach at creep velocity is generated.

The arrows on the profile of the control value suggest how the shape of the curve can be affected through the parameters of the move order or of the axis. To begin the acceleration follows a time-controlled ramp function "1" until the required travel velocity "2" is reached. This control value is maintained until a displacement, calculated previously when the movement started, is reached. After this point, a displacement-referenced ramp "3" is followed to brake down from the main travel velocity to the creep velocity "5"; this control value is reached at a specified distance, "4", from the target. This control value is retained until the target has been approached to within a specified remaining distance "6". The axis is then switched to its idle behaviour.

Parameters active in the travel profile

Start ramp "1": The smallest of the following values is the effective one: fMaxAcc and fAcc in ST_TcHydAxParam, Acceleration of the block used to start the axis (for example: MC_MoveAbsolute_BkPlcMc).

Travel phase "2": The smallest of the following values is the effective one: fRefVelo and fMaxVelo in ST_TcHydAxParam, Velocity of the block used to start the axis (for example: MC_MoveAbsolute_BkPlcMc).

Braking ramp "3": The smallest of the following values is the effective one: fMaxDec and fDec in ST_TcHydAxParam, Deceleration of the block used to start the axis (for example: MC_MoveAbsolute_BkPlcMc).

Creep phase "4", "5": The values of fCreepSpeed and fCreepDistance in ST_TcHydAxParam have an effect.

Transfer to target "6": The fBrakeDistance and/or fBrakeDeadTime in ST_TcHydAxParam have an effect.

Automatic start on an axis

If the distance between the actual position and the current destination position of an axis is exceeding the value of ST_TcHydAxParam.fReposDistance an automatic start id released.


TcPlcHydraulics: PLCopen Motion Control: System: Generators: MC_AxRuntimeTcPc_BkPlcMc

FUNCTION_BLOCK MC_AxRuntimeTcPc_BkPlcMc

(not recommended) This function block performs the task of a set value generator, if the constant iTcMc_ProfileTimePosCtrl from E_TcMcProfileType is specified as the nProfileType in ST_TcHydAxParam. The block is usually called by a MC_AxRuntime_BkPlcMc block.

VAR_INOUT
    stAxParams:	ST_TcHydAxParam;
    stAxRtData:	ST_TcHydAxRtData;
END_VAR

stAxParams: The address of a variable of type ST_TcHydAxRtData is to be passed here.

stAxRtData: The address of a variable of type ST_TcHydAxRtData is to be passed here.

Behaviour of the block:

The profile of two acceleration phases, a displacement-referenced braking phase following a square root curve, and a target approach at creep velocity is generated.

The arrows on the profile of the control value suggest how the shape of the curve can be affected through the parameters of the move order or of the axis. To begin with acceleration follows a time-controlled ramp function "1". In the example shown, this phase covers a specified displacement before the required travel velocity "3" is reached. From this point onwards the acceleration continues on a displacement-referenced ramp "2" until the required travel velocity "3" is reached. This control value is maintained until a displacement, calculated previously when the movement started, is reached. After this point, a displacement-referenced ramp "4" is followed to brake down from the main travel velocity to the creep velocity "6"; this control value is reached at a specified distance, "5", from the target. This control value is retained until the target has been approached to within a specified remaining distance. The axis is then switched to its idle behaviour.

Parameters active in the travel profile

Start ramp "1": fStartRamp, bPosCtrlAccEna and fStartAccDistance have an effect in ST_TcHydAxParam.

Start ramp "2": The smallest of the following values is the effective one: fMaxAcc and fAcc in ST_TcHydAxParam, Acceleration of the block used to start the axis (for example: MC_MoveAbsolute_BkPlcMc).

Travel phase "3": The smallest of the following values is the effective one: fRefVelo and fMaxVelo in ST_TcHydAxParam, Velocity of the block used to start the axis (for example: MC_MoveAbsolute_BkPlcMc).

Braking ramp "4": The smallest of the following values is the effective one: fMaxDec and fDec in ST_TcHydAxParam, Deceleration of the block used to start the axis (for example: MC_MoveAbsolute_BkPlcMc).

Creep phase "5", "6": The values of fCreepSpeed and fCreepDistance in ST_TcHydAxParam have an effect.

Transfer to target "7": The fBrakeDistance and/or fBrakeDeadTime in ST_TcHydAxParam have an effect.


TcPlcHydraulics: PLCopen Motion Control: System: Generators: MC_AxRunTimeTimeRamp_BkPlcMc

FUNCTION_BLOCK MC_AxRunTimeTimeRamp_BkPlcMc

(not recommended) This function block performs the task of a set value generator, if the constant iTcMc_ProfileTimeRamp from E_TcMcProfileType is specified as the nProfileType in ST_TcHydAxParam. The block is usually called by a MC_AxRuntime_BkPlcMc block.

VAR_INOUT
    stAxParams:	ST_TcHydAxParam;
    stAxRtData:	ST_TcHydAxRtData;
END_VAR

stAxParams: The address of a variable of type ST_TcHydAxRtData is to be passed here.

stAxRtData: The address of a variable of type ST_TcHydAxRtData is to be passed here.

Behaviour of the block

The profile of a time-referenced acceleration phase, a time-referenced braking phase and a target approach at creep velocity is generated.

The arrows on the profile of the control value suggest how the shape of the curve can be affected through the parameters of the move order or of the axis. To begin the acceleration follows a time-controlled ramp function "1" until the required travel velocity "2" is reached. This control value is maintained until the position cam information signals the start of the targeting phase. After this point, a time-referenced ramp "3" is followed to brake down from the main travel velocity to the creep velocity "4". This control value is retained until the position cam information signals that the target has been approached. The axis is then switched to its idle behaviour.

Parameters active in the travel profile

Start ramp "1": fStartRamp in ST_TcHydAxParam.

Travel phase "2": The smallest of the following values is the effective one: fRefVelo and fMaxVelo in ST_TcHydAxParam, Velocity of the block used to start the axis (for example: MC_MoveAbsolute_BkPlcMc).

Braking ramp "3": fStopRamp in ST_TcHydAxParam.

Creep phase "4": fCreepSpeed in ST_TcHydAxParam.

Behaviour of the block when starting over

If there is a startover command while the axis is actively moving there are two different cases.

This profile is generated in case of a startover in the same direction but different (here with higher) velocity.

This profile is generated in case of a startover in oposite direction, here with the same velocity.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxStandardBody_BkPlcMc

FUNCTION_BLOCK MC_AxStandardBody_BkPlcMc

This function block calls a block of each of the following types: MC_AxRtEncoder_BkPlcMc, MC_AxRuntime_BkPlcMc, MC_AxRtFinish_BkPlcMc and MC_AxRtDrive_BkPlcMc.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The usual components of the axis are called, depending on the value in ST_TcHydAxParam. If one of the called blocks reports an Error it is echoed, together with its ErrorID, at the outputs of this block.

Note: In the event of multiple problems, they are prioritised according to the following sequence: encoder, generator, finish, drive.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtCheckSyncDistance_BkPlcMc

FUNCTION_BLOCK MC_AxRtCheckSyncDistance_BkPlcMc

The block checks the distance between reference cam and sync pulse.

VAR_INPUT
    MaxDistance:	LREAL;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    Active:	BOOL;
    Exceeded:	BOOL;
END_VAR

MaxDistance: The maximum acceptable distance between reference cam signal and sync pulse is to be passed here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Exceeded: This signal becomes TRUE if the axis has travelled more than MaxDistance after the falling edge of the reference cam without detecting a sync pulse from the encoder.

Active: This signal is TRUE when the axis has left the reference cam and is scanning for the sync pulse.

Behaviour of the block:

The block recognises a referencing of the axis and monitors the travelled distance while the homing function searches the sync pulse of the encoder. If this distance exceeds the given limit the output Exceeded becomes TRUE. To abort the homing and place the axis in an error state a MC_AxRtGoErrorState_BkPlcMc block can be activated by this signal. There is a predefined error code dwTcHydErrCdEncSyncDist for this situation.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtFinish_BkPlcMc

FUNCTION_BLOCK MC_AxRtFinish_BkPlcMc

This function block adapts the control value that has been generated to the special features of the particular axis.

Warning: This block must not be called for an axis, that has a block of type MC_AxCtrlPressureCompensation_BkPlcMc.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If one of the pointers has not been initialised the block reacts with Error and with ErrorID:=dwTcHydErrCdPtrPlcMc or dwTcHydErrCdPtrMcPlc.

If it is possible to carry out these checks without encountering any problems, adaptation of the control value for the axis is carried out according to the value in Axis.pStAxParams.

  • The control value for the advance and the positional control reaction are combined to form the output control value.
  • Area compensation is taken into account.
  • Compensation is applied for a bend in the characteristic curve.
  • The overlap compensation, the press control value and the offset compensation are included in the calculation.

Note: If only the usual blocks (encoder, generator, finish, drive) for the axis are going to be called, then a block of type MC_AxStandardBody_BkPlcMc should be used for the sake of simplicity.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtFinish_BkPlcMc

FUNCTION_BLOCK MC_AxRtGoErrorState_BkPlcMc

(not recommended) This function block places the axis into a fault state.

VAR_INPUT
    Trigger:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Trigger: A rising edge at this input places the axis in a fault state.

ErrorCode: An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The axis is placed into a fault state by a rising edge at the Trigger input.

Requirements:

  • An address is to be entered in Axis under pStAxRtData.
  • The value at the ErrorCode input is not equal to 0.
  • The axis is not already in a fault state.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtFinish_BkPlcMc

FUNCTION_BLOCK MC_AxRtMoveChecking_BkPlcMc

This function block monitors the movement of an axis. If necessary, the axis is placed into a fault state with an MC_AxRtGoErrorState_BkPlcMc block.

VAR_INPUT
    Enable:		BOOL;
    MinDistance:	LREAL;
    Filter:		LREAL;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    Triggered:	BOOL;
END_VAR

Enable : The monitoring is only carried out if TRUE is asserted here.

MinDistance, Filter: The required minimum distance that is to be covered within the filter time must be specified here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Triggered: This provides a signal that the axis, through the activity of this block or for other reasons, is in the dwTcHydErrCdNotMoving error state.

Behaviour of the block:

If the axis is actively being moved, but does not cover at least the distance specified at the MinDistance input within the time specified at the Filter input in the correct direction, the axis is placed into a fault state, with ErrorCode being set to dwTcHydErrCdNotMoving.

The Triggered output indicates whether the axis is in this error state. It is irrelevant here whether it is this or some other block that has placed it into the error state.

Requirements:

  • An address is to be entered in Axis under pStAxRtData and pStAxParams.
  • The axis is not already in a fault state.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtSetActPos_BkPlcMc

FUNCTION_BLOCK MC_AxRtSetActPos_BkPlcMc

(not recommended) This function block updates the zero offset shift of an axis.

VAR_INPUT
    Execute:		BOOL;
    Position:		LREAL;
    pZeroShift:	POINTER TO LREAL;
END_VAR
VAR_OUTPUT
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : The reference travel is initiated by a rising edge at this input.

Position : The requested value for the actual position.

pZeroShift: The address of the variable that functions as the zero offset shift for the axis. This is fEnc_RefShift in ST_TcHydAxRtData on axes with incremental encoders. If the axis is being operated with an absolute displacement sensor, the variable fEnc_ZeroShift in ST_TcHydAxParam is to be addressed.

Done : Successful processing of the function is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If one of the pointers has not been initialised the block reacts with Error and with ErrorID:=dwTcHydErrCdPtrPlcMc or dwTcHydErrCdPtrMcPlc.

If it is possible to carry out these checks without problems, the zero offset shift is modified in such a way that the actual position of the axis corresponds to the value of Position.

A falling edge at Execute clears all the pending output signals. The signals provided at the end of the movement (Error, ErrorID, Done) are made available for one cycle.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtSetControllerEnable_BkPlcMc

FUNCTION MC_AxRtSetControllerEnable_BkPlcMc : DWORD

The function updates the control bit for the controller enable in the nDeCtrlDWord DWORD of an axis with a provided bit value.

VAR_INPUT
    nDeCtrlDWord:	DWORD;
    bControllerEnable:	BOOL;
END_VAR

nDeCtrlDWord: The value to be updated.

bControllerEnable: The bit to be updated.

Behaviour of the function

A control bit is set or cleared with the mask dwTcHydDcDwCtrlEnable in the supplied nDeCtrlDWord double word, depending on bControllerEnable. The result of the function is to be entered by the calling application into the variable in the runtime data for the axis of type ST_TcHydAxRtData.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtSetFeedEnableMinus_BkPlcMc

FUNCTION MC_AxRtSetFeedEnableMinus_BkPlcMc : DWORD

The function updates the control bit for the directional advance enable in the negative travel direction (in the direction of falling position values) in the nDeCtrlDWord DWORD of an axis with a provided bit value.

VAR_INPUT
    nDeCtrlDWord:	DWORD;
    bFeedEnableMinus:	BOOL;
END_VAR

nDeCtrlDWord: The value to be updated.

bFeedEnableMinus: The bit to be updated.

Behaviour of the function

A control bit is set or cleared with the mask dwTcHydDcDwFdNegEna in the supplied nDeCtrlDWord double word, depending on bFeedEnableMinus. The result of the function is to be entered by the calling application into the variable in the runtime data for the axis of type ST_TcHydAxRtData.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtSetFeedEnablePlus_BkPlcMc

FUNCTION MC_AxRtSetFeedEnablePlus_BkPlcMc : DWORD

The function updates the control bit for the directional advance enable in the negative travel direction (in the direction of falling position values) in the nDeCtrlDWord DWORD of an axis with a provided bit value.

VAR_INPUT
    nDeCtrlDWord:	DWORD;
    bFeedEnablePlus:	BOOL;
END_VAR

nDeCtrlDWord: The value to be updated.

bFeedEnablePlus: The bit to be updated.

Behaviour of the function

A control bit is set or cleared with the mask dwTcHydDcDwFdPosEna in the supplied nDeCtrlDWord double word, depending on bFeedEnablePlus. The result of the function is to be entered by the calling application into the variable in the runtime data for the axis of type ST_TcHydAxRtData.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtSetReferencingCamSignal_BkPlcMc

FUNCTION MC_AxRtSetReferencingCamSignal_BkPlcMc : DWORD

The function updates the control bit for the reference cam in the nDeCtrlDWord DWORD of an axis with a provided bit value.

VAR_INPUT
    nDeCtrlDWord:		DWORD;
    bReferencingCamSignal:	BOOL;
END_VAR

nDeCtrlDWord: The value to be updated.

bReferencingCamSignal: The bit to be updated.

Behaviour of the function

A control bit is set or cleared with the mask dwTcHydDcDwRefIndex in the supplied nDeCtrlDWord double word, depending on bReferencingCamSignal. The result of the function is to be entered by the calling application into the variable in the runtime data for the axis of type ST_TcHydAxRtData.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxUtiAverageDerivative_BkPlcMc

FUNCTION_BLOCK MC_AxUtiAverageDerivative_BkPlcMc

The function block is calculating the derivative of a value by numerical differentiation over multiple cycles.

VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_INPUT
    Input:		LREAL;
    MinIdx:		DINT;
    MaxIdx:		DINT;
    pBuffer:		POINTER TO LREAL;
END_VAR
VAR_OUTPUT
    Output:		LREAL;
END_VAR

Input: The actual value that has to be derivated has to be passed here.

MinIdx: The lower boundary index of the supplied ARRAY is to be passed here.

MaxIdx: The upper boundary index of the supplied ARRAY is to be passed here.

pBuffer: The address of a variable of type ARRAY [..] OF LREAL is to be passed here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Output: The filtered value.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Behaviour of the block:

The block investigates the input variables that have been passed to it every time it is called. A number of problems can be detected during this process:

  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc.
  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block responds with Error and ErrorID:=dwTcHydErrCdPtrMcPlc.
  • If the passed values for MinIdx and MaxIdx are invalid, the block responds with Error and ErrorID:=dwTcHydErrCdPtrPlcMc. Output will be 0.0.
  • If pBuffer is not initialised Output will be 0.0.

If it is possible to carry out these checks without encountering any problems, the difference between the actual value and the oldest value in the table will be valculated. To find Output the block divides this difference by pStAxParams.fCycletime and the number of values in the buffer. The table is updated with the actual value.

Note: If the block is supplied the actual position as its Input it will calculate the actual velocity based on multiples of the cycle time. It is delivering an updated value each cycle. The result has to be assigned to pStAxRtData.fActVelo by the application.

Note: The block is not returning correct values for Output before it has samples the number of stored values specified by MinIdx and MaxIdx.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxUtiCancelMonitoring_BkPlcMc

FUNCTION_BLOCK MC_AxUtiCancelMonitoring_BkPlcMc

The monitoring of a function is aborted.

Warning: Some types of function blocks do have to monitor the process they startet. If the monitoring is aborted the process may fail or will be executed incompletely. Use the abort function only for blocks with a special hint in this documentation.

VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_INPUT
    Execute:		BOOL;
END_VAR
VAR_OUTPUT
    Error:		BOOL;
    Done:		BOOL;
END_VAR

Execute : The abortion is initiated by a rising edge at this input.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Error: The occurrence of an error is indicated here.

Done : Successful processing of the abortion is indicated here.

Behaviour of the block:

On a rising edge on Execute the block will act on the supplied interface Axis in a way that some other blocks will see this as the start of some other function. If there is any other block monitoring this interface to trace a process it has started it will signal CommandAborted and abort its monitoring.

Hint: By now there are no possible reasons for problems. The output Error is allways FALSE.

Hint: The function of this block does not need any time for execution. The output Done will mirror the input Execute imediately after calling the block.

A list of the blocks accepting the abortion of monitoring is added to the Knowledge Base.


TcPlcHydraulics: PLCopen Motion Control: System: Controller: MC_AxUtiCheckTypedPointers

FUNCTION_BLOCK MC_AxUtiCheckTypedPointers

The block is safeguarding the pointer structure of the axis.

VAR_INPUT
    pParams:		POINTER TO ST_TcHydAxParam;
    pRtData:		POINTER TO ST_TcHydAxRtData;
    pLogBuffer:	POINTER TO ST_TcPlcMcLogBuffer:=0;
    pStAxAuxLabels:	POINTER TO ST_TcMcAuxDataLabels:=0;
    pEncIn:		POINTER TO ST_TcPlcMcEncoderIn;
    pEncOut:		POINTER TO ST_TcPlcMcEncoderOut;
    pDriveIn:		POINTER TO ST_TcPlcMcDriveIn;
    pDriveOut:	POINTER TO ST_TcPlcMcDriveOut;
    pAx2000In:	POINTER TO ST_TcPlcMcAx2000In;
    pAx2000Out:	POINTER TO ST_TcPlcMcAx2000Out;
ND_VAR
VAR_OUTPUT
    ReInit:		BOOL;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

ReInit: The occurrence of a change of the type or address of an axis interface item is indicated here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block compares the type codes and the addresses of the subitem pointers in the axis interface. If the block detects a change the block will initialise the pointers, cleared bParamsEnable and set nInitState to 0. This will cause the initialisation block for the axis to reload the parameters.

Hint: The parameter pLogBuffer can be left open if there is no need for message logging.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxUtiSlidingAverage_BkPlcMc

FUNCTION_BLOCK MC_AxUtiSlidingAverage_BkPlcMc

The function block is performing the calculation of a sliding average.

VAR_INPUT
    Input:		LREAL;
    MinIdx:		DINT;
    MaxIdx:		DINT;
    pBuffer:		POINTER TO LREAL;
END_VAR
VAR_OUTPUT
    Output:		LREAL;
END_VAR

Input: The actual value that has to be filtered has to be passed here.

MinIdx: The lower boundary index of the supplied ARRAY is to be passed here.

MaxIdx: The upper boundary index of the supplied ARRAY is to be passed here.

pBuffer: The address of a variable of type ARRAY [..] OF LREAL is to be passed here.

Output: The filtered value.

Behaviour of the block:

The block investigates the input variables that have been passed to it every time it is called. A number of problems can be detected during this process:

  • If the passed values for MinIdx and MaxIdx are invalid Output will be 0.0.
  • If pBuffer is not initialised Output will be 0.0.

If it is possible to carry out these checks without encountering any problems, the table in pBufferwill be updated and the average of the stored values will be calculated.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxUtiStandardInit_BkPlcMc

FUNCTION_BLOCK MC_AxUtiStandardInit_BkPlcMc

The block initialises and monitors the components of an axis.

VAR_INPUT
    AxisName:		STRING(255);
    PathName:		STRING(255);
    pParams:		POINTER TO ST_TcHydAxParam;
    pRtData:		POINTER TO ST_TcHydAxRtData;
    pLogBuffer:	POINTER TO ST_TcPlcMcLogBuffer;
    pAuxLabels:	POINTER TO ST_TcMcAuxDataLabels;
    pEncIn:		POINTER TO ST_TcPlcMcEncoderIn;
    pEncOut:		POINTER TO ST_TcPlcMcEncoderOut;
    pDriveIn:		POINTER TO ST_TcPlcMcDriveIn;
    pDriveOut:	POINTER TO ST_TcPlcMcDriveOut;
    pAx2000In:	POINTER TO ST_TcPlcMcAx2000In;
    pAx2000Out:	POINTER TO ST_TcPlcMcAx2000Out;
    nLogLevel:	DINT:=0;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    Ready:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

AxisName: The textual name of the axis (example: 'Axis_1') has to be supplied here.

PathName: The textual path name of the axis (example: 'C:\TwinCAT\Projekt\') that is to be used for storing the axis parameters has to be supplied here.

pParams: The adress of a variable of type ST_TcHydAxParam has to be supplied here.

pRtData: The adress of a variable of type ST_TcHydAxRtData has to be supplied here.

pLogBuffer: The adress of a variable of type ST_TcPlcMcLogBuffer can be supplied here.

pAuxLabels: The adress of a ST_TcMcAuxDataLabels structure containing text labels for the customer specific parameters of the axis can be supplied here.

pEncIn, pEncOut: The adresses of variables of type ST_TcPlcMcEncoderIn and ST_TcPlcMcEncoderOut have to be supplied here.

pDriveIn, pDriveOut: The adresses of variables of type ST_TcPlcMcDriveIn and ST_TcPlcMcDriveOut have to be supplied here.

pAx2000In, pAx2000Out: The adresses of variables of type ST_TcPlcMcAx2000In and ST_TcPlcMcAx2000Out have to be supplied here.

nLogLevel: A coded value has to be supplied here that defines the threshold for message recording.

Error: The occurrence of an error is indicated here.

ErrorID: An encoded error message is provided here.

Axis: The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

On each call the block checks the supplied axis reference and the supplied pointers. If there is any change the block will set signals in the supplied Axis_Ref_BkPlcMc structure, that the axis has to be reinitialised. A block of type MC_AxParamLoad_BkPlcMc will be used to automatically load the axis parameters from a file.

Note: The strings supplied as AxisName and PathName must not contain any white space characters or other characters that may cause problems when the strings are used to create a file name. The file name is created by concatenating the supplied string and placing the extension '.dat' at the end.

Note: The parameters pEncIn and pEncOut must be supplied for all axes that are using I/O hardware for position read out. If a AX2000 device is used or the axis is virtuel this parameters must be set to zero.

Note: The parameters pDriveIn and pDriveOut must be supplied for all axes that are using I/O hardware for setpoint output. If a AX2000 device is used or the axis is virtuel this parameters must be set to zero.

Note: The parameters pAx2000In and pAx2000Out must be supplied for all axes that are using a AX2000 device for position read out and setpoint output. If I/O hardware is used or the axis is virtuel this parameters must be set to zero.


TcPlcHydraulics: PLCopen Motion Control: Runtime: MC_HomeOnSync_BkPlcMc

FUNCTION_BLOCK MC_HomeOnSync_BkPlcMc

This function block starts and monitors the reference travel of an axis.

VAR_INPUT
    Execute:		BOOL;
    Position:		LREAL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    CommandAborted:	BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : The reference travel is initiated by a rising edge at this input.

Position : The reference position.

Busy: A pending command is indicated here.

Done : Successful processing of the reference travel is indicated here.

CommandAborted : Abortion of the reference travel is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If one of the pointers has not been initialised the block reacts with Error and with ErrorID:=dwTcHydErrCdPtrPlcMc or dwTcHydErrCdPtrMcPlc.
  • A reference travel can only be started from a stationary condition without errors. If that is not the case, the block will react by asserting Error with ErrorID:=dwTcHydErrCdNotStartable or with the error code that is passed to it.
  • If the axis is already in a fault state, or if it is in the process of carrying out a stop operation, it responds with Error and ErrorID:=dwTcHydErrCdNotReady.
  • If one of the velocities stated in the axis parameters is too small (less than 1% of the reference velocity) the block responds with Error and ErrorID:=dwTcHydErrCdSetVelo.

The reference travel begins if these checks are carried out without problems. The precise process of nEnc_HomingType is specified in the axis parameters.

If the movement algorithm reports an error code while the reference travel is being executed, the block responds with Error and ErrorID:=the movement algorithm's error code. If completion of the reference travel is prevented by the activity of another block, the block responds with CommandAborted. Successful completion of the reference travel is reported with Done.

A falling edge at Execute clears all the pending output signals. If, while the reference travel is still active, Execute is set to FALSE, execution of the reference travel that had started continues unaffected. The signals provided at the end of the movement (Error, ErrorID, CommandAborted, Done) are made available for one cycle.


TcPlcHydraulics: PLCopen Motion Control: Runtime: MC_HomeOnIndex_BkPlcMc

FUNCTION_BLOCK MC_HomeOnIndex_BkPlcMc

This function block starts and monitors the reference travel of an axis.

VAR_INPUT
    Execute:		BOOL;
    Position:		LREAL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    CommandAborted:	BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : The reference travel is initiated by a rising edge at this input.

Position : The reference position.

Busy: A pending command is indicated here.

Done : Successful processing of the reference travel is indicated here.

CommandAborted : Abortion of the reference travel is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If one of the pointers has not been initialised the block reacts with Error and with ErrorID:=dwTcHydErrCdPtrPlcMc or dwTcHydErrCdPtrMcPlc.
  • A reference travel can only be started from a stationary condition without errors. If that is not the case, the block will react by asserting Error with ErrorID:=dwTcHydErrCdNotStartable or with the error code that is passed to it.
  • If the axis is already in a fault state, or if it is in the process of carrying out a stop operation, it responds with Error and ErrorID:=dwTcHydErrCdNotReady.
  • If one of the velocities stated in the axis parameters is too small (less than 1% of the reference velocity) the block responds with Error and ErrorID:=dwTcHydErrCdSetVelo.

The reference travel begins if these checks are carried out without problems. The precise process of nEnc_HomingType is specified in the axis parameters.

If the movement algorithm reports an error code while the reference travel is being executed, the block responds with Error and ErrorID:=the movement algorithm's error code. If completion of the reference travel is prevented by the activity of another block, the block responds with CommandAborted. Successful completion of the reference travel is reported with Done.

A falling edge at Execute clears all the pending output signals. If, while the reference travel is still active, Execute is set to FALSE, execution of the reference travel that had started continues unaffected. The signals provided at the end of the movement (Error, ErrorID, CommandAborted, Done) are made available for one cycle.


TcPlcHydraulics: PLCopen Motion Control: Runtime: MC_HomeOnBlock_BkPlcMc

FUNCTION_BLOCK MC_HomeOnBlock_BkPlcMc

This function block starts and monitors the reference travel of an axis.

VAR_INPUT
    Execute:		BOOL;
    Position:		LREAL;
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		BOOL;
    CommandAborted:	BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : The reference travel is initiated by a rising edge at this input.

Position : The reference position.

Busy: A pending command is indicated here.

Done : Successful processing of the reference travel is indicated here.

CommandAborted : Abortion of the reference travel is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If one of the pointers has not been initialised the block reacts with Error and with ErrorID:=dwTcHydErrCdPtrPlcMc or dwTcHydErrCdPtrMcPlc.
  • A reference travel can only be started from a stationary condition without errors. If that is not the case, the block will react by asserting Error with ErrorID:=dwTcHydErrCdNotStartable or with the error code that is passed to it.
  • If the axis is already in a fault state, or if it is in the process of carrying out a stop operation, it responds with Error and ErrorID:=dwTcHydErrCdNotReady.
  • If one of the velocities stated in the axis parameters is too small (less than 1% of the reference velocity) the block responds with Error and ErrorID:=dwTcHydErrCdSetVelo.

The reference travel begins if these checks are carried out without problems. The precise process of nEnc_HomingType is specified in the axis parameters.

If the movement algorithm reports an error code while the reference travel is being executed, the block responds with Error and ErrorID:=the movement algorithm's error code. If completion of the reference travel is prevented by the activity of another block, the block responds with CommandAborted. Successful completion of the reference travel is reported with Done.

A falling edge at Execute clears all the pending output signals. If, while the reference travel is still active, Execute is set to FALSE, execution of the reference travel that had started continues unaffected. The signals provided at the end of the movement (Error, ErrorID, CommandAborted, Done) are made available for one cycle.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtLogAxisEntry_BkPlcMc

SPS Bibliotheken: TcPlcHydraulics

FUNCTION_BLOCK MC_AxRtLogAxisEntry_BkPlcMc

An axis related message is entered into the LogBuffer of the library. More information about creating a logging buffer can be found at FAQ #10 of the Knowledge Base.

Note: All axis related blocks of the library are using this block for message logging.

VAR_INOUT
    Axis:		POINTER TO Axis_Ref_BkPlcMc;
END_VAR
VAR_INPUT
    Execute:		BOOL:=FALSE;
    pBuffer:		POINTER TO ST_TcPlcMcLogBuffer;
    LogLevel:		DWORD:=0;
    Source:		DWORD:=0;
    Message:		STRING(255);
    ArgType:		INT:=0;
    diArg:		DINT:=0;
    lrArg:		LREAL:=0;
    sArg:		STRING(255);
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		UDINT;
END_VAR

Execute: A rising edge on this input will activate the block.

pBuffer: The address of a variable of type ST_TcPlcMcLogBuffer is to be supplied here.

LogLevel: A coded value for the type of the message. Use a Logger Levels value from the Global Constants here.

Source: A coded value for the source of the message. Use a Logger Sources value from the Global Constants here.

Message: The text of the message.

ArgType: The type of the optional argument.

diArg: If the optional argument is of type DINT supply its value here.

lrArg: If the optional argument is of type LREAL supply its value here.

sArg: If the optional argument is of type STRING supply its value here.

Busy: A pending command is indicated here.

Done : Successful processing of the reference travel is indicated here.

Behaviour of the block:

The only difference to a block of type MC_AxRtLogEntry_BkPlcMc is the prefix of the axis name to the message.

Note: The execution of the blocks function takes virtually not time. The output Done will be TRUE imediately while Busy will be TRUE at no time. These outputs are present for compatibility reasons only.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtLogClear_BkPlcMc

SPS Bibliotheken: TcPlcHydraulics

FUNCTION_BLOCK MC_AxRtLogClear_BkPlcMc

This function block will clear and initialise a LogBuffer. More information about creating a logging buffer can be found at FAQ #10 of the Knowledge Base.

VAR_INOUT
    pBuffer:		POINTER TO ST_TcPlcMcLogBuffer;
END_VAR

pBuffer: The address of a variable of type ST_TcPlcMcLogBuffer is to be supplied here.

Behaviour of the block

All entries of the LogBuffer are cleared and initialised.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtLogEntry_BkPlcMc

SPS Bibliotheken: TcPlcHydraulics

FUNCTION_BLOCK MC_AxRtLogEntry_BkPlcMc

A message is entered into the LogBuffer of the library. More information about creating a logging buffer can be found at FAQ #10 of the Knowledge Base.

VAR_INPUT
    Execute:		BOOL:=FALSE;
    pBuffer:		POINTER TO ST_TcPlcMcLogBuffer;
    LogLevel:		DWORD:=0;
    Source:		DWORD:=0;
    Message:		STRING(255);
    ArgType:		INT:=0;
    diArg:		DINT:=0;
    lrArg:		LREAL:=0;
    sArg:		STRING(255);
END_VAR
VAR_OUTPUT
    Busy:		BOOL;
    Done:		UDINT;
END_VAR

Execute: A rising edge on this input will activate the block.

pBuffer: The address of a variable of type ST_TcPlcMcLogBuffer is to be supplied here.

LogLevel: A coded value for the type of the message. Use a Logger Levels value from the Global Constants here.

Source: A coded value for the source of the message. Use a Logger Sources value from the Global Constants here.

Message: The text of the message.

ArgType: The type of the optional argument.

diArg: If the optional argument is of type DINT supply its value here.

lrArg: If the optional argument is of type LREAL supply its value here.

sArg: If the optional argument is of type STRING supply its value here.

Busy: A pending command is indicated here.

Done : Successful processing of the reference travel is indicated here.

Behaviour of the block:

Note: The execution of the blocks function takes virtually not time. The output Done will be TRUE imediately while Busy will be TRUE at no time. These outputs are present for compatibility reasons only.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtLoggerDeSpool_BkPlcMc

FUNCTION_BLOCK MC_AxRtLoggerDeSpool_BkPlcMc

The block keeps the librarys logging buffer from overrunning. More information about creating a logging buffer can be found at FAQ #10 of the Knowledge Base.

VAR_INPUT
    Spare:		INT;
END_VAR
VAR_INOUT
    pBuffer:		POINTER TO ST_TcPlcMcLogBuffer;
END_VAR

Spare: The number of free message entries the block has to guarantee.

pBuffer: The adress of a variable of type ST_TcPlcMcLogBuffer has to be supplied here.

Behaviour of the block

On each call the block will remove one message from the logging buffer if the number of free entries is smaller than Spare.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtLoggerRead_BkPlcMc

SPS Bibliotheken: TcPlcHydraulics

FUNCTION_BLOCK MC_AxRtLoggerRead_BkPlcMc

The block is reading a message from the LogBuffer of the library. More information about creating a logging buffer can be found at FAQ #10 of the Knowledge Base.

Note: This block is used by diagnosis tool via ADS. A direct call from the PLC application usually makes no sense.

VAR_INOUT
    Entry:		INT:=0;
    pBuffer:		POINTER TO ST_TcPlcMcLogBuffer;
    pEntry:		POINTER TO ST_TcPlcMcLogEntry;
END_VAR

Entry: The number of the requested message.

pBuffer: The address of a variable of type ST_TcPlcMcLogBuffer is to be supplied here.

pEntry: The address of a destination variable of type ST_TcPlcMcLogEntry is to be supplied here.

Behaviour of the block:

The block will copy the message specified by Entry from the LogBuffer pBuffer into the message structure adressed by pEntry. Entry is used as a relative age: Entry:=1 is selecting the top (last in) message, Entry:=2 the message next to it. If the requested message cannot be found the destination structure is cleared and initialised.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtLoggerSpool_BkPlcMc

FUNCTION_BLOCK MC_AxRtLoggerSpool_BkPlcMc

The block is forwarding messages from the librarys buffer to the Windows event logger. More information about creating a logging buffer can be found at FAQ #10 of the Knowledge Base.

VAR_INOUT
    pBuffer:		POINTER TO ST_TcPlcMcLogBuffer;
END_VAR

pBuffer: The adress of a variable of type ST_TcPlcMcLogBuffer has to be supplied here.

Behaviour of the block

On each call the block will remove one message from the librarys buffer and forward it to the Windows event logger.


TcPlcHydraulics: PLCopen Motion Control: Parameter: MC_AxAdsCommServer_BkPlcMc

FUNCTION_BLOCK MC_AxAdsCommServer_BkPlcMc

The function block gives the application the functionality of an ADS server. It calls blocks of the MC_AxAdsReadDecoder_BkPlcMc and MC_AxAdsWriteDecoder_BkPlcMc types as required. The ADS codes are listed in the Knowledge Base.

VAR_INPUT
    nFirstAxisIndex:	INT;
    nLastAxisIndex:	INT;
END_VAR
VAR_INOUT
    pAxItf:		POINTER TO Axis_Ref_BkPlcMc;
END_VAR

nFirstAxisIndex, nLastAxisIndex: The dimensioning of the Axis_Ref_BkPlcMc array must be given here.

Warning: Incorrect data provided at this location excludes some of the axes from communication, or can result in the PLC application crashing as a result of serious runtime errors (Page Fault Exception).

pAxItf: The address of a variable or of an array of variables of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

If the PLC application calls this block cyclically, it acquires the character of an ADS server, answering ADS read and ADS write accesses like any other ADS server. This includes the decoding of IdxGroup/IdxOffset addressing. Blocks of the MC_AxAdsReadDecoder and MC_AxAdsWriteDecoder types are called for this purpose as required.

Note: This block must not be used if the PLC application already is an ADS server. In that case, the blocks of the MC_AxAdsReadDecoder and MC_AxAdsWriteDecoder types have to be called from the ADS server blocks already included in the application.


TcPlcHydraulics: PLCopen Motion Control: Parameter: MC_AxAdsReadDecoder_BkPlcMc

FUNCTION_BLOCK MC_AxAdsReadDecoder_BkPlcMc

The function block decodes ADS read accesses. The ADS codes are listed in the Knowledge Base.

VAR_INPUT
    nFirstAxisIndex:	INT;
    nLastAxisIndex:	INT;
    bReset:		BOOL;
    bValid:		BOOL;
    sNetId:		STRING(80);
    nPort:		UINT;
    nInvokeId:	UDINT;
    nIdxGroup:	UDINT;
    nIdxOffs:		UDINT;
    cbReadLen:	UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    bClear:		BOOL;
    bPending:		BOOL;
END_VAR

nFirstAxisIndex, nLastAxisIndex: The dimensioning of the Axis_Ref_BkPlcMc array must be given here.

Warning: Incorrect data provided at this location excludes some of the axes from communication, or can result in the PLC application crashing as a result of serious runtime errors (Page Fault Exception).

bReset, bValid: The signals are used to co-ordinate the decoder with the ADS server.

sNetId, nPort, nInvokeId: These values are required in order to generate the ADS response. They are supplied by an ADS server's ADS indication block.

nIdxGroup, nIdxOffs, cbReadLen: These values are required in order to decode the access. They are supplied by an ADS server's ADS indication block.

Axis: The address of a variable or of an array of variables of type Axis_Ref_BkPlcMc is to be passed here.

bClear:

bPending:

Behaviour of the block:

Note: If, when the bValid signal is present, the block indicates neither bClear nor bPending it has not decoded the combination of nIdxGroup and nIdxOffs, and has not generated a response. In such a case, the ADS server (if there is one) must call another decoder, or must generate a response with the appropriate error code.


TcPlcHydraulics: PLCopen Motion Control: Parameter: MC_AxAdsWriteDecoder_BkPlcMc

FUNCTION_BLOCK MC_AxAdsWriteDecoder_BkPlcMc

The function block decodes ADS write accesses. The ADS codes are listed in the Knowledge Base.

VAR_INPUT
    nAxisCount:	INT;
    bReset:		BOOL;
    bValid:		BOOL;
    sNetId:		STRING(80);
    nPort:		UINT;
    nInvokeId:	UDINT;
    nIdxGroup:	UDINT;
    nIdxOffs:		UDINT;
    cbWriteLen:	UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR
VAR_OUTPUT
    bClear:		BOOL;
    bPending:		BOOL;
END_VAR

nFirstAxisIndex, nLastAxisIndex: The dimensioning of the Axis_Ref_BkPlcMc array must be given here.

Warning: Incorrect data provided at this location excludes some of the axes from communication, or can result in the PLC application crashing as a result of serious runtime errors (Page Fault Exception).

bReset, bValid: The signals are used to co-ordinate the decoder with the ADS server.

sNetId, nPort, nInvokeId: These values are required in order to generate the ADS response. They are supplied by an ADS server's ADS indication block.

nIdxGroup, nIdxOffs, cbWriteLen: These values are required in order to decode the access. They are supplied by an ADS server's ADS indication block.

Axis: The address of a variable or of an array of variables of type Axis_Ref_BkPlcMc is to be passed here.

bClear:

bPending:

Behaviour of the block:

Note: If, when the bValid signal is present, the block indicates neither bClear nor bPending it has not decoded the combination of nIdxGroup and nIdxOffs, and has not generated a response. In such a case, the ADS server (if there is one) must call another decoder, or must generate a response with the appropriate error code.


TcPlcHydraulics: PLCopen Motion Control: Parameter: MC_AxParamLoad_BkPlcMc

FUNCTION_BLOCK MC_AxParamLoad_BkPlcMc

The function block loads the parameters for an axis from a file. A block of type MC_AxParamSave_BkPlcMc must be used to generate a compatible parameter file.

Note: This block is usually not called directly by the application. If possible a block of type MC_AxUtiStandardInit_BkPlcMc should be used, that will make use of a block of type MC_AxParamLoad_BkPlcMc.

VAR_INPUT
    Execute:		BOOL;
END_VAR
VAR_OUTPUT
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : : The loading process is initiated by a rising edge at this input.

Done : Successful loading of the parameters is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If one of the pointers has not been initialised the block reacts with Error and with ErrorID:=dwTcHydErrCdPtrPlcMc or dwTcHydErrCdPtrMcPlc.

The loading process begins if these checks are carried out without problems.

A falling edge at Execute clears all the pending output signals. If Execute is set to FALSE while the loading process is still active, the process that had started continues unaffected. The signals provided at the end of the operation (Error, ErrorID, Done) are made available for one cycle.


TcPlcHydraulics: PLCopen Motion Control: Parameter: MC_AxParamSave_BkPlcMc

FUNCTION_BLOCK MC_AxParamSave_BkPlcMc

The function block writes the parameters for an axis into a file. A block of type MC_AxParamLoad_BkPlcMc must be used to read the file.

VAR_INPUT
    Execute:		BOOL;
END_VAR
VAR_OUTPUT
    Done:		BOOL;
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Execute : The writing process is initiated by a rising edge at this input.

Done : Successful writing of the parameters is indicated here.

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block is activated by a rising edge at Execute, and investigates the axis interface that has been passed to it. A number of problems can be detected and reported during this process:

  • If one of the pointers has not been initialised the block reacts with Error and with ErrorID:=dwTcHydErrCdPtrPlcMc or dwTcHydErrCdPtrMcPlc.

The writing process begins if these checks are carried out without problems.

A falling edge at Execute clears all the pending output signals. If Execute is set to FALSE while the writing process is still active, the process that had started continues unaffected. The signals provided at the end of the operation (Error, ErrorID, Done) are made available for one cycle.


TcPlcHydraulics: Knowledge Base

Knowledge Base of the TcHydlib PLC library

You will find a number of answers to frequently asked questions here.

Topics

Name | Description
Global Constants | Pre-defined error codes, masks for bit queries, ADS codes etc.
Setup | Setting up information
SampleList | Sample programs
Ideas Bank | Tips and tricks.

Problems on updating the library

After an update of the library there may be showing up compiler problems. A possible reasom for this is a name change on a block or type. Some name changes are unavoidable because they are enforced by one of the following reasons:

  • Adaption to the rules of the PLC Open Motion Control definitions.
  • Tracing the development of the PLC Open Motion Control definitions.
  • Advancement of the supplied technologie.
  • Adaption to the used technologie, for example the usage of more I/O devices.
  • Avoiding naming collisions and other types of incompatibility to other libraries.
Old Name | New Name | Cause of change
ST_TcMcAxInterface | Axis_Ref_BkPlcMc | Adaption to the rules of the PLC Open Motion Control definitions.
ST_TcPlcMcCamId | MC_CAM_ID_BkPlcMc | Adaption to the rules of the PLC Open Motion Control definitions.
ST_TcPlcMcCamRef | MC_CAM_REF_BkPlcMc | Adaption to the rules of the PLC Open Motion Control definitions.
E_TcMCDirection | MC_Direction_BkPlcMc | Adaption to the rules of the PLC Open Motion Control definitions.
E_TcMCStartMode | MC_StartMode_BkPlcMc | Adaption to the rules of the PLC Open Motion Control definitions.

Size of I/O structures in bytes

Name | V 2.1.X
ST_TcPlcMcEncoderIn | 16
ST_TcPlcMcEncoderOut | 1
ST_TcPlcMcDriveIn | 23
ST_TcPlcMcDriveOut | 40
ST_TcPlcMcAx2000In | 37
ST_TcPlcMcAx2000Out | 26


TcPlcHydraulics: Knowledge Base: FAQs

Knowledge Base of the TcHydlib PLC library: Start-up procedure

Suitable values have to be set for a number of parameters when starting up an axis. Some of these parameters are used to specify the hardware-specific sub-blocks to be used or other components that are available in multiple versions. Others provide information about the drive train, and are used to enable the library blocks to determine actual values correctly and to generate control and regulation values appropriately. Other parameters define the movement profile that is to be generated, or specify the behaviour when idle.

It is helpful to follow a specific procedure for this start-up process. The sequence described here is not mandatory, but does permit the axis to be controlled from an early stage. This allows the axis to be used, even as the rest of the work continues.

Note: The working method described here is comparable, at least in principle, to that for NC axes.

Name | Description
IBN #1 | Safety instructions
IBN #2 | Initial specifications
IBN #3 | Preliminary settings
IBN #4 | Acceleration and braking
IBN #5 | First activation of the axis
IBN #6 | Feed forward
IBN #7 | Target approach
IBN #8 | Idle behaviour
IBN #9 | Monitor functions
IBN #10 | Reference travel and zero offset shift
IBN #11 | Performance optimisation

IBN #1: Safety instructions

During the start-up process it is not impossible that the axis will move in ways that are neither wanted nor expected at this time or in this manner. The hazard presented to persons, objects or the machine itself are considerably higher during this phase than they are during normal operation. A number of precautions are accordingly to be taken.

  • The machine or equipment is to be secured to prevent anyone from entering or reaching into it.
  • All persons present must be informed about the hazards presented by the machine. Nobody should be allowed to remain in the area at all unless their presence is essential.
  • All delicate machine parts such as tools or moulds should, at least at the beginning, be removed. If this means that the missing mass, for instance, causes the axis to behave in a way that does not correspond to the way it will in practice, the use of ballast should be considered.
  • It is possible that the axis will execute untypical movements (too fast, too far, uneven). Appropriate precautions must be taken if this could lead to damage. This might, for example, take the form of a reinforced stop, attached provisionally to restrict the travel distance.
  • The power supply should only be activated at an appropriate stage (which means not right at the beginning), after careful examination of the situation and after due consideration.

IBN #2: Initial specifications

The following parameters should be set during the initialisation routine (see FAQ #3 here) at run time, and therefore every time the TwinCAT system is started:

  • fCycletime: The task cycle time is to be entered here. Using the PLC's runtime information is better than a hard-coded assignment.

    Example: stTcHydAxParam[nAxIndex].fCycletime:=UDINT_TO_LREAL(SystemTaskInfoArr[1..4].cycleTime) / 10000000.0;

  • sAxisName, sParamFileName: The text name of the axis and the name of the parameter file should have a fixed relationship. Hard coding here is therefore entirely fitting.

    Example of generic axis names generated from axis index 1..n:

    stAxItf[nAxIndex].sAxisName:=CONCAT('Achse_',INT_TO_STRING(nAxIndex));

    (*Example for a Cxxxx controller*)

    stemp:=CONCAT('C:\TwinCAT\PLC\HydLib\',stAxItf[nAxIndex].sAxisName);

    (*Example for a CX1000 controller*)

    stemp:=CONCAT('HARD DISK\TwinCAT\',stAxItf[nAxIndex].sAxisName);

    stAxParam[nAxIndex].sParamFileName:=CONCAT(stemp,'.dat');

    Note: The names of the parameter files for different axes must never be the same. It is only through the file names that the parameters are associated with their axis. If the same file name is used for two axes, the parameters for one axis will be lost, and it will receive the same parameters as the second axis. When the parameters are saved, the parameters for one axis will be lost. The parameter record that is retained and the one that is lost depends only on the sequence of save commands.

    Note: The parameter file for an axis can be backed up or restored by copying. Identical set-ups can be reproduced for machines in series production in this way. It is then only necessary to adjust parameters if, for example, reference positions or zero offset shifts are affected by the variable mechanical properties of the individual machine.

A number of parameters control the use of blocks and procedures for which multiple options exist. As a rule these specifications can be made at the very beginning of the start-up process.

  • nEnc_Type: A value from E_TcMcEncoderType is to be entered here. This parameter is normally evaluated by a block of type MC_AxRtEncoder_BkPlcMc.

    Note: The System Manager is used to establish the link between the I/O variables and the I/O components. Further notes can be found under FAQ #4.

  • nEnc_HomingType: A value from E_TcMcHomingType is to be entered here. This parameter is normally used by a block of type MC_Home_BkPlcMc.

    Note: Not every type of encoder supports every method of referencing.

    Note: In absolute encoders with, for instance, an SSI interface, it is not necessary to execute a reference travel, and the value of nEnc_HomingType has no significance. Matching the position acquisition to the machine is done through the parameter fEnc_ZeroShift.

  • nDrive_Type: A value from E_TcMcDriveType is to be entered here. This parameter is normally used by a block of type MC_AxRtDrive_BkPlcMc.

    Note: The System Manager is used to establish the link between the I/O variables and the I/O components. Further notes can be found under FAQ #7.

  • nProfileType: A value from E_TcMcProfileType is to be entered here. This parameter is normally evaluated by a block of type MC_AxRuntime_BkPlcMc.
  • bSoftEndMinEna, bSoftEndMaxEna: At this stage this parameter is most usually set to 0, i.e. FALSE, since it is usually only worth restricting the travel distance after the acquisition of actual positions is operating.
  • bPosCtrlAccEna: This parameter is initially also to be set to 0, i.e. FALSE.

IBN #3: Preliminary settings

At this stage the following parameters can already be assigned preliminary or even final values:

  • fEnc_IncWeighting, fEnc_IncInterpolation: For some types of encoder, such as incremental encoders or SSI absolute encoders, the increment weighting factor is to be obtained by calculations based on data sheet figures for the encoder and on information regarding the mechanical construction. In such cases this should be done now. Other encoders, such as analog transducers, permit at least a preliminary setting obtained by dividing the distance to which the sensor can respond by the range of values provided by the input electronics. Thus if an analog transducer delivers 0..10V over a distance of 100mm, and the KL4032 being used represents the electrical signal with a numerical range extending over 0..32767, then a preliminary value of 0.003 (i.e. approx. 100 / 32767) should be set for the parameter. This value is to be adjusted to a more accurate value at a later stage.
    Is this setting done for one increment the value of increment interpolation should be set to 1.0. Is the setting done for a number of increments (for an example per shaft turn) the value of increment interpolation should be set to this number of increments.
    Example: For 20mm distance on 1024 increments the rounded setting ( 0.019531 / 1 ) or the accurate setting ( 20.0 / 1024 ) are comparable.
  • bEnc_Reversed: Because of the lack of natural rules for the polarity of a movement the meaning of positive and negative are choosen arbitrarily. At this point it is usually not yet known if the encoders counting direction (caused by wiring signal lines to I/O points) is reversed to the choosen poalrity of the movement. So at this time a FALSE should be entered here.

    Attention: Not all encoder types are supporting this parameter.

  • fEnc_ZeroShift: This parameter has no meaning for incremental displacement transducers, and should now be given its final value of 0.0. If an absolute position transducer is used, a value should now be set that places the indicated actual position roughly into the desired range of values. This parameter will be given a final setting at a later stage.
  • fAreaRatio: The ratio of the effective areas of a hydraulic cylinder is to be entered here. If area compensation is not required, the value 1.0 must be entered.

    Note: The value can be calculated from the diameters of the pistons and piston rods by means of the following formula:

    fAreaRatio:=(DKA*DKA-DSA*DSA) / (DKB*DKB-DSB*DSB) with

    DKA=diameter of the piston on the A side

    DKB=diameter of the piston on the B side

    DSA=diameter of the rod on the A side

    DSB=diameter of the rod on the B side

    Note: The A side always refers to the side of the piston which, when subjected to pressure and fluid flow, causes the actual position to change in the rising direction. This means that a positive value causes the figure to rise, while a negative value makes it fall.

  • bDrive_Reversed: Because of the lack of natural rules for the polarity of a movement the meaning of positive and negative are choosen arbitrarily. At this point it is usually not yet known if the drives working direction (caused by wiring signal lines to I/O points) is reversed to the choosen poalrity of the movement. So at this time a FALSE should be entered here.
  • fRefVelo: The velocity of the axis, expressed in units of actual position per second, to be expected when 100% of the control value is output in the positive sense is to be entered here. A preliminary value can be calculated here on the basis of the characteristic data of the valve and the cylinder.

    fRefVelo:=QNOM * 16666.6 / AA with

    AA := (DKA*DKA-DSA*DSA) * 3.1415 / 4.0

    QNOM being the nominal volume rate of flow of fluid from the valve's data sheet.

  • fMaxVelo: Initially, the same value as is used for fRefVelo should be entered here.
  • fCreepSpeed, fCreepDistance: Approximately 10% of fRefVelo should be entered as a preliminary value into fCreepSpeed. To avoid travelling past the target position, a preliminary value of a few tens of millimetres (up to 100 mm in the case of large masses) should be set for the fCreepDistance.
  • fBrakeDistance, fBrakeDeadTime: This value should initially be set to 0.0. Although this does mean that the target will be slightly exceeded, this can be compensated for, if necessary, by increasing fBrakeDistance.
  • fMonPositionRange, fMonTargetRange, fMonTargetFilter: These parameters define the conditions under which completion of axis movements is reported. Initially, fMonPositionRange and fMonTargetRange should be set to a large values such as 1000.0 mm, and fMonTargetFilter to a small value such as 0.01 s.
  • fLagAmp, fZeroCompensation, fTargetClamping: These parameters should initially be set to 0.0. If the setting for an axis with a zero-crossing valve drifts, it should initially be stopped by changing fZeroCompensation. A small value should then be set for fLagAmp. A small value like this can be used to ensure that the fRefVelo is divided by a distance that is not too small, such as 100 mm.
  • fReposDistance: A large value such as 1000.0 mm should initially be set here. With certain profile types it is otherwise possible that the axis will start to move of its own accord.
  • fValve_BendPointVelo, fValve_BendPointOutput: The construction of some valves (a staged slider) results in a marked change in gradient over the active control range (example characteristic curve 2). The library blocks must take this changing gradient into account in order to achieve even acceleration and deceleration, and so that the travel velocity can be correctly adjusted over the usable working range. Information provided the in the data sheets is usually sufficient, and this setting can be made at this stage.

    Note: These parameters can be given a final setting of 0.0 at this stage for linear valves or for other actuators without bends in their characteristic curves (example characteristic curves 1 and 2).

  • fValve_OverlapComp: In the case of hydraulic valves with positive overlap (example characteristic curve 3) this parameter can now be set to a value somewhat more than that given in the data sheet. If the manufacturer has quoted a figure of 20%, the parameter should be set to about 22 or 25%. The valve manufacturer's information describes the control value at which it any measurable fluid flow occurs at all. The library blocks, on the other hand, require a control value at which a projection of the active region of the characteristic curve intersects the zero line. Experience indicates that this value is a few percentage points above the manufacturer's figure.

    Note: The parameter can now be given a final value of 0.0 for zero-cut valves or other actuators that do not have an exclusion area around the zero point (example characteristic curve 1 and 2).

Examples of typical valve characteristic curves

IBN #4: Acceleration and braking

  • fStartRamp, fAcc, fMaxAcc: These parameters govern the way velocity is built up. The smaller of the two acceleration parameters functions as a limit. Depending on the profile type chosen, fStartRamp also acts as a time-referenced limit. As an initial setting, 1 second can be entered for axes with a limiting frequency of at least a few tens of Hz, otherwise several seconds should be chosen. The acceleration values are then calculated in accordance with the following formula:

    Acc := fRefVelo / fStartRamp

    This setting controls the axis very gently. Optimisation of performance should be carried out later.

  • fStopRamp, fDec, fMaxDec: These parameters govern the way velocity is removed. The smaller of the two deceleration parameters functions as a limit. Depending on the profile type chosen, fStopRamp also acts as a time-referenced limit. As an initial setting, 1 second can be entered for axes with a limiting frequency of at least a few tens of Hz, otherwise several seconds should be chosen. The acceleration values are then calculated in accordance with the following formula:

    Dec := fRefVelo / fStopRamp

    This setting controls the axis very gently. Optimisation of performance should be carried out later.

  • fEmergencyRamp: This ramp time governs the removal of the control value in the event of an error and other comparable situations. This time should therefore be set to as low a value as the machine and equipment can cope with. In any event, the value should be chosen so that the axis brakes significantly more rapidly than when braking in regular operation.

    Note: In some cases it may be necessary to avoid reducing the control value too quickly, so that cavitation effects at the valve's control edges are avoided. This is mainly to be expected in valves with quick reactions and with high rated fluid flow rates in combination with large masses, and leads to a gradual deterioration of the valve.

IBN #5: First activation of the axis

After the initial settings described above have been made it should be possible to drive the axis. Performance may be poor, but approximate control should at least be possible.

  • Put the machine into a safe condition, and inform anyone present of the potential danger.
  • Ensure that the axis does not receive any enables in ST_TcHydAxRtData.nDeCtrlDWord.
  • If it is possible, a small movement of the machine, still without power, should be carried out. It may be possible to move the axis or the displacement sensor manually for this purpose. Ensure in this way that the actual value acquisition is counting in the proper direction. If counting is taking place in the wrong direction, the arithmetic sign in fEnc_IncWeighting should be inverted. fEnc_ZeroShift should then be checked on absolute displacement sensors.
  • Ensure that it is not possible for any other axes to start moving to when the power supply is activated.
  • Activate the power supply now. (Compressor on, high pressure on, etc.)
  • There should be no more than a drift in the position of the axis. If significant movement is detected, there is probably an electrical, hydraulic or mechanical problem that needs to be overcome before a new attempt can be made.
  • It must be possible to detect movement of the axis in the actual value. A drift in the axis position is sufficient to check this.
  • If an axis with a zero crossing valve (or with some other type of drive that does not have a dead region around the zero point) drifts, the movement should be halted by changing fZeroCompensation. It is then possible to set a low value (fRefVelo / 100mm, for example) as fLagAmp. If the axis reacts by moving away from the set position even when the positional control is active, the positional control loop is working with positive feedback. If the actual value acquisition has been checked and if it is counting in the correct direction, this can only be caused by an inverted connection in the control value channel. At present this problem can only be solved by correcting the wiring.
  • The axis should now be in a stable, idle state. The next step is to initiate the first active movement by starting the axis with a low velocity with a nearby target position. If the machine moves in the wrong direction, this must be due to an inverted connection in the control value channel. At present this problem can only be solved by correcting the wiring. If, although the machine moves in the correct direction, the actual position is indicated in the opposite direction, the arithmetic sign in fEnc_IncWeighting must be inverted. fEnc_ZeroShift should then be checked on absolute displacement sensors.

IBN #6: Feed forward

Parameters: fRefVelo, fAreaRatio, fValve_OverlapComp, fValve_BendPointVelo, fValve_BendPointOutput

To check the feed forward it is necessary to move the axis over a sufficient distance in changing directions and at different speeds. In doing this it must achieve the steady movement phase. If this is not possible, the acceleration, deceleration and creep phases must carefully be shortened.

  • There are a number of possible reasons for unsymmetrical behaviour of the axis:
    • If the cylinder is differential it is possible that fAreaRatio is not correctly set.
    • If the required force changes with the direction, the pressure drop at the valve, and therefore the volume rate of flow that actually needs to be set, depends on the direction. Compensation for this can be included in fAreaRatio.
    • Incorrectly set fZeroCompensation at low velocities can cause this behaviour in axes that have no dead region around the zero point.
  • If, when fully or almost fully driven, the actual velocity of the axis is significantly different from the set velocity, fRefVelo is not correct. If the value is too low, fRefVelo has been set too high, and vice versa.
  • If a valve has a bend in the characteristic curve, a test travel at approximately 75% of the fValve_BendPointVelo should be executed, and the actual velocity compared with the set velocity. If the value is too low, fValve_BendPointVelo has been set too high, and vice versa. This test, and the one below, should be repeated in alternation.
  • If a valve has a bend in the characteristic curve, a test travel at approximately 150% of the fValve_BendPointVelo should be executed, and the actual velocity compared with the set velocity. If the value is too low, fValve_BendPointOutput has been set too low, and vice versa. This test, and the one above, should be repeated in alternation.

    Note: This parameter should only be altered by very small amounts, because any change has a large effect.

  • After checking fRefVelo on a valve with positive overlap, a test travel at approximately 10% of fRefVelo should be carried out, and the actual velocity compared with the set velocity. If the value is too low, fValve_OverlapComp has been set too low, and vice versa.

    Note: This parameter should only be altered by very small amounts, because any change has a large effect.

    Note: If the parameter is set a great deal too small, the minimum usable velocity increases. The result of this can in turn be that the axis can no longer carry out a slow movement. If the same axis has at least an approximately correct reaction to travel commands with medium velocities, fValve_OverlapComp should be increased.

IBN #7: Target approach

Parameters: fCreepSpeed, fCreepDistance, fBrakeDistance, fBrakeDeadTime

When approaching the target, the control value for the axis is brought down to fCreepSpeed in such a way that this velocity is reached at a distance from the target specified by fCreepDistance . This control value is maintained until the distance from the target has dropped to fBrakeDistance+fBrakeDeadTime*actual velocity . The axis then switches to its idle behaviour.

  • The fCreepSpeed is to be chosen in such a way that the axis can travel at this velocity with sufficient accuracy under any loading situation that can be expected.

    Note: A higher value may make transition to the target less precise.

    Note: A value that is too low lengthens the time required and increases the risk that the axis will stop before reaching the target.

  • The fCreepDistance is to be chosen in such a way that under any loading situation that can be expected the axis will have settled to a constant velocity before it gets close to the target.

    Note: To high a value increases the required time.

    Note: The result of a value that is too low is that the transition to the idle condition, and therefore the precision with which the target is reached, depends heavily on the previous history (distance, velocity, loading conditions).

  • The parameters fBrakeDistance and fBrakeDeadTime specify the transition to idling behaviour.

IBN #8: Idle behaviour

Parameters: fLagAmp, fZeroCompensation, fTargetClamping, fReposDistance.

  • In axis without a dead region around the zero point, positional control when idling can be activated by setting the value of fLagAmp to be greater than 0.0.

    Note: The output of the position controller is limited to fCreepSpeed. If the axis changes to the idle state at the distance from the target specified by fBrakeDistance and/or fBrakeDeadTime there will not be an abrupt rise in the control value, even if the position controller would otherwise output a higher control value.

  • It is possible to compensate for an offset voltage or a tolerance in, for instance, the neutral position of the valve, by setting fZeroCompensation to an appropriate value.

    Note: If the remaining position error found on axes with no dead region around the origin, and where positional control when idle has been activated, always has the same arithmetic sign, regardless of the direction of movement, this is due to a one-sided effect. In addition to the causes that have already mentioned, gravity can be playing a part. It should be possible to significantly reduce the residual error through compensation.

    Note: If an axis with a dead region around the origin is seen in the scope recording to have clearly visible differences in the control value used to initiate an actual movement, even though fAreaRatio is correctly set, this can be the result of an offset. This can also have the effect of making the smallest, stable usable velocity dependent on the direction. If this behaviour is a problem, it can, at least, be significantly reduced.

  • If, when an axis has completed its movement, a defined output is to be provided, for instance to hold it against a stop, an appropriate value should be set in fTargetClamping. This value is then output in the idle state, with the arithmetic sign of the most recent active movement, until a reset or a new travel order is given.

    Note: If, as a result of sequences of commands or similar subsequent manipulations in the profile generation, the axis initially overshoots the target and then approaches it by changing the direction of its movement, the arithmetic sign of the last movement that lead towards the final destination will apply.

  • If an axis that has a dead region around the origin drifts or is pushed away from its destination when idle, it can automatically react by approaching the position again. If this is desired, the relevant tolerance must be set in fReposDistance.

    Note: With some types of profile this can have the effect that the axis sporadically refuses a travel command because it is already busy.

IBN #9: Monitor functions

Parameters: fMonPositionRange, fMonTargetRange, fMonTargetFilter.

These parameters determine the way in which the status bits of the axis are set, and therefore also the way in which various blocks in the library report that they have completed. A MC_MoveAbsolute_BkPlcMc block, for instance, will only report that it is Done when all the monitoring conditions are satisfied and the corresponding status bits have been set.

  • If the axis is located somewhere within the positions covered by fMonPositionRange around the target location, this is indicated in its status word nStateDWord, with the dwTcHydNsDwInTargRng mask.

    Note: Because no filtering is being carried out, it is possible that this signal will be unstable for either a short or long period.

  • If the axis is located without interruption within the range of positions covered by fMonTargetRange around the target for a period of time specified by fMonTargetFilter, this is indicated in its status if nStateDWord with the dwTcHydNsDwInTarget mask.

    Note: The filtering means that this signal appears with some delay, but with appropriate settings it is, however, stable.

  • No hard-and-fast rules can be given for setting this parameter, because it must generate different behaviours depending on the particular task. It should, however, be borne in mind that axis monitoring is one of the factors that determines the end of a travel movement. If settings are made that can never be satisfied, it is therefore possible that the axis will lock up or will be delayed in working through its procedures.

IBN #10: Reference travel and zero offset shift

Parameters: fEnc_ZeroShift, fEnc_RefIndexVelo, bEnc_RefIndexPositive, fEnc_RefSyncVelo

No reference travel is necessary for absolute displacement sensors (SSI interface, analog sensors with 0-10V or 0/4-20mA outputs). The correct position of the actual value system within the machine is achieved through shifting the zero offset in the parameter fEnc_ZeroShift. The raw actual position is shifted by adding the value entered here to it. If the actual value system for the axis has been shifted within the machine, the zero offset shift must be changed by the desired quantity, and in the desired direction.

A reference travel must be executed in order to find the relationship between the actual value acquisition from incremental displacement sensors and the machine. This operation uses one or more parameters, depending on the parameter nEnc_HomingType:

  • fEnc_RefIndexVelo, bEnc_RefIndexPositive: These parameters specify the direction and velocity of the first movement of the reference travel. The velocity quoted is to be understood as a co-factor to the fMaxVelo parameter. If the movement is to be executed at half of fMaxVelo, the value 0.5 should be set. If bEnc_RefIndexPositive is set to 1 (= TRUE) the movement will take place in the direction of rising position values. This initial movement is continued until a reference cam or a halt in the movement is detected, depending on nEnc_HomingType.

    Note: If a reference method is specified in nEnc_HomingType in which a cam is approached, the combination of velocity and the deceleration that will be activated must not cause the axis to overshoot the cam.

  • fEnc_RefSyncVelo, bEnc_RefSyncPositive: These parameters specify the direction and velocity of the second movement of the reference travel. The velocity quoted is to be understood as a co-factor to the fMaxVelo parameter. If the movement is to be executed at half of fMaxVelo, the value 0.5 should be set. If bEnc_RefSyncPositive is set to 1 (= TRUE) the movement will take place in the direction of rising position values. This second movement is continued until the end of the reference cam or an additional latch event is detected, depending on nEnc_HomingType.

    Note: Only some of the possible settings of nEnc_HomingType will cause this second movement to be carried out.

  • fEnc_DefaultHomePosition: This parameter is the value provided for the position input of blocks of type MC_Home_BkPlcMc. The actual position is set to this value if the reference travel can successfully be completed. This permits alignment with the actual value system within the machine. This parameter thus performs the same role for incremental displacement transducers as is performed for absolute displacement sensors by fEnc_ZeroShift.

    Note: The axis is not necessarily located at the given position at the end of the reference travel. In some referencing methods, the actual value is set into motion, and the axis is then stopped.

IBN #11: Performance optimisation

Parameters: fAcc, fDec, fMaxAcc, fMaxDec, fStartRamp, fStopRamp, fMaxVelo, fCreepSpeed, fCreepDistance, fMonTargetFilter, fMonTargetRange, fMonPositionRange.

The time required for a particular movement can be reduced through a number of procedures:

  • The acceleration phase can be shortened by increasing fMaxAcc. This will harden the movement control, and the axis will be stressed by greater forces and greater changes in force.

    Note: Increasing fMaxAcc only has an effect up to the value in fAcc.

    Note: In some types of profile, the acceleration is limited by fStartRamp. This parameter places a lower limit on the time for the acceleration up to fRefVelo, therefore restricting the possible range of accelerations.

  • The deceleration phase can be shortened by increasing fMaxDec. This will harden the target approach, and the axis will be stressed by greater forces and greater changes in force. The sharper deceleration will also lead to greater scatter in the transition to the creep phase. It may be necessary to compensate for an excessive increase by extending the creep phase so that the precision with which the target is reached can be maintained.

    Note: Increasing fMaxDec only has an effect up to the value in fDec.

    Note: In some types of profile, the deceleration is limited by fStopRamp. This parameter places a lower limit on the time for the acceleration up to fRefVelo, therefore restricting the possible range of decelerations.

  • If no additional controller blocks are integrated, it is possible to increase fMaxVelo up to fRefVelo, because the way in which the control value generators operate makes maintenance of a control reserve during active movement superfluous.
  • Too low a setting for fCreepSpeed or too high a setting for fCreepDistance may indeed improve the precision with which the target is reached, but also increase the time required. It is necessary to find a reasonable compromise here.
  • Making too high a setting for fMonTargetFilter increases the time required without yielding any further increase in reliability. The natural frequency of the axis should be found in order to choose a suitable value. This can be done by calculation or observation. It is possible to analyse the actual velocity in Scope View to determine the typical period of the oscillations when braking to fCreepSpeed. About twice this time should then be adequate for fMonTargetFilter.
  • About half of the error at the target that can in fact be accepted should be set for fMonTargetRange. If a lower value is set, this only increases the time required without improving the reliability.
  • The value in fMonPositionRange is often used to implement advance starts associated with subsequent movements. The pattern of movements of a 2-axis portal (upwards, across, downwards) can be accelerated if each axis reports dwTcHydNsDwInTargRng when it is still a carefully chosen distance short of the target. The subsequent movement can be initiated on receipt of these signals earlier than would otherwise be possible.
  • Note: If dwTcHydNsDwInTargRng is not used for this or any other similar purpose, then an equal or greater value should be set in fMonPositionRange as is set in fMonTargetRange.


TcPlcHydraulics: Knowledge Base: FAQs

Knowledge Base of the TcHydlib PLC library: FAQs

You will find a number of answers to frequently asked questions here.

Name | Description
FAQ #1 | How do I integrate one or more axes into a PLC application?
FAQ #2 | What data has to be created in the PLC application for the axes?
FAQ #3 | How do I initialise the data and load the parameters for an axis when the PLC starts?
FAQ #4 | How is the actual position of the axes determined ?
FAQ #5 | How is the control value for an axis created?
FAQ #6 | How is the control value for an axis prepared for output?
FAQ #7 | How is the control value output to an axis?
FAQ #8 | What is the correct order to call the function blocks for an axis?
FAQ #9 | How do I control the power stage (on board or external) of a valve?
FAQ #10 | How do I create a message logger functionality?
FAQ #11 | How do I abort the monitoring of a function?
FAQ #12 | How do I monitor the communication to an I/O device?
Setup | How is operation of the axis begun, and how is it optimised?

FAQ #1 How do I integrate one or more axes into a PLC application?

The procedure here differs fundamentally from an axis guided by the NC task, because in this case everything done by the NC task is performed by the PLC. Ready-made program blocks are, however, available in most areas, so that the additional programming effort is held within reasonable limits. The following particular points must be considered:

  • Axis data in the PLC application (FAQ #2)
  • Initialising and loading the axis parameters when starting the PLC application (FAQ #3)
  • Acquisition of actual values (FAQ #4)
  • Generating control values (FAQ #5)
  • Processing control values in preparation for output (FAQ #6)
  • Setting up the axes (Setup)
  • Organisation of the procedure for movement (FAQ #7)

Note: If only the usual blocks (encoder, generator, finish, drive) for the axis are going to be called, then a block of type MC_AxStandardBody_BkPlcMc should be used for the sake of simplicity.

FAQ #2 What data has to be created in the PLC application for the axes?

A variable of each of the types ST_TcHydAxParam, ST_TcHydAxRtData and Axis_Ref_BkPlcMc must be created for each axis. Other variables of types ST_TcPlcMcEncoderIn, ST_TcPlcMcEncoderOut, ST_TcPlcMcDriveIn and ST_TcPlcMcDriveOut must be created as required. The use of variable fields is highly recommended for multiple axes. An example for a single axis and a multiple axis project are supplied as TcPlcMcEx_1.pro and TcPlcMcEx_2.pro.

In the block FB_AxInit() a suittable procedure for a properly initialisation at the start of the PLC and the loading process of the axis parameters is described, although this is only to be understood as a well-proven example.

FAQ #3 How do I initialise the data for an axis?

A number of initialisations must be carried out when the PLC applications starts. It is helpful to do this in three stages:

  1. A number of pointers must be correctly set up to link the components of the axes together. This section is usually implemented by using a block of type MC_AxUtiCheckTypedPointers(), that will monitor the projects memory layout for changes of sizes, allocation or coded interface types caused by online change. The block is triggering a parameter reload in these cases.
  2. The parameters for the axis must be appropriately set. Although it would be technically possible for the application to do have these assignments hard-coded, this is not usually helpful. It is better for the settings to be stored in files that are loaded under the control of the application when the system starts. Notes on setting up an axis can be found under Setup.
  3. The task cycle time has to be copied to the axis parameters. This should be done at the end of the parameter loading procedure. At about line 38 of the FB_AxInit() block you will find a line like <stAxParam[].fCycletime:=DINT_TO_LREAL(SystemTaskInfoArr[1].cycleTime)/10000000.0;> Here the array index of SystemTaskInfoArr[] has to be adjusted to the task index of your project. Is the first task adressed by port number 801 calling the library blocks the index 1 is to be used. In case of the second task adressed by port 811 ist should be index 2, for the third task with adress 821 it is index 3 and for the fourth task with adress 831 index 4 is to be used. Naturally a hard coded constant like 0.002 for 2 milliseconds can be used as well.

Warning: If a block of type MC_AxAdsCommServer is used in the application, the block must be called in the same task that carries out the pointer assignments. If this is not possible, or for some reason difficult, then calling the block must be prevented while the assignments are being carried out. The result, otherwise, can be that the PLC application crashes as a result of serious runtime errors (Page Fault Exception).

The sample projects TcPlcMcEx_1.pro and TcPlcMcEx_2.pro provide the source code for FB_AxInit() blocks that carries out the steps described for single and multiple axis projects. To use it, an instance of this FB must be created for each axis and called cyclically in the application. This is demonsttaited in the Main() blocks of the sample projects. The initialisation has completed when the nInitState variable of the Axis_Ref_BkPlcMc for the axis adopts either the value 2 or -2; in the first case it has been successful, in the second there have been errors. If initialisation is successful, bParamsEnable in Axis_Ref_BkPlcMc becomes TRUE, but otherwise this variable remains FALSE.

The procedure illustrated here is not strictly specified, but can be understood as a well-proven example.

Note: The block provided here specifies the names of the axis and of the associated parameter file (including the path). It is essential that these specifications are modified to match the particular application.

FAQ #4: How is the actual position of the axes determined ?

A range of signal transducers may be considered for use as position sensors, operating according to a variety of physical principles to generate a position-dependent electrical magnitude. This magnitude determines the type of I/O components that must be used. The variables of types ST_TcPlcMcEncoderIn and ST_TcPlcMcEncoderOut must be created for each axis, and contain elements that are to be linked to the actual value, counter, latch, control and status variables associated with the I/O hardware.

Here are a few examples:

Signal | I/O components | Encoder type | PLC variable | I/O variable
0V .. 10V | KL3061 KL3062 KL3064 | iTcMc_EncoderKL3042 | StAxEncInput.uiCount | Data in
-10V .. 10V | KL3001 KL3002 | iTcMc_EncoderKL3002 | StAxEncInput.uiCount | Data in
-10V .. 10V | M2510 | iTcMc_EncoderM2510 | StAxEncInput.uiCount | Data in
0mA .. 20mA | KL3011 KL3012 KL3041 KL3042 KL3044 | iTcMc_EncoderKL3042 | StAxEncInput.uiCount | Data in
4mA .. 20mA | KL3021 KL3022 KL3051 KL3052 KL3054 | iTcMc_EncoderKL3042 | StAxEncInput.uiCount | Data in
2 Bit | KL10xx KL11xx KL12xx KL13xx KL14xx KL17xx | iTcMc_EncoderDigIncrement | StAxEncInput.bDigInA StAxEncInput.bDigInB | Input
SSI | KL5001 | iTcMc_EncoderKL5001 | StAxEncInput.uiPZDL_RegDaten StAxEncInput.uiPZDH StAxEncInput.usiRegStatus | PZDL_RegDaten PZDH RegStatus
SSI | IP5009 IE5009 | iTcMc_EncoderIx5009 | StAxEncInput.uiPZDL_RegDaten StAxEncInput.uiPZDH StAxEncInput.usiRegStatus | PZDL_RegDaten PZDH RegStatus
A/B increments, RS422="TTL" | KL5101 | iTcMc_EncoderKL5101 | StAxEncInput.uiCount StAxEncInput.uiLatch StAxEncOutput.usiCtrl StAxEncInput.usiStatus | Counter Latch Ctrl Status
A/B increments, RS422="TTL" | M3120 | iTcMc_EncoderM3120 | StAxEncInput.uiCount StAxEncOutput.usiCtrl StAxEncInput.usiStatus | Value_? Ctrl_? State_?
A/B increments, RS422="HTL" | KL5111 | iTcMc_EncoderKL5101 | StAxEncInput.uiCount StAxEncInput.uiLatch StAxEncOutput.usiCtrl StAxEncInput.usiStatus | Counter Latch/PeriodeL Ctrl Status
Pulse Train | KL2521 | iTcMc_EncoderKL2521 | StAxEncInput.uiCount | Data in
Stepper output, direct (without encoder) | KL2531 | iTcMc_EncoderKL2531 | StAxEncInput.uiCount | Data in

If one of the components mentioned here is used, then one of the encoder blocks provided will usually be applied. These blocks are located in the library's PLCopen_motioncontrol/System/Encoder sub-directory, and have names such as MC_AxRtEncoderKL5001_BkPlcMc. It is, however, better to specify the type of encoder according to the constants in E_TcMcEncoderType, to set it under nEnc_Type in ST_TcHydAxParam and to use a block of type MC_AxRtEncoder_BkPlcMc. This then automatically calls the correct type of sub-block for the type concerned. Directly calling this hardware-specific block brings only a small benefit in runtime, but makes a software modification essential when I/O components are changed.

All the encoder blocks use the parameter fEnc_IncWeighting to evaluate the increments. fEnc_ZeroShift is also used as a zero offset shift for absolute displacement sensors. Incremental sensors usually require a reference travel using a MC_Home_BkPlcMc block, during which fEnc_RefShift in ST_TcHydAxRtData is determined. This value then does the job of the zero offset shift. In special cases it is, of course, also possible to specify the zero offset shift with a MC_AxRtSetActPos_BkPlcMc block.

If, for technical reasons, it is not possible to determine the actual position using blocks from the library, this task can be carried out by application modules, and the result entered into fActPos in ST_TcHydAxRtData. For the sake of uniformity use should again be made here of the fEnc_IncWeighting and fEnc_ZeroShift or fEnc_RefShift parameters.

Note: If only the usual blocks (encoder, generator, finish, drive) for the axis are going to be called, then a block of type MC_AxStandardBody_BkPlcMc should be used for the sake of simplicity.

Note: The setup procedure for the read back of an actual pressure by use of MC_AxRtReadPressureSingle_BkPlcMc or MC_AxRtReadPressureDiff_BkPlcMc function blocks is described in the documentation of these function blocks.

FAQ #5: How is the control value for an axis created?

The PLC application must call a block of type MC_AxRuntime_BkPlcMc in every cycle for every axis. The parameter nProfileType in ST_TcHydAxParam specifies the procedure that is to be used to generate the control value. Velocity control values are calculated here according to the type, and depending on other parameters associated with the axis and on the movement data. These control values are, however, normalised to the abstract numerical range ±1.0, and have not yet been prepared for immediate output to I/O hardware.

Note: If only the usual blocks (encoder, generator, finish, drive) for the axis are going to be called, then a block of type MC_AxStandardBody_BkPlcMc should be used for the sake of simplicity.

FAQ #6: How is the control value for an axis prepared for output?

After calling the MC_AxRuntime_BkPlcMc block, a block of type MC_AxRtFinish_BkPlcMc must be called for each axis. This block assembles a number of velocity components (control value, controller output, offset compensation, overlap compensation), and also takes into account in the bends in the feed forward characteristic curve.

Numerical adjustment is usually necessary prior to output to an I/O module. A MC_AxRtDrive_BkPlcMc block is to be called for each axis for this purpose. The value of nDrive_Type in ST_TcHydAxParam selects the hardware-specific sub-block to be used.

The variables of types ST_TcPlcMcDriveIn and ST_TcPlcMcDriveOut must be created for each axis, and contain elements that are to be linked to the set value and control variables of the I/O hardware.

Note: If only the usual blocks (encoder, generator, finish, drive) for the axis are going to be called, then a block of type MC_AxStandardBody_BkPlcMc should be used for the sake of simplicity.

FAQ #7: How is the control value output to an axis?

A range of devices and equipment might be functioning as actuators, applying a variety of physical principles to create a variable velocity that depends on an electrical magnitude. This magnitude determines the type of I/O components that must be used. The variables of types ST_TcPlcMcDriveIn and ST_TcPlcMcDriveOut must be created for each axis, and contain elements that are to be linked to the variables of the I/O hardware.

Here are a few examples:

Signal | I/O components | Drive Type | Plc-Variable | E/A-Variable
-10V .. 10V | KL4031 KL4032 KL4034 | iTcMc_DriveKL4032 | StAxDriveOutput.nDacOut | Data out
-10V .. 10V | M2400 | iTcMc_DriveM2400_D1 iTcMc_DriveM2400_D2 iTcMc_DriveM2400_D3 iTcMc_DriveM2400_D4 | StAxDriveOutput.nDacOut | Data out
4 Bit | KL20xx KL21xx KL22xx KL24xx | iTcMc_DriveLowCostStepper | StAxDriveOutput.nDigOutAp StAxDriveOutput.nDigOutAn StAxDriveOutput.nDigOutBp StAxDriveOutput.nDigOutBn | Output
PWM | IP/IE2512 | iTcMc_DriveIx2512_1Coil iTcMc_DriveIx2512_2Coil | StAxDriveOutput.nDacOut | Data out
Pulse Train | KL2521 | iTcMc_DriveKL2521 | StAxDriveOutput.nDacOut | Data out
Stepper output, direct | KL2531 | iTcMc_DriveKL2531 | StAxDriveOutput.nDacOut StAxDriveOutput.bKL2531Ctrl StAxDriveOutput.bKL2531State StAxDriveOutput.bKL2531State2 | Data out Ctrl Status Status2

If one of the components mentioned here is used, then one of the drive blocks provided will usually be used. These blocks are located in the library's PLCopen_motioncontrol/System/Drive sub-directory, and have names such as MC_AxRtDriveKL40323_BkPlcMc. It is, however, better to specify the type of drive according to the constants in E_TcMcDriveType, to set it under nDrive_Type in ST_TcHydAxParam and to use a block of type MC_AxRtDrive_BkPlcMc. This then automatically calls the correct type of sub-block for the type concerned. Directly calling this hardware-specific block brings only a small benefit in runtime, but makes a software modification essential when I/O components are changed.

Note: If only the usual blocks (encoder, generator, finish, drive) for the axis are going to be called, then a block of type MC_AxStandardBody_BkPlcMc should be used for the sake of simplicity.

FAQ #8: What is the correct order to call the function blocks for an axis?

  1. Mandatory: All function blocks for reading the actual situation of the axis. This applies to block types like MC_AxRtEncoder_BkPlcMc, MC_AxRtReadPressureDiff_BkPlcMc or MC_AxRtReadPressureSingle_BkPlcMc.
  2. Common: Blocks or commands that are updating the enable signals of the axis. Usually this is a block of type MC_Power_BkPlcMc or on block of the types MC_AxRtSetControllerEnable_BkPlcMc, MC_AxRtSetFeedEnableMinus_BkPlcMc and MC_AxRtSetFeedEnablePlus_BkPlcMc. For axes using an incremental encoder that monitoring an index when homing a function call MC_AxRtSetReferencingCamSignal_BkPlcMc has to be added.
  3. Optional: Blocks and commands that are doing some decissions from actual values of the axis, I/O or application signals and then release some activity. One example is the start of an axis triggered by the rising edge of a sensor or the abortion of a move as a reaction of the rise of the actual pressure.
  4. Mandatory: Setpoint generators like function blocks of typ MC_AxRuntime_BkPlcMc.
  5. Optional: According to the requirements of the application there can be some control function blocks. These function blocks may be application specific or from the library like MC_AxCtrlVeloMoving, MC_AxCtrlPullbackOnPressure_BkPlcMc or MC_AxCtrlSlowDownOnPressure_BkPlcMc.
  6. Mandatory: A converting function block of typ MC_AxRtFinish_BkPlcMc.
  7. Mandatory: An output function block of type MC_AxRtDrive_BkPlcMc.

If required by the application the library function blocks can be replaced by application specific blocks. This can become necessary to interface a nonstandard sensor or actor or to cover the need for a special control functionality. A decicion like this has to be done conservative minded und the compatibility to the library has to be observed.

FAQ #9: How do I control the power stage (on board or external) of a valve?

In the ST_TcPlcMcDriveOut structure the elements bPowerOn and bEnable are provided for controlling the power supply and the enabling of a power stage. Both signals are set to TRUE by blocks of type MC_Power_BkPlcMc, when the input Enable is TRUE. At the same time this block will set the software enables in ST_TcHydAxRtData.nDeCtrlDWord. If this direct relationship is not matching the application it can be released by omitting the MC_Power_BkPlcMc block. In this case the signals in the ST_TcPlcMcDriveOut structure have to be controlled directly by the application. The software enables have to be defined by MC_AxRtSetControllerEnable_BkPlcMc, MC_AxRtSetFeedEnableMinus_BkPlcMc and MC_AxRtSetFeedEnablePlus_BkPlcMc.

In the ST_TcPlcMcDriveIn structure the elements bPowerOk, bEnAck and bReady are provided for monitoring the power supply, the enable loop back and the status of the power stage. The signals supplied by different hardware products of different makers are varying. At this time only the bPowerOk signal is used for defining the Status output of the MC_Power_BkPlcMc block.

FAQ #10: How do I create a message logger functionality?

A direct message output from a library block would be causing unpredictable run time behaviour. To avoid this the massages are stored in a buffer und forwarded to the Windows event logger sequentially if needed.

To create a message buffer instantiate a variable of type ST_TcPlcMcLogBuffer. This buffer is taking the messages of all axes. It is important that independend of the number of axes there is only one such variable in a project. The address of this same buffer is supplied to the MC_AxUtiCheckTypedPointers blocks of all axes allong with the individuell axis components. These blocks are usualoly called in the initialisating phase of the project. In the Axis_Ref_BkPlcMc structure the pointer is held in the pStAxLogBuffer element and safeguarded by the block.

In nLogLevel in Axis_Ref_BkPlcMc it is defined from wich level of importance a message is entered to the buffer. The coded values to be used here are defined in the Global Variables of the library. It has to be kept in mind that this setting is per axis.

The blocks of the library are detecting the before mentioned preparations and will start the generation of messages automatically. At this point the buffer would be filled and then any further messages would be lost. To prevent this ther are two solutions.

FAQ #10.1: Forwarding messages to the Windows event logger

To forward messages from the buffer to the Windows event logger a block of type MC_AxRtLoggerSpool_BkPlcMc has to be called cyclically. Each call will forward one message and remove it from the buffer.

Hint: Even on computers running under Windows CE an event logger functionallity can be created. Here the service can be emulated by the TwinCAT System Service. To keep the small message storing capacity of the typically used flash disc devices from overrunning be sure to log errors only.

FAQ #10.2: Clearing the oldest message

To clear and remove the oldest message a block of type MC_AxRtLoggerDespool_BkPlcMc can be called cyclically. On each call this block removes the oldest message as long there is less than a specified number of spare free messages. The removed messages are lost.

FAQ #10.3: Creating logger messages from the application

t.b.d.

FAQ #11: How do I abort the monitoring of a function?

Some blocks from the library are starting a process that does not need a cyclic call of the block after a successfull start. According to the rules of PLCopen definitions the block is still to be called because it is monitoring the progress of the activity to update the status signals at the output part of the block. This monitoring function is signaled at the output Busy.

Stopping the cyclic call of a block while it is monitoring the activitie it startet usually will cause trouble. The block may be unable to detect the edges on its triggering inputs properly or may report the abortion of a command because it still tries to monitor the last command it has been starting.

To abort the monitoring of a command take the following steps:

  • Call the command block with all parameters it needs. The triggering signal has to be TRUE now to create a rising edge.
  • Check the outputs of the command block to be sure the block accepted the command and is monitoring the activity.
    • In case of an error:
      • Call the command block with a FALSE at the triggering input.
      • Do what ever is needed to come up with the situation.
    • In case of a successfull start:
      • Call a block of type MC_AxUtiCancelMonitoring_BkPlcMc with Execute:=TRUE.
      • Call the block with Execute:=FALSE.
      • First call of the command block with FALSE at the triggering input. Now the block is signaling CommandAborted.
      • Second call of the command block with FALSE at the triggering input. Now the block is in its idle state and all outputs are cleared.

The described sequence will mimic the take over of control by some other function and will bring the signal exchange with the block to its final state.

By now the abortion of monitoring is supported by blocks of type MC_MoveAbsolute_BkPlcMc and MC_MoveVelocity_BkPlcMc only.

FAQ #12: How do I monitor the communication to an I/O device?

In ST_TcPlcMcDriveIn variables as well as in ST_TcPlcMcAx2000In variables an element named uiBoxState is allocated. If the applied bus coupler or the interface card of the servo amplifier supplies a matching variable and the fieldbus in use is signaling an untroubled communication by the value 0 a connection should be established. This can be done for the Beckhoff Lightbus and for Realtime Ethernet and EtherCAT.

If a MC_Power_BkPlcMc block is used for the axis it will monitor uiBoxState and report communication problems. In this case the axis will be placed in an error state.


TcPlcHydraulics: Knowledge Base: Global Constants

Knowledge Base of the TcPlcHydraulics PLC library: Global Constants

Bit-masks for position cams

These masks are to be used by the application to provide digital movement cams for bActPosCams in ST_TcHydAxRtData.

Constant | Description
bTcHydActPosCamPos | Summary of bTcHydActPosCamHigh and bTcHydActPosCamUp.
bTcHydActPosCamHigh | The axis has reached the upper target position.
bTcHydActPosCamUp | The axis is located close to the upper target position.
bTcHydActPosCamDown | The axis is located close to the lower target position.
bTcHydActPosCamLow | The axis has reached the lower target position.
bTcHydActPosCamNeg | Summary of bTcHydActPosCamLow and bTcHydActPosCamDown.

Bit-masks for axis status information

These masks are to be used by the application to interrogate status signals in nStateDWord in ST_TcHydAxRtData.

Constant | Description
dwTcHydNsDwFunctional | Axis is ready for operation.
dwTcHydNsDwReferenced | Axis has been referenced.
dwTcHydNsDwSteady | Axis is not active.
dwTcHydNsDwInTargRng | The axis is located within a distance from the target position specified by fMonPositionRange in ST_TcHydAxParam.
dwTcHydNsDwInTarget | The axis has been located without interruption since a time specified by fMonTargetFilter within a distance from the target position specified by fMonTargetRange in ST_TcHydAxParam.
dwTcHydNsDwStopped | The last movement of the axis was stopped without reaching the specified target position.
dwTcHydNsDwBusy | The axis is active.
dwTcHydNsDwMoveUp | The axis is moving in the direction of increasing positions.
dwTcHydNsDwMoveDown | The axis is moving in the direction of decreasing positions.
dwTcHydNsDwConstVelo | The axis is moving with constant velocity.
dwTcHydNsDwErrState | The axis is in an error state.

Bit-masks for axis enable information

These masks are to be used by the application to provide enable signals in nDeCtrlDWord in ST_TcHydAxRtData.

Constant | Description
dwTcHydDcDwCtrlEnable | Controller enable. This enable is a precondition for the output of control value and controller outputs.
dwTcHydDcDwFdPosEna | Advance movement enable in positive direction. This enable is a precondition for the output of control value and controller outputs in the direction of increasing values of position.
dwTcHydDcDwCtrlPosEna | Combination of dwTcHydDcDwCtrlEnable and dwTcHydDcDwFdPosEna.
dwTcHydDcDwFdNegEna | Advance movement enable in negative direction. This enable is a precondition for the output of control value and controller outputs in the direction of decreasing values of position.
dwTcHydDcDwCtrlNegEna | Combination of dwTcHydDcDwCtrlEnable and dwTcHydDcDwFdNegEna.
dwTcHydDcDwRefIndex | Referencing cam.

Error Codes

These constants are to be used for the outputs of ErrorID from blocks and for nErrorCode in ST_TcHydAxRtData.

Constant | Hexadecimal | Decimal | Description
dwTcHydAdsErrNoError | 0 | 0 | No error.
dwTcHydAdsErrInvalidIdxGroup | 16#702 | 1794 | Invalid IndexGroup.
dwTcHydAdsErrInvalidIdxOffset | 16#703 | 1795 | Invalid IndexOffset.
dwTcHydAdsErrRdWrNotPermitted | 16#704 | 1796 | Access (write, read) not permitted.
dwTcHydAdsErrInvalidSize | 16#705 | 1797 | Size (number of bytes) not permitted.
dwTcHydAdsErrIllegalValue | 16#706 | 1798 | Value not permitted.
dwTcHydAdsErrNotReady | 16#707 | 1799 | Not ready for operation.
dwTcHydAdsErrBusy | 16#708 | 1800 | Already active.
dwTcHydErrCdNotCompatible | 16#4040 | 16448 | The axis is not compatible with the requested function.
dwTcHydErrCdNotSupport | 16#4107 | 16647 | Function or command not supported.
dwTcHydErrCdCycleTime | 16#4205 | 16901 | Cycle time (fCycletime in ST_TcHydAxParam) not permitted.
dwTcHydErrCdMissingEnc | 16#4210 | 16912 | There is no connection to an encoder interface (pStAxEncInput and/or pStAxEncOutput in Axis_Ref_BkPlcMc).
dwTcHydErrCdMissingDrive | 16#4212 | 16914 | There is no connection to a drive interface (pStAxDriveOutput and/or pStAxDriveInput or pStAxAx2000Out and/or pStAxAx2000In in Axis_Ref_BkPlcMc).
dwTcHydErrCdIllegalGearFactor | 16#421B | 16923 | The parameters of a gear function are invalid.
dwTcHydErrCdSoftEnd | 16#4222 | 16930 | The target position is located on the far side of an active software limit switch, and is therefore not permitted.
dwTcHydErrCdLowDist | 16#4228 | 16936 | The travel distance is unacceptably small.
dwTcHydErrCdAcc | 16#4309 | 17161 | The acceleration is not acceptable.
dwTcHydErrCdDec | 16#430A | 17162 | The deceleration is not acceptable.
dwTcHydErrCdPtrPlcMc | 16#4345 | 17221 | There is no connection to one of the required axis interfaces (pStAxParams, pStAxRtData in Axis_Ref_BkPlcMc).
dwTcHydErrCdPtrMcPlc | 16#4346 | 17222 | There is no connection to one of the required axis interfaces (pStAxParams, pStAxRtData in Axis_Ref_BkPlcMc).
dwTcHydErrCdCtrlEna | 16#4356 | 17238 | Movement without controller enable is not permitted.
dwTcHydErrCdNegFdEna | 16#4357 | 17239 | Movement in the direction of reducing positions without the negative direction advance enable is not permitted.
dwTcHydErrCdPosFdEna | 16#4358 | 17240 | Movement in the direction of increasing positions without positive direction advance enable is not permitted.
dwTcHydErrCdSetVelo | 16#4359 | 17241 | The required velocity is not acceptable.
dwTcHydErrCdNotMoving | 16#435D | 17245 | The axis is not moving, or not in the correct direction.
dwTcHydErrCdConsequential | 16#43A0 | 17312 | Consequential error. The axis is in an error state, because an axis it depends on is in an error state.
dwTcHydErrCdEncType | 16#4401 | 17409 | The parameter type is invalid.
dwTcHydErrCdEncScaling | 16#4406 | 17414 | The increment scaling is not permitted.
dwTcHydErrCdEncSyncDist | 16#4414 | 17428 | The distance between Latch_Enable and the sync pulse is too small.
dwTcHydErrCdEncSetActPos | 16#4422 | 17442 | An error was detected during a actual position seting operation.
dwTcHydErrCdPtrPlcEncIn | 16#4442 | 17474 | The axis does not have a pointer to an encoder input interface.
dwTcHydErrCdPtrPlcEncOut | 16#4443 | 17475 | The axis does not have a pointer to an encoder output interface.
dwTcHydErrCdSsi | 16#4470 | 17520 | An error was detected when operating an SSI encoder.
dwTcHydErrCdDriveType | 16#4601 | 17921 | The value set in nDrive_Type is not permitted.
dwTcHydErrCdRefVelo | 16#4605 | 17925 | Reference velocity (fRefVelo in ST_TcHydAxParam) is invalid.
dwTcHydErrCdPtrPlcDriveIn | 16#4642 | 17986 | The axis does not have a pointer to a drive input interface.
dwTcHydErrCdPtrPlcDriveOut | 16#4643 | 17987 | The axis does not have a pointer to a drive output interface.
dwTcHydErrCdDriveNotReady | 16#4650 | 18000 | Power section not ready for operation
dwTcHydErrCdNotStartable | 16#4B01 | 19201 | Axis in a state that does not allow it to start.
dwTcHydErrCdNotReady | 16#4B09 | 19209 | The axis is not in an operable state.
dwTcHydErrCdHomingType | 16#4F00 | 20224 | Referencing method (nEnc_HomingType in ST_TcHydAxParam) is not permitted.
dwTcHydErrCdEncCutOff | 16#4F01 | 20225 | The limit frequency for the actual value acquisition has been exceeded.

Device specific error codes reported by MC_Power_BkPlcMc blocks

Values from this table may show up at ErrorID of MC_Power_BkPlcMc blocks, if there is a problem reported by the external device.

Konstante | Hexadezimal | Dezimal | Beschreibung
dwTcHydErrCdAX2000MainPwrTmOut | 1 | 16#0001 | For AX2000 only:
dwTcHydErrCdAX2000MainPwrFault | 2 | 16#0002 | For AX2000 only:
dwTcHydErrCdAX2000PwrStageTmOut | 3 | 16#0003 | For AX2000 only:
dwTcHydErrCdAX2000PwrStageFault | 4 | 16#0004 | For AX2000 only:
dwTcHydErrCdAX2000ReportsError | 5 | 16#0005 | For AX2000 only:
dwTcHydErrCdAX2000ErrorI2T | 6 | 16#0006 | For AX2000 only:
dwTcHydErrCdAX2000ErrorChopper | 7 | 16#0007 | For AX2000 only:
dwTcHydErrCdAX2000ErrorWatchDog | 8 | 16#0008 | For AX2000 only:
dwTcHydErrCdAX2000ErrorPwrLine | 9 | 16#0009 | For AX2000 only:
dwTcHydErrCdAX2000ConnectionLost | 10 | 16#000A | For AX2000 only:
dwTcHydErrCdAX2000ConnectionTmOut | 11 | 16#000B | For AX2000 only:
dwTcHydErrCdKL2531OverTemp | 1 | 16#0001 | For KL2531/KL2541 only:
dwTcHydErrCdKL2531UnderVoltage | 2 | 16#0002 | For KL2531/KL2541 only:
dwTcHydErrCdKL2531OverCurrentHigh | 3 | 16#0003 | For KL2531/KL2541 only:
dwTcHydErrCdKL2531OpenLoadA | 4 | 16#0004 | For KL2531/KL2541 only:
dwTcHydErrCdKL2531OpenLoadB | 5 | 16#0005 | For KL2531/KL2541 only:
dwTcHydErrCdKL2531OverCurrentA | 6 | 16#0006 | For KL2531/KL2541 only:
dwTcHydErrCdKL2531OverCurrentB | 7 | 16#0007 | For KL2531/KL2541 only:
dwTcHydErrCdKL2531NotReady | 8 | 16#0008 | For KL2531/KL2541 only:
dwTcHydErrCdKL2531ConnectionLost | 10 | 16#000A | For KL2531/KL2541 only:
dwTcHydErrCdKL2531ConnectionTmOut | 11 | 16#000B | For KL2531/KL2541 only:

ADS Codes

These constants are accepted by the MC_AxAdsReadDecoder and MC_AxAdsWriteDecoder blocks.

IndexGroup | IndexOffset | Type | R/W | Description
16#4000 + axis index | 2 | STRING() | R | Axis name in text form.
 | 4 | UDINT | R | Cycle time in microseconds.
 | 16#10003 | UDINT | R | Encoder type: nEnc_Type from ST_TcHydAxParam.
 | 16#10006 | LREAL | R | Incremental evaluation: fEnc_IncWeighting from ST_TcHydAxParam.
 | 16#30003 | UDINT | R | Drive type: nDrive_Type from ST_TcHydAxParam.
16#4100 + axis index | 1 | UDINT | R | Error code: nErrorCode from ST_TcHydAxRtData.
 | 16#10002 | LREAL | R | Actual position: fActPos from ST_TcHydAxRtData.
 | 16#10005 | LREAL | R | Actual velocity: fActVelo from ST_TcHydAxRtData.
16#4200 + axis index | 1 | - | W | Execute axis reset.
 | 16#10 | - | W | Start reference travel.
 | 16#21 | Structure | W | Start axis movement.
 | 16#FFFF0001 | - | W | Save parameters.
 | 16#FFFF0002 | - | W | Load parameters.
16#4300 + axis index | 16#81 | UDINT | R | Status double word: nStateDWord from ST_TcHydAxRtData.
 | 16#B1 | UDINT | R | Error code: nErrorCode from ST_TcHydAxRtData.
16#F000 + axis index | 1 | Structure | R | The ST_TcHydAxRtData variable for the axis.
 | 2 | Structure | R/W | The ST_TcHydAxParam variable for the axis.
16#FFFFFFFF | 0 | String() | R | Identification of the server.
 | 1 | UINT | R | Major version of the library.
 | 2 | UINT | R | Minor version of the library.
 | 3 | UINT | R | Release of the library.
 | 4 | UINT | R | Number of axes supported.

Array Dimensions

The constants below are used to define array dimensions and may be used by the application.

Constant | Description
ciBkPlcMc_CamSwitchRef_MinIdx | Lower boundary index on an array[] of MC_CAMSWITCH_REF_BkPlcMc, supplied to blocks of type MC_DigitalCamSwitch_BkPlcMc
ciBkPlcMc_CamSwitchRef_MaxIdx | Upper boundary index on an array[] of MC_CAMSWITCH_REF_BkPlcMc, supplied to blocks of type MC_DigitalCamSwitch_BkPlcMc
ciBkPlcMc_TrackRef_MinIdx | Lower boundary index on an array[] of MC_TRACK_REF_BkPlcMc, supplied to blocks of type MC_DigitalCamSwitch_BkPlcMc
ciBkPlcMc_TrackRef_MaxIdx | Upper boundary index on an array[] of MC_TRACK_REF_BkPlcMc, supplied to blocks of type MC_DigitalCamSwitch_BkPlcMc

Logger Levels

The constants below are used to define the threshold for the librarys logging functionallity.

Constant | Description
dwTcHydLogLevel_None | No recording
dwTcHydLogLevel_Errors | Error messages only
dwTcHydLogLevel_Warnings | Error messages and warnings
dwTcHydLogLevel_Actions | Error messages, warnings and activities

Logger Sources

The constants below are used to define the source of a message that is recorded by the librarys logging functionallity.

Konstante | Beschreibung
dwTcHydLogSource_Library | A block from the library
dwTcHydLogSource_Application | A block from the application


TcPlcHydraulics: Knowledge Base: Sample Programms

Knowledge Base of the TcHydlib PLC library: Sample Programms

Attention: On opening the PLC project there may be showing up a message box, reporting that there some libraries missing. The box is providing means to adjust the access path to the libraries. Only if the libraries are present on the computer in use this support should be accepted. Otherwise reject the offer and use the project for study. In this case compiling and running the project will not work.

Hint: If the library is present on the computer in use there is the chance to save the samples as a ZIP file and unpack them. The contained PRO file can be opened by using PlcControl. Usually the path to the library has to be adjusted. In the block FB_AxInit at about the line 15 the command < stemp:=CONCAT('C:\TwinCAT\PLC\',stAxItf.sAxisName); > is to be updated according the file system of the computer. The files of extension DAT have to be placed as devised this way. At about line 38 you will find a line like < stAxParam.fCycletime:=DINT_TO_LREAL(SystemTaskInfoArr[1].cycleTime)/10000000.0; >, that is performing an automatic update of the cycle time in the axis parameters to adapt them according the task setup of your PLC. If the library blocks are not called from task 1 the array index has to be adjusted. Now the project should be compiled and started successfully. There is a scope setup provided as SCP file that will sample the most importand information.

PLC project | Project (ZIP) | Description
TcPlcMcEx_1.pro | TcPlcMcEx_1.zip | Demonstration of the blocks MC_AxUtiStandardInit_BkPlcMc, MC_Power_BkPlcMc, MC_AxStandardBody_BkPlcMc and MC_AxAdsCommServer_BkPlcMc. One axis. Operated by use of PlcControl and PlcMcManager.
TcPlcMcEx_2.pro | TcPlcMcEx_2.zip | Demonstration of arrays in projects containing multiples of axes. Five axes. Operated by use of PlcControl and PlcMcManager.
TcPlcMcEx_3.pro | TcPlcMcEx_3.zip | Demonstration of the blocks MC_AxRtEncoder_BkPlcMc, MC_AxRuntime_BkPlcMc, MC_AxCtrlSlowDownOnPressure_BkPlcMc (automatic changeover pressure controller), MC_AxRtFinish_BkPlcMc and MC_AxRtDrive_BkPlcMc. Demonstration of the utilisation of fCustomerData for project parameters. One axis. Operated by use of PlcControl and PlcMcManager.
TcPlcMcEx_4.pro | TcPlcMcEx_4.zip | Demonstration of the blocks BkPlcMc_TC_1000. The working cycle ist triggered by setting the global variables bTriggerDown and bTriggerUp by using PlcControl. One axis. Operated by use of PlcControl and PlcMcManager.
TcPlcMcEx_5.pro | TcPlcMcEx_5.zip | Demonstration of the blocks MC_MoveAbsolute_BkPlcMc, MC_MoveVelocity_BkPlcMc, MC_MoveRelative_BkPlcMc and MC_Stop_BkPlcMc. The working cycle ist triggered by setting the global variable bStart by using PlcControl. One axis. Operated by use of PlcControl and PlcMcManager.
TcPlcMcEx_6.pro | TcPlcMcEx_6.zip | Demonstration of the block MC_AxRunTimeTimeRamp_BkPlcMc. One axis. Operated by use of PlcControl and PlcMcManager.
TcPlcMcEx_7.pro | TcPlcMcEx_7.zip | Demonstration of the blocks MC_SetOverride_BkPlcMc. The signal form, cycle time and the limits of a signal generator are controlled by global variables (bOverrideSinusoidal, fOverrideCycleTime, fOverrideMinValue, fOverrideMaxValue) to define a variable override. One axis. Operated by use of PlcControl and PlcMcManager.
TcPlcMcEx_100.pro | TcPlcMcEx_100.zip | Demonstration of the blocks MC_GearIn_BkPlcMc and MC_GearOut_BkPlcMc. Five axes. Axis 5 is a virtuel axis (center point of axis 1 and 2), axes 1 and 2 are coupled and decoupled by gearing functions. Operated by use of PlcControl and PlcMcManager.
TcPlcMcEx_101.pro | TcPlcMcEx_101.zip | Demonstration of the blocks MC_CamTableSelect_BkPlcMc, MC_CamIn_BkPlcMc and MC_CamOut_BkPlcMc. Five axes. Axis 5 is a virtuel axis (center point of axis 1 and 2), axes 1 and 2 are coupled and decoupled by camming tables. Operated by use of PlcControl and PlcMcManager.
TcPlcMcEx_102.pro | TcPlcMcEx_102.zip | Demonstration of the blocks BkPlcMc_TC_1001 and MC_MoveAbsolute_BkPlcMc. The working cycle ist triggered by setting the global variable bStart by using PlcControl. One axis. Operated by use of PlcControl and PlcMcManager.


TcPlcHydraulics: PLCopen Motion Control: System: MC_AxRtEncoderKL2531_BkPlcMc

FUNCTION_BLOCK MC_AxRtEncoderKL2531_BkPlcMc

(internal use only) The function block performs determination of the actual position of the axis from the output pulses acquired from a KL2531 direct stepper output terminal. It is called by blocks of the MC_AxRtEncoder_BkPlcMc type if the value iTcMc_EncoderKL2531 is set as the nEnc_Type in Axis.pStAxParam.

Note: The hydraulic library only offers a restricted range of functions, even in connection with electrical drives. TwinCAT NC PTP, NC I and CNC offer a significantly broader spectrum and more comprehensive support for commissioning and diagnosis.

VAR_OUTPUT
    Error:		BOOL;
    ErrorID:		UDINT;
END_VAR
VAR_INOUT
    Axis:		Axis_Ref_BkPlcMc;
END_VAR

Error: The occurrence of an error is indicated here.

ErrorID : An encoded indication of the cause of the error is provided here.

Axis : The address of a variable of type Axis_Ref_BkPlcMc is to be passed here.

Behaviour of the block:

The block investigates the axis interface that has been passed to it every time it is called. A number of problems can be detected and reported during this process:

  • If the pointer pStAxRtData in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. In this case, the axis cannot be placed into a fault state.
  • If the pointer pStAxEncInput in ST_TcMc Axis_Ref_BkPlcMc AxInterface is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncIn. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxEncOuput in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrPlcEncOut. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If the pointer pStAxParams in Axis_Ref_BkPlcMc is not initialised, the block reacts with a Error and ErrorID:=dwTcHydErrCdPtrMcPlc. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData.
  • If bEncDoLatch in Axis.ST_TcHydAxRtData becomes valid, the block reacts with Error and ErrorID:=dwTcHydErrCdHomingType. The axis is placed into an error state through this value in the nErrorCode in ST_TcHydAxRtData. This situation occurs if the value iTcMc_HomingOnSync is entered as the nEnc_HomingType in Axis.ST_TcHydAxParam.

If it is possible to carry out these checks without encountering any problems, the actual value of the axis is determined by evaluating the variables in Axis.pStAxEncInput. fEnc_IncWeighting and fEnc_ZeroShift from Axis.pStAxParam are used to convert to the displacement units appropriate to the axis.

Note: This block supports the iTcMc_HomingOnBlock and iTcMc_HomingOnIndex referencing methods, but not, however, iTcMc_HomingOnSync.