CPDev engineering package

1. General characteristics.

The CPDev (Control Program Developer) environment is an engineering package intended for programming PLC/PAC controllers in accordance with the PN/EN 61131-3 (IEC) standard. Typical applications include: measurement processing, logical-sequential control, continuous regulation, process and statistical calculations and others. The user program, compiled in a PC into a universal binary code, is executed on the controller side by a runtime program functioning as a virtual machine (similar to Java). The CPDev virtual machine supplemented with the manufacturer’s low-level functions can be implemented on various hardware platforms, e.g. AVR, ARM, PC with I/O cards, etc.

The PN/EN 61131-3 standard defines five programming languages:

  • ST (Structured Text),
  • IL (Instruction List),
  • FBD (Function Block Diagram),
  • LD (Ladder Diagram),
  • SFC (Sequential Function Chart).

The LD language is often used to program controllers replacing older relay-based systems. The FBD language is eagerly used by automation specialists and engineers who have no experience in computer programming. SFC is a macrolanguage whose elements are subroutines written in other languages, used to implement a sequence of sequences (production stages). The most universal, however, is the ST text language, which is the equivalent of C or Pascal languages. Programs created in graphical languages are converted to ST. All standard languages are available in CPDev.

2. Programming.

The CPDev project tree (Fig. 1) consists of POU software organizational units, a list of global variables, tasks and included libraries. Each POU (program, functional block or function) can be written using a different language. This allows several people to create a project together, in the languages of their choice, and then combine everything into a whole that is compiled into the controller program. Programs defined in POU are assigned to tasks performed by the controller with a given cycle, usually resulting from the processing power of the processor. A task performed in the controller by a runtime virtual machine can contain virtually any number of programs. The only limitation is hardware and software resources.

The first step in working on the project is to divide the POU software into units and select a language for each unit. Then prepare a list of global variables that are to be available in all programs. Finally, the previously developed algorithms for POUs are coded. Depending on the selected language, the editors provide: keyboard shortcuts, hints, code coloring, automatic block combining, etc. If an error is detected during compilation, an appropriate message indicates the incorrect line and the type of error. Warnings are also generated. The final step is to configure the hardware layer of the system and communication with field devices and the master computer. Finally, the compiled code and communication configuration data are sent to the controller.

Switching on/off implemented in five languages in the CPDev environment

Frequently used program fragments can be saved in libraries and used in future projects. There are three libraries of basic functional blocks available in the CPDev environment:

  • IEC_61131 – standard blocks of the standard,
  • Basic blocks – simple blocks,
  • Complex blocks – complex blocks (optional).

The user can, of course, create their own libraries. The CPDev environment provides the following data types:

  • elementary: BOOL, BYTE, WORD, DWORD, LWORD, SINT, INT, DINT, LINT, REAL, LREAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME,
  • complex: one-dimensional arrays, structured types.

The CPDev package also contains examples of simple control programs written in various languages.

3. Running and testing programs.

In addition to programming the PLC controller, the CPDev environment allows you to run and check the correct operation of the program in the CPSim simulator (Fig. 2). It is used both to track program execution in the PC (off-line) and in the controller (on-line), i.e. in commissioning mode.

The project tree (in Fig. 2 on the left) shows global variables and tasks containing local variables of individual programs. The user can connect to the selected data source (PC simulator or controller) and observe the current values. They can be additionally visualized on small panels. Variable values can be modified during the simulation. In the Task window, the user reads the task cycle time, tracks the number of cycles performed and the current system clock time. Exceeding the cycle time, array size during program execution, etc. is signaled.

Switching on/off simulation in CPsim

It is also possible to automate testing by creating an input file containing the values of the input variables and information about the time at which the changes are to be made. Simulation results can be saved in an output file for analysis using external tools (Excel, Matlab).

Graphical editors of the FBD, LD and SFC languages allow you to monitor variable values directly on the program diagram (Fig. 3). The most important functionalities include:

  • starting and stopping program execution (in PC simulation mode),
  • presentation of variable values on a diagram, including values for connections,
  • changing the value of input variables (forcing),
  • saving variable values in a text file,
  • support for traps, both unconditional and conditional.

Monitoring variable values in diagrams

The way the current variable values are presented depends on the language and type of data presented. In FBD and LD diagrams, connections for logic signals (BOOL) are drawn with a solid line (TRUE) or a dashed line (FALSE). Moreover, when you point the cursor at an input, output or connection, the current value of the variable is displayed. There is also an option to continuously present connection values.

Graphical editors are equipped with the ability to stop programs when they encounter traps. The user can then check the system status and the values of individual variables. CPDev also has a mechanism that allows you to create verification tests targeted at software organizational units (POUs).

4. Comparison of CPDev with CoDeSys.

CoDeSys software is a popular, hardware-independent design tool, compliant with the IEC 61131-3 standard, intended for programming PLC/PAC controllers. Like CPDev, it requires equipment manufacturers to develop their own, low-level functions specific to a given controller and prepare tools for programming.

The CPDev environment was created independently of CoDeSys, but due to similar functionality and adaptation to the requirements of the IEC standard, they are characterized by a significant degree of similarity (Table 1).

CechaCPDevCoDeSys
Język programowania ST, IL, FBD, LD, SFC******
Biblioteki bloków użytkownika******
Symulacja off-line*****
Testowanie on-line (commissioning)*****
Zmienne lokalne i globalne******
Programowanie sterownika z poziomu środowiska******
Pułapki******
Testy jednostkowe***
Wielozadaniowość*****
Uniwersalność dla różnych platform sprzętowych******

Comparison of the CPDev environment with CoDeSys

CoDeSys is more extensive than CPDev, but the basic functionalities are similar. People familiar with CoDeSys should have no difficulty using CPDev.

5. Summary.

Currently, project implementation time is crucial. However, it is not always possible to familiarize yourself with the processor architecture in advance in order to write a program in assembly language, C or Basic. Such requirements are met by the universal CPDev environment, which can be implemented in various hardware architectures. Moreover, thanks to compliance with the PN/EN 61131-3 (IEC) standard, CPDev enables the application to be quickly written by a programmer (automation engineer) who has previously gained experience in similar environments, e.g. CoDeSys.

CPDev program

6. Installation of the CPDev program.

CPDev program, full version, cpdev-etronix-1.2.5.2.exe (17MB),
A package needed for the CPSim simulator to function, vcredist_x86.exe (2.5MB).

7. You can program the SU 1.7 PLC using the CPDev package.

Scroll to Top