Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Lagged Variable PostProcessor #1523

Merged
merged 13 commits into from
Apr 28, 2021
Merged

Add Lagged Variable PostProcessor #1523

merged 13 commits into from
Apr 28, 2021

Conversation

joshua-cogliati-inl
Copy link
Contributor

@joshua-cogliati-inl joshua-cogliati-inl commented Apr 20, 2021


Pull Request Description

What issue does this change request address?

Closes #1522

What are the significant changes in functionality due to this change request?

This adds a new post processor.


For Change Control Board: Change Request Review

The following review must be completed by an authorized member of the Change Control Board.

  • 1. Review all computer code.
  • 2. If any changes occur to the input syntax, there must be an accompanying change to the user manual and xsd schema. If the input syntax change deprecates existing input files, a conversion script needs to be added (see Conversion Scripts).
  • 3. Make sure the Python code and commenting standards are respected (camelBack, etc.) - See on the wiki for details.
  • 4. Automated Tests should pass, including run_tests, pylint, manual building and xsd tests. If there are changes to Simulation.py or JobHandler.py the qsub tests must pass.
  • 5. If significant functionality is added, there must be tests added to check this. Tests should cover all possible options. Multiple short tests are preferred over one large test. If new development on the internal JobHandler parallel system is performed, a cluster test must be added setting, in XML block, the node <internalParallel> to True.
  • 6. If the change modifies or adds a requirement or a requirement based test case, the Change Control Board's Chair or designee also needs to approve the change. The requirements and the requirements test shall be in sync.
  • 7. The merge request must reference an issue. If the issue is closed, the issue close checklist shall be done.
  • 8. If an analytic test is changed/added is the the analytic documentation updated/added?
  • 9. If any test used as a basis for documentation examples (currently found in raven/tests/framework/user_guide and raven/docs/workshop) have been changed, the associated documentation must be reviewed and assured the text matches the example.

Copy link
Collaborator

@alfoa alfoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interfacePostprocessor here should be converted to be a normal PostProcessor (please talk to @wangcj05 about the new structure)

variables. For example, if there a variable price that is set hourly,
than new variable called price\_prev\_hour could be set by using a
delay of -1. This can be useful for training a ROM or other data
analysis.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Josh, please add an example here that precisely explains the Input DataObject and how the Output DataObject will get out. From the previous explanation I do not know how to use this PP and how to set up the output dataobject.
We need to be very verbose (with examples).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in conjunction with the example you have below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a bit more here, and expanded the example to include the step and the data objects.

\begin{itemize}
\item \xmlNode{delay}, \xmlDesc{empty}, a delay node with the following required parameters:
\begin{itemize}
\item \xmlAttr{original}, the variable to start with
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the format of the manual.
Example:

\item \xmlAttr{VAR}, \xmlDesc{required string attribute}, user-defined VARIABLE name etc etc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

\item \xmlAttr{original}, the variable to start with
\item \xmlAttr{new}, the new variable to create
\item \xmlAttr{steps}, the delay (if negative) or steps into the future (if positive) to use for the new variable (so -1 gives the previous, 1 gives the next)
\item \xmlAttr{default}, the value to use for cases where there is no previous or next value.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please be verbose here... "there is no previous or next value". What do you mean? in terms of perfect match using the step? need clear explanation for the user

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added: (such as the beginning when a negative delay is used, or the end when the delay is positive)

@@ -0,0 +1,91 @@

"""
This is to implement a delay or lagged parameters in a HistorySet
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standard of docstring


class HistorySetDelay(PostProcessorInterfaceBase):
"""
Class to get lagged or delayed data out of a history set.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standard

inputSpecification = super().getInputSpecification()
inputSpecification.setCheckClass(CheckInterfacePP("HistorySetDelay"))
delayClass = InputData.parameterInputFactory("delay", InputTypes.StringType,
descr="Adds a delay variable")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verbosity of the description

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those descriptions will be used for future automatic documentation. they must be of "manual grade"


def initialize(self):
"""
Method to initialize the HistorySetDelay
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standard docstring

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

<created>2021-04-19</created>
<classesTested>InterfacedPostProcessor</classesTested>
<description>
Tests of the HistorySetDelay interfaced post-processor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you improve the description answering to the following questions:
what do we test? What the expected outcomes? input and outputs? the model used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@joshua-cogliati-inl
Copy link
Contributor Author

The interfacePostprocessor here should be converted to be a normal PostProcessor (please talk to @wangcj05 about the new structure)

Hm, HistorySetSync doesn't seem to be converted in #1512 Where is an example of a converted InterfacePostProcessor I can look at?

@wangcj05
Copy link
Collaborator

The interfacePostprocessor here should be converted to be a normal PostProcessor (please talk to @wangcj05 about the new structure)

Hm, HistorySetSync doesn't seem to be converted in #1512 Where is an example of a converted InterfacePostProcessor I can look at?

I have converted the "RiskMeasuresDiscrete" in PR: https://github.com/idaholab/raven/pull/1512/files

@joshua-cogliati-inl
Copy link
Contributor Author

The interfacePostprocessor here should be converted to be a normal PostProcessor (please talk to @wangcj05 about the new structure)

Hm, HistorySetSync doesn't seem to be converted in #1512 Where is an example of a converted InterfacePostProcessor I can look at?

I have converted the "RiskMeasuresDiscrete" in PR: https://github.com/idaholab/raven/pull/1512/files

The method run doesn't seem to be modified:

https://github.com/idaholab/raven/pull/1512/files#diff-1d3a8ec5e63f5ed917bae8cea26d940241b149fcfda0e001b29ff32d871c83e7

@wangcj05
Copy link
Collaborator

The interfacePostprocessor here should be converted to be a normal PostProcessor (please talk to @wangcj05 about the new structure)

Hm, HistorySetSync doesn't seem to be converted in #1512 Where is an example of a converted InterfacePostProcessor I can look at?

I have converted the "RiskMeasuresDiscrete" in PR: https://github.com/idaholab/raven/pull/1512/files

The method run doesn't seem to be modified:

https://github.com/idaholab/raven/pull/1512/files#diff-1d3a8ec5e63f5ed917bae8cea26d940241b149fcfda0e001b29ff32d871c83e7

The base class will be changed. Based on the new structure, the interfacePP class, the PPInterfaces, the PPInterfaceBaseClass are not needed anymore. There is only minor changes in the methods by using inheritance.

@joshua-cogliati-inl
Copy link
Contributor Author

Well, I attempted to convert it to a post processor in: f4244c6

@joshua-cogliati-inl
Copy link
Contributor Author

This should be ready to review again.

Copy link
Collaborator

@wangcj05 wangcj05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments.

framework/Models/PostProcessors/HistorySetDelay.py Outdated Show resolved Hide resolved
framework/Models/PostProcessors/HistorySetDelay.py Outdated Show resolved Hide resolved
framework/Models/PostProcessors/HistorySetDelay.py Outdated Show resolved Hide resolved
framework/Models/PostProcessors/HistorySetDelay.py Outdated Show resolved Hide resolved
<?xml version="1.0" ?>
<Simulation verbosity="debug">
<TestInfo>
<name>framework/Models/PostProcessors/HistorySetDelay</name>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the test name, i.e. framework/PostProcessors.HistorySetDelay

Copy link
Collaborator

@wangcj05 wangcj05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes are good.

@alfoa alfoa added the RAVENv2.1 All tasks and defects that will go in RAVEN v2.1 label Apr 28, 2021
Copy link
Collaborator

@alfoa alfoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments addressed

@alfoa alfoa mentioned this pull request Apr 28, 2021
10 tasks
@alfoa
Copy link
Collaborator

alfoa commented Apr 28, 2021

Checklist passed...

Comments addressed..

Approved to merge.

@alfoa
Copy link
Collaborator

alfoa commented Apr 28, 2021

Merging...

@alfoa alfoa merged commit cfb57b0 into devel Apr 28, 2021
@alfoa alfoa deleted the cogljj/lag_pp branch April 28, 2021 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RAVENv2.1 All tasks and defects that will go in RAVEN v2.1 Ready To Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] Add lagged parameter creation
3 participants