-
Notifications
You must be signed in to change notification settings - Fork 184
Warning/Error flags #826
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
Warning/Error flags #826
Conversation
AQWA Examples (WEC-Sim#779)
Revert "DRAFT: Warning/Error flags"
kmruehl
left a comment
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.
@jtgrasb this looks great so far. I've made several comments in line. Also, the tests are failing, any idea why?
source/objects/simulationClass.m
Outdated
| solver = 'ode4' % (`string`) PDE solver used by the Simulink/SimMechanics simulation. Any continuous solver in Simulink possible. Recommended to use 'ode4, 'ode45' for WEC-Sim. Default = ``'ode4'`` | ||
| stateSpace {mustBeMember(stateSpace,0:1)} = 0 % (`integer`) Flag for convolution integral or state-space calculation, Options: 0 (convolution integral), 1 (state-space). Default = ``0`` | ||
| startTime {mustBeNonnegative} = 0 % (`float`) Simulation start time. Default = ``0`` s | ||
| zeroCross = 'DisableAll' % (`string`) Disable zero cross control. Default = ``'DisableAll'`` |
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.
How do this property validation work? Can you share a MATLAB link? How does it affect our documentation, etc? Are you planning to add this to the other classes too?
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.
https://www.mathworks.com/help/matlab/matlab_oop/validate-property-values.html
Here's the documentation for this MATLAB feature. I used it for the simulation class because there are a lot of simple checks on properties that I felt would be helpful (such as limiting the different timesteps to positive values), so I thought would be an easy way to check these.
Not sure how it affects the documentation yet, but I will check.
I think it would be helpful to add to more of the properties/classes, but I felt most of the other classes were easier to check using checkInputs methods.
Lastly, it is possible to add checks for the variable type (double, string, etc.) and size, but I ran into some issues with these when the variable is optional and can remain undefined.
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.
@jtgrasb I like this feature a lot, and think we should implement it, but I'm wondering whether it's something we should push to after v5.0 and implement across all the classes, or whether we should work to include it in v5.0, LMK what you think.
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.
@kmruehl I agree, it is a very useful feature. I think it may be best to wait until after v5.0 because although helpful, I don't think it affects WEC-Sim significantly with most use cases. It would also give me more time to work out the kinks and implement it for the other classes. If you think it should be part of v5.0 though, I can try to get the rest of the classes implemented.
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 agree, let's hold off of this on v5.0, but please add it to the project board for future development.
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.
Actually, can you revert the simulationClass property validation, and then I'll merge this.
|
@jtgrasb can you resolve the merge conflicts? |
|
@jtgrasb sorry that dev is a moving target due to the other PRs. This should be the last major change to dev to resolve conflicts with and then we can merge this PR too. |
|
@jtgrasb thanks for resolving merge conflicts! I'll merge this once the property validation has been removed. |
source/objects/simulationClass.m
Outdated
| solver = 'ode4' % (`string`) PDE solver used by the Simulink/SimMechanics simulation. Any continuous solver in Simulink possible. Recommended to use 'ode4, 'ode45' for WEC-Sim. Default = ``'ode4'`` | ||
| stateSpace {mustBeMember(stateSpace,0:1)} = 0 % (`integer`) Flag for convolution integral or state-space calculation, Options: 0 (convolution integral), 1 (state-space). Default = ``0`` | ||
| startTime {mustBeNonnegative} = 0 % (`float`) Simulation start time. Default = ``0`` s | ||
| zeroCross = 'DisableAll' % (`string`) Disable zero cross control. Default = ``'DisableAll'`` |
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.
Actually, can you revert the simulationClass property validation, and then I'll merge this.
|
Thanks @jtgrasb |
This is an updated version of PR #820 to be compatible with the new updates to dev.
In this PR, I’ve implemented warning and error flags that seek to provide more feedback to the user regarding common errors and issues. The following flags/messages have been implemented into wecSim as part of this PR:
I am working on more warning and error flags, but wanted to get a PR started here so that it can start to be reviewed.