public override void Run(HouseholdKey key, object o) { CalcStartParameterSet csps = (CalcStartParameterSet)o; SaveableEntry se = new SaveableEntry(key, ResultTableDefinition); se.AddField("Name", SqliteDataType.Text); se.AddField("Value", SqliteDataType.Text); se.AddRow(RowBuilder.Start("Name", "CsvCharacter").Add("Value", csps.CsvCharacter).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "Temperature Profile").Add("Value", csps.TemperatureProfile.Name).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "AffordanceRepetitionCount").Add("Value", csps.AffordanceRepetitionCount.ToString(CultureInfo.InvariantCulture)).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "CalcOptions").Add("Value", JsonConvert.SerializeObject(csps.CalcOptions, Formatting.Indented)).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "CalcTarget").Add("Value", csps.CalcTarget.Name).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "DeleteDatFiles").Add("Value", csps.DeleteDatFiles.ToString()).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "DeviceSelection").Add("Value", csps.DeviceSelection?.Name ?? "None").ToDictionary()); se.AddRow(RowBuilder.Start("Name", "EnergyIntensity").Add("Value", csps.EnergyIntensity.ToString()).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "ExternalTimeResolution").Add("Value", csps.ExternalTimeResolution.ToString()).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "GeographicLocation").Add("Value", csps.GeographicLocation.Name).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "InternalTimeResolution").Add("Value", csps.InternalTimeResolution.ToString()).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "LPGVersion").Add("Value", csps.LPGVersion).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "LoadTypePriority").Add("Value", csps.LoadTypePriority.ToString()).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "OfficialSimulationStartTime").Add("Value", csps.OfficialSimulationStartTime.ToString(CultureInfo.InvariantCulture)).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "OfficialSimulationEndTime").Add("Value", csps.OfficialSimulationEndTime.ToString(CultureInfo.InvariantCulture)).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "SelectedRandomSeed").Add("Value", csps.SelectedRandomSeed.ToString(CultureInfo.InvariantCulture)).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "SettlingDays").Add("Value", csps.SettlingDays.ToString(CultureInfo.InvariantCulture)).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "ShowSettlingPeriod").Add("Value", csps.ShowSettlingPeriod.ToString()).ToDictionary()); se.AddRow(RowBuilder.Start("Name", "TransportationDeviceSet").Add("Value", csps.TransportationDeviceSet?.Name ?? "None").ToDictionary()); se.AddRow(RowBuilder.Start("Name", "TravelRouteSet").Add("Value", csps.TravelRouteSet?.Name ?? "None").ToDictionary()); if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { var objects = (List <IHouseholdKey>)o; var transportationDeviceStateEntries = objects.ConvertAll(x => (ChargingStationState)x).ToList(); SaveableEntry se = new SaveableEntry(key, ResultTableDefinition); se.AddField("Time", SqliteDataType.Integer); se.AddField("ChargingStationName", SqliteDataType.Text); se.AddField("IsAvailable", SqliteDataType.Bit); se.AddField("CarName", SqliteDataType.Text); se.AddField("ChargingPower", SqliteDataType.Double); se.AddField("Json", SqliteDataType.JsonField); foreach (var ae in transportationDeviceStateEntries) { se.AddRow(RowBuilder.Start("Time", ae.TimeStep) .Add("ChargingStationName", ae.ChargingStationName) .Add("IsAvailable", ae.IsAvailable?1:0) .Add("CarName", ae.ConnectedCarName) .Add("ChargingPower", ae.ChargingPower) .Add("Json", JsonConvert.SerializeObject(ae, Formatting.Indented)).ToDictionary()); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { var hh = (ResultFileEntry)o; if (!_isTableCreated) { SaveableEntry se = GetStandardSaveableEntry(key); se.AddRow(RowBuilder.Start("Name", Constants.GeneralHouseholdKey) .Add("Json", JsonConvert.SerializeObject(hh, Formatting.Indented)).ToDictionary()); if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); _isTableCreated = true; } else { var row = RowBuilder.Start("Name", Constants.GeneralHouseholdKey) .Add("Json", JsonConvert.SerializeObject(hh, Formatting.Indented)).ToDictionary(); if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveDictionaryToDatabaseNewConnection(row, TableName, Constants.GeneralHouseholdKey); } }
public override void Run(HouseholdKey key, object o) { var objects = (List <IHouseholdKey>)o; var actionEntries = objects.ConvertAll(x => (PersonStatus)x).ToList(); SaveableEntry se = new SaveableEntry(key, ResultTableDefinition); se.AddField("TimeStep", SqliteDataType.Text); se.AddField("PersonName", SqliteDataType.Text); se.AddField("AffordanceName", SqliteDataType.Text); se.AddField("LocationName", SqliteDataType.Text); se.AddField("SiteName", SqliteDataType.Text); se.AddField("Json", SqliteDataType.Text); foreach (var actionEntry in actionEntries) { se.AddRow(RowBuilder.Start("PersonName", actionEntry.PersonName).Add("AffordanceName", actionEntry.ActiveAffordance) .Add("TimeStep", actionEntry.TimeStep).Add("LocationName", actionEntry.LocationName).Add("SiteName", actionEntry.SiteName) .Add("Json", JsonConvert.SerializeObject(actionEntry, Formatting.Indented)).ToDictionary()); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { var sets = (BridgeDayEntries)o; if (sets.Entries.Count == 0) { Logger.Info("No bridge days were found."); return; } SaveableEntry se = new SaveableEntry(key, ResultTableDefinition); se.AddField("BridgeDay", SqliteDataType.DateTime); se.AddField("BridgeDayJson", SqliteDataType.Text); foreach (var afftagset in sets.Entries) { se.AddRow(RowBuilder.Start("BridgeDay", afftagset) .Add("BridgeDayJson", JsonConvert.SerializeObject(afftagset, Formatting.Indented)).ToDictionary()); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { var objects = (List <IHouseholdKey>)o; var transportationDeviceStateEntries = objects.ConvertAll(x => (TransportationDeviceStateEntry)x).ToList(); SaveableEntry se = new SaveableEntry(key, ResultTableDefinition); se.AddField("Time", SqliteDataType.Integer); se.AddField("DateTime", SqliteDataType.Integer); se.AddField("DeviceName", SqliteDataType.Text); se.AddField("User", SqliteDataType.Text); se.AddField("DeviceState", SqliteDataType.Text); se.AddField("NumericDeviceState", SqliteDataType.Integer); se.AddField("CurrentRange", SqliteDataType.Double); se.AddField("CurrentSite", SqliteDataType.Text); se.AddField("Json", SqliteDataType.JsonField); foreach (var ae in transportationDeviceStateEntries) { se.AddRow(RowBuilder.Start("Time", ae.TimeStep) .Add("DateTime", ae.DateTime) .Add("DeviceName", ae.TransportationDeviceName) .Add("User", ae.CurrentUser) .Add("DeviceState", ae.TransportationDeviceState) .Add("NumericDeviceState", (int)ae.TransportationDeviceStateEnum) .Add("CurrentRange", ae.CurrentRange) .Add("CurrentSite", ae.CurrentSite) .Add("Json", JsonConvert.SerializeObject(ae, Formatting.Indented)).ToDictionary()); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { var objects = (List <LogMessageEntry>)o; SaveableEntry se = new SaveableEntry(key, ResultTableDefinition); se.AddField("Time", SqliteDataType.DateTime); se.AddField("RelativeTime", SqliteDataType.DateTime); se.AddField("Message", SqliteDataType.Text); se.AddField("Severity", SqliteDataType.Text); se.AddField("MyStackTrace", SqliteDataType.Text); foreach (var lme in objects) { se.AddRow(RowBuilder.Start("Time", lme.Time) .Add("Message", lme.Message) .Add("RelativeTime", lme.RelativeTime) .Add("Severity", lme.Severity.ToString()) .Add("MyStackTrace", lme.MyStackTrace) .ToDictionary()); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { var objects = (List <IHouseholdKey>)o; var actionEntries = objects.ConvertAll(x => (SingleTimestepActionEntry)x).ToList(); var rowEntries = new List <Dictionary <string, object> >(); foreach (var affordanceEnergyUseEntry in actionEntries) { rowEntries.Add(RowBuilder.Start("Timestep", affordanceEnergyUseEntry.TimeStep) .Add("Json", JsonConvert.SerializeObject(affordanceEnergyUseEntry, Formatting.Indented)).ToDictionary()); } SaveableEntry se = new SaveableEntry(key, ResultTableDefinition); se.AddField("Timestep", SqliteDataType.Text); se.AddField("Json", SqliteDataType.Text); foreach (Dictionary <string, object> entry in rowEntries) { se.AddRow(entry); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { var hh = (HouseholdKeyEntry)o; //check for duplicates if (!_savedKeys.Add(hh.HHKey)) { return; //throw new LPGException("Householdkey already existed"); } if (!_isTableCreated) { SaveableEntry se = GetStandardSaveableEntry(key); se.AddRow(RowBuilder.Start("Name", hh.HHKey) .Add("Json", JsonConvert.SerializeObject(hh, Formatting.Indented)).ToDictionary()); if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); _isTableCreated = true; return; } var dict = RowBuilder.Start("Name", hh.HHKey) .Add("Json", JsonConvert.SerializeObject(hh, Formatting.Indented)).ToDictionary(); if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveDictionaryToDatabaseNewConnection(dict, TableName, Constants.GeneralHouseholdKey); }
public override void Run(HouseholdKey key, object o) { CalcParameters calcParameters = (CalcParameters)o; SaveableEntry se = GetStandardSaveableEntry(key); se.AddRow(RowBuilder.Start("Name", "CalcParameters").Add("Json", JsonConvert.SerializeObject(calcParameters, Formatting.Indented)).ToDictionary()); if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { SaveableEntry se = GetStandardSaveableEntry(key); var sets = (List <CalcAffordanceTaggingSetDto>)o; foreach (var afftagset in sets) { se.AddRow(RowBuilder.Start("Name", afftagset.Name) .Add("Json", JsonConvert.SerializeObject(afftagset, Formatting.Indented)).ToDictionary()); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { var actionEntries = (List <TransportationDeviceEventStatistics>)o; //var actionEntries = objects.ConvertAll(x => (TransportationDeviceStatisticsEntry)x).ToList(); SaveableEntry se = GetStandardSaveableEntry(key); foreach (var actionEntry in actionEntries) { se.AddRow(RowBuilder.Start("Name", actionEntry.TransportationDevice) .Add("Json", JsonConvert.SerializeObject(actionEntry, Formatting.Indented)).ToDictionary()); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { SaveableEntry se = GetStandardSaveableEntry(key); var objects = (List <AffordanceEnergyUseEntry>)o; //var affordanceEnergyUseEntries = objects.ConvertAll(x => (AffordanceEnergyUseEntry) x).ToList(); foreach (var ae in objects) { se.AddRow(RowBuilder.Start("Name", ae.AffordanceName) .Add("Json", JsonConvert.SerializeObject(ae, Formatting.Indented)).ToDictionary()); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { SaveableEntry se = GetStandardSaveableEntry(key); var objects = (List <IHouseholdKey>)o; var transportationDeviceDtos = objects.ConvertAll(x => (CalcTravelRouteDto)x).ToList(); foreach (var device in transportationDeviceDtos) { se.AddRow(RowBuilder.Start("Name", device.Name) .Add("Json", JsonConvert.SerializeObject(device, Formatting.Indented)).ToDictionary()); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { SaveableEntry se = GetStandardSaveableEntry(key); var objects = (List <IHouseholdKey>)o; var variableDefinitions = objects.ConvertAll(x => (CalcVariableDto)x).ToList(); foreach (var calcPersonDto in variableDefinitions) { se.AddRow(RowBuilder.Start("Name", calcPersonDto.Name) .Add("Json", JsonConvert.SerializeObject(calcPersonDto, Formatting.Indented)).ToDictionary()); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { var objects = (List <IHouseholdKey>)o; var calcVarEntries = objects.ConvertAll(x => (CalcVariableEntry)x).ToList(); SaveableEntry se = GetStandardSaveableEntry(key); se.AddField("TimeStep", SqliteDataType.Integer); foreach (var actionEntry in calcVarEntries) { se.AddRow(RowBuilder.Start("Name", actionEntry.Name).Add("Timestep", actionEntry.TimeStep) .Add("Json", JsonConvert.SerializeObject(actionEntry, Formatting.Indented)).ToDictionary()); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { if (key != Constants.GeneralHouseholdKey) { throw new LPGException("Trying to save load types not in the general file"); } List <CalcLoadTypeDto> calcLoadTypeDtoDictionary = (List <CalcLoadTypeDto>)o; SaveableEntry se = GetStandardSaveableEntry(key); foreach (CalcLoadTypeDto dto in calcLoadTypeDtoDictionary) { se.AddRow(RowBuilder.Start("Name", dto.Name).Add("Json", JsonConvert.SerializeObject(dto, Formatting.Indented)).ToDictionary()); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { var objects = (List <IHouseholdKey>)o; var actionEntries = objects.ConvertAll(x => (TransportationStatus)x).ToList(); SaveableEntry se = new SaveableEntry(key, ResultTableDefinition); se.AddField("TimeStep", SqliteDataType.Integer); se.AddField("Message", SqliteDataType.Text); foreach (var actionEntry in actionEntries) { se.AddRow(RowBuilder.Start("Message", actionEntry.StatusMessage).Add("TimeStep", actionEntry.Timestep).ToDictionary()); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }
public override void Run(HouseholdKey key, object o) { var objects = (List <IHouseholdKey>)o; var actionEntries = objects.ConvertAll(x => (TotalsPerLoadtypeEntry)x).ToList(); var rowEntries = new List <Dictionary <string, object> >(); foreach (var actionEntry in actionEntries) { rowEntries.Add(RowBuilder.Start("Name", actionEntry.Loadtype.Name) .Add("Json", JsonConvert.SerializeObject(actionEntry, Formatting.Indented)).ToDictionary()); } SaveableEntry se = GetStandardSaveableEntry(key); foreach (Dictionary <string, object> entry in rowEntries) { se.AddRow(entry); } if (Srls == null) { throw new LPGException("Data Logger was null."); } Srls.SaveResultEntry(se); }