mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-16 12:38:17 -06:00
Decrement available phase power where consumed
This will make the Available Power number more relevant where this has been consumed by other devices. Currently this is fairly static and requires the user to perform mental arithmetic to understand the remaining resource value.
This commit is contained in:
parent
a8c57313d3
commit
ec72bdab2a
@ -1960,7 +1960,7 @@ class PowerPort(CableTermination, ComponentModel):
|
|||||||
allocated_draw_total=Sum('allocated_draw'),
|
allocated_draw_total=Sum('allocated_draw'),
|
||||||
)
|
)
|
||||||
utilization['outlets'] = len(outlet_ids)
|
utilization['outlets'] = len(outlet_ids)
|
||||||
utilization['available_power'] = powerfeed_available
|
utilization['available_power'] = powerfeed_available - utilization['maximum_draw_total']
|
||||||
stats.append(utilization)
|
stats.append(utilization)
|
||||||
|
|
||||||
# Per-leg stats for three-phase feeds
|
# Per-leg stats for three-phase feeds
|
||||||
@ -1973,7 +1973,10 @@ class PowerPort(CableTermination, ComponentModel):
|
|||||||
)
|
)
|
||||||
utilization['name'] = 'Leg {}'.format(leg_name)
|
utilization['name'] = 'Leg {}'.format(leg_name)
|
||||||
utilization['outlets'] = len(outlet_ids)
|
utilization['outlets'] = len(outlet_ids)
|
||||||
utilization['available_power'] = round(powerfeed_available / 3)
|
if utilization['maximum_draw_total']:
|
||||||
|
utilization['available_power'] = round((powerfeed_available - utilization['maximum_draw_total']) / 3)
|
||||||
|
else:
|
||||||
|
utilization['available_power'] = round(powerfeed_available / 3)
|
||||||
stats.append(utilization)
|
stats.append(utilization)
|
||||||
|
|
||||||
return stats
|
return stats
|
||||||
|
Loading…
Reference in New Issue
Block a user