- Posts: 7
Temperature in Kelvin and Celsius for LMO/LTO model in BatteryStateful
- pontus.netzell
- Topic Author
Less
More
04 Oct 2024 07:09 #13499
by pontus.netzell
Temperature in Kelvin and Celsius for LMO/LTO model in BatteryStateful was created by pontus.netzell
Dear Paul and the rest of the group
When using the default LMOLTO model I get strange results on the temperature. When reading the docs I realize that there might be a misunderstanding in terms of unit. All other temperatures are given in Celsius while "temp_avg" (only used for the LMO/LTO model) are given in Kelvin.
The battery I simulate runs for 70,000 cycles, I believe thats too much. In addition I get strange cyclic values on the temp_avg, see table below.
Could you possibly send me a piece of code in Python on how to correctly setup and initiate and size and run a LMO/LTO battery that will simulate according to expectations? Or, please explain how to do it in order to not get such strange behavior. I could of course offer you my code as well.
BR
Pontusdatetimetemp_avg - Average temperature for current day [K]n_cyclesday_age_of_batteryT_batt - Battery temperature averaged over time step [C]T_room2023-02-16 13:20281,0172983,00157459,9620,0420,002023-02-16 13:00268,8072983,00157459,9220,0420,002023-02-16 12:40256,5872983,00157459,8720,0420,002023-02-16 12:20244,3672983,00157459,8320,0420,002023-02-16 12:00232,1572983,00157459,7920,0520,002023-02-16 11:40219,9372983,00157459,7520,0520,002023-02-16 11:20207,7172983,00157459,7120,0520,002023-02-16 11:00195,5072983,00157459,6720,0620,002023-02-16 10:40183,2872983,00157459,6220,0620,002023-02-16 10:20171,0672983,00157459,5820,0620,002023-02-16 10:00158,8572983,00157459,5420,0720,002023-02-16 09:40146,6372983,00157459,5020,0720,002023-02-16 09:20134,4172983,00157459,4620,0820,002023-02-16 09:00122,1972983,00157459,4220,0820,002023-02-16 08:40109,9772983,00157459,3720,0920,002023-02-16 08:2097,7672983,00157459,3320,0920,002023-02-16 08:0085,5472983,00157459,2920,1020,002023-02-16 07:4073,3272983,00157459,2520,1120,002023-02-16 07:2061,1072983,00157459,2120,1120,002023-02-16 07:0048,8872983,00157459,1720,1220,002023-02-16 06:4036,6672983,00157459,1220,1320,002023-02-16 06:2024,4472983,00157459,0820,1420,002023-02-16 06:0012,2272983,00157459,0420,1520,002023-02-16 05:400,0072983,00157459,0020,1620,002023-02-16 05:20281,0172983,00157458,9620,1720,002023-02-16 05:00268,7872983,00157458,9220,1820,002023-02-16 04:40256,5672983,00157458,8720,1920,002023-02-16 04:20244,3472983,00157458,8320,2020,002023-02-16 04:00232,1272983,00157458,7920,2220,002023-02-16 03:40219,8972983,00157458,7520,2320,002023-02-16 03:20207,6772983,00157458,7120,2520,002023-02-16 03:00195,4472983,00157458,6720,1320,002023-02-16 02:40183,2272982,00157458,6220,0120,002023-02-16 02:20171,0172982,00157458,5820,0120,002023-02-16 02:00158,7972982,00157458,5420,0120,00
When using the default LMOLTO model I get strange results on the temperature. When reading the docs I realize that there might be a misunderstanding in terms of unit. All other temperatures are given in Celsius while "temp_avg" (only used for the LMO/LTO model) are given in Kelvin.
The battery I simulate runs for 70,000 cycles, I believe thats too much. In addition I get strange cyclic values on the temp_avg, see table below.
Could you possibly send me a piece of code in Python on how to correctly setup and initiate and size and run a LMO/LTO battery that will simulate according to expectations? Or, please explain how to do it in order to not get such strange behavior. I could of course offer you my code as well.
BR
Pontusdatetimetemp_avg - Average temperature for current day [K]n_cyclesday_age_of_batteryT_batt - Battery temperature averaged over time step [C]T_room2023-02-16 13:20281,0172983,00157459,9620,0420,002023-02-16 13:00268,8072983,00157459,9220,0420,002023-02-16 12:40256,5872983,00157459,8720,0420,002023-02-16 12:20244,3672983,00157459,8320,0420,002023-02-16 12:00232,1572983,00157459,7920,0520,002023-02-16 11:40219,9372983,00157459,7520,0520,002023-02-16 11:20207,7172983,00157459,7120,0520,002023-02-16 11:00195,5072983,00157459,6720,0620,002023-02-16 10:40183,2872983,00157459,6220,0620,002023-02-16 10:20171,0672983,00157459,5820,0620,002023-02-16 10:00158,8572983,00157459,5420,0720,002023-02-16 09:40146,6372983,00157459,5020,0720,002023-02-16 09:20134,4172983,00157459,4620,0820,002023-02-16 09:00122,1972983,00157459,4220,0820,002023-02-16 08:40109,9772983,00157459,3720,0920,002023-02-16 08:2097,7672983,00157459,3320,0920,002023-02-16 08:0085,5472983,00157459,2920,1020,002023-02-16 07:4073,3272983,00157459,2520,1120,002023-02-16 07:2061,1072983,00157459,2120,1120,002023-02-16 07:0048,8872983,00157459,1720,1220,002023-02-16 06:4036,6672983,00157459,1220,1320,002023-02-16 06:2024,4472983,00157459,0820,1420,002023-02-16 06:0012,2272983,00157459,0420,1520,002023-02-16 05:400,0072983,00157459,0020,1620,002023-02-16 05:20281,0172983,00157458,9620,1720,002023-02-16 05:00268,7872983,00157458,9220,1820,002023-02-16 04:40256,5672983,00157458,8720,1920,002023-02-16 04:20244,3472983,00157458,8320,2020,002023-02-16 04:00232,1272983,00157458,7920,2220,002023-02-16 03:40219,8972983,00157458,7520,2320,002023-02-16 03:20207,6772983,00157458,7120,2520,002023-02-16 03:00195,4472983,00157458,6720,1320,002023-02-16 02:40183,2272982,00157458,6220,0120,002023-02-16 02:20171,0172982,00157458,5820,0120,002023-02-16 02:00158,7972982,00157458,5420,0120,00
Please Log in or Create an account to join the conversation.
- dguittet
Less
More
- Posts: 14
07 Oct 2024 16:59 #13504
by dguittet
Replied by dguittet on topic Temperature in Kelvin and Celsius for LMO/LTO model in BatteryStateful
Hello Pontus,
The data you pasted is hard to parse. Are you able to send a CSV with the data?
Thanks,
Darice
The data you pasted is hard to parse. Are you able to send a CSV with the data?
Thanks,
Darice
Please Log in or Create an account to join the conversation.
- pontus.netzell
- Topic Author
Less
More
- Posts: 7
08 Oct 2024 02:07 #13506
by pontus.netzell
Replied by pontus.netzell on topic Temperature in Kelvin and Celsius for LMO/LTO model in BatteryStateful
Dear Darice
Thank you for you swift reply. Attached is a csv file with the data. N.B. I only took out some of the data which I judged to be important.
May I suggest a quick way forward if the data is not sufficient: Please return with a small script on a correct setup and simulation of the LMO/LTO battery. What variables do you need to assign, what helper functions do you need to use, how to control the battery according to a power signal.
BR Pontus
Thank you for you swift reply. Attached is a csv file with the data. N.B. I only took out some of the data which I judged to be important.
May I suggest a quick way forward if the data is not sufficient: Please return with a small script on a correct setup and simulation of the LMO/LTO battery. What variables do you need to assign, what helper functions do you need to use, how to control the battery according to a power signal.
BR Pontus
Attachments:
Please Log in or Create an account to join the conversation.
- dguittet
Less
More
- Posts: 14
09 Oct 2024 14:14 - 10 Oct 2024 15:26 #13510
by dguittet
Replied by dguittet on topic Temperature in Kelvin and Celsius for LMO/LTO model in BatteryStateful
Hi Pontus,
Try this:
import PySAM.BatteryStateful as battstfl
import PySAM.BatteryTools as BatteryTools
b = battstfl.default("LFPGraphite")
BatteryTools.battery_model_sizing(b, desired_power=2.5, desired_capacity=10, desired_voltage=240, size_by_ac_not_dc=True, tol=0.2)
params = {
# specify power input
"control_mode": 1, "input_power": 0, "dt_hr": 1,
"initial_SOC": 50.000, "maximum_SOC": 95.000, "minimum_SOC": 5.000,
}
for k, v in params.items():
b.value(k, v)
b.setup()
b.execute()
Best,
Darice
Try this:
import PySAM.BatteryStateful as battstfl
import PySAM.BatteryTools as BatteryTools
b = battstfl.default("LFPGraphite")
BatteryTools.battery_model_sizing(b, desired_power=2.5, desired_capacity=10, desired_voltage=240, size_by_ac_not_dc=True, tol=0.2)
params = {
# specify power input
"control_mode": 1, "input_power": 0, "dt_hr": 1,
"initial_SOC": 50.000, "maximum_SOC": 95.000, "minimum_SOC": 5.000,
}
for k, v in params.items():
b.value(k, v)
b.setup()
b.execute()
Best,
Darice
Last edit: 10 Oct 2024 15:26 by pgilman.
Please Log in or Create an account to join the conversation.
- pontus.netzell
- Topic Author
Less
More
- Posts: 7
10 Oct 2024 03:18 #13511
by pontus.netzell
Replied by pontus.netzell on topic Temperature in Kelvin and Celsius for LMO/LTO model in BatteryStateful
Dear Darice
Thanks a lot. It goes in line with what I expect. Still I dont get my hands around the issue yet.
N.B. I see that the battery used is LFPGraphite and not LMOLTO. Could you update the code snippet with the correct chemistry and eventual additional settings needed for the LMOLTO battery?
I would like to ask for the rest of the code as well for simulating a battery over its full lifetime.
I.e. what comes after the
"
import PySAM.BatteryStateful as battstfl
import PySAM.BatteryTools as BatteryTools
b = battstfl.default("LFPGraphite")
BatteryTools.battery_model_sizing(b, desired_power=2.5, desired_capacity=10, desired_voltage=240, size_by_ac_not_dc=True, tol=0.2)
params = {
# specify power input
"control_mode": 1, "input_power": 0, "dt_hr": 1,
"initial_SOC": 50.000, "maximum_SOC": 95.000, "minimum_SOC": 5.000,
}for k, v in params.items():
b.value(k, v)
b.setup()
b.execute()
"?
Is it something like:
power_signal = [a list with many power signals, e.g. repeated charge and discharge]
for power_value in power_signal:
# Set the power level you want
b.Controls.input_power = power_value
# Execute the simulation
b.execute()
# Save the values
"""Here I create a df and "exports" the interesting variables like:
'SOC_ending': b.StatePack.SOC,
'SOC_ending': b.StateCell.temp_avg,
"""
loop until replacement_capacity < e.g. 80 %
N.B. Maybe this editing tool is not good with tabs so I will attach a file as well.
Best Regards Pontus
Thanks a lot. It goes in line with what I expect. Still I dont get my hands around the issue yet.
N.B. I see that the battery used is LFPGraphite and not LMOLTO. Could you update the code snippet with the correct chemistry and eventual additional settings needed for the LMOLTO battery?
I would like to ask for the rest of the code as well for simulating a battery over its full lifetime.
I.e. what comes after the
"
import PySAM.BatteryStateful as battstfl
import PySAM.BatteryTools as BatteryTools
b = battstfl.default("LFPGraphite")
BatteryTools.battery_model_sizing(b, desired_power=2.5, desired_capacity=10, desired_voltage=240, size_by_ac_not_dc=True, tol=0.2)
params = {
# specify power input
"control_mode": 1, "input_power": 0, "dt_hr": 1,
"initial_SOC": 50.000, "maximum_SOC": 95.000, "minimum_SOC": 5.000,
}for k, v in params.items():
b.value(k, v)
b.setup()
b.execute()
"?
Is it something like:
power_signal = [a list with many power signals, e.g. repeated charge and discharge]
for power_value in power_signal:
# Set the power level you want
b.Controls.input_power = power_value
# Execute the simulation
b.execute()
# Save the values
"""Here I create a df and "exports" the interesting variables like:
'SOC_ending': b.StatePack.SOC,
'SOC_ending': b.StateCell.temp_avg,
"""
loop until replacement_capacity < e.g. 80 %
N.B. Maybe this editing tool is not good with tabs so I will attach a file as well.
Best Regards Pontus
Attachments:
Please Log in or Create an account to join the conversation.
- dguittet
Less
More
- Posts: 14
11 Oct 2024 14:23 #13513
by dguittet
Replied by dguittet on topic Temperature in Kelvin and Celsius for LMO/LTO model in BatteryStateful
Hi Pontus,
The LMO/LTO life model in SAM is out of date and tends to degrade slower than expected. I have shared an example of using a custom battery life model with BatteryStateful in PySAM here: github.com/NREL/pysam/blob/main/Examples/BatteryStateful_CustomLifeModel.ipynb
The LMO/LTO life model there is up to date and the reference for it is in that notebook.
Best,
Darice
The LMO/LTO life model in SAM is out of date and tends to degrade slower than expected. I have shared an example of using a custom battery life model with BatteryStateful in PySAM here: github.com/NREL/pysam/blob/main/Examples/BatteryStateful_CustomLifeModel.ipynb
The LMO/LTO life model there is up to date and the reference for it is in that notebook.
Best,
Darice
Please Log in or Create an account to join the conversation.
Moderators: pgilman