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:
depereo 2019-05-03 11:47:22 +12:00
parent a8c57313d3
commit ec72bdab2a

View File

@ -1960,7 +1960,7 @@ class PowerPort(CableTermination, ComponentModel):
allocated_draw_total=Sum('allocated_draw'),
)
utilization['outlets'] = len(outlet_ids)
utilization['available_power'] = powerfeed_available
utilization['available_power'] = powerfeed_available - utilization['maximum_draw_total']
stats.append(utilization)
# Per-leg stats for three-phase feeds
@ -1973,7 +1973,10 @@ class PowerPort(CableTermination, ComponentModel):
)
utilization['name'] = 'Leg {}'.format(leg_name)
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)
return stats