Acme-FishFarm
view release on metacpan or search on metacpan
docs/Acme-FishFarm-1.01.html view on Meta::CPAN
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#VERSION">VERSION</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#EXPORT">EXPORT</a></li>
<li><a href="#NOTES">NOTES</a></li>
<li><a href="#SYSTEM-INSTALLATION-RELATED-SUBROUTINES">SYSTEM INSTALLATION RELATED SUBROUTINES</a>
<ul>
<li><a href="#install_all_systems">install_all_systems</a></li>
</ul>
</li>
<li><a href="#SENSOR-READING-RELATED-SUBROUTINES">SENSOR READING RELATED SUBROUTINES</a>
<ul>
<li><a href="#reduce_precision-decimal">reduce_precision ( $decimal )</a></li>
</ul>
</li>
<li><a href="#AUTOMATED-SYSTEMS-RELATED-SUBROUTINES">AUTOMATED SYSTEMS RELATED SUBROUTINES</a>
<ul>
<li><a href="#consume_oxygen-oxygen_maintainer-consumed_oxygen">consume_oxygen ( $oxygen_maintainer, $consumed_oxygen )</a></li>
<li><a href="#check_DO-oxygen_maintainer-current_DO_reading">check_DO ( $oxygen_maintainer, $current_DO_reading )</a></li>
<li><a href="#check_pH-water_monitor-current_ph_reading">check_pH ( $water_monitor, $current_ph_reading )</a></li>
<li><a href="#check_temperature-water_monitor-current_temperature_reading">check_temperature ( $water_monitor, $current_temperature_reading )</a></li>
<li><a href="#check_turbidity-water_monitor-current_turbidity_reading">check_turbidity ( $water_monitor, $current_turbidity_reading )</a></li>
<li><a href="#check_water_filter-water_filter-current_waste_count-reduce_waste_by">check_water_filter ( $water_filter, $current_waste_count, $reduce_waste_by )</a></li>
<li><a href="#check_water_level-water_level_maintainer-current_water_level">check_water_level ( $water_level_maintainer, $current_water_level )</a></li>
<li><a href="#check_feeder-feeder-verbose">check_feeder ( $feeder, $verbose )</a></li>
<li><a href="#render_leds-water_monitor">render_leds ( $water_monitor )</a></li>
<li><a href="#render_buzzer-water_monitor">render_buzzer ( $water_monitor )</a></li>
</ul>
</li>
<li><a href="#AUTHOR">AUTHOR</a></li>
<li><a href="#BUGS">BUGS</a></li>
<li><a href="#SUPPORT">SUPPORT</a></li>
<li><a href="#ACKNOWLEDGEMENTS">ACKNOWLEDGEMENTS</a></li>
<li><a href="#SEE-ALSO">SEE ALSO</a></li>
<li><a href="#LICENSE-AND-COPYRIGHT">LICENSE AND COPYRIGHT</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>Acme::FishFarm - A Fish Farm with Automated Systems</p>
<h1 id="VERSION">VERSION</h1>
<p>Version 1.01</p>
<h1 id="SYNOPSIS">SYNOPSIS</h1>
<pre><code> use 5.010;
use Acme::FishFarm ":all";
my $water_monitor = Acme::FishFarm::WaterConditionMonitor->install;
my $oxygen = Acme::FishFarm::OxygenMaintainer->install( DO_generation_volume => 1.92 );
$water_monitor->add_oxygen_maintainer( $oxygen );
say "Water condition monitor installed...";
say "Oxygen maintainer installed and connected to water condition monitor...";
say "Water condition monitor switched on!";
say "";
while ( "fish are swimming happily" ) {
### DO
check_DO( $oxygen, reduce_precision( rand(8) ) );
say "";
### pH
check_pH( $water_monitor, 6.912 );
#check_pH( $water_monitor, 5.9 );
say "" ;
## temperature
#check_temperature( $water_monitor, 23 );
check_temperature( $water_monitor, 26 );
say "";
## turbidity
check_turbidity( $water_monitor, 120 );
#check_turbidity( $water_monitor, 190 );
say "";
# all LEDs
render_leds( $water_monitor );
say "";
# buzzers
render_buzzer( $water_monitor );
sleep(3);
say "-----------------------------";
}
</code></pre>
<h1 id="EXPORT">EXPORT</h1>
<p>The <code>:all</code> tag can be used to import all the subroutines available in this module.</p>
<h1 id="NOTES">NOTES</h1>
<p>Almost all the subroutines in this module will give output. The unit measurements used will be according to the ones mentioned in <code>Acme::FishFarm::WaterConditionMonitor</code>.</p>
<h1 id="SYSTEM-INSTALLATION-RELATED-SUBROUTINES">SYSTEM INSTALLATION RELATED SUBROUTINES</h1>
<h2 id="install_all_systems">install_all_systems</h2>
<p>Installs all the available systems the default way and returns them as a list of <code>Acme::FishFarm::*</code> objects in the following sequence:</p>
<pre><code> (Feeder, OxygenMaintainer, WaterConditionMonitor, WaterLevelMaintainer, WaterFiltration)</code></pre>
<h1 id="SENSOR-READING-RELATED-SUBROUTINES">SENSOR READING RELATED SUBROUTINES</h1>
<h2 id="reduce_precision-decimal">reduce_precision ( $decimal )</h2>
<p>Reduces positive or negative <code>$decimal</code> to a 3-decimal value. Make sure to pass in a decimal with more than 3 decimal points.</p>
<p>Returns the reduced precision value.</p>
<p>This subroutine is useful if you are trying to set the current sensor readings randomly using the built-in <code>rand</code> function as you do not want to end up with too many decimals on the screen.</p>
<h1 id="AUTOMATED-SYSTEMS-RELATED-SUBROUTINES">AUTOMATED SYSTEMS RELATED SUBROUTINES</h1>
<p>All of the subroutines here will give output.</p>
<p>Take note that there are some systems that can't be connected to the water monitoring system and therefore will not effect the LEDs or buzzers. These systems are:</p>
<ul>
<li><p>Acme::FishFarm::Feeder</p>
</li>
<li><p>Acme::FishFarm::WaterFiltration</p>
</li>
<li><p>Acme::FishFarm::WaterLevelMaintainer</p>
</li>
</ul>
<h2 id="consume_oxygen-oxygen_maintainer-consumed_oxygen">consume_oxygen ( $oxygen_maintainer, $consumed_oxygen )</h2>
<p>This will cause the oxygen level (DO level) of the <code>Acme::FishFarm::OxygenMaintainer</code> to reduce by <code>$consumed_oxygen mg/L</code></p>
<p>Returns 1 upon success.</p>
<h2 id="check_DO-oxygen_maintainer-current_DO_reading">check_DO ( $oxygen_maintainer, $current_DO_reading )</h2>
<p>This checks and outputs the condition of the current DO level.</p>
<p>Take note that this process will trigger the LED and buzzer if abnormal condition is present.</p>
( run in 0.422 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )