Specialized Power Systems in an S-function (C code generation)

6 次查看(过去 30 天)
I have an electrical system made of specialized power systems blocks. A controller measures the outputs of the system and generates input control signals to regulate it. The idea is to generate a C code of the electrical system (using simulink C code generation), including just the SPS blocks, then put it inside an S function and connect the controller externally. Is this possible? The objective is to deploy the system in a DSpace to perform a real time simulation or hardware in the loop (we dont have FPGAs or specific software/hardware) so we are doing this from scratch.
I have a workflow in mind.
1) Prepare the simulation, definining outputs and inputs (similar to HDL code generation).
2) Generate the code
3) Designing the s-function (I assume the block would have the inputs and outputs ports I defined)
4) Connect the controller.
5) Deploy the blocks in DSpace
I hope this is possible, thank you, and Im open to different solutions.

采纳的回答

Kothuri
Kothuri 2025-2-7
Hi Franco Huidobro Bandala,
The workflow you proposed is feasible and you can try the below steps:
  • For building the electrical system, instead of using the Specialized Power Systems blocks you can use Simscape Electrical blocks as they are capable of generating C code.
  • The generated C code can be wrapped inside the S-function.
  • Since the electrical system will be inside the S-Function, you can connect the controller externally.
  • Ensure that the solver settings match real-time requirements.
  1 个评论
Franco Huidobro Bandala
Hi, thank you for your answer.
I am using SPS because its a large power system and I could get a C code generated from those blocks. Honestly, I do not have more ideas to continue with the workflow. Could you give me more details about how to prepare the simulation for example or could you share resources on internet. My impression is this is not broadly documented.
Thank you again for you help.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Switches and Breakers 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by