A motor controller takes measurements as inputs, and outputs a control signal that allows a motor to operate and spin.
In an effort to improve design and testing processes, one of NASA’s key goals is developing a scalable control architecture for use on several electrified aircraft concepts. This architecture allows for automatic generation of motor control software from a simulation environment, making the development process quicker and more efficient compared to traditional software development practices.
Generating Code from Controller Models
Code generation is the process of generating conventional text code from visual models.
The motor controller is developed in a simulation where it is connected to the other components of a motor power system. In the simulation environment, the controller operates a power converter to control a motor. Code generation is used to automatically convert the controller in simulation to code that can be loaded onto a real controller in a physical system. The controller model that runs in the simulation becomes the code that runs real-life hardware.
Using this development approach is much quicker than writing traditional control software for complex control algorithms. Additionally, the visual controller model is easier to follow and the tight integration with simulation allows more in-depth analysis during hardware and software integration.
Development Benefits of Code Generation
- Shortens motor controller development time.
- Visual model is easier to follow.
- Full system simulation increases confidence and safety going into physical testing.
- New algorithms can be implemented and tested fully in simulation prior to hardware testing.
- Helps developers more easily find, understand, and debug problems.
- Iterative approach between simulation and hardware testing allows simulation to become more accurate, and gives future controller models developed in simulation a higher chance of initial success on hardware.
Flight Certification Benefits of Code Generation
- Visual models can represent on a single screen what would be hundreds or thousands of lines of code, making the full model much easier to navigate through than the full code base.
- Software can be analyzed at the model level using tools to identify design flaws.
- Generated code can be analyzed using Static Code Analysis tools to identify design defects, errors, cyclomatic complexity, software quality metrics, and to verify and prove that design errors can’t occur.
- Code can be generated to adhere to various coding standards.
- Models can be analyzed for checks on coding, modeling, or high integrity software development standards, metrics, and software quality objectives.
- Models and generated code can be assessed for Modified Condition/Decision Coverage (MC/DC) to measure testing coverage.
- Models can be assessed for dead logic, division by zero, overflow, and other design errors.
- Model tools can generate MC/DC test cases based on coverage objectives.
- Improve inefficiencies at the model level to prioritize model performance.
- Address model problems and design defects early in development.
Application and Next Steps
Code generation has successfully been used in the High Lift Motor Controller (HLMC) being developed under X-57. The development process has already been shown to decrease development times and lessen the differences between simulation and the real world.
Having a scaled control architecture allows the system that works for X-57 to be implemented on the Advanced Air Transport Technology (AATT) 250kW converter and eventually the 1.4MW High Efficiency Megawatt Motor (HEMM).
Although hardware interfaces differ between the X-57 and AATT projects, the control algorithm (which is the most challenging part) is mostly the same and can be reused on each project.