Merge branch 'master' into Wiki-Button

This commit is contained in:
Pherring04 2024-08-27 11:08:07 -05:00
commit bfaf285976
14 changed files with 126 additions and 12 deletions

View File

@ -190,7 +190,7 @@ apt-get update
apt-get install -y bison clang flex git llvm make maven swig cmake \ apt-get install -y bison clang flex git llvm make maven swig cmake \
curl g++ libx11-dev libxml2-dev libxt-dev libmotif-common libmotif-dev \ curl g++ libx11-dev libxml2-dev libxt-dev libmotif-common libmotif-dev \
python3-dev zlib1g-dev llvm-dev libclang-dev libudunits2-dev \ python3-dev zlib1g-dev llvm-dev libclang-dev libudunits2-dev \
libgtest-dev openjdk-11-jdk zip libgtest-dev default-jdk zip
# On some versions of Ubuntu (18.04 as of 04/2021), there may be multiple installations of python. # On some versions of Ubuntu (18.04 as of 04/2021), there may be multiple installations of python.
# Our new python3-dev will be linked to python3 and python3-config in your bin. # Our new python3-dev will be linked to python3 and python3-config in your bin.
@ -198,6 +198,8 @@ libgtest-dev openjdk-11-jdk zip
export PYTHON_VERSION=3 export PYTHON_VERSION=3
``` ```
Note: If you need to use a specific JDK version, such as `openjdk-11-jdk`, you can replace `default-jdk` with `openjdk-11-jdk` under install packages as shown above. However, you need to check where the `java` and `javac` commands are located. For instance, Ubuntu 24 typically sets up JRE (21) headless by default, so the `java` (version 21 headless) command might be located in `/usr/bin`. When you install `openjdk-11-jdk`, both `java` (version 11) and `javac` (version 11) might be placed in `/usr/lib/jvm/java-11-openjdk-amd64/bin`, with only `javac` potentially also in `/usr/bin`. Consequently, running a Java GUI with the default PATH might use JRE 21 headless instead of JRE 11, even though youre using JDK 11 for compiling, which may not be the desired configuration. Placing `/usr/lib/jvm/java-11-openjdk-amd64/bin` before `/usr/bin` in your PATH ensures that only JDK 11 is used.
proceed to [Install Trick](#install) section of the install guide proceed to [Install Trick](#install) section of the install guide
--- ---
@ -348,9 +350,9 @@ proceed to [Install Trick](#install) section of the install guide
<a name="manual_build_clang_llvm"></a> <a name="manual_build_clang_llvm"></a>
### Build Clang and LLVM ### Build Clang and LLVM
#### If you come to this section because Clang+LLVM installed by the package manager on your machine does not work for your environment, you need to manually build Clang and LLVM. Following instructions show steps on building a particular release of Clang and LLVM . `cmake` is required. CMake may support multiple native build systmes on certain platforms. A generator is responsible for generating a particular build system. Below lists two approaches for your reference. The 1st approach uses `Unix Makefiles` (one of Makefile generators) and the 2nd one uses `Ninja` (one of Ninja generators). For Mac Apple Silicon user, may want to go to the 2nd approach direcly. If you come to this section because Clang+LLVM installed by the package manager on your machine does not work for your environment, you need to manually build Clang and LLVM. Following instructions show steps on building a particular release of Clang and LLVM . `cmake` is required. CMake may support multiple native build systmes on certain platforms. A generator is responsible for generating a particular build system. Below lists two approaches for your reference. The first approach uses `Unix Makefiles` (one of Makefile generators) and the second one uses `Ninja` (one of Ninja generators). For Mac Apple Silicon user, may want to go to the second approach directly.
#### Note: Remember to add `--with-llvm=<clang+llvm-17_path>` for Trick configure if using the Clang and LLVM built in this section. Note: Remember to add `--with-llvm=<clang+llvm-17_path>` for Trick configure if using the Clang and LLVM built in this section.
1. Using `Unix Makefiles` generator 1. Using `Unix Makefiles` generator

View File

@ -3,7 +3,7 @@
Trick provides the following graphical user interfaces: Trick provides the following graphical user interfaces:
## Simulation Control Panel ## [Sim Control Panel](SimControlPanel)
Send control commands to and view the status of a simulation. Send control commands to and view the status of a simulation.

View File

@ -0,0 +1,86 @@
| [Home](/trick) → [Documentation Home](../../Documentation-Home) → [Running a Simulation](../Running-a-Simulation) → [Runtime GUIs](Runtime-GUIs) → Sim Control Panel |
|------------------------------------------------------------------|
## Sim Control Panel
The Sim Control Panel is a graphical user interface that allows users to control and view the state of a simulation.
### Launching
The Panel can be launched in two ways:
- Via the command line `${TRICK_HOME}/bin/trick-simcontrol [hostname] [port number]`
- The hostname and port number are optional
- Using the input file to launch it automatically, see [Automatically Launching Applications](Runtime-GUIs#automatically-launching-applications)
### The GUI
The GUI pictured below may have a different look and feel based on the architecture of the machine on which it is running, but the functionality will remain the same.
![SimControlPanel](images/SimControlPanel.jpg)
#### File Menu
The File menu pictured below contains operations to manage the Sim Control Panel's status messages as well as its look and feel.
![SimControlPanel_File](images/SCP_File.jpg)
- **Font:** Opens a dialogue to customize the font of the status message pane
- **Save Status Messages:** Opens a file chooser that allows you to save the current status messages to a specific file
- **Clear Status Message Log:** Clears any messages within the status message pane
- **Look and Feel:** Changes the theme and color palette of the Sim Control Panel
- **Exit:** Exits the application
#### Actions Menu
![SimControlPanel_Actions](images/SCP_Actions.jpg)
- **Start Trick View:** Opens an instance of the Trick View application connected to the current simulation. See [Trick View](TrickView) for more details.
- **Start Event/Malfunction Trick View:** Opens an instance of the Events/Malfunctions Trick View application connected to the current simulation. See [Events/Malfunctions Trick View](MalfunctionsTrickView) for more details.
- **Freeze At:** Sets the simulation to enter freeze mode at a specific simulation time
- **Freeze In:** Puts the simulation in freeze mode after a specified number of simulation seconds
- **Checkpoint Objects:** Specifies which objects are to be checkpointed when the `Dump Chkpnt` button is pressed
- **Throttle:** Opens a dialogue with a slider for you to set the maximum Sim Time / Real-Time Ratio. By default, the scale is between 1.0 and 10.0 but you can increase the maximum to 1000. It functionally allows simulations to run faster than real-time up to their maximum capable speed
#### Command Panel
- **Step:** Steps through each executing job, pausing before proceeding to the next
- **Start:** Puts the simulation in run mode
- **Freeze:** Puts the simulation in freeze mode
- **Shutdown:** Shuts the simulation down
- **Lite:** Shrinks the Sim Control Panel to hide the status message pane and Trick Logo or returns it to the default size via a toggle button
- **Data Rec On:** Toggles data recording on or off
- **RealTime On:** Toggles real-time mode in a simulation
- **Dump Chkpnt:** Opens a file chooser to save a checkpoint file
- **Load Chkpnt:** Opens a file chooser to choose a checkpoint file to load into the simulation
- **Exit:** Closes the Sim Control Panel
#### Misc
##### Simulation Overruns
The Sim Control Panel shows which simulation is running and keeps count of its overruns.
##### Status Message Panel
This panel is where any error or status messaging for the simulation appears. The search bar at the bottom allows the user to find specific text within the panel.
##### Simulation Connection
The bottom part of the Sim Control Panel has a dropdown where the user can input the hostname and port number of the simulation to which the user is attempting to connect. The hostname and port number must be separated by either a space or a colon. The user can also use the dropdown menu to select a simulation. The Connect button next to the dropdown initiates the connection attempt.

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

View File

@ -128,6 +128,8 @@ namespace Trick {
bool use_deriv2; // -- set by integration technique bool use_deriv2; // -- set by integration technique
double dt; // -- set by IntegLoopSimObject.cpp double dt; // -- set by IntegLoopSimObject.cpp
double target_integ_time; // -- set by IntegLoopScheduler.cpp. Final integration time regardless of
// intermediate step.
#ifndef USE_ER7_UTILS_INTEGRATORS #ifndef USE_ER7_UTILS_INTEGRATORS
double **state_origin; double **state_origin;
#endif #endif

View File

@ -11,6 +11,8 @@ int integrate(void);
int integrate_1st_order_ode(const double* deriv, double* state); int integrate_1st_order_ode(const double* deriv, double* state);
int integrate_2nd_order_ode(const double* acc, double* vel, double * pos); int integrate_2nd_order_ode(const double* acc, double* vel, double * pos);
double get_integ_time(void); double get_integ_time(void);
double get_integ_dt(void);
double get_integ_target_time(void);
void set_integ_time(double time_value); void set_integ_time(double time_value);
void reset_state(); void reset_state();
#ifndef USE_ER7_UTILS_INTEGRATORS #ifndef USE_ER7_UTILS_INTEGRATORS

View File

@ -465,9 +465,9 @@ class VariableServerSimObject : public Trick::SimObject {
// monte carlo slave sim children, and the monte carlo master. // monte carlo slave sim children, and the monte carlo master.
// monte carlo slave parents do not reach initialization. // monte carlo slave parents do not reach initialization.
{TRK} P0 ("initialization") trick_ret = vs.init() ; {TRK} P0 ("initialization") trick_ret = vs.init() ;
{TRK} ("monte_master_init") trick_ret = vs.init() ;
#ifndef TRICK_NO_MONTE_CARLO #ifndef TRICK_NO_MONTE_CARLO
{TRK} ("monte_master_init") trick_ret = vs.init() ;
{TRK} P1 ("initialization") monte_carlo_disable_all_apps() ; {TRK} P1 ("initialization") monte_carlo_disable_all_apps() ;
#endif #endif
{TRK} P1 ("initialization") Trick::launch_all_external_applications(); {TRK} P1 ("initialization") Trick::launch_all_external_applications();

View File

@ -420,6 +420,7 @@ public class SimControlApplication extends TrickApplication implements PropertyC
public void getInitializationPacket() { public void getInitializationPacket() {
String simRunDir = null; String simRunDir = null;
String[] results = null; String[] results = null;
boolean masterslave_enabled;
try { try {
String errMsg = "Error: SimControlApplication:getInitializationPacket()"; String errMsg = "Error: SimControlApplication:getInitializationPacket()";
try { try {
@ -459,6 +460,10 @@ public class SimControlApplication extends TrickApplication implements PropertyC
simState = new SimState(); simState = new SimState();
commandSimcom.put("trick.var_exists(\"trick_master_slave.master.num_slaves\")");
results = commandSimcom.get().split("\t");
masterslave_enabled = results[1].equals("1");
commandSimcom.put("trick.var_set_client_tag(\"SimControl\")\n"); commandSimcom.put("trick.var_set_client_tag(\"SimControl\")\n");
commandSimcom.put("trick.var_add(\"trick_sys.sched.sim_start\") \n" + commandSimcom.put("trick.var_add(\"trick_sys.sched.sim_start\") \n" +
"trick.var_add(\"trick_sys.sched.terminate_time\") \n" + "trick.var_add(\"trick_sys.sched.terminate_time\") \n" +
@ -466,9 +471,13 @@ public class SimControlApplication extends TrickApplication implements PropertyC
"trick.var_add(\"trick_cmd_args.cmd_args.default_dir\") \n" + "trick.var_add(\"trick_cmd_args.cmd_args.default_dir\") \n" +
"trick.var_add(\"trick_cmd_args.cmd_args.cmdline_name\") \n" + "trick.var_add(\"trick_cmd_args.cmd_args.cmdline_name\") \n" +
"trick.var_add(\"trick_cmd_args.cmd_args.input_file\") \n" + "trick.var_add(\"trick_cmd_args.cmd_args.input_file\") \n" +
"trick.var_add(\"trick_cmd_args.cmd_args.run_dir\") \n" + "trick.var_add(\"trick_cmd_args.cmd_args.run_dir\") \n");
"trick.var_add(\"trick_master_slave.master.num_slaves\") \n" +
"trick.var_send() \n" + if (masterslave_enabled) {
commandSimcom.put("trick.var_add(\"trick_master_slave.master.num_slaves\") \n");
}
commandSimcom.put("trick.var_send() \n" +
"trick.var_clear() \n"); "trick.var_clear() \n");
results = commandSimcom.get().split("\t"); results = commandSimcom.get().split("\t");
@ -484,7 +493,7 @@ public class SimControlApplication extends TrickApplication implements PropertyC
simStopTime = terminateTime/execTimeTicValue - simStartTime; simStopTime = terminateTime/execTimeTicValue - simStartTime;
} }
slaveCount = Integer.parseInt(results[8]); slaveCount = masterslave_enabled ? Integer.parseInt(results[8]) : 0;
simRunDirField = new JTextField[slaveCount+1]; simRunDirField = new JTextField[slaveCount+1];
overrunField = new JTextField[slaveCount+1]; overrunField = new JTextField[slaveCount+1];

View File

@ -444,6 +444,8 @@ int Trick::IntegLoopScheduler::integrate_dt ( double t_start, double dt) {
int ex_pass = 0; int ex_pass = 0;
bool need_derivs = get_first_step_deriv_from_integrator(); bool need_derivs = get_first_step_deriv_from_integrator();
double target_time = t_start + dt;
do { do {
ex_pass ++; ex_pass ++;
// Call all of the jobs in the derivative job queue if needed. // Call all of the jobs in the derivative job queue if needed.
@ -482,11 +484,12 @@ int Trick::IntegLoopScheduler::integrate_dt ( double t_start, double dt) {
if (ex_pass == 1) { if (ex_pass == 1) {
trick_curr_integ->time = t_start; trick_curr_integ->time = t_start;
trick_curr_integ->dt = dt; trick_curr_integ->dt = dt;
trick_curr_integ->target_integ_time = target_time;
} }
if (verbosity || trick_curr_integ->verbosity) { if (verbosity || trick_curr_integ->verbosity) {
message_publish (MSG_DEBUG, "Job: %s, time: %f, dt: %f\n", message_publish (MSG_DEBUG, "Job: %s, target_integ_time: %f, integ_time: %f, dt: %f, ipass = %d\n",
curr_job->name.c_str(), t_start, dt); curr_job->name.c_str(), target_time, t_start, dt, ipass);
} }
ipass = curr_job->call(); ipass = curr_job->call();

View File

@ -15,6 +15,7 @@ Trick::Integrator::Integrator() {
is_2nd_order_ODE_technique = 0; is_2nd_order_ODE_technique = 0;
use_deriv2 = 0; use_deriv2 = 0;
dt = 0.01; dt = 0.01;
target_integ_time = dt;
state = NULL; state = NULL;
deriv = NULL; deriv = NULL;
deriv2 = NULL; deriv2 = NULL;

View File

@ -22,11 +22,20 @@ extern "C" int integrate_2nd_order_ode(const double* acc, double* vel, double *
} }
extern "C" double get_integ_time() { extern "C" double get_integ_time() {
return (trick_curr_integ->time); return (trick_curr_integ->time);
}
extern "C" double get_integ_dt(void) {
return (trick_curr_integ->dt);
}
extern "C" double get_integ_target_time(void) {
return (trick_curr_integ->target_integ_time);
} }
extern "C" void set_integ_time(double time_value) { extern "C" void set_integ_time(double time_value) {
trick_curr_integ->time = time_value; trick_curr_integ->time = time_value;
trick_curr_integ->target_integ_time = time_value;
} }
extern "C" void reset_state() { extern "C" void reset_state() {