BatteryStateful¶
Wrapper for SAM Simulation Core model: cmod_battery_stateful.cpp
Input Consistency Warning¶
As described in Possible Problems, some input parameters are interdependent but the equations that enforce consistency are not available in this PySAM module. Therefore, the onus is on the PySAM user to check that interdependencies are correctly handled. The variables which may require additional logic include:
Provided for each of these inputs is a list of other inputs that are potentially interdependent.
Creating an Instance¶
Refer to the Initializing a Model page for details on the different ways to create an instance of a PySAM class.
BatteryStateful model description
BatteryStateful
-
PySAM.BatteryStateful.
default
(config) → BatteryStateful¶ Use default attributes config options:
- “LFPGraphite”
- “LeadAcid”
- “NMCGraphite”
-
PySAM.BatteryStateful.
from_existing
(data, optional config) → BatteryStateful¶ Share underlying data with an existing PySAM class. If config provided, default attributes are loaded otherwise.
-
PySAM.BatteryStateful.
new
() → BatteryStateful¶
-
PySAM.BatteryStateful.
wrap
(ssc_data_t) → BatteryStateful¶ Use existing PySSC data
Warning
Do not call PySSC.data_free on the ssc_data_t provided to
wrap
Functions¶
-
class
PySAM.BatteryStateful.
BatteryStateful
¶ This class contains all the variable information for running a simulation. Variables are grouped together in the subclasses as properties. If property assignments are the wrong type, an error is thrown.
-
assign
(dict) → None¶ Assign attributes from nested dictionary, except for Outputs
nested_dict = { 'Controls': { var: val, ...}, ...}
-
execute
(int verbosity) → None¶ Execute simulation with verbosity level 0 (default) or 1
-
export
() → dict¶ Export attributes into nested dictionary
-
setup
() → None¶ Setup parameters in simulation
-
unassign
(name) → None¶ Unassign a value in any of the variable groups.
-
value
(name, optional value) → Union[None, float, dict, sequence, str]¶ Get or set by name a value in any of the variable groups.
-
Controls Group¶
-
class
PySAM.BatteryStateful.BatteryStateful.
Controls
¶ -
assign
() → None¶ Assign attributes from dictionary
Controls_vals = { var: val, ...}
-
export
() → dict¶ Export attributes into dictionary
-
control_mode
¶ Control using current (0) or power (1) [0/1]
Required: True
Type: float
-
dt_hr
¶ Time step in hours [hr]
Required: True
Type: float
-
input_current
¶ Current at which to run battery [A]
Required: True if control_mode=0
Type: float
-
input_power
¶ Power at which to run battery [kW]
Required: True if control_mode=1
Type: float
-
ParamsCell Group¶
-
class
PySAM.BatteryStateful.BatteryStateful.
ParamsCell
¶ -
assign
() → None¶ Assign attributes from dictionary
ParamsCell_vals = { var: val, ...}
-
export
() → dict¶ Export attributes into dictionary
-
C_rate
¶ Rate at which voltage vs. capacity curve input
Required: True if voltage_choice=0&chem~2
Type: float
-
Qexp
¶ Cell capacity at end of exponential zone [Ah]
Required: True if voltage_choice=0&chem~2
Type: float
-
Qfull
¶ Fully charged cell capacity [Ah]
Required: True
Type: float
-
Qfull_flow
¶ Fully charged flow battery capacity [Ah]
Required: True if voltage_choice=0&chem=3
Type: float
-
Qnom
¶ Cell capacity at end of nominal zone [Ah]
Required: True if voltage_choice=0&chem~2
Type: float
-
Vcut
¶ Cell cutoff voltage [V]
Required: True if voltage_choice=0&chem~2
Type: float
-
Vexp
¶ Cell voltage at end of exponential zone [V]
Required: True if voltage_choice=0&chem~2
Type: float
-
Vfull
¶ Fully charged cell voltage [V]
Required: True if voltage_choice=0&chem~2
Type: float
-
Vnom
¶ Cell voltage at end of nominal zone [V]
Required: True if voltage_choice=0&chem~2
Type: float
-
Vnom_default
¶ Default nominal cell voltage [V]
Required: True
Type: float
-
calendar_a
¶ Calendar life model coefficient [1/sqrt(day)]
Required: True if life_model=0&calendar_choice=1
Type: float
-
calendar_b
¶ Calendar life model coefficient [K]
Required: True if life_model=0&calendar_choice=1
Type: float
-
calendar_c
¶ Calendar life model coefficient [K]
Required: True if life_model=0&calendar_choice=1
Type: float
-
calendar_choice
¶ Calendar life degradation input option [0/1/2]
Options: 0=None,1=LithiomIonModel,2=InputLossTable
Required: True if life_model=0
Type: float
-
calendar_matrix
¶ Table with Day # and Capacity % columns [[[#, %]]]
Required: True if life_model=0&calendar_choice=2
Type: sequence[sequence]
-
calendar_q0
¶ Calendar life model initial capacity cofficient
Required: True if life_model=0&calendar_choice=1
Type: float
-
chem
¶ Lead Acid (0), Li Ion (1), Vanadium Redox (2), Iron Flow (3) [0/1/2/3]
Required: True
Type: float
-
cycling_matrix
¶ Table with DOD %, Cycle #, and Capacity % columns [[[%, #, %]]]
Required: True if life_model=0
Type: sequence[sequence]
-
initial_SOC
¶ Initial state-of-charge [%]
Required: True
Type: float
-
leadacid_q10
¶ Capacity at 10-hour discharge rate [Ah]
Required: True if chem=0
Type: float
-
leadacid_q20
¶ Capacity at 20-hour discharge rate [Ah]
Required: True if chem=0
Type: float
-
leadacid_qn
¶ Capacity at discharge rate for n-hour rate [Ah]
Required: True if chem=0
Type: float
-
leadacid_tn
¶ Hours to discharge for qn rate [h]
Required: True if chem=0
Type: float
-
life_model
¶ Battery life model specifier [0/1]
Options: 0=calendar/cycle,1=NMC
Required: True
Type: float
-
maximum_SOC
¶ Maximum allowed state-of-charge [%]
Required: True
Type: float
-
minimum_SOC
¶ Minimum allowed state-of-charge [%]
Required: True
Type: float
-
resistance
¶ Internal resistance [Ohm]
Required: True
Type: float
-
voltage_choice
¶ Battery voltage input option [0/1]
Options: 0=Model,1=Table
Required: If not provided, assumed to be 0
Type: float
-
voltage_matrix
¶ Table with depth-of-discharge % and Voltage as columns [[[%, V]]]
Required: True if voltage_choice=1
Type: sequence[sequence]
-
ParamsPack Group¶
-
class
PySAM.BatteryStateful.BatteryStateful.
ParamsPack
¶ -
assign
() → None¶ Assign attributes from dictionary
ParamsPack_vals = { var: val, ...}
-
export
() → dict¶ Export attributes into dictionary
-
Cp
¶ Battery specific heat capacity [J/KgK]
Required: True
Type: float
-
T_room_init
¶ Temperature of storage room [C]
Required: True
Type: float
-
cap_vs_temp
¶ Table with Temperature and Capacity % as columns [[[C,%]]]
Required: True if life_model=0
Type: sequence[sequence]
-
h
¶ Heat transfer between battery and environment [W/m2K]
Required: True
Type: float
-
loss_choice
¶ Loss power input option [0/1]
Options: 0=Monthly,1=TimeSeries
Required: If not provided, assumed to be 0
Type: float
-
mass
¶ Battery mass [kg]
Required: True
Type: float
-
monthly_charge_loss
¶ Battery system losses when charging [[kW]]
Required: If not provided, assumed to be 0
Type: sequence
-
monthly_discharge_loss
¶ Battery system losses when discharging [[kW]]
Required: If not provided, assumed to be 0
Type: sequence
-
monthly_idle_loss
¶ Battery system losses when idle [[kW]]
Required: If not provided, assumed to be 0
Type: sequence
-
nominal_energy
¶ Nominal installed energy [kWh]
Required: True
Type: float
-
nominal_voltage
¶ Nominal DC voltage [V]
Required: True
Type: float
-
replacement_capacity
¶ Capacity degradation at which to replace battery [%]
Required: True if replacement_option=1
Type: float
-
replacement_option
¶ none (0), by capacity (1), or schedule (2) [0=none,1=capacity limit,2=yearly schedule]
Constraints: INTEGER,MIN=0,MAX=2
Required: If not provided, assumed to be 0
Type: float Type: Replacements
-
replacement_schedule_percent
¶ Percentage of battery capacity to replace in each year [[%/year]]
Options: length <= analysis_period
Required: True if replacement_option=2
Type: sequence
-
schedule_loss
¶ Battery system losses at each timestep [[kW]]
Required: If not provided, assumed to be 0
Type: sequence
-
surface_area
¶ Battery surface area [m^2]
Required: True
Type: float
-
StatePack Group¶
-
class
PySAM.BatteryStateful.BatteryStateful.
StatePack
¶ -
assign
() → None¶ Assign attributes from dictionary
StatePack_vals = { var: val, ...}
-
export
() → dict¶ Export attributes into dictionary
-
I
¶ Current [A]
Type: float
-
I_chargeable
¶ Estimated max chargeable current [A]
Type: float
-
I_dischargeable
¶ Estimated max dischargeable current [A]
Type: float
-
P
¶ Power [kW]
Type: float
-
P_chargeable
¶ Estimated max chargeable power [kW]
Type: float
-
P_dischargeable
¶ Estimated max dischargeable power [kW]
Type: float
-
Q
¶ Capacity [Ah]
Type: float
-
Q_max
¶ Max Capacity [Ah]
Type: float
-
SOC
¶ State of Charge [%]
Type: float
-
T_batt
¶ Battery temperature averaged over time step [C]
Type: float
-
T_room
¶ Room temperature [C]
Type: float
-
V
¶ Voltage [V]
Type: float
-
heat_dissipated
¶ Heat dissipated due to flux [kW]
Type: float
-
indices_replaced
¶ Lifetime indices of replacement occurrences
Type: sequence
-
last_idx
¶ Last index (lifetime)
Type: float
-
loss_kw
¶ Ancillary power loss (kW DC for DC connected, AC for AC connected) [kW]
Type: float
-
n_replacements
¶ Number of replacements at current year
Type: float
-
StateCell Group¶
-
class
PySAM.BatteryStateful.BatteryStateful.
StateCell
¶ -
assign
() → None¶ Assign attributes from dictionary
StateCell_vals = { var: val, ...}
-
export
() → dict¶ Export attributes into dictionary
-
I_loss
¶ Lifetime and thermal losses [A]
Type: float
-
SOC_prev
¶ State of Charge of last time step [%]
Type: float
-
T_batt_prev
¶ Battery temperature at end of last time step [C]
Type: float
-
average_range
¶ Average cycle range [%]
Type: float
-
cell_current
¶ Cell current [A]
Type: float
-
cell_voltage
¶ Cell voltage [V]
Type: float
-
chargeChange
¶ Whether Charge mode changed since last step [0/1]
Type: float
-
charge_mode
¶ Charge (0), Idle (1), Discharge (2) [0/1/2]
Type: float
-
day_age_of_battery
¶ Day age of battery [day]
Type: float
-
dq_relative_calendar_old
¶ Change in capacity of last time step [%]
Type: float
-
n_cycles
¶ Number of cycles
Type: float
-
prev_charge
¶ Charge mode of last time step [0/1/2]
Type: float
-
q0
¶ Cell capacity at timestep [Ah]
Type: float
-
q1_0
¶ Lead acid - Cell charge available [Ah]
Type: float
-
q2
¶ Lead acid - Cell capacity at 10-hr discharge rate [Ah]
Type: float
-
q2_0
¶ Lead acid - Cell charge bound [Ah]
Type: float
-
q_relative
¶ Overall relative capacity due to lifetime effects [Ah]
Type: float
-
q_relative_calendar
¶ Relative capacity due to calendar effects [%]
Type: float
-
q_relative_cycle
¶ Relative capacity due to cycling effects [%]
Type: float
-
q_relative_thermal
¶ Relative capacity due to thermal effects [Ah]
Type: float
-
qmax_lifetime
¶ Maximum possible cell capacity [Ah]
Type: float
-
qmax_thermal
¶ Maximum cell capacity adjusted for temperature effects [Ah]
Type: float
-
qn
¶ Lead acid - Cell capacity at n-hr discharge rate [Ah]
Type: float
-
rainflow_Xlt
¶ Rainflow range of second to last half cycle [%]
Type: float
-
rainflow_Ylt
¶ Rainflow range of last half cycle [%]
Type: float
-
rainflow_jlt
¶ Rainflow number of turning points
Type: float
-
rainflow_peaks
¶ Rainflow peaks of DOD [[%]]
Type: sequence
-
range
¶ Cycle range [%]
Type: float
-