Вы находитесь на странице: 1из 17

The Festo_CPX.

lib library
Table of Contents
1  The Festo_CPX.lib library .................................................................................................................. 1 
1.1  Overview ...................................................................................................................................... 1 
1.1.1  Architecture .................................................................................................................... 1 
1.1.2  Diagnosis ....................................................................................................................... 1 
1.1.3  CPX error handling ........................................................................................................ 1 
1.1.4  CPX system functions .................................................................................................... 1 
1.1.5  CPX auxiliary functions .................................................................................................. 1 
1.1.6  Designated use .............................................................................................................. 2 
1.1.7  Target group ................................................................................................................... 2 
1.1.8  Service ........................................................................................................................... 2 
1.2  Safety instructions ........................................................................................................................ 3 
1.3  Function blocks for diagnosis ....................................................................................................... 4 
1.3.1  Inputs and outputs of the function blocks ....................................................................... 4 
1.3.2  Handling function blocks ................................................................................................ 5 
1.4  Function blocks for system functions ......................................................................................... 10 
1.4.1  Inputs and outputs of the system function blocks ......................................................... 10 
1.4.2  Example for parameterising a CPX module ................................................................. 12 
1.5  Function blocks for error handling .............................................................................................. 13 

2  Index .................................................................................................................................................. 15 

ii
1 The Festo_CPX.lib library
1.1 Overview
Festo_CPX.lib is an internal library for CoDeSys 2.3. This library supports the specific functionality of the
CPX valve terminal such as parameterisation and diagnosis.

1.1.1 Architecture
The Festo_CPX.lib library is implemented entirely in IEC code. Functions that require implementation in
the real-time system are implemented in the Festo_CPX_extern.lib library.
This library is loaded automatically when the Festo_CPX.lib is appended. The library is hidden and
therefore does not appear in the library manager.
The library also uses the system library SysLibPLCConfig.lib.
For new projects, integrate Festo_CPX.lib using the CoDeSys function [Library manager]
[Additional libraries].

1.1.2 Diagnosis
Modules for modelling general CPX functions are stored in the 'Diagnostics' folder. The diagnosis includes
real-time diagnosis and reading out the error memory. All diagnostic information corresponds to the CPX
diagnostic information described in chapter B.2.1 of the CPX system manual.
Function block Description Comment

CPX_DiagnosticsUpdate Initiates the process for reading


out all diagnostic information.
CPX_GetFaultString Translates error numbers into
text.

1.1.3 CPX error handling


Modules for supporting CPX-specific error handling are stored in the 'Errorhandling' folder.
Function block Description Comment

CPX_ClearErrorLED Resets the CPX error LED

1.1.4 CPX system functions


Modules for modelling general CPX functions are stored in the 'SystemFunctions' folder. Note that CPX
system functions can become blocked for an indefinite period.
Bear this in mind, in particular when configuring the watchdog.
Function block Description Comment

CPX_CICommand Initiates the process for reading Used as an auxiliary function, no


out all diagnostic information. description.
CPX_GetParameter For reading out CPX parameters
CPX_SetParameter For writing CPX parameters

1.1.5 CPX auxiliary functions


Other modules for modelling special CPX functions are stored in the 'VariableServer' folder. Note that
these functions are only used internally and are therefore not described in further detail in this
documentation.

1
The Festo_CPX.lib library

1.1.6 Designated use


The function blocks (FB) described are designed for controlling and parameterising the associated device.
You can use the modules to conveniently integrate the many functions of the relevant device into your
program.
Read the "Safety instructions" and instructions on the designated use of the relevant devices, components
and modules. If additional commercially available components such as sensors and actuators are
connected, the specified limits for pressures, temperatures, electrical data, torques, etc. must not be
exceeded.

1.1.7 Target group


This manual is intended exclusively for technicians trained in control and automation technology, who have
experience in installing, commissioning, programming and diagnosing.

1.1.8 Service
Please consult your local Festo repair service or write to the following e-mail address if you have any
technical problems:
o service_international@festo.com

Version 2.3, 03.08.2009, en 0907NH

2
The Festo_CPX.lib library

1.2 Safety instructions


When commissioning and programming CPX systems, you must observe the safety regulations in the
manuals and operating instructions for the components used.
The user must make sure that there is nobody within the positioning range of the connected actuators or
axis systems. Access to the possible danger area must be prevented by suitable measures such as
barriers and warning signs.

Warning
Axes can move with high force and at high speed. Collisions can lead to serious injury to people
and damage to components.
• Make sure that nobody can place their hand in the positioning range of the axes or other
connected actuators and that there are no objects in the positioning path while the
system is still connected to a power supply.

3
The Festo_CPX.lib library

1.3 Function blocks for diagnosis


Function block Description Comment

CPX_DiagnosticsUpdate Initiates the process for reading


out all diagnostic information.
CPX_GetFaultString Translates error numbers into
text.

1.3.1 Inputs and outputs of the function blocks


The following tables contain descriptions of the inputs and outputs of the diagnostic modules.
Key:
o Input/output: Designation of an input or output from the CoDeSys function block/program
o Type: Data type expected by the relevant input or issued at an output.
o Description: Name and brief description of the CoDeSys function block (0 = FALSE, 1 = TRUE).

CPX_DIAGNOSTICSUPDATE

Input Type Description

Language String Language defined for error texts:


'DE' - German
'EN' - English (default)

CPX_GETFAULTSTRING

Input Type Description

Faultnumber Integer CPX error numbers


Language String Language defined for error texts:
'DE' - German
'EN' - English (default)

Output/ Type Description


(return value of function)

CPX_GetFaultString String CPX error texts

4
The Festo_CPX.lib library

1.3.2 Handling function blocks


Starting the program CPX_DiagnosticsUpdate(STRING language) initiates the process for reading out all
diagnostic information, after which the diagnostic information can be accessed. This information is
appended to the library in the form of global variables.
Start the program CPX_DiagnosticsUpdate(STRING language) to access the diagnostic
information.

Fig.: Global Variables CPX_Diagnostics

The real-time diagnosis includes:


o System diagnosis
o Module diagnosis
o Channel diagnosis

5
The Festo_CPX.lib library

System diagnosis
The system diagnosis is modelled in an instance of the structure CPX_SystemDiagnosticsStruct, which
contains the following structure variables:

Fig.: CPX system diagnosis program

Variable Type Description/note

sourceOfFault STRING Possible values: 'Valve', 'Output', 'Input',


'Analogue/Function module', ' '(module type cannot be
uniquely assigned).
typeOfFault STRING Possible values: 'Undervoltage', 'Short circuit/Overload',
'Wire break', 'Other error', ' '(error type cannot be uniquely
assigned).
firstFaultyModule INT Number of the first module that reports an error. '1' is the
first module apart from the CPX-CEC.
stateOfDiagnostics BOOL TRUE indicates that diagnostic information is available.
This variable can be evaluated in order to branch to an
error handling routine.
faultNumber INT See the CPX system manual 5.1.1 for information on
error numbers. Can be translated into text using the
CPX_GetFaultString function.

6
The Festo_CPX.lib library

Module and channel diagnosis


The module diagnosis is modelled using an array of instances of the structure
CPX_ModuleDiagnosticsStruct. In accordance with the maximum number of components permitted in the
CPX system, this array saves 48 elements starting with 1. Each element contains the following structure
variables:

Fig.: CPX module and channel diagnosis program

Variable Type Description/note

FirstFaultyChannel BYTE Number of the first faulty channel Numbers are


consecutive and start with 0. Input and output channels
are counted separately.
KindOfFault STRING Possible values: ”Output error”, ”Module error”, ”Input
error”, ”Unknown error”.
FaultNumber BYTE See the CPX system description/chapter 5 for information
on error numbers. Can be translated into text using the
CPX_GetFaultString function.
ChannelDiagnostics ARRAY [1..64] This array contains the channel diagnosis and lists the
OF BYTE input channels followed by the output channels. The error
number is specified for each channel.

7
The Festo_CPX.lib library

Error memory
The error memory is modelled with three elements.
The first element 'CPX_TraceMemoryParameter' is a type CPX_TraceMemoryParameterStruct element.
The structure contains the parameters of the diagnostic memory set in the system configuration. The
individual parameters are documented in the CPX system description in chapter B.2.4. The parameters
cannot be modified.

Fig.: CPX trace memory parameters

The second element 'CPX_TraceMemoryData' is a type CPX_traceMemoryDataStruct element. This


structure describes the current status of the diagnostic memory. The individual elements are documented
in the CPX system description in chapter B.2.5.

Fig.: CPX trace memory data

8
The Festo_CPX.lib library

The third element is an array of instances of the structure CPX_TraceMemoryItemStruct. In accordance


with the maximum number of error entries permitted in the CPX system, this array saves 40 elements
starting with 1.

Fig.: CPX trace memory item

Each element contains the following structure variables:

Variable Type Description/note

DaysSincePowerOn BYTE Number of days that have passed from the time the
controller was switched on to the time the error occurred.
TimeSincePowerOn TIME The exact time from the moment the controller was
switched on to the time the error occurred (resolution 10
ms, must be added to DaysSincePowerOn).
FirstFaultAfterPowerOn BOOL Is True if this is the first error that occurred after the
controller was switched on.
ModuleCode BYTE Code of the module where the error occurred.
ModulePosition BYTE Number of the module where the error occurred. 1 is the
first module apart from the CPX-CEC.
KindOfFault STRING Possible values: ”Output error”, ”Module error”, ”Input
error”, ”Unknown error”.
FirstFaultyChannel BYTE Number of the first faulty channel. Numbers are
consecutive and start with 0. Input and output channels
are counted separately.
FaultNumber BYTE See the CPX system description/chapter 5 for information
on error numbers. Can be translated into text using the
CPX_GetFaultString function.
SeriesErrors BYTE Number of subsequent channels with the same error.

9
The Festo_CPX.lib library

1.4 Function blocks for system functions

Function block Description Comment

CPX_CICommand Initiates the process for reading Used as an auxiliary function, no


out all diagnostic information. description.
CPX_GetParameter For reading out CPX parameters
CPX_SetParameter For writing CPX parameters

1.4.1 Inputs and outputs of the system function blocks


The following tables contain descriptions of the inputs and outputs of the parameter modules.
Key:
o Input/output: Designation of an input or output from the CoDeSys function block/program
o Type: Data type expected by the relevant input or issued at an output.
o Description: Name and brief description of the CoDeSys function block (0 = FALSE, 1 = TRUE).

CPX_GETPARAMETER

Input Type Description

ModulNo Byte Number of the module where the parameter is located.


The first module apart from the CPX-CEC is allocated the
number 1.
ParameterNo Byte Number of the parameter to be accessed. Refer to the
module documentation for the relevant number.

Output/ Type Description


(return value of function)

CPX_GetParameter LWORD Parameter value in 64-bit format.

10
The Festo_CPX.lib library

CPX_SETPARAMETER

Input Type Description

ModulNo Byte Number of the module where the parameter is located.


The first module apart from the CPX-CEC is allocated the
number 1.
ParameterNo Byte Number of the parameter to be accessed. Refer to the
module documentation for the relevant number.
NewValue LWORD Value of the parameter to be written in 64-bit format.

The number of bits written cannot exceed the parameter width. A validity check is not performed.

Output/ Type Description


(return value of function)

CPX_SetParameter BOOL The return value indicates whether the operation was
fundamentally successful:
TRUE: Parameter value transferred.
FALSE: Parameter value not transferred.

11
The Festo_CPX.lib library

1.4.2 Example for parameterising a CPX module

CPX module '2AO' with associated functions CPX_GetParameter and CPX_SetParameter.

Fig.: Example for behaviour after SCA (actuator)

The 'Behaviour after SCA (Actuator)' parameter of module 2AO can be read with CPX_GetParameter(2,
3).
The 3rd parameter of module '#2' in the control configuration is requested in the function call.
The return value is 1. The description of the CPX analogue module reveals that the value 1 is assigned to
the behaviour 'Switch on again'.

Fig.: Example for setting 'upper limit'

The 'Value A0:Upper limit' can be modified with CPX_SetParameter(1, 12, 4012).
The 12th parameter of module '#1' in the control configuration is written in the function call.
The parameter adopts the value 4012 following the call. Refer to the description of the CPX analogue
module for details of permitted value ranges.

12
The Festo_CPX.lib library

1.5 Function blocks for error handling


The following tables contain descriptions of the inputs and outputs of the diagnostic modules.
Key:
o Input/output: Designation of an input or output from the CoDeSys function block/program
o Type: Data type expected by the relevant input or issued at an output.
o Description: Name and brief description of the CoDeSys function block (0 = FALSE, 1 = TRUE).

CPX_CLEARERRORLED

Error handling must be performed in the user program.

Output/ Type Description


(return value of function)

CPX_CLEARERRORLED BOOL The return value indicates whether the operation was
fundamentally successful:
TRUE: ERROR LED cleared
FALSE: The LED could not be cleared.

13
2 Index

C  CPX_DiagnosticsUpdate ...................... 1, 4, 5
CPX diagnostic information .......................... 5 CPX_GetFaultString ................................. 1, 4
CPX error handling ................................ 1, 13 CPX_GetParameter.......................... 1, 10, 12
CPX functions .............................................. 1 CPX_SetParameter ................................ 1, 10
CPX parameters .......................................... 1 F 
CPX system functions ............................ 1, 10 Festo_CPX.lib .............................................. 1
CPX_CICommand ................................. 1, 10
CPX_ClearErrorLED .............................. 1, 13

15

Вам также может понравиться