Commit ddcdeb5d authored by Brewer, Wes's avatar Brewer, Wes
Browse files

Fix another bug when using cooling model related to de-globalizing config manager

parent 472f156e
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ class LayoutManager:
        self.setup_layout(layout_type)
        self.power_df_header = self.config['POWER_DF_HEADER']
        self.racks_per_cdu = self.config['RACKS_PER_CDU']
        self.fmu_cols = self.config['FMU_COLUMN_MAPPING']
        self.power_column = self.power_df_header[self.racks_per_cdu + 1]
        self.loss_column = self.power_df_header[-1]

@@ -178,10 +179,11 @@ class LayoutManager:
        ]

        # Dynamically build the data list using FMU_COLUMN_MAPPING

        data = []
        for key in relevant_keys:
            if key in datacenter_df and key in FMU_COLUMN_MAPPING:
                label = FMU_COLUMN_MAPPING[key]
            if key in datacenter_df and key in self.fmu_cols:
                label = self.fmu_cols[key]
                average_value = round(datacenter_df[key].mean(), 1)
                data.append((label, average_value))

@@ -192,14 +194,14 @@ class LayoutManager:

    def get_datacenter_df(self, cooling_outputs):
        # Initialize data dictionary with keys from FMU_COLUMN_MAPPING
        data = {key: [] for key in FMU_COLUMN_MAPPING.keys()}
        data = {key: [] for key in self.fmu_cols.keys()}
        
        # Loop over each compute block in the datacenter_outputs dictionary
        for i in range(1, NUM_CDUS + 1):
        for i in range(1, self.config['NUM_CDUS'] + 1):
            compute_block_key = f"simulator[1].datacenter[1].computeBlock[{i}].cdu[1].summary."
            
            # Append data to the corresponding lists dynamically using FMU_COLUMN_MAPPING keys
            for key in FMU_COLUMN_MAPPING.keys():
            for key in self.fmu_cols.keys():
                data[key].append(cooling_outputs.get(compute_block_key + key))
        
        # Convert to DataFrame
@@ -230,12 +232,12 @@ class LayoutManager:

        # Create column headers with appropriate styles
        columns = [f"{col} (kW)" if col != "CDU" else col for col in power_columns]
        columns += [FMU_COLUMN_MAPPING[key] for key in cooling_keys]
        columns += [self.fmu_cols[key] for key in cooling_keys]

        # Define styles for data values
        data_styles = ["bold cyan"] + ["bold green"] * (len(power_columns) - 1)
        data_styles += [
            "bold blue" if "Supply" in FMU_COLUMN_MAPPING[key] else "bold red" for key in cooling_keys
            "bold blue" if "Supply" in self.fmu_cols[key] else "bold red" for key in cooling_keys
        ]

        # Initialize the table with header styles