summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-topology/src
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2025-02-10 15:25:26 +0100
committerGitHub <noreply@github.com>2025-02-10 15:25:26 +0100
commit20d8587552840c0379e35f70dad05c46de439122 (patch)
tree27772bb50b3c23d0965846b80c9b2fbe421dc940 /opendc-compute/opendc-compute-topology/src
parent2a0f78cd550b2187341b7c0c2ca443c27ef44bb1 (diff)
added embodied carbon (#303)
Diffstat (limited to 'opendc-compute/opendc-compute-topology/src')
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt2
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/BatterySpec.kt2
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt12
3 files changed, 10 insertions, 6 deletions
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(