Crane Ship Simulator System Software Design Report


Introduction

The simulator system structure is a cluster of cooperating programs. These programs are coupled to each other by fixed data structures that retain the current state information of the system in interprocess shared memory from which the programs can read and write. This design facilitates a modular structure for the system. All the programs in the simulator run asynchronously with respect to all other programs. Some programs consist of more than one process or thread. Some programs are simulating physical dynamical models whose cyclic solver is synchronized to real-time.

The DIVERSE Toolkit

The DIVERSE Toolkit (DTK) is the "glue" that ties together all of the programs in the simulator.   Briefly, DTK consists of the server program, a C++ client application programming interface (API) and small utility programs.   The DTK server manages the interprocess shared memory, provides an interface for other programs to serial hardware devices via shared memory, and a seamless interface to IP networked shared memory.   The DTK C++ client API is used by all programs in the simulator.   The DTK server is central to the system in that it is the only program required to be running at all times for the simulator to be running.   All of the other programs (modules) can be developed and run independently of most other modules.   Modules can be emulated and started and stopped without corrupting other running modules.   When the system is running in a steady state the primary interprocess communication (IPC) mechanism used is DTK interprocess shared memory.

Integration design of programs (modules) in the simulator system

The simulator programs contain DTK client objects that enable the making of DTK shared memory objects that inturn enable communication between the programs in the system.   The code in the programs may be written in any combination of languages that may be linked with C++ objects, which includes FORTRAN, C, and C++.

Most of the programs in the system, after being initialized, run in a cyclic steady state simulation loop.   For this case the programs code may be split into two logical functions (subroutines or methods), "initialization" and "cyclic advance".   In the case of a C++ implementation a class constructor may be used for initialization.   A possible third function can be "closure" for the removal of shared computational resources that may have been allocated when the program runs, so that the program may call this function before exiting.   We refer to the code of theses functions as "task functions".   The writing of the task functions does not require the use of the DTK API.   For programs that must run in real-time, the real-time synchronizing code is not included in these task functions, but is introduced outside of these task functions, so that the code of these task functions may be used on other platforms, in other applications and testing the code is easier.   The task functions provide enough output variables so that any needed changing system state information, like for example position, angular acceleration, and time can be gotten from the output variables.   The task functions provide enough input variables so that all changing inputs are passed to the task functions.   The code of these task functions may preserve the dynamical state of its task or the dynamical state of its task may be passed to the task functions as a combination of input/output variables.   The later case may be more resource (CPU and memory usage) efficient in some cases.   When possible the cyclic advance task function should allow the user to specify the time to advance to.   Configuration files may be read by the initialization task function.

Simple test programs that use these task functions are an important part of the development of the simulator system.   Simple test programs just print variables to standard output.   Inputs to simple test programs are computed in the simple test program, like for example from a sine function with a reasonable scaling period.   Simple test programs are written in C or C++.   Simple test programs are written in one source file that does not include any of the source code of the task functions.

Pseudo code example task function test program

/* Test pseudo code for the wombat dynamics module
 * The two task functions being tested are:
 * wombat_init() and wombat_advance().
 * This particular example passes the wombat state
 * variables in and out and does not keep a copy
 * of the state variables in the code of the task
 * functions.  This saves having to copy variables in
 * the task functions, but assumes that the user will
 * not change them between wombat_advance() calls.
 */

big float         time = 0.00
state data type   x
input data type   i

set_state_to_initial_value(x)

wombat_init(time, x)

while 1 {

  /* setup next input value i. */
  i = sin(0.07 * time)

  /* advance the requested time */
  time = time + 0.01

  /* This advances the wombat dynamics to time "time" and
   * does so with input i.  The state input/output is x.
   */
  wombat_advance(time, i, x)

  print(time, i, x)
}

/* end test pseudo code for the wombat dynamics module */



List of Simulator System Modules (programs)

  1. DTK server
  2. system service provider
  3. Configure
  4. distributes common information to the crane ship simulator
  5. Render
  6. drawing visual
  7. Wave
  8. compute wave height and ship's x and y position relative to the ocean grid
  9. LAMP
  10. ship hull dynamics model
  11. Fun Filter
  12. visual and motion base relative motion filter
  13. Crane Model
  14. crane dynamics model
  15. Crane Controller
  16. filter operator input to crane model
  17. Motion Base Controller
  18. controller from engaging and shutting down the MOOG motion base
  19. Sound
  20. simulation activated sound
  21. DTK Shared Memory
  22. a list of DTK shared memory segments

Hyper-linked mapped image
click to go to
Hyper-linked mapped image

taken from an animated slide from the March 27, 2000 MURI power point presentation