How to solve the Data Type Mismatch error in Active cell balancing

15 views (last 30 days)
I've developed an Active cell balancing model. The model and scripting file as no error, but while running the simulation, im getting data type error like this
An error ocurred while propagating data type 'Double'. I even attached the model. Can anyone say solution to my data type mismatch error.

Accepted Answer

Anthony Coadou
Anthony Coadou on 3 Jan 2023
Hello,
The problem is the size mismatch on port PWM. The block reads:
if SOC2<SOC1
s1=PWM;
s2=0;
elseif SOC1<SOC2
s1=0;
s2=PWM;
where s1 and s2 are alternatively assigned values of size 1 (scalar 0) and 2 (vector PWM). The MATLAB Function block tries to infer its output data types first, but fails to do so because of the type mismatch, and throws this cryptic error.
Hope that helps.
Anthony
  3 Comments
MAHENDRAN A
MAHENDRAN A on 5 Jan 2023
Hi Sir,
Actually for the 2 and 3 cell battery active cell balancing models are running and your answers were helping. But according to my project, I need all the cells to equally balanced and then constantly either charging or discharging related to the volatge circuit.
I've developed the model for 4 cell battery model along with logic script function for the model, which Ive attached below. My model is running with the script file I've return. But, the output SOC values is not equally balanced and charging,
Obtained Output
- For 4 cell, the 1st two cells charging separately and 2nd two cells doing separately.
For 6 cell, the 1st 3 ceells and 2nd 3 cells charging separtely, which ive shown in the below files that Ive attached.
I know Ive made mistkes in the scripting file, Can you guide me correcting this scripting function
Expected Solution - The output I'm expecting is that every cell should match at one point and should equally balanced as well as charging upto the stop time.
Fatma GÜZEL
Fatma GÜZEL on 17 Apr 2023
Hi sir,
Were you able to make any progress on the last subject you wanted to do?
I'm working on the same issue, I'd be glad if you could help.
There is no problem in controlling with PWM, but I still get a double error when I try to control it with PID.

Sign in to comment.

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!