Pair voltage with frequency across the profile envelope
source-pr / source (pull_request) Successful in 12s

Boards do not run at a fixed voltage across their frequency range, so the
reported operating point was describing a machine that does not exist: the
voltage stayed at the boot value while the tuner moved the frequency.

Envelope::voltage_for interpolates linearly between the profile floor and
ceiling and clamps outside it, and MinerRuntime now reports the voltage that
pairs with the applied frequency. A single-frequency envelope reports its
floor without dividing by zero.
This commit is contained in:
2026-10-22 10:50:56 -06:00
parent 42509a6383
commit 2b07d27c67
2 changed files with 59 additions and 4 deletions
+13 -4
View File
@@ -67,7 +67,10 @@ impl MinerRuntime {
pub fn operating_point(&self) -> OperatingPoint {
OperatingPoint {
voltage_mv: self.plan.operating_point.voltage_mv,
voltage_mv: self
.plan
.envelope
.voltage_for(self.last_command.frequency_mhz),
frequency_mhz: self.last_command.frequency_mhz,
confirmed: self.plan.operating_point.confirmed,
}
@@ -271,8 +274,14 @@ mod tests {
for _ in 0..10 {
runtime.tick(&tick(1_500.0));
}
assert!(runtime.operating_point().frequency_mhz > 300);
assert!(!runtime.operating_point().confirmed);
assert_eq!(runtime.operating_point().voltage_mv, 1200);
let point = runtime.operating_point();
assert!(point.frequency_mhz > 300);
assert!(!point.confirmed);
// Voltage follows the frequency across the envelope instead of staying at the boot value.
assert_eq!(
point.voltage_mv,
runtime.plan().envelope.voltage_for(point.frequency_mhz)
);
assert!(point.voltage_mv > 1100);
}
}