2022-08-05 22:05:10 +00:00
|
|
|
| [Home](/trick) → [Documentation Home](../Documentation-Home) → [Simulation Capabilities](Simulation-Capabilities) → Realtime Injector |
|
|
|
|
|------------------------------------------------------------------|
|
2019-11-20 17:04:58 +00:00
|
|
|
|
|
|
|
The Real Time Injector (RTI) allows the user to set simulation variables
|
|
|
|
synchronously without impacting real-time performance. The RTI performs the injection
|
|
|
|
as a top of frame job ensuring thread-safe variable operations.
|
|
|
|
|
2023-04-21 22:32:31 +00:00
|
|
|
## Adding and Injecting Variables
|
2019-11-20 17:04:58 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
trick.rti_add( char * var_name , long long value)
|
|
|
|
trick.rti_add( char * var_name , double value)
|
|
|
|
trick.rti_fire( unsigned int thread_id)
|
|
|
|
```
|
|
|
|
|
|
|
|
The rti_add call is typically executed in the input file or variable server,
|
|
|
|
rti_add requires a variable name and a value (the value may also be a variable name, expression, etc.).
|
|
|
|
The rti_add call invokes an overloaded function that currently allows either a 64bit integer or double
|
|
|
|
precision float value to be inputted as the value. The RTI will down cast the
|
|
|
|
value to the variable type pointed to by var_name. If the value is a variable name, the value of the
|
|
|
|
variable is determined at the time of the rti_add call, NOT when the injection (rti_fire call) is done.
|
|
|
|
|
|
|
|
Multiple variables are allowed to be injected at the same time with separate
|
|
|
|
rti_add statements. Trick keeps an internal queue of all pending variable injections.
|
|
|
|
|
|
|
|
The injection occurs at the top of the next real-time frame only after the rti_fire() call is commanded.
|
|
|
|
All variable(s) added with rti_add are set according to the values in the rti_add statement(s).
|
|
|
|
The queue of pending injections is then cleared.
|
|
|
|
|
2023-04-21 22:32:31 +00:00
|
|
|
## Adjusting Firing Frame
|
2019-11-20 17:04:58 +00:00
|
|
|
|
|
|
|
A frame multiple and offset may be set to only allow injections to occur on a frame multiple boundary
|
|
|
|
and offset.
|
|
|
|
|
|
|
|
```python
|
|
|
|
trick.rti_set_frame_multiple( unsigned int thread_id , unsigned int mult )
|
|
|
|
trick.rti_set_frame_offset( unsigned int thread_id , unsigned int offset )
|
|
|
|
```
|
|
|
|
|
2023-04-21 22:32:31 +00:00
|
|
|
## Listing Scheduled Injections
|
2019-11-20 17:04:58 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
trick.rti_list()
|
|
|
|
```
|
|
|
|
|
|
|
|
rti_list prints the list of pending injections to the screen.
|
|
|
|
Listing the injections is not a real-time friendly operation.
|
|
|
|
|
2023-04-21 22:32:31 +00:00
|
|
|
## Debugging Injections
|
2019-11-20 17:04:58 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
trick.rti_set_debug( True | False )
|
|
|
|
```
|
|
|
|
|
|
|
|
Debug statements are printed if the rti debug flag is true. But we don't need them
|
|
|
|
because there aren't any bugs. :D Debug statements are normally set to Off.
|
|
|
|
|
|
|
|
[Continue to Monte Carlo](UserGuide-Monte-Carlo)
|