phone +48 (12) 659-14-42

CPDev engineering environment

1. General characteristic.

CPDev (Control Program Developer) engineering environment has been designed for programming PLC/PAC controllers according to the IEC 61131-3 standard. Typical applications include measurement processing, logic/sequence control, continuous regulation, process or statistical calculations, etc. User program, compiled in PC computer to a universal binary code, is executed in a controller by runtime firmware operating as virtual machine (similarly as Java). CPDev virtual machine provided with low-level platform dependent functions may be implemented on different hardware, as AVR, ARM, PC with I/O cards, etc.

IEC 61131-3 standard defines five programming languages:

LD language is typically used for programming controllers that replace older relay based systems. FBD language is preferred by engineers less experienced in computer programming. SFC is a macrolanguage for defining sequences of production stages. SFC diagram consists of programs written in the other languages. Textual ST language, equivalent to C or Pascal, is the most universal. Programs developed in graphical languages are usually translated to ST. All IEC languages are available in CPDev.

2. Programming.

CPDev project tree (Fig. 1) consists of program organization units (POUs), list of global variables, and libraries. Every POU unit (program, function block or function) can be written in a different language. Thus separate parts of the project may be created independently by a group of engineers in suitable languages, then consolidated together and compiled to a control program. Programs defined in POUs are assigned to tasks executed by the controller with prescribed execution cycles, usually dependent on computational power of the processor. Task executed in the controller by virtual machine may consist of any number of programs. The limit is set only by hardware or software resources.

In the first development step a project is divided into POU units, and base language selected for every unit. Then the list of global variables, available in each program, is created. Finally, appropriate algorithms are coded for particular POUs. Depending on the language, CPDev editors provide hot keys, suggestions, code coloring, automatic connection of blocks, etc. If an error is found during compilation, appropriate message indicates faulty line and error type. Warnings are also generated. In the last step hardware components of the system are configured, as well as communications with remote devices and with operating station. Finally, the compiled code and configuration data are transferred to the controller.


Fig. 1. Start/stop circuit written in five IEC languages.

Frequently used parts of the programs may be stored in libraries for reuse in future projects. CPDev environment provides three libraries of typical function blocks:

Users can create their own libraries. CPDev supports the following data types:

CPDev also includes several examples of simple control programs written in different languages.

3. Program execution and testing.

Beside PLC programming the CPDev environment supports running and checking the programs using CPSim simulator (Fig. 2). Program execution may be traced and debugged off-line in PC, as well as tested on-line in the target controller during commissioning mode.

The CPSim project tree (Fig. 2, left) shows global variables and tasks with local variables of particular programs. The user may choose data source (PC simulator or controller) and monitor current values. The variables can be also displayed in small panels. Variable values may be modified during simulation. Task window presents cycle time, number of completed cycles, and current system time. Violation of cycle time, array dimensions, etc., are also indicated.


Fig. 2. Simulation of start/stop circuit in CPSim.

Testing process can be automated by creating an input file with values of the variables and times of change. Simulation results can be saved in an output file and analyzed by external tools (Excel, Matlab).

Graphical editors of FBD, LD and SFC languages provide monitoring of variables directly in the program diagrams (Fig. 3). Main functionalities involve:


Fig. 3. Monitoring variable values on the diagram.

Current values may be presented in different ways, depending on the language and data type. Connections of logic signals (BOOL) on FBD and LD diagrams are shown as solid (TRUE) or dashed (FALSE) lines. The value of input, output or connection currently pointed at by the cursor is also displayed. Optionally, all values may be continuously presented.

Graphical editors can stop programs at breakpoints. Then the user may check system state and values of particular variables. CPDev also supports a mechanism for creating verification tests oriented towards program organization units.

4. Comparison between CPDev and CoDeSys.

CoDeSys package is popular, hardware independent engineering environment, designed for programing PLC/PAC controllers according to IEC 61131-3 standard. Similarly as CPDev it requires device manufactures to provide their own low-level functions and firmware programming tool.

CPDev environment has been developed independently from CoDeSys, although comparable functionality and compliance with IEC requirements resulted in considerable similarities (Tab. 1).

Feature CPDev CoDeSys
Programming language ST, IL, FBD, LD, SFC *** ***
User function block libraries *** ***
Off-line simulation ** ***
On-line testing (commissioning) ** ***
Local and global variables *** ***
Controller programming *** ***
Breakpoints *** ***
Unit testing *** -
Multitasking ** ***
Applications for different hardware platforms *** ***

Tab. 1. Comparison of CPDev and CoDeSys environments.

CoDeSys is larger than CPDev, however basic functionalities are similar. So CoDeSys users will not encounter any difficulties while using CPDev.

5. Conclusion.

Project development time becomes crucial nowadays. However, sometimes there is no opportunity to become familiar in advance with processor architecture, so as to write programs in assembler, C or Basic languages. Universal CPDev environment, which can be implemented on different hardware platforms meets such requirements. Moreover, due to compliance with IEC 61131-3 standard, CPDev provides rapid development of applications by a programmer (control engineer) with some experience in similar environments like, for instance CoDeSys.

6. CPDev installation.

To the top ..