public void AddTravelRouteStep([NotNull] string stepName, [NotNull] CalcTransportationDeviceCategory deviceCategory,
                                       int stepNumber, double distanceInM, StrGuid guid)
        {
            CalcTravelRouteStep trs = new CalcTravelRouteStep(
                stepName, deviceCategory, stepNumber,
                distanceInM, guid, _vehiclePool, _calcRepo);

            Steps.Add(trs);
        }
 public CalcTravelRouteStep([NotNull] string pName,
                            [NotNull] CalcTransportationDeviceCategory transportationDeviceCategory, int stepNumber, double distanceInM,
                            StrGuid guid, [NotNull][ItemNotNull] List <CalcTransportationDevice> vehiclePool,
                            CalcRepo calcRepo) : base(pName, guid)
 {
     TransportationDeviceCategory = transportationDeviceCategory;
     StepNumber         = stepNumber;
     _distanceOfStepInM = distanceInM;
     _vehiclePool       = vehiclePool;
     _calcRepo          = calcRepo;
 }
        public CalcTransportationDeviceCategory GetCategory([NotNull] CalcTransportationDeviceCategoryDto catDto)
        {
            if (DeviceCategories.Any(x => x.Guid == catDto.Guid))
            {
                return(DeviceCategories.Single(x => x.Guid == catDto.Guid));
            }
            CalcTransportationDeviceCategory ct = new CalcTransportationDeviceCategory(catDto.Name, catDto.IsLimitedToSingleLocation, catDto.Guid);

            DeviceCategories.Add(ct);
            return(ct);
        }
Exemplo n.º 4
0
        public void AddChargingStation([NotNull] CalcLoadType gridchargingLoadType,
                                       [NotNull] CalcTransportationDeviceCategory cat,
                                       double chargingDeviceMaxChargingPower,
                                       [NotNull] CalcLoadType carChargingLoadType,
                                       CalcRepo calcRepo)
        {
            string name = Name + " - Charging station " + (ChargingDevices.Count + 1);

            CalcChargingStation station = new CalcChargingStation(cat,
                                                                  gridchargingLoadType, chargingDeviceMaxChargingPower, name,
                                                                  System.Guid.NewGuid().ToStrGuid(), _householdKey, carChargingLoadType, calcRepo);

            ChargingDevices.Add(station);
        }
 public CalcChargingStation([NotNull] CalcTransportationDeviceCategory deviceCategory, [NotNull] CalcLoadType gridChargingLoadType,
                            double maxChargingPower,
                            [NotNull] string chargingStationName, StrGuid chargingStationGuid,
                            [NotNull] HouseholdKey householdKey,
                            [NotNull] CalcLoadType carChargingLoadType, CalcRepo calcRepo)
 {
     _householdKey        = householdKey;
     _calcRepo            = calcRepo;
     CarChargingLoadType  = carChargingLoadType;
     DeviceCategory       = deviceCategory;
     GridChargingLoadType = gridChargingLoadType;
     MaxChargingPower     = maxChargingPower;
     ChargingStationName  = chargingStationName;
     ChargingStationGuid  = chargingStationGuid;
     IsAvailable          = true;
 }
Exemplo n.º 6
0
        public CalcTransportationDevice(
            [NotNull] CalcTransportationDeviceCategory category,
            double averageSpeedInMPerS, [NotNull][ItemNotNull] List <CalcDeviceLoad> loads,
            double fullRangeInMeters,
            double energyToDistanceFactor,
            double maxChargingPower,
            [CanBeNull] CalcLoadType chargingCalcLoadType,
            [NotNull][ItemNotNull] List <CalcSite> allCalcSites,
            [NotNull] CalcDeviceDto calcDeviceDto, [NotNull] CalcRepo calcRepo)
            : base(calcDeviceDto.Name, calcDeviceDto.Guid)
        {
            _dsc                    = new DateStampCreator(calcRepo.CalcParameters);
            _loads                  = loads;
            _fullRangeInMeters      = fullRangeInMeters;
            _energyToDistanceFactor = energyToDistanceFactor;
            _maxChargingPower       = maxChargingPower;
            _chargingCalcLoadType1  = chargingCalcLoadType;
            _availableRangeInMeters = fullRangeInMeters;
            Category                = category;
            AverageSpeedInMPerS     = averageSpeedInMPerS;
            _calcDeviceDto          = calcDeviceDto;
            _calcRepo               = calcRepo;
            if (_calcRepo.CalcParameters.InternalTimesteps == 0)
            {
                throw new LPGException("Time steps were not initialized.");
            }

            _isBusyArray = new BitArray(_calcRepo.CalcParameters.InternalTimesteps);
            //not all devices need to have load types. busses for example have no load
            //if (loads.Count == 0) {
            //throw new DataIntegrityException("The transportation device " + pName +
            //" seems to have no load types. That is not very useful. Please fix.");
            //}
            var vehiclePoolGuid = "8C426E95-B269-402E-9806-C3785D6C8433".ToStrGuid();

            _calcDeviceDto.LocationGuid = vehiclePoolGuid;
            _calcDeviceDto.LocationName = "Vehicle Pool";
            if (calcDeviceDto.LocationGuid == null)
            {
                throw new LPGException("Trying to initalize with empty location guid");
            }
            foreach (CalcDeviceLoad deviceLoad in loads)
            {
                //TODO: check if -1 is a good location guid
                //OefcKey key = new OefcKey(_calcDeviceDto.HouseholdKey, OefcDeviceType.Transportation, Guid, "-1", deviceLoad.LoadType.Guid, "Transportation");
                var key = _calcRepo.Odap.RegisterDevice(deviceLoad.LoadType.ConvertToDto(), calcDeviceDto);
                _keysByLocGuidAndLoadtype.Add(calcDeviceDto.LocationGuid, new Dictionary <CalcLoadType, OefcKey>());
                _keysByLocGuidAndLoadtype[calcDeviceDto.LocationGuid].Add(deviceLoad.LoadType, key);
            }

            if (chargingCalcLoadType != null)
            {
                var key2 = _calcRepo.Odap.RegisterDevice(chargingCalcLoadType.ConvertToDto(), calcDeviceDto);
                if (!_keysByLocGuidAndLoadtype.ContainsKey(calcDeviceDto.LocationGuid))
                {
                    _keysByLocGuidAndLoadtype.Add(calcDeviceDto.LocationGuid, new Dictionary <CalcLoadType, OefcKey>());
                }
                var dict = _keysByLocGuidAndLoadtype[calcDeviceDto.LocationGuid];
                if (!dict.ContainsKey(chargingCalcLoadType))
                {
                    dict.Add(chargingCalcLoadType, key2);
                }
            }

            RegisterForAllCalcSites(allCalcSites);
        }
Exemplo n.º 7
0
 public List <CalcChargingStation> CollectChargingDevicesFor([NotNull] CalcTransportationDeviceCategory category, [NotNull] CalcLoadType carLoadType)
 {
     return(ChargingDevices.Where(x => x.DeviceCategory == category && x.CarChargingLoadType == carLoadType).ToList());
 }