home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p115 / 10.ddi / GCD4 / UPL / VENTURI.UPL < prev   
Encoding:
Text File  |  1988-06-01  |  2.7 KB  |  94 lines

  1. -----------------------------------------------------------------------------
  2. --VENTURI.UPL
  3. -- Venturi Nozzle Program
  4. --   User is prompted for the 1) entry diameter, 2) throat diameter,
  5. --  and 3) exit diameter.
  6. --   System will draw a sectional outline with the middle of the entry 
  7. --  opening at the origin.
  8. -----------------------------------------------------------------------------
  9.  
  10. PROC MAIN
  11.  
  12.     REAL NOZZLE_LENGTH    --Length of venturi nozzle
  13.     REAL OPEN_DIAM         --The opening diameter of venturi
  14.     REAL THROAT_DIAM    --Throat diameter of venturi
  15.     REAL OPEN_ANGLE        --Exit diameter of venturi
  16. --These points are used for drawing the upper and lower profiles of the nozzle
  17.     COORD POINT1, POINT2, POINT3     --upper profile data points
  18.     COORD POINT4, POINT5, POINT6    --lower profile data points
  19.  
  20. --start of executable code
  21.  
  22.     PRINT 'VENTURI NOZZLE PROGRAM. Enter the following values:'
  23.  
  24.     LOOP
  25.         ACCEPT NOZZLE_LENGTH PROMPT('   Nozzle length: ') NEWLINE
  26.         EXIT WHEN (NOZZLE_LENGTH => 0.0 AND NOZZLE_LENGTH <= 10.0)
  27.         PRINT 'Nozzle length must be between 0.0 and 10.0'
  28.     END LOOP
  29.  
  30.     LOOP
  31.         ACCEPT OPEN_DIAM PROMPT('   Opening diameter: ') NEWLINE
  32.         EXIT WHEN (OPEN_DIAM => 0.0 AND OPEN_DIAM <= 5.0)
  33.         PRINT 'Opening diameter must be between 0.0 and 5.0'
  34.     END LOOP
  35.  
  36.  
  37.     LOOP
  38.         ACCEPT THROAT_DIAM PROMPT('   Throat diameter: ') NEWLINE
  39.         EXIT WHEN (THROAT_DIAM => 0.0 AND THROAT_DIAM <= 5.0)
  40.         PRINT 'Throat diameter must be between 0.0 and 5.0'
  41.     END LOOP
  42.  
  43.     LOOP
  44.         ACCEPT OPEN_ANGLE PROMPT('   Opening angle: ') NEWLINE
  45.         EXIT WHEN (OPEN_ANGLE => 0.0 AND OPEN_ANGLE <= 90.0)
  46.         PRINT 'Opening angle must be between 0.0 and 90.0'
  47.     END LOOP
  48.  
  49.     --Calculate points on the nozzle outline's upper profile
  50.     POINT1.X = 0.0
  51.     POINT1.Y =  OPEN_DIAM/2.0
  52.     POINT1.Z =  0.0
  53.  
  54.     POINT2.X = TAN(DEGRAD(OPEN_ANGLE))*((OPEN_DIAM-THROAT_DIAM)/2.0)
  55.     POINT2.Y = THROAT_DIAM/2.0
  56.     POINT2.Z = 0.0
  57.  
  58.     POINT3.X = NOZZLE_LENGTH
  59.     POINT3.Y = OPEN_DIAM/2.0
  60.     POINT3.Z = 0.0
  61.  
  62.     --Calculate points on the nozzle outline's upper profile
  63.     --These are the mirror image about the x-axis so we negate 
  64.     --the y-component of each point.
  65.     POINT4.X = POINT1.X
  66.     POINT4.Y = -POINT1.Y
  67.     POINT4.Z = POINT1.Z
  68.  
  69.     POINT5.X = POINT2.X
  70.     POINT5.Y = -POINT2.Y
  71.     POINT5.Z = POINT2.Z
  72.  
  73.     POINT6.X = POINT3.X
  74.     POINT6.Y = -POINT3.Y
  75.     POINT6.Z = POINT3.Z
  76.  
  77.     --Now draw the nozzle
  78.  
  79.     ECHO OFF
  80.     SEND
  81.     SEND 'INS LIN: ',DIGSTR(POINT1), ',', DIGSTR(POINT2), ',', 
  82.     SEND DIGSTR(POINT3), ',', DIGSTR(POINT1)
  83.     SEND 'INS LIN: ',DIGSTR(POINT4), ',', DIGSTR(POINT5), ',', 
  84.     SEND DIGSTR(POINT6), ',', DIGSTR(POINT4)
  85.     SEND 'SEL COLOR 15'
  86.     SEND 'INS LIN FONT 3: X-1,IX',NOZZLE_LENGTH+2.0
  87.     SEND 'REPA'
  88.     SEND 'ZOOM ALL'
  89.     SEND 'SEL COLOR 12'
  90.     ECHO ON
  91.  
  92. END PROC
  93.  
  94.