Battery System Identification
Module contents
Submodules
battery_identification module
This module hosts the Battery System Identification class used for fitting battery ECM model parameters from data.
- class batt_sys_identification.battery_identification.BatteryParams(data)
Bases:
object
Battery system identification class with open circuit voltage correction scheme. This class takes in dataframe or csv with some given fields during instantiation.
Dataframe fields (columns) must include the following literally and case-sensitive:
current - battery/cell current time-series.
voltage - corresponding battery/cell voltage time-series.
soc - corresponding battery/cell state of charge time-series.
ocv - corresponding battery/cell open circuit voltage time-series.
How to use:
data = pd.read_csv(data_path). This loads a pandas dataframe.
module = BatteryParams(data)
module.run_sys_identification()
module.plot_correction_scheme_comparison()
Writes new corrected open-circuit voltages and battery parameters to file within the folder. Can be downloaded via the web-tool.
- Parameters:
data – Battery test data from which to fit the identification params.
- ga(num_generations=40, num_parents_mating=2, sol_per_pop=10, num_genes=7, crossover_type='single_point', mutation_type='adaptive', parent_selection_type='sss', mutation_percent_genes=60, mutation_prob=(0.3, 0.1), crossover_prob=None)
Runs the genetic algorithm instance. Please see PyGAD official documentation for more explanation of fields/params. The default parameters have been selected to optimize accuracy and speed, however, any user may find a combination of params that work better for a given set of battery data.
- Parameters:
crossover_prob –
num_generations – Number of generations. Default is 100.
num_parents_mating – Number of parents to combine to form the next offspring. Default is 2.
sol_per_pop – Number of solutions per population (a set of genes is one solution), or offspring size.
num_genes – Equivalent to the number of parameters being searched
crossover_type – Describes how the cross-over between mating genes is done.
mutation_type – Describes gene mutation. Default adaptive
parent_selection_type – Parent selection scheme for the next population.
mutation_percent_genes – The percentage of genes that undergo mutation.
mutation_prob – The probability of selecting a gene for applying the mutation operation.
Its value must be between 0.0 and 1.0 inclusive. :return: Solution vector of optimized parameters.
- get_Ro()
Returns the high frequency (Ro) resistance of the battery.
- Returns:
Resistance (R_o).
- get_corrected_voltages()
Returns the voltage response with corrected open circuit voltage.
- Returns:
Vector of voltage response with corrected open circuit voltage.
- get_uncorrected_voltages()
Returns the vector of uncorrected voltages from ECM model response.
- Returns:
Vector of uncorrected voltages.
- plot_Ro(grid=False)
Plots the high frequency resistance (Ro) of the battery.
- Returns:
None.
- plot_correction_scheme_comparison(xlim=(20000, 36000), ylim=(2.75, 3.85))
Generates a plot of OCV corrected model and non-OCV corrected model.
- Returns:
None
- run_ocv_correction(use_quadratic=False, cell_name='0', diagn=0)
Fits the parameters for the open circuit voltage correction scheme. Updates the ocv attribute. The open circuit voltage correction scheme can be quadratic or linear. The quadratic scheme was used in the original paper.
- Returns:
None.
- run_pre_checks()
Runs pre-checks on input values to ensure they are all of desired lengths. This is run at the beginning to ensure no errors in data length.
- Returns:
None.
- run_sys_identification(cell_name='0', diagn: int = 0, use_initial_pop: bool = True, quadratic_bias: bool = True, save: bool = False, error_stats: bool = False, generations=2) None
Runs the GA for system identification.
- Returns:
- simulate_response()
Simulates the response of the ECM model. Not complete yet.
- Returns: