plit test sims and fun sims into separate directories

Moved SIM_events, test_dp, test_dr, and abstract.

refs #191
This commit is contained in:
Alex Lin 2016-02-23 13:48:59 -06:00
parent 45e515cdb3
commit 0c84b8ad08
55 changed files with 47 additions and 387 deletions

View File

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

View File

@ -3,14 +3,13 @@ PURPOSE:
(This comment lists out the other object files that are not included from c++ headers)
LIBRARY DEPENDENCIES:
(
(test/dp/src/dp.c)
(dp/src/dp.c)
)
*************************************************************/
#include "sim_objects/default_trick_sys.sm"
##include "test/dp/include/dp.h"
##include "dp/include/dp.h"
%{

View File

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

View File

@ -2,14 +2,14 @@
PURPOSE: ( S_define )
LIBRARY DEPENDENCIES:
(
(test/dr/src/DR.cpp)
(test/dr/src/DR_default_data.cpp)
(dr/src/DR.cpp)
(dr/src/DR_default_data.cpp)
)
*************************************************************/
#include "sim_objects/default_trick_sys.sm"
##include "test/dr/include/DR.hh"
##include "dr/include/DR.hh"
class testSimObject : public Trick::SimObject {
public:

View File

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

View File

@ -1,158 +0,0 @@
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.UnknownHostException;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
import trick.common.utils.VariableServerConnection;
public class JetFire extends JPanel{
private JButton fireJetButton;
private JTextField dataField;
private VariableServerConnection vsConnection;
private static String host = "localhost";
private static int port = 7000;
public JetFire() {
setLayout(new GridBagLayout());
dataField = new JTextField(15);
dataField.setEditable(false);
fireJetButton = new JButton("Fire Jet");
fireJetButton.addActionListener(new MyButtonListener());
// creates a constraints object
GridBagConstraints c = new GridBagConstraints();
c.insets = new Insets(12, 12, 12, 12); // insets for all components
c.gridx = 0; // column 0
c.gridy = 0; // row 0
c.ipadx = 5; // increases components width by 10 pixels
c.ipady = 5; // increases components height by 10 pixels
c.gridwidth = 2;
c.fill = GridBagConstraints.HORIZONTAL; // Horizontal only
add(fireJetButton, c);
c.gridx = 0; // column 0
c.gridy = 1; // row 1
c.gridwidth = 1;
c.fill = GridBagConstraints.NONE; // Remember to reset to none
add(new JLabel("pos[0] "), c);
c.gridx = 1; // column 1
add(dataField, c);
try {
vsConnection = new VariableServerConnection(host, port);
} catch (UnknownHostException host_exception) {
/** The IP address of the host could not be determined. */
System.out.println(" Unknown host \""+host+"\"");
} catch (IOException ioe) {
/** Port number is unavailable, or there is no connection, etc. */
System.out.println(" Invalid TCP/IP port number \""+port+"\"");
System.out.println(" Please check the server and enter a proper port number!");
System.out.println(" IOException ..." + ioe);
System.out.println(" If there is no connection, please make sure SIM is up running properly!");
}
if (vsConnection != null) {
(new MonitorVariableTask()).execute();
try {
//vsConnection.setDebugLevel(3);
vsConnection.setCycle(0.5);
vsConnection.add("dyn.baseball.pos[0]");
} catch (IOException ioe) {
}
} else {
System.exit(0);
}
}
private static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("Jet Fire");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.getContentPane().add(new JetFire());
frame.setSize(350, 200);
frame.setVisible(true);
}
public static void main(String[] args) {
// if a valid port number is provided, use it.
// Otherwise, the default 7000 would be used.
if (args.length > 0) {
try {
port = Integer.parseInt(args[0]);
} catch (Exception e) {
// if the port provided is not a valid number, do nothing
}
}
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
private class MyButtonListener implements ActionListener {
MyButtonListener() {
}
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("Fire Jet")) {
if (vsConnection != null) {
try {
vsConnection.put("trick_mm.mmw.mm.read_checkpoint_from_string(\"dyn.baseball.jet_on = 1 ;\")");
} catch (IOException ioe) {
// do nothing
}
}
}
}
}
private class MonitorVariableTask extends SwingWorker<Void, Void> {
@Override
public Void doInBackground() {
String results[] = null;
while (true) {
try {
if (vsConnection != null) {
results = vsConnection.get().split("\t");
if (results != null && results[0].equals("0")) {
dataField.setText(results[1]);
} else {
break;
}
}
} catch (Exception e) {
break;
}
}
return null;
}
@Override
public void done() {
fireJetButton.setEnabled(false);
try {
if (vsConnection != null) {
vsConnection.close();
}
} catch (IOException ioe) {
// do nothing
}
}
}
}

View File

@ -1,13 +0,0 @@
drg = []
drg.append(trick.DRAscii("cannon_aero"))
#drg[0] = trick.DRAscii("cannon_aero")
drg[0].set_freq(trick.DR_Always)
drg[0].set_cycle(0.01)
drg[0].add_variable("dyn.baseball.pos[0]")
drg[0].add_variable("dyn.baseball.pos[1]")
#drg[0].add_variable("dyn.baseball.pos[2]")
trick.add_data_record_group( drg[0], trick.DR_Buffer )
drg[0].enable()

View File

@ -1,11 +0,0 @@
trick.frame_log_on()
trick.real_time_enable()
trick.exec_set_software_frame(0.01)
trick.itimer_enable()
trick.exec_set_enable_freeze(True)
trick.exec_set_freeze_command(True)
simControlPanel = trick.SimControlPanel()
trick.add_external_application(simControlPanel)

View File

@ -1,19 +0,0 @@
execfile("Modified_data/cannon_aero.dr")
execfile("Modified_data/realtime_jet.py")
dyn.baseball.pos[0] = 0.0
dyn.baseball.pos[1] = 0.0
dyn.baseball.pos[2] = 0.0
dyn.baseball.vel[0] = 43.30
dyn.baseball.vel[1] = 0.0
dyn.baseball.vel[2] = 25.0
dyn.baseball.theta = trick.sim_services.attach_units("d" , -90.0)
dyn.baseball.phi = trick.sim_services.attach_units("d" , 1.0)
dyn.baseball.omega0 = trick.sim_services.attach_units("rev/s" , 30.0)
dyn_integloop.getIntegrator(trick.Runge_Kutta_4, 6)
trick.sim_services.exec_set_terminate_time(10.0)

View File

@ -1,60 +0,0 @@
/************************TRICK HEADER*************************
PURPOSE:
(This S_define works with the jet simulation (RUN_tcltk input files))
LIBRARY DEPENDENCIES:
(
(cannon/aero/src/cannon_init_aero.c)
(cannon/aero/src/cannon_force_gravity.c)
(cannon/aero/src/cannon_force_drag.c)
(cannon/aero/src/cannon_force_lift.c)
(cannon/aero/src/cannon_force_cross.c)
(cannon/aero/src/cannon_collect_forces.c)
(cannon/aero/src/cannon_integ_aero.c)
(cannon/aero/src/cannon_impact_monte.c)
(cannon/aero/src/cannon_force_jet.c)
(cannon/aero/src/cannon_jet_control.c)
(cannon/aero/src/cannon_monte_default_data.c)
)
*************************************************************/
#include "sim_objects/default_trick_sys.sm"
##include "cannon/aero/include/cannon_aero.h"
##include "cannon/aero/include/cannon_monte_proto.h"
class CannonSimObject : public Trick::SimObject {
public:
CANNON_AERO baseball;
CannonSimObject() {
("default_data") cannon_monte_default_data( &baseball ) ;
("initialization") cannon_init_aero( &baseball ) ;
("derivative") cannon_force_gravity( &baseball ) ;
("derivative") cannon_force_drag( &baseball ) ;
("derivative") cannon_force_lift( &baseball ) ;
("derivative") cannon_force_cross( &baseball ) ;
("derivative") cannon_collect_forces( &baseball ) ;
("integration") trick_ret = cannon_integ_aero( &baseball ) ;
(0.1, "effector") cannon_force_jet( &baseball ) ;
("dynamic_event") cannon_impact_monte( &baseball ) ;
(0.1, "scheduled") cannon_jet_control( &baseball ) ;
}
} ;
CannonSimObject dyn ;
IntegLoop dyn_integloop (0.01) dyn ;
collect dyn.baseball.force_collect = {
dyn.baseball.force_gravity[0],
dyn.baseball.force_drag[0],
dyn.baseball.force_magnus[0],
dyn.baseball.force_cross[0],
dyn.baseball.force_jet[0]} ;

View File

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

View File

@ -1,5 +0,0 @@
#!/bin/sh
javac -sourcepath . -classpath classes:$TRICK_HOME/bin/java/dist/trick.jar JetFire.java

View File

@ -1,52 +0,0 @@
#! /bin/sh
# \
exec wish "$0" -- "$@"
# Grab package Trick's SimCom package
global auto_path
set auto_path [linsert $auto_path 0 $env(TRICK_HOME)/bin/tcl]
package require Simcom
namespace import Simcom::*
proc create { } {
global cannon
button .b -text "Fire Jet" -command "fire_jet $cannon(socket)"
label .l -textvariable cannon(x_position)
pack .b .l
}
proc fire_jet { sock } {
Simcom::send_cmd $sock "dyn.baseball.jet_on = 1 ;"
}
proc get_sim_data { } {
global cannon
Simcom::send_cmd $cannon(socket) "trick.var_cycle(0.5)\n"
Simcom::send_cmd $cannon(socket) "trick.var_add(\"dyn.baseball.pos\[0\]\")\n"
while { [gets $cannon(socket) sim_data] != -1 } {
set sim_data [string trimright $sim_data]
set sim_data [string range $sim_data 2 end]
set sim_data [string trimleft $sim_data]
set cannon(x_position) [format "%.2f" $sim_data]
update
}
}
proc main { } {
global cannon
global argv
set cannon(port) [lindex $argv 0]
set cannon(socket) [Simcom::connect "localhost" $cannon(port)]
create
get_sim_data
}
main

View File

@ -1,2 +0,0 @@
#!/bin/sh
java -classpath .:$TRICK_HOME/bin/java/dist/trick.jar JetFire $@

View File

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

View File

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

View File

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

View File

@ -3,66 +3,60 @@ export TRICK_HOST_CPU := $(shell $(TRICK_HOME)/bin/trick-gte TRICK_HOST_CPU)
# List out sims we want to compile
COMPILE_DIRS = SIM_Ball++_L1 \
SIM_amoeba \
SIM_ball_L1 \
SIM_ball_L2 \
SIM_ball_L3 \
SIM_ball_default_data \
SIM_cannon_aero \
SIM_cannon_analytic \
SIM_cannon_contact \
SIM_cannon_dt \
SIM_cannon_eulercromer \
SIM_cannon_integ \
SIM_cannon_jet \
Ball/SIM_ball_L1 \
Ball/SIM_ball_L2 \
Ball/SIM_ball_L3 \
Cannon/SIM_amoeba \
Cannon/SIM_cannon_aero \
Cannon/SIM_cannon_analytic \
Cannon/SIM_cannon_contact \
Cannon/SIM_cannon_dt \
Cannon/SIM_cannon_eulercromer \
Cannon/SIM_cannon_integ \
Cannon/SIM_cannon_jet \
SIM_demo_inputfile \
SIM_demo_sdefine \
SIM_events \
SIM_monte \
SIM_satellite \
SIM_stls \
SIM_stls2 \
SIM_sun \
SIM_target \
SIM_tcltk_java \
SIM_test_abstract \
SIM_test_dp \
SIM_test_dr \
SIM_test_inherit \
SIM_test_ip2 \
SIM_test_sched \
SIM_test_simlib \
SIM_trickcomm
SIM_test_simlib
#SIM_ball_default_data \
#SIM_monte \
#SIM_trickcomm
# This test is temporarily sitting out until fixed.
# SIM_test_varserv
# List out sims we want to run unit tests
TEST_DIRS = SIM_Ball++_L1 \
SIM_amoeba \
SIM_ball_L1 \
SIM_ball_L2 \
SIM_ball_L3 \
SIM_ball_default_data \
SIM_cannon_aero \
SIM_cannon_analytic \
SIM_cannon_contact \
SIM_cannon_dt \
SIM_cannon_eulercromer \
SIM_cannon_integ \
SIM_cannon_jet \
Ball/SIM_ball_L1 \
Ball/SIM_ball_L2 \
Ball/SIM_ball_L3 \
Cannon/SIM_amoeba \
Cannon/SIM_cannon_aero \
Cannon/SIM_cannon_analytic \
Cannon/SIM_cannon_contact \
Cannon/SIM_cannon_dt \
Cannon/SIM_cannon_eulercromer \
Cannon/SIM_cannon_integ \
Cannon/SIM_cannon_jet \
SIM_demo_sdefine \
SIM_events \
SIM_monte \
SIM_stls \
SIM_stls2 \
SIM_sun \
SIM_target \
SIM_test_dp \
SIM_test_dr \
SIM_test_sched \
SIM_test_simlib
#SIM_ball_default_data \
#SIM_monte \
# This test is temporarily sitting out until fixed.
# SIM_test_varserv
@ -72,7 +66,7 @@ UNIT_TEST_RESULTS = $(addprefix $(TRICK_HOME)/trick_test/, $(addsuffix .xml, $(T
all:
@echo "This makefile is used with Trick's top level 'make test' command"
test: $(EXECUTABLES) $(UNIT_TEST_RESULTS) data_record_results
test: $(EXECUTABLES) $(UNIT_TEST_RESULTS)
clean:
rm -f $(UNIT_TEST_RESULTS)
@ -88,13 +82,4 @@ $(EXECUTABLES):
$(UNIT_TEST_RESULTS): $(TRICK_HOME)/trick_test/%.xml : %/T_main_${TRICK_HOST_CPU}_test.exe
@ cd $* ; ./T_main_${TRICK_HOST_CPU}_test.exe RUN_test/unit_test.py
DR_RESULTS = $(TRICK_HOME)/trick_sims/SIM_test_dr/RUN_test
data_record_results: $(UNIT_TEST_RESULTS)
diff $(DR_RESULTS)/log_DR_bitfieldsASCII.csv $(DR_RESULTS)/Ref_Logs/log_DR_bitfieldsASCII_Master.csv
diff $(DR_RESULTS)/log_DR_typesASCII.csv $(DR_RESULTS)/Ref_Logs/log_DR_typesASCII_Master.csv
ifneq ($(wildcard $(DR_RESULTS)/Ref_Logs/typesB_${TRICK_HOST_CPU}.trk), )
cmp -b $(DR_RESULTS)/log_DR_bitfieldsBINARY.trk $(DR_RESULTS)/Ref_Logs/bitfB_${TRICK_HOST_CPU}.trk
cmp -b $(DR_RESULTS)/log_DR_typesBINARY.trk $(DR_RESULTS)/Ref_Logs/typesB_${TRICK_HOST_CPU}.trk
endif