SOC Recalibration using Matlab
Afficher commentaires plus anciens
Hello all,
I have test file of an 20Ah LFP Battery. I want to recailbrate the SOC at the end of Rest step. The Rest Step is 2hrs long. I have an SOC OCV lookup table for the battery in both charge and discharge direction. During recailbration, it is first checked what the step before the Rest step was. That is charging or discharging. Then the voltage at the end of the rest step is taken and the SOC should be taken from charge or discharge profile for recalibration. How can i implement this in matlab? The file is too large and cannot be attached. But a snippet from the test file is attached as picture. Any kind of help is hugely appreciated.

Réponse acceptée
Plus de réponses (1)
Gokul Gopakumar
le 15 Jan 2024
0 votes
4 commentaires
Hassaan
le 15 Jan 2024
Yes. You may need to adjust as per your requirements.
------------------------------------------------------------------------------------------------------------------------------------------------ If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback. Professional Interests Technical Services and Consulting Embedded Systems | Firmware Developement | Simulations Electrical and Electronics Engineering Feel free to contact me.
Gokul Gopakumar
le 16 Jan 2024
Hassaan
le 16 Jan 2024
The function recalibrateSOC is defined to take three arguments:
- data - The main dataset.
- socOcvCharge - The state-of-charge (SOC) open-circuit voltage (OCV) lookup table for charging.
- socOcvDischarge - The SOC OCV lookup table for discharging.
If you're seeing the error at Cell000Data.RecalibratedSOC = Nan(height(Cell000Data),1);, it seems that you might be trying to execute a line of code outside the function where Cell000Data has not been defined or passed as an argument to a function.
To rectify this error, ensure you are calling the recalibrateSOC function with all the required arguments. Here's an example of how to call this function correctly:
% Assuming 'Cell000Data' is your main dataset, and you have two other tables
% 'ChargeLookupTable' and 'DischargeLookupTable' that serve as SOC OCV lookup tables.
recalibratedData = recalibrateSOC(Cell000Data, ChargeLookupTable, DischargeLookupTable);
Before this call, you should have Cell000Data, ChargeLookupTable, and DischargeLookupTable defined in your workspace.
Here are a few additional checks and steps to troubleshoot:
- Check Your Workspace: Before calling the function, ensure that all the variables (data, socOcvCharge, and socOcvDischarge) are defined and available in your workspace.
- Check Function Call: Ensure that you are calling the function from another script or the MATLAB Command Window and that you are passing all the required arguments. The call should look like the example I provided above.
- Check Variable Names: Ensure that the variable names used when calling the function match the names of the variables in your workspace. MATLAB is case-sensitive, so Cell000Data, cell000Data, and CELL000DATA would be considered different variables.
- Check for Typos: Make sure that there are no typos in the function name and the variable names when calling the function.
- Check Data Types: The input data should be in the expected format. For instance, data should be a table, and socOcvCharge and socOcvDischarge should be lookup tables with 'Voltage' and 'SOC' columns.
- Use Breakpoints: Set a breakpoint at the beginning of the function and step through the function line by line to see where it might be failing.
- Check Function Definition: Make sure the recalibrateSOC function is defined in a file named recalibrateSOC.m and that the file is on the MATLAB path or in the current working directory.
If you're running a script that calls recalibrateSOC and you're still encountering the error, make sure that the script provides the correct input arguments to the function call. The line that is throwing the error should not be running on its own outside of the function; it should only execute as part of the recalibrateSOC function after the function has been called with the appropriate inputs.
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
Feel free to contact me.
Gokul Gopakumar
le 16 Jan 2024
Catégories
En savoir plus sur Electrical Block Libraries dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
