Integration of Battery in CM

I want to integrate my own made battery from Simulink to CM but I have tried several times with different methods and I can’t get it. I have a battery model in Simulink and want to integrate it with CM, how should I go about it and be able to do it. Should one make it FMI/FMU file and then integrate or what is the best way. I have tried with FMI/FMU file but also got a lot of problems there. I would have liked clear instructions on how to integrate it.

thanks in advance

Good afternoon,
you can connected the signals at the powertrain level

or better is to use a CarMaker plug in model as described in section 8.3 of the programmers guide

There are already some built examples like the
in the src folder of your project folder.
if you don’t have displayed that folder make sure you update the project folder

Hey, thank you for fast answer. I have tried with the FMU but when I generate the code, with simulink coder i get this error

Do I need to change the model here as well to the generated FMU?

Could you pleas describe the steps in this case and what should I change in this case ?

Hi, if you open FMU plug-in it should appear here

Thank you, but how do I solve this problem.

Do I even need to generate code from Simulink coder ?