Lab::Moose::Instrument::AdjustRange - Role for automatic adjustment of measurement ranges.
version 3.682
This role provides the 'adjust_measurement_range' method, which selects a measurement range suitable for the current input signal.
'adjust_measurement_range'
my $value = $instrument->get_value(); my $old_range = $instrument->adjust_measurement_range( value => $value, verbose => 1, ); my $new_range = $instrument->get_range();
To limit the allowed ranges, supply an arrayref with allowed ranges:
$instrument->adjust_measurement_range( value => ..., allowed_ranges => [0.1, 10], );
If verbose is set, carp whenever the measurement range is changed.
verbose
By default, the range is changed, whenever the signal exceeds 100% of the measurement range, this factor can be adjusted with the safety_factor attribute.
safety_factor
$instrument->adjust_measurement_range( ..., ..., safety_factor => 0.8, # change range when signal is at 80% of current range );
Arrayref with allowed ranges
$instrument->set_range(value => $new_range);
Set measurement range.
$instrument->get_cached_range();
Get current range from cache.
This software is copyright (c) 2019 by the Lab::Measurement team; in detail:
Copyright 2018 Simon Reinhardt
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Lab::Measurement, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lab::Measurement
CPAN shell
perl -MCPAN -e shell install Lab::Measurement
For more information on module installation, please visit the detailed CPAN module installation guide.