| 1 | package Lab::XPRESS::Sweep::Frequency; | ||
| 2 | $Lab::XPRESS::Sweep::Frequency::VERSION = '3.899'; | ||
| 3 | #ABSTRACT: Frequency sweep | ||
| 4 | |||
| 5 | use v5.20; | ||
| 6 | |||
| 7 | use Lab::XPRESS::Sweep; | ||
| 8 | use Time::HiRes qw/usleep/, qw/time/; | ||
| 9 | use strict; | ||
| 10 | |||
| 11 | our @ISA = ('Lab::XPRESS::Sweep'); | ||
| 12 | |||
| 13 | sub new { | ||
| 14 | my $proto = shift; | ||
| 15 | my @args = @_; | ||
| 16 | my $class = ref($proto) || $proto; | ||
| 17 | my $self->{default_config} = { | ||
| 18 | id => 'Frequency_Sweep', | ||
| 19 | filename_extension => 'FRQ=', | ||
| 20 | interval => 1, | ||
| 21 | points => [], | ||
| 22 | rate => [1], | ||
| 23 | mode => 'step', | ||
| 24 | allowed_instruments => [ | ||
| 25 | qw/ | ||
| 26 | Lab::Instrument::SignalRecovery726x Lab::Instrument::SR830 | ||
| 27 | Lab::Instrument::HP83732A Lab::Instrument::MG369xB | ||
| 28 | Lab::Instrument::RSSMB100A Lab::Moose::Instrument::RS_SMB | ||
| 29 | Lab::Moose::Instrument::ZI_MFIA Lab::Moose::Instrument::ZI_MFLI | ||
| 30 | / | ||
| 31 | ], | ||
| 32 | allowed_sweep_modes => [ 'list', 'step' ], | ||
| 33 | number_of_points => [undef] | ||
| 34 | }; | ||
| 35 | |||
| 36 | $self = $class->SUPER::new( $self->{default_config}, @args ); | ||
| 37 | bless( $self, $class ); | ||
| 38 | |||
| 39 | return $self; | ||
| 40 | } | ||
| 41 | |||
| 42 | sub go_to_sweep_start { | ||
| 43 | my $self = shift; | ||
| 44 | |||
| 45 | # go to start: | ||
| 46 | $self->{config}->{instrument} | ||
| 47 | ->set_frq( { value => @{ $self->{config}->{points} }[0] } ); | ||
| 48 | } | ||
| 49 | |||
| 50 | sub start_continuous_sweep { | ||
| 51 | my $self = shift; | ||
| 52 | |||
| 53 | return; | ||
| 54 | |||
| 55 | } | ||
| 56 | |||
| 57 | sub go_to_next_step { | ||
| 58 | my $self = shift; | ||
| 59 | |||
| 60 | $self->{config}->{instrument}->set_frq( | ||
| 61 | { value => @{ $self->{config}->{points} }[ $self->{iterator} ] } ); | ||
| 62 | |||
| 63 | } | ||
| 64 | |||
| 65 | sub exit_loop { | ||
| 66 | my $self = shift; | ||
| 67 | |||
| 68 | if ( $self->{config}->{mode} =~ /step|list/ ) { | ||
| 69 | if ( | ||
| 70 | not | ||
| 71 | defined @{ $self->{config}->{points} }[ $self->{iterator} + 1 ] ) | ||
| 72 | { | ||
| 73 | return 1; | ||
| 74 | } | ||
| 75 | else { | ||
| 76 | return 0; | ||
| 77 | } | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 81 | sub get_value { | ||
| 82 | my $self = shift; | ||
| 83 | return $self->{config}->{instrument}->get_frq(); | ||
| 84 | } | ||
| 85 | |||
| 86 | sub exit { | ||
| 87 | my $self = shift; | ||
| 88 | $self->{config}->{instrument}->abort(); | ||
| 89 | } | ||
| 90 | |||
| 91 | 1; | ||
| 92 | |||
| 93 | __END__ |