C#: Custom Components Tutorial
Nominal Editor ships with Editor CSharp, a C# solution file that enables custom components to be written in a more traditional programming language. The Mono runtime interpreter can read from C# DLLs and handle the data interoperability between the two environments. This tutorial series will demonstrate how to create a C# component and import it into Nominal Editor. The tutorial will create a custom solar panel that calculates the total power produced over the simulation lifetime and a custom thermal sensor that uses the atmosphere’s temperature and the solar panel’s power to produce an estimate of the temperature with some noise.
Table of Contents
- Creating a Simulation Class
- Creating a Solar Panel
- Creating a Sensor
- Creating a Message
- Building the Solution
- Creating the Object Blueprints
- Building the Level
- Plotting Data
Minimum Requirements
Nominal Editor must be installed before this tutorial commences. Information about how to install Nominal Editor can be found in the document below.
Visual Studio 2022 is used in this tutorial, although other IDEs can be used instead. An appropriate IDE with a C# builder must be installed before this tutorial commences. Information about how to install a solution can be found in the tutorial below.
The data downlink tutorial must have been completed before this tutorial. Although no TT&C elements will be present in this tutorial, some of the blueprint and Nominal architecture knowledge will be required at certain points.
Key Learnings
- Simulation Components: Understand how to code simulation components in C# using Visual Studio and the Nominal simulation infrastructure.
- Custom Messages: Create custom C# messages to store data from simulation components within the Nominal simulation infrastructure.
- Mono Objects: Compile DLLs in a C# solution with custom simulation objects and import them into Nominal Editor to use within simulations.
- Mono Properties: Understand how to use the Mono property functions in Nominal Editor to read and write data from C# components.