Skip to content

Commit f9f2438

Browse files
authored
Merge pull request #75 from acisops/fp_hrc_dep
Update acisfp_check to allow for HRC dependence in the ACIS FP model
2 parents e56ebbc + 33a1f02 commit f9f2438

18 files changed

+11143
-13
lines changed

acis_thermal_check/apps/acisfp_check.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ def _calc_model_supp(self, model, state_times, states, ephem, state0):
9898
model.comp["1cbat"].set_data(-53.0)
9999
model.comp["sim_px"].set_data(-120.0)
100100

101+
if "215pcast_off" in model.comp:
102+
# Set the HRC 15 volt state
103+
# NOTE: Because of an error in AP, the correct state is 215PCAST=OFF,
104+
# which indicates that the HRC 15V is ON.
105+
model.comp["215pcast_off"].set_data(states["hrc_15v"] == "ON", state_times)
106+
101107
def make_prediction_plots(
102108
self, outdir, states, temps, load_start, upper_limit, lower_limit
103109
):
@@ -253,11 +259,11 @@ def make_prediction_plots(
253259

254260
# Now write all the plots after possible
255261
# customizations have been made
256-
for key in plots:
262+
for key, plot in plots.items():
257263
if key != self.msid:
258-
outfile = outdir / plots[key].filename
264+
outfile = outdir / plot.filename
259265
mylog.info("Writing plot file %s", outfile)
260-
plots[key].fig.savefig(outfile)
266+
plot.fig.savefig(outfile)
261267

262268
return plots
263269

acis_thermal_check/apps/dpa_check.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
plots comparing predicted values to telemetry for the previous three
1111
weeks.
1212
"""
13+
1314
import sys
1415

1516
import matplotlib

acis_thermal_check/apps/dpamyt_check.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
plots comparing predicted values to telemetry for the previous three
1111
weeks.
1212
"""
13+
1314
import sys
1415

1516
import matplotlib

acis_thermal_check/apps/psmc_check.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
plots comparing predicted values to telemetry for the previous three
1111
weeks.
1212
"""
13+
1314
import sys
1415

1516
import matplotlib

acis_thermal_check/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def run(self, args, override_limits=None):
174174
# Record the selected state builder in the class attributes
175175
# If there is no "state_builder" command line argument assume
176176
# kadi
177-
hrc_states = self.name in ["cea"]
177+
hrc_states = any(p["comp_name"] == "215pcast_off" for p in model_spec["pars"])
178178
state_builder = getattr(args, "state_builder", "kadi")
179179
mylog.info(f"ACISThermalCheck is using the '{state_builder}' state builder.")
180180
self.state_builder = make_state_builder(
@@ -774,11 +774,11 @@ def make_prediction_plots(
774774

775775
# Now write all of the plots after possible
776776
# customizations have been made
777-
for key in plots:
777+
for key, plot in plots.items():
778778
if key != self.msid:
779-
outfile = outdir / plots[key].filename
779+
outfile = outdir / plot.filename
780780
mylog.debug("Writing plot file %s" % outfile)
781-
plots[key].fig.savefig(outfile)
781+
plot.fig.savefig(outfile)
782782

783783
return plots
784784

acis_thermal_check/state_builder.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ class StateBuilder:
4141
should not be used by itself, but subclassed.
4242
"""
4343

44-
def __init__(self, logger=None):
44+
def __init__(self, logger=None, hrc_states=False):
4545
if logger is None:
4646
# Make a logger but with no output
4747
logger = logging.getLogger("statebuilder-no-logger")
4848
self.logger = logger
4949
self.state_keys = STATE_KEYS.copy()
50+
if hrc_states:
51+
self.state_keys += ["hrc_15v", "hrc_24v", "hrc_i", "hrc_s"]
5052

5153
def get_prediction_states(self, tlm):
5254
"""
@@ -132,9 +134,7 @@ def __init__(
132134
hrc_states : boolean, optional
133135
Whether to add HRC-specific states. Default: False
134136
"""
135-
super().__init__(logger=logger)
136-
if hrc_states:
137-
self.state_keys += ["hrc_15v", "hrc_24v", "hrc_i", "hrc_s"]
137+
super().__init__(logger=logger, hrc_states=hrc_states)
138138

139139
# Note: `interrupt` is ignored in this class. This concept is not needed
140140
# since backstop 6.9, which provides the RUNNING_LOAD_TERMINATION_TIME
@@ -247,6 +247,7 @@ def __init__(
247247
outdir=None,
248248
verbose=2,
249249
logger=None,
250+
hrc_states=False,
250251
):
251252
"""
252253
Give the ACISStateBuilder arguments that were passed in
@@ -270,6 +271,8 @@ def __init__(
270271
- obtained from the model invocation command line arguments.
271272
logger : Logger object, optional
272273
The Python Logger object to be used when logging.
274+
hrc_states : boolean, optional
275+
Whether to add HRC-specific states. Default: False
273276
"""
274277
# Import the BackstopHistory class
275278
from backstop_history import BackstopHistory
@@ -284,7 +287,7 @@ def __init__(
284287
outdir,
285288
verbose,
286289
)
287-
super().__init__()
290+
super().__init__(hrc_states=hrc_states)
288291

289292
# Save some arguments to class attributes
290293
self.interrupt = interrupt

0 commit comments

Comments
 (0)