mirror of
https://github.com/nasa/trick.git
synced 2024-12-20 05:37:55 +00:00
Split test sims and fun sims into separate directories.
removed SIM_target because we don't use it. refs #191
This commit is contained in:
parent
d503d52bd8
commit
57bed25466
@ -1,8 +0,0 @@
|
||||
|
||||
NUM_RUNS: 300
|
||||
|
||||
VARS:
|
||||
target.state.velocity[0] {km/s} CALC;
|
||||
target.state.velocity[1] {km/s} CALC;
|
||||
target.state.velocity[2] {km/s} CALC;
|
||||
|
@ -1,50 +0,0 @@
|
||||
import math
|
||||
|
||||
target_integloop.getIntegrator(trick.Runge_Kutta_Fehlberg_45, 42)
|
||||
|
||||
# Set up the Monte Carlo runs.
|
||||
#trick.mc_set_dry_run(1)
|
||||
trick.mc_set_enabled(1)
|
||||
trick.mc_set_num_runs(200)
|
||||
var0 = trick.MonteVarCalculated("target.target_state.velocity[0]")
|
||||
var1 = trick.MonteVarCalculated("target.target_state.velocity[1]","m/s")
|
||||
var2 = trick.MonteVarCalculated("target.target_state.velocity[2]")
|
||||
trick_mc.mc.add_variable(var0)
|
||||
trick_mc.mc.add_variable(var1)
|
||||
trick_mc.mc.add_variable(var2)
|
||||
|
||||
#slave0 = trick.MonteSlave("localhost")
|
||||
#slave1 = trick.MonteSlave("localhost")
|
||||
#slave0 = trick.MonteSlave("Megatron")
|
||||
#trick_mc.mc.add_slave(slave0)
|
||||
#trick_mc.mc.add_slave(slave1)
|
||||
|
||||
|
||||
# Set the iteration limit. */
|
||||
iterate.iterate_data.iter_max = 12;
|
||||
|
||||
# Set the initial body position. */
|
||||
target.target_state.position[0] = trick.attach_units( "km", -7378.0)
|
||||
target.target_state.position[1] = trick.attach_units( "km", 0.0)
|
||||
target.target_state.position[2] = trick.attach_units( "km", 0.0)
|
||||
|
||||
# Compute the initial circular velocity from position. */
|
||||
#target.state.velocity[0] {km/s} = 0.0, 7.350214, 0.0;
|
||||
pi = 3.14159265358979323846264338328;
|
||||
mu = float(target.target_planet.mu);
|
||||
r_mag = math.sqrt( (float(target.target_state.position[0]) * float(target.target_state.position[0]))
|
||||
+ (float(target.target_state.position[1]) * float(target.target_state.position[1]))
|
||||
+ (float(target.target_state.position[2]) * float(target.target_state.position[2])) );
|
||||
|
||||
r_3 = r_mag * r_mag * r_mag;
|
||||
target.target_state.velocity[0] = 0.0;
|
||||
target.target_state.velocity[1] = math.sqrt( mu / r_mag );
|
||||
target.target_state.velocity[2] = 0.0;
|
||||
|
||||
# Set the desired terminal position. */
|
||||
target.target_data.position[0] = trick.attach_units( "km", 2*7378.0)
|
||||
target.target_data.position[1] = trick.attach_units( "km", 0.0)
|
||||
target.target_data.position[2] = trick.attach_units( "km", 0.0)
|
||||
|
||||
# Compute the stop time. */
|
||||
trick.stop( pi * math.sqrt( r_3 / mu ) )
|
@ -1,55 +0,0 @@
|
||||
import math
|
||||
from trick.unit_test import *
|
||||
|
||||
if trick.mc_get_slave_id() == 0:
|
||||
trick_utest.unit_tests.enable();
|
||||
trick_utest.unit_tests.set_file_name( os.getenv("TRICK_HOME") + "/trick_test/SIM_target_master.xml" )
|
||||
|
||||
target_integloop.getIntegrator(trick.Runge_Kutta_Fehlberg_45, 42)
|
||||
|
||||
# Set up the Monte Carlo runs.
|
||||
#trick.mc_set_dry_run(1)
|
||||
trick.mc_set_enabled(1)
|
||||
trick.mc_set_num_runs(200)
|
||||
var0 = trick.MonteVarCalculated("target.target_state.velocity[0]")
|
||||
var1 = trick.MonteVarCalculated("target.target_state.velocity[1]","m/s")
|
||||
var2 = trick.MonteVarCalculated("target.target_state.velocity[2]")
|
||||
trick_mc.mc.add_variable(var0)
|
||||
trick_mc.mc.add_variable(var1)
|
||||
trick_mc.mc.add_variable(var2)
|
||||
|
||||
slave0 = trick.MonteSlave("localhost")
|
||||
#slave0.set_remote_shell(trick.TRICK_SSH)
|
||||
#slave0.set_sim_path("${HOME}/trick_sims/SIM_target")
|
||||
slave0.set_S_main_name("./T_main_${TRICK_HOST_CPU}_test.exe")
|
||||
trick_mc.mc.add_slave(slave0)
|
||||
|
||||
|
||||
# Set the iteration limit. */
|
||||
iterate.iterate_data.iter_max = 12;
|
||||
|
||||
# Set the initial body position. */
|
||||
target.target_state.position[0] = trick.attach_units( "km", -7378.0)
|
||||
target.target_state.position[1] = trick.attach_units( "km", 0.0)
|
||||
target.target_state.position[2] = trick.attach_units( "km", 0.0)
|
||||
|
||||
# Compute the initial circular velocity from position. */
|
||||
#target.state.velocity[0] {km/s} = 0.0, 7.350214, 0.0;
|
||||
pi = 3.14159265358979323846264338328;
|
||||
mu = float(target.target_planet.mu);
|
||||
r_mag = math.sqrt( (float(target.target_state.position[0]) * float(target.target_state.position[0]))
|
||||
+ (float(target.target_state.position[1]) * float(target.target_state.position[1]))
|
||||
+ (float(target.target_state.position[2]) * float(target.target_state.position[2])) );
|
||||
|
||||
r_3 = r_mag * r_mag * r_mag;
|
||||
target.target_state.velocity[0] = 0.0;
|
||||
target.target_state.velocity[1] = math.sqrt( mu / r_mag );
|
||||
target.target_state.velocity[2] = 0.0;
|
||||
|
||||
# Set the desired terminal position. */
|
||||
target.target_data.position[0] = trick.attach_units( "km", 2*7378.0)
|
||||
target.target_data.position[1] = trick.attach_units( "km", 0.0)
|
||||
target.target_data.position[2] = trick.attach_units( "km", 0.0)
|
||||
|
||||
# Compute the stop time. */
|
||||
trick.stop( pi * math.sqrt( r_3 / mu ) )
|
@ -1,163 +0,0 @@
|
||||
/*****************************************************************************
|
||||
PURPOSE: ( This is Zach's test simulation )
|
||||
LIBRARY_DEPENDENCIES:
|
||||
(
|
||||
(target/src/target_data_default_data.c)
|
||||
(target/src/target_delta_v.c)
|
||||
(target/src/target_earth_default_data.c)
|
||||
(target/src/target_eom.c)
|
||||
(target/src/target_integ.c)
|
||||
(target/src/target_iterate_default_data.c)
|
||||
(target/src/target_master_init.c)
|
||||
(target/src/target_master_post.c)
|
||||
(target/src/target_master_pre.c)
|
||||
(target/src/target_master_shutdown.c)
|
||||
(target/src/target_print.c)
|
||||
(target/src/target_slave_init.c)
|
||||
(target/src/target_slave_post.c)
|
||||
(target/src/target_slave_pre.c)
|
||||
(target/src/target_slave_shutdown.c)
|
||||
(target/src/target_state_init.c)
|
||||
)
|
||||
****************************************************************************/
|
||||
#include "sim_objects/default_trick_sys.sm"
|
||||
|
||||
##include "target/include/target_body.h"
|
||||
##include "target/include/target_proto.h"
|
||||
|
||||
#define DYNAMICS 0.1
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* SIM_OBJECT: target - The simple targeting algorithm. *
|
||||
*****************************************************************************/
|
||||
class TargetSimObject : public Trick::SimObject {
|
||||
|
||||
public:
|
||||
|
||||
TargetBodyInit target_init;
|
||||
TargetBodyPlanet target_planet;
|
||||
TargetBodyState target_state;
|
||||
TargetBodyData target_data;
|
||||
TargetBodyIteration *iterate_data ;
|
||||
|
||||
TargetSimObject() {
|
||||
|
||||
/*=====================================================================
|
||||
= Target Default Data Routines: =
|
||||
= These are the default data routines to set the default data for =
|
||||
= the target.data. =
|
||||
=====================================================================*/
|
||||
("default_data") target_earth_default_data(&target_planet);
|
||||
("default_data") target_data_default_data(&target_data);
|
||||
|
||||
/*=====================================================================
|
||||
= Target Initialization Routine: =
|
||||
= This is an initialization routine that computes the initial state =
|
||||
= of the target.data. =
|
||||
=====================================================================*/
|
||||
("initialization") target_state_init( &target_init, &target_planet, &target_state );
|
||||
|
||||
/*=====================================================================
|
||||
= Orbital Dynamics Docking/Grapple Transition Routine: =
|
||||
= This is a derviative class routine that processes any pending =
|
||||
= dockings, separations, grapples or releases. =
|
||||
=====================================================================*/
|
||||
("derivative") target_eom( &target_planet, &target_state, &target_data );
|
||||
|
||||
/*=====================================================================
|
||||
= Target Body Integration Routine: =
|
||||
= This routine propagates the state of the target.data using the =
|
||||
= accelerations and time derivative of the state transition matrix =
|
||||
= computed in the preceeding derivative class routines. The =
|
||||
= integator type (Euler, RK4 ...) is selected through data input. =
|
||||
=====================================================================*/
|
||||
("integration") trick_ret = target_integ( &target_state, &target_data ) ;
|
||||
|
||||
/*=====================================================================
|
||||
= Target Delta V Computation Routine: =
|
||||
= This is a shutdown routine that computes the final targeting end =
|
||||
= point conditions and the required change in intial state. =
|
||||
=====================================================================*/
|
||||
("shutdown") target_delta_v( &target_state, &target_data, iterate_data ) ;
|
||||
|
||||
/*=====================================================================
|
||||
= Target Print Routine: =
|
||||
= This is an initialization routine that computes the initial state =
|
||||
= of the target.data and the state transition matrix. =
|
||||
=====================================================================*/
|
||||
("shutdown") target_print( exec_get_sim_time(), &target_init, &target_state, iterate_data );
|
||||
}
|
||||
} ;
|
||||
|
||||
TargetSimObject target;
|
||||
|
||||
/*****************************************************************************
|
||||
* SIM_OBJECT: iterate - The simple iteration algorithm. *
|
||||
*****************************************************************************/
|
||||
class IterateSimObject : public Trick::SimObject {
|
||||
|
||||
public:
|
||||
|
||||
TargetBodyIteration iterate_data;
|
||||
TargetBodyInit *target_init;
|
||||
TargetBodyPlanet *target_planet;
|
||||
TargetBodyState *target_state;
|
||||
TargetBodyData *target_data;
|
||||
|
||||
IterateSimObject() {
|
||||
|
||||
("default_data") target_iterate_default_data( &iterate_data ) ;
|
||||
|
||||
("monte_master_init") target_master_init( &iterate_data ) ;
|
||||
|
||||
("monte_slave_init") target_slave_init( &iterate_data ) ;
|
||||
|
||||
("monte_master_pre") target_master_pre( target_init,
|
||||
target_state,
|
||||
target_data,
|
||||
&iterate_data );
|
||||
|
||||
("monte_slave_pre") target_slave_pre( target_init,
|
||||
target_state,
|
||||
target_data,
|
||||
&iterate_data );
|
||||
|
||||
("monte_slave_post") target_slave_post( mc_get_connection_device(),
|
||||
target_init,
|
||||
target_state,
|
||||
target_data,
|
||||
&iterate_data );
|
||||
|
||||
("monte_master_post") target_master_post( mc_get_connection_device(),
|
||||
target_init,
|
||||
target_state,
|
||||
target_data,
|
||||
&iterate_data );
|
||||
|
||||
("monte_master_shutdown") target_master_shutdown( mc_get_connection_device(),
|
||||
target_data,
|
||||
&iterate_data );
|
||||
|
||||
("monte_slave_shutdown") target_slave_shutdown( mc_get_connection_device(),
|
||||
target_data );
|
||||
|
||||
}
|
||||
} ;
|
||||
|
||||
IterateSimObject iterate ;
|
||||
/*****************************************************************************
|
||||
* INTEGRATE: List the sim_objects with orbtial dynamics derviative and *
|
||||
* integration class routines. *
|
||||
*****************************************************************************/
|
||||
IntegLoop target_integloop (DYNAMICS) target;
|
||||
|
||||
void create_connections() {
|
||||
|
||||
target.iterate_data = &iterate.iterate_data;
|
||||
|
||||
iterate.target_init = &target.target_init;
|
||||
iterate.target_planet = &target.target_planet;
|
||||
iterate.target_state = &target.target_state;
|
||||
iterate.target_data = &target.target_data;
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
|
||||
TRICK_CFLAGS += -I${TRICK_HOME}/trick_models
|
||||
TRICK_CXXFLAGS += -I${TRICK_HOME}/trick_models
|
||||
|
Loading…
Reference in New Issue
Block a user