summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-topology
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2024-11-03 20:00:26 +0100
committerGitHub <noreply@github.com>2024-11-03 20:00:26 +0100
commitf3e578a2a43c99997dbf35e09debfde255a4ae22 (patch)
tree312dde871072cff0468d2a5a11cd671d85063220 /opendc-compute/opendc-compute-topology
parent6fa203b9187b474816e7719baed8c97eadd689cb (diff)
Rewritten the Carbon model (#260)
Diffstat (limited to 'opendc-compute/opendc-compute-topology')
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/TopologyFactories.kt1
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/PowerSourceSpec.kt3
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt4
3 files changed, 6 insertions, 2 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 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<String, Any> = 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 =