living with the lab - Portland State University

living with the lab - Portland State University

living with the lab control of salinity 2012 David Hall living with the lab General Idea DI water The objective is to keep the salinity close to a setpoint which will provided by your instructor salt water (1% NaCl) The salinity sensor measures the analog voltage output of the salinity circuit Opening DI solenoid valve decreases salinity Opening salty solenoid valve increases salinity 0.05 wt % NaCl setpoint for salinity 0.15 wt% NaCl (your instructor will provide a setpoint, such as 0.09 wt% NaCl) 2 living with the lab review of conductivity sensor wiring & programming // Averaged salinity sensor reading

int power_pin = 3; void setup() { Serial.begin(9600); pinMode(salinity_power_pin, OUTPUT); } void loop() { int input_pin = 2; int nave=20; float reading_ave; // // // Analog input pin Number of readings to average Average Value returned from function reading_ave = salinity_reading( power_pin, input_pin, nave); Serial.println(salinity_ave); } 3 living with the lab review of conductivity sensor wiring & programming // -- Perform averaging of sensor readings float salinity_reading_average( int power_pin, int input_pin, int nave ) {

int i; float sum; // Use float for more precision and to prevent overflow of sum sum = 0.0; digitalWrite( power_pin, HIGH ); delay(50); for ( i=1; i<=nave; i++ ) { sum += analogRead( input_pin ); delay(10); } digitalWrite( power_pin, LOW ); return( sum/float(nave) ); // // Supply power to the sensor Wait for sensor to settle // // Add reading to the running sum Pause between readings // Turn off power to the sensor

} 4 living with the lab review of conductivity sensor calibration Collect analog output of salinity circuit, with output numbers ranging from 0 to 1023 (the Arudino has a 10-bit ADC) Perform linear regression to determine the expected output of the conductivity circuit as a function of salinity salt concentration Arduino (fractional) output 0.0000 2.5 0.0005 465 0.0010 511.5 0.0015 537.5 Which fit is the best? linear polynomial power 5 living with the lab

examine fits over possible salinity range Consider how your fit behaves beyond 0.15 wt% salt since your salinity may increase well beyond 0.15% when salty water is added output vs salt concentration output vs salt concentration 800 600 700 500 500 raw data linear polynomial power 400 300 200 100 output of circuit output of circuit 600 400 300 200 100

0 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 salt concentration (% wt) 0 0.00 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20 salt concentration (% wt) Do you see any potential problems? Which fit seems to be the best? Why? 6 living with the lab equations needed for salinity control sketch Inverse equation can be obtained by Algebraic rearrangement of the calibration curve fit, or Performing another fit with x and y values swapped. In either case, retain four or five digits in the curve fit coefficients 7 living with the lab t1 > t2 since valve is left open an amount of time proportional to the error Control of Salinity valve = open

salty water valve status valve = closed t2 valve = open valve = closed DI water valve status t1 salinity (%wt NaCl) system lag hysteresis 0.15 deadtime compensation error 0.10 deadband 0.05 upper control limit (UCL) setpoint = 0.09 error error

lower control limit (LCL) random variation of conductivity system upset by externally adding salty water system upset by externally adding DI water 0.00 time 8 living with the lab key points The valve is left open an amount of time that is proportional to the error. small error = valve is open a short amount of time large error = valve is open a long amount of time The DI valve is left open longer than the salty valve when correcting for the same magnitude of error (DI=0%, setpoint = 0.09%, salty = 1%). The system has memory . . . it takes time for the salinity of the water to become uniform (mixing, water in pump and tubing). The lag time is called hysteresis. Control is more stable if we wait for the system to stabilize after opening a valve. The deadtime compensation is set to allow the system to come to equilibrium before responding to error. The upper and lower control limits are set so that random error will not cause the valves to open unnecessarily; these limits are often set three standard deviations of the error away from the setpoint. The difference

between UCL and LCL is called the deadband. 9 living with the lab control strategy The setpoint will be assigned by your instructor. Assume 0.09% NaCl here. Compute the UCL, setpoint and LCL values for control of salinity. UCL and LCL depend on the size of the deadband. For demonstration purposes, assume that the UCL and LCL are 0.01%NaCl from the setpoint: =1274.1 ( 0.0009+ 0.0001 ) 0.1325 =510 0.1325 =1274.1 ( 0.0009 ) =503 0.1325 =1274.1 ( 0.0009 0.0001 ) =495 Control strategy: if analogS > UCL (or 510) then open the DI valve an amount proportional to the error If analogS < LCL (or 495), then open the salty valve an amount proportional to the error 10

living with the lab setting UCL and LCL by examining random error A better way to determine UCL and LCL are by collecting analogS values for a salinity near the setpoint and then computing the standard deviation (s) of the error of analogS values. Using this approach, 99.7% of random error will fall between the LCL and UCL, which means that your solenoid valve will be triggered due to a false alarm only 0.3% of the time. 512 510 508 analog output Example Readings to Illustrate Procedure 506 analog output 504 502 500 498 496 494 0

2 4 6 8 10 12 14 16 18 20 reading =1274.1 ( 0.0009 ) 0.1325 =503 1 = 3 =503 8=495 11 living with the lab

setting deadtime compensation It takes time for your system to settle out after the salinity changes. Assume the system whose response is depicted in the graph below is upset at 18 seconds due to a sudden addition of salty water. At about 30 seconds, the salinity values stabilize (with continued random error at the new salinity level). For this example, the deadtime compensation would be set to 12 seconds (30s - 18s). This means that you would want to allow 12 seconds between salinity corrections. 525 deadtime = 12 s 520 analog output 515 510 505 analog output UCL LCL mean 500 495 490 485 480 time when salty water was added 0

5 10 15 20 25 30 35 40 time (s) 12 living with the lab strength of response to error We will compute the amount of salty water that should be added to the current mixture to correct the salinity salinity (%wt NaCl) a correction that is too strong was applied 0.15 error 0.10 upper control limit (UCL)

setpoint = 0.09 lower control limit (LCL) 0.05 overshoot (undesirable) 0.00 a second correction is applied this one is also too strong time Over correcting repeatedly causes the system to oscillate about the setpoint 13 living with the lab apply a response proportional to error salinity (%wt NaCl) We will compute the amount of salty water that should be added to the current mixture to completely correct the salinity We will open the solenoid valve long enough to remove a percentage of the error For example, if the salinity is 0.152% and the setpoint is 0.09%, then applying an 80% correction will lower the salinity to 0.102%, which is computed as correction = (.00152-(.00152-.0009)*.8) We call the proportionality constant the gain; gain is a common term used when working with industrial controllers 0.15 error 0.10

80% of error upper control limit (UCL) setpoint = 0.09 lower control limit (LCL) 0.05 0.00 time 14 living with the lab teams of 2 Class Problem Assume that your fishtank system has a setpoint of 0.09% NaCl. Your instructor comes by your table and upsets your system by adding a good dose of DI water. The conductivity circuit returns an analog output that corresponds to a salinity of 0.04% NaCl (which is below LCL). a) What is the target concentration if you have a gain of 0.80 (80%)? b) Using this gain, how much salty water (1% NaCl) should be added? c) How long should you leave the valve open if the flow rate is 0.2L/min? Recommended assumptions: The water leaves at the overflow is a mixture of water from the salty tank and the fishtank. The most salty the overflow water can be is 1% NaCl, and the least salty it can be is 0.04% NaCl. Assume that 15% of the overflow water is 1% NaCl and that the rest is 0.04% NaCl. Neglect density differences between incoming and outgoing water; that is, the mass of water that comes in from the salty tank is equal to the mass of water that leaves through the overflow. 15

living with the lab use your own data sketch control structure Compute setpoint, UCL and LCL =1274.1 ( 0.0009 ) 0.1325 =503 1 = 3 =5038=495 Measure salinity to get analogS (the analog output of the conductivity circuit) If analogS > UCL or < LCL & if time since last correction > deadtime then . . . Compute the %wt NaCl 24 =3.6686 ( 10 ) 7.5472 use your own data Compute the target salinity based on your gain Compute the time that your salty or DI solenoid valves needs to be left open

Open the DI or salty valve for the computed time 16 living with the lab to do for salinity control: Bring fishtank, water bottles, multimeter & computer to class next time Determine flow rate through your solenoid valve (mass per unit time) Recalibrate your system Determine your fits salinity as a function of analogS analogS as a function of salinity Collect data around 0.10% NaCl to determine the standard deviation of the conductivity output so that the UCL and LCL can be determined Determine the deadtime compensation (system response time) Write your control sketch THE END 17

Recently Viewed Presentations

  • Lifestyle Improvement Strategies - Pitchero

    Lifestyle Improvement Strategies - Pitchero

    Physical Activity. Get going everyday. 10 min shake up. Help you find local activities. Stepometer app. Alcohol. Choose less booze. Alcohol tracker app. Tips to cut down/alternatives
  • Janelle Taylor Graduate Education and Research TBA Competition

    Janelle Taylor Graduate Education and Research TBA Competition

    "Condensing my creative nonfiction thesis into just a few minutes was a challenge, but a lesson in brevity and focus. 3MT also allowed the opportunity to attend and participate in the regional competition at the Midwestern Association of Graduate schools...
  • Antarctica Project Introduction 11-16 age group A starting ...

    Antarctica Project Introduction 11-16 age group A starting ...

    Left - In the Southern (austral) summer, the continent of Antarctica is facing the sun and gets more energy. That part of the continent that is inside the Antarctic Circle has some time of 24 hour light, where the sun...
  • Classifying Beads Activity - calhoun.k12.al.us

    Classifying Beads Activity - calhoun.k12.al.us

    Finding Order in Diversity. Objectives: 9.0 Differentiate between the previous five-kingdom and current six-kingdom classification systems.. 9.1 Sequencing taxa from most inclusive to least inclusive in the classification of living things. 9.2 Identifying organisms using a dichotomous key . 9.3...
  • Heinz Werner and Physiognomic Perception

    Heinz Werner and Physiognomic Perception

    We propose that the participants will display signs of synesthesia and physiognomic perception through chromesthesia in looking at the pictures with different music and different smells. We also believe that children will be more susceptible to this unity of the...
  • Communications Training

    Communications Training

    United States Small-Area Life Expectancy Estimates Project (USALEEP) is funded by Robert Wood JohnsonFoundation. NAPHSIS partnered with the National Center for Health Statistics (NCHS) to produce life expectancy estimates - or the . average . number of years a person...
  • OHS 7th Grade Mathematics - PC&#92;|MAC

    OHS 7th Grade Mathematics - PC\|MAC

    Course Syllabus. OHS7th Grade Mathematics. ... They must then, at the beginning of class, create 2 math problems that they think will mirror the problems that will be presented in class that day before they have been taught the lesson,...
  • Uncompromising Faith In the Face of the Fiery

    Uncompromising Faith In the Face of the Fiery

    Title Slide: Uncompromising Faith—In the Face of the Fiery Furnace! Daniel 3:1 "Nebuchadnezzar the king made an image of gold, whose height was sixty cubits and its width six cubits. He set it up in the plain of Dura, in...