Split test sims and fun sims into separate directories.

Moved SIM_segments to test.

refs #191
This commit is contained in:
Alex Lin 2016-02-23 16:53:19 -06:00
parent 9ddc786ace
commit d884370175
11 changed files with 32 additions and 61 deletions

View File

@ -2,10 +2,6 @@
def main(): def main():
drg0 = trick.DRAscii("Ball") drg0 = trick.DRAscii("Ball")
for param in [ 'position' ] :
for index in range(0,2) :
var = "ball.obj.state.output." + param + "[" + str(index) + "]"
drg0.add_variable(var)
drg0.set_cycle(0.1) drg0.set_cycle(0.1)
drg0.freq = trick.DR_Always drg0.freq = trick.DR_Always
drg0.thisown = 0 drg0.thisown = 0

View File

@ -8,51 +8,9 @@ LIBRARY DEPENDENCIES:
*************************************************************/ *************************************************************/
// Include the experimental Segmented Executive. Must be included before default_trick_sys.sm // Include the experimental Segmented Executive. Must be included before default_trick_sys.sm
#include "sim_objects/SegmentedExecutive.sm" #include "SegmentedExecutive.sm"
#include "sim_objects/default_trick_sys.sm" #include "sim_objects/default_trick_sys.sm"
##include "Ball++/L1/include/Ball.hh"
/**
This class is the base ball class
*/
class ballSimObject : public Trick::SimObject {
public:
/** The actual ball object */
Ball obj ;
/** Constructor to add the jobs */
ballSimObject() {
("default_data") obj.force.default_data() ;
("default_data") obj.state.default_data() ;
("initialization") obj.state_init() ;
("derivative") obj.force_field() ;
("derivative") obj.state_deriv() ;
("integration") trick_ret = obj.state_integ() ;
("post_integration") print_me() ;
{BLUE} (10.0, "scheduled") trick_ret = obj.state_print() ;
{BLUE} (1.0, "freeze_scheduled") trick_ret = obj.state_print() ;
("shutdown") obj.shutdown() ;
}
int print_me() {
message_publish(MSG_NORMAL, "integration run\n") ;
return 0 ;
}
} ;
// Instantiations
ballSimObject ball ;
collect ball.obj.state.work.external_force = {ball.obj.force.output.force[0]};
IntegLoopSimObject my_integ_loop(0.01, &ball, (void *)NULL);
class fswSimObject : public Trick::SimObject { class fswSimObject : public Trick::SimObject {
public: public:
@ -72,6 +30,7 @@ class fswSimObject : public Trick::SimObject {
} ; } ;
fswSimObject fsw ; fswSimObject fsw ;
IntegLoopSimObject my_integ_loop(0.01, 0, &fsw, (void *)NULL);
// Includes a derived Segment class, SegmentA // Includes a derived Segment class, SegmentA
##include "SegmentedExecutive/include/ExampleSegments.hh" ##include "SegmentedExecutive/include/ExampleSegments.hh"
@ -117,6 +76,7 @@ class segmentSimObject : public Trick::SimObject {
segmentSimObject segments(trick_sys.sched, my_integ_loop.integ_sched) ; segmentSimObject segments(trick_sys.sched, my_integ_loop.integ_sched) ;
// Connect objects // Connect objects
void create_connections() { void create_connections() {
@ -124,10 +84,6 @@ void create_connections() {
exec_set_terminate_time(300.0) ; exec_set_terminate_time(300.0) ;
trick_sys.sched.set_freeze_frame(0.10) ; trick_sys.sched.set_freeze_frame(0.10) ;
// Set a default integrator. This statement in create connections allows this
// sim to run without an input file.
my_integ_loop.getIntegrator(Runge_Kutta_2, 4);
fsw.add_tag("A") ; fsw.add_tag("A") ;
fsw.add_tag_to_job("B", "scheduled_2") ; fsw.add_tag_to_job("B", "scheduled_2") ;
} }

View File

@ -0,0 +1,3 @@
TRICK_CFLAGS += -I./models
TRICK_CXXFLAGS += -I./models

View File

@ -27,12 +27,13 @@ class SysSimObject : public Trick::SimObject {
{TRK} P0 ("default_data") sched.process_sim_args() ; {TRK} P0 ("default_data") sched.process_sim_args() ;
{TRK} ("default_data") sched.get_freeze_job(name + ".sched") ; {TRK} ("default_data") sched.get_freeze_job(name + ".sched") ;
{TRK} P65534 ("initialization") exec_collect_init() ; {TRK} P65534 ("initialization") exec_collect_init() ;
{TRK} P65534 ("initialization") sched.write_s_job_execution(NULL) ;
{TRK} P65534 ("initialization") sched.write_s_run_summary(NULL) ; {TRK} P65534 ("initialization") sched.write_s_run_summary(NULL) ;
{TRK} P65535 ("initialization") sched.check_all_jobs_handled() ; {TRK} P65535 ("initialization") sched.check_all_jobs_handled() ;
{TRK} P65535 ("initialization") sched.check_all_job_cycle_times() ; {TRK} P65535 ("initialization") sched.check_all_job_cycle_times() ;
{TRK} P65535 ("initialization") sched.create_threads() ; {TRK} P65535 ("initialization") sched.create_threads() ;
{TRK} P65535 ("initialization") sched.write_s_job_execution(NULL) ;
{TRK} P65535 ("initialization") sched.async_freeze_to_exec_command() ; {TRK} P65535 ("initialization") sched.async_freeze_to_exec_command() ;
// This is an additional job when using a segmented executive // This is an additional job when using a segmented executive
@ -40,16 +41,15 @@ class SysSimObject : public Trick::SimObject {
{TRK} P0 ("checkpoint") sched.checkpoint() ; {TRK} P0 ("checkpoint") sched.checkpoint() ;
{TRK} P0 ("post_checkpoint") sched.post_checkpoint() ; {TRK} P0 ("post_checkpoint") sched.post_checkpoint() ;
{TRK} P0 ("restart") sched.restart() ;
//{TRK} P0 ("restart") sched.restart() ;
{TRK} P65534 ("restart") exec_collect_init() ;
#ifndef TRICK_NO_DMTCP #ifndef TRICK_NO_DMTCP
{TRK} ("dmtcp_restart") sched.write_s_job_execution(NULL) ; {TRK} ("dmtcp_restart") sched.write_s_job_execution(NULL) ;
{TRK} ("dmtcp_restart") sched.write_s_run_summary(NULL) ; {TRK} ("dmtcp_restart") sched.write_s_run_summary(NULL) ;
#endif #endif
// This is an additional job when using a segmentd executive
{TRK} ("top_of_frame") sched.segment_switch() ;
{TRK} ("system_moding") sched.sched_freeze_to_exec_command(false) ; {TRK} ("system_moding") sched.sched_freeze_to_exec_command(false) ;
{TRK} ("end_of_frame") sched.sched_freeze_to_exec_command(true) ; {TRK} ("end_of_frame") sched.sched_freeze_to_exec_command(true) ;
{TRK} ("end_of_frame") sched.async_freeze_to_exec_command() ; {TRK} ("end_of_frame") sched.async_freeze_to_exec_command() ;
@ -58,6 +58,7 @@ class SysSimObject : public Trick::SimObject {
// required job to advance sim time // required job to advance sim time
{TRK} ("system_advance_sim_time") sched.advance_sim_time() ; {TRK} ("system_advance_sim_time") sched.advance_sim_time() ;
} }
private: private:
@ -67,6 +68,22 @@ class SysSimObject : public Trick::SimObject {
SysSimObject trick_sys ; SysSimObject trick_sys ;
class MonteCarloSimObject : public Trick::SimObject {
public:
Trick::MonteCarlo mc ;
MonteCarloSimObject() {
// Register the monte_carlo class as a scheduler with the main executive.
exec_register_scheduler(&mc) ;
{TRK} P0 ("default_data") mc.process_sim_args() ;
{TRK} P0 ("initialization") mc.execute_monte() ;
{TRK} ("shutdown") mc.shutdown() ;
}
}
MonteCarloSimObject trick_mc ;
// define TRICK_NO_EXECUTIVE to exclude the default trick_sys object in default_sim_objects.sm // define TRICK_NO_EXECUTIVE to exclude the default trick_sys object in default_sim_objects.sm
#define TRICK_NO_EXECUTIVE #define TRICK_NO_EXECUTIVE

View File

@ -25,6 +25,8 @@ class Segment {
exit_job_class_str with the exit_jobs queue. This should be the normal constructor to use. */ exit_job_class_str with the exit_jobs queue. This should be the normal constructor to use. */
Segment( std::string segment_name , std::string enter_job_class_str , std::string exit_job_class_str ) ; Segment( std::string segment_name , std::string enter_job_class_str , std::string exit_job_class_str ) ;
virtual ~Segment() {} ;
/* getters and setters */ /* getters and setters */
std::string get_segment_name() ; std::string get_segment_name() ;
void set_segment_name(std::string in_segment_name) ; void set_segment_name(std::string in_segment_name) ;

View File

@ -11,7 +11,7 @@ LIBRARY_DEPENDENCIES:
#include <set> #include <set>
#include <map> #include <map>
#include <string> #include <string>
#include "sim_services/MonteCarlo/include/MonteCarlo.hh" #include "trick/Executive.hh"
#include "SegmentedExecutive/include/Segment.hh" #include "SegmentedExecutive/include/Segment.hh"
/** /**
@ -22,7 +22,7 @@ frame, or switch segments immediately.
namespace Trick { namespace Trick {
class SegmentedExecutive : public Trick::MonteCarlo { class SegmentedExecutive : public Trick::Executive {
friend class InputProcessor ; friend class InputProcessor ;
friend void init_attrTrick__SegmentedExecutive() ; friend void init_attrTrick__SegmentedExecutive() ;

View File

@ -1,3 +0,0 @@
TRICK_CFLAGS += -I${TRICK_HOME}/trick_models
TRICK_CXXFLAGS += -I${TRICK_HOME}/trick_models