One module I took during the final year of my degree was ‘System Modelling and Simulation’. A well taught and great module, one of the tasks was to model a double pendulum.
The approach involved deriving the equations of from the highest order of motion for each mass then working backwards through Simulink blocks to generate each term, which could then be to solve the equation – a bit of a chicken and egg problem! It was a an excellent task as the idea seems a little backwards at first and gave me a fresh approach to problem solving a model.
Below is the method extract from my report as the YouTube demo has generated some interest in the solution.
Double pendula are an example of a simple physical system which can exhibit chaotic behavior . That is to say it is sensitive to initial conditions and that its movements, although predictable, appear random. Equations of motion for the pendulum of Fig.?? can be derived by first considering the x and y components of displacement:
The Simulink model was constructed by first considering the various terms which make up the equations of motion (5), (6); each of the terms can be derived from the highest order of : . Hence, development begin by creating a mathematical flow of blocks, with each output a term within the equation [Fig.??].
Outputs for , etc. had been created but the inputs and where unknown. By rearranging the equations of motion to a set of functions in terms of and , they can be applied to the outputs and result fed back to the inputs:
[Fig.??] The outputs are combined using a Mux block, a multiplexor which creates an array of its inputs. Similarly, the masked system parameters are defined using MATLAB variables as Constant blocks and combined with another Mux. The terms are then found by creating Function blocks referencing these arrays, which are then equated accordingly to find and . Kinetic energies of the masses are also found at this stage in a similar manor, referring to (2). The angular accelerations are then fed back to the start of the block diagram. Initial angle conditions are set in the displacement Integrator to the MATLAB variables.
The pendulum model was ‘masked’ into a sub-system block for cleaner integration with the proceeding models [Appendix: ??]. Firstly, for Steps.2-5 of the experiment, the system of Fig.?? was used, which saves the outputs of the pendulum to file for manipulation within MATLAB. Secondly, for Step.5, a closed loop system with a PID block was used [Fig.??].
For the purpose of experimenting with the system for the report, I created two simple MATLAB scripts:
- Pre-processing – to define the variables (masses, length, gravity etc.)
- Post-processing – to create output plots and an animation.
This made the whole model very easy to use and play around with. I also various disturbances and feedback loops to the system, that can be turned on and off.
Here’s the code and model: