Simulink Real-Time input and Output to computer program

5 views (last 30 days)
I'm currently working on a project in my spare time where I am designing control systems and implementing them in Kerbal Space Program (a space physics sandbox). I am using KRPC which allows me to stream data and send commands to the program in C#, C++, Java, Lua and Python.
I've had quite a lot of success so far, I've been using MATLAB and Simulink to design my controllers and ave then been implementing them in Java. Is there any way to use Simulink Real-Time to simplify the implementation of my controllers? I've read that Simulink Real-Time C API allows you to "write the custom program in a high-level language (such as C, C++, or Java®) that works with a real-time application. This option requires that you are an experienced programmer.". I wouldn't describe myself as an experienced programmer (I'm an undergraduate Aerospace Engineering student), however KRPC allows me to send and receive data from KSP easily as well as allowing me to send commands to spacecraft in a format that I am very familiar with.
My question: Given all of this, is it possible for me to use Simulink Real-Time to design and implement control systems in C++ or Java?
I am very comfortable using Simulink but Simulink Real-Time is something that I've never used before and I'm struggling to find the information about whether it could be appropriate for this project.
Thanks, Sam

Accepted Answer

Jon Lobo
Jon Lobo on 9 Aug 2017
Hi Sam,
Simulink Real-Time leverages a dedicated computer running the Simulink Real-Time Kernel. Using Simulink Coder, you can generate C code from your Simulink model (control system), compile to a real-time application, and download to the dedicated real-time target computer. Within MATLAB, there is an API to allow you to interact with your control system that is now on the target computer: you can do things like tune parameters, log data, and build UIs for example.
I know this was a lot of build up, but the end point is that there is a C API for this to allow users to create applications outside of MATLAB that are intended to connect to the real-time application running on the real-time target.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!