| 1 |
|
| package Lab::Instrument::TemperatureControl; |
| 2 |
|
| #ABSTRACT: Generic temperature control instrument base class |
| 3 |
|
| $Lab::Instrument::TemperatureControl::VERSION = '3.899'; |
| 4 |
|
| use v5.20; |
| 5 |
|
| |
| 6 |
|
| use strict; |
| 7 |
|
| |
| 8 |
|
| our @ISA = ('Lab::Instrument'); |
| 9 |
|
| |
| 10 |
|
| our %fields = ( |
| 11 |
|
| supported_connections => [], |
| 12 |
|
| |
| 13 |
|
| # supported config options |
| 14 |
|
| device_settings => { |
| 15 |
|
| has_pidcontroller => undef, |
| 16 |
|
| num_heaters => 0, |
| 17 |
|
| num_sensors => 0, |
| 18 |
|
| sample_sensor => undef, |
| 19 |
|
| sample_heater => undef, |
| 20 |
|
| }, |
| 21 |
|
| |
| 22 |
|
| # Config hash passed to subchannel objects or $self->configure() |
| 23 |
|
| default_device_settings => {}, |
| 24 |
|
| ); |
| 25 |
|
| |
| 26 |
|
| sub new { |
| 27 |
|
| my $proto = shift; |
| 28 |
|
| my $class = ref($proto) || $proto; |
| 29 |
|
| my $self = $class->SUPER::new(@_); |
| 30 |
|
| $self->${ \( __PACKAGE__ . '::_construct' ) }(__PACKAGE__); |
| 31 |
|
| |
| 32 |
|
| print |
| 33 |
|
| "Temperature control support is experimental. You have been warned.\n"; |
| 34 |
|
| return $self; |
| 35 |
|
| } |
| 36 |
|
| |
| 37 |
|
| sub set_sample_sensor() { |
| 38 |
|
| my $self = shift; |
| 39 |
|
| my $channel = shift; |
| 40 |
|
| |
| 41 |
|
| # setze sample sensor if this is a valid channel number |
| 42 |
|
| } |
| 43 |
|
| |
| 44 |
|
| sub get_temperature() { |
| 45 |
|
| my $self = shift; |
| 46 |
|
| my $channel = shift; |
| 47 |
|
| |
| 48 |
|
| # no channel -> use default channel |
| 49 |
|
| # use method from hardware |
| 50 |
|
| return $self->_get_temperature($channel); |
| 51 |
|
| } |
| 52 |
|
| |
| 53 |
|
| sub get_sample_temperature() { |
| 54 |
|
| my $self = shift; |
| 55 |
|
| return $self->get_temperature( $self->get_sample_sensor ); |
| 56 |
|
| } |
| 57 |
|
| |
| 58 |
|
| sub _get_temperature() { |
| 59 |
|
| die "get_temperature not implemented for this instrument\n"; |
| 60 |
|
| } |
| 61 |
|
| |
| 62 |
|
| 1; |
| 63 |
|
| |
| 64 |
|
| __END__ |