# I am trying to charge a battery model but I keep receiving a state of discontinuity error

**URL:** <https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325>\
**Category:** PLECS\
**Tags:** charging\
**Created:** [April 14, 2018, 9:18am UTC](https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325 "2018-04-14T09:18:55Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junior9696](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@Junior9696](https://forum.plexim.com/u/Junior9696)\
**Post date:** [April 14, 2018, 9:18am UTC](https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325/1 "2018-04-14T09:18:55Z")

</div>

Urgent help needed. I will attach the model below. It would be great if someone can help fix the error so I manage to complete the charging of the battery.

[CGR18650CG\_data.mat](https://forum.plexim.com/uploads/short-url/2Ikok0Nq77Alfv1YwHpK1ukDFqO.mat) (1 KB)

[ccc.plecs](https://forum.plexim.com/uploads/short-url/vcNQsSwJbRbiGzYdPfgaWkMkr8n.plecs) (136 KB)

---

<div class="post-metadata">

**Author:** ![Oliver\_Schwartz](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/oliver_schwartz/32/6_2.png) [@Oliver\_Schwartz](https://forum.plexim.com/u/Oliver_Schwartz)\
**Post date:** [April 18, 2018, 10:56am UTC](https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325/2 "2018-04-18T10:56:53Z")

</div>

Please provide a model.

---

<div class="post-metadata">

**Author:** ![Junior9696](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@Junior9696](https://forum.plexim.com/u/Junior9696)\
**Post date:** [April 18, 2018, 11:49am UTC](https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325/3 "2018-04-18T11:49:05Z")

</div>

sorry i thought i attached them before.

 ![Screen Shot 2018-04-18 at 16.18.01.png](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/1X/9eb8031bc961ee3c5ca88262e46cd1d84373de6d.png)

[ther battery.plecs](https://forum.plexim.com/uploads/short-url/85JpgWzlHCJg7tzsFhVSOq4sALK.plecs) (23.2 KB)

---

<div class="post-metadata">

**Author:** ![Falk\_Kyburz](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@Falk\_Kyburz](https://forum.plexim.com/u/Falk_Kyburz)\
**Post date:** [April 19, 2018, 2:05am UTC](https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325/4 "2018-04-19T02:05:30Z")

</div>

This model requires additional files. Please provide a minimum working example.

---

<div class="post-metadata">

**Author:** ![Oliver\_Schwartz](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/oliver_schwartz/32/6_2.png) [@Oliver\_Schwartz](https://forum.plexim.com/u/Oliver_Schwartz)\
**Post date:** [April 19, 2018, 2:38am UTC](https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325/5 "2018-04-19T02:38:35Z")

</div>

The model that you have attached does not relate to the error message you’ve posted. The posted model works (provided you have all required files and switch the solver to Radau, as suggested in the resulting error message).

---

<div class="post-metadata">

**Author:** ![Junior9696](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@Junior9696](https://forum.plexim.com/u/Junior9696)\
**Post date:** [April 19, 2018, 10:11am UTC](https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325/6 "2018-04-19T10:11:52Z")

</div>

these two files need to put together in the same folder

[ther battery.plecs](https://forum.plexim.com/uploads/short-url/85JpgWzlHCJg7tzsFhVSOq4sALK.plecs) (23.2 KB)

[CGR18650CG\_data.mat](https://forum.plexim.com/uploads/short-url/2Ikok0Nq77Alfv1YwHpK1ukDFqO.mat) (1 KB)

---

<div class="post-metadata">

**Author:** ![Junior9696](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@Junior9696](https://forum.plexim.com/u/Junior9696)\
**Post date:** [April 19, 2018, 10:16am UTC](https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325/7 "2018-04-19T10:16:00Z")

</div>

all required files are placed and the solver is radau. The simulation initialization for the cccv charger is in the initialization tab of the simulation parameters tool. The model should not be missing any files, sorry for any inconveniance

---

<div class="post-metadata">

**Author:** ![Oliver\_Schwartz](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/oliver_schwartz/32/6_2.png) [@Oliver\_Schwartz](https://forum.plexim.com/u/Oliver_Schwartz)\
**Post date:** [April 19, 2018, 10:25am UTC](https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325/8 "2018-04-19T10:25:00Z")

</div>

The error message that you’ve posted says:

```auto
The voltage across capacitor ther battery/C1 is forced to jump from 0 to 0.00349563.

```

```auto
...

```

The model that you have attached does not contain this capacitor and simulates without error.

Please also read [https://www.plexim.com/support/solutions/153](https://www.plexim.com/support/solutions/153).

---

<div class="post-metadata">

**Author:** ![Junior9696](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@Junior9696](https://forum.plexim.com/u/Junior9696)\
**Post date:** [April 20, 2018, 12:08pm UTC](https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325/9 "2018-04-20T12:08:43Z")

</div>

Hi oliver,

sorry the files were confused again

please find the latest one which demonstrates the problem

[ccc.plecs](https://forum.plexim.com/uploads/short-url/vcNQsSwJbRbiGzYdPfgaWkMkr8n.plecs) (136 KB)

[CGR18650CG\_data.mat](https://forum.plexim.com/uploads/short-url/2Ikok0Nq77Alfv1YwHpK1ukDFqO.mat) (1 KB)

---

<div class="post-metadata">

**Author:** ![Oliver\_Schwartz](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/oliver_schwartz/32/6_2.png) [@Oliver\_Schwartz](https://forum.plexim.com/u/Oliver_Schwartz)\
**Post date:** [April 23, 2018, 2:38am UTC](https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325/10 "2018-04-23T02:38:40Z")

</div>

You have connected two capacitors with different initial voltages in parallel (one inside of the LiIon cell subsystem, one outside). This results in an error at simulation start because with ideal capacitors you’d get an infinite current.

---

<div class="post-metadata">

**Author:** ![Junior9696](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@Junior9696](https://forum.plexim.com/u/Junior9696)\
**Post date:** [April 23, 2018, 7:57am UTC](https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325/11 "2018-04-23T07:57:57Z")

</div>

okay I fixed that error by changing the initial voltage on the cell model. However, it doesn’t seem like the charging process is working. Any idea about what parameters should I adjust to make it work? I will attach the updated version below

[ccc.plecs](https://forum.plexim.com/uploads/short-url/aCfrFuvJoRkxMVPSHS9vxOOdNO6.plecs) (146 KB)

[CGR18650CG\_data.mat](https://forum.plexim.com/uploads/short-url/2Ikok0Nq77Alfv1YwHpK1ukDFqO.mat) (1 KB)

---

<div class="post-metadata">

**Author:** ![Oliver\_Schwartz](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/oliver_schwartz/32/6_2.png) [@Oliver\_Schwartz](https://forum.plexim.com/u/Oliver_Schwartz)\
**Post date:** [April 23, 2018, 8:39am UTC](https://forum.plexim.com/t/i-am-trying-to-charge-a-battery-model-but-i-keep-receiving-a-state-of-discontinuity-error/325/12 "2018-04-23T08:39:51Z")

</div>

This sounds like an engineering problem rather than a support problem. We do offer engineering services (but not for free) - if you are interested, please contact [info@plexim.com](mailto:info@plexim.com).
