Update Real Time Code Generator (RCG) authored by Ezekiel Dohmen's avatar Ezekiel Dohmen
...@@ -4,7 +4,19 @@ The Real Time Code Generator (RCG) is responsible for taking the model's Simulin ...@@ -4,7 +4,19 @@ The Real Time Code Generator (RCG) is responsible for taking the model's Simulin
![image](uploads/613e7cec095c0d7b88194509b356245b/image.png) ![image](uploads/613e7cec095c0d7b88194509b356245b/image.png)
## RGC Operation ## RGC Operation
The RCG works by parsing the model's `.mdl` file and flattening all the subsystems into one top level subsystem part. It then does part connection verification, like verifying parts that need ground inputs have them, and that all parts that need input connections are connected. It also replaces buses and `goto` links with the actual parts connected. It then verifies that connections are configured correctly, and will generate errors if any problems are found. Parts are then iterated over and code is generated for each one. The way that this works is that each cdsPart has an associated perl script/object with defined methods that return the code skeleton for that part.
### Part Methds
| Method | Purpose |
| ------ | ------ |
| `partType` | Returns the type of the part. (ie. AND, Filter, etc.) |
| `printHeaderStruct` | Returns the code that should be written to the model's header file for the given part. This is often nothing for simple parts (ADD, MULTIPLY), and is the EPICS output variable in the case of a EPICS outpu part. |
| `printEpics` | Prints the EPICS variables definitions for the given part. This goes to the EPICS channel list file. |
| `printFrontEndVars` | Returns the code that should be printed in the global section of the model code for the given part. This is usually variable definitions that store the state of the part. |
| `checkInputConnect` | This method allows a part to do its own input connection verification |
| `frontEndInitCode` | Returns the code that is run on the initialization cycle, this is run only once and can be used to setup complex structures, or simply zero variables. |
| `fromExp` | Returns the variable where the input of this part comes from. |
| `frontEndCode` | Returns the code that is run each cycle to preform the function of the part. |
## Main Build Products ## Main Build Products
| Name | Purpose | | Name | Purpose |
... ...
......