C code export
This section describes C code export option.
C code export provides an option to generate C code for a selected subsystem within a schematic model.
Even though the code is generated only for a selected subystem, the whole schematic is evaluated. This makes sure that the namespace and signal types are calculated properly for every component inside the selected subsystem.
- Model menu (Model → C code export → Settings), and
- Context menu (right click on the component, then in menu C code export choose Settings), and
- Exacly one subystem is selected,
- Selected subsystem does not contain electric components, and
- Selected subsystem does not contain HIL-specific components.
If at least one of the requirements from above is not met, an error message will be shown in the Schematic console.
Once C code export is finished, all files needed to succesfully run the code are created inside the destination directory. For every subsystem used for C code export, an appropriate header (.h) and source (.c) file will be generated. The C code inside these files is structured in a such way that allows easy reusability. This is accomplished by encapsulating all relevant data (variables) inside a single Model structure, which is passed as an argument to both init and step functions - which are used to interact with the generated C code.
- ExtIn - contains variables generated from the inputs of the selected subsystem,
- ExtOut - contains variables generated from the outputs of the selected subsystem,
- Sinks - contains variables generated from SCADA Ouput, Digital Probe, and Probe components, and
- States - contains variables used to preserve the state between successive calls of step function.