Split test sims and fun sims into separate directories.

removing trick_model code that does not belong to any sim.

refs #191
This commit is contained in:
Alex Lin 2016-04-15 08:30:07 -05:00
parent c4df54e53e
commit 6dcfed6215
26 changed files with 0 additions and 1669 deletions

View File

@ -1,83 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(Simple taget body tagetting information.)
REFERENCES:
((None))
ASSUMPTIONS AND LIMITATIONS:
((Purely Keplerian dynamics.))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
#ifndef TARGET_BODY_H
#define TARGET_BODY_H
#ifdef __cplusplus
extern "C" {
#endif
/* Target Body initialization parameters. */
typedef struct { /* TargetBodyPlanet ------------------------------------ */
double mu; /* (m3/s2) Planetary gravitational constant. */
} TargetBodyPlanet; /* -------------------------------------------------- */
/* Target Body initialization parameters. */
typedef struct { /* TargetBodyInit -------------------------------------- */
double position[3]; /* (m) Position vector of the target body. */
double velocity[3]; /* (m/s) Velocity vector of the target body. */
} TargetBodyInit; /* ---------------------------------------------------- */
/* Target Body state parameters. */
typedef struct { /* TargetBodyState -------------------------------------- */
double position[3]; /* (m) Position vector of the target body. */
double velocity[3]; /* (m/s) Velocity vector of the target body. */
double acceleration[3]; /* (m/s2) Acceleration vector of the target body. */
} TargetBodyState; /* ---------------------------------------------------- */
/* Target Body itereation parameters. */
typedef struct { /* TargetBodyIteration --------------------------------- */
int iter_max; /* cnt Maximum number of iterations allowed. */
int iter_cnt; /* cnt Iteration count. */
double tolerance; /* (m) Tolerance for iteration converence. */
double v_init[3]; /* (m/s) Initial velocity for this iteration. */
double delta_r[3]; /* (m) Vector distance from the target location. */
double delta_r_mag; /* (m) Total distance from the target location. */
double delta_v[3]; /* (m/s) Change in initial velocity for targeting. */
} TargetBodyIteration; /* ----------------------------------------------- */
/* Target Body data parameters. */
typedef struct { /* TargetBodyData -------------------------------------- */
double position[3]; /* (m) Vector to target position. */
double phi[6][6]; /* -- State transition matrix. */
double phidot[6][6]; /* -- State transition matrix time derivative. */
double F[6][6]; /* -- Working area. */
double Gmat[3][3]; /* -- Working area. */
} TargetBodyData; /* ---------------------------------------------------- */
#ifdef __cplusplus
}
#endif
#endif /* _TARGET_BODY_H_ : Do NOT put anything after this line! */

View File

@ -1,43 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(Simple taget body tagetting information.)
REFERENCES:
((None))
ASSUMPTIONS AND LIMITATIONS:
((Purely Keplerian dynamics.))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
#ifndef TARGET_PROTO_H
#define TARGET_PROTO_H
#include "target_body.h"
#include "trick_utils/comm/include/tc_proto.h"
#ifdef __cplusplus
extern "C" {
#endif
int target_data_default_data(TargetBodyData*);
int target_delta_v(TargetBodyState*, TargetBodyData*, TargetBodyIteration*);
int target_earth_default_data(TargetBodyPlanet*);
void target_eom(TargetBodyPlanet*, TargetBodyState*, TargetBodyData*);
int target_integ(TargetBodyState*, TargetBodyData*);
int target_iterate_default_data(TargetBodyIteration*);
int target_master_init(TargetBodyIteration*);
int target_master_post(TCDevice*, TargetBodyInit*, TargetBodyState*, TargetBodyData*, TargetBodyIteration*);
int target_master_pre(TargetBodyInit*, TargetBodyState*, TargetBodyData*, TargetBodyIteration*);
int target_master_shutdown(TCDevice*, TargetBodyData*, TargetBodyIteration*);
void target_print(double, TargetBodyInit*, TargetBodyState*, TargetBodyIteration*);
int target_slave_init(TargetBodyIteration*);
int target_slave_post(TCDevice*, TargetBodyInit*, TargetBodyState*, TargetBodyData*, TargetBodyIteration*);
int target_slave_pre(TargetBodyInit*, TargetBodyState*, TargetBodyData*, TargetBodyIteration*);
int target_slave_shutdown(TCDevice*, TargetBodyData*);
void target_state_init(TargetBodyInit*, TargetBodyPlanet*, TargetBodyState*);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,28 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(Target body targeting parameter default initialization data.)
REFERENCE:
(((Bailey, R.W, and Paddock, E.J.)
(Trick Simulation Environment) (NASA:JSC #37943)
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
(March 1997)))
ASSUMPTIONS AND LIMITATIONS:
((Keplerian dynamics)
(Simplified state transition matrix.))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA JSC ER7) (Nov 2009) (--) (Tareget body init.)))
*******************************************************************************/
#include "../include/target_body.h"
int target_data_default_data(TargetBodyData* target_data) {
int iinc;
int jinc;
/* Initialize the state transition matrix to identity. */
for (iinc = 0 ; iinc < 6 ; iinc++ ) {
for (jinc = 0 ; jinc < 6 ; jinc++ ) {
target_data->phi[iinc][jinc] = 0.0;
}
target_data->phi[iinc][iinc] = 1.0;
}
return(0);
}

View File

@ -1,68 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(This routine computes the change in delta-V required to adjust the
initial velocity to hit the targeted position.)
REFERENCE:
(((None)))
ASSUMPTIONS AND LIMITATIONS:
((Many.))
CLASS:
(shutdown)
LIBRARY DEPENDENCY:
((target_delta_v.o))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
/* System includes. */
#include <stdio.h>
/* Trick includes. */
#include "trick_utils/math/include/trick_math.h"
#include "sim_services/include/exec_proto.h"
/* Model includes */
#include "../include/target_body.h"
/* ENTRY POINT */
int
target_delta_v( /* RETURN: -- 0 - OK, 1 - Error. */
TargetBodyState * state, /* INOUT: -- Target body state data. */
TargetBodyData * data, /* INOUT: -- Targetting data. */
TargetBodyIteration * iterate ) /* INOUT: -- Iteration control data. */
{
int iinc, jinc;
double phi_12[3][3];
double phi_12_inv[3][3];
/* Compute the final distance from the desired target position. */
V_SUB( iterate->delta_r, data->position, state->position );
iterate->delta_r_mag = V_MAG( iterate->delta_r );
/*
* Calculate required change in initial velocity.
*/
/* Extract the portion of the STM that we need. */
for ( iinc = 0 ; iinc < 3 ; iinc++ ) {
for ( jinc = 0 ; jinc < 3 ; jinc++ ) {
phi_12[iinc][jinc] = data->phi[iinc][jinc+3];
}
}
/* Invert the portion of the STM. */
if ( dm_invert( phi_12_inv, phi_12 ) != TM_SUCCESS ) {
printf( "File: \"%s\": STM has zero determinate!\n\n", __FILE__ );
exec_terminate( __FILE__, "STM has zero determinate!" );
return( 1 );
}
/* Compute the required change in velocity. */
MxV( iterate->delta_v, phi_12_inv, iterate->delta_r );
/* Return to calling function. */
return( 0 );
}

View File

@ -1,20 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(Target planet model parameter default initialization data.)
REFERENCE:
(((Bailey, R.W, and Paddock, E.J.)
(Trick Simulation Environment) (NASA:JSC #37943)
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
(March 1997)))
ASSUMPTIONS AND LIMITATIONS:
((Simple spherical Newtonian body.))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA JSC ER7) (Nov 2009) (--) (Target planet init.)))
*******************************************************************************/
#include "../include/target_body.h"
int target_earth_default_data(TargetBodyPlanet* target_planet) {
/* Set the planetary gravitational constant. */
target_planet->mu = 3.986012e5 * 1000000000;
return(0);
}

View File

@ -1,102 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(This routine computes the derivatives for the propagation of both the
body state and the targeting state transition matrix.)
REFERENCE:
(((None)))
ASSUMPTIONS AND LIMITATIONS:
((Dynamics are purely Keplerian.))
CLASS:
(derivative)
LIBRARY DEPENDENCY:
((target_eom.o))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
/* System includes. */
/* Trick includes. */
//#include "sim_services/include/integrator.h"
#include "trick_utils/math/include/trick_math.h"
/* Model includes */
#include "../include/target_body.h"
/* ENTRY POINT */
void
target_eom( /* RETURN: -- None. */
TargetBodyPlanet * planet, /* INOUT: -- Target planet data. */
TargetBodyState * state, /* INOUT: -- Target body state data. */
TargetBodyData * data ) /* INOUT: -- Targetting data. */
{
int iinc, jinc, kinc;
double r_mag;
double r_3, r_5;
double outer[3][3];
double mu = planet->mu;
/* Compute the current radial distance. */
r_mag = V_MAG( state->position );
r_3 = r_mag * r_mag * r_mag;
r_5 = r_3 * r_mag * r_mag;
/*
* Compute the time derivative of the state (acceleration).
*/
V_SCALE( state->acceleration, state->position, (-mu / r_3) );
/*
* Compute the time derivative of the state transition matrix.
*/
/* Compute the G matrix. */
M_INIT( data->Gmat );
for ( iinc = 0 ; iinc < 3 ; iinc++ ) {
data->Gmat[iinc][iinc] = -mu / r_3;
}
V_OUTER( outer, state->position );
MxSCALAR( outer, outer, ((3.0*mu)/r_5) );
M_ADD( data->Gmat, data->Gmat, outer );
/* Compute/compose the F matrix. */
/* Upper left hand quadrant (zeros). */
for ( iinc = 0 ; iinc < 3 ; iinc++ ) {
for ( jinc = 0 ; jinc < 3 ; jinc++ ) {
data->F[iinc][jinc] = 0.0;
}
}
/* Upper right hand quadrant (identity). */
for ( iinc = 0 ; iinc < 3 ; iinc++ ) {
for ( jinc = 3 ; jinc < 6 ; jinc++ ) {
data->F[iinc][jinc] = 0.0;
}
data->F[iinc][iinc+3] = 1.0;
}
/* Lower left hand quadrant (Gmat). */
for ( iinc = 3 ; iinc < 6 ; iinc++ ) {
for ( jinc = 0 ; jinc < 3 ; jinc++ ) {
data->F[iinc][jinc] = data->Gmat[iinc-3][jinc];
}
}
/* Lower right hand quadrant (zeros). */
for ( iinc = 3 ; iinc < 6 ; iinc++ ) {
for ( jinc = 3 ; jinc < 6 ; jinc++ ) {
data->F[iinc][jinc] = 0.0;
}
}
/* Compute the time derivative of the state transition matrix. */
for ( iinc = 0 ; iinc < 6 ; iinc++ ) {
for ( jinc = 0 ; jinc < 6 ; jinc++ ) {
data->phidot[iinc][jinc] = 0.0;
for ( kinc = 0 ; kinc < 6 ; kinc++ ) {
data->phidot[iinc][jinc] += data->F[iinc][kinc] * data->phi[kinc][jinc];
}
}
}
return;
}

View File

@ -1,179 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(This routine loads and calls the Trick integration routine to propagate
both the target body state and the state transition matrix.)
REFERENCE:
(((None)))
ASSUMPTIONS AND LIMITATIONS:
((Many.))
CLASS:
(integration)
LIBRARY DEPENDENCY:
((target_integ.o))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
/* System includes. */
/* Trick includes. */
#include "sim_services/Integrator/include/integrator_c_intf.h"
#include "trick_utils/math/include/trick_math.h"
/* Model includes */
#include "../include/target_body.h"
/* ENTRY POINT */
int target_integ( /* RETURN: -- Integration mulit-pass pass id. */
TargetBodyState * body, /* INOUT: -- Target body state data. */
TargetBodyData * data ) /* INOUT: -- Targetting data. */
{
int ipass;
/* Load the states and derivatives. */
load_state(
&body->position[0],
&body->position[1],
&body->position[2],
&body->velocity[0],
&body->velocity[1],
&body->velocity[2],
&data->phi[0][0],
&data->phi[0][1],
&data->phi[0][2],
&data->phi[0][3],
&data->phi[0][4],
&data->phi[0][5],
&data->phi[1][0],
&data->phi[1][1],
&data->phi[1][2],
&data->phi[1][3],
&data->phi[1][4],
&data->phi[1][5],
&data->phi[2][0],
&data->phi[2][1],
&data->phi[2][2],
&data->phi[2][3],
&data->phi[2][4],
&data->phi[2][5],
&data->phi[3][0],
&data->phi[3][1],
&data->phi[3][2],
&data->phi[3][3],
&data->phi[3][4],
&data->phi[3][5],
&data->phi[4][0],
&data->phi[4][1],
&data->phi[4][2],
&data->phi[4][3],
&data->phi[4][4],
&data->phi[4][5],
&data->phi[5][0],
&data->phi[5][1],
&data->phi[5][2],
&data->phi[5][3],
&data->phi[5][4],
&data->phi[5][5],
NULL
);
load_deriv(
&body->velocity[0],
&body->velocity[1],
&body->velocity[2],
&body->acceleration[0],
&body->acceleration[1],
&body->acceleration[2],
&data->phidot[0][0],
&data->phidot[0][1],
&data->phidot[0][2],
&data->phidot[0][3],
&data->phidot[0][4],
&data->phidot[0][5],
&data->phidot[1][0],
&data->phidot[1][1],
&data->phidot[1][2],
&data->phidot[1][3],
&data->phidot[1][4],
&data->phidot[1][5],
&data->phidot[2][0],
&data->phidot[2][1],
&data->phidot[2][2],
&data->phidot[2][3],
&data->phidot[2][4],
&data->phidot[2][5],
&data->phidot[3][0],
&data->phidot[3][1],
&data->phidot[3][2],
&data->phidot[3][3],
&data->phidot[3][4],
&data->phidot[3][5],
&data->phidot[4][0],
&data->phidot[4][1],
&data->phidot[4][2],
&data->phidot[4][3],
&data->phidot[4][4],
&data->phidot[4][5],
&data->phidot[5][0],
&data->phidot[5][1],
&data->phidot[5][2],
&data->phidot[5][3],
&data->phidot[5][4],
&data->phidot[5][5],
NULL
);
/* Integrate state */
ipass = integrate();
/* Unload integrated state array. */
unload_state(
&body->position[0],
&body->position[1],
&body->position[2],
&body->velocity[0],
&body->velocity[1],
&body->velocity[2],
&data->phi[0][0],
&data->phi[0][1],
&data->phi[0][2],
&data->phi[0][3],
&data->phi[0][4],
&data->phi[0][5],
&data->phi[1][0],
&data->phi[1][1],
&data->phi[1][2],
&data->phi[1][3],
&data->phi[1][4],
&data->phi[1][5],
&data->phi[2][0],
&data->phi[2][1],
&data->phi[2][2],
&data->phi[2][3],
&data->phi[2][4],
&data->phi[2][5],
&data->phi[3][0],
&data->phi[3][1],
&data->phi[3][2],
&data->phi[3][3],
&data->phi[3][4],
&data->phi[3][5],
&data->phi[4][0],
&data->phi[4][1],
&data->phi[4][2],
&data->phi[4][3],
&data->phi[4][4],
&data->phi[4][5],
&data->phi[5][0],
&data->phi[5][1],
&data->phi[5][2],
&data->phi[5][3],
&data->phi[5][4],
&data->phi[5][5],
NULL
);
/* Return the integration step. */
return ipass;
}

View File

@ -1,27 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(Target body iteration parameter default initialization data.)
REFERENCE:
(((Bailey, R.W, and Paddock, E.J.)
(Trick Simulation Environment) (NASA:JSC #37943)
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
(March 1997)))
ASSUMPTIONS AND LIMITATIONS:
((Keplerian dynamics)
(Simplified state transition matrix.))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA JSC ER7) (Nov 2009) (--) (Tareget body init.)))
*******************************************************************************/
#include "../include/target_body.h"
int target_iterate_default_data(TargetBodyIteration* iterate_data) {
/* Set the default itertion variables. */
iterate_data->iter_max = 100;
iterate_data->iter_cnt = 0;
iterate_data->tolerance = 1.0e-3;
/* Clear the computed change in velocity. */
iterate_data->delta_v[0] = 0.0, 0.0, 0.0;
return(0);
}

View File

@ -1,35 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(This routine initializes the targeting iteration loop on the Master side
of the simulation.)
REFERENCE:
(((None)))
ASSUMPTIONS AND LIMITATIONS:
((Many.))
CLASS:
(monte_master_init)
LIBRARY DEPENDENCY:
((target_master_init.o))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
/* System includes. */
/* Trick includes. */
#include "sim_services/include/exec_proto.h"
/* Model includes */
#include "../include/target_body.h"
/* ENTRY POINT */
int
target_master_init( /* RETURN: -- Always returns zero. */
TargetBodyIteration * iterate ) /* INOUT: -- Iteration control data. */
{
/* Return to calling function. */
return( 0 );
}

View File

@ -1,127 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(This routine runs at the end of each targeting iteration loop on the
Master side of the simulation.)
REFERENCE:
(((None)))
ASSUMPTIONS AND LIMITATIONS:
((Many.))
CLASS:
(monte_master_post)
LIBRARY DEPENDENCY:
((target_master_post.o))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
/* System includes. */
#include <stdio.h>
/* Trick includes. */
#include "sim_services/MonteCarlo/include/montecarlo_c_intf.h"
#include "sim_services/UnitTest/include/trick_tests.h"
#include "trick_utils/comm/include/tc_proto.h"
#include "trick_utils/math/include/vector_macros.h"
/* Model includes */
#include "../include/target_body.h"
/* ENTRY POINT */
int target_master_post(
TCDevice* tc_dev,
TargetBodyInit* init,
TargetBodyState* state,
TargetBodyData* data,
TargetBodyIteration* iterate )
{
char message[128];
TargetBodyIteration iter_ret;
printf("\e[33mtarget_master_post\(\)\e[00m\n");
/* Read slave's results */
tc_read( mc_get_connection_device(), (char*)&iter_ret, sizeof(TargetBodyIteration) );
/* Copy iteration data. */
iterate->delta_r_mag = iter_ret.delta_r_mag;
V_COPY( iterate->delta_r, iter_ret.delta_r );
V_COPY( iterate->delta_v, iter_ret.delta_v );
V_COPY( iterate->v_init, iter_ret.v_init );
/* Increment the iteration count. */
iterate->iter_cnt++;
/* Check for convergence. */
if ( iterate->delta_r_mag < iterate->tolerance ) {
/* The below if-else block is for Hudson testing to verify
the correct number of runs occurs before termination */
if (mc_get_current_run() == 5) {
add_test_result("SIM_target Simulation", "MonteCarlo Optimization", "");
} else {
add_test_result("SIM_target Simulation", "MonteCarlo Optimization", "Should be 5 runs");
}
trick_test_add_parent("SIM_target Simulation", "MonteCarlo Optimization", "2014948908");
call_write_output() ;
sprintf( message,
"Iteration loop (%d) converged with Delta r_mag = %g\n",
iterate->iter_cnt, iterate->delta_r_mag );
exec_terminate( __FILE__, message );
}
/* Check to see if the maximum iteration count is exceeded. */
if ( iterate->iter_cnt >= iterate->iter_max ) {
sprintf( message,
"Iteration loop count limit (%d) exceeded.\n",
iterate->iter_cnt );
exec_terminate( __FILE__, message );
}
/* Let's print out some debug information. */
printf( "-----------------------------------------\n" );
printf( "Initial Position: x = %f km\n",
state->position[0]/1000.0 );
printf( " y = %f km\n",
state->position[1]/1000.0 );
printf( " z = %f km\n\n",
state->position[2]/1000.0 );
printf( "Initial Velocity: x = %f km/s\n",
state->velocity[0]/1000.0 );
printf( " y = %f km/s\n",
state->velocity[1]/1000.0 );
printf( " z = %f km/s\n\n",
state->velocity[2]/1000.0 );
printf( "Distance from Target: = %f km\n\n",
iterate->delta_r_mag/1000.0 );
printf( "Delta r: x = %f km\n",
iterate->delta_r[0]/1000.0 );
printf( " y = %f km\n",
iterate->delta_r[1]/1000.0 );
printf( " z = %f km\n\n",
iterate->delta_r[2]/1000.0 );
printf( "Delta V: x = %f km/s\n",
iterate->delta_v[0]/1000.0 );
printf( " y = %f km/s\n",
iterate->delta_v[1]/1000.0 );
printf( " z = %f km/s\n\n",
iterate->delta_v[2]/1000.0 );
/* Since we're here, we must need another iteration. */
/* So, we compute the new initial velocity. */
V_ADD( state->velocity, iterate->v_init, iterate->delta_v );
printf( "New Velocity: x = %.10f km/s\n",
state->velocity[0]/1000.0 );
printf( " y = %.10f km/s\n",
state->velocity[1]/1000.0 );
printf( " z = %.10f km/s\n\n",
state->velocity[2]/1000.0 );
printf( "-----------------------------------------\n");
/* Return to calling function. */
return( 0 );
}

View File

@ -1,48 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(This routine runs at the begining of each targeting iteration loop on the
Master side of the simulation.)
REFERENCE:
(((None)))
ASSUMPTIONS AND LIMITATIONS:
((Many.))
CLASS:
(monte_master_pre)
LIBRARY DEPENDENCY:
((target_master_pre.o))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
/* System includes. */
#include <stdio.h>
/* Trick includes. */
#include "sim_services/include/exec_proto.h"
#include "trick_utils/math/include/vector_macros.h"
/* Model includes */
#include "../include/target_body.h"
/* ENTRY POINT */
int
target_master_pre( /* RETURN: -- Always returns zero. */
TargetBodyInit * init, /* INOUT: -- Iteration init data. */
TargetBodyState * state, /* INOUT: -- Iteration state data. */
TargetBodyData * data, /* INOUT: -- Targeting data. */
TargetBodyIteration * iterate ) /* INOUT: -- Iteration control data. */
{
printf("\e[33mtarget_master_pre\(\)\e[00m\n");
printf( "Initial Velocity: x = %f km/s\n",
state->velocity[0]/1000.0 );
printf( " y = %f km/s\n",
state->velocity[1]/1000.0 );
printf( " z = %f km/s\n\n",
state->velocity[2]/1000.0 );
/* Return to calling function. */
return( 0 );
}

View File

@ -1,35 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(This routine runs are the end of the targeting iteration sequence on the
Master side of the simulation.)
REFERENCE:
(((None)))
ASSUMPTIONS AND LIMITATIONS:
((Many.))
CLASS:
(monte_master_shutdown)
LIBRARY DEPENDENCY:
((target_master_shutdown.o))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
/* System includes. */
/* Trick includes. */
//#include "sim_services/include/exec_proto.h"
#include "sim_services/MonteCarlo/include/montecarlo_c_intf.h"
/* Model includes */
#include "../include/target_body.h"
#include "trick_utils/comm/include/tc_proto.h"
/* ENTRY POINT */
int target_master_shutdown( TCDevice *tc_dev, TargetBodyData *data, TargetBodyIteration *iterate)
{
printf("\e[33mtarget_master_shutdown current_run=%d\(\)\e[00m\n",mc_get_current_run());
/* Return to calling function. */
return( 0 );
}

View File

@ -1,72 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(This routine prints out final target information at shutdown.)
REFERENCE:
(((None)))
ASSUMPTIONS AND LIMITATIONS:
((Many.))
CLASS:
(shutdown)
LIBRARY DEPENDENCY:
((target_print.o))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
/* System includes. */
#include <stdio.h>
/* Trick includes. */
/* Model includes */
#include "../include/target_body.h"
/* ENTRY POINT */
void
target_print( /* RETURN: -- None. */
double time, /* IN: -- Final time of flight. */
TargetBodyInit * init, /* IN: -- Target body initializtion data. */
TargetBodyState * state, /* IN: -- Target body state data. */
TargetBodyIteration * data ) /* IN: -- Targetting data. */
{
printf( "-----------------------------------------\n" );
printf( "Initial Position: x = %f km\n",
init->position[0]/1000.0 );
printf( " y = %f km\n",
init->position[1]/1000.0 );
printf( " z = %f km\n\n",
init->position[2]/1000.0 );
printf( "Initial Velocity: x = %f km/s\n",
init->velocity[0]/1000.0 );
printf( " y = %f km/s\n",
init->velocity[1]/1000.0 );
printf( " z = %f km/s\n\n",
init->velocity[2]/1000.0 );
printf( "Final Position: x = %f km\n",
state->position[0]/1000.0 );
printf( " y = %f km\n",
state->position[1]/1000.0 );
printf( " z = %f km\n\n",
state->position[2]/1000.0 );
printf( "Distance from Target: = %f km\n\n",
data->delta_r_mag/1000.0 );
printf( "Delta V: x = %f km/s\n",
data->delta_v[0]/1000.0 );
printf( " y = %f km/s\n",
data->delta_v[1]/1000.0 );
printf( " z = %f km/s\n\n",
data->delta_v[2]/1000.0 );
printf( "New Velocity: x = %.10f km/s\n",
(init->velocity[0]+data->delta_v[0])/1000.0 );
printf( " y = %.10f km/s\n",
(init->velocity[1]+data->delta_v[1])/1000.0 );
printf( " z = %.10f km/s\n\n",
(init->velocity[2]+data->delta_v[2])/1000.0 );
printf( "Time of Flight: = %f s\n", time );
printf( "-----------------------------------------\n");
/* Return to calling function. */
return;
}

View File

@ -1,33 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(This routine initializes the targeting iteration loop on the Slave side
of the simulation.)
REFERENCE:
(((None)))
ASSUMPTIONS AND LIMITATIONS:
((Many.))
CLASS:
(monte_slave_init)
LIBRARY DEPENDENCY:
((target_slave_init.o))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
/* System includes. */
/* Trick includes. */
#include "sim_services/include/exec_proto.h"
/* Model includes */
#include "../include/target_body.h"
/* ENTRY POINT */
int
target_slave_init( /* RETURN: -- Always returns zero. */
TargetBodyIteration * iterate ) /* INOUT: -- Iteration control data. */
{
/* Return to calling function. */
return( 0 );
}

View File

@ -1,51 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(This routine computes the change in delta-V required to adjust the
initial velocity to hit the targeted position.)
REFERENCE:
(((None)))
ASSUMPTIONS AND LIMITATIONS:
((Many.))
CLASS:
(monte_slave_post)
LIBRARY DEPENDENCY:
((target_slave_post.o)
(target_delta_v.o))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
/* System includes. */
/* Trick includes. */
#include "trick_utils/comm/include/tc_proto.h"
#include "sim_services/MonteCarlo/include/montecarlo_c_intf.h"
#include "trick_utils/math/include/vector_macros.h"
/* Model includes */
#include "../include/target_body.h"
/* ENTRY POINT */
int
target_slave_post( /* RETURN: -- 0 - OK, 1 - Error. */
TCDevice * tc_dev, /* INOUT: -- Iteration comm device. */
TargetBodyInit * init, /* INOUT: -- Target init state data. */
TargetBodyState * state, /* INOUT: -- Target body state data. */
TargetBodyData * target, /* INOUT: -- Targetting data. */
TargetBodyIteration * iterate ) /* INOUT: -- Iteration control data. */
{
int dv_ret;
/* Copy the initial state. */
V_COPY( iterate->v_init, init->velocity );
/* Call the delta-V computation. */
dv_ret = target_delta_v( state, target, iterate );
/* Send F(x) - which is in TargetBodyIteration. */
tc_write( mc_get_connection_device(), (char*)iterate, sizeof(TargetBodyIteration) );
/* Return to calling function. */
return( dv_ret );
}

View File

@ -1,45 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(This routine runs at the begining of each targeting iteration loop on the
Slave side of the simulation.)
REFERENCE:
(((None)))
ASSUMPTIONS AND LIMITATIONS:
((Many.))
CLASS:
(monte_slave_pre)
LIBRARY DEPENDENCY:
((target_slave_pre.o))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
/* System includes. */
#include <stdio.h>
/* Trick includes. */
#include "sim_services/include/exec_proto.h"
/* Model includes */
#include "../include/target_body.h"
/* ENTRY POINT */
int
target_slave_pre( /* RETURN: -- Always returns zero. */
TargetBodyInit * init, /* INOUT: -- Target init state data. */
TargetBodyState * state, /* INOUT: -- Target body state data. */
TargetBodyData * data, /* INOUT: -- Targeting data. */
TargetBodyIteration * iterate ) /* INOUT: -- Iteration control data. */
{
printf( "Initial Velocity: x = %f km/s\n",
state->velocity[0]/1000.0 );
printf( " y = %f km/s\n",
state->velocity[1]/1000.0 );
printf( " z = %f km/s\n\n",
state->velocity[2]/1000.0 );
/* Return to calling function. */
return( 0 );
}

View File

@ -1,34 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(This routine runs are the end of the targeting iteration sequence on the
Slave side of the simulation.)
REFERENCE:
(((None)))
ASSUMPTIONS AND LIMITATIONS:
((Many.))
CLASS:
(monte_slave_shutdown)
LIBRARY DEPENDENCY:
((target_slave_shutdown.o))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
/* System includes. */
/* Trick includes. */
#include "trick_utils/comm/include/tc_proto.h"
/* Model includes */
#include "../include/target_body.h"
/* ENTRY POINT */
int
target_slave_shutdown( /* RETURN: -- Always returns zero. */
TCDevice * tc_dev, /* INOUT: -- Iteration comm device. */
TargetBodyData * data ) /* INOUT: -- Targetting data. */
{
/* Return to calling function. */
return( 0 );
}

View File

@ -1,62 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(This routine initializes the targeting data structure.)
REFERENCE:
(((None)))
ASSUMPTIONS AND LIMITATIONS:
((Many.))
CLASS:
(initialization)
LIBRARY DEPENDENCY:
((target_state_init.o))
PROGRAMMERS:
(((Edwin Z. Crues) (NASA) (Nov 2009) (--) (Initial version.)))
*******************************************************************************/
/* System includes. */
#include <math.h>
#include <stdio.h>
/* Trick includes. */
#include "trick_utils/math/include/trick_math.h"
/* Model includes */
#include "../include/target_body.h"
/* ENTRY POINT */
void
target_state_init( /* RETURN: -- None. */
TargetBodyInit * init, /* IN: -- Target initialization data. */
TargetBodyPlanet * planet, /* INOUT: -- Target planet data. */
TargetBodyState * state ) /* INOUT: -- Target body state data. */
{
double r_mag;
double mu = planet->mu;
/* Copy the initial states into the target state init vectors. */
V_COPY( init->position, state->position );
V_COPY( init->velocity, state->velocity );
/* Just fill in the acceleration as a starting point. */
r_mag = V_MAG( state->position );
V_INIT( state->acceleration );
V_SCALE( state->acceleration, state->position, (-mu/(r_mag*r_mag*r_mag)) );
/* Let's print out some debug information. */
printf( "-----------------------------------------\n" );
printf( "Initial Position: x = %f km\n",
init->position[0]/1000.0 );
printf( " y = %f km\n",
init->position[1]/1000.0 );
printf( " z = %f km\n\n",
init->position[2]/1000.0 );
printf( "Initial Velocity: x = %f km/s\n",
init->velocity[0]/1000.0 );
printf( " y = %f km/s\n",
init->velocity[1]/1000.0 );
printf( " z = %f km/s\n\n",
init->velocity[2]/1000.0 );
return;
}

View File

@ -1,40 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
(Trick test)
REFERENCES:
(((Trick Simulation Environment) (NASA:JSC #37943)
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
(Nov 2001)))
ASSUMPTIONS AND LIMITATIONS:
((None))
PROGRAMMERS:
((Keith Vetter) (LinCom) (November 2001))
*******************************************************************************/
#ifndef TEST_H
#define TEST_H
typedef struct { /* A ------------------------------------------------*/
double d ; /* -- A double */
int i ; /* -- An int */
int j ; /* -- An int */
} A ; /*--------------------------------------------------------------*/
typedef struct { /* B ------------------------------------------------*/
double d ; /* -- A double */
int i ; /* -- An int */
int j ; /* -- An int */
} B ; /*--------------------------------------------------------------*/
typedef struct { /* TEST ---------------------------------------------*/
A a ; /* -- A */
B b ; /* -- B */
} TEST ; /*------------------------------------------------------------*/
#endif

View File

@ -1,32 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
( Testing )
REFERENCE:
(((Trick Simulation Environment) (NASA:JSC #37943)
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
(March 1997)))
ASSUMPTIONS AND LIMITATIONS:
((None))
CLASS:
(scheduled)
LIBRARY DEPENDENCY:
((export_master.o))
PROGRAMMERS:
((Keith Vetter) (LinCom) (November 2001))
*******************************************************************************/
/* GLOBAL DATA STRUCTURE DECLARATIONS */
#include "../include/test.h"
/* ENTRY POINT */
void export_master(
/* RETURN: -- NA */
TEST *T ) /* INOUT: -- TEST */
{
T->a.i++ ;
T->a.d += 0.1 ;
T->b.i-- ;
T->b.d -= 0.1 ;
}

View File

@ -1,31 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
( Testing )
REFERENCE:
(((Trick Simulation Environment) (NASA:JSC #37943)
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
(March 1997)))
ASSUMPTIONS AND LIMITATIONS:
((None))
CLASS:
(scheduled)
LIBRARY DEPENDENCY:
((export_slave.o))
PROGRAMMERS:
((Keith Vetter) (LinCom) (November 2001))
*******************************************************************************/
/* GLOBAL DATA STRUCTURE DECLARATIONS */
#include <stdio.h>
#include "../include/test.h"
/* ENTRY POINT */
void export_slave(
/* RETURN: -- NA */
TEST *T ) /* INOUT: -- TEST */
{
/* Do nothing */
T->a.i = T->a.i ;
}

View File

@ -1,28 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
( Testing )
REFERENCE:
(((Trick Simulation Environment) (NASA:JSC #37943)
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
(March 1997)))
ASSUMPTIONS AND LIMITATIONS:
((None))
CLASS:
(scheduled)
LIBRARY DEPENDENCY:
((import_master.o))
PROGRAMMERS:
((Keith Vetter) (LinCom) (November 2001))
*******************************************************************************/
/* GLOBAL DATA STRUCTURE DECLARATIONS */
#include "../include/test.h"
/* ENTRY POINT */
void import_master(
/* RETURN: -- NA */
TEST *T ) /* INOUT: -- TEST */
{
/* Do nothing */
T->a.i = T->a.i ;
}

View File

@ -1,37 +0,0 @@
/********************************* TRICK HEADER *******************************
PURPOSE:
( Testing )
REFERENCE:
(((Trick Simulation Environment) (NASA:JSC #37943)
(JSC/Engineering Directorate/Automation, Robotics and Simulation Division)
(March 1997)))
ASSUMPTIONS AND LIMITATIONS:
((None))
CLASS:
(scheduled)
LIBRARY DEPENDENCY:
((import_slave.o))
PROGRAMMERS:
((Keith Vetter) (LinCom) (November 2001))
*******************************************************************************/
/* GLOBAL DATA STRUCTURE DECLARATIONS */
#include <stdio.h>
#include "../include/test.h"
/* ENTRY POINT */
void import_slave(
/* RETURN: -- NA */
TEST *T ) /* INOUT: -- TEST */
{
/* Make a saw tooth */
if ( T->a.i > 20 ) {
T->a.i = 0 ;
T->a.d = 0 ;
T->b.i = 0 ;
T->b.d = 0 ;
}
}

View File

@ -1,99 +0,0 @@
/* TRICK HEADER
PURPOSE:
(Test all possible C data types recognized by the Interface Code
Generator and the executive input processor.)
REFERENCE:
(((Bailey, Robert W.)
(User's Guide and Operational Procedures Volume ...
of the Trick Simulation Environment) (MDSS-HD TM-6.24.26-04)
(McDonnell Douglas Space Systems - Houston Division) (March 1993) (--)))
ASSUMPTIONS AND LIMITATIONS:
((Unlimited software array dimensions and sizing)
(Unlimited software dynamically allocated array dimensions and sizing)
(Excessively large structures may overrun hardware memory)
(ICG ignores all compilier directives except '#define')
(ICG ignores all typedef declarations other than 'typedef struct'
and 'typedef enum'))
PROGRAMMERS:
(((Robert W. Bailey) (LinCom) (10/1/90) (Trick-CR-00000) (Initial Release)))
*/
#ifndef IP_C_TYPES_H
#define IP_C_TYPES_H
#define TWO 2 /* THE Value 2 */
typedef struct {
unsigned int bits_a : 5 ; /* -- Test bits 5 */
unsigned int : 2 ; /* -- Test bits 7 */
unsigned int bits_b : 9 ; /* -- Test bits 16 */
unsigned int bits_c : 16 ; /* -- Test bits 32 */
double doub_x ; /* -- Miscellaneous double */
unsigned int bits_d : 7 ; /* -- Test bits */
} BITS ;
typedef struct { /* FUNDAMENTAL 'C' DATA TYPES ----------------------------*/
char c ; /* -- Single character */
unsigned char uc ; /* -- Single unsigned character */
char * cp ; /* -- Single string */
short s ; /* -- Single short integer */
unsigned short us ; /* -- Single unsigned short integer */
int i ; /* -- Integer */
unsigned int ui ; /* -- Single unsigned integer */
long l ; /* -- Single long integer */
unsigned long ul ; /* -- Single unsigned long integer */
float f ; /* -- Single precision floating point value*/
double d ; /* -- Double precision floating point value */
} C_TYPES ; /*----------------------------------------------------------------*/
typedef struct { /* ARRAYS ------------------------------------------------*/
char ca[2][2][2] ; /* -- characters (strings) */
unsigned char uca[2][2][2] ; /* -- unsigned character s*/
short sa[2][2][2] ; /* -- short integers */
unsigned short usa[2][2][2] ; /* -- unsigned short integers */
int ia[2][2][2] ; /* -- integers */
unsigned int uia[2][2][2] ; /* -- unsigned integers */
long la[2][2][2] ; /* -- long integers */
unsigned long ula[2][2][2] ; /* -- unsigned long integers */
float fa[2][2][2] ; /* -- single precision floating point */
double da[2][2][2] ; /* -- double precision floating point */
} C_ARR_TYPES ; /*------------------------------------------------------------*/
typedef struct { /* POINTERS -- UNCONSTRAINED ARRAYS ----------------------*/
char **** cpp ; /* -- strings */
unsigned char *** ucpp ; /* -- unsigned characters */
short *** spp ; /* -- short integers */
unsigned short *** uspp ; /* -- unsigned short integers */
int *** ipp ; /* -- integers */
unsigned int *** uipp ; /* -- unsigned integers */
long *** lpp ; /* -- long integers */
unsigned long *** ulpp ; /* -- unsigned long integers */
float *** fpp ; /* -- single precision floating point */
double *** dpp ; /* -- double precision floating point */
} C_PTR_TYPES ; /*------------------------------------------------------------*/
typedef struct { /* MIXED POINTERS AND ARRAYS -----------------------------*/
char *** cpa[TWO] ; /* -- characters (strings) */
unsigned char ** ucpa[TWO] ; /* -- unsigned characters */
short ** spa[TWO] ; /* -- short integers */
unsigned short ** uspa[TWO] ; /* -- unsigned short integers */
int ** ipa[TWO] ; /* -- integers */
unsigned int ** uipa[TWO] ; /* -- unsigned integers */
long ** lpa[TWO] ; /* -- long integers */
unsigned long ** ulpa[TWO] ; /* -- unsigned long integers */
float ** fpa[TWO] ; /* -- single precision floating points */
double ** dpa[TWO] ; /* -- double precision floating points */
} C_MIX_TYPES ; /*------------------------------------------------------------*/
#endif

View File

@ -1,106 +0,0 @@
/* TRICK HEADER
PURPOSE:
(Test all possible data types recognized by the Interface Code
Generator and the executive input processor.)
REFERENCE:
(((Bailey, Robert W.)
(User's Guide and Operational Procedures Volume ...
of the Trick Simulation Environment) (MDSS-HD TM-6.24.26-04)
(McDonnell Douglas Space Systems - Houston Division) (March 1993) (--)))
ASSUMPTIONS AND LIMITATIONS:
((Unlimited software array dimensions and sizing)
(Unlimited software dynamically allocated array dimensions and sizing)
(Excessively large structures may overrun hardware memory)
(All parameter declarations MUST start in the first column))
PROGRAMMERS:
(((Robert W. Bailey) (LinCom) (10/1/90) (Trick-CR-00000) (Initial Release)))
*/
#ifndef IP_TEST_H
#define IP_TEST_H
/*=== THESE DEFINES ARE PARSED AND USABLE IN ARRAY DIMENSIONS ===*/
#define TWO 2 /* THE Value 2 */
#define TWO2 (1+1) /* THE Value 2 */
#define TWO3 2*1
/*=== THESE DEFINES ARE IGNORED ===*/
#define DUMMY_MACRO1(A,B) A = B + 1
#define DUMMY_MACRO2(A,B) { \
A = B + 1 ; \
B++ ; \
}
/*==== SYSTEM INCLUDES ARE IGNORED ===*/
#include <stdio.h> /* ignored */
#include <sys/time.h> /* ignored */
/*==== USER INCLUDES ARE PARSED AND STORED FOR FUTURE REFERENCE ====*/
#include "ip_c_types.h"
/*==== ALL GLOBAL DECLARATIONS ARE IGNORED ====*/
int * int_function() ; /* ignored */
float real_function( int bogus1 , double *bogus2[] ) ; /* ignored */
/*==== THESE TYPEDEFS ARE IGNORED ===*/
typedef unsigned int Int_Type ; /* ignored */
typedef double* Double_Ptr ;
typedef void (*Void_Func)() ; /* ignored */
typedef enum { /* ENUMERATED TYPES --------------------------------------*/
meter = -2 , /* Meters */
centimeter , /* CentiMeters */
millimeter , /* MilliMeters */
kilometer , /* KiloMeters */
inches = 10 , /* Inches */
feet , /* Feet */
yard , /* Yards */
mile = 5 , /* Miles */
nautical_mile /* Nautical Miles */
} Distance ; /*---------------------------------------------------------------*/
typedef struct { /* MEASUREMENT UNITS_TEST SPECIFICATION -----------------*/
double second[5] ; /* s Measurement units */
double meter[10] ; /* M Measurement units */
double radian[5] ; /* r Measurement units */
double kilogram[6] ; /* kg Measurement units */
double newton[5] ; /* N Measurement units */
double volt[3] ; /* v Measurement units */
double amp[3] ; /* amp Measurement units */
double ohm[2] ; /* ohm Measurement units */
double celsius[4] ; /* C Measurement units */
double fahrenheit[4] ; /* F Measurement units */
double temp_rate[4] ; /* K/s Measurement units */
double area[3] ; /* M2 Measurement units */
double volume[1+1+1] ; /* M3 Measurement units */
double velocity[4-1] ; /* M/s Measurement units */
double velocity_eng[2] ; /* mi/hr Measurement units using non-std units */
double accel[TWO+1] ; /* M/s2 Measurement units */
double inertia[3*1] ; /* kg*M2 Measurement units */
double torque[TWO*2-1] ; /* N*M Measurement units */
double pressure[3] ; /* N/M2 Measurement units */
double density[3] ; /* kg/M3 Measurement units */
Distance measure ; /* -- Distance measurement units */
} UNITS_TEST ; /*-------------------------------------------------------------*/
typedef struct { /* COMPOSITE DATA STRUCTURES ----------------------------*/
BITS bits[TWO] ; /* -- Two bits, four bits, six bits, a $ */
C_TYPES c_types ; /* -- Standard C types */
C_ARR_TYPES c_array_types ; /* -- Arrayed C types */
C_PTR_TYPES c_pointer_types ; /* -- Pointered C types */
C_MIX_TYPES c_mixed_types ; /* -- Mixed arrays and pointer types */
UNITS_TEST **units_test[TWO] ; /* -- Measurement unit test params */
int strings_good ; /* -- 1-good 0-bad */
} IP_TEST ; /*----------------------------------------------------------------*/
#endif

View File

@ -1,204 +0,0 @@
/*
PURPOSE:
(Test the Trick simulation executive 'scheduled' module handling.)
REFERENCE:
(((Bailey, R.W, and Paddock, E.J.)
(Trick Simulation Environment) (NASA:JSC #37943)
(JSC / Engineering Directorate / Automation and Robotics Division)
(Mar 1996) (--)))
ASSUMPTIONS AND LIMITATIONS:
((None))
CLASS:
(scheduled)
LIBRARY DEPENDENCY:
(ip_test.o)
PROGRAMMERS:
(((Robert W. Bailey) (LinCom Corp) (9/1/90) (Trick-CR-00000)
(Initial Release.)))
*/
#include <stdio.h>
#include <stdlib.h>
#include "../include/ip_test.h"
int ip_test(
/* RETURN: -- 0 - Nominal */
IP_TEST * it ) /* INOUT: -- Executive Input/Output test parameters */
{
char test_string[128] ;
char* trick_home ;
/* POINTER SHORTHAND ACCESS */
C_TYPES * C = &(it->c_types) ;
C_ARR_TYPES * CA = &(it->c_array_types) ;
C_PTR_TYPES * CP = &(it->c_pointer_types) ;
C_MIX_TYPES * CM = &(it->c_mixed_types) ;
C->i += 1 ;
C->d += 1.0 ;
CA->sa[0][0][1] += 1 ;
CA->fa[0][1][0] += 1.0 ;
CP->ipp[0][1][0] += 1 ;
CP->dpp[1][0][1] += 1 ;
CM->lpa[1][0][0] += 1 ;
CM->dpa[1][1][0] += 1 ;
trick_home = getenv("TRICK_HOME");
/* Characters */
sprintf( test_string,"%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
CA->ca[0][0][0],
CA->ca[0][0][1],
CA->ca[0][1][0],
CA->ca[0][1][1],
CA->ca[1][0][0],
CA->ca[1][0][1],
CA->ca[1][1][0],
CA->ca[1][1][1],
CA->uca[0][0][0],
CA->uca[0][0][1],
CA->uca[0][1][0],
CA->uca[0][1][1],
CA->uca[1][0][0],
CA->uca[1][0][1],
CA->uca[1][1][0],
CA->uca[1][1][1],
CM->ucpa[0][0][0],
CM->ucpa[0][0][1],
CM->ucpa[0][1][0],
CM->ucpa[0][1][1],
CM->ucpa[1][0][0],
CM->ucpa[1][0][1],
CM->ucpa[1][1][0],
CM->ucpa[1][1][1] ) ;
if ( strcmp( test_string, "abcdefghijklmnopABCDEFGH" ) ) {
fprintf(stderr, "Error_characters: %s \n", test_string);
it->strings_good = 0 ;
}
/* The regular string */
if ( strcmp( C->cp, "Testing Char Pointers.") ) {
if ( strcmp( C->cp, trick_home ) ) {
fprintf(stderr, "Error_character_ptr: %s \n", C->cp);
it->strings_good = 0 ;
}
}
/*
* The character pointers
*/
if ( strcmp( CP->cpp[0][0][0], "I'd" ) ) {
if ( strcmp( CP->cpp[0][0][0], trick_home ) ) {
if ( strcmp(CP->cpp[0][0][0], "Cat") ) {
fprintf(stderr, "Error_p1: %s \n", CP->cpp[0][0][0]);
it->strings_good = 0 ;
}
}
}
if ( strcmp( CP->cpp[0][0][1], "rather" ) ) {
if ( strcmp( CP->cpp[0][0][1], trick_home ) ) {
if ( strcmp(CP->cpp[0][0][1], "Horse") ) {
fprintf(stderr, "Error_p2: %s \n", CP->cpp[0][0][1]);
it->strings_good = 0 ;
}
}
}
if ( strcmp( CP->cpp[0][1][0], "be" ) ) {
if ( strcmp( CP->cpp[0][1][0], trick_home ) ) {
fprintf(stderr, "Error_p3: %s \n", CP->cpp[0][1][0]);
it->strings_good = 0 ;
}
}
if ( strcmp( CP->cpp[0][1][1], "developing" ) ) {
if ( strcmp( CP->cpp[0][1][1], trick_home ) ) {
fprintf(stderr, "Error_p4: %s \n", CP->cpp[0][1][1]);
it->strings_good = 0 ;
}
}
if ( strcmp( CP->cpp[1][0][0], "than" ) ) {
if ( strcmp( CP->cpp[1][0][0], trick_home ) ) {
fprintf(stderr, "Error_p5: %s \n", CP->cpp[1][0][0]);
it->strings_good = 0 ;
}
}
if ( strcmp( CP->cpp[1][0][1], "testing" ) ) {
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
fprintf(stderr, "Error_p6: %s \n", CP->cpp[1][0][1]);
it->strings_good = 0 ;
}
}
if ( strcmp( CP->cpp[1][1][0], "or" ) ) {
if ( strcmp( CP->cpp[1][1][0], trick_home ) ) {
fprintf(stderr, "Error_p7: %s \n", CP->cpp[1][1][0]);
it->strings_good = 0 ;
}
}
if ( strcmp( CP->cpp[1][1][1], "debugging." ) ) {
if ( strcmp( CP->cpp[1][1][1], trick_home ) ) {
fprintf(stderr, "Error_p8: %s \n", CP->cpp[1][1][1]);
it->strings_good = 0 ;
}
}
/*
* The character arrays
*/
if ( strcmp( CM->cpa[0][0][0], "I" ) ) {
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
fprintf(stderr, "Error_a1: %s \n", CM->cpa[0][0][0]);
it->strings_good = 0 ;
}
}
if ( strcmp( CM->cpa[0][0][1], "would" ) ) {
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
fprintf(stderr, "Error_a2: %s \n", CM->cpa[0][0][1]);
it->strings_good = 0 ;
}
}
if ( strcmp( CM->cpa[0][1][0], "rather" ) ) {
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
fprintf(stderr, "Error_a3: %s \n", CM->cpa[0][1][0]);
it->strings_good = 0 ;
}
}
if ( strcmp( CM->cpa[0][1][1], "be" ) ) {
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
fprintf(stderr, "Error_a4: %s \n", CM->cpa[0][1][1]);
it->strings_good = 0 ;
}
}
if ( strcmp( CM->cpa[1][0][0], "surfing" ) ) {
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
fprintf(stderr, "Error_a5: %s \n", CM->cpa[1][0][0]);
it->strings_good = 0 ;
}
}
if ( strcmp( CM->cpa[1][0][1], "today" ) ) {
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
fprintf(stderr, "Error_a6: %s \n", CM->cpa[1][0][1]);
it->strings_good = 0 ;
}
}
if ( strcmp( CM->cpa[1][1][0], "in" ) ) {
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
fprintf(stderr, "Error_a7: %s \n", CM->cpa[1][1][0]);
it->strings_good = 0 ;
}
}
if ( strcmp( CM->cpa[1][1][1], "the blue oceans of Wakiki." ) ) {
if ( strcmp( CP->cpp[1][0][1], trick_home ) ) {
fprintf(stderr, "Error_a8: %s \n", CM->cpa[1][1][1]);
it->strings_good = 0 ;
}
}
return( 0 ) ;
}