-
Notifications
You must be signed in to change notification settings - Fork 4
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
Basic Event Scheduler Model #37
base: devel
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have couple of comments for your consideration.
__init__.py
Outdated
@@ -9,6 +9,7 @@ | |||
from SR2ML.src import MaintenanceModel | |||
from SR2ML.src import MCSSolver | |||
from SR2ML.src import MarginModel | |||
from SR2ML.src import basicEventScheduler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend to use upper case for each leading character when define a class. That is: change basicEventScheduler to BasicEventScheduler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
\item \xmlNode{BE}, \xmlDesc{string, required parameter}, the name ID of all basic events | ||
\begin{itemize} | ||
\item \xmlAttr{tin}, \xmlDesc{required string attribute}, name ID of the variable describing the initial time of the BE | ||
\item \xmlAttr{tin}, \xmlDesc{required string attribute}, name ID of the variable describing the final time of the BE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change 'tin' to 'tfin'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, good catch
src/basicEventScheduler.py
Outdated
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update the copyright info, (The above info is used by raven). Something like:
# Copyright 2020, Battelle Energy Alliance, LLC
# ALL RIGHTS RESERVED
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -0,0 +1,119 @@ | |||
<Simulation verbosity="debug"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no gold files for this test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's weird, i wonder why the regression test was green
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see issue #38
tests/tests
Outdated
[./TestBasicEventScheduler] | ||
type = 'RavenFramework' | ||
input = 'test_basicEventScheduler.xml' | ||
OrderedCsv = 'basicEventScheduler/Print_sim_HS_0.csv' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the csv file is missed in the gold folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change OrderedCsv to csv, otherwise, the test will be be tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
src/basicEventScheduler.py
Outdated
""" | ||
This method generate an historySet from the a pointSet which contains initial and final time of the | ||
basic events | ||
@ In, inputDataset, dict, dictionary of inputs from RAVEN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change inputDataset to inputs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/basicEventScheduler.py
Outdated
basic events | ||
@ In, inputDataset, dict, dictionary of inputs from RAVEN | ||
@ In, container, object, self-like object where all the variables can be stored | ||
@ Out, basicEventHistorySet, Dataset, xarray dataset which contains time series for each basic event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no return for the run method. I think you can move the above line to the method docstring explanation part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
src/basicEventScheduler.py
Outdated
elif child.tag == 'variables': | ||
variables = [str(var.strip()) for var in child.text.split(",")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variables is not directly used in this class, you probably can remove these lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lines are needed as part of the external model class which require the "variables" node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variables are processed in ExternalModel class, but you are not using it in your class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed lines 65 and 66 but it errors out of line 68
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. We are looping over all nodes, even if they have already processed by other class. I'm ok to keep it here.
|
||
This model is designed to read the initial and final time under which a set of basic events | ||
are set to True, and then it generates an HistorySet with the full temporal profile of all | ||
basic events. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend to add another paragraph to explain the structure of generated history set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
src/basicEventScheduler.py
Outdated
for key in container.basicEvents.keys(): | ||
tin = inputs[container.basicEvents[key][0]][0] | ||
tend = inputs[container.basicEvents[key][1]][0] | ||
indexes = np.where(np.logical_and(timeArrayCleaned>tin,timeArrayCleaned<=tend)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why 'timeArrayCleaned>tin', but not 'timeArrayCleaned>=tin'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is due to to the conversion from interval-based data to instant-based data (i.e., the history set). The convention here is that a logical value set to 1 at a specific time instant implies that the basic event was actually True from the previous time instant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point, it is better to clarify it in the user manual.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, added text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the definition, 'tin' is the initial time for the basic event. Based on the calculation np.where(np.logical_and(timeArrayCleaned>tin,timeArrayCleaned<=tend))
, when the time instant is tin
, the value are set to 0. Does this mean the event are still the same as before at tin
, and does not change state at tin
? Only the time large than tin
, the basic event are actually changing state. Do I state correctly? @mandd
@wangcj05 : let me know if you need more edit form me here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is good. @mandd Could you resolve the conflict in the tests file?
Pull Request Description
What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.)
Closes #36
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.