2017-05-11 17:44:43 -05:00
|
|
|
# SIM\_cannon\_analytic
|
2015-09-05 15:42:41 -05:00
|
|
|
---
|
|
|
|
This is first of eight Trick-based simulations that one builds in the Trick
|
2015-09-08 17:05:37 -05:00
|
|
|
Tutorial (Section 3). It's purpose is to introduce some of the fundamentals
|
|
|
|
of building a Trick simulation.
|
2015-09-05 15:42:41 -05:00
|
|
|
|
2015-09-08 17:05:37 -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
|
|
|
|
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
|
|
|
|
2015-09-08 17:05:37 -05:00
|
|
|
### Solution
|
2015-09-05 15:42:41 -05:00
|
|
|
|
2015-09-08 17:05:37 -05:00
|
|
|
This problem has a closed-form solution, so that's what is used.
|
2015-09-05 15:42:41 -05:00
|
|
|
|
2015-09-09 17:42:57 -05:00
|
|
|
<!--
|
|
|
|
Tex: v_{x0}=S\cos\theta
|
|
|
|
-->
|
|
|
|

|
2015-09-05 15:42:41 -05:00
|
|
|
|
2015-09-09 17:42:57 -05:00
|
|
|
<!--
|
|
|
|
Tex: v_{y0}=S\sin\theta
|
|
|
|
-->
|
|
|
|

|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|

|
2015-09-05 15:42:41 -05:00
|
|
|
|
2015-09-08 17:05:37 -05:00
|
|
|

|
|
|
|
|
2015-09-09 17:42:57 -05:00
|
|
|

|
2015-09-08 17:05:37 -05:00
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|

|
|
|
|
|
2015-09-09 17:42:57 -05:00
|
|
|
|
2015-09-08 17:05:37 -05:00
|
|
|
The cannon ball will impact the ground, when y(t)=0 at:
|
2015-09-05 15:42:41 -05:00
|
|
|
|
|
|
|

|
|
|
|
|
2015-09-08 17:05:37 -05:00
|
|
|
|
|
|
|
### CANNON Object
|
|
|
|
Model Variable | Simulation Variable | Type | Units
|
|
|
|
--------------------------------------------|---------------------|---------|-------
|
|
|
|
,  | CANNON.pos0[2] |double[2]| m
|
|
|
|
, | CANNON.vel0[2] |double[2]| m/s
|
2015-09-09 17:42:57 -05:00
|
|
|
 | CANNON.init\_angle |double | r
|
|
|
|
 | CANNON.init\_speed |double | m/s
|
2015-09-08 17:05:37 -05:00
|
|
|
 | CANNON.pos[2] |double[2]| m
|
|
|
|
 | CANNON.vel[2] |double[2]| m/s
|
|
|
|
|