Calculating a large number of houses

Calculating large settlements

Starting with version 9.3 there is a new mechanisms that might be useful if you want load profiles for a large number of households. It is called JSON-based house job specifications and completely replaces the earlier command line interface, the Json calculation specifications and the district definitions.

JSON-based calculation

The settlements screen can now be used to directly generate such house job 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

House Job Files

You can get an example district definition file by calling:

Simulationengine.exe CreateExampleHouseJob

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

{
  "House": {
    "Name": "MyFirstHouse",
    "HouseGuid": "351f1cb4-0612-45d1-b9e8-34ef28a8b7aa",
    "Households": [
      {
        "HouseholdDataPersonSpecification": {
          "Persons": [
            {
              "Age": 25,
              "Gender": 0
            }
          ]
        },
        "HouseholdTemplateSpecification": null,
        "HouseholdNameSpecification": null,
        "UniqueHouseholdId": "5ca8a204-0d9c-441d-a25f-a590b39b2892",
        "Name": "My First Household, template randomly chosen based on persons",


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


        // 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": null,


        // 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": null,


        // 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": null,
        "TransportationDistanceModifiers": [],
        "HouseholdDataSpecifictionType": "ByPersons"
      },
      {
        "HouseholdDataPersonSpecification": null,
        "HouseholdTemplateSpecification": {
          "HouseholdTemplateName": "CHR01"
        },
        "HouseholdNameSpecification": null,
        "UniqueHouseholdId": "eed8b438-d952-4a79-83f4-c8d43360cc8d",
        "Name": "My Second Household (with transportation, template defined by name )",


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


        // 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"
        },


        // 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"
        },
        "TransportationDistanceModifiers": null,
        "HouseholdDataSpecifictionType": "ByTemplateName"
      }
    ],
    "HouseTypeCode": "HT01",
    "TargetCoolingDemand": 10000.0,
    "TargetHeatDemand": 20000.0
  },
  "CalcSpec": {


    // 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",


    // 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
    // SumProfileExternalIndividualHouseholdsAsJson
    // JsonSumFiles
    "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": "Example1-Results",


    // 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,


    // When using household templates, sometimes random households are generated 
    // that don't work. With this option you can make the LPG force to simulate at 
    // least some of the cases anyway. Default=false 
    "IgnorePreviousActivitiesWhenNeeded": false
  },
  "Scenario": "scenario",
  "Year": "year",
  "DistrictName": "districtname",
  "PathToDatabase": "profilegenerator.db3"
}

If you have exported the house job files from a settlement, you will find two files in the directory you specified called “SimulateEverythingInParallel.cmd” and “SimulateEverythingSequentially.cmd”. If you click the files, it will start the calculation.

Alternatively, after you prepared the the house job files, you can start them manually with

Simulationengine.exe ProcessHouseJob -j myfile.json

Or, if you have a lot of files, you can put them all into a directory and start the calculation with:

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

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.