This page is to document and explain the operation of the banked running variable system and structure.
The program running variables are divided into three broad groups: inputs, working and outputs. For both the input and output groups there are two copies of each set of variables, whereas there is only one copy of each set in the working group. This is required to allow both the inputs and outputs to be safely written and read at the same time. To facilitate this all sets of variables within the input and output groups are referenced with two pointers each. For the input group, the copy pointed to is swapped when fresh data is both available to and required by the mathematics function. For the output group the copy pointed to is swapped when the mathematics function has produced new output data. The input data is supplied by the engine position interrupt service routines as ADC readings and RPM values. The output data consists of pulse widths, timing angles, dwell periods and scheduling information.
Accessory functions (Idle, Boost, etc)
In order to achieve minimal latency and maximum frequency of execution of the main mathematics code the accessory functions must run asynchronously. Although we can guarantee that these functions will base their calculations on a matched set of data, we can not guarantee that it will be the same set of data presented along side the accessory data in the data log. Thus, where it is required to see the inputs that an accessory functions calculations were based on, those values should be cached for logging on a per function basis.
Although it seems like a lot of trouble to go to, it is critical to transient performance that the environmental conditions the engine is operating under are tracked and reacted to as quickly as possible. Having the less important stuff run asynchronously will result in an order of magnitude improvement of parameter tracking and is well worth the extra memory expense and complication.