0% found this document useful (0 votes)
209 views9 pages

Performing Metallurgical Calculations On Computerized Spreadsheets

This document discusses best practices for performing engineering calculations using spreadsheets. It recommends laying out spreadsheets in a step-by-step and readable format, including headings, manually set input cells distinguished from calculated cells, and using flowsheets to depict process diagrams and guide calculations. It also describes concepts of iteration, backward chaining, and convergence that are important for complex calculations involving circular references to properly resolve values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
209 views9 pages

Performing Metallurgical Calculations On Computerized Spreadsheets

This document discusses best practices for performing engineering calculations using spreadsheets. It recommends laying out spreadsheets in a step-by-step and readable format, including headings, manually set input cells distinguished from calculated cells, and using flowsheets to depict process diagrams and guide calculations. It also describes concepts of iteration, backward chaining, and convergence that are important for complex calculations involving circular references to properly resolve values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

PerformingMetallurgicalCalculationsonComputerizedSpreadsheets

AlexDoll,P.Eng
http://www.agdconsulting.ca

April3,2000

Abstract
Computerizedspreadsheetsareacommonlyusedtoolintheengineeringindustry.Unfortunately,theyareaverygenerictool,anddo
requirecarewhenusedtoperformprocessengineeringcalculations.Thispaperdescribesmanytoolsandtricksdevelopedinthe
consultingengineeringindustrytomakecalculationsmorereadableandtoperformqualityassurance.

Introduction
Spreadsheetsareaclassofcomputerprogramthatisusedtoperformalargenumberofsimplecalculations.Spreadsheetswereoneof
thefirstclassesofcomputerprogramsdevelopedtooperateonpersonalcomputers,andtheyarestandardequipmentintheofficesuites
offeredbythemajorPCsoftwarecompanies.
Thispaperdescribesanumberofconceptsthatwillmakeprocessengineeringcalculationsperformedonspreadsheetsmorereadable
andlesspronetoerror.Itisassumedthatthereaderisfamiliarwithspreadsheetsandisalreadyabletocreatemoderatelycomplex
calculations.Itisalsoassumedthatthereaderisfamiliarwithprocessengineeringconceptslikematerialbalancesandunitoperations.
ThespreadsheetformulasandnotationsusedthroughoutthispaperarebasedontheLotus123spreadsheetprogram.Mostother
spreadsheetpackageswillhavesimilarfunctionsandsyntax.Thereaderisencouragedtoconsultthedocumentationforhisparticular
softwaretodeterminetheexactformulaandsyntaxtouse.

SpreadsheetConcepts
Thelayoutandorganizationofaspreadsheetbasedcalculationhasahugeeffectonitsoverallusefulness.Manypeoplebuild
spreadsheetswithlittlecareorattentiontolayoutsanddiagramsunderthemistakenassumptionthatthelayoutdoesnotaffectthe
underlyingnumbersandformulas.Sadly,thehumansusingthesecalculationsaresimplemindedcreaturesandseeminglyirrelevant
thingslikelayoutsanddiagramsdomakealargedifferencetothecomprehensionofwhatisbeingcommunicated.
Acalculation,computerizedorotherwise,isreallyapieceofcommunicationbetweentwoormorepeople.Manyengineersareunaware
thattheirscribblesandspreadsheetsoftenneedtobecheckedintheprocessofdesigningafacility,orthatthesedocumentsmayendup
asevidenceincourtifsomethinggoeswrong.Thisisthekeyreasonwhyreadabilityandtransparencyofmethodsusedinacalculation
areabsolutelycriticaltothesuccessofacalculationineffectivelycommunicatingtootherengineersthetrueintentionsandconclusions
oftheauthor.

Readability
Layingoutthespreadsheetinasimple,stepbystepfashionwillmakeobviouswhatwasintendedandoftenassistsdeterminingwhen
somethingiswrong.Printoutsofspreadsheetcalculationsmustalsobelaidoutsothatanotherreasonablycapableengineercan
understandthemethodsofthecalculationandperformmanualcheckswithouthavingthedigitalspreadsheetfile.Spreadsheetcalcs
shouldcontainalltheelementsofhandcalcsincluding,wherereasonable,thegradualreductionofacomplexexpressionintoasimpler
one.
Spreadsheetsthatarelaidoutpoorlycanobscuresmallerrors.Forexample,ifacellcontainsthreeoperationsnestedtogether,thenall
theuserwillseeontheprintoutisasinglevalue.
@SUM(0.15*@AVG(A2..A5),0.15*@AVG(B2..B5))
Inthisexample,the0.15representsaninterestratebutbecausetherateishiddeninsidetheformula,itisnotpossiblefortheusersto
externallyconfirmwhatratewasused.
Reorganizingtheexampleaboveintoamorereadableformwouldlikesomethinglikethis:dividetheformulaover4cells.Thefirst
cell,labelled"AvgA"wouldcontainthesingleformula@AVG(A2..A5)thesecondcell,labelled"AvgB"wouldcontain
@AVG(B2..B5)thethirdcell,labeled"IntRate"wouldcontainjustthenumber"0.15"andthefourthcellwouldperformthefinal
calculation@SUM(IntRate*AvgA,IntRate*AvgB).Bybreakingupacomplexformulaintoseveralsimplerones,itbecomeseasyforthe
usertounderstandtheflowofthecalculationandtounderstandwhenwhatheislookingatcontainsanerror.
Calculationheadings
Allthenormalitemsthatonewouldputonahandcalcshouldbeincludedoncomputerizedcalcs.Theseinclude:
Nameofthecalc(andcalcnumber,ifapplicable)

Nameofthepersonperformingthecalc
Dateandrevisioninformation
Spreadsheetcalcsshouldalwaysincludethefilenameanddirectorypathintheprintout.
Manuallysetcells
Onekeythingthatanotherengineerwillneedtoknowwhenviewingaspreadsheetbasedcalciswhichvaluesarecalculatedandwhich
werefixedbytheauthor.Thisisbestaccomplishedbygivinginputcellsadifferentappearancetocalculatedcells.
Therecommendedwayofdenotingfixedcellsistogivethemayellowbackgroundsothattheystand
outfromtherestofthecalc.Iftheoutputofthecalcistobeusedinawaythattheyellowbackground
willnotappearclearly(forexample,ifthecalcresultsaretobefaxed),theneitherafontstylechange
(eg.italics)oraspecialcellborderpatternshouldbeused.
Itisagoodpracticetostatesomewhereinthecalcthebasisofanyinputvalues.Itisnotalways
necessarytostatethisbasisontheprintoutsothebasismaybehiddeninthespreadsheetincell
commentsoronhiddencells.

FlowsheetBasedCalculation
Thevisualappearanceofaspreadsheetiscriticaltotheunderstandingofthecalculation.Most
metallurgicalcalculationsareperformedaroundprocesscircuitsaddingadepictionofthecircuittothecalculationandusingthat
depictiontodirectthelayoutandflowofthecalculationcangreatlyreducethelikelihoodoferrorsappearinginthecalculation.For
nonprocesscalcs,theuseofotherdiagramscanprovidesimilarprotectionagainsterrors.
Massbalancecalculationscanusethedepictionofaflowsheetintwoways.Simplecalculationsshouldsuperimposethecalculation
cellsdirectlyovertheflowsheet,asinexamplecalc#1.Morecomplicatedcalcsshouldusetheflowsheettodefinestreamnumbersand
thenperformthecomputationsinatable,asinexamplecalc#2.
BallMillExample#1

BallMillExample#2

Iteration&Chaining
Numbercrunchingiswhatspreadsheetbasedcalcsdo.Itisthereforesurprisingthatveryfewengineerswhousespreadsheetsto
performcalculationsactuallyunderstandtheunderlyingconceptsinvolvedinaspreadsheetperformingthemathematics.Metallurgical
andprocesscalculationsareamongthemostdifficulttypesofcalculationsthatspreadsheetscanperform,andtheycansometimes
highlightthestrengthsofthedifferentcommercialpackages.
Theconceptsofiterationandchainingsignifytheorderofcalculationofthecellsofaspreadsheet.Theorderofcalculationisonlya
majorconcernifthespreadsheetcontainsacalculationwithcircularreferences(eg.circulatingloadsaroundaballmillcircuit).A
spreadsheetprogramthatexaminesthecalculationbybackwardchainingtodetermineanoptimalorderofcalculation(eg.Lotus123,
CorelQuattroPro)canconvergeacalculationinfarfasterthanaprogramthatdoesnot(eg.MicrosoftExcel,variousWorkspackages,
StarOffice).Incertainverycomplicatedcalculations,onlytheprogramsthatusebackwardchainingwillbeabletocorrectlyresolvethe
calculationregardlessofthenumberofiterations.Thenonchainingspreadsheetscangetcaughtinacircularreferencewhereastep
changeproceedsaroundthecircularreferencefromcelltocellwithoutdampeningout.Anexamplewouldbeaclosedcircuitballmill
feedcalculationcellthatcontainsthevalue100onthefirstiteration,0onthesecondandthirditerations,thenbackto100againand
repeatingthecycle.

BackwardChaining
Spreadsheetprogramsthatcalculatebymeansofbackwardchainingdeterminetheorderofcalculationbyexaminingtherelationships
betweencells.Forexample,ifcellA1containedtheformula+B5+D7,abackwardchainingspreadsheetwouldevaluatecellsB5and
D7beforeitevaluatedA1.However,beforeitcalculatedB5andD7,itwouldchecktheformulasinthesecellstoseeiftheydepended
onanyothercells,inwhichcasethosewouldbeevaluatedfirst.
Aspreadsheetthatdoesnotbackwardchainwouldignoretherelationshipsbetweencells.ItwouldcalculatecellA1firstusingwhatever
valueshappentobepresentincellsB5andD7,evenifthosevaluesare"stale".ThenwhenB5getscalculated,ifitsvaluechanges,cell
A1willnotautomaticallyupdateunlessthespreadsheetperformsaseconditerationofthecalculation.
BackwardChainingOrderofCalculation

NotChainedOrderofCalculation

IterationandConvergence
Iterationistheprocessofrepeatingtheevaluationofaspreadsheetuntilit"converges".
Convergenceisdefinedaswhentwoconsecutiveiterationsofaspreadsheetyieldresultsthatareapproximatelythesame.Some
programs(eg.MicrosoftExcel)allowtheusertodefineconvergenceasarelativedifferenceof,forexample,lessthat0.1%inallvalues
relativetothepreviousiteration.Otherprograms(eg.Lotus123)lackthisabilitytodefineaconvergencecriteria,inwhichcasethe
usermustdefineasetnumberofiterationsforthecomputertoprocessandthenexaminetheresultsvisuallytodetermineifthe
calculationhasconverged.
Calculationsthatinvolvecirculatingloads(liketheballmillexampleinanearliersection)mustbeconstructedcorrectlyinorderfor
themtoconverge.Calculationsthatcontainflawsinlogic,imbalancesaroundunitoperations,"forgotten"streams,andothererrorsmay
findthatthedifferencesinvaluesbetweensuccessiveiterationsmayincreaseratherthandecrease.Thisyieldsacalculationwhose
valuesarenonconverging(tendingtowardsinfinity).Itisimportantthattheengineerspecifyanabsolutemaximumnumberof
iterationsthataspreadsheetperformsonacalculationsothatifthecalculationisnonconverging,theengineermaysavethecalculation
beforeinfinitevaluesbegintoappearincells.
Nonconvergingspreadsheetsareusuallytheresultoferrorsinsomecellswithinthecalculationorafaultyunderstandingofthesystem
beingmodelledinthespreadsheet.Insomeveryrareinstances,nonconvergencemayalsobeduetotheinabilityofnonbackward
chainingspreadsheetstocorrectlycalculatecircularreferences.

Someofthequalityassurancetricksoutlinedlaterinthispaper,especiallydoubleentryaccountingandalarms,cangreatlyassistthe
engineerincreatingcalculationsthatconvergereliably.
Balancing
Balancingofcalculationsisconceptalmostuniquetoprocessengineering.Unlikeconvergence,acalculationissaidtobalancewhen,
forallcommodities,thesumofalltheinputstoeveryunitoperationisequaltothesumofalltheoutputsandreactionsforthesameunit
operation.Insimplerlanguage,acalculationbalanceswhenwhatwhateveryouputintosomethingcomesoutagainorreacts.
Balancedspreadsheetsarealmostalwaysconverged,butarenotnecessarilycorrect.Ifthecalculationissetupwrong(incorrectly
mimicstheprocessbeingmodelled),thentheresultsofabalancedandconvergedcalculationwillnotcorrectlymimicreality.
Thefollowingexampledemonstratestwoiterationsoftwosimilarcalculations.Thefirstisbalanced(thesumoftheinputsequalsthe
sumoftheoutputs)butisnotconverged(thevaluesoftheinternalslagrecyclearechangingsignificantlybetweenthetwoiterations).
Thesecondisconverged(thevaluesdonotchangesignificantlybetweenthetwoiterations)butisnotbalanced(thereisanerrorinthe
calculationorthereisanotheroutputstreamthathasnotbeenaccountedfor).
ExampleofBalanceWithoutConvergence

ExampleofConvergenceWithoutBalance

DoubleentryAccounting
Therearetwokeyconceptstodoubleentryaccounting:anycriticalvalueinacalculationshouldbecalculatedintwoindependentways
(andthetwoanswerscompared),and,inthecaseamaterialbalance,thesumoftheinputsshouldequalthesumoftheoutputsand
reactionsforanygivenunitoperationandfortheentireplant(thecalculationmustbalance).
Massandenergybalancecalculationsareeasytocheckaslongasthecalculationissetupwithdiscreteunitoperationinputsand
outputs.Includinga"sumofinputs"and"sumofoutputsandreactions"checkaroundallunitoperationswillprovideabigcheckon
whetherornotthereareanyproblemsinagivenspot.Similarly,a"sumofinputs"and"sumofoutputsandreactions"tableshouldbe
developedfortheentireplantbeingmodelled.
A"sumofinputs"checkinvolveseitheratableoraSUMstatementthataddsalltheinputsofaparticularcommodityintoaunit
operation.Eachsignificantcommodity(eg.solids,liquor,copper,sulphate)shouldhaveitsownSUMstatement.Thecorresponding
"sumofoutputsandreactions"iscreatedtheway,exceptthatreactionsthatcreateordestroythecommoditymustbeaccountedfor.
Reactionsthatdestroythecommoditywillbeexpressedasbeingpositive,whilstreactionsthatcreatethecommoditywillbeexpressed
asbeingnegative.
Theengineermustcarefullychoosethecommoditybeingcheckedtoensurethatthevaluesenteringandexitingaunitoperationsare
actuallycomparable.Avoidtheuseofvolumetricflowsforcommoditiesassmallfluctuationsintemperatureorpressurecanaffectthe
flowsenteringorleavingaunitoperation.Massflowsarethebestchoiceastheyarenotsubjecttofluctuationswithambientconditions.
BallMillCircuitwithDoubleEntryAccounting

Theballmillexample#3containsinputandoutputsumtablesateachmajorunitoperation.Inthisexample,thetwocommoditiesthat
arebeingcheckedaretonnes/hourofsolidsandtonnes/hourofliquor.
HeatBalanceExamplewithDoubleEntryAccounting

Asecondexample,considertheheatbalancearoundamixingvessel.Supposethetwoheatinputs(cellsB4andB5)enteravesseland
undergoanexothermicreaction.Theheatinthesingleoutputstream(cellB10)iscalculatedbyatemperaturemeasurement.Theheatof
reactioniscalculatedbyacomplicatedfifthorderdifferentialequation(incellB7).Inthisexample,the"sumofinputs"wouldbe
@SUM(B4,B5)andthesumofoutputswouldbe@SUM(B10,B7).Notethatbecausethereactioncreatesthecommodity(akaheat),it
isexpressedasanegativenumberintheoutputsumstatement.
Inthisexample,onewouldexpecttoseeasmalldifferencebetweenthetwosums.Thismaybeconsideredasunaccountedheatflows
(eg.heatflowthroughthevesselwall),asexperimentalerror(thetemperaturemeasurementwasnotaccurate),orasthenormal
differencebetweentheoryandreality(thefifthorderequationnotperfectlymatchingreality).Bydisplayingthetwosumssidebyside,
theengineercanvisuallygaugethedifferenceintheinputsandoutputsanddecidewhetherornotthevaluesarecloseenoughtobe
acceptable.

ModellingofUnitOperations
Flowsheetsareusefulforgivinganoverallviewofwhatishappeninginacalculation,buttheydonotaffordalotofspacefordoing
complicatedcalculations.Ratherthancluttertheflowsheet,itisrecommendedthateachmajorunitoperationbecarefullydrawnouton
itsownpagewithinthespreadsheet.Theinputstothisunitoperationpageshouldbedrawnfromtheflowsheet(orfromtheunit
operationpagesoftheequipmentfeedingthisunitoperation)andtheflowsheetshouldshowtheoutputsfromthisunitoperation.
Putasmallsketchorflowchartofwhatishappeningwithinaunitoperationpage.Justasaflowsheetordiagramaidsinunderstanding
theoverallcalculation,diagramsontheunitoperationpagesassistinunderstandingthenatureoftheinputs,outputsandcalculation
methodsofthisunitoperation.Largecalculationsinvolvingalargenumberofunitoperationswillrequirecarefulmanagementofthe
inputsandoutputsbetweenunitstoensurethattheflowofthecalculationmatchesthepipingnetworkintheprocessplant.Useof
doubleentryaccountingcanbecriticalinidentifyingwhenapipelineintheplanthasbeen"missed"inthecalculation.

Alarms

Automationofthedebuggingofcalculationsoftenprovidesbetterspreadsheets,faster.Oneofthekeytoolsinautomationofdebugging
isplacingalarmsinthecalculationthataretriggeredwhencertainkeycellshavevaluesoutsideofanacceptablerange.Alarmscanalso
beusedtocomparevaluesandreportnonsenseconditionslikepipeswithdifferentfeedanddischargerates.

LayingAlarms
AlarmsaresimpleIFstatementsthattestforbadconditionsanddisplaymessagesiftheyarepresent.Atypicalalarmwilllooklikethis:
@IF(H21>100,"TankOverflowing!","")
TheconditionbeingtestedisthevalueincellH21.Ifitisgreaterthan100,thenthecellwilldisplaythemessage"TankOverflowing!",
otherwiseitwilldisplaynothing.Thisisthekeyconceptinanalarm,itwillstayblankuntilitistriggered.
Alarmsarebestusedtohighlightconditionsinthecalculationthatmayappeartobevalid,butthatsimplywon'tworkintherealworld.
Examplesofconditionsthatalarmscanbeusedtoannouncearenegativetanklevels,overflowingtanks,backwardflowdownapipe,
anddiscrepanciesindoubleentryaccounting.
Itisoftennecessarytodenotethepresenceofanalarm,evenifitisinactive.This
willavoidthealarm'scellbeingmistakenforbeingblankandhavingthecontents
overwritten.Changingtheshadingofthecelltoalightorangecolouris
recommended.
Alarmsarecommonlyusedtocomparevaluesforexample,comparingthesumof
inputstoaunitoperationtothesumofoutputsforaunitoperation.Thereisatrickto
performingcomparisons:whatmustbetestedisnottheequalityofthetwovalues,
butrathertheirrelativedifference.Considertheexampleofthesumofinputs(cell
D5)equals8.00andthesumofoutputs(cellD6)equals8.0001.Analarmwrittenas
@IF(D5=D6,"Error","")willalmostnevershutoffastherewillalwaysbeminor
differencesincellvalueswhenacalculationhasconverged.Thisalarmsisbetterwrittenas@IF(@ABS(D5D6)<0.01,"Error","")
wherethe0.01istheengineer'sarbitrarychoiceofwhatconstitutesa"significant"difference.
Thepersonrunningthespreadsheetmustbemadeawarethatsomethingbadhashappenedwhenanalarmhasbeentriggered.Thisis
bestdonebychangingthetextformattingofthealarmcellsothatthealarmappearsinalarge,highcontrastred,boldprint.Alarms,if
theyaretriggered,shouldbelocatedonthespreadsheetinpositionswheretheyarehighlyvisibleandwheretheywillappearonthe
printout.Thiswillalertpeopleviewingtheresultsofthespreadsheetthatsomethingunusualishappeninginthecalculation.

CombiningAlarms
Largecalculationsmayencompasslargeareasofaspreadsheetandbeseveralpagesdeep.Itisimportanttokeepthealarmcellscloseto
thepartofthecalculationthatgeneratesthevaluesbeingmonitoredinthealarm.Thismeansthatthealarmsmaybeburiedseveral
pagesdeeponcomplicatedcalculationandmaynotbevisiblewhentheyaretriggered.
Itisagoodpracticetohaveasinglestatusareawheretheprogressofthewholecalculationmaybemonitored.Alarmscanbe
"concatenated"(aka'added')togethertogiveanoverallalarmstatusforagivenpage.Aformulatoconcatenatealarmsoperatesthe
samewayasaformulatoaddnumbers,exceptthatthe"&"symbolisusedratherthanthe"+"symbol.Forexample,iftherewere
alarmsincellsE4,I8andO10ofapage,theoverallalarmcellforthepagewouldlooklike:
+E4&I8&O10
Notethebeginning"+"signtotellthespreadsheetthatthisisaformula.ThisexampleisformattedforLotus123thesameformula
forMicrosoftExcelwoulduse"="totellthespreadsheetthatthisisaformula.So,inExceltheexamplewouldlooklike:
=E4&I8&O10
Evenplacingtheseoverallpagestatusalarmsmaynotbevisibleenough.Ifthecalculationincludesseveralpages,thenitmaybe
necessarytobuiltasingleallencompassingalarmcelllocatedinahighlyvisiblepartofthespreadsheet(forexample,onthemainpage
ofthespreadsheet).Theformofthisalarmissimilartotheformulasabove,exceptthatitshouldbetheoverallalarmsforthevarious
pagesthatgetconcatenated.Forexample,ifeachpagehasitsoverallalarmcellintheA1cell,thentheallencompassingalarmcell
wouldlooklikethis:
+A:A1&B:A1&C:A1&D:A1

ErrorTrapping
Errorvaluesinspreadsheetsarecreatedbysuchoperationsadividingbyzero,takingalogarithmofanegativenumber,andsoon.
Calculationsthatinvolvealargenumberofcircularreferencesrunariskofbecomingpopulatedwitherrormessages(eg.ERRorNA).
Engineersshouldalwaysexpectthattheseerrorswilleventuallycreepintotheirspreadsheets,andthereforeshouldtakemeasuresto
protecttheircalculation.

CriticalJunctions

Justasahighwayhasintersectionwherebadthingsmayhappen,spreadsheetswithcircularcalculationshavejunctions.Ajunctionis
definedasacellwithinaspreadsheetwhoseformuladependsononeormoredownstreamcells.Byplacingspecialerrortrapsatthese
junctioncells,theengineermaypreventerrorspropagatingthroughoutacalculation.
ThecodeforanerrortrapconsistsofanIFstatementthatchecksforanerrordownstream,adefaultvaluetodisplayifadownstream
errorispresent,andaformulatoexecuteiftherearenoerrorsdownstream.In123,thecodewilllooklikethis:
@IF(@ISERR(H21),100,H21/100*A3)
Theexpression@ISERR(H21)willreturn"true"ifthevalueofcellH21isERR.This"true"valuewillresultintheformulareturning
thevalue'100'.Ifthereisnoerrorpresent,the@ISERR(H21)willreturnfalse,whichwillresulttheexpressionH21/100+A3being
evaluatedinstead.Notethatinthisexample,thecellA3isnotbeingcheckedforerrors.IfthelayoutofthecalculationissuchthatA3is
"upstream"ofthecellwearecalculating,thenwemayignoreit.If,however,thevalueinA3didhaveapotentialtocauseerrorsto
propagatetothiscell,thentheengineershouldmodifythecheckingroutinetolookforanerrorincellA3too.Changingtheformulato:
@IF(@ISERR(H21+A3),100,H21/100*A3)
issufficientasifeitherofH21orA3containanERRvalue,thentheadditionwillresultinERRaswell.Notethatthespreadsheetcan
evaluateadditionfasterthanmultiplication,thusyourspreadsheetwillrunfasteriftheformula@ISERR(H21+A3)isusedinsteadof
@ISERR(H21/100*A3).
Thelocationsofcriticaljunctionsiscrucialtothesuccessofyourerrortrapping.Youmusthaveenoughtrapsatcriticalpartsofthe
spreadsheettopreventerrorspropagating,butnotsomanytrapsthattheybegintoslowdownthecalculationofthespreadsheet.Inthe
ballmillcircuitexampleusedpreviously,thecycloneunderflowandsumpdischargecellsarethecriticaljunctionsandshouldbefitted
witherrortraps.Alltheothercellscanoperatewithouterrortrapsasanyerrorsthattheygeneratewouldhavetotravelthroughthetwo
criticaljunctionsthatalreadyhavetraps.
Choosedefaultvaluescarefully.Theyshouldsizedapproximatelytowhattheformulawouldnormallyresultin(ifvaluesaretoolarge
orsmall,thenotherdownstreamformulasmayendupevaluatingtoERR).Thevalueshouldalsobereadilyvisiblesothatyouhavea
visualcluethatsomethingiswrongandthatthetraphasbeensprung(forexample,acellwiththevalue100.00willlooksuspicious
whereas93.70wouldappear"normal").Ifthetrapissprung,thenthedoubleentryaccountingandalarmsdiscussedinearlierchapters
shouldalertyoutothefactthatsomethingiswrong(itisimportantthattheybebuiltintothecalculation).

ErrorRecovery
Itispossibletocleanupaspreadsheetonceithasbecomeinfestedwitherrorsbutitisalotofwork.
Thefirststepinrecoveringthecalculationistoinstallerrortrapsatcriticaljunctionsasdescribedintheprevioussection.Thiswillhelp
isolatethepartofthecalculationthatisgeneratingtheerrorandwillhopefullyallowtheotherpartsofthespreadsheettooperateas
normal.Keepisolatingsmallerandsmallerpartsofthecalculationuntilasmallpartofthecalculationisnowfreeoferrors.Continue
addingerrortrapsuntillargersectionsofthespreadsheetbegintooperatenormallyandyoucanidentifythepartofthecalculationthat
isgeneratingtheerror.Thenfixtheformulathatisgeneratingtheerrorandhopefullythecalculationwillreturntonormal.
Ashortcutthatcanbeusedwithrecoveringfrompropagatederrorsistohardwiresomeoftheformulas.Copytheformulatoanearby
blankcellandthenoverwritetheoriginalformulawithavaluesimilartowhatitwillnormallyevaluateto.Thiswilltrickthe
downstreamformulasintocalculatingrelativelynormalvalueswhiletheengineerishuntingdowntherestoftheerrors.Oncethe
spreadsheethasbeencleanedoferrors,thenthecopiedformulasshouldberecopiedoverthemanuallyenteredvaluesinthe
calculation.

IterationDampening
Iterationdampeningisatechniqueofforcingacomplicatedcalculationtoconvergequickerthanitwoulddoonitsown.Thistechnique
isdangerous,though,andmustbeusedinconjunctionwiththedoubleentryaccountingandalarmsthathavebeendescribedpreviously.
Thereareoftenkeycellsinacalculationthathavevaluesthatvarywidelyasacalculationiteratestowardsconvergence.Thesecellscan
beforcedtonotvaryoutsideofagivenrangeforexample,acellthatshouldyieldasmall,positivenumbercanbelimitedsothatits
valuedoesnotdropbelowzero.ThisisdoneusinganIFstatement:
@IF((A3+H21/100)<0,0,A3+H21/100)
Notethatthisexpressiondoesnotplaceanupperlimitonthevalueinthecell.Itisusuallynotnecessarytoputanupperlimitonacell's
valueasthelowerlimitisusuallyenough.Tomakemattersworse,itiscommonthattheunitsofmeasureusedinanengineeringcalc
willchangeasthecalculationevolves,andachangeinunitsusuallycausesmoregriefwithanupperlimitthanwithalowerlimit.
Thecalculationwillnotbalancewheniterationdampeningisoperatinginacell.Itisimportanttohavedoubleentryaccountingand
alarmssetuparoundanycellwithiterationdampeningcodetoalerttheuserwhendampeningisinprogress.Itispossibleforiteration
dampeningtoallowacalculationtoconvergewithoutbalancingsotheengineermustwritethespreadsheetinawaythatdetectsand
announcestheproblem.

Conclusion

Computerspreadsheetsarepowerfultoolsthatcanbeextremelyusefultoengineers.Theymayalsobeextremelydangerousif
calculationsarenotproperlyimplemented.Theorderofcalculationofaspreadsheetprogramissometimescriticaltosolving
calculationsusingcircularreferences,
Simpletoolslikelayoutbasedcalculationsandalarmscanmakethecommunicationofideasinacalculationmoresuccessful.Other
simpletools,likedoubleentryaccountinganderrortrapping,canmaketheresultsofacalculationlesspronetoerrors.

You might also like