NAME

Acme::FishFarm - A Fish Farm with Automated Systems

VERSION

Version 1.01

SYNOPSIS

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 "-----------------------------";
}

EXPORT

The :all tag can be used to import all the subroutines available in this module.

NOTES

Almost all the subroutines in this module will give output. The unit measurements used will be according to the ones mentioned in Acme::FishFarm::WaterConditionMonitor.

SYSTEM INSTALLATION RELATED SUBROUTINES

install_all_systems

Installs all the available systems the default way and returns them as a list of Acme::FishFarm::* objects in the following sequence:

(Feeder, OxygenMaintainer, WaterConditionMonitor, WaterLevelMaintainer, WaterFiltration)

SENSOR READING RELATED SUBROUTINES

reduce_precision ( $decimal )

Reduces positive or negative $decimal to a 3-decimal value. Make sure to pass in a decimal with more than 3 decimal points.

Returns the reduced precision value.

This subroutine is useful if you are trying to set the current sensor readings randomly using the built-in rand function as you do not want to end up with too many decimals on the screen.

AUTOMATED SYSTEMS RELATED SUBROUTINES

All of the subroutines here will give output.

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:

  • Acme::FishFarm::Feeder

  • Acme::FishFarm::WaterFiltration

  • Acme::FishFarm::WaterLevelMaintainer

consume_oxygen ( $oxygen_maintainer, $consumed_oxygen )

This will cause the oxygen level (DO level) of the Acme::FishFarm::OxygenMaintainer to reduce by $consumed_oxygen mg/L

Returns 1 upon success.

check_DO ( $oxygen_maintainer, $current_DO_reading )

This checks and outputs the condition of the current DO level.

Take note that this process will trigger the LED and buzzer if abnormal condition is present.

Returns 1 upon success.

check_pH ( $water_monitor, $current_ph_reading )

This checks and outputs the condition of the current pH value.

Take note that this process will trigger the LED and buzzer if abnormal condition is present.

Returns 1 upon success.

check_temperature ( $water_monitor, $current_temperature_reading )

This checks and outputs the condition of the current temperature.

Take note that this process will trigger the LED and buzzer if abnormal condition is present.

Returns 1 upon success.

check_turbidity ( $water_monitor, $current_turbidity_reading )

This checks and outputs the condition of the current temperature.

Take note that this process will trigger the LED and buzzer if abnormal condition is present.

Returns 1 upon success.

check_water_filter ( $water_filter, $current_waste_count, $reduce_waste_by )

This checks, performs necessary actions and outputs the condition of the current waste count in the filtering cylinder.

Take note that this process DOES NOT trigger the LED and buzzer if abnormal condition is present.

Returns 1 upon success.

check_water_level ( $water_level_maintainer, $current_water_level )

This checks, performs necessary actions and outputs the condition of the current waste count in the filtering cylinder.

Take note that this process DOES NOT trigger the LED and buzzer if abnormal condition is present.

Returns 1 upon success.

check_feeder ( $feeder, $verbose )

This checks, performs necessary actions and outputs the condition of the feeder. Each call will tick the clock inside the feeder. See Acme::FishFarm::Feeder for more info.

If the food tank is empty, it will be filled to the default. So if you want to fill a different amount, please set the amount before hand. See Acme::FishFarm::Feeder.

Setting $verbose to 1 will give more output about the empty food tank.

Take note that this process DOES NOT trigger the LED and buzzer if abnormal condition is present.

Returns 1 upon success.

render_leds ( $water_monitor )

Outputs which LEDs are lighted up. Returns 1 upon success.

Currently this subroutine only shows the LEDs present in the Acme::FishFarm::WaterConditionMonitor object. See that module for more details about the available LEDs.

More LEDs will be available in the future.

render_buzzer ( $water_monitor )

Outputs which buzzer is buzzing. Returns 1 upon success.

See Acme::FishFarm::WaterConditionMonitor for details on how the short and long buzzers are switched on and off.

AUTHOR

Raphael Jong Jun Jie, <ellednera at cpan.org>

BUGS

Please report any bugs or feature requests to bug-acme-fishfarm at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-FishFarm. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Acme::FishFarm

You can also look for information at:

ACKNOWLEDGEMENTS

Besiyata d'shmaya

SEE ALSO

Acme::FishFarm::Feeder

Acme::FishFarm::OxygenMaintainer

Acme::FishFarm::WaterConditionMonitor

Acme::FishFarm::WaterFiltration

Acme::FishFarm::::WaterLevelMaintainer

LICENSE AND COPYRIGHT

This software is Copyright (c) 2021 by Raphael Jong Jun Jie.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)