Day 5 - PowerPoint PPT Presentation

hunter-gray
day 5 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Day 5 PowerPoint Presentation
play fullscreen
1 / 16
Download Presentation
Day 5
91 Views
Download Presentation

Day 5

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Day 5 • Section 9 - Contiuous Simulation • Exercise 9 • Section 10 - Animation • Demonstration of SIMANIMATION • Exercise 10 F —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-1

  2. Section 10 - Animation Part 1 - Demonstration of SIMANIMATION —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-2

  3. SimAnimation's Concept - Toward Object Oriented Programming • Define an object with a process routine - say an airplane • Give it some characteristics - location, velocity • Attach routines for specific procedures - move to new location • Invoke routine by waiting —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-3

  4. Use Processes to Control Motion • Initial velocity, location • Wait some time to let object move • Change something, say velocity • Wait some more time for object to move again • Dynamic graphic process is a temporary entity with motion attributes added (i.e. Dynamic Graphic Entity) —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-4

  5. Some Definitions A viewing transformation connects the World View to the Viewport Everything else is clipped World View Viewing Transformation Universe Viewport —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-5

  6. Some Definitions (continued) • The universe is the space you're working in (miles) • A world view is that part of the universe you want to see on the screen at any given time -100 miles to +100 miles horizontally 25 miles to 75 miles vertically • A view port is that part of the screen containing the world view 0 to 20,000 NDC units horizontally 0 to 5,000 NDC units vertically —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-6

  7. Viewing Transformation Let vxform.v = 2 Call setworld.r (-100,100,25,75) Call setview.r (0,20000,0,5000) —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-7

  8. 1 Preamble 2 3 '' This shows a simple dynamic graphics output using SimAnimation. 4 '' It draws a shape and moves it around the screen. 5 '' CACI Products Company 6 7 Normally mode is undefined 8 9 Processes include 10 SHAPE 11 12 Dynamic graphic entities include 13 SHAPE 14 15 Define minutes to mean units 16 17 Define ..END.OF.PROGRAM to mean Call messagebox.r ("Click to end program!","End of Program") 18 19 End ''Preamble 1 Main 2 3 Call SET.GRAPHICS 4 Activate a SHAPE now 5 Show SHAPE with "ARROW" 6 7 Start simulation 8 9 End ''Main —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-8

  9. 1 Process SHAPE 2 3 Define .I as an integer variable 4 5 Let location.a(SHAPE) = location.f(0.0, 0.0) 6 7 Let velocity.a(SHAPE) = velocity.f(200.0, pi.c/4) 8 Let orientation.a(SHAPE) = pi.c/4 9 Wait 16 minutes 10 11 Let velocity.a(SHAPE) = velocity.f(200.0, - pi.c / 2) 12 Let orientation.a(SHAPE) = - pi.c /2 13 Wait 11.6 minutes 14 15 Let velocity.a(SHAPE) = velocity.f(200.0, 0.8 * pi.c) 16 For .I = 1 to 100 do 17 Add (pi.c / 10) to orientation.a(SHAPE) 18 Wait 0.1 minutes 19 Loop ''I = 1 to 100 do 20 21 Let velocity.a(SHAPE) = 0 22 23 ..END.OF.PROGRAM 24 25 End ''SHAPE —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-9

  10. 1 Routine SET.GRAPHICS 2 3 '' Set maximum speed to 1 second of real time per unit of simulated time 4 5 Let timescale.v = 100 6 7 '' Open a viewport 8 9 Let vxform.v = 5 10 Call setworld.r(0, 3277, 0, 2276) 11 Call setview.r (0, 32767, 0, 32755) 12 13 End ''SET.GRAPHICS —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-10

  11. Exercise 10 Approach to Runway C:\Program Files\Simscript3\models\Heathrow —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-11

  12. Heathrow Airport Reprise • As a final exercise in simulation and modeling, write a SIMSCRIPT II.5 program to animate the flight of an airplane on its approach to Heathrow airport. The checkpoints through which the airplane must pass are listed below. HEATHROW APPROACH CHECKPOINTS X Y -10 -1 (initial location) - 5 0 3 0 6 4 10 4 —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-12

  13. Preamble '' Heathrow Airpot Animation Problem - CACI Products Company '' Preliminary Code for Student Problem '' The user must create an icon representing an airplane and '' write a process to make the airplane move. '' files: HEATHROW.SRC, graphics.sg2 with lhw.icn & (user).icn Normally mode is undefined Temporary entities include MAP Graphic entities include MAP Define ..DISPLAY.VIEW.PORT to mean 2 Define minute to mean units Define minutes to mean units End ''Preamble Main Create a MAP Display MAP with "LHW.ICN" End ''Main —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-13

  14. Routine VECTOR Given .X1, ''Coordinates of first point .Y1, .X2, ''Coordinates of second point .Y2, .SPEED ''Speed of object Yielding .TIME, ''Time to go from first to second point .DIRECTION ''Direction from first to second point (radians) Define .X1, .Y1, .X2, .Y2, .SPEED, .TIME, .DIRECTION, .DELTA.X and .DELTA.Y as real variables Let .DELTA.X = .X2 - .X1 Let .DELTA.Y = .Y2 - .Y1 Let .TIME = sqrt.f(.DELTA.X ** 2 + .DELTA.Y ** 2) / .SPEED Let .DIRECTION = arctan.f(.DELTA.Y, .DELTA.X) End ''VECTOR —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-14

  15. Routine SET.GRAPHICS Let timescale.v = 100 '' Set up a display view port Let vxform.v = ..DISPLAY.VIEW.PORT Call setworld.r (-11, 11, -11, 11) Call setview.r (1000, 32000, 1000, 32000) End ''SET.GRAPHICS —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-15

  16. This page is intentionally blank —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 10-16