Project 3 2016-12-22 FMNN05: Simulation Tools Claus Führer (LTH) Christian Andersson(LTH/Modelon) This is Part III of the overall course project. In this part, we consider differential equations with discontinuities. Please describe you observation in report form. It should include • a description of your tests, i.e. what is tested and why ... • a description of your test cases in such a way so that they are reproducible. • a documentation of your results (tables, plots etc) obtained by DYMOLA/Modelica and your own Assimulo/Sundials control computations. • your own interpretation of the results. Consider the tasks listed below as suggestions for experiments. You are free to design others as long as they lead to a statement. Background First we describe the model problem. Figure 1: Woodpecker model The problem with discontinuities is a toy woodpecker, similar to the one descriped by Leine and Glocker on http://www.zfm.ethz.ch/~leine/toys.htm. The main difference between our model and this model is that we consider impacts without friction, which simplifies the task significantly. 1 The model consists of two bodies, the sleeve (hylsa, sv.) and the bird. The central bar has no degrees of freedom and is considered as part of the ground system. The sleeve is connected to the bar, by so-called unilateral constraints, i.e. constraints, which are described by inequalities. They can be viewed as classical constraints, which are activated only under certain conditions. Normally the sleeve has two degrees of freedom, its rotation described by ϕS and its vertical translation described by z. When the constraint is active, the degrees of freedom are blocked and two constraint forces λ1 and λ2 get nonzero values. The sleeve is connected to the bird by a rotational spring without damping. The bird has one degree of freedom, the rotation relative to the sleeve, which we denote by ϕB . Finaly the bird’s beak can hit the bar and cause an impact. We distinguih three system states State I The system is free. State II The sleeve blocks at lower right and upper left corner. State III The sleeve blocks at lower left and upper right corner. State IV The beak hits the bar. The transitition between the states is described by different types of discontinuities: The states I-III are discribed by different equations of motion and the transition between them is a discontinuity, where the models have to be changed. Transition to and from state IV does not change the model (differential equation) but sets new initial conditions. The linearized equations of motion are given as DAEs with changing constraints. This enables us to work always with the same number of equations: State I (mS + mB )z̈ + mB lS ϕ̈S + mB lG ϕ̈B = −(mS + mB )g (mB lS )z̈ + (JS + mB lS2 )ϕ̈S + (mB lS lG )ϕ̈B = cp (ϕB − ϕS ) − mB lS g − λ1 mB lG z̈ + (mB lS lG )ϕ̈S + (JB + 2 mB lG )ϕ̈B 2 = cp (ϕS − ϕB ) − mB lG g − λ2 (1a) (1b) (1c) 0 = λ1 (1d) 0 = λ2 (1e) State II (mS + mB )z̈ + mB lS ϕ̈S + mB lG ϕ̈B = −(mS + mB )g − λ2 (mB lS )z̈ + (JS + mB lS2 )ϕ̈S (2a) + (mB lS lG )ϕ̈B = cp (ϕB − ϕS ) − mB lS g − hS λ1 − rS λ2 (2b) 2 mB lG z̈ + (mB lS lG )ϕ̈S + (JB + mB lG )ϕ̈B = cp (ϕS − ϕB ) − mB lG g (2c) 0 = (rS − r0 ) + hS ϕS (2d) 0 = ż + rS ϕ̇S (2e) State III (mS + mB )z̈ + mB lS ϕ̈S + mB lG ϕ̈B = −(mS + mB )g − λ2 (mB lS )z̈ + (JS + mB lS2 )ϕ̈S (3a) + (mB lS lG )ϕ̈B = cp (ϕB − ϕS ) − mB lS g + hS λ1 − rS λ2 (3b) 2 mB lG z̈ + (mB lS lG )ϕ̈S + (JB + mB lG )ϕ̈B = cp (ϕS − ϕB ) − mB lG g (3c) 0 = (rS − r0 ) − hS ϕS (3d) 0 = ż + rS ϕ̇S (3e) with the mass of the sleeve mS = 3.0 104 kg, the sleeve’s moment of intertia JS = 5.0 10−9 kgm, the mass of the bird mB = 4.5 10−3 kg, the bird’s moment of inertia JB = 7.0 10−7 kgm, the radius of the bar r0 = 2.5 10−3 m, the inner radius of the sleeve rS = 3.1 10−3 m, the half height of the sleeve hS = 2.0 10−2 m, the vertical distance between sleeve and rotation axis of the spring lS = 1.0 10−2 m, the vertical distance between bird’s origin and rotation axis of the spring lG = 1.5 10−2 m, the beak’s coordinates in ther bird’s local system (lB , hB ) = (2.01 10−2 m, 2.0 10−2 )m, the spring constant cp = 5.6 10−3 N/rad and the gravitation constant g = 9.81m/s2 . Python definitions of these values can be downloaded from the course’s webpage. Transistions Here the verbal description of the possible transitions • If the woodpecker is in State I and ϕ̇B < 0 it will switch to State II, when hS ϕS = −(rS − r0 ). • If the woodpecker is in State I and ϕ̇B > 0 it will switch to State III, when hS ϕS = (rS − r0 ). • If the woodpecker is in State II it will switch to State I if λ1 changes sign. • If the woodpecker is in State III and ϕ̇B < 0 it will switch to State I if λ1 changes sign. • If the woodpecker is in State III and ϕ̇B > 0 it will switch to State IV if hB ϕB = lS + lG − lB − r0 . • If the woodpecker is in State IV it will immediately change back to State III and change the sign of ϕ̇B . 3 Sleeve blocking When the sleeve comes into blocking state we compute the momentum (rörelsemängd (Sv)) before the impact 2 − I − = mB lG ż − + (mB lS lG )ϕ̇− S + (JB + mB lG )ϕ̇B + − + and set ż + = ϕ̇+ S = 0. With these new values we compute ϕ̇B by demanding I = I , so that the momentum will be conserved. Tasks This assignment has 7 tasks. Task 1 Implement the equations of motion in an Assimulo problem class. Task 2 Write a function state_event. As mentioned above, the geometric and mechanical constants can be downloaded as Python definitions from the webpage. Task 3 Write a function handle_event. Task 4 Make simulations with Assimulo IDA. Note that the constraints (2d) and (3d) are index-3 constraints. You might want also consider index reduced models. Task 5 How many times is the woodpecker’s beak hitting the bar during the first 2 seconds. Task 6 repeat these tasks with Dymola. 4 Task 7 If you have time, please run your problem also in the ”classical way”, i.e. with if-statements depending on the state variables and not on the switches. Compare the accuracies and performance (step size history). Don’t hesitate to ask for help in case you run into problems. Lycka till! 5
© Copyright 2026 Paperzz