1 / 14

Day 5

Day 5. Section 9 - Continuous Simulation Exercise 9 Section 10 - Animation Demonstration of SIMANIMATION Exercise 10. F. Exercise 9. Missile Flight C:Program FilesSimscript3modelsMISSILE. Missile Flight Problem. Angle. Y. X. Continuous Simulation.

clover
Download Presentation

Day 5

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Exercise 9 Missile Flight C:\Program Files\Simscript3\models\MISSILE —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-2

  3. Missile Flight Problem Angle Y X —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-3

  4. Continuous Simulation • Given an equation for the rate of change of a variable, calculate the value of the variable continuously d(angle) = -.1 (radians/sec) dt dx = speed * cos(angle) dt dy = speed * sin(angle) dt —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-4

  5. Continuous Simulation (continued) Preamble Processes include Every MISSILE has an X, a Y, a SPEED, an ANGLE Define X,Y,ANGLE as continuous real variables Define QUIT as an integer function End ''Preamble Process MISSILE Work continuously evaluating 'EQUATIONS' testing 'QUIT' End ''MISSILE —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-5

  6. Continuous Simulation (continued) Routine EQUATIONS Given .MSL Let D.ANGLE(.MSL) = -.1 ''radians/second Let D.X(.MSL) = SPEED(.MSL) * cos.f(ANGLE(.MSL)) Let D.Y(.MSL) = SPEED(.MSL) * sin.f(ANGLE(.MSL)) End ''EQUATIONS Function QUIT If time.v > 5 ''seconds Return with 1 Endif ''time.v > 5 Return with 0 End ''QUIT —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-6

  7. 1 Preamble 2 3 '' Sample continuous simulation program 4 '' CACI Products Company, 703-875-2919 5 6 Normally mode is undefined 7 8 Processes include 9 REPORT 10 11 Every MISSILE has 12 an MSL.X, 13 a MSL.Y, 14 a MSL.SPEED, 15 an MSL.ANGLE and 16 a MSL.PITCH.RATE 17 18 Define MSL.PITCH.RATE as a real variable 19 20 Define MSL.X, 21 MSL.Y, 22 MSL.SPEED and 23 MSL.ANGLE 24 as continuous real variables 25 26 Define PITCH.OVER and 27 FLIGHT.TIME 28 as integer functions 29 30 Define seconds to mean units 31 Define second to mean units 32 33 End ''Preamble —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-7

  8. 1 Main 2 3 Open unit 10 for input, name = "MISSILE.DAT" 4 Use unit 10 for input 5 6 ''Defaults 7 Read max.step.v, ''.1 8 min.step.v, ''.01 9 abs.err.v and ''.0001 10 rel.err.v ''.01 11 12 Close unit 10 13 14 Activate a MISSILE now 15 Activate a REPORT now 16 17 Start simulation 18 19 End ''Main 1 Process MISSILE 2 3 Let MSL.SPEED(MISSILE) = 500 ''feet per second 4 Let MSL.ANGLE(MISSILE) = pi.c / 4 ''radians 5 6 Work continuously evaluating 'FLIGHT' testing 'PITCH.OVER' 7 8 Let MSL.PITCH.RATE(MISSILE) = - 0.1 ''radians per second 9 Work continuously evaluating 'FLIGHT' testing 'FLIGHT.TIME' 10 11 Suspend 12 13 End ''MISSILE —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-8

  9. 1 Routine FLIGHT 2 3 Given 4 .MSL ''Pointer to missile process notice 5 6 Define .MSL as a pointer variable 7 8 Let D.MSL.ANGLE(.MSL) = MSL.PITCH.RATE(.MSL) 9 Let D.MSL.X(.MSL) = MSL.SPEED(.MSL) * cos.f(MSL.ANGLE(.MSL)) 10 Let D.MSL.Y(.MSL) = MSL.SPEED(.MSL) * sin.f(MSL.ANGLE(.MSL)) 11 12 End ''FLIGHT 1 Function PITCH.OVER 2 Given 3 .MSL ''Pointer to missile process notice 4 5 Define .MSL as a pointer variable 6 7 Let .MSL = .MSL 8 9 If time.v > 5 ''seconds 10 Return with 1 ''End integration 11 Endif ''time.v > 5 seconds 12 13 Return with 0 ''Continue integration 14 15 End ''PITCH.OVER —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-9

  10. 1 Function FLIGHT.TIME 2 3 Given 4 .MSL ''Pointer to missile process notice 5 6 Define .MSL as a pointer variable 7 8 If MSL.ANGLE(.MSL) < -pi.c / 4 9 Return with 1 ''Pitch over is complete 10 Endif ''MSL.ANGLE(.MSL) < -pi.c / 4 11 12 Return with 0 ''Continue simulation 13 14 End ''FLIGHT.TIME —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-10

  11. 1 Process REPORT 2 3 Define .TERMINAL.MSL.ANGLE as a real variable 4 5 Let .TERMINAL.MSL.ANGLE = - pi.c / 4 6 7 Print 3 lines thus Time MSL.X MSL.Y Angle ---- ----- ----- ----- 11 Use unit 6 for output 12 Until MSL.ANGLE(MISSILE) <= .TERMINAL.MSL.ANGLE do 13 14 Print 1 line with time.v, 15 MSL.X(MISSILE), 16 MSL.Y(MISSILE), 17 MSL.ANGLE(MISSILE) * radian.c thus ** **** **** **.* 19 20 Wait 1 second 21 22 Loop ''MSL.ANGLE(MISSILE) > = .TERMINAL.MSL.ANGLE do 23 24 Read as / using unit 5 25 26 Stop 27 28 End ''REPORT —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-11

  12. Values of Runge-Kutta parameters: .1, .1, .1, .1 Time MSL.X MSL.Y Angle ---- ----- ----- ----- 0 0 0 0. 1 315 315 45.0 2 633 633 45.0 3 952 952 45.0 4 1270 1270 45.0 5 1588 1588 45.0 6 1938 1909 39.9 7 2295 2182 34.7 8 2676 2422 29.6 9 3077 2626 24.4 10 3495 2793 19.3 11 3925 2922 14.1 12 4366 3012 9.0 13 4813 3062 3.8 14 5263 3072 -1.4 15 5712 3041 -6.5 16 6156 2970 -11.7 17 6592 2859 -16.8 18 7016 2709 -22.0 19 7425 2522 -27.1 20 7816 2299 -32.3 21 8185 2042 -37.5 22 8530 1753 -42.6 —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-12

  13. Values of Runge-Kutta parameters: .1, .01, .0001, .01 Time MSL.X MSL.Y Angle ---- ----- ----- ----- 0 0 0 0. 1 353 353 45.0 2 707 707 45.0 3 1060 1060 45.0 4 1414 1414 45.0 5 1767 1767 45.0 6 2138 2103 39.3 7 2540 2400 33.6 8 2969 2656 27.9 9 3422 2867 22.2 10 3894 3033 16.4 11 4379 3150 10.7 12 4875 3218 5.0 13 5374 3236 -.8 14 5873 3205 -6.5 15 6366 3123 -12.2 16 6849 2993 -17.9 17 7316 2816 -23.7 18 7763 2592 -29.4 19 8185 2326 -35.1 20 8579 2018 -40.9 —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-13

  14. This page is intentionally blank —————————— CACI Products Company —————————————————————————————— SimScript II.5 —————————————— 9-14

More Related