From 20d8587552840c0379e35f70dad05c46de439122 Mon Sep 17 00:00:00 2001 From: Dante Niewenhuis Date: Mon, 10 Feb 2025 15:25:26 +0100 Subject: added embodied carbon (#303) --- .../kotlin/org/opendc/compute/topology/TopologyFactories.kt | 2 ++ .../kotlin/org/opendc/compute/topology/specs/BatterySpec.kt | 2 ++ .../org/opendc/compute/topology/specs/TopologySpecs.kt | 12 ++++++------ 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'opendc-compute/opendc-compute-topology/src') diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt index a857f496..b62c457c 100644 --- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt +++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt @@ -143,6 +143,8 @@ private fun ClusterJSONSpec.toClusterSpec(): ClusterSpec { this.battery.chargingSpeed, this.battery.batteryPolicy, this.battery.initialCharge, + this.battery.embodiedCarbon, + this.battery.expectedLifetime, ) } diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/BatterySpec.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/BatterySpec.kt index 79a23a9e..b5fc98d5 100644 --- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/BatterySpec.kt +++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/BatterySpec.kt @@ -28,4 +28,6 @@ public data class BatterySpec( val chargingSpeed: Double, val batteryPolicy: BatteryPolicyJSONSpec, val initialCharge: Double, + val embodiedCarbon: Double, + val expectedLifetime: Double, ) diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt index 0f7694c1..7b309bc3 100644 --- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt +++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt @@ -166,6 +166,9 @@ public data class PowerSourceJSONSpec( * @property chargingSpeed The charging speed of the battery in J * @property batteryPolicy The policy used to decide when the battery charges and discharges * @property initialCharge The initial charge in the battery + * @property embodiedCarbon The embodied carbon needed to create the battery in gram + * @property expectedLifetime The expected lifetime of the battery in years + * */ @Serializable public data class BatteryJSONSpec( @@ -174,12 +177,9 @@ public data class BatteryJSONSpec( val chargingSpeed: Double, val batteryPolicy: BatteryPolicyJSONSpec, var initialCharge: Double = 0.0, -) { - init { - this.capacity *= 3600000 - this.initialCharge *= 3600000 - } -} + var embodiedCarbon: Double = 0.0, + var expectedLifetime: Double = 0.0, +) @Serializable public data class BatteryPolicyJSONSpec( -- cgit v1.2.3