For the final chapter of modeling control systems a computer program must be developed to calculate processes using a computational model and visualize them. The program should have a standard Windows interface (a window with data entry fields, buttons and a graphic area).
Requirements for models:
- Ability to set the simulation time and time step.
- Ability to display one or more timelines on the construction area.
- Convenience of scaling charts. The main driving influence of the system (for z) is a single jump at the initial moment of time.
For Subordinate Regulation Control System:
- The ability to visualize the processes u (t), x (t), y (t), z (t), as well as defining the effects of internal circuits for the quantities x (t) and y (t).
For Modal Control System:
- The ability to visualize processes for all state variables, as well as for the output value z (t), if it is not a state variable.
For reason of it simplicity, the language chosen was Python 3 programming environment. Python is a general-purpose programming language, moreover, the entry threshold is low, and the code is largely concise and understandable even to someone who has never used Python.
Creating the app here begins with choosing a GUI framework and other libraries to develop our window and related components. The chosen GUI library is tkinter, the other libraries are: numpy for math functions and matplotlib for plot visualization.
Both control systems will be calculated in this app. All schedules will be built all in the same program at the same time. The visualization will consist in the fact that the user selects the graphic of interest to him in the graphic selection block, and, when you click on the corresponding buttons, the graphics are already built and become visible.
This should be the app behaviour: the user enters the initial parameters into the data entry fields and clicks the "Calculate" button; after that, the program calculates all the points in the coordinate plane for plotting; and finally, the user selects the desired graphic to be displayed, and the app will show it.
I explain the development of the app in this video on youtube:
Also here is the source code for the app; you can download, add or edit if you want to improve the performance and behaviour.
No comments:
Post a Comment