Dynamic Process Simulation of Zinc ElectrowinningbyMichael John MahonB.Sc. Materials Engineering, University of Alberta, 2009A THESIS SUBMITTED IN PARTIAL FULFILLMENTOF THE REQUIREMENTS FOR THE DEGREE OFDoctor of PhilosophyinTHE FACULTY OF GRADUATE AND POSTDOCTORALSTUDIES(Materials Engineering)The University Of British Columbia(Vancouver)January 2016c©Michael John Mahon, 2016ABSTRACTZinc electrowinning is the final aqueous processing step in the production of metallic zinc.It is a complex process that is difficult to control and monitor. This thesis seeks to develop atime transient process simulation of zinc electrowinning to aid in controlling and monitor-ing. Based on reported models of zinc electrowinning, and other electrowinning processes,a dynamic simulation of a zinc electrowinning cell capable of representing time-based ef-fects was developed. The new model incorporates more sophisticated estimations of elec-trolyte activity using Pitzer parameters. Further, recently determined empirical relationsfor solution conductivity, density and viscosity were included. The effect of gas evolutionon the conductivity of solution was also included. First, the simulation was validated us-ing a reported data set, and the kinetic constants of the primary cathodic reactions weredetermined using a simplex optimization algorithm. A model of a counter-flow coolingtower was also developed in order to simulate a full cell house. The simulation was thensuccessfully validated against data collected from three industrial cell houses in Canada.Once validated, the simulation was used to investigate its possible applications. Thebenefits of optimizing a single electrowinning cell in comparison to optimizing the cellhouse was examined. Due to the inability to directly control both the acid and zinc concen-trations in the electrowinning cell without major process changes, it was established thatthe optimal single cell conditions favoured zinc concentrations of approximately 70 g L−1,while the cell house optimization favoured lower zinc concentrations by comparison (ap-proximately 50 g L−1). The simulation was used to track the consumption of manganeseions in the cell house when using variable concentrations of manganese in the purified elec-trolyte fed to the cell house. The experimental rates reported for Mn consumption overes-iitimated the Mn consumption in a cell house. The simulation was also used to investigateprocess control strategies. With the use of a basic process control scheme, the productioncould increase by 4 % and decrease the variability in the spent electrolyte concentration.iiiPREFACEThe following journal submissions have been extracted from the body of work presentedin this dissertation. My supervisor, Dr. Akram Alfantazi provided experimental insight,results interpretation, and editorial support covering all aspects of my research. Aside frommy supervisor and key secondary contributors, I am the primary contributor to these works.Journal Articles1) Mahon, M., Alfantazi, A., “Simulated process control in a zinc electrowinning cellhouse” Submitted.2) Mahon, M., Alfantazi, A., “Manganese consumption during zinc electrowinning us-ing a dynamic process simulation”, Hydrometallurgy, (2014).3) Mahon, M., Peng, S., Alfantazi, A., “Application and optimization studies of a zincelectrowinning process simulation”, The Canadian Journal of Chemical Engineering,(2014).4) Mahon, M., Wasik, L., Alfantazi, A., “Development and implementation of a zincelectrowinning process simulation”, Journal of the Electrochemical Society, (2012).Conference Proceedings with Presentation1) Mahon, M., Alfantazi, A., “Seasonal effects on the water balance in a zinc elec-trowinning cell house”, Pb-Zn 2015 - Lead-Zinc 2015 Symposium, (To be presentedJune, 2015).iv2) Mahon, M., Alfantazi, A., “Data reconciliation of current efficiency in zinc elec-trowinning”, Hydrometallurgy 2014 Seventh International Symposium - Volume II,(2014).3) Mahon, M., Peng, S., Wasik, L., Alfantazi, A., “Development of a fully dynamic sim-ulation of a zinc electrowinning tankhouse”, Electrometallurgy Symposium - TMS2012, (2012).Larry Wasik provided training in process simulation modelling and insight in to modeldevelopment for journal article 4 and conference proceeding 3.Spencer Peng provided support in the development of the zinc electrowinning modeland cell house simulation in journal article 3 and conference proceeding 3.vTABLE OF CONTENTSAbstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iiPreface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ivTable of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viList of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ixList of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiNomenclature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xivList of Acronyms and Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . .xxviAcknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxviii1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Literature Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.1 History of Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2 Modern Zinc Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2.1 Zinc Ores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.2.2 Roasting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.2.3 Leaching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2.4 Direct Leaching . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.2.5 Iron Removal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.2.6 Zinc Dust Cementation . . . . . . . . . . . . . . . . . . . . . . . . 152.3 Zinc Electrowinning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.3.1 Zinc Electrowinning Cells . . . . . . . . . . . . . . . . . . . . . . 172.3.2 Zinc Electrowinning Cell Houses . . . . . . . . . . . . . . . . . . . 272.3.3 Modelling of Electrowinning . . . . . . . . . . . . . . . . . . . . . 302.4 Hydrometallurgical Process Modelling . . . . . . . . . . . . . . . . . . . . 372.4.1 Steady State Process Models . . . . . . . . . . . . . . . . . . . . . 402.4.2 Dynamic Process Models . . . . . . . . . . . . . . . . . . . . . . . 432.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47vi3 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494 Model Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504.1 Modelling Zinc Electrowinning . . . . . . . . . . . . . . . . . . . . . . . . 504.1.1 Bubble Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574.1.2 Cell Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . 584.1.3 Dynamic Mass and Energy Balance . . . . . . . . . . . . . . . . . 594.2 Modelling Evaporative Cooling Towers . . . . . . . . . . . . . . . . . . . 625 Model Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665.1 Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665.2 Cell House Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695.2.1 Validating Cell House A . . . . . . . . . . . . . . . . . . . . . . . 705.2.2 Simulation Description . . . . . . . . . . . . . . . . . . . . . . . . 715.2.3 Validating Cell House B . . . . . . . . . . . . . . . . . . . . . . . 775.2.4 Simulation Methodology . . . . . . . . . . . . . . . . . . . . . . . 775.2.5 Simulation Results . . . . . . . . . . . . . . . . . . . . . . . . . . 805.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 856 Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 886.1 Optimization Studies of a Zinc Electrowinning Process Simulation . . . . . 886.1.1 Optimization Methodology . . . . . . . . . . . . . . . . . . . . . . 886.1.2 Single Cell Analysis . . . . . . . . . . . . . . . . . . . . . . . . . 896.1.3 Cell House Analysis . . . . . . . . . . . . . . . . . . . . . . . . . 1026.2 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1047 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1057.1 Simulating Process Control . . . . . . . . . . . . . . . . . . . . . . . . . . 1057.1.1 Set Point Tracking Performance . . . . . . . . . . . . . . . . . . . 1147.1.2 Optimizing Production . . . . . . . . . . . . . . . . . . . . . . . . 1177.1.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1227.2 Manganese in Zinc Electrowinning . . . . . . . . . . . . . . . . . . . . . . 1227.2.1 Simulation Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . 1237.2.2 Manganese Simulation Development . . . . . . . . . . . . . . . . . 1247.2.3 Results and Discussion . . . . . . . . . . . . . . . . . . . . . . . . 1317.2.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1397.3 Cathode Data Reconciliation . . . . . . . . . . . . . . . . . . . . . . . . . 1407.3.1 Reconciled Cathode Production . . . . . . . . . . . . . . . . . . . 1417.3.2 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1437.4 Seasonal Effects on Water Evaporation . . . . . . . . . . . . . . . . . . . . 1457.4.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1518 Conclusions and Recommendations . . . . . . . . . . . . . . . . . . . . . . . 1528.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1528.2 Recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154viiReferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156Appendix A Impurities in Zinc Electrowinning . . . . . . . . . . . . . . . . . . 170Appendix B Additives in Zinc Electrowinning . . . . . . . . . . . . . . . . . . . 177B.1 Morphology and Levelling Agents . . . . . . . . . . . . . . . . . . . . . . 177B.2 Foaming Additives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180Appendix C Electrowinning Code . . . . . . . . . . . . . . . . . . . . . . . . . . 183Appendix D Cooling Tower Code . . . . . . . . . . . . . . . . . . . . . . . . . . 221viiiLIST OF TABLESTable 2.1 Typical commercial zinc concentrate specifications . . . . . . . . . . . . 7Table 2.2 Zinc dust purification - typical composition ranges of neutral and puri-fied solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17Table 2.3 Pitzer Parameter Values . . . . . . . . . . . . . . . . . . . . . . . . . . 21Table 2.4 Breakdown of Total Cell potential . . . . . . . . . . . . . . . . . . . . . 22Table 4.1 Electrowinning cell model inputs and outputs . . . . . . . . . . . . . . . 51Table 4.2 Cooling tower model inputs and outputs . . . . . . . . . . . . . . . . . 64Table 5.1 Static cell house details as applied to the simulation . . . . . . . . . . . 71Table 5.2 Dynamic cell house details. These values changed over the simulatedtime with their typical values given here. . . . . . . . . . . . . . . . . . 72Table 5.3 Measurement location labels associated with figure 5.10 . . . . . . . . . 79Table 5.4 Zinc balance taken around cell house A and B at steady state on the starttime and date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81Table 6.1 Single Cell Normal Operation Limits . . . . . . . . . . . . . . . . . . . 90Table 6.2 Single cell optimization of current efficiency (ε), along with correspond-ing energy consumption (P) and zinc production rates (rZn) values undertypical cell house constraints . . . . . . . . . . . . . . . . . . . . . . . 91Table 6.3 Single cell optimization of energy consumption (P), along with corre-sponding current efficiency (ε) and zinc production rate (rZn) values un-der typical cell house constraints . . . . . . . . . . . . . . . . . . . . . 91Table 6.4 Single cell optimization of zinc production (rZn), along with correspond-ing current efficiency (ε) and energy consumption (P) values under nor-mal cell house constraints . . . . . . . . . . . . . . . . . . . . . . . . . 92Table 6.5 Single Cell Optimization Limits . . . . . . . . . . . . . . . . . . . . . . 93Table 6.6 Single cell optimization of current efficiency (ε), along with correspond-ing energy consumption (P) and zinc production rates (rZn) values . . . . 94Table 6.7 Single cell optimization of energy consumption (P), along with corre-sponding current efficiency (ε) and zinc production rate (rZn) values . . . 96Table 6.8 Single cell optimization of zinc production (rZn), along with correspond-ing current efficiency (ε) and energy consumption (P) values . . . . . . 97Table 7.1 Relative Gain Array for the proposed control strategy presented in figure7.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108ixTable 7.2 Integral of the absolute error of spent electrolyte zinc concentration(cZn(SE)), spent electrolyte acid concentration (cAcid(SE)), and spentelectrolyte temperature T (SE) . . . . . . . . . . . . . . . . . . . . . . . 110Table 7.3 Integral of the absolute error of spent electrolyte zinc concentration(cZn(SE)), spent electrolyte acid concentration (cAcid(SE)), and spentelectrolyte temperature (T (SE)) during set point changes using differ-ent control schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116Table 7.4 Comparison of control strategies in optimizing zinc production and thevariation in the zinc and acid concentrations of the spent electrolyte . . . 120Table 7.5 Summary of various rates of reaction for the deposition of MnO2 in zincelectrowinning conditions reported in literature . . . . . . . . . . . . . . 130Table A.1 Effects, characteristics, solution targets and removal of impurities inzinc electrowinning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170xLIST OF FIGURESFigure 2.1 General process flow diagram of the roast leach electrowin process . . . 7Figure 2.2 General diagram of a zinc electrowinning cell . . . . . . . . . . . . . . 19Figure 2.3 Reference schematic of the cell house simulated . . . . . . . . . . . . . 29Figure 5.1 Comparison of mass transfer equations to experimental results . . . . . 67Figure 5.2 Comparison of predicted and experimental potentials with varying zincconcentrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69Figure 5.3 Comparison of predicted and experimental potentials with varying Acidconcentrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70Figure 5.4 Comparison of simulated entering and exiting zinc concentrations over8.5 days using industrial data . . . . . . . . . . . . . . . . . . . . . . . 73Figure 5.5 Comparison of tankhouse concentration over 8.5 days using industrialdata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74Figure 5.6 Comparison of recorded and predicted temperatures over the course oftwo weeks based on the developed cooling tower . . . . . . . . . . . . 75Figure 5.7 Comparison of the zinc and acid concentration in the spent electrolytebetween the reported cell house electrolyte data and calculated resultsfrom the simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77Figure 5.8 Comparing daily cathode production in the simulation to that reportedby the plant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78Figure 5.9 Cumulative cathode prediction for the simulation and the daily reportedamount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79Figure 5.10 Process flow diagram of cell houses including measurement positionnotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80Figure 5.11 Predicted and assayed zinc concentrations of the purified (ZPSA) andreturned (REA) electrolyte in cell house A from the start time onwards . 82Figure 5.12 Comparison of predicted and assayed spent (A) and cooled electrolyte(B) zinc concentrations in cell house A . . . . . . . . . . . . . . . . . . 83Figure 5.13 Comparison of predicted and assayed spent (A) and cooled (B) zincelectrolyte concentrations in cell house A from the start time onwardswith a recirculation ratio of 12.0 . . . . . . . . . . . . . . . . . . . . . 85Figure 5.14 Predicted and assayed purified and returned electrolyte zinc concentra-tions in cell house B . . . . . . . . . . . . . . . . . . . . . . . . . . . 86Figure 5.15 Comparison of predicted and assayed spent (A) and cooled (B) elec-trolyte zinc concentrations in cell house B . . . . . . . . . . . . . . . . 87xiFigure 6.1 Surface response plot of current efficiency in a single cell . . . . . . . . 95Figure 6.2 Surface response plot of energy consumption in a single cell . . . . . . 98Figure 6.3 Surface response plot of zinc production in a single cell . . . . . . . . . 101Figure 6.4 Optimization of electrowinning cell energy consumption for a simu-lated cell house. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104Figure 7.1 Proposed control scheme for the cell house . . . . . . . . . . . . . . . 107Figure 7.2 Bump test performed using the simulation . . . . . . . . . . . . . . . . 109Figure 7.3 Control response of the spent electrolyte zinc concentration in the sim-ulated cell house . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111Figure 7.4 Control response of the spent electrolyte acid concentration in the sim-ulated cell house . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112Figure 7.5 Control response of the spent electrolyte temperature in the simulatedcell house . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113Figure 7.6 Scaled zinc concentration response to very large current changes . . . . 115Figure 7.7 Scaled acid concentration response to very large current changes . . . . 116Figure 7.8 Comparison of Proportion Integral Derivative (PID) and Track+FeedForward (FF)+Undertuned (U) on the acid concentration in the spentelectrolyte in maintaining a desired acid set point . . . . . . . . . . . . 117Figure 7.9 Block diagram of the control hierarchy for the zinc cell house . . . . . . 118Figure 7.10 Comparison of PID and Track+FF+U on the acid concentration in thespent electrolyte in maintaining a desired acid set point . . . . . . . . . 121Figure 7.11 Comparison of the simulations prediction and the measured concentra-tion of zinc and sulfuric acid in the electrolyte exiting the cell houseover time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125Figure 7.12 Manganese concentrations in a cell block where no manganese is re-acting to form MnO2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 131Figure 7.13 Comparison of reported Mn deposition rates as listed in Table 7.5 intwo cell banks (A and B) over 40 days of stable purified feed man-ganese concentration . . . . . . . . . . . . . . . . . . . . . . . . . . . 133Figure 7.14 Comparison of reported Mn deposition rates as listed in Table 7.5 intwo cell banks (A and B) over 60 days of variable purified feed man-ganese concentration . . . . . . . . . . . . . . . . . . . . . . . . . . . 134Figure 7.15 Comparison of Mn consumption during a period where the cell housewas fully turned off for four days. The hashed region notes time whenthe current was shut down in the cell house . . . . . . . . . . . . . . . 135Figure 7.16 Comparison of predicted and measured values using two different con-stant Mn consumption rates over the course of an operational increasein manganese concentration in the cell house . . . . . . . . . . . . . . 137Figure 7.17 Purified and spent electrolyte concentrations of manganese comparedwith the ratio of manganese to chloride concentrations (in g L−1) in thespent electrolyte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138Figure 7.18 Comparison of predicted and plant calculated current efficiencies over30 weeks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143Figure 7.19 Comparison of predicted and plant zinc cathode masses over 55 days . . 144xiiFigure 7.20 Comparison of predicted water addition to the cell house with ambienthumidity during a week in winter and a week in summer . . . . . . . . 146Figure 7.21 Comparison of predicted water addition to the cell house with ambientair temperature during a week in winter and a week in summer . . . . . 147Figure 7.22 Comparison of predicted heat rejection in a cooling tower with ambienthumidity during a week in winter and a week in summer . . . . . . . . 149Figure 7.23 Comparison of predicted heat rejection in a cooling tower with ambientair temperature during a week in winter and a week in summer . . . . . 150xiiiNOMENCLATURERoman Symbols (page introduced) Unitsm˙a Mass Flow Rate of Air (page 64) kg s−1m˙a Mass Flow Rate of Air (page 64) kg s−1m˙i,in Incoming Mass Flow of Component i (page 60) kg s−1m˙i,out Outgoing Mass Flow of Component i (page 60) kg s−1m˙i,out Outgoing Mass Flow of Component i (page 61) kg s−1m˙i,rxn Reaction Rate Mass Change of Component i (page 60) kg s−1m˙w Mass Flow Rate of Water (page 64) kg s−1m˙w Mass Flow Rate of Water (page 64) kg s−1Q˙evap Energy of Evaporation (page 61) kJ s−1Q˙evap Energy of Evaporation (page 62) kJ s−1Q˙i,rxn Energy of Reaction i (page 62) kJ s−1Q˙in Energy of Entering Electrolyte (page 62) kJ s−1Q˙out Energy of Exiting Electrolyte (page 62) kJ s−1Q˙out Energy of Exiting Electrolyte (page 62) kJ s−1Q˙rxn Energy of Reaction (page 62) kJ s−1V˙ (ZPS) Volumetric Flow Rate of Zinc Purified Solution (page 76) m3 h−1V˙H Volumetric Rate of Hydrogen Evolution (page 55) m3 s−1A0,i Frequency Factor (page 53) mol m−2 s−1AA Anode Area (page 55) m2AC/A Cathode or Anode Surface Area (page 59) m2xivAC Cathode Area (page 55) m s−1AC Cathode Area (page 56) m s−1AC Cathode Area (page 35) m2AC Cathode Area (page 55) m2AC Cathode Area (page 55) m2AC Cathode Area (page 63) m2ai Activity of Species i (page 52)AL Liquid Surface Area (page 61) m2ap Activity of Products (page 53)ar Activity of Reactants (page 53)AAE Absolute Average Error (page 120)c( j) Concentration at Sampling Point Time j (page 120) mol L−1c(SP)( j) Concentration Set Point at Sampling Point Time j (page 120) mol L−1cH2SO4 Concentration of Sulfuric Acid (page 31) mol L−1cZn2+ Concentration of Zinc Ions (page 31) mol L−1ci Concentration of Species i (page 52) mol L−1ci Concentration of Species i (page 52) mol L−1co Concentration of Oxidized Species (page 53) mol L−1CP,w Heat Capacity of Water (page 64) kJ kg−1 K−1CP,w Heat Capacity of Water (page 64) kJ kg−1 K−1CP,w Heat Capacity of Water (page 64) kJ kg−1 K−1CP,w Heat Capacity of Water (page 64) kJ kg−1 K−1cr Concentration of Reduced Species (page 53) mol L−1cZn Concentration of Zinc (page 55) mol L−1CV Controlled Variable (page 110)d Cathode to Anode Distance (page 59) md(t+∆t) Change in Electrode Space due to Zinc Deposition (page 63) mxvEA Anode Potential (page 59) VEC/A Cathode or Anode Potential (page 58) VEC/A Cathode or Anode Potential (page 54) VECell Cell Potential (page 59) VECell Cell Potential (page 59) VEC Cathode Potential (page 59) VEe,i Equilibrium Potential of Reaction i (page 53) VEe,i Equilibrium Potential of Reaction i (page 54) VE0e,i Standard Equilibrium Potential of Reaction i (page 53) VELoss Miscellaneous Potential Losses (page 59) VF Faraday Constant (page 32) C (mol e−)−1F Faraday Constant (page 33) C (mol e−)−1F Faraday Constant (page 33) C (mol e−)−1F Faraday Constant (page 54) C (mol e−)−1F Faraday Constant (page 55) C (mol e−)−1F Faraday Constant (page 55) C (mol e−)−1F Faraday Constant (page 55) C (mol e−)−1F Faraday Constant (page 58) C (mol e−)−1F Faraday Constant (page 59) C (mol e−)−1F Faraday Constant (page 53) C (mol e−)−1F Faraday Constant (page 53) C (mol e−)−1F(ZPS)C Controlled Flow rate of Zinc Purified Solution (page 124) m3 h−1F(ZPS)N Normal Flow rate of Zinc Purified Solution (page 124) m3 h−1fg Fractional Voidage due to Gas Bubbles (page 58)fg Fractional Voidage due to Gas Bubbles (page 58)fm Limiting Voidage due to Gas Bubbles (page 58)Hevap Enthalpy of Water Evaporation (page 61) kJ mol−1xviHi Enthalpy of Reaction i (page 62) kJ mol−1hmasw Enthalpy of Water Saturated Air (page 64) kJ kg−1hmasw Enthalpy of Water Saturated Air (page 64) kJ kg−1hmasw Enthalpy of Water Saturated Air (page 64) kJ kg−1hmasw Enthalpy of Water Saturated Air (page 64) kJ kg−1hma Enthalpy of Mixed Air (page 64) kJ kg−1hma Enthalpy of Mixed Air (page 64) kJ kg−1hma Enthalpy of Mixed Air (page 64) kJ kg−1hma Enthalpy of Mixed Air (page 64) kJ kg−1hv Enthalpy of Water Vaporization (page 64) kJ kg−1hv Enthalpy of Water Vaporization (page 64) kJ kg−1hv Enthalpy of Water Vaporization (page 64) kJ kg−1I Current (page 58) C s−1i Current Density (page 32) A m−2i Current Density (page 33) A m−2i Current Density (page 33) A m−2i Current Density (page 55) A m−2i Current Density (page 130) A m−2IN Normal Current to the Cell House (page 124) Ai0,H Exchange Current Density of Hydrogen Evolution (page 54) A m−2i0 Exchange Current Density (page 32) A m−2i0 Exchange Current Density (page 33) A m−2i0 Exchange Current Density (page 33) A m−2i0 Exchange Current Density (page 55) A m−2i0 Exchange Current Density (page 53) A m−2iA Anodic Current Density (page 55) A m−2ICH Current to the Cell House (page 76) AxviiICH Current to the Cell House (page 124) AiC Cathodic Current Density (page 55) A m−2iC Cathodic Current Density (page 59) A m−2iC Cathodic Current Density (page 59) A m−2iH Current Density of Hydrogen Evolution (page 36) A m−2iH Current Density of Hydrogen Evolution (page 54) A m−2iH Current Density of Hydrogen Evolution (page 55) A m−2ii Current Density of Reaction i (page 59) A m−2il Limiting Current Density (page 33) A m−2il Limiting Current Density (page 55) A m−2il Limiting Current Density (page 55) A m−2iMn Current Density (page 130) A m−2iZn Zinc Reduction Current Density (page 59) A m−2iH2O Current Density of Water Oxidation (page 55) A m−2iH2O Current Density of Water Oxidation (page 57) A m−2iH2O Current Density of Water Oxidation (page 100) A m−2IAE Integral of Absolute Error (page 110)j Sampling Point Time Index (page 110)j Sampling Point Time Index (page 142)j Sampling Point Time Index (page 120)k0,i Standard Rate Constant (page 53) mol m−2 s−1k0,i Standard Rate Constant (page 53) mol m−2 s−1Ka Tafel Constant (page 57) VKa Tafel Constant (page 100) VKb Tafel Slope (page 57) V dec(A)−1Kb Tafel Slope (page 100) V dec(A)−1Kevap Water Evaporation Rate Constant (page 61) mol s−1xviiikMn,0 Morrow and Perlman Constant (page 126) 100 M−2 s−1kMn,1 Morrow and Perlman Constant (page 126) 19 M−3 s−1kMn,2 Morrow and Perlman Constant (page 126) 63 M−4 s−1kMn Mn Reaction Rate Constant (page 130)Km Mass Transfer Coefficient (page 35) m s−1Km Mass Transfer Coefficient (page 36) m s−1Km Mass Transfer Coefficient (page 55) m s−1Km Mass Transfer Coefficient (page 55) m s−1Km Mass Transfer Coefficient (page 56) m s−1Km Mass Transfer Coefficient (page 56) m s−1KT Mass Transfer Constant (page 35)KT Mass Transfer Constant (page 55)kW Wark’s Constant (page 31)Le f Lewis Factor (page 64)Le f Lewis Factor (page 64)Le f Lewis Factor (page 64)mi,res Resident Mass of Component i in the Cell (page 60) kgmi,res(t+∆t) Resident Mass of Component i in the Cell at time t+∆t (page 61) kgmi,temp Temporary Mass of Component i (page 60) kgmi,temp Temporary Mass of Component i (page 60) kgmi,temp Temporary Mass of Component i (page 60) kgmi,temp Temporary Mass of Component i (page 61) kgMi Molar Mass of Species i (page 52) kg mol−1mi Mass of Species i (page 52) kgMZn Molar Mass of Zinc (page 63) kg s−1Me Merkel Number (page 64)Me Merkel Number (page 64)xixN Number of Sampling Points (page 110)N Number of Sampling Points (page 142)N Number of Sampling Points (page 120)n Mass Transfer due to Gas Convection Exponent (page 35)n Mass Transfer due to Gas Convection Exponent (page 55)P Energy of Zinc Deposition (page 59) kWhr (tonne−1)p Pressure (page 58) kPaps Saturated Vapour Pressure (page 61) mm Hgps Saturated Vapour Pressure (page 61) mm Hgpv Vapour Pressure (page 61) mm HgQres Resident Energy in Reactor (page 62) kJQres(t+∆t) Resident Energy in Reactor (page 62) kJQtemp Temporary Energy in Reactor (page 62) kJQtemp Temporary Energy in Reactor (page 62) kJQtemp Temporary Energy in Reactor (page 62) kJR Gas Constant (page 32) J mol−1 K−1R Gas Constant (page 33) J mol−1 K−1R Gas Constant (page 33) J mol−1 K−1R Gas Constant (page 54) J mol−1 K−1R Gas Constant (page 55) J mol−1 K−1R Gas Constant (page 55) J mol−1 K−1R Gas Constant (page 58) J mol−1 K−1R Gas Constant (page 53) J mol−1 K−1R Gas Constant (page 53) J mol−1 K−1R Gas Constant (page 130) J mol−1 K−1revap Water Evaporation Rate (page 61) mol s−1revap Water Evaporation Rate (page 61) mol s−1xxri Rate of Reaction i (page 59) mol s−1ri Rate of Reaction i (page 62) mol s−1rZn Rate of Zinc Deposition (page 63) mol s−1Re Reynolds Number (page 36)Sc Schmidt Number (page 36)Sh Sherwood Number (page 36)SP Set Point (page 110)T Temperature (page 32) KT Temperature (page 33) KT Temperature (page 33) KT Temperature (page 54) KT Temperature (page 55) KT Temperature (page 55) KT Temperature (page 58) KT Temperature (page 61) KT Temperature (page 52) KT Temperature (page 52) KT Temperature (page 53) KT Temperature (page 53) KT Temperature (page 130) KT Temperature (page 130) Kt Simulation Time (page 60) st Simulation Time (page 60) st Simulation Time (page 61) st Simulation Time (page 62) st Simulation Time (page 62) st Simulation Time (page 62) sxxit Simulation Time (page 63) st Simulation Time (page 126) stA,Cleaning Time Since Anode Cleaning (page 130) DaystA,Service Time Anode Has Been in Service (page 130) DaysTwi Temperature of Inlet Water (page 64) KTwo Temperature of Outlet Water (page 64) KTw Temperature of Water (page 64) KTw Temperature of Water (page 64) KTw Temperature of Water (page 64) KTw Temperature of Water (page 64) Ku0g Superficial Gas Velocity (page 58) m s−1u0g Superficial Gas Velocity (page 58) m s−1uL Velocity of Electrolyte (page 36) m s−1u0l Superficial Liquid Velocity (page 58) m s−1usw Bubble Swarm Rise Velocity (page 58) m s−1usw Bubble Swarm Rise Velocity (page 58) m s−1usw Bubble Swarm Rise Velocity (page 58) m s−1us Single Bubble Rise Velocity (page 58) m s−1VT,res Resident Volume of the Cell (page 60) m3VT,res Resident Volume of the Cell (page 62) m3VT,temp Temporary Volume of Resident Electrolyte (page 60) m3VT,temp Temporary Volume of Resident Electrolyte (page 60) m3VT,temp Temporary Volume of Resident Electrolyte (page 62) m3VT Total Volume of Electrowinning Cell (page 52) m3w Humidity Ratio of Air (page 64) kg kg−1w Humidity Ratio of Air (page 64) kg kg−1w Humidity Ratio of Air (page 64) kg kg−1xxiiwsw Saturated Humidity Ratio of Air (page 64) kg kg−1wsw Saturated Humidity Ratio of Air (page 64) kg kg−1wsw Saturated Humidity Ratio of Air (page 64) kg kg−1z Number of Electrons Involved in the Reaction (page 32)z Number of Electrons Involved in the Reaction (page 33)z Number of Electrons Involved in the Reaction (page 33)z Number of Electrons Involved in the Reaction (page 55)z Number of Electrons Involved in the Reaction (page 58)z Number of Electrons Involved in the Reaction (page 59)z Number of Electrons Involved in the Reaction (page 63)zH Number of Electrons Involved in the Reaction (page 54)zH Number of Electrons Involved in the Reaction (page 55)zi Number of Electrons Involved in the Reaction (page 53)zi Number of Electrons Involved in the Reaction (page 53)zZn Number of Electrons Involved in the Reaction (page 55)V˙g Volumetric Rate of Gas Production (page 55) m3 s−1V˙H Volumetric Rate of Hydrogen Production (page 56) m3 s−1V˙H Volumetric Rate of Hydrogen Production (page 56) m3 s−1Vg Volumetric Rate of Gas Production (page 35) m3 s−1Greek Symbols (page introduced) Unitsα Charge Transfer Coefficient (page 32)α Charge Transfer Coefficient (page 33)α Charge Transfer Coefficient (page 33)α Charge Transfer Coefficient (page 55)αH Charge Transfer Coefficient of Hydrogen Evolution (page 54)αi Charge Transfer Coefficient (page 53)xxiii∆t Simulation Time Step (page 60) s∆t Simulation Time Step (page 60) s∆t Simulation Time Step (page 61) s∆t Simulation Time Step (page 62) s∆t Simulation Time Step (page 62) s∆t Simulation Time Step (page 62) s∆t Simulation Time Step (page 63) s∆Gi Activation Energy of Reaction i (page 53) J mol−1∆GMn Activation Energy (page 130) J mol−1η Overpotential (page 32) Vη Overpotential (page 33) Vη Overpotential (page 33) Vη Overpotential (page 55) VηH Overpotential of Hydrogen Evolution Reaction (page 54) Vηi Reaction Overpotential (page 54) VηH2O Overpotential of Water Oxidation (page 57) VηH2O Overpotential of Water Oxidation (page 100) Vλi Activity Coefficient of Species i (page 52)φ Cation Coefficient of Density Equation (page 52)φ Cation Coefficient of Density Equation (page 53)ρZn Density of Zinc (page 63) kg m−3ρsol Density of Solution (page 60) kg m−3ρsol Density of Solution (page 52) kg m−3σ Conductivity of Solution (page 58) S m−1σ Conductivity of Solution (page 52) S m−1σB Conductivity of Solution Accounting for Gas Voidage (page 58) S m−1σB Conductivity of Solution Accounting for Gas Voidage (page 59) S m−1xxivε Current Efficiency (page 31) %ε Current Efficiency (page 59) %ε Current Efficiency (page 59) %ε(MnO2) Current Efficiency of MnO2 Deposition (page 130) %εMeasured Measured Current Efficiency (page 142) %εPredicted Predicted Current Efficiency (page 142) %xxvLIST OF ACRONYMS AND ABBREVIATIONSAAE Absolute Average ErrorADL Atmospheric Direct LeachCE Cooled ElectrolyteCOM Component Object ModuleCSTR Continuous Stirred Tank ReactorCV Controlled VariableDCS Distributed Control SystemDLM Dynamic Load ModuleEAFD Electronic Arc Furnace DustECE Electrochemical Chemical ElectrochemicalEW ElectrowinningFF Feed ForwardIAE Integral of Absolute ErrorIP Intellectual PropertyISP Imperial Smelting ProcessMIMO Multi Input Multi OuputMPC Model Predictive ControlOL Open LoopSP Set PointP&ID Piping and Instrumentation DiagramPBM Population Balance ModelPID Proportion Integral DerivativePI Proportion IntegralxxviRE Returned ElectrolyteRLE Roast Leach ElectrowinRTO Real Time OptimizationSART Sulfidization Acidification Recycle ThickeningSE Spent ElectrolyteSI Syste`me International d’Unite´s (International System of Units)SISO Single Input Single OutputSX Solvent ExtractionU UndertunedZPS Zinc Purified SolutionxxviiACKNOWLEDGMENTSI would like to thank my supervisor Dr. Akram Alfantazi for his encouragement, trust andmentorship throughout my graduate studies. I would like to thank all the colleagues in mygroup and especially Maysam Mohammadi for many excellent discussions.Thank you to the project partners Aurel Systems, HudBay Minerals, Teck, GlencoreXstrata and NSERC for their financial and technical assistance towards this work. I wouldlike to thank all of the engineers and operators working at the zinc refineries for beingexcellent hosts and for giving your time to answer my questions. Finally, I am indebted toeveryone at Aurel Systems for your mentorship and enthusiastic input in to my project.xxviiiDEDICATED TO MY PARENTSxxixCHAPTER 1INTRODUCTIONToday, 13 million tonnes of zinc are produced annually making it the fourth most com-monly produced metal in the world following iron, aluminum, and copper [1]. The mostcommon uses for zinc include brasses, galvanized steel, and casting alloys. Electrolyticzinc extraction techniques have been successfully applied to zinc processing and elec-trolytic refining of total world zinc production has increased from nil to approximately 85%over the last 100 years [2]. Electrowinning, the final step in in the electrolytic zinc processbefore casting, involves depositing aqueous zinc onto electrodes through a reduction reac-tion using an applied electric current. This is done in a zinc cell house (sometimes called atankhouse) which consumes roughly 80% of the total energy in a typical electrolytic zincrefinery [3]. In Canada there are three operating zinc refineries with a combined electricalpower consumption of approximately of 9250 TJ yr−1 dedicated to the cell houses alone.For comparison, this is the same amount of electricity used by approximately 230,000Canadian homes. This emphasizes the importance of finding and maintaining optimal pro-cess conditions in the cell house so as to most efficiently utilize this enormous amountof energy. Improvements to the energy or current efficiency of the cell house can havetremendous value. However, finding and maintaining optimal conditions in a cell house isa complex task.Zinc electrowinning has evolved over time to continually improve cell house perfor-mance. Many of these improvements have been mechanical in nature including use oflarger cells, larger electrodes, automated cathode retrieval and stripping, and automated1CHAPTER 1. INTRODUCTIONanode cleaning. However, the overall process has essentially remained the same. A puri-fied zinc bearing solution is combined with the re-circulated electrolyte in the cell house tomaintain a desired zinc concentration. A small portion of the spent electrolyte exiting theelectrowinning cells is passed out of the cell house to serve as a high acid solution for otheroperations such as leaching. The remainder is cooled before being re-circulated back intothe cells. Many other factors affect the operational characteristics of electrowinning cellsincluding applied current, electrolyte temperature, impurity concentrations, and physicalphenomenon such as dendritic growth. These interacting process variables make control-ling a cell house very challenging, requiring a great deal of experience on behalf of theoperators and plant engineers to maintain optimal conditions.Due to the complexity of chemical processes, computer modelling is a valuable toolwhich offers rapid testing of multiple process conditions with no risk to operators andminimal impacts on equipment and production throughput. The complexity of processsimulations range from basic steady state mass balances to fully dynamic plant operatortraining simulations. METSIM, SysCAD, HSC Chemistry and Excel are all known to becapable of these types of mineral processing models. However, these models generally donot account for time-based variations in the cell house processes and can be slow to solve.Thus traditional models do not account for typical process variations over the course oftime such as cathode harvesting, changing solution flow, equipment shut down, or dailyvariations in the applied current. The creation of a time-dependent process simulation ofzinc electrowinning would allow prediction of operational variances including short termand longer term impacts. This type of dynamic process simulation would also be useful fordata reconciliation, full cell house optimization, impurity tracking, and even fundamentaldesign for new projects.This work proposes a new method to analyze zinc electrowinning through dynamicprocess simulation. It will build upon previously developed models of electrowinning aswell as incorporate further electrolyte and cooling tower effects on operation. The pri-2CHAPTER 1. INTRODUCTIONmary objective of this work is to build a tool which can give better control, monitoring,and prediction of operations in a zinc cell house. It will be useful for optimizing existingoperations as well as for predicting performance in future designs. To do this effectively,work has been undertaken with all three operating Canadian zinc producers and one in-ternational zinc producer to validate the zinc electrowinning model and examine potentialapplications.3CHAPTER 2LITERATURE REVIEW2.1 History of ProcessingBefore its elemental isolation, the first use of zinc was in brass alloys recorded in ancientRoman, Indian and Chinese histories. Brasses are thought to have developed by accidentwhen materials containing zinc oxide were reduced in copper crucibles. When the zincoxide was reduced during smelting of ores containing zinc, zinc vapour emerged whichthen deposited on the flue of the smelter as zinc oxide. The zinc oxide was then combinedwith the copper to form brass [4].The first written record of the isolation of elemental zinc comes from Indian texts datingfrom the 13th century in small retorts. This record makes zinc unique as the only elementto have been first isolated outside of western science [5]. Following the isolation of zincits extraction became more sophisticated and trade grew. It was used for statues, utensils,roofing and even lining for coffins. Today, zinc’s major uses are in galvanized steel, die-cast zinc alloys, brass alloys, and other chemical reagents such as zinc oxide [6]. Thefirst written record of the isolation of elemental zinc comes from Indian texts dating fromthe 13th century in small retorts. This record makes zinc unique as the only element tohave been first isolated outside of western science [5]. Following the isolation of zincits extraction became more sophisticated and trade grew. It was used for statues, utensils,roofing and even lining for coffins. Today, zinc’s major uses are in galvanized steel, die-castzinc alloys, brass alloys, and other chemical reagents such as zinc oxide [6].4CHAPTER 2. LITERATURE REVIEWProducing zinc through pyrometallurgical processes is difficult because it requires thefurnace be closed off from an oxidizing atmosphere. This is because zinc vapourizes at907 ◦C and is quickly oxidized by air. The original small retorts were improved upon inthe 1800s when the Belgian brass industry developed the horizontal retort. This processcreated a malleable zinc sheet that is still used today for roofing in Belgium, France and theNetherlands [4]. The Imperial Smelting Process (ISP) was developed in the late 1940s. Itproduced a continuous, combined stream of lead and zinc from a feed of oxides mixed withcoke. This process is ideal for locations with a steady supply of coke, high electricity costs,and concentrates containing both zinc and lead which are difficult to separate [4]. Whilezinc was originally extracted through pyrometallurgy, hydrometallurgical processing routesmake up approximately 85% of today’s zinc production [6].Electrolytic extraction of zinc was first patented in 1881 in France. Driven by demandfor zinc from World War I, the first commercial application began in 1915 at Anaconda,Montana, U.S.A. Soon after, electrolytic plants in Trail, British Columbia, Canada in 1917and in Risdon, Australia in 1918. The cost to produce zinc in 1922 through the electrolyticprocess was $12 to $20 per short ton (1922 USD). At the time this price was balked at sincethe smelting cost of zinc was $10 to $16 per short ton (1922 USD) [7]. Adjusted for in-flation this electrolytic processing would cost approximately $169 to $281 per tonne today.In comparison, the modern Skorpion zinc plant boasts the operating costs of approximately$550 per tonne (USD) [8, 9]. This increase in operating cost is attributed to the decline inore grades and the modern demand for very pure zinc product. These conditions furtherpromoted the use of the electrolytic process over pyrometallurgical techniques.2.2 Modern Zinc ProcessingThe conventional electrolytic processing route of zinc, known as Roast Leach Electrowin(RLE), takes a zinc sulfide concentrate and roasts it to produce zinc oxide. This zinc oxide5CHAPTER 2. LITERATURE REVIEWis then leached in weak sulphuric acid and the resulting solution is purified [9]. Finally, theaqueous zinc is recovered from the purified solution through electrowinning. An outline ofthe RLE is presented in figure 2.1. Variations on this basic outline, such as direct pressureor atmospheric leaching rather than roasting, are becoming more common in newly builtzinc processing plants [10].There are many variations in processing procedures for each of these ores, however inthe end they must form an electrolyte solution that is suitable for electrowinning. Zinc elec-trowinning requires a nearly pure zinc sulphate solution to produce zinc metal efficiently.Small amounts of impurities can cause low current efficiency (e.g. Co, Ni), cathode con-tamination (e.g. Cu and Pb), or hazardous operating conditions (e.g. Cl). A more detailedsummary of impurity effects is presented in Appendix A. Disruptions caused by imperfec-tions can create problems for the entire facility since the spent electrolyte produced in thezinc cell house is used to leach incoming concentrate, and the zinc dust needed for purifi-cation comes from the produced zinc cathode. For this reason, a brief overview of zincprocessing is presented in the following sections.2.2.1 Zinc OresZinc ores originate from many different sources such as sulfides, oxides, silicates, and car-bonates [8], as well as from secondary wastes such as Electronic Arc Furnace Dust (EAFD)or Waelz Process zinc oxides [11]. A typical zinc concentrate will be comprised principallyof ZnS (sphalerite) with various other species. Table 2.1 shows a typical elemental break-down of a commercial zinc concentration [6]. Impurities that may enter the cell house willusually be introduced with the zinc concentrates that are treated.2.2.2 RoastingRoasting oxidizes the ZnS to ZnO using fluidized bed roasters. Inevitably some Fe2O3will form due to the oxidation of iron sulfides present in the ore, and this will react with6CHAPTER 2. LITERATURE REVIEW                   ! "  # $ % &Figure 2.1: General process flow diagram of the roast leach electrowin processTable 2.1: Typical commercial zinc concentrate specifications [6]Element Normal Range (%) Preferred Maximum Limit (%)Zn 48-56Fe 1.5-10 12.0Pb 1.0-3.0 3.5Cu 0.1-1.5 2.0Cd 0.15-0.3Ca 0.2-1.0 2.0Mn 0.02-0.08 0.4Sb 0.01-0.1 0.20As 0.01-0.5 0.20Co 0.001-0.02 0.02Ni 0.001-0.01 0.01Ag 0.001-0.002SiO2 0.2-2.5 3.0S 30.5-32.57CHAPTER 2. LITERATURE REVIEWZnO to form zinc ferrite (Zn ·Fe2O4). The formation of zinc ferrites should be minimizedas they require stronger leaching conditions than zinc oxide. Nevertheless, some zinc fer-rites will form during roasting, typically representing 15% of the zinc. If the zinc ferritecannot be recovered through further treatment it represents a major loss of zinc for the re-finery [12, 13]. Prior to the 1960s zinc ferrites were not recovered, but advances in ironremoval allows most modern facilities to recover this zinc. Roasting will also produce zincsilicates if significant amounts of SiO2 are present. Roasting has advantages over directleaching processes in that it eliminate some impurities such as halides and Hg. Howeverthe production of SO2 gas requires further processing to form H2SO4. This can be an ad-vantage if the refinery is close to a market for sulfuric acid, or a detriment for those inremote locations [6].2.2.3 LeachingPrimary LeachingRoasted calcine is leached using spent electrolyte from the cell house according to equation2.1. This is done over multiple countercurrent leaching stages. The first stage is a neutralleach which uses a series of Continuous Stirred Tank Reactor (CSTR)s maintained at a pHof 4.5 to 5 and 60◦C. Typically the first stage will leach 65 % of the zinc in the calcine.The resulting solid liquid mixture is passed to a clarifier where the solids report to a weakacid leach stage with a pH range of 2.5-3.5 or 5-10 g L−1H2SO4 if a secondary leach stageis not present. This will increase zinc extraction to 85 %, but will also release ferrousions from marmatitic iron in the ZnO lattice and dissolve zinc silicates as orthosilicic acid(H4SiO4). The weak acid leach product solution is passed to a second clarifier where theunderflow solids are passed through further and stronger leaching stages. The clarifiedoverflow solution is passed back to the initial neutral leach stage.ZnO+H2SO4 −−→ ZnSO4+H2O (2.1)8CHAPTER 2. LITERATURE REVIEWThe dissolved silica will precipitate under neutral leach operating pHs however caremust be taken to keep the concentration of dissolved silica low to favor the precipitation oflarge psuedo-crystalline silica. Large changes in the silica content in the neutral leach op-eration can create gelatinous silica which is difficult to settle out of solution. The aqueousferrous introduced by the weak acid leach and further leaching stages must also be precip-itated out of solution. The ferrous is removed by oxidizing it to ferric and precipitatingit as Fe(OH)3 after the neutral leach stage. This is advantageous since it scavenges minorimpurities that are detrimental to electrowinning such as Ge, As, Sb, Al, In, and Ga throughcoprecipitation [6, 14].Leaching of Primary Leach ResidueFollowing weak acid leaching, the zinc ferrites and any remaining zinc sulfides can beleached with hot (90 ◦C), high acid solutions. In a series of CSTRs the acidity can rangefrom 100 g L−1 at the start to 30 g L−1 in the final tank. The acid is provided by spentelectrolyte from the cell house, often heated with steam from the residual heat from theroasters. If there is significant silver and lead in the leach residue a second countercurrentleaching stage can be added to maximize the lead content in the solids. The solids andliquids are separated, and the liquid reporting to iron removal before being passed back tothe primary leach stage [6, 15].2.2.4 Direct LeachingDirect zinc leaching technologies, where ZnS is leached without first roasting it to a cal-cine, have gained interest for economic and environmental reasons. Often direct leachingtechnologies are incorporated into an existing RLE facility to increase production by 5-10% [9]. In China, where zinc production has increased an average of 9.6 % from 2006to 2012, the dominating RLE accounts for 80 % of zinc production with direct atmosphericand pressure leaching of ZnS technologies being introduced. Unfortunately, the expected9CHAPTER 2. LITERATURE REVIEWeconomic advantages of these direct leaching processes did not come to fruition due to un-suitable or unreasonable process concepts. Continued improvement and refinement of theprocess flow sheets is expected in the future [10].Direct Pressure LeachingPressure leaching was developed by Sherritt Gordon Mines Ltd. in the late 1970s and firstimplemented in 1980 by Cominco Ltd. in Trail, British Columbia, Canada to complementthe existing refinery. It was designed in response to concerns at locations experiencingdifficulties treating the SO2 gas from roasting. The SO2 was not desirable at some locationsdue to difficulties in transporting the formed sulfuric acid for sale, and due to the volatilesulphuric acid market. Instead, a pressure leach process was introduced where the zincsulfide is converted directly to aqueous zinc sulphate. Unfortunately this process carries alarger capital cost than the traditional leach route employed by most facilities.The autoclave is run with a partial pressure of oxygen between 700 and 1200 kPa andat 150 ◦C giving reactions 2.2-2.4. Some of the sulpher will oxidize to sulfate as well,generating sulfuric acid [6, 12, 16, 17].ZnS+H2SO4+12 O2 −−→ ZnSO4+H2O+S (2.2)FeS+H2SO4+12 O2 −−→ FeSO4+H2O+S (2.3)CuFeS2+2H2SO4+O2 −−→ CuSO4+FeSO4+2H2O+2S (2.4)Iron will precipitate in the autoclave as jarosite (e.g. equation 2.5. Hematite, plumbo-jarosite and argentojarosite can also form at lower acidities as seen in equations 2.6 to 2.8.If recovery of the lead and silver is desired, the operating acidity should be above 70 g L−1.10CHAPTER 2. LITERATURE REVIEW3Fe2(SO4)3+14H2O−−→ 2H3OFe3(SO4)2(OH)6+5H2SO4 (2.5)Fe2(SO4)3+(x+3)H2O−−→ Fe2O3 ·xH2O+3H2SO4 (2.6)PbSO4+3Fe2(SO4)3+12H2O−−→ PbFe6(SO4)4(OH)12+6H2SO4 (2.7)12 Ag2SO4+32 Fe2(SO4)3+H2O−−→ AgFe3(SO4)2(OH)6+4H2SO4 (2.8)Following the autoclave, a floatation stage is necessary to remove sulpher from thesolution. Pressure leaching can replace the traditional roast leach process entirely withtwo pressure leach stages, however without calcine available from roasting, other methodsof solution neutralization must be considered. The autoclave itself is compartmentalizedto avoid solution carryover. Each compartment is agitated individually and sparged withoxygen to oxidize ferrous ions to ferric. Often the first compartment will be twice as largeas the subsequent ones in order to have enough reaction proceed to ensure autogenousoperation. The exiting slurry enters flash tanks that reduce its temperature and preheat theincoming feed to the autoclave. The liquids and solids in the slurry are separated and theliquids are treated to remove iron either through existing calcine leach or directly to an ironremoval process [6, 16, 18].Atmospheric Direct LeachingAtmospheric Direct Leach (ADL) has been gaining interest for applications in new zinc pro-cessing facilities. An atmospheric tank has a lower capital cost than a pressure autoclavewhile removing the need to treat SO2 from a roaster. The Outotec ADL utilizes compara-tively tall leaching tanks (30 m) with an internal draft tube that suspends the slurry with11CHAPTER 2. LITERATURE REVIEWimpellers and sparged oxygen. With a retention time of 24 hours, 98% zinc extraction canbe achieved [19, 20]. The solids produced are sent to floatation to separate sulfur. It hasbeen noted that sulfur produced in ADL is more difficult to separate than the sulfur producedduring pressure leaching. Combined with the added cost of steam boilers to maintain thenecessary temperature of the leaching tank, the ADL process has a higher operating costthan the RLE process [10].The Union Minie`re direct leaching process makes use of the zinc ferrite containingneutral leach residue from a traditional RLE process. Unroasted concentrate is combinedwith the neutral leach residue in strong acid (55-65 g L−1 H2SO4) and sparged oxygen toleach the ferrites. The zinc ferrites provide iron for the ferric/ferrous couple which in turnleaches the sphalerite in the zinc concentrate.2.2.5 Iron RemovalIron removal is important for solution purity both for the iron it directly removes and forremoval of other trace elements which coprecipitate with the iron. After leaching, the ironpresent as ferrous iron is oxidized to ferric and can be precipitated out as ferric hydroxideby raising the pH to 5.5. The formation of Fe(OH)3 in this manner is not desired on a largescale since it forms very fine particles which require significant time to separate from solu-tion [12]. Three processes are commonly suggested for iron removal through precipitationin electrolytic zinc processing, each named after the compound they produce to remove theiron [6, 21].Jarosite ProcessThe jarosite process is considered the most cost effective process for iron removal, thoughit produces the greatest volume of waste [6]. The jarosite process creates precipitates thatcontain heavy metals such as Se, In, and Ge requiring containment in tailing ponds orcement as is done in the Jarofix Process. The jarosite process uses single charge cations12CHAPTER 2. LITERATURE REVIEWsuch as sodium, potassium, or ammonium ions in neutral solutions and high temperatures(90-95 ◦C) to precipitate iron as jarosite. This is demonstrated in the ammonium jarositereaction (equation 2.9 [12, 21, 22].3Fe2(SO4)3+(NH4)2SO4+12H2O−−→ (NH4)2Fe6(SO4)4(OH)12+6H2SO4 (2.9)Sulphate ions are consumed by the reaction. This is an added benefit of the jarositeprocess since sulphate ions must be added to the circuit by way of sulfuric acid. As such,stronger acid concentrations are allowable in leaching stages resulting in lower retentiontimes in leaching tanks to achieve the same extraction. As well, acid is formed in thereaction necessitating the addition of calcine in order to keep the pH at the required level.The zinc ferrites present in the added calcine will not be leached and represent a loss ofzinc. Often a pre-neutralization stage and thickener is added before the jarosite processin order to raise the pH and allow the solids captured in this stage to be treated in the hotacid leach stage. Zinc ferrites entrained with jarosite precipitates can also be treated witha releach stage since the jarosites have a higher stability than zinc ferrites in acid. This isdone in the Dor variant of the jarosite process or Outokumpo Conversion Process, but thisdoes not allow for the capture of lead-silver residues [6, 12].Goethite ProcessIn the goethite process, a hydrated ferric oxide crystal is formed by maintaining the con-centration of ferric in the system below 2 g L−1 and preferably 1 g L−1. However the ferricconcentration resulting from leaching zinc ferrites can be 30 g L−1. To reduce the ferricions, zinc sulfide is added to form ferrous ions seen in equation 2.10. The ferrous sulphateis then reoxidized at a controlled rate with oxygen or air to form goethite (equation 2.11.The goethite process is operated at 95 ◦C and a pH range of 3.5-4.0. The resulting solid13CHAPTER 2. LITERATURE REVIEWproduct is higher in iron content than jarosite, resulting in a lower volume of waste thatmust be impounded.Fe2(SO4)3+ZnS−−→ 2FeSO4+ZnSO4+S (2.10)2FeSO4+12 O2+3H2O−−→ 2FeOOH+2H2SO4 (2.11)The above reaction produces one mole of acid for each mole of iron precipitated, how-ever the zinc losses are typically higher in the goethite process than the jarosite process.This is a result of the lower acidity not able to leach all the calcine, and zinc entrainingwith the goethite precipitate. The zinc lost with goethite is not able to to be releached asgoethite will redissolve, unlike jarosite.A variant of the goethite process is the paragoethite process where the high ferric con-centration solution is added slowly to a single-stage large precipitation tank. Slow additionof the solution maintains the ferric ion concentrations below 2 g L−1 as the reaction pro-ceeds as seen in equation 2.12. However the product often contains basic zinc sulphate andhas poor crystallinity in comparison to the pure goethite product.Fe2(SO4)3+4H2O−−→ 2FeOOH+3H2SO4 (2.12)The larger amount of acid produced per mole of iron precipitated in reaction 2.12 meangreater amounts of calcine are required for neutralization compared to the jarosite process.This leads to a greater loss of zinc.The jarosite process produces waste with 25-30% iron, the goethite process produceswaste with 42-43% iron and the paragoethite waste contains 30-35% iron. Thus an advan-tage of the goethite process is less waste volume. However, zinc is lost in the precipitate.This lowers zinc recovery and adversely affects economics of the refinery [6, 12, 21].14CHAPTER 2. LITERATURE REVIEWHematite ProcessIsmael and Carvalho compared the different types of iron precipitation processes in aneffort to identify a process created marketable iron by-product rather than waste productsthat have to be contained in a tailings pond or elsewhere [21]. If iron could be removedas hematite it could be sold as a raw material for cement or pigments and would lower thecost of handling iron as a waste product. The hematite process attempts to do this by firstreducing the ferric from the zinc ferrite leach solution as in the goethite process. It is thenput in an autoclave at 180-200 ◦C with sparged oxygen (pO2 ¿ 5 bar).The main drawback to this method is the requirement of high temperatures and an oxi-dizing atmosphere. It carries much higher capital and operational costs, due to the requiredautoclave, which may not be offset despite the marketable iron precipitates formed. Fur-ther, the hematite produced typically contains too many impurities (particularly zinc andarsenic) to be marketable for the steel industry. Finally, the conditions in the autoclave tendto cause deposits on the autoclave walls requiring multiple pressure vessels to maintaincontinuous operation as the autoclaves are cycled through cleaning [6, 21].2.2.6 Zinc Dust CementationCementation is a very common method of purifying zinc electrolytes as a final step beforeelectrowinning. This is done in multiple stages in order to selectively remove impurities(M) as seen in equation 2.13 [12]. Any metals electrochemically more noble than zinc canbe reduced by adding zinc dust to the solution. Zinc dust is produced by atomization of zinccathode produced in the cell house. The zinc dust oxidizes and dissolves in the electrolytewhich is subsequently recovered through electrowinning. Cementation will cause zinc tobe caught and lost in the precipitate. The solid precipitate formed can be sold if valuablemetals are present, otherwise it must be disposed of or recycled. Upwards of 6 % of thecathodic product can be made up of zinc dust used to cement out impurities. Typical the-oretical stoichiometric amounts are only 0.5-1.5 % however inefficiencies in precipitation15CHAPTER 2. LITERATURE REVIEWrequire greater amounts of zinc dust. Inefficiencies are caused by the parasite evolution ofhydrogen, and zinc dust granules being coated by reduced impurities and trapping the corezinc within the precipitate particle. This results in lost zinc in the overall extraction [12,23].Zn+M2+ −−→ Zn2++M (2.13)Zinc dust purification removes nobler metal impurities but the driving force of the reac-tion is largely influenced by the potential differences between the metal impurity and zinc.Impurities having standard electrode potentials closer to zinc such as cobalt, cadmium, andnickel are more difficult to remove from solution than copper or arsenic.A further complication is the hydrogen evolution reaction. Zinc has a very low ex-change current density for hydrogen evolution, allowing kinetic longevity in solution. Met-als such as copper, cobalt, and nickel have high exchange current densities for hydrogenevolution. Higher exchange current densities will catalyze hydrogen reduction on thesesurfaces as zinc oxidizes, reducing the efficiency of the zinc dust in removing unwantedimpurities.For this reason the method of zinc dust addition is important. Adding zinc in smallaliquots (5-10 % of the required stoichiometric amount) at a time results in greater ef-ficiency losses due to hydrogen evolution. Larger additions of zinc dust are thought tooverwhelm the hydrogen reaction kinetics, allowing the zinc dust time to cement out thetargeted impurities [23]. To remove these elements more efficiently, an activator is addedin the form of copper with antimony or arsenic. These activators are thought to form in-termetallic compounds with the impurity that have a lower hydrogen evolution exchangecurrent density [6].The order that the impurities are removed is also important and varies between pro-cessing facilities. Multiple stages are used to effectively remove all impurities and createmarketable product cements. The traditional order is: a hot (85 ◦C)arsenic activated Co,Ni, and Cu removal followed by a second stage at 70 ◦C to remove cadmium. A third pol-16CHAPTER 2. LITERATURE REVIEWishing stage is also possible. The Cu/Ni/Co cement from the first stage can be leached withspent acid to remove zinc and cadmium. Note that the resulting Co/Cu cement is typicallycontaminated with arsenic, which reduces its value.Another approach, called the “reverse purification procedure”, has a colder first stage(65 ◦C) to remove copper and cadmium. This cement can then be leached of cadmium withspent acid from the cell house leaving a purer Cu product. Next is a hot activated zinc dustcementation step (requiring the addition of copper sulfate) to remove the remaining Co,Ni, and copper. Many variants on these two purification procedures exist, but ultimatelythey must produce a solution pure enough for electrowinning [6,12]. The effects of variousimpurities on zinc electrowinning have been summarized in Table 2.2.Table 2.2: Zinc dust purification - typical composition ranges of neutral and purifiedsolutions [12]Neutral Solution pH: 4.5 - 5.2 Purified Solution pH: 4.5 - 5.5Zinc 100 - 180 g L−1 100 - 180 g L−1Manganese 2.5 - 20 g L−1 2.5 - 20 g L−1Cadmium 10 - 500 mg L−1 0.1 - 0.5 mg L−1Copper 10 - 600 mg L−1 0.02 - 0.05 mg L−1Iron 1 - 10 mg L−1 1 - 10 mg L−1Cobalt 2 - 20 mg L−1 04 - 1.0 mg L−1Nickel 1 - 10 mg L−1 0.05 - 0.1 mg L−1Arsenic 0.1 - 10 mg L−1 0.1 - 0.2 mg L−1Antimony 2 - 100 mg L−1 0.04 - 0.2 mg L−1Germanium 10 - 100 mg L−1 0.001 - 0.01 mg L−12.3 Zinc Electrowinning2.3.1 Zinc Electrowinning CellsA zinc electrowinning cell consists of a long narrow tank, aluminum cathodes, lead-silveranodes, and electrolyte which enters one end and overflows at the opposite. The tank isa few centimeters wider than the electrodes and has a depth approximately half again the17CHAPTER 2. LITERATURE REVIEWheight of the electrodes. The length of the cell determines how many electrodes can beplaced in it. A general diagram of a cell is presented in figure 2.2. The tank itself isconstructed out of concrete with a liner to prevent sulfuric acid attack on the concrete.Still, the prevalence of sulfuric acid mist in cell houses, and unavoidable acid spillageover the side of cells causes the concrete to deteriorate quickly and can expose the steelreinforcements. Recently concrete has been replaced with acid-resistant concrete. Moderncells have trended towards having longer cells with larger and more numerous electrodes[24]. Consideration must be taken when designing the cell house crane, which collects theelectrodes for stripping or cleaning, to ensure the it can handle the masses it must pick up.Electrodes are placed in the cells upon aluminum busbars running on the long edge ofthe cell. Copper busbars are avoided in a zinc cell house as the high acid concentrationin the cells will corrode the copper, degrading the electrical connections, and introducingcopper to the electrolyte eventually contaminating the cathode product. Electrodes are typ-ically 4.5 cm apart from centre to centre. Shorter distances between electrodes reduceselectrical potential loss from solution resistivity, but may create the risk of electrical short-ing in the cell. The busbar is typically cut to improve its physical connection with theelectrode and to provide more surface area for current to flow in order to reduce heat buildup in the busbar. The cathodes from one cell and the anodes from the next sit on the samebusbar. The opposite end of the electrode sits on an insulated contact and the active portionof the electrode hangs in the cell electrolyte. In this pattern, the cells form a large seriescircuit with potential provided by a direct current rectifier. The number of cells in series islimited by the power capacity of the rectifier. Typically there is potential loss due to poorbusbar connections, estimated to be approximately 0.05 V, however this varies between cellhouses and is generally small when compared to the typical cell operating potential of 3.4V.Volume is provided below the bottom of the electrodes to aid in the settling of precip-itated solids such as PbSO4 or MnO2, that form an anode mud. The extra volume aids in18CHAPTER 2. LITERATURE REVIEWFigure 2.2: General diagram of a zinc electrowinning cell. Dimensions not to scale.preventing the mud from being mixed in to the electrolyte by the action of electrolyte flowor gas evolution on the electrodes. Solids agitated in the electrolyte can reduce cathodepurity [25]. Pb is introduced to the electrolyte through corrosion of the anodes and must beprecipitated in order to avoid cathode contamination. Often strontium is added as SrCO3which precipitates as SrSO4, adsorbing Pb or codepositing it as PbSO4. MnO2 precipi-tates in the cell due to the oxidation of manganese at the anode. The cells are periodicallycleaned of mud using vacuum hoses that can be used during operation. In extreme cases of19CHAPTER 2. LITERATURE REVIEWmud buildup the cell is drained and the mud is removed manually. The collected muds arefiltered, washed, and recycled to leaching in order to provide a source of manganese for thecells [6, 26].ElectrodesCathodes in zinc electrowinning are typically made of brushed aluminum alloy. The Alcathode blank is often brushed between stripping cycles in order to prevent zinc cathodesfrom adhering too strongly to the surface, and preventing the zinc from being stripped off.If halides such as Cl– and especially F– are present, cathodes may be unstrippable. Thisis colloquially referred to as “sticky cathodes” [27]. Sticky cathodes must be recovered byreleaching the zinc from the cathode blank with acid and re-treating the cathode blank. Theoccurrence of sticky cathodes is reduced if brushing is done on the cathode after stripping.Sticky cathodes are thought to be caused by the formation of intermetallic Al compoundswhich form a more adherent bond with the deposited zinc. Inert side strips are places onthe cathode blanks to prevent zinc from wrapping around the cathode, making strippingdifficult.Zinc electrowinning anodes are typically made of a lead silver alloy, ranging from 0.5%to 0.75% Ag. The silver content gives the anodes a higher corrosion resistance, reducesoxygen evolution overpotential, and improves mechanical strength. Prior to alloying withsilver, the poor mechanical strength of lead was a major obstacle to increasing the anodedimensions and thus increasing cell house production. Anodes receive a great deal of atten-tion as they are the single greatest contributor to the operating cell potential (approximately1.9 V of the 3.4 V total). Further, the silver content of the anodes makes them very costly toreplace. The typical service lifetime for an anode is three to four years. Evidence suggestsanode lifetimes have been five to seven years in the past, however no cause has been givenfor this decrease in service life [28]. Conventionally, anodes are smaller in dimensions thanthe cathodes, with the bottoms and sides being a couple of centimeters smaller. This is de-20CHAPTER 2. LITERATURE REVIEWsigned to direct the current so deposited zinc grows inwards and prevent excessive growthat the edges. Larger anodes typically must be thicker to give them dimensional stability,however this adds mass which the crane must be capable of lifting.Aqueous ChemistryThe aqueous chemistry of the zinc electrolyte is one of the most critical parameters in zincelectrowinning. The physical and chemical properties of the zinc electrolyte are highlyinfluenced by temperature and solution concentration, (density, viscosity, and conductiv-ity). Several relations have been suggested to predict the density of the electrolyte. Eachtypically uses the concentration of zinc, acid, other ionic species, and temperature. Thesolution conductivity is calculated based on similar variables and is a major determinant inthe voltage of the cell. Changes in solution conductivity through the length of the cell cancause the undesired effect of zinc preferentially depositing at one end. For this reason theelectrowinning cell must be kept well mixed. Finally, Pitzer parameters as seen in Table2.3 are recommended to predict the activity coefficients of the zinc electrolyte given thehigh concentration of aqueous species [29–31].Three principle reactions occur in zinc electrowinning. Zinc ions are reduced at thecathode, while oxidation of water at the anode produces acid and oxygen gas. Hydrogenevolution also takes place at the cathode in a parasitic reaction which is the main cause ofreduced current efficiency under normal operating conditions.Table 2.3: Pitzer Parameter values used in the prediction of electrolyte componentactivity coefficient values with temperature (T ) in KelvinIon Pairing β (0) β (1) β (2) C(φ)Zn2+-SO42– [29] 1.280-0.00366T 4.077 + 0.0233T 32.817 - 0.333T -1.151 + 0.00397TZn2+-HSO4– [29] 0.439 1.811 0 0.0397H+-SO42– [31] 0.113104 -0.76726 0 -0.00763H+-HSO4– [31] 0.224635 0.710204 0 -0.0040121CHAPTER 2. LITERATURE REVIEWZn2+(aq)+2 e– −−→ Zn(s) Eo298 =−0.76 VSHE2 H+(aq)+2 e– −−→ H2(g) Eo298 = 0.00 VSHEO2(g)+4 H+(aq)+4 e– −−→ 2 H2O(l) Eo298 = 1.23 VSHEThe low reduction potential of zinc is both an advantage and a disadvantage in elec-trolytic processing. With a standard equilibrium reduction potential of -0.76 VSHE , elec-trodeposition of zinc requires very pure solutions for electrowinning otherwise the elec-trodeposition of a pure and appreciable amount of zinc is unattainable. However, as aresult of the pure electrolyte, the zinc product is typically very pure as well (Special HighGrade≥ 99.99%zinc), and can go directly to casting without further refinement [32]. Whileelectrodeposition of zinc from a highly acidic solution is not thermodynamically favoured,it is kinetically possible due to the high required overpotential of hydrogen on zinc metal.However this kinetic barrier can be compromised when impurities are present. The overallpotential breakdown in a zinc electrowinning cell can be found in Table 2.4 [33].Manganese in Zinc ElectrowinningManganese in zinc electrowinning is an essential component for optimal cell house oper-ation because of its importance in maintaining the PbAg anodes. Mn contributes to mudgenerated in zinc electrowinning which has both adverse and beneficial contributions to theperformance of the cell. Over the course of operation, a cell will generate mud consist-ing largely of manganese dioxide, lead sulphate, and gypsum. The mud will accumulatein two general areas: as a scale adhering to the anodes, and as a precipitate mud productTable 2.4: Approximate contributions to the total cell potential [33]Reversible Cell Potential 1.99 VCathodic Overpotential 0.15 VAnodic Overpotential 0.6 VElectrolyte Resistance 0.5 VOther Cell Resistances 0.25 VTotal Voltage 3.38 - 3.4422CHAPTER 2. LITERATURE REVIEWresiding on the bottom of the cell. The composition of the these two muds (further referredto as anode and cell mud) is usually dissimilar. The anode mud is being largely γ-MnO2,a solid solution of MnO2 and lower oxidation state manganese containing hydroxyl ions(MnOn · (2−n)H2O) [26]. The cell mud is usually a mixture of gypsum, MnO2 which hassloughed off of the anode coating, and Pb (as PbO2 or PbSO4) which flakes off along withthe MnO2 scale from the anode or precipitated from solution using strontium carbonate.The muds accumulate over the course of operation, and periodically the anodes and cellsare cleaned, with the solids being collected for sale or operational use in other sections.Mud accumulation presents several problems for operation. MnO2 scale built up on theanodes presents an increased risk for electrical shorts if a physical connection between thecathode and the anode is formed. As well, particulate MnO2 (often associated with newanodes) can diminish cathode Zn morphology [25]. Accumulation of mud at the bottom ofthe cell will reduce the available liquid volume of the cell and in extreme cases may preventelectrodes from fully submerging and connecting with busbars. Cell muds will accumulateat a rate dependent on many conditions such as concentrations, additive additions, and thetype of anode used.Manganese also has benefits for the cell. The MnO2 scale on the anode provides valu-able corrosion protection and lowers the oxidation overpotential of the water electrolysisreaction [34–36]. The corrosion protection reduces Pb dissolving and entering the solutionwhich in then reduces the contamination of the cathode product, and the volume of Pb pre-cipitated contributing to the cell mud. Further, the presence of manganese ions has beenreported to reduce the evolution of chlorine gas through proposed scavenging reactions(equation 2.14 and 2.15). This limits the dissolved chlorine in the electrolyte and conse-quently reduces chlorine gas venting out of the cells. Chlorine is a hazard for operators andcan corrode equipment, particularly at the solution level of the electrodes. The surface ofMnO2 has also been found to inhibit the evolution of Cl2 gas in comparison with bare Pbelectrodes [26, 37, 38].23CHAPTER 2. LITERATURE REVIEWMn2++ 12 Cl2 −−→Mn3++Cl− (2.14)Mn2++Cl2+2H2O−−→MnO2+4H++2Cl− (2.15)Typically a Mn2+ target concentration of 3-4 g L−1 is desired in order to promote theprotective anodic scale however concentrations can be higher for example 18 g L−1 [25].The MnO2 rich mud that is produced can be a valuable process reagent often added duringleaching prior to electrowinning in order to boost the concentration of Mn2+ if the puri-fied zinc solution entering the cell house is deficient. In solvent extraction circuits whereMn is removed entirely from the leach solution the addition of MnO2 after purification isparticularly important [6].Impurities and AdditivesThe impurities introduced to a cell house will depend on the concentrates used and theleaching technique [39]. The concentration of impurities can be reduced through solutionpurification, but they will be present in any electrolyte as the cost of further removal beginsto become too high to justify further purification. The negative effects of impurities suchas Cu [40], Ni [41, 42], Co [43, 44], Sb [44–46], As [43], Ge [47], and Fe [40] are all seenin zinc electrowinning. Many metal impurities have a more noble reduction potential thanzinc, resulting in even small concentrations of these impurities co-depositing with zinc.This is detrimental as it will deteriorate the deposit purity and cause a minor decrease inthe current efficiency of the reduction reaction. Furthermore, after deposition of these metalimpurities, two additional phenomenon can occur which decrease the current efficiency toan even greater extent.First, the deposition of a metal such as copper, cobalt, or nickel can create a localgalvanic cell wherein the impurity begins to dissolve the surrounding zinc metal, creating a24CHAPTER 2. LITERATURE REVIEWpit. Second, impurities act as sites which catalyze the parasitic hydrogen evolution by wayof the reduced hydrogen overpotential in comparison to the surrounding zinc. This canlead to an induction period where zinc deposits normally for a time, then spontaneouslydissolves. This phenomenon is thought to be due to the local deposition of nickel on thecathode, which serves as a catalysis site for hydrogen gas. The hydrogen gas formed localgalvanic cell resulting in the re-dissolution of the zinc. It was shown that the potentialat the bottom of the hydrogen bubbles reaches a potential capable of oxidizing zinc [42,48]. Multiple impurities can also act synergistically to exacerbate their negative effects.Examples of such combinations include nickel-cobalt [49], and cobalt-arsenic [43].In most industrial facilities, an organic compound is added to the electrolyte at lowconcentrations in order to promote the growth of smooth deposits during electrowinning.Smooth, compact deposits are desired because they are easier to strip and less likely tocause electrical shorts from dendritic growth bridging the electrode gap. Additives such asanimal glue or gum arabic are used to refine and level the deposit, promoting smaller grainsand limiting dendrite formation [43, 50]. This is thought to be achieved through a mecha-nism of increased nucleation overpotential for zinc deposition, however this benefit usuallycomes with the cost of decreased current efficiency and increased power consumption.Organic reagents such as Dowfroth, saponin, or licorice are also often added to actas acid mist suppressors in zinc electrowinning. They operate by creating a foam layerat the top of the cell in order to trap acid-laden bubbles that burst on the surface of theelectrolyte [51]. The foaming agent Dowfroth was used in the Kidd Creek plant in Ontario,Canada, however it was observed that it had negative effects on the current efficiency anddeposition characteristics. Antimony could counteract this to some extent. In general,saponin had no effect on the current efficiency. Saponin gave deposit morphologies thatcontained smaller and more distinct nodules [52]. Strontium carbonate is also regularlyadded to cell house electrolytes to precipitate any Pb in the solution (typically caused bycorrosion of the anode) to prevent co-deposition of lead on the cathode [53].25CHAPTER 2. LITERATURE REVIEWOptimal Electrolyte ConditionsMany studies have investigated the conditions of zinc electrolytes, and their effect on theelectrowinning process. Determining the optimal conditions of a zinc electrolyte is difficultdue to the large number of variables that performance is dependent on. From a high purityelectrolyte, the response of current efficiency has been measured against three factors: thetemperature, the current density, and the rotation speed of a rotating electrode. It wasconcluded that the rotation speed had little effect on the current efficiency, suggesting anactivation controlled process. On the other hand, temperature and current density did havemarked effects. As the temperature or current density increased, the current efficiencyincreased as well [54]. It must be noted that these studies utilized an ideal electrolytewith no impurities. As well, the deposition quality was not examined. High operatingcurrent density (such as 890 A m−2) can be detrimental to the quality of the zinc depositcreated [55].Optimal electrolyte concentrations and temperatures will yield a good combination ofhigh current efficiency, low power consumption, and low operating cost. The factors af-fecting the zinc electrowinning cell performance were examined by Scott et al. [56]. Thegoal of this study was to determine, from experimentation, the conditions which would givethe optimum operating conditions for an electrowinning cell. The optimum was defined asthe conditions which resulted in the greatest amount of zinc produced given the amount ofenergy put in. Based on experimental results, the current efficiency increased as the zincconcentration increased, and reached a plateau after 60 g L−1 of zinc. The power consump-tion achieved an optimum value at approximately 70 g L−1. Beyond this concentration itwas believed that increasing zinc concentration would decrease the solution conductivity,requiring a greater voltage. An increase in acid concentration in the cell was found to de-crease both the current efficiency and the energy consumption per mass of zinc plated. Thisresult was somewhat counter-intuitive. However, while hydrogen evolution at the cathodeincreased with increasing acidity, the conductivity of the solution also increased. The in-26CHAPTER 2. LITERATURE REVIEWcrease in conductivity off-set the losses of current to hydrogen, and lowered the energyconsumed overall. These results indicated that running cells at acid concentrations as highas 180 g L−1 would be beneficial to power consumption, as well as the acid regenerationfor leaching. Temperature increases were found to raise the current efficiency and decreasethe power consumption. Current density had very little effect on the current efficiency, butpower consumption per tonne of zinc increased with higher current density [56].In a study designed to find the optimal concentrations of zinc and acid, Alfantazi andDreisinger examined the effect that these concentrations had on the cell performance [57].It was found that increasing the zinc concentration caused current efficiency to increase.This, in turn, decreased the energy consumption per tonne of zinc produced. It was ob-served that at low zinc concentrations, nodules (unfavorable for production) began to form.It was also noted that electrolyte conductivity tended to increase with increasing acid con-centrations as well as with increasing temperature. This finding was significant becausesolution conductivity has a large effect on the cell voltage, and therefore on the energyconsumption of the plant. Guillaume et al. also examined the optimal conditions for anelectrolyte in zinc electrowinning [58]. Their study was consistent with others, holdingthat higher acid concentration led to decreased zinc deposition yields. The authors suggestthat this is due to an increase in the exchange current density for hydrogen evolution.2.3.2 Zinc Electrowinning Cell HousesIn a conventional zinc electrowinning cell house, a purified zinc sulphate electrolyte (typi-cally 160 g L−1 Zn2+, 0 g L−1 H2SO4 and 25◦C) is fed to the cell house. This Zinc PurifiedSolution (ZPS) originates from previous purification steps where most impurities have beenreduced to part per million levels or less.27CHAPTER 2. LITERATURE REVIEWProcess FlowA general zinc cell house process flow diagram is presented in Figure 2.3. The ZPS entersthe cell house where it is mixed with recirculating electrolyte coming from cooling towers.This forms the Cooled Electrolyte (CE) which is typically 60 g L−1 [Zn2+], 175 g L−1[H2SO4] and 30◦C. The CE is distributed evenly among all of the electrowinning cellsin the tank house with the Spent Electrolyte (SE) overflowing at the opposite end of thecell. The solution flowing through the electrowinning cells has a typical residence timeof 60 minutes. Under normal operating conditions, aqueous zinc will be depleted whilethe acid concentration will increase giving typical SE conditions of 55 g L−1 [Zn2+], 185g L−1 [H2SO4], and 35◦C. Due to the gas evolution at the electrodes and fast cooledelectrolyte flow, the cell is usually assumed to be perfectly mixed, that is, the outflowingspent electrolyte composition being the same as the resident electrolyte in the cell. Thedifference in zinc concentration between the cooled and spent electrolyte is sometimesreferred to as the “bite.” If the bite is larger than 5 g L−1, the electrolyte will not beperfectly mixed. Operators have reported that larger bites caused current to trend towardsthe cathodes at the outflow side of the cell. This was due to the higher conductivity at theoutflow end caused by the higher acid concentration.Small amounts of water are added to the cell house for washing and cooling purposesand affects the concentration in the cells. It is important to maintain the conditions in theSE as this is the solution that the electrodes are exposed to and altering the concentrationwill affect the process current efficiency, power consumption, and cell voltage. Furtherdisruptions of the SE are associated with undesirable effects in the cathode product such asdendrite growth, sticky cathodes and lowered metal purity [6,57]. The SE is passed to stor-age tanks, where 90-95% of the electrolyte is pumped to atmospheric evaporative coolingtowers and air passes over a spray of the electrolyte. Finally this recirculated electrolytecombines with incoming ZPS to form the CE again. The remaining 10-5% of electrolytethat is not recirculated is passed back to previous leaching operations as Returned Elec-28CHAPTER 2. LITERATURE REVIEWFigure 2.3: Reference schematic of typical cell house. ZPS: Zinc Purified Solution,CE: Cooled Electrolyte, SE: Spent Electrolyte, RE: Returned Electrolytetrolyte (RE).Electrolyte CoolingDue to the decreased current efficiency and cathode quality at higher temperatures it isnecessary to cool the recirculated electrolyte. Atmospheric cooling towers are common,however cooling coils within electrowinning cells have been reported as well [59]. SE ispumped up to cooling towers which often sit on the roof of the cell house. The electrolyteis sprayed down from the top of the tower while atmospheric air is fanned in the oppositedirection. The solution is cooled through a combination of the vaporization of water andthe temperature difference between the air and spent electrolyte.The performance of the cooling tower depends on the ambient atmospheric conditions.29CHAPTER 2. LITERATURE REVIEWIt can be difficult to cool the electrolyte to the set point temperature, particularly in the sum-mer. High air humidity and temperature can create difficulties in cooling. In extreme casesthe current applied to the cell house needs to be reduced. The cell house is a net evaporatorof water in the zinc processing circuit. During periods of high air humidity and temperaturethere is low tolerance for water addition to the cell house or during previous leaching andpurification operations. In those conditions not enough water can be evaporated to maintainthe desired concentrations.2.3.3 Modelling of ElectrowinningAs discussed previously, there are many variables that influence the performance of zincelectrowinning including concentrations of zinc, acid, impurities, additives, the electrolytetemperature, electrode gap, and applied current. To add further complexity, an electrowin-ning cell cannot operate in isolation. Rather, the electrolyte recirculating in the cell house,its residence time, pumping capacity, incoming solution purity, and even the ambient weatheraffecting the cooling towers will all contribute to the performance of the cells. All of thesecontribute to the difficulty of modelling zinc electrowinning.Modelling Zinc ElectrowinningOne of the first to attempt to characterize the effect of zinc electrolytes on electrowinningwas Wark [60]. First stated in 1964, (however the original work was done in 1926 to1929) the relation known now as “Wark’s rule” was formulated. It became a a method ofpredicting the current efficiency based on the concentration of zinc sulphate and sulphuricacid. Wark’s rule is demonstrated in equation 2.16 where ε is the current efficiency, kWis Wark’s Constant, and cZn2+ is the molar concentration of zinc and cH2SO4 is the molarconcentration of sulfuric acid.ε =1kWcZn2+cH2SO4(2.16)30CHAPTER 2. LITERATURE REVIEWBased on Wark’s rule, it is clear that 100% current efficiency cannot be reached. Itrefuted a previous view that suggested hydrogen evolution was a product of impurities inthe electrolyte and that 100% current efficiency was possible [61]. However, Wark showedthat hydrogen evolution cannot be avoided through experimental investigation using highpurity and impurity bearing solutions.More sophisticated empirical relationships have also been suggested. Based on an it-erative process of fitting parameters using regression coefficients, equations have been de-veloped to predict the current efficiency based on three input parameters: current, zincconcentration, and acid concentration. This equation requires only three variables, makingit a quick and convenient method of predicting current efficiencies. It was suggested thatthe optimum conditions for zinc electrowinning using a high purity electrolyte was at 61◦C, 890 A m−2, 52 g L−1 Zn2+ and 105 g L−1 H2SO4 [54]. Cruz et al. developed an empir-ical formula to predict current efficiency and power consumption through linear regressiontechniques based on the concentrations of zinc, acid, and seven additives and impuritiescommon in zinc electrowinning [62]. Empirical models such as this one are especiallyuseful for rapid calculations and characterizing complex effects such as the synergistic ef-fects of impurities and additives. Empirical relations also have been presented for manyphysical and chemical constants pertinent to zinc electrowinning such as solution conduc-tivity, viscosity, density, diffusivity of zinc ions, and Pitzer activity coefficients [29, 30].Gas evolution can be modelled to predict effects caused by the formation and growth ofbubbles on the electrode surface. These effects can include increased resistivity of thecell, masking of surface area resulting in a larger effective current density, and localizedsupersaturation [63, 64].Empirical models face limitations in situations outside of the validated limits of themodel. A simple example of this can be seen in Wark’s rule where the constant kW must becharacterized for different electrolytes [65]. A fundamental model, while often more cal-culation intensive, can have greater applicability and validity over broader ranges of condi-31CHAPTER 2. LITERATURE REVIEWtions. As well, empirical relations for physical and chemical properties can be incorporatedinto a fundamental model to provide predictions of constants which might otherwise be tootime consuming or impossible to predict given a lack of data. Fundamental models of gen-eral electrochemical reactors have been proposed in literature. Thin diffusion layer modelshave been developed which focus on diffusion of reactants and geometric effects. As such,these models focus on process hydrodynamics [66, 67]. In the case of zinc electrowinning,the cell may be assumed to be well mixed due to the evolution of hydrogen and oxygen atthe electrodes in combination with the high flow rates of entering electrolyte [68].A fundamental model of zinc electrowinning was proposed and developed by Bartonand Scott [3, 56, 69, 70]. Their model consisted of approximately 95 equations that en-compassed mass, energy, and current balances, all based on fundamental thermodynamicand electrochemical relations. It was able to predict the current efficiency and cell po-tential based on the configuration of the cell, the composition and temperature of the cellelectrolyte, and the cathodic current density. Their model was validated using a 10 L testcell [3] as well as a 3900 L pilot cell [70]. Of critical importance was the Butler-Volmerequation that relates the overpotential to the current density (equation 2.17). This equationprovided a basis for the kinetics of the reaction as well as a prediction of the current lost tohydrogen evolution.i = i0[exp(−αηzFRT)− exp((1−α)ηzFRT)](2.17)The Butler-Volmer equation can be simplified to the Tafel equation in cases where theoverpotential is 0.118 V beyond the equilibrium potential (equation 2.18) [3]. This is thecase for the oxygen and hydrogen evolution reactions.i = i0exp(−αηzFRT)(2.18)32CHAPTER 2. LITERATURE REVIEWOne notable variation of the Butler-Volmer equation includes a mass transfer term asseen in equation 2.19 [3, 71]. At low concentrations of zinc, the rate of reaction at thecathode will outpace the rate that the zinc can diffuse from the bulk electrolyte to thecathode. The il term denotes the limiting current density caused by this mass transferlimitation.i = i0[(il− iil)exp(−αηzFRT)− exp((1−α)ηzFRT)](2.19)This Barton and Scott model was then validated against data collected from a 10 Llab cell. The correlation between modelled and experimental results was good, with theaverage error being 0.6 % for current efficiency and 1.4 % for power consumption [3].The model was then developed further by scaling it up from a lab-sized simulation to asimulation of an industrial cell. This included adding the effects of bubbles from oxygenevolution on solution conductivity and the resulting cell voltage, water evaporation, cellcooling coils, and manganese scale effects. The results were validated against a 3900 Ltest cell. These added calculations had only minor effects on the overall model, but wereimportant for completeness. Again, the simulated results closely matched the experimen-tal results, with average errors of approximately 1 % for power consumption and currentefficiency [70].Barton and Scott’s series of papers were concluded by outlining some of the industrialapplications of their model. They list applications such as optimization of cell operatingconditions, investigation of new circuit configurations, and a dynamic model of a feedbackcontrolled cell. For optimizing the cell performance, they recommended 69 g L−1 Zn in thecell, 132.3 g L−1 acidity in the cell, 40◦C, and 300 A m−2. All this gives a minimum powerconsumption of 2706 kWh tonne−1 (for a high purity electrolyte) [59]. These optimalconditions are also similar to those found by other thermodynamic models as well [54,72].33CHAPTER 2. LITERATURE REVIEWHowever, it must be noted that a 70 g L−1 zinc concentration is not typical in moderncell houses because it results in nodular zinc deposits (colloquially known as “peanutting”)which can lead to current shorting. Furthermore, the low acidity may be disruptive forleaching as a greater volume of spent electrolyte is needed, thus decreasing retention timesand increasing heating.The Barton and Scott model was developed using a spreadsheet-based program thatwould iterate until finding a solution for a single point in time. However, due to limitationsin computing power, mathematically complex parameters such as activity coefficients andother physicochemical effects had to be roughly estimated using a constant or ignored toallow a reasonable computation time. Further, the experimental data this study collectedwas taken at steady state conditions, which makes any dynamic calculations difficult tovalidate. Despite these limitations, this model does provide the groundwork for the currentsimulation and industrial applications that can be further investigated, as Barton and Scottultimately suggested [59].Gas Bubble EvolutionBubble flow and formation have various effects on the performance of a cell. First, bubblesact as insulating spheres, preventing deposition where they are present on a cathode surface.Second, bubbles can increase the solution resistance by reducing the effective cross sectionfor current flow [63]. Finally, the micro-convection of hydrogen bubbles at the cathodeis assumed to be the primary method of zinc mass transport under typical electrowinningconditions [73].The effect of oxygen bubbles on solution conductivity was predicted by Barton andScott who noted an average decrease in conductivity of 4% [70]. Since this resistive losswas comparatively small (equivalent to approximately 10 mV), these relations were leftout of their program due to the minimal benefit received for the computationally complexalgorithm required. Hydrogen evolution was found to have a much smaller effect given the34CHAPTER 2. LITERATURE REVIEWlower volumes of hydrogen typically produced.Mass Transfer of Zinc IonsThe diffusion of zinc ions in electrowinning is particularly important at lower Zn2+ con-centrations and higher current densities where the kinetics of zinc deposition become moredependent on mass transfer. Two mechanisms are recognized to be responsible for masstransfer at a gas evolving electrode: macro-convective effects due to natural fluid flow (suchas active fluid pumping and buoyant rise of bubbles), and micro-convective effects due tonucleation, growth, and detachment of gas bubbles [68]. Micro-convection caused by evo-lution of hydrogen gas at the cathode has been identified as the primary source of Zn2+mass transfer in the current densities used typically in electrowinning [73]. Mass trans-fer relations (e.g. equation 2.20) and equations using dimensionless numbers are commonmethods for characterizing the mass transfer at a gas evolving electrode. Several sourceshave suggested methods for calculating the mass transfer coefficient Km specific for zincelectrodeposition [3, 74, 75].Km = KT(VgAC)n(2.20)Other relations have been suggested to predict Km, as seen in equations 2.21 and 2.22where υ is the kinematic viscosity, iH is the current density of the hydrogen evolutionreaction, Re is the Reynolds number, Sc is the Schmidt number, and Sh is the SherwoodNumber. Cathro et al. note that equation 2.21 may not be reliable as it uses a potentio-dynamic method which would not account for hydrogen evolution [76]. Finally, the formderived by Hosny et al. using dimensionless numbers was determined to be unsuitable sincethe characteristic length used was the immersed depth of the cathode [75]. Instead, Vogtrecommended equating the characteristic length to the thickness of the micro-convectivelayer [77]. Since the thickness of the microconvective layer can be difficult to define35CHAPTER 2. LITERATURE REVIEWbetween different systems, the form of equation 2.20 was deemed the more appropriatecompared to a dimensionless number method for zinc electrowinning. The reported valueof n varies between 0.25 and 0.87 [75]. A low value of n is a characteristic of a hydrody-namic model while a value of approximately 0.5 is more characteristic of a microconvectivemodel.Km = 0.186x10−3u0.8L +0.18x10−3(iH2)0.5 (2.21)Sh = 12.47(ReSc)0.45 (2.22)Modelling of Other Electrowinning ProcessesModels of copper electrowinning have also been developed. These are useful because thearchitecture of the equation within the copper electrowinning models is often applicable tozinc electrowinning. The diffusion and kinetics of modelling a continuous parallel platehave been examined [78]. The model takes into account three layers between a parallelcathode and anode; the bulk, and the diffusion layers at the anode and cathode. In the bulk,the flow and concentrations are assumed to be constant. Within the diffusion layers, theyare assumed to be variable. The parallel plate model focuses on hydrodynamics unlike theone developed by Barton and Scott. It also includes the effects of voltage drops across theboundary layer based on diffusion of all species through the layer. The parallel plate modelwas validated against previous results, and there was good agreement in the prediction ofthe limiting current density under different electrolyte conditions.A steady state model of copper electrowinning was developed based on Butler-Volmerequations which could calculate the current efficiency and potential [79]. The model pa-36CHAPTER 2. LITERATURE REVIEWrameters (four reactions each with an exchange current density, mass transfer coefficient,and charge transfer coefficient for a total of 12 parameters) were determined using data col-lected from a pilot Solvent Extraction (SX)-Electrowinning (EW) facility and were solvedby using an optimization routine. The routine sought to minimize error between the modeland plant data. One potential pitfall with this method of parametrization is that plant datawill typically stay within a narrow operating range. This can limit the applicability of themodel to other plants and care must be taken when doing so.A more recent copper electrowinning model investigated the modeling behavior of areactive electrodialysis cell. Reactive electrodialysis differs from conventional electrowin-ning by attempting to oxidize iron instead of electrolyze water at the anode. This requires aseparate anolyte and catholyte. The model uses a combination of Butler-Volmer equationscombined with Fick’s diffusion equations. This model is unique by taking into accountthe rate of diffusion of species through a membrane that separates the catholyte and theanolyte. This was determined using a transport flux equation based on the migration ofionic species through the electrolytes combined with diffusion through the membrane. Themodel validation was carried out by running laboratory experiments and comparing the re-sults with model data. A good correlation was established between the two. The valuesof cell voltage and energy consumption differed by 2-3 %, and this was attributed to thestart-up conditions within the experimental cell. Once the experimental cell reached steadystate conditions, the results were in good agreement [80].2.4 Hydrometallurgical Process ModellingSimulation and modelling are valuable tools for control, design and general understandingof industrial chemical processes. Chemical process simulations combine models of multi-ple unit operations linked with process streams representing material flow through pipes,often visually represented as a process flow diagram. These tools have many possible37CHAPTER 2. LITERATURE REVIEWuses including optimizing control, testing new operational regimes before implementation,and training operators. Still, developing validated process models of hydrometallurgicalcircuits is a complicated task due to complex chemistry and thermodynamics inherent tothese systems. In particular, heterogeneous solid feeds, three phase reactors, and aggres-sive environments make quantification of process variables difficult, thereby complicatingmodel validation. Furthermore, the unique circumstances under which many plants oper-ate, depending on ores and location, lead to large variability in flow sheet design and a lackof standardized equipment in much of the hydrometallurgical industry. These reasons havebeen credited for why hydrometallurgical process simulation and modelling traditionallylag behind other chemical industries [81].Process simulations are generally divided into steady state and dynamic (time transient)categories. Steady state models are generally simpler, take less time to set up and are moresuited for initial design work, capital cost estimates, and plant audits. Dynamic simula-tions are useful for tasks such as dynamic data reconciliation, model predictive control,or operator training. While more complex, dynamic simulations have been suggested foruse in reducing the need for intermediate buffer tanks, better understanding of upsets (es-pecially in cases where the flow sheet is complex), and testing control structures whichmay be applied to a plant. Indeed, dynamic simulation was recognized as requisite to fur-thering extractive metallurgy plant control over twenty years ago. Still, limited progresshas been reported [82]. To be sure, the benefits of dynamic versus steady state simulationmust be balanced against the time and effort it takes to set up the model or simulation [83].Nevertheless, as plants become more integrated and complex, there will be a greater needfor plant-wide process control which in turn will require a suitable computational descrip-tion [84].While there is a large amount of literature available describing modelling of individualoperation units, notably less has been reported on process models incorporating multipleunit operations acting together. Explanations for this include Intellectual Property (IP)38CHAPTER 2. LITERATURE REVIEWconcerns and difficulty in validation. This makes presentation of novel results challenging.Regardless, process modelling has been shown to have great industrial functionality andsome examples developed for hydrometallurgical facilities have been presented.Process models and simulations can vary in complexity from spreadsheets in Excel(published by Microsoft), to dedicated process simulation software packages such as AspenPlus or METSIM. The advantages in the approach or software used are forever debatable,however each is a tool and the choice is dependent on the user’s comfort with the softwareand the end requirements of the modelling exercise. Arguably, the simplest approach toprocess modelling is done with a spreadsheet program such as Excel, familiar to most andeasily transferred among multiple people.To compare copper leaching from primary sulfides, D. Dreisinger used spreadsheetmodels to analyze several different processes for criteria such as reagent costs or inclusionof a bleed to heap stream [85]. It was determined that each process had unique featuresthat lead to potential advantages for each situation. This is an effective demonstration ofthe benefit of a less complex spreadsheet process model for comparing multiple leachingapproaches. A drawback of a spreadsheet based approach include is reliance on the user toset all of their physical properties, solution chemistries, and reaction properties leading tolonger development times and greater chance for error (especially as the model increasesin complexity). Further, complex spreadsheet models will typically have longer computa-tion times compared to a dedicated process modelling software, especially when recyclestreams are present. M. Dry compared a spreadsheet based approach alongside a special-ized process simulation software [86]. The results were useful for evaluating viability ofprocess circuits in both cases. While the spreadsheet model required simplifications, it didnot require the acquisition and associated learning curve of the specialized process soft-ware. A balance must be struck between the desired outcomes of the modelling exerciseand the accuracy required.39CHAPTER 2. LITERATURE REVIEW2.4.1 Steady State Process ModelsThe Population Balance Model (PBM) was applied to a zinc pressure leach reactor in orderto demonstrate its viability for a reaction where a diffusion-limiting porous layer is formed.Based on this work the package REACTSIM, which specializes in modelling pressure au-toclaves, was created as a method to transfer academic research to industries [87]. Thekinetics were based on experimentally derived relations and the model gave estimations ofthe conversion through four compartments in a pressure leach autoclave. The model resultswere compared against the pressure autoclave in Trail, British Columbia, Canada and goodagreement was found for the limited data available [18]. The authors identified four rateprocesses for representing the system: the oxygen dissolution, sulfide dissolution, ferrousoxidizing to ferric, and the precipitation of jarosites and iron hydroxides. Fundamentalrelations from literature were taken to describe the kinetics of each reaction and, where afundamental relation was unavailable, empirical relations derived from experimental datawere used. The PBM model was solved for a steady state solution and the consumption ofO2 was examined in particular. This model was utilized to study variations in zinc concen-trate feeds and the effect on the pressure leach in maintaining autogenous operation [88].Process parameters such as returned electrolyte and cooling water flows were manipulatedin order to maintain operation. It was noted that concentrates with low iron were not capa-ble of achieving autogenous operation in the first compartment of the autoclave, howeverthis could be overcome through the addition of more plant acid, preheating the feed, ordoubling the first compartment size.A steady state METSIM (published by PROWARE) model of a roast-leach-electrowinzinc refinery was developed and reported by Holcroft et al. [89]. In total 67 species weremodelled flowing through leaching and purification sections of the plant. Reaction extentswere set to match the values attained in the plant rather than predictions based on kinetics.Several case studies were examined with these extents remaining constant. The model wasused to study the effect of adding additional tanks to neutral leaching or jarosite precipita-40CHAPTER 2. LITERATURE REVIEWtion, the resulting change in iron loading, and required spent acid addition. A sensitivityanalysis was performed to estimate the amount of change in reaction extents caused byexpected changes in residence times. The model was also used to understand consumptionof process waters in order to minimize water use and to reduce zinc losses through simplemodifications in process flow or alternative solid separation methods. This work demon-strates the value of a process simulation as an audit for an existing plant which may haveotherwise been too complex to model using a spreadsheet program. However it limited theestimation of individual unit reactions.METSIM and equilibrium data of the Fe-As-H2O system obtained from HSC (pub-lished by Outotec) were used to analyze the removal of arsenic through scorodite crystal-lization [90]. The study sought to improve As removal while minimizing the amount ofenergy required. The model consisted of 31 streams and 16 unit operations. Four reactionswere considered with the kinetics estimated from experimental kinetic studies. Reaction2.23 was taken to completion with 20% excess sodium hydroxide. Produced ferric hydrox-ide was then reacted with 93 % of H3AsO4(aq) coming from an arsenic bearing solution(14.8 g L−1 As) according to reaction 2.24. Remaining H3AsO4(aq) was precipitated withCaCO3(s) in reaction 2.25 to give a final As concentration in the range of 0.11 - 0.44 g L−1.Three cases were then evaluated using the model. This was done to analyze the evaporationof water so as to increase the concentration of arsenic bearing solution before reacting withFe(OH)3. The outcomes were used to give estimates of equipment costs and heat require-ments for the system. Higher entering As concentrations (requiring greater evaporation)lead to higher exiting As concentrations. The greater amount of energy required for evapo-ration was not offset substantially by the reduced energy consumption of units downstream.Finally, the As/Fe concentration ratio was analyzed for the unit operation handling reaction2.24 to show that when this ratio was low, not enough iron is present, leading to rising Asconcentrations. This METSIM model demonstrates the value of a process simulation toevaluate a process prior to operation. Based on experimental kinetic and cataloged equi-41CHAPTER 2. LITERATURE REVIEWlibrium data the model showed further treatment of the arsenic bearing solution would berequired.Fe2(SO4)3(s)+6NaOH(aq) −−→ 2Fe(OH)3(s)+3Na2SO4(aq) (2.23)H3AsO4(aq)+Fe(OH)3(s) −−→ FeAsO4 ·2H2O(s)+H2O (2.24)H3AsO4(aq)+CaCO3(s) −−→ CaHAsO4 ·H2O(s)+CO2(g) (2.25)Na2SO4(aq)+10H2O−−→ Na2SO4 ·10H2O(s) (2.26)Another study was conducted to analyze the equilibrium of copper in saline solutions inorder to reduce fresh water demand [91]. Using METSIM in conjunction with HSC equi-librium data they analyzed cases with varying saline levels, with and without the presenceof acid. Overall it was found that saline without acid gave the highest yield, however therewere higher energy requirements during evaporation before crystallization.A steady state model of a hybrid nickel leaching circuit (where finely ground, low Mgfraction of the ore was treated under pressure acid leach and high Mg fraction of the orewas leached atmospherically) was reported using SysCAD (published by Kenwalt) [92]. Itinvestigated seven scenarios where process parameters were analyzed, such as the solidsfraction exiting a thickener or autoclave pressure. The solutions were validated againstlimited available plant data. The availability of process plant data is a major limitationin the ability of process models to demonstrate their validity. This model however, wascapable of giving estimates for the optimal operation points of a hybrid nickel leachingplant.Finally, a process model of a copper solvent extraction in combination with an elec-42CHAPTER 2. LITERATURE REVIEWtrowinning circuit was reported [79, 93]. Along with overall mass balances for both sec-tions, the surface area ratio and rates of transfer were estimated for SX and a model ofcopper electrowinning was developed based on Butler-Volmer kinetics for the two com-peting reactions at both electrodes. The model was first calibrated against lab scale resultsand then applied to pilot plant data from Les Mines Gaspe´, Quebec, Canada. The modelrepresented the pilot plant well. It could be used to identify the effect that entering leach Cuconcentration and cell voltage have on the current efficiency and electrowinning electrolyteCu concentration. The interaction of the two units is notable, with recycled spent Cu elec-trolyte being sent back to the solvent stripping stage [79]. Residence time distributions hadbeen studied previously for the same system finding that transport in the mixer and mixer-settler units could be reasonably approximated as perfect mixers. While there was somebypass in the electrowinning cells, it was still dominantly a perfectly mixed system [93].2.4.2 Dynamic Process ModelsDynamic simulation is often associated with plant control since a validated simulation canact as a proxy for the actual operating process. This allows tuning parameters for operatingcontrol to be determined from the model rather than relying on process disturbances [83].Further, advanced routines can be undertaken with a simulation to generate control struc-tures such as Model Predictive Control (MPC), Real Time Optimization (RTO), or Gray-Box modelling. MPC sets process targets for the conventional Proportion Integral Deriva-tive (PID) controls which can improve efficiency by allowing plant-wide targets to be set.In cases where a fundamental model is not possible, a Gray-Box model may be used. AGray-Box model combines a first principles model to form the basic structure. An empir-ically derived black box model (such as a neural network or empirical relation) will fill inthe details. This approach is suited to phenomena such as reactor fouling, deactivation, ofcatalysts and complex pH processes [94, 95]. For all these reasons, dynamic simulationsof hydrometallurgical processes, as recently presented in various studies, offer interesting43CHAPTER 2. LITERATURE REVIEWapplicability to operating facilities.Based on a shrinking core model, a dynamic simulation of pyrite bioleaching and grav-ity separation designed to liberate Fe and Co was reported using USIM PAC software (pub-lished by Caspeo) [96]. The model was used to analyze plant configurations to reduce thesulphide and heavy metal content in the wastes. The simulation included primary, sec-ondary, tertiary leaching operations, as well as a cyclone separator. The kinetics of eachtank were set based on experimental data. The recovery amounts of Co was found to belargely above the actual recovery due to variations in kinetics. The particle size was notappropriately reflecting the actual results.METSIM was also used to dynamically model copper treatment from a heap leachsolution and evaluate the use of a Sulfidization Acidification Recycle Thickening (SART)system. In order to prevent excessive buildup of aqueous copper in the leach solution,the copper was removed as Cu2S. Cyanide from the leach solution was regenerated viaequation 2.27 [97]. Initially, test work was conducted to establish reagent requirements,reaction extents, and expected precipitation assays. The model was then used to evaluatethe process at full scale. It used heap leach blocks within the software, followed by theSART processing facility, and estimated the copper levels in the treated leach solution overthe course of nine years. The model was capable of giving more information, however itwas not reported. Nonetheless, the reported information was suitable to evaluate the fulloperation prior to design or construction and to consider options for optimization.2Cu(CN)32−+3H2SO4+S2− −−→ Cu2S(s)+6HCN(aq)+3SO42− (2.27)In an effort to set up control parameters, Dorfling et al. developed a model of highpressure sulfuric acid/oxygen leaching for the treatment of precious ores [98, 99]. Themodel was solved in MATLAB using a sequential modular approach. The initial mass44CHAPTER 2. LITERATURE REVIEWbalance was done in SysCAD containing 22 streams and six unit operations including theautoclave, flash tank, slurry holding tanks, and a thickener. Twenty-one reactions wereconsidered including kinetic reaction rates for each based on previous work conducted bythe authors. First, the reaction rates and extents of consumed solids were solved. Next,the dissolved species were solved with checks to ensure a species was not consumed to agreater amount than what was available. In the second part of this study, the extraction ofvarious species was examined, applying variations in process parameters such as temper-ature, pressure, and flow rate. While no detailed validation of the results was conducted,interesting dynamic capabilities of the model were presented. They demonstrated varia-tions in the autoclave that occurred over 36 hour periods. These types of trends could aidin the setting up control parameters which would otherwise be difficult, time consuming,and possibly dangerous to determine from equipment operation alone.The steady state Cu SX model presented by Aminian et al. was expanded upon by Ko-mulainen et al. to become a dynamic simulation utilizing plant-specific McCabe-Thielediagrams [79, 100] . The process was modelled by considering the mass transfer of copperbetween the organic and aqueous phases. Each unit was modelled as a combination of aplug flow and an ideal mixer. The process was validated using one month of plant processdata. The simulation and plant results matched well over this time period. Moreno et al.further expanded on this model to include settler hydrodynamics and focused on using pa-rameters easily measured by SX plants. The goal was applying this model to plant processcontrol [101] . Plant efficiencies were matched using a least squares fit through manipula-tion of fitting parameters. The simulation was performed using Simulink software and wascompared to 56 days of operational data where good agreement was observed. Improvedresults were also achieved compared to a model where the settler was simulated simplywith a time delay.A frequently cited benefit to process modelling is the ability to perform process control.It has been noted that while hydrometallurgy is a large field, little has been reported on45CHAPTER 2. LITERATURE REVIEWprocess control due to unsatisfactory process models, lack of instrumentation, and generallack of use of data management and processing [102, 103]. Validated process models areessential in development of sophisticated control schemes. Based on Cu SX modellingwork, a control scheme was presented with the objective of increasing copper productionand decreasing variation in stream flows, particularly the copper concentration of the richelectrolyte sent to the electrowinning cell house [104]. The work compared the currentmanual control at a copper SX-EW facility with proposed Proportion Integral (PI) controlsand a two level MPC. The control strategy consisted of an optimization layer which wouldidentify optimal copper concentrations, and a stabilizing control layer which would setmanipulated variables such as solution flow rates. These were then passed to a PI controllayer to control the simulation. The MPC control strategy was compared to open loop and PIcontrol. MPC performed best. Finally, the MPC control was compared against the industrialdata under manual control in terms of copper flow in the exiting rich electrolyte. The copperproduction was found to increase by as much as 5% using MPC control and the variation ofcopper concentration in the process streams decreased by 70-90%. These results requiredthe creation of a validated dynamic process model that could represent the process in orderto perform the desired optimizations.Using a first order solution relation, Padilla et al. analyzed a heap leach to SX-EWcircuit for copper extraction using a profit-based objective function [105]. Analyzing theheap height and leach time variables, the relation offered a quick method of analyzing theheap leach parameters on a circuit. It also demonstrated the restrictions that a downstreamSX plays on the profit function. Maximum recovery in heap leach did not correspond tomaximum profit. The authors also noted the need to further expand the study to includemore complex parameters such as particle size, solution flows, and leaches with more thanone leaching step.Data reconciliation is a further valuable analysis which can be conducted with a processmodel. In many operating systems the number of measurements taken will overspecify the46CHAPTER 2. LITERATURE REVIEWprocess. There will be more data taken than free variables to define. Due to errors associ-ated with each measurement, overspecification makes setting operating points difficult anda full mass or energy balance cannot be achieved. Data reconciliation attempts to mini-mize this error by finding a solution which is most probably correct by minimizing an errorfunction between measured results and reconciled estimates. The error function can alsoaccount for the expected error with the type of measurement. It is a useful technique forplant audits and for generating a single, most probable, set of data. However, data recon-ciliation is less common in hydrometallurgy due to difficulties in problem formulation andthe resulting unreliability of the results [106].Data reconciliation was conducted for batch concentrate grinding using the PBM model[107]. Bazin et al. described a copper solvent extraction data reconciliation procedureused to reconcile measurements. They also determined an extraction equilibrium constant[108]. This can be incorporated with a process model to identify measurements which areerroneous and minimize over or under-correction in operating procedure.Hydrometallurgical process simulations have not been extensively reported in literature,however they do present interesting results. Considering multiple process units operatingtogether is important in understanding the process and acting as a proxy for the actualprocess. This allows for process control and optimization to be considered on a plant-widebasis.2.5 SummaryLiterature surrounding zinc electrowinning has examined a great deal of experimental re-sults, recommending concentration limits for species, and practical experimental results.However these studies use electrolytes which are typically very specific to a single elec-trowinning facility. As well, after consultation with plant engineers and operators, oftenlaboratory electrowinning set ups do not accurately replicate the conditions in the cells47CHAPTER 2. LITERATURE REVIEWin the house. A process model of electrowinning can be a valuable tool for amalgamat-ing process data from multiple plants and experimental results to observe and understanddifferences between them.The most thorough model to date was presented by Barton and Scott [3, 70]. Howeverthis model is now dated. Due to the computing power at the time, many relations weresimplified (e.g. activity coefficients) and lacked the ability to quickly handle time-basedcalculations. This model is unsuitable for completing complex process calculations, suchas data reconciliation or plant-wide simulations, which are becoming common in otherindustries. Development of a process simulation offers a novel method of analyzing, con-trolling and understanding zinc electrowinning.48CHAPTER 3OBJECTIVESBased on the preceding discussion, the following objectives were set out.1) Develop a time transient process simulation based on previously developed modelsof zinc electrowinning and update the model to include recently determined physical,chemical, and kinetic parameters.2) Validate the zinc electrowinning model for both an electrowinning cell and a fullcell house using data from individual electrowinning cells and process data fromoperating industrial zinc cell houses.3) Develop a process model of a cooling tower based on the Poppe method to predictseasonal effects of ambient air conditions on cooling capacity and water evaporationfrom a cell house.4) Use the process simulation to investigate optimization of a single cell in comparisonwith a full cell house.5) Using the process simulation, investigate the potential benefits of implementing pro-cess control in a zinc cell house.6) Examine manganese movement and consumption in a cell house given variations inprocess conditions.7) Predict the cathode mass in a cell house using data reconciliation to rapidly estimatethe current efficiency.49CHAPTER 4MODEL DEVELOPMENTElectrowinning and cooling tower models from literature were incorporated and expandedto make a dynamic process simulation of a zinc electrowinning cell house. A coolingtower model was also developed to represent the counter flow atmospheric cooling towerscommon in electrowinning cell houses. The models were incorporated into the commercialprocess simulation software CADSIM Plus as a Dynamic Load Module (DLM). The DLMswere written using C++ Builder 2010 published by Embarcadero Technologies Inc. Forreference, variable names, units, and location of first use are listed in the Glossary.In the simulation software, every process operation such as a tank, launder, or pipeis solved sequentially over the course of the timestep. Similarly, each simulated cell orcooling tower was incorporated in to the CADSIM simulation package as an individualunit. This required the order of execution of each unit to be specified in order to havea stable simulation particularly for the first iteration. Each unit will also carry its ownlocalized variables such as cathode mass which will affect the subsequent timesteps of thatunit alone.4.1 Modelling Zinc ElectrowinningThe following description outlines the logic and equations in the C++ code used to simulatea time step in a cell. The code used to execute these simulations is provided in AppendixC. In summary, the zinc electrowinning model improves upon the previously developed50CHAPTER 4. MODEL DEVELOPMENTTable 4.1: Electrowinning cell model inputs and outputsUser Inputs Model OutputsVolume Current DensityCurrent Current EfficiencyNumber of Cathodes Cell PotentialNumber of Anodes Energy ConsumptionCathode Surface Area Retention TimeAnode Surface Area Solution Potential LossElectrode Spacing Mass of Deposited Zinc on Each Cathode SetAnode Length Gas OutflowNumber of Sets of Cathodes Outgoing Solution CompositionIf a Cathode Set has Been Pulled for Harvesting Outgoing Solution Flow RateConnection Potential Loss Outgoing Solution TemperatureIncoming Solution CompositionIncoming Solution Flow RateIncoming Solution TemperatureBarton and Scott model by incorporating new expressions for conductivity, zinc electrolytedensity and variable activity coefficients predicted by Pitzer parameters. Further, the masstransfer constant of zinc ions as well as activation energy and frequency factor of the zincdeposition reaction and hydrogen evolution reaction were solved for 40 reported test casesover variable temperature (25-50 ◦C), zinc (20-70 g L−1), acid (87-210 g L−1) and currentdensity (100-650 A m−2) in contrast with a set of experiments conducted under the samestandard conditions (35 ◦C, 55 g L−1 Zn, 110 g L−1 H2SO4 and 500 A m−2). As well themodel was developed in to a time transient mass and energy balance allowing data over timeto be compared between the simulation and the cell house. Finally this was incorporated into a commercial simulation software to rapidly analyze the model and the effect the modelhas in a networked process flow simulation.The temperature (T ), the gas constant (R), and Faraday’s constant (F) have their con-ventional Syste`me International d’Unite´s (International System of Units) (SI) values. Allvalues are in SI units unless otherwise stated. Table 4.1 gives a list of user inputs andsimulation outputs.Initially, the model was set up based on a file within the process simulation software51CHAPTER 4. MODEL DEVELOPMENT(CADSIM Plus). This file contains all chemical species information including masses,physical properties (e.g. molar mass, density, heat capacity), temperature, and pressure.This file can be set up manually by the user or consists of results collected from a previouslyrun time step of the model. Concentration (ci) of an individual species (i) was calculated inequation 4.1 where mi is the mass of component i present in the cell, Mi is the molar massof the component, and VT is the total volume of the cell.ci =mi (Mi)VT(4.1)Activity coefficients (λi) were calculated using the Pitzer Parameter algorithm [109–112] and the Pitzer Parameters listed in Table 2.3. The activity (ai) of a species was cal-culated in equation 4.2. The Pitzer Parameter method was chosen to estimate the activitiesbecause of the high ionic strength of zinc electrolytes, the associated physical meaning witheach term, and the availability of these parameters in literature [29].ai = ciλi (4.2)The electrolyte conductivity (σ ) and solution density (ρ) were calculated using empir-ical relations 4.3 and 4.4+4.5 respectively [29].σ =−10.79[Zn2+]−53.9[H2SO4]−1.817[Zn2+]2−6.380[H2SO4]2−1.027[Zn(2+)][H2SO4]+16.73[Zn2+]2[H2SO4]+0.0585[Zn2+]T+12.46[Zn2+][H2SO4]2−6.762[Zn2+]2[H2SO4]2+0.3345[H2SO4]T−0.1341[Zn2+][H2SO4]T(4.3)52CHAPTER 4. MODEL DEVELOPMENTρsol =1.0112− (0.00044+0.00008[H2SO4]+0.00013[φ ])T +0.0611[H2SO4]−0.0049[φ ][H2SO4]+0.1568[φ ](4.4)φ = [Zn2+]+0.68[Mg2+]+0.83[Mn2+]+0.32[Na+]+0.37[K+] (4.5)The equilibrium reaction potentials of the zinc deposition, hydrogen evolution, and oxy-gen evolution (subscripts Zn, H, and H2O respectively) were calculated using the Nernstequation (equation 4.6), where ap,i and ar,i are the activities of the products and reactantsrespectively and z is the number of electrons transferred in the reaction.Ee,i = E0e,i+RTziFln(ap,iar,i)(4.6)The exchange current densities (i0,i) of the three primary chemical reactions were calcu-lated in equations 4.7 and 4.8, where k0,i is the standard rate constant, A0,i is the frequencyfactor and ∆Gi is the activation energy of the reaction, co is the concentration of the oxi-dized species, cr is the concentration of the reduced species, and αi is the charge transfercoefficient of the reaction.k0,i = A0,i exp(−∆GiRT)(4.7)i0,i = ziFk0,ic1−αio cαir (4.8)To solve for the overpotential on the cathode, an iterative root solving method wasused to determine the cathode potential needed for the zinc deposition current density (iZn),which was added to the hydrogen evolution current density (iH) to equal the current density53CHAPTER 4. MODEL DEVELOPMENTof the cathode (iC). First the overpotential and current density of the hydrogen evolutionreaction was calculated in equations 4.9 and 4.10, where EC/A is the cathode or anodepotential (depending on the reaction) and η is the overpotential of the reaction. Equation4.10 was valid while |ηH |> 0.118V . This is typical for zinc electrowinning [3].ηi = EC/A−Ee,i (4.9)iH = i0,Hexp(−αHηHzHFRT)(4.10)Calculating the overpotential of the zinc reaction first required calculating the masstransfer of zinc ions. Hydrogen evolution plays an important role in increasing zinc ionmass transfer due to the turbulence generated during hydrogen gas evolution. The rateof hydrogen evolution was calculated in equation 4.11. V˙H is the specific volumetric rate(m3 s−1 m−2) of hydrogen evolution, AC is the total cathode area, and p is the operatingpressure. The mass transfer coefficient (Km) was calculated by equation 4.12 where KT isthe mass transfer constant and n is the mass transfer exponent. The model does not takethe hydrostatic pressure’s effect on bubble size in to account for the volumetric evolutionof gas. The limiting current density of the zinc reaction (il) was calculated in equation 4.13(note: the concentration of Zn2+ must also be converted from dm3 (L) to m3). Finally, thecurrent density of the zinc reaction (iZn) was calculated with equation 4.14. To solve forthe cathodic potential, equations 4.9 to 4.14 were iterated through the root solving routineuntil the conditions of equation 4.15 were met (when the current at the anode and cathodeare equal).The root solving routine uses a combination of root solving methods. The first threeiterations use a bisection method designed to isolate the root and converge quickly. Thenext iterations use a Newton-Raphson method to refine the cathode potential guess. Typi-cally the algorithm will solve the cathode potential within a maximum of ten guesses. To54CHAPTER 4. MODEL DEVELOPMENTdecrease computation time further, the cathode potential from the previous time step wasstored and given to the next time step as the initial guess. This can shorten the iterationsto two or three given that the conditions in the cell (current, temperature, concentrations)have not changed dramatically. Otherwise the initial guess is the equilibrium potential ofzinc less 20 mV.V˙H =iHzHFRTpAC(4.11)Km = KT(VgAC)n(4.12)il = KmcZnzZnF(1000cZn) (4.13)i = i0[(il− iil)exp(−αηzFRT)− exp((1−α)ηzFRT)](4.14)iCACAA= iA = iH2O (4.15)Up to this point, the model has repeated the procedure outlined by Barton and Scott’smodel [3]. However, after replicating the Barton and Scott model, the limiting currentdensity of the zinc deposition kinetic equation did not give results similar to those reported.A value of 1.66×10−3 was given for KT in equation 4.12, based on a least squares fit of 10L test cell data. This was reported to give a value of 4.9×10−5 m s−1 for the mass transfercoefficient (Km) [3]. This differs from the value of 4.9×10−4 cm s−1 for Km listed under55CHAPTER 4. MODEL DEVELOPMENTthe same conditions reported earlier [69]. Experimental tracer methods have estimated themass transfer coefficient to be in the order of 10−4 cm s−1 under the same or similar zincelectrowinning conditions [74, 113].The Barton and Scott model had listed equation 4.16 for the mass transfer coefficient,using the volumetric rate of hydrogen evolution. Reviewing the original spreadsheet pro-gram in Scott’s thesis, the volumetric rate of hydrogen (VH) production listed was calcu-lated as a volumetric rate divided by the cathodic area (as seen in equation 4.17) [69]. Thisis consistent with the Vogt model of mass transfer due to gas evolution on an electrodewhere the effect of gaseous bubble micro-convection on mass transfer was based on therate of volumetric gas production per unit area of the electrode [77]. Continuing to followthe spreadsheet program, further differences were discovered between the mass transfercoefficient equations listed and used (equations 4.16 and 4.17 respectively). When utiliz-ing these two equations from Scott’s thesis, equation 4.17 produces results consistent withthose presented in Barton and Scott’s model [3].Km = 1.66x10−3(V˙H)0.3 (4.16)Km = 1.66x10−2(3000V˙HAC)0.3(4.17)The current density of the anode (iA), the current density of oxygen evolution (iH2O),and oxygen evolution overpotential (ηH2O) were calculated using equation 4.18, where Kaand Kb are Tafel constants and AA is the total anode area. The potential of the anode canbe more difficult to predict than the cathode. The surface composition of the cathode isaluminum quickly covered by zinc for the remainder of the deposition cycle. The surfaceof the anode however will change over time as the anode ages for reasons such as the MnO256CHAPTER 4. MODEL DEVELOPMENTlayer growing, periodic anode cleaning, and the alloying composition of the anode. As theeffect of these details on the anodic overpotential are difficult to capture, the anode reactionwas simplified to a single Tafel equation.ηH2O = Ka+Kblog(iH2O) (4.18)4.1.1 Bubble EffectsGas evolution in the cell affects the solution conductivity by acting as a current insulator,increasing the potential drop through the solution. The effect of bubbles on conductivity(σB) was calculated using equations 4.19 to 4.22. The effect of oxygen bubbles on solutionconductivity was predicted by Barton and Scott noting an average decrease in conductivityof 4% [70]. Since this resistive loss was comparatively small (equivalent to approximately10 mV), these relations were left out of their program due to the minimal benefit receivedcompared to the computationally complex algorithm required. For completeness, thesecalculations were added to the C++ code without a large effect on computation time. Equa-tions and constants set out by Kreysa and Kuhn [64] were used as outlined in equations 4.19to 4.22 with us = 0.04 m s−1, u0l = 0.0 m s−1, and fm = 0.11. The fractional voidage ( fg)from the bubbles was solved for iteratively in the same manner described for the cathodicpotential, and using the same root finding procedure. The effect of hydrogen bubbles wasalso calculated in the same manner and found to be approximately 0.5%. This was expectedgiven the lesser amount of hydrogen gas compared to oxygen gas produced. The final de-crease in conductivity ( 4%) from the generation of bubbles agreed with those reported byBarton and Scott [70].fg =fm1+{[u0l( fm− fg)(1− fg) +usw fg]/u0g} (4.19)57CHAPTER 4. MODEL DEVELOPMENTusw = us(1− fg)21− f53g(4.20)u0g =RTpzFAC/AI (4.21)σB = σ(usw) (4.22)4.1.2 Cell PerformanceThe performance of an electrowinning cell is important primarily because it indicates thecurrent efficiency and power consumption of the cell. Secondarily however, it also givesoperators an indication of the overall upkeep of the cell house. Typically a clean cell house,with well kept anodes, producing high purity cathodes that are easily stripped, will alsohave a consistently high current efficiency [6, 114]. In this way an electrowinning modelcan provide insight in to an ideal state of cell performance given the solution concentrationsand temperatures. Cell potential (ECell), current efficiency (ε), and energy consumption pertonne of zinc produced (P) were calculated in equations 4.23, 4.24, and 4.25 respectively.ECell = |EC|+ |EA|+ diCσB +ELoss (4.23)ε =100iZniC(4.24)P =81960(ECell)ε(4.25)In these equations, d is the distance between the surface of the cathode and surfaceof the anode, and ELoss is the potential losses due to busbar connections or other resistiveeffects. The electrochemical conditions of the cell were defined by these equations and the58CHAPTER 4. MODEL DEVELOPMENTdynamic time step could be introduced at this stage.4.1.3 Dynamic Mass and Energy BalanceA time step (∆t) was introduced to the simulation to allow it to respond to time-basedchanges. Using the performance of the cell, calculated as outlined previously, the rate ofspecies reaction (ri) was summed from each reaction the species is associated with (con-sumed or produced) through Faraday’s Law (equation 4.26).ri =∑iiiAA/CzF(4.26)The mass (m) and energy (Q) balances were carried out over a time step using a linearapproximation of the derivatives(dmdt ,dQdt ). Equations 4.27 to 4.30 outline the mass balanceover a time step (∆t) from time (t) to (t +∆t). The time step was set based on a toler-ation condition where a change in individual component mass over a time step was lessthan 0.1 wt%. A time step of one minute was found to meet this condition for steady stateand the majority of dynamic predictions. When the change tolerance condition was notmet, the simulation automatically divided the time step in to successively smaller fractionsand reran until the change was tolerable. Over the course of a time step, the incomingmass of a component (m˙i,in) and consumed or produced mass from reaction (m˙i,rxn) of eachcomponent (i) was added to the resident mass (mi,res) of that same component in equation4.27. This created a new temporary individual mass (mi,temp) and total temporary residentmass (∑imi,temp). This was “temporary” because this mass (and associated volume) wasnow greater than what could be held in the electrowinning cell. The temporary volumeof solution was calculated in equation 4.28 based on the density of solution. This tempo-rary volume was then perfectly mixed, and the fraction of mixed solution which could notphysically fit in the cell made up the mass flowing out of the cell (m˙i,out). The electrolytewas assumed to be perfectly mixed. This assumption was based on the large amount of59CHAPTER 4. MODEL DEVELOPMENTgas evolution which agitates the solution as well as the rapid flow of electrolyte throughthe cell. Based on operator experience, small changes in zinc concentration through theelectrowinning cell keep this assumption valid. As the bite in zinc concentrations exceeds10 g L−1, this assumption may no longer apply. To further understand the mixing in zincelectrowinning cells would require hydrodynamic simulations which is outside the scopeof this work.mi,temp = mi,res+(m˙i,in+ m˙i,rxn)∆t (4.27)VT,temp =∑i mi,tempρsol(4.28)m˙i,out =VT,resVT,tempmi,temp∆t(4.29)mi,res(t+∆t) = mi,temp− m˙i,out∆t (4.30)The exiting mass (m˙i,out) was calculated using the ratio between: (1) the liquid vol-ume of the original liquid resident mass (VT,res) (which was equal to the volume of theelectrowinning cell (VT ) subtracting the volume of any solids such as electrode volumes,deposited zinc volumes, and precipitated mud volume); and (2) the volume of the tempo-rary resident mass (VT,temp) from equation 4.29. Finally, the resident mass (mt+∆ti,res ) for thenext time step was updated. A volume ratio was used because it was more representative ofa physical tank in which the volume of liquid changes depending on the temperature, andcomposition influenced density changes between the feed and spent electrolyte.The energy balance of the electrowinning cell was conducted in a similar manner tothe mass balance. It is outlined from equations 4.31 to 4.37. First the heat losses due towater evaporation from the top of the cell were calculated in equations 4.31 to 4.33. In60CHAPTER 4. MODEL DEVELOPMENTthese equations, ps (mm Hg) is the saturated vapor pressure, revap is the water evaporationrate, Kevap is the evaporation constant (2.5 x 10−4), AL is the electrolyte-air surface area,and Hevap is the enthalpy of water evaporation (40600 J mol−1). The energy change due toreactions Qrxn was calculated from the sum of the enthalpy of reaction product (∆Hi) andthe reaction rate.log10 ps = 8.925−2259T(4.31)revap = KevapAL (ps− pv) (4.32)Qevap = Hevaprevap (4.33)The subsequent heat balance equations followed a similar logic as in the mass balanceover a time step. The heat capacity of the solution was calculated internally within theprocess simulation software as a mass weighted average of the individual component heatcapacities. This allowed temperature of the solution to be calculated based on the totalamount of heat resident in the electrowinning cell.Q˙i,rxn =∑i∆Hiri (4.34)Qtemp = Qres+(Q˙in+ Q˙rxn+ Q˙evap)∆t (4.35)61CHAPTER 4. MODEL DEVELOPMENTQ˙out =VT,resVT,tempQtemp∆t(4.36)Qres(t+∆t) = Qtemp− Q˙out∆t (4.37)Finally the amount of solids resident in the cell was updated. This increased the amountof deposited solid zinc on the cathodes (thereby decreasing the amount of liquid volumein the cell) and decreased the distance between anodes and cathodes. The distance be-tween the cathode and anode surface was updated for the following time step (∆d(t+∆t))in equation 4.38 where ρZn is the density of the deposited zinc, assumed to be 7.14 kgm−3. Within the CADSIM Plus simulator, the individual electrowinning model ran ap-proximately 19,000 times faster than real time using an Intel i5 560, 2.67 GHz processor.∆d(t+∆t) = d(t)− rZnMZnρZzAC∆t (4.38)4.2 Modelling Evaporative Cooling TowersThe following outlines the equations used in the model of the evaporative cooling tower.The code used to execute these simulations is provided in Appendix D. The cooling towerwas simply used to predict the amount of water lost in the cell house and amount of coolingavailable in the cooling towers. No major modifications were made from algorithms pre-sented in other sources beyond adapting them to a dynamic simulation module. Typicallythe electrolyte is cooled in wet atmospheric cooling towers where both sensible and latentheat are transferred by the direct contact of the liquid with an air stream. A negligible62CHAPTER 4. MODEL DEVELOPMENTamount sulfuric acid is lost in the vapour exiting the cooling tower in the form of acid mistand for this model it is assumed there is no mass loss of sulfuric acid through the coolingtower. Normally the latent heat dominates in these types of towers [115]. A prediction ofthe cooling in a counter flow evaporative cooling tower can be conducted using the Merkelmethod, characterized by equation 4.39, where Me is the Merkel number, a characteris-tic number for the tower, Two is the temperature of the water leaving the tower, Twi is thetemperature of the water entering the tower, Cpw is the heat capacity of water, hmasw is theenthalpy of the air leaving the cooling tower, and hsa is the enthalpy of air entering thecooling tower. The Merkel number is a dimensionless coefficient of performance incorpo-rating mass transfer coefficient and surface area per unit volume of fill, both of which aredifficult to determine. The Merkel method is limited due to the assumptions that the LewisFactor being unity, the exiting air is saturated, and the amount of water evaporation is neg-ligible [115–117]. For the purposes of modelling cooling towers in a cell house, especiallywhere the water balance is concerned, this final point is particularly concerning.Me =∫ TwiTwoCP,wdTwhmasw−hma (4.39)A more sophisticated modelling approach in the Poppe Method addresses these as-sumptions by expanding on the Merkel method. Three governing equations (4.40, 4.41and 4.42) are used to predict the performance of the cooling tower including the exiting airhumidity, enthalpy, and Merkel number. In these three equations, w is the humidity ratio ofwater vapour in dry air, mw is the mass flow rate of water entering the cooling tower, ma isthe mass flow rate of air entering the cooling tower, wsw is the humidity ratio of saturatedair at Tw, Le f is the Lewis factor of air, and hv is the latent heat of vaporization of water.The Lewis factor gives an indication of the relative rates of mass and heat transfer in anevaporative cooling tower, and higher Lewis factors will result in more heat rejected in thecooling tower and lower outlet water temperatures [115].63CHAPTER 4. MODEL DEVELOPMENTTable 4.2: Cooling tower model inputs and outputsUser Inputs Model OutputsVolume Heat RejectedMerkel Number Water EvaporatedIncoming Water Flow Rate Liquid/Gas RatioIncoming Water Temperature Solution Temperature ChangeIncoming Air Flow Rate Retention TimeAmbient Air Humidity Outgoing Solution TemperatureAmbient Air Pressure Outgoing Air HumidityAmbient Air Temperature Outgoing Air TemperaturedwdTw=CP,w m˙wm˙a (wsw−w)hmasw−hma+(Le f −1)[hmasw−hma− (wsw−w)hv]− (wsw−w)CP,wTw (4.40)dhmadTw=m˙wCP,wm˙a(1+(wsw−w)CP,wTw(hmasw−hma+(Le f −1)[hmasw−hma− (wsw−w)hv]− (wsw−w)CP,wTw))(4.41)dMedTw=CP,whmasw−hma+(Le f −1)[hmasw−hma− (wsw−w)hv]− (wsw−w)CP,wTw (4.42)Table 4.2 gives a list of the required user inputs and resulting outputs. The mass andenergy hold up are handled in the same method outlined in equations 4.27 to 4.30 howeverthe only reaction occurring is the evaporation of water. The energy balance was determinedwith the Poppe method using the algorithm outlined by J. C. Kloppers [115]. The Poppeequations were solved using two nested root solving functions. These solved for the out-let solution temperature and the outlet air humidity. Based on guesses for these values, aMerkel number was solved for and compared with the Merkel number of the tower. Theguesses were then iterated until a solution is found. While computationally more inten-64CHAPTER 4. MODEL DEVELOPMENTsive than the Merkel method, the Poppe method was more appropriate for the goals ofpredicting water losses due to evaporation which is a concern when operating zinc cellhouses. Within the CADSIM Plus simulator, the individual electrowinning model ran ap-proximately 15,000 times faster than real time using an Intel i5 560, 2.67 GHz processor.The computation speed was slower for the cooling tower than the electrowinning modelprimarily due to the nested root solving routine.65CHAPTER 5MODEL VALIDATIONThe validation of the process simulation was conducted using reported lab cell test data andindustrially provided data from operating cell houses. For anonymity, some details of thecell houses are not published.5.1 ValidationIn order for the simulation to be effective, it required validation for both a single electrowin-ning cell, as well as the cell house process as a whole. While the validation of an entire cellhouse is the ultimate goal, the validation of a single cell was done first in order to ensurethat the simulation still reflected the characteristics of a single cell. As well, validationusing a laboratory cell rather than a single industrial cell was beneficial because operatingindustrial cells normally see a narrow concentration, temperature, and current range. Thisnarrow range limits the conditions which the model can be tested against. The data set firstused was reported by Scott [69]. This was a set of 40 experiments for a single 10 L testcell where data was reported for concentrations, voltages, current efficiencies, and temper-atures. This data set consisted of a range of concentrations and temperatures beyond whatis typical in an operating zinc electrowinning process. The parameters for each recordedexperiment and the physical set up of the cell were replicated in the simulation of a singlecell. The simulation was allowed to come to steady state and the model results of currentefficiency, voltage, and power were recorded.66CHAPTER 5. MODEL VALIDATIONFigure 5.1: Comparison of equations 4.17 [69] and 4.16 [3] and using the optimizedkinetic parameters (A0,Zn, A0,H , ∆GZn, ∆GH and KT ) in equation 4.12. Linesrepresent a curve of best fit to the generated simulation results for clarityNew kinetic parameters were determined in order to rectify the inconsistencies betweenmass transfer relations found in literature. An effort was made to keep the form of theequations and relations taken from literature unchanged and equation 4.12 was used. Avalue of 0.45 was used for the gas exponent n based on the recommendation for a pure zincelectrowinning electrolyte [75]. The set of experimental data given by Scott was used tofind a new value of KT [69]. However in finding a new mass transfer constant, the kineticconstants (A0,Zn, A0,H , ∆GZn, and ∆GH) (equation 4.7) had to be re-determined since theoriginal kinetic constants were solved for KT = 1.66 x 10−3. These five constants weresolved simultaneously using a SIMPLEX optimization method within CADSIM Plus [118].The objective function was defined as the least squares error of the current efficiency andvoltage. The optimal values for these constants were found to be: A0,Zn = 1.51 x 1014 (C67CHAPTER 5. MODEL VALIDATIONdm3 s−1 mol−1 m−2) , A0,H = 355 (C dm3 s−1 mol−1 m−2), ∆GZn = 57590 (J mol−1) , ∆GH= 48780 (J mol−1), and KT = 1.07 x 10−3.The current efficiency was used to evaluate the performance of the new constants de-rived for A0,Zn, A0,H , ∆GZn, ∆GH and KT . Figure 5.1 compares the predicted current effi-ciencies of equations 4.16 and 4.17 using the original kinetic constants and equation 4.12using the constants optimized in this work. Based on Figure 5.1, the new optimized kineticconstants offer the closest fit to the experimental data. Upon closer inspection of the in-ternal code, values of 0.82 V were predicted for the cathodic potential at 55 g L−1 by thesimulation which agreed with the listed values for experimental cathodic potential of 0.78and 0.88 V listed for a 20 and 80 g L−1 respectively [56]. It must be noted that the currentefficiency predicted here does not account for shorts or uneven current distribution.The predicted voltage of a cell was validated as well. Figures 5.2 and 5.3 show thepredicted potential compared to the experimental potential values based on varying Zn2+and H2SO4 concentrations respectively. The predicted potential was on average 50 mVgreater than its experimental counterpart. This may be due to difference in the solutionconductivity between a pure and impure solution. Other species present in the solutionsuch as NH4+, Mn2+, and Mg2+ are not taken in to account when predicting the solutionconductivity as this data was not available in the Scott data set. Further this may be a resultof the type of anode used and the variations introduced from anode cleaning frequency andmethod.The cooling towers were modelled using the Poppe approach for counterflow evapora-tive cooling towers. The model was first validated against the examples provided in Ap-pendices I and K by J.C. Kloppers [115]. Some minor differences were observed betweenthe model developed in CADSIM Plus and the thesis example due to small differences inthe expressions for physical properties used in each, however the two were consistent over-all. The CADSIM values were chosen instead of adapting the empirical relations from theexamples presented in Kloppers’ thesis in order to maintain an energy and mass balance68CHAPTER 5. MODEL VALIDATIONFigure 5.2: Comparison of predicted and experimental [69] potential with varyingZn2+ concentrationsconsistency in the CADSIM Plus routine.5.2 Cell House ValidationFollowing validation on a single cell and cooling tower, the simulation was validatedagainst data supplied from major industrial producers. Figure 2.3 provides a basic outlineof the electrolyte flow in the real and simulated cell house, with incoming electrolyte beingsplit evenly amongst the cells. The actual simulations replicated the full Piping and In-strumentation Diagram (P&ID) of the plant, however this amount of detail is not presentedhere. The simulated cells were designed with the same physical set up as in the cell house.Two validated cell houses are presented here with data anonymized where appropriate.69CHAPTER 5. MODEL VALIDATIONFigure 5.3: Comparison of predicted and experimental [69] potential with varyingH2SO4 concentrations5.2.1 Validating Cell House AA cell house in Canada was analyzed for comparison and reported numbers have beenscaled for anonymity where appropriate. The flow rates of CE and RE (V˙ (CE) and V˙ (RE))were set by tank level controllers on the spent and cooled electrolyte tanks respectively.V˙ (SE) was set manually at 2700 m3 h−1. Cathodic zinc is produced on a stripping scheduleevery 48 simulated hours. Thirty-five cells were harvested of zinc each simulated day. Halfof the cathodes of a cell were removed for ten minutes at a time to account for cranemovement time between the stripping machine and obtaining a new set of cathodes. Tenminutes represents an average for the crane’s movement time in the cell house. Dependingon where the stripping machine is located from the cell being harvested, this time willvary in actual practice. The crane harvested the zinc once from each of the 35 cells being70CHAPTER 5. MODEL VALIDATIONstripped that day, then went back again to repeat the process on the second set of cathodeson those 35 cells. This took a total of 700 simulated minutes to complete.5.2.2 Simulation DescriptionThe simulation was made using the CADSIM Plus software. Figure 2.3 gives a processflow outline of the cell house. Usually three cooling towers were operating at a time withone down for service. Electrowinning cell details have been listed in Table 5.1 and did notchange over the course of the simulation. Table 5.2 lists approximate cell house values thatmay change over the simulated time.Table 5.1: Static cell house details as applied to the simulationCell Characteristic ValueNumber of operating cells 67Volume 33.9 m3Number of Cathodes 116Number of Anodes 117Cathode Surface Area 3.6 m2Anode Surface Area 3.4 m2Cathode to Cathode Spacing 0.09 mAnode Length 1.25 mConnection Voltage Loss 0.03 VCooling Towers Online 3The returned electrolyte was simply the overflow of the spent electrolyte tank. Thelevel of the tank was maintained with a level controller. While there is a capacity to pumpfurther spent electrolyte back to leaching, this was not done in the simulation in order tomaintain a steady state. A nominal amount of water was evaporated through the coolingtowers.Initial cell house validation was done in a simulated cell house with simulated PIDcontrollers used to directly set the observed spent electrolyte concentration. The ZPS con-centration, flow of SE sent to the cooling towers, and the current in the cell house werespecified directly from plant data as inputs to the simulation. The CE temperature was71CHAPTER 5. MODEL VALIDATIONTable 5.2: Dynamic cell house details. These values changed over the simulated timewith their typical values given here.Cell House Characteristic ValueRecirculation rate 2700 m3 h−1Cell Retention Time 50 minCathode Time to Strip 48 hCurrent Density 500 A m−2cZn(ZPS) 160 g L−1cAcid(ZPS) 0 g L−1cZn(SE) 50 g L−1cAcid(SE) 180 g L−1cZn(CE) 55 g L−1cAcid(CE) 170 g L−1controlled internally by varying the amount of cooling air received by the SE through thecooling towers. The CE concentration was specified using a controller to vary the ZPS flowrate in order to match the CE concentration to the plant data. The simulation calculated theremaining concentrations, feed rates, temperatures, and performance characteristics of thecells for three weeks.Figure 5.4 demonstrates the Zn2+ concentration in the CE and SE. The flow of ZPSwas controlled to match the concentration of CE. However by specifying the simulationin this way, the controller may also produce noise, an example of which is observable at8600 minutes in the simulated CE prediction. The simulated SE concentration was a directoutcome of the simulation. Good agreement was found between the simulation and plantdata with the simulation having an average error of 1.0% (0.49 g L−1). The average over-prediction may have been a result of the kinetic constants being derived from differentconditions than the cell house or of impurity effects which may not have been accountedfor. Re-calculation of the kinetic constants could not be conducted using plant data due tothe limited range of concentrations that are seen operationally. Predicting this deviation incurrent efficiency would require further investigation.Beyond steady state operation, a simulation must also be capable of predicting distur-bances. As an example of this, the response of the simulation when the current density72CHAPTER 5. MODEL VALIDATIONFigure 5.4: CE and SE Zn2+ concentrations over 8.5 days as measured in the tankhouse(dotted lines) and predicted by the simulation (solid lines)was decreased during operation is shown in Figure 5.5. This demonstrates the dynamicresponse of the simulation. When the current density is decreased, the simulation predictsthe corresponding effect on the zinc concentration drop through the cell.The cooling towers were put in to the simulation under the same conditions of an oper-ating cell house. Atmospheric air was passed through the cooling towers at a static 280,000m3 h−1. The air venting through the cooling towers was first passed through the cell houseitself providing the ventilation of acid mist. Before entering the cell house the ventilationair was first heated to 10 ◦C if the outdoor ambient temperature was cooler, but it was notcooled when it was warmer. As such, the temperature entering the cooling towers verydifficult to measure, as is the humidity. For this reason the cooling tower was assumed tobegin as soon as the air enters the cell house, making the Merkel number for the cooling73CHAPTER 5. MODEL VALIDATIONFigure 5.5: Comparison of the tankhouse current density against the predicted dropin Zn2+ concentration from CE to SE over 8.5 daystower an approximate one rather than a true value. This approximate Merkel number wassolved for by analyzing the cell house over the course of a day where the cooling tower airwas saturated and unsaturated. This value was 0.4 and was kept constant for the remainderof the simulation runs. The effects of this value on the temperature of the cell house can beseen in Figure 5.6.Often the air exiting the cooling tower would become supersaturated with the relativehumidity exceeding 100%. In this situation the exiting humidity would be equal to thesaturation humidity with the excess steam coalescing as water droplets. This coalescencealong with conventional convective heat transfer increases the air temperature over thatdomain step. In turn, water vapour saturation increases, allowing cooling to continue evenif saturation is reached part way through the tower. The coalesced steam exited as liquidwater, assumed to have formed in the vent stream.A simulation was run to validate the mass and energy balance for this particular cell74CHAPTER 5. MODEL VALIDATIONFigure 5.6: Comparison of recorded and predicted temperatures over the course oftwo weeks based on the developed cooling towerhouse. This was done by transferring data, (obtained from the cell house’s DistributedControl System (DCS)), from a spread sheet to the simulation through a Component ObjectModule (COM) link. Every simulated hour, the simulation updated the data it used fromcell house measurements. Some of these measurements were then used to drive the simu-lation, while the remainder were used to validate the simulation to ensure replication of theactual cell house as closely as possible. The data provided to drive the simulation was: theelectric current to the cells I, concentration of zinc in the zinc purified solution (cZn(ZPS)),temperature of the zinc purified solution (T (ZPS)), and the flow rate of air through thecooling towers (m˙(A)). In the actual cell house, the V˙ (ZPS) was tied to the current appliedto the electrowinning cells and this was replicated in the simulation according to equation5.1. During large current shut downs (50% or less of normal) flow rate of ZPS was set to75CHAPTER 5. MODEL VALIDATIONzero. Pure water was added to the cell house to represent sump water additions to the cellhouse. The water flow rate (F(W)) was set equal to the amount of water evaporated in thecooling towers since the water addition to the cell house is typically erratic and could notbe represented well in the simulation.V˙ (ZPS) = 7.2×10−4ICH (5.1)Figure 5.7 presents the concentrations of zinc and sulfuric acid in the spent electrolytefor both the industrial cell house and the simulation over a period of steady state opera-tion. Good agreement was found between the two indicating the simulation is performingas an adequate proxy for the actual process. Similar results were observed for the cooledelectrolyte, however this information is not presented. Further in Figures 5.8 and 5.9 thedaily and cumulative cathode production are presented. The masses of cathode producedwas scaled to an average value of daily production, with a value of one being average. Thepredicted and reported daily produced zinc in figure 5.8 were similar, however day-to-dayvariation in the cathode stripping schedule created variations in the reported cathode val-ues. In particular, the period from day 20 to day 60 in figure 5.9 was a result of a change inthe stripping schedule from every 48 hours to every 60 hours. The cumulative cathode pro-duction simply added the produced amount of zinc each day to a running total. After 100days, the predicted cumulative cathode produced was 0.23 % less than the reported cumula-tive cathode produced. This prediction was generated through the fundamental model, anddid not require any offset for the predicted current efficiency. It demonstrates the overallamount of zinc produced by the reported and the predicted cathode masses to be very simi-lar. This indicates the simulation is closely predicting the current efficiency experienced inthe cell house.76CHAPTER 5. MODEL VALIDATIONFigure 5.7: Comparison of the zinc and acid concentration in the spent electrolytebetween the reported cell house electrolyte data and calculated results from thesimulation5.2.3 Validating Cell House B5.2.4 Simulation MethodologyA dynamic transient simulation was made to replicate as closely as possible the actualoperating plant conditions of an industrial facility taking in to account parameters such assolution flows, electrolyte conditions, current applied, and tank volumes. A basic outline ofthe simulation is shown in figure 5.10 primarily to identify the locations of measurementstaken, important controllers, and abbreviations.Static inputs to the simulation will include information such as volume of any tanksand physical cell characteristics. Dynamic inputs include time based measurement dataof the purified electrolyte and returned electrolyte. Abbreviations are defined in table 5.3.77CHAPTER 5. MODEL VALIDATIONFigure 5.8: Comparing daily cathode production in the simulation to that reported bythe plant. Stripping in the simulation was done on a 48 hour schedule howeverthe plant used a 60 hour stripped schedule from day 20 to 60 resulting the in thewidening of the reported cathode mass production in that sectionThe current efficiency of the cells is predicted by the simulation based on electrochemicalkinetic equations. Typically, the current efficiency is predicted to be 91-92% for the typicalelectrolyte composition and cell operational parameters of these cell houses. Calculatedweekly and monthly averages of current efficiency are lower, averaging around 87%. Rea-sons for this discrepancy will require further investigation. All data values were taken fromindustry partner cell houses.78CHAPTER 5. MODEL VALIDATIONFigure 5.9: Cumulative cathode prediction for the simulation and the daily reportedamount. Good agreement is found between the two over this time period sug-gesting the current efficiency calculated is representative of the actual cell houseefficiencyTable 5.3: Measurement location labels associated with figure 5.10Measurement Location LabelPurified Electrolyte A ZPSAPurified Electrolyte B ZPSBCooled Electrolyte A CEACooled Electrolyte B CEBSpent Electrolyte A SEASpent Electrolyte B SEBReturned Electrolyte A REAReturned Electrolyte B REBProduced Zn Cathode Cath79CHAPTER 5. MODEL VALIDATIONFigure 5.10: Process flow diagram of cell houses including measurement position no-tations5.2.5 Simulation ResultsZinc BalanceAn initial overall zinc mass balance was conducted in order to confirm there are no masserrors in the simulation. The simulation was taken to steady state at a consistent start timeon an arbitrarily chosen date. The concentrations of species, current, and temperature inputto the simulation were taken from cell house measurements. A data file with all of themeasurements and the time they were taken at was linked through a COM server to thesimulator allowing those measurements to be read directly in to the simulation. The valuesread to the simulation were the next upcoming value in time. For example, at 12:01 amJanuary 1, 2000, the purified Zn concentration input was the value given at 3:00 am January2000 rather than the value recorded at 11:00 pm December 31, 1999. The initial zinc80CHAPTER 5. MODEL VALIDATIONbalance numbers are given in table 5.4. It demonstrates that the mass balance is working asexpected with no unaccounted losses or gains in zinc through the system.Table 5.4: Zinc balance taken around cell house A and B at steady state on the starttime and date. Positive values are flows in to the cell house, negative values areflows outMeasurement Location Zinc Concentration (g L−1) Flow (m3 hr−1) Zn Flow (kg s−1)Electrolyte InZPSA 157 208.98 9.113ZPSB 157 207.36 9.043Electrolyte OutREA 58 -197.87 -3.188REB 56 -211.80 -2.928Cathode ProducedCath -12.040Balance Zinc 0With the mass balance established, the steady state results of the entire simulation (allspecies, temperatures, and flow rates) were combined in to a file saved within the simulator(CADSIM Plus). The simulation could then use the file as a starting point running in tothe future. Two primary changes were then introduced to the system. First, the time wasallowed to increment forward. This is to say the simulation was in a dynamic state ratherthan a steady state. Second, the measured values taken from the plant were used to drive thesystem. In this case, the flow of purified electrolyte was set by a controller which soughtto match the predicted value of the returned electrolyte zinc concentration in cell houseA and B to the assay values by varying the flow rate of purified electrolyte. The purifiedelectrolyte concentration values were set directly from plant data. A sample of these resultscan be seen in figure 5.11. As expected, the ZPSA concentration values overlap exactlybecause this was a direct input; as such the predicted ZPSA Zn values cannot be seen. TheREA Zn values show good agreement for most points. The minor fluctuations may be dueto erratic addition of wash water to the cell house.This cell house did not have an operating flow meter on the flow of ZPS and to predictthe flow of electrolyte. The simulation controlled the purified flow directly, seeking to81CHAPTER 5. MODEL VALIDATIONFigure 5.11: Predicted and assayed zinc concentrations of the purified (ZPSA) and re-turned (REA) electrolyte in cell house A from the start time onwards. Locationof measurement in the cell house is indicated in figure 5.10match simulated RE zinc concentration values with industrial data fed in by the COM link.In this case, the purified electrolyte flow was set by a PID Track controller. This controlleris described in Section 7.1 in more detail. The results of the simulation over a period oftwo weeks is seen in Figure 5.11.Internal Zinc BalanceSince the overall mass balance is correct and the purified and returned electrolyte flowsgive concentrations that match the assayed results, the internal movement of zinc withinthe cell house can be analyzed. The predicted and assayed values of the spent and cooledelectrolyte zinc concentrations in cell house A can be seen over the course of two weeksat the same set static value of current efficiency (87%) in figure 5.12. During this time82CHAPTER 5. MODEL VALIDATIONFigure 5.12: Comparison of predicted and assayed spent (A) and cooled electrolyte(B) zinc concentrations in cell house A from the start time onwards with anelectrolyte recirculation ratio of 9.62. Location of measurement in the cellhouse is indicated in figure 5.10there was a 17 hour shut down of cell house A on the 8th day, otherwise the current wassteady. Figure 5.12 shows the predicted and assayed zinc concentrations in the Cooled(cZn(CEA) and Spent cZn(SEA) concentrations in cell house A. The cZn(SEA) values matchclosely to those in figure 5.12A. This was expected since the c(REA)(Zn) values should onlydiffer from the cZn(SEA) values by the residence time of the SE Tank A (approximately 45minutes).83CHAPTER 5. MODEL VALIDATIONThe cZn(CEA) values display much more variation than cZn(SEA). In general, the differ-ence in the assayed values indicates that the bite through the cells should be approximately8-10 g L−1, while the simulation predicts a zinc bite of approximately 6-8 g L−1 as seenin figure 5.12B. This suggests that more aqueous zinc is being taken out of the electrolyteper pass in the actual process. This could be caused by either higher current efficiencyin the actual process than what is being predicted (contrary to what has been establishedpreviously) or the electrolyte residence time in the cells should be shorter than its currentvalue (approximately 60 minutes). Supporting the latter, the actual c(CEA)(Zn) values arehigher than the predicted c(CEA)(Zn) in two occurrences, at 2.5, and 10.5 days in figure5.12B. This could also be due to a longer residence time in the simulation, resulting in thepredicted c(CEA)(Zn) Zn taking a longer time to react to rapid increases in zinc concentra-tion.The recycle flow rate of spent electrolyte to the cooling towers was the primary de-terminant of the residence time of the cells since the flow rates of purified electrolyte andwash water are minor in comparison. The ratio of recirculated volumetric flow to volu-metric addition of purified electrolyte was initially 9.62. One complication arises from thesporadic addition of wash water to the cells which may interfere with concentration values.This source of error is assumed to be minor. The simulation recommended a ratio of ap-proximately 12.0 (approximately 60 minute residence time) to get a reasonable fit betweenthe predicted and assayed c(CEA)(Zn) values as seen in figure 5.13. The agreement appearsto be consistent in the Cell House B over this time period (figures 5.14 and 5.15). It issuspected that the greater variation in the cold spent electrolyte concentration is due to thewater balance. It is difficult to establish a complete water balance due to the variation inwater being taken off by the cooling towers given the ambient weather conditions as wellas the intermittent addition of wash water.84CHAPTER 5. MODEL VALIDATIONFigure 5.13: Comparison of predicted and assayed spent (A) and cooled (B) zinc elec-trolyte concentrations in cell house A from the start time onwards with a recir-culation ratio of 12.0. Location of measurement in the cell house is indicatedin figure 5.105.3 SummaryThe developed models of the cooling tower and zinc electrowinning cells were first vali-dated against values reported from literature. Using the developed model, an operating zincelectrowinning cell house was simulated with good agreement with the values recorded bythe cell house.85CHAPTER 5. MODEL VALIDATIONFigure 5.14: Predicted and assayed purified and returned electrolyte zinc concentra-tions in cell house B. Location of measurement in the cell house is indicatedin figure 5.1086CHAPTER 5. MODEL VALIDATIONFigure 5.15: Comparison of predicted and assayed spent (A) and cooled (B) elec-trolyte zinc concentrations in cell house B. Location of measurement in thecell house is indicated in figure 5.1087CHAPTER 6OPTIMIZATION6.1 Optimization Studies of a Zinc Electrowinning Pro-cess SimulationThe process simulation was used to analyze a variety of conditions and identify optimalconditions for both a single cell and a full cell house, along with the notable differencesbetween the two.6.1.1 Optimization MethodologyOptimizations were performed to analyze the effects of multiple variables on multiple ob-jective functions. The objective functions used are given in equations (4.24), (4.25), and(4.26). For objective functions which were required to maximize a value (i.e. current effi-ciency and zinc production rate) the inverse of the value was taken as the objective function.As the objective functions were often not convex, optimization trials were run five timesindependent of the number of manipulated variables. Random initial guesses were suppliedby the algorithm in order to investigate possible erroneous values caused by local minima.In cases where a local minimum was found, the optimization was run an additional timeto obtain a total of five consistent minimum values. Optimization studies were carried outfirst on a single cell, then on the full cell house consisting of 200 cells and cooling towers.88CHAPTER 6. OPTIMIZATION6.1.2 Single Cell AnalysisThe single cell was optimized for up to three separate criteria: current efficiency, energyconsumption, and production rate. Up to four variables were manipulated to find the opti-mums: current density, temperature, concentration of Zn2+, and concentration of H2SO4.First the model was optimized under constraint conditions chosen based on typical limits ofcell house operation. While the model was validated under a larger range of conditions, acell house typically cannot operate under all of these conditions (such as room temperature)without substantial changes to the cell house flow sheet. These conditions were chosen suchthat they can be reasonably applied to a typical zinc circuit. Second, the model was opti-mized under constraint conditions chosen based on the limits of validation of the model.This was done to examine the simulation performance over a range of conditions outsideof the normal bounds of electrowinning cell house operation. However, these conditionsmay be unreasonable for typical zinc circuits in operation.Optimization under zinc circuit conditionsTable 6.1 outlines the variable limits (when free to be manipulated) and fixed values (whena manipulated variable was fixed). A variable was either manipulated or set to its fixedvalue, giving a total of 8 optimization tests for the optimized energy consumption per tonneof zinc produced. The limits were chosen based on the typical modern cell house charac-teristics detailed by Sinclair [6]. The acid concentration was set based on the variable zincconcentration in order to give a constant value of sulfate concentration in the cell for alltrials. For the typical zinc and acid concentrations of 50 g L−1 Zn and 165 g L−1 H2SO4,this was calculated to be 2.5 mol L−1. This gives a lower bound acid concentration of 135g L−1. This concentration may be too low for the leaching operations of some zinc circuits.The minimum temperature of 30 ◦C may require cooling beyond what a cell house canachieve given the seasonal ambient air conditions, however this was an achievable set pointfor one of the cell houses visited. While these optimization limits were chosen based on89CHAPTER 6. OPTIMIZATIONTable 6.1: Single Cell Normal Operation Limits. *The acid concentration is calcu-lated based on maintaining a constant concentration of sulfate for the fixed con-ditionParameter Symbol Minimum Maximum Fixed ValueCurrent Density (A m−2) iC 281 640 450Temperature (◦C) T 30 40 35Zn2+ (g L−1) Zinc 47 70 50H2SO4 (g L−1) Acid* 135 170 165their applicability to a typical operating cell house, it must be stressed that the model doesnot account for phenomena such as cathode morphology or impurity effects which may beencountered.Table 6.2 details the prediction of optimal current efficiency in the cell. Generally,increasing current efficiency came at the cost of higher energy consumption. Higher currentdensities generally increased the current efficiency so long as the zinc concentration washigh enough to prevent mass transfer limitations. As well, the highest current densities wereachieved with the highest zinc concentrations. The optimized current efficiency alwaysfavored lower temperatures as the higher temperatures will increase the rate of hydrogenevolution due to the lower activation energy as compared to zinc deposition used in themodel.Optimization results for energy consumption per tonne of zinc produced under normaloperating constraints are listed in table 6.3. Generally, reduced energy consumption camewith reduced current densities, at the cost of overall production rate. Under typical currentdensity, energy consumption was reduced with higher temperatures, while the opposite wastrue for the lower bound current density. This was due to the competing effects of solutionresistivity and current efficiency both decreasing at higher temperatures. Under typicalcurrent density, there was not a large amount of variation in the energy consumption. Thiswas due to the narrow range of zinc concentrations and temperature variation.Table 6.4 gives the optimized steady state zinc production rates. The current densitywas the primary driver of increasing production. The current efficiency resulting from90CHAPTER 6. OPTIMIZATIONTable 6.2: Single cell optimization of current efficiency (ε), along with correspond-ing energy (P) and zinc production rate (rZn) values under typical cell housecontraints. Underlined text indicates values set to their fixed value. Acid concen-trations were set based on maintaining the sulfate concentration at 2.5 mol L−1.Consult table 6.1 for symbol definitionsZinc Acid T iC ε P rZn(gL-1) (gL-1) (oC) (Am-2) (%) (kWhtonne-1) (kgs-1)70 135 30 640 96.4 2974 0.075370 135 35 640 96.2 2952 0.075170 135 30 450 95.9 2781 0.052670 135 35 450 95.6 2771 0.052550 165 30 584 94.2 2867 0.067150 165 35 592 93.9 2860 0.067850 165 30 450 93.9 2752 0.051550 165 35 450 93.5 2748 0.0513Table 6.3: Single cell optimization of energy consumption (P), along with corre-sponding current efficiency (ε) and zinc production rate (rZn) values under typ-ical cell house constraints. Underlined text indicates values set to their fixedvalue. Acid concentrations were set based on maintaining the sulfate concentra-tion at 2.5 mol L−1. Consult table 6.1 for symbol definitionsZinc Acid T iC ε P rZn(g L−1) (g L−1) (◦C) (A m−2) (%) (kWh tonne−1) (kg s−1)70.0 135 30 281 94.2 2636 0.032370.0 135 35 281 93.7 2638 0.032150.0 165 30 281 91.8 2651 0.031550.0 165 35 281 91.2 2661 0.031254.1 159 40 450 93.6 2744 0.051450.0 165 40 450 93.1 2746 0.051152.5 161 35 450 93.8 2747 0.051550.0 165 35 450 93.5 2748 0.0513the zinc concentration and temperature modified this value further. Increasing the currentdensity results in higher exiting electrolyte temperatures, and a cell house may be unableto cool the circulated electrolyte without modification.91CHAPTER 6. OPTIMIZATIONTable 6.4: Single cell optimization of zinc production (rZn), along with correspond-ing current efficiency (ε) and energy consumption (P) values under normal cellhouse constraints. Underlined text indicates values set to their fixed value. Acidconcentrations were set based on maintaining the sulfate concentration at 2.5 molL−1. Consult table 6.1 for symbol definitions.Zinc Acid T iC ε P rZn(g L−1) (g L−1) (◦C) (A m−2) (%) (kWh tonne−1) (kg s−1)70 135 30 640 96.4 2974 0.075370 135 35 640 96.2 2952 0.075150 165 30 640 94.0 2921 0.073450 165 35 640 93.9 2903 0.073370 135 30 450 95.9 2781 0.052670 135 35 450 95.6 2771 0.052550 165 30 450 93.9 2752 0.051550 165 35 450 2748 93.5 0.0513Optimization under model validation limitsThe model was also optimized on a broader range of conditions, outlined in table 6.5,which may create operating conditions not normally seen in cell house operation. The acidconcentration in this case was free to be manipulated, contrary to the previous optimiza-tion. The lower temperature limit of 20 ◦C may be unattainable using conventional coolingtowers and would likely require additional cooling to achieve this value. Further, the hightemperature limit of 50 ◦C may cause reduce current efficiency due to exacerbated hydro-gen evolution on minor amounts of incoming impurities (such as Co). The variable limits(when free to be manipulated) were chosen based on the limits that the model had beenvalidated under. A variable was either manipulated or set to its fixed value, giving a totalof 16 optimization tests for each of the three optimized criteria. While these values maybe unattainable in an operating cell house, the model can indicate general trends of cellperformance beyond normal operating conditions.It must be noted that while the values generated through these optimizations are basedon validated mathematical models, experimental verification has not been conducted. Inparticular the values of current efficiency are predictions of the idealized effect of parasitic92CHAPTER 6. OPTIMIZATIONTable 6.5: Single Cell Optimization LimitsParameter Symbol Minimum Maximum Fixed ValueCurrent Density (A m−2) iC 300 700 491Temperature (◦C) T 20 50 39H2SO4 (g L−1) Acid 100 225 170Zn2+ (g L−1) Zinc 15 100 54.5hydrogen evolution on current efficiency. They may produce different results depending oncurrent losses from other sources such as electrical shorts caused by dendritic growth, stickycathodes, or impurity effects. As well, the optimizations cannot account for morphologicaleffects or other operational concerns.Surface response plots of the current efficiency, energy consumption, and zinc produc-tion rate have been presented in figures 6.1, 6.2, and 6.3 respectively. They are presentedfor varying current density and temperature with constant zinc and acid concentrations inorder to better understand the simulation response. Full results of the optimizations of cur-rent efficiency, energy consumption, and zinc production can be seen in tables 6.6, 6.7, and6.8. Typically, free variables trended towards the limits of the simulation to achieve themaximum current efficiency and zinc production. One notable exception is seen in table6.6 where current density does not reach its maximum of 700 A m−2 when the zinc ionconcentration is fixed. This suggests that the current efficiency is highly dependent on thecombination of current density and zinc concentration. When the zinc concentration is in-creased, the mass transfer limitation of the zinc reduction reaction is reduced, allowing thecurrent density to increase without adverse effects on the current efficiency. However, acell house could not operate under these conditions due to the formation of dendrites whichwould create shorts and drastically reduce the current efficiency.In general, current density has the largest effect on optimization of energy consump-tion and zinc production. This aligns with expectations since the current density is nearlydirectly proportional to production and energy consumption at high current efficiencies asseen in equations (4.25) and (4.26). Current density did not have a similar effect on the93CHAPTER 6. OPTIMIZATIONTable 6.6: Single cell optimization of current efficiency (ε), along with correspondingenergy (P) and zinc production rate (rZn) values. Underlined text indicates valuesset to their fixed value. Consult table 6.5 for symbol definitionsZinc Acid T iC ε P rZn(g L−1) (g L−1) (◦C) (A m−2) (%) (kWh tonne−1) (kg s−1)100 100 20 700 98.1 3101 0.0745100 100 20 491 97.9 2848 0.0521100 100 39 700 97.7 2999 0.0741100 100 39 491 97.3 2788 0.0518100 170 20 700 97.2 2920 0.0738100 170 20 491 96.5 2745 0.0514100 170 39 700 96.4 2861 0.073154.5 100 20 422 96.4 2794 0.044154.5 100 20 491 96.2 2886 0.051254.5 100 39 491 95.8 2809 0.05154.5 100 39 514 95.8 2834 0.0533100 170 39 491 95.4 2722 0.050854.5 170 20 553 95.0 2790 0.05754.5 170 20 491 94.9 2739 0.050554.5 170 39 696 94.2 2853 0.071154.5 170 39 491 93.7 2718 0.0499optimal current efficiency, however. Rather, optimal current efficiency depended more onthe number of free variables to optimize for. Generally, all three of these tables demonstratethat with a greater number of free variables to manipulate, the optimal values will reach alower minimum. A notable exception was observed in table 6.8 where the fixed concentra-tion of zinc ions alone had a larger effect on optimal zinc production than fixing both theacid concentration and temperature. This was also the case for optimal current efficiencyas seen in table 6.6.As seen in equation 4.12, an increase in hydrogen production will increase the masstransport of zinc ions, and thus increase the limiting current density of the zinc depositionreaction as well. This, in turn, can increase the zinc deposition current density if the zincdeposition reaction is being limited by mass transfer conditions. For this reason, the currentdensity does not appear to have uniform influence on determining the maximum currentefficiency. As the current efficiency is greatly influenced by the limiting current density,94CHAPTER 6. OPTIMIZATIONFigure 6.1: Surface response plot of current efficiency in a single cell at 30 g L−1 (a),55 g L−1 (b), and 80 g L−1 (c) Zn2+. Colour plot and bottom contour are doneat 180 g L−1 H2SO4 while solid gray plot is at 150 g L−1 H2SO495CHAPTER 6. OPTIMIZATIONTable 6.7: Single cell optimization of energy consumption (P), along with corre-sponding current efficiency (ε) and zinc production rate (rZn) values. Under-lined text indicates values set to their fixed value. Consult table 6.5 for symboldefinitionsZinc Acid T iC ε P rZn(g L−1) (g L−1) (◦C) (A m−2) (%) (kWh tonne−1) (kg s−1)100 148 20 300 95.6 2601 0.0311100 170 20 300 94.8 2603 0.030999.6 113 39 300 95.4 2604 0.031154.5 154 20 300 94 2611 0.030654.5 170 20 300 93.4 2612 0.030454.5 120 39 300 93.8 2620 0.030599.9 170 39 300 92.9 2623 0.030254.5 170 39 300 91.2 2641 0.029762.4 225 32 491 93.1 2701 0.049667.6 208 39 491 93.2 2703 0.049654.5 225 20 491 93.6 2707 0.049870.4 170 45.3 491 94.1 2710 0.050168.7 170 39 491 94.5 2711 0.050354.5 198 39 491 92.8 2712 0.049454.5 170 42.9 491 93.4 2717 0.049754.5 170 39 491 93.7 2718 0.0499high zinc ion concentrations are favoured as seen in figure 6.1 and table 6.6. A high currentefficiency has an associated lower hydrogen gas production rate which decreases the masstransfer coefficient. However, this penalty on the zinc deposition rate can be counteractedby increasing the zinc concentration as seen in equation (4.13).The current efficiency optimizations in table 6.6 favour lower acid concentrations, whichwas expected due to the resulting decrease in the exchange current density of hydrogenevolution at lower acid concentrations. The effect appears to be increased at higher tem-peratures and lower current densities as seen in figure 6.1.Finally, in figures 6.1a and b, the current efficiency appears to favour lower tempera-tures when the current density is low, and the opposite when the current density is high.However figure 6.1c shows a low temperature is preferred through the entire plot. Thelower temperature caused a decrease in the exchange current densities, and a decrease in96CHAPTER 6. OPTIMIZATIONTable 6.8: Single cell optimization of zinc production (rZn), along with correspond-ing current efficiency (ε) and energy consumption (P) values. Underlined textindicates values set to their fixed value. Consult table 6.5 for symbol definitions.Zinc Acid T iC ε P rZn(g L−1) (g L−1) (◦C) (A m−2) (%) (kWh tonne−1) (kg s−1)100 100 20 700 98.1 3101 0.0745100 100 39 700 97.7 2999 0.0742100 170 20 700 97.2 2920 0.0738100 170 39 700 96.4 2862 0.073254.5 100 39 700 95.1 3057 0.072254.5 100 20 700 95 3195 0.072154.5 170 20 700 94.6 2928 0.071854.5 170 39 700 94.2 2856 0.0715100 100 20 491 97.9 2848 0.0521100 100 39 491 97.3 2788 0.0518100 170 20 491 96.5 2745 0.051454.5 100 20 491 96.2 2886 0.051254.5 100 39 491 95.8 2809 0.051100 170 39 491 95.4 2722 0.050854.5 170 20 491 94.9 2739 0.050554.5 170 39 491 93.7 2718 0.0499the standard rate constants, the equilibrium potentials, and the volumetric flow of hydrogengas at the cathode. This, in turn, decreased the mass transfer coefficient. In the progressionof figures 6.1a to 6.1c, as well as in table 6.6, we note the movement of the maximumcurrent efficiency values to higher current densities while the zinc concentration increases.This indicates the strong effect of the limiting current density on the current efficiency.The higher preferred temperatures are indicative of the increased mass transfer coefficientcaused by a greater volumetric production of hydrogen. Lower temperatures appear to beuniformly preferred when the system is not being strongly affected by the mass limitationcondition. This trend is a result of the balance of the exchange current densities of zinc andhydrogen with a greater amount of hydrogen being produced in proportion to depositedzinc at higher temperatures.The energy consumption per tonne of zinc (table 6.7) is of interest because minimiz-ing this value requires balancing current efficiency and overall cell voltage. This is best97CHAPTER 6. OPTIMIZATIONFigure 6.2: Surface response plot of energy consumption in a single cell at 30 g L−1(a), 55 g L−1 (b), and 80 g L−1 (c) Zn2+. Colour plot and bottom contour aredone at 150 g L−1 H2SO4 while solid gray plot is at 180 g L−1 H2SO498CHAPTER 6. OPTIMIZATIONdemonstrated in the variable acid concentration. While the current efficiency and produc-tion optimizations always sought to minimize the acid, the optimized energy consumptiondemonstrates that a sacrifice in current efficiency through higher acid concentration in-creases the conductivity of the solution (equation (4.3)) enough to give an overall minimalvalue of energy consumption.The effect of low limiting current density and resulting low current efficiency on theenergy consumption can be seen in figure 6.2a. Conversely, the similarity of figures 6.2band 6.2c demonstrate that the increased zinc concentration does not have a large effect onthe energy consumption in regions where the limiting current density is also large. Thegeneral increase in energy consumption with increasing current density is expected due tothe increased cell voltage needed to produce overvoltage, to drive the anodic and cathodicreactions, and to pass the larger amount of current through the electrolyte. Therefore, thevariation in the energy consumption surface plot must be a result of competing changes inthe cell voltage.The temperature and acid concentration of the electrolyte have a large effect on thesolution conductivity contributing to the potential drop through the solution as seen inequation (4.3). In general, higher temperatures and acid concentrations will increase thesolution conductivity. The effect of temperature on energy consumption changes as thecurrent density increases: dPdT has a positive slope at 300 A m−2 and a negative slope at700 A m−2. This change in slope is due to the nature of the potential calculations. This isexemplified by the difference between equations (6.2) and (6.3).ECell = |EC|+ |EA|+ESol +ELoss (6.1)ESol =∆biCσB(6.2)99CHAPTER 6. OPTIMIZATIONηH2O = Ka+Kblog(iH2O) (6.3)In equation (6.2), the potential increases linearly with current density, while in equa-tion (6.3) the increase in potential scales logarithmically with current density. The Butler-Volmer equations (equations (4.10) and (4.14)) act in a similar manner to the Tafel rela-tion (equation (6.3)) with linear change in the magnitude of potential causing exponentialchange in current density. Thus as the current density is increased, there is a greater rate ofincrease in the ESol term than in EC or EA in equation (6.1) resulting in the change of slope.An increase in the acidity increased the solution conductivity, but also decreased thecurrent efficiency (as seen previously). Between these opposite contributions to the energyconsumption, lower acidity produces lower energy consumption only in a region wherethe temperature was high and the current density was low. This created an intersectionbetween the different acid concentration surfaces observable in figures 6.2a, b and c. In theprogression of these figures, the intersection moves towards higher temperatures, and lowercurrent densities. This movement of the intersection corresponds to the same decrease incurrent efficiency in this region as seen in figure 6.1. However, at higher current densities,it demonstrates that a sacrifice in current efficiency with higher acid concentrations canresult in a lower energy consumption as a result of the increase in solution conductivity.Finally the surface response and the optimization of zinc production is seen in figure 6.3and table 6.8 respectively. The optimizations show that maximum production is achievedat the highest current density and a maximized current efficiency. The surface responsedemonstrates that current density is the primary variable affecting production. The zincconcentration had little overall effect on the production as long as the deposition was notunder limiting current density conditions. Lower acid concentrations were favoured, how-ever the effect appears minor and is difficult to see in figure 6.3. The temperature does nothave an observable influence in figure 6.3, however the optimization data in table 6.8 foundthat lower temperatures increased the production rate when zinc concentrations were at the100CHAPTER 6. OPTIMIZATIONFigure 6.3: Surface response plot of zinc production in a single cell at 55 g L−1 Zn2+.Colour plot and bottom contour are done at 150 g L−1 H2SO4 while solid grayplot is at 180 g L−1 H2SO4101CHAPTER 6. OPTIMIZATIONset point or above. This corroborates findings that the current efficiency increases with de-creased temperature in regions where the limiting current density is not strongly affectingthe zinc current density.6.1.3 Cell House AnalysisOptimizations were also performed on an entire simulated cell house consisting of 200cells containing 100 cathodes, and 101 anodes each. The objective function of power con-sumption (equation (4.25)) was used. There were minor variations in power consumptionbetween the cells as a result of the changing gap space between electrodes as the depositsgrew or were harvested. Because of this, an average of power consumption from all 200cells was used in the optimization. The cooled electrolyte was distributed evenly to all cellsin parallel and the current was equal throughout the cells resulting in largely consistent cellconditions.The operation of a cell house differed from a single cell in that the electrolyte movedthrough recycle circuits. There were also additional operational units such as cooling tow-ers and storage tanks. This increased the complexity of the simulation, requiring longercomputation times per time step than a single unit model. As well, the simulation reflectedthat a cell house cannot control variables as closely as in an experimental cell and it takesa longer amount of time to reach steady state. In particular, the acid concentration wassoley a result of generated through electrolysis; typically acid is not added or neutralizedin normal cell house operation.The temperature of the electrolyte is also more difficult to control in an operating cellhouse. The recycled electrolyte was cooled through evaporative cooling towers which maynot be able to cool the electrolyte enough to reach the desired temperature. The simulationcontrolled the cooled feed temperature rather than the spent electrolyte temperature. Basedon this, energy consumption was used as the objective function, with the electrolyte tem-perature, and zinc concentration being variable within the ranges listed in Table 6.5. The102CHAPTER 6. OPTIMIZATIONoptimizations were conducted at multiple constant current densities.The optimization of energy consumption of the cells in the cell house can be seen infigure 6.4. Compared to the energy values reported in table 6.7, the optimal energy con-sumption values for the cell house are similar. The acid concentration is not fully controlledin the cell house as it is mainly a result of the applied current driving the anodic reactionand the addition of purified electrolyte to the cell house. However, with the zinc concen-tration controlled by the addition of the purified electrolyte, and the current already beinga variable, the acid concentration is now a result of the optimization conditions. Notably,the optimized energy values cannot reach the minimums attained in the single cell set upgiven the lack of control over the acid concentration. In the full cell house optimization,the zinc concentration decreased with increasing current density starting at 67 g L−1 at 300A m−2 and decreasing to 51.8 g L−1 at 700 A m−2. This presents an important disconnectbetween laboratory tests and cell house performance. The single cell optimization testsconducted without the sulphate constraint suggest increasing the zinc ion concentration toachieve lower energy consumption, while the optimization of the full cell house suggestthis is not the case. This is due to the link of acid and zinc concentration in the cell house.Figure 6.4 also shows that optimal power consumption was achieved at the higher cur-rent densities by increasing temperature. At higher current densities, the potential throughthe solution increased. To minimize the energy consumption, the conductivity of the so-lution needed to be increased also increasing the temperature. As well, the conditionswhich produced higher acid concentrations were favoured for their increased solution con-ductivity. The result however was a decrease in the predicted current efficiency as highertemperature and acid result in greater hydrogen evolution.It must be noted that the values for power consumption presented here are lower thanthe median value of 3200 kWh tonne−1 reported for cell houses [24]. This difference maybe a result of effects not taken in to account by the simulation such as shorts caused bydeposit growth, impurity effects on current efficiency, or increases in cell voltage caused103CHAPTER 6. OPTIMIZATIONFigure 6.4: Optimization of electrowinning cell energy consumption for a simulatedcell house. Consult table 6.5 for symbol definitionsby additives such as glue. This will affect optimal energy consumption conditions.6.2 SummaryThe simulation was used to examine optimization results for a single zinc electrowinningcell noting the overall tendency to increase zinc concentrations and decrease temperatureand acid concentrations. In comparison to a full zinc cell house, it was noted that the lackof strong control of acid concentration in the cell house affects the optimization results.To achieve the gains in energy efficiency possible in a single cell, methods of decreasingthe cell house acid concentration would be required. This may not be reasonable given therecycling of spent acid back to previous leaching operations.104CHAPTER 7APPLICATIONSUsing the validated simulations in Chapter 5, applications of the dynamic process simula-tion were examined.7.1 Simulating Process ControlZinc electrowinning cell house control is primarily operated under manual control. Whilemany other chemical processing industries rely heavily on process control, few details re-garding process control in hydrometallurgy exists. Integrating a computerized process con-trol scheme is difficult in a cell house where the potential negative outcomes of a poorlydesigned control scheme may have enormous costs. Further, it is difficult to anticipate thepotential benefits of a sophisticated process control scheme in a zinc electrowinning cellhouse. More consistent control of zinc cell house electrolytes may be beneficial for main-taining high current efficiency and zinc production. Further, the electrical current suppliedto the cell house occasionally is changed and a control scheme would aid in returning thecell house to desired set points. One potential method of evaluating control strategies andtheir benefits for these applications would be to examine a control scheme in a dynamicprocess simulation.As discussed previously, the electrolyte conditions that an electrode is exposed to canhave large implications as to what performance the zinc electrowinning cell will experience.Reducing variability can aid in maintaining high process performance. The three main105CHAPTER 7. APPLICATIONSreactions are influenced by the electrolyte temperature and aqueous species concentrations.In turn, these parameters will affect the current efficiency, energy consumption per mass ofzinc produced, and the overall production of the cell. For these reasons, it is important tomaintain the concentrations in the cells at desired levels.To the author’s best knowledge, no control strategies of systems have been reported inliterature for a zinc electrowinning cell house. Typically the cell house is controlled byexperienced operators however it is difficult to reach a set point due to the complex inter-actions and long solution retention times in a cell house. Some process control work forhydrometallurgy has been reported. Komulainen et al. demonstrated the benefit of a SingleInput Single Output (SISO) PID control, and a Multi Input Multi Ouput (MIMO) MPC controlon a copper solvent extraction process [104] . Work by Sun et al. investigated controllingcobalt removal in the cementation process in zinc purification [119] . The objective of thiswork is to investigate the effectiveness of process control for use in a zinc electrowinningcell house by using a time transient process simulation as a representation for the actualcell house. It will seek to maximize production of zinc cathode while stabilizing the con-centration of acid and zinc in the returned electrolyte to desired target concentrations.Proposed Control StrategyThe goal of this work is to identify potential benefits of applying a control scheme to azinc electrowinning cell house. The validated simulation of Cell House A in Chapter 5was used to investigate these benefits. Based on the process description, three manipu-lated variables were identified, outlined in figure 7.1: the flow of zinc purified solutions(V˙ (ZPS)), the flow of water to the cell house (V˙ (Water)), and the flow of air to the cool-ing towers (V˙ (Air)). Three variables of primary importance to zinc electrowinning are thespent electrolytes concentration of zinc (cZn(SE)), concentration of acid (cAcid(SE)), andtemperature T (SE). As the electrowinning cells are well mixed from the large amount ofoxygen and hydrogen gas evolution [3], the SE is generally thought to be representative of106CHAPTER 7. APPLICATIONS        !"#!" # !"$ #$    %"# Figure 7.1: Proposed control scheme for the cell housewhat solution conditions the electrodes are exposed to. Control of these SE parameters maytherefore improve the electrowinning cell performance.Many control feedback mechanisms exist. The most common approach is PID feedbackcontrol. PIDbreaks down intuitively in its components as past (I), present (P), and future(D) errors. Often the derivative portion is not included in control due to adding only asmall benefit to control at the cost of increased complexity [120]. It is estimated that 90%of implemented industrial controllers are PID controllers [121]. PID control is not suitablefor strongly non-linear systems, however can be utilized effectively when combined withtechniques such as with gain scheduling [122]. Other options such as MPC in combina-tion with low level PID control may be useful, or RST control however these are generallymore complex and are not investigated in this work [123, 124]. For this work, PID con-trollers were chosen due to their general application to many industrial processes and basicimplementation within the simulation software.The validated electrowinning process model was used to perform bump tests on the107CHAPTER 7. APPLICATIONScontrolled variables and the results can be seen in figure 7.2. Generally, the flow of zincpurified solution has the greatest affect on all three controlled variables. The flow of waterdid have an effect on the concentrations of species and the temperature of the electrolyte.The flow of air had little effect on concentrations while having a small effect on the elec-trolyte temperature. A control strategy as shown in figure 7.1 is proposed, with V˙ (ZPS)used to control the zinc concentration, V˙ (Water) used to control the acid concentrationand V˙ (Air) used to control the temperature. To investigate this pairing further, a relativegain array was developed using closed loop PID controls according to this pairing. Theresults are presented in table 7.1 and generally show that this control scheme is suitable.This control strategy has a Niederlinkski Index of 1.445 not indicating instability in thiscontrol scheme [125]. It must be noted that each manipulated variable has an affect on allthree controlled variables. A more sophisticated MIMO control strategy may be beneficialhowever for this work, only a SISO control strategy is examined.For this control scheme, it was assumed that there was an excess amount of ZPS alwaysavailable for input to the cell house. The zinc concentration and temperature of the ZPSwere constant at 170 g L−1 and 35 ◦C respectively. As well, the cooling towers were as-sumed to have a constant Merkel number of 0.2, and constant inlet air conditions of 20 ◦C,0.0 humidity ratio, and 101.3 kPa ambient air pressure. Electrolyte storage tanks (tanks 1and 2 in figure 7.1) used PID level controls tuned to give a tank level of 80%. Unless other-wise noted, the controllers were tuned using the CADSIM Plus internal tuning algorithm.This was based on the automatic lambda tuning method and bump tests performed withinthe simulation [126].Table 7.1: Relative Gain Array for the proposed control strategy presented in figure7.1[Zn] [Acid] [T]V˙ (ZPS) 0.675475 0.33017 -0.0057V˙ (Water) 0.318155 0.70381 -0.022V˙ (Air) 0.00637 -0.034 1.02761108CHAPTER 7. APPLICATIONSFigure 7.2: Bump test performed using the simulation demonstrating the effects ofthree manipulated variables on the resulting controlled variablesProcess upsets to a zinc electrowinning cell house include changes in the concentra-tion of the ZPS during purification, applied electric current, and electrolyte temperature.The control strategy presented in figure 7.1 was evaluated using 5% changes to the ZPSzinc concentration, in the current applied to the electrowinning cells, and in the flow rate ofspent electrolyte recirculating in the cell house. The results of zinc concentration, acid con-centration, and temperature are presented in figures 7.3, 7.4 and 7.5 using three strategies:Open Loop (OL), three PID controllers, and three PID controllers with a feed forward com-pensator for cZn(ZPS) and a track controller for the current (PID+Feed Forward (FF)). Thetrack controller (Track) gave an output based on the ratio of the applied electric current andthe output of the tuned PID controller. This served to decrease the flow of ZPS quickly in theevent that current to the cell house was also reduced suddenly. The FF control was set upbased on the difference in cZn(ZPS) from an average value of 170 g L−1 and would reduce109CHAPTER 7. APPLICATIONSor increase the V˙ (ZPS) as the cZn(ZPS) increased or decreased. The Integral of AbsoluteError (IAE) for each control scheme is further listed in table 7.2. The IAE was calculatedaccording to equation 7.1 where Controlled Variable (CV) was the controlled variable valuefrom the simulation, Set Point (SP), and N was the number of sampling points. The changein spent electrolyte flow rate had a notably smaller effect on the process than the other dis-turbance variables. The PID control with feed forward compensator and track control gavethe best disturbance rejection. In figure 7.3, the zinc concentration disturbance was greatlyreduced by the feed forward control, however this also increased the acid disturbance asseen in figure 7.5.IAE =N∑j|CV −SP| (7.1)Table 7.2: Integral of the absolute error of spent electrolyte zinc concentration(cZn(SE)), spent electrolyte acid concentration (cAcid(SE)), and spent electrolytetemperature T (SE)IAE cZn(SE) IAE cAcid(SE) IAE T (SE)Open Loop 147 98.1 15.1PID 59.6 53.8 4.4Track + FF 6.0 38.7 4.5Track + FF + U 3.5 2 4.5As seen in scaled temperature in figure 7.5, which exhibits some noise, a steady statewas not fully achieved. The action of simulated cathode harvesting caused the concentra-tion of acid to increase and decrease by approximately 0.5 g L−1 over the course of a dayin a periodic manner. During the simulated harvesting, the volume of the cell decreasedbelow the overflow point when cathodes were removed, and the electrolyte flow out of thecell halted for a couple of minutes as the cell filled again after. The momentary halt of SEflow as cathodes are pulled was confirmed by operator observation as well. This causedthe acid concentration to increase, and the zinc concentration to decrease. Another effectduring harvesting is that current density doubled (1000 A m−2) for approximately 10 min-110CHAPTER 7. APPLICATIONSFigure 7.3: Control response of the spent electrolyte zinc concentration in the simu-lated cell house under open loop, PID, and Track+FF Control given 5% changesto cZn(ZPS), I, and V˙ (SE)utes, lowering the predicted current efficiency by approximately 2%, and causing the acidconcentration to decrease and the zinc concentration increase. These competing effectsultimately caused the simulated acid and zinc to increase during harvesting with the effectbeing more pronounced for the acid concentration. This effect was minor when comparedto other simulated process changes such as in the cZn(ZPS) or I. Nevertheless it must benoted that a full steady state was not achieved.Controlling Water AdditionsWhile the PID ZPS flow controller performed consistently for the zinc concentration duringchanges in cZn(ZPS) and current, it was not satisfactory for the acid concentration as seenin figure 7.4. While overall there is a net loss of water in the cell house due to evaporation,111CHAPTER 7. APPLICATIONSFigure 7.4: Control response of the spent electrolyte acid concentration in the simu-lated cell house under open loop, PID, and Track+FF Control given 5% changesto cZnZPS), I, and V˙ (SE)water is added in small amounts primarily for house keeping. From industrial data, thispure water addition is approximately one to two percent of the incoming ZPS volumetricflow. This will indirectly affect the water balance in the cell house. To stabilize the acidconcentration in the SE, particularly in conjunction with the feed forward controller, con-trollers were added to the V˙ (W ). It must be noted that this may be an unrepresentativemethod as water additions to the cell house are typically done by operators for specifictasks such as washing cathodes, cooling a single cell that is running hot, or for cell housecleaning. However, as these additions are tracked, a controller could offer insight to theamount of water that is required to be added in a day to aid in maintaining acid concentra-tions. The first controller examined was a PID controller applied to the water flow. As seenin figure 7.4, the acid concentration was closer to the set point overall. Nevertheless, there112CHAPTER 7. APPLICATIONSFigure 7.5: Control response of the spent electrolyte temperature in the simulatedcell house under open loop, PID, and Track +FF Control given 5% changesto cZnZPS), I, and V˙ (SE)were still large deviations. No observable effect was seen on the zinc concentration. Dueto the low flow of added water in comparison to other flows, the integral reset time wasvery large. Indeed as seen during the +5% of cZn(ZPS), the acid set point was not reached.To account for this, the integral reset time was decreased to 10% and controller gain wasincreased to 10 times their tuned value creating an Undertuned (U) controller. This createdan undertuned (Track+FF+U) controller and the resulting acid concentration was closest tothe set point of the four schemes investigated as seen in table 7.2.Control During Large Current ChangesInfrequently, the current to a cell house may be reduced by amounts larger than the 5%as seen in figures 7.3, 7.4 and 7.5 or shut off entirely for cleaning or maintenance. Using113CHAPTER 7. APPLICATIONSa PID controller alone for V˙ (ZPS) may not be suitable in this situation due to the largeeffect the electric current has on the rate of aqueous zinc consumption. A large decreasein current can result in a rapid increase in the zinc concentration as seen in figure 7.6. Tobetter control for this, a PID Track controller was used. This controller set an output for theflow based on the ratio of the controller output and current applied to the cell house. ThePID Track controller was tuned using CADSIM Plus autotuning algorithm with the ratio ofPID output and electric current giving the controller output. This allowed the V˙ (ZPS) todrop quickly along with the current when the current was rapidly decreased. As seen infigures 7.6 and 7.7, the PID+Track controller was more capable than the PID controller ofmaintaining the set point zinc and acid concentrations through manipulation of V˙ (ZPS). Itmust be noted that the simulation assumes the anode and cathode do not interact with theelectrolyte during current shut downs or reductions. The effects of zinc dissolving backin to solution from the cathode or reduced corrosion resistance of the lead anodes duringthese events are not taken in to account by the simulation.7.1.1 Set Point Tracking PerformanceThe controller combinations detailed previously were also tested for set point tracking per-formance. Changes of ± 10% to the set points of spent electrolyte zinc concentration, acidconcentration, temperature, and combinations of each were examined. The response of thescaled acid concentration in the spent electrolyte is shown in figure 7.8. The faster tunedV˙ (Water) controller allowed the process to reach the set point faster than the PID controllerstuned in CADSIM Plus, however it did add volatility in the case of changes in the cAcid(SE)only. The IAE of the set point tracking was calculated using equation 7.1 and the resultsare presented in table 7.3. The integral error was reduced with each controlling strategywith the greatest improvement seen with the Track + FF combination. The temperaturecontrol did not achieve significant improvement due to the limitations of the fan which hada maximum mass flow rate of 150 kg s−1. Typically, if more cooling was required another114CHAPTER 7. APPLICATIONSFigure 7.6: Scaled zinc concentration response to very large current changes (50%reduction and 100% reduction). The track controller sets its output value basedon a ratio of the flow and current applied to the cell house. During times whencurrent is shut off, it is assumed the electrolyte is stored and does not interactwith cathodes or anodescooling tower would be put online to compliment the three in service. The control of zincconcentration in the spent electrolyte did not show a great deal of improvement betweenthe PID and Track + FF schemes. This was due to the variations introduced to the zinc con-centration with the undertuned water controller creating changes in the zinc concentrationwhen the acid set point changed. A deficiency with this outlined control scheme is the longsettling time required to reach a steady state. In practice a settling time of five days maybe impractical for implementation. A faster transient may be achieved, but it may come atthe cost of reduced stability. Under manual control, the process is always hunting to reachthe desired set points and this control scheme may increase in the stability of the controlled115CHAPTER 7. APPLICATIONSFigure 7.7: Scaled acid concentration response to very large current changes (50%reduction and 100% reduction). The track controller sets its output value basedon a ratio of the flow and current applied to the cell house. During times whencurrent is shut off, it is assumed the electrolyte is stored and does not interactwith cathodes or anodevariables. Further investigation of a MIMO controller may be beneficial in reducing thesettling time.Table 7.3: Integral of the absolute error of spent electrolyte zinc concentration(cZn(SE)), spent electrolyte acid concentration (cAcid(SE)), and spent electrolytetemperature (T (SE)) during set point changes using different control schemesIAE: cZn(SE) IAE: cAcid(SE) IAE: T (SE)Open Loop 55 185 35PID 28.2 74.8 25.2Track + FF 28 73.6 25.4Track + FF + U 26.9 13.9 25.4116CHAPTER 7. APPLICATIONSFigure 7.8: Comparison of PID and Track+FF+U on the acid concentration in the spentelectrolyte in maintaining a desired acid set point7.1.2 Optimizing ProductionCell house production can be increased most directly through raises in the current. How-ever, this method is limited by supply of ZPS, cooling capacity of the towers, and potentialproblems in the cathode product morphology. The production can also be increased throughincreases in current efficiency achieved by changing the electrolyte solution concentrationand temperature. These changes can be implemented as set points to the simulation. Anoptimizer was set up within the simulation software to determine the optimal concentra-tions of zinc and acid as well as the temperature. An outline of the control hierarchy ispresented in figure 7.9. The optimized function was simply the maximization of the zincproduction in a single simulated electrowinning cell. The optimization function may alsobe chosen to reflect the energy consumption or current efficiency, however this informa-117CHAPTER 7. APPLICATIONSOPTIMIZATIONMaximize Cathodic Zinc ProductionSTABILIZING CONTROLSISO Control Strategy , PID controllersINSTRUMENTATIONConcentration Assays , Control Valves, Flow Rates , TemperatureZINC CELL HOUSEIndustrial Zinc ElectrowinningSet points for the zinc concentration, acid concentration, and temperatureSet points for the flow ratesFigure 7.9: Block diagram of the control hierarchy for the zinc cell house. The opti-mization provides the supervisory SISO control block with set points. The in-strumentation controlling the cell house is set by the supervisory control block.Reported results from the instrumentation block are fed back up to the supervi-sory layer.tion is not reported here. It must be noted that the optimized values presented here onlyreflect the simulated cell house. The set points determined by it may interact poorly withthe zinc production circuit as a whole, particularly with concern to the returned acid, usedin the leaching circuit. For this reason, the limits of the spent electrolyte zinc, acid andtemperature were chosen to be 45-60 g L−1, 160-200 g L−1, and 30-40 ◦C respectively.These limits were selected based on typical data ranges for these variables taken from theexamined electrowinning cell house (A).118CHAPTER 7. APPLICATIONSTo investigate the effectiveness of using different control schemes along with the op-timizer, a month of historical tankhouse data (cZn(ZPS) and (I)) was used. For any givenchange in the current, the optimizer determined the optimal spent electrolyte conditions andthese values were fed in to the tank house simulation as set points for the controllers. If achange in current was recorded, the optimizer would run again at the new current to providenew set points. For most operational currents, the optimizer would solve to the limits of 60g L−1, 160 g L−1 and 30 ◦C for the zinc concentration, acid concentration and temperaturerespectively. It was assumed there was an unlimited supply of ZPS and water which couldbe added to the cell house which may not be the case in actual operation. During the sim-ulation runs, there were no unreasonably high flow rates set by the simulation controllersthat would suggest this was an unreasonable assumption. It was also assumed there wereno losses in cathode production due to unharvestable cathodes or electrical shorts in thesystem.The data set used is presented in figure 7.10 C. The effects of the PID and Track+FF+Ucontrol strategies on the zinc and acid concentration in the simulated cell house are pre-sented in figures 7.10 A and 7.10 B. Table 7.4 lists the Absolute Average Error (AAE)in maintaining the zinc and acid set points as well as the simulated change in productionfrom the manual control case. The absolute average error was calculated using equation7.2 where c( j) is the simulated concentration at sampling time j, c(SP) is the set pointconcentration, and N is the number of sampling times. In the manual control case the setpoint was determined based on a rolling two-day average of concentration values at eachtime point, or otherwise taken from the optimizer. The base level of zinc production overthis time period was taken from the manual control case as calculated by the simulation.In general, the feed forward control reduced the variation in the zinc and acid concentra-tions to a greater degree than the Track controller alone did. However the result with theleast variation was the Track+FF+U controller. The control strategies lessened the amountof variation in the predicted concentration, particularly during periods of stable current as119CHAPTER 7. APPLICATIONScompared to the historical plant data as seen in figures 7.10 A and B. The large currentupset was best handled by the Track controller, however there was still a 10 g L−1 changein the zinc concentration which is undesirable. During this type of event it may be requiredto manually stop the flow of ZPS, as is typical practice in cell houses currently. Overall,these results may have value in reducing the amount of variation in acid concentration thatis present in the spent electrolyte allowing for more consistent operation in the cell house.Furthermore, stable concentrations in the returned electrolyte may allow for more con-sistency in the leaching operation. Finally, the Track+FF+U control strategy provided thelargest change in predicted production, primarily through increasing the current efficiencyand stabilizing concentrations and temperatures in the SE.AAE =N∑j|c( j)− c(SP)( j)|/N (7.2)Table 7.4: Comparison of control strategies in optimizing zinc production and thevariation in the zinc and acid concentrations of the spent electrolyteControl Absolute Error cZn(SE) Absolute Error cAcid(SE) Production ChangeManual 1.41 2.24 0.00%PID 5.05 5.86 2.43%PID+FF 1.6 0.75 2.44%Track 4.94 6.04 2.74%Track+FF 0.81 1.09 4.33%Based on these results, there are potential benefits to applying a control scheme to azinc cell house in order to improve overall production. While the optimization can improveselection of target set points, the greater benefit may be the more rapid return to steady stateunder process control after an external event such as a current shut down or changes in theZPS concentration. Further development of MIMO control schemes could further benefitcell houses in this regard as well.120CHAPTER 7. APPLICATIONSFigure 7.10: Comparison of PID and Track+FF+U on the acid concentration in thespent electrolyte in maintaining a desired acid set point121CHAPTER 7. APPLICATIONS7.1.3 SummaryProcess control in a zinc electrowinning cell house may have benefits in increasing produc-tion and maintaining stable electrolyte concentrations. A dynamic process simulation of azinc electrowinning cell house was used as a representative for an industrial cell house inorder to investigate potential benefits. The impact of the flow rates of zinc purified solution,water, and cooling tower air were used as manipulated variables and the effect of each wasexamined on the spent electrolyte zinc concentration, acid concentration, and temperatureas controlled variables. Various SISO control schemes were examined and it was found thatthe increased control in stability lead to decreases in spent electrolyte variation as comparedto the manual control case alone. Finally the production was found to increase 4.3% witha track controller, feed forward controller, and an undertuned water addition controller dueto an optimization of the current efficiency and maintenance of these optimal conditions.7.2 Manganese in Zinc ElectrowinningThe simulation can be used to track the movement and concentration of species other thanzinc and acid through the cell house as well. This can provide a method of predictingif the concentrations of species of interest (such as manganese) may become too low ortoo high. Based on operator feedback, running out of manganese in a cell house circuithas been the cause of cell house shut downs in the past and is an expensive upset to theprocess. Conversely, too much Mn in the electrolyte can cause operational problems suchas excessive mud generation.For these beneficial and detrimental effects the generation of cell mud and anode scalerequires a balance which is a complex task. With competing factors affecting the con-sumption of Mn2+ in a cell house, controlling a constant concentration of Mn2+ in order tomaintain the MnO2 coating is difficult. The concentration of Mn in the purified feed mustbe kept at such a level that the concentration of Mn in the highly recirculated cell house122CHAPTER 7. APPLICATIONSelectrolyte remains at the desired target. The rate of Mn consumption of a cell house iscomplex to calculate as the conditions are difficult to replicate in a laboratory when con-ducting conventional rate tests. Conversely, calculating the rate direct from cell house datawill also carry errors. This is due to variable input of new feed electrolyte with changingMn concentration that is recirculated through the cell house. Thus, determining a consis-tent basis for the calculation is difficult. A process simulation is one method of predictingthe consumption of Mn in a cell house as it can replicate the conditions in the cell houseand apply mathematical algorithms for appropriate Mn consumption rates. For this rea-son the following work focuses on developing a process simulation capable of providingpredictions of Mn consumption during zinc electrowinning.7.2.1 Simulation SetupThe framework of the simulation uses the time based process simulation developed previ-ously in Chapter 5 as cell house B. The simulated cell house uses a conventional circulatingelectrolyte flow, with a feed of purified solution to maintain the zinc concentration. A frac-tion of the electrolyte flows out of the house for use in other processes such as leaching. Theanodes used were typical industrial PbAg anodes that were first rolled, then sandblasted.Current was supplied by dedicated rectifiers for each cell house and the applied current wassampled every hour. Flow of zinc purified solution was set by a ratio controller providingpurified electrolyte based on the ratio of applied current to typical applied current. As areliable flow meter reading was unavailable, the controller set the purified electrolyte flowin order to give a concentration of zinc in the spent electrolyte equal to the assay of the zincconcentration taken from the industrial facility. The zinc concentration in the spent elec-trolyte was collected every four hours. To validate the simulation, the simulated and actualzinc concentrations in the cooled electrolyte were compared. This resulted in reasonableagreement. The zinc cathode values produced were compared with refinery measurements,and again the values were in agreement. The validation of the zinc balance gave confi-123CHAPTER 7. APPLICATIONSdence that the simulation was properly predicting solution flows, and would be capable ofperforming a meaningful manganese balance.The purified electrolyte flow was set by a PID Track controller as seen in equation 7.3.This controller set the controlled flow rate of ZPS (F(ZPS)C) based on the ratio of appliedcell house current (ICH) divided by the current (IN) (current during normal operation) mul-tiplied by the Normal ZPS flow F(ZPS)N (zinc purified electrolyte flow rate during normaloperation) as outlined in equation 7.3. This controller allowed the simulation to respondmuch faster in matching the returned electrolyte concentrations. The acid concentrationwas used to predict how much wash water was added to the cell house as this was nototherwise recorded. Water was added in a similar way, with an undertuned PID track con-troller, to match the concentration of acid through dilution. In figure 7.11, the concentrationof acid and zinc in the solution exiting the cell house for use in leaching is presented. Themeasured and predicted values of the zinc concentration are consistent over time. The acidconcentrations have a greater variation, however they are relatively consistent as well. Vari-ations may have been caused by the addition of process water for cell cooling or errors inmeasurement. However, these value are generally in agreement with each other and the va-lidity of the water balance is further strengthened. The water balance is required to ensurethe concentrations of Mn are accurately represented in the simulation.F(ZPS)C = F(ZPS)NICHIN(7.3)7.2.2 Manganese Simulation DevelopmentThe overall chemical equation for the deposition of MnO2 is seen in equation 7.4. However,it is unlikely that this reaction occurs in a single step given the change in oxidation state ofthe Mn and exchange of multiple electrons [127].Mn2++2H2O−−→MnO2+4H++2e− (7.4)124CHAPTER 7. APPLICATIONSFigure 7.11: Comparison of the simulations prediction and the measured concentra-tion of zinc and sulfuric acid in the electrolyte exiting the cell house over timeDue to the complex nature of Mn, many pathways have been suggested for manganesereactions and the formation of MnO2 in typical zinc electrowinning conditions. Fourvalances of manganese are typical in electrowinning conditions: Mn2+, Mn3+, Mn4+, andMn7+, with Mn4+ and Mn7+ typically present exclusively as MnO2 and MnO4– respec-tively. Manganese is thermodynamically stable as Mn2+ in the acidities common with zincelectrowinning. Mn3+ has a pink colour which is characteristic of zinc electrowinningelectrolytes. Because of the high acidity in the electrolyte, the Mn3+ formed in the zincelectrolyte is known to persist for long periods of time despite its thermodynamic instabil-ity. Thus, the manganic ions are typically present in low concentrations [128]. In laboratorytests, the purple colour characteristic of permanganate ions has been observed close to theanode. The potential of the anode during zinc electrowinning is large enough to generatepermanganate ions, but likely reacts quickly near the anode and thus is not observed in the125CHAPTER 7. APPLICATIONSbulk solution [36,129]. MnO4– has been reported to be present in regions between the leadanode and MnO2 anode scale [37], however the full role of permanganate in the formationof the MnO2 layer remains unclear. It has been suggested that permanganate will reactwith Mn2+ to form MnO2 or Mn3+ ions (equations 7.5 and 7.6 respectively). Reaction 7.6is accomplished through reaction 7.7 followed by 7.8 with 7.7 being the rate limiting step.The rate of reaction 7.6 has been reported as equation 7.9 with kMn,0 = 100 M−2 s−1; kMn,1= 19 M−3 s−1; and kMn,2 = 63 M−4 s−1 and the concentrations in mol L−1 [130].2MnO4−+3Mn2++2H2O−−→ 5MnO2+4H+ (7.5)MnO4−+4Mn2++8H+ −−→ 5Mn3++4H2O (7.6)MnO4−+2Mn2+ −−→ 2MnO2+Mn3+ (7.7)4H++MnO2+Mn2+ −−→ 2Mn3++2H2O (7.8)−d[MnO4−]dt=15d[Mn3+]dt=(kMn,0+ kMn,1[H+]+ kMn,2[H+]2)[MnO4−][Mn3+]2(7.9)The formation of MnO2 is accelerated in the presence of new anodes and after a periodof time the deposition stabilizes [25]. Evidence of permanganate at the surface of the anodesuggests other possible routes for MnO2 deposition. In particular, the deposition does notdepend solely on an electrochemical reaction as evidence exists that MnO2 deposits onsurfaces that are not otherwise conductive. This was noted in cases where the anode wasnew, and did not have a mature coating of MnO2 on it [25]. This leads to several posited126CHAPTER 7. APPLICATIONSdeposition mechanisms for MnO2.A diffusion controlled Electrochemical Chemical Electrochemical (ECE) mechanismfor the deposition of MnO2 has been proposed (equations 7.10, 7.11 and 7.12). Mn3+present in solution deposits initially as a hydroxide with a further electrochemical oxidationto form the MnO2. This mechanism was suggested based on observations of deposition ona Pt anode and at anodic voltages lower than those required to produce permanganate.The formation of adsorbed MnOOH (equation 7.11) has a reported equilibrium constant of1.8 [36].Mn2+ −−→Mn3++ e− (7.10)Mn3++2H2O−−→MnOOH+3H+ (7.11)MnOOH−−→MnO2+H++ e− (7.12)Typically the anodic voltage of the PbAg anodes used in electrowinning is greater than1.9 VSHE , that is, higher than the reversible potential required to generate MnO4– [36]. Atthese higher potentials on Pt anodes, MnO4– was observed to form and a mechanism wasposited for the deposition of MnO2 as seen in equations 7.13, 7.14 and 7.15.Mn2++4H2O−−→MnO4−+8H++5e− (7.13)2MnO4−+3Mn2++16H+ −−→ 5Mn4++8H2O (7.14)Mn4++2H2O−−→MnO2+4H+ (7.15)127CHAPTER 7. APPLICATIONSThe type of anode will affect its electrochemical performance. Conventional PbAganodes used in electrowinning consist of a PbO2 coating with a layer of MnO2 deposited ontop. The MnO2 layer is typically non-coherent with cracks and blisters exposing the PbO2beneath. Based on observations of MnO2 deposition on these surfaces, further mechanismshave been proposed. Kelsall et al. suggested the following mechanism on a PbO2 anode at500 A m−2 (equations 7.13, 7.16 and 7.17) [26].MnO4−+4Mn2++12H+ −−→ 5Mn3++4H2O (7.16)2Mn3++2H2O−−→MnO2+Mn2++6H+ (7.17)Along with deposition on the anode, MnO2 can precipitate from solution as well.MnOOH is thought to be a precursor to ε-MnO2 which will precipitate in the cell mud,while the disproportionation of Mn3+ results in the creation of the γ-MnO2 found on thescale on the anodes in the case of PbCaSn anodes [129, 131]. The disproportionation re-action has been reported with an equilibrium constant of 10−3 in high molar (4M) sulfuricacid solutions [132]. When a new anode is placed in to a cell, a large amount of MnO2 mudis generated. After a time period of approximately a month, the volume of mud generatedis greatly reduced and a mature, coherent coating of MnO2 is established [133]. Anodeswith a mature coating of MnO2 are typical in normal operation of the cell house. Over thecourse of operation, the MnO2 coating thickens on the anode, growing on the establisheddense coherent MnO2 layer. Anodes are cleaned periodically (every one to three monthsdepending on operational preferences) using pressurized water or mechanical brushes [6].The cleaning is done to remove the surface layer of deposited MnO2, preventing it fromreaching the cathode and causing a short. The initial dense layer of MnO2 is left on theanode in order to prevent excessive MnO2 formation observed with the initial clean sur-face. This suggests that MnO2 formation (and associated Mn ion consumption) is usually128CHAPTER 7. APPLICATIONSdone on an established layer of MnO2. Clarke et al. conducted an investigation of theelectrodeposition of MnO2 on a MnO2 substrate with a ring disc electrode over a range oftemperatures, pHs, and concentrations [128]. At concentrations greater than 1 M H2SO4and 40 ◦C, γ-MnO2 was formed under activation controlled conditions. The authors pro-posed a mechanism relying on the disproportionation mechanism as previously described,with equation 7.17 being the rate limiting, activation controlled step.In order to predict the consumption of Mn, an expression is needed. However, as thepreceding discussion has shown, the deposition of MnO2 is complex, and it is difficult tofully replicate an industrial cell in the lab. Instead, using industrial data in conjunctionwith a representative process simulation, the deposition can be investigated in a new way.Specifically, the consumption of Mn ions can be tracked and compared against processevents to determine the influence they have. Results can be compared against previouslyreported experimental values of Mn2+ consumption from both lab and industrial data.The rate of Mn consumption has been reported previously, however the conditions wereeither specific to a single cell house at a set static value, or were meant for applicationswhere the production of MnO2 was desired rather than a side effect. Rodrigues and Meyerreported a Mn consumption rate of 65 g m−2 day−1 for the Zincor cell house PbCaSnanodes [25]. This cell house typically had a concentration range of 7 to 13 g L−1 Mnwith an average operating current density of 660 A m−2. Ault and Bratt designed a cellmeant to lower the concentration of Mn in a zinc electrolyte through oxidation [134]. Theydetermined a relation through regression analysis for use in predicting the current efficiencyof MnO2 deposition on a Pb−0.75%Ag anode (equation 7.18). Where i is the currentdensity (A m−2), concentrations are in g L−1, T is the temperature (K), tA,Cleaning is dayssince cleaning the anode, and tA,Service is days since the anode was first used. The datarange included the conditions normally encountered for zinc electrowinning however theirconcentration of Mn was typically higher than 5 g L−1. They determined that Mn wasremoved optimally at lower acidities and from new anodes without a developed MnO2129CHAPTER 7. APPLICATIONScoating. Finally, Clarke et al. developed an expression (equation 7.19) for the currentdensity of MnO2 deposition on MnO2 substrates where ∆GMn = 28-35 kJ mol−1 and kMn= 5.59 [128]. This rate was determined using rotating disk electrode and rotating ring-disk electrode techniques. These expressions give possible rates that may be applied to anoperating cell house. Reported rates of reaction and the typical resulting rates applied tothe simulation have been summarized in table 7.5, however the rates in the simulation werevariable based on the equations presented.log(ε(MnO2)) =−30.1−0.64log(i)+0.28log([Mn2+])−0.36log([H2SO4])+13.6log(T )−0.13log(tA,Cleaning)−0.27log(A) (7.18)ln(iMn) = kMn− ∆GMnRT (7.19)Table 7.5: Summary of various rates of reaction for the deposition of MnO2 in zincelectrowinning conditions reported in literatureEquation MnO2 Current Efficiency (%) Consumption Rate (mol m−2 s−1) Reference- 0.4 1.37x10-5 [25, 133]7.18 3.45 7.87x10-5 [134]7.19 1.05 2.40x10-5 [128]To compare the applicability of these rates to an industrial cell house, months of processdata from the operating cell house were used. The temperature and concentration of speciesof the purified electrolyte were input in to the simulation along with the current densityapplied to the cells and the return electrolyte zinc and acid concentrations. The returnelectrolyte zinc concentration was used to control the flow rate of the purified electrolyteentering the cell house as there was not a calibrated functioning flow meter over this timeperiod.130CHAPTER 7. APPLICATIONSFigure 7.12: Manganese concentrations in a cell block where no manganese is react-ing to form MnO27.2.3 Results and DiscussionUsing the industrial data as described, a comparison of the Mn concentration was examinedin the case where Mn was not reacting at all. This allowed the Mn concentration to varybased on incoming concentrations of purified feed and the flow of solution through the cellhouse. The results of the Mn balance can be seen in figure 7.12. In general the predictedspent Mn concentration mirrored the ZPS Mn concentration. The flow of purified feed wasapproximately 180 m3 h−1 and the sum of all operational volumes of cells and tanks wasapproximately 5000 m3 giving a retention time for the entire cell house of approximately28 hours. The values of Mn were collected every 24 hours, and thus similarity betweenthe two was expected. Notably when the purified feed Mn concentration was changedsignificantly, for example day see 4 in figure 7.12, the system does not have enough timefor the concentrations to match. As well, during longer periods where the purified [Mn] isconstant, for example see day 9 to day 18, the predicted [Mn] is slightly above the purified[Mn]. This was due to water loss from evaporation in the cooling towers which caused theexiting returned acid flow rate to be less than the incoming purified feed flow rate.131CHAPTER 7. APPLICATIONSSummarized in table 7.5, different rate relations have been suggested for MnO2 de-position in conditions relevant to zinc electrowinning. In figures 7.13 and 7.14, the ratesare compared against the industrial data over an initial time period with a relatively con-stant manganese concentration, and over a second time period with an altered manganeseconcentration. This took place in two cell blocks being fed the same purified electrolyte,however with separate recirculating electrolytes isolated to either cell block. In all cases,the rate was overestimated; the predicted manganese concentrations were below the mea-sured values. In figure 7.14, the concentration of Mn in the purified feed is increased. Thepredictions of spent [Mn] from the rates remain consistently below the expected values,however we note that the measured spent [Mn] does not exhibit the same discrepancy overthe entire time period. At higher [Mn] the separation between the purified and spent valuesappears to decrease.The rate producing the closest result was that reported by Rodrigues and Meyer whichwas developed based on an overall manganese balance for the Zincor cell house [25]. Thedifference between the measured and predicted values for this rate may have been a resultof the higher current densities, the higher manganese concentrations, or a combination ofthe two. The other models did not produce suitable results, and reflect the difficulty in repli-cating MnO2 deposition in the specific conditions of zinc electrowinning. Ault and Bratt’srate for MnO2 deposition was based on a cell specifically designed to maximize Mn2+ re-moval from the electrolyte [134]. While typical electrowinning conditions were includedin the regression, these were extreme values compared with the other experimental pointsused to generate the regression analysis. This may account for the large deviation from thisrate. Finally, the rate determined by Clarke et al. was determined using a laboratory celldesigned to examine the reaction mechanism of MnO2 on a MnO2 substrate [128]. Thisidealized system may have contributed to the difference between the actual and predictedresults in figures 7.13 and 7.14.It was unclear if an applied current was necessary for the deposition of MnO2, or if132CHAPTER 7. APPLICATIONSFigure 7.13: Comparison of reported Mn deposition rates as listed in Table 7.5 in twocell banks (A and B) over 40 days of stable purified feed manganese concen-tration133CHAPTER 7. APPLICATIONSFigure 7.14: Comparison of reported Mn deposition rates as listed in Table 7.5 intwo cell banks (A and B) over 60 days of variable purified feed manganeseconcentration134CHAPTER 7. APPLICATIONSFigure 7.15: Comparison of Mn consumption during a period where the cell housewas fully turned off for four daysthe resident manganic ions would continue to disproportionate. The effect of a full fourday shut down in cell block A is seen in figure 7.15. During this time, no current was ap-plied to the cell block, the electrolyte was stored outside of the cells to prevent degradationof the anodes, zinc purified solution was no longer flowing in and no electrolyte exited.The measured spent electrolyte concentration did not change during this shut down. If theMnO2 continued to deposit at a comparable rate (8.0×10−6 mol m−2 s−1) over this fourday shut down (presuming enough Mn3+ was available to sustain this), we would expect theMn concentration to diminish to approximately 1.0 g L−1. However, the measured valuesremained at approximately 3.9± 0.15 g L−1 through the shut down. The Mn concentrationrecovered to its initial level quickly as the purified feed flowed in to the cells again. Thisindicates that deposition of MnO2 requires current actively being applied, and this is con-135CHAPTER 7. APPLICATIONSsistent with findings of other authors where Mn3+ is stable in solutions with high acid andthe solution retains its characteristic pink colour. This was also the case based on feedbackfrom the cell house.Based on these results a rate can be determined which will predict the Mn consump-tion in this cell house. Previous authors have established that MnO2 deposition on MnO2is activation controlled and not diffusion controlled at the temperature, acidities, and Mnconcentrations typical for zinc electrowinning [128]. For typical zinc electrowinning an-odes which have been aged in the cell house, a layer of MnO2 covering the Pb is common,even after cleaning. During cleaning, the objective is to leave a thin hard protective layer ofMnO2 on the anode so as to prevent exposure of the Pb surface directly to the electrolyte.Anodes newly introduced to service which lack an established MnO2 coating are known toproduce large volumes of cell mud before the hard thin coating of MnO2 has been estab-lished. Given that the operational anodes are in service for approximately three years andthe MnO2 coating takes a month to establish [25], we assume the overall rate is representa-tive of established anodes. New relations were introduced to the code of the simulation inorder to represent the oxidation of manganese. To determine the effect that the manganeseconcentration has on the rate, a single constant rate was established using the simulation.The rate was taken over two different time periods, where the concentration of Mn wasconstant at approximately 2 and 4 g L−1 respectively. The rates were determined through asimplex optimization algorithm which sought to minimize the difference between the pre-dicted and measured Mn concentrations with a least squares sum function. At an average[Mn] of 3.8 g L−1, the rate was 4.1×10−6 mol m−2 s−1, while at [Mn] of 2.0 g L−1, therate of consumption was 8.0×10−6 mol m−2 s−1. This difference is highlighted in figure7.16 where static rates of 8.0×10−6 mol m−2 s−1 and 4.1×10−6 mol m−2 s−1 were usedbefore and after the [Mn] was increased with the prediction deteriorating after this event.This higher rate of deposition associated with the lower concentration of manganese iscontrary to what would be typically expected based on the overall equation for the deposi-136CHAPTER 7. APPLICATIONSFigure 7.16: Comparison of predicted and measured values using two different con-stant Mn consumption rates over the course of an operational increase in man-ganese concentration in the cell housetion of MnO2. The current, temperature, and zinc and acid concentrations remained withinthe same target values. The decreased reaction rate may be due to an impurity, additive,errors in measurement, or an operational change in cell management. Examining these, thetemperature was largely consistent over this time period, staying at approximately 37 ◦C±2 ◦C with no noticeable long term trends. The acid concentration was consistent over thistime period as well, remaining approximately 170 g L−1. Based on consultation with theindustrial cell house, no changes to the anodes or the physical set up of the cells or flowswas made over this time period.Given the decrease in the consumption rate of Mn in the cells when the concentrationof Mn increased, a competing reaction may be responsible. The deposition of mud is nor-mally occurs through the disproportionation of manganic (equation 7.17, while the growthof the anode scale is through an ECE mechanism, requiring a final electron to convert ad-137CHAPTER 7. APPLICATIONSFigure 7.17: Purified and spent electrolyte concentrations of manganese comparedwith the ratio of manganese to chloride concentrations (in g L−1) in the spentelectrolytesorbed MnOOH on the surface of the anode to MnO2. Any supposition on the cause of thisdecrease would need further validation, however these results indicate Mn2+ is consumedat a higher rate at lower Mn2+ concentrations. No literature is available dealing with exper-imental determination of Mn on aged anodes, that is, those anodes which have had a hardadherent MnO2 coating formed on them. It is possible that with the higher concentrationof Mn2+, the disproportionation equilibrium is shifted in favour of maintaining Mn3+. Withthe formation rate of Mn3+ remaining relatively constant on the anode, the generation ofMnO2 would be hindered in comparison.Another possibility is an impurity affecting the consumption of Mn ions. Chlorine evo-lution is a common concern in cell houses because it is hazardous to operators and increasescorrosion to equipment. Mn aids in preventing excessive Cl2 evolution [6]. Examining theconcentration of Cl– in the spent electrolyte reveals no great change in its concentrationduring the increase of [Mn]. As well, the periods of greater MnO2 consumption do notappear to correspond with times of notably high or low chloride levels. However, the ratioof Mn to the Cl– concentration (in g L−1) does appear to influence the consumption of138CHAPTER 7. APPLICATIONSaqueous Mn. In figure 7.17, during times when this ratio is approximately eight or less,the consumption of Mn is greater (indicated by the decrease in difference between purifiedand spent manganese concentrations). This is a strong indication that Cl– has a role in theconsumption of MnO2 in zinc electrowinning cells.Mn2++ 12 Cl2 −−→Mn3++Cl− (7.20)Mn2++Cl2+2H2O−−→MnO2+4H++2Cl− (7.21)For chloride to consume Mn2+, it can first be oxidized to Cl2 which is possible at a typ-ical zinc electrowinning anodic potential. Following oxidation, reaction 7.20 or 7.21 cantake place. The formation of MnO2 directly from chlorine (reaction 7.21) is reported to bea kinetically slow reaction, and it is suspected that the formation of Mn3+ is more proba-ble [135]. With lower [Mn2+] to [Cl–] ratios, the formation of Mn3+ may be promoted. Anincrease in available Mn3+ in the bulk electrolyte would increase the rate of disproportion-ation (equation 7.17) and subsequent formation of MnO2 in the cell mud. The followingpathway is proposed. First, the deposition of MnO2 is controlled through the formation ofMn3+ by anodic reaction and generated through the scavenging of Mn2+ by Cl2. The Mn3+then deposits as anode scale at an activation controlled rate from the MnOOH precursor.Excess Mn3+ will disproportionate and form cell mud due to the equilibrium of equation7.17.7.2.4 SummaryThe consumption of manganese was analyzed in an industrial cell house using a dynamicprocess simulation. Previously determined relations and values for the current efficiency ofthe manganese deposition rate did not provide adequate predictions for this cell house en-vironment. The rate of consumption decreased with an increased manganese concentration139CHAPTER 7. APPLICATIONSin the electrolyte. The prediction of Mn concentrations in the cell house using a simulationhas potential applications in process control of Mn additions in the previous leaching stepsto maintain a desired concentration, and in reconciling the collection of process data toestimate errors in measurement. It was found that an applied current was required to de-posit MnO2 with the manganic being stable in the electrolyte. As well, the ratio of [Mn2+]to [Cl–] influenced the amount of aqueous manganese consumed, with ratios lower thaneight depositing a greater amount of MnO2. A simulation such as this has potential appli-cations in controlling Mn concentrations, and predicting the consumption rate of Mn in azinc electrowinning cell house.7.3 Cathode Data ReconciliationDuring zinc electrowinning, the current efficiency of zinc electrodeposition is a key oper-ating parameter. Zinc electrowinning consumes a large amount of electric power. It hasbeen estimated to be 80% of the total power cost of a zinc refinery and maintaining a highcurrent efficiency is desirable [69]. Further, low current efficiency decreases the produc-tion capacity of the cell house. Predicting current efficiency and, subsequently, cathodeproduction would be a valuable tool for operators and engineers. This is a complicatedtask as current efficiency is a result of many interconnected factors such as concentrations,temperature, current density, and electrode maintenance [6]. Previous models can predictthe current efficiency but these are limited in giving only a value for either a single point intime, or a general expected target current efficiency [3, 60, 62].Calculation of current efficiency is further complicated by the large amount of elec-trodes present in a modern electrowinning facility. One facility can contain thousands ofindividual cathodes, each with a unique deposition history depending on when that set ofcathodes was placed in the cell. To calculate the current efficiency, the mass of the de-posited zinc cathode is compared to the theoretical amount of zinc possible given the total140CHAPTER 7. APPLICATIONSelectric charge passed through the cathode. As there are many sets of cathodes, it becomescumbersome to track the history of current applied to each set without assistance from au-tomated sensors. Without such a system, a second approach is to compare the total massof produced zinc to the current applied over the history of deposition which will give anestimation of cell house current efficiency. This method requires taking the weekly or evenmonthly average of current efficiency since the daily produced cathode will depend highlyon pulling schedule and stripping capacity. In such a case, daily or even more frequentestimations of current efficiency would be beneficial in cell house control to identify poten-tial operational problems where deviations exist between observed and predicted cathodemasses and consequently current efficiency.The objective of this work was to utilize a time based computer simulation of zincelectrowinning in order to track expected zinc cathode masses and reconcile the currentefficiency to actual industrial operation data over multiple weeks. Validated Cell House Bfrom Chapter 5 was used to conduct this analysis. A validated simulation such as this iscapable of acting as a predictive tool for operators and engineers to track cathode massesand identifying whether a cathode mass was expected or not. This may aid in identifyingprocess problems earlier. General trends in current efficiency could be quickly estimatedas well.7.3.1 Reconciled Cathode ProductionThe simulation was then used to predict the current efficiency by subtracting a static offsetvalue from the ideal values calculated by the simulation. In order to determine the idealoffset a simplex optimization algorithm developed by Laperriere and Wasik was used tosearch for a minimum in equation 7.22 [118]. The objective function was defined using thecumulative values because it punished long term deviations more harshly.141CHAPTER 7. APPLICATIONSN∑j|(εMeasured− εPredicted)2 (7.22)After running the optimization three times, the optimized value of this offset consis-tently resulted in a negative current efficiency of 4.88% less than the modules prediction ofcurrent efficiency. Figure 7.18 shows the simulation’s weekly predicted current efficienciescompared to the weekly rolling four month average of calculated current efficiency. Thevalues were found to be within 0.52% of each other. The simulation gives an immediateestimation of the current efficiency for the day or week which would not otherwise be avail-able to operators and engineers. The predicted current efficiency does not match the currentefficiency exactly, and in particular, the two values appear to move independently of oneanother around an average current efficiency of 87.5%. This indicates the simulation isnot sensitive to factors which affect the current efficiency. Further work is needed to allowthe simulation to accurately predict these values. However, as the current efficiency valuesare similar, the overall zinc balance and resulting production of cathodic zinc will not begreatly affected.Using the simulation, the produced values of zinc and consequent current efficienciescan be calculated. Drops in produced zinc are observed during temporary decreases incurrent to the cell houses, or during shut downs. Shut downs are needed occasionally toservice and clean the cell house, however other cell houses may continue to operate. Thesimulation can give information to operators in predicting daily zinc production for all ofthe cell houses, and in the absence of a scale give a value of daily production. The currentefficiency predicted by the simulation does not show a large amount of variation, howeverit does decrease during periods when the produced zinc decreases (as a result of reducedcurrent). The exact cause of these decreases requires further investigation. Nevertheless,the simulation offers a tool for engineers and operators to gather immediate predictions ofthe cathode production and current efficiency of the plant. This will aid in control of thecell house by allowing quick identification of deviations from normal operation parameters.142CHAPTER 7. APPLICATIONSFigure 7.18: Comparison of predicted and plant calculated current efficiencies over30 weeks. Current efficiency is normalized against a baseline value to showthe variation over time. Plant calculations of current efficiencies are four weekaverages of current efficiency. The average error was 0.52% between currentefficiency values over this time period7.3.2 SummaryThe simulation has been validated with the industrial cell house data. The cathode massesproduced appear to match well in the simulation and actual plant-collected data with anaverage error in current efficiency of 0.52% The concentration of zinc can be predictedthroughout the plant. Potentially, this simulation could be used to identify erroneous mea-surements in flow or concentration and predict expected daily zinc production. As well,based on the flows predicted by the simulation of the purified electrolyte, it may be possi-ble to better control the cell house input in order to have more steady and consistent zincconcentrations in the cell house.143CHAPTER 7. APPLICATIONSFigure 7.19: Comparison of predicted and plant zinc cathode masses over 55 days144CHAPTER 7. APPLICATIONS7.4 Seasonal Effects on Water EvaporationUsing the cooling tower module developed in Chapter 4 the evaporation of water in the cellhouse can be predicted. Water evaporation through the cooling towers is a concern due tothe effect it has on the water balance. In summer months when the ambient temperature ishigh, cell house operators note the difficulty of cooling the electrolyte enough to maintainthe temperature set points of the cell house. Further, as the cell house cooling towers arenot able to evaporate as much water as in cooler months, the cell house is not able removeas much water from the zinc circuit as a net evaporator. If the ambient temperature and hu-midity is high enough that the cooling towers cannot achieve the required cooling, the cellhouse will have to run at reduced current or in extreme cases shut down entirely. Predictionof the water removal capacity of the cooling towers through seasonal changes can be usefulwhen designing the cell house to ensure enough cooling capacity is available, or in dailyoperations to predict the amount of water that the cell house can reliably evaporate.The water addition required to maintain the acid concentration is shown in figures 7.20and 7.21 over a week during the winter and a week during the summer. The temperature andhumidity data was collected from an Environment Canada weather station approximatelytwo kilometers from the operating cell house. The atmospheric data fed to the cell housecontained hourly data for temperature, pressure and relative humdity. This allowed a fullpsychrometric description of the ambient air to be obtained, particularly the humidity ratio.The water addition was followed rather than the amount of evaporation in the towers toallow comparisons of the amount of fresh wash water that is required in order to maintainthe acid balance.During the winter week, the relative humidity was high, however this was at low am-bient temperatures where the water vapour saturation limit was low. As the air was heatedbefore entering the cooling towers, the same was done to the simulated air and it was as-sumed this process added no water vapour to the air. After heating the air to 10 ◦C, therelative humidity was typically 10-15%. In general, the amount of water added during the145CHAPTER 7. APPLICATIONSFigure 7.20: Comparison of predicted water addition to the cell house with ambienthumidity during a week in winter and a week in summer146CHAPTER 7. APPLICATIONSFigure 7.21: Comparison of predicted water addition to the cell house with ambientair temperature during a week in winter and a week in summer147CHAPTER 7. APPLICATIONSwinter week to maintain the acid concentration was higher than what was added in the sum-mer week. This is consistent with operators’ experiences noting there is much less capacityfor water additions during warmer summer months than in the winter. The water additionsshow some inverse correlation with the summer air temperature, however this effect issmall. Overall the simulated water additions were relatively static due to the PID controlleron the water flow. In actual plant operation the water additions would be more intermittentwhich is not reflected in figures 7.20 and 7.21. However this information may aid operatorsand engineers in monitoring the water balance in the cell house through monitoring howmuch water can reasonably enter the cell house or the zinc circuit in general.In figures 7.22 and 7.23 the amount of heat that is rejected from the circulating elec-trolyte solution is recorded in a summer and a winter week and compared to the humidityand air temperature. During the winter week the cooling towers are capable of rejectingmore energy more consistently than in the summer week. This consistency is attributableto the requirement to heat the air before it enters the cooling towers. In this cell house theair is first heated before entering the cell house. The air is then pulled through the cellhouseby the cooling tower fans, ventilating the cell house to reduce the acid mist. The humidityratio during cold winter months is typically very low, however once heated, the air has ahigher capacity for evaporated water. This aids in heat rejection by allowing more heat lostto latent heat of water evaporation. Further, the consistency of heat rejection is attributableto the heating of the cold air, giving an air input to the cooling towers which is at a steadytemperature and low relative humidity.Notably, the heat rejection in the summer seen in figure 7.23 is lower during days ofthe week when the average temperature was higher such as around day one and two. Thehumidity had less of a direct effect on the heat rejection in both summer and winter. Thevariations in relative humidity during the summer are the result of the temperature decreaseduring the night, as the amount of water in the air will be the same but the saturation limitwill change with temperature. However as the air enters the cooling tower and warms up148CHAPTER 7. APPLICATIONSFigure 7.22: Comparison of predicted heat rejection in a cooling tower with ambienthumidity during a week in winter and a week in summer149CHAPTER 7. APPLICATIONSFigure 7.23: Comparison of predicted heat rejection in a cooling tower with ambientair temperature during a week in winter and a week in summer150CHAPTER 7. APPLICATIONSover the spray zone, the air is more capable of evaporating water. This leads to greater heatrejection in the night overall, largely driven by the cooler temperature.7.4.1 SummaryThe cell house model including hourly variations in ambient air conditions was capable ofpredicting the heat rejection and water evaporation from the cell house. This type of analy-sis is beneficial in predicting seasonal effects on cell house performance such as predictingif high cell house current densities would increase the electrolyte temperature beyond whatcould be reasonably cooled in the hotter summer months. Further, it could be used toestimate the capacity of the cell house to remove water from the system.151CHAPTER 8CONCLUSIONS AND RECOMMENDATIONS8.1 ConclusionsThis work developed and validated a dynamic process simulation of zinc electrowinningas a tool for engineers and operators. The model updated existing models of zinc elec-trowinning by incorporating estimations of electrolyte activity using Pitzer parameters, aswell as new empirical relations for solution conductivity, density, and viscosity. The effectof gas evolution on the conductivity of solution was also included. New kinetic constantswere determined using a range of zinc, acid, temperature and current densities in a singleelectrowinning cell. Further, the existing steady state models of zinc electrowinning weredeveloped in to dynamic, time dependent models so they could be applied to an operatingcell to track changes in the cell over time. A model of an evaporative counterflow coolingtower was also adapted from literature to predict the cooling and water loss in the recircu-lating electrolyte. These models were incorporated in to the commercial process simulationsoftware, CADSIM Plus.The simulation was first validated against reported data sets for a single electrowinningcell. It was then validated against data collected from four operating industrial facilities.This demonstrated the transferability of the model to multiple facilities. Validation wasconducted through monitoring the zinc, acid and temperature of cell house electrolytesover time, particularly through upsets in the applied current and zinc purified solution flow.The cell house model was capable of predicting the cathode mass produced over 100 days152CHAPTER 8. CONCLUSIONS AND RECOMMENDATIONSin a well run cell house, including disruptions in current, within 0.2%. The validated cellhouse models offered a method of examining the cell house in novel ways beyond what iscapable with a steady state simulation.Applications of this simulation tool were investigated including optimization, processcontrol, and impurity tracking. The benefits of optimizing a single electrowinning cellwere found to be different than in optimizing a full cell house due to the differences inthe constraint conditions. Notably, an operating cell house typically has a constant sulfateconcentration allowing only the zinc or acid concentration to vary. This largely affectsoptimization of energy consumption which must balance decreased current efficiency withincreased solution conductivity for lower zinc concentrations when the sulfate balance in-creased the acid concentration.The simulation was also used to investigate process control strategies. The dynamicsimulation was capable of predicting the potential benefit of applying various control schemesto a cell house. A track controller and feed forward controller combined with PID controlon the flow of zinc purified solution was found to be the most beneficial of the controlstrategies investigated. An optimizer was used to choose the set points of spent electrolytetemperature, acid concentration and zinc concentration which maximized zinc production.This optimized control strategy increased production within the simulation by 4% and alsodecreased the variability in the spent electrolyte concentration with comparison to histori-cal operator control in an operating cell house. Such a control strategy could not be testedwith a steady state model of zinc electrowinning.The simulation was used to analyze the consumption of manganese ions in the cellhouse. The simulation was used to predict the concentration of manganese in the cell houseelectrolytes as the concentration of Mn changed in the zinc purified solution and conditionsin the cell house changed. It was determined that the ratio of manganese and chlorideconcentrations in the cell had an effect on the amount of MnO2 precipitated. Increasingthe concentration of Mn with relation to Cl in the spent electrolyte reduced the amount of153CHAPTER 8. CONCLUSIONS AND RECOMMENDATIONSMnO2 precipitated. A ratio above eight reduced the amount of MnO2 produced.The simulation was used to estimate the current efficiency of zinc electwinning cells.Measurements taken from the plant were reconciled to estimate the amount of zinc cathodeproduced over time, giving an estimation of the current efficiency. The difference betweenpredicted and measured current efficiency was 0.52% over 30 weeks. This information mayhelp engineers and operators in monitoring the cell house by giving a more rapid estimationof the current efficiency and generating a single set of most probable data.8.2 RecommendationsThe preceding discussions have also highlighted areas of interest for further work.1) Improving the Zinc Electrowinning Models The model presented here does not ac-count for some effects such as impurities, plating times, or optimizing based on costrather than energy. With relevant data, these improvements could be incorporated inthe model and develop an improved tool to analyze zinc cell houses with.2) Electrowinning of Other Metals The dynamic model developed here for zinc elec-trowinning can be modified to suit other commonly electrowon metals. The control-ling kinetics of the reduction reaction, whether activation or mass transport limiting,can be represented within the developed code through modification. This would de-pend on having data sets available for both an industrial scale operation, and small labscale environments to examine extreme conditions not common in the electrowinningoperation.3) Dynamic Simulation of a Zinc Refinery Dynamic modelling of a full zinc plantmay have benefits to control, operator training, and plant scheduling. This wouldrequire further development of steady state leaching models for CSTR or pressureleaching autoclaves which have been reported in literature.154CHAPTER 8. CONCLUSIONS AND RECOMMENDATIONS4) Model Predictive Control Each input to the cell house, such as ZPS flow rate, willaffect all of the process variables. Investigation and implementation of a MPC setpoint optimization using the simulation may achieve superior control to the basicSISO control scheme investigated in this work.5) Online Data Reconciliation The simulation can tied to the DCS of an operating plantwhich based on data history and measurement variations can create a single live setof data which is most probable in the plant at that moment. This will aid in removingerroneous data and identifying concerning process upsets earlier.155REFERENCES[1] T. Yoshida. Technological overview of the zinc industry - now and future. In S.Wang and J.E. Dutrizac and M.L. Free and J.Y. Hwang and D. Kim, editor, T.T.Chen Honorary Symposium on Hydrometallurgy, Electrometallurgy, and MaterialsCharacterization., pages 1–23, Olrando Florida, 2012. TMS. (Cited on page 1.)[2] M. Ruonala, K. Svens, J. Hammerschmidt, B. Saxe´n, and E. Tuuppa. LatestDevelopments in Zinc Processing. In A. Siegmund, L. Centomo, C. Geenen,N. Piret, G. Richards, and R. Stephens, editors, Lead Zinc Proceedings, pages29–45, Vancouver, Canada, 2010. John Wiley & Sons. (Cited on page 1.)[3] G.W. Barton and A.C. Scott. A validated mathematical model for a zincelectrowinning cell. Journal of Applied Electrochemistry, 22:104–115, 1992.(Cited on pages 1, 32, 33, 35, 48, 54, 55, 56, 67, 106, and 140.)[4] T. Wall and K. Hewitt. The Zinc Industry. Woodhead Publishing Limited,Cambridge, United Kingdom, 2000. (Cited on pages 4 and 5.)[5] H. Aldersey-Williams. Periodic Tales: The Curious Lives of the Elements.Penguin, 1 edition, 2011. (Cited on page 4.)[6] R.J. Sinclair. The Extractive Metallurgy of Zinc. The Australian Institute of Miningand Metallurgy, Carlton, Australia, 2005. (Cited on pages 4, 5, 6, 7, 8, 9, 10, 11,12, 13, 14, 15, 16, 17, 20, 24, 28, 58, 89, 128, 138, 140, and 170.)[7] H.O. Hofman. Metallurgy of zinc and cadmium. McGraw-Hill Book Company,Inc., 1922. (Cited on page 5.)[8] K. C. Sole, A. M. Feather, and P. M. Cole. Solvent extraction in southern Africa:An update of some recent hydrometallurgical developments. Hydrometallurgy,78(1-2):52–78, July 2005. (Cited on pages 5 and 6.)[9] Dimitrios Filippou. Innovative Hydrometallurgical Processes for the PrimaryProcessing of Zinc. Mineral Processing and Extractive Metallurgy Review,25(3):205–252, July 2004. (Cited on pages 5, 6, and 9.)[10] K. Jiang, H. Wang, and L. Li. Hydrometallurgical Developments in the ZincIndustry in China. In E. Asselin, D. Dixon, F. Doyle, D. Dreisinger, M. Jeffrey, andM. Moats, editors, Hydrometallurgy 2014 - 7th International Symposium Volume I,156REFERENCESpages 17–31, Victoria BC, Canada, 2014. Canadian Institute of Mining Metallurgyand Petroleum. (Cited on pages 6, 10, and 12.)[11] G. Diaz and D. Martin. Modified Zincex Process : the clean , safe and profitablesolution to the zinc secondaries treatment. Resources, Conservation and Recycling,10:43–57, 1994. (Cited on page 6.)[12] S.W.K. Morgan. Zinc and its Alloys and Compounds. Ellis Horwood, West Sussex,1985. (Cited on pages 8, 10, 12, 13, 14, 15, 16, and 17.)[13] N. Leclerc, E. Meux, and J. Lecuire. Hydrometallurgical extraction of zinc fromzinc ferrites. Hydrometallurgy, 70(1-3):175–183, July 2003. (Cited on page 8.)[14] J. O. Claassen, E.H.O. Meyer, J. Rennie, and R.F. Sandenbergh. Iron precipitationfrom zinc-rich solutions: defining the Zincor Process. Hydrometallurgy,67(1-3):87–108, December 2002. (Cited on page 9.)[15] D. Filippou and G. .P. Demopoulos. Steady-state modeling of zinc-ferrite hot-acidleaching. Metallurgical and Materials Transactions B, 28(4):701–711, August1997. (Cited on page 9.)[16] K. R. Buban, M. J. Collins, and I. M. Masters. Iron control in zinc pressure leachprocesses. JOM, 51(12):23–25, 1999. (Cited on pages 10 and 11.)[17] M. J. Collins, B. N. Doyle, E. Ozberk, and I. M. Masters. The zinc pressureleaching process applications. In T.S. Mackay and R.D. Prengaman, editors,Proceedings Lead-Zinc 90, pages 293–311, Anaheim CA, U.S.A., 1990. TMSAnnual Meeting. (Cited on page 10.)[18] S. A. Baldwin, G. P. Demopoulos, and V. G. Papangelakis. Mathematical modelingof the zinc pressure leach process. Metallurgical and Materials Transactions B,26(5):1035–1047, October 1995. (Cited on pages 11 and 40.)[19] T. Haakana, B. Saxe´n, L. Lehtinen, H. Takala, M. Lahtinen, K. Svens, M. Ruonala,and X. Gongming. Outotec direct leaching application in China. Journal - SouthAfrican Institute of Mining and Metallurgy, 2008(5):245–251, 2008. (Cited onpage 12.)[20] M. Lahtinen, K. Svens, T. Haakana, and L. Lehtinen. Zinc plant expansion byoutotec direct leaching process. In L. Centomo, M. J. Collins, J. Harlamovs, andJ. Liu, editors, Zinc and Lead Metallurgy - 47th Annual Conference of Metallurgistsof CIM, pages 167–178, Winnipeg MB, Canada, 2008. METSOC 2008. (Cited onpage 12.)[21] M.R.C. Ismael and J.M.R. Carvalho. Iron recovery from sulphate leach liquors inzinc hydrometallurgy. Minerals Engineering, 16(1):31–39, January 2003. (Citedon pages 12, 13, 14, and 15.)157REFERENCES[22] S. Seyer, T. Chen, and J. Dutrizac. Jarofix: Addressing iron disposal in the zincindustry. JOM, 53(12):32–35, 2001. (Cited on page 13.)[23] S.J.G. Casaroli, B. Cohen, a.R. Tong, P. Linkson, and J.G. Petrie. Cementation formetal removal in zinc electrowinning circuits. Minerals Engineering,18(13-14):1282–1288, November 2005. (Cited on page 16.)[24] M. Moats, E. Guerra, and A. Gonzalez. Zinc Electrowinning - Operating Data. InA. Siegmund, L. Centomo, C. Geenen, N. Piret, G. Richards, and R. Stephens,editors, Pb Zn 2010 - Lead-Zinc 2010 Symposium, pages 263–282, Vancouver,2010. John Wiley & Sons. (Cited on pages 18 and 103.)[25] J.M.S. Rodrigues and E.H.O. Meyer. Improving the performance of anodes for zincelectrowinning. In G.W. Warren, editor, EPD Congress 1996, pages 161–180,Anaheim CA, U.S.A., 1996. TMS Annual Meeting. (Cited on pages 19, 23, 24,126, 129, 130, 132, and 136.)[26] G. H. Kelsall, E. Guerra, G. Li, and M. Bestetti. Effects of manganese (II) andchloride ions in zinc electrowinning reactors. Proceedings-Electrochemical Society,14:350–361, 2000. (Cited on pages 20, 23, and 128.)[27] D. Dhak, M. Mahon, E. Asselin, and A. Alfantazi. Characterizing industriallyelectrowon sticky zinc deposits. Hydrometallurgy, 111-112:136–140, 2012. (Citedon page 20.)[28] Y. Lefevre and M.R. Pieterse. The state of the art and constant feasibility upgradingof the zinc electrowinning cell house of Asturiana de Zinc at San Juan de Nieva,Spain. In J.E. Dutrizac, J.A. Gonzalez, J.L. Bolton, and P. Hancock, editors,Proceedings Lead-Zinc Proceedings Conference, pages 367–377, Calgary, Canada,1998. Canadian Institute of Mining Metallurgy and Petroleum. (Cited on page 20.)[29] E. Guerra and M. Bestetti. Physicochemical Properties of ZnSO4 - H2SO4 - H2OElectrolytes of Relevance to Zinc Electrowinning. Journal of Chemical &Engineering Data, 51(5):1491–1497, September 2006. (Cited on pages 21, 31,and 52.)[30] Y. Umetsu, Q. Su, and K. Tozawa. Density and viscosity coefficient of acidic zincsulphate solutions containing impurity sulphates. Journal of the Minerals andMetallurgy Institute of Japan, 104(11):829–836, 1988. (Cited on pages 21 and 31.)[31] J. K. Hovey, K. S. Pitzer, and J. A. Rard. Thermodynamics of Na2SO4(aq) attemperatures T from 273 K to 373 K and of {(1-y)H2SO4+yNa2SO4}(aq) at T =298.15 K. The Journal of Chemical Thermodynamics, 25(1):173–192, January1993. (Cited on page 21.)[32] G. Dı´az, D. M. San Lorenzo, and C. L. Gallego. Zinc recycling through themodified Zincex process. JOM, 47(10):22–23, October 1995. (Cited on page 22.)158REFERENCES[33] T.J. O’Keefe. Zinc Electrowinning - Short Course. In J.E. Dutrizac Siegmund, J.A.Gonzalez, D.M. Henke, S.C. James, and A.H.J., editors, Lead Zinc 2000Symposium, Pittsburgh, U.S.A., 2000. John Wiley & Sons. (Cited on page 22.)[34] M. Tunnicliffe, F. Mohammadi, and A. Alfantazi. Polarization Behavior ofLead-Silver Anodes in Zinc Electrowinning Electrolytes. Journal of TheElectrochemical Society, 159(4):C170, 2012. (Cited on page 23.)[35] C. Cachet, C. Le Pape-re´rolle, and R. Wiart. Influence of Co2+ and Mn2+ ions onthe kinetics of lead anodes for zinc electrowinning. Journal of appliedelectrochemistry, pages 813–820, 1999. (Cited on page 23.)[36] P. Yu and T.J. O’Keefe. Evaluation of Lead Anode Reactions in Acid SulfateElectrolytes. Journal of The Electrochemical Society, 149(5):A558, 2002. (Citedon pages 23, 126, and 127.)[37] G.N. Pakhomova and L.M. Marenkova. Some reactions on the insoluble lead anodeduring the electrodeposition of zinc. TSVETNYE MET, pages 41–43, 1966. (Citedon pages 23 and 126.)[38] R. Hierzyk, D. Krupkowa, and E. Lach. From the studies on the behavior of Cl-ions in the Zn electrolysis process. Rudy I Matle Niezelazne, 4:197–199, 1969.(Cited on page 23.)[39] C.J. Krauss. Effects of Minor elements on the production of electrolytic zinc fromzinc sulphide concentrates. Technical report, Development Manager, TrailOperations Cominco Ltd., Trail, Canada, 1993. (Cited on pages 24 and 170.)[40] L. Muresan, G. Maurin, L. Oniciu, and D. Gaga. Influence of metallic impurities onzinc electrowinning from sulphate electrolyte. Hydrometallurgy, 43:345–354,1996. (Cited on page 24.)[41] C. Cachet. Zinc Electrowinning in Acidic Sulfate Electrolytes: Impedance Analysisand Modeling of the Influence on Nickel Impurities. Journal of TheElectrochemical Society, 141(1):131, 1994. (Cited on pages 24 and 170.)[42] H. Zhang, Y. Li, J. Wang, and X. Hong. The influence of nickel ions on the longperiod electrowinning of zinc from sulfate electrolytes. Hydrometallurgy,99(1-2):127–130, October 2009. (Cited on pages 24, 25, and 170.)[43] R. D. Fosnacht and T. J. O’Keefe. The effects of certain impurities and theirinteractions on zinc electrowinning. Metallurgical Transactions B, 14(4):645–655,December 1983. (Cited on pages 24, 25, and 170.)[44] D.J. MacKinnon, R.M. Morrison, and J.M. Brannen. The effects of nickel andcobalt and their interaction with antimony on zinc electrowinning from industrialacid sulphate electrolyte. Journal of Applied Electrochemistry, 16:53–61, 1986.(Cited on pages 24 and 170.)159REFERENCES[45] D.J. MacKinnon, J.M. Brannen, and P.L. Fenn. Characterization of impurity effectsin zinc electrowinning from industrial acid sulphate electrolyte. Journal of AppliedElectrochemistry, 17:1129–1143, 1987. (Cited on page 24.)[46] I. Ivanov. Increased current efficiency of zinc electrowinning in the presence ofmetal impurities by addition of organic inhibitors. Hydrometallurgy,72(1-2):73–78, February 2004. (Cited on pages 24 and 170.)[47] A.R. Ault and E.J. Frazer. Effects of certain impurities on zinc electrowinning inhigh-purity synthetic solutions. Journal of Applied Electrochemistry, 18:583–589,1988. (Cited on pages 24, 170, and 182.)[48] R. Wiart, C. Cachet, C. Bozhkov, and S. Rashkov. On the nature of the ‘inductionperiod’ during the electrowinning of zinc from nickel containing sulphateelectrolytes. Journal of Applied Electrochemistry, 20:381–389, 1990. (Cited onpage 25.)[49] C. Bozhkov, M. Petrova, and St. Rashkov. Nickel and cobalt synergism effect inzinc electrowinning from sulphate electrolytes. Journal of AppliedElectrochemistry, 22:73–81, 1992. (Cited on page 25.)[50] D.J. MacKinnon, R.M. Morrison, J.E. Mouland, and P.E. Warren. The effects ofantimony and glue on zinc electrowinning from Kidd Creek electrolyte. Journal ofApplied Electrochemistry, 20:728–736, 1990. (Cited on pages 25 and 177.)[51] A.M. Alfantazi and D.B. Dreisinger. Foaming behavior of surfactants for acid mistcontrol in zinc electrolysis processes. Hydrometallurgy, 69(1-3):57–72, April 2003.(Cited on pages 25 and 180.)[52] D.J. MacKinnon, R.M. Morrison, J.E. Mouland, and P.E. Warren. The effects ofDowfroth , antimony and Saponin on zinc electrowinning from Kidd Creekelectrolyte. Journal of Applied Electrochemistry, 21:213–220, 1991. (Cited onpages 25 and 180.)[53] C. Lupi and D. Pilone. New lead alloy anodes and organic depolariser utilization inzinc electrowinning. Hydrometallurgy, 44(3):347–358, March 1997. (Cited onpage 25.)[54] E.J. Frazer and T. Lwin. Identification of optimum conditions for zincelectrowinning in high-purity synthetic electrolytes. Journal of AppliedElectrochemistry, 17:453–462, 1987. (Cited on pages 26, 31, and 33.)[55] A.E. Saba and A.E. Elsherief. Continuous electrowinning of zinc.Hydrometallurgy, 54(2-3):91–106, January 2000. (Cited on pages 26 and 177.)[56] A.C. Scott. The development and application of a mathematical model for the zincelectrowinning process. PhD thesis, University of Sydney, 1988. (Cited onpages 26, 27, 32, and 68.)160REFERENCES[57] A.M. Alfantazi and D.B. Dreisinger. The role of zinc and sulfuric acidconcentrations on zinc electrowinning from industrial sulfate based electrolyte.Journal of Applied Electrochemistry, 31:641–646, 2001. (Cited on pages 27and 28.)[58] P. Guillaume, N. Leclerc, C. Boulanger, J. Lecuire, and F. Lapicque. Investigationof optimal conditions for zinc electrowinning from aqueous sulfuric acidelectrolytes. Journal of Applied Electrochemistry, 37(11):1237–1243, August 2007.(Cited on page 27.)[59] G.W. Barton and A.C. Scott. Industrial applications of a mathematical model forthe zinc electrowinning process. Journal of Applied Electrochemistry, 24:377–383,1994. (Cited on pages 29, 33, and 34.)[60] I.W. Wark. The electrodeposition of zinc from acidified zinc sulphate solution.Journal of Applied Electrochemistry, 9:721–730, 1979. (Cited on pages 30and 140.)[61] U.C. Tainton. Hydrogen Overvoltage and Current Density in the Electrodepositionof Zinc. Trans. American Electrochemical Society, 41:389–410, 1922. (Cited onpage 31.)[62] J. Bolan˜os R. Cruz, S. Castro, R. Gonzalez-Garcia, L. Alvarado, B. Ramos, R.Lara. Prediction models of current efficiency and cathodic overpotential for thezinc electrodeposition process. In A. Siegmund, L. Centomo, C. Geenen, N. Piret,G. Richards, and R. Stephens, editors, Pb Zn 2010 - Lead-Zinc 2010 Symposium,Held in Conjunction with COM 2010, pages 1191–1201, Vancouver, 2010. JohnWiley & Sons. (Cited on pages 31 and 140.)[63] J. Dukovic and C.W. Tobias. The Influence of Attached Bubbles on Potential Dropand Current Distribution at GasEvolving Electrodes. Journal of theElectrochemical Society, 134(2):331–343, 1987. (Cited on pages 31 and 34.)[64] G. Kreysa and M. Kuhn. Modelling of gas evolving electrolysis cells. I. The gasvoidage problem. Journal of applied electrochemistry, 15(4):517–526, 1985.(Cited on pages 31 and 57.)[65] T. Biegler and E.J. Frazer. The coulombic efficiency of zinc electrowinning inhigh-purity synthetic electrolytes. Journal of applied electrochemistry,16(5):654–662, 1986. (Cited on page 31.)[66] R.E. White, M. Bain, and M. Raible. Parallel plate electrochemical reactor model.Journal of The Electrochemical Society, 130(5):1–6, 1983. (Cited on page 32.)[67] M.J. Mader, C.W. Walton, and R.E. White. Parallel plate electrochemical reactormodel: material balance closure and a simplification. Journal of TheElectrochemical Society, 133(6):1124–1130, 1986. (Cited on page 32.)161REFERENCES[68] F. Ajersch, D. Mathieu, and D.L. Piron. Bubble Enhanced Mass Transfer ofElectrodeposited Zinc from Acid Solutions. Canadian Metallurgical Quarterly,24(1):53–63, 1985. (Cited on pages 32 and 35.)[69] A.C. Scott, R.M. Pitblado, G.W. Barton, and A.R. Ault. Experimentaldetermination of the factors affecting zinc electrowinning efficiency. Journal ofApplied Electrochemistry, 18(1):120–127, January 1988. (Cited on pages 32, 56,66, 67, 69, 70, and 140.)[70] G.W. Barton and A.C. Scott. Scale-up effects in modelling a full-size zincelectrowinning cell. Journal of Applied Electrochemistry, 22:687–692, 1992.(Cited on pages 32, 33, 34, 48, and 57.)[71] T. Hurlen. Kinetics of metal/metal-ion electrodes: Iron, copper, zinc.Electrochimica Acta, 7(6):653–668, January 1962. (Cited on page 33.)[72] G. Li, Y. Zhang, E. Asselin, and Z. Li. Vapor-Liquid Equilibria for theZnSO4-H2SO4-H2O and MgSO4-H2SO4-H2O Systems at (30, 60, 90, and 101.3)kPa. Journal of Chemical & Engineering Data, 59(11):3449–3460, 2014. (Cited onpage 33.)[73] R. Courant, K. Friedrichs, and H. Lewy. On the Partial Difference Equations ofMathematical Physics. IBM Journal of Research and Development, 11(2):215–234,March 1967. (Cited on pages 34 and 35.)[74] H Vogt. Mass transfer at gas evolving electrodes with superposition ofhydrodynamic flow. Electrochimica Acta, 23(3):23–25, 1978. (Cited on pages 35and 56.)[75] A.Y. Hosny, T.J. O’Keefe, J.W. Johnson, and W.J. James. Correlation between masstransfer and operating parameters in zinc electrowinning. Journal of AppliedElectrochemistry, 21(9):785–792, September 1991. (Cited on pages 35, 36,and 67.)[76] K. J. Cathro. Mass Transport during Zinc Electrowinning at High Current Density.Journal of The Electrochemical Society, 139(8):2186, 1992. (Cited on page 35.)[77] H. Vogt. Superposition of microconvective and macroconvective mass transfer atgas-evolving electrodesa theoretical attempt. Electrochimica acta, 32(4):633–636,1987. (Cited on pages 35 and 56.)[78] F. Lapicque and A. Storck. Modelling of a continuous parallel plate plug flowelectrochemical reactor: electrowinning of copper. Journal of AppliedElectrochemistry, 15(6):925–935, 1985. (Cited on page 36.)[79] Hossein Aminian, Claude Bazin, Daniel Hodouin, and Claude Jacob. Simulation ofa SXEW pilot plant. Hydrometallurgy, 56(1):13–31, May 2000. (Cited onpages 36, 43, and 45.)162REFERENCES[80] L. Cifuentes, J.M. Castro, G. Criso´stomo, J.M. Casas, and J. Simpson. Modelling acopper electrowinning cell based on reactive electrodialysis. Applied MathematicalModelling, 31(7):1308–1320, July 2007. (Cited on page 37.)[81] V.G. Papangelakis and G.P. Demopoulos. Prologue. In V.G. Papangelakis and G. P.Demopoulos, editors, Modelling, Simulation and Control of HydrometallurgicalProcesses, pages v–vi, Quebec City, 1993. Canadian Institute of Mining Metallurgyand Petroleum. (Cited on page 38.)[82] B. Flintoff. Process control in hydrometallurgy. In Vladimiros G.. Papangelakisand George P. Demopoulos, editors, Modelling, Simulation and Control ofHydrometallurgical Processes, pages 175–190, Quebec City, 1993. CanadianInstitute of Mining Metallurgy and Petroleum. (Cited on page 38.)[83] W. Luyben. Plantwide Dynamic Simulators in Chemical Process Control. MarcelDekker, New York, 2002. (Cited on pages 38 and 43.)[84] S. Xu and J. Bao. Distributed control of plantwide chemical processes. Journal ofProcess Control, 19(10):1671–1687, December 2009. (Cited on page 38.)[85] D. Dreisinger. Copper leaching from primary sulfides: Options for biological andchemical extraction of copper. Hydrometallurgy, 83(1-4):10–20, September 2006.(Cited on page 39.)[86] M. Dry. Using Computing Power in Process Development. In Mintek 75, pages1–34, Randburg, South Africa, 2009. Mintek. (Cited on page 39.)[87] S.A. Baldwin, G.P. Demopoulos, and V.G. Papangelakis. Computer simulation andanalysis of pressure oxidation autoclaves using REACTSIM. In V.G. Papangelakisand G. P. Demopoulos, editors, Modelling, Simulation and Control ofHydrometallurgical Processes, pages 123–143, Quebec City, 1993. CanadianInstitute of Mining Metallurgy and Petroleum. (Cited on page 40.)[88] S.A. Baldwin and G.P. Demopoulos. Assessment of alternative iron sources in thepressure leaching of zinc concentrates using a reactor model. Hydrometallurgy,39(1-3):147–162, October 1995. (Cited on page 40.)[89] G. Holcroft, L. Rosato, and S. Seyer. Hydrometallurgical process simulation atCanadian Electrolytic Zinc. In V.G. Papangelakis and G. P. Demopoulos, editors,Modelling, Simulation and Control of Hydrometallurgical Processes, pages93–106, Quebec City, 1993. Canadian Institute of Mining Metallurgy andPetroleum. (Cited on page 40.)[90] P.C. Hernandez, M.E. Taboada, T.A. Graber, and H.R. Galleguillos. Crystallizationof Hydrated Ferric Arsenate. Process Design Using METSIM. Industrial &Engineering Chemistry Research, 48(23):10522–10531, December 2009. (Cited onpage 41.)163REFERENCES[91] O.A. Rocha, M. Claros, T.A. Graber, E.K. Flores, and M.E. Taboada. Solid-LiquidEquilibrium and Process Design of CuSO4 + NaCl + (H2O or H2SO4 / H2O)Systems at 298.15 K. Industrial & Engineering Chemistry Research,52(20):6803–6811, May 2013. (Cited on page 42.)[92] A. Razavimanesh, M. Tade, J. Rumball, and V. Pareek. Steady-State Simulation ofHybrid Nickel Leaching Circuit Using Syscad. Chemical Product and ProcessModeling, 1(1), January 2006. (Cited on page 42.)[93] H. Aminian, C. Bazin, and D. Hodouin. Residence time distributions in SX-EWequipment. International journal of mineral processing, 54:235–242, 1998. (Citedon page 43.)[94] Q. Xiong and A. Jutan. Grey-box modelling and control of chemical processes.Chemical Engineering Science, 57(6):1027–1039, March 2002. (Cited on page 43.)[95] S. Engell. Feedback control for optimal process operation. Journal of ProcessControl, 17(3):203–219, March 2007. (Cited on page 43.)[96] S. Brochot, M.V. Durance, J. Villeneuve, P. D’Hugues, and M. Mugabi. Modellingof the bioleaching of sulphide ores: application for the simulation of thebioleaching/gravity section of the Kasese Cobalt Company Ltd process plant.Minerals Engineering, 17(2):253–260, February 2004. (Cited on page 44.)[97] M. Botz, A. Kaczmarek, and S. Orser. Managing copper in leach solution at theC¸o¨pler gold mine : laboratory testing and process design. Minerals &Metallurgical Processing, 2011, 28(3):133–138, 2011. (Cited on page 44.)[98] C. Dorfling, G. Akdogan, S.M. Bradshaw, and J.J. Eksteen. Modelling of anautoclave used for high pressure sulphuric acid/oxygen leaching of first stage leachresidue. Part 1: Model development. Minerals Engineering, 53:220–227,November 2013. (Cited on page 44.)[99] C. Dorfling, G. Akdogan, S.M. Bradshaw, and J.J. Eksteen. Modelling of anautoclave used for high pressure sulphuric acid/oxygen leaching of first stage leachresidue, Part 2: Model application. Minerals Engineering, 53:213–219, November2013. (Cited on page 44.)[100] T. Komulainen, P. Pekkala, A. Rantala, and S. Ja¨msa¨-Jounela. Dynamic modellingof an industrial copper solvent extraction process. Hydrometallurgy, 81(1):52–61,January 2006. (Cited on page 45.)[101] C.M. Moreno, J.R. Pe´rez-Correa, and a. Otero. Dynamic modelling of coppersolvent extraction mixersettler units. Minerals Engineering, 22(15):1350–1358,December 2009. (Cited on page 45.)[102] L.G. Bergh and J.B. Yianatos. Current status and limitations of copper SX/EWplants control. Minerals Engineering, 14(9):975–985, September 2001. (Cited onpage 46.)164REFERENCES[103] L.G. Bergh, S. Ja¨msa¨-Jounela, and D. Hodouin. State of the art in copperhydrometallurgic processes control. Control Engineering Practice,9(9):1007–1012, September 2001. (Cited on page 46.)[104] T. Komulainen, F. Doyle III, A. Rantala, and S. Ja¨msa¨-Jounela. Control of anindustrial copper solvent extraction process. Journal of Process Control,19(1):2–15, January 2009. (Cited on pages 46 and 106.)[105] G.A. Padilla, L.A. Cisternas, and J.Y. Cueto. On the optimization of heap leaching.Minerals Engineering, 21(9):673–678, August 2008. (Cited on page 46.)[106] L.R.P. de Andrade Lima. Nonlinear data reconciliation in gold processing plants.Minerals Engineering, 19(9):938–951, July 2006. (Cited on page 47.)[107] C. Bazin. Data reconciliation for the calibration of a model for batch grinding.Minerals Engineering, 18(10):1052–1056, August 2005. (Cited on page 47.)[108] C. Bazin, D. Hodouin, and M. Zouadi. Data reconciliation and equilibrium constantestimation: Application to copper solvent extraction. Hydrometallurgy,80(1-2):43–53, November 2005. (Cited on page 47.)[109] K.S. Pitzer. Thermodytriarnics of Electrolytes. I. Theoretical Basis and GeneralEquations. The Journal of Physical Chemistry, 77(6):268–277, 1973. (Cited onpage 52.)[110] K.S. Pitzer and G. Mayorga. Thermodynamics of electrolytes II. activity andosmotic coefficients for strong electrolytes with one or both ions univalent. TheJournal of Physical Chemistry, 77(19):2300–2308, 1973. (Cited on page 52.)[111] K.S. Pitzer and G. Mayorga. Thermodynamics of electrolytes. III. Activity andosmotic coefficients for 2-2 electrolytes. Journal of Solution Chemistry,3(7):539–546, 1974. (Cited on page 52.)[112] K. S. Pitzer and J. J. Kim. Thermodynamics of Electrolytes. IV. Activity andOsmotic Coefficients for Mixed Electrolytes. Journal of the American ChemicalSociety, 1426(4):5701–5707, 1974. (Cited on page 52.)[113] H.M. Wang, S.F. Chen, and T.J. O’Keefe. Evaluation of mass transport in copperand zinc electrodeposition using tracer methods. Journal of AppliedElectrochemistry, 19(2):174–182, 1989. (Cited on page 56.)[114] M. Moats. Hydrometallurgy 2014 Short Course Copper Electrorefining andElectrowinning. In E. Asselin, D. Dixon, F. Doyle, D. Dreisinger, M. Jeffrey, andM. Moats, editors, Hydrometallurgy 2014 - 7th International Symposium Volume I,Victoria BC, Canada, 2014. Canadian Institute of Mining Metallurgy andPetroleum. (Cited on page 58.)165REFERENCES[115] J.C. Kloppers. A critical evaluation and refinement of the performance predictionof wet-cooling towers. PhD thesis, University of Stellenbosch, 2003. (Cited onpages 63, 64, and 68.)[116] J.C. Kloppers and D.G. Kroger. Cooling Tower Performance Evaluation: Merkel,Poppe, and e-NTU Methods of Analysis. Journal of Engineering for Gas Turbinesand Power, 127(1):1–7, 2005. (Cited on page 63.)[117] N.J. Williamson. Numerical modelling of heat and mass transfer and optimisationof a natural draft wet cooling tower. PhD thesis, University of Sydney, 2008.(Cited on page 63.)[118] L. Laperriere and L. Wasik. Implementing optimization with process simulation.Tappi Journal, 85(6):7–12, 2002. (Cited on pages 67 and 141.)[119] B. Sun, W.H. Gui, Y.L. Wang, and C.H. Yang. Intelligent optimal setting control ofa cobalt removal process. Journal of Process Control, 24(5):586–599, May 2014.(Cited on page 106.)[120] K.J. A˚ stro¨m and T. Ha¨gglund. The future of PID control. Control EngineeringPractice, 9:1163–1175, 2001. (Cited on page 107.)[121] K.H. Ang, G. Chong, and Y. Li. PID control system analysis, design, andtechnology. IEEE Transactions on Control Systems Technology, 13(4):559–576,2005. (Cited on page 107.)[122] T.P. Blanchett, G.C. Kember, and R. Dubay. PID gain scheduling using fuzzy logic.ISA Transactions, 39:317–325, 2000. (Cited on page 107.)[123] S.J. Qin and T.A. Badgwell. A survey of industrial model predictive controltechnology. Control Engineering Practice, 11:733–764, 2003. (Cited on page 107.)[124] H. Gharsallaoui, M. Ayadi, M. Benrejeb, and P. Borne. Flatness-based control andconventional RST polynomial control of a thermal process. International Journal ofComputers, Communications and Control, 4(1):41–56, 2009. (Cited on page 107.)[125] W.Y. Svrcek, D.P. Mahoney, and B.R. Young. A Real-Time Approach to ProcessControl. In A Real-Time Approach to Process Control, pages 215–234. John Wiley& Sons, 2nd edition, 2006. (Cited on page 108.)[126] Aurel Systems Inc. CADSIM Plus Process Simulator User Manual. Aurel SystemsInc., Burnaby BC, Canada, 2014. (Cited on page 108.)[127] L. Pajunun, J. Aromaa, and O. Forsen. The effect of dissolved manganese on anodeactivity in electrowinning. In C. Young, A. Alfantazi, C. Anderson, A. James,D. Dreisinger, and B. Harris, editors, Hydrometallurgy 2003 Volume 2:Electrometallurgy and Environmental Hydrometallurgy, Hoboken, NJ, USA,August 2003. John Wiley & Sons, Inc. (Cited on page 124.)166REFERENCES[128] C. J. Clarke, G. J. Browning, and S. W. Donne. An RDE and RRDE study into theelectrodeposition of manganese dioxide. Electrochimica Acta, 51(26):5773–5784,August 2006. (Cited on pages 125, 129, 130, 132, and 136.)[129] J. Ipinza and J.P. Iba´n˜ez. Mecanismo de la formacio´n de compuestos de manganesoen electrolitos a´cidos. Revista De Metalurgia, 43(1):11–19, 2007. (Cited onpages 126 and 128.)[130] J.I. Morrow and S. Perlman. Kinetic study of the permanganate-manganous ionreaction to form manganic ion in sulfuric acid media. Inorganic Chemistry,1957(3):8–10, 1973. (Cited on page 126.)[131] J. Ipinza, J.P. Iba´n˜ez, A. Pagliero, and F. Vergara. Study of anodic slime fromChilean copper electrowinning plants. In C. Young, A. Alfantazi, C. Anderson,A. James, D. Dreisinger, and B. Harris, editors, Hydrometallurgy 2003 Volume 2:Electrometallurgy and Environmental Hydrometallurgy, Hoboken, NJ, USA,August 2003. John Wiley & Sons, Inc. (Cited on page 128.)[132] R.G. Selim and J.J. Lingane. Coulometric titration with higher oxidation states ofmanganese: Electrolytic generation and stability of +3 manganese in sulfuric acidmedia. Analytica Chimica Acta, 21:536–544, 1959. (Cited on page 128.)[133] J. Rodrigues, D. Garbers, and E.H.O. Meyer. Recent Developments in the ZincorCell House. Canadian Metallurgical Quarterly, 40(4):441–449, January 2001.(Cited on pages 128 and 130.)[134] A.R. Ault and G.C. Bratt. Control of manganese level in an electrolytic zinc plantcircuit by anodic deposition of oxide. Proceedings Australasia Institute of Miningand Metallurgy, 254:37–45, 1975. (Cited on pages 129, 130, and 132.)[135] O.J. Hao, A.P. Davis, and P.H. Chang. Kinetics of manganese (II) oxidation withchlorine. Journal of Environmental Engineering, 117(3):359–374, 1991. (Cited onpage 139.)[136] B.C. Tripathy, S.C. Das, G.T. Hefter, and P. Singh. Zinc electrowinning from acidicsulfate solutions Part I : Effects of sodium lauryl sulfate. Journal of AppliedElectrochemistry, 27:673–678, 1997. (Cited on pages 178 and 182.)[137] A. Rece´ndiz, I. Gonza´lez, and J.L. Nava. Current efficiency studies of the zincelectrowinning process on aluminum rotating cylinder electrode (RCE) in sulfuricacid medium: Influence of different additives. Electrochimica Acta,52(24):6880–6887, August 2007. (Cited on page 178.)[138] B.C. Tripathy, S.C. Das, G.T. Hefter, and P. Singh. Zinc electrowinning from acidicsulphate solutions Part II : Effects of triethylbenzylammonium chloride. Journal ofApplied Electrochemistry, 28:915–920, 1998. (Cited on page 178.)167REFERENCES[139] B C Tripathy, S C Das, P Singh, and G T Hefter. Zinc electrowinning from acidicsulphate solutions . Part III : Effects of quaternary ammonium bromides. Journal ofApplied Electrochemistry, 29:1229–1235, 1999. (Cited on page 179.)[140] S.C. Das. The effects of 4-ethylpyridine and 2-cyanopyridine on zincelectrowinning from acidic sulfate solutions. Journal of Applied Electrochemistry,27:738–744, 1997. (Cited on pages 179 and 182.)[141] C.Y. Cheng, M.D. Urbani, P. Miovski, D. Kittelty, A.F. Otero, and R.M. San Martn.Evaluation of saponins as acid mist suppressants in zinc electrowinning.Hydrometallurgy, 73(1-2):133–145, April 2004. (Cited on page 181.)168Appendices169APPENDIXAIMPURITIES IN ZINC ELECTROWINNINGTable A.1: Effects, characteristics, solution targets and removal of impurities in zincelectrowinning [6, 39, 41–44, 46, 47]Group Cathode Effects Process EffectsImpurity Cathode Effects Process EffectsGroup 1(Na, K)No effect Can be a problem if jarosite precipita-tion is not wanted in subsequent leach-ing. Useful for conducting water balancein the cell house. K promotes vertical de-position morphology.Group 2(Mg, Ca,Sr, Ba)No effect Will reduce zinc loading on sulfate.Mg - can have adverse effects on filter-ing, settling and conductivity. Reported topromote a basal deposition morphology.Mg is kept below 10000 ppm.Ca - can precipitate as gypsum on filtersand lines which is troublesome. Also canserve as a method of removing sulfate. Cais kept between 300 and 800 ppm.170APPENDIX A. IMPURITIES IN ZINC ELECTROWINNINGTable A.1 – Continued from previous pageGroup Cathode Effects Process EffectsSr, Ba - are insoluble and typically willprecipitate with leach residues. SrCO3 isoften added to the electrolyte to precipi-tate Pb.Group 3(Sc, Y,Yb, U)No known effects Not normally present in zinc electrolytes.Radioactive elements would present ahazard.Group 4(Ti, Zr,Hf)No known effects Not normally present in zinc electrolytesGroup 5(V, Nb,Ta)Lab tests indicate significantdrop in current efficiencyabove 1 ppmNot normally present in zinc electrolytesGroup 6(Cr, Mo,W)No known effects Not normally present in zinc electrolytesGroup 7(Mn, Re)Mn - small loss in current effi-ciency at high concentrationsas higher oxidation states arereducedMn - Needed to minimize anode corro-sion. 1.5 to 4 g L−1. Levels up to 15g L−1 have been reported as tolerable.Too much Mn can lead to disposal prob-lems and increases the frequency of anodecleaning.Re -Little effect on current ef-ficiency at 2 ppmRe - Conflicting information171APPENDIX A. IMPURITIES IN ZINC ELECTROWINNINGTable A.1 – Continued from previous pageGroup Cathode Effects Process EffectsGroup 8(Fe, Ru,Os)Fe - 3% current efficiencyloss at 10 ppm, 5 ppm or lessdesirable.Fe - Increases the rate of anode corrosion.Will contaminate cathode with iron andlead. Good indicator of purification per-formance. Ferric/ferrous couple can be aparasitic reaction at the anode.Ru, Os - Limited data avail-ableGroup 9(Co, Rh,Ir)Co - 15% current efficiencyloss at 10 ppm, 0.3 ppm orless desirable. Synergistic ef-fects with Ni or Sb lower fur-ther.Co - Must be removed with hot zinc dustpurification.Rh, Ir - Limited data availableGroup 10(Ni, Pd,Pt)Ni - 10% current efficiencyloss at 10 ppm, 0.3 ppm orless desirable. Synergistic ef-fects with Co or Sb lower fur-ther.Ni - Must be removed with hot zinc dustpurification. Will create a spongy zinccathode. Ni can create an induction effectwhere zinc will deposit for a time untilconcentrations of Ni are too high, wherethe deposit will then resolutionize.Pd - Limited data availablePt - Lowers current efficiencyat ppb levels.172APPENDIX A. IMPURITIES IN ZINC ELECTROWINNINGTable A.1 – Continued from previous pageGroup Cathode Effects Process EffectsGroup 11(Cu, Ag,Au)Cu - 5% current efficient lossat 1 ppm, 0.1 ppm or less isdesirable.Cu - Will contaminate the cathode if notremoved during purification. Readily re-moved to 0.03 ppm with zinc dust cemen-tation. Can be introduced through corro-sion of Cu electrical contacts in the cellhouse.Ag - Alloyed in Pb anodes.Au - Not normally present in zinc elec-trolytesGroup 12(Zn, Cd,Hg)Cd - 0.3 ppm or less is desir-able.Cd - Contaminates cathode. Good indica-tor of purification performance.Hg - 2% current efficientraise at 10 ppm, not nor-mally present in significantamounts.Hg - Would contaminate the cathode,however volatilzes during roasting or re-ports with residue of pressure leaching.Trace amounts cause severe pitting of AlcathodesGroup 13(B, Al,Ga, In,Tl)No Effects B, Al - Can affect electrolyte density, vis-cosity and ionic strength, however not alarge concern.Ga, In - Will contaminate cathode if notremoved. Easily removed by iron precip-itation173APPENDIX A. IMPURITIES IN ZINC ELECTROWINNINGTable A.1 – Continued from previous pageGroup Cathode Effects Process EffectsTl - Will contaminate cathode if not re-moved. Follows Cd and can be removedby permanganate precipitation in the Cdcircuit, or during iron precipitation.Group 14(Si, Ge,Sn, Pb)Si - No Effect Si - Can cause settling problems in leach-ingGe - 50% current efficientloss at 1 ppm, 0.01 ppm orless is desirable. Synergisticeffects with Ni and Co.Ge - Removed during iron purification.Can build up as a problem for some plantsdue to residue leaching. Ge can create aninduction effect where zinc will depositfor a time until concentrations of Ge aretoo high, where the deposit will then res-olutionize.Sn - 50% current efficient lossat 1 ppm, 0.01 ppm or less isdesirable.Sn - Usually removed during iron purifi-cation.Pb - No Effect. Pb - Can contaminate cathode. Usuallyremoved in iron removal. Can be intro-duced to the electrolyte due to anode cor-rosion.Group 15(As, Sb,Bi)As - 7% current efficient lossat 1 ppm, 0.1 ppm or less isdesirable.As - Normally removed during iron pu-rification.174APPENDIX A. IMPURITIES IN ZINC ELECTROWINNINGTable A.1 – Continued from previous pageGroup Cathode Effects Process EffectsSb - 35% current efficient lossat 1 ppm, 0.03 to 0.1 ppm de-sirableSb - Usually purified to less than 0.01ppm. Levels in electrolyte kept at 0.03 to0.1 ppm to offset the increased overvolt-age caused by the organic glue additions.It also improves cathode stripping. Sb cancreate an induction effect where zinc willdeposit for a time until concentrations ofSb are too high, where the deposit willthen resolutionize.Bi - No Effect Bi - Not normally present in zinc elec-trolytes. Would contaminate cathode ifpresentGroup 16(Se, Te)Se - Cause severe current ef-ficiency reduction. 0.01 ppmor less desirableSe - Removed by zinc dust cementationand volatization during roasting.Te - Cause severe current effi-ciency reduction. 0.005 ppmor less desirableTe - Removed during iron purification.Group17 (F, Cl,Br, I)No effects, provided the zinccan be separated from the Alblank sheetF - Will corrode starting Al blanks andprevent the zinc deposit from being re-moved. Desired to keep below 10 ppm.Above 10 ppm, Sb can aid in preventingsticky cathodes.175APPENDIX A. IMPURITIES IN ZINC ELECTROWINNINGTable A.1 – Continued from previous pageGroup Cathode Effects Process EffectsCl - Less than 100 ppm is desired. Willcorrode Al starters and Pb anodes. Above300 ppm, will evolve chlorine gas whichwill corrode equipment.Br, I - Not normally present in zinc elec-trolytes176APPENDIXBADDITIVES IN ZINC ELECTROWINNINGB.1 Morphology and Levelling AgentsContinuous electrowinning was also examined by Saba and Elsherief [55]. They observedthat the zinc concentration is a major determination of current efficiency at any currentdensity. At low zinc concentrations ( ≤40g L−1), the current efficiency was shown todrop from 96.6% at 120g L−1 Zn, to 53.1% at 41.2 g L−1 of Zn. Most interesting wastheir explanation in to the effect of organic additives, and the methods that they reducedeleterious effects of impurities on current efficiency. The addition of 50 mg L−1 of gelatincreated a very smooth deposit with small grains. This was attributed to gelatin ability toform a peptide polymer which helps to polarize the cathode further resulting in higherquality zinc deposit.GlueGlue (or pearl glue) is a typical additive in many electrowinning plants. It has a beneficialeffect in leveling the zinc deposit; essentially creating a smooth and compact deposit. Gluewas examined as a potential additive in electrowinning of Kidd Creek electrolyte [50].It was found that the power consumption increased with increasing glue concentrations,however the deposit quality also improved at levels of 30 mg L−1 of glue and above. Themechanism suggested for improving the quality of the deposit was the increase in nucle-ation overpotential caused by the polarizing effect of the glue. With an increased NOP, the177APPENDIX B. ADDITIVES IN ZINC ELECTROWINNINGdeposit contains a higher amount of small grains, and limits grain growth that would resultin dendrite or nodule formation.Sodium Lauryl Sulfate (SLS)SLS is an additive examined by [136]. It was compared against glue. It was found to haveless of an effect on the NOP and power consumption than glue did. It reached an optimumlevel around 1 mg L−1 where current efficiency reached its highest level at 93.3%. Thiswas compared with glue which reached a maximum current efficiency of 92.2% at 5 mgL−1. The deposits created were shiny and compact at levels of SLS between 1 mg L−1 and20 mg L−1 [136]. SLS was also examined by Recendiz et al., [137]. They found that SLScreated a shiny, but also porous deposit. The current efficiency was maximum at 95% with0.9 mg L−1 SLS.Triethylbenzylammonium Chloride (TEBACl)TEBACl was examined. A maximum current efficiency was reached at 2 mg L−1. Thecurrent efficiency improved from 89% without additives to 92.8% at 2 mg L−1 TEBACl.The rate of decrease in current efficiency as TEBACl is increased was lower than the rateof decrease for glue. TEBACl was seen to decrease grain size with increasing concentra-tion. There was an observed decrease in the screening effect of hydrogen bubbles which isthought to have contributed to the decrease in grain size [138].Quaternary Ammonium Bromides Cetyltrimethylammonium bromide (CTABr) and tetra-butyl ammonium bromide (TBABr) were also investigated as alternatives to standard in-dustrial glue. It was found that both compounds improved current efficiency, with CTABrreaching a maximum of 93% at 1 mg L−1 and TBABr reaching a maximum of 93% at 10mg L−1. Both of these reagents decreased current efficiency at higher concentrations, how-ever CTABr was more detrimental to current efficiency than TBABr. This was attributedto CTABr being a stronger adsorber on to the deposition surface. While both of these were178APPENDIX B. ADDITIVES IN ZINC ELECTROWINNINGsuitable for leveling the zinc surface, it was concluded that CTABr was equivalent to glueand which were both superior to TBABr [139].PyridinesThe pyridines 4-ethylpydridine and 2-cyanopyridine were examined as potential additivesbased on the success of pyridines as corrosion inhibitors. It was hypothesized that sincecorrosion inhibitors act by increasing the NOP during corrosion, a similar increase in NOPduring electrowinning might also improve the deposit quality. The data was comparedwith gum Arabic. 2-cyanopyridine was found to be the least suitable, causing a largeinhibition of zinc deposition. It was suggested that due to the complexing behavior of2-cyanopyridine causing it to adsorb over the entire cathode surface, limiting depositionkinetics. However both pyridines were shown to increase power consumption and decreasecurrent efficiency at similar rates as gum arabic. It was concluded that 4-ethylpyridine wasa suitable additive [140].Organic Additives in Chloride SolutionsWith chloride electrolytes being toted as a potential solution for processing low quality andrecycled zinc sources, additives have been investigated in these solutions as well. Pearlglue, Separan NP10, Percol 140 and tetraalkyammonium chlorides (tetrabutylammoniumchloride (TBACl), tetraethylammonium chloride (TEACl), tetrapentylammonium chloride(TPACl) and tetrapropylammonium chloride (TPrACl)). It was found that better depositquality was achieved with organic additives with longer alky chain length, with TPACl be-ing the best. However TPACl had lower current efficiencies than other additives. TBAClwas suggested as the most suitable organic additive for electrowinning from chloride solu-tions with a current efficiency at 99% with 15 mg L−1 TABCl compared with 91% currentefficiency with no additives.179APPENDIX B. ADDITIVES IN ZINC ELECTROWINNINGB.2 Foaming AdditivesOrganic reagents are also added to act as acid mist suppressors. These operate by creatinga foam layer at the top of the cell in order to trap acid laden bubbles that break the sur-face of the electrolyte [52]. Foaming agents are common in froth floatation during mineralcomminution and it has been noted that foaming agents decrease the bubble size. Smallerbubbles may decrease the resistivity in an electrowinning cell by reducing the fractionalvoidage cover of bubbles on the electrodes. However this has not been tested in electrowin-ning conditions. The foaming agent Dowfroth was used in the Kidd Creek plant, howeverit was observed that it had negative effects on the current efficiency and deposition char-acteristics. It was determined that Dowfroth increased the NOP significantly. Antimonywas added in an effort to improve deposit quality and current efficiency, it was found thattogether they gave a maximum CE, however as more Dowfroth was added, more antimonywas needed to counter-balance it. In general Saponin had no effect on the current efficiency.Saponin gave deposit morphologies that contained smaller more distinct nodules [52]. Asseen above, the effect of foaming agents on electrowinning performance is easily measured,however little regard is given to the foaming characteristics of the additive. Alfantazi andDreisinger [51] developed a test in order to measure the foam profile of any given foam-ing additive which they described as a ini-flotation test.Other methods of acid mist controlwere mentioned such as the floating plastic balls which might capture the acid, or ventinghoods over the tank. These were deemed less practical than simple foaming agents how-ever due to their mechanical interference when removing cathodes. The mini-flotation testconsisted of a glass tube with a porous ceramic frit at the bottom which could pump gasthrough. A measured volume of electrolyte was put in the tube and the additive placedin as well. Saponin, Dowfroth 250, MPC and licorice were all examine in the apparatus.The parameters allowed to vary were the gas flow rate, surfactant concentration, electrolyteacid concentration, temperature, and the type of gas. The gas flow rate was related to thecurrent density, which would be responsible for producing gas in the electrowinning cell.180APPENDIX B. ADDITIVES IN ZINC ELECTROWINNINGEach surfactant examined had different foam profile characteristics; however each reacheda steady state height after going through an initial peak during start up. In a simulation, itwould be important to design a tank with a required height to contain the acid mist foam.The acid concentration also had an effect on the additive. This interacted with each surfac-tant differently, causing higher profiles for lower or higher acid concentrations dependingon the surfactant. Temperature had minimal effect however in general; higher temperatures( 45 ◦C) gave lower foam profiles. The type of gas used was found to have little effect onthe foam profile. These tests provide a useful baseline with which to compare against suit-able surfactant additive rates of addition. However further information would be needed onthe consumption of these over time.Cheng et al., [141] examined the effect of saponins and licorice as foaming agents inzinc electrowinning. It was found that Mistop, QLZinc, and Licorice needed 1.2, 2.5, and14.4 mg L−1 respectively in order to achieve full foam coverage. These results showedthat the saponin based reagents are more surface active than licorice. However licorice wasobserved to achieve full foam coverage much faster than the saponins. The best foamingagents were chosen to be 1.8 ppm Mistop or 3.8 ppm QLZinc because of their long foampersistence times. When the current efficiency was measured, there was a minimal effect.The saponins had a greater effect than the licorice however. In each case the current effi-ciency was decreased slightly. The morphology of the deposit was also slightly affected.The saponins yielded a smooth deposit with few pits at concentrations less than 10 ppm.One problem with foaming additives is they cannot be easily removed from the spent elec-trolyte. Since the spent electrolyte is sent back to solvent extraction, there is concern offoaming additives having an effect on that process as well. It was concluded that effectswere minimal for concentrations of surfactants that were this low.While antimony is typically regarded as one of the most deleterious impurities in a zincelectrolyte it is also shown to lower the zinc nucleation overpotential in cyclic voltometrystudies. However, the presence of antimony and an organic leveler in combination will181APPENDIX B. ADDITIVES IN ZINC ELECTROWINNINGcreate a compact and smooth deposit, and the antimony counteracted the decrease in currentefficiency caused by the organic additive and current efficiencies were observed to increase[136, 140]. A typical concentration of 0.02 to 0.04 mg L−1 of antimony was cited as anideal concentration [47].182APPENDIXCELECTROWINNING CODEThe following lists the code input C++ for the zinc electrowinning cell module. Coderelating to generic functions used in setting up the module for CADSIM Plus have beenreplaced with a descriptor for brevity. This has been noted with a “*” preceding a comment./∗ F i l e : ELECTROWINNING.CPP ∗ //∗ Author ( s ) : MJ. Mahon ∗ /#pragma hdrstop# inc lude ” un i t . h ”/∗ ============================================================= ∗ //∗ Descr ip t ion , Requirements and Recogni t ion ∗ //∗ ============================================================= ∗ /# de f ine kModuleDescr ipt ion ”ELECTROWINNING”/∗ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! DO NOT CHANGE THE FOLLOWING LINE ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ∗ /# de f ine kProgramNumber kProgramAurelCadsimPlus/∗ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ∗ /# de f ine kFi leTag CELL#def ine USE FIXED TIME STEP /∗ ∗ // / # de f ine MATCH LAST TIME STEP /∗ ∗ /# de f ine kPortSPENT kF i r s t Po r t / / Spent E l e c t r o l y t e Por t#de f ine kPortGASES kSecondPort / / Gas Vent Por t#de f ine kPortCATHODES kTh i rdPor t / / Cathode Por t#de f ine kPr iva teContents kF i r s t Po r t / / Ce l l Resident Mass#de f ine kPr iva teReactor kSecondPort / / Reactor Resident Mass183APPENDIX C. ELECTROWINNING CODE#def ine kNewInput kTh i rdPor t / / Incoming Mass#de f ine kNewOutput kFour thPor t / / Outgoing Mass/ / Constants f o r z inc e lec t row inn ings t a t i c const double kFreqFacH = 355;s t a t i c const double kActEnergyH = 48780;s t a t i c const double kAlphaH = 0 .5 ;s t a t i c const double kMassTransConst = 0.00107;s t a t i c const double kH2OEvap = 2.5E−4;s t a t i c const double kTafelAH2O = 0.306;s t a t i c const double kTafelBH2O = 0.146;s t a t i c const double kActH2O = 0 .9 ;s t a t i c const double kActH2 = 1 . 0 ;s t a t i c const double kActO2 = 1 . 0 ;s t a t i c const double kValanceH2O = 2 .0 ;s t a t i c const double kValanceH = 1 .0 ;s t a t i c const double kEH2O = 1.229;s t a t i c const double kEH = 0.00 ;s t a t i c const double kFreqFacZn = 1.51E14 ;s t a t i c const double kActEnergyZn = 57590;s t a t i c const double kAlphaZn = 0 . 4 ;s t a t i c const double kActZn = 1 . 0 ;s t a t i c const double kValanceZn = 2 . 0 ;s t a t i c const double kEZn = −0.763;s t a t i c Qchar kKeywordNames [ ] ={”CELL” ,END OF LIST} ;s t a t i c Qchar kStreamRequirements [ ] ={FLOWNAME,TEMPERATURE NAME,END OF LIST} ;/ / Se t t i ng up names f o r each Free Var iab le and an i n i t i a l value .s t a t i c T NameValue kFreeUni tVar iab leTab le [ ] ={/∗ For ALL cases ∗ /NAME VALUE(VOLUME NAME, 10 .0 ) ,NAME VALUE( ” Current ” , 500) ,184APPENDIX C. ELECTROWINNING CODENAME VALUE( ” NumberOfCathodes ” , 2 ) ,NAME VALUE( ” NumberOfAnodes ” , 2 ) ,NAME VALUE( ” CathodeSurfaceArea ” , 0 .0295) ,NAME VALUE( ” AnodeSurfaceArea ” , 0 .0283) ,/∗ Cathode Set Case ∗ /NAME VALUE( ” Pul l ingCathodes ” , 0 ) ,NAME VALUE( ” CathodePullSetNumber ” , 1 ) ,/∗ Defau l t Case ∗ /NAME VALUE( ” Se tCu r ren tE f f i c i ency ” , 90 .0 ) ,NAME VALUE( ” SetCe l lVo l tage ” , 3 . 0 ) ,/∗ kZinc Case ∗ /NAME VALUE( ” AnodeLength ” , 0 .125) ,NAME VALUE( ” ElectrodeGap ” , 0 .030) ,NAME VALUE( ” ConnectionVoltageLoss ” , 0 . 0 ) ,END OF NAMES VALUES} ;enum E FreeVarIndex/ / ∗Se t t i ng up Free Var iab le Ind ices/ / Se t t i ng up names f o r each ca l cu la ted va r i ab l es t a t i c Qchar kCalcVar iab les [ ] ={{ ” TotalCathodeArea ” } ,{ ” CurrentDens i ty ” } ,{ ” EnergyConsumption ” } ,{ ” RetentionTime ” } ,END OF LIST} ;enum E CalcVarIndex/ / ∗Se t t i ng up Calcuated Var iab le i nd i cesenum E Out le t Index/ / ∗Se t t i ng up Ou t le t Var iab le i nd i cess t r u c t T Qua l i t y I nd i ces/∗ T Qua l i t y I nd i ces ∗ /PointerTypes ( T Qua l i t y I nd i ces ) ;enum E Metal Index/ / ∗ se t t i n g metal indexenum E E lec t r o l y t e I ndex/ / ∗ se t t i n g anion indexenum E React ionIndex/ / ∗ se t t i n g reac t i on index185APPENDIX C. ELECTROWINNING CODEs t a t i c const T Size kMax I te ra t ions = 3;s t a t i c E Out le t Index gWhichType ;s t a t i c T Index gIndex ;Beg in p r i va te da ta ( kFi leTag ) bool f i r s t T ime ;/ /∗ dec la r i ng p r i v a t e va r i ab l esEnd pr i va te da ta ( kFi leTag )S tanda rd un i t desc r i p t i on( kFi leTag , /∗ source f i l e name ∗ /kProgramNumber , /∗ program number ∗ /kModuleDescr ipt ion , /∗ module desc r i p t i o n ∗ /kKeywordNames , /∗ module keywords ∗ /kFreeUni tVar iab leTable , /∗ names of u n i t f r ee va r i ab l es / de f au l t values ∗ /kCalcVar iables , /∗ names of u n i t ca lc va r i ab l es ∗ /kStreamRequirements , /∗ names of requ i red va r i ab l es ∗ /kQua l i f i e r s , /∗ names of u n i t q u a l i f i e r s ∗ /kREACTOR, /∗ what k ind o f u n i t ∗ / / / ??1 , /∗ minimum number o f i npu ts ∗ /1 , /∗ maximum number o f i npu ts ∗ /3 , /∗ minimum number o f outputs ∗ /3 , /∗ maximum number o f outputs ∗ /f a l se , /∗ supports mu l t i p l e stream de f i n i t i o n s on i n l e t s ∗ /f a l se , /∗ supports mu l t i p l e stream de f i n i t i o n s on ou t l e t s ∗ /f a l se , /∗ i npu t streams have spec ia l names ∗ /t rue , /∗ output streams have spec ia l names ∗ /f a l se , /∗ s p l i t r a t i o s al lowed ∗ /f a l se , /∗ a u x i l i a r y va r i ab l es are normal ∗ /t rue , /∗ number o f f r ee un i t va r i ab l es va r i es ∗ /f a l se , /∗ can pass networked f lows ∗ /f a l se , /∗ supports mu l t i p l e networks ∗ /kPopup standard ) /∗ k ind o f u n i t pop−up ∗ /# de f ine kDomainThreshold 1.0e−7#def ine kRangeThreshold 1.0e−10s t r u c t T CurrentData/ / ∗Declar ing va r i ab l es f o r DoSolveCurrent Funct ions t r u c t T GammaData/ / ∗Declar ing va r i ab l es f o r DoSolveGamma Funct ions t r u c t T BubbleData/ / ∗Declar ing va r i ab l es f o r DoSolveBubble Funct ionPointerTypes ( T CurrentData ) ;PointerTypes (T GammaData ) ;186APPENDIX C. ELECTROWINNING CODEPointerTypes ( T BubbleData ) ;/∗ ============================================================= ∗ //∗ Local f unc t i ons ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− doSolveCurrent −−−−−−−−−−−−−−−−−−−−−−−− ∗ //∗ Solves Voltage f o r a user set cu r ren t dens i t y ∗ /s t a t i c Use rFunc t i on de f i n i t i o n ( doSolveCurrent ){double ECathode , iH , VH2, massTransferCoef f i c ien t , iZn lc , alpha , beta , iZn ;double iC , f1 ;T CurrentData & data = ∗Rein te rp re tCas t ( PT CurrentData , s t u f f ) ;Qvoid who = data .who ;ECathode = value ;iH = data . iHo ∗ exp(−(ECathode − data .EH) ∗ kAlphaH ∗ 1.0 ∗ kFaraday / (kR /kThousand ) / ( data . solTempK ) ) ;i f ( iH > data . cu r ren tDens i t y )iH = data . cu r ren tDens i t y ;data . rateH2 = iH ∗ data . to tCatArea / 2.0 / kFaraday ;VH2 = data . rateH2 / data . to tCatArea ∗ ( kR / kThousand ) ∗ ( data . solTempK ) /data . pressure / kThousand ;massTrans fe rCoef f i c ien t = data . MassTrans ∗ pow(VH2, 0 . 45 ) ;i Zn l c = massTrans fe rCoef f i c ien t ∗ 2.0 ∗ kFaraday ∗ data . concZnSO4 ∗ 1000;i f ( i Zn l c == 0 .0 )i Zn l c = kZeroWannaBe ;alpha = exp(−(ECathode − data .EZn) ∗ kAlphaZn ∗ 2.0 ∗ kFaraday / (kR /kThousand ) / ( data . solTempK ) ) ;beta = exp ( ( ECathode − data .EZn) ∗ ( 1 .0 − kAlphaZn ) ∗ 2.0 ∗ kFaraday / (kR /kThousand ) / ( data . solTempK ) ) ;iZn = ( data . iZno ∗ i Z n l c ∗ ( alpha − beta ) ) / ( 1 .0 + ( alpha ∗ data . iZno ) ) ;iC = iZn + iH ;data . iZn = iZn ;data . iH = iH ;f1 = ( data . iH2O ∗ data . totAnArea ) − ( iC ∗ data . to tCatArea ) ;data . iC = iC ;data . ECathode = ECathode ;r e t u rn f1 ;} /∗ doSolveCurrent ∗ /PointerTypes ( T CurrentData ) ;/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− doSolveGamma −−−−−−−−−−−−−−−−−−−−−−−−−− ∗ /187APPENDIX C. ELECTROWINNING CODE/∗ Solves A c t i v i t y Coe f f i c i e n t s (gamma) f o r Zinc e l e c t r o l y t e s ∗ /s t a t i c Use rFunc t i on de f i n i t i o n (doSolveGamma){i n t i , j ;double AOsmCoef , KSO4, numbCations , numbAnions , x , y , z , ionSt r , numbIons ;double CZnSO4, BZnSO4, CZnHSO4, BZnHSO4, BZnHSO4P, xHZn , JxHZn , JxHZnP ;double xHH, JxHH , JxHHP, JxZnZn , JxZnZnP , thetaHZn , thetaHZnP , BZnSO4P, F , Z ;double CHSO4, BHSO4, BHSO4P, CHHSO4, BHHSO4, BHHSO4P, xSO4HSO4, xSO4SO4;double JxSO4HSO4, JxSO4HSO4P, JxSO4SO4, JxSO4SO4P, JxHSO4HSO4, JxHSO4HSO4P;double thetaSO4HSO4 , thetaSO4HSO4P , PsiZnH , gammaSO4Ion , gammaHSO4Ion , f1 ;double gammaZnIon , gammaHIon , step , PsiSO4HSO4 , xZnZn , xHSO4HSO4;/ / Ion ar ray order : Zn2+ , SO4 2−, H+ , HSO4−double molal [ 4 ] ;double ca t i on [ 2 ] , anion [ 2 ] ; / / [ Zn2+ ] , [H+] & [SO4 2−] , [HSO4−]double charge [ 4 ] = {2 , −2, 1 , −1};double BP [ 2 ] [ 2 ] , B [ 2 ] [ 2 ] , C [ 2 ] [ 2 ] ;T GammaData & data = ∗Rein te rp re tCas t (PT GammaData , s t u f f ) ;Qvoid who = data .who ;/ / P i t z e r Parameters , B( 0 ) , B( 1 ) , B( 2 ) , C, Psidouble PitZnSO4 [ 5 ] = {1.280 − 0.00366 ∗ data . solTempK , −4.077 + 0.0233 ∗data . solTempK , 32.817 − 0.333 ∗ data . solTempK , −1.151 +0.00397 ∗ data . solTempK , 0 .0} ;/ / double PitZnSO4 [ 5 ] = {−0.270314, 3.548866 , −37.1077765, 0.0376478 , 0} ;double PitZnHSO4 [ 5 ] = {0.439 , 1.811 , 0 , 0.0397 , 0 .0} ;double PitHSO4 [ 5 ] = {0.1131042 , −0.7672550, 0 .0 , −0.0076309, 0 .0} ;double PitHHSO4 [ 5 ] = {0.2246349 , 0.7102037 , 0 .0 , −0.0040052, 0 .0} ;AOsmCoef = 0.377 + 0.0004684 ∗ ( data . solTempK − kOf f se tKe l v i n ) + 0.00000374 ∗pow( data . solTempK − kOf fse tKe lv in , 2 ) ;KSO4 = 562.69486 − 102.5154 ∗ l og ( data . solTempK ) − 0.0001117033 ∗ pow( data . solTempK , 2) + 0.2477538 ∗ data . solTempK − 13273.75 /data . solTempK ;KSO4 = pow(10 , KSO4) ;x = data . x ;z = data . z ;numbCations = 2 . 0 ;numbAnions = 2 . 0 ;/ / ca t i on [ Zn , H]ca t i on [ 0 ] = z ;ca t i on [ 1 ] = value ;y = pow ( ( x + z + KSO4) , 2 ) − 4.0 ∗ 1.0 ∗ ( x ∗ z − KSO4 ∗ x ) ;y = (−(x + z + KSO4) + sq r t ( y ) ) / 2 . 0 ;188APPENDIX C. ELECTROWINNING CODE/ / anion [SO4, HSO4]anion [ 0 ] = 2.0 ∗ x − value ;anion [ 1 ] = z − x + value ;i f ( anion [ 0 ] <= 0 .0 )anion [ 0 ] = kZeroWannaBe ;i f ( anion [ 1 ] <= 0 .0 )anion [ 1 ] = kZeroWannaBe ;/ / molal [ ] = [ Zn2+ , SO4 2−, H+ , HSO4−]molal [ 0 ] = z ;molal [ 1 ] = value ;molal [ 2 ] = 2.0 ∗ x − value ;molal [ 3 ] = z − x + value ;anion [ 1 ] = z − x + value ;i onS t r = 0 . 0 ;numbIons = 4 . 0 ;f o r ( i = 0 ; i + 1 <= numbIons ; ++ i ){i onS t r += ( molal [ i ] ∗ pow( charge [ i ] , 2 ) ) ;}i onS t r /= 2 . 0 ;i f ( i onS t r < 0 .0 )i onS t r = kZeroWannaBe ;/ / Zn − SO4BZnSO4 = PitZnSO4 [ 0 ] + PitZnSO4 [ 1 ] ∗ ( 2 .0 ∗ ( 1 .0 − ( 1 .0 + 1.4 ∗sq r t ( i onS t r ) ) ∗ exp(−1.4 ∗ sq r t ( i onS t r ) ) ) / pow ( ( 1 . 4 ∗sq r t ( i onS t r ) ) , 2 . 0 ) ) + PitZnSO4 [ 2 ] ∗ ( 2 .0 ∗ ( 1 .0 − ( 1 .0 + 12 ∗sq r t ( i onS t r ) ) ∗ exp(−12.0 ∗ sq r t ( i onS t r ) ) ) /pow( (12 .0 ∗ sq r t ( i onS t r ) ) , 2 . 0 ) ) ;BZnSO4P = ( PitZnSO4 [ 1 ] ∗ ( exp(−1.4 ∗ sq r t ( i onS t r ) )− (2.0 ∗( 1 .0 − ( 1 .0 + 1.4 ∗ sq r t ( i onS t r ) ) ∗ exp(−1.4 ∗ sq r t ( i onS t r ) ) ) /pow ( ( 1 . 4 ∗ sq r t ( i onS t r ) ) , 2 . 0 ) ) ) + PitZnSO4 [ 2 ] ∗( exp(−12.0 ∗ sq r t ( i onS t r ) )− (2.0 ∗ ( 1 .0 − ( 1 .0 + 12.0 ∗sq r t ( i onS t r ) ) ∗ exp(−12.0 ∗ sq r t ( i onS t r ) ) ) / pow( (12 .0 ∗sq r t ( i onS t r ) ) , 2 . 0 ) ) ) ) / i onS t r ;CZnSO4 = PitZnSO4 [ 3 ] / ( 2 .0 ∗ sq r t ( 2 .0 ∗ 2 . 0 ) ) ;/ / Zn − HSO4BZnHSO4 = PitZnHSO4 [ 0 ] + PitZnHSO4 [ 1 ] ∗ ( 2 .0 ∗ ( 1 .0 − ( 1 .0 + 1.4 ∗sq r t ( i onS t r ) ) ∗ exp(−1.4 ∗ sq r t ( i onS t r ) ) ) / pow ( ( 1 . 4 ∗sq r t ( i onS t r ) ) , 2 . 0 ) ) + PitZnHSO4 [ 2 ] ∗ ( 2 .0 ∗ ( 1 .0 − ( 1 .0 + 12.0 ∗sq r t ( i onS t r ) ) ∗ exp(−12.0 ∗ sq r t ( i onS t r ) ) ) / pow( (12 .0 ∗sq r t ( i onS t r ) ) , 2 . 0 ) ) ;189APPENDIX C. ELECTROWINNING CODEBZnHSO4P = (PitZnHSO4 [ 1 ] ∗ ( exp(−1.4 ∗ sq r t ( i onS t r ) )− (2.0 ∗( 1 .0 − ( 1 .0 + 1.4 ∗ sq r t ( i onS t r ) ) ∗ exp(−1.4 ∗ sq r t ( i onS t r ) ) ) /pow ( ( 1 . 4 ∗ sq r t ( i onS t r ) ) , 2 . 0 ) ) ) + PitZnHSO4 [ 2 ] ∗( exp(−12.0 ∗ sq r t ( i onS t r ) )− (2.0 ∗ ( 1 .0 − ( 1 .0 + 12.0 ∗ sq r t ( i onS t r ) )∗ exp(−12.0 ∗ sq r t ( i onS t r ) ) ) / pow( (12 .0 ∗ sq r t ( i onS t r ) ) , 2 . 0 ) ) ) ) /i onS t r ;CZnHSO4 = PitZnHSO4 [ 3 ] / ( 2 .0 ∗ sq r t ( 2 .0 ∗ 2 . 0 ) ) ;/ / H − SO4BHSO4 = PitHSO4 [ 0 ] + PitHSO4 [ 1 ] ∗ ( 2 .0 ∗ ( 1 .0 − ( 1 .0 + 1.4 ∗ sq r t ( i onS t r ) ) ∗exp(−1.4 ∗ sq r t ( i onS t r ) ) ) / pow ( ( 1 . 4 ∗ sq r t ( i onS t r ) ) , 2 . 0 ) ) +PitHSO4 [ 2 ] ∗ ( 2 .0 ∗ ( 1 .0 − ( 1 .0 + 12.0 ∗ sq r t ( i onS t r ) ) ∗ exp(−12.0 ∗sq r t ( i onS t r ) ) ) / pow( (12 .0 ∗ sq r t ( i onS t r ) ) , 2 . 0 ) ) ;BHSO4P = ( PitHSO4 [ 1 ] ∗ ( exp(−1.4 ∗ sq r t ( i onS t r ) )− (2.0 ∗( 1 .0 − ( 1 .0 + 1.4 ∗ sq r t ( i onS t r ) ) ∗ exp(−1.4 ∗ sq r t ( i onS t r ) ) ) /pow ( ( 1 . 4 ∗ sq r t ( i onS t r ) ) , 2 . 0 ) ) ) + PitHSO4 [ 2 ] ∗( exp(−12.0 ∗ sq r t ( i onS t r ) )− (2.0 ∗ ( 1 .0 − ( 1 .0 + 12 ∗ sq r t ( i onS t r ) )∗ exp(−12.0 ∗ sq r t ( i onS t r ) ) ) / pow( (12 .0 ∗ sq r t ( i onS t r ) ) , 2 . 0 ) ) ) ) /i onS t r ;CHSO4 = PitHSO4 [ 3 ] / ( 2 .0 ∗ sq r t ( 2 .0 ∗ 2 . 0 ) ) ;/ / H − HSO4BHHSO4 = PitHHSO4 [ 0 ] + PitHHSO4 [ 1 ] ∗ ( 2 .0 ∗ ( 1 .0 − ( 1 .0 + 1.4 ∗sq r t ( i onS t r ) ) ∗ exp(−1.4 ∗ sq r t ( i onS t r ) ) ) / pow ( ( 1 . 4 ∗sq r t ( i onS t r ) ) , 2 . 0 ) ) + PitHHSO4 [ 2 ] ∗ ( 2 .0 ∗ ( 1 .0 − ( 1 .0 + 12.0 ∗sq r t ( i onS t r ) ) ∗ exp(−12.0 ∗ sq r t ( i onS t r ) ) ) / pow( (12 .0 ∗sq r t ( i onS t r ) ) , 2 . 0 ) ) ;BHHSO4P = (PitHHSO4 [ 1 ] ∗ ( exp(−1.4 ∗ sq r t ( i onS t r ) )− (2.0 ∗( 1 .0 − ( 1 .0 + 1.4 ∗ sq r t ( i onS t r ) ) ∗ exp(−1.4 ∗ sq r t ( i onS t r ) ) ) /pow ( ( 1 . 4 ∗ sq r t ( i onS t r ) ) , 2 . 0 ) ) ) + PitHHSO4 [ 2 ] ∗( exp(−12.0 ∗ sq r t ( i onS t r ) )− (2.0 ∗ ( 1 .0 − ( 1 .0 + 12.0 ∗ sq r t ( i onS t r ) )∗ exp(−12.0 ∗ sq r t ( i onS t r ) ) ) / pow( (12 .0 ∗ sq r t ( i onS t r ) ) , 2 . 0 ) ) ) ) /i onS t r ;CHHSO4 = PitHHSO4 [ 3 ] / ( 2 .0 ∗ sq r t ( 2 .0 ∗ 2 . 0 ) ) ;xHZn = 6.0 ∗ 1.0 ∗ 2.0 ∗ AOsmCoef ∗ sq r t ( i onS t r ) ;xHH = 6.0 ∗ 1.0 ∗ 1.0 ∗ AOsmCoef ∗ sq r t ( i onS t r ) ;xZnZn = 6.0 ∗ 2.0 ∗ 2.0 ∗ AOsmCoef ∗ sq r t ( i onS t r ) ;JxHZn = xHZn / (4 .0 + 4.581 ∗ pow(xHZn , −0.7237) ∗ exp(−0.012 ∗ xHZn ∗0 . 528 ) ) ;step = 0.0001 ∗ xHZn ;xHZn += step ;JxHZnP = xHZn / (4 .0 + 4.581 ∗ pow(xHZn , −0.7237) ∗ exp(−0.012 ∗ xHZn ∗0 . 528 ) ) ;190APPENDIX C. ELECTROWINNING CODExHZn −= step ;JxHZnP = (JxHZnP − JxHZn ) / ( step ) ;JxHH = xHH / (4 .0 + 4.581 ∗ pow(xHH, −0.7237) ∗ exp(−0.012 ∗ xHH ∗ 0 . 528 ) ) ;step = 0.0001 ∗ xHH;xHH += step ;JxHHP = xHH / (4 .0 + 4.581 ∗ pow(xHH, −0.7237) ∗ exp(−0.012 ∗ xHH ∗ 0 . 528 ) ) ;xHH −= step ;JxHHP = (JxHHP − JxHH) / ( step ) ;JxZnZn = xZnZn / (4 .0 + 4.581 ∗ pow( xZnZn , −0.7237) ∗ exp(−0.012 ∗ xZnZn ∗0 . 528 ) ) ;step = 0.0001 ∗ xZnZn ;xZnZn += step ;JxZnZnP = xZnZn / (4 .0 + 4.581 ∗ pow( xZnZn , −0.7237) ∗ exp(−0.012 ∗ xZnZn ∗0 . 528 ) ) ;xZnZn −=step ;JxZnZnP = ( JxZnZnP − JxZnZn ) / ( step ) ;thetaHZn = (1 .0 ∗ 2 .0 ) / ( 4 .0 ∗ i onS t r ) ∗ ( JxHZn − 0.5 ∗ JxHH − 0.5 ∗JxZnZn ) ;thetaHZnP = −thetaHZn / i onS t r + ( ( 1 . 0 ∗ 2 .0 ) / ( 8 .0 ∗ pow( ionSt r , 2 . 0 ) ) ∗( xHZn ∗ JxHZnP − 0.5 ∗ xHH ∗ JxHHP − 0.5 ∗ xZnZn ∗ JxZnZnP ) ) ;xSO4HSO4 = 6.0 ∗ 2.0 ∗ 1.0 ∗ AOsmCoef ∗ sq r t ( i onS t r ) ;xSO4SO4 = 6.0 ∗ 2.0 ∗ 2.0 ∗ AOsmCoef ∗ sq r t ( i onS t r ) ;xHSO4HSO4 = 6.0 ∗ 1.0 ∗ 1.0 ∗ AOsmCoef ∗ sq r t ( i onS t r ) ;JxSO4HSO4 = xSO4HSO4 / (4 .0 + 4.581 ∗ pow(xSO4HSO4, −0.7237) ∗ exp(−0.012 ∗xSO4HSO4 ∗ 0 . 528 ) ) ;step = 0.0001 ∗ xSO4HSO4;xSO4HSO4 += step ;JxSO4HSO4P = xSO4HSO4 / (4 .0 + 4.581 ∗ pow(xSO4HSO4, −0.7237) ∗ exp(−0.012 ∗xSO4HSO4 ∗ 0 . 528 ) ) ;xSO4HSO4 −= step ;JxSO4HSO4P = (JxSO4HSO4P − JxSO4HSO4) / ( step ) ;JxSO4SO4 = xSO4SO4 / (4 .0 + 4.581 ∗ pow(xSO4SO4, −0.7237) ∗ exp(−0.012 ∗xSO4SO4 ∗ 0 . 528 ) ) ;step = 0.0001 ∗ xSO4SO4;xSO4SO4 += step ;JxSO4SO4P = xSO4SO4 / (4 .0 + 4.581 ∗ pow(xSO4SO4, −0.7237) ∗ exp(−0.012 ∗xSO4SO4 ∗ 0 . 528 ) ) ;xSO4SO4 −= step ;JxSO4SO4P = (JxSO4SO4P − JxSO4SO4) / ( step ) ;JxHSO4HSO4 = xHSO4HSO4 / (4 .0 + 4.581 ∗ pow(xHSO4HSO4, −0.7237) ∗exp(−0.012 ∗ xHSO4HSO4 ∗ 0 . 528 ) ) ;191APPENDIX C. ELECTROWINNING CODEstep = 0.0001 ∗ xHSO4HSO4;xHSO4HSO4 += step ;JxHSO4HSO4P = xHSO4HSO4 / (4 .0 + 4.581 ∗ pow(xHSO4HSO4, −0.7237) ∗exp(−0.012 ∗ xHSO4HSO4 ∗ 0 . 528 ) ) ;xHSO4HSO4 −=step ;JxHSO4HSO4P = (JxHSO4HSO4P − JxHSO4HSO4) / ( step ) ;thetaSO4HSO4 = (1 .0 ∗ 2 .0 ) / ( 4 .0 ∗ i onS t r ) ∗ ( JxHZn − 0.5 ∗ JxHH − 0.5 ∗JxZnZn ) ;thetaSO4HSO4P = −thetaSO4HSO4 / i onS t r + ( ( 1 . 0 ∗ 2 .0 ) / ( 8 .0 ∗pow( ionSt r , 2 . 0 ) ) ∗ ( xHZn ∗ JxSO4HSO4P − 0.5 ∗ xHH ∗JxHHP − 0.5 ∗ xZnZn ∗ JxZnZnP ) ) ;BP [ 0 ] [ 0 ] = BZnSO4P;BP [ 0 ] [ 1 ] = BZnHSO4P;BP [ 1 ] [ 0 ] = BHSO4P;BP [ 1 ] [ 1 ] = BHHSO4P;B [ 0 ] [ 0 ] = BZnSO4;B [ 0 ] [ 1 ] = BZnHSO4;B [ 1 ] [ 0 ] = BHSO4;B [ 1 ] [ 1 ] = BHHSO4;C [ 0 ] [ 0 ] = CZnSO4;C [ 0 ] [ 1 ] = CZnHSO4;C [ 1 ] [ 0 ] = CHSO4;C [ 1 ] [ 1 ] = CHHSO4;PsiZnH = thetaHZn + thetaHZnP ;PsiSO4HSO4 = thetaSO4HSO4 + thetaSO4HSO4P − 0.0857672;/ /Gamma ZnF = 0 .0 ;f o r ( i = 0 ; i + 1 <= numbCations ; ++ i ){f o r ( j = 0 ; j + 1 <= numbAnions ; ++ j ){F += ca t i on [ i ] ∗ anion [ j ] ∗ BP[ i ] [ j ] ;}}F += ca t i on [ 0 ] ∗ ca t i on [ 1 ] ∗ thetaHZnP ;F += anion [ 0 ] ∗ anion [ 1 ] ∗ thetaSO4HSO4P ;F += −AOsmCoef ∗ ( s q r t ( i onS t r ) / ( 1 .0 + 1.2 ∗ sq r t ( i onS t r ) ) + 2.0 / 1.2 ∗l og (1 .0 + 1.2 ∗ sq r t ( i onS t r ) ) ) ;Z = ca t i on [ 0 ] ∗ 2.0 + ca t i on [ 1 ] ∗ 1.0 + anion [ 0 ] ∗ 2.0 + anion [ 1 ] ∗ 1 . 0 ;gammaZnIon = 0 . 0 ;gammaZnIon = 4.0 ∗ F ;192APPENDIX C. ELECTROWINNING CODEf o r ( j = 0 ; j + 1 <= numbAnions ; ++ j ){gammaZnIon += anion [ j ] ∗ ( 2 .0 ∗ B [ 0 ] [ j ] + Z ∗ C[ 0 ] [ j ] ) ;}gammaZnIon += ca t i on [ 1 ] ∗ ( 2 .0 ∗ PsiZnH ) ;gammaZnIon += ca t i on [ 0 ] ∗ ( ca t i on [ 1 ] ∗ anion [ 0 ] ∗ C[ 1 ] [ 0 ] + ca t i on [ 1 ] ∗anion [ 1 ] ∗ C [ 1 ] [ 1 ] ) ;gammaZnIon = exp (gammaZnIon ) ;/ / Gamma HgammaHIon = 0 .0 ;gammaHIon = F ;f o r ( j = 0 ; j + 1 <= numbAnions ; ++ j ){gammaHIon += anion [ j ] ∗ ( 2 .0 ∗ B [ 1 ] [ j ] + Z ∗ C[ 1 ] [ j ] ) ;}gammaHIon += ca t i on [ 0 ] ∗ ( 2 .0 ∗ PsiZnH ) ;gammaHIon += ca t i on [ 1 ] ∗ ( ca t i on [ 0 ] ∗ anion [ 0 ] ∗ C[ 0 ] [ 0 ] + ca t i on [ 0 ] ∗anion [ 1 ] ∗ C [ 0 ] [ 1 ] ) ;gammaHIon = exp (gammaHIon ) ;/ / Gamma SO4gammaSO4Ion = 4.0 ∗ F ;f o r ( i = 0 ; i + 1 <= numbAnions ; ++ i ){gammaSO4Ion += ca t i on [ i ] ∗ ( 2 .0 ∗ B[ i ] [ 0 ] + Z ∗ C[ i ] [ 0 ] ) ;}gammaSO4Ion += anion [ 1 ] ∗ ( 2 .0 ∗ PsiSO4HSO4 ) ;gammaSO4Ion += anion [ 0 ] ∗ ( ca t i on [ 0 ] ∗ anion [ 1 ] ∗ C[ 0 ] [ 1 ] + ca t i on [ 1 ] ∗anion [ 1 ] ∗ C [ 1 ] [ 1 ] ) ;gammaSO4Ion = exp (gammaSO4Ion ) ;/ / Gamma HSO4gammaHSO4Ion = 4.0 ∗ F ;f o r ( i = 0 ; i + 1 <= numbAnions ; ++ i ){gammaHSO4Ion += ca t i on [ i ] ∗ ( 2 .0 ∗ B[ i ] [ 1 ] + Z ∗ C[ i ] [ 1 ] ) ;}gammaHSO4Ion += anion [ 0 ] ∗ ( 2 .0 ∗ PsiSO4HSO4 ) ;gammaHSO4Ion += anion [ 1 ] ∗ ( ca t i on [ 0 ] ∗ anion [ 0 ] ∗ C[ 0 ] [ 0 ] + ca t i on [ 1 ] ∗anion [ 0 ] ∗ C [ 1 ] [ 0 ] ) ;gammaHSO4Ion = exp (gammaHSO4Ion ) ;f1 = KSO4 − ( ca t i on [ 1 ] ∗ gammaHIon) ∗ ( anion [ 0 ] ∗ gammaSO4Ion) /( anion [ 1 ] ∗ gammaHSO4Ion ) ;193APPENDIX C. ELECTROWINNING CODEdata . y = y ;data . gammaZnIon = gammaZnIon ;data . gammaHIon = gammaHIon ;data . gammaHSO4Ion = gammaHSO4Ion ;data . gammaSO4Ion = gammaSO4Ion ;step = gammaHIon ∗ gammaSO4Ion / gammaHSO4Ion ;data . gammaValue = value ;r e t u rn f1 ;} /∗ doSolveGamma ∗ /PointerTypes (T GammaData ) ;/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− doSolveBubbles −−−−−−−−−−−−−−−−−−−−−−−− ∗ //∗ Solves r e s i s t i v i t y increase due to bubbles a t the anode ∗ /s t a t i c Use rFunc t i on de f i n i t i o n ( doSolveBubbles ){double usw , ug , f1 ;T BubbleData & data = ∗Rein te rp re tCas t ( PT BubbleData , s t u f f ) ;Qvoid who = data .who ;ug = ( data .VO2) / data . crossSect ion ;i f ( ug <= 0 .0 )ug = kZeroWannaBe ;usw = data . us ∗ (pow( ( 1 − data . eg ) , 2 ) ) / (1 − (pow( data . eg , 5 / 3 ) ) ) ;data . eg = data .em / (1 + ( ( data . u l 0 ∗ ( ( data .em − value ) / ( 1 − value ) ) +data .em ∗ usw ∗ value / data .em) / ug ) ) ;f1 = data . eg − value ;r e t u rn f1 ;}/∗ doSolveBubbles ∗ // / PointerTypes ( T BubbleData ) ;/∗ ============================================================= ∗ //∗ Creat ion ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− SetUp −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ∗ /S tandard SetUp funct ion/∗ ============================================================= ∗ //∗ Uni t Matching ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetInputDefaultName −−−−−−−−−−−−−−−−−−−− ∗ /Standard Get InputDefau l tName funct ion/ / Looking f o r names on inpu ts .194APPENDIX C. ELECTROWINNING CODE/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetOutputDefaultName −−−−−−−−−−−−−−−−−−− ∗ /GetOutputDefaul tName funct ion/ / The module needs to know which o u t l e t i s f o r the Vent , Cathodes and E l e c t r o l y t e{/ / Note t ha t t h i s module does not f o l l ow the naming convent ion f o r new/ / modules − the l a s t output stream has a mandatory name, ra t he r than/ / having the mandatory streams be the f i r s t streams .RecognizeAllArguments ( GetOutputDefaultName )i f ( ( which − kF i r s t Po r t ) >= numbOut )r e t u rn NULL ;i f ( which == kPortGASES ){∗ i sRequi red = kNameMandatory ;r e t u rn ”GASES” ;}i f ( which == kPortCATHODES){∗ i sRequi red = kNameMandatory ;r e t u rn ”CATHODES” ;}∗ i sRequi red = kNameDefault ;s t r cpy ( gTempBuff , OUT NAME) ;s t r c a t ( gTempBuff , Str ingFromIndex (NULL, 0 , which + 1 − kF i r s t Po r t ) ) ;r e t u rn gTempBuff ;} /∗ GetOutputDefaultName ∗ //∗ ============================================================= ∗ //∗ I n i t i a l i z a t i o n ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− PrepareForSpec i f i ca t ions −−−−−−−−−−−−−−− ∗ /S tanda rd Prepa reForSpec i f i ca t i ons func t i on/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− PrepareGetUni tFreeInfo −−−−−−−−−−−−−−−−− ∗ /P repareGetUn i tF ree In fo func t ion/ / Co l l e c t i ng which f ree va r i ab l es to ask the user f o r ( e . g . volume , e lec t rode areas ){Pchar va lueS t r i ng ;T Size count = 8 ; / / 8 f o r de fau l t , +2 f o r cathode sets , +1 f o r kZincRecognizeAllArguments ( PrepareGetUni tFreeInfo )i f ( verbose )195APPENDIX C. ELECTROWINNING CODEP r i n t S e l f (”− prepar ing to get u n i t f r ee i n f o f o r ” , ” −\n ” ) ;l oca l−>numCells = 1 ;/∗ Looking f o r ” P a r a l l e l Ce l l s . ” Ce l l s using the same feed , s p l i t evenlyamongst them a l l . The un i t w i l l d i v i de the i npu t streams by t h i s number ,perform ca l c u l a t i o n s as i f i t were a s i ng l e ce l l , then mu l t i p l y ther e s u l t i n g output streams by t h i s number again . ∗ /va lueS t r i ng = GetCopyOfKeywordValueFromUnitName ( ”CELLS ” ) ;i f ( va lueS t r i ng ){l o ca l−>numCells = s t r t o l ( va lueSt r ing , NULL, 10 ) ;i f ( l oca l−>numCells < 1)l oca l−>numCells = 1 ;FreeMemory ( va lueS t r i ng ) ;}l o ca l−>temperatureIndex = GetInputTemperatureIndex ( kF i r s t Po r t ) ;l oca l−>metal = kCopper ; / / d e f au l t case/∗ I d e n t i f y i n g what metal i s being e lec t rodepos i t ed ∗ /va lueS t r i ng = GetCopyOfKeywordValueFromUnitName ( ”METAL ” ) ;/ / ∗Choosing metal indexloca l−>e l e c t r o l y t e = kSulphate ; / / d e f au l tl oca l−>HMetalIon = 64770.0; / / Cu Defau l t/∗ I d e n t i f y i n g the i o n i c environment used ∗ /va lueS t r i ng = GetCopyOfKeywordValueFromUnitName ( ”ELECTROLYTE ” ) ;/ / ∗Choosing anion indexloca l−>cathodeSets = 0;/∗ I d e n t i f i e s how many sets o f cathodes there are . One set can be pu l l eda t a t ime . ∗ /va lueS t r i ng = GetCopyOfKeywordValueFromUnitName ( ” CathodeSets ” ) ;i f ( va lueS t r i ng ){count += 2;l oca l−>cathodeSets = s t r t o l ( va lueSt r ing , NULL, 10 ) ;i f ( l oca l−>cathodeSets < 1)l oca l−>cathodeSets = 1;FreeMemory ( va lueS t r i ng ) ;}gWhichType = kVolume ;re t u rn count ;} /∗ PrepareGetUni tFreeInfo ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetNextUni tFreeInfo −−−−−−−−−−−−−−−−−−−− ∗ /Ge tNex tUn i tF ree In fo func t i on196APPENDIX C. ELECTROWINNING CODE/ / ∗Co l l e c t i ng names of Free and Calcu la ted Var iab les/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− PrepareGetDeferredVarInfo −−−−−−−−−−−−−− ∗ /P repareGetDefer redVar In fo func t ion/ / ∗Prepar ing defer red va r i ab l es ( e . g . d i f f e r e n t number o f Free Var iab les )/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetNextDeferredVarInfo −−−−−−−−−−−−−−−−− ∗ /GetNex tDefe r redVar In fo func t ion/ / ∗Set up ind i ces o f defer red va r i ab l es/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− I n i t i a l i z e −−−−−−−−−−−−−−−−−−−−−−−−−−−−− ∗ /I n i t i a l i z e f u n c t i o n/∗ I n i t i a l i z i n g the c e l l w i th a s t a r t i n g mass , energy and amount o f cathode ∗ /{Pdouble compMassPtr ;Pdouble cathSetMassPtr ;QT ComponentInfo compInfo ;T Index compCount , index ;T Size setCount ;T Environment env ;RecognizeAllArguments ( I n i t i a l i z e )i f ( verbose )P r i n t S e l f (”− i n i t i a l i z i n g ” , ” −\n ” ) ;/ / ∗Looking a t the metal and anion index , and making sure appropr ia te/ / components are present to suppor t t ha t choice . W i l l g ive an e r r o r/ / i f no ZnSO4 i s i n the e l e c t r o l y t e f o r example .swi tch ( l oca l−>metal )swi tch ( l oca l−>e l e c t r o l y t e )/∗ Use our p r i v a t e f i e l d va r i ab l es as ind i ces f o r the ∗ //∗ Get Inpu tVar iab le ( ) f unc t i on . A l t e r n a t i v e l y , i f IsDer ived ( ) i s t rue , ∗ //∗ use Get Inpu tVar iab le ( ) index d i r e c t l y o f f the vec to r inData i f ∗ //∗ I sDer ived ( ) i s f a l s e . Note t ha t the ind i ces are one h igher than ∗ //∗ necessary ( zero i nd i ca t es i n v a l i d name ) . ∗ // / ∗ se t t i n g up l o c a l va r i ab l e i nd i ces on i n l e t , o u t l e t and p r i v a t e/ / streams . One example i s the mass f low in the i npu t stream :loca l−>f lowIndex = GetInputFlowIndex ( kF i r s t Po r t ) ;/∗ I n i t i a l i z i n g the mass on the cathodes and a l l o c a t i n g the doublesf o r t r a ck i ng the masses ∗ /setCount = loca l−>cathodeSets ;l oca l−>cathSet = Al locateDoubles ( setCount ) ;/ / I n i t i a l i z i n g cathode masses to 0f o r ( index = 1 , cathSetMassPtr = loca l−>cathSet ;index <= Sta t i cCas t ( T Index , setCount ) ; ++index , ++cathSetMassPtr )197APPENDIX C. ELECTROWINNING CODE{∗cathSetMassPtr = 0 . 0 ;}compCount = GetCountOfInputComponents ( kF i r s t Po r t ) ;l oca l−>compMasses = Al locateDoubles ( compCount ) ;/ / I n i t i a l i z i n g component masses to 0f o r ( index = 1 , compMassPtr = loca l−>compMasses , l oca l−>numQuality = 0 ;index <= compCount ; ++index , ++compMassPtr ){∗compMassPtr = 0 . 0 ;compInfo = GetOutputComponentInfo ( kF i r s tPo r t , index ) ;env . fCategory = compInfo−>fCategType ;env . fPhase = compInfo−>fPhase ;i f ( compInfo−>fCategType & kCatNonFlowQuali ty )++ loca l−>numQuality ;}/ / Copies p r i v a t e po r t ( r es i den t mass ) from the ou t l e t stream to i n i t i a l i z eClonePrivateStreamFromOutputStream ( kPr ivateContents , ” I n t e r n a l ” , k F i r s t Po r t ) ;} /∗ I n i t i a l i z e ∗ //∗ ============================================================= ∗ //∗ Get t ing Free Var iab les ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− PrepareGetOut le tFreeInfo −−−−−−−−−−−−−−− ∗ /P repareGetOu t le tF ree In fo func t ion{RecognizeAllArguments ( PrepareGetOut le tFreeInfo )i f ( verbose )P r i n t S e l f (”− prepar ing to get next o u t l e t f r ee i n f o f o r ” , ” −\n ” ) ;i f ( l oca l−>pressureIndex == NOT FOUND)re tu rn f a l s e ;gWhichType = kPressureOut le t ;r e t u rn t rue ;} /∗ PrepareGetOut le tFreeIn fo ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetNextOut le tFreeIn fo −−−−−−−−−−−−−−−−−− ∗ /Ge tNex tOu t l e tF ree In fo func t i on{Qchar r e s u l t = NULL ;198APPENDIX C. ELECTROWINNING CODERecognizeAllArguments ( GetNextOut le tFreeIn fo )i f ( verbose )P r i n t S e l f (”− ge t t i n g next o u t l e t f r ee i n f o f o r ” , NULL ) ;∗ r e p e t i t i o n s = 1;swi tch ( gWhichType ){case kPressureOut le t :gWhichType = kNoMore ;r e s u l t = PRESSURE NAME;break ;}i f ( verbose ){i f ( r e s u l t ){Pr i n tS i ze ( ” = ” , ∗ r e pe t i t i o n s , ” o f ” ) ;P r i n t S t r i n g s ( r esu l t , ” −\n ” , NULL ) ;}elseP r i n t S t r i n g ( ” = NULL −\n ” ) ;}∗const ra ined = f a l s e ;r e t u rn r e s u l t ;} /∗ GetNextOut le tFreeIn fo ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetTypicalValue −−−−−−−−−−−−−−−−−−−−−−−− ∗ /S tandard GetTyp ica lVa lue func t ion/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetUni tsForVar iab le −−−−−−−−−−−−−−−−−−−− ∗ /Ge tUn i t sFo rVa r i ab le func t i on/ / ∗ Sets un i t s and names f o r each f ree and ca l cu la ted va r i ab l e/∗ ============================================================= ∗ //∗ Ca lcu la t i ons ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− Execute −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ∗ /S tandard Execute func t ion/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− Perform −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ∗ /Pe r fo rm func t ion{bool boolPul l ingCathodes ;i n t setCount ;199APPENDIX C. ELECTROWINNING CODEdouble convToMin , volume , vFlow , re ten t i on , value ;double value2 , theTimeStep , accumulatedMass ;double deltaEnergy , sum, length , f r a c t i o n , tankVol ;double sum2 , newMass , res iden t , incMass , d i f f V o l ;double energy , totalHeatOfRx , reacted , HeatResistance ;double solCond , electrodeGap , concH2SO4 ;double concZnSO4 , cathodeArea , anodeArea , topArea ;double numberOfCathodes , numberOfAnodes , to tCatArea ;double totAnArea , solTemp , iH2O , etaH2O , crossSect ion ;double actHIon , EH2O, EAnode , rateH2 , ava i l ab leMe ta l ;double totalActH2O , to ta lAc tH , actZnIon ;double EH, EZn , iZno , iHo , CE, cu r ren t ;double cur ren tDens i ty , ra teMeta l , r a teMe ta lSa l t ;double rateAcid , rateH2O , rateO2 , pr ivateMass ;double to ta lAc tZn , HeatEvap , vo lSo l i d s ;double connect ionVoltageLoss , app l iedVo l tage ;double HMetalIon , HH2O, HeatZnRx , HeatHRx , solTempK ;double growZn , tankMass , guessBubbles , remainingSets ;double x , z , waterVol , dens i t ySo l i d , ambientPressure ;double to ta lT ime , pu l lSe t , VO2, metalDepValence ;double sumHeatOfRx , index , depZincOut , eg ;double del taT , convVFlowToL , guessCathPot ;double convOutMassFlowTokgPerStep , guessGammaX;double conduc t i v i t yBubb les , susMetal ;double concMnSO4 ;double elecLength , courant , outMass ;double rateMango , rateManganese , ra teCh lo r i de ;double ra teCh lo r i ne ;Pdouble compMassPtr , cathSetMassPtr ;E PhysResult s ta tus ;PT Qua l i t y Ind ices q u a l i t y P t r ;QT ComponentInfo compInfo ;QT CategoryData categData ;const T ConversionFactors & convFacts = ∗ConversionFactors ( ) ;T Environment env ;T Index compCount , compFlowCount , compIndex ;T Index loop , cIndex ;T CurrentData s t u f f ;T GammaData gamma;T BubbleData bubbles ;200APPENDIX C. ELECTROWINNING CODERecognizeAllArguments ( Perform )/ / Dec lar ing va r i ab l es t ha t w i l l not change over the run .compCount = GetCountOfInputComponents ( kF i r s t Po r t ) ;compFlowCount = GetCountOfOutputFlowComponents ( kF i r s t Po r t ) ;setCount = loca l−>cathodeSets ;convToMin = 60 .0 ; / / from user t ime to sec and then to minvolume = FreeUn i tVar iab le ( indexVOLUME) ∗ convFacts . fVolumeTank ;i f ( volume < kZeroWannaBe ) / / Checking the volume i s not 0{Pchar mes1 = TranslateMessage1 ( ”VOLUME (%1) i s negat ive or ”” e s s en t i a l l y zero . ” ,StringFromDouble (NULL, 0 , volume ) ) ;Pchar mes2 = TranslateMessage1 ( ” I t w i l l be assumed to be equal to ””(%1) f o r c a l c u l a t i o n s . ” ,StringFromDouble (NULL, 0 , kZeroWannaBe ) ) ;SignalAlarmAndFree2 ( kAlarmImportant , mes1 , mes2 ) ;volume = kZeroWannaBe ;}i f ( ! l oca l−>pressureIndex ) / / g e t t i n g pressureambientPressure = kAtmPressureSI ;e lseambientPressure = GetOutputVar iable ( kPortGASES , loca l−>pressureIndex ) ∗convFacts . fPressure ; / / To kPade l taT = GetDeltaTime ( ) ∗ 60; /∗ i t e r a t i o n t ime (min ) to seconds ∗ /convVFlowToL = convFacts . fVolumeFlow ∗ convFacts . fTime ;convOutMassFlowTokgPerStep = convFacts . fMassFlow ∗ de l taT ;i f ( isWarmup ) / / perform warmup once to i n i t i a l i z e{bool foundVal idData = f a l s e ;double tankVol ;Qdouble pData = in te rna lDa ta ;T Size valuesCount = GetCountOfOutputValues ( kF i r s t Po r t ) + setCount ;i f ( verbose )P r i n t S e l f (”− warming up ” , ” −\n ” ) ;i f ( CheckInputDetached ( kF i r s t Po r t ) )goto leave ;i f ( CheckOutputDetached ( kF i r s t Po r t ) )goto leave ;l oca l−>f i r s t T ime = t rue ;201APPENDIX C. ELECTROWINNING CODE/∗ I n i t i a l i z e volume / holdup i n f o to est imates ( or s t a r t values ) ∗ //∗ Out le t conc . i s equal to tank concen t ra t ions ∗ /i f ( pData )/ / ∗Se t t i ng stream composit ions , temperatures and un i t va r i ab l es/ / i f an ava i l ab l e save f i l e from a prev ious run i s found .i f ( ! foundVal idData )/ / ∗ I f no save f i l e i s ava i l ab le , i n i t i a l i z e i t to o u t l e t composi t ion/ / and un i t de f au l t s .tankMass = GetPr i va teVar iab le ( kPr ivateContents , l oca l−>f lowIndex ) ∗convFacts . fMass ;tankVol = GetPr i va teVar iab le ( kPr ivateContents ,l oca l−>volFlowIndex ) ∗ convVFlowToL ;i f ( ( tankVol > kZeroWannaBe ) && ( fabs ( volume − tankVol ) > 0 .01 ) ){f r a c t i o n = volume / tankVol ;f o r ( compIndex = 1; compIndex <= compCount ; ++compIndex ){value = GetPr i va teVar iab le ( kPr ivateContents , compIndex ) ;compInfo = GetOutputComponentInfo ( kF i r s tPo r t , compIndex ) ;categData = GetOutputCategoryData ( kF i r s tPo r t ,compInfo−>fCategory ) ;i f ( ( compIndex <= compFlowCount ) | |( categData−>fType & kCatNonFlowMass ) ){value ∗= f r a c t i o n ;Se tP r i va teVar iab le ( kPr ivateContents , compIndex , value ) ;}}}}else /∗ performing , but not isWarmup ∗ /{i f ( verbose )P r i n t S e l f (”− per forming ” , ” −\n ” ) ;/∗ We assume tha t the i npu t components and output ∗ //∗ components are congruent (same number o f components i n ∗ //∗ the same order ! ) ∗ //∗ Co l l e c t i ng FreeVar iab les ∗ /cu r ren t = FreeUn i tVar iab le ( indexCurrent ) ;i f ( cu r ren t < 0 .0 )cu r ren t = 0 . 0 ;202APPENDIX C. ELECTROWINNING CODEnumberOfCathodes = FreeUn i tVar iab le ( indexNumberOfCathodes ) ;i f ( numberOfCathodes < 1 .0 )numberOfCathodes = 1 . 0 ;numberOfAnodes = FreeUn i tVar iab le ( indexNumberOfAnodes ) ;i f ( numberOfAnodes < 2 .0 )numberOfAnodes = 2 . 0 ;cathodeArea = FreeUn i tVar iab le ( indexCathodeSurfaceArea ) ∗convFacts . fArea ;i f ( cathodeArea <= 0 .0 )cathodeArea = kZeroWannaBe ;anodeArea = FreeUn i tVar iab le ( indexAnodeSurfaceArea ) ∗ convFacts . fArea ;i f ( anodeArea <= 0 .0 )anodeArea = kZeroWannaBe ;i f ( F reeUn i tVar iab le ( indexPul l ingCathodes ) > kLogicTolerance )boolPul l ingCathodes = t rue ;e lse i f ( setCount == 0)boolPul l ingCathodes = t rue ;e lseboolPul l ingCathodes = f a l s e ;/∗ When pu l l i n g , the t o t a l cathode sur face area w i l l decrease . Howeveri f there i s on ly one set , we s imp l i f y and do not do t h i s c a l c u l a t i o n ∗ /remainingSets = setCount ;i f ( ( boolPul l ingCathodes ) && ( setCount > 1 . 0 ) ){pu l lSe t = FreeUn i tVar iab le ( indexCathodePullSetNumber ) ;remainingSets = setCount − 1 . 0 ;numberOfCathodes = numberOfCathodes − numberOfCathodes / setCount +kZeroWannaBe ;}i f ( ( boolPul l ingCathodes ) && ( setCount == 1 . 0 ) ){pu l lSe t = FreeUn i tVar iab le ( indexCathodePullSetNumber ) ;remainingSets = setCount ;numberOfCathodes = numberOfCathodes ;}i f ( ! l oca l−>pressureIndex )ambientPressure = kAtmPressureSI ;e lseambientPressure = GetOutputVar iable ( kPortGASES , loca l−>pressureIndex ) ∗convFacts . fPressure ; / / To kPa/∗ Se t t i ng up So lu t i on before reac t i on ∗ /203APPENDIX C. ELECTROWINNING CODEvFlow = GetOutputVar iable ( kF i r s tPo r t , l oca l−>l i qu idVo lF lowIndex ) ∗convFacts . fVolumeFlow / l oca l−>numCells ; /∗ to l / s ∗ /i f ( vFlow > volume )vFlow = volume ;i f ( vFlow <= 0 .0 )vFlow = kZeroWannaBe ;i f ( NearZero ( vFlow ) )vFlow = kZeroWannaBe ;/∗ compMassPtr i s used to c o l l e c t a l l components e x i t i n g as spente l e c t r o l y t e , here we i n i t i a l i z e to zero ∗ /f o r ( compIndex = 1 , compMassPtr = loca l−>compMasses ,l oca l−>numQuality = 0 ; compIndex <= compCount ; ++compIndex ,++compMassPtr ){∗compMassPtr = 0 . 0 ;}l o ca l−>energyHoldup = 0 .0 ;theTimeStep = 60 .0 ;theTimeStep = de l taT ;/ / Begin a t ime step .f o r ( to ta lT ime = 0 .0 ; ( to ta lT ime + theTimeStep ∗ 1.0e−6) < de l taT ;to ta lT ime += theTimeStep ){solTemp = ( GetPr i va teVar iab le ( kF i r s tPo r t , l oca l−>OutTempIndex ) +convFacts . fTempOffset ) ∗ convFacts . fTemp ;solTempK = solTemp + kOf f se tKe l v i n ;i f ( solTempK < 273.1)solTempK = 273.1 ;i f ( solTempK > 373)solTempK = 373.0 ;to tCatArea = numberOfCathodes ∗ cathodeArea ;totAnArea = ( numberOfAnodes − 1 .0 ) ∗ anodeArea ;cu r ren tDens i t y = cu r ren t / to tCatArea ;iH2O = cur ren tDens i t y ∗ to tCatArea / totAnArea ;tankMass = GetPr i va teVar iab le ( kPr ivateContents , l oca l−>f lowIndex ) ∗convFacts . fMass ; / / kg / contentstankVol = GetPr i va teVar iab le ( kPr ivateContents , l oca l−>volFlowIndex ) ∗convVFlowToL ;i f ( tankVol <= 0 .0 )tankVol = kZeroWannaBe ;/∗ Universa l Ca lcVar iab les ∗ /204APPENDIX C. ELECTROWINNING CODECalcVar iab le ( indexTotalCathArea ) = totCatArea ;Ca lcVar iab le ( indexCurrentDens i ty ) = cu r ren tDens i t y ;Ca lcVar iab le ( indexRetent ionTime ) = tankVol / vFlow / convToMin ;/∗ Specf ic Zinc Case ∗ /T Index f reeUn i t I ndex = indexAnodeSurfaceArea + 1;i f ( setCount > 0)f reeUn i t I ndex += 2;i f ( l oca l−>metal == kZinc ){electrodeGap = FreeUn i tVar iab le ( f reeUn i t I ndex ++) ∗ / / ? ?convFacts . fLength ;i f ( electrodeGap <= 0 .0 )electrodeGap = kZeroWannaBe ;elecLength = FreeUn i tVar iab le ( f reeUn i t I ndex ++) ∗ convFacts . fLength ;i f ( e lecLength <= 0 .0 )elecLength = kZeroWannaBe ;connect ionVol tageLoss = FreeUn i tVar iab le ( f reeUn i t I ndex ++) ; / / ??crossSect ion = cathodeArea / numberOfCathodes / elecLength ∗electrodeGap ;/∗ ge t t i n g concen t ra t ions o f key species (mol / L ) ∗ /i f ( l oca l−>acid Index != NOT FOUND) / / ge t t i n g [H2SO4]{compInfo = GetPrivateComponentInfo ( kPr ivateContents ,l oca l−>acid Index ) ;concH2SO4 = GetPr i va teVar iab le ( kPr ivateContents ,l oca l−>acid Index ) ∗convFacts . fMass ;concH2SO4 ∗= kThousand / compInfo−>fMolecularWeight / tankVol ;}elseconcH2SO4 = 0 .0 ;i f ( l oca l−>meta lSa l t Index != NOT FOUND) / / ge t t i n g [ZnSO4]{compInfo = GetPrivateComponentInfo ( kPr ivateContents ,l oca l−>meta lSa l t Index ) ;concZnSO4 = GetPr i va teVar iab le ( kPr ivateContents ,l oca l−>meta lSa l t Index ) ∗convFacts . fMass ;concZnSO4 ∗= kThousand / compInfo−>fMolecularWeight / tankVol ;}else205APPENDIX C. ELECTROWINNING CODEconcZnSO4 = 0 .0 ;i f ( l oca l−>manganeseIndex != NOT FOUND) / / ge t t i n g [MnSO4]{compInfo = GetPrivateComponentInfo ( kPr ivateContents ,l oca l−>manganeseIndex ) ;concMnSO4 = GetPr i va teVar iab le ( kPr ivateContents ,l oca l−>manganeseIndex ) ∗convFacts . fMass ;concMnSO4 ∗= kThousand / compInfo−>fMolecularWeight / tankVol ;}elseconcMnSO4 = 0 .0 ;waterVol = GetPr i va teVar iab le ( kPr ivateContents , l oca l−>waterIndex ) ;i f ( waterVol > kZeroWannaBe ){x = GetPr i va teVar iab le ( kPr ivateContents , l oca l−>acid Index ) ∗convFacts . fMass / compInfo−>fMolecularWeight ∗ kThousand /tankVol ;i f ( x <= 0 .0 )x = kZeroWannaBe ;z = GetPr i va teVar iab le ( kPr ivateContents , l oca l−>meta lSa l t Index ) ∗convFacts . fMass / compInfo−>fMolecularWeight ∗ kThousand /tankVol ;i f ( z <= 0 .0 )z = kZeroWannaBe ;}else{x = kZeroWannaBe ;z = kZeroWannaBe ;}/∗ Data s t r u c t u r e f o r a c t i v i t y c o e f f i c i e n t DoSolveGamma c a l l ∗ /gamma.who = who ;gamma. x = x ;gamma. z = z ;gamma. solTemp = solTemp ;gamma. solTempK = solTempK ;/∗ I n i t i a l Guess f o r a c i t i v i t y c o e f f i c i e n t s ∗ /i f ( l oca l−>f i r s t T ime ){guessGammaX = x ;206APPENDIX C. ELECTROWINNING CODE}else{guessGammaX = loca l−>guessGammaX;}sum = FindConstrainedRoot (doSolveGamma , &gamma, guessGammaX, x ,x ∗ 2.0 , kDomainThreshold ,kRangeThreshold , verbose , 0 ) ;l oca l−>guessGammaX = gamma. gammaValue ;/ / Guerra & Bes t e t t i , 2006solCond = −(10.79 ∗ concZnSO4 ) − (53 .9 ∗ concH2SO4) −(1 .814 ∗ pow(concZnSO4 , 2 ) ) − (6 .380 ∗ pow(concH2SO4 , 2 ) ) −(1 .027 ∗ concZnSO4 ∗ concH2SO4) + (16.73 ∗pow(concZnSO4 , 2) ∗ concH2SO4) + (0.0585 ∗ solTempK ∗concZnSO4 ) + (12.46 ∗ concZnSO4 ∗ pow(concH2SO4 , 2 ) ) −(6 .762 ∗ pow(concZnSO4 , 2) ∗ pow(concH2SO4 , 2 ) ) +(0.3345 ∗ concH2SO4 ∗ solTempK ) −(0.1341 ∗ concZnSO4 ∗ concH2SO4 ∗ solTempK ) + kZeroWannaBe ;rateO2 = iH2O ∗ totAnArea / 4.0 / kFaraday ;VO2 = rateO2 ∗ kR / kThousand ∗ ( solTempK ) / ambientPressure /kThousand ;/∗ DoSolveBubble data s t r u c t u r e ∗ /bubbles .who = who ;bubbles .VO2 = VO2;bubbles .em = 0 .11 ;bubbles . u l 0 = 0 . 0 ;bubbles . us = 0 .04 ;bubbles . crossSect ion = crossSect ion ;bubbles . eg = 0 . 0 ;i f ( l oca l−>f i r s t T ime ){guessBubbles = 0 . 0 ;}else{guessBubbles = loca l−>guessBubbles ;}sum = FindConstrainedRoot ( doSolveBubbles , &bubbles , guessBubbles ,0 .0 , 1 .0 , kDomainThreshold ,kRangeThreshold , verbose , 0 ) ;l oca l−>guessBubbles = eg = bubbles . eg ;207APPENDIX C. ELECTROWINNING CODEconduc t i v i t yBubb les = ( ( 1 − eg ) / ( 1 + ( eg / 2 ) ) + 1 .0 ) / 2 . 0 ;solCond ∗= conduc t i v i t yBubb les ;/∗ Find ing Revers ib le po t e n t i a l s o f the 3 pr imary Zn EW reac t i ons ∗ // / Nernst H2O decomposit ioni f (gamma. gammaHIon > 10.0 | | gamma. gammaHIon < 0 .0 )gamma. gammaHIon = 1 .0 ;actHIon = gamma. gammaHIon ∗ concH2SO4 ∗ 2 . 0 ;totalActH2O = (pow( actHIon , kValanceH2O ) ∗ pow( kActO2 , 1.0 /kActH2O ) / ( kActO2 ) ) ;EH2O = ( log ( totalActH2O ) ∗ kR / kThousand / kFaraday / kValanceH2O ∗( solTempK ) ) + kEH2O;/ / Nernst H2 evo lu t i onto ta lAc tH = ( actHIon / pow( kActH2 , 0 . 5 ) ) ;EH = ( log ( to ta lAc tH ) ∗ kR / kThousand / kFaraday / kValanceH ∗( solTempK ) ) + kEH;/ / Nernst Zn2+ depos i t i oni f (gamma. gammaZnIon > 10.0 | | gamma. gammaZnIon < 0 .0 )gamma. gammaZnIon = 1 . 0 ;actZnIon = gamma. gammaZnIon ∗ concZnSO4 ;to ta lAc tZn = actZnIon / kActZn ;EZn = ( log ( t o ta lAc tZn ) ∗ kR / kThousand / kFaraday / kValanceZn ∗( solTempK ) ) + kEZn ;/∗ Ca lcu la t i ng Current dens i t i e s f o r the 3 main reac t i ons ∗ /etaH2O = kTafelAH2O + kTafelBH2O ∗ log10 ( iH2O ) ;iHo = kFreqFacH ∗ exp(−kActEnergyH / (kR / kThousand ) / ( solTempK ) ) ;i f ( iHo > 1.0E6)iHo = 1.0E6 ;iHo ∗= pow ( ( concH2SO4 ∗ 2 .0 ) , ( 1 .0 − kAlphaH ) ) ;iZno = kFreqFacZn ∗ exp(−kActEnergyZn / (kR / kThousand ) /( solTempK ) ) ;iZno ∗= pow(concZnSO4 , (1 .0 − kAlphaZn ) ) ;/∗ Data s t r u c t u r e to solve DoSolveCurrent ∗ /s t u f f .who = who ;s t u f f . app l iedVo l tage = EZn + EH2O;s t u f f . connect ionVol tageLoss = connect ionVol tageLoss ;s t u f f . to tCatArea = totCatArea ;s t u f f . totAnArea = totAnArea ;s t u f f . solTempK = solTempK ;s t u f f . iH2O = iH2O ;s t u f f . concZnSO4 = concZnSO4 ;s t u f f . EZn = EZn ;208APPENDIX C. ELECTROWINNING CODEs t u f f .EH2O = EH2O;s t u f f .EH = EH;s t u f f . iHo = iHo ;s t u f f . electrodeGap = electrodeGap ;s t u f f . cu r ren tDens i t y = cu r ren tDens i t y ;s t u f f . iC = cur ren tDens i t y ;s t u f f . solCond = solCond ;s t u f f . iZno = iZno ;s t u f f . so lVo l tLoss = ( s t u f f . electrodeGap ) ∗s t u f f . cu r ren tDens i t y / s t u f f . solCond ;s t u f f . ECathode = EZn ;s t u f f . numberOfCathodes = numberOfCathodes ;s t u f f . MassTrans = kMassTransConst ;s t u f f . z = z ;s t u f f . x = x ;s t u f f . pressure = ambientPressure ;i f ( l oca l−>f i r s t T ime ){guessCathPot = EZn − 0 .02 ;}else{guessCathPot = loca l−>guessCathPot ;}/ / Solve f o r cu r ren t dens i t i e s o f z inc and hydrogen reac t i onssum = FindConstrainedRoot ( doSolveCurrent , &s t u f f , guessCathPot ,EZn − 2.0 , EZn , kDomainThreshold ,kRangeThreshold , verbose , 0 ) ;l oca l−>guessCathPot = s t u f f . ECathode ;EAnode = EH2O + etaH2O ;iH2O = cur ren tDens i t y ;i f ( cu r ren tDens i t y <= 0 .0 )app l iedVo l tage = 0 . 0 ;e lseapp l iedVo l tage = −s t u f f . ECathode + s t u f f . so lVo l tLoss +s t u f f . connect ionVol tageLoss + EAnode ;i f ( s t u f f . iZn <=0.0)s t u f f . iZn = 0 . 0 ;i f ( cu r ren tDens i t y > 0 .0 )i f ( s t u f f . iZn < 0 .0 )CE = 0 .0 ;209APPENDIX C. ELECTROWINNING CODEelseCE = ( s t u f f . iZn ) / cu r ren tDens i t y ∗ kHundred ;e lseCE = 0 .0 ;i f (CE > 0){compInfo = GetOutputComponentInfo ( kF i r s tPo r t , l oca l−>metal Index ) ;compInfo = GetOutputComponentInfo ( kF i r s tPo r t , l oca l−>metal Index ) ;Ca lcVar iab le ( indexEnergyConsumption ) = kThousand ∗ kHundred ∗2.0 ∗ kFaraday / 3600.0 /compInfo−>fMolecularWeight∗ app l iedVo l tage / CE;}elseCalcVar iab le ( indexEnergyConsumption ) = kM i l l i o n ;i f ( l oca l−>metal == kZinc ){CalcVar iab le ( i ndexCu r ren tE f f i c i ency ) = CE;CalcVar iab le ( indexCe l lVo l tage ) = app l iedVo l tage ;}CalcVar iab le ( indexSolu t ionVol tageLoss ) = s t u f f . so lVo l tLoss ;/ / Rates o f React ion/∗ I n i t i a l i z e a l l ra tes to 0 to begin . A l l Rates are i n mol / sec ∗ /ra teMeta l = 0 . 0 ;ra teMe ta lSa l t = 0 . 0 ;rateH2 = 0 . 0 ;rateH2O = 0 .0 ;ra teAc id = 0 . 0 ;ra teMeta l = ( cu r ren tDens i t y ∗ CE / kHundred ) ∗ to tCatArea / 2.0 /kFaraday ;ra teMe ta lSa l t = −ra teMeta l ;rateH2 = s t u f f . rateH2 ;rateH2O = −iH2O ∗ totAnArea / 2.0 / kFaraday ;ra teAc id = ((− rateH2 ∗ 2 .0 ) + (−rateH2O ∗ 2 . 0 ) ) / 2 . 0 ;/ / HMetalIon = −152510.0; / / Enthalpy o f fo rmat ion o f Zn2+ ( J / mol )}else / / de f au l t Copper case/ / ∗Solves f o r a de f au l t c e l l , r e qu i r i n g the user to set cu r ren t/ / e f f i c i e n c y and c e l l vo l tage ./∗ Mass Balance po r t i on ∗ /f o r ( compIndex = 1 , compMassPtr = loca l−>compMasses ;210APPENDIX C. ELECTROWINNING CODEcompIndex <= compCount ; ++compIndex , ++compMassPtr ){compInfo = GetOutputComponentInfo ( kF i r s tPo r t , compIndex ) ;env . fCategory = compInfo−>fCategType ;env . fPhase = compInfo−>fPhase ;i f ( ( compIndex <= compFlowCount ) | | ( compInfo−>fCategType &kCatNonFlowMass ) ){/ / Incoming MassincMass = Get IndexedInputVar iab le ( kF i r s tPo r t , compIndex ) ∗convFacts . fMass / convFacts . fTime / l oca l−>numCells ;/ / Outgoing MassoutMass = GetIndexedOutputVar iable ( kF i r s tPo r t , compIndex ) ∗convFacts . fMass / convFacts . fTime / l oca l−>numCells ;/ / Holdup Mass from Previous Time stepres i den t = GetPr i va teVar iab le ( kPr ivateContents , compIndex ) ∗convFacts . fMass ;i f ( r es i den t <= kZeroWannaBe )res i den t = kZeroWannaBe ;i f ( compIndex == loca l−>metal Index ){accumulatedMass = 0 . 0 ;f o r ( loop = 1 , cathSetMassPtr = loca l−>cathSet ;loop <= setCount ; ++loop , ++cathSetMassPtr ){/∗ summing the deposi ted z inc present i n the c e l l ∗ /accumulatedMass += ∗cathSetMassPtr ;}susMetal = res i den t − accumulatedMass ;}/ / React ion produc t ion / consumption ra tesi f ( compIndex == loca l−>meta lSa l t Index ){reacted = ra teMe ta lSa l t ∗ compInfo−>fMolecularWeight /kThousand ;}else i f ( compIndex == loca l−>acid Index ){reacted = ra teAc id ∗ compInfo−>fMolecularWeight /kThousand ;}211APPENDIX C. ELECTROWINNING CODEelse i f ( compIndex == loca l−>waterIndex ){reacted = rateH2O ∗ compInfo−>fMolecularWeight /kThousand ;}else i f ( compIndex == loca l−>H2Index ){reacted = rateH2 ∗ compInfo−>fMolecularWeight /kThousand ;}else i f ( compIndex == loca l−>metal Index ){reacted = ra teMeta l ∗ compInfo−>fMolecularWeight /kThousand ;}else i f ( compIndex == loca l−>O2Index ){reacted = rateO2 ∗ compInfo−>fMolecularWeight /kThousand ;}else i f ( compIndex == loca l−>mangoIndex ){reacted = rateMango ∗ compInfo−>fMolecularWeight /kThousand ;}else i f ( compIndex == loca l−>manganeseIndex ){reacted = rateManganese ∗ compInfo−>fMolecularWeight /kThousand ;}else i f ( compIndex == loca l−>ch lo r i de Index ){reacted = ra teCh lo r i de ∗ compInfo−>fMolecularWeight /kThousand ;}else i f ( compIndex == loca l−>ch lo r i ne Index ){reacted = ra teCh lo r i ne ∗ compInfo−>fMolecularWeight /kThousand ;}else212APPENDIX C. ELECTROWINNING CODEreacted = 0 . 0 ;newMass = res i den t + ( incMass + reacted ) ∗ theTimeStep ;newMass /= convFacts . fMass ;/∗ Releasing the gases to atmosphere & se t t i n g E l e c t r o l y t estream gas values to 0 ∗ /i f ( compIndex == loca l−>H2Index | | compIndex == loca l−>O2Index| | compIndex == loca l−>ch lo r i ne Index ){∗compMassPtr += newMass ;Se tP r i va teVar iab le ( kPr ivateContents , compIndex , 0 . 0 ) ;}else{/∗ Some time step check a rev iewer asked me to put i n on oneof my papers ∗ /courant = fabs ( ( incMass − outMass + reacted ) ∗ theTimeStep ) ;courant = courant / ( r es i den t ∗ 0 .001 ) ;/ / Se t t i ng stream output values/ / newMass i n User ’ s un i t sSe tP r i va teVar iab le ( kPr ivateContents , compIndex , newMass ) ;}}}vo lSo l i d s = 0 . 0 ; / / Zeroing the volume of so l i d s i n the c e l l/∗ summing up the t o t a l r es i den t so l i d s and sub t r ac t i ng the r e s u l t i n gvolume from the t o t a l a va i l ab l e volume of the c e l l ∗ /f o r ( compIndex = 1; compIndex < compCount ; compIndex++){compInfo = GetOutputComponentInfo ( kF i r s tPo r t , compIndex ) ;env . fCategory = compInfo−>fCategType ;env . fCategory = compInfo−>fCategType ;env . fPhase = compInfo−>fPhase ;i f ( env . fCategory == kCatSuspended ){env . fPhase = compInfo−>fPhase ;dens i t ySo l i d = DetermineInputProper ty ( compInfo , kF i r s tPo r t ,kPhysProp Density ,&env , &s ta tus ) ;vo lSo l i d s += GetPr i va teVar iab le ( kPr ivateContents , compIndex ) /dens i t ySo l i d ;}213APPENDIX C. ELECTROWINNING CODE}/∗ New tank volume before any so l u t i o n i s forced to f low out ∗ /tankVol = ( GetPr i va teVar iab le ( kPr ivateContents ,l oca l−>volFlowIndex ) ∗convVFlowToL ) ;d i f f V o l = tankVol − volume ;i f ( d i f f V o l < 0)d i f f V o l = 0 . 0 ;/∗ Seeing how much volume must be removed from the c e l l ∗ /i f ( tankVol − vo lSo l i d s <= 0 .0 )f r a c t i o n = 1 . 0 ;e lsef r a c t i o n = ( volume − vo lSo l i d s ) / ( tankVol − vo lSo l i d s ) ;i f ( f r a c t i o n > 1 .0 ) / / ?? Put warnings here??f r a c t i o n = 1 . 0 ;i f ( f r a c t i o n < 0 .5 )f r a c t i o n = f r a c t i o n ;/∗ Se t t i ng the Output Streams ∗ /f o r ( compIndex = 1 , compMassPtr = loca l−>compMasses ; compIndex <=compCount ; ++compIndex , ++compMassPtr ){/∗ any aqueous so l u t i o n components e x i t i n g are handled here ∗ /i f ( compIndex != loca l−>metal Index && compIndex != loca l−>H2Index &&compIndex != loca l−>O2Index &&compIndex != loca l−>ch lo r i ne Index ){pr ivateMass = GetPr i va teVar iab le ( kPr ivateContents , compIndex ) ∗convFacts . fMass ∗ f r a c t i o n ;∗compMassPtr += ( GetPr i va teVar iab le ( kPr ivateContents ,compIndex ) ∗convFacts . fMass ) − pr ivateMass ;pr ivateMass /= convFacts . fMass ;i f ( pr ivateMass < 0 .0 )pr ivateMass = 0 . 0 ;Se tP r i va teVar iab le ( kPr ivateContents , compIndex , pr ivateMass ) ;}/∗ So l id Cathode components are set here ∗ /i f ( compIndex == loca l−>metal Index ){compInfo = GetOutputComponentInfo ( kF i r s tPo r t , compIndex ) ;env . fCategory = compInfo−>fCategType ;214APPENDIX C. ELECTROWINNING CODEenv . fPhase = compInfo−>fPhase ;growZn = ra teMeta l ∗ compInfo−>fMolecularWeight / kThousand ;/∗ I n d i v i d u a l t imestep accumulat ion ∗ /pr ivateMass = GetPr i va teVar iab le ( kPr ivateContents , compIndex ) ∗convFacts . fMass ;pu l lSe t = FreeUn i tVar iab le ( indexCathodePullSetNumber ) ;cIndex = indexSolu t ionVol tageLoss ;/∗ For s p e c i f i c p u l l i n g schedules ∗ /i f ( l oca l−>metal == kZinc )cIndex += 3;/∗ Growing or s t r i p p i n g the deposi ted metal ∗ /i f ( setCount <= 0) / / case wi th cont inuous pu l l i n g{accumulatedMass = growZn ∗ theTimeStep ;}f o r ( loop = 1 , cathSetMassPtr = loca l−>cathSet ;loop <= setCount ; ++loop , ++cathSetMassPtr ){i f ( boo lPul l ingCathodes && loop == pu l lSe t ){/∗ summing the deposi ted z inc present i n the c e l l ∗ // / accumulatedMass += ( growZn ∗ theTimeStep / setCount ) ;/∗ s t r i p p i n g z inc out o f the c e l l − t h i s must be done atthe setOutput ∗ // /∗ cathSetMassPtr = 0 . 0 ;Ca lcVar iab le ( cIndex ) = 0 . 0 ;}else{/∗ grow the cathode ∗ /∗cathSetMassPtr += ( growZn ∗ theTimeStep / remainingSets ) ;/∗summing the deposi ted z inc present i n the c e l l ∗ /accumulatedMass += ( growZn ∗ theTimeStep / remainingSets ) ;Ca lcVar iab le ( cIndex ) = ∗cathSetMassPtr ;}++cIndex ;}susMetal = pr ivateMass − accumulatedMass ;∗compMassPtr = susMetal ∗ ( 1 .0 − f r a c t i o n ) ;pr ivateMass = accumulatedMass + susMetal ∗ f r a c t i o n −∗compMassPtr ;215APPENDIX C. ELECTROWINNING CODE/∗pr ivateMass = ( ( GetPr i va teVar iab le ( kPr ivateContents , compIndex ) ∗convFacts . fMass ) − accumulatedMass ) ∗ f r a c t i o n +accumulatedMass ;∗compMassPtr += ( ( Ge tPr i va teVar iab le ( kPr ivateContents ,compIndex ) ∗convFacts . fMass ) − accumulatedMass ) ∗ ( 1 .0 −f r a c t i o n ) ;∗ /pr ivateMass /= convFacts . fMass ;/ / i f ( setCount == 0)/ / pr ivateMass = 0 . 0 ;i f ( pr ivateMass < 0 .0 )pr ivateMass = 0 . 0 ;Se tP r i va teVar iab le ( kPr ivateContents , compIndex , pr ivateMass ) ;}}/ / Energy Ca lcu la t i ons kJ / s bas isHH2O = −285250;HeatZnRx = ra teMeta l ∗ ( 0 .0 − ( l oca l−>HMetalIon + HH2O) ) /kThousand ;HeatHRx = rateH2 ∗ ( 0 .0 − HH2O) / kThousand ;sumHeatOfRx = HeatZnRx + HeatHRx ;HeatResistance = cur ren tDens i t y ∗ to tCatArea ∗app l iedVo l tage / kThousand ;tota lHeatOfRx = sumHeatOfRx ;/∗ Used to est imate the evaporat ion heat o f f the top o f the c e l l ∗ /i f ( l oca l−>metal != kZinc )/∗ For Cu EW, minimum cathode cent re to cent re spacing i s ˜ 95 mm ∗ /electrodeGap = 0.045;leng th = ( numberOfCathodes + numberOfAnodes ) ∗ (0 .006 +electrodeGap ) ;topArea = leng th ∗ cathodeArea ;value = 8.925 − 2259 / solTempK ;value = pow( value , 10 . 0 ) ;HeatEvap = kH2OEvap ∗ topArea ∗ ( value − 12.0) ∗ 40.600;/∗ Energy i s : Enthalpy o f outgoing so l u t i o n =+ Enthalpy o f incoming so l u t i o n− Heat o f reac t i ons ( Revers ib le work )+ E l e c t r i c Work Added ( IV )− Evaporat ion heat losses ∗ /216APPENDIX C. ELECTROWINNING CODEdel taEnergy = GetInputEnergy ( kF i r s t Po r t ) ∗ convFacts . fEnergy /convFacts . fTime / l oca l−>numCells ;del taEnergy = ( ( GetInputEnergy ( kF i r s t Po r t ) ∗ convFacts . fEnergy /convFacts . fTime / l oca l−>numCells ) − sumHeatOfRx +HeatResistance − HeatEvap ) ∗ theTimeStep ;energy = GetPr ivateEnergy ( kPr iva teContents ) ∗ convFacts . fEnergy ;energy += del taEnergy ;energy /= convFacts . fEnergy ;SetPr ivateEnergy ( kPr ivateContents , ( energy ∗ f r a c t i o n ) ) ;l oca l−>energyHoldup += energy ∗ ( 1 .0 − f r a c t i o n ) ;solTemp = GetPr i va teVar iab le ( kPr ivateContents , l oca l−>OutTempIndex ) ;/∗ Se t t i ng a l l the e x i t i n g components to t h e i r proper streams ∗ /f o r ( compIndex = 1 , compMassPtr = loca l−>compMasses ; compIndex <=compCount ; ++compIndex , ++compMassPtr ){i f ( compIndex == loca l−>H2Index | | compIndex == loca l−>O2Index | |compIndex == loca l−>ch lo r i ne Index ){/ / Releasing the gases to atmospherevalue = (∗compMassPtr / convFacts . fMass ) / ( de l taT /convFacts . fTime ) ∗ l o ca l−>numCells ;i f ( value < 0 .0 )value = 0 . 0 ;SetOutputVar iab le ( kPortGASES , compIndex , value ) ;SetOutputVar iab le (kPortCATHODES , compIndex , 0 . 0 ) ;SetOutputVar iab le ( kF i r s tPo r t , compIndex , 0 . 0 ) ;}else i f ( compIndex == loca l−>mangoIndex ){value = (∗compMassPtr / convFacts . fMass ) / ( de l taT /convFacts . fTime ) ∗ l o ca l−>numCells ;i f ( value < 0 .0 )value = 0 . 0 ;SetOutputVar iab le ( kPortGASES , compIndex , 0 . 0 ) ;SetOutputVar iab le (kPortCATHODES , compIndex , value ) ;SetOutputVar iab le ( kF i r s tPo r t , compIndex , 0 . 0 ) ;}else i f ( compIndex == loca l−>metal Index ){value = (∗compMassPtr / convFacts . fMass ) / ( de l taT /convFacts . fTime ) ∗ l o ca l−>numCells ;217APPENDIX C. ELECTROWINNING CODEi f ( value < 0 .0 )value = 0 . 0 ;SetOutputVar iab le ( kF i r s tPo r t , compIndex , value ) ;SetOutputVar iab le (kPortCATHODES , compIndex , 0 . 0 ) ;/∗ remove the z inc cathodes i f p u l l i n g i s True ∗ /i f ( boo lPul l ingCathodes ){pu l lSe t = FreeUn i tVar iab le ( indexCathodePullSetNumber ) ;cathSetMassPtr = loca l−>cathSet ;f o r ( index = 1; index < pu l lSe t ; index ++)cathSetMassPtr ++; / / kgi f ( setCount == 0){depZincOut = ra teMeta l ∗ compInfo−>fMolecularWeight /kThousand ;pr ivateMass = GetPr i va teVar iab le ( kPr ivateContents ,compIndex ) ;pr ivateMass −= depZincOut ∗ theTimeStep ;Se tP r i va teVar iab le ( kPr ivateContents , compIndex ,pr ivateMass ) ;}elsedepZincOut = ∗cathSetMassPtr / theTimeStep ; / / kg / sdepZincOut /= convFacts . fMassFlow ; / / user un i t sdepZincOut ∗= loca l−>numCells ;i f ( depZincOut < 0 .0 )depZincOut = 0 . 0 ;SetOutputVar iab le (kPortCATHODES , compIndex , depZincOut ) ;i f ( setCount > 0){accumulatedMass −= ∗cathSetMassPtr ;pr ivateMass = GetPr i va teVar iab le ( kPr ivateContents ,compIndex ) ;pr ivateMass −= ∗cathSetMassPtr ;i f ( pr ivateMass < 0 .0 )pr ivateMass = 0 . 0 ;Se tP r i va teVar iab le ( kPr ivateContents , compIndex ,pr ivateMass ) ;∗cathSetMassPtr = 0 . 0 ;}}218APPENDIX C. ELECTROWINNING CODE}else{/ / Se t t i ng spent e l e c t r o l y t e output valuesvalue = (∗compMassPtr / convFacts . fMass ) / ( de l taT /convFacts . fTime ) ∗ l o ca l−>numCells ;i f ( value < 0 .0 )value = 0 . 0 ;SetOutputVar iab le ( kPortGASES , compIndex , 0 . 0 ) ;SetOutputVar iab le (kPortCATHODES , compIndex , 0 . 0 ) ;SetOutputVar iab le ( kF i r s tPo r t , compIndex , value ) ;}}solTemp = GetPr i va teVar iab le ( kPr ivateContents , l oca l−>OutTempIndex ) ;SetOutputVar iab le ( kF i r s tPo r t , l oca l−>OutTempIndex , solTemp ) ;SetOutputVar iab le ( kPortGASES , loca l−>OutTempIndex , solTemp ) ;SetOutputVar iab le (kPortCATHODES , loca l−>OutTempIndex , solTemp ) ;i f ( l oca l−>f i r s t T ime )l oca l−>f i r s t T ime = f a l s e ;i f ( verbose )/ / ∗ I n t e r n a l CADSIM Plus energy balance check#de f ine SKIP NonFlowMass# inc lude ” non f l ow i . cpp ”i f ( volume > 0 .0 )/ / I n t e r n a l CADSIM Plus mass balance checkRefreshFreeVar iab les ( ) ;}} /∗ Perform ∗ /leave :{}}/∗ ============================================================= ∗ //∗ Reading / Wr i t i ng ∗ //∗ ============================================================= ∗ // / Reading and w r i t i n g data to move between t ime steps and save f i l e s/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− WriteDataToMemory −−−−−−−−−−−−−−−−−−−−−− ∗ /WriteDataToMemory funct ion/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ReadDataFromMemory −−−−−−−−−−−−−−−−−−−−−∗/ReadDataFromMemory function219APPENDIX C. ELECTROWINNING CODE/∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− Wri teDataToFi le −−−−−−−−−−−−−−−−−−−−−−−−∗/Wr i t eDa taToF i l e func t i on/∗ ============================================================= ∗ //∗ Terminat ion ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− Terminate −−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ∗ /Te rm ina te func t ion/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ShutDown −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ∗ /Standard ShutDown funct ion220APPENDIXDCOOLING TOWER CODEThe following lists the code input C++ for the cooling tower module. Code relating togeneric functions used in setting up the module for CADSIM Plus have been replaced witha descriptor for brevity. This has been noted with a “*” preceding a comment./∗ F i l e : CoolingTower .CPP ∗ //∗ Author ( s ) : MJ. Mahon ∗ //∗ ============================================================= ∗ //∗ Descr ip t ion , Requirements and Recogni t ion ∗ //∗ ============================================================= ∗ /# de f ine kModuleDescr ipt ion ”COOLING TOWER”/∗ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! DO NOT CHANGE THE FOLLOWING LINE ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ∗ /# de f ine kProgramNumber kProgramAurelCadsimPlus/∗ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ∗ /# de f ine kFi leTag MYCOOLINGTOWER#def ine kPortHOT kF i r s t Po r t / / Hot water stream en te r i ng#de f ine kPortAIR kSecondPort / / A i r blown in to the tower#de f ine kPortCOOLED kF i r s t Po r t / / Cooled water stream ex i t i n g#de f ine kPortVENT kSecondPort / / A i r e x i t i n g the tower#de f ine kPr iva teContents kF i r s t Po r t / / L i qu id contents o f the tower#de f ine kP r i v a t eA i r kSecondPort / / A i r contents o f the tower#de f ine BYPASSMAX 100#def ine MAXLOOP 10#def ine TEST1 1#def ine TEST2 2221APPENDIX D. COOLING TOWER CODE#def ine BRACKET 3#def ine NARROWING 4#def ine LASTDITCH 5s t a t i c Qchar kKeywordNames [ ] ={”COOLING” ,END OF LIST} ;s t a t i c Qchar kStreamRequirements [ ] ={FLOWNAME,TEMPERATURE NAME,END OF LIST} ;s t a t i c T NameValue kFreeUni tVar iab leTab le [ ] ={NAME VALUE(VOLUME NAME, 10 .0 ) ,NAME VALUE( ” MerkelNumber ” , 1 .50 ) ,END OF NAMES VALUES} ;enum E FreeVarIndex/ / Se t t i ng up Free Var iab le Ind iceess t a t i c Qchar kCalcVar iab les [ ] ={{” HeatRejected ”} ,{”WaterLoss ”} ,{” L iqu id / GasRatio ”} ,{” TemperatureChange ”} ,{” RetentionTime ”} ,END OF LIST} ;enum E CalcVarIndex/ / Se t t i ng up Calcu la ted Var iab le Ind icess t a t i c Qchar kQua l i f i e r s [ ] ={DYNAMIC NAME,END OF LIST} ;enum E Out le t Index/ / Se t t i ng up Ou t le t Ind i ces222APPENDIX D. COOLING TOWER CODEs t r u c t T Qua l i t y I nd i ces{T Index qual i tyCompIndex ;T Index motherIndex ;double holdupMotherValue ;} ; /∗ T Qua l i t y I nd i ces ∗ /PointerTypes ( T Qua l i t y I nd i ces ) ;s t r u c t T CompIndices/ / Se t t i ng component ( e . g . Water ) i nd i cesPointerTypes ( T CompIndices ) ;s t a t i c const T Size kMax I te ra t ions = 3;s t a t i c E Out le t Index gWhichType ;s t a t i c T Index gIndex ;Beg in p r i va te da ta ( kFi leTag )/ / dec la r i ng ins tance va r i ab l e i nd i cesEnd pr i va te da ta ( kFi leTag )S tanda rd un i t desc r i p t i on( kFi leTag , /∗ source f i l e name ∗ /kProgramNumber , /∗ program number ∗ /kModuleDescr ipt ion , /∗ module desc r i p t i o n ∗ /kKeywordNames , /∗ module keywords ∗ /kFreeUni tVar iab leTable , /∗ names of u n i t f r ee va r i ab l es / de f au l t values ∗ /kCalcVar iables , /∗ names of u n i t ca lc va r i ab l es ∗ /kStreamRequirements , /∗ names of requ i red va r i ab l es ∗ /kQua l i f i e r s , /∗ names of u n i t q u a l i f i e r s ∗ /kREACTOR, /∗ what k ind o f u n i t ∗ /2 , /∗ minimum number o f i npu ts ∗ /2 , /∗ maximum number o f i npu ts ∗ /2 , /∗ minimum number o f outputs ∗ /2 , /∗ maximum number o f outputs ∗ /t rue , /∗ supports mu l t i p l e stream de f i n i t i o n s on i n l e t s ∗ /t rue , /∗ supports mu l t i p l e stream de f i n i t i o n s on ou t l e t s ∗ /t rue , /∗ i npu t streams have spec ia l names ∗ /t rue , /∗ output streams have spec ia l names ∗ /f a l se , /∗ s p l i t r a t i o s al lowed ∗ /f a l se , /∗ a u x i l i a r y va r i ab l es are normal ∗ /f a l se , /∗ number o f f r ee un i t va r i ab l es va r i es ∗ /f a l se , /∗ can pass networked f lows ∗ /f a l se , /∗ supports mu l t i p l e networks ∗ /kPopup standard ) /∗ k ind o f u n i t pop−up ∗ /# de f ine kDomainThreshold 1.0e−11223APPENDIX D. COOLING TOWER CODE#def ine kRangeThreshold 1.0e−7s t r u c t T Cool ingData/ / dec la r i ng doSolveCool ing va r i ab l e s t r u c t u r e} ;PointerTypes ( T Cool ingData ) ;/∗ ============================================================= ∗ //∗ Local f unc t i ons ∗ //∗ ============================================================= ∗ /s t a t i c Use rFunc t i on de f i n i t i o n ( doSolveCool ing )/∗ Solves coo l i ng tower using the Poppe Method ∗ /{double endPoint , sumw, tempAirTempK , tempSolTempK , n , dhdTw , increment ;double sumh , dMedTw, sumMe, humidGuess , humidi tyRat ioVap , cpw , a i r I n ;double humid i tyRat ioSat , waterOut , water In ;double ambPressure , a i rOut , lew isFactor , latHeatVap , dewPointTVap , pvVap ;double enthalpyVapourVap , dwdTa , dTwdTa , enthalpyVapourSat , f2 , humiditySup ;double airTemp , airTempK , pvsSup , pvSup , dwdTw, merkelGiven , merkelCalc ;double humidi tyRat ioSup , latHeatVapSup , dewPointTSup , enthalpyVapourSup ;double setMass , pvsSat , humidi tySat , latHeatVapSat , steamMass , inputVa lue ;T Cool ingData & data = ∗Rein te rp re tCas t ( PT CoolingData , s t u f f ) ;/ / Value here i s the guess o f the f i n a l s o l u t i o n o u t l e t temperature (K)const T ConversionFactors & convFacts = ∗ConversionFactors ( ) ;T Index index ;QT Resource who = data .who ;PT PrivateData l o c a l = data . l o c a l ;PT CompIndices a i r I ndexP t r = loca l−>compIndices + 1;PDouble compMassAirPtr ;T Index compCountAir = GetCountOfInputComponents ( kPortAIR ) ;T Index compIndex ;QT ComponentInfo compInfo ;T Environment env ;E PhysResult s ta tus ;humidGuess = data . humidGuess ;merkelGiven = data . merkel ;ambPressure = data . ambPressure ;enthalpyVapourSat = data . enthalpyVapourSat ;a i r I n = data . a i r I n ;water In = data . water In ;humidi tyRat ioVap = data . humid i tyRat ioDry ;224APPENDIX D. COOLING TOWER CODEhumidi tyRat ioVap = data . humidGuess ;humid i tyRat ioSat = data . humid i tyRat ioSat ;tempSolTempK = value ; / / = valuetempAirTempK = data . dryBulbTempK ;endPoint = data . s t a r t P o i n t ;a i rOut = a i r I n ; / / Placeholder , should inc lude water vapourpvVap = humidi tyRat ioVap ∗ ambPressure / (0.6219 +humidi tyRat ioVap ) ;merkelCalc = 0 . 0 ;i f ( pvVap <= 0 .0 )pvVap = kZeroWannaBe ;waterOut = water In / a i r I n ∗ (1 − ( ( a i r I n / water In ) ∗( humidGuess − data . humid i tyRat ioDry ) ) ) ∗ a i rOut ;/ / Value here i s the guess o f the f i n a l s o l u t i o n o u t l e t temperature (K)increment = ( endPoint − value ) / 5 . 0 ; / / should be 500i f ( fabs ( increment ) < kZeroWannaBe )increment = kZeroWannaBe ;humidGuess = data . humidGuess ;merkelGiven = data . merkel ;ambPressure = data . ambPressure ;enthalpyVapourSat = data . enthalpyVapourSat ;a i r I n = data . a i r I n ;water In = data . water In ;humidi tyRat ioVap = data . humid i tyRat ioDry ;humid i tyRat ioSat = data . humid i tyRat ioSat ;tempAirTempK = data . dryBulbTempK ;a i rOut = a i r I n ; / / Placeholder , should inc lude water vapourpvVap = humidi tyRat ioVap ∗ ambPressure / (0.6219 +humidi tyRat ioVap ) ;merkelCalc = 0 . 0 ;i f ( pvVap <= 0 .0 )pvVap = kZeroWannaBe ;waterOut = water In / a i r I n ∗ (1 − ( ( a i r I n / water In ) ∗( humidGuess − humidi tyRat ioVap ) ) ) ∗ a i rOut ;/∗ I n i t i a l i z e s the P r i v a t eA i r stream to be the same as the AIR I n l e t ∗ /Se tP r i va teVar iab le ( kP r i va teA i r , a i r I ndexP t r−>f lowIndex , 1 . 0 ) ;double pr iva teA i rMass ;pr iva teA i rMass = 0 . 0 ;f o r ( compIndex = 1 , compMassAirPtr = loca l−>compMassesAir ,l oca l−>numQuality = 0 ; compIndex <= compCountAir ; ++compIndex ,++compMassAirPtr )225APPENDIX D. COOLING TOWER CODE{compInfo = GetOutputComponentInfo ( kPortAIR , compIndex ) ;env . fCategory = compInfo−>fCategType ;env . fPhase = compInfo−>fPhase ;setMass = Get Inpu tVar iab le ( kPortAIR , compIndex ) ;Se tP r i va teVar iab le ( kP r i va teA i r , compIndex , setMass ) ;p r iva teA i rMass += setMass ;}f o r ( ; tempSolTempK + 0.01 < data . s t a r t P o i n t ; ){/∗ Code to set up the i n t e r n a l stream to be at ambient pressure andincoming so l u t i o n temperautre making the ” sa tu ra ted maximum”∗ /env . fTemperature = tempSolTempK − kOf f se tKe l v i n ;env . fPressure = ambPressure / kThousand ;inputValue = tempSolTempK − kOf f se tKe l v i n ;inputValue /= convFacts . fTemp ;inputValue −= convFacts . fTempOffset ;Se tP r i va teVar iab le ( kP r i va teA i r , a i r I ndexP t r−>temperatureIndex ,inputVa lue ) ;inputValue = ambPressure / kThousand / convFacts . fPressure ;Se tP r i va teVar iab le ( kP r i va teA i r , a i r I ndexP t r−>pressureIndex , inputVa lue ) ;/∗ Sets the steam component and to make the humid i ty to 100% ∗ /compIndex = loca l−>steamInAir Index ;compInfo = GetOutputComponentInfo ( kP r i va teA i r , compIndex ) ;env . fCategory = compInfo−>fCategType ;env . fPhase = compInfo−>fPhase ;pvsSat = DeterminePr iva teProper ty ( compInfo , kP r i va teA i r ,kPhysProp Pv , &env , &s ta tus ) ∗kThousand ; / / Pahumid i tyRat ioSat = ( GetPr i va teVar iab le ( kP r i va teA i r ,l oca l−>humid i tyRat io Index ) +convFacts . fTempOffset ) ∗ convFacts . fTemp ;humid i tyRat ioSat = (0.6219 ∗ pvsSat ) / ( ambPressure − pvsSat ) ;inputVa lue = humid i tyRat ioSat ∗( Ge tPr i va teVar iab le ( kP r i va teA i r , a i r I ndexP t r−>f lowIndex ) ∗convFacts . fMassFlow −GetPr i va teVar iab le ( kP r i va teA i r , compIndex )∗convFacts . fMassFlow ) ;inputValue /= convFacts . fMassFlow ;Se tP r i va teVar iab le ( kP r i va teA i r , compIndex , inputVa lue ) ;enthalpyVapourSat = GetPr i va teVar iab le ( kP r i va teA i r ,226APPENDIX D. COOLING TOWER CODEl o ca l−>en tha lpyA i r Index ) ∗convFacts . fSpecEnergy ;/∗ Code to set up the i n t e r n a l stream to be at ambient pressure andincrements the temperature w i th the f o r loop . ∗ /inputVa lue = tempAirTempK − kKe lv in ;inputValue /= convFacts . fTemp ;inputValue −= convFacts . fTempOffset ;Se tP r i va teVar iab le ( kP r i va teA i r , a i r I ndexP t r−>temperatureIndex ,inputVa lue ) ;inputValue = ambPressure / kThousand / convFacts . fPressure ;Se tP r i va teVar iab le ( kP r i va teA i r , a i r I ndexP t r−>pressureIndex , inputVa lue ) ;env . fTemperature = tempSolTempK − kKe lv in ;compIndex = loca l−>wate r InA i r Index ;i f ( ! compIndex ){compIndex = loca l−>waterInWaterIndex ;compInfo = GetPrivateComponentInfo ( kPr ivateContents , compIndex ) ;cpw = DeterminePr iva teProper ty ( compInfo , kPr ivateContents ,kPhysProp Cp , &env , &s ta tus ) ∗kThousand ;}else{compInfo = GetPrivateComponentInfo ( kP r i va teA i r , compIndex ) ;cpw = DeterminePr iva teProper ty ( compInfo , kPr ivateContents ,kPhysProp Cp , &env , &s ta tus ) ∗kThousand ;}env . fTemperature = tempAirTempK − kKe lv in ;pvsSat = DeterminePr iva teProper ty ( compInfo , kP r i va teA i r ,kPhysProp Pv , &env , &s ta tus ) ∗kThousand ; / / PacompIndex = loca l−>a i r I nA i r I n de x ;compInfo = GetPrivateComponentInfo ( kP r i va teA i r , compIndex ) ;compIndex = loca l−>steamInAir Index ;compInfo = GetPrivateComponentInfo ( kP r i va teA i r , compIndex ) ;sumw = 0 .0 ;sumh = 0 .0 ;sumMe = 0 .0 ;f o r ( n = 1; n <= 2; n++){227APPENDIX D. COOLING TOWER CODE/∗ This sec t ion w i l l c a l cu l a t e i n an a i r + steam stream the : humid i ty (%) ,l a t e n t heat o f vapo r i za t i on ( kJ / kg ) , and entha lpy o f the a i rstream ( kJ / kg ) based on the temperature , pressure , andhumid i ty r a t i o ( kg / kg ) . ∗ //∗ Sets the steam component and to make the humid i ty to 100% ∗ /compIndex = loca l−>steamInAir Index ;steamMass = humidi tyRat ioVap ∗( Ge tPr i va teVar iab le ( kP r i va teA i r , a i r I ndexP t r−>f lowIndex ) ∗convFacts . fMassFlow −GetPr i va teVar iab le ( kP r i va teA i r , l oca l−>steamInAir Index ) ∗convFacts . fMassFlow ) ;inputValue = steamMass / convFacts . fMassFlow ;Se tP r i va teVar iab le ( kP r i va teA i r , compIndex , inputVa lue ) ;latHeatVap = DeterminePr iva teProper ty ( compInfo , kP r i va teA i r ,kPhysProp Hv , &env , &s ta tus ) ;enthalpyVapourVap = GetPr i va teVar iab le ( kP r i va teA i r ,l oca l−>en tha lpyA i r Index ) ∗convFacts . fSpecEnergy ;lew isFac to r = pow(0 .865 , 0.6667) ∗ ( ( ( ( humid i tyRat ioSat +0.622) / ( humidi tyRat ioVap + 0 .622) ) − 1 ) ) /( log ( ( humid i tyRat ioSat + 0.622) /( humidi tyRat ioVap + 0 . 6 2 2 ) ) ) ;dwdTw = (cpw ∗ ( waterOut / a i rOut ) ∗ ( humid i tyRat ioSat − / / Kloppershumidi tyRat ioVap ) ) / ( ( enthalpyVapourSat −enthalpyVapourVap ) ∗ kThousand + ( ( lew isFac to r − 1 .0 ) ∗( enthalpyVapourSat ∗ kThousand − enthalpyVapourVap ∗kThousand − ( humid i tyRat ioSat − humidi tyRat ioVap ) ∗latHeatVap ∗ kThousand ) ) − ( humid i tyRat ioSat −humidi tyRat ioVap ) ∗ cpw ∗ ( tempSolTempK − kOf f se tKe l v i n ) ) ;dhdTw = (cpw ∗ waterOut / a i r I n ) ∗ ( 1 .0 + ( ( ( humid i tyRat ioSat −humidi tyRat ioVap ) ∗ cpw ∗ ( tempSolTempK − kOf f se tKe l v i n ) /( enthalpyVapourSat ∗ kThousand − enthalpyVapourVap ∗kThousand + ( lew isFac to r − 1 .0 ) ∗ ( enthalpyVapourSat ∗kThousand − enthalpyVapourVap ∗ kThousand −( humid i tyRat ioSat − humidi tyRat ioVap ) ∗ latHeatVap ∗kThousand ) − ( humid i tyRat ioSat − humidi tyRat ioVap ∗ cpw ∗( tempSolTempK − kOf f se tKe l v i n ) ) ) ) ) ) ;dMedTw = cpw / ( enthalpyVapourSat ∗ kThousand − enthalpyVapourVap ∗kThousand + ( lew isFac to r − 1 .0 ) ∗ ( enthalpyVapourVap ∗kThousand − enthalpyVapourVap ∗ kThousand −( humid i tyRat ioSat − humidi tyRat ioVap ) ∗ latHeatVap ∗228APPENDIX D. COOLING TOWER CODEkThousand ) − ( humid i tyRat ioSat − humidi tyRat ioVap ) ∗ cpw ∗( tempSolTempK − kOf f se tKe l v i n ) ) ;sumw += (dwdTw / 2 . 0 ) ;sumh += (dhdTw / 2 . 0 ) ;sumMe += (dMedTw / 2 . 0 ) ;tempSolTempK += increment ;}tempSolTempK −= increment ;sumw = sumw ∗ ( increment ) + humidi tyRat ioVap ;humidi tyRat ioVap = sumw;i f ( humidi tyRat ioVap <= 0 .0 )humidi tyRat ioVap = kZeroWannaBe ;i f (sumMe < 0 .0 )sumMe = 0 .0 ;steamMass = humidi tyRat ioVap ∗( Ge tPr i va teVar iab le ( kP r i va teA i r , a i r I ndexP t r−>f lowIndex ) ∗convFacts . fMassFlow −GetPr i va teVar iab le ( kP r i va teA i r , l oca l−>steamInAir Index ) ∗convFacts . fMassFlow ) ;\inputVa lue = steamMass / convFacts . fMassFlow ;Se tP r i va teVar iab le ( kP r i va teA i r , compIndex , inputVa lue ) ;pvVap = humidi tyRat ioVap ∗ ambPressure / (0.6219 +humidi tyRat ioVap ) ;i f ( pvVap <= 0 .0 )pvVap = kZeroWannaBe ;merkelCalc += sumMe ∗ increment ;sumh = sumh / kThousand ∗ ( increment ) + enthalpyVapourVap ;enthalpyVapourVap = sumh ;inputValue = (sumh / convFacts . fSpecEnergy ) ∗ pr iva teA i rMass ;SetPr ivateEnergy ( kP r i va teA i r , inputVa lue ) ;tempAirTempK = ( GetPr i va teVar iab le ( kP r i va teA i r ,a i r I ndexP t r−>temperatureIndex ) +convFacts . fTempOffset ) ∗ convFacts . fTemp +kOf f se tKe l v i n ;env . fTemperature = tempAirTempK − kKe lv in ;pvsSat = DeterminePr iva teProper ty ( compInfo , kP r i va teA i r ,kPhysProp Pv , &env , &s ta tus ) ∗kThousand ; / / Pa}data . tempSolTempK = value ;data . tempAirTempK = tempAirTempK ;229APPENDIX D. COOLING TOWER CODEdata . humidi tyRat ioVap = humidi tyRat ioVap ;data . enthalpyVapourVap = enthalpyVapourVap ;data . endPoint = tempSolTempK ;f2 = ( merkelCalc − merkelGiven ) ;data . deltaMe = f2 ;r e t u rn f2 ;}/∗ ============================================================= ∗ //∗ Creat ion ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− SetUp −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ∗ /S tandard SetUp funct ion/∗ ============================================================= ∗ //∗ Uni t Matching ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetInputDefaultName −−−−−−−−−−−−−−−−−−−− ∗ // / Co l l e c t i ng names of each streamGet InputDefau l tName funct ion{RecognizeAllArguments ( GetInputDefaultName )i f ( ( which − kF i r s t Po r t ) >= numbIn )r e t u rn NULL ;i f ( which == kPortAIR ){∗ i sRequi red = kNameMandatory ;r e t u rn ” AIR ” ;}∗ i sRequi red = kNameDefault ;s t r cpy ( gTempBuff , IN NAME ) ;s t r c a t ( gTempBuff , Str ingFromIndex (NULL, 0 , which + 1 − kF i r s t Po r t ) ) ;r e t u rn gTempBuff ;} /∗ GetInputDefaultName ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetOutputDefaultName −−−−−−−−−−−−−−−−−−− ∗ /GetOutputDefaul tName funct ion{/ / Note t ha t t h i s module does not f o l l ow the naming convent ion f o r new/ / modules − the l a s t output stream has a mandatory name, ra t he r than/ / having the mandatory streams be the f i r s t streams .RecognizeAllArguments ( GetOutputDefaultName )i f ( ( which − kF i r s t Po r t ) >= numbOut )r e t u rn NULL ;230APPENDIX D. COOLING TOWER CODEi f ( which == kPortVENT ){∗ i sRequi red = kNameMandatory ;r e t u rn VENT NAME;}∗ i sRequi red = kNameDefault ;s t r cpy ( gTempBuff , OUT NAME) ;s t r c a t ( gTempBuff , Str ingFromIndex (NULL, 0 , which + 1 − kF i r s t Po r t ) ) ;r e t u rn gTempBuff ;} /∗ GetOutputDefaultName ∗ //∗ ============================================================= ∗ //∗ I n i t i a l i z a t i o n ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− PrepareForSpec i f i ca t ions −−−−−−−−−−−−−−− ∗ /S tanda rd Prepa reForSpec i f i ca t i ons func t i on/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− PrepareGetUni tFreeInfo −−−−−−−−−−−−−−−−− ∗ /P repareGetUn i tF ree In fo func t ion{T Size count = 4 ;RecognizeAllArguments ( PrepareGetUni tFreeInfo )i f ( verbose )P r i n t S e l f (”− prepar ing to get u n i t f r ee i n f o f o r ” , ” −\n ” ) ;gWhichType = kVolume ;re t u rn count ;} /∗ PrepareGetUni tFreeInfo ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetNextUni tFreeInfo −−−−−−−−−−−−−−−−−−−− ∗ /Ge tNex tUn i tF ree In fo func t i on/ / ∗Co l l e c t i ng names of each f ree va r i ab l e/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− PrepareGetDeferredVarInfo −−−−−−−−−−−−−− ∗ /P repareGetDefer redVar In fo func t ion/ / I d e n t i f y i n g defer red va r i ab l es/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetNextDeferredVarInfo −−−−−−−−−−−−−−−−− ∗ /GetNex tDefe r redVar In fo func t ion/ / Get t ing defer red va r i ab l e i n f o rma t i on/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− I n i t i a l i z e −−−−−−−−−−−−−−−−−−−−−−−−−−−−− ∗ /I n i t i a l i z e f u n c t i o n{PT CompIndices indexPt r ;QT StreamDef in i t ion waterSdef , a i rSde f ;Pdouble compMassPtr , compMassAirPtr ;QT ComponentInfo compInfo ;231APPENDIX D. COOLING TOWER CODET Index compCount , index ;T Environment env ;T Size streamIndex ;RecognizeAllArguments ( I n i t i a l i z e )i f ( verbose )P r i n t S e l f (”− i n i t i a l i z i n g ” , ” −\n ” ) ;waterSdef = Ge t I npu tDe f i n i t i o n ( kPortHOT ) ;a i rSde f = Ge t I npu tDe f i n i t i o n ( kPortAIR ) ;/ / ∗Check t ha t requ i red components ( a i r , water , water vapour ) are presentl oca l−>compIndices = A l l o ca t eS t r u c t s ( numbOut , T CompIndices ) ;/ / ∗Declar ing ind i ces o f s p e c i f i c stream component va r i ab l es ( e . g . water )compCount = GetCountOfInputComponents ( kPortHOT ) ;l oca l−>compMasses = Al locateDoubles ( compCount ) ;/ / ∗ I n i t i a l i z i n g component masses and temperatureClonePrivateStreamFromOutputStream ( kPr ivateContents , ” I n t e r n a l ” , kPortHOT ) ;ClonePrivateStreamFromOutputStream ( kPr i va teA i r , ” I n t e r n a l ” , kPortAIR ) ;} /∗ I n i t i a l i z e ∗ //∗ ============================================================= ∗ //∗ Get t ing Free Var iab les ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− PrepareGetOut le tFreeInfo −−−−−−−−−−−−−−− ∗ /P repareGetOu t le tF ree In fo func t ion{RecognizeAllArguments ( PrepareGetOut le tFreeInfo )i f ( verbose )P r i n t S e l f (”− prepar ing to get next o u t l e t f r ee i n f o f o r ” , ” −\n ” ) ;/ / t h i s needs to have both s ides checked .i f ( ( l oca l−>compIndices−>pressureIndex == NOT FOUND) &&( ( l oca l−>compIndices + 1)−>pressureIndex == NOT FOUND) )r e t u rn f a l s e ;gWhichType = kPressureOut le t ;r e t u rn t rue ;} /∗ PrepareGetOut le tFreeIn fo ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetNextOut le tFreeIn fo −−−−−−−−−−−−−−−−−− ∗ /Ge tNex tOu t l e tF ree In fo func t i on/ / ∗Co l l e c t Ou t l e t f r ee va r i ab l e i n fo rma t i on ( none f o r t h i s module )/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− OutletSpecCanBeOnStream −−−−−−−−−−−−−−−− ∗ /Standard OutletSpecCanBeOnStream function/∗ ============================================================= ∗ //∗ Prepar ing f o r Network Ca l cu la t i ons ∗ /232APPENDIX D. COOLING TOWER CODE/∗ ============================================================= ∗ //∗ ============================================================= ∗ //∗ Get t ing and Se t t i ng In fo rma t i on ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetTypicalValue −−−−−−−−−−−−−−−−−−−−−−−− ∗ /S tandard GetTyp ica lVa lue func t ion/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− GetUni tsForVar iab le −−−−−−−−−−−−−−−−−−−− ∗ /Ge tUn i t sFo rVa r i ab le func t i on/ / ∗Set d i sp lay un i t s f o r f r ee and ca l cu la ted va r i ab l es/∗ ============================================================= ∗ //∗ Ca lcu la t i ons ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− Execute −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ∗ /S tandard Execute func t ion/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− Perform −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ∗ /Pe r fo rm func t ion{double convToMin , volume , vFlow , re ten t i on , value ;double deltaEnergy , sum, f r a c t i o n , tankVol , pvSat ;double sum2 , newMass , res iden t , incMass , pvsVap ;double energy , reacted , humidi ty , guessNumber , pvDry ;double to ta lT ime , d i f f V o l , dryBulbTemp , pvsSat , pvVap ;double solTemp , ambPressure , dryBulbTempK , water In ;double privateMass , airFlowRate , pvsDry , dewPointTSat ;double vo lSo l ids , humidi tyRat ioVap , dewPointTVap ;double l i qu idF low , latHeatVap , guessSolTempK , de l taT ;double minTempK , convVFlowToL , maxTempK, tempSolTempK ;double energyAi r In , energyAirOut , enthalpyVapourSat ;double airMassFlowRate , humid i tyRat ioSat , endPoint ;double humid i tyRat ioDry , dewPointTDry , deltaHumRatio ;double solTempK , guessHumidityRatio , s t a r t P o i n t ;double airTempK , airTemp , value2 ;double solHotEnergy , pvsSup , pvSup , enthalpyVapourDry ;double humiditySup , enthalpyVapourSup , so l Temp In i t i a l ;double humidi tyRat ioSup , latHeatVapSup , dewPointTSup ;double tempAirTempK , merkel , index ;double waterEvaporat ion , steamVapour ;Pdouble compMassPtr , compMassAirPtr ;E PhysResult s ta tus ;PT Qua l i t y Ind ices q u a l i t y P t r ;233APPENDIX D. COOLING TOWER CODEPT CompIndices water IndexPt r = loca l−>compIndices ;PT CompIndices a i r I ndexP t r = loca l−>compIndices + 1;QT ComponentInfo compInfo ;QT CategoryData categData ;const T ConversionFactors & convFacts = ∗ConversionFactors ( ) ;T Environment env ;T Index compCountWater , compFlowCountWater , compIndex ;T Index loop , compCountAir , compFlowCountAir ;T Size streamIndex ;T Cool ingData coo l i ng ;RecognizeAllArguments ( Perform )/ / s e t t i n g un i t s t ha t w i l l not change over the runcompCountWater = GetCountOfInputComponents ( kPortHOT ) ;compFlowCountWater = GetCountOfOutputFlowComponents ( kPortCOOLED ) ;compFlowCountAir = GetCountOfOutputFlowComponents ( kPortVENT ) ;compCountAir = GetCountOfInputComponents ( kPortAIR ) ;convToMin = 60.0 / convFacts . fTime ; / / from user t ime to sec and then to minvolume = FreeUn i tVar iab le ( indexVOLUME) ∗ convFacts . fVolumeTank ;i f ( volume < kZeroWannaBe ){Pchar mes1 = TranslateMessage1 ( ”VOLUME (%1) i s negat ive or ”” e s s en t i a l l y zero . ” ,StringFromDouble (NULL, 0 , volume ) ) ;Pchar mes2 = TranslateMessage1 ( ” I t w i l l be assumed to be equal to ””(%1) f o r c a l c u l a t i o n s . ” ,StringFromDouble (NULL, 0 , kZeroWannaBe ) ) ;SignalAlarmAndFree2 ( kAlarmImportant , mes1 , mes2 ) ;volume = kZeroWannaBe ;}de l taT = GetDeltaTime ( ) ∗ 60 .0 ; /∗ i t e r a t i o n t ime (min ) to seconds ∗ // / ( L / s / userVolumeFlow ) ∗ ( s / contents )convVFlowToL = convFacts . fVolumeFlow ∗ convFacts . fTime ;i f ( isWarmup ) / / Warmup i s run once to i n i t i a l i z e va r i ab l es{bool foundVal idData = f a l s e ;double tankVol ;Qdouble pData = in te rna lDa ta ;T Size valuesCount = GetCountOfOutputValues (kPortCOOLED ) ;i f ( verbose )P r i n t S e l f (”− warming up ” , ” −\n ” ) ;f o r ( streamIndex = 0; streamIndex < numbIn ; ++streamIndex )234APPENDIX D. COOLING TOWER CODEi f ( CheckInputDetached ( streamIndex ) )goto leave ;f o r ( streamIndex = 0; streamIndex < numbOut ; ++streamIndex )i f ( CheckOutputDetached ( streamIndex ) )goto leave ;l oca l−>f i r s t T ime = t rue ;/∗ I n i t i a l i z e volume / holdup i n f o to est imates ( or s t a r t values ) ∗ //∗ Out le t conc . i s equal to tank concen t ra t ions ∗ /i f ( pData )/ / ∗ I n i t i a l i z e stream components from a save f i l e i f a va i l ab l e or/ / o u t l e t stream composi t ion and de f au l t u n i t f r ee va r i ab l es .ambPressure = Get Inpu tVar iab le ( kPortAIR , a i r I ndexP t r−>pressureIndex ) ;ambPressure = ( ambPressure + convFacts . fP ressureOf fse t ) ∗convFacts . fPressure ∗ kThousand ; / / To Pai f ( ambPressure < 10000.0)ambPressure = 10000.0;dryBulbTemp = ( Get Inpu tVar iab le ( kPortAIR , a i r I ndexP t r−>temperatureIndex ) +convFacts . fTempOffset ) ∗ convFacts . fTemp ;so l Temp In i t i a l = ( Get Inpu tVar iab le ( kPortHOT ,water IndexPtr−>temperatureIndex ) +convFacts . fTempOffset ) ∗ convFacts . fTemp ;ai rF lowRate = Get Inpu tVar iab le ( kPortAIR , a i r I ndexP t r−>volFlowIndex ) ;airMassFlowRate = Get Inpu tVar iab le ( kPortAIR , a i r I ndexP t r−>f lowIndex ) ;a i rF lowRate = Get Inpu tVar iab le ( kPortAIR , a i r I ndexP t r−>volFlowIndex ) ∗convFacts . fVolumeFlow ;airMassFlowRate = Get Inpu tVar iab le ( kPortAIR , a i r I ndexP t r−>f lowIndex ) ∗convFacts . fMassFlow ;i f ( a i rF lowRate <= 0 .0 )ai rF lowRate = kZeroWannaBe ;tankVol = GetPr i va teVar iab le ( kPr ivateContents ,water IndexPtr−>volFlowIndex ) ∗convVFlowToL ;l i qu i dF l ow = GetOutputVar iable ( kPortCOOLED , loca l−>l i qu idVo lF lowIndex ) ∗convFacts . fVolumeFlow ;i f ( l i qu i dF l ow <= kZeroWannaBe )l i qu i dF l ow = kZeroWannaBe ;i f ( ( tankVol > kZeroWannaBe ) ){f r a c t i o n = volume / tankVol ;f o r ( compIndex = 1; compIndex <= compCountWater ; ++compIndex ){235APPENDIX D. COOLING TOWER CODEvalue = GetPr i va teVar iab le ( kPr ivateContents , compIndex ) ;compInfo = GetOutputComponentInfo ( kPortCOOLED , compIndex ) ;categData = GetOutputCategoryData ( kPortCOOLED ,compInfo−>fCategory ) ;i f ( ( compIndex <= compFlowCountWater ) | |( categData−>fType & kCatNonFlowMass ) ){value ∗= f r a c t i o n ;Se tP r i va teVar iab le ( kPr ivateContents , compIndex , value ) ;}}}}else /∗ performing , but not isWarmup ∗ /{i f ( verbose )P r i n t S e l f (”− per forming ” , ” −\n ” ) ;/∗ We assume tha t the i npu t components and output ∗ //∗ components are congruent (same number o f components i n ∗ //∗ the same order ! ) ∗ /i f ( volume < 0 .0 ){Pchar mes1 = TranslateMessage1 ( ”VOLUME (%1) i s negat ive . ” ,StringFromDouble (NULL, 0 , volume ) ) ;Pchar mes2 = TranslateMessage1 ( ”A value o f %1 w i l l be used f o r ”” c a l c u l a t i o n s . ” , ” 0 . 0 ” ) ;SignalAlarmAndFree2 ( kAlarmImportant , mes1 , mes2 ) ;volume = 0 .0 ;}solTemp = ( Get Inpu tVar iab le ( kPortHOT , water IndexPtr−>temperatureIndex ) +convFacts . fTempOffset ) ∗ convFacts . fTemp ;solTempK = solTemp + kOf f se tKe l v i n ;s o l Temp In i t i a l = ( Get Inpu tVar iab le ( kPortHOT ,water IndexPtr−>temperatureIndex ) +convFacts . fTempOffset ) ∗ convFacts . fTemp ;dryBulbTemp = ( Get Inpu tVar iab le ( kPortAIR , a i r I ndexP t r−>temperatureIndex ) +convFacts . fTempOffset ) ∗ convFacts . fTemp ;dryBulbTempK = dryBulbTemp + kOf f se tKe l v i n ;airTempK = dryBulbTempK ;airTemp = airTempK − kOf f se tKe l v i n ;ambPressure = Get Inpu tVar iab le ( kPortAIR , a i r I ndexP t r−>pressureIndex ) ∗236APPENDIX D. COOLING TOWER CODEconvFacts . fPressure ;ambPressure = ( ambPressure + convFacts . fP ressureOf fse t ) ∗ kThousand ;i f ( ambPressure <= 10000.0)ambPressure = 10000.0;a i rF lowRate = Get Inpu tVar iab le ( kPortAIR , a i r I ndexP t r−>volFlowIndex ) ∗convFacts . fVolumeFlow ;airMassFlowRate = Get Inpu tVar iab le ( kPortAIR , a i r I ndexP t r−>f lowIndex ) ∗convFacts . fMassFlow ;i f ( airMassFlowRate <= 0 .0 )airMassFlowRate = kZeroWannaBe ;i f ( a i rF lowRate <= 0 .0 )ai rF lowRate = kZeroWannaBe ;vFlow = GetOutputVar iable ( kPortCOOLED , loca l−>l i qu idVo lF lowIndex ) ∗convFacts . fVolumeFlow ; /∗ to l / s ∗ /l i qu i dF l ow = GetOutputVar iable ( kPortCOOLED , loca l−>l i qu idVo lF lowIndex ) ∗convFacts . fVolumeFlow ;i f ( l i qu i dF l ow <= kZeroWannaBe )l i qu i dF l ow = kZeroWannaBe ;i f ( NearZero ( vFlow ) )vFlow = kZeroWannaBe ;humid i ty = Get Inpu tVar iab le ( kPortAIR , l oca l−>humid i ty Index ) ;i f ( humid i ty < kZeroWannaBe )humid i ty = kZeroWannaBe ;humid i tyRat ioDry = Get Inpu tVar iab le ( kPortAIR , l oca l−>humid i tyRat io Index ) ;i f ( humid i tyRat ioDry > 1 .0 )humid i tyRat ioDry = 1 . 0 ;/ / Get t ing humid i ty c h a r a c t e r i s t i c s o f incoming a i r (DRY)compIndex = 1;compInfo = GetInputComponentInfo ( kPortHOT , water IndexPtr−>waterIndex ) ;env . fPressure = Get Inpu tVar iab le ( kPortAIR , a i r I ndexP t r−>pressureIndex ) ∗convFacts . fPressure ;env . fTemperature = dryBulbTemp ;enthalpyVapourDry = Get Inpu tVar iab le ( kPortAIR , l oca l−>en tha lpyA i r Index ) ∗convFacts . fSpecEnergy ;/ / Saturated a i r a t water temp cha r a c t e r i s t i c s (SAT)env . fTemperature = solTemp ;humid i ty = Get Inpu tVar iab le ( kPortAIR , l oca l−>humid i ty Index ) ;/∗ This sec t ion w i l l c a l cu l a t e i n an a i r + steam stream the : humid i ty (%) ,l a t e n t heat o f vapo r i za t i on ( kJ / kg ) , and entha lpy o f the a i rstream ( kJ / kg ) based on the temperature , pressure , andhumid i ty r a t i o ( kg / kg ) . ∗ /237APPENDIX D. COOLING TOWER CODE/∗ I n i t i a l i z e s the P r i v a t eA i r stream to be the same as the VENT ou t l e t ∗ /Se tP r i va teVar iab le ( kP r i va teA i r , a i r I ndexP t r−>f lowIndex , 1 . 0 ) ;f o r ( compIndex = 1 , compMassAirPtr = loca l−>compMassesAir ,l oca l−>numQuality = 0 ; compIndex <= compCountAir ; ++compIndex ,++compMassAirPtr ){compInfo = GetOutputComponentInfo ( kP r i va teA i r , compIndex ) ;env . fCategory = compInfo−>fCategType ;env . fPhase = compInfo−>fPhase ;value = GetOutputVar iable ( kPortAIR , compIndex ) ;Se tP r i va teVar iab le ( kP r i va teA i r , compIndex , value ) ;}/∗ Code to set up the i n t e r n a l stream to be at ambient pressure and incomingso l u t i o n temperautre making the ” sa tu ra ted maximum”∗ /value = solTemp ;value /= convFacts . fTemp ;value −= convFacts . fTempOffset ;Se tP r i va teVar iab le ( kP r i va teA i r , a i r I ndexP t r−>temperatureIndex , value ) ;value = ambPressure / kThousand / convFacts . fPressure ;Se tP r i va teVar iab le ( kP r i va teA i r , a i r I ndexP t r−>pressureIndex , value ) ;/∗ Sets the steam component and to make the humid i ty to 100% ∗ /compIndex = loca l−>steamInAir Index ;compInfo = GetOutputComponentInfo ( kP r i va teA i r , compIndex ) ;env . fCategory = compInfo−>fCategType ;env . fPhase = compInfo−>fPhase ;pvsSat = DeterminePr iva teProper ty ( compInfo , kP r i va teA i r ,kPhysProp Pv , &env , &s ta tus ) ∗kThousand ; / / Pahumid i ty = GetPr i va teVar iab le ( kP r i va teA i r , l oca l−>humid i ty Index ) ;humid i tyRat ioSat = GetPr i va teVar iab le ( kP r i va teA i r ,l oca l−>humid i tyRat io Index ) ;humid i tyRat ioSat = (0.6219 ∗ pvsSat ) / ( ambPressure − pvsSat ) ;value = humid i tyRat ioSat ∗( Ge tPr i va teVar iab le ( kP r i va teA i r , a i r I ndexP t r−>f lowIndex ) ∗convFacts . fMassFlow −GetPr i va teVar iab le ( kP r i va teA i r , compIndex )∗convFacts . fMassFlow ) ;value /= convFacts . fMassFlow ;Se tP r i va teVar iab le ( kP r i va teA i r , compIndex , value ) ;enthalpyVapourSat = GetPr i va teVar iab le ( kP r i va teA i r ,l oca l−>en tha lpyA i r Index ) ∗238APPENDIX D. COOLING TOWER CODEconvFacts . fSpecEnergy ;humid i ty = GetPr i va teVar iab le ( kP r i va teA i r , l oca l−>humid i ty Index ) ;water In = Get Inpu tVar iab le ( kPortHOT , water IndexPtr−>waterIndex ) ∗convFacts . fMassFlow ;i f ( water In <= kZeroWannaBe ){water In = kZeroWannaBe ;}s t a r t P o i n t = ( Get Inpu tVar iab le ( kPortHOT ,water IndexPtr−>temperatureIndex ) +convFacts . fTempOffset ) ∗ convFacts . fTemp + kOf f se tKe l v i n ;endPoint = dryBulbTempK + 5 .0 ; / / t h i s should be a guess o f o u t l e t Sol TemptempSolTempK = s t a r t P o i n t ;tempAirTempK = airTempK ;merkel = FreeUn i tVar iab le ( indexMerkelNumber ) ;/ / DoSolveCooling outer roo t so l v i ngi f ( l oca l−>f i r s t T ime ){guessHumidi tyRat io = ( humid i tyRat ioDry ) ; / / + humid i tyRat ioSat ) / 2 . 0 ;guessSolTempK = ( s t a r t P o i n t + tempAirTempK ) / 2 . 0 ;l oca l−>f i r s t T ime = f a l s e ;l oca l−>bypassCounter = 0 ;}/∗ Bypass check to make sure the dosolve rou t i nes are f i r e d occas iona l l y ∗ /e lse i f ( l oca l−>bypassCounter < BYPASSMAX){guessHumidi tyRat io = loca l−>guessHumidi tyRat io ;guessSolTempK = loca l−>guessSolTempK ;l oca l−>bypassCounter ++;}/∗ rese t o f the bypassCounter ∗ /e lse{guessHumidi tyRat io = ( humid i tyRat ioDry + humid i tyRat ioSat ) / 2 . 0 ;guessSolTempK = ( s t a r t P o i n t + tempAirTempK ) / 2 . 0 ;l oca l−>bypassCounter = 0 ;}coo l i ng .who = who ;coo l i ng . l o c a l = l o c a l ;coo l i ng . s t a r t P o i n t = s t a r t P o i n t ; / / Incoming So lu t i on Temp (K)coo l i ng . dryBulbTempK = tempAirTempK ; / / Incoming A i r Temp (K)239APPENDIX D. COOLING TOWER CODEcoo l i ng . humid i tyRat ioDry = humid i tyRat ioDry ; / / Incoming A i r Humidi ty ( kg / kg )coo l i ng . humid i tyRat ioSat = humid i tyRat ioSat ; / / F i na l Humidi ty Guess ( kg / kg )coo l i ng . enthalpyVapourSat = enthalpyVapourSat ; / / Enthalpy o f sa tu ra ted a i rcoo l i ng . enthalpyVapourDry = enthalpyVapourDry ; / / Enthalpy o f dry a i rcoo l i ng . a i r I n = airMassFlowRate ; / / MASS Flow Rate o f A i r In ( kg / s )coo l i ng . water In = water In ; / / Mass Flow Rate o f Water In ( kg / s )coo l i ng . ambPressure = ambPressure ; / / Pressure (Pa)coo l i ng . endPoint = endPoint ; / / Used to spec i f y o u t l e t So lu t i on temperaturecoo l i ng . merkel = merkel ; / / Merkel numbercoo l i ng . humidi tyRat ioVap = guessHumidi tyRat io ;minTempK = 273.1 ; / / coo l i ng . dryBulbTempK ;maxTempK = coo l ing . s t a r t P o i n t ;/∗ Condi t ion to take i f no a i r or water i s f l ow ing i n ∗ /tempSolTempK = coo l ing . tempSolTempK ;humidi tyRat ioVap = coo l ing . humid i tyRat ioDry ;airTempK = coo l ing . dryBulbTempK ;airTemp = airTempK − kOf f se tKe l v i n ;solTempK = coo l ing . s t a r t P o i n t ;solTemp = coo l ing . s t a r t P o i n t − kOf f se tKe l v i n ;i f ( airMassFlowRate > kZeroWannaBe && water In > kZeroWannaBe ){double de l ta , delTest , e r ro r , e r ror1 , er ror2 , r e s u l t ;double tes t0 , tes t1 , tes t2 , t r i a l ;double rangeThreshold = 1.0e−4 / convFacts . fEnergyFlow ;double requiredU , h ighest , lowest ;const double domainThreshold = 1.0e−7;const double f a c t o r = 1 . 6 ;T Index findRootMode , whichError , loops ;findRootMode = TEST1 ;h ighes t = humid i tyRat ioSat ∗ 2 . 0 ; / / ?? Guess of the MAXIMUM vapour humid i tylowest = humid i tyRat ioDry ;i f ( guessHumidi tyRat io > h ighes t )guessHumidi tyRat io = h ighes t ;i f ( guessHumidi tyRat io < lowest )guessHumidi tyRat io = lowest ;t es t0 = guessHumidi tyRat io ;/∗ code from FindConstrainedRoot ∗ //∗ F i r s t , we need to bracket the f unc t i on ; prov ide a rough est imate ∗ //∗ of the f i r s t value to s t a r t w i th : ∗ /t e s t 1 = tes t0 ;i f ( ( t es t1 − lowest ) < domainThreshold )240APPENDIX D. COOLING TOWER CODEt e s t 1 = ( lowest ∗ 0 .8 ) + ( h ighes t ∗ 0 . 2 ) ;e lse i f ( ( h ighes t − t e s t 1 ) < domainThreshold )t es t1 = ( lowest ∗ 0 .2 ) + ( h ighes t ∗ 0 . 8 ) ;guessHumidi tyRat io = t r i a l = t es t1 ;i f ( fabs ( t es t1 ) < domainThreshold )t es t2 = domainThreshold ;e lsetes t2 = ( t es t1 ∗ 0.95) + ( h ighes t ∗ 0 . 05 ) ;coo l i ng . humidGuess = guessHumidi tyRat io ;f o r ( loops = 0; loops < MAXLOOP; ){coo l i ng . humidGuess = guessHumidi tyRat io ;sum = FindConstrainedRoot ( doSolveCooling , &cool ing , guessSolTempK ,minTempK , maxTempK, kDomainThreshold ,kRangeThreshold , verbose , 0 ) ;e r r o r = guessHumidi tyRat io − coo l i ng . humidi tyRat ioVap ;i f ( findRootMode == TEST1)/ / ∗Outer Root so l v i ng method f o r humid i ty}/∗ I f the Merkel number i s not solved , module assumes the l i m i t s o f thecoo l i ng tower are reached ∗ /i f ( coo l i ng . deltaMe >= 0.1 | | coo l i ng . deltaMe <= −0.1){tempSolTempK = loca l−>guessSolTempK ;tempAirTempK = 300.0 ;humidi tyRat ioVap = loca l−>guessHumidi tyRat io ;airTempK = tempAirTempK ;airTemp = airTempK − kOf f se tKe l v i n ;solTemp = tempSolTempK − kOf f se tKe l v i n ;waterEvaporat ion = ( humidi tyRat ioVap − humid i tyRat ioDry ) ∗airMassFlowRate ∗ de l taT ;}else{tempSolTempK = coo l ing . tempSolTempK ;tempAirTempK = coo l ing . tempAirTempK ;humidi tyRat ioVap = coo l ing . humidi tyRat ioVap ;airTempK = tempAirTempK ;airTemp = airTempK − kOf f se tKe l v i n ;solTemp = tempSolTempK − kOf f se tKe l v i n ;waterEvaporat ion = ( humidi tyRat ioVap − humid i tyRat ioDry ) ∗241APPENDIX D. COOLING TOWER CODEairMassFlowRate ∗ de l taT ;}}l o ca l−>guessHumidi tyRat io = humidi tyRat ioVap ;l oca l−>guessSolTempK = tempSolTempK ;/ / EXITING MASS AND ENERGYf o r ( compIndex = 1 , compMassPtr = loca l−>compMasses ,l oca l−>numQuality = 0 ; compIndex <= compCountWater ; ++compIndex ,++compMassPtr ){∗compMassPtr = 0 . 0 ;}f o r ( compIndex = 1 , compMassAirPtr = loca l−>compMassesAir ,l oca l−>numQuality = 0 ; compIndex <= compCountAir ; ++compIndex ,++compMassAirPtr ){∗compMassAirPtr = 0 . 0 ;}l o ca l−>energyHoldup = 0 .0 ;f o r ( to ta lT ime = 0 .0 ; ( to ta lT ime + de l taT ∗ 1.0e−6) < de l taT ;to ta lT ime += del taT ){solTempK = solTemp + kOf f se tKe l v i n ;i f ( solTempK < 273)solTempK = 273;i f ( solTempK > 373)solTempK = 373;tankVol = GetPr i va teVar iab le ( kPr ivateContents ,water IndexPtr−>volFlowIndex ) ∗convVFlowToL ;l i qu i dF l ow = GetOutputVar iable ( kPortCOOLED ,loca l−>l i qu idVo lF lowIndex ) ∗convFacts . fVolumeFlow ;i f ( l i qu i dF l ow <= kZeroWannaBe )l i qu i dF l ow = kZeroWannaBe ;vFlow = l i qu i dF l ow ;i f ( vFlow <= 0 .0 )vFlow = kZeroWannaBe ;f o r ( compIndex = 1 , compMassPtr = loca l−>compMasses ;compIndex <= compCountWater ; ++compIndex , ++compMassPtr ){242APPENDIX D. COOLING TOWER CODEcompInfo = GetOutputComponentInfo ( kPortCOOLED , compIndex ) ;env . fCategory = compInfo−>fCategType ;env . fPhase = compInfo−>fPhase ;i f ( ( compIndex <= compFlowCountWater ) | |( compInfo−>fCategType & kCatNonFlowMass ) ){/ / Incoming MassincMass = Get IndexedInputVar iab le ( kPortHOT , compIndex ) ∗convFacts . fMass / convFacts . fTime ;/ / Holdup Mass from Previous Time stepres i den t = GetPr i va teVar iab le ( kPr ivateContents , compIndex ) ∗convFacts . fMass ;/ / React ion produc t ion / consumption ra tesi f ( compIndex == water IndexPtr−>waterIndex )reacted = −waterEvaporat ion ;e lsereacted = 0 . 0 ;newMass = res i den t + reacted + incMass ∗ de l taT ;newMass /= convFacts . fMass ;/ / Se t t i ng stream output values/ / newMass i n User ’ s un i t sSe tP r i va teVar iab le ( kPr ivateContents , compIndex , newMass ) ;}}f o r ( compIndex = 1 , compMassAirPtr = loca l−>compMassesAir ;compIndex <= compCountAir ; ++compIndex , ++compMassAirPtr ){compInfo = GetOutputComponentInfo ( kPortVENT , compIndex ) ;env . fCategory = compInfo−>fCategType ;env . fPhase = compInfo−>fPhase ;i f ( ( compIndex <= compFlowCountAir ) | |( compInfo−>fCategType & kCatNonFlowMass ) ){/ / Incoming MassincMass = Get IndexedInputVar iab le ( kPortAIR , compIndex ) ∗convFacts . fMass / convFacts . fTime ;/ / Holdup Mass from Previous Time stepres i den t = 0 . 0 ;/ / React ion produc t ion / consumption ra tesi f ( compIndex == a i r I ndexP t r−>steamIndex )reacted = waterEvaporat ion ;243APPENDIX D. COOLING TOWER CODEelsereacted = 0 . 0 ;newMass = res i den t + reacted + incMass ∗ de l taT ;/ / Se t t i ng stream output values/ / newMass i n User ’ s un i t s∗compMassAirPtr = newMass ;}}vo lSo l i d s = 0 . 0 ;tankVol = ( GetPr i va teVar iab le ( kPr ivateContents ,water IndexPtr−>volFlowIndex ) ∗convVFlowToL ) ;d i f f V o l = tankVol − volume ;i f ( d i f f V o l < 0)d i f f V o l = 0 . 0 ;f r a c t i o n = ( volume − vo lSo l i d s ) / ( Ge tPr i va teVar iab le ( kPr ivateContents ,water IndexPtr−>volFlowIndex ) ∗convVFlowToL − vo lSo l i d s ) ;i f ( f r a c t i o n > 1 .0 )f r a c t i o n = 1 . 0 ;f o r ( compIndex = 1 , compMassPtr = loca l−>compMasses ;compIndex <= compCountWater ;++compIndex , ++compMassPtr ) / / Se t t i ng the Output{compInfo = GetOutputComponentInfo ( kPortCOOLED , compIndex ) ;env . fCategory = compInfo−>fCategType ;env . fPhase = compInfo−>fPhase ;i f ( env . fCategory == kCatVapour ){∗compMassPtr = GetPr i va teVar iab le ( kPr ivateContents , compIndex ) ∗convFacts . fMass ;Se tP r i va teVar iab le ( kPr ivateContents , compIndex , 0 . 0 ) ;}else{pr ivateMass = GetPr i va teVar iab le ( kPr ivateContents , compIndex ) ∗convFacts . fMass ∗ f r a c t i o n ;∗compMassPtr += GetPr i va teVar iab le ( kPr ivateContents , compIndex ) ∗convFacts . fMass − pr ivateMass ;pr ivateMass /= convFacts . fMass ;i f ( pr ivateMass < 0 .0 )244APPENDIX D. COOLING TOWER CODEpr ivateMass = 0 . 0 ;Se tP r i va teVar iab le ( kPr ivateContents , compIndex , pr ivateMass ) ;}}f o r ( compIndex = 1 , compMassPtr = loca l−>compMasses ;compIndex <= compCountWater ; ++compIndex , ++compMassPtr ){/ / Se t t i ng stream output valuescompInfo = GetOutputComponentInfo ( kPortCOOLED , compIndex ) ;env . fCategory = compInfo−>fCategType ;env . fPhase = compInfo−>fPhase ;value = (∗compMassPtr / convFacts . fMass ) / ( de l taT /convFacts . fTime ) ;i f ( value < 0 .0 )value = 0 . 0 ;SetOutputVar iab le ( kPortCOOLED , compIndex , value ) ;}f o r ( compIndex = 1 , compMassAirPtr = loca l−>compMassesAir ; compIndex <=compCountAir ; ++compIndex , ++compMassAirPtr ){/ / Se t t i ng stream output valuescompInfo = GetOutputComponentInfo ( kPortVENT , compIndex ) ;env . fCategory = compInfo−>fCategType ;env . fPhase = compInfo−>fPhase ;value = (∗ compMassAirPtr / convFacts . fMass ) / ( de l taT /convFacts . fTime ) ;i f ( value < 0 .0 )value = 0 . 0 ;SetOutputVar iab le ( kPortVENT , compIndex , value ) ;}/ / Energy Ca lcu la t i ons kJ / s bas isdouble energyWaterOut ;env . fTemperature = airTemp ;compIndex = loca l−>steamInAir Index ;solHotEnergy = GetInputEnergy ( kPortHOT ) ∗ convFacts . fEnergyFlow ;energyA i r In = GetInputEnergy ( kPortAIR ) ∗ convFacts . fEnergyFlow ;solTemp /= convFacts . fTemp ;solTemp −= convFacts . fTempOffset ;Se tP r i va teVar iab le ( kPortCOOLED , water IndexPtr−>temperatureIndex ,solTemp ) ;SetOutputVar iab le ( kPortCOOLED , water IndexPtr−>temperatureIndex ,245APPENDIX D. COOLING TOWER CODEsolTemp ) ;energyWaterOut = GetOutputEnergy (kPortCOOLED) ∗ convFacts . fEnergyFlow ;del taEnergy = ( solHotEnergy + energyA i r In − energyWaterOut ) ;energy = del taEnergy ;energy /= convFacts . fEnergyFlow ;SetOutputEnergy ( kPortVENT , energy ) ;double ou t le tPressure , f r a c t i o n , ex i t , e r r o r ;ou t l e tP ressu re = ambPressure / convFacts . fPressure / kThousand ;SetOutputVar iab le ( kPortVENT , a i r I ndexP t r−>pressureIndex ,ou t l e tP ressu re ) ;/ / Condensing excess steam to waterhumid i ty = GetOutputVar iable ( kPortVENT , l oca l−>humid i ty Index ) ;value2 = GetOutputVar iable ( kPortVENT , l oca l−>steamInAi r Index ) ;e x i t = 0 . 0 ;f o r ( f r a c t i o n = 0.99 , e r r o r = 1.0 ; fabs ( e r r o r ) > 0.1 && e x i t < 20 &&humid i ty > kHundred ; ){value = f r a c t i o n ∗ value2 ;SetOutputVar iab le ( kPortVENT , l oca l−>steamInAir Index , value ) ;SetOutputVar iab le ( kPortVENT , l oca l−>water InA i r Index , value2 −value ) ;SetOutputEnergy ( kPortVENT , energy ) ;humid i ty = GetOutputVar iable ( kPortVENT , l oca l−>humid i ty Index ) ;e r r o r = humid i ty − kHundred ;f r a c t i o n += 0.1 ∗ (− e r r o r / kHundred ) ;e x i t ++;}CalcVar iab le ( indexLGRatio ) = water In / airMassFlowRate ;Ca lcVar iab le ( indexRetent ionTime ) = volume / vFlow / convToMin ;Ca lcVar iab le ( indexTemperatureChange ) = solTemp − so l Temp In i t i a l ;Ca lcVar iab le ( indexWaterLoss ) = (1 .0 − GetOutputVar iable ( kPortCOOLED ,water IndexPtr−>waterIndex ) ∗convFacts . fMassFlow /water In ) ∗ 100.0 ;Ca lcVar iab le ( indexHeatRejected ) = airMassFlowRate ∗( coo l i ng . enthalpyVapourVap −enthalpyVapourDry ) /convFacts . fEnergyFlow ;#de f ine SKIP NonFlowMass# inc lude ” non f l ow i . cpp ”i f ( verbose )246APPENDIX D. COOLING TOWER CODE/ / ∗ I n t e r n a l CADSIM Plus energy balance check#de f ine SKIP NonFlowMass# inc lude ” non f l ow i . cpp ”i f ( volume > 0 .0 )/ / I n t e r n a l CADSIM Plus mass balance checkRefreshFreeVar iab les ( ) ;}} /∗ Perform ∗ /leave :{}}/∗ ============================================================= ∗ //∗ Reading / Wr i t i ng ∗ //∗ ============================================================= ∗ // / Reading and w r i t i n g data to move between t ime steps and save f i l e s/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− WriteDataToMemory −−−−−−−−−−−−−−−−−−−−−− ∗ /WriteDataToMemory funct ion/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ReadDataFromMemory −−−−−−−−−−−−−−−−−−−−−∗/ReadDataFromMemory function/∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− Wri teDataToFi le −−−−−−−−−−−−−−−−−−−−−−−−∗/Wr i t eDa taToF i l e func t i on/∗ ============================================================= ∗ //∗ Terminat ion ∗ //∗ ============================================================= ∗ //∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− Terminate −−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ∗ /Te rm ina te func t ion/∗ −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ShutDown −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− ∗ /Standard ShutDown funct ion247