-
Notifications
You must be signed in to change notification settings - Fork 5
Unit test and example for Genrou
class.
#85
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
Conversation
M_PI constant should not be available from <cmath> without previously defining
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.
Everything looks good. Compiled and ran example 2 on my machine with no issues.
@abirchfield, the
|
@abirchfield, I believe docs for the |
Perhaps we should use more descriptive names instead of "Example 1" and "Example 2"? |
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.
@pelesh I really don't like the littering of _USE_MATH_DEFINES
everywhere - it's almost certainly going to continue to be a problem like this going forward for the MSVC platform (which requires its use to access math constants like M_PI
). We should look into defining this macro in cmake rather than in every individual file which needs it. Otherwise I can foresee countless pull requests later adding these defines everywhere whenever someone on Linux needs to use M_PI
and forgets to define this. Thoughts?
My suggestion would be to have a file with constants protected with a namespace and something like |
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 load bug, including impacts to tests and docs. Still runs great on my machine.
Description
The 6th order electrical machine model implemented in
Genrou
class has been tested in an example where results of a simulation for a 2-bus system are compared to Powerworld simulations of the same system, comparing the results to within 3-4 significant digits. That example does not testGenrou
methods to the machine precision, which is needed for models of such complexity. This PR adds a unit test for the model residual evaluation function and another example comparing results to Powerworld reference.Closes #78
Proposed changes
Add a unit test that initializes the
Genrou
model at a consistent DAE solution and then verifies that all residual vector elements are zero to within machine precision. In addition, a 3-bus example is added which verifies simulation result to the numerical integration tolerance.Checklist
-Wall -Wpedantic -Wconversion -Wextra
.Further comments
This requires a little bit more work before it is ready for review.