Transcript Document
Intro to Simulation and Virtual Reality CE00166-1 Animation v Simulation Week 3 What is simulation? Simulation is Designing, Implementing, Running, and Using either Models or Software to represent systems Simulation is Used To gain insights into the system To predict what a system will do For Education and Training When it is “better” than using the system Some Examples Flight and Traffic simulators Simulation of Slow Processes or New Designs Simulations to drive Animations Monte Carlo Simulation Monte Carlo simulation How did Monte Carlo simulation get its name? Monte Carlo simulation was named for Monte Carlo, Monaco, where the primary attractions are casinos containing games of chance. Games of chance such as roulette wheels, dice, and slot machines, exhibit random behaviour. The random behaviour in games of chance is similar to how Monte Carlo simulation selects variable values at random to simulate a model. When you roll a die, you know that either a 1, 2, 3, 4, 5, or 6 will come up, but you don't know which for any particular roll. It's the same with the variables that have a known range of values but an uncertain value for any particular time or event (e.g. interest rates, staffing needs, stock prices, inventory, phone calls per minute). Technical Attractions of Simulation Ability to compress time, expand time Ability to control sources of variation Avoids errors in measurement Ability to stop and review Ability to restore system state Facilitates replication Modeler can control level of detail Ways To Study A System Introduction What is discrete-event simulation? Modeling, simulating, and analyzing systems Computational and mathematical techniques Model: construct a conceptual framework that describes a system Simulate: perform experiments using computer implementation of the model Analyze: draw conclusions from output that assist in decision making process Characterizing a Model Deterministic or Stochastic Static or Dynamic Does the model contain stochastic components? Randomness is easy to add to a DES Is time a significant variable? Continuous or Discrete Does the system state evolve continuously or only at discrete points in time? Continuous: classical mechanics Discrete: queuing, inventory, machine shop models Definitions Discrete-Event Simulation Model Stochastic: some state variables are random Dynamic: time evolution is important Discrete-Event: significant changes occur at discrete time instances Monte Carlo Simulation Model Stochastic Static: time evolution is not important Model Taxonomy DES Model Development Algorithm 1.1 — How to develop a model: 1) 2) 3) 4) 5) 6) Determine the goals and objectives Build a conceptual model Convert into a specification model Convert into a computational model Verify Validate Typically an iterative process Three Model Levels Conceptual Specification Very high level How comprehensive should the model be? What are the state variables, which are dynamic, and which are important? On paper May involve equations, pseudocode, etc. How will the model receive input? Computational A computer program General-purpose PL or simulation language? Verification vs. Validation Verification Validation Computational model should be consistent with specification model Did we build the model right? Computational model should be consistent with the system being analyzed Did we build the right model? Can an expert distinguish simulation output from system output? Interactive graphics can prove valuable A Machine Shop Model 150 identical machines: Service technician(s): Operate continuously, 8 hr/day, 250 days/yr Operate independently Repaired in the order of failure Income: £20/hr of operation 2-year contract at £52,000/yr Each works 230 8-hr days/yr How many service technicians should be hired? System Diagram Algorithm Applied 1) Goals and Objectives: — — 2) Conceptual Model: — — — 3) Find number of technicians for max profit Extremes: one techie, one techie per machine State of each machine (failed, operational) State of each techie (busy, idle) Provides a high-level description of the system at any time Specification Model: — — — What is known about time between failures? What is the distribution of the repair times? How will time evolution be simulated? Algorithm Applied 4) Computational Model: — — — 5) Verify: — — 6) Simulation clock data structure Queue of failed machines Queue of available techies Software engineering activity Usually done via extensive testing Validate: — — — Is the computational model a good approximation of the actual machine shop? If operational, compare against the real thing Otherwise, use consistency checks Graphics = algorithms for visual simulation What would we have to model/simulate ? models of shape -- need to be deformable [skeleton, skin] lighting (shadows) physical motion light bending by lenses (refraction) surface texture controlling/specifying motion perspective depth of field camera model / camera control sound effects & music story Physics Simulation Particles Rigid bodies Collisions, contact, stacking, rolling, sliding Articulated bodies Hinges, constraints Deformable bodies (solid mechanics) Elasticity, plasticity, viscosity Fracture Cloth Fluid dynamics Fluid flow (liquids & gasses) Combustion (fire, smoke, explosions…) Phase changes (melting, freezing, boiling…) Vehicle dynamics Cars, boats, airplanes, helicopters, motorcycles… Character dynamics Body motion, skin & muscle, hair, clothing Computer Animation What is Animation? Make objects change over time according to scripted actions What is Simulation? Predict how objects change over time according to physical laws or behavioral analysis Principle of Traditional Animation – Disney – Squash and Stretch Slow In and Out Anticipation Exaggeration Follow Through and Overlapping Action Timing Staging Straight Ahead Action and Pose-to-Pose Action Arcs Secondary Action Appeal Squash and Stretch Slow In and Out Anticipation Principle of Traditional Animation – Disney – Squash and Stretch Slow In and Out Anticipation Exaggeration Follow Through and Overlapping Action Timing Staging Straight Ahead Action and Pose-to-Pose Action Arcs Secondary Action Appeal Computer Animation Animation Pipeline 3D modeling Motion specification Motion simulation Shading, lighting, & rendering Postprocessing Keyframe Animation Define Character Poses at Specific Time Steps Called “Keyframes” Keyframe Animation Interpolate Variables Describing Keyframes to Determine Poses for Character in between Inbetweening Linear Interpolation Usually not enough continuity Inbetweening Spline Interpolation Maybe good enough Inbetweening Cubic Spline Interpolation Maybe good enough May not follow physical laws !! Summary Simulation is… Animation is… Graphics is a simulation Animation Requires ... Modeling Scripting Inbetweening Lighting, shading Rendering Image processing