-
Notifications
You must be signed in to change notification settings - Fork 61
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
Feature/286 sysmodel logger #287
Conversation
9dc56b8
to
1345e3a
Compare
ff33918
to
4cc244e
Compare
4cc244e
to
bda714a
Compare
Added new C++ based loggers (see original post), which significantly speed up logging. |
It was discussed that it is best to separate C++ logging from this new logging system, pending further discussion on whether we actually want to encourage 'variable logging' as a form of simulation poking. |
Moreover, the possible merge of #317 might simplify the implementation of this PR (by leveraging the unified access to variables from the |
Sure, this PR can wait for #317 to be approved if it will yield a nicer implementation. It will be nice to have this, but there is no immediate urgency. |
601129c
to
37ca757
Compare
850cfa8
to
cc2dc22
Compare
@juan-g-bonilla , Looking over your PR for this branch. Nice work overall, I'm not seeing any major issues. Some questions:
|
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.
Great change, makes it much easier. I added just a couple of comments, everything else looks great. Thanks, Juan!
Thanks for the review!
Finally, I forgot to mention, there is a video tutorial that is now outdated (sorry!) |
Ok, let's add a note in the release notes that module |
cc2dc22
to
f7b4af2
Compare
f7b4af2
to
200131e
Compare
@schaubh I implemented the small fixes, just waiting on the video for merging! |
Ok, thanks @juan-g-bonilla , thanks for the update. I'll try to do the new video for the RST file ASAP. |
7679f7e
to
74e4e89
Compare
Squashed commits: [859f125] Update docs related to logging
74e4e89
to
8372d25
Compare
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.
Thanks for this PR. This is a nice change. I chose not to redo the video as the variable logging is now so simple, and similar to how the recorder()
method works, I didn't see a need for a video.
Description
Variable logging was implemented through a
SysModel
, which is added to a task similarly to message recorders. For usage, see documentation bskPrinciples 6.The new
SysModel
logger take arbitrary lambdas as callback functions for logging, which are given in a dictionary. However, for recording simple module attributes, the utility functionlogger
has been added to every module, which takes as input a string or list of strings and produces a logger that will record the given attributes:is equivalent to:
The
logger
method is added toSysModel
through a new swig file that all module swig files now include. An error is raised for scripts that try to accesslogger
for modules that do not use the swig file (i.e. they use%include sys_model.h
instead of%include sys_model.i
).The following methods are now deprecated:
AddVariableForLogging
GetLogVariableData
RecordLogVars
However, they still work as expected. This was accomplished by having these functions call the new logging functionality internally, which means that the old logging has been completely removed from the code.
Verification
All scenarios and tests that used the old syntax have been updated to the new syntax, and all are passing. On a personal note, updating these has been a pain as it is difficult to script the conversion reliably.
Documentation
bskPrinciples-6
was updated to reflect the new way of logging variables. Note that the associated video is now outdated. Scenarios have also been updated to use the new syntax.