def generate_default_cpu(number_of_cores: int, available_frequencies: Set[int], thermal_dissipation: float = 5) -> Processor: """ Generate a default CPU specifying the number of cores and the available frequencies :param number_of_cores: Number of cores in the CPU :param available_frequencies: Available frequencies in the CPU :param thermal_dissipation: Dissipation of each core in watts when they are with maximum frequency :return: CPU specification """ # :param preemption_cost: Cost of preemption in cycles # :param migration_cost: Cost of migration in cycles max_cpu_frequency: float = max(available_frequencies) leakage_alpha: float = 0.001 leakage_delta: float = 0.1 dynamic_beta: float = 2 dynamic_alpha: float = (thermal_dissipation - dynamic_beta) * max_cpu_frequency**-3 energy_consumption_properties = EnergyConsumption( leakage_alpha=leakage_alpha, leakage_delta=leakage_delta, dynamic_alpha=dynamic_alpha, dynamic_beta=dynamic_beta) core_type_definition = CoreModel( dimensions=Dimensions(x=10, y=10, z=2), material=SMSilicon(), core_energy_consumption=energy_consumption_properties, available_frequencies=available_frequencies) # preemption_cost=preemption_cost number_of_columns = math.ceil(math.sqrt(number_of_cores)) lateral_size = number_of_columns * (3 + 10 + 3) board_definition = Board(dimensions=Dimensions(x=lateral_size, y=lateral_size, z=1), material=SMCooper(), location=Location(x=0, y=0, z=0)) cores_definition: Dict[int, Core] = {} for i in range(number_of_cores): x_position = (3 + 10 + 3) * (i % number_of_columns) + 3 y_position = (3 + 10 + 3) * (i // number_of_columns) + 3 cores_definition[i] = Core(core_type=core_type_definition, location=Location(x=x_position, y=y_position, z=2)) return Processor(board_definition=board_definition, cores_definition=cores_definition, measure_unit=0.001)
def test_heat_conservation_simple(self): # Dimensions of the cubes cubes_dimensions = Dimensions(x=3, z=3, y=3) # Cube material cuboid_material = SMSilicon() # Cuboid initial temperature system_initial_temperature = 273.15 + 45 # Definition of the CPU shape and materials scene_definition = { # Cube 0: (cuboid_material, Cuboid(location=Location(x=0, z=0, y=0), dimensions=cubes_dimensions)) } # Edge size pf 1 mm cube_edge_size = 0.001 cubed_space = Model(material_cubes=scene_definition, cube_edge_size=cube_edge_size, environment_properties=None, simulation_precision="HIGH") initial_state = cubed_space.create_initial_state( default_temperature=system_initial_temperature, environment_temperature=None) max_temperature_vector = [] min_temperature_vector = [] number_of_iterations = 10000 for i in range(number_of_iterations): # Apply energy over the cubed space initial_state = cubed_space.apply_energy( actual_state=initial_state, amount_of_time=0.001) temperature_over_energy_application = cubed_space.obtain_temperature( actual_state=initial_state) min_temperature_one = min( obtain_min_temperature( temperature_over_energy_application).values()) max_temperature_one = max( obtain_max_temperature( temperature_over_energy_application).values()) min_temperature_vector.append(min_temperature_one) max_temperature_vector.append(max_temperature_one) assert (self.float_equal(min(min_temperature_vector), system_initial_temperature, error=0.1)) assert (self.float_equal(max(max_temperature_vector), system_initial_temperature, error=0.1))
def test_external_conduction_plot_3d_stacked(self): # Configuration # Size of the simulation step simulation_step = 0.1 # Major cycle in seconds major_cycle = 1.0 # Temperature of the system (Celsius degrees) system_temperature = 45 number_of_cores = 1 # Dimensions of the core core_dimensions = Dimensions(x=10, z=2, y=10) # Material of the core core_material = SMSilicon() # Material of the board board_material = SMCooper() # Environment initial temperature environment_temperature = 273.15 + system_temperature # CPU distribution # XXXXXXX # XX0X3XX # XX1X4XX # XX2X5XX # XXXXXXX # Definition of the CPU shape and materials cpu_definition = { # Cores 0: (core_material, Cuboid(location=Location(x=20, z=2, y=10), dimensions=core_dimensions)), # Board 1: (board_material, Cuboid(location=Location(x=0, z=0, y=0), dimensions=Dimensions(x=70, z=2, y=70))) } # Edge size pf 0.5 mm cube_edge_size = 0.001 # Environment properties environment_properties = FEAirFree() external_heat_generators_dynamic_power = { 0: create_energy_applicator( (core_material, Cuboid(location=Location(x=20, z=0, y=10), dimensions=Dimensions(x=10, z=2, y=10))), watts_to_apply=10, cube_edge_size=cube_edge_size) } # Generate cubed space cubed_space = Model(material_cubes=cpu_definition, cube_edge_size=cube_edge_size, external_temperature_booster_points= external_heat_generators_dynamic_power, internal_temperature_booster_points={}, environment_properties=environment_properties, simulation_precision="HIGH") initial_state = cubed_space.create_initial_state( default_temperature=environment_temperature, environment_temperature=environment_temperature) # Initial temperatures temperature_measures: Dict[float, Dict[int, PhysicalCuboid]] = {} temperature_over_before_zero_seconds = cubed_space.obtain_temperature( actual_state=initial_state) temperature_measures[0.0] = temperature_over_before_zero_seconds actual_applied_externally_energy_points = {0} # Apply energy over the cubed space for i in range(round(major_cycle / simulation_step)): initial_state = cubed_space.apply_energy( actual_state=initial_state, external_energy_application_points= actual_applied_externally_energy_points, internal_energy_application_points=set(), amount_of_time=simulation_step) temperature = cubed_space.obtain_temperature( actual_state=initial_state) temperature_measures[i * simulation_step] = temperature # Display temperatures for i in range(round(major_cycle / simulation_step)): time_to_display = i * simulation_step min_temperature = min( obtain_min_temperature( temperature_measures[time_to_display]).values()) max_temperature = max( obtain_max_temperature( temperature_measures[time_to_display]).values()) plot_3d = plot_3d_heat_map_temperature( temperature_measures[time_to_display], min_temperature=min_temperature, max_temperature=max_temperature) plot_3d.show()
def test_internal_conduction_plot(self): # Dimensions of the cubes cubes_dimensions = Dimensions(x=2, z=2, y=2) # Cube 0 material cube_0_material = SMCooper() # Core initial temperature cube_0_initial_temperature = 273.15 + 65 # Board initial temperature environment_temperature = 273.15 + 25 # Min simulation value min_simulation_value = cube_0_initial_temperature - 10 max_simulation_value = cube_0_initial_temperature + 10 # Definition of the CPU shape and materials scene_definition = { # Cores 0: (cube_0_material, Cuboid(location=Location(x=0, z=0, y=0), dimensions=cubes_dimensions)) } # Edge size pf 1 mm cube_edge_size = 0.001 # Environment properties environment_properties = FEAirForced() cubed_space = Model(material_cubes=scene_definition, cube_edge_size=cube_edge_size, environment_properties=environment_properties, simulation_precision="HIGH") initial_state = cubed_space.create_initial_state( default_temperature=environment_temperature, material_cubes_temperatures={0: cube_0_initial_temperature}, environment_temperature=environment_temperature) # Initial temperatures temperature_over_before_zero_seconds = cubed_space.obtain_temperature( actual_state=initial_state) # Apply energy over the cubed space initial_state = cubed_space.apply_energy(actual_state=initial_state, amount_of_time=0.9) temperature_over_before_half_second = cubed_space.obtain_temperature( actual_state=initial_state) # Apply energy over the cubed space initial_state = cubed_space.apply_energy(actual_state=initial_state, amount_of_time=0.9) temperature_over_before_one_second = cubed_space.obtain_temperature( actual_state=initial_state) # Zero seconds plot_3d_heat_map_temperature(temperature_over_before_zero_seconds, min_temperature=min_simulation_value, max_temperature=max_simulation_value) min_temperature = obtain_min_temperature( temperature_over_before_zero_seconds) max_temperature = obtain_max_temperature( temperature_over_before_zero_seconds) print("Temperature before 0 seconds: min", min_temperature, ", max", max_temperature) # Half second plot_3d_heat_map_temperature(temperature_over_before_half_second, min_temperature=min_simulation_value, max_temperature=max_simulation_value) min_temperature = obtain_min_temperature( temperature_over_before_half_second) max_temperature = obtain_max_temperature( temperature_over_before_half_second) print("Temperature before 0.5 seconds: min", min_temperature, ", max", max_temperature) # One second plot_3d_heat_map_temperature(temperature_over_before_one_second, min_temperature=min_simulation_value, max_temperature=max_simulation_value) min_temperature = obtain_min_temperature( temperature_over_before_one_second) max_temperature = obtain_max_temperature( temperature_over_before_one_second) print("Temperature before 1 second: min", min_temperature, ", max", max_temperature)
def test_external_conduction_plot_2d_3d_animation_generation(self): # Dimensions of the cubes cubes_dimensions = Dimensions(x=4, z=4, y=4) # Cube 0 material cube_0_material = SMSilicon() # Cube 1 material cube_1_material = SMCooper() # Core initial temperature cube_0_initial_temperature = 273.15 + 65 cube_1_initial_temperature = 273.15 + 25 # Board initial temperature environment_temperature = 273.15 + 15 # Min simulation value min_simulation_value = cube_1_initial_temperature - 10 max_simulation_value = cube_0_initial_temperature + 10 # Definition of the CPU shape and materials scene_definition = { # Cores 0: (cube_0_material, Cuboid(location=Location(x=0, z=0, y=0), dimensions=cubes_dimensions)), 1: (cube_1_material, Cuboid(location=Location(x=cubes_dimensions.x, z=0, y=0), dimensions=cubes_dimensions)) } # Edge size pf 1 mm cube_edge_size = 0.001 # Environment properties environment_properties = FEAirForced() cubed_space = Model(material_cubes=scene_definition, cube_edge_size=cube_edge_size, environment_properties=environment_properties, simulation_precision="HIGH") initial_state = cubed_space.create_initial_state( default_temperature=environment_temperature, material_cubes_temperatures={ 0: cube_0_initial_temperature, 1: cube_1_initial_temperature }, environment_temperature=environment_temperature) # Initial temperatures temperature_over_before_zero_seconds = cubed_space.obtain_temperature( actual_state=initial_state) # Apply energy over the cubed space initial_state = cubed_space.apply_energy(actual_state=initial_state, amount_of_time=0.1) temperature_over_before_point_one_seconds = cubed_space.obtain_temperature( actual_state=initial_state) # Apply energy over the cubed space initial_state = cubed_space.apply_energy(actual_state=initial_state, amount_of_time=0.1) temperature_over_before_point_two_seconds = cubed_space.obtain_temperature( actual_state=initial_state) heat_map_2d_video = generate_video_2d_heat_map( { 0.0: temperature_over_before_zero_seconds, 1: temperature_over_before_point_one_seconds, 2: temperature_over_before_point_two_seconds }, min_temperature=min_simulation_value, max_temperature=max_simulation_value, axis="Z", location_in_axis=2, delay_between_frames_ms=100) heat_map_3d_video = generate_video_3d_heat_map( { 0.0: temperature_over_before_zero_seconds, 1: temperature_over_before_point_one_seconds, 2: temperature_over_before_point_two_seconds }, min_temperature=min_simulation_value, max_temperature=max_simulation_value, delay_between_frames_ms=100) writer = animation.FFMpegWriter() heat_map_2d_video.save("2d_generation.mp4", writer=writer) heat_map_3d_video.save("3d_generation.mp4", writer=writer)
def test_processor_heat_generation_plot(self): # Dimensions of the core core_dimensions = Dimensions(x=10, z=2, y=10) # Material of the core core_material = SMSilicon() # Material of the board board_material = SMCooper() # Core initial temperature # core_initial_temperature = 273.15 + 65 core_0_initial_temperature = 273.15 + 25 core_1_initial_temperature = 273.15 + 25 core_2_initial_temperature = 273.15 + 25 core_3_initial_temperature = 273.15 + 25 # Board initial temperature board_initial_temperature = 273.15 + 25 # Environment initial temperature environment_temperature = 273.15 + 25 # Min simulation value max_simulation_value = 273.15 + 80 min_simulation_value = 273.15 + 20 # Definition of the CPU shape and materials cpu_definition = { # Cores 0: (core_material, Cuboid(location=Location(x=10, z=2, y=10), dimensions=core_dimensions)), 1: (core_material, Cuboid(location=Location(x=30, z=2, y=10), dimensions=core_dimensions)), 2: (core_material, Cuboid(location=Location(x=10, z=2, y=30), dimensions=core_dimensions)), 3: (core_material, Cuboid(location=Location(x=30, z=2, y=30), dimensions=core_dimensions)), # Board 4: (board_material, Cuboid(location=Location(x=0, z=0, y=0), dimensions=Dimensions(x=50, z=2, y=50))) } # Edge size pf 1 mm cube_edge_size = 0.001 # Environment properties environment_properties = FEAirFree() # CPU energy consumption configuration # Dynamic power = dynamic_alpha * F^3 + dynamic_beta # Leakage power = current temperature * 2 * leakage_delta + leakage_alpha leakage_alpha: float = 0.001 leakage_delta: float = 0.1 dynamic_alpha: float = 19 * 1000**-3 dynamic_beta: float = 2 cpu_frequency: float = 1000 watts_to_apply = dynamic_alpha * (cpu_frequency**3) + dynamic_beta # External heat generators external_heat_generators = { # Dynamic power 0: create_energy_applicator( (core_material, Cuboid(location=Location(x=10, z=2, y=10), dimensions=core_dimensions)), watts_to_apply=watts_to_apply, cube_edge_size=cube_edge_size), # Leakage power 1: create_energy_applicator( (core_material, Cuboid(location=Location(x=10, z=2, y=10), dimensions=core_dimensions)), watts_to_apply=leakage_alpha, cube_edge_size=cube_edge_size), 2: create_energy_applicator( (core_material, Cuboid(location=Location(x=30, z=2, y=10), dimensions=core_dimensions)), watts_to_apply=leakage_alpha, cube_edge_size=cube_edge_size), 3: create_energy_applicator( (core_material, Cuboid(location=Location(x=10, z=2, y=30), dimensions=core_dimensions)), watts_to_apply=leakage_alpha, cube_edge_size=cube_edge_size), 4: create_energy_applicator( (core_material, Cuboid(location=Location(x=30, z=2, y=30), dimensions=core_dimensions)), watts_to_apply=leakage_alpha, cube_edge_size=cube_edge_size) } # Internal heat generators internal_heat_generators = { 0: TMInternal(cuboid=Cuboid(location=Location(x=10, z=2, y=10), dimensions=core_dimensions), boostRateMultiplier=leakage_delta), 1: TMInternal(cuboid=Cuboid(location=Location(x=30, z=2, y=10), dimensions=core_dimensions), boostRateMultiplier=leakage_delta), 2: TMInternal(cuboid=Cuboid(location=Location(x=10, z=2, y=30), dimensions=core_dimensions), boostRateMultiplier=leakage_delta), 3: TMInternal(cuboid=Cuboid(location=Location(x=30, z=2, y=30), dimensions=core_dimensions), boostRateMultiplier=leakage_delta) } # Generate cubed space cubed_space = Model( material_cubes=cpu_definition, cube_edge_size=cube_edge_size, external_temperature_booster_points=external_heat_generators, internal_temperature_booster_points=internal_heat_generators, environment_properties=environment_properties, simulation_precision="HIGH") initial_state = cubed_space.create_initial_state( default_temperature=environment_temperature, material_cubes_temperatures={ 0: core_0_initial_temperature, 1: core_1_initial_temperature, 2: core_2_initial_temperature, 3: core_3_initial_temperature, 4: board_initial_temperature }, environment_temperature=environment_temperature) temperatures_vector = [] # Initial temperatures temperature_over_before_zero_seconds = cubed_space.obtain_temperature( actual_state=initial_state) temperatures_vector.append(temperature_over_before_zero_seconds) # Apply energy over the cubed space number_of_iterations = 10 for i in range(number_of_iterations): initial_state = cubed_space.apply_energy( actual_state=initial_state, external_energy_application_points={0}, # {0, 1, 2, 3, 4}, # internal_energy_application_points={0, 1, 2, 3}, amount_of_time=0.5) temperature = cubed_space.obtain_temperature( actual_state=initial_state) temperatures_vector.append(temperature) for i, temperature in enumerate(temperatures_vector): # Zero seconds plot_3d_heat_map_temperature( temperature, min_temperature=min_simulation_value, max_temperature=max_simulation_value).show() plot_2d_heat_map(temperature, min_temperature=min_simulation_value, max_temperature=max_simulation_value, axis="Z", location_in_axis=1).show() min_temperature = obtain_min_temperature(temperature) max_temperature = obtain_max_temperature(temperature) print("Temperature before", i * 0.5, "seconds: min", min_temperature, ", max", max_temperature)
def test_internal_conduction_with_convection(self): # Dimensions of the cubes cubes_dimensions = Dimensions(x=3, z=3, y=3) # Cube 0 material cuboid_material = SMSilicon() # Core initial temperature cuboid_initial_temperature = 273.15 + 65 # Board initial temperature environment_temperature = 273.15 + 25 # Definition of the CPU shape and materials scene_definition = { # Cores 0: (cuboid_material, Cuboid(location=Location(x=0, z=0, y=0), dimensions=cubes_dimensions)) } # Edge size pf 1 mm cube_edge_size = 0.001 # Environment properties environment_properties = FEAirForced() cubed_space = Model(material_cubes=scene_definition, cube_edge_size=cube_edge_size, environment_properties=environment_properties, simulation_precision="HIGH") initial_state = cubed_space.create_initial_state( default_temperature=environment_temperature, material_cubes_temperatures={0: cuboid_initial_temperature}, environment_temperature=environment_temperature) # Apply energy over the cubed space initial_state = cubed_space.apply_energy(actual_state=initial_state, amount_of_time=0.5) temperature_over_before_half_second = cubed_space.obtain_temperature( actual_state=initial_state) # Apply energy over the cubed space initial_state = cubed_space.apply_energy(actual_state=initial_state, amount_of_time=0.5) temperature_over_before_one_second = cubed_space.obtain_temperature( actual_state=initial_state) # Half second min_temperature_half = obtain_min_temperature( temperature_over_before_half_second) max_temperature_half = obtain_max_temperature( temperature_over_before_half_second) min_temperature_half = min(min_temperature_half.values()) max_temperature_half = max(max_temperature_half.values()) # One second min_temperature_one = obtain_min_temperature( temperature_over_before_one_second) max_temperature_one = obtain_max_temperature( temperature_over_before_one_second) min_temperature_one = min(min_temperature_one.values()) max_temperature_one = max(max_temperature_one.values()) assert (environment_temperature <= min_temperature_half <= cuboid_initial_temperature and max_temperature_half <= cuboid_initial_temperature) assert (environment_temperature <= min_temperature_one <= cuboid_initial_temperature and max_temperature_one <= cuboid_initial_temperature) assert (min_temperature_one <= min_temperature_half and max_temperature_one <= max_temperature_half)
def test_processor_heat_conservation(self): # Dimensions of the core core_dimensions = Dimensions(x=10, z=2, y=10) # Material of the core core_material = SMSilicon() # Material of the board board_material = SMCooper() # System initial temperature system_initial_temperature = 273.15 + 25 # Core initial temperature core_initial_temperature = system_initial_temperature # Board initial temperature board_initial_temperature = system_initial_temperature # Environment initial temperature environment_temperature = system_initial_temperature # Definition of the CPU shape and materials cpu_definition = { # Cores 0: (core_material, Cuboid(location=Location(x=10, z=2, y=10), dimensions=core_dimensions)), 1: (core_material, Cuboid(location=Location(x=30, z=2, y=10), dimensions=core_dimensions)), 2: (core_material, Cuboid(location=Location(x=10, z=2, y=30), dimensions=core_dimensions)), 3: (core_material, Cuboid(location=Location(x=30, z=2, y=30), dimensions=core_dimensions)), # Board 4: (board_material, Cuboid(location=Location(x=0, z=0, y=0), dimensions=Dimensions(x=50, z=2, y=50))) } # Edge size pf 1 mm cube_edge_size = 0.001 # Environment properties environment_properties = FEAirFree() # Generate cubed space cubed_space = Model(material_cubes=cpu_definition, cube_edge_size=cube_edge_size, external_temperature_booster_points={}, internal_temperature_booster_points={}, environment_properties=environment_properties, simulation_precision="HIGH") initial_state = cubed_space.create_initial_state( default_temperature=environment_temperature, material_cubes_temperatures={ 0: core_initial_temperature, 1: core_initial_temperature, 2: core_initial_temperature, 3: core_initial_temperature, 4: board_initial_temperature }, environment_temperature=environment_temperature) min_max_temperatures_vector: List[Tuple[float, float, float]] = [ (0.0, core_initial_temperature, core_initial_temperature) ] # Initial temperatures temperature_over_before_zero_seconds = cubed_space.obtain_temperature( actual_state=initial_state) min_temperature = obtain_min_temperature( temperature_over_before_zero_seconds) max_temperature = obtain_max_temperature( temperature_over_before_zero_seconds) min_max_temperatures_vector.append((0.0, min(min_temperature.values()), max(max_temperature.values()))) # Apply energy over the cubed space number_of_iterations = 100 for i in range(number_of_iterations): initial_state = cubed_space.apply_energy( actual_state=initial_state, amount_of_time=0.001) temperature = cubed_space.obtain_temperature( actual_state=initial_state) min_temperature = obtain_min_temperature(temperature) max_temperature = obtain_max_temperature(temperature) min_max_temperatures_vector.append( (0.0, min(min_temperature.values()), max(max_temperature.values()))) assert all(i > system_initial_temperature - 0.1 for _, i, _ in min_max_temperatures_vector) assert all(i < system_initial_temperature + 0.1 for _, _, i in min_max_temperatures_vector)
def _generate_cubed_space( tasks: TaskSet, processor_definition: Processor, environment_specification: Environment, simulation_options: SimulationConfiguration, board_thermal_id: int ) -> Tuple[Model, SimulationState, Dict[Tuple[int, int], int], Dict[Tuple[ int, int], int]]: """ Generate a cubed space thermal simulator from the system specification :param tasks: Group of tasks in the system :param processor_definition: Definition of the CPU to use :param environment_specification: Specification of the environment :param simulation_options: Options of the simulation :param board_thermal_id: Id of the cube that represents the board :return: Cubed space of the simulation Cubed space state of the simulation Dict [(core id, frequency in Hz)] -> External thermal source id that must be activated to simulate that a task is being executed in a CPU with a determinate frequency if DVSF is used Dict [(core id, task id)] -> External thermal source id that must be activated to simulate that a task is being executed in a CPU if energy based thermal model is used """ cube_edge_size = processor_definition.measure_unit / simulation_options.processor_mesh_division scene_definition = { i: (j.core_type.material, Cuboid(location=Location( x=j.location.x * simulation_options.processor_mesh_division, y=j.location.y * simulation_options.processor_mesh_division, z=j.location.z * simulation_options.processor_mesh_division), dimensions=Dimensions( x=j.core_type.dimensions.x * simulation_options.processor_mesh_division, y=j.core_type.dimensions.y * simulation_options.processor_mesh_division, z=j.core_type.dimensions.z * simulation_options.processor_mesh_division))) for i, j in processor_definition.cores_definition.items() } # Board scene_definition[board_thermal_id] = ( processor_definition.board_definition.material, Cuboid(location=Location( x=processor_definition.board_definition.location.x * simulation_options.processor_mesh_division, y=processor_definition.board_definition.location.y * simulation_options.processor_mesh_division, z=processor_definition.board_definition.location.z * simulation_options.processor_mesh_division), dimensions=Dimensions( x=processor_definition.board_definition.dimensions.x * simulation_options.processor_mesh_division, y=processor_definition.board_definition.dimensions.y * simulation_options.processor_mesh_division, z=processor_definition.board_definition.dimensions.z * simulation_options.processor_mesh_division))) # Leakage power energy generators external_heat_generators_leakage_power = { i: create_energy_applicator( (j.core_type.material, Cuboid(location=Location( x=j.location.x * simulation_options.processor_mesh_division, y=j.location.y * simulation_options.processor_mesh_division, z=j.location.z * simulation_options.processor_mesh_division), dimensions=Dimensions( x=j.core_type.dimensions.x * simulation_options.processor_mesh_division, y=j.core_type.dimensions.y * simulation_options.processor_mesh_division, z=j.core_type.dimensions.z * simulation_options.processor_mesh_division))), watts_to_apply=j.core_type.core_energy_consumption.leakage_alpha, cube_edge_size=cube_edge_size) for i, j in processor_definition.cores_definition.items() } internal_heat_generators_leakage_power = { i: TMInternal(cuboid=Cuboid( location=Location( x=j.location.x * simulation_options.processor_mesh_division, y=j.location.y * simulation_options.processor_mesh_division, z=j.location.z * simulation_options.processor_mesh_division), dimensions=Dimensions(x=j.core_type.dimensions.x * simulation_options.processor_mesh_division, y=j.core_type.dimensions.y * simulation_options.processor_mesh_division, z=j.core_type.dimensions.z * simulation_options.processor_mesh_division)), boostRateMultiplier=j.core_type.core_energy_consumption. leakage_delta) for i, j in processor_definition.cores_definition.items() } # Dynamic energy external heat generators core_frequency_energy_activator_id: Dict[Tuple[int, int], int] = {} core_task_energy_activator_id: Dict[Tuple[int, int], int] = {} if simulation_options.thermal_simulation_type == "DVFS": external_heat_generators_dynamic_energy: Dict[int, TMExternal] = {} for i, j in processor_definition.cores_definition.items(): for f in j.core_type.available_frequencies: generator_id = len(external_heat_generators_dynamic_energy) + \ len(external_heat_generators_leakage_power) core_frequency_energy_activator_id[(i, f)] = generator_id external_heat_generators_dynamic_energy[ generator_id] = create_energy_applicator( (j.core_type.material, Cuboid( location=Location( x=j.location.x * simulation_options.processor_mesh_division, y=j.location.y * simulation_options.processor_mesh_division, z=j.location.z * simulation_options.processor_mesh_division), dimensions=Dimensions( x=j.core_type.dimensions.x * simulation_options.processor_mesh_division, y=j.core_type.dimensions.y * simulation_options.processor_mesh_division, z=j.core_type.dimensions.z * simulation_options.processor_mesh_division))), watts_to_apply=j.core_type.core_energy_consumption. dynamic_alpha * (f**3) + j.core_type.core_energy_consumption.dynamic_beta, cube_edge_size=cube_edge_size) elif simulation_options.thermal_simulation_type == "TASK_CONSUMPTION_MEASURED": external_heat_generators_dynamic_energy: Dict[int, TMExternal] = {} for i, j in processor_definition.cores_definition.items(): for k in tasks.tasks(): generator_id = len(external_heat_generators_dynamic_energy) + \ len(external_heat_generators_leakage_power) core_task_energy_activator_id[(i, k.identifier)] = generator_id external_heat_generators_dynamic_energy[ generator_id] = create_energy_applicator( (j.core_type.material, Cuboid( location=Location( x=j.location.x * simulation_options.processor_mesh_division, y=j.location.y * simulation_options.processor_mesh_division, z=j.location.z * simulation_options.processor_mesh_division), dimensions=Dimensions( x=j.core_type.dimensions.x * simulation_options.processor_mesh_division, y=j.core_type.dimensions.y * simulation_options.processor_mesh_division, z=j.core_type.dimensions.z * simulation_options.processor_mesh_division))), watts_to_apply=k.energy_consumption, cube_edge_size=cube_edge_size) else: external_heat_generators_dynamic_energy: Dict[int, TMExternal] = {} cubed_space = Model( material_cubes=scene_definition, cube_edge_size=cube_edge_size, external_temperature_booster_points={ **external_heat_generators_leakage_power, **external_heat_generators_dynamic_energy }, internal_temperature_booster_points= internal_heat_generators_leakage_power, environment_properties=environment_specification. environment_properties, simulation_precision=simulation_options.thermal_simulation_precision) initial_state = cubed_space.create_initial_state( default_temperature=environment_specification.temperature, environment_temperature=environment_specification.temperature) return cubed_space, initial_state, core_frequency_energy_activator_id, core_task_energy_activator_id