Reliability Prototype - #833
Conversation
elenya-grant
left a comment
There was a problem hiding this comment.
Left some big-picture comments! Happy to chat through anything if you'd like! Thanks!
| shape: float = field(validator=validators.instance_of(float)) | ||
| downtime: Any = field(converter=generate_downtime_model) | ||
| downtime_per_event: np.ndarray = field(init=False, validator=validators.instance_of(np.ndarray)) | ||
| availability: np.ndarray = field( |
There was a problem hiding this comment.
could we make n_timesteps a configuration parameter? Then we could have availability be initialized in __attrs_post_init__ as np.ones(n_timesteps)
There was a problem hiding this comment.
The generation of availability is now done in calculate_availability to make it easier to automate, and adding the n_timesteps to the to do section.
| frequency: float = field(validator=(validators.instance_of((float, int)), validators.gt(0))) | ||
| downtime: Any = field(converter=generate_downtime_model) | ||
| downtime_per_event: np.ndarray = field(init=False, validator=validators.instance_of(np.ndarray)) | ||
| availability: np.ndarray = field( |
There was a problem hiding this comment.
same comment here about having n_timesteps as a configuration parameter.
| interval = np.ceil(8760 / frequency).astype(int) | ||
| first_occurrence = rng.integers(0, np.where(interval > 8760, 8760, interval)) |
There was a problem hiding this comment.
should these 8760's be n_timesteps?
| ) | ||
| # TODO: handle start > 8760 | ||
| end = start + duration | ||
| end = np.where(end > 8760, 8760, end) |
There was a problem hiding this comment.
same here - should 8760 be n_timesteps or N_TIMESTEPS (as you have it now?)
| to a quarterly downtime event and 0.25 is equivalent to an every 4 years downtime event. | ||
| For all events the timing of the first event will be sampled within the first year or | ||
| interval period to offset events from being based on January 1st in an 8760. | ||
| downtime (int | float | dict): Either fixed length of each downtime, in hours, or a |
There was a problem hiding this comment.
could we name this downtime_hrs or something? Also - can these models be updated to handle varying timesteps? It seems like a lot of logic is intended for hourly? If so - I think we should should make dt an input parameter too.
There was a problem hiding this comment.
This could be tricky, but I'll add it to the to do section.
| merge_shared_inputs(self.options["tech_config"]["model_inputs"], "performance"), | ||
| additional_cls_name=self.__class__.__name__, | ||
| ) | ||
| if self.options["tech_config"]["model_inputs"]["reliability"]: |
There was a problem hiding this comment.
do we need to use self.options["tech_config"]["model_inputs"].get("reliability", False) here?
There was a problem hiding this comment.
Not exactly, but that did get me thinking on a better way to use use_reliability, so I appreciate the question!
| self.reliability_model = None | ||
| self.use_reliability = False |
There was a problem hiding this comment.
Could these be parameters in the NaturalGasPerformanceConfig? So a user can input reliability_model and use_reliability? Where the __attrs_post_init__ checks that reliability_model is provided if use_reliability is True?
There was a problem hiding this comment.
That's a good question, it didn't dawn on me that a user could want to provide a definition, but not use it. Though it could be easier to iterate on a problem by simply turning it on/off instead of commenting out a whole section of the inputs. I'll also add this to the to do section.
…nts in every model
Integration of Basic Reliability Modeling
This is an early stage (non-working) prototype of a Weibull-based reliability model for the
NaturalGasPerformanceModel.For now, the model is designed to slot into any performance model using an hourly timestep over a single year. The key output is an array of availability (0 for downtime and 1 for operational) that is multiplied by the demand array.
Working example
Section 1: Type of Contribution
Section 2: Draft PR Checklist
TODO: (see other feedback/considerations for what I'm considering or other aspects I could be missing)
n_timestepsas an input to the model in place of using module levelN_TIMESTEPS = 8760.dtas an input to the model for duration of the simulation in place ofN_TIMESTEPS = 8760.use_reliabilityfor a performance model to toggle its usage or check that a model has been provided if using during model initialization.Type of Reviewer Feedback Requested (on Draft PR)
Structural feedback: Anything is welcome
Implementation feedback: Should the reliability slot into the performance in a more streamlined way? Any other feedback is welcome.
Other feedback/considerations for the finalized PR: It would be great to get feedback on the importance of the following items and any preferred approaches.
better control over random seeding- kick the can way down the roaduncertainty quantification- getting well ahead of ourselvesn_timestepsfrom the plant configurationmodel.calculate_availability()?Section 3: General PR Checklist
docs/files are up-to-date, or added when necessaryCHANGELOG.md"A complete thought. [PR XYZ]((https://github.com/NatLabRockies/H2Integrate/pull/XYZ)", where
XYZshould be replaced with the actual number.Section 4: Related Issues
Section 5: Impacted Areas of the Software
Section 5.1: New Files
path/to/file.extensionmethod1: What and why something was changed in one sentence or less.Section 5.2: Modified Files
path/to/file.extensionmethod1: What and why something was changed in one sentence or less.Section 6: Additional Supporting Information
Section 7: Test Results, if applicable
Section 8 (Optional): New Model Checklist
docs/developer_guide/coding_guidelines.mdattrsclass to define theConfigto load in attributes for the modelBaseConfigorCostModelBaseConfiginitialize()method,setup()method,compute()methodCostModelBaseClass__init__.pyfile to ensure it is properly imported and used insupported_models.pysupported_models.pycreate_financial_modelinh2integrate_model.pytest_all_examples.pydocs/user_guide/model_overview.mddocs/section<model_name>.mdis added to the_toc.ymlgenerate_class_hierarchy.pyto update the class hierarchy diagram indocs/developer_guide/class_structure.md