public static List <CalcDeviceLoad> MakeCalcDeviceLoads([NotNull] CalcDeviceDto device, [NotNull] CalcLoadTypeDictionary calcLoadTypeDictionary) { var deviceLoads = new List <CalcDeviceLoad>(); foreach (var ltdto in device.Loads) { if (calcLoadTypeDictionary.SimulateLoadtype(ltdto.LoadTypeGuid)) { var lt = calcLoadTypeDictionary.GetLoadtypeByGuid(ltdto.LoadTypeGuid); var cdl = new CalcDeviceLoad(ltdto.Name, ltdto.MaxPower, lt, ltdto.AverageYearlyConsumption, ltdto.PowerStandardDeviation); deviceLoads.Add(cdl); } } return(deviceLoads); }
public List <CalcAutoDev> MakeCalcAutoDevs( [NotNull][ItemNotNull] List <CalcAutoDevDto> autoDevices, [NotNull] DtoCalcLocationDict locationDict) { var autodevs = new List <CalcAutoDev>(autoDevices.Count); foreach (var autoDevDto in autoDevices) { if (_loadTypeDictionary.SimulateLoadtype(autoDevDto.LoadtypeGuid)) { var deviceLoads = MakeCalcDeviceLoads(autoDevDto, _loadTypeDictionary); CalcProfile cp = MakeCalcProfile(autoDevDto.CalcProfile, _calcRepo.CalcParameters); var loadtype = _loadTypeDictionary.GetLoadtypeByGuid(autoDevDto.LoadtypeGuid); CalcLocation calcLocation = locationDict.GetCalcLocationByGuid(autoDevDto.CalcLocationGuid); List <VariableRequirement> requirements = new List <VariableRequirement>(); foreach (var req in autoDevDto.Requirements) { VariableRequirement vreq = new VariableRequirement(req.Name, req.Value, req.CalcLocationName, req.LocationGuid, req.VariableCondition, _calcVariableRepository, req.VariableGuid); requirements.Add(vreq); } autoDevDto.AdditionalName = " (autonomous)"; var cautodev = new CalcAutoDev(cp, loadtype, deviceLoads, autoDevDto.TimeStandardDeviation, 1, calcLocation, requirements, autoDevDto, _calcRepo); var busyarr = _availabilityDtoRepository.GetByGuid(autoDevDto.BusyArr.Guid); cautodev.ApplyBitArry(busyarr, loadtype); autodevs.Add(cautodev); } } return(autodevs); }