File Coverage

blib/lib/Rinchi/CIGIPP/WeatherControl.pm
Criterion Covered Total %
statement 132 184 71.7
branch 32 74 43.2
condition 13 39 33.3
subroutine 31 33 93.9
pod 29 29 100.0
total 237 359 66.0


line stmt bran cond sub pod time code
1             #
2             # Rinchi Common Image Generator Interface for Perl
3             # Class Identifier: f78ad2ec-200e-11de-bdac-001c25551abc
4             # Author: Brian M. Ames
5             #
6              
7             package Rinchi::CIGIPP::WeatherControl;
8              
9 1     1   30 use 5.006;
  1         3  
  1         53  
10 1     1   7 use strict;
  1         2  
  1         41  
11 1     1   6 use warnings;
  1         2  
  1         37  
12 1     1   5 use Carp;
  1         2  
  1         5498  
13              
14             require Exporter;
15              
16             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             our %EXPORT_TAGS = ( 'all' => [ qw(
26            
27             ) ] );
28              
29             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
30              
31             our @EXPORT = qw(
32            
33             );
34              
35             our $VERSION = '0.01';
36              
37             # Preloaded methods go here.
38              
39             =head1 NAME
40              
41             Rinchi::CIGIPP::WeatherControl - Perl extension for the Common Image Generator
42             Interface - Weather Control data packet.
43             data packet.
44             =head1 SYNOPSIS
45              
46             use Rinchi::CIGIPP::WeatherControl;
47             my $wthr_ctl = Rinchi::CIGIPP::WeatherControl->new();
48              
49             $packet_type = $wthr_ctl->packet_type();
50             $packet_size = $wthr_ctl->packet_size();
51             $entity_ident = $wthr_ctl->entity_ident(22740);
52             $region_ident = $wthr_ctl->region_ident(59769);
53             $layer_ident = $wthr_ctl->layer_ident(131);
54             $humidity = $wthr_ctl->humidity(89);
55             $cloud_type = $wthr_ctl->cloud_type(Rinchi::CIGIPP->None);
56             $random_lightning_enable = $wthr_ctl->random_lightning_enable(Rinchi::CIGIPP->Disable);
57             $random_winds_enable = $wthr_ctl->random_winds_enable(Rinchi::CIGIPP->Disable);
58             $scud_enable = $wthr_ctl->scud_enable(Rinchi::CIGIPP->Enable);
59             $weather_enable = $wthr_ctl->weather_enable(Rinchi::CIGIPP->Enable);
60             $severity = $wthr_ctl->severity(2);
61             $weather_scope = $wthr_ctl->weather_scope(Rinchi::CIGIPP->RegionalScope);
62             $air_temperature = $wthr_ctl->air_temperature(15.426);
63             $visibility_range = $wthr_ctl->visibility_range(89.817);
64             $scud_frequency = $wthr_ctl->scud_frequency(2.31);
65             $coverage = $wthr_ctl->coverage(84.412);
66             $base_elevation = $wthr_ctl->base_elevation(47.967);
67             $thickness = $wthr_ctl->thickness(38.301);
68             $transition_band = $wthr_ctl->transition_band(70.407);
69             $horizontal_wind_speed = $wthr_ctl->horizontal_wind_speed(45.598);
70             $vertical_wind_speed = $wthr_ctl->vertical_wind_speed(85.529);
71             $wind_direction = $wthr_ctl->wind_direction(62.819);
72             $barometric_pressure = $wthr_ctl->barometric_pressure(82.459);
73             $aerosol_concentration = $wthr_ctl->aerosol_concentration(3.569);
74              
75             =head1 DESCRIPTION
76              
77             The Weather Control packet is used to control weather layers and weather
78             entities. Global weather layers have no distinct horizontal boundaries.
79             Atmospheric affects can be observed anywhere within the vertical range of the
80             layer. Regional weather layers occur only in areas defined by the Environmental
81             Region Control packet (CIGI ICD Section 4.1.11). Weather entities are entities
82             that represent meteorological phenomena.
83              
84             The Layer ID attribute specifies the global or regional weather layer whose
85             attributes are being set. If the Scope attribute is set to Global (0), the
86             weather layer exists everywhere over the database. If this attribute is set to
87             Region (1), the weather layer is bound to the region specified by the Region ID
88             attribute. Up to 256 weather layers may be defined globally, and up to 256
89             layers may be defined within each region. The Layer ID attribute is ignored for
90             weather entities.
91              
92             The Cloud Type attribute specifies the type of cloud found within a cloud layer
93             or entity. Each value may correspond to a specific cloud texture or model.
94             Values one through 10 are reserved for the most common general cloud types as
95             listed in Table 18. The remaining values can be used for mammatus clouds,
96             Kelvin-Helmholtz cloud effects, and other specific cloud phenomena.
97              
98             The vertical range of a weather layer is specified by the Base Elevation,
99             Thickness, and Transition Band attributes. Base Elevation specifies the
100             distance from Mean Sea Level to the bottom of the layer. Thickness is the
101             vertical height of the layer. Transition Band specifies the vertical height of
102             both the region above and below the layer through which visibility gradually
103             changes from that of the layer to that immediately outside the region.
104              
105             For weather entities, the Transition Band attribute can be used to specify a
106             threshold radius for partial penetration into a cloud model. The Base Elevation
107             and Thickness attributes are ignored for weather entities.
108              
109             The Scud Enable attribute specifies whether the layer produces scud effects
110             within the transition band. The Scud Frequency attribute defines how often scud
111             occurs. The placement of scud (i.e., above versus below the layer) depends upon
112             the IG implementation. Some systems allow this to be controlled via a Component
113             Control packet.
114              
115             The Horizontal Wind Speed, Vertical Wind Speed, and Wind Direction attributes
116             define the wind velocity within the weather layer or entity. These can be used
117             to specify surface winds or winds aloft, depending upon the base elevation and
118             thickness of the layer or the altitude of the weather entity. The Random Winds
119             Enable attribute causes the IG to create gusts of random duration and
120             frequency.
121             A typical effect of weather layers is the suspension of liquid or solid
122             particles in the air. The density of this particulate matter is specified by
123             the Aerosol Concentration attribute. The most common aerosol is liquid water,
124             but ice crystals, sand, and dust are also common. Weather layers may also be
125             used to create smoke, combat haze, and other man-made airborne contaminants.
126             Each layer can contain zero or one type of mutable aerosol; multiple aerosols
127             in a given space must be implemented as separate weather layers.
128              
129             Where weather layers overlap, atmospheric effects should be combined as as
130             described in the CIGI ICD.
131              
132             =head2 EXPORT
133              
134             None by default.
135              
136             #==============================================================================
137              
138             =item new $wthr_ctl = Rinchi::CIGIPP::WeatherControl->new()
139              
140             Constructor for Rinchi::WeatherControl.
141              
142             =cut
143              
144             sub new {
145 1     1 1 280 my $class = shift;
146 1   33     9 $class = ref($class) || $class;
147              
148 1         26 my $self = {
149             '_Buffer' => '',
150             '_ClassIdent' => 'f78ad2ec-200e-11de-bdac-001c25551abc',
151             '_Pack' => 'CCSCCCCffffffffffff',
152             '_Swap1' => 'CCvCCCCVVVVVVVVVVVV',
153             '_Swap2' => 'CCnCCCCNNNNNNNNNNNN',
154             'packetType' => 12,
155             'packetSize' => 56,
156             'regionEntityIdent' => 0,
157             'layerIdent' => 0,
158             'humidity' => 0,
159             '_bitfields1' => 0, # Includes bitfields cloudType, randomLightningEnable, randomWindsEnable, scudEnable, and weatherEnable.
160             'cloudType' => 0,
161             'randomLightningEnable' => 0,
162             'randomWindsEnable' => 0,
163             'scudEnable' => 0,
164             'weatherEnable' => 0,
165             '_bitfields2' => 0, # Includes bitfields unused21, severity, and weatherScope.
166             'severity' => 0,
167             'weatherScope' => 0,
168             'airTemperature' => 0,
169             'visibilityRange' => 0,
170             'scudFrequency' => 0,
171             'coverage' => 0,
172             'baseElevation' => 0,
173             'thickness' => 0,
174             'transitionBand' => 0,
175             'horizontalWindSpeed' => 0,
176             'verticalWindSpeed' => 0,
177             'windDirection' => 0,
178             'barometricPressure' => 0,
179             'aerosolConcentration' => 0,
180             };
181              
182 1 50       6 if (@_) {
183 0 0       0 if (ref($_[0]) eq 'ARRAY') {
    0          
184 0         0 $self->{'_Buffer'} = $_[0][0];
185             } elsif (ref($_[0]) eq 'HASH') {
186 0         0 foreach my $attr (keys %{$_[0]}) {
  0         0  
187 0 0       0 $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
188             }
189             }
190             }
191              
192 1         3 bless($self,$class);
193 1         3 return $self;
194             }
195              
196             #==============================================================================
197              
198             =item sub packet_type()
199              
200             $value = $wthr_ctl->packet_type();
201              
202             Data Packet Identifier.
203              
204             This attribute identifies this data packet as the Weather Control packet. The
205             value of this attribute must be 12.
206              
207             =cut
208              
209             sub packet_type() {
210 1     1 1 8 my ($self) = @_;
211 1         9 return $self->{'packetType'};
212             }
213              
214             #==============================================================================
215              
216             =item sub packet_size()
217              
218             $value = $wthr_ctl->packet_size();
219              
220             Data Packet Size.
221              
222             This attribute indicates the number of bytes in this data packet. The value of
223             this attribute must be 56.
224              
225             =cut
226              
227             sub packet_size() {
228 1     1 1 9 my ($self) = @_;
229 1         4 return $self->{'packetSize'};
230             }
231              
232             #==============================================================================
233              
234             =item sub entity_ident([$newValue])
235              
236             $value = $wthr_ctl->entity_ident($newValue);
237              
238             Entity ID. (Weather Entities)
239              
240             This attribute specifies the entity to which the weather attributes in this
241             packet are applied.
242              
243             Note: Entity ID/Region ID is ignored if Scope is set to Global (0).
244              
245             =cut
246              
247             sub entity_ident() {
248 1     1 1 413 my ($self,$nv) = @_;
249 1 50       6 if (defined($nv)) {
250 1         5 $self->{'entityIdent'} = $nv;
251             }
252 1         4 return $self->{'entityIdent'};
253             }
254              
255             #==============================================================================
256              
257             =item sub region_ident([$newValue])
258              
259             $value = $wthr_ctl->region_ident($newValue);
260              
261             Region ID.
262              
263             This attribute specifies the region to which the weather layer is confined.
264              
265             Note: Entity ID/Region ID is ignored if Scope is set to Global (0).
266              
267             =cut
268              
269             sub region_ident() {
270 1     1 1 6 my ($self,$nv) = @_;
271 1 50       4 if (defined($nv)) {
272 1         3 $self->{'regionIdent'} = $nv;
273             }
274 1         3 return $self->{'regionIdent'};
275             }
276              
277             #==============================================================================
278              
279             =item sub layer_ident([$newValue])
280              
281             $value = $wthr_ctl->layer_ident($newValue);
282              
283             Layer ID.
284              
285             This attribute specifies the weather layer to which the data in this packet are
286             applied. This attribute also determines the type of aerosol contained within
287             the layer.
288              
289             Values 0 through 9 are defined as standard weather layer types. Values beyond
290             this range are defined in the IG configuration.
291              
292             Note: This attribute is ignored if Scope is set to Entity (2).
293              
294             =cut
295              
296             sub layer_ident() {
297 1     1 1 6 my ($self,$nv) = @_;
298 1 50       4 if (defined($nv)) {
299 1         2 $self->{'layerIdent'} = $nv;
300             }
301 1         4 return $self->{'layerIdent'};
302             }
303              
304             #==============================================================================
305              
306             =item sub humidity([$newValue])
307              
308             $value = $wthr_ctl->humidity($newValue);
309              
310             Humidity.
311              
312             This attribute specifies the humidity, measured in percent, within the weather layer/entity.
313              
314             =cut
315              
316             sub humidity() {
317 1     1 1 98 my ($self,$nv) = @_;
318 1 50       5 if (defined($nv)) {
319 1 50 33     12 if ($nv>=0 and $nv<=100 and int($nv)==$nv) {
      33        
320 1         3 $self->{'humidity'} = $nv;
321             } else {
322 0         0 carp "humidity must be an integer 0-100 (percent).";
323             }
324             }
325 1         3 return $self->{'humidity'};
326             }
327              
328             #==============================================================================
329              
330             =item sub cloud_type([$newValue])
331              
332             $value = $wthr_ctl->cloud_type($newValue);
333              
334             Cloud Type.
335              
336             This attribute specifies the type of clouds contained within the weather layer.
337             If the value of Layer ID does not correspond to a cloud layer, Cloud Type
338             should be set to None (0).
339              
340             None 0
341             Altocumulus 1
342             Altostratus 2
343             Cirrocumulus 3
344             Cirrostratus 4
345             Cirrus 5
346             Cumulonimbus 6
347             Cumulus 7
348             Nimbostratus 8
349             Stratocumulus 9
350             Stratus 10
351             Other1 11
352             Other2 12
353             Other3 13
354             Other4 14
355             Other5 15
356              
357             =cut
358              
359             sub cloud_type() {
360 1     1 1 2 my ($self,$nv) = @_;
361 1 50       6 if (defined($nv)) {
362 1 50 33     10 if ($nv>=0 and $nv<=15 and int($nv) == $nv) {
      33        
363 1         2 $self->{'cloudType'} = $nv;
364 1         3 $self->{'_bitfields1'} |= ($nv << 4) &0xF0;
365             } else {
366 0         0 carp "cloud_type must be 0 (None), 1 (Altocumulus), 2 (Altostratus), 3 (Cirrocumulus), 4 (Cirrostratus), 5 (Cirrus), 6 (Cumulonimbus), 7 (Cumulus), 8 (Nimbostratus), 9 (Stratocumulus), 10 (Stratus), 11 (Other1), 12 (Other2), 13 (Other3), 14 (Other4), or 15 (Other5).";
367             }
368             }
369 1         3 return (($self->{'_bitfields1'} & 0xF0) >> 4);
370             }
371              
372             #==============================================================================
373              
374             =item sub random_lightning_enable([$newValue])
375              
376             $value = $wthr_ctl->random_lightning_enable($newValue);
377              
378             Random Lightning Enable.
379              
380             This attribute specifies whether the weather layer or entity exhibits random
381             lightning effects. The frequency and severity of the lightning varies according
382             to the Severity attribute.
383              
384             Disable 0
385             Enable 1
386              
387             =cut
388              
389             sub random_lightning_enable() {
390 1     1 1 2 my ($self,$nv) = @_;
391 1 50       4 if (defined($nv)) {
392 1 50 33     5 if (($nv==0) or ($nv==1)) {
393 1         2 $self->{'randomLightningEnable'} = $nv;
394 1         3 $self->{'_bitfields1'} |= ($nv << 3) &0x08;
395             } else {
396 0         0 carp "random_lightning_enable must be 0 (Disable), or 1 (Enable).";
397             }
398             }
399 1         3 return (($self->{'_bitfields1'} & 0x08) >> 3);
400             }
401              
402             #==============================================================================
403              
404             =item sub random_winds_enable([$newValue])
405              
406             $value = $wthr_ctl->random_winds_enable($newValue);
407              
408             Random Winds Enable.
409              
410             This attribute specifies whether a random frequency and duration should be
411             applied to the local wind effects.
412              
413             Disable 0
414             Enable 1
415              
416             =cut
417              
418             sub random_winds_enable() {
419 1     1 1 4 my ($self,$nv) = @_;
420 1 50       4 if (defined($nv)) {
421 1 50 33     9 if (($nv==0) or ($nv==1)) {
422 1         3 $self->{'randomWindsEnable'} = $nv;
423 1         3 $self->{'_bitfields1'} |= ($nv << 2) &0x04;
424             } else {
425 0         0 carp "random_winds_enable must be 0 (Disable), or 1 (Enable).";
426             }
427             }
428 1         3 return (($self->{'_bitfields1'} & 0x04) >> 2);
429             }
430              
431             #==============================================================================
432              
433             =item sub scud_enable([$newValue])
434              
435             $value = $wthr_ctl->scud_enable($newValue);
436              
437             Scud Enable
438              
439             This attribute specifies whether weather layer produces scud effects within its
440             transition bands.
441              
442             Disable 0
443             Enable 1
444              
445             =cut
446              
447             sub scud_enable() {
448 1     1 1 3 my ($self,$nv) = @_;
449 1 50       4 if (defined($nv)) {
450 1 50 33     8 if (($nv==0) or ($nv==1)) {
451 1         2 $self->{'scudEnable'} = $nv;
452 1         3 $self->{'_bitfields1'} |= ($nv << 1) &0x02;
453             } else {
454 0         0 carp "scud_enable must be 0 (Disable), or 1 (Enable).";
455             }
456             }
457 1         4 return (($self->{'_bitfields1'} & 0x02) >> 1);
458             }
459              
460             #==============================================================================
461              
462             =item sub weather_enable([$newValue])
463              
464             $value = $wthr_ctl->weather_enable($newValue);
465              
466             Weather Enable.
467              
468             This attribute specifies whether a weather layer/entity and its atmospheric
469             effects are enabled.
470              
471             Disable 0
472             Enable 1
473              
474             =cut
475              
476             sub weather_enable() {
477 1     1 1 2 my ($self,$nv) = @_;
478 1 50       4 if (defined($nv)) {
479 1 50 33     8 if (($nv==0) or ($nv==1)) {
480 1         2 $self->{'weatherEnable'} = $nv;
481 1         2 $self->{'_bitfields1'} |= $nv &0x01;
482             } else {
483 0         0 carp "weather_enable must be 0 (Disable), or 1 (Enable).";
484             }
485             }
486 1         4 return ($self->{'_bitfields1'} & 0x01);
487             }
488              
489             #==============================================================================
490              
491             =item sub severity([$newValue])
492              
493             $value = $wthr_ctl->severity($newValue);
494              
495             Severity.
496              
497             This attribute specifies the severity of the weather layer/entity.
498              
499             =cut
500              
501             sub severity() {
502 1     1 1 6 my ($self,$nv) = @_;
503 1 50       4 if (defined($nv)) {
504 1 50 33     11 if ($nv>=0 and $nv<=5 and int($nv)==$nv) {
      33        
505 1         3 $self->{'severity'} = $nv;
506 1         2 $self->{'_bitfields2'} |= ($nv << 3) &0x18;
507             } else {
508 0         0 carp "severity must be an integer 0-5.";
509             }
510             }
511 1         3 return (($self->{'_bitfields2'} & 0x18) >> 3);
512             }
513              
514             #==============================================================================
515              
516             =item sub weather_scope([$newValue])
517              
518             $value = $wthr_ctl->weather_scope($newValue);
519              
520             Weather Scope.
521              
522             This attribute specifies whether the weather is global, regional, or assigned
523             to an entity. If this value is set to Regional (1), the layer is confined to
524             the region specified by Region ID. If this value is set to Entity (2), the
525             weather attributes are applied to the volume within the moving model specified
526             by Entity ID.
527              
528             GlobalScope 0
529             RegionalScope 1
530             EntityScope 2
531              
532             =cut
533              
534             sub weather_scope() {
535 1     1 1 2 my ($self,$nv) = @_;
536 1 50       4 if (defined($nv)) {
537 1 50 33     10 if (($nv==0) or ($nv==1) or ($nv==2)) {
      33        
538 1         2 $self->{'weatherScope'} = $nv;
539 1         2 $self->{'_bitfields2'} |= $nv &0x07;
540             } else {
541 0         0 carp "weather_scope must be 0 (GlobalScope), 1 (RegionalScope), or 2 (EntityScope).";
542             }
543             }
544 1         4 return ($self->{'_bitfields2'} & 0x07);
545             }
546              
547             #==============================================================================
548              
549             =item sub air_temperature([$newValue])
550              
551             $value = $wthr_ctl->air_temperature($newValue);
552              
553             Air Temperature.
554              
555             This attribute specifies the temperature, measered in degrees Celsius (°C),
556             within the weather layer/entity.
557              
558             =cut
559              
560             sub air_temperature() {
561 1     1 1 6 my ($self,$nv) = @_;
562 1 50       4 if (defined($nv)) {
563 1         2 $self->{'airTemperature'} = $nv;
564             }
565 1         3 return $self->{'airTemperature'};
566             }
567              
568             #==============================================================================
569              
570             =item sub visibility_range([$newValue])
571              
572             $value = $wthr_ctl->visibility_range($newValue);
573              
574             Visibility Range.
575              
576             This attribute specifies the visibility range, measured in meters, through the
577             weather layer/entity. This might correspond to Runway Visibility Range through
578             ground fog, for example.
579              
580             =cut
581              
582             sub visibility_range() {
583 1     1 1 5 my ($self,$nv) = @_;
584 1 50       4 if (defined($nv)) {
585 1         3 $self->{'visibilityRange'} = $nv;
586             }
587 1         3 return $self->{'visibilityRange'};
588             }
589              
590             #==============================================================================
591              
592             =item sub scud_frequency([$newValue])
593              
594             $value = $wthr_ctl->scud_frequency($newValue);
595              
596             Scud Frequency.
597              
598             This attribute specifies the frequency of scud within the transition bands
599             above and/or below a cloud or fog layer. A value of 0% produces no scud effect;
600             100% produces a solid effect.
601              
602             =cut
603              
604             sub scud_frequency() {
605 1     1 1 4 my ($self,$nv) = @_;
606 1 50       5 if (defined($nv)) {
607 1         3 $self->{'scudFrequency'} = $nv;
608             }
609 1         3 return $self->{'scudFrequency'};
610             }
611              
612             #==============================================================================
613              
614             =item sub coverage([$newValue])
615              
616             $value = $wthr_ctl->coverage($newValue);
617              
618             Coverage.
619              
620             This attribute specifies the amount of area coverage for the weather layer.
621              
622             =cut
623              
624             sub coverage() {
625 1     1 1 6 my ($self,$nv) = @_;
626 1 50       4 if (defined($nv)) {
627 1         2 $self->{'coverage'} = $nv;
628             }
629 1         3 return $self->{'coverage'};
630             }
631              
632             #==============================================================================
633              
634             =item sub base_elevation([$newValue])
635              
636             $value = $wthr_ctl->base_elevation($newValue);
637              
638             Base Elevation.
639              
640             This attribute specifies the altitude of the base (bottom) of the weather
641             layer. This attribute is ignored if Scope is set to Entity (2).
642              
643             =cut
644              
645             sub base_elevation() {
646 1     1 1 5 my ($self,$nv) = @_;
647 1 50       3 if (defined($nv)) {
648 1         3 $self->{'baseElevation'} = $nv;
649             }
650 1         4 return $self->{'baseElevation'};
651             }
652              
653             #==============================================================================
654              
655             =item sub thickness([$newValue])
656              
657             $value = $wthr_ctl->thickness($newValue);
658              
659             Thickness.
660              
661             This attribute specifies the vertical thickness of the weather layer. The
662             altitude of the top of the layer is equal to this value plus that specified by
663             Base Elevation. This attribute is ignored if Scope is set to Entity (2).
664              
665             =cut
666              
667             sub thickness() {
668 1     1 1 4 my ($self,$nv) = @_;
669 1 50       4 if (defined($nv)) {
670 1         3 $self->{'thickness'} = $nv;
671             }
672 1         3 return $self->{'thickness'};
673             }
674              
675             #==============================================================================
676              
677             =item sub transition_band([$newValue])
678              
679             $value = $wthr_ctl->transition_band($newValue);
680              
681             Transition Band.
682              
683             This attribute specifies the height of a vertical transition band both above
684             and below the weather layer. This band produces a visibility gradient from the
685             layer's visibility to that immediately outside the transition band. This
686             attribute is ignored if Scope is set to Entity (2).
687              
688             =cut
689              
690             sub transition_band() {
691 1     1 1 4 my ($self,$nv) = @_;
692 1 50       4 if (defined($nv)) {
693 1         3 $self->{'transitionBand'} = $nv;
694             }
695 1         2 return $self->{'transitionBand'};
696             }
697              
698             #==============================================================================
699              
700             =item sub horizontal_wind_speed([$newValue])
701              
702             $value = $wthr_ctl->horizontal_wind_speed($newValue);
703              
704             Horizontal Wind Speed.
705              
706             This attribute specifies the local wind speed parallel to the
707             ellipsoid-tangential reference plane.
708              
709             =cut
710              
711             sub horizontal_wind_speed() {
712 1     1 1 6 my ($self,$nv) = @_;
713 1 50       3 if (defined($nv)) {
714 1         3 $self->{'horizontalWindSpeed'} = $nv;
715             }
716 1         3 return $self->{'horizontalWindSpeed'};
717             }
718              
719             #==============================================================================
720              
721             =item sub vertical_wind_speed([$newValue])
722              
723             $value = $wthr_ctl->vertical_wind_speed($newValue);
724              
725             Vertical Wind Speed.
726              
727             This attribute specifies the local vertical wind speed.
728              
729             Note: A positive value produces an updraft, while a negative value produces a downdraft.
730              
731             =cut
732              
733             sub vertical_wind_speed() {
734 1     1 1 7 my ($self,$nv) = @_;
735 1 50       4 if (defined($nv)) {
736 1         2 $self->{'verticalWindSpeed'} = $nv;
737             }
738 1         3 return $self->{'verticalWindSpeed'};
739             }
740              
741             #==============================================================================
742              
743             =item sub wind_direction([$newValue])
744              
745             $value = $wthr_ctl->wind_direction($newValue);
746              
747             Wind Direction.
748              
749             This attribute specifies the local wind direction.
750              
751             Note: This is the direction from which the wind is blowing.
752              
753             =cut
754              
755             sub wind_direction() {
756 1     1 1 6 my ($self,$nv) = @_;
757 1 50       5 if (defined($nv)) {
758 1         2 $self->{'windDirection'} = $nv;
759             }
760 1         3 return $self->{'windDirection'};
761             }
762              
763             #==============================================================================
764              
765             =item sub barometric_pressure([$newValue])
766              
767             $value = $wthr_ctl->barometric_pressure($newValue);
768              
769             Barometric Pressure.
770              
771             This attribute specifies the atmospheric pressure, measured in millibars (mb)
772             or hectopascals (hPa), within the weather layer or entity. The units are interchangeable.
773              
774             =cut
775              
776             sub barometric_pressure() {
777 1     1 1 6 my ($self,$nv) = @_;
778 1 50       4 if (defined($nv)) {
779 1         2 $self->{'barometricPressure'} = $nv;
780             }
781 1         3 return $self->{'barometricPressure'};
782             }
783              
784             #==============================================================================
785              
786             =item sub aerosol_concentration([$newValue])
787              
788             $value = $wthr_ctl->aerosol_concentration($newValue);
789              
790             Aerosol Concentration.
791              
792             This attribute specifies the concentration of water, smoke, dust, or other
793             particles suspended in the air.
794              
795             This attribute is provided primarily for sensor applications; any visual effect
796             is secondary and is IG- and layer-dependent.
797              
798             Note: The type of aerosol depends upon the layer ID of a weather layer, or the
799             entity type of a weather phenomenon entity.
800              
801             =cut
802              
803             sub aerosol_concentration() {
804 1     1 1 5 my ($self,$nv) = @_;
805 1 50       3 if (defined($nv)) {
806 1         2 $self->{'aerosolConcentration'} = $nv;
807             }
808 1         4 return $self->{'aerosolConcentration'};
809             }
810              
811             #==========================================================================
812              
813             =item sub pack()
814              
815             $value = $wthr_ctl->pack();
816              
817             Returns the packed data packet.
818              
819             =cut
820              
821             sub pack($) {
822 1     1 1 5 my $self = shift ;
823            
824 1         12 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
825             $self->{'packetType'},
826             $self->{'packetSize'},
827             $self->{'regionEntityIdent'},
828             $self->{'layerIdent'},
829             $self->{'humidity'},
830             $self->{'_bitfields1'}, # Includes bitfields cloudType, randomLightningEnable, randomWindsEnable, scudEnable, and weatherEnable.
831             $self->{'_bitfields2'}, # Includes bitfields unused21, severity, and WthrScope.
832             $self->{'airTemperature'},
833             $self->{'visibilityRange'},
834             $self->{'scudFrequency'},
835             $self->{'coverage'},
836             $self->{'baseElevation'},
837             $self->{'thickness'},
838             $self->{'transitionBand'},
839             $self->{'horizontalWindSpeed'},
840             $self->{'verticalWindSpeed'},
841             $self->{'windDirection'},
842             $self->{'barometricPressure'},
843             $self->{'aerosolConcentration'},
844             );
845              
846 1         4 return $self->{'_Buffer'};
847             }
848              
849             #==========================================================================
850              
851             =item sub unpack()
852              
853             $value = $wthr_ctl->unpack();
854              
855             Unpacks the packed data packet.
856              
857             =cut
858              
859             sub unpack($) {
860 0     0 1   my $self = shift @_;
861            
862 0 0         if (@_) {
863 0           $self->{'_Buffer'} = shift @_;
864             }
865 0           my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m,$n,$o,$p,$q,$r,$s) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
866 0           $self->{'packetType'} = $a;
867 0           $self->{'packetSize'} = $b;
868 0           $self->{'regionEntityIdent'} = $c;
869 0           $self->{'layerIdent'} = $d;
870 0           $self->{'humidity'} = $e;
871 0           $self->{'_bitfields1'} = $f; # Includes bitfields cloudType, randomLightningEnable, randomWindsEnable, scudEnable, and weatherEnable.
872 0           $self->{'_bitfields2'} = $g; # Includes bitfields unused21, severity, and WthrScope.
873 0           $self->{'airTemperature'} = $h;
874 0           $self->{'visibilityRange'} = $i;
875 0           $self->{'scudFrequency'} = $j;
876 0           $self->{'coverage'} = $k;
877 0           $self->{'baseElevation'} = $l;
878 0           $self->{'thickness'} = $m;
879 0           $self->{'transitionBand'} = $n;
880 0           $self->{'horizontalWindSpeed'} = $o;
881 0           $self->{'verticalWindSpeed'} = $p;
882 0           $self->{'windDirection'} = $q;
883 0           $self->{'barometricPressure'} = $r;
884 0           $self->{'aerosolConcentration'} = $s;
885              
886 0           $self->{'cloudType'} = $self->cloud_type();
887 0           $self->{'randomLightningEnable'} = $self->random_lightning_enable();
888 0           $self->{'randomWindsEnable'} = $self->random_winds_enable();
889 0           $self->{'scudEnable'} = $self->scud_enable();
890 0           $self->{'weatherEnable'} = $self->weather_enable();
891 0           $self->{'severity'} = $self->severity();
892 0           $self->{'weatherScope'} = $self->weather_scope();
893              
894 0           return $self->{'_Buffer'};
895             }
896              
897             #==========================================================================
898              
899             =item sub byte_swap()
900              
901             $obj_name->byte_swap();
902              
903             Byte swaps the packed data packet.
904              
905             =cut
906              
907             sub byte_swap($) {
908 0     0 1   my $self = shift @_;
909            
910 0 0         if (@_) {
911 0           $self->{'_Buffer'} = shift @_;
912             } else {
913 0           $self->pack();
914             }
915 0           my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m,$n,$o,$p,$q,$r,$s) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
916              
917 0           $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m,$n,$o,$p,$q,$r,$s);
918 0           $self->unpack();
919              
920 0           return $self->{'_Buffer'};
921             }
922              
923             1;
924             __END__