Graphics.DspSimdataNew - lordmundi/wikidoctest GitHub Wiki

Sim Data plugin (2.1 and above)

« Customizing the view layout | EDGE User’s Guide | Simdata API File Reference page »

This is the new Simdata documentation for versions of EDGE 2.1 and above. For older versions, see this page.


Sim data visualization interface

How to Use: Visualizing Recorded Data

To generate the data:

  1. If your sim currently uses DCOMM, you may leave comm on in your sim or turn it off using graphics.data.comm.active = False;
  2. You may set the Graphics object on or off in the sim. However, you must know which you are doing, since you will need to choose a corresponding API file when you visualize the data.
  3. Make sure you are recording all of the variables that you need
  4. Optional: turn off realtime so that the sim runs faster
  5. Run the sim and record the data. Use the output .trk file in the next steps

To visualize recorded data:

  1. Select Options→Sim-data Dlg
  2. Click the "Pick API File" button. Select the API file you wish to use. See the API File Reference page for more info. Make sure that you are using an API file that contains data transforms if the Graphics object was turned off when the .trk file was recorded, or an API file that directly accesses the Graphics parameters if you had the Graphics object on. It is acceptable to use an API file that has both data transforms and direct Graphics parameters, however you will get a warning message if parameters or transforms are not supported by the recorded TRICK data file.
  3. Click the "Pick Data Source" button. Choose "Recorded" and select your recorded TRICK data file.

Use the simdata controls as normal. Use the "User Defined" scale to set the playback scale as low or high as you want, or to control the size of the time step when stepping through the data in paused mode. Note that to change the "User Defined" entry you must enter the new rate then hit Enter to tell simdata you are done.

To override the default sim_data directory location:

There is an environment variable called "SIM_DATA_DIR" that is used to provide the default. In EDGE 1.0, this is being defined in the cev.cfg unfortunately. Please see this issue for more details and a workaround.

How to Use: Visualizing a Live Sim

Connecting to a live sim through Sim Data Dialog GUI:


Sim data Live Connection

  1. Select Options→Sim-data Dlg
  2. Click the "Pick API File" button. Select the API file you wish to use. See the API File Reference page for more info. Make sure that you are using an API file that contains data transforms if the Graphics object is turned off in the sim. If the Graphics object is turned on, you will save some CPU cycles by not using an API file with transforms, but you will not be broken by using an API file that has them. It is acceptable to use an API file that has both data transforms and direct Graphics parameters, however you will get a warning message if parameters or transforms are not supported by the sim. Note that every parameter in the API file must be sent from the sim variable server, so using both transformed and untransformed versions of the same parameters may cause hiccups during playback if the network cannot handle the load.
  3. Click the "Pick Data Source" button. Choose "Live" and select the sim to which you wish to connect. If you see the message "Waiting on Data…" please give simdata a few seconds to finish gathering data on which sims are available (this process takes approximately 5 seconds). Once a sim is selected, simdata will automatically attempt to connect to it, and will indicate the status of the connection on the display.

Automating connection to live sim at EDGE startup:

If you start and restart both sims and EDGE regularly it can be tedious to use the GUI to connect to a sim. There is a way to configure EDGE to automatically connect to a Trick sim assuming certain settings are constant. Include a tcl file in your user.cfg which does the following:

simdata_set_sim "127.0.0.1 7000 1x"
 simdata_startlive

This assumes that in your Trick sim resides on the same localhost as EDGE and that you've set the Trick variable server to a hardcoded 7000. Change those to whatever you need it to be. Now you won't need to deal with the simdata dialog. If you still want the dialog to appear, also add this line to the same tcl file:

Window show .simdatadlg

Controlling the visualization:


Sim data Live Sim Running

The simdata controls largely function as normal, but note that you are controlling the visualization of the data received over the network — not the sim itself. Thus if you click the pause button, you are pausing your visualization, while the sim continues to run. If you need to control the sim, you may use the usual TRICK sim control panel. Simdata will keep all incoming data as long as possible but it does have a finite buffer size, so eventually earlier data points will need to be dropped to allow the latest data to be made available.

  1. At initial connection simdata is paused, which means that the visualization is paused, even though data is being received from the sim.
  2. To follow or resume following the sim from a paused state, click the play button to resume playback, then click fast-forward. Clicking fast-forward without first clicking play will move the slider to the most recent data point received, but will leave simdata paused.
  3. While connected, the rewind button will move the slider back to the first data point in the buffer. This may not be the start of the sim if the sim was already running when the connection was made, or if the amount of data to be visualized is larger than the simdata buffer can hold.
  4. The slider may be dragged to any available time position to see the sim visualization as it was at that point in time. Note, however, that if the buffer fills, a chosen data point may be discarded. If you need to analyze a time slice at length, freezing the sim or recording the sim data for off-line analysis is recommended.
  5. When the sim ends, simdata will be disconnected. However, the simulation data in the buffer is still available for visualization until EDGE is terminated, or another sim or file is loaded.
  6. You can use the "User Defined" scale to set the playback scale as low or high as you want, or to control the size of the time step when stepping through the data in paused mode. Note that to change the "User Defined" entry you must enter the new rate then hit Enter to tell simdata you are done.

Troubleshooting connection and data problems

  1. Usually simdata will detect all sims available on a subnet. If, for some reason, simdata cannot detect a sim that you know is out there, you may still be able to connect manually if you know the host and port. To try this, select "Manual Input" under the "Live" menu, enter the host and port, and click "Go." Note that simdata must be able to connect directly via TCP/IP to a sim. If you need to attach to a sim on a different network, you may be able to accomplish this using port forwarding over an SSH tunnel.
  2. Playback over a network may not be as smooth as playback from a file due to network constraints and OS buffering on the sim side. This is especially true if the sim is running faster than real-time. Obviously, the less data that needs to be sent per frame the better playback is likely to be, so consider using an API file with only the parameters and transforms you need.

Writing your own transforms

  1. Simdata is supplied with built-in standard orbital transforms, as well as a plume transform, and a special transform to handle chute status. It is possible (and encouraged!) to write your own transforms to support whatever specific capabilities you need. The easiest way to do this is to place your transforms under $DOUG_HOME/src.dist/plugins/playback/libapi/transforms. Writing a transform is not that hard, and if you use an existing transform as a template, and place it in the libapi/transforms directory with a .cpp extension, the makefile will compile it correctly with the right flags and place it in the $DOUG_HOME library directory, ready to be loaded. If you'd rather store your transforms somewhere else, make sure you follow the following points.
  2. Transforms must have the signature void myfunc(Values& ins, Values& outs). The Values class is defined in transformation.hh in $DOUG_HOME/src.dist/plugins/playback/libtvs for EDGE 2.1, and $DOUG_HOME/src.dist/plugins/common/libtvs for EDGE 2.2 and above. It handles the mapping between API parameters and aliases defined in the API file that you can use to make your transforms generic, rather than tying them to hardcoded parameter names. See the API File Reference page for information on how this mapping works. The idea is that you will "ins" values and produce "outs" values. It is an error to use an "in" or "out" parameter that has not been defined in the API file, or to fail to provide an "out" parameter value for each transform output specified in the API file.
  3. Transforms must have "C" linkage
  4. Transforms must be compiled to .so files with the -ldl, and —shared flags.

« Customizing the view layout | EDGE User’s Guide | Simdata API File Reference page »