trick/trick_sims/SIM_cannon_analytic/README.md

59 lines
1.8 KiB
Markdown
Raw Normal View History

2015-09-05 20:42:41 +00:00
#SIM\_cannon\_analytic
---
This is first of eight Trick-based simulations that one builds in the Trick
2015-09-08 22:05:37 +00:00
Tutorial (Section 3). It's purpose is to introduce some of the fundamentals
of building a Trick simulation.
2015-09-05 20:42:41 +00:00
2015-09-08 22:05:37 +00: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 20:42:41 +00:00
* The **only** force acting on the cannon ball is gravity.
* The acceleration of gravity (g) is **constant** and equal to -9.81 meters per
2015-09-05 20:42:41 +00:00
second squared.
* The surface of the ground is defined as where y=0.
2015-09-05 20:42:41 +00:00
2015-09-08 22:05:37 +00:00
![](images/CannonInit.png)
2015-09-05 20:42:41 +00:00
2015-09-08 22:05:37 +00:00
### Solution
2015-09-05 20:42:41 +00:00
2015-09-08 22:05:37 +00:00
This problem has a closed-form solution, so that's what is used.
2015-09-05 20:42:41 +00:00
<!--
Tex: v_{x0}=S\cos\theta
-->
![](images/init_v_x_0.png)
2015-09-05 20:42:41 +00:00
<!--
Tex: v_{y0}=S\sin\theta
-->
![](images/init_v_y_0.png)
![](images/init_a_x.png)
![](images/init_a_y.png)
2015-09-05 20:42:41 +00:00
2015-09-08 22:05:37 +00:00
![](images/solution_vx.png)
![v_{y}(t) = gt +v_{y0}](images/solution_vy.png)
2015-09-08 22:05:37 +00:00
![](images/solution_x.png)
![](images/solution_y.png)
2015-09-08 22:05:37 +00:00
The cannon ball will impact the ground, when y(t)=0 at:
2015-09-05 20:42:41 +00:00
![](images/time_of_impact.png)
2015-09-08 22:05:37 +00:00
### CANNON Object
Model Variable | Simulation Variable | Type | Units
--------------------------------------------|---------------------|---------|-------
![](images/x_0.png), ![](images/y_0.png) | CANNON.pos0[2] |double[2]| m
![](images/v_x_0.png), ![](images/v_y_0.png)| CANNON.vel0[2] |double[2]| m/s
![\theta](images/param_theta.png) | CANNON.init\_angle |double | r
![speed](images/param_s.png) | CANNON.init\_speed |double | m/s
2015-09-08 22:05:37 +00:00
![\vec{x}](images/vector_x.png) | CANNON.pos[2] |double[2]| m
![\vec{v}](images/vector_v.png) | CANNON.vel[2] |double[2]| m/s