Acme-FishFarm

 view release on metacpan or  search on metacpan

docs/Acme-FishFarm-WaterConditionMonitor-1.01.html  view on Meta::CPAN

<p>Version 1.01</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>    use 5.010;

    use Acme::FishFarm::WaterConditionMonitor;
    use Acme::FishFarm::OxygenMaintainer;

    my $water_monitor = Acme::FishFarm::WaterConditionMonitor-&gt;install;
    my $oxygen = Acme::FishFarm::OxygenMaintainer-&gt;install( DO_generation_volume =&gt; 1.92 );

    $water_monitor-&gt;add_oxygen_maintainer( $oxygen );
    
    # always check water conditions before checking LEDs and buzzers
    # also, these four method will return 1 or 0, upon calling them, the status of LEDs and buzzers will also be updated
    $water_monitor-&gt;ph_is_normal;
    $water_monitor-&gt;temperature_is_normal;
    $water_monitor-&gt;lacking_oxygen;
    $water_monitor-&gt;water_dirty;
    
    if ( $water_monitor-&gt;is_on_LED_DO ) {
        # do something, same goes to the rest of the LEDs
    }

    if ( $water_monitor-&gt;is_on_buzzer_short ) {
        # do something
    } elsif ( $water_monitor-&gt;is_on_buzzer_long ) {
        # do something
    }</code></pre>

<h1 id="EXPORT">EXPORT</h1>

<p>None</p>

<h1 id="NOTES">NOTES</h1>

<p>Some of the methods in this module can be confusing expecially when it comes to checking abnormal water conditions.</p>

<p><b>Please always always always check the water condition before checking the LEDs and buzzers status.</b></p>

<p><code>Acme::FishFarm</code> contains subroutines to check all the abnormal water conditions to ease this job.</p>

<h1 id="CREATION-RELATED-SUBROUTINES-METHODS">CREATION RELATED SUBROUTINES/METHODS</h1>

<p>Only 3 sensors are built-in. However, there is a 4th socket for the oxygen maintainer. For this socket, you&#39;ll need to manuall connect an Acme::FishFarm::OxygenMaintainer object by calling the <code>add_oxygen_maintainer</code> method.</p>

<p>More sockets might be available in the future.</p>

<h2 id="install-sensors">install ( %sensors )</h2>

<p>Installs a water condition monitoring system.</p>

<p>The <code>%sensors</code> included are:</p>

<dl>

<dt id="pH">pH</dt>
<dd>

<p>Optional. The default threshold range is <code>[6.5, 7.5]</code> and the default pH is <code>7.0</code>.</p>

<p>This will set the threshold value of the water pH. Please pass in an array reference to this key in the form of <code>[min_pH, max_pH]</code></p>

<p>The values are in the range of <code>1-14</code>. However, this range is not checked for incorrect values.</p>

</dd>
<dt id="temperature">temperature</dt>
<dd>

<p>Optional. The default threshold range is <code>[20, 25]</code> degree celcius and the default temprature is <code>25</code>.</p>

<p>This will set the threshold value of the water temperature. Please pass in an array reference to this key in the form of <code>[min_temperature, max_temperature]</code></p>

<p>The ranges of values are between <code>0</code> and <code>50</code> degree <b>celcius</b>. However, this range is not checked for incorrect values. The unit <code>celcius</code> is just a unit, it doesn&#39;t show up if you call any of it&#39;s re...

</dd>
<dt id="turbidity">turbidity</dt>
<dd>

<p>Optional. The default threshold is <code>180 ntu</code> and the default turbidity is set to <code>10 ntu</code>.</p>

<p>This will set the threshold of the turbidity of the water.</p>

<p>The range of values are between <code>0 ntu</code> and <code>300 ntu</code>. However, this range is not checked for incorrect values. The unit <code>ntu</code> is just a unit, it doesn&#39;t show up if you call any of it&#39;s related getters.</p>

</dd>
</dl>

<h2 id="add_oxygen_maintainer-oxygen_maintainer">add_oxygen_maintainer ( $oxygen_maintainer )</h2>

<p>Connects the oxygen maintainer ie <code>Acme::FishFarm::OxygenMaintainer</code> system to this monitoring system.</p>

<p>For now, this module can only check if the oxygen is lacking or not. This module contains a user friendly method compared to the standard terminology used in the <code>Acme::FishFarm::OxygenMaintainer</code> module. Other user friendly methods wil...

<h1 id="WATER-CONDITIONS-RELATED-SUBROUTINES-METHODS">WATER CONDITIONS RELATED SUBROUTINES/METHODS</h1>

<h2 id="current_ph-new_ph">current_ph ( $new_ph )</h2>

<p>Sets / returns the current pH of the water.</p>

<p><code>$new_pH</code> is optional. If present, the current pH will be set to <code>$new_ph</code>. Otherwise, returns the current pH reading.</p>

<h2 id="ph_threshold">ph_threshold</h2>

<p>Returns the pH threshold as an array ref.</p>

<h2 id="set_ph_threshold-ph_value">set_ph_threshold ( $ph_value )</h2>

<p>Sets the pH threshold.</p>

<h2 id="ph_is_normal">ph_is_normal</h2>

<p>Returns true if the current pH is within the set range of threshold.</p>

<p>The pH LED will light up and a short buzzer will be turned on if <b>only</b> the pH is not normal.</p>

<p>Don&#39;t worry about the long buzzer as it will be taken care of behind the scene.</p>

<h2 id="current_temperature-new_temperature">current_temperature ( $new_temperature )</h2>

<p>Sets / returns the current temperature of the water.</p>

<p><code>$new_temperature</code> is optional. If present, the current temperature will be set to <code>$new_temperature</code>. Otherwise, returns the current temperature reading.</p>

<h2 id="temperature_threshold">temperature_threshold</h2>

<p>Returns the acceptable temperature range as an array ref.</p>

<h2 id="set_temperature_threshold-new_temperature">set_temperature_threshold ( $new_temperature )</h2>

<p>Sets the water temperature threshold.</p>

<h2 id="temperature_is_normal">temperature_is_normal</h2>

<p>Returns true if the current temperature is within the set range of threshold.</p>

<p>The temperature LED will light up and a short buzzer will be turned on if <b>only</b> the temperature is not normal.</p>

<p>Don&#39;t worry about the long buzzer as it will be taken care of behind the scene.</p>



( run in 0.448 second using v1.01-cache-2.11-cpan-39bf76dae61 )