diff --git a/trick_sims/SIM_msd/RUN_test/input.py b/trick_sims/SIM_msd/RUN_test/input.py index fb5c80ab..8ee3b0db 100644 --- a/trick_sims/SIM_msd/RUN_test/input.py +++ b/trick_sims/SIM_msd/RUN_test/input.py @@ -1,10 +1,14 @@ dyn_integloop.getIntegrator(trick.Runge_Kutta_4, 4) +trick.var_debug(3) execfile("Modified_data/realtime.py") #========================================== # Start the display VarServer Client #========================================== varServerPort = trick.var_server_get_port(); +trick.set_var_server_info_msg_on() + +print(varServerPort) MsdGui_path = "models/graphics/dist/MsdGui.jar" if (os.path.isfile(MsdGui_path)) : diff --git a/trick_sims/SIM_msd/S_define b/trick_sims/SIM_msd/S_define index 3b74619c..7af14518 100644 --- a/trick_sims/SIM_msd/S_define +++ b/trick_sims/SIM_msd/S_define @@ -3,29 +3,30 @@ PURPOSE: (This S_define works with the RUN_numeric input file) LIBRARY DEPENDENCIES: ( - (msd/src/msd_init.cpp) - (msd/src/msd_numeric.cpp) - (msd/src/msd_shutdown.cpp) (msd/src/msd.cpp) + (msd/src/msd_default_data.cpp) (msd/src/msd_deriv.cpp) + (msd/src/msd_init.cpp) (msd/src/msd_integ.cpp) + (msd/src/msd_shutdown.cpp) ) *************************************************************/ #include "sim_objects/default_trick_sys.sm" -##include "msd/include/msd_numeric.hh" +##include "msd/include/msd.hh" class MSDSimObject : public Trick::SimObject { public: - MSD msd; + MSD msd ; MSDSimObject() { - ("default_data") msd_default_data( msd ) ; - ("initialization") msd_init( msd ) ; - ("derivative") msd.state_deriv(); - ("integration") trick_ret= msd.state_integ(); + ("default_data") MSD::default_data( msd ) ; + ("initialization") msd.init() ; + ("derivative") msd.state_deriv() ; + ("integration") trick_ret= msd.state_integ() ; + ("shutdown") msd.shutdown() ; } } ; diff --git a/trick_sims/SIM_msd/models/msd/include/msd.hh b/trick_sims/SIM_msd/models/msd/include/msd.hh index 832ecf1c..17cc96dc 100644 --- a/trick_sims/SIM_msd/models/msd/include/msd.hh +++ b/trick_sims/SIM_msd/models/msd/include/msd.hh @@ -22,27 +22,20 @@ public: double k; /* N/m spring constant */ double F; /* N force constant */ + MSD(double _m, double _k, double _b, double _F, + double _v_0, double _x_0); + + static int default_data(MSD &); + int init(); + int shutdown(); + int state_deriv(void); + int state_integ(void); MSD(void); /* not used */ - MSD(double _m, double _k, double _b, double _F, - double _v_0, double _x_0); - - int state_deriv(void); - int state_integ(void); - }; -#ifdef __cplusplus -extern "C" { -#endif -int msd_default_data(MSD &); -int msd_init(MSD &); -int msd_shutdown(const MSD &); -#ifdef __cplusplus -} -#endif #endif /* MSD_H */ \ No newline at end of file diff --git a/trick_sims/SIM_msd/models/msd/include/msd_numeric.hh b/trick_sims/SIM_msd/models/msd/include/msd_numeric.hh deleted file mode 100644 index 29093004..00000000 --- a/trick_sims/SIM_msd/models/msd/include/msd_numeric.hh +++ /dev/null @@ -1,17 +0,0 @@ -/************************TRICK HEADER************************* -PURPOSE: Msd Numeric model -PROGRAMMERS: - (((Scott P. Fennell) (CACI International Inc.) (January 2018) (Trick Learning Project))) -*************************************************************/ -#ifndef MSD_NUMERIC_H -#define MSD_NUMERIC_H - -#include "msd.hh" - -#ifdef __cplusplus -extern "C" { -#endif -#ifdef __cplusplus -} -#endif -#endif \ No newline at end of file diff --git a/trick_sims/SIM_msd/models/msd/src/msd.cpp b/trick_sims/SIM_msd/models/msd/src/msd.cpp index 4c2a3f60..5ba59dd6 100644 --- a/trick_sims/SIM_msd/models/msd/src/msd.cpp +++ b/trick_sims/SIM_msd/models/msd/src/msd.cpp @@ -4,7 +4,7 @@ PROGRAMMERS: (((Scott P. Fennell) (CACI International Inc.) (January 2018) (Trick Learning Project))) *************************************************************/ #include -#include "../include/msd_numeric.hh" +#include "msd.hh" #include MSD::MSD(double _m, double _k, double _b, double _F, double _v_0, double _x_0) { @@ -16,4 +16,5 @@ MSD::MSD(double _m, double _k, double _b, double _F, double _v_0, double _x_0) { x_0 = _x_0; } -MSD::MSD(void) {/* not used */} \ No newline at end of file +MSD::MSD(void) {/* not used */} + diff --git a/trick_sims/SIM_msd/models/msd/src/msd_default_data.cpp b/trick_sims/SIM_msd/models/msd/src/msd_default_data.cpp new file mode 100644 index 00000000..b5513978 --- /dev/null +++ b/trick_sims/SIM_msd/models/msd/src/msd_default_data.cpp @@ -0,0 +1,20 @@ +/************************TRICK HEADER************************* +PURPOSE: MSD default data job +PROGRAMMERS: + (((Scott P. Fennell) (CACI International Inc.) (January 2018) (Trick Learning Project))) +*************************************************************/ +#include "msd.hh" + +/* default data job */ +int MSD::default_data(MSD &M) { + M = MSD( + 1.0, /* m */ + 2.0, /* k */ + 0.5, /* b */ + 5.0, /* F */ + 0.0, /* v_0 */ + 5.0 /* x_0 */ + ); + + return 0; +} \ No newline at end of file diff --git a/trick_sims/SIM_msd/models/msd/src/msd_deriv.cpp b/trick_sims/SIM_msd/models/msd/src/msd_deriv.cpp index 815256ca..9b4da4dd 100644 --- a/trick_sims/SIM_msd/models/msd/src/msd_deriv.cpp +++ b/trick_sims/SIM_msd/models/msd/src/msd_deriv.cpp @@ -3,8 +3,7 @@ PROGRAMMERS: (((Scott P. Fennell) (CACI International Inc.) (January 2018) (Trick Learning Project))) *************************************************************/ -#include "../include/msd_numeric.hh" -#include "../include/msd.hh" +#include "msd.hh" #include int MSD::state_deriv(void) { diff --git a/trick_sims/SIM_msd/models/msd/src/msd_init.cpp b/trick_sims/SIM_msd/models/msd/src/msd_init.cpp index 627c41ee..c1ec280a 100644 --- a/trick_sims/SIM_msd/models/msd/src/msd_init.cpp +++ b/trick_sims/SIM_msd/models/msd/src/msd_init.cpp @@ -5,24 +5,9 @@ PROGRAMMERS: *************************************************************/ /* Model Include files */ -#include "../include/msd.hh" - -/* default data job */ -int msd_default_data(MSD &M) { - M = MSD( - 1.0, /* m */ - 2.0, /* k */ - 0.5, /* b */ - 5.0, /* F */ - 0.0, /* v_0 */ - 5.0 /* x_0 */ - - ); - - return 0; -} +#include "msd.hh" /* initialization job */ -int msd_init(MSD &M) { +int MSD::init() { return 0; } diff --git a/trick_sims/SIM_msd/models/msd/src/msd_integ.cpp b/trick_sims/SIM_msd/models/msd/src/msd_integ.cpp index 30566922..872fcb4c 100644 --- a/trick_sims/SIM_msd/models/msd/src/msd_integ.cpp +++ b/trick_sims/SIM_msd/models/msd/src/msd_integ.cpp @@ -3,7 +3,6 @@ PROGRAMMERS: (((Scott P. Fennell) (CACI International Inc.) (January 2018) (Trick Learning Project))) *************************************************************/ -#include "../include/msd_numeric.hh" #include "msd.hh" #include "trick/Integrator.hh" #include "trick/integrator_c_intf.h" @@ -24,8 +23,9 @@ int MSD::state_integ(void) { ipass = integrate(); unload_state( - &x, - &v, - NULL); + &x, + &v, + NULL); + return(ipass); } \ No newline at end of file diff --git a/trick_sims/SIM_msd/models/msd/src/msd_shutdown.cpp b/trick_sims/SIM_msd/models/msd/src/msd_shutdown.cpp index 48fa22e4..a7ea6f84 100644 --- a/trick_sims/SIM_msd/models/msd/src/msd_shutdown.cpp +++ b/trick_sims/SIM_msd/models/msd/src/msd_shutdown.cpp @@ -3,15 +3,15 @@ PURPOSE: (Print the final msd state.) PROGRAMMERS: (((Scott P. Fennell) (CACI International Inc.) (January 2018) (Trick Learning Project))) *************************************************************/ -#include "../include/msd.hh" +#include "msd.hh" #include "trick/exec_proto.h" #include -int msd_shutdown(const MSD &M) { +int MSD::shutdown() { printf("========================================\n"); printf(" MSD State at Shutdown \n"); printf("pos = [%g], vel = [%g], acc = [%g]\n", - M.x, M.v, M.a); + x, v, a); printf("========================================\n"); return 0; } \ No newline at end of file