From f3e578a2a43c99997dbf35e09debfde255a4ae22 Mon Sep 17 00:00:00 2001 From: Dante Niewenhuis Date: Sun, 3 Nov 2024 20:00:26 +0100 Subject: Rewritten the Carbon model (#260) --- .../src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt | 1 + .../main/kotlin/org/opendc/compute/topology/specs/PowerSourceSpec.kt | 3 ++- .../main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt | 4 +++- 3 files changed, 6 insertions(+), 2 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 76c653bf..f271c028 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 @@ -107,6 +107,7 @@ private fun ClusterJSONSpec.toClusterSpec(random: RandomGenerator): ClusterSpec PowerSourceSpec( UUID(random.nextLong(), (clusterId).toLong()), totalPower = this.powerSource.totalPower, + carbonTracePath = this.powerSource.carbonTracePath, ) clusterId++ return ClusterSpec(this.name, hostSpecs, powerSourceSpec) diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/PowerSourceSpec.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/PowerSourceSpec.kt index 79770684..179e8f9e 100644 --- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/PowerSourceSpec.kt +++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/PowerSourceSpec.kt @@ -29,5 +29,6 @@ public data class PowerSourceSpec( val uid: UUID, val name: String = "unknown", val meta: Map = emptyMap(), - val totalPower: Long, + val totalPower: Long = Long.MAX_VALUE, + val carbonTracePath: String? = null, ) 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 9acdf72a..cdc1d96a 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 @@ -115,6 +115,7 @@ public data class PowerModelSpec( val power: Power = Power.ofWatts(400), val maxPower: Power, val idlePower: Power, + val carbonTracePaths: String? = null, ) { init { require(maxPower >= idlePower) { "The max power of a power model can not be less than the idle power" } @@ -144,7 +145,8 @@ public data class PowerSourceJSONSpec( val vendor: String = "unknown", val modelName: String = "unknown", val arch: String = "unknown", - val totalPower: Long, + val totalPower: Long = Long.MAX_VALUE, + val carbonTracePath: String? = null, ) { public companion object { public val DFLT: PowerSourceJSONSpec = -- cgit v1.2.3