Search Unity

Share

Is this article helpful for you?

Thank you for your feedback!

Computer simulation has been used for decades by researchers, engineers, problem solvers, and policy makers in many fields, including the study of infectious disease. Unity Simulation enables a special kind of real-time simulation that can be scaled on the cloud to holistically study large, complex, and uncertain systems. We built a simplified demonstration project to simulate coronavirus spread in a fictitious grocery store and explored the impact that store policy has on exposure rates. Learn more in our white paper – we’ve also made the full source code for this project available on GitHub for anyone to extend.

Disclaimer: The project referenced in this post (including all information and data associated with it) is “as is” and “as available.” You are solely responsible for your use of the project, and Unity Technologies and its affiliates make no representations or warranties of any kind concerning the project or its use; see license terms for details.

Without limiting the foregoing, we want to be absolutely clear: We are not epidemiologists or doctors. Nothing in this project can or should be taken as medical or other guidance or advice of any kind. This is a conceptual model based on simplified rules. It is not scientifically validated. For guidance or advice concerning the novel coronavirus, how it is spread, what steps you might take to avoid infection, or anything else health-related, consult a competent health professional.

Click here to interact with our grocery store simulation

Simulation and coronavirus

Computer simulation has been used for decades by researchers, engineers, problem solvers, and policymakers in many fields. It is a central solution to the problem of predicting what might happen under complex and uncertain conditions. Simulation plays a large role in research for infectious disease and has been applied to diseases ranging from the bubonic plague to HIV/AIDS. Researchers start the process by first collecting relevant data from the field. They develop theoretical and heuristically informed mathematical models using the data. The mathematical models are then built into a simulation tool that calculates the outcomes of interest, such as viral spread, from various input parameters, such as population density exposure factors. Finally, the simulation allows big-picture observations and what-if studies, ultimately leading to a conceptual understanding of real-world situations that experts can use to inform challenging policy decisions.

As the novel coronavirus has spread throughout the world, governments have taken drastic measures to curb the severity of the pandemic. Meanwhile, leading research institutes are developing rigorous scientific simulations to help inform government policies. An article in The New York Times describes some of the projections that The Institute for Disease Modeling (IDM), a private institution, is developing to help inform policy. Several conceptually oriented simulations have recently been designed to help the public visualize and understand how the novel coronavirus progresses and how our actions can help prevent its spread. Here are some interesting examples we’ve come across:

  • A conceptual simulation published by The Washington Post demonstrating the impact of “social distancing”
  • A collaborative study by the Katholieke Universiteit Leuven and Eindhoven University of Technology using detailed fluid simulation to show the potential for spread during biking and running situations
  • A study from Finland using detailed fluid simulation to show how a cough can spread in a grocery store

Simulating spatial environments in Unity

Researchers and businesses use Unity to efficiently simulate spatial environments. Unity enables real-time simulation in interactive mode and can simulate frames even faster than real-time in offline mode. By developing projects in Unity that represent real-world environments, parameterizing those projects for simulation, and running many simulated scenarios in the cloud, they can holistically understand complex systems to inform key policy or design decisions. Let’s define a few of these terms:

  • An environment in Unity is a 3D spatial representation of a defined space and all of the objects it contains. Those objects can be fixed in position, or they can move and change according to programmed rules, physics models, or machine-learning algorithms. Objects in an environment can be simplified or highly visually detailed.
  • A parameter is an identified aspect of the Unity environment that can change from one simulation to the next. Because Unity is a highly extensible framework based on C#, parameters can be very simple, such as a change in the speed of a single object’s motion, or they can be more complex, such as the logic handling crowd behavior.
  • A scenario is a combination of parameter settings to be run in an environment over the course of a simulation. Each simulation typically corresponds to a single scenario. A simulation batch job in the cloud can consist of many scenarios.

Let’s explore these definitions through a relatable use case: the spread of the novel coronavirus within a system of shoppers in a grocery store. The environment in a simulation like this would be the spatial representation of the store, the healthy and infected shoppers it contains, and the rules for virus transmission. The parameters might include the store’s rules, such as the allowable number of shoppers or the number of open cash registers. Each combination of these parameter values would comprise a separate scenario. As each scenario is simulated, the emergent behaviors of the dynamical system play out, and it becomes clear how a store’s rules might lead to more or fewer individuals becoming exposed to the virus. A simulation like this could provide helpful insight into the variables that affect the exposure rate so the store’s management can develop policies and procedures to potentially reduce the spread of disease in those environments.

Our team built a simplified demonstration project to illustrate what this could look like and to inspire the Unity user community and disease modeling community to think about new ways to model coronavirus spread. IDM has guided our team over the course of this project, referring us to several existing scientific models for transmission of the coronavirus that helped inform our vision.

 

Check it out

 

Unity works well for systems modeling because it can efficiently simulate systems over longer timescales than some other types of simulation tools. This means that instead of simulating a short virus-spreading cough event over a single second using many hours of computation in a fluid dynamics simulator, Unity can simulate a group of 50 individuals moving in an environment over the course of 10 minutes using simplified spread dynamics. By simulating a longer time period, larger-scale trends of spread become evident. Leveraging batch cloud simulation capabilities, the simulation can be sped up to compute faster than real-time and run tens or hundreds of thousands of scenarios in a batch in a matter of hours.

Cloud simulation of the whole parameter space

Once we built our simulation, we sampled each parameter at multiple values and ran a batch simulation job on the cloud using 10,000 simulation instances to test all of the combinations of our sampled parameter values in just three hours. Each combination of parameter values was simulated five times to account for randomness and the output averaged. This batch job produced a results file containing the number of healthy shoppers and number of exposed shoppers from each run. We easily calculated the exposure rate as the number of exposed shoppers divided by the number of total shoppers by post-processing the data in a spreadsheet.

Conclusion

Using the simulation output data from all of our runs, we were able to produce a high-level summary view of the exposure rate as a function of the store’s policy. In the figure below, we show the relationship between the number of open registers for different numbers of allowable shoppers. When only one register is open, the exposure rates are very high, especially when the store is crowded with 30 or 40 shoppers, due to backups at the checkout area. Opening up a second register has the largest impact on reducing the exposure rate. The benefits level off after that point when the store has 20 shoppers, but opening up to five registers is helpful for when the store has 30 or 40 shoppers.

Extend this project on your own

This simulation is just a starting point. The parameters we use in the mathematical model for transmission have a large impact on the results and need to be rigorously developed using real data. We’re making this project, including its full source code, available via GitHub for anyone to experiment with. You can run the demo we’ve described here using the free tier of the Unity Game Simulation beta, which leverages Unity Simulation and Unity Remote Config under the hood. We offer many additional informational resources in the whitepaper.

Stay connected

We encourage interested readers to explore and extend this project, and if you do, share the results on social media using the hashtag #UnitySimulation. You are also welcome to contact us directly about any project ideas you have at simulation@unity3d.com.

Is this article helpful for you?

Thank you for your feedback!