Neaten and fix warnings in files created in Tutorial section 8.

This commit is contained in:
John M. Penn 2015-09-03 19:02:44 -05:00
parent 2683c17e0e
commit 77c8cd656f
11 changed files with 80 additions and 80 deletions

View File

@ -1,5 +1,6 @@
/*********************************** TRICK HEADER **************************
PURPOSE: (Test Baseball)
/****************************** TRICK HEADER ******************************
PURPOSE: ( Define CANNON_AERO type. )
Tutorial Section 8
***************************************************************************/
#ifndef CANNON_AERO_H
@ -16,9 +17,9 @@ typedef enum {
} Lift_Estimation_Method ;
typedef struct {
double pos[3] ; /* M position */
double vel[3] ; /* M/s velocity */
double acc[3] ; /* M/s2 acceleration */
double pos[3] ; /* m position */
double vel[3] ; /* m/s velocity */
double acc[3] ; /* m/s2 acceleration */
double omega[3] ; /* r/s Angular velocity of cannonball */
double theta ; /* r Angle from x-axis to axis rotation */
@ -28,7 +29,7 @@ typedef struct {
/* Impact */
REGULA_FALSI rf ; /* -- Dynamic event params for impact */
int impact ; /* -- Has impact occured */
double impact_pos ; /* M How far ball lands in field */
double impact_pos ; /* m How far ball lands in field */
/* Forces */
double force_gravity[3] ; /* N Gravitational force */
@ -47,11 +48,11 @@ typedef struct {
/* Environment and Properties */
double mass ; /* kg Mass of cannonball */
double air_density ; /* kg/M3 Air density at 20C */
double ball_radius ; /* M Radius of cannonball */
double ball_area ; /* M2 Cross sectional area of ball */
double air_density ; /* kg/m3 Air density at 20C */
double ball_radius ; /* m Radius of cannonball */
double ball_area ; /* m2 Cross sectional area of ball */
double spin_parameter ; /* -- S=r*omega/speed */
double g ; /* M/s2 Gravitational acceleration */
double g ; /* m/s2 Gravitational acceleration */
/* Coefficients drag, lift and cross */
Lift_Estimation_Method lift_method ; /* -- How to find lift force */

View File

@ -1,10 +1,9 @@
/*********************************** TRICK HEADER **************************
PURPOSE: (Test Baseball)
/****************************** TRICK HEADER ******************************
PURPOSE: (Cannon_aero Prototypes)
Tutorial Section 8
***************************************************************************/
#ifndef CANNON_AERO_PROTO_H
#define CANNON_AERO_PROTO_H
#include "cannon_aero.h"
#ifdef __cplusplus

View File

@ -1,12 +1,12 @@
/*********************************************************
/****************************** TRICK HEADER ******************************
PURPOSE: (Set the default data values)
LIBRARY_DEPENDENCY: ((cannon_aero_default_data.o))
*********************************************************/
Tutorial Section 8
***************************************************************************/
#include "../include/cannon_aero_proto.h"
#include "../include/cannon_aero.h"
int cannon_aero_default_data(CANNON_AERO* C) {
int cannon_aero_default_data(CANNON_AERO* C)
{
double const newton = 4.44822162 ;
/* Initialize cannon ball shot */
@ -22,7 +22,6 @@ int cannon_aero_default_data(CANNON_AERO* C)
/* Regula Falsi impact critter setup */
#define BIG_TGO 10000
C->rf.lower_set = No ;
C->rf.upper_set = No ;
C->rf.iterations = 0 ;

View File

@ -1,12 +1,12 @@
/*********************************** TRICK HEADER **************************
PURPOSE: (Collect all forces and calculate acceleration)
/****************************** TRICK HEADER ******************************
PURPOSE: (Collect all forces and calculate acceleration)
Tutorial Section 8
***************************************************************************/
#include "../include/cannon_aero.h"
#include "../include/cannon_aero_proto.h"
#include "sim_services/include/collect_macros.h"
int cannon_collect_forces(
CANNON_AERO *C )
{
int cannon_collect_forces( CANNON_AERO *C ) {
double **collected_forces ;
int ii ;

View File

@ -1,12 +1,12 @@
/*********************************** TRICK HEADER **************************
PURPOSE: (Cross Force or Side Force )
/****************************** TRICK HEADER ******************************
PURPOSE: (Cross Force or Side Force )
Tutorial Section 8
***************************************************************************/
#include "../include/cannon_aero.h"
#include "../include/cannon_aero_proto.h"
#include "trick_utils/math/include/trick_math.h"
int cannon_force_cross(
CANNON_AERO *C )
{
int cannon_force_cross( CANNON_AERO *C ) {
double magnus_cross_drag[3] ;
double norm_magnus_cross_drag[3] ;
double k, speed ;

View File

@ -1,12 +1,12 @@
/*********************************** TRICK HEADER **************************
PURPOSE: (Drag force)
/****************************** TRICK HEADER ******************************
PURPOSE: (Drag force)
Tutorial Section 8
***************************************************************************/
#include "../include/cannon_aero.h"
#include "../include/cannon_aero_proto.h"
#include "trick_utils/math/include/trick_math.h"
int cannon_force_drag(
CANNON_AERO *C )
{
int cannon_force_drag( CANNON_AERO *C ) {
double k ;
double speed ;

View File

@ -1,7 +1,8 @@
/*********************************** TRICK HEADER **************************
PURPOSE: ( Gravitational force on cannonball )
/****************************** TRICK HEADER ******************************
PURPOSE: (Gravitational force on cannonball)
Tutorial Section 8
***************************************************************************/
#include "../include/cannon_aero.h"
#include "../include/cannon_aero_proto.h"
int cannon_force_gravity(
CANNON_AERO *C )

View File

@ -1,12 +1,12 @@
/*********************************** TRICK HEADER **************************
PURPOSE: (Lift-Magnus Force)
/****************************** TRICK HEADER ******************************
PURPOSE: (Lift-Magnus Force)
Tutorial Section 8
***************************************************************************/
#include "../include/cannon_aero.h"
#include "../include/cannon_aero_proto.h"
#include "trick_utils/math/include/trick_math.h"
int cannon_force_lift(
CANNON_AERO *C )
{
int cannon_force_lift( CANNON_AERO *C ) {
double w_cross_v[3] ; double norm_w_cross_v[3] ;
double k, speed ;

View File

@ -1,8 +1,10 @@
/*********************************** TRICK HEADER **************************
PURPOSE: (Kaboom!!!)
/****************************** TRICK HEADER ******************************
PURPOSE: (Kaboom!!!)
PURPOSE: ()
Tutorial Section 8
***************************************************************************/
#include <stdio.h>
#include "../include/cannon_aero.h"
#include "../include/cannon_aero_proto.h"
#include "sim_services/Integrator/include/integrator_c_intf.h"
double cannon_impact_aero( CANNON_AERO* C)

View File

@ -1,15 +1,13 @@
/*********************************** TRICK HEADER **************************
PURPOSE: ( Cannon initialization )
/****************************** TRICK HEADER ******************************
PURPOSE: ( Cannon initialization )
Tutorial Section 8
***************************************************************************/
#include <math.h>
#include <stdio.h>
#include "../include/cannon_aero.h"
#include "../include/cannon_aero_proto.h"
#include "trick_utils/math/include/trick_math.h"
int cannon_init_aero(
CANNON_AERO* C)
{
int cannon_init_aero( CANNON_AERO* C) {
/* Convert omega from spherical (almost) to rectangular */
C->omega[0] = C->omega0*sin(M_PI/2.0 - C->phi)*cos(C->theta) ;
C->omega[1] = C->omega0*sin(M_PI/2.0 - C->phi)*sin(C->theta) ;

View File

@ -1,10 +1,10 @@
/*********************************** TRICK HEADER **************************
PURPOSE: (Cannon integration)
/****************************** TRICK HEADER ******************************
PURPOSE: (Cannon integration)
Tutorial Section 8
***************************************************************************/
#include <stdio.h>
#include "sim_services/Integrator/include/integrator_c_intf.h"
#include "../include/cannon_aero.h"
#include "../include/cannon_aero_proto.h"
int cannon_integ_aero(
CANNON_AERO* C)