InTRICKacies - nasa/gunns GitHub Wiki

InTRICKacies

Intricacies of the Trick environment. These are design limitations of the Trick-GUNNS interaction to be aware of:

Data Dropouts on Trick View

During run, certain GUNNS parameters show random value drops to zero on Trick View and stripcharts. This is described in detail here.

1-Frame Time Offset in Trick Data Recorder

When using Trick Data Recording to log data from a GUNNS model that is in a Trick “scheduled” job, there is a 1-frame discrepancy in time between the logged data and values shown on Trick View.

This happens because Trick updates the data recorder after the scheduled job but before time is updated. Therefore, logging sees the new values that GUNNS just calculated, but writes it to the log file with the old time. This page in the Trick Wiki lists the job order for the Scheduled Loop: https://github.com/nasa/trick/wiki/Executive-Scheduler

This affects the “flow” aspect networks: Fluid, Thermal, Electrical, since they are always run in Trick “scheduled” jobs.

This discrepancy doesn’t appear in data from a Trick integration loop model, such as the GUNNS Dynamics aspect, even though the data recorder is also updated by Trick after the integration loop and before time is updated. This is because Trick skips updating integration loop jobs on the first frame, and updates it at the top of the next frame before freezing. This difference in how Trick updates integration vs. scheduled jobs on the first frame is why logged data from the GUNNS flow aspects shows a time discrepancy but the dynamics aspect does not.

The series of pictures below illustrate the discrepancy. In this sim we are updating parameters x_integ and x_sched at 1/sec in Trick intergration & scheduled jobs, respectively. Both jobs have update period of 0.01 sec, and we show snapshots of the data log, Trick View, and the Sim Control window at each 0.01 sec interval:

Simulation start:

Note that the data log doesn’t record data for time zero.

After 1st 0.01 second step:

Here we see that x_sched has updated to 0.01 in both the log and Trick View as we expect, but the log shows time = 0 on that data row. This is because Trick hasn’t updated sys.exec.time until after the logger records the data. The data recorder has not written a data row for sys.exec.time = 0.01 yet.

After 2nd 0.01 second step:

Now the data logger shows the data for sys.exec.time = 0.01, which matches the expected value for x_integ, but x_sched still has the 1-frame offset.

After 3rd 0.01 second step:

The pattern is now evident, and repeats indefinitely:

Stripchart of the entire run:

Below we show how it appears in a Strip Chart. The Strip Chart application runs in a parallel process from the simulation and will sometimes sample sim data at some point between simulation frames, based on the natural variation of when threads run relative to each other. Here we can see that between times 0.01-0.02 and 0.02-0.03, Strip Chart sampled x_integ and x_sched in between simulation frames, after the scheduled job update but before the integration job updated.

⚠️ **GitHub.com Fallback** ⚠️