-
Notifications
You must be signed in to change notification settings - Fork 1
Priority in Microgrid Controller Selection #29
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1e7e2f4
Priority in Microgrid Controller Selection
iguessthislldo 07ab3b0
Merge branch 'main' into igtd/mc-sel-priority
iguessthislldo 126953e
Add Testing to GHA and Tweaks
iguessthislldo ecdcad1
Respond to Review and Use SIGINT
iguessthislldo 12e2e04
Remove Testing for macOS
iguessthislldo ac8a098
Workaround Escaping in opnedds_add_test
iguessthislldo 7fca400
Use qw
iguessthislldo f77f788
Move Windows Stack Change to TMS_Common
iguessthislldo 9abe3af
Don't do SIGINT on Windows and try trace on Linux
iguessthislldo dec436c
Add Missing OS if
iguessthislldo d3e3ea0
Try Kill(..., 0) on Windows
iguessthislldo 787324c
Explicit Shutdown in Test
iguessthislldo ae0446f
More Fixes For Occasional Failures
iguessthislldo 991abb2
Try Removing IPv6 and Log Ignore
iguessthislldo d0694b8
Put --ipv6 Back, Try TARGET_RUNTIME_DLL_DIRS
iguessthislldo 0f53659
Try mc-sel Test on macOS Without IPv6
iguessthislldo c1fe616
Revert "Try mc-sel Test on macOS Without IPv6"
iguessthislldo 25de293
Configurable Debug Messages
iguessthislldo 96ba18b
Remove Commented Line
iguessthislldo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,15 @@ | ||
| cmake_minimum_required(VERSION 3.27) | ||
|
|
||
| project(opendds_tms_mc_sel_test CXX) | ||
| project(opendds_tms_mc_sel CXX) | ||
| enable_testing() | ||
|
|
||
| find_package(OpenDDS REQUIRED) | ||
| include(opendds_testing) | ||
|
|
||
| add_executable(mc-sel-test mc-sel-test.cpp) | ||
| target_link_libraries(mc-sel-test PRIVATE PowerSim_Idl) | ||
| add_executable(basic-dev basic-dev.cpp) | ||
| target_link_libraries(basic-dev PRIVATE PowerSim_Idl) | ||
|
|
||
| add_executable(basic-mc ${CMAKE_SOURCE_DIR}/controller/Controller.cpp basic-mc.cpp) | ||
| target_link_libraries(basic-mc PRIVATE Commands_Idl) | ||
|
|
||
| opendds_add_test(COMMAND ./mc-sel-test) | ||
| opendds_add_test(ARGS remove_dcs_after=0 test_verbose=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #include "common.h" | ||
|
|
||
| #include <power_devices/PowerDevice.h> | ||
|
|
||
| #include <tests/Utils/DistributedConditionSet.h> | ||
|
|
||
| int main(int argc, char* argv[]) | ||
| { | ||
| const std::string name = "dev"; | ||
| PowerDevice pd(name); | ||
| if (pd.init(domain, argc, argv) != DDS::RETCODE_OK) { | ||
| return 1; | ||
| } | ||
|
|
||
| DistributedConditionSet_rch dcs = | ||
| OpenDDS::DCPS::make_rch<FileBasedDistributedConditionSet>(); | ||
|
|
||
| ControllerCallbacks& cbs = pd.controller_callbacks(); | ||
| cbs.set_new_controller_callback([dcs, name](const tms::Identity& id) { | ||
| printf("new_controller\n"); | ||
| dcs->post(name, "new controller " + id); | ||
| }); | ||
| cbs.set_missed_heartbeat_callback([dcs, name](const tms::Identity& id) { | ||
| dcs->post(name, "missed controller " + id); | ||
| }); | ||
| cbs.set_lost_controller_callback([dcs, name](const tms::Identity& id) { | ||
| dcs->post(name, "lost controller " + id); | ||
| }); | ||
| cbs.set_no_controllers_callback([dcs, name]() { | ||
| dcs->post(name, "no controllers"); | ||
| }); | ||
|
|
||
| Exiter exiter(pd); | ||
| return pd.run(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,22 @@ | ||
| #include "controller/Controller.h" | ||
| #include "common.h" | ||
|
|
||
| struct Timeout { | ||
| static const char* name() { return "Timeout"; } | ||
| }; | ||
|
|
||
| class Test : public TimerHandler<Timeout> { | ||
| public: | ||
| Test() | ||
| { | ||
| reactor_->register_handler(SIGINT, this); | ||
| schedule(Timeout{}, Sec(0), Sec(30)); | ||
| } | ||
|
|
||
| private: | ||
| void timer_fired(Timer<Timeout>& t) | ||
| { | ||
| ACE_DEBUG((LM_INFO, "(%P|%t) Timeout\n")); | ||
| t.exit_after = true; | ||
| } | ||
|
|
||
| void any_timer_fired(AnyTimer timer) | ||
| { | ||
| std::visit([&](auto&& value) { this->timer_fired(*value); }, timer); | ||
| } | ||
|
|
||
| int handle_signal(int, siginfo_t*, ucontext_t*) | ||
| { | ||
| ACE_DEBUG((LM_INFO, "(%P|%t) SIGINT\n")); | ||
| return end_event_loop(); | ||
| } | ||
| }; | ||
| #include <controller/Controller.h> | ||
|
|
||
| int main(int argc, char* argv[]) | ||
| { | ||
| const int domain = std::stoi(argv[1]); | ||
| const std::string device_id = argv[2]; | ||
| if (argc < 4) { | ||
| ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: requires device id, priority, and time duration arguments\n")); | ||
| return 1; | ||
| } | ||
| const std::string device_id = argv[1]; | ||
| const uint16_t priority = std::stoi(argv[2]); | ||
| const Sec exit_after(std::stoi(argv[3])); | ||
|
|
||
| Controller mc(device_id); | ||
| Controller mc(device_id, priority); | ||
| if (mc.init(domain, argc, argv) != DDS::RETCODE_OK) { | ||
| return 1; | ||
| } | ||
|
|
||
| Test test; | ||
| Exiter exiter(mc, exit_after); | ||
| return mc.run(); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.