# Integration of Battery in CM

**URL:** <https://forums.ipg-automotive.com/t/integration-of-battery-in-cm/795>\
**Category:** Coding & Integration\
**Tags:** student, carmaker\
**Created:** [27 January 2024 12:50 UTC](https://forums.ipg-automotive.com/t/integration-of-battery-in-cm/795 "2024-01-27T12:50:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fcm.user](https://forums.ipg-automotive.com/letter_avatar_proxy/v4/letter/f/cc9497/32.png) [@fcm.user](https://forums.ipg-automotive.com/u/fcm.user)\
**Post date:** [27 January 2024 12:50 UTC](https://forums.ipg-automotive.com/t/integration-of-battery-in-cm/795/1 "2024-01-27T12:50:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![roberto.ortolan](https://forums.ipg-automotive.com/letter_avatar_proxy/v4/letter/r/96bed5/32.png) [@roberto.ortolan](https://forums.ipg-automotive.com/u/roberto.ortolan)\
**Post date:** [29 January 2024 14:37 UTC](https://forums.ipg-automotive.com/t/integration-of-battery-in-cm/795/2 "2024-01-29T14:37:00Z")

</div>

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

 ![image](https://forums.ipg-automotive.com/uploads/default/original/1X/ff782e143442026a5870dc395d69228f37ff0f8d.png)  
or better is to use a CarMaker plug in model as described in section 8.3 of the programmers guide  
 ![image](https://forums.ipg-automotive.com/uploads/default/original/1X/5edd62fdd168747c9225aefc7a2fcd43dd4112e1.png)

There are already some built examples like the  
MyBattery\_RTW.mdl  
in the src folder of your project folder.  
if you don’t have displayed that folder make sure you update the project folder  
 ![image](https://forums.ipg-automotive.com/uploads/default/original/1X/584f9238dec720c858a61dbb616454f2ca02d55d.png)

---

<div class="post-metadata">

**Author:** ![fcm.user](https://forums.ipg-automotive.com/letter_avatar_proxy/v4/letter/f/cc9497/32.png) [@fcm.user](https://forums.ipg-automotive.com/u/fcm.user)\
**Post date:** [31 January 2024 07:46 UTC](https://forums.ipg-automotive.com/t/integration-of-battery-in-cm/795/3 "2024-01-31T07:46:53Z")

</div>

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

 ![image](https://forums.ipg-automotive.com/uploads/default/original/1X/1217d7ebe953f38b50ba9aca76ccbdb893e02f34.png)

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

 ![image](https://forums.ipg-automotive.com/uploads/default/original/1X/f939df26737605ac86103455557ab00296e4e8d4.png)

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

---

<div class="post-metadata">

**Author:** ![roberto.ortolan](https://forums.ipg-automotive.com/letter_avatar_proxy/v4/letter/r/96bed5/32.png) [@roberto.ortolan](https://forums.ipg-automotive.com/u/roberto.ortolan)\
**Post date:** [31 January 2024 17:04 UTC](https://forums.ipg-automotive.com/t/integration-of-battery-in-cm/795/4 "2024-01-31T17:04:53Z")

</div>

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

 ![image](https://forums.ipg-automotive.com/uploads/default/original/1X/84c0058628ce1f2fa5832ae1478cc26b25034079.png)

---

<div class="post-metadata">

**Author:** ![fcm.user](https://forums.ipg-automotive.com/letter_avatar_proxy/v4/letter/f/cc9497/32.png) [@fcm.user](https://forums.ipg-automotive.com/u/fcm.user)\
**Post date:** [31 January 2024 20:30 UTC](https://forums.ipg-automotive.com/t/integration-of-battery-in-cm/795/5 "2024-01-31T20:30:34Z")

</div>

Thank you, but how do I solve this problem.

 ![image](https://forums.ipg-automotive.com/uploads/default/original/1X/42e613839f145197a40893145c43b03ac606b07d.png)  
Do I even need to generate code from Simulink coder ?
