|
Harmony
HARMONic stabilitY assessment of PE-penetrated power systems
|
Interactive ImGui/ImPlot visualization for solver results. More...
#include "../../Constants.h"

Go to the source code of this file.
Classes | |
| struct | OPFVisualData |
| Container for all OPF topology and solution data needed by viz_opf(). More... | |
Functions | |
| void | visualization_stop () |
| Closes the visualization window and stops the GUI thread. | |
| void | visualization_set_embedded_mode (bool enabled) |
| Use the host ImGui/GLFW context (HarmonyUI) instead of a background window. | |
| bool | visualization_has_tabs () |
| Returns whether plot tabs are registered. | |
| void | visualization_clear_tabs () |
| Remove all registered plot tabs (e.g. | |
| void | visualization_draw_embedded (const char *tabBarId="HarmonyPlotTabs") |
| Draw plot tabs inside the current ImGui window (embedded / HarmonyUI mode). | |
| void | visualization_process_pending_save (GLFWwindow *window) |
Capture a pending PNG save after ImGui::Render() on window. | |
| bool | visualization_is_running () |
| Returns whether the visualization window is currently open. | |
| void | visualization_wait () |
| Blocks until the user closes the visualization window. | |
| void | visualization_save_tab (const std::string &tab_title, const std::filesystem::path &output_dir={}) |
| Schedules a PNG capture of the named tab on the next rendered frame. | |
| std::vector< std::string > | visualization_tab_titles () |
| Titles of tabs currently registered in the visualization window. | |
| void | add_plot_tab (const std::string &title, std::function< void()> fn) |
| Registers a custom ImGui/ImPlot draw callback as a new tab. | |
| void | bode_plot_implot (const std::vector< double > &freq, const std::vector< std::vector< double > > &mag_dB, const std::vector< std::vector< double > > &phase_deg, const std::vector< std::string > &labels, const std::string &title) |
| Opens a Bode magnitude/phase plot in the visualization window. | |
| void | nyquist_plot_implot (const std::vector< std::vector< std::complex< double > > > &H_data, const std::vector< std::string > &labels, const std::string &title) |
| Opens a Nyquist plot in the visualization window. | |
| void | plot_eigenvalues_implot (const std::vector< std::complex< double > > &eigvals, const std::string &title) |
| Plots eigenvalues in the complex plane. | |
| void | plot_participation_factors_implot (const std::vector< std::vector< double > > &P, const std::vector< std::string > &state_labels, const std::vector< std::string > &mode_labels, const std::string &title) |
| Plots participation factor heatmap (states vs modes). | |
| void | plot_abc_waveforms_implot (const std::vector< double > &t, const Eigen::MatrixXd &Xabc, const std::string &title) |
| Plots three-phase abc waveforms over time. | |
| void | plot_abc_groups_implot (const std::vector< double > &t, const std::vector< Eigen::MatrixXd > &Xabc_groups, const std::string &title) |
| Plots multiple abc waveform groups on shared axes. | |
| void | viz_opf (const OPFVisualData &data) |
| Registers an "AC/DC OPF" network diagram tab in the visualization window. | |
Interactive ImGui/ImPlot visualization for solver results.
Provides a shared GUI window with built-in Bode, Nyquist, eigenvalue, participation-factor, and abc waveform plots, plus OPF network rendering and an extension API for custom plot tabs.
| void add_plot_tab | ( | const std::string & | title, |
| std::function< void()> | fn | ||
| ) |
Registers a custom ImGui/ImPlot draw callback as a new tab.
The GUI thread is auto-started on the first call. fn is invoked every frame while the tab is active.
| title | Tab title shown in the tab bar. |
| fn | Draw callback executed each frame. |
Registers a custom ImGui/ImPlot draw callback as a new tab.
References add_tab().
|
extern |
Opens a Bode magnitude/phase plot in the visualization window.
| freq | Frequency axis (Hz). |
| mag_dB | Magnitude in dB, one vector per trace. |
| phase_deg | Phase in degrees, one vector per trace. |
| labels | Trace legend labels. |
| title | Plot window title. |
References add_tab(), j, and kHarmonyPlotPanelHeightPx.
Referenced by StabilityEstimate::bodeplotTF(), and Element::plotYParameters().
|
extern |
Opens a Nyquist plot in the visualization window.
| H_data | Complex frequency response, one vector per trace. |
| labels | Trace legend labels. |
| title | Plot window title. |
Referenced by StabilityEstimate::nyquistplotTF().
|
extern |
Plots multiple abc waveform groups on shared axes.
| t | Time axis (s). |
| Xabc_groups | One 3N matrix per signal group. |
| title | Plot window title. |
References add_tab(), and kHarmonyPlotWaveformHeightPx.
Referenced by example_DQsym_DSSS2(), example_DQsym_RLC(), and DQsym::plot().
|
extern |
Plots three-phase abc waveforms over time.
| t | Time axis (s). |
| Xabc | Waveform matrix (3 rows N samples). |
| title | Plot window title. |
References add_tab().
Referenced by example_DQsym_math_operations().
|
extern |
Plots eigenvalues in the complex plane.
| eigvals | List of eigenvalues. |
| title | Plot window title. |
References add_tab(), and kHarmonyPlotEigenHeightPx.
Referenced by Converter::plotEigenvalues().
|
extern |
Plots participation factor heatmap (states vs modes).
| P | Participation factor matrix [state][mode]. |
| state_labels | Row labels (state names). |
| mode_labels | Column labels (mode indices/names). |
| title | Plot window title. |
Referenced by Converter::plotParticipationFactors().
| void visualization_clear_tabs | ( | ) |
Remove all registered plot tabs (e.g.
before a new run).
| void visualization_draw_embedded | ( | const char * | tabBarId = "HarmonyPlotTabs" | ) |
Draw plot tabs inside the current ImGui window (embedded / HarmonyUI mode).
References draw_plot_tabs().
| bool visualization_has_tabs | ( | ) |
Returns whether plot tabs are registered.
| bool visualization_is_running | ( | ) |
Returns whether the visualization window is currently open.
Referenced by runJsonSimulation().
| void visualization_process_pending_save | ( | GLFWwindow * | window | ) |
Capture a pending PNG save after ImGui::Render() on window.
Referenced by runHarmonyLauncher().
| void visualization_save_tab | ( | const std::string & | tab_title, |
| const std::filesystem::path & | output_dir | ||
| ) |
Schedules a PNG capture of the named tab on the next rendered frame.
| tab_title | Title of the tab to capture (saved as "<tab_title>.png"). |
Schedules a PNG capture of the named tab on the next rendered frame.
The file is written as "<tab_title>.png" in the working directory. Thread-safe: can be called from any thread.
| void visualization_set_embedded_mode | ( | bool | enabled | ) |
Use the host ImGui/GLFW context (HarmonyUI) instead of a background window.
Call before any simulation runs. Prevents a second GLFW/ImGui context that can crash with ImGui focus-scope errors.
Referenced by runHarmonyLauncher().
| void visualization_stop | ( | ) |
Closes the visualization window and stops the GUI thread.
Referenced by runHarmonyLauncher().
| std::vector< std::string > visualization_tab_titles | ( | ) |
Titles of tabs currently registered in the visualization window.
| void visualization_wait | ( | ) |
Blocks until the user closes the visualization window.
Call at the end of main() to keep the process alive while the GUI is open.
Blocks until the user closes the visualization window.
Referenced by runJsonSimulation().
| void viz_opf | ( | const OPFVisualData & | data | ) |
Registers an "AC/DC OPF" network diagram tab in the visualization window.
Returns immediately; the window stays open until the user closes it or visualization_stop() / visualization_wait() is called.
| data | OPF topology and solved bus/branch quantities. |