How nasa/sil works
Main Components
• Simulink Model / Autocoding Environment: Represents the user’s model in Simulink that is the source for auto-code generation.
• SIL Code Generation Pipeline: The extension to Simulink’s tools (incorporating MATLAB classes, scripts, and TLC [Target Language Compiler] files) responsible for describing and configuring model interfaces.
• cFS ECI Integration Layer: This encapsulates the generic wrapper code that interfaces with the Core Flight System’s APIs (table services, time services, software bus, events, and fault reporting).
• Supporting Libraries and Utilities: Includes custom MATLAB packages (e.g., the +cfsPackage with its specialized classes like Parameter, Signal, customAttribs, etc.), mex functions (providing low-level integrations), and utility scripts that prepare and configure the environment.
• Testing Framework: Unit tests and ECI compatibility tests that exercise both the integration (by generating simulink models and verifying the output) and any code parser/analysis capabilities.
Relationships & Interactions
• Within the SIL Code Generation Pipeline, denote sub-components such as:
– MATLAB classes (from the +cfsPackage) that encapsulate parameters, signals, and other attributes.
– TLC files which are used to customize the code generation (for instance, cfsCmdMessage.tlc, cfsCriticalDataStorage.tlc, etc.).
– Utility scripts (e.g., in src/util and mex) that support the compilation process.
• Testing Framework interfacing with multiple components (SIL pipeline outputs, and directly with sections of the ECI integration) to validate functionality.
Architectural Patterns / Design Principles
• Modularity: The division into separate directories (src, tests, doc) and packages (e.g., +cfsPackage) implies a modular design where functionality is encapsulated into narrowly defined components.
• Layered Architecture: The structure (from Simulink model through SIL abstraction to the runtime integration with cFS) conforms to a layered design paradigm.
• Extensibility: The inclusion of custom attribute classes and code parser utilities (found in tests/unit/+cfetargettester) demonstrates a system designed with extensibility in mind.
• Code Generation & Automation: The heavy emphasis on TLC files, mex functions, and auto-generated code signals an architecture built around automated code generation pipelines.
Mention Relevant Technologies, Frameworks, and Libraries
• MATLAB & Simulink (with toolboxes such as Embedded Coder, Simulink Coder, and MATLAB Coder).
• Core Flight System (cFS) APIs – including table services, time services, software bus, event services, and fault reporting.
• TLC (Target Language Compiler) for customizing code generation.
• MEX functions: These are used for integration with low-level C code.
• Testing frameworks (unit tests as seen in tests/unit, ECI compatibility tests).
• Clear labels for each major component, such as:
– “Simulink Model / Autocoding Environment”
– “SIL Code Generation Pipeline” (with subcomponents: MATLAB Classes, TLC Files, Utilities, and MEX Functions)
– “cFS ECI Integration Layer”
– “Testing & Validation Framework”
– Data/code flow from Simulink to the SIL pipeline.
– Integration and interfacing from the SIL pipeline to the cFS system.
– Feedback loops from the testing components back to the SIL pipeline and possibly Simulink inputs.
Happy diagramming!