| 1 | # | ||||||||||||||||||||||||||||
| 2 | # Rinchi Common Image Generator Interface for Perl | ||||||||||||||||||||||||||||
| 3 | # Class Identifier: f78aca54-200e-11de-bda9-001c25551abc | ||||||||||||||||||||||||||||
| 4 | # Author: Brian M. Ames | ||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | package Rinchi::CIGIPP::CelestialSphereControl; | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 2 | require Exporter; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | # Items to export into callers namespace by default. Note: do not export | ||||||||||||||||||||||||||||
| 19 | # names by default without a very good reason. Use EXPORT_OK instead. | ||||||||||||||||||||||||||||
| 20 | # Do not simply export all your public functions/methods/constants. | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | # This allows declaration use Rinchi::CIGI::AtmosphereControl ':all'; | ||||||||||||||||||||||||||||
| 23 | # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK | ||||||||||||||||||||||||||||
| 24 | # will save memory. | ||||||||||||||||||||||||||||
| 25 | 2 | our %EXPORT_TAGS = ( 'all' => [ qw( | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | ) ] ); | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 2 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 2 | our @EXPORT = qw( | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 2 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | # Preloaded methods go here. | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | =head1 NAME | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | Rinchi::CIGIPP::CelestialSphereControl - Perl extension for the Common Image | ||||||||||||||||||||||||||||
| 42 | Generator Interface - Celestial Sphere Control data packet. | ||||||||||||||||||||||||||||
| 43 | data packet. | ||||||||||||||||||||||||||||
| 44 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | use Rinchi::CIGIPP::CelestialSphereControl; | ||||||||||||||||||||||||||||
| 47 | my $sky_ctl = Rinchi::CIGIPP::CelestialSphereControl->new(); | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | $packet_type = $sky_ctl->packet_type(); | ||||||||||||||||||||||||||||
| 50 | $packet_size = $sky_ctl->packet_size(); | ||||||||||||||||||||||||||||
| 51 | $hour = $sky_ctl->hour(123); | ||||||||||||||||||||||||||||
| 52 | $minute = $sky_ctl->minute(7); | ||||||||||||||||||||||||||||
| 53 | $date_time_valid = $sky_ctl->date_time_valid(Rinchi::CIGIPP->Invalid); | ||||||||||||||||||||||||||||
| 54 | $star_field_enable = $sky_ctl->star_field_enable(Rinchi::CIGIPP->Disable); | ||||||||||||||||||||||||||||
| 55 | $moon_enable = $sky_ctl->moon_enable(Rinchi::CIGIPP->Disable); | ||||||||||||||||||||||||||||
| 56 | $sun_enable = $sky_ctl->sun_enable(Rinchi::CIGIPP->Disable); | ||||||||||||||||||||||||||||
| 57 | $ephemeris_model_enable = $sky_ctl->ephemeris_model_enable(Rinchi::CIGIPP->Enable); | ||||||||||||||||||||||||||||
| 58 | $date = $sky_ctl->date(5486); | ||||||||||||||||||||||||||||
| 59 | $star_field_intensity = $sky_ctl->star_field_intensity(29.575); | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | The Celestial Sphere Control data packet allows the Host to specify properties | ||||||||||||||||||||||||||||
| 64 | of the sky model. | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | The Date attribute specifies the current date and the Hour and Minute | ||||||||||||||||||||||||||||
| 67 | attributes specify the current time of day. The IG uses these attributes to | ||||||||||||||||||||||||||||
| 68 | determine ambient light properties, sun and moon positions (and corresponding | ||||||||||||||||||||||||||||
| 69 | directional light positions), moon phase, and horizon glow. | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | An IG typically uses an ephemeris model to continuously update the time of day. | ||||||||||||||||||||||||||||
| 72 | A Celestial Sphere Control packet need not be sent each minute for the sole | ||||||||||||||||||||||||||||
| 73 | purpose of updating the time of day unless the Host has disabled the ephemeris | ||||||||||||||||||||||||||||
| 74 | model with the Ephemeris Model Enable flag. | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | Note: If the Host freezes the simulation, it must send a Celestial Sphere | ||||||||||||||||||||||||||||
| 77 | Control packet with the Ephemeris Model Enable attribute set to Disable (0); | ||||||||||||||||||||||||||||
| 78 | otherwise, the IG will continue to update the time of day. When the Host | ||||||||||||||||||||||||||||
| 79 | resumes the simulation, it must explicitly re-enable the ephemeris model. | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | The Date/Time Valid attribute specifies whether the IG should set the current | ||||||||||||||||||||||||||||
| 82 | date and time to the values specified by the Hour, Minute, and Date attributes. | ||||||||||||||||||||||||||||
| 83 | This enables the Host to change sky model properties without affecting the | ||||||||||||||||||||||||||||
| 84 | ephemeris model. | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | =head2 EXPORT | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | None by default. | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | #============================================================================== | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | =item new $sky_ctl = Rinchi::CIGIPP::CelestialSphereControl->new() | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | Constructor for Rinchi::CelestialSphereControl. | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | =cut | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=29.8
Pod
documented
| |||||||||||||||||||||||||||||
| 99 | 2 | my $class = shift; | |||||||||||||||||||||||||||
| 100 | 2 | ▶ | $class = ref($class) || $class; | ||||||||||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 2 | my $self = { | |||||||||||||||||||||||||||
| 103 | '_Buffer' => '', | ||||||||||||||||||||||||||||
| 104 | '_ClassIdent' => 'f78aca54-200e-11de-bda9-001c25551abc', | ||||||||||||||||||||||||||||
| 105 | '_Pack' => 'CCCCCCSIf', | ||||||||||||||||||||||||||||
| 106 | '_Swap1' => 'CCCCCCvVV', | ||||||||||||||||||||||||||||
| 107 | '_Swap2' => 'CCCCCCnNN', | ||||||||||||||||||||||||||||
| 108 | 'packetType' => 9, | ||||||||||||||||||||||||||||
| 109 | 'packetSize' => 16, | ||||||||||||||||||||||||||||
| 110 | 'hour' => 0, | ||||||||||||||||||||||||||||
| 111 | 'minute' => 0, | ||||||||||||||||||||||||||||
| 112 | '_bitfields1' => 0, # Includes bitfields unused12, dateTimeValid, starFieldEnable, moonEnable, sunEnable, and ephemerisModelEnable. | ||||||||||||||||||||||||||||
| 113 | 'dateTimeValid' => 0, | ||||||||||||||||||||||||||||
| 114 | 'starFieldEnable' => 0, | ||||||||||||||||||||||||||||
| 115 | 'moonEnable' => 0, | ||||||||||||||||||||||||||||
| 116 | 'sunEnable' => 0, | ||||||||||||||||||||||||||||
| 117 | 'ephemerisModelEnable' => 0, | ||||||||||||||||||||||||||||
| 118 | '_unused13' => 0, | ||||||||||||||||||||||||||||
| 119 | '_unused14' => 0, | ||||||||||||||||||||||||||||
| 120 | 'date' => 0, | ||||||||||||||||||||||||||||
| 121 | 'starFieldIntensity' => 0, | ||||||||||||||||||||||||||||
| 122 | }; | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 2 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | if (ref($_[0]) eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 126 | 0 | $self->{'_Buffer'} = $_[0][0]; | |||||||||||||||||||||||||||
| 127 | } elsif (ref($_[0]) eq 'HASH') { | ||||||||||||||||||||||||||||
| 128 | 0 | foreach my $attr (keys %{$_[0]}) { | |||||||||||||||||||||||||||
| 129 | 0 | ▶ | $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 2 | bless($self,$class); | |||||||||||||||||||||||||||
| 135 | 2 | return $self; | |||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | #============================================================================== | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | =item sub packet_type() | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | $value = $sky_ctl->packet_type(); | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | Data Packet Identifier. | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | This attribute identifies this data packet as the Celestial Sphere Control | ||||||||||||||||||||||||||||
| 147 | packet. The value of this attribute must be 9. | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | =cut | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 2 | ▶ | sub packet_type() { | ||||||||||||||||||||||||||
|
Subroutine
packet_type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 152 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 153 | 2 | return $self->{'packetType'}; | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | #============================================================================== | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | =item sub packet_size() | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | $value = $sky_ctl->packet_size(); | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | Data Packet Size. | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | This attribute indicates the number of bytes in this data packet. The value of | ||||||||||||||||||||||||||||
| 165 | this attribute must be 16. | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | =cut | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 2 | ▶ | sub packet_size() { | ||||||||||||||||||||||||||
|
Subroutine
packet_size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 170 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 171 | 2 | return $self->{'packetSize'}; | |||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | #============================================================================== | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | =item sub hour([$newValue]) | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | $value = $sky_ctl->hour($newValue); | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | Hour. | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | This attribute specifies the current hour of the day within the simulation. | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | =cut | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 2 | ▶ | sub hour() { | ||||||||||||||||||||||||||
|
Subroutine
hour: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 187 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 188 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 189 | 2 | $self->{'hour'} = $nv; | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | 2 | return $self->{'hour'}; | |||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | #============================================================================== | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | =item sub minute([$newValue]) | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | $value = $sky_ctl->minute($newValue); | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | Minute. | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | This attribute specifies the current minute of the day within the simulation. | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | =cut | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 2 | ▶ | sub minute() { | ||||||||||||||||||||||||||
|
Subroutine
minute: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 207 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 208 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 209 | 2 | $self->{'minute'} = $nv; | |||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||
| 211 | 2 | return $self->{'minute'}; | |||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | #============================================================================== | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | =item sub date_time_valid([$newValue]) | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | $value = $sky_ctl->date_time_valid($newValue); | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | Date/Time Valid. | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | This attribute specifies whether the Hour, Minute, and Date attributes are | ||||||||||||||||||||||||||||
| 223 | valid. If Date/Time Valid is set to Valid (1), these values will override the | ||||||||||||||||||||||||||||
| 224 | IG's current date and time. | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | Invalid 0 | ||||||||||||||||||||||||||||
| 227 | Valid 1 | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | =cut | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 2 | ▶ | sub date_time_valid() { | ||||||||||||||||||||||||||
|
Subroutine
date_time_valid: called CC=4 SCAR=14.7
Pod
documented
| |||||||||||||||||||||||||||||
| 232 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 233 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 234 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 235 | 2 | $self->{'dateTimeValid'} = $nv; | |||||||||||||||||||||||||||
| 236 | 2 | $self->{'starFieldEnable'} = $nv; | |||||||||||||||||||||||||||
| 237 | 2 | $self->{'moonEnable'} = $nv; | |||||||||||||||||||||||||||
| 238 | 2 | $self->{'sunEnable'} = $nv; | |||||||||||||||||||||||||||
| 239 | 2 | $self->{'ephemerisModelEnable'} = $nv; | |||||||||||||||||||||||||||
| 240 | 2 | $self->{'_bitfields1'} |= ($nv << 4) &0x10; | |||||||||||||||||||||||||||
| 241 | } else { | ||||||||||||||||||||||||||||
| 242 | 0 | carp "date_time_valid must be 0 (Invalid), or 1 (Valid)."; | |||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | 2 | return (($self->{'_bitfields1'} & 0x10) >> 4); | |||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | #============================================================================== | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | =item sub star_field_enable([$newValue]) | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | $value = $sky_ctl->star_field_enable($newValue); | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | Star Field Enable. | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | This attribute specifies whether the star attribute is enabled in the sky | ||||||||||||||||||||||||||||
| 257 | model. The star positions are determined by the current date and time. | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | Disable 0 | ||||||||||||||||||||||||||||
| 260 | Enable 1 | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | =cut | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | 2 | ▶ | sub star_field_enable() { | ||||||||||||||||||||||||||
|
Subroutine
star_field_enable: called CC=4 SCAR=15.9
Pod
documented
| |||||||||||||||||||||||||||||
| 265 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 266 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 268 | 2 | $self->{'_bitfields1'} |= ($nv << 3) &0x08; | |||||||||||||||||||||||||||
| 269 | } else { | ||||||||||||||||||||||||||||
| 270 | 0 | carp "star_field_enable must be 0 (Disable), or 1 (Enable)."; | |||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | 2 | return (($self->{'_bitfields1'} & 0x08) >> 3); | |||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | #============================================================================== | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | =item sub moon_enable([$newValue]) | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | $value = $sky_ctl->moon_enable($newValue); | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | Moon Enable. | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | This attribute specifies whether the moon is enabled in the sky model. The moon | ||||||||||||||||||||||||||||
| 285 | phase is determined by the current date. | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | Disable 0 | ||||||||||||||||||||||||||||
| 288 | Enable 1 | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | =cut | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | 2 | ▶ | sub moon_enable() { | ||||||||||||||||||||||||||
|
Subroutine
moon_enable: called CC=4 SCAR=15.9
Pod
documented
| |||||||||||||||||||||||||||||
| 293 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 294 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 295 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 296 | 2 | $self->{'_bitfields1'} |= ($nv << 2) &0x04; | |||||||||||||||||||||||||||
| 297 | } else { | ||||||||||||||||||||||||||||
| 298 | 0 | carp "moon_enable must be 0 (Disable), or 1 (Enable)."; | |||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||
| 301 | 2 | return (($self->{'_bitfields1'} & 0x04) >> 2); | |||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | #============================================================================== | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | =item sub sun_enable([$newValue]) | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | $value = $sky_ctl->sun_enable($newValue); | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | Sun Enable. | ||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | This attribute specifies whether the sun is enabled in the sky model. | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | Disable 0 | ||||||||||||||||||||||||||||
| 315 | Enable 1 | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | =cut | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | 2 | ▶ | sub sun_enable() { | ||||||||||||||||||||||||||
|
Subroutine
sun_enable: called CC=4 SCAR=15.9
Pod
documented
| |||||||||||||||||||||||||||||
| 320 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 321 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 322 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 323 | 2 | $self->{'_bitfields1'} |= ($nv << 1) &0x02; | |||||||||||||||||||||||||||
| 324 | } else { | ||||||||||||||||||||||||||||
| 325 | 0 | carp "sun_enable must be 0 (Disable), or 1 (Enable)."; | |||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | 2 | return (($self->{'_bitfields1'} & 0x02) >> 1); | |||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | #============================================================================== | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | =item sub ephemeris_model_enable([$newValue]) | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | $value = $sky_ctl->ephemeris_model_enable($newValue); | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | Ephemeris Model Enable. | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | This attribute controls whether the time of day is static or continuous. If | ||||||||||||||||||||||||||||
| 340 | this attribute is set to Enabled (1), the image generator will continuously | ||||||||||||||||||||||||||||
| 341 | update the time of day. | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | Disable 0 | ||||||||||||||||||||||||||||
| 344 | Enable 1 | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | =cut | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | 2 | ▶ | sub ephemeris_model_enable() { | ||||||||||||||||||||||||||
|
Subroutine
ephemeris_model_enable: called CC=4 SCAR=15.9
Pod
documented
| |||||||||||||||||||||||||||||
| 349 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 350 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 351 | 2 | ▶ | if (($nv==0) or ($nv==1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$nv == 0 or $nv == 1
MC/DC0%0/2
$nv == 0 or $nv == 1
$nv == 0
$nv == 1
Truth table33%1/3
A or B
A= $nv == 0B= $nv == 1
| |||||||||||||||||||||||||||||
| 352 | 2 | $self->{'_bitfields1'} |= $nv &0x01; | |||||||||||||||||||||||||||
| 353 | } else { | ||||||||||||||||||||||||||||
| 354 | 0 | carp "ephemeris_model_enable must be 0 (Disable), or 1 (Enable)."; | |||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||
| 357 | 2 | return ($self->{'_bitfields1'} & 0x01); | |||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | #============================================================================== | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | =item sub date([$newValue]) | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | $value = $sky_ctl->date($newValue); | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | Date. | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | This attribute specifies the current date within the simulation. The date is | ||||||||||||||||||||||||||||
| 369 | represented as a seven- or eight-digit decimal integer formatted as follows: | ||||||||||||||||||||||||||||
| 370 | MMDDYYYY = (month × 1000000) + (day × 10000) + year. | ||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | =cut | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | 2 | ▶ | sub date() { | ||||||||||||||||||||||||||
|
Subroutine
date: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 375 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 376 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 377 | 2 | $self->{'date'} = $nv; | |||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||
| 379 | 2 | return $self->{'date'}; | |||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | #============================================================================== | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | =item sub star_field_intensity([$newValue]) | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | $value = $sky_ctl->star_field_intensity($newValue); | ||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | Star Field Intensity. | ||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||
| 390 | This attribute specifies the intensity of the star attribute within the sky | ||||||||||||||||||||||||||||
| 391 | model. This attribute is ignored if Star Field Enable is set to Disable (0). | ||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | =cut | ||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | 2 | ▶ | sub star_field_intensity() { | ||||||||||||||||||||||||||
|
Subroutine
star_field_intensity: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 396 | 2 | my ($self,$nv) = @_; | |||||||||||||||||||||||||||
| 397 | 2 | ▶ | if (defined($nv)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 398 | 2 | $self->{'starFieldIntensity'} = $nv; | |||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||
| 400 | 2 | return $self->{'starFieldIntensity'}; | |||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | #========================================================================== | ||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | =item sub pack() | ||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | $value = $sky_ctl->pack(); | ||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | Returns the packed data packet. | ||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||
| 411 | =cut | ||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | 2 | ▶ | sub pack($) { | ||||||||||||||||||||||||||
|
Subroutine
pack: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 414 | 2 | my $self = shift ; | |||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | $self->{'_Buffer'} = CORE::pack($self->{'_Pack'}, | ||||||||||||||||||||||||||||
| 417 | $self->{'packetType'}, | ||||||||||||||||||||||||||||
| 418 | $self->{'packetSize'}, | ||||||||||||||||||||||||||||
| 419 | $self->{'hour'}, | ||||||||||||||||||||||||||||
| 420 | $self->{'minute'}, | ||||||||||||||||||||||||||||
| 421 | $self->{'_bitfields1'}, # Includes bitfields unused12, dateTimeValid, starFieldEnable, moonEnable, sunEnable, and ephemerisModelEnable. | ||||||||||||||||||||||||||||
| 422 | $self->{'_unused13'}, | ||||||||||||||||||||||||||||
| 423 | $self->{'_unused14'}, | ||||||||||||||||||||||||||||
| 424 | $self->{'date'}, | ||||||||||||||||||||||||||||
| 425 | 2 | $self->{'starFieldIntensity'}, | |||||||||||||||||||||||||||
| 426 | ); | ||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | 2 | return $self->{'_Buffer'}; | |||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | #========================================================================== | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | =item sub unpack() | ||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||
| 435 | $value = $sky_ctl->unpack(); | ||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||
| 437 | Unpacks the packed data packet. | ||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | =cut | ||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | 0 | ▶ | sub unpack($) { | ||||||||||||||||||||||||||
|
Subroutine
unpack: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 442 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||
| 444 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 445 | 0 | $self->{'_Buffer'} = shift @_; | |||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||
| 447 | 0 | my ($a,$b,$c,$d,$e,$f,$g,$h,$i) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'}); | |||||||||||||||||||||||||||
| 448 | 0 | $self->{'packetType'} = $a; | |||||||||||||||||||||||||||
| 449 | 0 | $self->{'packetSize'} = $b; | |||||||||||||||||||||||||||
| 450 | 0 | $self->{'hour'} = $c; | |||||||||||||||||||||||||||
| 451 | 0 | $self->{'minute'} = $d; | |||||||||||||||||||||||||||
| 452 | 0 | $self->{'_bitfields1'} = $e; # Includes bitfields unused12, dateTimeValid, starFieldEnable, moonEnable, sunEnable, and ephemerisModelEnable. | |||||||||||||||||||||||||||
| 453 | 0 | $self->{'_unused13'} = $f; | |||||||||||||||||||||||||||
| 454 | 0 | $self->{'_unused14'} = $g; | |||||||||||||||||||||||||||
| 455 | 0 | $self->{'date'} = $h; | |||||||||||||||||||||||||||
| 456 | 0 | $self->{'starFieldIntensity'} = $i; | |||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | 0 | $self->{'dateTimeValid'} = $self->date_time_valid(); | |||||||||||||||||||||||||||
| 459 | 0 | $self->{'starFieldEnable'} = $self->star_field_enable(); | |||||||||||||||||||||||||||
| 460 | 0 | $self->{'moonEnable'} = $self->moon_enable(); | |||||||||||||||||||||||||||
| 461 | 0 | $self->{'sunEnable'} = $self->sun_enable(); | |||||||||||||||||||||||||||
| 462 | 0 | $self->{'ephemerisModelEnable'} = $self->ephemeris_model_enable(); | |||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||
| 464 | 0 | return $self->{'_Buffer'}; | |||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||
| 467 | #========================================================================== | ||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | =item sub byte_swap() | ||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | $obj_name->byte_swap(); | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | Byte swaps the packed data packet. | ||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | =cut | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | 0 | ▶ | sub byte_swap($) { | ||||||||||||||||||||||||||
|
Subroutine
byte_swap: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 478 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||
| 480 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 481 | 0 | $self->{'_Buffer'} = shift @_; | |||||||||||||||||||||||||||
| 482 | } else { | ||||||||||||||||||||||||||||
| 483 | 0 | $self->pack(); | |||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||
| 485 | 0 | my ($a,$b,$c,$d,$e,$f,$g,$h,$i) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'}); | |||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | 0 | $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g,$h,$i); | |||||||||||||||||||||||||||
| 488 | 0 | $self->unpack(); | |||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||
| 490 | 0 | return $self->{'_Buffer'}; | |||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | 2 | 1; | |||||||||||||||||||||||||||
| 494 | __END__ | ||||||||||||||||||||||||||||