Esempio n. 1
0
    def create_features(self):
        """
        Args:
            processed_cycler_run (beep.structure.ProcessedCyclerRun)
            params_dict (dict): dictionary of parameters governing how the ProcessedCyclerRun object
                gets featurized. These could be filters for column or row operations
            parameters_path (str): Root directory storing project parameter files.
            cell_info_path (str): Root directory for cell half cell data


        Returns:
             (pd.DataFrame) containing the cell material parameters for the first and second diagnotics
                as a single row dataframe
        """

        ia = IntracellAnalysis(
            self.hyperparameters["cathode_file"],
            self.hyperparameters["anode_file"],
            cycle_type=self.hyperparameters["diagnostic_cycle_type"],
            step_type=self.hyperparameters["step_type"]
        )

        (cell_init_aligned, cell_init_profile, PE_matched, NE_matched) = ia.intracell_wrapper_init(
            self.datapath,
        )

        eol_cycle_index_list = self.datapath.diagnostic_summary[
            (self.datapath.diagnostic_summary.cycle_type == ia.cycle_type) &
            (self.datapath.diagnostic_summary.discharge_capacity > ia.THRESHOLD)
            ].cycle_index.to_list()

        # # initializations before for loop
        dataset_dict_of_cell_degradation_path = dict()
        real_cell_dict_of_profiles = dict()
        for i, cycle_index in enumerate(eol_cycle_index_list[0:2]):
            loss_dict, profiles_dict = ia.intracell_values_wrapper(cycle_index,
                                                                   self.datapath,
                                                                   cell_init_aligned,
                                                                   cell_init_profile,
                                                                   PE_matched,
                                                                   NE_matched,
                                                                   )
            dataset_dict_of_cell_degradation_path.update(loss_dict)
            real_cell_dict_of_profiles.update(profiles_dict)

        degradation_df = pd.DataFrame(dataset_dict_of_cell_degradation_path,
                                      index=['LLI', 'LAM_PE', 'LAM_NE', 'x_NE_2', 'alpha_real', 'alpha_emulated',
                                             'PE_upper_voltage', 'PE_lower_voltage', 'PE_upper_SOC', 'PE_lower_SOC',
                                             'PE_mass', 'NE_upper_voltage', 'NE_lower_voltage', 'NE_upper_SOC',
                                             'NE_lower_SOC', 'NE_mass', 'Li_mass'
                                             ]).T
        diag_0_names = ["diag_0_" + name for name in degradation_df.columns]
        diag_1_names = ["diag_1_" + name for name in degradation_df.columns]
        values = {0: degradation_df.iloc[0].tolist() + degradation_df.iloc[1].tolist()}
        features_df = pd.DataFrame(values, index=diag_0_names+diag_1_names).T
        self.features = features_df
Esempio n. 2
0
    def test_intracell_wrappers(self):
        ia = IntracellAnalysis(os.path.join(TEST_FILE_DIR, 'data-share', 'raw',
                                            'cell_info', 'cathode_test.csv'),
                               os.path.join(TEST_FILE_DIR, 'data-share', 'raw',
                                            'cell_info', 'anode_test.csv'),
                               cycle_type='rpt_0.2C',
                               step_type=0)

        (cell_init_aligned, cell_init_profile, PE_matched,
         NE_matched) = ia.intracell_wrapper_init(self.cell_struct)

        eol_cycle_index_list = self.cell_struct.diagnostic_summary[
            (self.cell_struct.diagnostic_summary.cycle_type == ia.cycle_type)
            & (self.cell_struct.diagnostic_summary.discharge_capacity >
               ia.THRESHOLD)].cycle_index.to_list()

        # # initializations before for loop
        dataset_dict_of_cell_degradation_path = dict()
        real_cell_dict_of_profiles = dict()
        for i, cycle_index in enumerate(eol_cycle_index_list):
            loss_dict, profiles_dict = ia.intracell_values_wrapper(
                cycle_index,
                self.cell_struct,
                cell_init_aligned,
                cell_init_profile,
                PE_matched,
                NE_matched,
            )
            dataset_dict_of_cell_degradation_path.update(loss_dict)
            real_cell_dict_of_profiles.update(profiles_dict)

        degradation_df = pd.DataFrame(
            dataset_dict_of_cell_degradation_path,
            index=[
                'LLI', 'LAM_PE', 'LAM_NE', 'x_NE_2', 'alpha_real',
                'alpha_emulated', 'PE_upper_voltage', 'PE_lower_voltage',
                'PE_upper_SOC', 'PE_lower_SOC', 'PE_mass', 'NE_upper_voltage',
                'NE_lower_voltage', 'NE_upper_SOC', 'NE_lower_SOC', 'NE_mass',
                'Li_mass'
            ]).T
        print(degradation_df['LLI'])
        print(degradation_df['LAM_PE'])
        print(degradation_df['Li_mass'])
        self.assertAlmostEqual(degradation_df['LLI'].iloc[0], -9.999983, 5)
        self.assertAlmostEqual(degradation_df['LLI'].iloc[1], -9.999556, 5)
        self.assertAlmostEqual(degradation_df['LAM_PE'].iloc[0], 49.984768, 5)
        self.assertAlmostEqual(degradation_df['LAM_PE'].iloc[1], 49.984877, 5)
        self.assertAlmostEqual(degradation_df["Li_mass"].iloc[1], 12.312480, 3)