MB

M.J. Bekooy

info

Please Note

2 records found

Master thesis (2024) - M.J. Bekooy, G. Gousios, C.B. Poulsen, S. Proksch
Type annotations in Python are an integral part of static analysis. They can be used for code documentation, error detection and the development of cleaner architectures. By enhancing code quality, they contribute to the robustness, maintainability and comprehensibility of codebases. Tools like static type checkers use type annotations to detect bugs early, with some type checkers like Pyright being capable of inferring annotations statically from source code.

This thesis uses an innovative approach to further enhance type annotation coverage in Python codebases by using a combination of machine learning predictions and combinatorial search. To do this, PyHintSearch was developed. PyHintSearch constructs a search tree to which a depth-first search is applied to systematically explore potential combinations of predicted type annotations and validate them using feedback from the Pyright static type checker. Ultimately, the goal is to identify a branch containing a valid combination of type annotations. These annotations can then be integrated into Python code, thereby enhancing the type annotation coverage, which leads to improved static analysis and ultimately better code quality.

PyHintSearch's effectiveness is evaluated based on type annotation coverage and correctness, performance, and practical usability. Experimental results demonstrate different improvements in type annotation coverage, depending on the machine learning model used for type inference. Type4Py showed an improvement of 62.45% and TypeT5 of 79.93%. The precision of type annotations from these models are 0.36 and 0.51, respectively. Performance-wise, PyHintSearch can efficiently explore the exponential search space, annotating 16 diverse projects, ranging from small to large, in approximately 13.75 hours when using the Type4Py model. Regarding practical usability, the impact of type annotations on downstream program analysis is examined through the generation of call graphs. The additional information that type annotations provide can be used to refine the call graph by eliminating irrelevant calls to make it more precise. ...

Easy to use displacement diagram editor

Working with pneumatics can be done using a Programmable Logic Controller (PLC), which commands the individual actuators. To start, the movements of each component are described in a displacement diagram. From this diagram, ladder logic can be extracted, which is a set of conditions with corresponding actions. These actions are executed when the conditions hold. This ladder logic is the programming language of PLCs and makes it possible to control pneumatics. De Techniekschool provides courses on these techniques and pneumatics.

This report describes the research, design and implementation of a software application to aid students in their education of pneumatics. The main goal is to allow users to create a displacement diagram and then generate the corresponding ladder logic based on this diagram. This will allow users to understand how this conversion works and help them in understanding PLC programming.

In the research phase, various designs were evaluated. The implementation of the compiler was thought out and possible designs for the Graphical User Interface (GUI) for creating the diagram were explored. In the case of the GUI, the final implementation differs from the initial chosen design. This is because, during the project, it was discovered that the design did not work as well as intended, thus the switch was made. To guarantee the correct behaviour of the product, each individual component was tested on its own with unit tests.

Besides a compiler and the ability to draw displacement diagrams, features of Stepladder include the option to save and open work, and the option to undo and redo actions. It is also possible to show the signals which the PLC will receive and send. These signals already play a vital role in the conversion from displacement diagram to ladder logic and the generated signals can help to understand this conversion.

Desirable features which are not yet implemented are the support for multiple languages and improvements to the accessibility of the application. Also, a more advanced compiler is desired, because the current compiler does create ladder logic according to a valid technique, but it is not the optimal solution. For learning purposes, an optimal conversion may be desired. Proper user testing is also desired to verify the design and whether the application is easy to use.

To conclude, the final product allows the user to create displacement diagrams and generate ladder logic. This can be used to study the conversion needed in PLC programming. The final product meets the design goals set in the design process. Besides the design goals, the product also satisfies the initial requirements. There are some features the client could implement but these are not required. ...