Skip to content

[Nexthop] Add load-line droop compensation for AVS voltage rails in sensor_service#1351

Open
vvasavada-nexthop wants to merge 2 commits into
facebook:mainfrom
nexthop-ai:load-line-droop-compensation-avs-rail
Open

[Nexthop] Add load-line droop compensation for AVS voltage rails in sensor_service#1351
vvasavada-nexthop wants to merge 2 commits into
facebook:mainfrom
nexthop-ai:load-line-droop-compensation-avs-rail

Conversation

@vvasavada-nexthop

Copy link
Copy Markdown

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

AVS rails that use load-line regulation (Adaptive Voltage Positioning) intentionally droop their output voltage under load. Under high current, this droop can be large enough to trip low-voltage alarms even when the regulator is behaving correctly.

This change adds load-line droop compensation to sensor_service. For a configured voltage rail, the published value is corrected back toward the regulator set-point using the measured load current:

vout = rawVout + (I_amps * R_uOhms * 1e-6)

Changes

  • Thrift schema (sensor_config.thrift): add two optional PmSensor fields:
    • loadLineCurrentSensor
    • loadLineuOhms
  • SensorServiceImpl: rails with loadLineuOhms are collected into a deferred loadLineSensors collection during fetchSensorData and published only after their companion sensors have been read. processLoadLineDroopAdjust applies the formula above and then publishes the adjusted value.
  • ConfigValidator: validates the new config fields:
    • fields must be set together
    • only valid on VOLTAGE sensors
    • resistance must be positive
    • the referenced companion current sensor must exist and be of type CURRENT
  • Tests: new SensorServiceImplLoadLineTest coverage, including direct adjustment and fetchSensorData paths, plus new ConfigValidator cases.

Test Plan

  • sensor_service_sw_test passed, including the newly added test cases
  • manually verified on hardware by comparing the stock service and patched binary on the live rail
  • also tested with exaggerated load-line resistance to confirm that published voltage is driven by iout × loadLineuOhms × 1e-6
config raw VOUT IOUT computation published VOUT
Before / without compensation 766 → 0.766 V 171500 → 171.5 A no adjustment -> 0.766 0.77
With compensation / loadLineuOhms = 59 766 → 0.766 V 172750 → 172.75 A 0.766 + 172.75 x 59 x 1e-6 = 0.7762 0.78
With compensation / loadLineuOhms = 59000 766 → 0.766 V ~171 A 0.766 + 171 x 59000 x 1e-6 = 10.855 10.86

The realistic resistance case produces the expected small correction, and increasing the resistance scales the adjustment proportionally, confirming that the published value is driven by iout × loadLineuOhms × 1e-6.

@vvasavada-nexthop vvasavada-nexthop requested review from a team as code owners June 30, 2026 16:53
@meta-cla

meta-cla Bot commented Jun 30, 2026

Copy link
Copy Markdown

Hi @vvasavada-nexthop!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@vvasavada-nexthop vvasavada-nexthop changed the title Add load-line droop compensation for AVS voltage rails in sensor_service Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 participant