コード例 #1
0
        float EqualisedPower(PowerConsumerInterface them)
        {
            var sumCapacity = Capacity + them.GetMaxPower();
            var sumPower    = Power + them.GetMaxPower() - them.GetRemainingPowerCapacity();

            return(Capacity * sumPower / sumCapacity);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 static float NormalizedPower(PowerConsumerInterface powerHolder)
 {
     return(1f - powerHolder.GetRemainingPowerCapacity() / powerHolder.GetMaxPower());
 }