Data Processing (25 points) Reading time saver : This is identical to Lab4 – Par
ID: 3822255 • Letter: D
Question
Data Processing (25 points)
Reading time saver: This is identical to Lab4 – Part III, except that you are writing Perl script instead of shell script.
Your Perl program must adhere to the following requirements:
Must use the pragmas below:
use strict
use constant
Must include subroutines
Must only use the features or functions covered in the Unit. Note that features have wide range of options. Online documentation, reference materials, and other search engine can be used to explore those many options for efficient code.
Consider the files files l2b1.iva, l2b2.iva, and l2b3.iva from your lab2B. These are raw performance data collected on a solar photovoltaic module installed at ASU Polytechnic campus. These data must be processed to determine the performance output of the system or panel. The 3 files correspond to 3 repeated measurements.
Upon processing, the test data are presented as shown in the table below:
Performance Data
Date
12/30/2006
Tamb (°C)
15.8
Tref (°C)
30.1
Tm (°C)
20.2
Irradiance (W/m^2)
1006.2
Isc (A)
8.40
Voc (V)
37.14
Imp (A)
7.55
Vmp (V)
28.19
Pm (W)
212.86
FF (%)
68.3
The data in the table above are average values from 3 repeated measurements on panel id gge001. The 3 measurements gge001x, gge001y, and gge001z are shown in the table/file below.
For this lab, we’ll use the file below, obtained from previous labs.
F gge0001x gge0001y gge0001z
D 12-30-2006 12-30-2006 12-30-2006
T 14:15:20 14:15:55 14:16:27
S a69 a69 a69
B 15.8 16.1 15
M gge06001 gge06001 gge06001
P 30.1 29.6 29.9
Q 20.2 22.3 23.4
R 1006.2 1003.5 999.8
U 1011.8 1011.8 1005
X 34.7 35.2 35.1
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.395 8.406 8.368
O 37.141 36.823 36.621
C 7.55 7.532 7.437
K 28.193 27.902 27.856
W 212.86 210.15 207.15
L 68.3 67.9 67.6
You are to write a Perl program that produces the “Performance Data” table as shown above.
Note the corresponding rows:
Date D
Tamb B
Tref P
Tm Q
Irradiance R
Isc H
Voc O
Imp C
Vmp K
Pm W
FF L
You will submit 1 file: Your script file, called lab6.pl
Performance Data
Date
12/30/2006
Tamb (°C)
15.8
Tref (°C)
30.1
Tm (°C)
20.2
Irradiance (W/m^2)
1006.2
Isc (A)
8.40
Voc (V)
37.14
Imp (A)
7.55
Vmp (V)
28.19
Pm (W)
212.86
FF (%)
68.3
Explanation / Answer
#!/usr/bin/perl
use strict;
use warnings;
# XXXXX program dispalys a menu of options for the user to
#choose from. Once the choice is made it is confirmed first
#before actually performing the option.
my $string1 = "Please enter the option number you wish to perform? ";
my $string2 = "1) Create a UNIX Group. ";
my $string3 = "2) Drop a UNIX Group. ";
my $string4 = "3) Create a User. ;"
my $string5 = "4) Drop a User. ";
my $string6 = $string2 . $string3 . $string4 . $string5 ;
print "$string6 ";
print "$string1 ";
my $user_input = ;
#
#chomp eliminates any unknown in the string
#
print "You Chose option $user_input ";
chomp $user_input ;
if ( $user_input == 1 )
{
print "Enter the name of the group you wish to create: ";
my $group_name = ;
system ("addgroup $group_name") ;
print "You added $group_name.."
}
if ( $user_input == 2 )
{
print " What is the name of the group you wish to delete? ";
my $user_input2 = ;
system ("rmgroup $user_input2");
print "You deleted $user_input2. ";
}
if ( $user_input == 3 )
{
print "What is the name of the user you wish to ADD? ";
my $user_input3 = ;
system ("useradd $user_input3");
print "You just added user $user_input3. "
}
if ( $user_input == 4 )
{
my $user_input4 = ;
print "What is the user name you wish to delete? "
;
system ("rmuser $user_input4");
print "You just removed user $user_input4. ";
}
if ( $user_input > 4 )
{
print "Invalid input...program terminating ! ! ";
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.