Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrote a Real-time Best Practices HOW TO #1710

Merged
merged 4 commits into from
May 20, 2024
Merged

Conversation

jmpenn
Copy link
Contributor

@jmpenn jmpenn commented May 13, 2024

Title says it

@jmpenn jmpenn requested review from hchen99 and sharmeye May 13, 2024 19:13
@coveralls
Copy link

coveralls commented May 13, 2024

Coverage Status

coverage: 55.943%. remained the same
when pulling 5b994e6 on Realtime-Best-Practices
into 26c18d9 on master.


#### 1.1 Trick events are computationally expensive. Use them judiciously.

Trick events can provide a quick, easy, way to customize the behavior of a sim, based on some condition. But, because they require Python interpretation, they are slow. They are not intended for implementation of permanent sim functionality. If they are over used, they can seriously degrade simulation performance. So, take it easy with the events.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick, easy, -> quick and easy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


#### 1.2 Disable Trick run-time components that your sim doesn't need.

```default_trick_sys.sm```, the file included at the top of any Trick ```S_define``` file defines numerous "modules" that provide functionality to a Trick sim. Whereas some of these modules ( like the Executive, MemoryManager, CommandLineArguments) are required for any Trick Simulation to function, many are optional. If the modules are not needed, then disabling them can improve simulation perfromance.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfromance -> performance

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


#### 1.3 Consider running Trick variable server clients and Sims on different machines.
Trick variable server clients communicate with a simulation via a TCP/IP connection.
The client process may, but isn't required to run on the same machine as your simulation process. On the same machine, both will competing for the same resources. This can degrade sim performance, especially when clients are rendering high-definition graphics.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may, but isn't required to -> may, but isn't required to,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

SubmarineSimObject dyn;
...
```
This job only transmits information. It doesn't effect the simulation, but does degrade real-time performance slightly. To disable it, we'll add the following to our input file:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

effect -> affect

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.


#### 2.2 Try to reduce variation in job cycle times.
Realtime performance is largely about minimizing the worst case, rather than the average case.
The most well behaved job takes the same time, every time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

takes the same amount of time

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.


![Real time with itimer](images/UMA_Arch.png)

In an UMA architecture, as the number of CPUs increases, the higher tha chance that the system bus will become a bottle-neck.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

higher the chance

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -0,0 +1,497 @@
# Trick Real-time Best Practices
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throughout document, alternating between real-time and realtime should be eliminated. Pick the one that you hate the least and roll with it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed all to realtime, except in the title of a referenced document.


Real world dynamic systems change in real time (the time that you and I experience). A simulated dynamic system changes in simulation-time. Simulation time begins at t=0, and runs until we stop it. Simulation time can elapse faster or slower than real-time.

If we want to interact with a simulation as if it were real, we need to synchronize simulation time to real time. This requires that a simulation is capable of running at least as fast as real time. If it is incapable, then it can not be made to run in real time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to use either real-time or real time consistently?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above issue. Fixed.

<a id=frame-log-files></a>
#### Frame Log Files
Frame logging records the following data files in your sim’s RUN_ directory:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to add log_timeline.csv and log_timeline_init.csv as in trick-dp section mentioned 5 data product xml files.

Copy link
Contributor Author

@jmpenn jmpenn May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added descriptions to these files.

|# | Name | Type | Units | Description |
|--:|:---- |:-----|:-----:|-------------|
| 1| ```sys.exec.out.time``` | double | seconds |Simulation Time |
| 2| ```trick_real_time.rt_sync.frame_time``` | double | seconds | This badly named parameter expresses the amount of time that the scheduled jobs in this frame took to execute. See: [figure](#figure-Real-time-under``-run)|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This figure link doesn't seem to work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@jmpenn
Copy link
Contributor Author

jmpenn commented May 17, 2024

I think I've fixed all of the issues. Should be ready to merge.

@hchen99 hchen99 merged commit 4d621e0 into master May 20, 2024
13 checks passed
@hchen99 hchen99 deleted the Realtime-Best-Practices branch May 20, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants