Unexpected simulation results from BatteryStateful model

  • abrac
  • Topic Author
More
05 Apr 2022 09:25 #10805 by abrac
Hi there. I would like to use the BatteryStateful model through PySAM. I've managed to set it up, but the results don't seem to be correct.

I have created a minimum working example to show this:

I set up a model with the parameters shown in the attached JSON file (

File Attachment:

File Name: mwe.json.txt
File Size:4 KB
). In my Python code, I set the input power of the battery as 10 kW, and the simulation timestep as 1 minute. Then I executed the model. The energy that is supposed to be absorbed by the battery is 10*1/60 = 0.167 kWh. However, the energy that actually gets absorbed into the battery is 2.89 kWh.

I have attached my python code (

File Attachment:

File Name: mwe_2022-04-05.py
File Size:1 KB
). I also show the code here below, with the output of the script.

The code:
Code:
# Import libraries: from PySAM import BatteryStateful import json # Initialize the model: model = BatteryStateful.new() with open("mwe.json.txt", 'r') as parameter_file: data = json.load(parameter_file) for key, val in data.items(): model.value(key, val) model.value('dt_hr', 1 / 60) # Run the simulation for a one-minute timestep. model.value('input_power', -10) # Let the power input be 10 kW. model.setup() # Run the model for one timestep, with an input power of 10kW: model.execute() # Execute the model. # View the result: print("Power provided to battery: \n\t10 kW") print("Power absorbed by battery: \n\t" + str(abs(model.StatePack.P)) + " kW") print("Energy expected to be absorbed by battery: \n\t" + str(abs(model.StatePack.P * 1 / 60)) + " kWh") print("Energy actually absorbed by the battery: \n\t" + str(model.StatePack.SOC / 100 * model.ParamsPack.nominal_energy) + " kWh")

The output:
Code:
Power provided to battery:   10 kW Power absorbed by battery:   10.000000000000014 kW Energy expected to be absorbed by battery:   0.1666666666666669 kWh Energy actually absorbed by the battery:   2.8879938952723645 kWh
I hope you can help me figure out what the reason is for this issue. I hope I am not using the model incorrectly...

Chris

Please Log in or Create an account to join the conversation.

  • pgilman
More
07 Apr 2022 19:25 #10814 by pgilman
Hi Chris,

This behavior seems to be related to the initial state of charge (SOC). In this case, you have set (in the JSON file) the initial SOC to zero (note that the minimum SOC is 20%). I tried changing the initial SOC to 5% and 20%, and for both of those runs, setting 'input_power' to -0.5 resulted in P = -0.5, which I think is the result you are expecting.

For a real battery, you would want to avoid discharging the battery below the minimum SOC.

I'll ask the model developer about this and follow up if there's more to add.

Thanks,
Paul.

Please Log in or Create an account to join the conversation.

  • abrac
  • Topic Author
More
12 Apr 2022 08:54 #10833 by abrac
Thank you, Paul! I changed my model parameters to ensure that the battery is never fully discharged. However, I have a follow up question: Even when I am operating the battery in the acceptable range, the SOC value does not increase proportionally to the charge added into the battery... My understanding is that the SOC is calculated as the energy in the battery divided by the nominal energy capacity of the battery. However, when I run the model, this does not seem to be the case. For example, if I have a battery with 10 kWh nominal energy, and I start with an SOC of 5%, then I expect 0.5 kWh of energy to be present in the battery. If I then charge the battery with 10 kW over a 1 minute timestep, I expect the 10 * 1/60 = 0.167 kWh of energy to be added to the battery. Thus the energy in the battery would be 0.5 + 0.167 = 0.667 kWh, which results in an SOC of 6.67%. However, when I run this in the model, I get an SOC of 19.3%. I have attached a minimum working example.

Please Log in or Create an account to join the conversation.

  • dguittet
More
15 Apr 2022 17:09 #10841 by dguittet
Hi Chris,

The leadacid chemistry model uses a "KiBAM" capacity model which accounts for the peukert effect, which is much higher for lead than for li-ion. The model parameters leadacid_q20, leadacid_q10, leadacid_qn, and leadacid_tn are used to fit the leadacid capacity model. From your parameters:

    "leadacid_q20": 100,    "leadacid_q10": 43,    "leadacid_qn": 40,    "leadacid_tn": 1,
Means that at a C rate of 1/20C, the battery has 100% capacity, but at a C rate of 1C ("qn"), the battery only has 40% capacity. These parameters are adjustable, but in practice it is not very flexible in that it is hard to get a set of parameters that can model a wide range of c-rate to capacity behaviors. 

Darice

Please Log in or Create an account to join the conversation.

  • abrac
  • Topic Author
More
22 Apr 2022 14:05 #10866 by abrac
Thank you for your response, and I am so sorry for my delayed response! What you have said is interesting! This makes me realize the problem with my model parameters. In fact the units of the
Code:
leadacid_qX
values are in Ah, not %. When I changed my leadacid_q20 to 833.333 Ah, the results are much closer to what I had expected. Thank you for your help!

Please Log in or Create an account to join the conversation.

  • abrac
  • Topic Author
More
23 Apr 2022 09:54 #10868 by abrac
Perhaps, it may also be useful to add to the documentation that
Code:
nominal_energy
and
Code:
leadacid_qX
are interdependent inputs.

Please Log in or Create an account to join the conversation.

Moderators: pgilman
Powered by Kunena Forum