## 4 Construction of a Control System Model and Test Results  
In this study, simulation tests are intended to show the effectiveness of the TR controller. The TR controller is the author's new proposal that is currently being improved and developed. Previous research [32] has shown that this direction is correct and promising. To confirm this, simulation tests were prepared in the MatLab Simulink environment, comparing the effectiveness of stabilising the inverted pendulum using a TR controller and a PID controller. Unlike many complex proposals, TR and PID controllers are characterised by a simple computational algorithm, and PID controllers are still often used to stabilise inverted pendulums in practical solutions. For the author, the aspect of the possibility of practical use of the TR controller is important; hence the inertia of the actuator system, limiting the control signal to a specific interval, and the disturbance of the measurement signal were introduced into the test system. The risks associated with these factors are inevitable for any real control system.  
The simulation model of the inverted pendulum control system was built in the MatLab Simulink program.  
The following main blocks were used during the tests:  
* Pendulum--an inverted pendulum model based on Formula (1) in accordance with Figure 1:
* Input variable: control variable (CV) \(F_{x}\);
* Output variable: process variable (PV) \(\varphi\);
* Constant parameters: \(m\) (mass of the pendulum) and \(R\) (length of pendulum arm).
* TR--controller developed based on Formulas (5) and (6):
* Input variable: error of control (E), \(E=SP-PV\), \((SP=0)\Rightarrow(E=-PV)\);
* Output variable: control variable (CV) \(F_{x}\);
* Constant setting: \(k_{c}\).
* \(F_{c1}\)--second-order transfer function based on Formula (3).
* PID controller--block from the MatLab Simulink library, PID Formula (8) and constant parameters of the PID block:
* Controller settings: P, I and D;
* Filter coefficient: N: \[F_{xPID}=P+I\frac{1}{s}+D\frac{N}{1+N\frac{1}{s}}\] (8)
* Random Number--a block from the MatLab Simulink library used as a disturbance generator.  
* Saturation--a block from the MatLab Simulink library used to limit the CV value to a closed interval. Tests were conducted for both controllers (TR and PID) in three test configurations:
* A control system without disturbances and inertial block;
* A control system with an inertial block (\(F_{c1}\)) of the actuator system;
* A control system with an inertial block (\(F_{c1}\)) of the actuator system and a disturbance generator of the measurement signal. The limitations and scope of the tests are outlined as follows:
* In accordance with the limitations adopted in the pendulum model, the scope of research was limited to pendulum deflections in the range +90\({}^{\circ}\) to -90\({}^{\circ}\).
* The tests were carried out for a set value of \(SP=0\), which means that the TR controller always set the pendulum to the upright position.
* The initial value of the pendulum deflection angle for testing was set to \(\varphi_{0}=1[rad]\). If the PID controller was not able to bring the system to stable operation for an initial value of \(\varphi_{0}=1[rad]\), the value of the \(\varphi_{0}\) parameter for testing of the system with PID was reduced to such a value, thanks to which a stable control result was obtained.
* In all tests, limits were introduced on the control force value in the range of \((F_{min};F_{max})\).
* In all tests of the TR controller, the \(k_{c}\) setting was set to a constant value. The \(\varphi_{min}\) controller parameter in the TR controller was modified in the range of 0 to 0.1. The PID controller settings were selected for each test in such a way as to obtain a stable result.