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

Mandd/ft generator #1370

Open
wants to merge 10 commits into
base: devel
Choose a base branch
from
Open

Mandd/ft generator #1370

wants to merge 10 commits into from

Conversation

mandd
Copy link
Collaborator

@mandd mandd commented Nov 6, 2020


Pull Request Description

What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.)

Creation of a PP which generates fault tree from a set of simulated data (PointSet) #1369

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

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.

@mandd mandd added priority_minor RAVENv2.1 All tasks and defects that will go in RAVEN v2.1 labels Nov 6, 2020
@mandd mandd requested review from wangcj05 and alfoa November 6, 2020 01:51
@mandd mandd changed the title Mandd/f tgenerator Mandd/ft generator Nov 6, 2020
@mandd mandd added the task This tag should be used for any new capability, improvement or enanchment label Nov 6, 2020
@mandd mandd linked an issue Nov 6, 2020 that may be closed by this pull request
10 tasks
@mandd
Copy link
Collaborator Author

mandd commented Nov 6, 2020

This PR requires a new python library: SymPy (https://www.sympy.org/en/index.html)

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.

Several comments for you. @mandd

@@ -30,6 +30,7 @@ \subsection{PostProcessor}
\item \textbf{ParetoFrontier}
\item \textbf{MCSImporter}
\item \textbf{EconomicRatio}
\item \textbf{FTgenerator}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest to change FTgenerator to FTGenerator

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you agree, please go over all the files to update it.

contained in the PointSet. This postprocessor creates a fault tree based on the generated Boolean formula.

\ppType{SampleSelector}{SampleSelector}
Copy link
Collaborator

Choose a reason for hiding this comment

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

update SampleSelector to FTGenerator

\begin{enumerate}
\item the input variables in the PointSet which correspond to the basic events in the fault tree
\item the output variable in the PointSet which correspond to the top event in the fault tree
Copy link
Collaborator

Choose a reason for hiding this comment

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

correspond --> corresponds?

\item \xmlNode{topEventID}, \xmlDesc{string, required field}, ID of the output variable in the PointSet which corresponds
to the top event in the fault tree
\item \xmlNode{inputVars}, \xmlDesc{string, required field}, IDs of the input variables in the PointSet which correspond
Copy link
Collaborator

Choose a reason for hiding this comment

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

string --> list of strings (comma separated strings)

from utils import utils, xmlUtils
from utils import InputData, InputTypes
from sympy.logic import SOPform, POSform
from itertools import product
Copy link
Collaborator

Choose a reason for hiding this comment

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

move following lines to External Modules above

from sympy.logic import SOPform, POSform
from itertools import product

inputVars = paramInput.findFirst('inputVars')
self.inputVars = inputVars.value.split(",")
for var in self.inputVars:
var = var.strip()
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to use strip method here, it is already in InputTypes.

self.simOnly = simOnly.value

typeConv = paramInput.findFirst('type')
self.type = typeConv.value.lower()
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe worth to add lower option in InputTypes, and a discussion with our teams. No need to change here.

understandable by this pp.
In this case, we only want data objects!
@ In, currentInp, list, an object that needs to be converted
@ Out, currentInp, DataObject.HistorySet, input data
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change DataObject.HistorySet to DataObject.PointSet, only PointSet is allowed.

inData = self.inputToInternal(inputIn)
dataset = inData.asDataset()

self.dataObjectName = inputIn
Copy link
Collaborator

Choose a reason for hiding this comment

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

self variable should be first mentioned in init method.

for counter,combination in enumerate(combinations):
indexes = np.where(np.all(data==combination,axis=1))[0]
if len(indexes)==0 and not self.simOnly:
self.raiseAnError(RuntimeError,'FTgenerator: combination ' + str(combination) + ' of variables ' + str(self.inputVars) +' has not been found in the dataset.')
Copy link
Collaborator

Choose a reason for hiding this comment

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

'+' can be replaced with ','

@wangcj05
Copy link
Collaborator

@mandd You may want to finalize this PR. In addition, I think PR belongs to SR2ML. Please let me know what do you think.

@wangcj05
Copy link
Collaborator

@mandd Should we move this to SR2ML and finalize the PR?

@wangcj05 wangcj05 added RAVENv2.3 for RAVEN 2.3 Release and removed RAVENv2.1 All tasks and defects that will go in RAVEN v2.1 labels Nov 17, 2022
@wangcj05 wangcj05 removed the RAVENv2.3 for RAVEN 2.3 Release label May 19, 2023
@aalfonsi
Copy link
Collaborator

@wangcj05 @mandd are you planning to finish this MR? it would be quite useful to have this finalized in the next months or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority_minor task This tag should be used for any new capability, improvement or enanchment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] fault tree generator
3 participants