• Ei tuloksia

Mobile crane simulation: results and discussion

Figure 2.10: Screenshot of the generated 3D animation of mobile crane.

2.4 Mobile crane simulation: results and discussion

In the work, the model obtained using commercial software was taken as a reference of calculation speed and accuracy. The model was calculated using two fixed-step solvers ode 1 and ode 4, which exploit the 1st order Euler numerical method and the 4th order Runge-Kutta method, respectively. In general, the Euler solver, due to its structure, provides faster but less accurate simulation results when compared with the Runge-Kutta solver. A time step as small as 10-4 s for both solvers was used. The reference models were translated to C source code using MATLAB Embedded Coder. The program was optimised for its execution efficiency.

The code also enables the logging to the file of the main variables, such as coordinates of tip location and values of the forces produced by actuators. The derived mathematical model was directly implemented as C source code. All programs were executed on a personal computer running 2.26 GHz Intel(R) Core(TM) 2 Duo CPU and 4 GB of RAM.

The movement of the crane was modelled from the static initial position. The cylinders of the lifting boom and outer boom were actuated by providing the input voltage of 5 V to their control valves. All other cylinders were fixed in their initial positions. The movement during a time period of 5 s was simulated. In Figure 2.11 global coordinates of the crane tip produced by the simulation of the reference and mathematical INEF models are presented for comparison. The resulting coordinates of the crane tip calculated by the models differ less than 5 cm from each other. Thus, the accuracy of the models can be considered as comparable. The time spent for the execution of each program implementing different models is compared in Figure 2.12. The black line indicates the real-time period of 5 s. Any values of time below this line can be considered faster than real time, while the value above the line indicates that simulation overflow. The program implementing INEF method demonstrates the fastest execution. It consumes less than half of the real-time period that is simulated and provides the maximum amount of time for analysis of predicted system behaviour.

Figure 2.11: Trajectory of the boom tip: Accuracy comparison.

Figure 2.12: Performance comparison.

The advantage of the direct mathematical modelling built with the use of the INEF method can be seen in the ability of its fine tuning in terms of performance and portability. The implementation of such a model does not depend on any particular programming language, software library, operating system or hardware platform. At the same time the commercial software modelling ensures simplicity of implementation, and even the complex mechatronic systems in certain cases can also be used in real-time applications.

49

3 Fast simulation of hydraulic models using recurrent neural network

In this chapter the modelling and fast simulation of the fluid power system using an artificial neural network with recurrent architecture is studied. As an example of the fluid power system, a mathematical model of the HPS system (Circuit 3) is considered. The system was chosen since it includes the features that are typical for the wide variety of fluid power system models, such as stiff differential equations, strong nonlinearities and non-smooth dependencies. Such models are complex and very time-consuming to solve with conventional numerical integration methods.

3.1 Recurrent neural network architectures

A number of the RNN architectures can be used for dynamic system modelling, such as the NFIR, NARX and the NARMAX architectures. These three architectures are similar in their structure; however, they differ in how much previous information is recurrently supplied to the network input, which, in turn, affects the network prediction accuracy, stability, size and calculation time.

The NFIR architecture can be considered the simplest and can be presented by the following defining equation (Schram, Verhaegen, & Krijgsman, 1996):

𝐲̂(𝑑) = πœ“π»(𝐱(𝑑), 𝐱(𝑑 βˆ’ 1), … , 𝐱(𝑑 βˆ’ 𝑛π‘₯)) (3.1) where 𝐱(𝑑) = [π‘₯1(𝑑), … , π‘₯π‘š(𝑑)]𝑇 is the network input vector at time t; 𝑛π‘₯ is the time delay order for input; and πœ“π» is the nonlinear mapping performed by multilayer feedforward network with H layers. In (3.1) and in the following equations the hatted variables represent the network estimations of the states of the dynamic system to be modelled. According to (Schram, Verhaegen, & Krijgsman, 1996), the NFIR architecture ensures stable simulation as long as the time of dynamic response is fully covered by past inputs. This leads to a larger number of parameters to be estimated in comparison with the NARX architecture, for example. The NARX architecture is an extended version of the NFIR architecture where also the past outputs are recurrently supplied. The defining equation for the NARX architecture is (Siegelmann, Horne, & Giles, 1997):

𝐲̂(𝑑) = πœ“π»(𝐲̂(𝑑 βˆ’ 1), … , 𝐲̂(𝑑 βˆ’ 𝑛𝑦), 𝐱(𝑑), 𝐱(𝑑 βˆ’ 1), … , 𝐱(𝑑 βˆ’ 𝑛π‘₯)) (3.2) where, in addition to described above parameters, 𝐲(𝑑) = [𝑦̂1(𝑑), … , 𝑦̂𝑙(𝑑)]𝑇is the network output vector at time t and 𝑛𝑦 is the time delay order for output. In comparison to the NFIR, this architecture is inherently less stable, since it operates in a closed loop, i.e. it uses its predictions as additional input. At the same time, the NARX network is considered to be a more accurate approximator. The NARX network can be obtained from the basic multilayer feedforward network by delaying the input vector 𝐱 and feeding back the output vector 𝐲̂

(Figure 3.1, Figure 3.2).

The predictive performance of the NARX network can be enhanced by also adding the error

information to the network input vector. This approach is used in the NARMAX architecture, whose defining equation can be written as:

𝐲̂(𝑑) = πœ“π»(𝐲̂(𝑑 βˆ’ 1), … , 𝐲̂(𝑑 βˆ’ 𝑛𝑦), 𝐱(𝑑), 𝐱(𝑑 βˆ’ 1), … , 𝐱(𝑑 βˆ’ 𝑛π‘₯), 𝐞(𝑑 βˆ’ 1), … , 𝐞(𝑑 βˆ’ 𝑛𝑒)) (3.3) where 𝐞(𝑑 βˆ’ 1) = 𝐲(𝑑 βˆ’ 1) βˆ’ 𝐲̂(𝑑 βˆ’ 1) is the network error at time t - 1 and 𝑛𝑒 is the time delay order for error. In (3.3) elements presented by x are sometimes called β€œcontrolled input”

and thus e elements can be considered as β€œuncontrolled input”. From this point of view, the NARMAX architecture is the most beneficial in the case of the real-world datasets with the unobserved noise as it is explicitly modelled in the network structure. However, in order to identify this kind of architecture, the previous 𝑛𝑒 prediction errors are needed. Thus, the need arises for another predictor that has to be used during the training. This makes the identification process for the NARMAX network much more complex than for the NFIR or NARX networks.

In our case, the used datasets do not include any noise as they are produced by a simulation of the mathematical model. Moreover, the smaller number of network parameters means faster calculations during operation, which is our goal. At the same time the prediction accuracy is still important. At this point, it can be concluded that the NARX architecture is seen as the most suitable for our application.

Network training is an iterative process of finding the set of network parameters (weights and biases) that satisfy some optimal criterion, such as mean square error minimum, using training data (a set of samples where each sample includes the input vector and the desired output vector). Using training data, a typical feedforward network can be trained by applying one of the backpropagation-based algorithms (Rojas, 1996). One of the most successful up-to-date training algorithms for this kind of network is the Levenberg-Marquardt (LM) algorithm (Yu

& Wilamowski, 2011). In order for the trained network to be not only able to reproduce the training data but also to generalise well, Early Stopping (Demuth, Beale, de Jess, & Hagan, 2014) and Bayesian Regularisation (Demuth, Beale, de Jess, & Hagan, 2014) techniques should

Figure 3.1: Training configuration of the NARX network.

Figure 3.2: General configuration of the NARX network.

3.2 Training data generation 51