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

Reset overrides from outside #206

Merged
merged 5 commits into from
Mar 15, 2019
Merged

Conversation

eidekrist
Copy link
Member

This solves part of issue #190, allowing resetting of overridden values from the C API.

As a safeguard against potential race conditions, cse::override_manipulator now only calls cse::simulator::set_xxx_yyy_manipulator() during the call to cse::manipulator::step_commencing(). I may have taken things a bit too far with templates here, as well as borrowing some code from the scenario world in order to minimize code duplication.

One obvious downside to this feature, is that when resetting parameters and unconnected inputs, the value goes back to 0, as mentioned in issue #188. I suggest that this be fixed in a separate PR, so as to not clash with PR #189.

For testing the client-server-core trifecta, a distribution can be downloaded from the related cse-server-go build.

@eidekrist eidekrist added the enhancement New feature or request label Mar 12, 2019
@eidekrist eidekrist self-assigned this Mar 12, 2019
Copy link
Member

@kyllingstad kyllingstad left a comment

Choose a reason for hiding this comment

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

Some of the code lines introduced in this PR are very long, and won't even fit in the diff view on GitHub. I think we decided at some point to have a soft limit of 80 characters per line, and a hard limit of 100. We just haven't been able to get clang-format to enforce it in any good way. I'd appreciate it if the long lines were broken up a bit.

Otherwise very good, just some minor issues that need to be addressed. :)

@@ -1,3 +1,5 @@
#include "../../include/cse/scenario.hpp"
Copy link
Member

Choose a reason for hiding this comment

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

Why not #include "cse/scenario.hpp"?

Copy link
Member Author

Choose a reason for hiding this comment

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

CLion works in mysterious ways, but I should have caught it! I'll remove it, as scenario.hpp is already included in manipulator.hpp.

}

void override_manipulator::override_real_variable(simulator_index index, variable_index variable, double value)

template<typename I, typename O, typename M, typename N>
Copy link
Member

Choose a reason for hiding this comment

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

With so many template parameters it is no longer obvious what they mean. I suggest some more descriptive names, or at least an explanatory comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree! I also don't really like how this turned out, so I'm working on a cleaner way to do it.

eidekrist added 2 commits March 13, 2019 15:51
@eidekrist
Copy link
Member Author

Some of the code lines introduced in this PR are very long, and won't even fit in the diff view on GitHub. I think we decided at some point to have a soft limit of 80 characters per line, and a hard limit of 100. We just haven't been able to get clang-format to enforce it in any good way. I'd appreciate it if the long lines were broken up a bit.

I have tried reducing line lengths in the files I've touched now. Other than that, I've pushed some changes restructuring the whole shebang with the manipulatorsmodifiers. The directionality bit (input/output) has been moved to a separate flag in the variable_action struct, as it is not directly coupled with the manipulator modifier function itself. As a reward, I was also allowed to clean up the scenario code 😄

Opinions?

Copy link
Member

@kyllingstad kyllingstad left a comment

Choose a reason for hiding this comment

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

Awesome :)

@eidekrist eidekrist merged commit 665ac37 into master Mar 15, 2019
@eidekrist eidekrist deleted the feature/190-reset-manipulators branch March 15, 2019 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants