Presentation on theme: "The Computer Continuum11-1 Chapter 11: Simulation: Modeling the Physical World Simulation is one of the most important uses of computers today. It allows."— Presentation transcript:
The Computer Continuum11-1 Chapter 11: Simulation: Modeling the Physical World Simulation is one of the most important uses of computers today. It allows us to visualize worlds that might not exist outside of the computer.
The Computer Continuum11-2 Simulation: Modeling the Physical World n In this chapter: Why do we need simulations? What is a model and how do they differ? How can the simulation game Monopoly be categorized? What can SimCity teach us? What do programmers consider when planning, designing, and implementing a simulation? Virtual reality, what are its uses? How can an electronic spreadsheet be used as a simulation tool?
The Computer Continuum11-3 Reasons for Simulation n Simulation: A technique used to mimic or imitate some phenomenon in a way that represents the real situation in most of its details. A physical or mathematical model is designed to behave like the object or event of interest. –By manipulating and working with the model, a person can: Predict outcomes. Better understand the model. Experiment with the model. Test the model. Use the model for training purposes.
The Computer Continuum11-4 Reasons for Simulation n Time compression must be possible in order to predict the future in some way. –Presidential elections. –Weather forecasting. –National economic trends. –Population growth. Predictions are only as good as the model used in the simulation!
The Computer Continuum11-5 Reasons for Simulation n Simulation of the Inaccessible or Impossible Many simulations are necessary because it is impossible to gain knowledge any other way. –Observing the collapse of a star. –Reactions within a nuclear reactor. –Genetic evolution. –The weather on Venus. –Recreation of the bomb blast that destroyed the Alfred P. Murrah Federal Building in Oklahoma City, Oklahoma.
The Computer Continuum11-6 Reasons for Simulation n Based on the explosives investigation, a simulation of the bombs force was recreated. Oklahoma Bombing Simulation
The Computer Continuum11-7 Reasons for Simulation n Experimentation and Testing Testing the simulated model of a complicated system is sometimes more feasible than testing the real thing. –Experimentation on a new jet engine. –Repeatedly crashing automobiles into cement barriers. –Results from changing tax rates and interest rates on the US economy. –Changing fertilizer compounds on corn crops.
The Computer Continuum11-8 Reasons for Simulation n Testing guardrail designs using simulated car crashes.
The Computer Continuum11-9 Reasons for Simulation n Education and Training Offers greater flexibility than traditional education and training. Can offer the benefit of years of experience to people learning some complex skill. –Diagnostics in medicine. –Flight training. –Training a nuclear power plant technician. –Managing salmon runs. –Managing traffic patterns. –Building and bridge construction.
The Computer Continuum11-10 Reasons for Simulation n Simulated landing onto an aircraft carrier.
The Computer Continuum11-11 Building a Model n Models, whether physical or computer-simulated, share general characteristics: Continuous systems: Have quantities that vary smoothly or in a continuous manner. –Example: Simulated landing of a rocket on the moon has quantities in engine thrust, velocity, and deceleration. All these vary smoothly (dont jump). Discrete systems: Have quantities that vary in steps or jumps. –Example: Modeling the traffic flow at an intersection. The number of cars can be counted precisely. Cant have half a car pass through the intersection.
The Computer Continuum11-12 Building a Model n Models can also be characterized as predictable or probabilistic Predictable systems: Have systems that predict exactly what will happen. –Example: Using the mathematical model of the solar system to predict exactly when an eclipse will happen. Probabilistic systems: Have models that contain unpredictable features. –Example: Weather simulation programs combine multitudes of information from satellites and previously recorded data. Yet, weather systems have unpredictable features.
The Computer Continuum11-13 Building a Model n Models can also be characterized as having feedback versus non-feedback features. Feedback: A general term denoting the feeding back or recycling of actions or results of a model to itself. –An automobile driver system is a feedback type of system: Driver tries to avoid an object in the road »A turn away from the object is started. »Drivers eyes feed back information... If the turn is not sharp enough »Driver increases the turn »Drivers eyes feed back information...
The Computer Continuum11-14 Monopoly Game Simulation n Monopoly Simulation: Probabilistic: Controlled by random toss of dice or instructions given by randomly shuffled cards. Discrete: Dice or instructions both show exact number of steps to be taken. Feedback? –If players are involved, then yes there is feedback in the system. –If the system is defined not to include the players but only the dice tosses on the board, it does not have a feedback loop.
The Computer Continuum11-15 Monopoly Game Simulation n Monopoly Simulation: How can computers be used to simulate systems? A partial list of activities necessary to simulate the game of Monopoly: –Toss dice. –Move game pieces. –Allow real estate, hotel and house purchases. –Draw Chance or Community Chest card if necessary. –Toss second or third time if necessary. –Go to jail if doubles on third toss. –Collect $ upon passing GO. –Check for rent payment. –Keep records of each players assets (cash and real estate)...
The Computer Continuum11-16 Monopoly Game Simulation n To understand the process of writing a program to play Monopoly, look at part of the problem of getting out of jail... Start in Jail Count = 1 Wait Turn Wait Turn Out of Jail Move # Shown Roll Pay $50.00 Roll Use Get out of Jail free card Is Count > 2 ? Use Get out of Jail free card Pay $50.00 Doubles? Yes No Yes No
The Computer Continuum11-17 Monopoly Game Simulation n The probabilities for landing on the various squares in Monopoly: 1 Mediterranean St. James Place Pacific Community Chest Community Chest North Carolina Baltic Tennessee Community Chest Income Tax New York Pennsylvania Reading Railroad Free Parking Short Line Rail Oriental Kentucky Chance Chance Chance Park Place Vermont Indiana Luxury Tax Connecticut Illinois Boardwalk Just Visiting B&O Railroad Go Jail Possibilities St. Charles Place Atlantic J(1) Sent to Jail Electric Co Ventnor J(2) in Jail 2 Turns States Water Works J(3) in Jail 3 Turns Virginia Marvin Gardens Pennsylvania Rail Go to Jail
The Computer Continuum11-18 Monopoly Game Simulation n Calculating the return on investment, taking into account the probability of landing on that particular property: $1000 $2000
The Computer Continuum11-19 SimCity: Simulation for City Planning n SimCity: A game or simulation rich in details needed to do real city planning. Basic thesis: To build and run a city. Building Cities: (Problem Solving) –Zoning areas as Residential, Commercial or Industrial. –Building roads, rail systems, power and water facilities. –Taxing and appropriating funds. –Building police stations, fire stations, and hospitals. –Including educational institutions and libraries. –Adding zoos, parks and recreational areas. –Building marinas, airports, and seaports.
The Computer Continuum11-20 SimCity: Simulation for City Planning n Choices of power plants in the year 2026.
The Computer Continuum11-21 SimCity: Simulation for City Planning n Sims: The people who live in the simulation. People will stay in a city if they feel safe, taxes are reasonable, jobs are available, and services are provided. n City Planning must include replacement and repairs as needed. Power plants wear out. Roads need repair. As cities grow, increasing water system demand grows. Money needs to be coming in for services to be provided!
The Computer Continuum11-22 SimCity: Simulation for City Planning n The water system is under the city.
The Computer Continuum11-23 Design and Implementation of Computer Simulations n Five basic tasks to be performed in setting up a computer simulation: 1.Determine if the simulation is feasible. –Cost and other alternatives must be examined first. 2.Create a model to mimic the real situation. 3.Write a computer program that is based on the model. 4.Validate and verify that the program correctly represents the real-world system. –A model is verified or validated when it proves to be a reasonable representation of the system being simulated. 5.Experiment with the computer simulation to resolve the problem.
The Computer Continuum11-24 Design and Implementation of Computer Simulations n Programming languages used to create simulations: Can be written in any language including Visual BASIC, Smalltalk, C++, Pascal, etc. n For complex simulations, several simulation programs have been developed. Usually have a graphics orientation. One example is Extend: –Library-based simulation program. –Programmer can build libraries of icons that represent the behaviors of elements in the system being modeled.
The Computer Continuum11-25 Design and Implementation of Computer Simulations n The classic predator/prey problem as modeled in Extend:
The Computer Continuum11-26 Virtual Reality n Virtual Reality (Artificial reality): A situation in which an individual has a three-dimensional view into a world that doesnt exist except in the computer. Uses: –Industry and military train people in the use of complex systems. –Entertainment. Special equipment is necessary to experience the environment fabricated by the computer. –Can include visual images, smells, and touch.
The Computer Continuum11-27 Virtual Reality n Special equipment is necessary to experience the environment fabricated by the computer. Can include smells, and touch. Can include visual images using a headset, goggles, or a special environment. –Three approaches to this type of simulation: A computer creates a tiny video display in a headset. Special goggles are worn that will make 3D images appear. Create a room whose walls are video projections of scenes that are created alternately for the left eye, then the right eye.
The Computer Continuum11-28 Virtual Reality n CAVE Automatic Virtual Environment Physical environment: 10x10x9 room where 3 of the 4 walls and the floor are projection surfaces. Electronically controlled shutter glasses alternately allow projected images to appear to each eye.
The Computer Continuum11-29 Virtual Reality n Virtual Surgery: (Surgery project) Surgery training workstations with video monitor and hand manipulators. Surgeons practice various types of surgery. Can be used as a remote surgery facility. Surgeon connects via satellite to an operating room where robot- like devices at an operating room do the job.
The Computer Continuum11-30 Electronic Spreadsheets as Simulation Tools n Electronic spreadsheet application consists of rows/columns of cells that can contain numbers, text, and formulas. The next slides will display how spreadsheets are used in a: –Continuous simulation model. –Probabilistic simulation model. –Model with feedback.
The Computer Continuum11-31 Electronic Spreadsheets as Simulation Tools n Continuous Simulation Model Expres is a standard three- phase, dispersed-flow, black-oil, finite-difference reservoir simulator. Uses a spreadsheets macro capabilities to simulate oil well production. Expres Simulator web site…
The Computer Continuum11-32 Electronic Spreadsheets as Simulation Tools n Probabilistic Simulation Model Each time a probabilistic simulation is run, a different result will occur. This simulation uses a random number function to simulate a die toss.
The Computer Continuum11-33 Electronic Spreadsheets as Simulation Tools n Model with Feedback Deals with the issue of time. –Something happens that affects a reaction later. A widely used type of feedback is the what-if simulation. Example: Backpacking trip. If you only have 4 days and need 4 each of breakfasts, lunches, and dinners. What combinations can you make if you only have $45.00 to spend?