public void OnlineDeviceActivationProcessorArrayTest() { var rnd = new Random(1); var nr = new NormalRandom(0, 1, rnd); using (var wd = new WorkingDir(Utili.GetCurrentMethodAndClass())) { wd.InputDataLogger.AddSaver(new ColumnEntryLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new ResultFileEntryLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new HouseholdKeyLogger(wd.SqlResultLoggingService)); var calcParameters = CalcParametersFactory.MakeGoodDefaults().EnableShowSettlingPeriod(); //calcParameters.Enable(CalcOption.ActionsLogfile); calcParameters.Enable(CalcOption.DeviceProfilesIndividualHouseholds); calcParameters.Enable(CalcOption.DetailedDatFiles); using (var fft = new FileFactoryAndTracker(wd.WorkingDirectory, "hh1", wd.InputDataLogger)) { //SqlResultLoggingService srls = new SqlResultLoggingService(Path.Combine(wd.WorkingDirectory, "results.sqlite")); var dsc = new DateStampCreator(calcParameters); using (IOnlineLoggingData old = new OnlineLoggingData(dsc, wd.InputDataLogger, calcParameters)) { var hhkey = new HouseholdKey("HH1"); fft.RegisterHousehold(Constants.GeneralHouseholdKey, "generalhousehold", HouseholdKeyType.General, "Description", null, null); fft.RegisterHousehold(hhkey, "hh1", HouseholdKeyType.Household, "Description", null, null); var odap = new OnlineDeviceActivationProcessor(old, calcParameters, fft); var deviceGuid = "devguid".ToStrGuid(); var locationGuid = "locationGuid".ToStrGuid(); var loadtypeGuid = "ltguid".ToStrGuid(); var cdd = new CalcDeviceDto("devicename", "devcatguid".ToStrGuid(), hhkey, OefcDeviceType.Device, "devcatname", "", deviceGuid, locationGuid, "loc"); var key = new OefcKey(cdd, loadtypeGuid); var clt = new CalcLoadType("lt1", "W", "kWh", 1, true, loadtypeGuid); odap.RegisterDevice(clt.ConvertToDto(), cdd); double[] stepValues = { 1.0, 0 }; var valueList = new List <double>(stepValues); var cp = new CalcProfile("myCalcProfile", Guid.NewGuid().ToStrGuid(), valueList, ProfileType.Absolute, "synthetic"); var ts1 = new TimeStep(1, 0, false); var cdl = new CalcDeviceLoad("", 1, clt, 0, 0); var sv = StepValues.MakeStepValues(cp, 10, RandomValueProfile.MakeStepValues(cp.StepValues.Count, nr, 0), cdl); odap.AddNewStateMachine(ts1, clt.ConvertToDto(), "name1", "p1", key, cdd, sv); double[] resultValues = { 0, 10.0, 0, 0, 0, 0, 0, 0, 0, 0 }; for (var i = 0; i < 10; i++) { var ts = new TimeStep(i, 0, true); var filerows = odap.ProcessOneTimestep(ts); filerows.Count.Should().Be(1); filerows[0].EnergyEntries.Count.Should().Be(1); Logger.Info(filerows[0].EnergyEntries[0].ToString(CultureInfo.CurrentCulture)); resultValues[i].Should().Be(filerows[0].EnergyEntries[0]); foreach (var fileRow in filerows) { fileRow.Save(odap.BinaryOutStreams[fileRow.LoadType]); } } } } Logger.Info(wd.WorkingDirectory); wd.CleanUp(); } }
public void ProcessOneTimestepTestVariableFactor() { var calcParameters = CalcParametersFactory.MakeGoodDefaults(); using var wd = new WorkingDir(Utili.GetCurrentMethodAndClass()); wd.InputDataLogger.AddSaver(new ResultFileEntryLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new HouseholdKeyLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new ColumnEntryLogger(wd.SqlResultLoggingService)); using var fft = new FileFactoryAndTracker(wd.WorkingDirectory, "name", wd.InputDataLogger); fft.RegisterGeneralHouse(); using var old = new OnlineLoggingData(new DateStampCreator(calcParameters), wd.InputDataLogger, calcParameters); var odap = new OnlineDeviceActivationProcessor(old, calcParameters, fft); var clt = new CalcLoadType("clt1", "W", "kWh", 1, true, Guid.NewGuid().ToStrGuid()); var devguid = Guid.NewGuid().ToStrGuid(); var locguid = Guid.NewGuid().ToStrGuid(); var cdd = new CalcDeviceDto("dev1", "devcatguid".ToStrGuid(), new HouseholdKey("HH1"), OefcDeviceType.Device, "devcatname", "", devguid, locguid, "loc"); var key = new OefcKey(cdd, clt.Guid); odap.RegisterDevice(clt.ConvertToDto(), cdd); double[] timestepValues = { 0, 5, 10.0, 20, 30, 40, 0 }; var cp = new CalcProfile("myCalcProfile", Guid.NewGuid().ToStrGuid(), timestepValues.ToList(), ProfileType.Absolute, "synthetic"); var ts1 = new TimeStep(1, 0, true); CalcDeviceLoad cdl = new CalcDeviceLoad("", 1, clt, 0, 0); var sv = StepValues.MakeStepValues(cp, 1, RandomValueProfile.MakeStepValues(cp.StepValues.Count, NormalRandom, 0), cdl); odap.AddNewStateMachine(ts1, clt.ConvertToDto(), "name1", "p1", key, cdd, sv); double[] resultValues = { 0, 0, 5, 10.0, 20, 30, 40, 0 }; //double[] resultValuesRow1 = {0, 0, 5, 10, 200, 3000, 4000, 0}; var ctd = new CalcTransformationDevice(odap, -1, 080, -1000, 1000, cdd, clt); var clt2 = new CalcLoadType("clt2", "W2", "kWh2", 1, true, Guid.NewGuid().ToStrGuid()); ctd.AddOutputLoadType(clt2, 2, TransformationOutputFactorType.Interpolated); ctd.AddDatapoint(10, 1); ctd.AddDatapoint(20, 10); ctd.AddDatapoint(30, 100); for (var i = 0; i < resultValues.Length; i++) { var ts = new TimeStep(i, calcParameters); var filerows = odap.ProcessOneTimestep(ts); filerows.Count.Should().Be(2); filerows[0].EnergyEntries.Count.Should().Be(1); var sb = new StringBuilder("row0 before:"); sb.Append(filerows[0].EnergyEntries[0]); sb.Append(" row1 before:"); sb.Append(filerows[1].EnergyEntries[0]); Assert.Equal(resultValues[i], filerows[0].EnergyEntries[0]); Assert.Equal(0, filerows[1].EnergyEntries[0]); ctd.ProcessOneTimestep(filerows, null); //(filerows[1].EnergyEntries[0]).Should().Be(resultValuesRow1[i]); sb.Append(" row0 after:"); sb.Append(filerows[0].EnergyEntries[0]); sb.Append(" row1 after:"); sb.Append(filerows[1].EnergyEntries[0]); Logger.Info(Utili.GetCurrentMethodAndClass() + " " + sb); } }
public TimeStep SetTimeprofile([NotNull] CalcProfile calcProfile, [NotNull] TimeStep startTimeStep, [NotNull] CalcLoadType loadType, [NotNull] string affordanceName, [NotNull] string activatingPersonName, double multiplier, bool activateDespiteBeingBusy) { if (calcProfile.StepValues.Count == 0) { throw new LPGException("Trying to set empty device profile. This is a bug. Please report."); } CalcDeviceLoad cdl = _deviceLoadsBy[loadType]; if (cdl == null) { throw new LPGException("It was tried to activate the loadtype " + loadType.Name + " even though that one is not set for the device " + Name); } /*if (Math.Abs(cdl.Value) < 0.00000001 ) { * throw new LPGException("Trying to calculate with a power consumption factor of 0. This is wrong."); * }*/ if (CalcRepo.Odap == null && !Config.IsInUnitTesting) { throw new LPGException("ODAP was null. Please report"); } var totalDuration = calcProfile.StepValues.Count; //.GetNewLengthAfterCompressExpand(timefactor); //calcProfile.CompressExpandDoubleArray(timefactor,allProfiles), var key = _keyByLoad[cdl.LoadType]; RandomValueProfile rvp = GetRandomValueProfile(calcProfile.StepValues.Count, cdl, startTimeStep); StepValues sv = StepValues.MakeStepValues(calcProfile, multiplier, rvp, cdl); CalcRepo.Odap.AddNewStateMachine( startTimeStep, cdl.LoadType.ConvertToDto(), affordanceName, activatingPersonName, key, _calcDeviceDto, sv); if (MatchingAutoDevs.Count > 0) { foreach (CalcAutoDev matchingAutoDev in MatchingAutoDevs) { if (matchingAutoDev._keyByLoad.ContainsKey(cdl.LoadType)) { var zerokey = matchingAutoDev._keyByLoad[cdl.LoadType]; CalcRepo.Odap.AddZeroEntryForAutoDev(zerokey, startTimeStep, totalDuration); } } } SetBusy(startTimeStep, totalDuration, loadType, activateDespiteBeingBusy); return(startTimeStep.AddSteps(totalDuration)); }
public void OnlineDeviceStateMachineTest() { var startdate = new DateTime(2018, 1, 1); var enddate = startdate.AddMinutes(200); CalcParameters calcParameters = CalcParametersFactory.MakeGoodDefaults() .SetStartDate(startdate).SetEndDate(enddate).SetSettlingDays(0).EnableShowSettlingPeriod(); var values = new double[10]; for (var i = 0; i < values.Length; i++) { values[i] = i + 1; Logger.Info(values[i].ToString(CultureInfo.CurrentCulture)); } var valueList = new List <double>(values); var r = new Random(1); var nr = new NormalRandom(0, 1, r); var devGuid = Guid.NewGuid().ToStrGuid(); var locGuid = Guid.NewGuid().ToStrGuid(); var clt = new CalcLoadType("lt", "kWh", "W", 1, true, Guid.NewGuid().ToStrGuid()); var calcDeviceDto = new CalcDeviceDto("device", devGuid, new HouseholdKey("hh1"), OefcDeviceType.Device, "mycategory", "", devGuid, locGuid, "locname"); var key = new OefcKey(calcDeviceDto, locGuid); var cp = new CalcProfile("mycalcprofile", Guid.NewGuid().ToStrGuid(), valueList, ProfileType.Absolute, "bla"); TimeStep ts = new TimeStep(5, 0, false); CalcDeviceLoad cdl = new CalcDeviceLoad("", 1, clt, 0, 0); StepValues sv = StepValues.MakeStepValues(cp, 1, RandomValueProfile.MakeStepValues(cp.StepValues.Count, nr, 0), cdl); var odsm = new OnlineDeviceStateMachine(ts, clt.ConvertToDto(), "device", key, "affordance", calcParameters, sv, 0); calcParameters.SetDummyTimeSteps(0); odsm.CalculateOfficialEnergyUse().Should().Be(55); // all calcParameters.SetDummyTimeSteps(6); odsm.CalculateOfficialEnergyUse().Should().Be(54); // not the first //_calcParameters.InternalTimesteps = 20; calcParameters.SetDummyTimeSteps(15); odsm.CalculateOfficialEnergyUse().Should().Be(0); // none calcParameters.SetDummyTimeSteps(14); odsm.CalculateOfficialEnergyUse().Should().Be(10); // only the last Logger.Info(odsm.CalculateOfficialEnergyUse().ToString(CultureInfo.CurrentCulture)); startdate = new DateTime(2018, 1, 1); enddate = startdate.AddMinutes(10); calcParameters.DisableShowSettlingPeriod(); calcParameters.SetStartDate(startdate).SetEndDate(enddate) .SetDummyTimeSteps(5); odsm.CalculateOfficialEnergyUse().Should().Be(15); // only the first 5 //_calcParameters.InternalTimesteps = 10; // only 5 calcParameters.SetDummyTimeSteps(9); var val = odsm.CalculateOfficialEnergyUse(); val.Should().Be(5); // only #5 Logger.Info(odsm.CalculateOfficialEnergyUse().ToString(CultureInfo.CurrentCulture)); }
private void SetTimeprofile([NotNull] CalcProfile calcProfile, [NotNull] TimeStep startidx, [NotNull] CalcLoadType loadType, [NotNull] string affordanceName, [NotNull] string activatingPersonName, StrGuid locationGuid) { CalcDeviceLoad cdl = null; foreach (var calcDeviceLoad in _loads) { if (calcDeviceLoad.LoadType == loadType) { cdl = calcDeviceLoad; } } if (cdl == null) { throw new LPGException("It was tried to activate the loadtype " + loadType.Name + " even though that one is not set for the device " + Name); } /* var factor = cdl.Value * multiplier; * if (calcProfile.ProfileType == ProfileType.Absolute) * { * factor = 1 * multiplier; * }*/ if (_calcRepo.Odap == null && !Config.IsInUnitTesting) { throw new LPGException("ODAP was null. Please report"); } // var totalDuration = calcProfile.GetNewLengthAfterCompressExpand(timefactor); //OefcKey key = new OefcKey(_calcDeviceDto.HouseholdKey, OefcDeviceType.Transportation, Guid, "-1", cdl.LoadType.Guid, "Transportation"); var key = _keysByLocGuidAndLoadtype[locationGuid][cdl.LoadType]; var rvp = RandomValueProfile.MakeStepValues(calcProfile.StepValues.Count, _calcRepo.NormalRandom, 0); var sv = StepValues.MakeStepValues(calcProfile, 1, rvp, cdl); _calcRepo.Odap.AddNewStateMachine(startidx, cdl.LoadType.ConvertToDto(), affordanceName, activatingPersonName, key, _calcDeviceDto, sv); //SetBusy(startidx, totalDuration, loadType, activateDespiteBeingBusy); // return totalDuration + startidx; }
private RandomValueProfile GetRandomValueProfile(int count, CalcDeviceLoad cdl, TimeStep timeStep) { var entry = _randomValues.FirstOrDefault(x => x.TimeStep == timeStep && Math.Abs(x.PowerStandardDeviation - cdl.PowerStandardDeviation) < 0.000000001 && x.RandomValueProfile.Values.Count == count); if (entry != null) { return(entry.RandomValueProfile); } var newrvp = RandomValueProfile.MakeStepValues(count, CalcRepo.NormalRandom, cdl.PowerStandardDeviation); while (_randomValues.Count > 10) { _randomValues.RemoveAt(0); } var rvpe = new RandomValueProfileEntry(timeStep, cdl.PowerStandardDeviation, newrvp); _randomValues.Add(rvpe); return(newrvp); }
public void DriveAndCharge([NotNull] TimeStep currentTimeStep) { AdjustCurrentsiteByTimestep(currentTimeStep); LastChargingPower = 0; //first the undefined state // geräte, die nicht geladen werden müssen, haben eine negative range. //geräte im vehicle depot / in transit müssen nicht geladen werden. if (_fullRangeInMeters < 0) { DisconnectCar(); _calcRepo.OnlineLoggingData.AddTransportationDeviceState(new TransportationDeviceStateEntry( Name, Guid, currentTimeStep, TransportationDeviceState.Undefined, CurrentSoc, _calcDeviceDto.HouseholdKey, _availableRangeInMeters, _currentSite?.Name, _lastUsingPerson, _dsc.MakeDateStringFromTimeStep(currentTimeStep), 0)); return; } //currently driving if (currentTimeStep >= _activationStartTimestep && currentTimeStep < _activationStopTimestep) { DisconnectCar(); if (_currentSite != null) { throw new LPGException("transportation device was assigned to a site, even though it is driving"); } double distancePerTimestep = AverageSpeedInMPerS * _calcRepo.CalcParameters.InternalStepsize.TotalSeconds; _availableRangeInMeters -= distancePerTimestep; if (_availableRangeInMeters <= 0) { _availableRangeInMeters = 0; } _calcRepo.OnlineLoggingData.AddTransportationDeviceState(new TransportationDeviceStateEntry( Name, Guid, currentTimeStep, TransportationDeviceState.Driving, CurrentSoc, _calcDeviceDto.HouseholdKey, _availableRangeInMeters, _currentSite?.Name, _lastUsingPerson, _dsc.MakeDateStringFromTimeStep(currentTimeStep), distancePerTimestep)); return; } //car is fully charged if (_availableRangeInMeters >= _fullRangeInMeters) { _calcRepo.OnlineLoggingData.AddTransportationDeviceState(new TransportationDeviceStateEntry( Name, Guid, currentTimeStep, TransportationDeviceState.ParkingAndFullyCharged, CurrentSoc, _calcDeviceDto.HouseholdKey, _availableRangeInMeters, _currentSite?.Name, null , _dsc.MakeDateStringFromTimeStep(currentTimeStep), 0)); DisconnectCar(); //TODO: different disconnect strategies return; } if (_currentSite != null) { //needs charging && is at charging station var chargingStations = _currentSite.ChargingDevices.Where(x => x.CarChargingLoadType == _chargingCalcLoadType1 && x.DeviceCategory == Category).ToList(); if (chargingStations.Count > 0) { if (chargingStations.All(x => !x.IsAvailable) && _lastChargingStation == null) { _calcRepo.OnlineLoggingData.AddTransportationDeviceState(new TransportationDeviceStateEntry( Name, Guid, currentTimeStep, TransportationDeviceState.ParkingAndWaitingForCharging, CurrentSoc, _calcDeviceDto.HouseholdKey, _availableRangeInMeters, _currentSite.Name, null, _dsc.MakeDateStringFromTimeStep(currentTimeStep), 0)); DisconnectCar(); return; } //use the first one that is available //TODO: recycle the last one used var chargingStation = _lastChargingStation; if (_lastChargingStation == null) { chargingStation = chargingStations.First(x => x.IsAvailable); ConnectCar(chargingStation); } if (_currentSite == null) { throw new LPGException("Current site was null while trying to charge."); } if (chargingStation == null) { throw new LPGException("Charging station for charging was null"); } _calcRepo.OnlineLoggingData.AddTransportationDeviceState(new TransportationDeviceStateEntry( Name, Guid, currentTimeStep, TransportationDeviceState.ParkingAndCharging, CurrentSoc, _calcDeviceDto.HouseholdKey, _availableRangeInMeters, _currentSite.Name, null, _dsc.MakeDateStringFromTimeStep(currentTimeStep), 0)); double maxChargingPower = Math.Min(_maxChargingPower, chargingStation.MaxChargingPower); List <double> chargingProfile = new List <double> { maxChargingPower }; var cp = new CalcProfile("Profile for " + _currentSite.Name + " - Charging - " + Name, System.Guid.NewGuid().ToStrGuid(), chargingProfile, ProfileType.Absolute, "Synthetic Charging for " + Name + " @ " + _currentSite.Name); var dstLoadType = chargingStation.GridChargingLoadType; var key = _keysByLocGuidAndLoadtype[_currentSite.Guid][dstLoadType]; //OefcKey key = new OefcKey(_householdKey, OefcDeviceType.Charging, Guid, _currentSite.Guid, dstLoadType.Guid, "Transportation"); //if (dstLoadType == null) { // throw new Exception("???"); //} CalcDeviceLoad cdl = new CalcDeviceLoad("", 1, dstLoadType, 0, 0); //if (cp.DataSource != "Synthetic") { //throw new LPGException("wrong data source"); //} var rsv = RandomValueProfile.MakeStepValues(cp.StepValues.Count, _calcRepo.NormalRandom, cdl.PowerStandardDeviation); var sv = StepValues.MakeStepValues(cp, 1, rsv, cdl); _calcRepo.Odap.AddNewStateMachine(currentTimeStep, dstLoadType.ConvertToDto(), "Charging for " + Name + " @ " + _currentSite, "(autonomous)", key, _calcDeviceDto, sv); double gainedDistance = maxChargingPower * _energyToDistanceFactor * _calcRepo.CalcParameters.InternalStepsize.TotalSeconds; _availableRangeInMeters += gainedDistance; LastChargingPower = maxChargingPower; if (_availableRangeInMeters > _fullRangeInMeters) { //TODO: do this properly: reduce the max charging power _availableRangeInMeters = _fullRangeInMeters; } return; } } DisconnectCar(); _calcRepo.OnlineLoggingData.AddTransportationDeviceState(new TransportationDeviceStateEntry( Name, Guid, currentTimeStep, TransportationDeviceState.ParkingAndNoChargingAvailableHere, CurrentSoc, _calcDeviceDto.HouseholdKey, _availableRangeInMeters, _currentSite?.Name, null , _dsc.MakeDateStringFromTimeStep(currentTimeStep), 0)); }
public void ProcessOneEnergyStorageTimestepTest() { using (var wd = new WorkingDir(Utili.GetCurrentMethodAndClass())) { wd.InputDataLogger.AddSaver(new ColumnEntryLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new ResultFileEntryLogger(wd.SqlResultLoggingService)); wd.InputDataLogger.AddSaver(new HouseholdKeyLogger(wd.SqlResultLoggingService)); CalcParameters calcParameters = CalcParametersFactory.MakeGoodDefaults(); calcParameters.ShowSettlingPeriodTime = true; using (OnlineLoggingData old = new OnlineLoggingData(new DateStampCreator(calcParameters), wd.InputDataLogger, calcParameters)) { using (FileFactoryAndTracker fft = new FileFactoryAndTracker(wd.WorkingDirectory, "name", wd.InputDataLogger)) { fft.RegisterGeneralHouse(); var odap = new OnlineDeviceActivationProcessor(old, calcParameters, fft); var clt = new CalcLoadType("clt1", "W", "kWh", 1, true, Guid.NewGuid().ToStrGuid()); var deviceGuid = Guid.NewGuid().ToStrGuid(); HouseholdKey hhkey = new HouseholdKey("HH1"); var locationGuid = Guid.NewGuid().ToStrGuid(); CalcDeviceDto cdd = new CalcDeviceDto("dev1", "devcatguid".ToStrGuid(), hhkey, OefcDeviceType.Device, "devcatname", "", deviceGuid, locationGuid, "loc"); var key = new OefcKey(cdd, clt.Guid); odap.RegisterDevice(clt.ConvertToDto(), cdd); double[] timestepValue = { 1.0, 0 }; var timestepValues = new List <double>(timestepValue); var cp = new CalcProfile("myCalcProfile", Guid.NewGuid().ToStrGuid(), timestepValues, ProfileType.Absolute, "synthetic"); CalcDeviceLoad cdl1 = new CalcDeviceLoad("", -10, clt, 0, 0); var rvp = RandomValueProfile.MakeStepValues(cp.StepValues.Count, NormalRandom, 0); StepValues sv1 = StepValues.MakeStepValues(cp, 1, rvp, cdl1); odap.AddNewStateMachine(new TimeStep(1, 0, true), clt.ConvertToDto(), "name1", "p1", key, cdd, sv1); CalcDeviceLoad cdl2 = new CalcDeviceLoad("", -100, clt, 0, 0); StepValues sv2 = StepValues.MakeStepValues(cp, 1, rvp, cdl2); odap.AddNewStateMachine(new TimeStep(3, 0, true), clt.ConvertToDto(), "name2", "syn", key, cdd, sv2); CalcDeviceLoad cdl3 = new CalcDeviceLoad("", -10, clt, 0, 0); StepValues sv3 = StepValues.MakeStepValues(cp, 1, rvp, cdl3); odap.AddNewStateMachine(new TimeStep(5, 0, true), clt.ConvertToDto(), "name3", "syn", key, cdd, sv3); CalcDeviceLoad cdl4 = new CalcDeviceLoad("", 100, clt, 0, 0); StepValues sv4 = StepValues.MakeStepValues(cp, 1, rvp, cdl4); odap.AddNewStateMachine(new TimeStep(7, 0, true), clt.ConvertToDto(), "name4", "syn", key, cdd, sv4); double[] resultValues = { 0, -10.0, 0, -100, 0, 10, 0, 100, 0, 0 }; var ces = new CalcEnergyStorage(odap, clt.ConvertToDto(), 100, 7, 0, 0, 5, 20, null, cdd); List <OnlineEnergyFileRow> rawRows = new List <OnlineEnergyFileRow>(); int keyidx = 0; foreach (var keys in odap.Oefc.ColumnEntriesByLoadTypeByDeviceKey.Values) { foreach (KeyValuePair <OefcKey, ColumnEntry> pair in keys) { Logger.Info("Key " + keyidx + " " + pair.Key.ToString() + " - " + pair.Value); keyidx++; } } for (var i = 0; i < 10; i++) { TimeStep ts = new TimeStep(i, 0, true); var filerows = odap.ProcessOneTimestep(ts); rawRows.Add(filerows[0]); filerows.Count.Should().Be(1); filerows[0].EnergyEntries.Count.Should().Be(1); var sb = new StringBuilder("row0 before:"); sb.Append(filerows[0].EnergyEntries[0]); sb.Append(" : "); //sb.Append(filerows[0].EnergyEntries[1]); //filerows[0].EnergyEntries[0].Should().Be(resultValues[i]); for (var j = 0; j < 5; j++) { ces.ProcessOneTimestep(filerows, ts, null); } sb.Append(" row0 after:"); sb.Append(filerows[0].EnergyEntries[0]); sb.Append(" : "); //sb.Append(filerows[0].EnergyEntries[1]); sb.Append(" :StorageLevel "); sb.Append(ces.PreviousFillLevel); sb.Append(" :Expected "); sb.Append(resultValues[i]); Logger.Info(sb.ToString()); } rawRows.Count.Should().Be(10); } } wd.CleanUp(); } }
public RandomValueProfileEntry(TimeStep timeStep, double powerStandardDeviation, RandomValueProfile randomValueProfile) { TimeStep = timeStep; PowerStandardDeviation = powerStandardDeviation; RandomValueProfile = randomValueProfile; }