Difference between revisions of "Team:UMaryland/Design"

Line 375: Line 375:
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">laststep</font><font color="#434f54">++</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">laststep</font><font color="#434f54">++</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#434f54">//If the pcr has maintained the setpoint for the desired amount of time, it will enter this loop and begin cooling</font>
+
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#7e7e7e">/*If the pcr has maintained the setpoint for the desired amount </font><font color="#7e7e7e"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of time, it will enter this loop and begin cooling*/</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#d35400">millis</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#434f54">&gt;</font> <font color="#000000">(</font><font color="#000000">t1Melt</font> <font color="#434f54">+</font> <font color="#000000">cycleStart</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#434f54">&&</font> <font color="#000000">(</font><font color="#000000">laststep</font> <font color="#434f54">==</font> <font color="#000000">stepnow</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#000000">{</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#d35400">millis</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#434f54">&gt;</font> <font color="#000000">(</font><font color="#000000">t1Melt</font> <font color="#434f54">+</font> <font color="#000000">cycleStart</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#434f54">&&</font> <font color="#000000">(</font><font color="#000000">laststep</font> <font color="#434f54">==</font> <font color="#000000">stepnow</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#000000">{</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">stepnow</font><font color="#434f54">++</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">stepnow</font><font color="#434f54">++</font><font color="#000000">;</font>
Line 394: Line 394:
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">laststep</font><font color="#434f54">++</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">laststep</font><font color="#434f54">++</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#434f54">//checks if the machine has maintained the temperature for the desired amount of time, and begins the next step</font>
+
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#434f54">//checks if the machine has maintained the temperature for </font>
 +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#434f54">//the desired amount of time, and begins the next step</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#d35400">millis</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#434f54">&gt;</font> <font color="#000000">(</font><font color="#000000">t1PCR</font> <font color="#434f54">+</font> <font color="#000000">cycleStart</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#434f54">&&</font> <font color="#000000">(</font><font color="#000000">laststep</font> <font color="#434f54">==</font> <font color="#000000">stepnow</font><font color="#000000">)</font> <font color="#434f54">&&</font> <font color="#000000">(</font><font color="#000000">cycle</font> <font color="#434f54">==</font> <font color="#000000">2</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#000000">{</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#d35400">millis</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#434f54">&gt;</font> <font color="#000000">(</font><font color="#000000">t1PCR</font> <font color="#434f54">+</font> <font color="#000000">cycleStart</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#434f54">&&</font> <font color="#000000">(</font><font color="#000000">laststep</font> <font color="#434f54">==</font> <font color="#000000">stepnow</font><font color="#000000">)</font> <font color="#434f54">&&</font> <font color="#000000">(</font><font color="#000000">cycle</font> <font color="#434f54">==</font> <font color="#000000">2</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#000000">{</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">stepnow</font><font color="#434f54">++</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">stepnow</font><font color="#434f54">++</font><font color="#000000">;</font>
Line 412: Line 413:
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">laststep</font><font color="#434f54">++</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">laststep</font><font color="#434f54">++</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#434f54">//checks if the machine has maintained the temperature for the desired amount of time, and begins the next step</font>
+
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#7e7e7e">/*checks if the machine has maintained the temperature </font><font color="#7e7e7e"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* for the desired amount of time, and begins the next step*/</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#d35400">millis</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#434f54">&gt;</font> <font color="#000000">(</font><font color="#000000">textension1</font> <font color="#434f54">+</font> <font color="#000000">cycleStart</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#434f54">&&</font> <font color="#000000">(</font><font color="#000000">laststep</font> <font color="#434f54">==</font> <font color="#000000">stepnow</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#000000">{</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#d35400">millis</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#434f54">&gt;</font> <font color="#000000">(</font><font color="#000000">textension1</font> <font color="#434f54">+</font> <font color="#000000">cycleStart</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#434f54">&&</font> <font color="#000000">(</font><font color="#000000">laststep</font> <font color="#434f54">==</font> <font color="#000000">stepnow</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#000000">{</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">pcr</font> <font color="#434f54">=</font> <font color="#00979c">"heating to melt "</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">pcr</font> <font color="#434f54">=</font> <font color="#00979c">"heating to melt "</font><font color="#000000">;</font>
Line 466: Line 467:
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
  &nbsp;<font color="#7e7e7e">/*</font><font color="#7e7e7e"> &nbsp;&nbsp;* Begins the last step, which again works in a similar fashion to the other steps, but may differ in the </font><font color="#7e7e7e"> &nbsp;&nbsp;* final extension temperature</font><font color="#7e7e7e"> &nbsp;&nbsp;*/</font>
+
  &nbsp;<font color="#7e7e7e">/*</font><font color="#7e7e7e"> &nbsp;&nbsp;* Begins the last step, which again works in a similar fashion </font><font color="#7e7e7e"> &nbsp;&nbsp;* to the other steps, but may differ in the final extension temperature</font><font color="#7e7e7e"> &nbsp;&nbsp;*/</font>
 
  &nbsp;<font color="#000000">}</font> <font color="#5e6d03">else</font> <font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#000000">stepnow</font> <font color="#434f54">&gt;</font><font color="#434f54">=</font> <font color="#000000">cyclenum</font> <font color="#434f54">&&</font> <font color="#000000">stepnow</font> <font color="#434f54">&lt;</font><font color="#434f54">=</font> <font color="#000000">cyclenum</font> <font color="#434f54">+</font> <font color="#000000">2</font> <font color="#000000">)</font><font color="#000000">)</font> <font color="#000000">{</font>
 
  &nbsp;<font color="#000000">}</font> <font color="#5e6d03">else</font> <font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#000000">stepnow</font> <font color="#434f54">&gt;</font><font color="#434f54">=</font> <font color="#000000">cyclenum</font> <font color="#434f54">&&</font> <font color="#000000">stepnow</font> <font color="#434f54">&lt;</font><font color="#434f54">=</font> <font color="#000000">cyclenum</font> <font color="#434f54">+</font> <font color="#000000">2</font> <font color="#000000">)</font><font color="#000000">)</font> <font color="#000000">{</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#000000">(</font><font color="#000000">stepnow</font> <font color="#434f54">%</font> <font color="#000000">3</font><font color="#000000">)</font> <font color="#434f54">==</font> <font color="#000000">1</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#000000">{</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#000000">(</font><font color="#000000">stepnow</font> <font color="#434f54">%</font> <font color="#000000">3</font><font color="#000000">)</font> <font color="#434f54">==</font> <font color="#000000">1</font><font color="#000000">)</font><font color="#000000">)</font> <font color="#000000">{</font>
Line 513: Line 514:
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
  &nbsp;<font color="#7e7e7e">/**</font><font color="#7e7e7e"> &nbsp;&nbsp;* Once the last step has been completed, determined by stepnow being greater than cyclenum+2,</font><font color="#7e7e7e"> &nbsp;&nbsp;* the code will tell the pcr to hold at 4 C. It will continue looping at this step indefinitely</font><font color="#7e7e7e"> &nbsp;&nbsp;* because the conditions will no longer satisfy any of the other if statement</font><font color="#7e7e7e"> &nbsp;&nbsp;*/</font>
+
  &nbsp;<font color="#7e7e7e">/**</font><font color="#7e7e7e"> &nbsp;&nbsp;* Once the last step has been completed, determined by </font><font color="#7e7e7e"> &nbsp;&nbsp;* stepnow being greater than cyclenum+2,the code will tell the </font><font color="#7e7e7e"> &nbsp;&nbsp;* pcr to hold at 4 C. It will continue looping at this step indefinitely</font><font color="#7e7e7e"> &nbsp;&nbsp;* because the conditions will no longer satisfy any of the other if statement</font><font color="#7e7e7e"> &nbsp;&nbsp;*/</font>
 
  &nbsp;<font color="#000000">}</font> <font color="#5e6d03">else</font> <font color="#000000">{</font>
 
  &nbsp;<font color="#000000">}</font> <font color="#5e6d03">else</font> <font color="#000000">{</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#00979c">int</font> <font color="#000000">strt</font> <font color="#434f54">=</font> <font color="#000000">1</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#00979c">int</font> <font color="#000000">strt</font> <font color="#434f54">=</font> <font color="#000000">1</font><font color="#000000">;</font>
Line 528: Line 529:
  
 
  &nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#000000">}</font>
  &nbsp;&nbsp;&nbsp;<font color="#434f54">//Once the pcr has reached 37 C, the pcr will print out that the pcr has shutt off</font>
+
  &nbsp;&nbsp;&nbsp;<font color="#7e7e7e">/*Once the pcr has reached 37 C, the pcr will </font><font color="#7e7e7e"> &nbsp;&nbsp;&nbsp;print out that the pcr has shutt off*/</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#000000">Input</font> <font color="#434f54">-</font> <font color="#000000">38</font> <font color="#434f54">+</font> <font color="#000000">1</font><font color="#000000">)</font> <font color="#434f54">&lt;</font> <font color="#000000">0</font><font color="#000000">)</font> <font color="#000000">{</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#000000">Input</font> <font color="#434f54">-</font> <font color="#000000">38</font> <font color="#434f54">+</font> <font color="#000000">1</font><font color="#000000">)</font> <font color="#434f54">&lt;</font> <font color="#000000">0</font><font color="#000000">)</font> <font color="#000000">{</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">signalr1</font><font color="#434f54">,</font> <font color="#00979c">HIGH</font><font color="#000000">)</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;&nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">signalr1</font><font color="#434f54">,</font> <font color="#00979c">HIGH</font><font color="#000000">)</font><font color="#000000">;</font>
Line 551: Line 552:
 
  &nbsp;&nbsp;&nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">signalr2</font><font color="#434f54">,</font> <font color="#00979c">LOW</font><font color="#000000">)</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">signalr2</font><font color="#434f54">,</font> <font color="#00979c">LOW</font><font color="#000000">)</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;<b><font color="#d35400">Serial</font></b><font color="#434f54">.</font><font color="#d35400">println</font><font color="#000000">(</font><font color="#00979c">"COOLING"</font><font color="#000000">)</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;<b><font color="#d35400">Serial</font></b><font color="#434f54">.</font><font color="#d35400">println</font><font color="#000000">(</font><font color="#00979c">"COOLING"</font><font color="#000000">)</font><font color="#000000">;</font>
  <font color="#434f54">// if the pcr machine's temperature reaches 97, cooling will automatically be initiated and a death message will be displayed</font>
+
  <font color="#7e7e7e">/* if the pcr machine's temperature reaches 97, cooling will </font><font color="#7e7e7e"> &nbsp;&nbsp;&nbsp;automatically be initiated and a death message will be displayed*/</font>
 
  &nbsp;<font color="#000000">}</font><font color="#5e6d03">else</font> <font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#000000">Input</font> <font color="#434f54">-</font> <font color="#000000">deathT</font> <font color="#434f54">+</font><font color="#000000">1</font><font color="#000000">)</font> <font color="#434f54">&gt;</font> <font color="#000000">0</font><font color="#000000">)</font><font color="#000000">{</font>
 
  &nbsp;<font color="#000000">}</font><font color="#5e6d03">else</font> <font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#000000">Input</font> <font color="#434f54">-</font> <font color="#000000">deathT</font> <font color="#434f54">+</font><font color="#000000">1</font><font color="#000000">)</font> <font color="#434f54">&gt;</font> <font color="#000000">0</font><font color="#000000">)</font><font color="#000000">{</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">signalr1</font><font color="#434f54">,</font> <font color="#00979c">HIGH</font><font color="#000000">)</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">signalr1</font><font color="#434f54">,</font> <font color="#00979c">HIGH</font><font color="#000000">)</font><font color="#000000">;</font>
Line 557: Line 558:
 
  &nbsp;&nbsp;&nbsp;<b><font color="#d35400">Serial</font></b><font color="#434f54">.</font><font color="#d35400">println</font><font color="#000000">(</font><font color="#00979c">"DEATH"</font><font color="#000000">)</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;<b><font color="#d35400">Serial</font></b><font color="#434f54">.</font><font color="#d35400">println</font><font color="#000000">(</font><font color="#00979c">"DEATH"</font><font color="#000000">)</font><font color="#000000">;</font>
  
<font color="#7e7e7e">/* these two statements work on the maintaining the temperature, by controlling heating and cooling when there is overshoot or undershoot </font><font color="#7e7e7e"> &nbsp;&nbsp;in the temperature*/</font>
+
<font color="#7e7e7e">/* these two statements work on the maintaining the temperature, by </font><font color="#7e7e7e"> * controlling heating and cooling when there is overshoot or undershoot </font><font color="#7e7e7e"> &nbsp;&nbsp;in the temperature*/</font>
 
  &nbsp;<font color="#000000">}</font> <font color="#5e6d03">else</font> <font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">Output</font> <font color="#434f54">&gt;</font> <font color="#000000">now</font> <font color="#434f54">-</font> <font color="#000000">windowStartTime</font> <font color="#434f54">-</font> <font color="#000000">1</font><font color="#000000">)</font> <font color="#000000">{</font>
 
  &nbsp;<font color="#000000">}</font> <font color="#5e6d03">else</font> <font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">Output</font> <font color="#434f54">&gt;</font> <font color="#000000">now</font> <font color="#434f54">-</font> <font color="#000000">windowStartTime</font> <font color="#434f54">-</font> <font color="#000000">1</font><font color="#000000">)</font> <font color="#000000">{</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">signalr1</font><font color="#434f54">,</font> <font color="#00979c">HIGH</font><font color="#000000">)</font><font color="#000000">;</font>
 
  &nbsp;&nbsp;&nbsp;<font color="#d35400">digitalWrite</font><font color="#000000">(</font><font color="#000000">signalr1</font><font color="#434f54">,</font> <font color="#00979c">HIGH</font><font color="#000000">)</font><font color="#000000">;</font>

Revision as of 22:04, 18 September 2015