Example #1
0
        public bool IsGroupCapacityEnoughForAdditionalChargeStation(ChargeStation chargeStation)
        {
            int extraMaxCurrentInAmps = chargeStation.Connectors.Sum(x => x.MaxCurrentInAmps);

            int actualMaxCurrentOfConnectors = GetActualMaxCurrentOfConnectors();

            int resultingCapacity = actualMaxCurrentOfConnectors + extraMaxCurrentInAmps;

            bool canExtraChargeStationBeAdded = CapacityInAmps >= resultingCapacity;

            return(canExtraChargeStationBeAdded);
        }
Example #2
0
        public void AddChargeStation(ChargeStation chargeStation)
        {
            if (chargeStation.Connectors?.Any() == false)
            {
                throw new SpecificationException("Charge station cannot be added without at least a connector");
            }

            if (IsGroupCapacityEnoughForAdditionalChargeStation(chargeStation) == false)
            {
                throw new SpecificationException("Charge station cannot be added. The additional current load would be too much for the group");
            }

            ChargeStations.Add(chargeStation);
        }