Skip to content

Commit be09dfa

Browse files
authored
Merge pull request #31 from acisops/VOR-VOB
Review load is a full science + vehicle load but only vehicle commands executed.
2 parents 3fded78 + 84e9bb3 commit be09dfa

File tree

4 files changed

+183
-41
lines changed

4 files changed

+183
-41
lines changed

CHECK_POWER_COMMANDS/Backstop_File_Class.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,13 @@ def insert_errors(self, lr_file, violations_list):
262262
# ACIS-LoadReview.txt.ERRORS files intact for comparison.
263263
if not self.test_flag:
264264
try:
265-
print('Moving ACIS-LoadReview.txt.ERRORS to ACIS-LoadReview.txt')
265+
print(' Moving ACIS-LoadReview.txt.ERRORS to ACIS-LoadReview.txt')
266266
shutil.move('ACIS-LoadReview.txt.ERRORS', 'ACIS-LoadReview.txt')
267267
except OSError as err:
268268
print(err)
269269
print('Examine the ofls directory and look for the .ERRORS file.')
270270
else:
271-
print('Copy was successful')
271+
print(' Copy of errors into ACIS-LoadReview.txt was successful')
272272
else:
273273
print('\nTEST MODE - Leaving the ACIS-LoadReview.txt and ACIS-LoadReview.txt.ERRORS files intact for comparison')
274274

CHECK_POWER_COMMANDS/Check_Power_Cmds.py

Lines changed: 47 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
# - Part of the Feb 22 update to fix the 63 second erroneous violations
2525
# - Removed deprecated Chandra.Time
2626
# - Eliminated commented-out line
27+
#
28+
# Update: February 15, 2022
29+
# Gregg Germain
30+
# - Allow for the case of a Vehicle-Only Review load where there are no ACISPKT commands
31+
#
2732
################################################################################
2833
import argparse
2934

@@ -168,10 +173,9 @@ def run_one_command(cmd, system_state, bfc, rule_set):
168173
# Set the test flag based upon user input
169174
if testargs.test:
170175
# For Test Purposes:
171-
print('\nCheck_Power_Cmds - RUNNING IN TEST MODE\n')
176+
print('\n Check_Power_Cmds - RUNNING IN TEST MODE')
172177
test_flag = True
173178
else:
174-
print("\nRunning for score.\n")
175179
test_flag = False
176180

177181
# Now create an instance of the the System State Class.
@@ -201,32 +205,40 @@ def run_one_command(cmd, system_state, bfc, rule_set):
201205
# Grab the first item in the array
202206
present_cmd = system_packets[array_row_number]
203207

204-
# Now process each entry until you hit your
205-
# first ACISPKT. Then you process that first one. This will set up
206-
# the system state for processing the next ACISPKT that you encounter
207-
while present_cmd['cmd_type'] != 'ACISPKT':
208208

209-
# Run the ORB rules on the present state
210-
system_state, new_rules_fired, violations_list = run_one_command(present_cmd,
211-
system_state,
212-
bfc,
213-
Rulesets.ORB_CMD_SW_rule_set)
209+
# If this is a Vehicle-Only Review load then there will be no ACISPKT commands within the load.
210+
# So skip the while loop which is intended ot take you to the first one.
211+
# This means that array_row_number will equal 0
212+
213+
if 'ACISPKT' in system_packets['cmd_type']:
214+
215+
#
216+
# Now process each entry until you hit your first ACISPKT.
217+
# Then you process that first one. This will set up
218+
# the system state for processing the next ACISPKT that you encounter
219+
while present_cmd['cmd_type'] != 'ACISPKT':
220+
221+
# Run the ORB rules on the present state
222+
system_state, new_rules_fired, violations_list = run_one_command(present_cmd,
223+
system_state,
224+
bfc,
225+
Rulesets.ORB_CMD_SW_rule_set)
214226

215-
# Append all the rules that may have fired to the master rule list
216-
if new_rules_fired:
217-
all_rules_fired.append(list(new_rules_fired))
227+
# Append all the rules that may have fired to the master rule list
228+
if new_rules_fired:
229+
all_rules_fired.append(list(new_rules_fired))
218230

219-
# Append any violations you found to the master violations list
220-
if violations_list:
221-
all_violations.append(violations_list[0])
231+
# Append any violations you found to the master violations list
232+
if violations_list:
233+
all_violations.append(violations_list[0])
222234

223-
# You want to increment the system_packets index so that you can look
224-
# at the next command.
225-
# You will be looking at the next row
226-
array_row_number += 1
235+
# You want to increment the system_packets index so that you can look
236+
# at the next command.
237+
# You will be looking at the next row
238+
array_row_number += 1
227239

228-
# Now look at the next command in the backstop file.
229-
present_cmd = system_packets[array_row_number]
240+
# Now look at the next command in the backstop file.
241+
present_cmd = system_packets[array_row_number]
230242

231243

232244
# Ok so this next command you are looking at is an ACISPKT command.
@@ -286,7 +298,16 @@ def run_one_command(cmd, system_state, bfc, rule_set):
286298

287299
# Append any violations you found to the master violations list
288300
if violations_list:
289-
all_violations += violations_list[0]
301+
all_violations+= violations_list[0]
302+
303+
304+
if len(all_violations) == 0:
305+
print('\n NO POWER COMMAND ERRORS FOUND\n')
306+
else:
307+
# Write out the errors
308+
print('\n ERROR - POWER COMMAND ERRORS FOUND!')
309+
bfc.insert_errors('ACIS-LoadReview.txt', all_violations)
310+
311+
312+
290313

291-
# Write out the error
292-
bfc.insert_errors('ACIS-LoadReview.txt', all_violations)

Release_Notes_V4.1.txt

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
Change Description
2+
==================
3+
4+
The main driver for this update is handling the circumstance where the Review load is a full science + vehicle
5+
commands load, but we know - prior to the review - that only the vehicle load command set, in the
6+
review load, will be executed. The new LR switch: VOR for Vehicle Only Review was implemented. The Focal plane
7+
thermal model had difficulties with the -109 database searches when the Vehicle-Only portion of a full load was
8+
processed by lr (see FSDS-18).
9+
10+
The program which checks for power command timing errors had to be modified to handle loads without any ACISPKT commands.
11+
Also the Check_Power_Cmds output messages were cleaned up and made more informative.
12+
13+
14+
15+
Files Changed or added:
16+
===================
17+
18+
lr, Release_Notes_V4.1.txt
19+
20+
The changes can be seen here:
21+
22+
https://github.com/acisops/lr/pull/31
23+
24+
Must be installed with or after an acis_thermal_check update:
25+
26+
FSDS-18 - https://github.com/acisops/acis_thermal_check/pull/48
27+
28+
29+
30+
Testing:
31+
========
32+
33+
The changes were tested by running these regression test loads:
34+
35+
DEC2418A
36+
DEC2418B
37+
MAY2620
38+
AUG3120
39+
SEP2021
40+
OCT2821
41+
OCT3021
42+
JAN1022
43+
FEB1422
44+
45+
These test types included Normal, TOO, SCS-107 and Full Stop loads; loads with and without power commanding errors,
46+
loads which were vehicle-only as built (e.g. MAY2620 and AUG3120), and loads which were built as full loads but
47+
only the vehicle commands were activated (e.g. OCT2821 and FEB1422), and loads which were not affected by
48+
Vehicle-Only Continuity or Review loads. In cases where there was no production case of a load type being executed as
49+
a full Review load (science+vehicle) where the Vehicle-Only commands were executed, tests were run and checked by hand
50+
(e.g. JAN1022).
51+
52+
The assembled histories for OCT2821 and FEB1422 were checked by hand and these loads were added to the regression test suite.
53+
Tests were also conducted using acis_thermal_checl/pull/48 to assure that the problem was fixed and the results were correct.
54+
Where applicable, thermal model output was checked. All differing results were accounted for: all tests passed.
55+
56+
57+
58+
Interface impacts
59+
=================
60+
61+
ACIS Ops lr user has a new switch to use when appropriate VOR.
62+
63+
64+
Review
65+
======
66+
67+
ACIS Ops
68+
69+
70+
Deployment Plan
71+
===============
72+
73+
74+

lr

Lines changed: 60 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ use Plucknames;
125125
#
126126
#
127127
# Update: September, 21, 2021
128-
# V3.9
128+
# V3.9
129129
# - Move CHECK_POWER_COMMANDS and WINDOW_CHECK to before
130130
# run_models call
131131
#
@@ -142,6 +142,10 @@ use Plucknames;
142142
# - added --nomodels switch to run LR without running the thermal models
143143
# - Added comments and fixed typos
144144
#
145+
# Update: February 10, 2022
146+
# V4.1
147+
# - Activated hooks for VOB and VOR switches
148+
#
145149
###########################################################
146150
# usage: lr [present load] [previous week] #
147151
# example: lr AUG2701A AUG2001 #
@@ -191,9 +195,12 @@ if ($VO_choice ne "")
191195
# But since they did supply one, check to see if the supplied argument
192196
# is in the list. We want to check this and, if the input is invalid, exit.
193197
if( not( grep( /^$VO_choice$/, @VO_types)))
194-
{
195-
die("FATAL ERROR - $VO_choice is an invalid value for the VO switch.\nValid values are: VOC, VOR, VOB\n");
196-
}
198+
{
199+
die("FATAL ERROR - $VO_choice is an invalid value for the VO switch.\nValid values are: VOC, VOR, VOB\n");
200+
}
201+
else
202+
{ print "\n The VO value is: $VO_choice";}
203+
197204
}
198205

199206

@@ -298,7 +305,7 @@ print("\nLength of the input string is: $len_prevload");
298305
# Get the last token in the preview load name
299306
$last_token = substr($prev_load, -1);
300307

301-
print("\nBefore the IF:");
308+
302309
print("\n The Previous load variable contains: $prev_load");
303310

304311

@@ -422,7 +429,7 @@ if( (! $test_dir) &&
422429
#------------------------------------------------------
423430

424431
# CD to the newly-created ofls<x> directory.
425-
# CD to /data/acis/LoadReviews/<YEAR>/LOAD/ofls<a,b,c etc> ------- IN OFLS DIR
432+
# CD to /data/acis/LoadReviews/<YEAR>/LOAD/ofls<a,b,c etc> -------------------------------- IN OFLS DIR
426433
chdir("${ofls_dir}") || die "Cannot change directories to $ofls_dir\n";
427434

428435
if ($skiplucky)
@@ -483,7 +490,8 @@ print "unzipping: $zip ...\n";
483490
# Get tar file
484491
$file = (Plucknames->findNames(".", "backstop.tar"))[0];
485492

486-
#backstop extraction and acis script
493+
# Extract both the CR*.backstop file and the .../vehicle/VR*.backstop file
494+
# backstop extraction and acis script
487495
@tarTOC = Archive::Tar->list_archive($file, 0);
488496
@bck = Plucknames->tarNames(\@tarTOC, "backstop");
489497

@@ -652,19 +660,56 @@ open(CONTFILE, ">$ofls_dir/ACIS-Continuity.txt");
652660
# directory path to the ACIS-Continuity.txt file
653661
print CONTFILE $prev_load_dir.$ofls_val, "\n";
654662

655-
# Now, if the user specified "VOC" for the VO command line argument,
656-
# Then append "VO_" to the load type. This will inform the models
663+
# Now, if the user specified either "VOC" or "VOB"for the VO command line argument,
664+
# then append "VO_" to the load type. This will inform the models
657665
# that when the continuity load is read, the Vehicle Only version
658666
# should be used. Otherwise load_type should be just the present
659667
# value
660-
if ($VO_choice eq "VOC")
668+
#
669+
# VOB stands for (V)ehicle (O)nly (B)oth, meaning that the VR*.backstop vehicle only file
670+
# should be read for both the Review and the Continuity load. But this piece of code
671+
# handles what gets written to the ACIS-Continuity.txt file. So in both cases (VOC and VOB)
672+
# You want ACIS-Continuity.txt to indicate vehicle-only for the Continuity load.
673+
# Reading the VR*.backstop file for the review load is handled by the call to run-models.pl.
674+
if ( ($VO_choice eq "VOC") || ($VO_choice eq "VOB") )
661675
{
662676
# User selected VOC for the VO switch. Tell the model to read
663677
# the vehicle only load for the Continuity. Append "VO_"
664678
# to the recognized load type
665679
$load_type = "VO_".$load_type;
666680
}
667681

682+
# Now if $VO_choice is either VOB or VOR, then the REVIEW Load is to be run Vehicle Only.
683+
# In this case copy the CR*.backstop file to ORIG_CR*.backstop, and the .../vehicle/VR*.backstop
684+
# is to be copied to CR*_V.backstop.
685+
#
686+
if ( ($VO_choice eq "VOR") || ($VO_choice eq "VOB") )
687+
{
688+
689+
# Save the full backstop file as ORIG_CR*.backstop
690+
print "\nReceived the $VO_choice switch. Copying $backfile to ORIG_${backfile}";
691+
system("mv $backfile ORIG_${backfile}");
692+
693+
# Formulate the modified name for the CR backstop file to include "_V" in the name
694+
# Index of the beginning of the extension: ".backstop"
695+
$ext_index = index($backfile, ".backstop");
696+
697+
# Extract the file name without the extension
698+
$old_CR_file_name = substr($backfile, 0, $ext_index);
699+
700+
# Compose a new name by concatenating the "_V" to the name and include the extension
701+
$new_CR_file_name = "${old_CR_file_name}_V.backstop";
702+
703+
# Perform the copy of the Vehicle-Only file to tne CR file with the new name.
704+
print "\n ...and now copying $vfile to $new_CR_file_name";
705+
system( "cp $vfile $new_CR_file_name");
706+
707+
708+
# Lastly, change the variable $backfile so that it points to the new CR*_V.backstop file
709+
# Other applications need to access this file and they need to know the new name
710+
$backfile = $new_CR_file_name;
711+
}
712+
668713

669714
# Write out the type of load: Normal, TOO, SCS107
670715
if ($break == 1)
@@ -761,7 +806,7 @@ print "\nACIS-backstop completed.\n";
761806
#------------------------------
762807
# Set up soft links
763808
#------------------------------
764-
chdir("$cur_load_dir") || die "cannot change to ${cur_load_dir}\n";
809+
chdir("$cur_load_dir") || die "cannot change to ${cur_load_dir}\n"; # -------------------------------- CHDIR IN .../YYYY/MMMDDYY DIR
765810

766811
if(-e "./ofls")
767812
{
@@ -772,7 +817,7 @@ if(-e "./ofls")
772817
symlink( "${ofls_dir}", "./ofls");
773818

774819
# CD to the OFLS dir
775-
chdir("${ofls_dir}") || die "Cannot change to {$ofls_dir}";
820+
chdir("${ofls_dir}") || die "Cannot change to {$ofls_dir}"; # -------------------------------- CHDIR IN OFLS DIR
776821

777822

778823
#determine and display version of ACIS tables used:
@@ -859,8 +904,10 @@ else
859904
#
860905
# Run Check_Power_Cmds.py
861906
print "\nEXECUTING THE CHECK POWER COMMAND PROGRAM";
907+
# PRODUCTION
862908
system("/usr/local/bin/python3 /data/acis/LoadReviews/script/CHECK_POWER_COMMANDS/Check_Power_Cmds.py");
863909

910+
864911
# Now execute the Window Check program
865912
print "\nEXECUTING THE WINDOW CHECK PROGRAM.";
866913
system('/usr/local/bin/python3 /data/acis/LoadReviews/script/WINDOW_CHECK/Window_Check.py');
@@ -940,7 +987,7 @@ print "Done with thermal codes...\n\n";
940987
print "\nACIS TABLES USED IN THIS LOAD:\n$cfg_file\n$dat_file\n";
941988

942989
# CD to /data/acis<-bak>/LoadReviews.
943-
chdir("$lr_dir");
990+
chdir("$lr_dir"); # -------------------------------- CHDIR IN /DATA/ACIS/LoadReviews DIR
944991

945992
# Do NOT use this directory for ACE if there is test directory
946993
unless($test_dir){

0 commit comments

Comments
 (0)