CODESYS Bachelor- / Master Thesis Projects

Bachelor / Master Thesis Projects

Bachelor or Master Thesis: Measurement and visualization of the cohesion of classes in CODESYS

Definition of problem


Cohesion in computer science describes the contextual connection of a class. Ideally, a class should deal with exactly one task.

In concrete terms, the cohesion of a class can be measured as the correlation between the data and the methods of a class. For example, the methods of a class can be grouped according to their data usage: Two methods belong together if they use the same data.

The cohesion of a class can then be expressed in a number as follows:

1 - (Number of methods using different data / Number of methods in the class)

Maximum cohesion would thus be 1 (all functions access the same data), and minimum cohesion 0 (all functions access different data).

A class with low cohesion should be refactored - typically by splitting the class into smaller classes.

While it is easy to calculate the cohesion, the calculated number is not very helpful in itself to help the user refactor a class.

Objective of the thesis


The tool CODESYS Static Analysis shall be extended by a function to measure the cohesion of classes. The user shall be able to define a minimum cohesion. Classes that are below this threshold value are then reported as faulty. In addition, a visualization is to be developed that shows the contextual connection between the methods and the data of a class.

The project can be carried out as a Bachelor or Master thesis. A Master thesis should additionally include a functionality to automatically refactor parts of one class into another class. This functionality can also be limited to specific cases that are to be determined as part of the Master thesis.

Duration: depending on study regulations
Remuneration: ja
Hours per week: 40h
Application reference: MDKK-Student

Bachelor or Master Thesis: Compiler directive for likeliness

Definition of problem

CODESYS is a hardware-independent programming system for programmable logic controllers. The IEC 61131-3-compliant programming languages used are translated into processor-specific code. There are currently code generator backends for more than 10 CPUs for CODESYS.

Today's CPUs have deep pipelines to load and process commands long before they are actually executed. In conditional jumps, these CPUs use simple heuristics to determine which path is the most likely to be processed.

Incorrect heuristics can lead to very poor performance because the pipeline may have to be completely purged and refilled.

An efficient compiler can exploit these properties of a CPU to generate faster code when the probability of a condition being met is known. It would be very helpful to implement a directive that allows the programmer to set the probability of a condition. For example, this kind of directive could look something like this:

IF (__UNLIKELY(x > 100000)) THEN
         LOG_Message(‘Variable too big’);
ELSIF (__LIKELY(x < 100)) THEN
          // do this
         // do that

In addition to IF-ELSIF statements, there are also conditional calls, conditional jumps, and conditional return statements in the graphical languages of IEC 61131-3. These should also be optimized with the __LIKELY directive.

Objective of the thesis

A directive as described above shall be implemented and integrated into the CODESYS compiler. Furthermore, the work shall investigate how this directive can be used on the different CPU architectures (Intel Pentium, ARM, PowerPC, possibly SH, MIPS, and others) and which performance enhancements can be achieved.

The bachelor thesis may be expanded into a master thesis by developing a runtime analysis that measures the rate at which a condition applies in order to optimize the code with __LIKELY / __UNLIKELY directives in a second compile run.

Duration: up to 6 months
Remuneration: yes
Hours per week: 40
Application reference: Compiler student

What we offer

We offer:

  • Challenging tasks and projects
  • Individual support and on-the-job training
  • Friendly working atmosphere
  • Opportunity of a permanent job offer after successful completion of your studies


  • Ongoing studies in computer science or electrical engineering
  • Interest and commitment
  • Motivation to work independently
  • Accurate and reliable working style

Duration: The time period of the thesis depends on the study regulations.
Hours per week: 40
Starting date: according to agreement