private void CreateCalcConditions([NotNull] TransformationDevice trafo,
                                          [NotNull][ItemNotNull] List <CalcTransformationConditionDto> calcconditions)
        {
            foreach (var condition in trafo.Conditions)
            {
                CalcVariableDto variableDto = _calcVariableDtoFactory.RegisterVariableIfNotRegistered(
                    condition.Variable,
                    "House", Constants.HouseLocationGuid, Constants.HouseKey);

                CalcTransformationConditionDto trafocondition = new CalcTransformationConditionDto(condition.Name,
                                                                                                   condition.IntID,
                                                                                                   variableDto,
                                                                                                   condition.MinValue,
                                                                                                   condition.MaxValue,
                                                                                                   Guid.NewGuid().ToStrGuid());
                calcconditions.Add(trafocondition);
            }
        }
        private static List <CalcEnergyStorageDto> CreateEnergyStorageDtos([NotNull][ItemNotNull] List <EnergyStorage> energyStorages,
                                                                           [NotNull] CalcLoadTypeDtoDictionary ltdict,
                                                                           [NotNull] HouseholdKey householdKey, CalcVariableDtoFactory calcVariableDtoFactory)
        {
            var calcEnergyStorages = new List <CalcEnergyStorageDto>();

            foreach (var es in energyStorages)
            {
                if (es.LoadType == null)
                {
                    throw new LPGException("Energy storage load type was null");
                }

                if (ltdict.SimulateLoadtype(es.LoadType))
                {
                    List <CalcEnergyStorageSignalDto> signals = new List <CalcEnergyStorageSignalDto>();
                    foreach (var signal in es.Signals)
                    {
                        if (signal.Variable == null)
                        {
                            throw new DataIntegrityException("Signal variable was null");
                        }

                        var cvdto = calcVariableDtoFactory.RegisterVariableIfNotRegistered(signal.Variable, "House",
                                                                                           Constants.HouseLocationGuid, Constants.HouseKey);
                        var cessig = new CalcEnergyStorageSignalDto(signal.Name,
                                                                    signal.IntID,
                                                                    signal.TriggerLevelOff,
                                                                    signal.TriggerLevelOn,
                                                                    signal.Value,
                                                                    cvdto,
                                                                    Guid.NewGuid().ToStrGuid());
                        signals.Add(cessig);
                    }

                    //foreach (DeviceTaggingSet set in deviceTaggingSets) {
                    //set.AddTag(es.Name,"House Device");
                    //}
                    var lt  = ltdict.GetLoadtypeDtoByLoadType(es.LoadType);
                    var ces = new CalcEnergyStorageDto(es.Name,
                                                       es.IntID,
                                                       lt,
                                                       es.MaximumStorageRate,
                                                       es.MaximumWithdrawRate,
                                                       es.MinimumStorageRate,
                                                       es.MinimumWithdrawRate,
                                                       es.InitialFill,
                                                       es.StorageCapacity,
                                                       householdKey,
                                                       Guid.NewGuid().ToStrGuid(),
                                                       signals);
                    calcEnergyStorages.Add(ces);
                    if (es.Signals.Count != ces.Signals.Count)
                    {
                        throw new LPGException("Signals for energy storage were not correctly initialized");
                    }
                }
                else
                {
                    throw new DataIntegrityException("You are trying to run a calculation with a house type that uses an energy storage, " +
                                                     " that references an load type you excluded. This will not work. Please enable the load type " +
                                                     es.LoadType + " by for example chosing All Loadtypes");
                }
            }

            return(calcEnergyStorages);
        }