Problems modeling a battery behaviour to generate C Code.

2 visualizaciones (últimos 30 días)
Iker Fernandez Requejo
Iker Fernandez Requejo el 9 de Oct. de 2023
Comentada: Iker Fernandez Requejo el 20 de Oct. de 2023
I have a functional Simscape model of a battery which response I wanna replicate using Simulink blocks in order to generate C Code. The main problem is that I have a "Infinite Loop" problem so I can't generate C Code. The infinite loop can easily be solved using a unit delay, but when you incorporate it to the model, the current (and the battery voltage) signal starts to oscillate in the moment the change between charge/discharge state occurs. To achieve that change from discharge to charge states I use a switch block (I've already tried to change the switch block using logic and that solution does not work).

Respuestas (1)

Sabin el 11 de Oct. de 2023
Editada: Sabin el 12 de Oct. de 2023
It is possible to generate C code from the Simscape model directly:
  1 comentario
Iker Fernandez Requejo
Iker Fernandez Requejo el 20 de Oct. de 2023
For the especific purpouse of the application it is mandatory to use only Simulink blocks.
Thank you!

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by