Towards HB Agent Based Models?

Hello everyone!

I am currently thinking of Agent Based Models (ABM) for building assessment, specifically to understand how behavioural patterns affect building performance and vice versa.

The way I see it, and I could be wrong, to some extend these types of analyses are already included in E+ (and HB) in the sense that we can assign schedules of certain building components and systems (e.g. shading, windows aka n.v., thermostats, etc.) according to other independent variables (mainly outdoor temperature and irradiance) that we attribute to imaginary agents.

However, this mostly represents analyses using external (to the model itself) data, and not internally calculated outputs, which are essential for assessing occupant behaviour (e.g. open window when outdoor temperature is lower than…). Thankfully, HB already includes an array of advanced components able to calculate these parameters, especially comfort parameters and daylighting.

Does that mean that we could potentially use that information as input to agents that would populate the space of our model? I am thinking here in the same terms as a wind driven rain simulation workflow would work, where first a CFD study would analyse the wind velocity for every point of the mesh and the droplets would then be dropped in that mesh and their probabilities of their routes would be calculated. In the same way I would imagine we can calculate probabilities of occupant actions in ‘points in time’, where occupants would change their environments given the results of the simulation. This isn’t really real-time but it is still a start and it is a quite good approximation of the nowadays-popular, low-control, mechanically ventilated buildings.

Now, I believe that I could model these type of agents, and their parameters, rules, probabilities, etc. If so, how interesting and especially how difficult would it be to create the component that would take the results of the simulation for a space as inputs for these agents?

I know the above is not totally clear but bare with me as this is shaped along your comments and ideas.

(an example for inspiration from 2011, agent based model architecture:

Kind regards,



I had meant to respond to this sooner and I think that this statement is very relevant and well-timed. My one point of feedback is to be mindful of the tendency to incorporate new technologies and ideas (in this case agent-based modelling) simply because they are the new cool thing to do and, if we think carefully about how the integration of agent-based modeling will improve the accuracy and usefulness of our models, we are more likely to make lasting contributions through their integration.

For example, it seems vital to me that such agent-based models be grounded in some clear quantifiable observations of human behavior in real buildings as opposed to relying on our own coefficients to represent how valuable we think certain things are to the occupants. I will give an example of two agent-based ideas that I have had - one of which has turned out to seem much more valuable in the long-run because of it’s grounding in real-world data and I plan to implement soon.

To start with the more valuable example, ever since I read this awesome book on adaptive thermal comfort (…), I have had several ideas for how to integrate the findings of recent comfort surveys into our energy models. Generally, the focus of thermal comfort research seems to be shifting from theoretical human energy balance calculations to surveys of occupant behavior, giving us a lot of great data that helps incorporate these behavioral factors in our energy models. To continue one of the ideas that you mention, Theodore, here is a plot from the book that describes the window-opening behavior of occupants as the indoor temperature increases:

Currently, EnergyPlus does not easily allow you to set such a function for window-opening, as you point out but the incorporation of this behavior seems necessary to produce an accurate model of a naturally ventilated building (since opening all of the windows as soon as the indoor temperature hits 21 C is far from realistic). To get around this, I was thinking of including an option on the nat vent component that will put in a series of IF/THEN nat vent objects that approximate this smooth function through a step function:

IF 19 < indoor temperature < 20 THEN WindowOpening = 10%

IF 20 < indoor temperature < 21 THEN WindowOpening = 15%

IF 21 < indoor temperature < 22 THEN WindowOpening = 21%

IF 22 < indoor temperature < 23 THEN WindowOpening = 35%

I am hoping to implement this soon.

To describe the example that I have realized was not so helpful with time, when I was first drafting the idea for high-resolution comfort maps (…), I originally thought that I would develop computer models an animations of occupants moving around the thermally diverse space to make themselves more comfortable. Once I started to get into this, however, I realized that the social characteristics of a space usually have a much larger impact on where people place themselves than the thermal characteristics and it is not until the thermal characteristics become very uncomfortable or the presence of other people is completely removed that the thermal environment dominates the movement behavior. Thus, in order to model the occupant behavior, I would have to code in the relative importance of a large number of these social characteristics in relation to thermal comfort, which would have been a process of me simply making up coefficients to produce cool-looking but somewhat meaningless animations. It is only when my nicely-designed thermal environments were aligned with the social/programmatic characteristics of the space that I could argue that I was justifiably adding value since the thermal characteristics were not in contradiction to or being weighted against the social ones. So, in the end, realized that all I needed in order to produce a good design was to align the thermal environment with the placing of program and the agent-based modelling would not have enabled the production of a much better design. This is the reason why the human silhouettes are manually placed in the thermal animations on the youtube playlist in the above link and is the reason why I do not intend to incorporate agent-based modelling in this particular manner.

Let me know your thoughts on this as I realize I may also be looking at this from a narrow perspective that is not informed by all that agent-based modelling has to offer.


Hi Chris,

Thanks for the answer. Sorry for the late reply.

Indeed that is exactly what i was thinking. Even though I was excited when I was acquainted to NetLogo and ABM, I do realize that ABM can be a bit hip atm as it is being introduced in more and more fields. I also realize that thermal conditions of a space are not the only determinants for human behaviour. So I would not attempt to model human behavior right away in that sense.

From the very limited review I did I also thought the way to go was to use research out there that approximates behaviour on specific human tasks by statistics, like the example you gave. I was actually reading an interesting thesis that included statistical formulas for a wide range of actions within a building. I could compile a set of these formulas and step functions for a few different rules if you want. Cause I think your idea of using the if/then rules will give allow a different kind of modeling of adaptive behaviors.

Now time to go see if I can acquire that book somehow :slight_smile:

Kind regards,

Theodore Galanos.


It sounds like you are looking at some good stuff and I am very excited to hear what you come up with. Compiling a set of formulas would be a great resource and, if that thesis is available for download or purchase anywhere, I would love to read it.

The pointing out of the “hipness” of ABM was not meant to be a critique of it as much a wariness of the “hype cycle” that is useful to view new technologies with ( I am certain that there is a huge plateau of productivity for ABM as we come to understand its most valuable applications.


Hi Chris,

This is the thesis I was referring too I haven’t gone through the whole thing to make sure but from what I see it provides a pretty good literature review and compilation of behavioral modelling for important user actions on different building components like windows, doors, thermal parameters, etc. He also goes through a lot of different mathematical frameworks one can use to model these.

I’ll try and extract useful information out of this and other papers and perhaps make my own review of sorts and share it with everyone here. See where that takes us.

I did find another interesting thing looking around, researchers from UPENN were combining ABM methodology and EnergyPlus. They used the MLE+ framework ( to connect matlab and E+ and allow the actions of the agent in their example to interact with the E+ simulation at each timestep. Is something like that available today in GH or LB/HB? Sounds like an interesting platform, allowing for these connections to E+ but man don’t let me go into Matlab :frowning:

(link of the paper

Kind regards,

I haven’t read the whole discussion but in case you’re interested to do what MLE+ does you don’t really need MATLAB. It is an interface for BCVTB ( which you can connect to directly.

Thanks Mostapha!

BCVTB looks very promising! All I need now is more hours in a day!

Kind regards,


Hi Theodore, I’m very interested in the topic of using agent-based modeling for behavioral modeling. One of the main issues for integrating similar features in energyplus is the difficulties to tap into the simulation during the run. I think we need to get into EMS for making any solutions similar to this to work. I have never played with EMS but it looks like one of those things that will be easy once you figure it out once. EnergyPlus developers are very good in developing not user-friendly workflows.

Interestingly enough I know 2 of the current developers of MLE+. I’m currently working with them on a different project. I didn’t know that they are currently involved in MLE+. I can also ask them about their approach next time that I see them in person (will be early next year). Looks like they have made so many changes during the last 5 years which was the last time that I tried MLE+.

Hi Mostapha,

Thanks for your reply. It would be amazingly helpful if we can get their input on how to develop a co-simulation between EnergyPlus and an agent-based model. I’ve seen from the BCTVB site that they are either using what they calll ExternalInteface objects or EMS components. I think the EMS would be the best solution as well, just for matters of consistency. Apparently there are a couple of examples given along with the software.

Unfortunately, after a couple of hours browsing the site I came into my usual “wall”. It’s kind of hard for me to understand the underlying code of the thing given I’m not very familiar with E+ scripting language. I will keep trying though. I could move a lot faster if I had practical experience. I wonder if they already have examples of co-simulation (other than the templates offered with the software) that they would be willing to share.

Anyways, I’ve decided to turn my Christmas holidays to a mini sabbatical. I’ll focus on collecting literature on agent based models of thermal comfort as well as mathematical models and statistics on human behavior in buildings. Hopefully, we can use all the above once we understand how to link E+ to such models.

Kind regards,


I went around GitHub for a bit, there seem to be a lot of interesting projects on ABM.

What is good for us, I suppose, is that most of them seem to be built on the Python environment, like

pyabm (,

agentum (,

and the perhaps the most promising looking

mesa (

Would being coded in python make it easier for someone to port them in GH?

There are also some others written in javascript like agentbase ( Another potential interesting project is focusing on crowd dynamics ( which might be relevant for us.

Finally, there’s pandora (, a framework that can scale up to handle complex simulations. I would imagine this fits to the type of simulations we would want to do.

This is just a first read of course, I will give a try in some of them hopefully. I hope this is helpful.

Merry Christmas!

Kind regards,


Actually, upon reading a bit more, it seems that pyabm is a good place to start. It seems to be a basic python toolkit for creating ABM models, classes, agent parameters, etc. which would be a nice start I guess.

I do think it has stopped developing by now however.

Spam continues on Christmas Day!

I’m now playing around with NetLogo again to remember my uni days. I’ve also come across AnyLogic. It seems like a highly developed ABM software so I think I will go over some (MIT) lectures on it to get both a practical and theoretical refreshing on things. Cool thing about it is even though it’s probably an expensive software it has a free personal learning edition!




Sorry for being away from the conversation for a couple of weeks. As Mostapha points out, a lot of your criteria for a good ABM package are going to be related to the means by which you plan to dynamically interact with the E+ simulation. If you are going to interact with it via MLE+, then an ABM package that is in Matlab would likely be the best. Mostapha, is there a way to use MLE+ without having to buy Matlab?

If you are going to go with a BCTVT approach, then an ABM package that is in Modelica would probably be best. I know a colleague who is working with the BCTVT and I remember seeing some great stuff that he was doing with Modelica. I remember that he was using the Dymola interface to access the modlelica building components library that Michael Wetter put together and that this library had really only been validated with Dymola and not the other interfaces for Modelica (Dymola is not free, although it is a lot less expensive than MATLAB). Still, Modelica is an open language unlike MATLAB and there are free interfaces for it that are getting better. Thus, there may be some long-term benefits to developing with that. Let me know if you want to be put in touch with my colleague who is working with the Modelica building components library.

Finally, the agent behavior that you are trying to model will also shape how you integrate it into the simulation. If the behavior is triggered by temperature, solar radiation, or glare/daylight values that you get from a Radiance simulation, then you don’t have a need for these very complex interfaces and you can get what you are after with just the objects that are already in E+ and with csv schedules. For understanding all of the objects that you have at your disposal in E+, I recommend using the IDF Editior that comes with E+ (C:\EnergyPlusV8-3-0\PreProcess\IDFEditor) and the online Input/Output Reference. I had no knowledge of E+ objects a year and a half ago and both of these resources were critical for my tapping into E+.

Once you have a good understanding of the specific behaviors that you are trying to model and the capabilities that E+ already has, I think you will be in a better position to decide what tools are most valuable to you.

Hope this helps,


Hi Chris and Mostapha,

First of all, happy new year! I wish you all a happy, healthy, and creative 2016.

Chirs, thank you once again for your informative answer.

I have been thinking a lot about this lately. I believe you are absolutely right to say that the type of behavior to be modelled will define if we actually need an ABM interface. If, as you say, the parameters modelled are temperature or radiation, then I imagine that a lot of studies can be done within E+, perhaps in the stepwise way you described earlier.

Additionally, and this is my main critic on ABM in general but I’ll leave it for another discussion, the degree of freedom or interaction with the environment that an agent has dictates the possibilities for an ABM. In typical models this has to do with how you model innovation in agents, changes in their practices and norms (which generally isn’t there in ABM models). In our case, it related to the type of environments our agents are situated in.

I can imagine two extreme cases of environments, with ofc a gradient of possible worlds between: the mechanically conditioned building and the naturally ventillated building.

In the first case, which btw is the one most encountered in my part of the world, the agents have minimal, to sometimes zero, control on their environment and no capabilities of adaptation and change. Imagine a typical building where the set points are set centrally, windows are not operable, and even the shading devices are sometimes out of their reach.

In this case, I can imagine ABM models helping only as a post processing tool. What that means is that we could potentially use them to analyze occupant behavior within this controlled environment. E+ would give us the hourly space performance and we would feed that to agents to see how they respond. Ofc, in terms of thermal comfort this is almost what your tools are doing. So, such an approach would have little value in an office building for example where people are assumed static but could be interesting in retail buildings where we could potentially model occupant movement according to building performance. The limits of this approach then is some sort of scenario testing of different settings and occupant (response) behavior to them. Here of course, you have a valid point of other building characteristics that should be modelled, apart from climate.

In the second case, that of an adaptive building, I believe ABM can be a tool that can be used in a co-simulation approach, as it has been used in the site Mostapha mentioned above. Again though, in ABM it is critical to not overdefine behavior but on the contrary to generate behavior from assigning simple rules to agents. This makes it difficult for me to find the limit of detail in the functions/statistics used to model occupant actions within the building (on windows, shading, thermostats, etc.).

Since ABM is better fitted to generate patterns that we encounter in the real world, I thought of developing a model that might do exactly that. It took me a while to think of a pattern that would be interesting, but I think I finally have it. It is a bit of a grand gesture of course, but should be worth it.

As you know better than me from your research, the adaptive comfort studies found a quite peculiar fact about the tropics. The sentence went something like this (I’m botching it probably), “people in the tropics tend to prefer environments that are below the limits of their neutral comfort”. Or simpler, people just want to the space to be colder than what one calls neutral.

My simple minded explanation, after leaving in the region, is that the explanation for this is to be found in the interface between outside and inside. The temperature gradient in that interface is what makes people feel more comfortable in uncomfortable (i.e. colder) conditions.

So what if we would introduce a shaded, open, naturally ventilated space prior to a MV building’s entrance and then increase your indoor temperatures in the building? Or what if we introduced a temperature gradient in the different spaces a visitor/occupant passes through as he enters the building. I feel that energy modelling cannot really understand the impact of these interventions on occupants, at least in its basic form. I think this is where ABM could be useful. Building a model that can generate the above mentioned pattern and then using it to analyze different types of strategies to occupant behavior.

I wanted to write the things above in a more structured way but I forgot my cheat-sheet at home :slight_smile: I hope I made some sense.

I will try and be patient and follow the route you suggest however, understanding the E+ resources first and then moving to connecting it to ABM.

I just thought I’d describe the sort of research questions I have in mind for this, hoping someone finds it interesting as well!

Kind regards,


P.S.: I have left out other areas that would be suitable for ABM modeling within buildings. For example the area of health and safety. ABM is an amazing tool to model occupant behavior in extreme events, e.g. fire in a building or toxic smoke, etc. in order to analyze evacuation patterns and optimize building design. Even though this is something I am also interested, I intentionally did not go into it since we are mostly dealing with environmental design here.

Hello again!

Following Chris’s advice I skimmed through the E+ reference guide. Took a lot of notes and learned a lot of interesting things I did not know. Unfortunately, the most difficult parts of the guide for me were exactly the two group of objects that are most interesting for this: EMS and ExternalInterface.

I will keep reading and testing, currently also downloading BCVTB at work. I am also currently contacting two former colleagues one with a very strong background in ABM and coding and the other researching on building energy simulation. Will probe to see if this is interesting to them and will let you know.

Maybe we can coordinate something in the immediate future.

Have a nice day.


This looks very promising as well. It is a new effort but it seems to be a very good start on an ABM framework for GH.…

Hi Chris,

It would be very helpful if you could get me in touch with your colleague. Any information on how to navigate this new rabbit hole would be invaluable.

Kind regards,


I think this topic is very interesting!! I have done research with urban growth and economic models utilizing cellular automata as well as abm models. I made this project at my university a couple years ago in which agents moved over a predefined colored gradient background. They chose whether to go straight or turn, and how fast based on the surrounding environment(gradient), they also had the capacity to change this environment. This makes me think of how an ABM or CA model can be linked with microclimate map for example, and figure out how people move inside the building based on that. Just a thought!

Have you had any updates on your work?

1 Like

Wow, thanks for reviving such an old post :slight_smile: Didn’t have so much progress since then but I am doing related things that might work now.

It’s an interesting proposition, especially the thermal comfort one, no doubt worthy of a thesis type of research. But I guess one can start simpler with maybe some NetLogo models of a thermal environment with rules of how people react to TC. It might be an interesting way to test some thermoregulation ideas I’ve also wondered about.

Additionally, if you care about the hype, Reinforcement Learning is a nice approach for these models now. It’s a sort of ML agents. I have only touched on it (some toy examples on OpenAI gym) but would love to look into creating an environment for our type of cases. Let me know if that sounds interesting and I can point you to some direction or have a chat.

Kind regards,

Hi Theodore, I am reviving this thread once again :wink:

I managed to integrate a stochastic (logistic regression) window operation model in Honeybee (see attached paper). I did this by inputting some ERL code to the “AddtitionalStrings” input of the Run component (it was insanely complicated and took me forever to wrap my head around). In this case it didn’t require co-simulation since I assumed the occupants to be static.

Now I have an application that would really benefit from co-simulation: I want to test whether shifting occupants to the currently most comfortable zones in a building at each time step would improve overall comfort. (Imagine a school building with some redundant classrooms and an environmental sensor network that prescribes “on-the-go” in which rooms the next classes should take place).

Were you able to solve the co-simulation issue? In GH, at each time step, I want to read the operative temperatures of all classrooms and edit the occupancy schedules accordingly for the next time step. I could probably do this entirely in EMS again but it would be a colossal PAIN (especially since as a next step I want to minimize walking distances with Shortest Path algorithms etc.).

Would be interesting to hear your (or anyone else’s) thoughts on this!
190211_SimAUD_49.pdf (483.4 KB)