You are here

An Animation of Distillation Part IV The Falling Drop

Author(s): 

Victor Bendall
Eastern Kentucky University

Note: This article was scanned using OCR from the Winter 1989 CCCE Newsletter. Please contact us if you identify any OCR errors.
 
In this part of our series on the animation of a distillation I shall discuss the display of a drop of liquid falling and adding into a liquid pool. The coding will be designed to integrate with the stirrer and flame animations of the earlier parts. This animation is a more ambitious task than the earlier routines and will rely more heavily on the internal CHEMUTIL-2 (1) routines.
 
The figure 1 shows the essentials of the animation and illustrates some of the terms used. A drop will appear to fall from location TOPDRP to location BOTDRP, then a transient splash will appear and the liquid pool can increase by drawing a line at LIQY. The Topmost image of a drop will be displayed at TOPDRP so we first define that in terms of VTAB and HTAB. Earlier we displayed flame and stirrer by defining new characters and printing them with the CHEMUTIL-2 character generator. It is conven ient to do the same for the falling drop. Two new characters are de fined using CHARACTER (2) and stored in character set 2 immedi-ately following the previously de-fined stirre~ representations at $73D0-$73DF. The simplest way to do that is to BLOAD CHEMUTIL-2 or better the modified version after running Listing 1 of Part II of this series. Next in order CALL -151 : type 7300 : 00 1 C 08 00 00 00 00 00 00 00 00 1 C 1 C 08 00 : CTRL C : RETURN : BSAVE CHEMUTIL-2, A $6000, L$1 COO. You will now have saved the modified CHEMUTIL-2 to disk with two representationd of the same drop as ASCII (90) and ASCII (91) in ·Character set 2. If the second image is rapidly printed over the first, the illusion of a falling drop will result. 
 
It was most convenient to display images of flame, stirrer and the drop using the character gen-erator. The splash cannot be done conveniently in the same manner. The reason is that a character can be displayed only at one of the saeen locations defined by VTAB (0-23)* and HTAB (0-39) but the splash must appear to be at the surface of the pool and the Y-coordinate (LIQY)
can have values from Q-191. Splash is done by directly poking values into appropriate bytes of screen memory. The Y-coordinate and HT AB are used together to find the corresponding screen memory . address. There is a ·routine in CHEMUTIL-2 which does that using look-up tables. Into each of three screen memory bytes located verti .. cally above one another is poked 
numerical values which result in the · splash representa1ion appearing on the monitor. The same three bytes are then set to zero and the splash representation is blanked out. These operations are very fast and a delay has to be introduced between draw-ing the splash and erasing it.
 
Every time the liquid pool inaeases by eight vertical bytes, the value of BOTDRP VTAB must be decreased by one or the bottom drop will blank. some of the liquid. This means that the distance be-tween the topmost drop and the liquid level decreases and so does the total.number of crop images to be displayed. When TOPDRP = BOTDRP only one or two drop im-ages will be shown. In our coding we cannot allow the liquid level to rise above TOPDRP or, if it does, the dropping routine must be by-passed at that time. 
 
 
As in our earlier routines we allow for stopping the routine by pressing the S-key at the keyboard and the delay loops are introduced to control the speed of the anima-tion. The delays are inserted to .control how long a given image remains on the screen; in this. case, while the crop or splash representa-tion is on the screen. the delays are here because we expect that the flame and stirrer animations will have to be activated while drops are fall-ing in the full distillation animation. There is more than one delay be-cause we may need to have flame 
and s1irrer alternate between falling drops or have. one appear while a drop is being displayed and the other appear while a drop is being blanked out.
 
With three places where the timing of the animation can be tuned it would seem that ample provision for adjustments has been made. If the program given below is exe-cuted you should see a series of falling drops which periodically cause the liquid level to rise. However, the apparent speed of the drop will in-crease as the eight lines of liquid are drawn. This occurs because fewer . drops are c.tawn as the distance be-tween TOPDRP and BOTDRP de-creases. There is proportionately less for each prgram loop 1o do between successive splashes and the animation speeds up. To allow for this effect one or more of the delay intervals would have to be adjusted every eighth time the liquid level is incremented. This adjust-ment is left as an exercise for the reader. Beca
 
 
Because of the way the coding was structured, it is easy to make min~ changes. For example, you may wish to simulate an appa-ratus at reflux by having the drop splash but not have the liquid pool increases. You need to eliminate the LIQDRAW routines by poke '• 31962 ($7CDA), 96. To eliminate the splash yo~ should poke 32042 ($D2A), 96.
 
*This statement is not quite correct since CHEMUTIL-2 easily allows super and subscripted characters which effectively doubles the number of vertical locations available. Indeed, more sophisticated CHEMUTIL-2 users can make the character generator access all the vertical coordinate locations. 
 
(1) Bendall, V. "CHEMUTIL-2, A Chemistry Programming Utility,; Project SERAPHIM, NSF Science Education; Department of Chemistry, Eastern Michigan University, Ypsilanti, Ml 48197, 1985. 
 
(2) Bendaii,V. "CHHARACTEA,; Project SERAPHIM, NSF Science Education; Department of Chemis-try, Eastern Michigan University, Yp-silanti, Ml 48197, 1985. 

 

Date: 
01/05/89 to 01/09/89