ENVIRONMENTAL SYSTEMS ENGINEERING ENVIRONMENTAL SYSTEMS ENGlNEERING by Henry R. Bungay Rensselaer Polytechnic Institute Troy, New York U. S.A. ~. " SPRINGER SCIENCE+BUSINESS MEDIA, LLC ISBN 978-1-4613-7516-6 ISBN 978-1-4615-5507-0 (eBook) DOI 10.1007/978-1-4615-5507-0 Library or Congress Cataloging-in-Poblication Data A C.I.P. Catalogue record for this book is available from the Ubrary of Congress. Copyright $1998 by Springer Science+Busmess Media New York Originally published by Kluwer Academic Publishers in 1998 Softcover reprint ofthe hardcover Ist edition 1998 All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, mechanical, photo-copying. recording. or otherwise. without the prior written permission of the publisher. Springer Science+Business Media, LLC. Printed an acid-free pap er. TABLE OFCONTENTS PREFACE ix 1. INTRODUCTION 1 Systemsengineering 2 Biologicalconcepts 4 Programmingforsystemsapplications 5 Oldreliablelanguages 5 Newerlanguages 6 Equationsolvers 7 2. SIMULATION 9 SIMBAS,SIMulationinBASic 11 Guideforwritingsimbasprograms 16 Dissolvedoxygensagcurve 21 Trickswithsimbas 25 3. PROCESS DYNAMICS 35 Dynamicanalysis 36 Forcingfunctions 38 Controllers 41 Distance-velocitylag 42 Templatesforgraphicaldesignoranalysis 45 Stability 50 Linearity 53 Open-andclosed-loopresponses 54 Bodediagramsinmatlab 55 Feedforwardcontrol 57 Programsfordynamicanalysis 57 4. DATABASES 61 Databasemanagement. 61 v Spreadsheets 63 Electronicdatabases 77 5. COMPUTER MODELS 83 Philosophy 83 Curvefitting 84 Growth-raterelationships 88 Clemsonmodelofactivatedsludge 92 Partialdifferentialequations 93 Plumemodelsforairpollution 100 Estuarinecontaminantsimulator 102 Fugacityapproach 103 Observers 104 Cellularautomatamodels 105 Conclusions 106 6. HYDRAULICNETWORKS 109 Networkprinciples 109 Pipenetworks 110 Morecomplicatednetworks 118 Softwareforprocesses 118 7. NEURALNETWORKS 121 Howmanyboxesandhiddenlayers? 122 Neuralalgorithms 124 Commercialshellsforneuralnetworks 125 Discussion , 133 Bioprocessmonitoringandcontrol... 133 Publicdomainprograms 134 vi 8. EXPERTSySTEMS 139 Commonexpertsystems 141 Advancedfeaturesofexpertsystems 144 Commercialprogramsforexpertsystems 145 Applications 149 9. FUZZYLOGIC 155 Fuzzyoperations 155 Fuzzytruth 158 Fuzzycontrollers 162 Fuzzyapproachestostateestimation 170 Alittlemoretheory 171 10. STATISTICALAPPROACHES 173 Definitions 174 Distributions 175 Processperformance 180 Statisticalfeaturesofspreadsheets 184 Timeseriesanalysis 186 Extremevalueproblems 188 Independentvariables 190 Optimization 190 APPENDICES A. RUNNING DOS PROGRAMS 193 B. INTRODUCTIONTOASPREADSHEET.. 197 C. MATLABPIPENETWORKPROGRAM 201 vii PREFACE Systems engineering is a key for advances in process analysis, development, improvement, and control. While the principles of mass and energy balances, kinetics, thermodynamics, and sciences are absolutely essential for sound engineering,theyareanentryintonewermethodsthatalsomustbeintherepertoire ofmodemengineers. This bookorganizes material used at Rensselaer Polytechnic Institute in a introductory course environmental systems engineering that has been taught for several years. Initially aimed at environmental engineers, its scope has been broadened to include more chemical engineering. Each ofthe topics is often treated byitselfin books orseparatecourses, socoverage here is greatly restricted. Nevertheless,eachtopic isexplained with problemsand computerprogramssothat practicalapplicationsarepossible. There isalways thedangerofmisuse becauseof incomplete understanding, and further study beyond this book is highly recommended. The teaching of environmental systems engineering at Rensselaer Polytechnic Institute is changing because of the World Wide Web (web). The computerized tutorials written in BASIC that have been effective in the past seem ancient to students who have grown up playing computer games with exceptionally fine graphics. As time permits,ourcomputerexercises are being translated to Javaand JavaScriptas interactivehypertextpresentationonthe web. Our goal is to makeas muchuseaspossibleofthefollowing featuresofHypertext: *Ahome pagereachedeasilyfrom the otherpages helps the reader to get backon trackwhenlostinthenooksandcranniesofthepresentation. * Study guides package web presentations into logical sequences and group materialsforeachassignment. Eachguideisaspecializedhomepage. ix x Preface *Citationsare"hotwords," andamouseclickinvokesexactlythatreference. *Layered presentationsofequationsprovide bothacursoryand detailedderivation andagrosslyoversimplifiedtreatmentforanyone withweakmath. * Each assay procedure has an index page with entries for the techniques themselves, evaluations and tips lifted from Ph.D. or M.S. theses, lists of equipment,and namesofvendors. * A glossary is accessed by key words on various pages and take the reader to exactlythatentryintheglossary. Linkstootherpagescanmaintainthe logicalthreadorcan branch. Forexample,an introductory page links to moreadvanced material, and these more advanced pages have hot words that bring up pages with explanations. The glossary and the literature citations need no links because the Back feature ofthe browser software puts you right back where you were. This is more sensible than scrolling to find yourplacewhenanaddressinvokesthetopofthepage. The number offiles on the web that relate to environmentlil engineering increases daily, and any documentabout them is soon out ofdate. However, our home page on the web is updated frequently. It has links to other archives throughout the world. The starting page has the Internet address http://www.rpi.edu/dept/chem eng!hypertext.html During this transition period when not everyone has access to the web, this book retains the tutorial exercises that have been superseded by the web exercises. Computersnotconnectedtothe webcanstill installthe browsersoftwareand direct it to files on a disk. Working from a disk avoids Internet delays and usually has much faster response. Youcan have a friend with Internetaccessdownload files to adisk for you, or you can requestdisks from the authorat H. Bungay, Department ofChemical Engineering, Rensselaer Polytechnic Institute, Troy, NY 12180-3590. When moved to the harddrive ofa personalcomputerthat hasa web browser, files from the web pop into your browser almost instantly. The software for Internet browsers has versions for Windows, Macintosh, Unix, Commodore Amiga, and otheroperatingsystems. Publicdomain versionsare widelyavailable from Internet archives, and there are commercial browsers. While it is not difficult to find and install the public domain browser software, the commercial software has better instructions. This book offers no advice about installation because most students will use the system at their institution and only a few will need to configure their personalcomputers. Except for the hypertext presentations for any computer that has the web browser software, most of the programs that you can download from our archive are for MSIDOS because they will also execute in newer operating systems. Modem operatingsystemsoffermorespeed, windows,and convenience, butworking within the limitationsofMSIDOS does not impair presentation ofthe concepts covered in EnvironmentalSystemsEngineering xi thebook. The programscomefromavarietyofsourcesand are writtenindifferent languages. Some public domain programs and some templates for commercial or proprietaryprogramsareinourarchivefordownloading. Whileitis notpracticalto distribute computer materials not in the public domain, sources are described in sufficient detail that the reader should have no difficulty in ordering them. Wheneverpossible, theassignmentsinthisbookarenotspecificto onecommercial program, but the solutions are shown for one designated program. Most of the source files are in ASCII format that should be accepted readily by otheroperating systems. Authorsofthe programsarecredited within the programs themselves and notinthisbook. NEWANDUPDATEDPROGRAMS Anyone on the Internet that connects universities, government laboratories, and many commercial organizations can use e-mail to get help with the programs or suggest improvements by contacting [email protected]. Our web archive has the latest versions of the programs in compressed groups for downloading. Our RPI. archive for FrP is no longer tended regularly because of our preoccupation with browsersoftwarefortheweb. Downloadingwitha webbrowser While viewing a page with your browser, simply pull down the File menu to click on SaveAs. Arequester will appearfor youto type in where you wish tosavethe file thatproducedthispage. Linksto files for downloading will also invokea requesterasking you where to put the file. It is recommended that you put compressed files into a temporary directory, unsqueeze them, and move the resulting files to a different directory. Thispermitsscreeningandorganizing. FrPtransfers Instructionsvaryalittlefor variouscomputercenters, butthe mainideaisto invoke the FrP system and to type in the electronic address. You move to the desired directoryand find thefile thatyou want. The file maybe ASCIIorbinary,and you will get gibberish if you download a binary file with your option set for ASCII. Often the programs are compressed to save storage space. This saves time for transmission, but you must have a program for unsqueezing them. These are ubiquitous, and a few phone calls to your knowledgeable friends will locate whateveryou need. Youdotheunsqueezingrightonyourpersonalcomputer. The steps are as follows: use your personal computer, modem, and communication software to connect to your computer center (many people are already connected throughaterminalonthe system);entertheaccountnumberand password assigned to you by your center; invoke the FrP program; type in the electronic address; the distantsystemshouldrespond that you areconnected and will ask for your account number. You seldomhavean account on aremote computer, so you type in either upper or lower case ANONYMOUS as your account and your e-mail address (or GUEST) as your password. The system should respond that you are admitted but that some restrictions apply. You must then move to the directory or subdirectory that has the programs. Commands that you need over and over are cd (change directory) and Is(listthe files). Ifadisk full ofprograms has beendeposited in the xii Preface collection. you may have to download them as one large file. Usually this is possible. buttherearealso the individualfiles. Thedownloading maybevery fast forasingle file and abouttenseconds (onagoodday withadirect link) for the file representing an entire disk. The names are case-specific; you must type caps or lowercase namesexactlyas shown. Youcandownload to yourpersonal computer or to your account at your computer center. It is faster to save to your account because the long-distance transmission through a modem can require many retransmissions when a noisy phone line corrupts some sections of the transfer. Each segmentis checked and sentagain iferrors are found. Local phone lines are less likely to be noisy when you transfer from your account to your personal computer. Beware of space requirements. Your account may not have room for programsequivalenttoanentirefloppydisk. and youmustrequestadditionalspace. Downloading from your computer center to your personal computer through the phone lines is relatively slow. When it finally is on your computer. you usually havetounsqueezethedownloadedmaterial. All of our programs are free for downloading from the RPI computer center. Downloadingwhilebrowsingthewebiseasiest,butFTPmaybemoreconvenientif you do not know how to get images. The address for the old BASIC programs is FfP.RPI.EDU,and thedirectoryisPUB/faculty/bungay. The webaddressescanbe seen on the screen of your browser. Most files are in ASCII format and are not compressed. Programs change from time to time to fix bugs and to improve them. Browsingthe webisthebestupdatingserviceforourprograms. Forcustomerswho don't wantto workwith modemsand withprograms for using them, you can send aformatted disk withreturnpostage to the authorevery yearor so for free updates. This free service is available to persons who have purchased the book; others are expectedto includean additional $5 overthe costofpostage. Besure to label your disk with your name and the Macintosh or PC-compatible format desired (several files that work with commercial programs for Windows have no Macintosh equivalent).