Simulations allow for the testing of different system configurations before hardware is built. It is important that such simulations are dynamic and that they integrate all major subsystems and activities. This paper describes a specific habitat simulation being built at NASA Johnson Space Center. It is a discrete-event simulation that is dynamic and stochastic. It simulates all major subsystem of a Lunar or Martian habitat, including the crew (with variable ages, weights and genders), biomass production (with scalable plantings of nine different crops), water recovery, air revitalization, food processing, solid waste recycling and energy production. Crew activities are modeled including: exercise, sleep and work. Extravehicular activities (EVAs) are simulated by having crew members leave the habitat taking small amounts of consumable resources with them and then returning later with fewer consumables. Habitat pressure is simulated including leak rates and losses due to airlocks and EVA. Malfunctions can be injected at any time into any subsystem. The simulation also models sensors and actuators to provide for control opportunities. The simulation is written in an object-oriented paradigm that makes it portable, extensible and reconfigurable. In addition to introducing the simulation, this paper also presents results from using the simulation to analyze five different Lunar habitat configurations.