Calculating a large number of houses

Calculating large settlements

Starting with version 8.6 there are two new mechanisms that might be useful if you want load profiles for a large number of households.

  • JSON-based calculation specifications: This completely replaces the earlier command line interface

  • District definition files: This allows you to specify the houses you want directly in json and the LPG will generate households and houses and then calculate them.

JSON-based calculation

The settlements screen can now be used to directly generate such calculation specification files, which can then be used with the command line interface to calculate all the houses in the settlement.

The screen for this should be pretty self-explanatory:

  • Set all the options you want

  • Enter a target directory

  • Export everything with the button on the bottom.

  • Go to the directory and start the calculation with either “SimulateEverythingInParallel.cmd” or “SimulateEverythingSequentially.cmd”.

  • If you want to adjust the number of cores to use, you can open “SimulateEverythingInParallel.cmd” for example in notepad and change the number. Try to keep the number below the number of real cores your computer has though. Higher numbers than that lead to everything becoming pretty slow.

  • Also be aware of the memory demand of about 500MB to 1 GB per concurrent Household. So if you want to calculate 10 houses with 10 households each in parallel, you better have about 50-100GB of RAM, otherwise you will most likely run into issues. Of course you can just run things sequentially too or reduce the number of parallel executions to limit memory consumption.

New Section in the Settlement Definition

District definition files

You can get an example district definition file by calling:

Simulationengine.exe CreateDistrictDefinition

That will create all needed files in a subdirectory called “example”. The district definition looks like this:

{
  "Houses": [
    {
      "Name": "MyFirstHouse",
      "HouseGuid": "43953d12-2636-435a-a011-211b6380c3c5",
      "Households": [
        {
          "DailyCommutingDistance": 100.0,
          "HouseholdGuid": "b1f086b8-b0fa-4e51-8a5a-0b53600c2534",
          "Name": "My First Household",
          "Persons": [
            {
              "Age": 25,
              "Gender": 0
            }
          ],
          "TargetEnergyUse": 2000.0,
          "UseElectricCar": 0,
          "ChargingStationSet": null,
          "TransportationDeviceSet": null,
          "TravelRouteSet": null
        },
        {
          "DailyCommutingDistance": 50.0,
          "HouseholdGuid": "03472b42-066e-44b8-b434-97910825e9da",
          "Name": "My Second Household (with transportation)",
          "Persons": [
            {
              "Age": 25,
              "Gender": 0
            }
          ],
          "TargetEnergyUse": 3000.0,
          "UseElectricCar": 0,
          "ChargingStationSet": {
            "Name": "Charging At Home with 00.5 kW",
            "Guid": "0a42e424-2f0d-40db-b257-82a5fc010567"
          },
          "TransportationDeviceSet": {
            "Name": "Bus and one slow Car",
            "Guid": "6ac74bd0-bacd-4b39-b84a-dc7ae16702c9"
          },
          "TravelRouteSet": {
            "Name": "Travel Route Set for 30km to Work",
            "Guid": "0b217fce-ad99-4ef1-8540-c07081856d3c"
          }
        }
      ],
      "HouseTypeCode": "HT01",
      "TargetCoolingDemand": 10000.0,
      "TargetHeatDemand": 20000.0
    },
    {
      "Name": "MySecondHouse",
      "HouseGuid": "dcebe816-b761-4b1c-a7f0-c62b870dbeba",
      "Households": [
        {
          "DailyCommutingDistance": 100.0,
          "HouseholdGuid": "79d11195-c20b-4184-9d5c-b50043a92b1c",
          "Name": "My Third Household",
          "Persons": [
            {
              "Age": 35,
              "Gender": 0
            },
            {
              "Age": 34,
              "Gender": 1
            }
          ],
          "TargetEnergyUse": 2000.0,
          "UseElectricCar": 0,
          "ChargingStationSet": null,
          "TransportationDeviceSet": null,
          "TravelRouteSet": null
        },
        {
          "DailyCommutingDistance": 50.0,
          "HouseholdGuid": "9efa948f-bac5-4579-9743-be40df04f4a7",
          "Name": "My Fourth Household",
          "Persons": [
            {
              "Age": 75,
              "Gender": 0
            },
            {
              "Age": 74,
              "Gender": 1
            }
          ],
          "TargetEnergyUse": 3000.0,
          "UseElectricCar": 0,
          "ChargingStationSet": null,
          "TransportationDeviceSet": null,
          "TravelRouteSet": null
        }
      ],
      "HouseTypeCode": "HT02",
      "TargetCoolingDemand": 10000.0,
      "TargetHeatDemand": 20000.0
    }
  ],
  "Name": "My district"
}

Note that the TargetEnergyUse and the transportation functions are not yet working. Right now it will just select a household template based on the number and age of the people. The fix for the transportation will probably be in the next release.

The second file you get is the calculationsettings.json. Here you can adjust the settings for the calculation, such as which files to generate, start date, end date, temperature profile and more.

It looks like this:

{


  // List of all load types to process in postprocessing. Internally if you calculate 
  // a house, the LPG needs to calculate the warm water needs to correctly calculate 
  // the electricity demand from the heat pump. But maybe you don't need the warm 
  // water profiles and only want the electricity files. Then you can put Electricity 
  // here (case is important!) and the LPG will skip everything in postprocessing 
  // that is not in this list. Leave this blank or delete the option entirely if 
  // you want all the result files. 
  "LoadtypesForPostprocessing": [
    "Electricity"
  ],


  // Name for the calculation. This is not used in the calculation and is intended 
  // for the user to store comments or something like that. 
  "CalculationName": "My Comment",
  "CalcObject": {
    "Name": "Name that is just for information",
    "Guid": "This will be overwritten when creating individual calculation files for each house"
  },


  // List of all calculation output options to enable. This is ADDITIONALLY to 
  // the output files enabled by the DefaultForOutputFiles option! 
  // Possible Options:
  // IndividualSumProfiles
  // OverallDats
  // OverallSum
  // DetailedDatFiles
  // ActionCarpetPlot
  // EnergyCarpetPlot
  // TimeOfUsePlot
  // VariableLogFile
  // ActivationsPerHour
  // DaylightTimesList
  // ActivationFrequencies
  // ActionsLogfile
  // DeviceProfiles
  // TotalsPerLoadtype
  // HouseholdContents
  // TemperatureFile
  // TotalsPerDevice
  // EnergyStorageFile
  // DurationCurve
  // DesiresLogfile
  // ThoughtsLogfile
  // PolysunImportFiles
  // CriticalViolations
  // SumProfileExternalEntireHouse
  // SumProfileExternalIndividualHouseholds
  // WeekdayProfiles
  // AffordanceEnergyUse
  // TimeProfileFile
  // LocationsFile
  // HouseholdPlan
  // DeviceProfileExternalEntireHouse
  // DeviceProfileExternalIndividualHouseholds
  // MakeGraphics
  // MakePDF
  // LocationCarpetPlot
  // PersonStatus
  // TransportationDeviceCarpetPlot
  // LogErrorMessages
  // LogAllMessages
  // TransportationStatistics
  // ActionsEachTimestep
  // CalculationFlameChart
  "CalcOptions": [
    "IndividualSumProfiles",
    "SumProfileExternalEntireHouse",
    "SumProfileExternalIndividualHouseholds"
  ],


  // Guid of the charging station set to use. Only used if the transportation module 
  // is enabled and if not calculating a house. Settings in the house for the households 
  // will override these settings. 
  "ChargingStationSet": {
    "Name": "Charging At Home with 00.5 kW",
    "Guid": "0a42e424-2f0d-40db-b257-82a5fc010567"
  },


  // This sets which output files are generated. You need to use one of the defaults. 
  // If you want some additional individual output, you can use the calc options 
  // list of individual settings to enable additional things. 
  // Possible Options:
  // All
  // OnlyOverallSum
  // OnlySums
  // OnlyDeviceProfiles
  // Reasonable
  // ReasonableWithCharts
  // ReasonableWithChartsAndPDF
  // None
  // ForSettlementCalculations
  "DefaultForOutputFiles": "OnlySums",


  // This option makes the LPG delete everything but the resulting PDF. This is 
  // pretty much only useful if you want to generate a full set of PDFs for all households 
  // to get a detailed view of the results for each household. Default: false 
  "DeleteAllButPDF": false,


  // This option make the LPG delete all the DAT-files after the calculation. 
  // Default=true 
  "DeleteDAT": true,


  // If you want the people to use certain devices, for example if you want to make 
  // sure that the people really use incandescent light bulbs, then you can set 
  // up a device selection to ensure that this type of device will always be selected. 
  "DeviceSelection": null,


  // Enables the transportation module for calculating for example electromobility. 
  "EnableTransportation": false,


  // End date of the simulation. Defaults to the 31.12. of the current year if not 
  // set. One year maximum. 
  "EndDate": "2019-01-03T00:00:00",


  // How devices are picked for the households, for example if the household gets 
  // an old fridge or a new fridge. 
  // Possible Options:
  // EnergySaving
  // Random
  // EnergyIntensive
  // AsOriginal
  // EnergySavingPreferMeasured
  // EnergyIntensivePreferMeasured
  "EnergyIntensityType": "Random",


  // If you need result files in 15 min resolution instead of 1 minute, then this 
  // option will help you. Set it to 00:15:00 to get 15 minute files. Needs to be 
  // a multiple of the internal time resolution, which is normally 1 minute. 
  "ExternalTimeResolution": "00:15:00",


  // If you need result files in 30 sekunds resolution instead of 1 minute, then 
  // this option will help you. Set it to 00:00:30 to get 30 second resolution files. 
  // Note that the predefined device profiles are measured with a resolution 
  // of 1 minute, so you won't gain any accuracy, but it will save you the effort 
  // of interpolating the results yourself. 
  "InternalTimeResolution": "00:01:00",


  // The guid of the geographic location to use. This determines holidays and 
  // sunrise/sunset times. 
  "GeographicLocation": {
    "Name": "(Finland) Helsinki",
    "Guid": "ddb2bae5-d41a-494d-b5df-80eee767fc20"
  },


  // Which load types should be included in the calculation. If you want to calculate 
  // a house, it is required to use at least the house-setting. 
  // Possible Options:
  // Undefined
  // Mandatory
  // RecommendedForHouseholds
  // RecommendedForHouses
  // Optional
  // All
  "LoadTypePriority": "RecommendedForHouses",


  // Path to the output directory where all the files will be put. Defaults to the 
  // current path. 
  "OutputDirectory": null,


  // Path to the database file to use. Defaults to profilegenerator.db3 in the 
  // current directry if not set. 
  "PathToDatabase": "profilegenerator.db3",


  // Sets the random seed. If two calculations with the same random seed are run, 
  // then the results will be identical. Defaults to -1, which means that it will 
  // be randomly selected. 
  "RandomSeed": -1,


  // The LPG runs a 3-day period before the simulation start to initialize the 
  // people. For debugging purposes it is possible to include this in the result 
  // files. Defaults to false. 
  "ShowSettlingPeriod": false,


  // If you enable this, the LPG will check in the result directory if this household/house 
  // was already calculated and if so, will quit quietly. Defaults to true. 
  "SkipExisting": true,


  // Start date of the simulation. Defaults to the 01.01. of the current year if 
  // not set. 
  "StartDate": "2019-01-01T00:00:00",


  // Reference of the temperature profile to use. Defaults to the first temperature 
  // profile in the database if not set, which is probably not what you want. Only 
  // the GUID is used to search the database. The name is ignored and only for human 
  // readability. 
  "TemperatureProfile": {
    "Name": "Berlin, Germany 1996 from Deutscher Wetterdienst DWD (www.dwd.de)",
    "Guid": "ec337ba6-60a1-404b-9db0-9be52c9e5702"
  },


  // Sets the guid of the transportation device set that should be used. Only used 
  // if the transportation module is enabled and if not calculating a house. Settings 
  // in the house for the households will override these settings. 
  "TransportationDeviceSet": {
    "Name": "Bus and one slow Car",
    "Guid": "6ac74bd0-bacd-4b39-b84a-dc7ae16702c9"
  },


  // Sets the guid of the travel route set to be used. Only used if the transportation 
  // module is enabled and if not calculating a house. Settings in the house for 
  // the households will override these settings. 
  "TravelRouteSet": {
    "Name": "Travel Route Set for 30km to Work",
    "Guid": "0b217fce-ad99-4ef1-8540-c07081856d3c"
  },


  // This option make the LPG delete all the SQLite result files after the calculation. 
  // Only enable this if you really only want the load profiles and no further processing. 
  // Default=false 
  "DeleteSqlite": false
}

It is not recommended to put more than about 100-300 houses into a single district if you can avoid it. It is possible to prepare multiple district definitions though, which can all be processed in one go. For this you need to create a new directory and put all the district definitions in there.

After you prepared your district definition you can process it:

Simulationengine.exe processdistrictdefinitionfiles -JsonPath MyDirectoryWithOnlyDistricitDefinitionFiles -CalculationDefinition myadjustedcalculationdefinition.json -DstPath c:\\work\\mydistrictresults

That will take a while to generate all the input files for the calculations. After it has finished you can start the calculations with:

Simulationengine.exe launchjsonparallel -numberofcores 20 -jsondirectory c:\\work\\mydistrictresults

There are additional options that you can see if you call

Simulationengine.exe -help

If you have any new ideas, feature requests or discover any problems, please send me an email or contact me using the form on this website.