float EqualisedPower(PowerConsumerInterface them) { var sumCapacity = Capacity + them.GetMaxPower(); var sumPower = Power + them.GetMaxPower() - them.GetRemainingPowerCapacity(); return(Capacity * sumPower / sumCapacity); }
protected override Byte CalculateOutput(SegmentEntity entity, UInt16 data) { PowerConsumerInterface powerConsumerInterface = entity as PowerConsumerInterface; if (powerConsumerInterface == null) { return(0); } Double remainingPower = Math.Round(powerConsumerInterface.GetRemainingPowerCapacity(), MidpointRounding.AwayFromZero); Double maxPower = Math.Round(powerConsumerInterface.GetMaxPower(), MidpointRounding.AwayFromZero); return((Byte)((1f - remainingPower / maxPower) * 255f)); }
static float NormalizedPower(PowerConsumerInterface powerHolder) { return(1f - powerHolder.GetRemainingPowerCapacity() / powerHolder.GetMaxPower()); }