Chapter 6 Model Simplification for HIL Implementation
6.4 Neural Network Modelling
6.4.4 Neural Network Limitations
A weakness of NNs is that they are unable to extrapolate the behaviour of the modelled system beyond the training data. For example, if the input voltage to the wiper motor physical model was increased to, say, 25V, the model would be able to simulate the behaviour. However, the NN model would fail because it was only trained up to 18V. For this reason care must be taken when selecting training data and when running the NN models.
An example of the NN models developed in this chapter failing is shown in Figure 6-23. In this case the NN motor model is subject to a constant torque when the motor is switched off16 at around 5.2s. This causes a large error in both the motor velocity and current. It should also be noted that the NN model fails to recover once the motor inputs return to their normal, trained values at around 5.8s. Thus, the NN models developed here would not be suitable for implementations such as fault insertion testing.
Figure 6-23: Neural Network Limitation Example
16 The implemented simulation models prevent this from happening to emulate the worm and
wheel gear system in the motor.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 -60 -50 -40 -30 -20 -10 0 10 20 Time (s) C u rr e n t (A ) 0 2 4 6 8 10 12 14 16-1 0 1 2 3 4 5 6 7 V e lo ci ty (r a d /s) Velocity Current
154
6.5 Discussion
The goal of the work presented in this chapter was to modify the wiper system model developed, parametized and validated in the previous three chapters in order to make it suitable for real-time simulation, and thus HIL implementation. It was decided that the best way to achieve this was to replace the SimMechanics element of the physical model with a model which could be simulated outside of the physical domain. Doing this allowed the simulation speed of the model to be increased for two reasons. Firstly, local Simscape solvers could be used to solve the physical network which are faster than the global solvers (and could not be used if a SimMechanics model was attached to the physical network). Secondly, models could be developed that only simulated elements of the system that were needed, making them inherently faster to simulate.
The first step was to make use of the fact that the mechanical system is a fully kinematically defined system of rigid bodies with one DOF. This meant that the positional behaviour of any point on the system could be represented using look-up tables driven by the position of the motor output shaft. The velocity and acceleration behaviour could then be obtained by differentiating the position.
The second step was to model the torque load applied to the motor by the wiper system’s mechanical element. Initially, this was done for the system’s so called no-load condition, which only takes into account the load applied by the linkages. The torque was modelled using polynomials to define the fundamental shape of the torque load, with respect to the motor shaft position, across its forward and reverse wipe. An equation was then developed to model the effect of the motor velocity on the torque, whose unknown constants were identified using a GA. By replacing the SimMechanics implementation of the linkages with the polynomial implementation, the model went from taking 86s (real-
155
time) to simulate 60s (simulation time) to taking 4s to simulate 60s – making it suitable for real-time and HIL simulation.
The third step was to model the whole mechanical system using feed forward NN. An investigation revealed that, in this case, a NN with 10 hidden layers with 10 neurons each are the optimal dimensions. The network was trained to simultaneously output the torque developed in the wet and dry windscreen conditions from input data consisting of the motor output shaft’s position and velocity. The network was trained with data from the physical model. The trained network successfully models the torque with an average MSE of 0.0951 for the training data and 0.1102 for the validation data. A simulation model of the wiper system with the torque NN replacing the SimMechanics system was measured as simulating 60s (simulation time) of data in 5.92s (real time).
The final step was to attempt to model the entire wiper system using NNs. For this, a NN modelling the wiper motor that could be interfaced with the torque NN was developed, based on the principles of a NARX network. The motor NN accepts voltage and torque (from the torque NN) inputs and outputs the motor current and output shaft velocity for both fast and slow modes of operation. The trained motor NN is able to model the dynamics of the wiper motor with an average MSE of 0.0068, however to achieve this low MSE the NN had a closed loop training time of 7h19m. Both the motor NN and torque NN are implemented together in a Simulink model and successfully simulated the entire wiper system. The full NN system can simulate 60s (simulation time) in 2.17s (real time) making it the fastest model developed here.
156