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

View File

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

View File

@ -1,12 +1,12 @@
/********************************************************* /****************************** TRICK HEADER ******************************
PURPOSE: (Set the default data values) PURPOSE: (Set the default data values)
LIBRARY_DEPENDENCY: ((cannon_aero_default_data.o)) 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 ; double const newton = 4.44822162 ;
/* Initialize cannon ball shot */ /* Initialize cannon ball shot */
@ -22,7 +22,6 @@ int cannon_aero_default_data(CANNON_AERO* C)
/* Regula Falsi impact critter setup */ /* Regula Falsi impact critter setup */
#define BIG_TGO 10000
C->rf.lower_set = No ; C->rf.lower_set = No ;
C->rf.upper_set = No ; C->rf.upper_set = No ;
C->rf.iterations = 0 ; C->rf.iterations = 0 ;

View File

@ -1,12 +1,12 @@
/*********************************** TRICK HEADER ************************** /****************************** TRICK HEADER ******************************
PURPOSE: (Collect all forces and calculate acceleration) 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" #include "sim_services/include/collect_macros.h"
int cannon_collect_forces( int cannon_collect_forces( CANNON_AERO *C ) {
CANNON_AERO *C )
{
double **collected_forces ; double **collected_forces ;
int ii ; int ii ;

View File

@ -1,12 +1,12 @@
/*********************************** TRICK HEADER ************************** /****************************** TRICK HEADER ******************************
PURPOSE: (Cross Force or Side Force ) 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" #include "trick_utils/math/include/trick_math.h"
int cannon_force_cross( int cannon_force_cross( CANNON_AERO *C ) {
CANNON_AERO *C )
{
double magnus_cross_drag[3] ; double magnus_cross_drag[3] ;
double norm_magnus_cross_drag[3] ; double norm_magnus_cross_drag[3] ;
double k, speed ; double k, speed ;

View File

@ -1,12 +1,12 @@
/*********************************** TRICK HEADER ************************** /****************************** TRICK HEADER ******************************
PURPOSE: (Drag force) 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" #include "trick_utils/math/include/trick_math.h"
int cannon_force_drag( int cannon_force_drag( CANNON_AERO *C ) {
CANNON_AERO *C )
{
double k ; double k ;
double speed ; double speed ;

View File

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

View File

@ -1,12 +1,12 @@
/*********************************** TRICK HEADER ************************** /****************************** TRICK HEADER ******************************
PURPOSE: (Lift-Magnus Force) 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" #include "trick_utils/math/include/trick_math.h"
int cannon_force_lift( int cannon_force_lift( CANNON_AERO *C ) {
CANNON_AERO *C )
{
double w_cross_v[3] ; double norm_w_cross_v[3] ; double w_cross_v[3] ; double norm_w_cross_v[3] ;
double k, speed ; double k, speed ;

View File

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

View File

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

View File

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