コード例 #1
0
 public void DeviceActionTest()
 {
     using (DatabaseSetup db = new DatabaseSetup(Utili.GetCurrentMethodAndClass()))
     {
         ObservableCollection <TimeBasedProfile> profiles = db.LoadTimeBasedProfiles();
         ObservableCollection <RealDevice>       devices  = db.LoadRealDevices(out _, out var loadTypes, profiles);
         ObservableCollection <DeviceAction>     das      = new ObservableCollection <DeviceAction>();
         DeviceActionGroup dag = new DeviceActionGroup("blub", db.ConnectionString, "desc", Guid.NewGuid().ToStrGuid());
         dag.SaveToDB();
         ObservableCollection <DeviceActionGroup> dags = db.LoadDeviceActionGroups();
         // try loading
         DeviceAction.LoadFromDatabase(das, db.ConnectionString, profiles, devices, loadTypes, dags, false);
         // clear db
         db.ClearTable(DeviceActionGroup.TableName);
         db.ClearTable(DeviceAction.TableName);
         db.ClearTable(DeviceActionProfile.TableName);
         // create new one, save, load
         DeviceAction da = new DeviceAction("bla", null, "desc", db.ConnectionString, dag, devices[0], Guid.NewGuid().ToStrGuid());
         da.SaveToDB();
         da.AddDeviceProfile(profiles[0], 1, loadTypes[0], 1);
         das.Clear();
         DeviceAction.LoadFromDatabase(das, db.ConnectionString, profiles, devices, loadTypes, dags, false);
         (das.Count).Should().Be(1);
         (das[0].Profiles.Count).Should().Be(1);
         das[0].DeleteProfileFromDB(das[0].Profiles[0]);
         (das[0].Profiles.Count).Should().Be(0);
         das[0].DeleteFromDB();
         das.Clear();
         DeviceAction.LoadFromDatabase(das, db.ConnectionString, profiles, devices, loadTypes, dags, false);
         (das.Count).Should().Be(0);
         db.Cleanup();
     }
 }
 public DeviceActionGroupPresenter([NotNull] ApplicationPresenter applicationPresenter, [NotNull] DeviceActionGroupView view,
                                   [NotNull] DeviceActionGroup deviceActionGroup)
     : base(view, "ThisDeviceActionGroup.Name", deviceActionGroup, applicationPresenter)
 {
     _deviceActionGroup = deviceActionGroup;
     _usedIns           = new ObservableCollection <UsedIn>();
     RefreshUsedIn();
 }
 public DeviceSelectionDeviceAction([CanBeNull] int?pID, [CanBeNull] int?deviceSelectionID, [CanBeNull] DeviceActionGroup group,
                                    [CanBeNull] DeviceAction action, [NotNull] string connectionString, [NotNull] string name,
                                    StrGuid guid) : base(name, TableName,
                                                         connectionString, guid)
 {
     ID = pID;
     _deviceActionGroup = group;
     _deviceAction      = action;
     _deviceSelectionID = deviceSelectionID;
     TypeDescription    = "Device Selection Action Item";
 }
コード例 #4
0
        public void CalculateAverageEnergyUseTestDeviceAction()
        {
            using (var db = new DatabaseSetup(Utili.GetCurrentMethodAndClass()))
            {
                Config.IsInUnitTesting = true;
                var col     = new ColorRGB(255, 0, 0);
                var devices = new ObservableCollection <RealDevice>();
                var rd2     = new RealDevice("rd2", 1, string.Empty, null, string.Empty, false, false, db.ConnectionString, Guid.NewGuid().ToStrGuid());
                var lt      = new VLoadType("lt", string.Empty, "bla", "blub", 1, 1, new TimeSpan(0, 1, 0), 1,
                                            db.ConnectionString,
                                            LoadTypePriority.Mandatory, true, Guid.NewGuid().ToStrGuid());
                lt.SaveToDB();
                rd2.SaveToDB();
                rd2.AddLoad(lt, 666, 0, 0);

                devices.Add(rd2);

                var deviceCategories = new ObservableCollection <DeviceCategory>();
                var deviceActions    = new ObservableCollection <DeviceAction>();
                var aff = new Affordance("bla", null, null, false, PermittedGender.All, 1, col, string.Empty, null,
                                         string.Empty,
                                         db.ConnectionString, true, true, 0,
                                         100, false, ActionAfterInterruption.GoBackToOld, false, Guid.NewGuid().ToStrGuid(),
                                         BodilyActivityLevel.Low);
                aff.SaveToDB();

                var tp = new TimeBasedProfile("tp", null, db.ConnectionString, TimeProfileType.Relative, "fake", Guid.NewGuid().ToStrGuid());
                tp.SaveToDB();
                tp.AddNewTimepoint(new TimeSpan(0, 0, 0), 100, false);
                tp.AddNewTimepoint(new TimeSpan(0, 2, 0), 0, false);
                var dag = new DeviceActionGroup("dag", db.ConnectionString, string.Empty, Guid.NewGuid().ToStrGuid());
                dag.SaveToDB();
                var da = new DeviceAction("da", null, string.Empty, db.ConnectionString, dag, rd2, Guid.NewGuid().ToStrGuid());
                da.SaveToDB();
                da.AddDeviceProfile(tp, 0, lt, 1);
                deviceActions.Add(da);
                var tbp = new TimeBasedProfile("name", 1, db.ConnectionString, TimeProfileType.Absolute, "data source", Guid.NewGuid().ToStrGuid());
                aff.AddDeviceProfile(dag, tbp, 0, devices, deviceCategories, lt, 1);
                var res = aff.CalculateAverageEnergyUse(deviceActions);
                foreach (var keyValuePair in res)
                {
                    Logger.Info(keyValuePair.Key + ": " + keyValuePair.Value);
                }
                res.Count.Should().Be(1);
                var first = res.First();
                first.Value.Should().Be(666 * 2);
                db.Cleanup();
            }
        }
        private void CheckGroupUsage([NotNull] Simulator sim, [NotNull] DeviceActionGroup actionGroup)
        {
            if (!PerformCleanupChecks)
            {
                return;
            }

            var result = actionGroup.CalculateUsedIns(sim);

            if (result.Count == 0)
            {
                throw new DataIntegrityException(
                          "The device action group " + actionGroup + " is not used. Please fix or delete!", actionGroup);
            }
        }
コード例 #6
0
        public void IsAffordanceAvailableTestCheckDeviceActionGroupInDeviceActionGroup()
        {
            // Location: device action group
            // affordance: device Action Group
            Config.IsInUnitTesting = true;
            var col           = new ColorRGB(255, 0, 0);
            var deviceActions = new ObservableCollection <DeviceAction>();
            var aff           = new Affordance("bla", null, null, false, PermittedGender.All, 1, col, string.Empty, null,
                                               string.Empty, string.Empty,
                                               true, true, 0, 100, false, ActionAfterInterruption.GoBackToOld, false, Guid.NewGuid().ToStrGuid(), BodilyActivityLevel.Low);
            var rd1 = new RealDevice("rd1", 1, string.Empty, null, string.Empty, false, false, string.Empty, Guid.NewGuid().ToStrGuid());

            var dg = new DeviceActionGroup("group", string.Empty, string.Empty, Guid.NewGuid().ToStrGuid());
            var da = new DeviceAction("device action 1", null, "blub", string.Empty, dg, rd1, Guid.NewGuid().ToStrGuid());

            deviceActions.Add(da);
            var devices = new ObservableCollection <RealDevice>
            {
                rd1
            };
            // check if it works with a device category that has the device
            var dc1 = new DeviceCategory("dc1", 0, string.Empty, false, devices, Guid.NewGuid().ToStrGuid(), null, true);

            rd1.DeviceCategory = dc1;
            dc1.RefreshSubDevices();
            (dc1.SubDevices.Count).Should().Be(1);
            var connectionString = string.Empty;
            var lt = new VLoadType("lt", string.Empty, "bla", "blub", 1, 1, new TimeSpan(0, 1, 0), 1, connectionString,
                                   LoadTypePriority.Mandatory, true, Guid.NewGuid().ToStrGuid());
            var tbp = new TimeBasedProfile("name", 1, connectionString, TimeProfileType.Absolute, "data source", Guid.NewGuid().ToStrGuid());

            aff.AffordanceDevices.Add(new AffordanceDevice(dg, tbp, null, 0, null,
                                                           new ObservableCollection <RealDevice>(),
                                                           new ObservableCollection <DeviceCategory>(), "name", lt, string.Empty, 1, Guid.NewGuid().ToStrGuid()));
            var allDevices3 = new List <IAssignableDevice>
            {
                dg
            };

            if (da.DeviceActionGroup == null)
            {
                throw new LPGException("device action group was null");
            }
            var relevantDeviceActionGroup = da.DeviceActionGroup.GetDeviceActions(deviceActions);

            (relevantDeviceActionGroup.Count).Should().Be(1);
            (aff.IsAffordanceAvailable(allDevices3, deviceActions)).Should().BeTrue();
        }
        private void FindMissingDevice([NotNull] DeviceCategory category, [NotNull][ItemNotNull] List <DeviceAction> actionsInGroup,
                                       [NotNull] DeviceActionGroup deviceActionGroup, [NotNull] Simulator sim)
        {
            if (!PerformCleanupChecks)
            {
                return;
            }
            foreach (var device in category.SubDevicesWithoutRefresh)
            {
                var action = actionsInGroup.FirstOrDefault(a => a.Device == device);

                if (action == null)
                {
                    DeviceAction a;
                    Logger.Get().SafeExecuteWithWait(() => {
                        a = device.MakeDeviceAction(sim);
                        a.DeviceActionGroup = deviceActionGroup;
                        var other           = actionsInGroup.FirstOrDefault();
                        if (other != null)
                        {
                            foreach (var profile in other.Profiles)
                            {
                                if (profile.Timeprofile == null)
                                {
                                    throw  new LPGException("Time Profile was null");
                                }
                                if (profile.VLoadType == null)
                                {
                                    throw new LPGException("LoadType was null");
                                }
                                a.AddDeviceProfile(profile.Timeprofile, profile.TimeOffset, profile.VLoadType,
                                                   profile.Multiplier);
                            }
                        }
                        a.SaveToDB();
                    });
                    throw new DataIntegrityException(
                              "A device action group always needs to have all the devices in a device category." +
                              "The device action group " + Environment.NewLine + deviceActionGroup +
                              Environment.NewLine + " is missing at least one device. This device is " + Environment.NewLine + device.Name +
                              Environment.NewLine + " from the device category " + Environment.NewLine + device.DeviceCategory?.Name + Environment.NewLine + Environment.NewLine +
                              "A new device action was created for it. Please check if everything is correct and adjust as needed.",
                              deviceActionGroup);
                }
            }
        }
コード例 #8
0
        public void CalculateMaximumInternalTimeResolutionTestForDeviceAction()
        {
            using (var db = new DatabaseSetup(Utili.GetCurrentMethodAndClass()))
            {
                Config.IsInUnitTesting = true;
                var col     = new ColorRGB(255, 0, 0);
                var devices = new ObservableCollection <RealDevice>();
                var rd2     = new RealDevice("rd2", 1, string.Empty, null, string.Empty, false, false, db.ConnectionString, Guid.NewGuid().ToStrGuid());
                rd2.SaveToDB();
                devices.Add(rd2);

                var deviceCategories = new ObservableCollection <DeviceCategory>();
                var aff = new Affordance("bla", null, null, false, PermittedGender.All, 1, col, string.Empty, null,
                                         string.Empty,
                                         db.ConnectionString, true, true, 0, 100,
                                         false, ActionAfterInterruption.GoBackToOld, false, Guid.NewGuid().ToStrGuid(), BodilyActivityLevel.Low);
                aff.SaveToDB();

                var tp = new TimeBasedProfile("tp", null, db.ConnectionString, TimeProfileType.Relative, "fake", Guid.NewGuid().ToStrGuid());
                tp.SaveToDB();
                tp.AddNewTimepoint(new TimeSpan(0, 0, 0), 1, false);
                tp.AddNewTimepoint(new TimeSpan(0, 1, 0), 1, false);
                tp.AddNewTimepoint(new TimeSpan(0, 10, 0), 1, false);
                var lt = new VLoadType("lt", string.Empty, "bla", "blub", 1, 1, new TimeSpan(0, 1, 0), 1,
                                       db.ConnectionString,
                                       LoadTypePriority.Mandatory, true, Guid.NewGuid().ToStrGuid());
                lt.SaveToDB();
                var dag = new DeviceActionGroup("dag", db.ConnectionString, string.Empty, Guid.NewGuid().ToStrGuid());
                dag.SaveToDB();
                var da = new DeviceAction("da", null, string.Empty, db.ConnectionString, dag, rd2, Guid.NewGuid().ToStrGuid());
                da.SaveToDB();
                da.AddDeviceProfile(tp, 0, lt, 1);
                new ObservableCollection <DeviceAction>().Add(da);
                var tbp = new TimeBasedProfile("name", 1, db.ConnectionString, TimeProfileType.Absolute, "data source", Guid.NewGuid().ToStrGuid());
                aff.AddDeviceProfile(da, tbp, 0, devices, deviceCategories, lt, 1);

                var ts = aff.CalculateMaximumInternalTimeResolution();
                (ts.TotalSeconds).Should().Be(60);
                Logger.Info(ts.ToString());
                db.Cleanup();
            }
        }
        public void DeviceActionGroupTestsAll()
        {
            using (DatabaseSetup db = new DatabaseSetup(Utili.GetCurrentMethodAndClass()))
            {
                ObservableCollection <DeviceActionGroup> dags = new ObservableCollection <DeviceActionGroup>();

                DeviceActionGroup.LoadFromDatabase(dags, db.ConnectionString, false);
                db.ClearTable(DeviceActionGroup.TableName);
                DeviceActionGroup dag = new DeviceActionGroup("bla", db.ConnectionString, "desc", Guid.NewGuid().ToStrGuid());
                dag.SaveToDB();
                dags.Clear();
                DeviceActionGroup.LoadFromDatabase(dags, db.ConnectionString, false);
                (dags.Count).Should().Be(1);
                dags[0].DeleteFromDB();
                dags.Clear();
                DeviceActionGroup.LoadFromDatabase(dags, db.ConnectionString, false);
                (dags.Count).Should().Be(0);
                db.Cleanup();
            }
        }
        private void CheckDeviceActionsAllInSameCategory([NotNull] DeviceActionGroup actionGroup,
                                                         [NotNull][ItemNotNull] ObservableCollection <DeviceAction> allActions, [NotNull] Simulator sim)
        {
            // collect all used groups

            var devicesInActions = actionGroup.GetRealDevices(allActions);

            if (devicesInActions.Count == 0)
            {
                throw new LPGException("Bug in device action check. Please report!");
            }
            var cat = devicesInActions[0].DeviceCategory;

            if (devicesInActions[0].DeviceCategory == null)
            {
                throw new LPGException("Device Category was null");
            }
            var devicesInCategory = devicesInActions[0].DeviceCategory.GetRealDevices(allActions);

            if (cat == null)
            {
                throw new LPGException("Category was null");
            }
            foreach (var realDevice in devicesInActions)
            {
                if (!devicesInCategory.Contains(realDevice))
                {
                    FindMissingDevice(cat, actionGroup.GetDeviceActions(allActions), actionGroup, sim);
                }
            }
            foreach (var realDevice in devicesInCategory)
            {
                if (!devicesInActions.Contains(realDevice))
                {
                    FindMissingDevice(cat, actionGroup.GetDeviceActions(allActions), actionGroup, sim);
                }
            }
        }
コード例 #11
0
        private DeviceAction PickDeviceActionFromGroupAtHHLocation([NotNull] DeviceActionGroup deviceActionGroup,
                                                                   [NotNull][ItemNotNull] List <IAssignableDevice> allDevLocations, EnergyIntensityType energyIntensity, [NotNull] Location targetLoc,
                                                                   [NotNull][ItemNotNull] ObservableCollection <DeviceAction> allDeviceActions)
        {
            // check if there is already such a device
            // first get all device actions in the group
            var deviceActions = deviceActionGroup.GetDeviceActions(allDeviceActions);
            //then get all devices in all device actions
            var devices = deviceActions.Select(da => da.Device).ToList();

            //then find if any of the locations already has a device for any of the device actions
            foreach (var device in allDevLocations)
            {
                if (devices.Contains(device))
                {
                    var devac = deviceActions.Single(x => x.Device == device);
                    Logger.Debug(
                        "Picked " + devac.Name + " from " + targetLoc.Name + " since the device for it was already there.");
                    return(devac);
                }
            }
            return(PickDeviceFromGroup(deviceActionGroup, energyIntensity, allDeviceActions, targetLoc.IntID));
        }
        public void DeviceCategoryPickerDeviceActionGroupAutoDev()
        {
            Random               r      = new Random(2);
            DeviceSelection      ds     = new DeviceSelection("ds", 1, string.Empty, string.Empty, Guid.NewGuid().ToStrGuid());
            DeviceCategoryPicker picker = new DeviceCategoryPicker(r, ds);
            // device stuff
            ObservableCollection <RealDevice> allDevices = new ObservableCollection <RealDevice>();
            DeviceCategory    dc  = new DeviceCategory("dc", -1, "bla", false, allDevices, Guid.NewGuid().ToStrGuid());
            RealDevice        rd1 = new RealDevice("device1", 0, string.Empty, dc, "desc", false, true, string.Empty, Guid.NewGuid().ToStrGuid(), -1);
            RealDevice        rd2 = new RealDevice("device2", 0, string.Empty, dc, "desc", false, true, string.Empty, Guid.NewGuid().ToStrGuid(), -1);
            DeviceActionGroup dag = new DeviceActionGroup("Dag1", string.Empty, "blub", Guid.NewGuid().ToStrGuid(), -1);
            DeviceAction      da1 = new DeviceAction("da1", -1, "blub", string.Empty, dag, rd1, Guid.NewGuid().ToStrGuid());
            DeviceAction      da2 = new DeviceAction("da2", -1, "blub", string.Empty, dag, rd2, Guid.NewGuid().ToStrGuid());
            ObservableCollection <DeviceAction> deviceActions = new ObservableCollection <DeviceAction>
            {
                da1,
                da2
            };

            allDevices.Add(rd1);
            List <IAssignableDevice> otherDevicesAtLocation = new List <IAssignableDevice>
            {
                dag
            };

            DeviceAction pickedDeviceAction = picker.GetAutoDeviceActionFromGroup(dag, otherDevicesAtLocation,
                                                                                  EnergyIntensityType.Random, deviceActions, 5);

            Logger.Info("Device Action 1 " + pickedDeviceAction);
            for (int i = 0; i < 50; i++)
            {
                DeviceAction deviceAction2 = picker.GetAutoDeviceActionFromGroup(dag, otherDevicesAtLocation,
                                                                                 EnergyIntensityType.Random, deviceActions, 5);
                Logger.Info("Device Action  " + i + " " + deviceAction2);
                pickedDeviceAction.Should().Be(deviceAction2);
            }
        }
コード例 #13
0
        private DeviceAction PickDeviceFromGroup([NotNull] DeviceActionGroup deviceGroup, EnergyIntensityType energyIntensity,
                                                 [NotNull][ItemNotNull] ObservableCollection <DeviceAction> allDeviceActions, int locationID)
        {
            var deviceActions = deviceGroup.GetDeviceActions(allDeviceActions);

            if (deviceActions.Count == 0)
            {
                throw new DataIntegrityException("The device action group " + deviceGroup.Name +
                                                 " has no devices but it is used. A device could not be picked from it.");
            }
            if (deviceActions[0].Device == null)
            {
                throw new LPGException("Device was null");
            }
            var usedDeviceCategory = deviceActions[0].Device.DeviceCategory;

            if (usedDeviceCategory == null)
            {
                throw new LPGException("usedDeviceCategory was null");
            }
            var ldt2 = new LocationDeviceTuple(usedDeviceCategory, locationID);

            if (_pickedDevices.ContainsKey(ldt2))
            {
                // find the device picked earlier
                var rd = _pickedDevices[ldt2];
                deviceActions = deviceActions.Where(x => x.Device == rd).ToList();
                if (deviceActions.Count == 0)
                {
                    throw new DataIntegrityException(
                              "The device action group " + deviceGroup.Name + " has no entry for the device " +
                              rd.PrettyName +
                              ". Please fix.", rd);
                }
            }
            DeviceAction pickedDevice = null;

            // look for this device group in the device selection
            if (_deviceSelection != null && _deviceSelection.Actions.Count > 0)
            {
                foreach (var item in _deviceSelection.Actions)
                {
                    if (item.DeviceActionGroup == deviceGroup)
                    {
                        pickedDevice = item.DeviceAction;
                    }
                }
            }
            if (pickedDevice == null)
            {
                switch (energyIntensity)
                {
                case EnergyIntensityType.Random:
                    var dstval = _random.Next(deviceActions.Count);
                    pickedDevice = deviceActions[dstval];
                    break;

                case EnergyIntensityType.EnergySaving: {
                    var pickeDeviceAction = deviceActions[0];
                    foreach (var deviceAction in deviceActions)
                    {
                        if (pickeDeviceAction.CalculateWeightedEnergyUse() >
                            deviceAction.CalculateWeightedEnergyUse())
                        {
                            pickeDeviceAction = deviceAction;
                        }
                    }
                    pickedDevice = pickeDeviceAction;
                }
                break;

                case EnergyIntensityType.EnergySavingPreferMeasured: {
                    var actions           = TryToGetMeasured(deviceActions);
                    var pickeDeviceAction = actions[0];
                    foreach (var deviceAction in actions)
                    {
                        if (pickeDeviceAction.CalculateWeightedEnergyUse() >
                            deviceAction.CalculateWeightedEnergyUse())
                        {
                            pickeDeviceAction = deviceAction;
                        }
                    }
                    pickedDevice = pickeDeviceAction;
                }
                break;

                case EnergyIntensityType.EnergyIntensive: {
                    var pickeDeviceAction = deviceActions[0];
                    foreach (var deviceAction in deviceActions)
                    {
                        if (pickeDeviceAction.CalculateWeightedEnergyUse() <
                            deviceAction.CalculateWeightedEnergyUse())
                        {
                            pickeDeviceAction = deviceAction;
                        }
                    }
                    pickedDevice = pickeDeviceAction;
                }
                break;

                case EnergyIntensityType.EnergyIntensivePreferMeasured: {
                    var actions           = TryToGetMeasured(deviceActions);
                    var pickeDeviceAction = actions[0];
                    foreach (var deviceAction in deviceActions)
                    {
                        if (pickeDeviceAction.CalculateWeightedEnergyUse() <
                            deviceAction.CalculateWeightedEnergyUse())
                        {
                            pickeDeviceAction = deviceAction;
                        }
                    }
                    pickedDevice = pickeDeviceAction;
                }
                break;

                default:
                    throw new LPGException("Unknown EnergyIntensityType");
                }
            }
            Logger.Debug(
                "Picked " + pickedDevice.Name + " from " + deviceActions.Count + " device actions in the group.");
            if (pickedDevice == null)
            {
                throw new LPGException("Picked device was null");
            }
            return(pickedDevice);
        }
コード例 #14
0
        private List <LoadingEntry> GetLoadingActions(bool ignoreMissingTables)
        {
            var actions = new List <LoadingEntry>
            {
                new LoadingEntry("Loadtypes",
                                 () => VLoadType.LoadFromDatabase(LoadTypes.MyItems, ConnectionString, ignoreMissingTables),
                                 LoadTypes),
                new LoadingEntry("Holidays",
                                 () => Holiday.LoadFromDatabase(Holidays.MyItems, ConnectionString, ignoreMissingTables), Holidays),
                new LoadingEntry("Variables",
                                 () => Variable.LoadFromDatabase(Variables.It, ConnectionString, ignoreMissingTables), Variables),

                new LoadingEntry("Date Based Profiles",
                                 () => DateBasedProfile.LoadFromDatabase(DateBasedProfiles.MyItems, ConnectionString,
                                                                         ignoreMissingTables), DateBasedProfiles),
                new LoadingEntry("Vacations",
                                 () => Vacation.LoadFromDatabase(Vacations.MyItems, ConnectionString, ignoreMissingTables),
                                 Vacations),
                new LoadingEntry("Desires",
                                 () => Desire.LoadFromDatabase(Desires.MyItems, ConnectionString, ignoreMissingTables), Desires),
                new LoadingEntry("Time Profiles",
                                 () => TimeBasedProfile.LoadFromDatabase(Timeprofiles.MyItems, ConnectionString, ignoreMissingTables),
                                 Timeprofiles),
                new LoadingEntry("Temperature Profiles",
                                 () => TemperatureProfile.LoadFromDatabase(TemperatureProfiles.MyItems, ConnectionString,
                                                                           ignoreMissingTables), TemperatureProfiles),
                new LoadingEntry("Generators",
                                 () => Generator.LoadFromDatabase(Generators.MyItems, ConnectionString, LoadTypes.MyItems,
                                                                  DateBasedProfiles.MyItems, ignoreMissingTables), Generators),
                new LoadingEntry("Energy Storages",
                                 () => EnergyStorage.LoadFromDatabase(EnergyStorages.MyItems, ConnectionString, LoadTypes.MyItems, Variables.MyItems,
                                                                      ignoreMissingTables), EnergyStorages),
                new LoadingEntry("Transformation Devices",
                                 () => TransformationDevice.LoadFromDatabase(TransformationDevices.MyItems, ConnectionString,
                                                                             LoadTypes.MyItems, Variables.MyItems, ignoreMissingTables), TransformationDevices),
                new LoadingEntry("Device Categories", () =>
                {
                    DeviceCategory.LoadFromDatabase(DeviceCategories.MyItems, out _dcnone, ConnectionString,
                                                    RealDevices.MyItems, ignoreMissingTables);
                    DeviceCategories.DeviceCategoryNone = _dcnone;
                }, DeviceCategories),

                new LoadingEntry("Real Devices",
                                 () => RealDevice.LoadFromDatabase(RealDevices.MyItems, DeviceCategories.MyItems,
                                                                   DeviceCategories.DeviceCategoryNone, ConnectionString, LoadTypes.MyItems, Timeprofiles.MyItems,
                                                                   ignoreMissingTables), RealDevices),
                new LoadingEntry("Device Action Groups",
                                 () => DeviceActionGroup.LoadFromDatabase(DeviceActionGroups.MyItems, ConnectionString,
                                                                          ignoreMissingTables), DeviceActionGroups),
                new LoadingEntry("Device Actions",
                                 () => DeviceAction.LoadFromDatabase(DeviceActions.MyItems, ConnectionString, Timeprofiles.MyItems,
                                                                     RealDevices.MyItems, LoadTypes.MyItems, DeviceActionGroups.MyItems, ignoreMissingTables),
                                 DeviceActions),
                new LoadingEntry("Device Tagging Sets",
                                 () => DeviceTaggingSet.LoadFromDatabase(DeviceTaggingSets.MyItems, ConnectionString,
                                                                         ignoreMissingTables, RealDevices.MyItems, LoadTypes.It), DeviceTaggingSets),
                new LoadingEntry("Persons",
                                 () => Person.LoadFromDatabase(Persons.MyItems, ConnectionString,
                                                               ignoreMissingTables), Persons),
                new LoadingEntry("Locations",
                                 () => Location.LoadFromDatabase(Locations.MyItems, ConnectionString, RealDevices.MyItems,
                                                                 DeviceCategories.MyItems, LoadTypes.MyItems, ignoreMissingTables), Locations),
                new LoadingEntry("Time Limits",
                                 () => TimeLimit.LoadFromDatabase(TimeLimits.MyItems, DateBasedProfiles.MyItems, ConnectionString,
                                                                  ignoreMissingTables), TimeLimits),
                new LoadingEntry("Geographic Locations",
                                 () => GeographicLocation.LoadFromDatabase(GeographicLocations.MyItems, ConnectionString,
                                                                           Holidays.MyItems, TimeLimits.MyItems, ignoreMissingTables), GeographicLocations),
                new LoadingEntry("Subaffordances",
                                 () => SubAffordance.LoadFromDatabase(SubAffordances.MyItems, ConnectionString, Desires.MyItems,
                                                                      ignoreMissingTables, Locations.It, Variables.It), SubAffordances),
                new LoadingEntry("Affordances",
                                 () => Affordance.LoadFromDatabase(Affordances.MyItems, ConnectionString, Timeprofiles.MyItems,
                                                                   DeviceCategories.MyItems, RealDevices.MyItems, Desires.MyItems, SubAffordances.MyItems,
                                                                   LoadTypes.MyItems, TimeLimits.MyItems, DeviceActions.MyItems, DeviceActionGroups.MyItems,
                                                                   Locations.It, ignoreMissingTables, Variables.It), Affordances),
                new LoadingEntry("Affordance Tagging Sets",
                                 () => AffordanceTaggingSet.LoadFromDatabase(AffordanceTaggingSets.MyItems, ConnectionString,
                                                                             ignoreMissingTables, Affordances.MyItems, LoadTypes.It), AffordanceTaggingSets),
                new LoadingEntry("Trait Tags",
                                 () => TraitTag.LoadFromDatabase(TraitTags.MyItems, ConnectionString, ignoreMissingTables),
                                 TraitTags),
                new LoadingEntry("Household Traits",
                                 () => HouseholdTrait.LoadFromDatabase(HouseholdTraits.MyItems, ConnectionString, Locations.MyItems,
                                                                       Affordances.MyItems, RealDevices.MyItems, DeviceCategories.MyItems, Timeprofiles.MyItems,
                                                                       LoadTypes.MyItems, TimeLimits.MyItems, Desires.MyItems, DeviceActions.It, DeviceActionGroups.It,
                                                                       TraitTags.It, ignoreMissingTables, Variables.It), HouseholdTraits),
                new LoadingEntry("Device Selections",
                                 () => DeviceSelection.LoadFromDatabase(DeviceSelections.MyItems, ConnectionString,
                                                                        DeviceCategories.MyItems, RealDevices.MyItems, DeviceActions.It, DeviceActionGroups.It,
                                                                        ignoreMissingTables), DeviceSelections),
                new LoadingEntry("Household Tags",
                                 () => HouseholdTag.LoadFromDatabase(HouseholdTags.It, ConnectionString, ignoreMissingTables),
                                 HouseholdTags),
                new LoadingEntry("Modular Households",
                                 () => ModularHousehold.LoadFromDatabase(ModularHouseholds.MyItems, ConnectionString,
                                                                         HouseholdTraits.MyItems, DeviceSelections.MyItems, ignoreMissingTables, Persons.MyItems,
                                                                         Vacations.It, HouseholdTags.It, TraitTags.It), ModularHouseholds),
                new LoadingEntry("Household Templates",
                                 () => HouseholdTemplate.LoadFromDatabase(HouseholdTemplates.MyItems, ConnectionString,
                                                                          HouseholdTraits.MyItems, ignoreMissingTables, Persons.MyItems, TraitTags.It, Vacations.It,
                                                                          HouseholdTags.It, DateBasedProfiles.It), HouseholdTemplates),
                new LoadingEntry("Template Persons",
                                 () => TemplatePerson.LoadFromDatabase(TemplatePersons.It, ConnectionString, HouseholdTraits.It,
                                                                       ignoreMissingTables, ModularHouseholds.It, Persons.It), TemplatePersons),
                new LoadingEntry("Household Plans",
                                 () => HouseholdPlan.LoadFromDatabase(HouseholdPlans.MyItems, ConnectionString, ignoreMissingTables,
                                                                      Persons.MyItems, AffordanceTaggingSets.MyItems, ModularHouseholds.MyItems),
                                 HouseholdPlans),
                new LoadingEntry("House Types",
                                 () => HouseType.LoadFromDatabase(HouseTypes.MyItems, ConnectionString, RealDevices.MyItems,
                                                                  DeviceCategories.MyItems, Timeprofiles.MyItems, TimeLimits.MyItems, LoadTypes.MyItems,
                                                                  TransformationDevices.MyItems, EnergyStorages.MyItems, Generators.MyItems, ignoreMissingTables,
                                                                  Locations.MyItems, DeviceActions.It, DeviceActionGroups.It, Variables.It), HouseTypes),
                new LoadingEntry("Transportation Device Categories",
                                 () => TransportationDeviceCategory.LoadFromDatabase(TransportationDeviceCategories.It, ConnectionString,
                                                                                     ignoreMissingTables), TransportationDeviceCategories),
                new LoadingEntry("Sites",
                                 () => Site.LoadFromDatabase(Sites.It,
                                                             ConnectionString, ignoreMissingTables,
                                                             Locations.It), Sites),
                new LoadingEntry("Transportation Devices",
                                 () => TransportationDevice.LoadFromDatabase(TransportationDevices.It, ConnectionString, ignoreMissingTables,
                                                                             TransportationDeviceCategories.It, LoadTypes.It), TransportationDevices),

                new LoadingEntry("Transportation Device Sets",
                                 () => TransportationDeviceSet.LoadFromDatabase(TransportationDeviceSets.It, ConnectionString,
                                                                                ignoreMissingTables, TransportationDevices.It), TransportationDeviceSets),

                new LoadingEntry("Travel Routes",
                                 () => TravelRoute.LoadFromDatabase(TravelRoutes.It, ConnectionString, ignoreMissingTables,
                                                                    TransportationDeviceCategories.It, Sites.It), TravelRoutes),

                new LoadingEntry("Travel Route Sets",
                                 () => TravelRouteSet.LoadFromDatabase(TravelRouteSets.It, ConnectionString, ignoreMissingTables,
                                                                       TravelRoutes.It), TravelRouteSets),
                new LoadingEntry("Charging Station Sets",
                                 () => ChargingStationSet.LoadFromDatabase(ChargingStationSets.It,
                                                                           ConnectionString, ignoreMissingTables,
                                                                           LoadTypes.It, TransportationDeviceCategories.It, Sites.It), ChargingStationSets),

                new LoadingEntry("Houses",
                                 () => House.LoadFromDatabase(Houses.MyItems, ConnectionString, TemperatureProfiles.MyItems,
                                                              GeographicLocations.MyItems, HouseTypes.MyItems,
                                                              ModularHouseholds.MyItems, ChargingStationSets.MyItems,
                                                              TransportationDeviceSets.MyItems, TravelRouteSets.MyItems,
                                                              ignoreMissingTables), Houses),
                new LoadingEntry("Settlements",
                                 () => Settlement.LoadFromDatabase(Settlements.MyItems, ConnectionString,
                                                                   TemperatureProfiles.MyItems, GeographicLocations.MyItems, ModularHouseholds.MyItems, Houses.MyItems,
                                                                   ignoreMissingTables), Settlements),
                new LoadingEntry("Settlement Templates",
                                 () => SettlementTemplate.LoadFromDatabase(SettlementTemplates.It, ConnectionString,
                                                                           HouseholdTemplates.It, HouseTypes.It, ignoreMissingTables, TemperatureProfiles.It,
                                                                           GeographicLocations.It, HouseholdTags.It, HouseholdTraits.It), SettlementTemplates),
                new LoadingEntry("Settings",
                                 () => MyGeneralConfig = GeneralConfig.LoadFromDatabase(ConnectionString, ignoreMissingTables), null),
                new LoadingEntry("Calculation Outcomes",
                                 () => CalculationOutcome.LoadFromDatabase(CalculationOutcomes.MyItems, ConnectionString,
                                                                           ignoreMissingTables), CalculationOutcomes)
            };

            return(actions);
        }