architecture-building-systems / CityEnergyAnalyst

The City Energy Analyst (CEA)
https://www.cityenergyanalyst.com/
MIT License
194 stars 61 forks source link

Develop bayesian calibrator for CEA #351

Closed jimenofonseca closed 6 years ago

jimenofonseca commented 7 years ago

The idea is to integrate part of the work of y. Heo on the bayesian calibration of building energy models into the CEA. the process includes methods for running:

  1. Preescreening or sensitivity analysis of continuos variables of the CEA model based on the morris method.
  2. New database of probability distributions: Accounting for uncertainty of most variables in the CEA based on real measurements and literature.
  3. Bayesian calibration of building energy consumption based on affinite Montecarlo-markov chains and latin hypercube.
  4. Calibration to hourly, monthly, or yearly data.
jimenofonseca commented 7 years ago

@martin-mosteiro i guess we will need access to the HQ metered data for all standing buildings. hourly values will be the best.

martin-mosteiro commented 7 years ago

@JIMENOFONSECA I am in contact with the Universities and Hospital to obtain measured data. For the privately owned buildings it will be hard to get hourly metered data... Or how did you do it for Inducity?

jimenofonseca commented 7 years ago

We liased with the operator of the district (siemens) he was our partner during the project. Maybe ZH's city could help? At least to get data from the district heating operator...

Best, Jimeno

On 7 Oct 2016, at 16:18, martin-mosteiro notifications@github.com<mailto:notifications@github.com> wrote:

@JIMENOFONSECAhttps://github.com/JIMENOFONSECA I am in contact with the Universities and Hospital to obtain measured data. For the privately owned buildings it will be hard to get hourly metered data... Or how did you do it for Inducity?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/architecture-building-systems/CEAforArcGIS/issues/351#issuecomment-252180388, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIjrgujgAS1YFCQT2nOnYR2azdiwiEMXks5qxgBOgaJpZM4KPspe.

martin-mosteiro commented 7 years ago

@JIMENOFONSECA We are in contact with them and will hopefully have the information from them by the end of the month. Unfortunately everyone is on holidays at the moment so that will be the earliest we can get that information...

jimenofonseca commented 7 years ago

@martin-mosteiro no problem i guesss i will be finishing by the end of the year this. It would be great we get data for 2 or more years btw :-)

jimenofonseca commented 7 years ago

@daren-thomas i am having a little of a problem while running 7000 simulation of the CEA in parallel. I tried using the Queue, Process and Apply.Sync functions of the multiprocessing library in python. all have the same problem. They create multiple python instances for each simulation. The result: after just 10 pycharm runs out of memory. Any clue how to solve this issue?

daren-thomas commented 7 years ago

@JIMENOFONSECA: where can i find this code? I checked out the i351-the-calibrator branch, but I'm not sure where to start?

daren-thomas commented 7 years ago

OK. I see the problem: You need to use a pool (like in demand). What you are currently doing is allocating a new process for each job. A pool will (re-)use a set of processes...

daren-thomas commented 7 years ago

@JIMENOFONSECA I have just pushed on your branch a version that uses multiprocessing. I suggest you don't use it though: We can only easily do multiprocessing on either the demand calculation or the morris function. Doing it on both doesn't work easily (though see here: http://stackoverflow.com/questions/6974695/python-process-pool-non-daemonic for a work-around) and besides, there is not much sense in doing it, since running on more processes than available CPU's is only really a good idea in an IO bound computation. Our computation is more CPU bound.

The version I have posted runs the morris on a multiprocessing pool and shows how to create a Queue object that can be used in a pool like that, but needs to run the demand calculation in single process mode. I think the other way round makes more sense.

Now... if we moved to the cluster for these computations, we could probably do the split the other way round, as we then have sooo many more CPU's, but then the whole architecture of the morris function needs to be changed as the computations don't happen on the same computer and memory can't be shared between processes...

jimenofonseca commented 7 years ago

@daren-thomas thanks a lot for the input. I figured out the way to do it with just using multiprocessing for calling the demand, but not in the demand script itself as you said. I also moved from the morris method to Sobol, which is a bit more accurrate, more computer intensive, but on return it provides a better understunding of how much each variable is influencing the model (in percentage of the total variance). What the morris method does not provide..

It runs in parallel smoothly now...

jimenofonseca commented 7 years ago

moving this to the next milestone as there is an ongoing publication that will use part of the data included in this approach

daren-thomas commented 7 years ago

@JIMENOFONSECA the pull request shows differing results in the unit tests... do you have an idea what changed?