 # Model Your Own Medieval Catapult Design

August 23, 2012 — Peter Aronsson, Wolfram MathCore

Explore the contents of this article with a free Wolfram SystemModeler trial.Since my childhood, I have always been impressed by big mechanical structures, especially things that are used for demolition of some kind, like demolition machines (cranes with big metallic balls thrown hard at concrete buildings) or machines for warfare. All kids are by nature intrigued by demolishing, and I guess that some of us never lose that interest.

When we grow up, our interest may shift toward understanding the physics behind the machines used for demolition more than the actual demolished result. Wouldn’t it be nice to be able to study medieval warfare, and in particular, the mechanical system of a catapult? How should you design your catapult for maximal effect? How far can you hurl a projectile with a given design? What is required to throw a piano?

The mechanics behind a catapult are rather simple to describe using ready-made components in Wolfram SystemModeler. The model could be used to fine-tune the design and calculate properties such as the maximum length of a hurl for a specific counterweight.

SystemModeler ships with the MultiBody library, which is able to take a model description and automatically turn it into a 3D system. This is perfect to use as building blocks for a model of a catapult. Since we want to explore the design of the catapult—like the mass of the counterweight, length of the main throwing arm, and where to connect it to the frame, as well as where it lets go of the ball—we need a dynamic tool where we can see how the parts fit together as well as how they move due to the various weights and loads we attach to them.

The final view of the catapult will look like the model diagram below. It consists of a chassis in the middle, which builds up the frame and the counterweight. At the top of the model is a firing control component, and the bottom right shows the projectile we are going to hurl. The frame is also fixed in space by a connection to a fixed world component. We start by building the chassis, which will consist of a frame, a swinging arm, and a counterweight. The end result of that component is shown below: The first component in the chassis is the frame that the arm will be attached to. This is done by dragging and dropping cylinder components into the model diagram. When simulated, the corresponding 3D model will be constructed and visualized:  Next we add the arm. The arm is attached to the frame with a revolute joint. The operation of the arm is controlled by a clutch; when released, the arm will start to swing: When we connect the arm and the frame together and simulate the model, we get the following video:

Next we add the counterweight. A mass of 1,000 kg is attached by a short cylinder linkage and a revolute joint: Here is the resulting animation:

We can already see that the behavior of the catapult is getting close to a finished product; we’re only lacking the ball that we will hurl. This is the next step.

We need a way of detaching the ball from the catapult. To accomplish this, we can extend the MultiBody library with our own custom component. The DetachableString component will change the force in the loadspring from the traditional force to zero when the release signal is triggered. This event handling can easily be incorporated in Modelica code: As long as the “attached” signal is true, the spring will act as a spring, but when the signal changes to false, the force will change to zero, and the ball will be released. We incorporate this into our main model: If we do not release the ball, the animation looks like the following:

Now we have all the mechanical components needed in the catapult. What is still missing is the firing mechanism. This will be a two-stage process, releasing the swinging arm with the counterweight and, at the right moment, releasing the projectile we want to hurl. This kind of process can easily be expressed with the StateGraph components in the Modelica Standard Library.

In the component below, the arm is kept in a locked position for two seconds. Then the releaseArm transition fires, letting the arm start to swing. When the arm angle reaches the given drop angle, we release the ball and go into the detached state: Finally, to get a target to shoot at and a ground for the catapult to stand on, we add some basic shape components from the library. We now have a fully functioning catapult model. Running the automatic animation in the Simulation Center shows the catapult shooting a ball at the target:

Let’s try to get the ball thrown as far as possible and say we can vary the angle from which we release the arm as well as the angle at which we release the ball. Experimenting with different parameters, we can plot the parabola the thrown ball takes. We do this by creating a new parametric plot in the Simulation Center and selecting the x and y position for the ball.

We start by varying the startAngle parameter, which defines the angle at which we release the arm. It has to stay below 3.65 rad to avoid the arm touching the ground. Varying the angle between 3.65 and 3.25 rad in steps of 0.1, the result looks like this: We can see that that the first simulation with the angle 3.65 rad gives the largest distance. If we look at the animated simulation, we can see that this is the angle where the counterweight is dropped from a maximal height.

Using the best starting angle for the arm, let’s do the same experiment, but vary the angle at which we release the ball. A reasonable range seems to be between 1.9 and 2.3 rad. The resulting plot, with steps of 0.1 rad, looks like this: The longest throw here is the third simulation with a ball release when the arm is at 2.1 rad. Here is the animation with the two parameters found to give the largest distance:

As an extension to this experiment, we can do a parameter sweep over both parameters in Mathematica using the Wolfram SystemModeler Link. This allows us to create a plot over two dimensions, showing the distance thrown depending on both parameters. The height of the surface is the distance thrown with the given input angles. We can see that the point we found in the Simulation Center indeed seems to be a good choice for maximal distance: We can also find the highest point right away by running the Mathematica function FindMaximum, which returns 3.65 for the start angle and 2.06384 for the ball release angle.

Using this model of a catapult, many more questions can be answered. Which changes can be made to the mechanical structure to make it throw further? If there are given weight limits for the counterweight and the thrown projectile, what can be done to make it go further? You can also extend the model in many different ways. Try adding a sling that holds the projectile to make the catapult behave like a trebuchet and throw the ball even further.

Wolfram SystemModeler is available as a Home Edition version, and a trial is available.

Posted in: SystemModeler     The device being modeled in this article is not a catapult but a trebuchet. A catapult was a kind of giant crossbow powered by torsion. The catapult was developed perhaps a 1000 years before the gravity-powered trebuchet. I imagine a catapult simulation would require a rather different model. Posted by Morton Goldberg    August 23, 2012 at 8:00 pm      Yes, you are absolutely right. The right name for this machine is Trebuchet. See my earlier answer below on how to build a torsion based catapult, it can actually be done quite easy by using the existing chassi and a spring component. Posted by Peter Aronsson    September 11, 2012 at 2:39 am       In principle yes, there is a Mathematica function called WSMModelData (http://reference.wolfram.com/system-modeler/WSMLink/ref/WSMModelData.html) that retrieves the equations of your SystemModeler model. However, since the Trebuchet example is modeled using the MultiBody library, and that library extensively uses Modelica functions with some special features which is currently not fully supported by this function, so you will only get a partial set of equations. This is something we are working on improving for the next version. That would allow you to e.g. use NDSolve and other neat stuff in Mathematica to analyze your MultiBody system. Best Regards Peter Posted by Peter Aronsson    August 24, 2012 at 9:52 am       I would like to see if a torsion catipult could be coded in Mathmatica instead of a counterweighted one. Is that possible and if so, could you post a sample of that code? Posted by Bo    August 27, 2012 at 2:37 pm       The mechanical structure of the model can easily be adapted to a torsion catapult. You just remove the counterweight component and replace it by a rod of appropriate length. To model a simple torsion component you can use the MultiBody spring component (http://reference.wolfram.com/system-modeler/libraries/Modelica/Modelica.Mechanics.MultiBody.Forces.Spring.html). You also need to adjust the startAngle parameter so the throwing arm is positioned properly (a value of 0.5 radians seems appropriate). If you want a more detailed torsion behavior you will have to write your own component for that, which makes it a little bit more complicated, but still doable as long as you know the equations. Posted by Peter Aronsson    August 29, 2012 at 8:55 am       Thank you for this tutorial, i found it very helpful. The machine worked perfectly Posted by That Kid, CJ    February 28, 2013 at 6:18 pm     