introduction - calvin college | grand rapids, · web viewthe ice bath calibration experiment....

12
C-1 Abstract— This paper discusses the role of control systems in a six-stroke internal combustion engine, and its ability to control the operating temperature of the engine by modifying the pressure of the water injection pump. A. INTRODUCTION ossil fuels are being used at an alarming rate and unconventional methods need to be considered to help reduce the dependence on these fuels. The goal of Senior Design Team 14’s project is to increase the efficiency of a standard internal combustion engine. This will effectively reduce fuel consumption, and therefore emissions, without significantly compromising on power. To accomplish this, Team 14 will modify a four stroke engine to create a six stroke engine by adding a steam cycle, such that the engine (1) intakes, (2) compresses, (3) combusts, (4) recompresses, (5) injects water, (6) exhausts. Basically, the water injection system turns heat energy that would otherwise be lost through exhaust into another power stroke, increasing the engine’s efficiency. Consequently, injecting more water transfers more wasted energy into usable power. However, F injecting too much water will flood the cylinder and cause catastrophic damage to the engine. An electrical control system has been designed to effectively regulate the amount of water injected, and optimize the engine efficiency B. DESIGN ALTERNATIVES C. Design Requirements The amount of water injected into the cylinder is a factor of how long the injector is open and how much back pressure is pushing on the water. Since the injector timing is regulated by the camshaft of the engine, the control system must regulate the back pressure. Since the engine will be running at steady state for an undetermined amount of time, it is preferred that the system be inherently stable. That is, if left unattended, both the amount of water injected and the temperature of the engine should be stable. Under no circumstances can the system inject too much water and damage the engine; and under no circumstances can the system fail to maintain a constant temperature. There are no serious requirements on the electrical system’s response time. The heat capacity of the engine is so great that temperature changes in the order of 1°C/sec, as seen in Figure 1. This slow rate of change combined with a 16. Appendix C – Control System Report Temperature-Based Water Injection Pressure Control System

Upload: hadung

Post on 14-Mar-2018

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: INTRODUCTION - Calvin College | Grand Rapids, · Web viewThe ice bath calibration experiment. Then the thermocouple was transferred to the water boiler. The output of the amplifier

C-1

Abstract— This paper discusses the role of control systems in a six-stroke internal combustion engine, and its ability to control the operating temperature of the engine by modifying the pressure of the water injection pump.

I. INTRODUCTION

ossil fuels are being used at an alarming rate and unconventional methods need to be considered to help reduce the dependence on these fuels. The goal

of Senior Design Team 14’s project is to increase the efficiency of a standard internal combustion engine. This will effectively reduce fuel consumption, and therefore emissions, without significantly compromising on power. To accomplish this, Team 14 will modify a four stroke engine to create a six stroke engine by adding a steam cycle, such that the engine (1) intakes, (2) compresses, (3) combusts, (4) recompresses, (5) injects water, (6) exhausts. Basically, the water injection system turns heat energy that would otherwise be lost through exhaust into another power stroke, increasing the engine’s efficiency. Consequently, injecting more water transfers more wasted energy into usable power. However, injecting too much water will flood the cylinder and cause catastrophic damage to the engine. An electrical control system has been designed to effectively regulate the amount of water injected, and optimize the engine efficiency

F

II. DESIGN ALTERNATIVES

A. Design Requirements The amount of water injected into the cylinder is a factor

of how long the injector is open and how much back pressure is pushing on the water. Since the injector timing is regulated by the camshaft of the engine, the control system must regulate the back pressure.

Since the engine will be running at steady state for an undetermined amount of time, it is preferred that the system be inherently stable. That is, if left unattended, both the amount of water injected and the temperature of the engine should be stable. Under no circumstances can the system

inject too much water and damage the engine; and under no circumstances can the system fail to maintain a constant temperature.

There are no serious requirements on the electrical system’s response time. The heat capacity of the engine is so great that temperature changes in the order of 1°C/sec, as seen in Figure 1. This slow rate of change combined with a ±5°C tolerance means that the control system must operate at approximately 1Hz.

T = 0.6567t + 45.622

0

20

40

60

80

100

120

0 20 40 60 80 100 120

Tem

pera

ture

(*C)

Time (s)

Figure 1. The external engine temperature as a function of time from cold start to equilibrium.

Lastly, the control system must be simple. This portion of the project has a minimal budget. Keeping the design simple will help keep the cost low. Additionally, the system may have to be transported with the engine to off-campus facilities for testing. A simple design will be easier to move and minimize transportation risks.

B. Design A: Pressurized Air TankThe first design alternative involves regulating the back

pressure of the water by means of a pressurized air tank, shown in Figure 2. The air tank feeds pressurized air into a closed water tank. As water is pushed through the injector, more pressurized air is added to the water tank to maintain back pressure.

16. Appendix C – Control System Report

Temperature-Based Water Injection Pressure Control System

Andrew DeJong, Student Member, ASME, Tim Opperwall, Student Member, ASME

Page 2: INTRODUCTION - Calvin College | Grand Rapids, · Web viewThe ice bath calibration experiment. Then the thermocouple was transferred to the water boiler. The output of the amplifier

C-2

Figure 2. Diagram of Design A. The amount of water injected is regulated by adjusting the pressure in the closed water tank.

C. Design B: Variable Fuel PumpThe second design alternative involves a fuel pump

creating back pressure on the water supply rail, as shown in Figure 3. The power supply to the pump is varied to adjust the back pressure.

Figure 3. Diagram of Design B. The amount of water injected is regulated by adjusting the power to the pump.

D. Design SelectionDesign B is inherently stable. Once the engine has

reached steady state temperature, the control system should not need to make any more adjustments. The back pressure will naturally stay constant. Design A however is inherently unstable. Once the engine has reached steady state temperature, the control system has to continue adjusting the pressurized air tank valve. The back pressure will naturally decrease as water is removed from the closed tank.

Furthermore, Design B is simpler than Design A. Modern automobiles use a pump-rail-injector system similar to Design B. Hence, many of the components for Design B are already designed to work together and can be purchased relatively inexpensively; whereas the components for Design A would have to be bought individually and adjusted to work together.

Neither design raises any concerns about response time. Both utilize an Arduino microprocessor to transfer the temperature data to a controlled output.

Based on the design requirements Design B was chosen for this project. The system’s stability and use of pre-existing technology and components makes it an optimal solution.

III. THEORETICAL SYSTEM

From Figure 3, the control system can be modeled with a flow chart, shown in Figure 4. For purposes of experimentation, the ideal engine temperature was set to

Page 3: INTRODUCTION - Calvin College | Grand Rapids, · Web viewThe ice bath calibration experiment. Then the thermocouple was transferred to the water boiler. The output of the amplifier

C-3

75°C. For the final physical implementation, this temperature is likely to be over 100°C. To make testing simpler, the temperature range was limited to 0-100°C via an ice bath and a boiling water bath.

Figure 4. Flow chart of Design B.

Within this design, two types of controllers were discussed. The first is a transfer function that directly correlates the current engine temperature to a power output to the pump. However, this method fails to account for the current “momentum” of the temperature change. That is, this method allows for exactly one response if the engine temperature is 20°C too high: to dramatically increase the pump power to help cool the engine. Yet, if the engine temperature is 20°C too high but decreasing, the appropriate adjustment would be to maintain the current pressure until the engine temperature reaches the desired temperature. This phenomenon is pictured in Figure 5. The red lines indicate the engine temperature’s current “momentum.” The green lines indicate the desired response.

Figure 5. The desired responses for each momentum direction and degree of temperature difference.

Splitting any single temperature reading into these two cases (momentum increasing or momentum decreasing) suggests a fuzzy logic design. In this application, the direction of the momentum and the degree of the temperature difference creates discrete truth statements, or cases. Each case has its own response. Thus, if the engine is too hot and getting hotter, the pressure is drastically increased; if the engine is too hot and cooling, the pressure is maintained. The boundaries for our system were chosen at ±5, ±10, and

±20°C of the desired temperature. Figure 6 further identifies each case, and Table 1 identifies the desired response for each case. The conditions are the temperature difference between the engine temperature and the desired temperature. The momentum is the derivative of the engine temperature over time. The pump switch output is a digital switch that cuts the power to the pump when set to 0. The pump current output is a scalar value ranging from 0 to 255 where a value of 100 corresponds to the steady state pump power.

Figure 6. Each case determined by the temperature difference and momentum.

Table 1. The conditions and desired output for each case.

case tempdiff momentum pumpswitch pumpcurrent0 <-20 >0 0 01 <-10 >0 1 02 <-5 >0 1 503 >20 >0 1 2004 >10 >0 1 1505 >5 >0 1 120

10 <-20 <0 0 011 <-10 <0 0 012 <-5 <0 1 3013 >20 <0 1 20014 >10 <0 1 13015 >5 <0 1 110

20 -5<T<5 any no change no change

conditions outputs

IV. PHYSICAL IMPLEMENTATION

Many components of our system are predetermined by Team 14’s project, such as the engine and pump. Since the engine was not modified in the timeframe of this project, it was not available for use in implementation and experimentation of the control system. Consequently, the

Case 3 Case 13

Case 4 Case 14

Case 5 Case 15Case 20 Case 20Case 20 Case 20Case 2 Case 12Case 1 Case 11

Case 0 Case 10

Page 4: INTRODUCTION - Calvin College | Grand Rapids, · Web viewThe ice bath calibration experiment. Then the thermocouple was transferred to the water boiler. The output of the amplifier

C-4

flow chart shown in Figure 4 can be adjusted for the sake of implementation to the flow chart shown in Figure 7.

Controller+_

Amp Thermocouple

75 � C Water PotOutput to Computer

Figure 7. The adjusted flow chart. The engine and pump have been removed.

A. ControllerThe controller for this system was selected based on

suggestions from electrical engineering classmate with moderate experience with similar control systems. The suggested controller was the Arduino Duemilanove prototyping board [1], shown in Figure 8. The board has an ATmega328 processor, is programmed in C, is powered by a USB port, and utilizes 6 analog pins and 14 digital pins.

Figure 8. The Arduino prototyping board. The USB port can be seen in the top left, the analog pins in the bottom right, and the digital ports along the

top. The code was written to model the above fuzzy logic

with the cases as shown in Figure 6. The cases are frame-worked using If statements for each criteria. A sample of this code can be seen below:

if(tempdiff < -20){if(momentum >= 0){pumpswitch=LOW;pumpcurrent=0;Serial.print("\t case 0\t");}else if(momentum < 0){pumpswitch=LOW;pumpcurrent=0;Serial.print("\t case 10\t");}

}

else if (tempdiff < -10) {if(momentum >= 0){pumpswitch = LOW;pumpcurrent = 0;Serial.print("\t case 1\t");}else if(momentum < 0){pumpswitch=LOW;pumpcurrent = 0;Serial.print("\t case 11\t");}

}else if(tempdiff < -5){

if(momentum >= 0){pumpswitch = HIGH;pumpcurrent = 50;Serial.print("\t case 2\t");}else if(momentum < 0){pumpswitch =HIGH;pumpcurrent = 30;Serial.print("\t case 12\t");}

}where tempdiff is the difference between the current engine temperature and the desired temperature, momentum is the change from the last known engine temperature and the current engine temperature.

The process for finding the current engine temperature is to average ten temperature readings over 1 second. The desired temperature (75 in this case) is then subtracted from this average to find tempdiff. And the difference between this average and the last average is considered the momentum. An example of this code can be seen below:

void loop(){ temp1 = analogRead(temppin)/2.048; delay(delaytime); temp2 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp3 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp4 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp5 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp6 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp7 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp8 = analogRead(temppin)/2.048; //degrees C

Page 5: INTRODUCTION - Calvin College | Grand Rapids, · Web viewThe ice bath calibration experiment. Then the thermocouple was transferred to the water boiler. The output of the amplifier

C-5

delay(delaytime); temp9 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp10 = analogRead(temppin)/2.048; //degrees C delay(delaytime); oldaveragetemp = newaveragetemp; newaveragetemp =

(temp1+temp2+temp3+temp4+temp5+temp6+temp7+temp8+temp9+temp10)/10;

momentum = newaveragetemp - oldaveragetemp; tempdiff=newaveragetemp-desiredtemp;

where delaytime is 100 ms, temppin is the numerical identification of the thermocouple input, and desiredtemp is 75.

Finally, this code was uploaded to the Ardino board. The full code can be seen in the Appendix.

B. Thermocouple and AmplifierThe input on the controller requires a 0 to 5 V analog

signal. To properly transform the thermocouples analog resistance into the required voltage signal, an Analog Devices Thermocouple Amplifier [2] is necessary between the thermocouple and the Arduino board. This is precalibrated to map the thermocouples resistance on a 10mV/°C scale. That is, if the thermocouple is reading 25°C the amplifier outputs 0.250 V. Since the temperature of the engine will not exceed 500°C, the amplified signal will never exceed the Arduino board’s 5 V upper limit.

The thermocouple is a standard K-type thermocouple purchased from Omega [3].

C. Water PotThe absence of the engine and pump requires the input

from a controlled temperature source to simulate changing engine temperatures. This is done using an electric hot pot filled with water. This provides three known temperatures: 0°C in an ice bath, 24°C at room temperature, and 100°C at boiling point.

D. Output to ComputerBy embedding Serial.print commands inside the code,

key variable values were output to a text file on the computer powering the Arduino board. During each iteration of the control loop, the computer documented the engine temperature, corresponding case, and output.

V. EXPERIMENTATION

E. Thermocouple and Amp CalibrationThe thermocouple and amplifier communication was

calibrated using the setup shown in Figure 9 below. The amplifier was connected as listed in Table 2. The amplifier is a Monolithic Thermocouple Amplifier with Cold Junction Compensation (AD595) made by Analog Devices. The digital multi-meter (DMM) is a Fluke 179 True RMS Multimeter. A DC power supply made by Calvin College +12V supply was used to power the amplifier. An ice bath was made using a Styrofoam cup with ice and water, and a boiling water bath was med using a Crofton Electric Hot Pot. A laser thermometer made by Cen-Tech was used to verify temperatures.

Figure 9. The setup for the thermocouple calibration test.

Table 2. The pin allocations of the thermocouple amp.1. Thermocouple (yellow wire) + Ground2. Open3. Open4. Ground5. Open6. Open7. Ground8. Wire to Pin 99. Output10. Open11. +12V Source12. Open13. Ground14. Thermocouple (red wire)

At room temperature, the output of the amplifier was 0.236 V (or 23.6 °C), as shown in Figure 10. This temperature was verified by measuring the temperature of the desk work surface with the laser thermometer, which read 23 °C.

Page 6: INTRODUCTION - Calvin College | Grand Rapids, · Web viewThe ice bath calibration experiment. Then the thermocouple was transferred to the water boiler. The output of the amplifier

C-6

Figure 10. The room temperature calibration experiment.

The thermocouple was transferred to the ice bath. The output of the amplifier was 0.016 V (1.6 °C), as shown in Figure 11. This temperature was verified by the laser thermometer which read 1°C.

Figure 11. The ice bath calibration experiment.

Then the thermocouple was transferred to the water boiler. The output of the amplifier was 1.015 (or 101.5 °C), as shown in Figure 12. This temperature was verified with the laser thermometer which read 103 °C, as shown in Figure 13.

Figure 12. The boiling water path calibration experiment.

Figure 13. The laser thermometer verification.

Both measurement techniques show some error, but the accuracy required for this control system is at least ± 5 °C. Hence the pre-calibration of the amplifier and the natural fluctuation in both the thermocouple and the amplifier are acceptable.

F. Control System Response TestFinally, the control system’s response to simulated

engine temperatures can be observed. The setup for this test can be seen in Figure 14 below. The thermocouple amplifier was connected as previously listed in Table 2. The Arduino board was connected as listed in Table 3.

Page 7: INTRODUCTION - Calvin College | Grand Rapids, · Web viewThe ice bath calibration experiment. Then the thermocouple was transferred to the water boiler. The output of the amplifier

C-7

Figure 14. The temperature control system setup.

Table 3. . The pin allocations of Arduino board.Power:

USB. Cable to computerGnd1. GroundGnd2. Ground

Analog:0. Input from amp1. Pump Current

Digital:13. Pump Switch

14. Gnd. Ground

First, a calibration test was run to ensure that the microprocessor was properly converting the input signals into degrees Celsius and sending the correct output signals. This was done by placing the thermocouple in the ice bath and the boiling water bath and observing the input and output signal of the microprocessor board on the DMMs.

It was noted that the analog input pin on the microprocessor was pre-calibrated to a 10 bit resolution, such that a 0 V input resulted in a pin value of 0 and a 5 V input resulted in a pin value of 1024, with a linear correlation in between. Thus the input signal can be converted to degree Celsius as follows:

10 mVC

input∗1 V1000 mV

∗1024

5V=2.048 1

CTherefore, the input pin value is divided by 2.048 to

determine the temperature of the thermocouple in degrees Celsius. The processor code was corrected to reflect this.

Once the control system was calibrated, a response test was run to monitor the system’s response to varying temperature. The hot pot was filled with room temperature water and the thermocouple was fixed in the water. As the hot pot brought the water a boil the thermocouple temperature as calculated by the Arduino board was recorded as seen in Figure 15.

40

50

60

70

80

90

100

110

0 200 400 600 800 1000 1200 1400 1600

Tem

pera

ture

(*C

)

Time (s)

Temp(C) Desired Temp+5 *C -5 *C+10 *C -10 *C+20 *C -20 *C

Figure 15. The simulated engine temperature relative to the fuzzy logic case boundaries.

Figure 15 also shows the fuzzy logic case boundaries as defined in the programming code. When the temperature crosses one of these boundaries, there is a corresponding shift in the controller output, as shown in g Figure 16.

0

50

100

150

200

250

0 200 400 600 800 1000 1200 1400 1600

Con

trol

Out

put

Val

ue

Time (s)

Figure 16. The control system output as the simulated engine temperature varies and causes shifts between fuzzy logic cases.

VI. CONCLUSION

A. Result AnalysisThe most distinguishing feature of the results shown in

Figures 15 and 16 is the rapid fluctuation in the thermocouple temperature and the resultant rapid shifting between fuzzy logic cases. This is primarily due to non-homogeneous temperatures in the water pot and natural inaccuracies in the thermocouple. This effect can be minimized by increasing the time between temperature sampling and increasing the number of temperature readings averaged into one sampling.

Some of the most stable results occur when the temperature is in Case 20 (±5°C). Exactly as planned, the system assumed a steady state until the temperature diverged

Page 8: INTRODUCTION - Calvin College | Grand Rapids, · Web viewThe ice bath calibration experiment. Then the thermocouple was transferred to the water boiler. The output of the amplifier

C-8

from the desired range, at which point the control system began to reduce power to the pump to compensate for the cooling temperature.

B. Further ImplementationThe experimentation of Design B verifies that all design

requirements are satisfied. With additional refining, debugging, and experimenting this design can be successfully implemented to control the engine temperature in Team 14’s six stroke engine.

C. Additional ConsiderationsAfter this project had been finished, Team 14 decided to

use an electric engine control unit (ECU). The ECU would eliminate the need for the camshaft, and remove the design requirement that the temperature controller regulate the back pressure on injector. Instead, now the ECU can regulate the timing on the injector. It is possible that this will be easier and simpler.

VII. REFERENCES

[1] (2009) “Arduino Duemilanove.” Arduino [Online]. Available: http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove (Accessed: Dec 2009).

[2] (2009) “AD595 MONOLITHIC THERMOCOUPLE AMPLIFIER WITH COLD JUNCTION COMPENSATION PRETRIMMED FOR TYPE K THERMOCOUPLES.” Analog Devices [Online]. Available: http://www.analog.com/en/sensors/digital-temperature-sensors/ad595/products/product.html (Accessed: Dec 2009).

[3] (2009) “Ready-Made Insulated Thermocouples.” Omega Engineering [Online]. Available: http://www.omega.com/ppt/pptsc.asp?ref=5TC (Accessed: Dec 2009)

Page 9: INTRODUCTION - Calvin College | Grand Rapids, · Web viewThe ice bath calibration experiment. Then the thermocouple was transferred to the water boiler. The output of the amplifier

C-9

VIII. APPENDIX – FULL ARDUINO CODE

/*---------------This program was written by Andrew DeJong and Tim

Opperwall ofCalvin College, 20 Nov 2009*/

// allocate input and output pinsint temppin = 0; // temperature input - analogueint pumppin = 1; // pump output - analogueint pumpswitchpin = 13; // pump on/off switch output -

digital

// allocate all variablesint pumpswitch = 0; // pump on/off switch, 1=ondouble oldaveragetemp = 20; // previous average tempdouble newaveragetemp = 20; // new average tempdouble desiredtemp = 75; // desired tempdouble tempdiff = 70; // difference between current and

desired tempdouble pumpcurrent = 10; // resultant output to pumpdouble temp1, temp2, temp3, temp4, temp5, temp6, temp7,

temp8, temp9, temp10; //temps to be averageddouble momentum = 0; // direction of temperature

changeint delaytime = 100; // delay value in milliseconds

// setup() runs once to ID the pins and interruptsvoid setup() { pinMode(temppin, INPUT); pinMode(pumppin, OUTPUT); // initialize serial communications at 9600 bps: Serial.begin(9600); }

// loop() runs continuously when the chip is activevoid loop(){ temp1 = analogRead(temppin)/2.048; //degrees C

converted from 5V = 1024 delay(delaytime); temp2 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp3 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp4 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp5 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp6 = analogRead(temppin)/2.048; //degrees C

delay(delaytime); temp7 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp8 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp9 = analogRead(temppin)/2.048; //degrees C delay(delaytime); temp10 = analogRead(temppin)/2.048; //degrees C delay(delaytime); oldaveragetemp = newaveragetemp; newaveragetemp =

(temp1+temp2+temp3+temp4+temp5+temp6+temp7+temp8+temp9+temp10)/10;

Serial.print("\nnew average temp\t" ); Serial.print(newaveragetemp); momentum = newaveragetemp - oldaveragetemp; tempdiff=newaveragetemp-desiredtemp; //positive if

current is greater Serial.print("\t momentum\t"); Serial.print(momentum); Serial.print("\ttemp difference\t"); Serial.print(tempdiff); if(tempdiff < -20){ if(momentum >= 0){ pumpswitch=LOW; pumpcurrent=0; Serial.print("\t case 0\t"); } else if(momentum < 0){ pumpswitch=LOW; pumpcurrent=0; Serial.print("\t case 10\t"); } } else if (tempdiff < -10) { if(momentum >= 0){ pumpswitch = LOW; pumpcurrent = 0; Serial.print("\t case 1\t"); } else if(momentum < 0){ pumpswitch=LOW; pumpcurrent = 0; Serial.print("\t case 11\t"); } } else if(tempdiff < -5){ if(momentum >= 0){

Page 10: INTRODUCTION - Calvin College | Grand Rapids, · Web viewThe ice bath calibration experiment. Then the thermocouple was transferred to the water boiler. The output of the amplifier

C-10

pumpswitch = HIGH; pumpcurrent = 50; Serial.print("\t case 2\t"); } else if(momentum < 0){ pumpswitch =HIGH; pumpcurrent = 30; Serial.print("\t case 12\t"); } } else if(tempdiff > 20){ if(momentum >= 0){ pumpswitch = HIGH; pumpcurrent = 200; Serial.print("\t case 3\t"); } else if(momentum <0){ pumpswitch =HIGH; pumpcurrent = 200; Serial.print("\t case 13\t"); } } else if(tempdiff > 10){ if(momentum >= 0){ pumpswitch = HIGH; pumpcurrent = 150; Serial.print("\t case 4\t"); } else if(momentum <0){ pumpswitch =HIGH; pumpcurrent = 130; Serial.print("\t case 14\t"); } } else if(tempdiff > 5){ if(momentum > 0){ pumpswitch = HIGH; pumpcurrent = 120; Serial.print("\t case 5\t"); } else if(momentum <= 0){ pumpswitch = HIGH; pumpcurrent = 110; Serial.print("\t case 14\t"); } } else{ Serial.print("\t case 20\t");

}

analogWrite(pumppin,pumpcurrent); digitalWrite(pumpswitchpin, pumpswitch); Serial.print("\tpump switch\t"); Serial.print(pumpswitch); Serial.print("\tpump current\t"); Serial.print(pumpcurrent);}// serial printing example // // print the results to the serial monitor:// Serial.print("sensor = " );// Serial.print(sensorValue);// Serial.print("\t output = ");// Serial.println(outputValue);