2017-05-11 17:44:43 -05:00
|
|
|
# SIM\_cannon\_analytic
|
2018-08-17 17:07:06 -05:00
|
|
|
|
2015-09-05 15:42:41 -05:00
|
|
|
---
|
2018-08-17 17:07:06 -05:00
|
|
|
|
2015-09-05 15:42:41 -05:00
|
|
|
This is first of eight Trick-based simulations that one builds in the Trick
|
2018-08-17 17:07:06 -05:00
|
|
|
Tutorial (Section 4). It's purpose is to introduce some of the fundamentals
|
2015-09-08 17:05:37 -05:00
|
|
|
of building a Trick simulation.
|
2015-09-05 15:42:41 -05:00
|
|
|
|
2018-08-17 17:07:06 -05:00
|
|
|
Here we simulate the flight of a cannon ball. We want to know the position and
|
|
|
|
velocity of the cannon ball over time, given an initial position, and
|
2015-09-08 17:05:37 -05:00
|
|
|
velocity, and subject to the following assumptions and limitations:
|
2015-09-05 15:42:41 -05:00
|
|
|
|
|
|
|
* The **only** force acting on the cannon ball is gravity.
|
2015-09-09 17:42:57 -05:00
|
|
|
* The acceleration of gravity (g) is **constant** and equal to -9.81 meters per
|
2015-09-05 15:42:41 -05:00
|
|
|
second squared.
|
2015-09-05 17:12:52 -05:00
|
|
|
* The surface of the ground is defined as where y=0.
|
2015-09-05 15:42:41 -05:00
|
|
|
|
2015-09-08 17:05:37 -05:00
|
|
|

|
2015-09-05 15:42:41 -05:00
|
|
|
|
2018-08-17 17:07:06 -05:00
|
|
|
## Parameterization
|
|
|
|
The following parameters are given default values in a "default_data" job called
|
|
|
|
**cannon\_default\_data**. Their values can be changed in the **input.py** file.
|
2015-09-05 15:42:41 -05:00
|
|
|
|
2018-08-17 17:07:06 -05:00
|
|
|
| Name | Sim Variable | Type | Units | Symbol | default |
|
|
|
|
|------------------|------------------------|-----------|---------|:---------------------------------:|---------|
|
|
|
|
| Barrel Angle | dyn.cannon.init\_angle | double | radians |  | 30*(π/180) |
|
|
|
|
| Speed | dyn.cannon.init\_speed | double | m/s |  | 50.0 |
|
|
|
|
| Gravity | dyn.cannon.g | double | m/s |  | 9.81 |
|
|
|
|
| Initial Position | dyn.cannon.pos0 | double[2] | m |  |  |
|
2015-09-08 17:05:37 -05:00
|
|
|
|
2018-08-17 17:07:06 -05:00
|
|
|
## Initialization
|
|
|
|
The initial velocity is calculated in an "initialization" job.
|
2015-09-08 17:05:37 -05:00
|
|
|
|
2018-08-17 17:07:06 -05:00
|
|
|
| Name | Sim Variable | Type | Units | Calculation |
|
|
|
|
|------------------|:----------------|-----------|-------|-------------------------------|
|
|
|
|
| Initial Velocity | dyn.cannon.vel0 | double[2] | m/s |  |
|
2015-09-08 17:05:37 -05:00
|
|
|
|
2018-08-17 17:07:06 -05:00
|
|
|
## State Propagation
|
|
|
|
For each time-step, the following are calculated in a "scheduled" job. Though acceleration is
|
|
|
|
constant in this simulation, it usually isn't for "F=ma" type simulations.
|
2015-09-08 17:05:37 -05:00
|
|
|
|
2018-08-17 17:07:06 -05:00
|
|
|
| Name | Sim Variable | Type | Units | Calculation |
|
|
|
|
|------------------|:---------------|-----------|-----------|----------------------------------|
|
|
|
|
| Acceleration | dyn.cannon.acc | double[2] | m/s² |  |
|
|
|
|
| Velocity(t) | dyn.cannon.vel | double[2] | m/s |  |
|
|
|
|
| Position(t) | dyn.cannon.pos | double[2] | m |  |
|
2015-09-09 17:42:57 -05:00
|
|
|
|
2018-08-17 17:07:06 -05:00
|
|
|
## Calculating When the Ball Impacts the Ground.
|
|
|
|
The cannon ball will impact the ground, when y-element of the position vector is zero.
|
2015-09-05 15:42:41 -05:00
|
|
|
|
2018-08-17 17:07:06 -05:00
|
|
|
| Name | Sim Variable | Type | Units | Calculation |
|
|
|
|
|------------------|:----------------------|--------|-------|--------------------------------|
|
|
|
|
| Time of Impact | dyn.cannon.impactTime | double | s |  |
|
2015-09-05 15:42:41 -05:00
|
|
|
|
2018-08-17 17:07:06 -05:00
|
|
|
<!--
|
|
|
|
t_{\textrm{impact}} = \frac{ -v_{0_y} - \sqrt{v_{0_y}^2 - 2 g x_{0_y} }}{g}
|
|
|
|
-->
|
2015-09-08 17:05:37 -05:00
|
|
|
|