From bc5a3e8923cb8efedbbd5b88e212eb0e9009cf87 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Thu, 5 Oct 2017 20:02:59 -0300 Subject: Add copyright on files and documentation update --- docs/doxygen/html/_about_form_8cpp_source.html | 9 +- docs/doxygen/html/_about_form_8h.html | 117 +++++ docs/doxygen/html/_about_form_8h_source.html | 12 +- docs/doxygen/html/_art_metro_8cpp_source.html | 6 + docs/doxygen/html/_art_metro_8h_source.html | 6 + docs/doxygen/html/_branch_8cpp_source.html | 28 +- docs/doxygen/html/_branch_8h_source.html | 46 +- docs/doxygen/html/_bus_8cpp_source.html | 68 +-- docs/doxygen/html/_bus_8h_source.html | 29 +- docs/doxygen/html/_bus_form_8cpp_source.html | 31 +- docs/doxygen/html/_bus_form_8h.html | 115 +++++ docs/doxygen/html/_bus_form_8h_source.html | 12 +- .../html/_bus_form_bitmaps_8cpp_source.html | 6 + docs/doxygen/html/_camera_8cpp_source.html | 9 +- docs/doxygen/html/_camera_8h.html | 115 +++++ docs/doxygen/html/_camera_8h_source.html | 10 +- docs/doxygen/html/_capacitor_8cpp_source.html | 59 +-- docs/doxygen/html/_capacitor_8h_source.html | 20 +- docs/doxygen/html/_chart_view_8cpp_source.html | 13 +- docs/doxygen/html/_chart_view_8h.html | 122 +++++ docs/doxygen/html/_chart_view_8h_source.html | 16 +- .../doxygen/html/_chart_view_base_8cpp_source.html | 6 + docs/doxygen/html/_chart_view_base_8h_source.html | 6 + .../html/_chart_view_bitmaps_8cpp_source.html | 6 + .../doxygen/html/_connection_line_8cpp_source.html | 29 +- docs/doxygen/html/_connection_line_8h.html | 115 +++++ docs/doxygen/html/_connection_line_8h_source.html | 31 +- docs/doxygen/html/_constant_8cpp_source.html | 32 +- docs/doxygen/html/_constant_8h.html | 117 +++++ docs/doxygen/html/_constant_8h_source.html | 29 +- docs/doxygen/html/_constant_form_8cpp_source.html | 12 +- docs/doxygen/html/_constant_form_8h.html | 115 +++++ docs/doxygen/html/_constant_form_8h_source.html | 14 +- docs/doxygen/html/_control_editor_8cpp_source.html | 92 ++-- docs/doxygen/html/_control_editor_8h.html | 145 ++++++ docs/doxygen/html/_control_editor_8h.js | 16 + docs/doxygen/html/_control_editor_8h_source.html | 48 +- .../html/_control_editor_base_8cpp_source.html | 6 + .../html/_control_editor_base_8h_source.html | 6 + .../html/_control_editor_bitmaps_8cpp_source.html | 6 + .../doxygen/html/_control_element_8cpp_source.html | 15 +- docs/doxygen/html/_control_element_8h.html | 124 +++++ docs/doxygen/html/_control_element_8h_source.html | 14 +- .../_control_element_container_8cpp_source.html | 47 +- .../html/_control_element_container_8h.html | 125 ++++++ .../html/_control_element_container_8h_source.html | 22 +- .../html/_control_element_solver_8cpp_source.html | 37 +- docs/doxygen/html/_control_element_solver_8h.html | 116 +++++ .../html/_control_element_solver_8h_source.html | 34 +- .../html/_control_system_test_8cpp_source.html | 12 +- docs/doxygen/html/_control_system_test_8h.html | 115 +++++ .../html/_control_system_test_8h_source.html | 14 +- docs/doxygen/html/_data_report_8cpp_source.html | 42 +- docs/doxygen/html/_data_report_8h.html | 115 +++++ docs/doxygen/html/_data_report_8h_source.html | 16 +- .../html/_data_report_base_8cpp_source.html | 6 + docs/doxygen/html/_data_report_base_8h_source.html | 6 + .../html/_data_report_bitmaps_8cpp_source.html | 6 + .../html/_degrees_and_radians_8h_source.html | 6 + .../html/_electric_calculation_8cpp_source.html | 86 ++-- docs/doxygen/html/_electric_calculation_8h.html | 6 + .../html/_electric_calculation_8h_source.html | 30 +- .../html/_electromechanical_8cpp_source.html | 67 +-- docs/doxygen/html/_electromechanical_8h.html | 126 ++++++ .../doxygen/html/_electromechanical_8h_source.html | 24 +- docs/doxygen/html/_element_8cpp_source.html | 68 +-- docs/doxygen/html/_element_8h.html | 13 +- docs/doxygen/html/_element_8h_source.html | 132 +++--- .../html/_element_data_object_8cpp_source.html | 14 +- .../html/_element_data_object_8h_source.html | 11 +- docs/doxygen/html/_element_form_8cpp_source.html | 6 + docs/doxygen/html/_element_form_8h_source.html | 6 + .../html/_element_form_bitmaps_8cpp_source.html | 6 + .../html/_element_plot_data_8cpp_source.html | 8 +- .../doxygen/html/_element_plot_data_8h_source.html | 10 +- docs/doxygen/html/_exponential_8cpp_source.html | 26 +- docs/doxygen/html/_exponential_8h.html | 115 +++++ docs/doxygen/html/_exponential_8h_source.html | 29 +- .../html/_exponential_form_8cpp_source.html | 12 +- docs/doxygen/html/_exponential_form_8h.html | 115 +++++ docs/doxygen/html/_exponential_form_8h_source.html | 14 +- docs/doxygen/html/_fault_8cpp_source.html | 56 +-- docs/doxygen/html/_fault_8h.html | 6 + docs/doxygen/html/_fault_8h_source.html | 24 +- docs/doxygen/html/_file_handing_8cpp_source.html | 197 ++++---- docs/doxygen/html/_file_handing_8h.html | 125 ++++++ docs/doxygen/html/_file_handing_8h_source.html | 21 +- docs/doxygen/html/_formulas.tex | 8 + docs/doxygen/html/_gain_8cpp_source.html | 28 +- docs/doxygen/html/_gain_8h.html | 117 +++++ docs/doxygen/html/_gain_8h_source.html | 31 +- docs/doxygen/html/_gain_form_8cpp_source.html | 10 +- docs/doxygen/html/_gain_form_8h.html | 115 +++++ docs/doxygen/html/_gain_form_8h_source.html | 12 +- .../html/_general_properties_form_8cpp_source.html | 9 +- docs/doxygen/html/_general_properties_form_8h.html | 117 +++++ .../html/_general_properties_form_8h_source.html | 12 +- .../html/_generator_stab_form_8cpp_source.html | 22 +- docs/doxygen/html/_generator_stab_form_8h.html | 115 +++++ .../html/_generator_stab_form_8h_source.html | 18 +- .../html/_graphical_element_8cpp_source.html | 8 +- .../doxygen/html/_graphical_element_8h_source.html | 10 +- docs/doxygen/html/_i_o_control_8cpp_source.html | 32 +- docs/doxygen/html/_i_o_control_8h.html | 117 +++++ docs/doxygen/html/_i_o_control_8h_source.html | 29 +- .../html/_i_o_control_form_8cpp_source.html | 11 +- docs/doxygen/html/_i_o_control_form_8h.html | 116 +++++ docs/doxygen/html/_i_o_control_form_8h_source.html | 15 +- docs/doxygen/html/_ind_motor_8cpp_source.html | 45 +- docs/doxygen/html/_ind_motor_8h_source.html | 22 +- docs/doxygen/html/_ind_motor_form_8cpp_source.html | 27 +- docs/doxygen/html/_ind_motor_form_8h.html | 115 +++++ docs/doxygen/html/_ind_motor_form_8h_source.html | 14 +- docs/doxygen/html/_inductor_8cpp_source.html | 59 +-- docs/doxygen/html/_inductor_8h_source.html | 20 +- docs/doxygen/html/_limiter_8cpp_source.html | 26 +- docs/doxygen/html/_limiter_8h.html | 115 +++++ docs/doxygen/html/_limiter_8h_source.html | 29 +- docs/doxygen/html/_limiter_form_8cpp_source.html | 10 +- docs/doxygen/html/_limiter_form_8h.html | 115 +++++ docs/doxygen/html/_limiter_form_8h_source.html | 12 +- docs/doxygen/html/_line_8cpp_source.html | 92 ++-- docs/doxygen/html/_line_8h_source.html | 27 +- docs/doxygen/html/_line_form_8cpp_source.html | 36 +- docs/doxygen/html/_line_form_8h.html | 115 +++++ docs/doxygen/html/_line_form_8h_source.html | 14 +- docs/doxygen/html/_load_8cpp_source.html | 62 +-- docs/doxygen/html/_load_8h_source.html | 21 +- docs/doxygen/html/_load_form_8cpp_source.html | 30 +- docs/doxygen/html/_load_form_8h.html | 115 +++++ docs/doxygen/html/_load_form_8h_source.html | 14 +- docs/doxygen/html/_machines_8cpp_source.html | 56 ++- docs/doxygen/html/_machines_8h_source.html | 46 +- docs/doxygen/html/_main_frame_8cpp_source.html | 62 ++- docs/doxygen/html/_main_frame_8h.html | 137 ++++++ docs/doxygen/html/_main_frame_8h.js | 13 + docs/doxygen/html/_main_frame_8h_source.html | 28 +- .../doxygen/html/_main_frame_base_8cpp_source.html | 6 + docs/doxygen/html/_main_frame_base_8h_source.html | 6 + .../html/_main_frame_bitmaps_8cpp_source.html | 6 + docs/doxygen/html/_multiplier_8cpp_source.html | 24 +- docs/doxygen/html/_multiplier_8h.html | 115 +++++ docs/doxygen/html/_multiplier_8h_source.html | 29 +- docs/doxygen/html/_power_element_8cpp_source.html | 56 +-- docs/doxygen/html/_power_element_8h.html | 14 +- docs/doxygen/html/_power_element_8h_source.html | 116 ++--- docs/doxygen/html/_power_flow_8cpp_source.html | 32 +- docs/doxygen/html/_power_flow_8h_source.html | 10 +- .../doxygen/html/_properties_data_8cpp_source.html | 8 +- docs/doxygen/html/_properties_data_8h_source.html | 16 +- .../doxygen/html/_properties_form_8cpp_source.html | 8 +- docs/doxygen/html/_properties_form_8h_source.html | 6 + .../html/_properties_form_bitmaps_8cpp_source.html | 6 + docs/doxygen/html/_rate_limiter_8cpp_source.html | 27 +- docs/doxygen/html/_rate_limiter_8h.html | 116 +++++ docs/doxygen/html/_rate_limiter_8h_source.html | 30 +- .../html/_rate_limiter_form_8cpp_source.html | 10 +- docs/doxygen/html/_rate_limiter_form_8h.html | 115 +++++ .../doxygen/html/_rate_limiter_form_8h_source.html | 12 +- .../_reactive_shunt_element_form_8cpp_source.html | 28 +- .../html/_reactive_shunt_element_form_8h.html | 116 +++++ .../_reactive_shunt_element_form_8h_source.html | 16 +- docs/doxygen/html/_shunt_8cpp_source.html | 38 +- docs/doxygen/html/_shunt_8h_source.html | 32 +- .../_simulations_settings_form_8cpp_source.html | 21 +- .../html/_simulations_settings_form_8h.html | 115 +++++ .../html/_simulations_settings_form_8h_source.html | 12 +- docs/doxygen/html/_sum_8cpp_source.html | 30 +- docs/doxygen/html/_sum_8h_source.html | 29 +- docs/doxygen/html/_sum_form_8cpp_source.html | 9 +- docs/doxygen/html/_sum_form_8h.html | 115 +++++ docs/doxygen/html/_sum_form_8h_source.html | 12 +- docs/doxygen/html/_switching_form_8cpp_source.html | 21 +- docs/doxygen/html/_switching_form_8h.html | 115 +++++ docs/doxygen/html/_switching_form_8h_source.html | 12 +- docs/doxygen/html/_sync_generator_8cpp_source.html | 50 ++- docs/doxygen/html/_sync_generator_8h_source.html | 34 +- .../html/_sync_machine_form_8cpp_source.html | 40 +- docs/doxygen/html/_sync_machine_form_8h.html | 115 +++++ .../doxygen/html/_sync_machine_form_8h_source.html | 16 +- docs/doxygen/html/_sync_motor_8cpp_source.html | 43 +- docs/doxygen/html/_sync_motor_8h_source.html | 32 +- docs/doxygen/html/_text_8cpp_source.html | 103 +++-- docs/doxygen/html/_text_8h_source.html | 44 +- docs/doxygen/html/_text_form_8cpp_source.html | 59 +-- docs/doxygen/html/_text_form_8h.html | 117 +++++ docs/doxygen/html/_text_form_8h_source.html | 14 +- .../html/_transfer_function_8cpp_source.html | 27 +- .../doxygen/html/_transfer_function_8h_source.html | 29 +- .../html/_transfer_function_form_8cpp_source.html | 11 +- docs/doxygen/html/_transfer_function_form_8h.html | 115 +++++ .../html/_transfer_function_form_8h_source.html | 12 +- docs/doxygen/html/_transformer_8cpp_source.html | 79 ++-- docs/doxygen/html/_transformer_8h_source.html | 26 +- .../html/_transformer_form_8cpp_source.html | 30 +- docs/doxygen/html/_transformer_form_8h.html | 115 +++++ docs/doxygen/html/_transformer_form_8h_source.html | 14 +- docs/doxygen/html/_workspace_8cpp_source.html | 152 ++++--- docs/doxygen/html/_workspace_8h.html | 145 ++++++ docs/doxygen/html/_workspace_8h.js | 17 + docs/doxygen/html/_workspace_8h_source.html | 47 +- docs/doxygen/html/_workspace_base_8cpp_source.html | 6 + docs/doxygen/html/_workspace_base_8h_source.html | 6 + .../html/_workspace_bitmaps_8cpp_source.html | 6 + docs/doxygen/html/annotated.html | 122 ++--- docs/doxygen/html/annotated_dup.js | 1 + docs/doxygen/html/class_about_form-members.html | 6 + docs/doxygen/html/class_about_form.html | 18 +- .../html/class_about_form_base-members.html | 6 + docs/doxygen/html/class_about_form_base.html | 8 +- docs/doxygen/html/class_branch-members.html | 6 + docs/doxygen/html/class_branch.html | 44 +- docs/doxygen/html/class_bus-members.html | 6 + docs/doxygen/html/class_bus.html | 36 +- docs/doxygen/html/class_bus_form-members.html | 6 + docs/doxygen/html/class_bus_form.html | 18 +- docs/doxygen/html/class_bus_form_base-members.html | 6 + docs/doxygen/html/class_bus_form_base.html | 8 +- docs/doxygen/html/class_camera-members.html | 6 + docs/doxygen/html/class_camera.html | 18 +- docs/doxygen/html/class_capacitor-members.html | 6 + docs/doxygen/html/class_capacitor.html | 28 +- docs/doxygen/html/class_chart_view-members.html | 6 + docs/doxygen/html/class_chart_view.html | 18 +- .../html/class_chart_view_base-members.html | 6 + docs/doxygen/html/class_chart_view_base.html | 8 +- .../html/class_connection_line-members.html | 6 + docs/doxygen/html/class_connection_line.html | 32 +- docs/doxygen/html/class_constant-members.html | 6 + docs/doxygen/html/class_constant.html | 30 +- docs/doxygen/html/class_constant_form-members.html | 6 + docs/doxygen/html/class_constant_form.html | 18 +- .../html/class_constant_form_base-members.html | 6 + docs/doxygen/html/class_constant_form_base.html | 8 +- .../doxygen/html/class_control_editor-members.html | 6 + docs/doxygen/html/class_control_editor.html | 8 +- .../html/class_control_editor_base-members.html | 6 + docs/doxygen/html/class_control_editor_base.html | 6 + .../html/class_control_element-members.html | 6 + docs/doxygen/html/class_control_element.html | 34 +- .../html/class_control_element_button-members.html | 6 + .../doxygen/html/class_control_element_button.html | 18 +- .../class_control_element_container-members.html | 6 + .../html/class_control_element_container.html | 18 +- .../html/class_control_element_solver-members.html | 6 + .../doxygen/html/class_control_element_solver.html | 18 +- .../html/class_control_system_test-members.html | 6 + docs/doxygen/html/class_control_system_test.html | 18 +- .../class_control_system_test_base-members.html | 6 + .../html/class_control_system_test_base.html | 8 +- docs/doxygen/html/class_data_report-members.html | 6 + docs/doxygen/html/class_data_report.html | 18 +- .../html/class_data_report_base-members.html | 6 + docs/doxygen/html/class_data_report_base.html | 8 +- .../html/class_electric_calculation-members.html | 6 + docs/doxygen/html/class_electric_calculation.html | 34 +- .../html/class_electromechanical-members.html | 108 +++-- docs/doxygen/html/class_electromechanical.html | 56 ++- docs/doxygen/html/class_electromechanical.js | 14 +- docs/doxygen/html/class_element-members.html | 6 + docs/doxygen/html/class_element.html | 184 ++++---- .../html/class_element_data_object-members.html | 6 + docs/doxygen/html/class_element_data_object.html | 8 +- .../html/class_element_plot_data-members.html | 6 + docs/doxygen/html/class_element_plot_data.html | 8 +- docs/doxygen/html/class_exponential-members.html | 6 + docs/doxygen/html/class_exponential.html | 30 +- .../html/class_exponential_form-members.html | 6 + docs/doxygen/html/class_exponential_form.html | 18 +- .../html/class_exponential_form_base-members.html | 6 + docs/doxygen/html/class_exponential_form_base.html | 8 +- docs/doxygen/html/class_fault-members.html | 6 + docs/doxygen/html/class_fault.html | 18 +- docs/doxygen/html/class_file_handing-members.html | 6 + docs/doxygen/html/class_file_handing.html | 18 +- docs/doxygen/html/class_gain-members.html | 6 + docs/doxygen/html/class_gain.html | 32 +- docs/doxygen/html/class_gain_form-members.html | 6 + docs/doxygen/html/class_gain_form.html | 18 +- .../doxygen/html/class_gain_form_base-members.html | 6 + docs/doxygen/html/class_gain_form_base.html | 8 +- .../class_general_properties_form-members.html | 6 + .../html/class_general_properties_form.html | 18 +- ...class_general_properties_form_base-members.html | 6 + .../html/class_general_properties_form_base.html | 8 +- .../html/class_generator_stab_form-members.html | 6 + docs/doxygen/html/class_generator_stab_form.html | 18 +- .../class_generator_stab_form_base-members.html | 6 + .../html/class_generator_stab_form_base.html | 8 +- .../html/class_graphical_element-members.html | 6 + docs/doxygen/html/class_graphical_element.html | 8 +- docs/doxygen/html/class_i_o_control-members.html | 6 + docs/doxygen/html/class_i_o_control.html | 30 +- .../html/class_i_o_control_form-members.html | 6 + docs/doxygen/html/class_i_o_control_form.html | 18 +- .../html/class_i_o_control_form_base-members.html | 6 + docs/doxygen/html/class_i_o_control_form_base.html | 8 +- docs/doxygen/html/class_ind_motor-members.html | 6 + docs/doxygen/html/class_ind_motor.html | 16 +- .../doxygen/html/class_ind_motor_form-members.html | 6 + docs/doxygen/html/class_ind_motor_form.html | 18 +- .../html/class_ind_motor_form_base-members.html | 6 + docs/doxygen/html/class_ind_motor_form_base.html | 8 +- docs/doxygen/html/class_inductor-members.html | 6 + docs/doxygen/html/class_inductor.html | 28 +- docs/doxygen/html/class_limiter-members.html | 6 + docs/doxygen/html/class_limiter.html | 30 +- docs/doxygen/html/class_limiter_form-members.html | 6 + docs/doxygen/html/class_limiter_form.html | 18 +- .../html/class_limiter_form_base-members.html | 6 + docs/doxygen/html/class_limiter_form_base.html | 8 +- docs/doxygen/html/class_line-members.html | 6 + docs/doxygen/html/class_line.html | 58 +-- docs/doxygen/html/class_line_form-members.html | 6 + docs/doxygen/html/class_line_form.html | 18 +- .../doxygen/html/class_line_form_base-members.html | 6 + docs/doxygen/html/class_line_form_base.html | 8 +- docs/doxygen/html/class_load-members.html | 6 + docs/doxygen/html/class_load.html | 24 +- docs/doxygen/html/class_load_form-members.html | 6 + docs/doxygen/html/class_load_form.html | 18 +- .../doxygen/html/class_load_form_base-members.html | 6 + docs/doxygen/html/class_load_form_base.html | 8 +- docs/doxygen/html/class_machines-members.html | 6 + docs/doxygen/html/class_machines.html | 42 +- docs/doxygen/html/class_main_app-members.html | 6 + docs/doxygen/html/class_main_app.html | 8 +- docs/doxygen/html/class_main_frame-members.html | 12 +- docs/doxygen/html/class_main_frame.html | 87 +++- docs/doxygen/html/class_main_frame.js | 2 +- .../html/class_main_frame_base-members.html | 6 + docs/doxygen/html/class_main_frame_base.html | 8 +- docs/doxygen/html/class_multiplier-members.html | 6 + docs/doxygen/html/class_multiplier.html | 30 +- docs/doxygen/html/class_node-members.html | 6 + docs/doxygen/html/class_node.html | 18 +- .../html/class_open_g_l_colour-members.html | 6 + docs/doxygen/html/class_open_g_l_colour.html | 14 +- docs/doxygen/html/class_plot_data-members.html | 6 + docs/doxygen/html/class_plot_data.html | 8 +- docs/doxygen/html/class_power_element-members.html | 6 + docs/doxygen/html/class_power_element.html | 30 +- docs/doxygen/html/class_power_flow-members.html | 6 + docs/doxygen/html/class_power_flow.html | 8 +- .../html/class_properties_data-members.html | 6 + docs/doxygen/html/class_properties_data.html | 8 +- docs/doxygen/html/class_rate_limiter-members.html | 8 +- docs/doxygen/html/class_rate_limiter.html | 118 ++++- .../html/class_rate_limiter_form-members.html | 6 + docs/doxygen/html/class_rate_limiter_form.html | 18 +- .../html/class_rate_limiter_form_base-members.html | 6 + .../doxygen/html/class_rate_limiter_form_base.html | 8 +- .../class_reactive_shunt_element_form-members.html | 6 + .../html/class_reactive_shunt_element_form.html | 18 +- ...s_reactive_shunt_element_form_base-members.html | 6 + .../class_reactive_shunt_element_form_base.html | 8 +- docs/doxygen/html/class_shunt-members.html | 6 + docs/doxygen/html/class_shunt.html | 32 +- .../class_simulations_settings_form-members.html | 6 + .../html/class_simulations_settings_form.html | 18 +- ...ass_simulations_settings_form_base-members.html | 6 + .../html/class_simulations_settings_form_base.html | 8 +- docs/doxygen/html/class_sum-members.html | 6 + docs/doxygen/html/class_sum.html | 20 +- docs/doxygen/html/class_sum_form-members.html | 6 + docs/doxygen/html/class_sum_form.html | 18 +- docs/doxygen/html/class_sum_form_base-members.html | 6 + docs/doxygen/html/class_sum_form_base.html | 8 +- .../doxygen/html/class_switching_form-members.html | 6 + docs/doxygen/html/class_switching_form.html | 18 +- .../html/class_switching_form_base-members.html | 6 + docs/doxygen/html/class_switching_form_base.html | 8 +- .../doxygen/html/class_sync_generator-members.html | 6 + docs/doxygen/html/class_sync_generator.html | 20 +- .../html/class_sync_machine_form-members.html | 6 + docs/doxygen/html/class_sync_machine_form.html | 18 +- .../html/class_sync_machine_form_base-members.html | 6 + .../doxygen/html/class_sync_machine_form_base.html | 8 +- docs/doxygen/html/class_sync_motor-members.html | 6 + docs/doxygen/html/class_sync_motor.html | 18 +- docs/doxygen/html/class_text-members.html | 6 + docs/doxygen/html/class_text.html | 20 +- docs/doxygen/html/class_text_form-members.html | 6 + docs/doxygen/html/class_text_form.html | 18 +- .../doxygen/html/class_text_form_base-members.html | 6 + docs/doxygen/html/class_text_form_base.html | 8 +- .../html/class_text_g_l_drawable-members.html | 6 + docs/doxygen/html/class_text_g_l_drawable.html | 6 + docs/doxygen/html/class_text_texture-members.html | 6 + docs/doxygen/html/class_text_texture.html | 6 + .../html/class_transfer_function-members.html | 6 + docs/doxygen/html/class_transfer_function.html | 20 +- .../html/class_transfer_function_form-members.html | 6 + .../doxygen/html/class_transfer_function_form.html | 18 +- .../class_transfer_function_form_base-members.html | 6 + .../html/class_transfer_function_form_base.html | 8 +- docs/doxygen/html/class_transformer-members.html | 6 + docs/doxygen/html/class_transformer.html | 48 +- .../html/class_transformer_form-members.html | 6 + docs/doxygen/html/class_transformer_form.html | 18 +- .../html/class_transformer_form_base-members.html | 6 + docs/doxygen/html/class_transformer_form_base.html | 8 +- docs/doxygen/html/class_workspace-members.html | 6 + docs/doxygen/html/class_workspace.html | 18 +- .../doxygen/html/class_workspace_base-members.html | 6 + docs/doxygen/html/class_workspace_base.html | 8 +- docs/doxygen/html/classes.html | 56 +-- .../html/classwx_g_l_number_renderer-members.html | 6 + docs/doxygen/html/classwx_g_l_number_renderer.html | 6 + docs/doxygen/html/classwx_g_l_string-members.html | 6 + docs/doxygen/html/classwx_g_l_string.html | 6 + .../html/classwx_g_l_string_array-members.html | 6 + docs/doxygen/html/classwx_g_l_string_array.html | 6 + .../classwx_ribbon_metro_art_provider-members.html | 6 + .../html/classwx_ribbon_metro_art_provider.html | 6 + .../html/dir_ffd1f789ec7bd0a45fc6ad92579c5070.html | 90 ++++ .../html/dir_ffd1f789ec7bd0a45fc6ad92579c5070.js | 160 +++++-- docs/doxygen/html/files.html | 88 ++-- docs/doxygen/html/functions.html | 6 + docs/doxygen/html/functions_0x7e.html | 9 + docs/doxygen/html/functions_b.html | 6 + docs/doxygen/html/functions_c.html | 6 + docs/doxygen/html/functions_d.html | 6 + docs/doxygen/html/functions_dup.js | 1 + docs/doxygen/html/functions_e.html | 12 + docs/doxygen/html/functions_f.html | 6 + docs/doxygen/html/functions_func.html | 6 + docs/doxygen/html/functions_func_0x7e.html | 9 + docs/doxygen/html/functions_func_b.html | 6 + docs/doxygen/html/functions_func_c.html | 6 + docs/doxygen/html/functions_func_d.html | 6 + docs/doxygen/html/functions_func_e.html | 6 + docs/doxygen/html/functions_func_f.html | 6 + docs/doxygen/html/functions_func_g.html | 6 + docs/doxygen/html/functions_func_h.html | 6 + docs/doxygen/html/functions_func_i.html | 6 + docs/doxygen/html/functions_func_m.html | 9 + docs/doxygen/html/functions_func_n.html | 6 + docs/doxygen/html/functions_func_o.html | 6 + docs/doxygen/html/functions_func_p.html | 6 + docs/doxygen/html/functions_func_r.html | 6 + docs/doxygen/html/functions_func_s.html | 9 + docs/doxygen/html/functions_func_u.html | 6 + docs/doxygen/html/functions_func_w.html | 6 + docs/doxygen/html/functions_g.html | 6 + docs/doxygen/html/functions_h.html | 6 + docs/doxygen/html/functions_i.html | 6 + docs/doxygen/html/functions_m.html | 9 + docs/doxygen/html/functions_n.html | 6 + docs/doxygen/html/functions_o.html | 6 + docs/doxygen/html/functions_p.html | 6 + docs/doxygen/html/functions_r.html | 6 + docs/doxygen/html/functions_s.html | 9 + docs/doxygen/html/functions_u.html | 6 + docs/doxygen/html/functions_vars.html | 18 + docs/doxygen/html/functions_w.html | 6 + docs/doxygen/html/functions_x.html | 108 +++++ docs/doxygen/html/globals.html | 6 + docs/doxygen/html/globals_enum.html | 6 + docs/doxygen/html/globals_eval.html | 6 + docs/doxygen/html/hierarchy.html | 186 ++++---- docs/doxygen/html/hierarchy.js | 1 + docs/doxygen/html/index.html | 10 +- docs/doxygen/html/main_8cpp_source.html | 13 +- docs/doxygen/html/menudata.js | 1 + docs/doxygen/html/navtreedata.js | 26 +- docs/doxygen/html/navtreeindex0.js | 106 ++--- docs/doxygen/html/navtreeindex1.js | 146 +++--- docs/doxygen/html/navtreeindex10.js | 484 ++++++++++---------- docs/doxygen/html/navtreeindex11.js | 500 ++++++++++----------- docs/doxygen/html/navtreeindex12.js | 216 ++++----- docs/doxygen/html/navtreeindex13.js | 310 ++++++++----- docs/doxygen/html/navtreeindex2.js | 146 +++--- docs/doxygen/html/navtreeindex3.js | 146 +++--- docs/doxygen/html/navtreeindex4.js | 180 ++++---- docs/doxygen/html/navtreeindex5.js | 158 +++---- docs/doxygen/html/navtreeindex6.js | 158 +++---- docs/doxygen/html/navtreeindex7.js | 160 +++---- docs/doxygen/html/navtreeindex8.js | 158 +++---- docs/doxygen/html/navtreeindex9.js | 158 +++---- docs/doxygen/html/search/all_0.js | 1 + docs/doxygen/html/search/all_1.js | 1 + docs/doxygen/html/search/all_10.js | 3 + docs/doxygen/html/search/all_12.js | 1 + docs/doxygen/html/search/all_13.js | 7 +- docs/doxygen/html/search/all_14.html | 26 ++ docs/doxygen/html/search/all_14.js | 9 + docs/doxygen/html/search/all_2.js | 10 + docs/doxygen/html/search/all_3.js | 1 + docs/doxygen/html/search/all_4.js | 5 + docs/doxygen/html/search/all_5.js | 3 +- docs/doxygen/html/search/all_6.js | 4 + docs/doxygen/html/search/all_8.js | 3 + docs/doxygen/html/search/all_9.js | 4 + docs/doxygen/html/search/all_a.js | 6 +- docs/doxygen/html/search/all_e.js | 3 + docs/doxygen/html/search/all_f.js | 6 + docs/doxygen/html/search/classes_e.js | 1 + docs/doxygen/html/search/files_0.js | 3 +- docs/doxygen/html/search/files_1.js | 2 +- docs/doxygen/html/search/files_2.js | 11 +- docs/doxygen/html/search/files_3.html | 26 ++ docs/doxygen/html/search/files_3.js | 4 + docs/doxygen/html/search/files_4.html | 26 ++ docs/doxygen/html/search/files_4.js | 8 + docs/doxygen/html/search/files_5.html | 26 ++ docs/doxygen/html/search/files_5.js | 5 + docs/doxygen/html/search/files_6.html | 26 ++ docs/doxygen/html/search/files_6.js | 7 + docs/doxygen/html/search/files_7.html | 26 ++ docs/doxygen/html/search/files_7.js | 6 + docs/doxygen/html/search/files_8.html | 26 ++ docs/doxygen/html/search/files_8.js | 7 + docs/doxygen/html/search/files_9.html | 26 ++ docs/doxygen/html/search/files_9.js | 5 + docs/doxygen/html/search/files_a.html | 26 ++ docs/doxygen/html/search/files_a.js | 4 + docs/doxygen/html/search/files_b.html | 26 ++ docs/doxygen/html/search/files_b.js | 6 + docs/doxygen/html/search/files_c.html | 26 ++ docs/doxygen/html/search/files_c.js | 7 + docs/doxygen/html/search/files_d.html | 26 ++ docs/doxygen/html/search/files_d.js | 6 + docs/doxygen/html/search/files_e.html | 26 ++ docs/doxygen/html/search/files_e.js | 4 + docs/doxygen/html/search/functions_11.js | 1 + docs/doxygen/html/search/functions_9.js | 1 + docs/doxygen/html/search/functions_e.js | 1 + docs/doxygen/html/search/searchdata.js | 6 +- docs/doxygen/html/search/variables_1.js | 3 +- docs/doxygen/html/search/variables_2.js | 3 +- docs/doxygen/html/search/variables_3.html | 26 ++ docs/doxygen/html/search/variables_3.js | 5 + docs/doxygen/html/search/variables_4.html | 26 ++ docs/doxygen/html/search/variables_4.js | 5 + .../html/struct_bus_electrical_data-members.html | 6 + docs/doxygen/html/struct_bus_electrical_data.html | 12 +- .../struct_capacitor_electrical_data-members.html | 6 + .../html/struct_capacitor_electrical_data.html | 8 +- .../html/struct_elements_lists-members.html | 6 + docs/doxygen/html/struct_elements_lists.html | 8 +- docs/doxygen/html/struct_general_data-members.html | 6 + docs/doxygen/html/struct_general_data.html | 8 +- .../struct_ind_motor_electrical_data-members.html | 6 + .../html/struct_ind_motor_electrical_data.html | 8 +- .../struct_inductor_electrical_data-members.html | 6 + .../html/struct_inductor_electrical_data.html | 8 +- .../html/struct_integration_constant-members.html | 6 + docs/doxygen/html/struct_integration_constant.html | 12 +- .../html/struct_line_electrical_data-members.html | 6 + docs/doxygen/html/struct_line_electrical_data.html | 8 +- .../html/struct_load_electrical_data-members.html | 6 + docs/doxygen/html/struct_load_electrical_data.html | 8 +- .../html/struct_reactive_limits-members.html | 6 + docs/doxygen/html/struct_reactive_limits.html | 8 +- .../html/struct_simulation_data-members.html | 6 + docs/doxygen/html/struct_simulation_data.html | 8 +- .../html/struct_switching_data-members.html | 6 + docs/doxygen/html/struct_switching_data.html | 12 +- ...uct_sync_generator_electrical_data-members.html | 22 +- .../struct_sync_generator_electrical_data.html | 28 +- .../html/struct_sync_generator_electrical_data.js | 6 + .../struct_sync_machine_model_data-members.html | 109 +++++ .../html/struct_sync_machine_model_data.html | 200 +++++++++ .../doxygen/html/struct_sync_machine_model_data.js | 7 + .../struct_sync_motor_electrical_data-members.html | 6 + .../html/struct_sync_motor_electrical_data.html | 10 +- ..._transfer_function_1_1_space_state-members.html | 6 + .../struct_transfer_function_1_1_space_state.html | 8 +- ...struct_transformer_electrical_data-members.html | 6 + .../html/struct_transformer_electrical_data.html | 12 +- docs/doxygen/html/wx_g_l_string_8cpp_source.html | 6 + docs/doxygen/html/wx_g_l_string_8h_source.html | 6 + 573 files changed, 13529 insertions(+), 4002 deletions(-) create mode 100644 docs/doxygen/html/_about_form_8h.html create mode 100644 docs/doxygen/html/_bus_form_8h.html create mode 100644 docs/doxygen/html/_camera_8h.html create mode 100644 docs/doxygen/html/_chart_view_8h.html create mode 100644 docs/doxygen/html/_connection_line_8h.html create mode 100644 docs/doxygen/html/_constant_8h.html create mode 100644 docs/doxygen/html/_constant_form_8h.html create mode 100644 docs/doxygen/html/_control_editor_8h.html create mode 100644 docs/doxygen/html/_control_editor_8h.js create mode 100644 docs/doxygen/html/_control_element_8h.html create mode 100644 docs/doxygen/html/_control_element_container_8h.html create mode 100644 docs/doxygen/html/_control_element_solver_8h.html create mode 100644 docs/doxygen/html/_control_system_test_8h.html create mode 100644 docs/doxygen/html/_data_report_8h.html create mode 100644 docs/doxygen/html/_electromechanical_8h.html create mode 100644 docs/doxygen/html/_exponential_8h.html create mode 100644 docs/doxygen/html/_exponential_form_8h.html create mode 100644 docs/doxygen/html/_file_handing_8h.html create mode 100644 docs/doxygen/html/_formulas.tex create mode 100644 docs/doxygen/html/_gain_8h.html create mode 100644 docs/doxygen/html/_gain_form_8h.html create mode 100644 docs/doxygen/html/_general_properties_form_8h.html create mode 100644 docs/doxygen/html/_generator_stab_form_8h.html create mode 100644 docs/doxygen/html/_i_o_control_8h.html create mode 100644 docs/doxygen/html/_i_o_control_form_8h.html create mode 100644 docs/doxygen/html/_ind_motor_form_8h.html create mode 100644 docs/doxygen/html/_limiter_8h.html create mode 100644 docs/doxygen/html/_limiter_form_8h.html create mode 100644 docs/doxygen/html/_line_form_8h.html create mode 100644 docs/doxygen/html/_load_form_8h.html create mode 100644 docs/doxygen/html/_main_frame_8h.html create mode 100644 docs/doxygen/html/_main_frame_8h.js create mode 100644 docs/doxygen/html/_multiplier_8h.html create mode 100644 docs/doxygen/html/_rate_limiter_8h.html create mode 100644 docs/doxygen/html/_rate_limiter_form_8h.html create mode 100644 docs/doxygen/html/_reactive_shunt_element_form_8h.html create mode 100644 docs/doxygen/html/_simulations_settings_form_8h.html create mode 100644 docs/doxygen/html/_sum_form_8h.html create mode 100644 docs/doxygen/html/_switching_form_8h.html create mode 100644 docs/doxygen/html/_sync_machine_form_8h.html create mode 100644 docs/doxygen/html/_text_form_8h.html create mode 100644 docs/doxygen/html/_transfer_function_form_8h.html create mode 100644 docs/doxygen/html/_transformer_form_8h.html create mode 100644 docs/doxygen/html/_workspace_8h.html create mode 100644 docs/doxygen/html/_workspace_8h.js create mode 100644 docs/doxygen/html/functions_x.html create mode 100644 docs/doxygen/html/search/all_14.html create mode 100644 docs/doxygen/html/search/all_14.js create mode 100644 docs/doxygen/html/search/files_3.html create mode 100644 docs/doxygen/html/search/files_3.js create mode 100644 docs/doxygen/html/search/files_4.html create mode 100644 docs/doxygen/html/search/files_4.js create mode 100644 docs/doxygen/html/search/files_5.html create mode 100644 docs/doxygen/html/search/files_5.js create mode 100644 docs/doxygen/html/search/files_6.html create mode 100644 docs/doxygen/html/search/files_6.js create mode 100644 docs/doxygen/html/search/files_7.html create mode 100644 docs/doxygen/html/search/files_7.js create mode 100644 docs/doxygen/html/search/files_8.html create mode 100644 docs/doxygen/html/search/files_8.js create mode 100644 docs/doxygen/html/search/files_9.html create mode 100644 docs/doxygen/html/search/files_9.js create mode 100644 docs/doxygen/html/search/files_a.html create mode 100644 docs/doxygen/html/search/files_a.js create mode 100644 docs/doxygen/html/search/files_b.html create mode 100644 docs/doxygen/html/search/files_b.js create mode 100644 docs/doxygen/html/search/files_c.html create mode 100644 docs/doxygen/html/search/files_c.js create mode 100644 docs/doxygen/html/search/files_d.html create mode 100644 docs/doxygen/html/search/files_d.js create mode 100644 docs/doxygen/html/search/files_e.html create mode 100644 docs/doxygen/html/search/files_e.js create mode 100644 docs/doxygen/html/search/variables_3.html create mode 100644 docs/doxygen/html/search/variables_3.js create mode 100644 docs/doxygen/html/search/variables_4.html create mode 100644 docs/doxygen/html/search/variables_4.js create mode 100644 docs/doxygen/html/struct_sync_machine_model_data-members.html create mode 100644 docs/doxygen/html/struct_sync_machine_model_data.html create mode 100644 docs/doxygen/html/struct_sync_machine_model_data.js (limited to 'docs/doxygen') diff --git a/docs/doxygen/html/_about_form_8cpp_source.html b/docs/doxygen/html/_about_form_8cpp_source.html index 8a9ad94..54c7a2f 100644 --- a/docs/doxygen/html/_about_form_8cpp_source.html +++ b/docs/doxygen/html/_about_form_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,7 +88,8 @@ $(document).ready(function(){initNavTree('_about_form_8cpp_source.html','');});
AboutForm.cpp
-
1 #include "AboutForm.h"
2 
3 AboutForm::AboutForm(wxWindow* parent) : AboutFormBase(parent) { Init(); }
4 AboutForm::~AboutForm() {}
5 void AboutForm::Init()
6 {
7  // Create developers table
8  m_gridCredits->EnableGridLines(false);
9  wxFont headerFont = m_gridCredits->GetDefaultCellFont();
10  headerFont.SetWeight(wxFONTWEIGHT_BOLD);
11  headerFont.SetPointSize(headerFont.GetPointSize() + 1);
12  wxColour headerColour(200, 200, 200);
13  wxColour hyperlinkColour(6, 69, 173);
14 
15  m_gridCredits->AppendCols(3);
16  m_gridCredits->AppendRows(6);
17  m_gridCredits->HideColLabels();
18  m_gridCredits->HideRowLabels();
19  m_gridCredits->SetCellSize(0, 0, 1, 3);
20  m_gridCredits->SetCellSize(3, 0, 1, 3);
21 
22  m_gridCredits->SetCellValue(0, 0, _("Developers"));
23  m_gridCredits->SetCellAlignment(0, 0, wxALIGN_CENTRE, wxALIGN_CENTRE);
24  m_gridCredits->SetCellBackgroundColour(0, 0, headerColour);
25  m_gridCredits->SetCellFont(0, 0, headerFont);
26  m_gridCredits->SetCellValue(1, 0, wxT("Thales Lima Oliveira"));
27  m_gridCredits->SetCellValue(1, 1, _("Main developer and project admin"));
28  m_gridCredits->SetCellValue(1, 2, wxT("thales@ufu.br"));
29 
30  m_gridCredits->SetRowMinimalHeight(2, 30);
31 
32  m_gridCredits->SetCellValue(3, 0, _("Contributors / Special Thanks"));
33  m_gridCredits->SetCellAlignment(3, 0, wxALIGN_CENTRE, wxALIGN_CENTRE);
34  m_gridCredits->SetCellBackgroundColour(3, 0, headerColour);
35  m_gridCredits->SetCellFont(3, 0, headerFont);
36  // Caixeta
37  m_gridCredits->SetCellValue(4, 0, wxT("Geraldo Caixeta Guimar") + static_cast<wxString>(L'\u00E3') + wxT("es"));
38  m_gridCredits->SetCellValue(4, 1, _("Chief advisor"));
39  m_gridCredits->SetCellValue(4, 2, wxT("gcaixeta@ufu.br"));
40  // Marcio Tamashiro
41  m_gridCredits->SetCellValue(5, 0, wxT("M") + static_cast<wxString>(L'\u00E1') + wxT("rcio Augusto Tamashiro"));
42  m_gridCredits->SetCellValue(5, 1, "");
43  m_gridCredits->SetCellValue(5, 2, wxT("tamashiro@ifto.edu.br"));
44 
45  for(int i = 0; i < m_gridCredits->GetNumberRows(); ++i) {
46  m_gridCredits->SetCellTextColour(i, 2, hyperlinkColour);
47  }
48 
49  m_gridCredits->AutoSize();
50 
51  // Last col size
52  int lastColSize = m_notebook->GetPage(1)->GetSize().GetWidth();
53  int lastColNumber = m_gridCredits->GetNumberCols() - 1;
54  for(int i = 0; i < lastColNumber; ++i) {
55  lastColSize -= m_gridCredits->GetColSize(i);
56  }
57  m_gridCredits->SetColSize(lastColNumber, lastColSize);
58  m_gridCredits->SetSize(m_notebook->GetPage(1)->GetSize());
59 
60  // Load license file
61  wxString licenseStr = "";
62  wxTextFile file;
63  if(!file.Open("../data/LICENSE")) {
64  // Error message
65  } else {
66  licenseStr += file.GetFirstLine() + "\n";
67  while(!file.Eof()) {
68  licenseStr += file.GetNextLine() + "\n";
69  }
70  }
71  wxFont font = m_richTextCtrlLicense->GetFont();
72  font.SetFamily(wxFONTFAMILY_TELETYPE);
73  m_richTextCtrlLicense->SetFont(font);
74  m_richTextCtrlLicense->SetEditable(false);
75  m_richTextCtrlLicense->AppendText(licenseStr);
76 }
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "AboutForm.h"
19 
20 AboutForm::AboutForm(wxWindow* parent) : AboutFormBase(parent) { Init(); }
21 AboutForm::~AboutForm() {}
22 void AboutForm::Init()
23 {
24  // Create developers table
25  m_gridCredits->EnableGridLines(false);
26  wxFont headerFont = m_gridCredits->GetDefaultCellFont();
27  headerFont.SetWeight(wxFONTWEIGHT_BOLD);
28  headerFont.SetPointSize(headerFont.GetPointSize() + 1);
29  wxColour headerColour(200, 200, 200);
30  wxColour hyperlinkColour(6, 69, 173);
31 
32  m_gridCredits->AppendCols(3);
33  m_gridCredits->AppendRows(6);
34  m_gridCredits->HideColLabels();
35  m_gridCredits->HideRowLabels();
36  m_gridCredits->SetCellSize(0, 0, 1, 3);
37  m_gridCredits->SetCellSize(3, 0, 1, 3);
38 
39  m_gridCredits->SetCellValue(0, 0, _("Developers"));
40  m_gridCredits->SetCellAlignment(0, 0, wxALIGN_CENTRE, wxALIGN_CENTRE);
41  m_gridCredits->SetCellBackgroundColour(0, 0, headerColour);
42  m_gridCredits->SetCellFont(0, 0, headerFont);
43  m_gridCredits->SetCellValue(1, 0, wxT("Thales Lima Oliveira"));
44  m_gridCredits->SetCellValue(1, 1, _("Main developer and project admin"));
45  m_gridCredits->SetCellValue(1, 2, wxT("thales@ufu.br"));
46 
47  m_gridCredits->SetRowMinimalHeight(2, 30);
48 
49  m_gridCredits->SetCellValue(3, 0, _("Contributors / Special Thanks"));
50  m_gridCredits->SetCellAlignment(3, 0, wxALIGN_CENTRE, wxALIGN_CENTRE);
51  m_gridCredits->SetCellBackgroundColour(3, 0, headerColour);
52  m_gridCredits->SetCellFont(3, 0, headerFont);
53  // Caixeta
54  m_gridCredits->SetCellValue(4, 0, wxT("Geraldo Caixeta Guimar") + static_cast<wxString>(L'\u00E3') + wxT("es"));
55  m_gridCredits->SetCellValue(4, 1, _("Chief advisor"));
56  m_gridCredits->SetCellValue(4, 2, wxT("gcaixeta@ufu.br"));
57  // Marcio Tamashiro
58  m_gridCredits->SetCellValue(5, 0, wxT("M") + static_cast<wxString>(L'\u00E1') + wxT("rcio Augusto Tamashiro"));
59  m_gridCredits->SetCellValue(5, 1, "");
60  m_gridCredits->SetCellValue(5, 2, wxT("tamashiro@ifto.edu.br"));
61 
62  for(int i = 0; i < m_gridCredits->GetNumberRows(); ++i) {
63  m_gridCredits->SetCellTextColour(i, 2, hyperlinkColour);
64  }
65 
66  m_gridCredits->AutoSize();
67 
68  // Last col size
69  int lastColSize = m_notebook->GetPage(1)->GetSize().GetWidth();
70  int lastColNumber = m_gridCredits->GetNumberCols() - 1;
71  for(int i = 0; i < lastColNumber; ++i) {
72  lastColSize -= m_gridCredits->GetColSize(i);
73  }
74  m_gridCredits->SetColSize(lastColNumber, lastColSize);
75  m_gridCredits->SetSize(m_notebook->GetPage(1)->GetSize());
76 
77  // Load license file
78  wxString licenseStr = "";
79  wxTextFile file;
80  wxFileName fn(wxStandardPaths::Get().GetExecutablePath());
81  wxString licensePath = fn.GetPath() + "\\..\\data\\LICENSE";
82  if(!file.Open(licensePath)) {
83  // Error message
84  } else {
85  licenseStr += file.GetFirstLine() + "\n";
86  while(!file.Eof()) {
87  licenseStr += file.GetNextLine() + "\n";
88  }
89  }
90  wxFont font = m_richTextCtrlLicense->GetFont();
91  font.SetFamily(wxFONTFAMILY_TELETYPE);
92  m_richTextCtrlLicense->SetFont(font);
93  m_richTextCtrlLicense->SetEditable(false);
94  m_richTextCtrlLicense->AppendText(licenseStr);
95 }
+
diff --git a/docs/doxygen/html/_about_form_8h.html b/docs/doxygen/html/_about_form_8h.html new file mode 100644 index 0000000..1c822d8 --- /dev/null +++ b/docs/doxygen/html/_about_form_8h.html @@ -0,0 +1,117 @@ + + + + + + + + + +Project/AboutForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
AboutForm.h File Reference
+
+
+
#include "PropertiesForm.h"
+#include <wx/textfile.h>
+#include <wx/stdpaths.h>
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  AboutForm
 Form to show some informations. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_about_form_8h_source.html b/docs/doxygen/html/_about_form_8h_source.html index c967711..b4b7f5b 100644 --- a/docs/doxygen/html/_about_form_8h_source.html +++ b/docs/doxygen/html/_about_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,14 +88,14 @@ $(document).ready(function(){initNavTree('_about_form_8h_source.html','');});
AboutForm.h
-
1 #ifndef ABOUTFORM_H
2 #define ABOUTFORM_H
3 #include "PropertiesForm.h"
4 
5 #include <wx/textfile.h>
6 
7 class AboutForm : public AboutFormBase
8 {
9  public:
10  AboutForm(wxWindow* parent);
11  virtual ~AboutForm();
12  virtual void Init();
13 
14  protected:
15  virtual void OnOKButtonClick(wxCommandEvent& event) { EndModal(wxID_OK); };
16 };
17 #endif // ABOUTFORM_H
- +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ABOUTFORM_H
19 #define ABOUTFORM_H
20 #include "PropertiesForm.h"
21 
22 #include <wx/textfile.h>
23 #include <wx/stdpaths.h>
24 
32 class AboutForm : public AboutFormBase
33 {
34  public:
35  AboutForm(wxWindow* parent);
36  virtual ~AboutForm();
37  virtual void Init();
38 
39  protected:
40  virtual void OnOKButtonClick(wxCommandEvent& event) { EndModal(wxID_OK); };
41 };
42 #endif // ABOUTFORM_H
+
Form to show some informations.
Definition: AboutForm.h:32
-
1 #include "Branch.h"
2 
3 Branch::Branch()
4  : PowerElement()
5 {
6 }
7 Branch::~Branch() {}
8 bool Branch::NodeContains(wxPoint2DDouble position)
9 {
10  wxRect2DDouble nodeRect1(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
11  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
12  wxRect2DDouble nodeRect2(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize,
13  m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize, 10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
14 
15  if(nodeRect1.Contains(position)) {
16  m_activeNodeID = 1;
17  return true;
18  }
19  if(nodeRect2.Contains(position)) {
20  m_activeNodeID = 2;
21  return true;
22  }
23 
24  m_activeNodeID = 0;
25  return false;
26 }
27 
29 {
30  if(m_activeNodeID == 1 && parent == m_parentList[0]) return false;
31  if(m_activeNodeID == 2 && parent == m_parentList[1]) return false;
32 
33  if(parent && m_activeNodeID != 0) {
34  wxRect2DDouble nodeRect(0, 0, 0, 0);
35  if(m_activeNodeID == 1) {
36  nodeRect = wxRect2DDouble(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
37  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
38  }
39  if(m_activeNodeID == 2) {
40  nodeRect = wxRect2DDouble(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize,
41  m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize, 10 + 2.0 * m_borderSize,
42  10 + 2.0 * m_borderSize);
43  }
44 
45  if(parent->Intersects(nodeRect)) {
46  if(m_activeNodeID == 1) {
47  // Check if the user is trying to connect the same bus.
48  if(m_parentList[1] == parent) {
49  m_activeNodeID = 0;
50  return false;
51  }
52 
53  m_parentList[0] = parent;
54 
55  // Centralize the node on bus.
56  wxPoint2DDouble parentPt = parent->RotateAtPosition(
57  m_pointList[0], -parent->GetAngle()); // Rotate click to horizontal position.
58  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
59  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
60  m_pointList[0] = parentPt;
61 
62  UpdateSwitchesPosition();
63  return true;
64  }
65  if(m_activeNodeID == 2) {
66  if(m_parentList[0] == parent) {
67  m_activeNodeID = 0;
68  return false;
69  }
70 
71  m_parentList[1] = parent;
72 
73  wxPoint2DDouble parentPt =
74  parent->RotateAtPosition(m_pointList[m_pointList.size() - 1], -parent->GetAngle());
75  parentPt.m_y = parent->GetPosition().m_y;
76  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
77  m_pointList[m_pointList.size() - 1] = parentPt;
78 
79  UpdateSwitchesPosition();
80  return true;
81  }
82  } else {
83  if(m_activeNodeID == 1) m_parentList[0] = NULL;
84  if(m_activeNodeID == 2) m_parentList[1] = NULL;
85  }
86  }
87  return false;
88 }
89 
91 {
92  for(int i = 0; i < 2; i++) {
93  if(parent == m_parentList[i]) {
94  m_parentList[i] = NULL;
95  m_online = false;
96  UpdateSwitchesPosition();
97  }
98  }
99 }
100 
102 {
103  if(m_parentList[0]) {
104  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
105  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
106 
107  if(!m_parentList[0]->Intersects(nodeRect)) {
108  m_parentList[0]->RemoveChild(this);
109  m_parentList[0] = NULL;
110  m_online = false;
111  UpdateSwitchesPosition();
112  }
113  }
114  if(m_parentList[1]) {
115  wxRect2DDouble nodeRect = wxRect2DDouble(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize,
116  m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize, 10 + 2.0 * m_borderSize,
117  10 + 2.0 * m_borderSize);
118 
119  if(!m_parentList[1]->Intersects(nodeRect)) {
120  m_parentList[1]->RemoveChild(this);
121  m_parentList[1] = NULL;
122  m_online = false;
123  UpdateSwitchesPosition();
124  }
125  }
126 }
127 
128 void Branch::RotateNode(Element* parent, bool clockwise)
129 {
130  double rotAngle = m_rotationAngle;
131  if(!clockwise) rotAngle = -m_rotationAngle;
132 
133  if(parent == m_parentList[0]) {
134  m_pointList[0] = parent->RotateAtPosition(m_pointList[0], rotAngle);
135  } else if(parent == m_parentList[1]) {
136  m_pointList[m_pointList.size() - 1] = parent->RotateAtPosition(m_pointList[m_pointList.size() - 1], rotAngle);
137  }
138  UpdateSwitchesPosition();
139 }
140 
141 void Branch::UpdateSwitchesPosition()
142 {
143  if(m_parentList[0]) {
144  m_pointList[1] = GetSwitchPoint(m_parentList[0], m_pointList[0], m_pointList[2]);
145  } else {
146  m_pointList[1] = m_pointList[0];
147  }
148  if(m_parentList[1]) {
149  m_pointList[m_pointList.size() - 2] =
150  GetSwitchPoint(m_parentList[1], m_pointList[m_pointList.size() - 1], m_pointList[m_pointList.size() - 3]);
151  } else {
152  m_pointList[m_pointList.size() - 2] = m_pointList[m_pointList.size() - 1];
153  }
154  UpdateSwitches();
155 }
156 
158 {
159  wxPoint2DDouble swCenter = wxPoint2DDouble(
160  (m_pointList[0].m_x + m_pointList[1].m_x) / 2.0, (m_pointList[0].m_y + m_pointList[1].m_y) / 2.0);
161  m_switchRect[0] = wxRect2DDouble(
162  swCenter.m_x - m_switchSize / 2.0, swCenter.m_y - m_switchSize / 2.0, m_switchSize, m_switchSize);
163 
164  if(m_switchRect.size() > 1) {
165  swCenter =
166  wxPoint2DDouble((m_pointList[m_pointList.size() - 1].m_x + m_pointList[m_pointList.size() - 2].m_x) / 2.0,
167  (m_pointList[m_pointList.size() - 1].m_y + m_pointList[m_pointList.size() - 2].m_y) / 2.0);
168  m_switchRect[1] = wxRect2DDouble(
169  swCenter.m_x - m_switchSize / 2.0, swCenter.m_y - m_switchSize / 2.0, m_switchSize, m_switchSize);
170  }
171 }
double GetAngle() const
Get the element angle.
Definition: Element.h:201
-
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Branch.cpp:90
- -
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Branch.cpp:28
-
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:91
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Branch.h"
19 
20 Branch::Branch() : PowerElement() {}
21 Branch::~Branch() {}
22 bool Branch::NodeContains(wxPoint2DDouble position)
23 {
24  wxRect2DDouble nodeRect1(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
25  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
26  wxRect2DDouble nodeRect2(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize,
27  m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize, 10 + 2.0 * m_borderSize,
28  10 + 2.0 * m_borderSize);
29 
30  if(nodeRect1.Contains(position)) {
31  m_activeNodeID = 1;
32  return true;
33  }
34  if(nodeRect2.Contains(position)) {
35  m_activeNodeID = 2;
36  return true;
37  }
38 
39  m_activeNodeID = 0;
40  return false;
41 }
42 
44 {
45  if(m_activeNodeID == 1 && parent == m_parentList[0]) return false;
46  if(m_activeNodeID == 2 && parent == m_parentList[1]) return false;
47 
48  if(parent && m_activeNodeID != 0) {
49  wxRect2DDouble nodeRect(0, 0, 0, 0);
50  if(m_activeNodeID == 1) {
51  nodeRect = wxRect2DDouble(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
52  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
53  }
54  if(m_activeNodeID == 2) {
55  nodeRect = wxRect2DDouble(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize,
56  m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize,
57  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
58  }
59 
60  if(parent->Intersects(nodeRect)) {
61  if(m_activeNodeID == 1) {
62  // Check if the user is trying to connect the same bus.
63  if(m_parentList[1] == parent) {
64  m_activeNodeID = 0;
65  return false;
66  }
67 
68  m_parentList[0] = parent;
69 
70  // Centralize the node on bus.
71  wxPoint2DDouble parentPt = parent->RotateAtPosition(
72  m_pointList[0], -parent->GetAngle()); // Rotate click to horizontal position.
73  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
74  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
75  m_pointList[0] = parentPt;
76 
77  UpdateSwitchesPosition();
78  return true;
79  }
80  if(m_activeNodeID == 2) {
81  if(m_parentList[0] == parent) {
82  m_activeNodeID = 0;
83  return false;
84  }
85 
86  m_parentList[1] = parent;
87 
88  wxPoint2DDouble parentPt =
89  parent->RotateAtPosition(m_pointList[m_pointList.size() - 1], -parent->GetAngle());
90  parentPt.m_y = parent->GetPosition().m_y;
91  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
92  m_pointList[m_pointList.size() - 1] = parentPt;
93 
94  UpdateSwitchesPosition();
95  return true;
96  }
97  } else {
98  if(m_activeNodeID == 1) m_parentList[0] = NULL;
99  if(m_activeNodeID == 2) m_parentList[1] = NULL;
100  }
101  }
102  return false;
103 }
104 
106 {
107  for(int i = 0; i < 2; i++) {
108  if(parent == m_parentList[i]) {
109  m_parentList[i] = NULL;
110  m_online = false;
111  UpdateSwitchesPosition();
112  }
113  }
114 }
115 
117 {
118  if(m_parentList[0]) {
119  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
120  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
121 
122  if(!m_parentList[0]->Intersects(nodeRect)) {
123  m_parentList[0]->RemoveChild(this);
124  m_parentList[0] = NULL;
125  m_online = false;
126  UpdateSwitchesPosition();
127  }
128  }
129  if(m_parentList[1]) {
130  wxRect2DDouble nodeRect = wxRect2DDouble(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize,
131  m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize,
132  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
133 
134  if(!m_parentList[1]->Intersects(nodeRect)) {
135  m_parentList[1]->RemoveChild(this);
136  m_parentList[1] = NULL;
137  m_online = false;
138  UpdateSwitchesPosition();
139  }
140  }
141 }
142 
143 void Branch::RotateNode(Element* parent, bool clockwise)
144 {
145  double rotAngle = m_rotationAngle;
146  if(!clockwise) rotAngle = -m_rotationAngle;
147 
148  if(parent == m_parentList[0]) {
149  m_pointList[0] = parent->RotateAtPosition(m_pointList[0], rotAngle);
150  } else if(parent == m_parentList[1]) {
151  m_pointList[m_pointList.size() - 1] = parent->RotateAtPosition(m_pointList[m_pointList.size() - 1], rotAngle);
152  }
153  UpdateSwitchesPosition();
154 }
155 
156 void Branch::UpdateSwitchesPosition()
157 {
158  if(m_parentList[0]) {
159  m_pointList[1] = GetSwitchPoint(m_parentList[0], m_pointList[0], m_pointList[2]);
160  } else {
161  m_pointList[1] = m_pointList[0];
162  }
163  if(m_parentList[1]) {
164  m_pointList[m_pointList.size() - 2] =
165  GetSwitchPoint(m_parentList[1], m_pointList[m_pointList.size() - 1], m_pointList[m_pointList.size() - 3]);
166  } else {
167  m_pointList[m_pointList.size() - 2] = m_pointList[m_pointList.size() - 1];
168  }
169  UpdateSwitches();
170 }
171 
173 {
174  wxPoint2DDouble swCenter = wxPoint2DDouble((m_pointList[0].m_x + m_pointList[1].m_x) / 2.0,
175  (m_pointList[0].m_y + m_pointList[1].m_y) / 2.0);
176  m_switchRect[0] = wxRect2DDouble(swCenter.m_x - m_switchSize / 2.0, swCenter.m_y - m_switchSize / 2.0, m_switchSize,
177  m_switchSize);
178 
179  if(m_switchRect.size() > 1) {
180  swCenter =
181  wxPoint2DDouble((m_pointList[m_pointList.size() - 1].m_x + m_pointList[m_pointList.size() - 2].m_x) / 2.0,
182  (m_pointList[m_pointList.size() - 1].m_y + m_pointList[m_pointList.size() - 2].m_y) / 2.0);
183  m_switchRect[1] = wxRect2DDouble(swCenter.m_x - m_switchSize / 2.0, swCenter.m_y - m_switchSize / 2.0,
184  m_switchSize, m_switchSize);
185  }
186 }
double GetAngle() const
Get the element angle.
Definition: Element.h:212
+
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Branch.cpp:105
+ +
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Branch.cpp:43
+
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:107
virtual bool Intersects(wxRect2DDouble rect) const =0
Check if the element&#39;s rect intersects other rect.
-
virtual void UpdateSwitches()
Update the switch position.
Definition: Branch.cpp:157
-
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Branch.cpp:101
-
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Branch.cpp:8
- -
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:171
-
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Branch.cpp:128
+
virtual void UpdateSwitches()
Update the switch position.
Definition: Branch.cpp:172
+
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Branch.cpp:116
+
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Branch.cpp:22
+ +
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:187
+
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Branch.cpp:143
diff --git a/docs/doxygen/html/_branch_8h_source.html b/docs/doxygen/html/_branch_8h_source.html index de27de5..564f01b 100644 --- a/docs/doxygen/html/_branch_8h_source.html +++ b/docs/doxygen/html/_branch_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,27 +88,27 @@ $(document).ready(function(){initNavTree('_branch_8h_source.html','');});
Branch.h
-
1 #ifndef BRANCH_H
2 #define BRANCH_H
3 
4 #include "PowerElement.h"
5 #include "Bus.h"
6 
7 class Branch : public PowerElement
8 {
9 public:
10  Branch();
11  ~Branch();
12 
13  virtual bool Contains(wxPoint2DDouble position) const { return false; }
14  virtual void Draw(wxPoint2DDouble translation, double scale) const {}
15  virtual void Move(wxPoint2DDouble position) {}
16  virtual void StartMove(wxPoint2DDouble position) {}
17  virtual void MoveNode(Element* parent, wxPoint2DDouble position) {}
18  virtual bool NodeContains(wxPoint2DDouble position);
19  virtual bool SetNodeParent(Element* parent);
20  virtual void RemoveParent(Element* parent);
21  virtual void UpdateNodes();
22  virtual wxCursor GetBestPickboxCursor() const { return wxCURSOR_ARROW; }
23  virtual bool Intersects(wxRect2DDouble rect) const { return false; }
24  virtual void MovePickbox(wxPoint2DDouble position) {}
25  virtual bool PickboxContains(wxPoint2DDouble position) { return false; }
26  virtual void RotateNode(Element* parent, bool clockwise = true);
27  virtual void AddPoint(wxPoint2DDouble point) {};
28  virtual bool GetContextMenu(wxMenu& menu) { return false; }
29  virtual void UpdateSwitchesPosition();
30  virtual void UpdateSwitches();
31 
32  protected:
33  bool m_inserted = false;
34 };
35 
36 #endif // BRANCH_H
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Branch.h:14
-
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Branch.cpp:90
- -
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Branch.cpp:28
-
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Branch.h:28
-
virtual void MovePickbox(wxPoint2DDouble position)
Move the pickbox.
Definition: Branch.h:24
-
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Branch.h:16
-
virtual void UpdateSwitches()
Update the switch position.
Definition: Branch.cpp:157
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Branch.h:13
-
virtual void AddPoint(wxPoint2DDouble point)
Add point to the list of points that connect the element to the bus.
Definition: Branch.h:27
-
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Branch.h:23
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef BRANCH_H
19 #define BRANCH_H
20 
21 #include "PowerElement.h"
22 #include "Bus.h"
23 
24 class Branch : public PowerElement
25 {
26  public:
27  Branch();
28  ~Branch();
29 
30  virtual bool Contains(wxPoint2DDouble position) const { return false; }
31  virtual void Draw(wxPoint2DDouble translation, double scale) const {}
32  virtual void Move(wxPoint2DDouble position) {}
33  virtual void StartMove(wxPoint2DDouble position) {}
34  virtual void MoveNode(Element* parent, wxPoint2DDouble position) {}
35  virtual bool NodeContains(wxPoint2DDouble position);
36  virtual bool SetNodeParent(Element* parent);
37  virtual void RemoveParent(Element* parent);
38  virtual void UpdateNodes();
39  virtual wxCursor GetBestPickboxCursor() const { return wxCURSOR_ARROW; }
40  virtual bool Intersects(wxRect2DDouble rect) const { return false; }
41  virtual void MovePickbox(wxPoint2DDouble position) {}
42  virtual bool PickboxContains(wxPoint2DDouble position) { return false; }
43  virtual void RotateNode(Element* parent, bool clockwise = true);
44  virtual void AddPoint(wxPoint2DDouble point){};
45  virtual bool GetContextMenu(wxMenu& menu) { return false; }
46  virtual void UpdateSwitchesPosition();
47  virtual void UpdateSwitches();
48 
49  protected:
50  bool m_inserted = false;
51 };
52 
53 #endif // BRANCH_H
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Branch.h:31
+
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Branch.cpp:105
+ +
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Branch.cpp:43
+
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Branch.h:45
+
virtual void MovePickbox(wxPoint2DDouble position)
Move the pickbox.
Definition: Branch.h:41
+
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Branch.h:33
+
virtual void UpdateSwitches()
Update the switch position.
Definition: Branch.cpp:172
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Branch.h:30
+
virtual void AddPoint(wxPoint2DDouble point)
Add point to the list of points that connect the element to the bus.
Definition: Branch.h:44
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Branch.h:40
Switching data of power elements.
-
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Branch.cpp:101
-
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Branch.cpp:8
- -
virtual bool PickboxContains(wxPoint2DDouble position)
Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be c...
Definition: Branch.h:25
-
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Branch.h:15
-
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Branch.cpp:128
-
virtual void MoveNode(Element *parent, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Branch.h:17
-
virtual wxCursor GetBestPickboxCursor() const
Get the best cursor to shown to the user when the mouse is above a pickbox.
Definition: Branch.h:22
-
Definition: Branch.h:7
+
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Branch.cpp:116
+
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Branch.cpp:22
+ +
virtual bool PickboxContains(wxPoint2DDouble position)
Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be c...
Definition: Branch.h:42
+
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Branch.h:32
+
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Branch.cpp:143
+
virtual void MoveNode(Element *parent, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Branch.h:34
+
virtual wxCursor GetBestPickboxCursor() const
Get the best cursor to shown to the user when the mouse is above a pickbox.
Definition: Branch.h:39
+
Definition: Branch.h:24
diff --git a/docs/doxygen/html/_bus_8cpp_source.html b/docs/doxygen/html/_bus_8cpp_source.html index e2caea0..999dc39 100644 --- a/docs/doxygen/html/_bus_8cpp_source.html +++ b/docs/doxygen/html/_bus_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,37 +88,37 @@ $(document).ready(function(){initNavTree('_bus_8cpp_source.html','');});
Bus.cpp
-
1 #include "Bus.h"
2 #ifdef USING_WX_3_0_X
3 #include "DegreesAndRadians.h"
4 #endif
5 
6 Bus::Bus() : PowerElement() {}
7 Bus::Bus(wxPoint2DDouble position) : PowerElement()
8 {
9  m_width = 100.0;
10  m_height = 5.0;
11  SetPosition(position);
12 }
13 
14 Bus::Bus(wxPoint2DDouble position, wxString name)
15 {
16  m_width = 100.0;
17  m_height = 5.0;
18  SetPosition(position);
19 
20  m_electricalData.name = name;
21 }
22 
23 Bus::~Bus() {}
24 void Bus::Draw(wxPoint2DDouble translation, double scale) const
25 {
26  // Draw selection (layer 1)
27  if(m_selected) {
28  // If the object is selected, the matrix is reset to remove scale effects applied to it, thus keeping the
29  // edges with fixed sizes for all zoom levels.
30  glPushMatrix();
31  glLoadIdentity();
32  // The matrix was reset, so we must use screen coordinates (WorldToScreen).
33  wxPoint2DDouble screenPt = WorldToScreen(translation, scale);
34  glTranslated(screenPt.m_x, screenPt.m_y, 0.0);
35  glRotated(m_angle, 0.0, 0.0, 1.0);
36  glTranslated(-screenPt.m_x, -screenPt.m_y, 0.0);
37 
38  glColor4dv(m_selectionColour.GetRGBA());
39 
40  wxPoint2DDouble pts[4] = {WorldToScreen(translation, scale, -(m_width / 2.0), -(m_height / 2.0)) -
41  wxPoint2DDouble(m_borderSize, m_borderSize),
42  WorldToScreen(translation, scale, -(m_width / 2.0), (m_height / 2.0)) -
43  wxPoint2DDouble(m_borderSize, -m_borderSize),
44  WorldToScreen(translation, scale, (m_width / 2.0), (m_height / 2.0)) -
45  wxPoint2DDouble(-m_borderSize, -m_borderSize),
46  WorldToScreen(translation, scale, (m_width / 2.0), -(m_height / 2.0)) -
47  wxPoint2DDouble(-m_borderSize, m_borderSize)};
48  DrawRectangle(pts);
49  glPopMatrix();
50  }
51  // Draw bus (layer 2)
52  // Push the current matrix on stack.
53  glPushMatrix();
54  // Rotate the matrix around the object position.
55  glTranslated(m_position.m_x, m_position.m_y, 0.0);
56  glRotated(m_angle, 0.0, 0.0, 1.0);
57  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
58 
59  if(m_dynEvent)
60  glColor4dv(m_dynamicEventColour.GetRGBA());
61  else
62  glColor4dv(m_busColour.GetRGBA());
63 
64  DrawRectangle(m_position, m_width, m_height);
65  // Pop the old matrix back.
66  glPopMatrix();
67 
68  // Draw pickbox (layer 3)
69  if(m_showPickbox) {
70  glPushMatrix();
71  glLoadIdentity();
72 
73  wxPoint2DDouble screenPt = WorldToScreen(translation, scale);
74  glTranslated(screenPt.m_x, screenPt.m_y, 0.0);
75  glRotated(m_angle, 0.0, 0.0, 1.0);
76  glTranslated(-screenPt.m_x, -screenPt.m_y, 0.0);
77 
78  wxPoint2DDouble pbPosition[2] = {WorldToScreen(translation, scale, m_width / 2.0),
79  WorldToScreen(translation, scale, -m_width / 2.0)};
80  DrawPickbox(pbPosition[0]);
81  DrawPickbox(pbPosition[1]);
82 
83  glPopMatrix();
84  }
85 }
86 
87 bool Bus::Contains(wxPoint2DDouble position) const
88 {
89  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
90  return m_rect.Contains(ptR);
91 }
92 
93 bool Bus::Intersects(wxRect2DDouble rect) const
94 {
95  if(m_angle == 0.0 || m_angle == 180.0) return m_rect.Intersects(rect);
96 
97  return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0);
98 }
99 
100 bool Bus::PickboxContains(wxPoint2DDouble position)
101 {
102  m_activePickboxID = ID_PB_NONE;
103 
104  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
105 
106  wxPoint2DDouble center(m_position.m_x + m_width / 2.0, m_position.m_y);
107  wxRect2DDouble rectRight(center.m_x - 5.0, center.m_y - 5.0, 10.0, 10.0);
108 
109  center = wxPoint2DDouble(m_position.m_x - m_width / 2.0, m_position.m_y);
110  wxRect2DDouble rectLeft(center.m_x - 5.0, center.m_y - 5.0, 10.0, 10.0);
111 
112  if(rectRight.Contains(ptR)) {
113  m_activePickboxID = ID_PB_RIGHT;
114  return true;
115  }
116  if(rectLeft.Contains(ptR)) {
117  m_activePickboxID = ID_PB_LEFT;
118  return true;
119  }
120 
121  return false;
122 }
123 
125 {
126  double angle = m_angle;
127  while(angle >= 157.5) angle -= 180.0;
128 
129  if(angle >= -22.5 && angle < 22.5)
130  return wxCursor(wxCURSOR_SIZEWE);
131  else if(angle >= 22.5 && angle < 67.5)
132  return wxCursor(wxCURSOR_SIZENWSE);
133  else if(angle >= 67.5 && angle < 112.5)
134  return wxCursor(wxCURSOR_SIZENS);
135  else if(angle >= 112.5 && angle < 157.5)
136  return wxCursor(wxCURSOR_SIZENESW);
137 
138  return wxCursor(wxCURSOR_ARROW);
139 }
140 
141 void Bus::MovePickbox(wxPoint2DDouble position)
142 {
143  if(m_activePickboxID == ID_PB_NONE) return;
144 
145  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
146 
147  double dx = 0.0;
148  if(m_activePickboxID == ID_PB_RIGHT)
149  dx = ptR.m_x - m_position.m_x - m_width / 2.0;
150  else if(m_activePickboxID == ID_PB_LEFT)
151  dx = m_position.m_x - m_width / 2.0 - ptR.m_x;
152 
153  if(m_width + dx < 20.0) return;
154 
155  if(m_activePickboxID == ID_PB_RIGHT) {
156  m_position.m_x += (dx / 2.0) * std::cos(wxDegToRad(m_angle));
157  m_position.m_y += (dx / 2.0) * std::sin(wxDegToRad(m_angle));
158  } else if(m_activePickboxID == ID_PB_LEFT) {
159  m_position.m_x -= (dx / 2.0) * std::cos(wxDegToRad(m_angle));
160  m_position.m_y -= (dx / 2.0) * std::sin(wxDegToRad(m_angle));
161  }
162  m_width += dx;
163 
164  SetPosition(m_position);
165 }
166 
167 void Bus::Rotate(bool clockwise)
168 {
169  double rotAngle = m_rotationAngle;
170  if(!clockwise) rotAngle = -m_rotationAngle;
171 
172  m_angle += rotAngle;
173  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
174 }
175 
176 bool Bus::GetContextMenu(wxMenu& menu)
177 {
178  menu.Append(ID_EDIT_ELEMENT, _("Edit bus"));
179  GeneralMenuItens(menu);
180  return true;
181 }
182 
183 bool Bus::ShowForm(wxWindow* parent, Element* element)
184 {
185  BusForm* busForm = new BusForm(parent, this);
186  if(busForm->ShowModal() == wxID_OK) {
187  busForm->Destroy();
188  return true;
189  }
190 
191  busForm->Destroy();
192  return false;
193 }
194 
196 {
197  Bus* copy = new Bus();
198  *copy = *this;
199  return copy;
200 }
201 wxString Bus::GetTipText() const
202 {
203  wxString tipText = m_electricalData.name;
204  tipText += wxString::Format(" (%d)", m_electricalData.number + 1);
205  tipText += "\n";
206  tipText += StringFromDouble(m_electricalData.nominalVoltage, 1) +
207  (m_electricalData.nominalVoltageUnit == UNIT_V ? _(" V") : _(" kV"));
208  tipText += "\n";
209  tipText += _("\nV = ") + wxString::FromDouble(std::abs(m_electricalData.voltage), 5) + _(" p.u.");
210  tipText += "\n";
211  tipText += wxString(L'\u03B8') + " = " + wxString::FromDouble(wxRadToDeg(std::arg(m_electricalData.voltage)), 5) +
212  " " + wxString(L'\u00B0');
213 
214  tipText += _("\n\nFault info:");
215  tipText += _("\nVa = ") + wxString::FromDouble(std::abs(m_electricalData.faultVoltage[0]), 5) + _(" p.u.");
216  tipText += _("\nVb = ") + wxString::FromDouble(std::abs(m_electricalData.faultVoltage[1]), 5) + _(" p.u.");
217  tipText += _("\nVc = ") + wxString::FromDouble(std::abs(m_electricalData.faultVoltage[2]), 5) + _(" p.u.");
218  if(m_electricalData.hasFault) {
219  tipText += _("\nIa = ") + wxString::FromDouble(std::abs(m_electricalData.faultCurrent[0]), 5) + _(" p.u.");
220  tipText += _("\nIb = ") + wxString::FromDouble(std::abs(m_electricalData.faultCurrent[1]), 5) + _(" p.u.");
221  tipText += _("\nIc = ") + wxString::FromDouble(std::abs(m_electricalData.faultCurrent[2]), 5) + _(" p.u.");
222  }
223 
224  tipText += _("\n\nSsc = ") + wxString::FromDouble(std::abs(m_electricalData.scPower), 5) + _(" p.u.");
225 
226  return tipText;
227 }
228 
230 {
231  if(!m_electricalData.plotBus) return false;
232  plotData.SetName(m_electricalData.name);
233  plotData.SetCurveType(ElementPlotData::CT_BUS);
234 
235  std::vector<double> absVoltage, argVoltage;
236  for(unsigned int i = 0; i < m_electricalData.stabVoltageVector.size(); ++i) {
237  absVoltage.push_back(std::abs(m_electricalData.stabVoltageVector[i]));
238  argVoltage.push_back(wxRadToDeg(std::arg(m_electricalData.stabVoltageVector[i])));
239  }
240  plotData.AddData(absVoltage, _("Voltage"));
241  plotData.AddData(argVoltage, _("Angle"));
242  return true;
243 }
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Bus.cpp:183
- - - -
virtual void MovePickbox(wxPoint2DDouble position)
Move the pickbox.
Definition: Bus.cpp:141
-
virtual wxPoint2DDouble WorldToScreen(wxPoint2DDouble translation, double scale, double offsetX=0.0, double offsetY=0.0) const
Convert the element position to screen position.
Definition: Element.cpp:109
-
virtual wxString GetTipText() const
Get the tip text.
Definition: Bus.cpp:201
-
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Bus.cpp:176
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Bus.cpp:24
-
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:91
-
Definition: BusForm.h:7
-
virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode=GL_QUADS) const
Draw rectangle.
Definition: Element.cpp:53
-
virtual void GeneralMenuItens(wxMenu &menu)
Insert general itens to context menu.
Definition: Element.cpp:228
-
Definition: Bus.h:45
-
virtual bool GetPlotData(ElementPlotData &plotData)
Fill the plot data.
Definition: Bus.cpp:229
- -
void SetPosition(const wxPoint2DDouble position)
Set the element position and update the rectangle.
Definition: Element.cpp:10
-
virtual wxCursor GetBestPickboxCursor() const
Get the best cursor to shown to the user when the mouse is above a pickbox.
Definition: Bus.cpp:124
-
virtual void DrawPickbox(wxPoint2DDouble position) const
Draw pickbox.
Definition: Element.cpp:82
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Bus.cpp:167
-
virtual bool PickboxContains(wxPoint2DDouble position)
Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be c...
Definition: Bus.cpp:100
- -
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:300
- - -
virtual Element * GetCopy()
Get a the element copy.
Definition: Bus.cpp:195
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Bus.cpp:87
-
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Bus.cpp:93
-
virtual bool RotatedRectanglesIntersects(wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const
Check if two roteted rectangles intersect.
Definition: Element.cpp:132
- -
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:83
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Bus.h"
19 #ifdef USING_WX_3_0_X
20 #include "DegreesAndRadians.h"
21 #endif
22 
23 Bus::Bus() : PowerElement() {}
24 Bus::Bus(wxPoint2DDouble position) : PowerElement()
25 {
26  m_width = 100.0;
27  m_height = 5.0;
28  SetPosition(position);
29 }
30 
31 Bus::Bus(wxPoint2DDouble position, wxString name)
32 {
33  m_width = 100.0;
34  m_height = 5.0;
35  SetPosition(position);
36 
37  m_electricalData.name = name;
38 }
39 
40 Bus::~Bus() {}
41 void Bus::Draw(wxPoint2DDouble translation, double scale) const
42 {
43  // Draw selection (layer 1)
44  if(m_selected) {
45  // If the object is selected, the matrix is reset to remove scale effects applied to it, thus keeping the
46  // edges with fixed sizes for all zoom levels.
47  glPushMatrix();
48  glLoadIdentity();
49  // The matrix was reset, so we must use screen coordinates (WorldToScreen).
50  wxPoint2DDouble screenPt = WorldToScreen(translation, scale);
51  glTranslated(screenPt.m_x, screenPt.m_y, 0.0);
52  glRotated(m_angle, 0.0, 0.0, 1.0);
53  glTranslated(-screenPt.m_x, -screenPt.m_y, 0.0);
54 
55  glColor4dv(m_selectionColour.GetRGBA());
56 
57  wxPoint2DDouble pts[4] = {WorldToScreen(translation, scale, -(m_width / 2.0), -(m_height / 2.0)) -
58  wxPoint2DDouble(m_borderSize, m_borderSize),
59  WorldToScreen(translation, scale, -(m_width / 2.0), (m_height / 2.0)) -
60  wxPoint2DDouble(m_borderSize, -m_borderSize),
61  WorldToScreen(translation, scale, (m_width / 2.0), (m_height / 2.0)) -
62  wxPoint2DDouble(-m_borderSize, -m_borderSize),
63  WorldToScreen(translation, scale, (m_width / 2.0), -(m_height / 2.0)) -
64  wxPoint2DDouble(-m_borderSize, m_borderSize)};
65  DrawRectangle(pts);
66  glPopMatrix();
67  }
68  // Draw bus (layer 2)
69  // Push the current matrix on stack.
70  glPushMatrix();
71  // Rotate the matrix around the object position.
72  glTranslated(m_position.m_x, m_position.m_y, 0.0);
73  glRotated(m_angle, 0.0, 0.0, 1.0);
74  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
75 
76  if(m_dynEvent)
77  glColor4dv(m_dynamicEventColour.GetRGBA());
78  else
79  glColor4dv(m_busColour.GetRGBA());
80 
81  DrawRectangle(m_position, m_width, m_height);
82  // Pop the old matrix back.
83  glPopMatrix();
84 
85  // Draw pickbox (layer 3)
86  if(m_showPickbox) {
87  glPushMatrix();
88  glLoadIdentity();
89 
90  wxPoint2DDouble screenPt = WorldToScreen(translation, scale);
91  glTranslated(screenPt.m_x, screenPt.m_y, 0.0);
92  glRotated(m_angle, 0.0, 0.0, 1.0);
93  glTranslated(-screenPt.m_x, -screenPt.m_y, 0.0);
94 
95  wxPoint2DDouble pbPosition[2] = {WorldToScreen(translation, scale, m_width / 2.0),
96  WorldToScreen(translation, scale, -m_width / 2.0)};
97  DrawPickbox(pbPosition[0]);
98  DrawPickbox(pbPosition[1]);
99 
100  glPopMatrix();
101  }
102 }
103 
104 bool Bus::Contains(wxPoint2DDouble position) const
105 {
106  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
107  return m_rect.Contains(ptR);
108 }
109 
110 bool Bus::Intersects(wxRect2DDouble rect) const
111 {
112  if(m_angle == 0.0 || m_angle == 180.0) return m_rect.Intersects(rect);
113 
114  return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0);
115 }
116 
117 bool Bus::PickboxContains(wxPoint2DDouble position)
118 {
119  m_activePickboxID = ID_PB_NONE;
120 
121  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
122 
123  wxPoint2DDouble center(m_position.m_x + m_width / 2.0, m_position.m_y);
124  wxRect2DDouble rectRight(center.m_x - 5.0, center.m_y - 5.0, 10.0, 10.0);
125 
126  center = wxPoint2DDouble(m_position.m_x - m_width / 2.0, m_position.m_y);
127  wxRect2DDouble rectLeft(center.m_x - 5.0, center.m_y - 5.0, 10.0, 10.0);
128 
129  if(rectRight.Contains(ptR)) {
130  m_activePickboxID = ID_PB_RIGHT;
131  return true;
132  }
133  if(rectLeft.Contains(ptR)) {
134  m_activePickboxID = ID_PB_LEFT;
135  return true;
136  }
137 
138  return false;
139 }
140 
142 {
143  double angle = m_angle;
144  while(angle >= 157.5) angle -= 180.0;
145 
146  if(angle >= -22.5 && angle < 22.5)
147  return wxCursor(wxCURSOR_SIZEWE);
148  else if(angle >= 22.5 && angle < 67.5)
149  return wxCursor(wxCURSOR_SIZENWSE);
150  else if(angle >= 67.5 && angle < 112.5)
151  return wxCursor(wxCURSOR_SIZENS);
152  else if(angle >= 112.5 && angle < 157.5)
153  return wxCursor(wxCURSOR_SIZENESW);
154 
155  return wxCursor(wxCURSOR_ARROW);
156 }
157 
158 void Bus::MovePickbox(wxPoint2DDouble position)
159 {
160  if(m_activePickboxID == ID_PB_NONE) return;
161 
162  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
163 
164  double dx = 0.0;
165  if(m_activePickboxID == ID_PB_RIGHT)
166  dx = ptR.m_x - m_position.m_x - m_width / 2.0;
167  else if(m_activePickboxID == ID_PB_LEFT)
168  dx = m_position.m_x - m_width / 2.0 - ptR.m_x;
169 
170  if(m_width + dx < 20.0) return;
171 
172  if(m_activePickboxID == ID_PB_RIGHT) {
173  m_position.m_x += (dx / 2.0) * std::cos(wxDegToRad(m_angle));
174  m_position.m_y += (dx / 2.0) * std::sin(wxDegToRad(m_angle));
175  } else if(m_activePickboxID == ID_PB_LEFT) {
176  m_position.m_x -= (dx / 2.0) * std::cos(wxDegToRad(m_angle));
177  m_position.m_y -= (dx / 2.0) * std::sin(wxDegToRad(m_angle));
178  }
179  m_width += dx;
180 
181  SetPosition(m_position);
182 }
183 
184 void Bus::Rotate(bool clockwise)
185 {
186  double rotAngle = m_rotationAngle;
187  if(!clockwise) rotAngle = -m_rotationAngle;
188 
189  m_angle += rotAngle;
190  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
191 }
192 
193 bool Bus::GetContextMenu(wxMenu& menu)
194 {
195  menu.Append(ID_EDIT_ELEMENT, _("Edit bus"));
196  GeneralMenuItens(menu);
197  return true;
198 }
199 
200 bool Bus::ShowForm(wxWindow* parent, Element* element)
201 {
202  BusForm* busForm = new BusForm(parent, this);
203  if(busForm->ShowModal() == wxID_OK) {
204  busForm->Destroy();
205  return true;
206  }
207 
208  busForm->Destroy();
209  return false;
210 }
211 
213 {
214  Bus* copy = new Bus();
215  *copy = *this;
216  return copy;
217 }
218 wxString Bus::GetTipText() const
219 {
220  wxString tipText = m_electricalData.name;
221  tipText += wxString::Format(" (%d)", m_electricalData.number + 1);
222  tipText += "\n";
223  tipText += StringFromDouble(m_electricalData.nominalVoltage, 1) +
224  (m_electricalData.nominalVoltageUnit == UNIT_V ? _(" V") : _(" kV"));
225  tipText += "\n";
226  tipText += _("\nV = ") + wxString::FromDouble(std::abs(m_electricalData.voltage), 5) + _(" p.u.");
227  tipText += "\n";
228  tipText += wxString(L'\u03B8') + " = " + wxString::FromDouble(wxRadToDeg(std::arg(m_electricalData.voltage)), 5) +
229  " " + wxString(L'\u00B0');
230 
231  tipText += _("\n\nFault info:");
232  tipText += _("\nVa = ") + wxString::FromDouble(std::abs(m_electricalData.faultVoltage[0]), 5) + _(" p.u.");
233  tipText += _("\nVb = ") + wxString::FromDouble(std::abs(m_electricalData.faultVoltage[1]), 5) + _(" p.u.");
234  tipText += _("\nVc = ") + wxString::FromDouble(std::abs(m_electricalData.faultVoltage[2]), 5) + _(" p.u.");
235  if(m_electricalData.hasFault) {
236  tipText += _("\nIa = ") + wxString::FromDouble(std::abs(m_electricalData.faultCurrent[0]), 5) + _(" p.u.");
237  tipText += _("\nIb = ") + wxString::FromDouble(std::abs(m_electricalData.faultCurrent[1]), 5) + _(" p.u.");
238  tipText += _("\nIc = ") + wxString::FromDouble(std::abs(m_electricalData.faultCurrent[2]), 5) + _(" p.u.");
239  }
240 
241  tipText += _("\n\nSsc = ") + wxString::FromDouble(std::abs(m_electricalData.scPower), 5) + _(" p.u.");
242 
243  return tipText;
244 }
245 
247 {
248  if(!m_electricalData.plotBus) return false;
249  plotData.SetName(m_electricalData.name);
250  plotData.SetCurveType(ElementPlotData::CT_BUS);
251 
252  std::vector<double> absVoltage, argVoltage;
253  for(unsigned int i = 0; i < m_electricalData.stabVoltageVector.size(); ++i) {
254  absVoltage.push_back(std::abs(m_electricalData.stabVoltageVector[i]));
255  argVoltage.push_back(wxRadToDeg(std::arg(m_electricalData.stabVoltageVector[i])));
256  }
257  plotData.AddData(absVoltage, _("Voltage"));
258  plotData.AddData(argVoltage, _("Angle"));
259  return true;
260 }
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Bus.cpp:200
+ + + +
virtual void MovePickbox(wxPoint2DDouble position)
Move the pickbox.
Definition: Bus.cpp:158
+
virtual wxPoint2DDouble WorldToScreen(wxPoint2DDouble translation, double scale, double offsetX=0.0, double offsetY=0.0) const
Convert the element position to screen position.
Definition: Element.cpp:124
+
virtual wxString GetTipText() const
Get the tip text.
Definition: Bus.cpp:218
+
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Bus.cpp:193
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Bus.cpp:41
+
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:107
+
Form to edit the bus power data.
Definition: BusForm.h:31
+
virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode=GL_QUADS) const
Draw rectangle.
Definition: Element.cpp:69
+
virtual void GeneralMenuItens(wxMenu &menu)
Insert general itens to context menu.
Definition: Element.cpp:245
+
Definition: Bus.h:62
+
virtual bool GetPlotData(ElementPlotData &plotData)
Fill the plot data.
Definition: Bus.cpp:246
+ +
void SetPosition(const wxPoint2DDouble position)
Set the element position and update the rectangle.
Definition: Element.cpp:25
+
virtual wxCursor GetBestPickboxCursor() const
Get the best cursor to shown to the user when the mouse is above a pickbox.
Definition: Bus.cpp:141
+
virtual void DrawPickbox(wxPoint2DDouble position) const
Draw pickbox.
Definition: Element.cpp:98
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Bus.cpp:184
+
virtual bool PickboxContains(wxPoint2DDouble position)
Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be c...
Definition: Bus.cpp:117
+ +
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:320
+ + +
virtual Element * GetCopy()
Get a the element copy.
Definition: Bus.cpp:212
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Bus.cpp:104
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Bus.cpp:110
+
virtual bool RotatedRectanglesIntersects(wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const
Check if two roteted rectangles intersect.
Definition: Element.cpp:147
+ +
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:101
diff --git a/docs/doxygen/html/_bus_8h_source.html b/docs/doxygen/html/_bus_8h_source.html index 741c991..8fa6343 100644 --- a/docs/doxygen/html/_bus_8h_source.html +++ b/docs/doxygen/html/_bus_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,18 +88,19 @@ $(document).ready(function(){initNavTree('_bus_8h_source.html','');});
Bus.h
-
1 #ifndef BUS_H
2 #define BUS_H
3 
4 #include "BusForm.h"
5 #include "PowerElement.h"
6 
8  int number = 0;
9  wxString name = "";
10  double nominalVoltage = 138.0;
11  ElectricalUnit nominalVoltageUnit = UNIT_kV;
12  bool isVoltageControlled = false;
13  double controlledVoltage = 1.0;
14  int controlledVoltageUnitChoice = 0; // 0 = p.u., 1 = same as nominalVoltageUnit (UNIT_V or UNIT_kV).
15  bool slackBus = false;
16 
17  // Power flow (p.u.)
18  std::complex<double> voltage = std::complex<double>(1.0, 0.0);
19  std::complex<double> power = std::complex<double>(0.0, 0.0);
20  int busType = 2; // PQ
21 
22  // Fault
23  bool hasFault = false;
24  FaultData faultType = FAULT_THREEPHASE;
25  FaultData faultLocation = FAULT_LINE_A;
26  // p.u. fault data
27  double faultResistance = 0.0;
28  double faultReactance = 0.0;
29  std::complex<double> faultCurrent[3] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
30  std::complex<double>(0.0, 0.0)};
31  std::complex<double> faultVoltage[3] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
32  std::complex<double>(0.0, 0.0)};
33  double scPower = 0.0;
34 
35  // Stability
36  bool plotBus = false;
37  bool stabHasFault = false;
38  double stabFaultTime = 0.0;
39  double stabFaultLength = 0.0;
40  double stabFaultResistance = 0.0;
41  double stabFaultReactance = 0.0;
42  std::vector<std::complex<double> > stabVoltageVector;
43 };
44 
45 class Bus : public PowerElement
46 {
47  public:
48  Bus();
49  Bus(wxPoint2DDouble position);
50  Bus(wxPoint2DDouble position, wxString name);
51  ~Bus();
52  virtual Element* GetCopy();
53  virtual bool AddParent(Element* parent, wxPoint2DDouble position) { return true; }
54  virtual bool Contains(wxPoint2DDouble position) const;
55  virtual bool Intersects(wxRect2DDouble rect) const;
56  virtual void Draw(wxPoint2DDouble translation, double scale) const;
57  virtual void Rotate(bool clockwise = true);
58  virtual wxCursor GetBestPickboxCursor() const;
59  virtual void MovePickbox(wxPoint2DDouble position);
60  virtual bool PickboxContains(wxPoint2DDouble position);
61  virtual bool GetContextMenu(wxMenu& menu);
62  virtual wxString GetTipText() const;
63  virtual BusElectricalData GetElectricalData() const { return m_electricalData; }
64  virtual void SetElectricalData(BusElectricalData electricalData) { m_electricalData = electricalData; }
65  virtual bool ShowForm(wxWindow* parent, Element* element);
66  virtual bool GetPlotData(ElementPlotData& plotData);
67 
68  protected:
69  BusElectricalData m_electricalData;
70 };
71 
72 #endif // BUS_H
-
FaultData
Information about fault (type and location).
Definition: PowerElement.h:38
- - -
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
-
Definition: Bus.h:45
- - - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef BUS_H
19 #define BUS_H
20 
21 #include "BusForm.h"
22 #include "PowerElement.h"
23 
25  int number = 0;
26  wxString name = "";
27  double nominalVoltage = 138.0;
28  ElectricalUnit nominalVoltageUnit = UNIT_kV;
29  bool isVoltageControlled = false;
30  double controlledVoltage = 1.0;
31  int controlledVoltageUnitChoice = 0; // 0 = p.u., 1 = same as nominalVoltageUnit (UNIT_V or UNIT_kV).
32  bool slackBus = false;
33 
34  // Power flow (p.u.)
35  std::complex<double> voltage = std::complex<double>(1.0, 0.0);
36  std::complex<double> power = std::complex<double>(0.0, 0.0);
37  int busType = 2; // PQ
38 
39  // Fault
40  bool hasFault = false;
41  FaultData faultType = FAULT_THREEPHASE;
42  FaultData faultLocation = FAULT_LINE_A;
43  // p.u. fault data
44  double faultResistance = 0.0;
45  double faultReactance = 0.0;
46  std::complex<double> faultCurrent[3] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
47  std::complex<double>(0.0, 0.0)};
48  std::complex<double> faultVoltage[3] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
49  std::complex<double>(0.0, 0.0)};
50  double scPower = 0.0;
51 
52  // Stability
53  bool plotBus = false;
54  bool stabHasFault = false;
55  double stabFaultTime = 0.0;
56  double stabFaultLength = 0.0;
57  double stabFaultResistance = 0.0;
58  double stabFaultReactance = 0.0;
59  std::vector<std::complex<double> > stabVoltageVector;
60 };
61 
62 class Bus : public PowerElement
63 {
64  public:
65  Bus();
66  Bus(wxPoint2DDouble position);
67  Bus(wxPoint2DDouble position, wxString name);
68  ~Bus();
69  virtual Element* GetCopy();
70  virtual bool AddParent(Element* parent, wxPoint2DDouble position) { return true; }
71  virtual bool Contains(wxPoint2DDouble position) const;
72  virtual bool Intersects(wxRect2DDouble rect) const;
73  virtual void Draw(wxPoint2DDouble translation, double scale) const;
74  virtual void Rotate(bool clockwise = true);
75  virtual wxCursor GetBestPickboxCursor() const;
76  virtual void MovePickbox(wxPoint2DDouble position);
77  virtual bool PickboxContains(wxPoint2DDouble position);
78  virtual bool GetContextMenu(wxMenu& menu);
79  virtual wxString GetTipText() const;
80  virtual BusElectricalData GetElectricalData() const { return m_electricalData; }
81  virtual void SetElectricalData(BusElectricalData electricalData) { m_electricalData = electricalData; }
82  virtual bool ShowForm(wxWindow* parent, Element* element);
83  virtual bool GetPlotData(ElementPlotData& plotData);
84 
85  protected:
86  BusElectricalData m_electricalData;
87 };
88 
89 #endif // BUS_H
+
FaultData
Information about fault (type and location).
Definition: PowerElement.h:55
+ + +
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+ +
Definition: Bus.h:62
+ + +
Switching data of power elements.
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Bus.h:53
- +
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Bus.h:70
+
diff --git a/docs/doxygen/html/_bus_form_8cpp_source.html b/docs/doxygen/html/_bus_form_8cpp_source.html index 691a10a..c75a647 100644 --- a/docs/doxygen/html/_bus_form_8cpp_source.html +++ b/docs/doxygen/html/_bus_form_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,19 +88,20 @@ $(document).ready(function(){initNavTree('_bus_form_8cpp_source.html','');});
BusForm.cpp
-
1 #include "BusForm.h"
2 #include "Bus.h"
3 
4 BusForm::BusForm(wxWindow* parent, Bus* bus) : BusFormBase(parent)
5 {
6  m_choiceFaultType->SetString(0, _("Three-phase"));
7  m_choiceFaultType->SetString(1, _("Line-to-line"));
8  m_choiceFaultType->SetString(2, _("Double line-to-ground"));
9  m_choiceFaultType->SetString(3, _("Line-to-ground"));
10 
11  SetSize(GetBestSize());
12 
13  m_parent = parent;
14  m_bus = bus;
15 
16  m_textCtrlName->SetValue(bus->GetElectricalData().name);
17  m_textCtrlNomVoltage->SetValue(bus->StringFromDouble(bus->GetElectricalData().nominalVoltage));
18 
19  if(bus->GetElectricalData().nominalVoltageUnit == UNIT_V)
20  m_choiceNomVoltage->SetSelection(0);
21  else
22  m_choiceNomVoltage->SetSelection(1);
23 
24  m_checkBoxCtrlVoltage->SetValue(bus->GetElectricalData().isVoltageControlled);
25  m_textCtrlCtrlVoltage->SetValue(bus->StringFromDouble(bus->GetElectricalData().controlledVoltage));
26  m_choiceCtrlVoltage->SetSelection(bus->GetElectricalData().controlledVoltageUnitChoice);
27  m_checkBoxSlackBus->SetValue(bus->GetElectricalData().slackBus);
28 
29  m_checkBoxFault->SetValue(bus->GetElectricalData().hasFault);
30  switch(bus->GetElectricalData().faultType) {
31  case FAULT_THREEPHASE: {
32  m_choiceFaultType->SetSelection(0);
33  } break;
34  case FAULT_2LINE: {
35  m_choiceFaultType->SetSelection(1);
36  } break;
37  case FAULT_2LINE_GROUND: {
38  m_choiceFaultType->SetSelection(2);
39  } break;
40  case FAULT_LINE_GROUND: {
41  m_choiceFaultType->SetSelection(3);
42  } break;
43  default:
44  break;
45  }
46  switch(bus->GetElectricalData().faultLocation) {
47  case FAULT_LINE_A: {
48  m_choiceFaultPlace->SetSelection(0);
49  } break;
50  case FAULT_LINE_B: {
51  m_choiceFaultPlace->SetSelection(1);
52  } break;
53  case FAULT_LINE_C: {
54  m_choiceFaultPlace->SetSelection(2);
55  } break;
56  default:
57  break;
58  }
59  m_textCtrlFaultResistance->SetValue(bus->StringFromDouble(bus->GetElectricalData().faultResistance));
60  m_textCtrlFaultReactance->SetValue(bus->StringFromDouble(bus->GetElectricalData().faultReactance));
61 
62  m_checkBoxPlotData->SetValue(bus->GetElectricalData().plotBus);
63  m_checkBoxStabFault->SetValue(bus->GetElectricalData().stabHasFault);
64  m_textCtrlStabFaultTime->SetValue(bus->StringFromDouble(bus->GetElectricalData().stabFaultTime));
65  m_textCtrlStabFaultLength->SetValue(bus->StringFromDouble(bus->GetElectricalData().stabFaultLength));
66  m_textCtrlStabFaultResistance->SetValue(bus->StringFromDouble(bus->GetElectricalData().stabFaultResistance));
67  m_textCtrlStabFaultReactance->SetValue(bus->StringFromDouble(bus->GetElectricalData().stabFaultReactance));
68 
69  EnableCtrlVoltageFields(bus->GetElectricalData().isVoltageControlled);
70  EnableFaultFields(bus->GetElectricalData().hasFault);
71  EnableStabFaultFields(bus->GetElectricalData().stabHasFault);
72 }
73 
74 BusForm::~BusForm() {}
75 void BusForm::OnButtonCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
76 void BusForm::OnButtonOKClick(wxCommandEvent& event)
77 {
78  BusElectricalData data = m_bus->GetElectricalData();
79  data.name = m_textCtrlName->GetValue();
80  if(!m_bus->DoubleFromString(m_parent, m_textCtrlNomVoltage->GetValue(), data.nominalVoltage,
81  _("Value entered incorrectly in the field \"Rated voltage\".")))
82  return;
83  data.nominalVoltageUnit = m_choiceNomVoltage->GetSelection() == 0 ? UNIT_V : UNIT_kV;
84  data.isVoltageControlled = m_checkBoxCtrlVoltage->GetValue();
85  if(data.isVoltageControlled) {
86  if(!m_bus->DoubleFromString(m_parent, m_textCtrlCtrlVoltage->GetValue(), data.controlledVoltage,
87  _("Value entered incorrectly in the field \"Controlled voltage\".")))
88  return;
89  data.controlledVoltageUnitChoice = m_choiceCtrlVoltage->GetSelection();
90  }
91  data.slackBus = m_checkBoxSlackBus->GetValue();
92 
93  data.hasFault = m_checkBoxFault->GetValue();
94  switch(m_choiceFaultType->GetSelection()) {
95  case 0: {
96  data.faultType = FAULT_THREEPHASE;
97  } break;
98  case 1: {
99  data.faultType = FAULT_2LINE;
100  } break;
101  case 2: {
102  data.faultType = FAULT_2LINE_GROUND;
103  } break;
104  case 3: {
105  data.faultType = FAULT_LINE_GROUND;
106  } break;
107  }
108 
109  switch(m_choiceFaultPlace->GetSelection()) {
110  case 0: {
111  data.faultLocation = FAULT_LINE_A;
112  } break;
113  case 1: {
114  data.faultLocation = FAULT_LINE_B;
115  } break;
116  case 2: {
117  data.faultLocation = FAULT_LINE_C;
118  } break;
119  }
120 
121  if(!m_bus->DoubleFromString(m_parent, m_textCtrlFaultResistance->GetValue(), data.faultResistance,
122  _("Value entered incorrectly in the field \"Fault resistance\".")))
123  return;
124 
125  if(!m_bus->DoubleFromString(m_parent, m_textCtrlFaultReactance->GetValue(), data.faultReactance,
126  _("Value entered incorrectly in the field \"Fault reactance\".")))
127  return;
128 
129  data.plotBus = m_checkBoxPlotData->GetValue();
130  data.stabHasFault = m_checkBoxStabFault->GetValue();
131 
132  if(!m_bus->DoubleFromString(m_parent, m_textCtrlStabFaultTime->GetValue(), data.stabFaultTime,
133  _("Value entered incorrectly in the field \"Time\".")))
134  return;
135 
136  if(!m_bus->DoubleFromString(m_parent, m_textCtrlStabFaultLength->GetValue(), data.stabFaultLength,
137  _("Value entered incorrectly in the field \"Fault lenght\".")))
138  return;
139 
140  if(!m_bus->DoubleFromString(m_parent, m_textCtrlStabFaultResistance->GetValue(), data.stabFaultResistance,
141  _("Value entered incorrectly in the field \"Fault resistence (stability)\".")))
142  return;
143 
144  if(!m_bus->DoubleFromString(m_parent, m_textCtrlStabFaultReactance->GetValue(), data.stabFaultReactance,
145  _("Value entered incorrectly in the field \"Fault reactance (stability)\".")))
146  return;
147 
148  m_bus->SetElectricalData(data);
149 
150  if(data.stabHasFault)
151  m_bus->SetDynamicEvent(true);
152  else
153  m_bus->SetDynamicEvent(false);
154 
155  EndModal(wxID_OK);
156 }
157 
158 void BusForm::OnNominalVoltageChoice(wxCommandEvent& event) { UpdateChoiceBoxes(); }
159 void BusForm::OnFaultTypeChoice(wxCommandEvent& event) { UpdateChoiceBoxes(); }
160 void BusForm::OnControlledVoltageClick(wxCommandEvent& event)
161 {
162  EnableCtrlVoltageFields(m_checkBoxCtrlVoltage->GetValue());
163 }
164 void BusForm::OnInsertFaultClick(wxCommandEvent& event) { EnableFaultFields(m_checkBoxFault->GetValue()); }
165 void BusForm::OnInsertStabFaultClick(wxCommandEvent& event) { EnableStabFaultFields(m_checkBoxStabFault->GetValue()); }
166 void BusForm::EnableCtrlVoltageFields(bool enable)
167 {
168  m_textCtrlCtrlVoltage->Enable(enable);
169  m_choiceCtrlVoltage->Enable(enable);
170 
171  UpdateChoiceBoxes();
172 }
173 
174 void BusForm::EnableFaultFields(bool enable)
175 {
176  m_choiceFaultType->Enable(enable);
177  m_choiceFaultPlace->Enable(enable);
178  m_textCtrlFaultReactance->Enable(enable);
179  m_textCtrlFaultResistance->Enable(enable);
180  m_staticTextPU_1->Enable(enable);
181  m_staticTextPU_2->Enable(enable);
182 
183  UpdateChoiceBoxes();
184 }
185 
186 void BusForm::EnableStabFaultFields(bool enable)
187 {
188  m_textCtrlStabFaultTime->Enable(enable);
189  m_textCtrlStabFaultLength->Enable(enable);
190  m_staticTextS_1->Enable(enable);
191  m_staticTextS_2->Enable(enable);
192  m_textCtrlStabFaultReactance->Enable(enable);
193  m_textCtrlStabFaultResistance->Enable(enable);
194  m_staticTextPU_3->Enable(enable);
195  m_staticTextPU_4->Enable(enable);
196 }
197 
198 void BusForm::UpdateChoiceBoxes()
199 {
200  switch(m_choiceFaultType->GetSelection()) {
201  case 0: // three-phase
202  {
203  m_choiceFaultPlace->Enable(false);
204  } break;
205  case 1: // line-to-line
206  case 2: // double line-to-line
207  {
208  if(m_checkBoxFault->GetValue()) m_choiceFaultPlace->Enable(true);
209  m_choiceFaultPlace->SetString(0, _("Lines AB"));
210  m_choiceFaultPlace->SetString(1, _("Lines BC"));
211  m_choiceFaultPlace->SetString(2, _("Lines CA"));
212  } break;
213  case 3: // line-to-ground
214  {
215  if(m_checkBoxFault->GetValue()) m_choiceFaultPlace->Enable(true);
216  m_choiceFaultPlace->SetString(0, _("Line A"));
217  m_choiceFaultPlace->SetString(1, _("Line B"));
218  m_choiceFaultPlace->SetString(2, _("Line C"));
219  } break;
220  default:
221  break;
222  }
223  switch(m_choiceNomVoltage->GetSelection()) {
224  case 0: {
225  m_choiceCtrlVoltage->SetString(1, _("V"));
226  } break;
227  case 1: {
228  m_choiceCtrlVoltage->SetString(1, _("kV"));
229  } break;
230  default:
231  break;
232  }
233 }
- - - - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "BusForm.h"
19 #include "Bus.h"
20 
21 BusForm::BusForm(wxWindow* parent, Bus* bus) : BusFormBase(parent)
22 {
23  m_choiceFaultType->SetString(0, _("Three-phase"));
24  m_choiceFaultType->SetString(1, _("Line-to-line"));
25  m_choiceFaultType->SetString(2, _("Double line-to-ground"));
26  m_choiceFaultType->SetString(3, _("Line-to-ground"));
27 
28  SetSize(GetBestSize());
29 
30  m_parent = parent;
31  m_bus = bus;
32 
33  m_textCtrlName->SetValue(bus->GetElectricalData().name);
34  m_textCtrlNomVoltage->SetValue(bus->StringFromDouble(bus->GetElectricalData().nominalVoltage));
35 
36  if(bus->GetElectricalData().nominalVoltageUnit == UNIT_V)
37  m_choiceNomVoltage->SetSelection(0);
38  else
39  m_choiceNomVoltage->SetSelection(1);
40 
41  m_checkBoxCtrlVoltage->SetValue(bus->GetElectricalData().isVoltageControlled);
42  m_textCtrlCtrlVoltage->SetValue(bus->StringFromDouble(bus->GetElectricalData().controlledVoltage));
43  m_choiceCtrlVoltage->SetSelection(bus->GetElectricalData().controlledVoltageUnitChoice);
44  m_checkBoxSlackBus->SetValue(bus->GetElectricalData().slackBus);
45 
46  m_checkBoxFault->SetValue(bus->GetElectricalData().hasFault);
47  switch(bus->GetElectricalData().faultType) {
48  case FAULT_THREEPHASE: {
49  m_choiceFaultType->SetSelection(0);
50  } break;
51  case FAULT_2LINE: {
52  m_choiceFaultType->SetSelection(1);
53  } break;
54  case FAULT_2LINE_GROUND: {
55  m_choiceFaultType->SetSelection(2);
56  } break;
57  case FAULT_LINE_GROUND: {
58  m_choiceFaultType->SetSelection(3);
59  } break;
60  default:
61  break;
62  }
63  switch(bus->GetElectricalData().faultLocation) {
64  case FAULT_LINE_A: {
65  m_choiceFaultPlace->SetSelection(0);
66  } break;
67  case FAULT_LINE_B: {
68  m_choiceFaultPlace->SetSelection(1);
69  } break;
70  case FAULT_LINE_C: {
71  m_choiceFaultPlace->SetSelection(2);
72  } break;
73  default:
74  break;
75  }
76  m_textCtrlFaultResistance->SetValue(bus->StringFromDouble(bus->GetElectricalData().faultResistance));
77  m_textCtrlFaultReactance->SetValue(bus->StringFromDouble(bus->GetElectricalData().faultReactance));
78 
79  m_checkBoxPlotData->SetValue(bus->GetElectricalData().plotBus);
80  m_checkBoxStabFault->SetValue(bus->GetElectricalData().stabHasFault);
81  m_textCtrlStabFaultTime->SetValue(bus->StringFromDouble(bus->GetElectricalData().stabFaultTime));
82  m_textCtrlStabFaultLength->SetValue(bus->StringFromDouble(bus->GetElectricalData().stabFaultLength));
83  m_textCtrlStabFaultResistance->SetValue(bus->StringFromDouble(bus->GetElectricalData().stabFaultResistance));
84  m_textCtrlStabFaultReactance->SetValue(bus->StringFromDouble(bus->GetElectricalData().stabFaultReactance));
85 
86  EnableCtrlVoltageFields(bus->GetElectricalData().isVoltageControlled);
87  EnableFaultFields(bus->GetElectricalData().hasFault);
88  EnableStabFaultFields(bus->GetElectricalData().stabHasFault);
89 }
90 
91 BusForm::~BusForm() {}
92 void BusForm::OnButtonCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
93 void BusForm::OnButtonOKClick(wxCommandEvent& event)
94 {
95  BusElectricalData data = m_bus->GetElectricalData();
96  data.name = m_textCtrlName->GetValue();
97  if(!m_bus->DoubleFromString(m_parent, m_textCtrlNomVoltage->GetValue(), data.nominalVoltage,
98  _("Value entered incorrectly in the field \"Rated voltage\".")))
99  return;
100  data.nominalVoltageUnit = m_choiceNomVoltage->GetSelection() == 0 ? UNIT_V : UNIT_kV;
101  data.isVoltageControlled = m_checkBoxCtrlVoltage->GetValue();
102  if(data.isVoltageControlled) {
103  if(!m_bus->DoubleFromString(m_parent, m_textCtrlCtrlVoltage->GetValue(), data.controlledVoltage,
104  _("Value entered incorrectly in the field \"Controlled voltage\".")))
105  return;
106  data.controlledVoltageUnitChoice = m_choiceCtrlVoltage->GetSelection();
107  }
108  data.slackBus = m_checkBoxSlackBus->GetValue();
109 
110  data.hasFault = m_checkBoxFault->GetValue();
111  switch(m_choiceFaultType->GetSelection()) {
112  case 0: {
113  data.faultType = FAULT_THREEPHASE;
114  } break;
115  case 1: {
116  data.faultType = FAULT_2LINE;
117  } break;
118  case 2: {
119  data.faultType = FAULT_2LINE_GROUND;
120  } break;
121  case 3: {
122  data.faultType = FAULT_LINE_GROUND;
123  } break;
124  }
125 
126  switch(m_choiceFaultPlace->GetSelection()) {
127  case 0: {
128  data.faultLocation = FAULT_LINE_A;
129  } break;
130  case 1: {
131  data.faultLocation = FAULT_LINE_B;
132  } break;
133  case 2: {
134  data.faultLocation = FAULT_LINE_C;
135  } break;
136  }
137 
138  if(!m_bus->DoubleFromString(m_parent, m_textCtrlFaultResistance->GetValue(), data.faultResistance,
139  _("Value entered incorrectly in the field \"Fault resistance\".")))
140  return;
141 
142  if(!m_bus->DoubleFromString(m_parent, m_textCtrlFaultReactance->GetValue(), data.faultReactance,
143  _("Value entered incorrectly in the field \"Fault reactance\".")))
144  return;
145 
146  data.plotBus = m_checkBoxPlotData->GetValue();
147  data.stabHasFault = m_checkBoxStabFault->GetValue();
148 
149  if(!m_bus->DoubleFromString(m_parent, m_textCtrlStabFaultTime->GetValue(), data.stabFaultTime,
150  _("Value entered incorrectly in the field \"Time\".")))
151  return;
152 
153  if(!m_bus->DoubleFromString(m_parent, m_textCtrlStabFaultLength->GetValue(), data.stabFaultLength,
154  _("Value entered incorrectly in the field \"Fault lenght\".")))
155  return;
156 
157  if(!m_bus->DoubleFromString(m_parent, m_textCtrlStabFaultResistance->GetValue(), data.stabFaultResistance,
158  _("Value entered incorrectly in the field \"Fault resistence (stability)\".")))
159  return;
160 
161  if(!m_bus->DoubleFromString(m_parent, m_textCtrlStabFaultReactance->GetValue(), data.stabFaultReactance,
162  _("Value entered incorrectly in the field \"Fault reactance (stability)\".")))
163  return;
164 
165  m_bus->SetElectricalData(data);
166 
167  if(data.stabHasFault)
168  m_bus->SetDynamicEvent(true);
169  else
170  m_bus->SetDynamicEvent(false);
171 
172  EndModal(wxID_OK);
173 }
174 
175 void BusForm::OnNominalVoltageChoice(wxCommandEvent& event) { UpdateChoiceBoxes(); }
176 void BusForm::OnFaultTypeChoice(wxCommandEvent& event) { UpdateChoiceBoxes(); }
177 void BusForm::OnControlledVoltageClick(wxCommandEvent& event)
178 {
179  EnableCtrlVoltageFields(m_checkBoxCtrlVoltage->GetValue());
180 }
181 void BusForm::OnInsertFaultClick(wxCommandEvent& event) { EnableFaultFields(m_checkBoxFault->GetValue()); }
182 void BusForm::OnInsertStabFaultClick(wxCommandEvent& event) { EnableStabFaultFields(m_checkBoxStabFault->GetValue()); }
183 void BusForm::EnableCtrlVoltageFields(bool enable)
184 {
185  m_textCtrlCtrlVoltage->Enable(enable);
186  m_choiceCtrlVoltage->Enable(enable);
187 
188  UpdateChoiceBoxes();
189 }
190 
191 void BusForm::EnableFaultFields(bool enable)
192 {
193  m_choiceFaultType->Enable(enable);
194  m_choiceFaultPlace->Enable(enable);
195  m_textCtrlFaultReactance->Enable(enable);
196  m_textCtrlFaultResistance->Enable(enable);
197  m_staticTextPU_1->Enable(enable);
198  m_staticTextPU_2->Enable(enable);
199 
200  UpdateChoiceBoxes();
201 }
202 
203 void BusForm::EnableStabFaultFields(bool enable)
204 {
205  m_textCtrlStabFaultTime->Enable(enable);
206  m_textCtrlStabFaultLength->Enable(enable);
207  m_staticTextS_1->Enable(enable);
208  m_staticTextS_2->Enable(enable);
209  m_textCtrlStabFaultReactance->Enable(enable);
210  m_textCtrlStabFaultResistance->Enable(enable);
211  m_staticTextPU_3->Enable(enable);
212  m_staticTextPU_4->Enable(enable);
213 }
214 
215 void BusForm::UpdateChoiceBoxes()
216 {
217  switch(m_choiceFaultType->GetSelection()) {
218  case 0: // three-phase
219  {
220  m_choiceFaultPlace->Enable(false);
221  } break;
222  case 1: // line-to-line
223  case 2: // double line-to-line
224  {
225  if(m_checkBoxFault->GetValue()) m_choiceFaultPlace->Enable(true);
226  m_choiceFaultPlace->SetString(0, _("Lines AB"));
227  m_choiceFaultPlace->SetString(1, _("Lines BC"));
228  m_choiceFaultPlace->SetString(2, _("Lines CA"));
229  } break;
230  case 3: // line-to-ground
231  {
232  if(m_checkBoxFault->GetValue()) m_choiceFaultPlace->Enable(true);
233  m_choiceFaultPlace->SetString(0, _("Line A"));
234  m_choiceFaultPlace->SetString(1, _("Line B"));
235  m_choiceFaultPlace->SetString(2, _("Line C"));
236  } break;
237  default:
238  break;
239  }
240  switch(m_choiceNomVoltage->GetSelection()) {
241  case 0: {
242  m_choiceCtrlVoltage->SetString(1, _("V"));
243  } break;
244  case 1: {
245  m_choiceCtrlVoltage->SetString(1, _("kV"));
246  } break;
247  default:
248  break;
249  }
250 }
+ + + + + -
Definition: Bus.h:45
- - - - -
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:300
- +
Definition: Bus.h:62
+ + + + +
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:320
+
diff --git a/docs/doxygen/html/_bus_form_8h.html b/docs/doxygen/html/_bus_form_8h.html new file mode 100644 index 0000000..27fa1f9 --- /dev/null +++ b/docs/doxygen/html/_bus_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/BusForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
BusForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  BusForm
 Form to edit the bus power data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_bus_form_8h_source.html b/docs/doxygen/html/_bus_form_8h_source.html index 7d112d3..4278bd7 100644 --- a/docs/doxygen/html/_bus_form_8h_source.html +++ b/docs/doxygen/html/_bus_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_bus_form_8h_source.html','');});
BusForm.h
-
1 #ifndef BUSFORM_H
2 #define BUSFORM_H
3 
4 #include "ElementForm.h"
5 class Bus;
6 
7 class BusForm : public BusFormBase
8 {
9 public:
10  BusForm(wxWindow* parent, Bus* bus);
11  virtual ~BusForm();
12 protected:
13  virtual void OnFaultTypeChoice(wxCommandEvent& event);
14  virtual void OnControlledVoltageClick(wxCommandEvent& event);
15  virtual void OnInsertFaultClick(wxCommandEvent& event);
16  virtual void OnInsertStabFaultClick(wxCommandEvent& event);
17  virtual void OnNominalVoltageChoice(wxCommandEvent& event);
18  virtual void OnButtonCancelClick(wxCommandEvent& event);
19  virtual void OnButtonOKClick(wxCommandEvent& event);
20  virtual void EnableCtrlVoltageFields(bool enable = true);
21  virtual void EnableFaultFields(bool enable = true);
22  virtual void EnableStabFaultFields(bool enable = true);
23  virtual void UpdateChoiceBoxes();
24 
25  Bus* m_bus = NULL;
26  wxWindow* m_parent = NULL;
27 };
28 #endif // BUSFORM_H
Definition: BusForm.h:7
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef BUSFORM_H
19 #define BUSFORM_H
20 
21 #include "ElementForm.h"
22 class Bus;
23 
31 class BusForm : public BusFormBase
32 {
33  public:
34  BusForm(wxWindow* parent, Bus* bus);
35  virtual ~BusForm();
36 
37  protected:
38  virtual void OnFaultTypeChoice(wxCommandEvent& event);
39  virtual void OnControlledVoltageClick(wxCommandEvent& event);
40  virtual void OnInsertFaultClick(wxCommandEvent& event);
41  virtual void OnInsertStabFaultClick(wxCommandEvent& event);
42  virtual void OnNominalVoltageChoice(wxCommandEvent& event);
43  virtual void OnButtonCancelClick(wxCommandEvent& event);
44  virtual void OnButtonOKClick(wxCommandEvent& event);
45  virtual void EnableCtrlVoltageFields(bool enable = true);
46  virtual void EnableFaultFields(bool enable = true);
47  virtual void EnableStabFaultFields(bool enable = true);
48  virtual void UpdateChoiceBoxes();
49 
50  Bus* m_bus = NULL;
51  wxWindow* m_parent = NULL;
52 };
53 #endif // BUSFORM_H
Form to edit the bus power data.
Definition: BusForm.h:31
-
Definition: Bus.h:45
+
Definition: Bus.h:62
-
1 #include "Camera.h"
2 
3 Camera::Camera()
4 {
5  m_translation = wxPoint2DDouble(0, 0);
6  m_scale = 1.0;
7 }
8 
9 Camera::~Camera() {}
10 wxPoint2DDouble Camera::ScreenToWorld(wxPoint2DDouble screenCoords) const
11 {
12  return wxPoint2DDouble(
13  screenCoords.m_x / m_scale - m_translation.m_x, screenCoords.m_y / m_scale - m_translation.m_y);
14 }
15 
16 void Camera::SetTranslation(wxPoint2DDouble screenPoint)
17 {
18  m_translation = screenPoint / m_scale - m_translationStartPt;
19 }
20 
21 void Camera::SetScale(wxPoint2DDouble screenPoint, double delta)
22 {
23  m_translation -= screenPoint * (1.0 - m_scale) / m_scale;
24 
25  m_scale += delta;
26 
27  // Limits: 5% - 300%
28  if(m_scale < m_zoomMin) m_scale = m_zoomMin;
29  if(m_scale > m_zoomMax) m_scale = m_zoomMax;
30 
31  m_translation += screenPoint * (1.0 - m_scale) / m_scale;
32 }
33 
34 wxPoint2DDouble Camera::GetMousePosition(bool worldCoords) const
35 {
36  if(worldCoords) return ScreenToWorld(m_mousePosition);
37  return m_mousePosition;
38 }
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Camera.h"
19 
20 Camera::Camera()
21 {
22  m_translation = wxPoint2DDouble(0, 0);
23  m_scale = 1.0;
24 }
25 
26 Camera::~Camera() {}
27 wxPoint2DDouble Camera::ScreenToWorld(wxPoint2DDouble screenCoords) const
28 {
29  return wxPoint2DDouble(screenCoords.m_x / m_scale - m_translation.m_x,
30  screenCoords.m_y / m_scale - m_translation.m_y);
31 }
32 
33 void Camera::SetTranslation(wxPoint2DDouble screenPoint)
34 {
35  m_translation = screenPoint / m_scale - m_translationStartPt;
36 }
37 
38 void Camera::SetScale(wxPoint2DDouble screenPoint, double delta)
39 {
40  m_translation -= screenPoint * (1.0 - m_scale) / m_scale;
41 
42  m_scale += delta;
43 
44  // Limits: 5% - 300%
45  if(m_scale < m_zoomMin) m_scale = m_zoomMin;
46  if(m_scale > m_zoomMax) m_scale = m_zoomMax;
47 
48  m_translation += screenPoint * (1.0 - m_scale) / m_scale;
49 }
50 
51 wxPoint2DDouble Camera::GetMousePosition(bool worldCoords) const
52 {
53  if(worldCoords) return ScreenToWorld(m_mousePosition);
54  return m_mousePosition;
55 }
+
-
1 #ifndef CAMERA_H
2 #define CAMERA_H
3 
4 #include <wx/geometry.h>
5 
6 class Camera
7 {
8 public:
9  Camera();
10  ~Camera();
11 
12  void SetScale(wxPoint2DDouble screenPoint, double delta);
13  void SetScale(double scale) { m_scale = scale; }
14  void SetTranslation(wxPoint2DDouble screenPoint);
15  void StartTranslation(wxPoint2DDouble startPoint) { this->m_translationStartPt = startPoint; }
16  void UpdateMousePosition(wxPoint2DDouble mousePosition) { this->m_mousePosition = mousePosition; }
17  double GetScale() const { return m_scale; }
18  wxPoint2DDouble GetTranslation() const { return m_translation; }
19  wxPoint2DDouble GetMousePosition(bool worldCoords = true) const;
20  wxPoint2DDouble ScreenToWorld(wxPoint2DDouble screenCoords) const;
21  double GetZoomMin() const { return m_zoomMin; }
22  double GetZoomMax() const { return m_zoomMax; }
23 
24 protected:
25  wxPoint2DDouble m_translation;
26  wxPoint2DDouble m_translationStartPt;
27  double m_scale;
28 
29  wxPoint2DDouble m_mousePosition;
30 
31  double m_zoomMin = 0.01;
32  double m_zoomMax = 3.0;
33 };
34 
35 #endif // CAMERA_H
Definition: Camera.h:6
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CAMERA_H
19 #define CAMERA_H
20 
21 #include <wx/geometry.h>
22 
30 class Camera
31 {
32  public:
33  Camera();
34  ~Camera();
35 
36  void SetScale(wxPoint2DDouble screenPoint, double delta);
37  void SetScale(double scale) { m_scale = scale; }
38  void SetTranslation(wxPoint2DDouble screenPoint);
39  void StartTranslation(wxPoint2DDouble startPoint) { this->m_translationStartPt = startPoint; }
40  void UpdateMousePosition(wxPoint2DDouble mousePosition) { this->m_mousePosition = mousePosition; }
41  double GetScale() const { return m_scale; }
42  wxPoint2DDouble GetTranslation() const { return m_translation; }
43  wxPoint2DDouble GetMousePosition(bool worldCoords = true) const;
44  wxPoint2DDouble ScreenToWorld(wxPoint2DDouble screenCoords) const;
45  double GetZoomMin() const { return m_zoomMin; }
46  double GetZoomMax() const { return m_zoomMax; }
47  protected:
48  wxPoint2DDouble m_translation;
49  wxPoint2DDouble m_translationStartPt;
50  double m_scale;
51 
52  wxPoint2DDouble m_mousePosition;
53 
54  double m_zoomMin = 0.01;
55  double m_zoomMax = 3.0;
56 };
57 
58 #endif // CAMERA_H
Class responsible for the correct visualization of the elements on screen.
Definition: Camera.h:30
-
1 #include "ReactiveShuntElementForm.h"
2 #include "Capacitor.h"
3 
4 Capacitor::Capacitor() : Shunt() {}
5 Capacitor::Capacitor(wxString name) : Shunt() { m_electricalData.name = name; }
6 Capacitor::~Capacitor() {}
7 bool Capacitor::AddParent(Element* parent, wxPoint2DDouble position)
8 {
9  if(parent) {
10  m_parentList.push_back(parent);
11  parent->AddChild(this);
12  wxPoint2DDouble parentPt =
13  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
14  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
15  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
16 
17  m_position = parentPt + wxPoint2DDouble(0.0, 100.0); // Shifts the position to the down of the bus.
18  m_width = 40;
19  m_height = 30;
20  m_rect = wxRect2DDouble(m_position.m_x - m_width / 2.0, m_position.m_y - m_height / 2.0, m_width, m_height);
21 
22  m_pointList.push_back(parentPt);
23  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
24  m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -m_height / 2.0 - 10.0));
25  m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -m_height / 2.0));
26 
27  m_inserted = true;
28 
29  wxRect2DDouble genRect(0, 0, 0, 0);
30  m_switchRect.push_back(genRect); // Push a general rectangle.
31  UpdateSwitches();
32 
33  return true;
34  }
35  return false;
36 }
37 
38 void Capacitor::Draw(wxPoint2DDouble translation, double scale) const
39 {
40  OpenGLColour elementColour;
41  if(m_online) {
42  if(m_dynEvent)
43  elementColour = m_dynamicEventColour;
44  else
45  elementColour = m_onlineElementColour;
46  } else
47  elementColour = m_offlineElementColour;
48 
49  if(m_inserted) {
50  std::vector<wxPoint2DDouble> capPts;
51  capPts.push_back(wxPoint2DDouble(m_position.m_x - m_width / 2.0, m_position.m_y - m_height / 2.0));
52  capPts.push_back(wxPoint2DDouble(m_position.m_x + m_width / 2.0, m_position.m_y - m_height / 2.0));
53  capPts.push_back(wxPoint2DDouble(m_position.m_x - m_width / 2.0, m_position.m_y - m_height / 2.0 + 10.0));
54  capPts.push_back(wxPoint2DDouble(m_position.m_x + m_width / 2.0, m_position.m_y - m_height / 2.0 + 10.0));
55 
56  if(m_selected) {
57  glLineWidth(1.5 + m_borderSize * 2.0);
58  glColor4dv(m_selectionColour.GetRGBA());
59 
60  DrawLine(m_pointList);
61 
62  glPushMatrix();
63  glTranslated(m_position.m_x, m_position.m_y, 0.0);
64  glRotated(m_angle, 0.0, 0.0, 1.0);
65  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
66 
67  DrawLine(capPts, GL_LINES);
68 
69  DrawGround(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 10.0));
70 
71  glPopMatrix();
72 
73  // Draw node selection.
74  DrawCircle(m_pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
75  }
76  // Draw Capacitor (layer 2).
77  glLineWidth(1.5);
78  glColor4dv(elementColour.GetRGBA());
79  DrawCircle(m_pointList[0], 5.0, 10, GL_POLYGON);
80  DrawLine(m_pointList);
81 
82  DrawSwitches();
83 
84  glPushMatrix();
85  glTranslated(m_position.m_x, m_position.m_y, 0.0);
86  glRotated(m_angle, 0.0, 0.0, 1.0);
87  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
88 
89  glColor4dv(elementColour.GetRGBA());
90  DrawLine(capPts, GL_LINES);
91 
92  DrawGround(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 10.0));
93 
94  glPopMatrix();
95  }
96 }
97 
98 void Capacitor::Rotate(bool clockwise)
99 {
100  double rotAngle = m_rotationAngle;
101  if(!clockwise) rotAngle = -m_rotationAngle;
102 
103  m_angle += rotAngle;
104  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
105  m_pointList[2] = RotateAtPosition(m_pointList[2], rotAngle);
106  m_pointList[3] = RotateAtPosition(m_pointList[3], rotAngle);
107  UpdateSwitchesPosition();
108 }
109 
110 bool Capacitor::GetContextMenu(wxMenu& menu)
111 {
112  menu.Append(ID_EDIT_ELEMENT, _("Edit Capacitor"));
113  GeneralMenuItens(menu);
114  return true;
115 }
116 
117 bool Capacitor::Contains(wxPoint2DDouble position) const
118 {
119  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
120  return m_rect.Contains(ptR);
121 }
122 
123 bool Capacitor::Intersects(wxRect2DDouble rect) const
124 {
125  return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0);
126 }
127 
128 bool Capacitor::ShowForm(wxWindow* parent, Element* element)
129 {
130  ReactiveShuntElementForm* capacitorForm = new ReactiveShuntElementForm(parent, this);
131  capacitorForm->SetTitle(_("Capacitor"));
132  if(capacitorForm->ShowModal() == wxID_OK) {
133  capacitorForm->Destroy();
134  return true;
135  }
136  capacitorForm->Destroy();
137  return false;
138 }
139 
140 CapacitorElectricalData Capacitor::GetPUElectricalData(double systemPowerBase)
141 {
142  CapacitorElectricalData data = m_electricalData;
143  switch(data.reactivePowerUnit) {
144  case UNIT_VAr: {
145  data.reactivePower = data.reactivePower / systemPowerBase;
146  data.reactivePowerUnit = UNIT_PU;
147  } break;
148  case UNIT_kVAr: {
149  data.reactivePower = (data.reactivePower * 1e3) / systemPowerBase;
150  data.reactivePowerUnit = UNIT_PU;
151  } break;
152  case UNIT_MVAr: {
153  data.reactivePower = (data.reactivePower * 1e6) / systemPowerBase;
154  data.reactivePowerUnit = UNIT_PU;
155  } break;
156  default:
157  break;
158  }
159 
160  return data;
161 }
162 
164 {
165  Capacitor* copy = new Capacitor();
166  *copy = *this;
167  return copy;
168 }
169 
170 wxString Capacitor::GetTipText() const
171 {
172  wxString tipText = m_electricalData.name;
173 
174  // TODO: Avoid reactive power calculation.
175  double reactivePower = m_electricalData.reactivePower;
176  if(!m_online)
177  reactivePower = 0.0;
178  else {
179  std::complex<double> v = static_cast<Bus*>(m_parentList[0])->GetElectricalData().voltage;
180  reactivePower *= std::pow(std::abs(v), 2);
181  }
182  tipText += "\n";
183  tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
184  switch(m_electricalData.reactivePowerUnit) {
185  case UNIT_PU: {
186  tipText += _(" p.u.");
187  } break;
188  case UNIT_VAr: {
189  tipText += _(" VAr");
190  } break;
191  case UNIT_kVAr: {
192  tipText += _(" kVAr");
193  } break;
194  case UNIT_MVAr: {
195  tipText += _(" MVAr");
196  } break;
197  default:
198  break;
199  }
200 
201  return tipText;
202 }
double GetAngle() const
Get the element angle.
Definition: Element.h:201
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Capacitor.cpp:128
- -
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Capacitor.cpp:110
- -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Capacitor.cpp:98
-
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:91
- -
virtual Element * GetCopy()
Get a the element copy.
Definition: Capacitor.cpp:163
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Capacitor.cpp:117
-
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Capacitor.cpp:123
-
Definition: Bus.h:45
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Capacitor.cpp:38
- -
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:333
- - - - -
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:171
-
Definition: Shunt.h:7
-
virtual wxString GetTipText() const
Get the tip text.
Definition: Capacitor.cpp:170
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Capacitor.cpp:7
- - -
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:83
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
19 #include "Capacitor.h"
20 
21 Capacitor::Capacitor() : Shunt() {}
22 Capacitor::Capacitor(wxString name) : Shunt() { m_electricalData.name = name; }
23 Capacitor::~Capacitor() {}
24 bool Capacitor::AddParent(Element* parent, wxPoint2DDouble position)
25 {
26  if(parent) {
27  m_parentList.push_back(parent);
28  parent->AddChild(this);
29  wxPoint2DDouble parentPt =
30  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
31  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
32  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
33 
34  m_position = parentPt + wxPoint2DDouble(0.0, 100.0); // Shifts the position to the down of the bus.
35  m_width = 40;
36  m_height = 30;
37  m_rect = wxRect2DDouble(m_position.m_x - m_width / 2.0, m_position.m_y - m_height / 2.0, m_width, m_height);
38 
39  m_pointList.push_back(parentPt);
40  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
41  m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -m_height / 2.0 - 10.0));
42  m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -m_height / 2.0));
43 
44  m_inserted = true;
45 
46  wxRect2DDouble genRect(0, 0, 0, 0);
47  m_switchRect.push_back(genRect); // Push a general rectangle.
48  UpdateSwitches();
49 
50  return true;
51  }
52  return false;
53 }
54 
55 void Capacitor::Draw(wxPoint2DDouble translation, double scale) const
56 {
57  OpenGLColour elementColour;
58  if(m_online) {
59  if(m_dynEvent)
60  elementColour = m_dynamicEventColour;
61  else
62  elementColour = m_onlineElementColour;
63  } else
64  elementColour = m_offlineElementColour;
65 
66  if(m_inserted) {
67  std::vector<wxPoint2DDouble> capPts;
68  capPts.push_back(wxPoint2DDouble(m_position.m_x - m_width / 2.0, m_position.m_y - m_height / 2.0));
69  capPts.push_back(wxPoint2DDouble(m_position.m_x + m_width / 2.0, m_position.m_y - m_height / 2.0));
70  capPts.push_back(wxPoint2DDouble(m_position.m_x - m_width / 2.0, m_position.m_y - m_height / 2.0 + 10.0));
71  capPts.push_back(wxPoint2DDouble(m_position.m_x + m_width / 2.0, m_position.m_y - m_height / 2.0 + 10.0));
72 
73  if(m_selected) {
74  glLineWidth(1.5 + m_borderSize * 2.0);
75  glColor4dv(m_selectionColour.GetRGBA());
76 
77  DrawLine(m_pointList);
78 
79  glPushMatrix();
80  glTranslated(m_position.m_x, m_position.m_y, 0.0);
81  glRotated(m_angle, 0.0, 0.0, 1.0);
82  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
83 
84  DrawLine(capPts, GL_LINES);
85 
86  DrawGround(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 10.0));
87 
88  glPopMatrix();
89 
90  // Draw node selection.
91  DrawCircle(m_pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
92  }
93  // Draw Capacitor (layer 2).
94  glLineWidth(1.5);
95  glColor4dv(elementColour.GetRGBA());
96  DrawCircle(m_pointList[0], 5.0, 10, GL_POLYGON);
97  DrawLine(m_pointList);
98 
99  DrawSwitches();
100 
101  glPushMatrix();
102  glTranslated(m_position.m_x, m_position.m_y, 0.0);
103  glRotated(m_angle, 0.0, 0.0, 1.0);
104  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
105 
106  glColor4dv(elementColour.GetRGBA());
107  DrawLine(capPts, GL_LINES);
108 
109  DrawGround(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 10.0));
110 
111  glPopMatrix();
112  }
113 }
114 
115 void Capacitor::Rotate(bool clockwise)
116 {
117  double rotAngle = m_rotationAngle;
118  if(!clockwise) rotAngle = -m_rotationAngle;
119 
120  m_angle += rotAngle;
121  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
122  m_pointList[2] = RotateAtPosition(m_pointList[2], rotAngle);
123  m_pointList[3] = RotateAtPosition(m_pointList[3], rotAngle);
124  UpdateSwitchesPosition();
125 }
126 
127 bool Capacitor::GetContextMenu(wxMenu& menu)
128 {
129  menu.Append(ID_EDIT_ELEMENT, _("Edit Capacitor"));
130  GeneralMenuItens(menu);
131  return true;
132 }
133 
134 bool Capacitor::Contains(wxPoint2DDouble position) const
135 {
136  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
137  return m_rect.Contains(ptR);
138 }
139 
140 bool Capacitor::Intersects(wxRect2DDouble rect) const
141 {
142  return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0);
143 }
144 
145 bool Capacitor::ShowForm(wxWindow* parent, Element* element)
146 {
147  ReactiveShuntElementForm* capacitorForm = new ReactiveShuntElementForm(parent, this);
148  capacitorForm->SetTitle(_("Capacitor"));
149  if(capacitorForm->ShowModal() == wxID_OK) {
150  capacitorForm->Destroy();
151  return true;
152  }
153  capacitorForm->Destroy();
154  return false;
155 }
156 
157 CapacitorElectricalData Capacitor::GetPUElectricalData(double systemPowerBase)
158 {
159  CapacitorElectricalData data = m_electricalData;
160  switch(data.reactivePowerUnit) {
161  case UNIT_VAr: {
162  data.reactivePower = data.reactivePower / systemPowerBase;
163  data.reactivePowerUnit = UNIT_PU;
164  } break;
165  case UNIT_kVAr: {
166  data.reactivePower = (data.reactivePower * 1e3) / systemPowerBase;
167  data.reactivePowerUnit = UNIT_PU;
168  } break;
169  case UNIT_MVAr: {
170  data.reactivePower = (data.reactivePower * 1e6) / systemPowerBase;
171  data.reactivePowerUnit = UNIT_PU;
172  } break;
173  default:
174  break;
175  }
176 
177  return data;
178 }
179 
181 {
182  Capacitor* copy = new Capacitor();
183  *copy = *this;
184  return copy;
185 }
186 
187 wxString Capacitor::GetTipText() const
188 {
189  wxString tipText = m_electricalData.name;
190 
191  // TODO: Avoid reactive power calculation.
192  double reactivePower = m_electricalData.reactivePower;
193  if(!m_online)
194  reactivePower = 0.0;
195  else {
196  std::complex<double> v = static_cast<Bus*>(m_parentList[0])->GetElectricalData().voltage;
197  reactivePower *= std::pow(std::abs(v), 2);
198  }
199  tipText += "\n";
200  tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
201  switch(m_electricalData.reactivePowerUnit) {
202  case UNIT_PU: {
203  tipText += _(" p.u.");
204  } break;
205  case UNIT_VAr: {
206  tipText += _(" VAr");
207  } break;
208  case UNIT_kVAr: {
209  tipText += _(" kVAr");
210  } break;
211  case UNIT_MVAr: {
212  tipText += _(" MVAr");
213  } break;
214  default:
215  break;
216  }
217 
218  return tipText;
219 }
double GetAngle() const
Get the element angle.
Definition: Element.h:212
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Capacitor.cpp:145
+ +
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Capacitor.cpp:127
+ +
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Capacitor.cpp:115
+ +
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:107
+ +
virtual Element * GetCopy()
Get a the element copy.
Definition: Capacitor.cpp:180
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Capacitor.cpp:134
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Capacitor.cpp:140
+
Definition: Bus.h:62
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Capacitor.cpp:55
+ +
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:353
+ + + + +
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:187
+
Definition: Shunt.h:24
+
virtual wxString GetTipText() const
Get the tip text.
Definition: Capacitor.cpp:187
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Capacitor.cpp:24
+
Form to edit the reactive shunt element power data.
+ +
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:101
diff --git a/docs/doxygen/html/_capacitor_8h_source.html b/docs/doxygen/html/_capacitor_8h_source.html index c33b942..179289e 100644 --- a/docs/doxygen/html/_capacitor_8h_source.html +++ b/docs/doxygen/html/_capacitor_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,13 +88,13 @@ $(document).ready(function(){initNavTree('_capacitor_8h_source.html','');});
Capacitor.h
-
1 #ifndef CAPACITOR_H
2 #define CAPACITOR_H
3 
4 #include "Shunt.h"
5 
7 
9  wxString name;
10  double reactivePower = 100.0;
11  ElectricalUnit reactivePowerUnit = UNIT_MVAr;
12 };
13 
14 class Capacitor : public Shunt
15 {
16 public:
17  Capacitor();
18  Capacitor(wxString name);
19  ~Capacitor();
20 
21  virtual Element* GetCopy();
22  virtual bool AddParent(Element* parent, wxPoint2DDouble position);
23  virtual void Draw(wxPoint2DDouble translation, double scale) const;
24  virtual bool Contains(wxPoint2DDouble position) const;
25  virtual bool Intersects(wxRect2DDouble rect) const;
26  virtual void Rotate(bool clockwise = true);
27  virtual bool GetContextMenu(wxMenu& menu);
28  virtual wxString GetTipText() const;
29  virtual bool ShowForm(wxWindow* parent, Element* element);
30  virtual CapacitorElectricalData GetElectricalData() { return m_electricalData; }
31  virtual CapacitorElectricalData GetPUElectricalData(double systemPowerBase);
32  virtual void SetElectricalData(CapacitorElectricalData electricalData) { m_electricalData = electricalData; }
33 protected:
34  CapacitorElectricalData m_electricalData;
35 };
36 
37 #endif // CAPACITOR_H
-
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
- - -
Definition: Shunt.h:7
- - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CAPACITOR_H
19 #define CAPACITOR_H
20 
21 #include "Shunt.h"
22 
24 
26  wxString name;
27  double reactivePower = 100.0;
28  ElectricalUnit reactivePowerUnit = UNIT_MVAr;
29 };
30 
31 class Capacitor : public Shunt
32 {
33  public:
34  Capacitor();
35  Capacitor(wxString name);
36  ~Capacitor();
37 
38  virtual Element* GetCopy();
39  virtual bool AddParent(Element* parent, wxPoint2DDouble position);
40  virtual void Draw(wxPoint2DDouble translation, double scale) const;
41  virtual bool Contains(wxPoint2DDouble position) const;
42  virtual bool Intersects(wxRect2DDouble rect) const;
43  virtual void Rotate(bool clockwise = true);
44  virtual bool GetContextMenu(wxMenu& menu);
45  virtual wxString GetTipText() const;
46  virtual bool ShowForm(wxWindow* parent, Element* element);
47  virtual CapacitorElectricalData GetElectricalData() { return m_electricalData; }
48  virtual CapacitorElectricalData GetPUElectricalData(double systemPowerBase);
49  virtual void SetElectricalData(CapacitorElectricalData electricalData) { m_electricalData = electricalData; }
50  protected:
51  CapacitorElectricalData m_electricalData;
52 };
53 
54 #endif // CAPACITOR_H
+
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+ + +
Definition: Shunt.h:24
+
Form to edit the reactive shunt element power data.
+
diff --git a/docs/doxygen/html/_chart_view_8cpp_source.html b/docs/doxygen/html/_chart_view_8cpp_source.html index 33c9bfa..c531030 100644 --- a/docs/doxygen/html/_chart_view_8cpp_source.html +++ b/docs/doxygen/html/_chart_view_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,9 +88,10 @@ $(document).ready(function(){initNavTree('_chart_view_8cpp_source.html','');});
ChartView.cpp
-
1 #include "ChartView.h"
2 #include "ElementPlotData.h"
3 
4 ChartView::ChartView(wxWindow* parent, std::vector<ElementPlotData> epdList, std::vector<double> time)
5  : ChartViewBase(parent)
6 {
7  m_epdList = epdList;
8  m_time = time;
9  m_xAxisValues = time;
10 
11  m_menuItemShowGrid->Check(m_hideGrid ? false : true);
12  m_menuItemShowLabel->Check(m_showLeg);
13  m_menuItemShowCoordinates->Check(m_showCoords);
14  m_menuItemDarkTheme->Check(m_darkTheme);
15 
16  // Create color property.
17  m_pgPropColor = m_pgMgr->Insert(m_pgPropLineProp, 1, new wxColourProperty(_("Color")));
18  m_pgPropColor->SetEditor(wxT("ChoiceAndButton"));
19  m_pgPropColor->SetValue(static_cast<wxVariant>(*wxBLACK));
20 
21  // Set margins and axis limit to composed mode.
22  m_pgPropMargins->SetValue(wxT("<composed>"));
23  m_pgMgr->Collapse(m_pgPropMargins);
24  m_pgPropAxisLimit->SetValue(wxT("<composed>"));
25  m_pgMgr->Collapse(m_pgPropAxisLimit);
26 
27  // Add line type choices
28  m_pgProplineType->AddChoice(_("Solid"), wxPENSTYLE_SOLID);
29  m_pgProplineType->AddChoice(_("Dot"), wxPENSTYLE_DOT);
30  m_pgProplineType->AddChoice(_("Dash"), wxPENSTYLE_SHORT_DASH);
31  m_pgProplineType->AddChoice(_("Dot and dash"), wxPENSTYLE_DOT_DASH);
32  m_pgProplineType->AddChoice(_("Cross"), wxPENSTYLE_CROSS_HATCH);
33  m_pgProplineType->AddChoice(_("Driagonal cross"), wxPENSTYLE_CROSSDIAG_HATCH);
34 
35  SetMPWindow();
36  GetSizer()->Add(m_mpWindow, 1, wxEXPAND, WXC_FROM_DIP(5));
37  SetTreectrl();
38  Layout();
39  SetInitialSize();
40 
41  BuildColourList();
42 }
43 
44 ChartView::~ChartView() {}
45 void ChartView::SetMPWindow()
46 {
47  m_mpWindow = new mpWindow(this, wxID_ANY);
48 
49  m_mpWindow->SetDoubleBuffered(true);
50 
51  m_mpWindow->SetMargins(20, 10, 40, 60);
52  m_xaxis = new mpScaleX("", mpALIGN_BOTTOM, true);
53  m_yaxis = new mpScaleY("", mpALIGN_LEFT, true);
54  m_xaxis->SetDrawOutsideMargins(false);
55  m_yaxis->SetDrawOutsideMargins(false);
56  m_xaxis->SetTicks(m_hideGrid);
57  m_yaxis->SetTicks(m_hideGrid);
58 
59  m_leg = new mpInfoLegend(wxRect(200, 20, 40, 40), wxWHITE_BRUSH);
60  m_coords = new mpInfoCoords(wxRect(0, 0, 0, 0), wxWHITE_BRUSH);
61 
62  m_chartTitle = new mpText("", 50, 0);
63  wxFont chartTitleFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
64  m_chartTitle->SetFont(chartTitleFont);
65 
66  m_mpWindow->AddLayer(m_xaxis);
67  m_mpWindow->AddLayer(m_yaxis);
68  m_mpWindow->AddLayer(m_leg);
69  m_mpWindow->AddLayer(m_coords);
70  m_mpWindow->AddLayer(m_chartTitle);
71 
72  m_leg->SetVisible(m_showLeg);
73  m_coords->SetVisible(m_showCoords);
74 
75  m_mpWindow->EnableDoubleBuffer(true);
76  m_mpWindow->LockAspect(false);
77  Fit();
78 }
79 
80 void ChartView::SetTreectrl()
81 {
82  wxTreeItemId rootID = m_treeCtrl->AddRoot(wxT("root"));
83  m_treeTimeID = m_treeCtrl->AppendItem(rootID, _("Time"));
84  m_treeCtrl->SetItemTextColour(m_treeTimeID, *wxRED);
85 
86  bool firstElement[ElementPlotData::NUM_ELEMENTS];
87  for(int i = 0; i < ElementPlotData::NUM_ELEMENTS; ++i) firstElement[i] = true;
88 
89  wxString rootElementName[ElementPlotData::NUM_ELEMENTS];
90  rootElementName[ElementPlotData::CT_BUS] = _("Bus");
91  rootElementName[ElementPlotData::CT_IND_MOTOR] = _("Induction motor");
92  rootElementName[ElementPlotData::CT_LINE] = _("Line");
93  rootElementName[ElementPlotData::CT_LOAD] = _("Load");
94  rootElementName[ElementPlotData::CT_SHUNT_CAPACITOR] = _("Capacitor");
95  rootElementName[ElementPlotData::CT_SHUNT_INDUCTOR] = _("Inductor");
96  rootElementName[ElementPlotData::CT_SYNC_COMPENSATOR] = _("Synchronous compensator");
97  rootElementName[ElementPlotData::CT_SYNC_GENERATOR] = _("Synchronous generator");
98  rootElementName[ElementPlotData::CT_TRANSFORMER] = _("Transformer");
99  rootElementName[ElementPlotData::CT_TEST] = _("Test");
100 
101  wxTreeItemId rootItemID[ElementPlotData::NUM_ELEMENTS];
102 
103  for(auto it = m_epdList.begin(), itEnd = m_epdList.end(); it != itEnd; ++it) {
104  ElementPlotData data = *it;
105  ElementPlotData::CurveType curveType = data.GetCurveType();
106 
107  if(firstElement[curveType]) {
108  rootItemID[curveType] = m_treeCtrl->AppendItem(rootID, rootElementName[curveType]);
109  firstElement[curveType] = false;
110  }
111  wxTreeItemId itemID = m_treeCtrl->AppendItem(rootItemID[curveType], data.GetName());
112  for(int i = 0; i < data.GetElementDataNumber(); ++i) {
113  m_treeCtrl->AppendItem(itemID, data.GetDataName(i), -1, -1, data.GetPlotData(i));
114  }
115  }
116 }
117 
118 void ChartView::OnPropertyGridChange(wxPropertyGridEvent& event)
119 {
120  bool fit = false;
121 
122  if(m_treeCtrl->GetSelection()) {
123  if(PlotData* data = dynamic_cast<PlotData*>(m_treeCtrl->GetItemData(m_treeCtrl->GetSelection()))) {
124  if(event.GetPropertyName() == _("Draw")) {
125  bool isPlotting = m_pgPropDraw->GetValue();
126  data->SetPlot(isPlotting);
127  if(isPlotting) {
128  wxColour colour = GetNextColour();
129  data->SetColour(colour);
130  m_pgPropColor->SetValue(static_cast<wxVariant>(colour));
131  m_treeCtrl->SetItemBold(m_treeCtrl->GetSelection(), true);
132  } else {
133  m_treeCtrl->SetItemBold(m_treeCtrl->GetSelection(), false);
134  }
135  fit = true;
136  } else if(event.GetPropertyName() == _("Color")) {
137  wxColour colour;
138  colour << m_pgPropColor->GetValue();
139  data->SetColour(colour);
140  } else if(event.GetPropertyName() == _("Thickness")) {
141  data->SetThick(m_pgProplineThick->GetValue().GetInteger());
142  } else if(event.GetPropertyName() == _("Type")) {
143  data->SetPenType(static_cast<wxPenStyle>(m_pgProplineType->GetValue().GetInteger()));
144  } else if(event.GetPropertyName() == _("Axis")) {
145  int axis = m_pgProplineAxis->GetValue().GetInteger();
146  if(axis == 1) { // Y
147  // All lines to Y axis
148  AllToYAxis(m_treeCtrl->GetRootItem());
149  // curva selecionada para o eixo X
150  m_treeCtrl->SetItemTextColour(m_treeCtrl->GetSelection(), *wxRED);
151  m_xAxisValues = data->GetValues();
152  }
153  data->SetAxis(axis);
154  fit = true;
155  }
156  }
157  }
158 
159  if(event.GetPropertyName() == _("Margins")) {
160  m_mpWindow->SetMargins(m_pgPropMarginsUp->GetValue().GetLong(), m_pgPropMarginsRight->GetValue().GetLong(),
161  m_pgPropMarginsBot->GetValue().GetLong(), m_pgPropMarginsLeft->GetValue().GetLong());
162  m_mpWindow->UpdateAll();
163  }
164  if(event.GetPropertyName() == _("Axis limit")) {
165  m_mpWindow->Fit(m_pgPropXMin->GetValue().GetDouble(), m_pgPropXMax->GetValue().GetDouble(),
166  m_pgPropYMin->GetValue().GetDouble(), m_pgPropYMax->GetValue().GetDouble());
167  m_mpWindow->UpdateAll();
168  }
169  UpdatePlot(fit);
170 }
171 
172 void ChartView::OnMenuDarkThemeClick(wxCommandEvent& event)
173 {
174  m_darkTheme = event.IsChecked();
175  wxColour grey(96, 96, 96);
176 
177  if(m_darkTheme) {
178  m_mpWindow->SetColourTheme(*wxBLACK, *wxWHITE, grey);
179  m_leg->SetBrush(*wxBLACK_BRUSH);
180  m_coords->SetBrush(*wxBLACK_BRUSH);
181  } else {
182  m_mpWindow->SetColourTheme(*wxWHITE, *wxBLACK, grey);
183  m_leg->SetBrush(*wxWHITE_BRUSH);
184  m_coords->SetBrush(*wxWHITE_BRUSH);
185  }
186 
187  m_mpWindow->UpdateAll();
188 }
189 
190 void ChartView::OnMenuSaveImageClick(wxCommandEvent& event)
191 {
192  int x = m_mpWindow->GetScreenPosition().x;
193  int y = m_mpWindow->GetScreenPosition().y;
194  int width = m_mpWindow->GetSize().GetWidth();
195  int height = m_mpWindow->GetSize().GetHeight();
196 
197  wxScreenDC dcScreen;
198  wxBitmap screenshot(width, height);
199 
200  wxMemoryDC memDC;
201  memDC.SelectObject(screenshot);
202 
203  memDC.Blit(0, 0, width, height, &dcScreen, x, y);
204  memDC.SelectObject(wxNullBitmap);
205 
206  wxFileDialog saveFileDialog(
207  this, _("Save image"), "", "",
208  "PNG image file (*.png)|*.png|Bitmap image file (*.bmp)|*.bmp|JPEG image file (*.jpg)|*.jpg",
209  wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
210  if(saveFileDialog.ShowModal() == wxID_CANCEL) return;
211 
212  wxFileName imagePath(saveFileDialog.GetPath());
213  wxBitmapType imageType = wxBITMAP_TYPE_BMP;
214 
215  if(imagePath.GetExt() == "png")
216  imageType = wxBITMAP_TYPE_PNG;
217  else if(imagePath.GetExt() == "jpg")
218  imageType = wxBITMAP_TYPE_JPEG;
219 
220  screenshot.SaveFile(imagePath.GetFullPath(), imageType);
221 }
222 
223 void ChartView::OnMenuSendClipClick(wxCommandEvent& event)
224 {
225  int x = m_mpWindow->GetScreenPosition().x;
226  int y = m_mpWindow->GetScreenPosition().y;
227  int width = m_mpWindow->GetSize().GetWidth();
228  int height = m_mpWindow->GetSize().GetHeight();
229 
230  wxScreenDC dcScreen;
231  wxBitmap screenshot(width, height);
232 
233  wxMemoryDC memDC;
234  memDC.SelectObject(screenshot);
235 
236  memDC.Blit(0, 0, width, height, &dcScreen, x, y);
237  memDC.SelectObject(wxNullBitmap);
238 
239  if(wxTheClipboard->Open()) {
240  wxTheClipboard->SetData(new wxBitmapDataObject(screenshot));
241  wxTheClipboard->Close();
242 
243  wxMessageDialog msgDialog(this, _("Chart send to clipboard"), _("Info"), wxOK | wxICON_INFORMATION,
244  wxDefaultPosition);
245  msgDialog.ShowModal();
246  } else {
247  wxMessageDialog msgDialog(this, _("It was not possible to send to clipboard"), _("Error"), wxOK | wxICON_ERROR,
248  wxDefaultPosition);
249  msgDialog.ShowModal();
250  }
251 }
252 
253 void ChartView::OnMenuShowCoordinatesClick(wxCommandEvent& event)
254 {
255  m_showCoords = event.IsChecked();
256  m_coords->SetVisible(m_showCoords);
257  m_mpWindow->UpdateAll();
258 }
259 
260 void ChartView::OnMenuShowGridClick(wxCommandEvent& event)
261 {
262  m_hideGrid = event.IsChecked() ? false : true;
263  m_xaxis->SetTicks(m_hideGrid);
264  m_yaxis->SetTicks(m_hideGrid);
265  m_mpWindow->UpdateAll();
266 }
267 
268 void ChartView::OnMenuShowLabelClick(wxCommandEvent& event)
269 {
270  m_showLeg = event.IsChecked();
271  m_leg->SetVisible(m_showLeg);
272  m_mpWindow->UpdateAll();
273 }
274 
275 void ChartView::Fit()
276 {
277  m_mpWindow->Fit();
278  double bBox[4];
279  m_mpWindow->GetBoundingBox(bBox);
280 
281  m_pgPropXMin->SetValue(bBox[0]);
282  m_pgPropXMax->SetValue(bBox[1]);
283  m_pgPropYMin->SetValue(bBox[2]);
284  m_pgPropYMax->SetValue(bBox[3]);
285 }
286 
287 void ChartView::UpdatePlot(bool fit)
288 {
289  wxRect legRect = m_leg->GetRectangle();
290  wxRect coordsRect = m_coords->GetRectangle();
291  m_mpWindow->DelAllLayers(true, false);
292 
293  // GoAllTrees(treeCtrl_ChartSelection->GetRootItem());
294  UpdateAllPlots(m_treeCtrl->GetRootItem());
295 
296  m_xaxis = new mpScaleX(m_pgPropXLabel->GetValueAsString(), mpALIGN_BOTTOM, true);
297  m_yaxis = new mpScaleY(m_pgPropYLabel->GetValueAsString(), mpALIGN_LEFT, true);
298  m_leg = new mpInfoLegend(legRect, wxWHITE_BRUSH);
299  m_coords = new mpInfoCoords(coordsRect, wxWHITE_BRUSH);
300 
301  m_xaxis->SetDrawOutsideMargins(false);
302  m_yaxis->SetDrawOutsideMargins(false);
303  m_xaxis->SetTicks(m_hideGrid);
304  m_yaxis->SetTicks(m_hideGrid);
305 
306  mpText* chartTitle = new mpText(m_pgPropChartTitle->GetValueAsString(), 50, 0);
307  wxFont chartTitleFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
308  chartTitle->SetFont(chartTitleFont);
309 
310  m_mpWindow->AddLayer(m_xaxis);
311  m_mpWindow->AddLayer(m_yaxis);
312  m_mpWindow->AddLayer(m_leg);
313  m_mpWindow->AddLayer(m_coords);
314  m_mpWindow->AddLayer(chartTitle);
315 
316  m_leg->SetVisible(m_showLeg);
317  m_coords->SetVisible(m_showCoords);
318 
319  if(fit) Fit();
320 
321  wxColour grey(96, 96, 96);
322  if(m_darkTheme) {
323  m_mpWindow->SetColourTheme(*wxBLACK, *wxWHITE, grey);
324  m_leg->SetBrush(*wxBLACK_BRUSH);
325  m_coords->SetBrush(*wxBLACK_BRUSH);
326  } else {
327  m_mpWindow->SetColourTheme(*wxWHITE, *wxBLACK, grey);
328  m_leg->SetBrush(*wxWHITE_BRUSH);
329  m_coords->SetBrush(*wxWHITE_BRUSH);
330  }
331 }
332 
333 void ChartView::OnTreeItemActivated(wxTreeEvent& event)
334 {
335  if(PlotData* data = dynamic_cast<PlotData*>(m_treeCtrl->GetItemData(event.GetItem()))) {
336  bool isPlotting = data->IsPlot() ? false : true;
337  data->SetPlot(isPlotting);
338  m_pgPropDraw->SetValue(data->IsPlot());
339  if(isPlotting) {
340  wxColour colour = GetNextColour();
341  data->SetColour(colour);
342  m_pgPropColor->SetValue(static_cast<wxVariant>(colour));
343  m_treeCtrl->SetItemBold(m_treeCtrl->GetSelection(), true);
344  } else {
345  m_treeCtrl->SetItemBold(m_treeCtrl->GetSelection(), false);
346  }
347  UpdatePlot(true);
348  }
349 
350  if(event.GetItem() == m_treeTimeID) {
351  AllToYAxis(m_treeCtrl->GetRootItem());
352  m_treeCtrl->SetItemTextColour(m_treeTimeID, *wxRED);
353  m_xAxisValues = m_time;
354  UpdatePlot(true);
355  }
356 
357  event.Skip();
358 }
359 
360 void ChartView::OnTreeItemSelectionChanged(wxTreeEvent& event)
361 {
362  if(PlotData* data = dynamic_cast<PlotData*>(m_treeCtrl->GetItemData(event.GetItem()))) {
363  m_pgPropDraw->SetValue(data->IsPlot());
364  wxVariant colour;
365  colour << data->GetColour();
366  m_pgPropColor->SetValue(colour);
367  m_pgProplineThick->SetValue(data->GetThick());
368  m_pgProplineType->SetValue(data->GetPenType());
369  m_pgProplineAxis->SetValue(data->GetAxis());
370  }
371  event.Skip();
372 }
373 
374 void ChartView::BuildColourList()
375 {
376  m_colourList.push_back(wxColour(255, 0, 0));
377  m_colourList.push_back(wxColour(0, 0, 255));
378  m_colourList.push_back(wxColour(0, 255, 0));
379  m_colourList.push_back(wxColour(255, 128, 0));
380  m_colourList.push_back(wxColour(128, 0, 255));
381  m_colourList.push_back(wxColour(0, 255, 128));
382  m_colourList.push_back(wxColour(255, 255, 0));
383  m_colourList.push_back(wxColour(255, 0, 255));
384  m_colourList.push_back(wxColour(0, 255, 255));
385  m_colourList.push_back(wxColour(128, 255, 0));
386  m_colourList.push_back(wxColour(255, 0, 128));
387  m_colourList.push_back(wxColour(0, 128, 255));
388  m_colourList.push_back(wxColour(128, 128, 128));
389  m_colourList.push_back(*wxBLACK);
390  m_itColourList = --m_colourList.end();
391 }
392 
393 wxColour ChartView::GetNextColour()
394 {
395  if(*m_itColourList == *wxBLACK)
396  m_itColourList = m_colourList.begin();
397  else
398  ++m_itColourList;
399 
400  return *m_itColourList;
401 }
402 
403 wxTreeItemId ChartView::AllToYAxis(wxTreeItemId root)
404 {
405  wxTreeItemIdValue cookie;
406  wxTreeItemId item = m_treeCtrl->GetFirstChild(root, cookie);
407  wxTreeItemId child;
408 
409  while(item.IsOk()) {
410  m_treeCtrl->SetItemTextColour(item, *wxBLACK);
411  if(PlotData* data = dynamic_cast<PlotData*>(m_treeCtrl->GetItemData(item))) data->SetAxis(0); // X axis.
412 
413  if(m_treeCtrl->ItemHasChildren(item)) {
414  wxTreeItemId nextChild = AllToYAxis(item);
415  if(nextChild.IsOk()) return nextChild;
416  }
417  item = m_treeCtrl->GetNextChild(root, cookie);
418  }
419 
420  wxTreeItemId dummyID;
421  return dummyID;
422 }
423 
424 wxTreeItemId ChartView::UpdateAllPlots(wxTreeItemId root)
425 {
426  wxTreeItemIdValue cookie;
427  wxTreeItemId item = m_treeCtrl->GetFirstChild(root, cookie);
428  wxTreeItemId child;
429 
430  while(item.IsOk()) {
431  if(PlotData* data = dynamic_cast<PlotData*>(m_treeCtrl->GetItemData(item))) {
432  if(data->IsPlot()) {
433  wxString parentName = m_treeCtrl->GetItemText(m_treeCtrl->GetItemParent(item));
434  mpFXYVector* newLayer = new mpFXYVector(data->GetName() + " (" + parentName + ")");
435  newLayer->SetData(m_xAxisValues, data->GetValues());
436  newLayer->SetContinuity(true);
437  wxPen layerPen(data->GetColour(), data->GetThick(), data->GetPenType());
438  newLayer->SetPen(layerPen);
439  newLayer->SetDrawOutsideMargins(false);
440  newLayer->ShowName(false);
441 
442  m_mpWindow->AddLayer(newLayer);
443  }
444  }
445 
446  if(m_treeCtrl->ItemHasChildren(item)) {
447  wxTreeItemId nextChild = UpdateAllPlots(item);
448  if(nextChild.IsOk()) return nextChild;
449  }
450  item = m_treeCtrl->GetNextChild(root, cookie);
451  }
452 
453  wxTreeItemId dummyID;
454  return dummyID;
455 }
456 
457 void ChartView::OnMenuExpCSVClick(wxCommandEvent& event)
458 {
459  wxFileDialog saveFileDialog(this, _("Save CSV file"), "", "", "CSV file (*.csv)|*.csv",
460  wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
461  if(saveFileDialog.ShowModal() == wxID_CANCEL) return;
462 
463  wxTextFile csvFile(saveFileDialog.GetPath());
464  if(!csvFile.Create()) {
465  if(!csvFile.Open()) {
466  wxMessageDialog msgDialog(this, _("It was not possible to open or create the selected file."), _("Error"),
467  wxOK | wxCENTRE | wxICON_ERROR);
468  msgDialog.ShowModal();
469  }
470  } else
471  csvFile.Open();
472  if(csvFile.IsOpened()) {
473  csvFile.Clear();
474  csvFile.AddLine(GetActiveCurvesCSV());
475  csvFile.Write();
476  csvFile.Close();
477  }
478 }
479 
480 wxString ChartView::GetActiveCurvesCSV()
481 {
482  std::vector<PlotData*> activePlotDataList;
483  GetActivePlotData(m_treeCtrl->GetRootItem(), activePlotDataList);
484 
485  std::vector<double> xValues;
486  wxString xName = "";
487 
488  // Find X axis curve, if none is found, X is the m_time.
489  bool foundXAxis = false;
490  for(auto it = activePlotDataList.begin(), itEnd = activePlotDataList.end(); it != itEnd; ++it) {
491  PlotData* data = *it;
492  if(data->GetAxis() == 1) {
493  xValues = data->GetValues();
494  xName = data->GetName();
495  foundXAxis = true;
496  activePlotDataList.erase(it);
497  delete data;
498  break;
499  }
500  }
501  if(!foundXAxis) {
502  xValues = m_time;
503  xName = _("Time");
504  }
505 
506  // Build CSV text.
507  wxString csvText = xName + ";";
508  // Header
509  for(auto it = activePlotDataList.begin(), itEnd = activePlotDataList.end(); it != itEnd; ++it) {
510  PlotData* data = *it;
511  csvText += data->GetName() + ";";
512  }
513  csvText[csvText.length() - 1] = '\n';
514  // Values
515  for(unsigned int i = 0; i < xValues.size(); ++i) {
516  csvText += wxString::FromCDouble(xValues[i], 13) + ";";
517  for(unsigned int j = 0; j < activePlotDataList.size(); ++j) {
518  double value = 0.0;
519  if(i < activePlotDataList[j]->GetValues().size()) {
520  value = activePlotDataList[j]->GetValues()[i];
521  }
522  csvText += wxString::FromCDouble(value, 13) + ";";
523  }
524  csvText[csvText.length() - 1] = '\n';
525  }
526 
527  // Clear active plot data vector.
528  for(auto it = activePlotDataList.begin(); it != activePlotDataList.end(); ++it) {
529  delete(*it);
530  }
531  activePlotDataList.clear();
532 
533  return csvText;
534 }
535 
536 wxTreeItemId ChartView::GetActivePlotData(wxTreeItemId root, std::vector<PlotData*>& plotDataList)
537 {
538  wxTreeItemIdValue cookie;
539  wxTreeItemId item = m_treeCtrl->GetFirstChild(root, cookie);
540  wxTreeItemId child;
541 
542  while(item.IsOk()) {
543  if(PlotData* data = dynamic_cast<PlotData*>(m_treeCtrl->GetItemData(item))) {
544  if(data->IsPlot() || data->GetAxis() == 1) {
545  wxString parentName = m_treeCtrl->GetItemText(m_treeCtrl->GetItemParent(item));
546 
547  PlotData* dataCopy = new PlotData();
548  *dataCopy = *data;
549  dataCopy->SetName(data->GetName() + " (" + parentName + ")");
550  plotDataList.push_back(dataCopy);
551  }
552  }
553 
554  if(m_treeCtrl->ItemHasChildren(item)) {
555  wxTreeItemId nextChild = GetActivePlotData(item, plotDataList);
556  if(nextChild.IsOk()) return nextChild;
557  }
558  item = m_treeCtrl->GetNextChild(root, cookie);
559  }
560 
561  wxTreeItemId dummyID;
562  return dummyID;
563 }
- - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "ChartView.h"
19 #include "ElementPlotData.h"
20 
21 ChartView::ChartView(wxWindow* parent, std::vector<ElementPlotData> epdList, std::vector<double> time)
22  : ChartViewBase(parent)
23 {
24  m_epdList = epdList;
25  m_time = time;
26  m_xAxisValues = time;
27 
28  m_menuItemShowGrid->Check(m_hideGrid ? false : true);
29  m_menuItemShowLabel->Check(m_showLeg);
30  m_menuItemShowCoordinates->Check(m_showCoords);
31  m_menuItemDarkTheme->Check(m_darkTheme);
32 
33  // Create color property.
34  m_pgPropColor = m_pgMgr->Insert(m_pgPropLineProp, 1, new wxColourProperty(_("Color")));
35  m_pgPropColor->SetEditor(wxT("ChoiceAndButton"));
36  m_pgPropColor->SetValue(static_cast<wxVariant>(*wxBLACK));
37 
38  // Set margins and axis limit to composed mode.
39  m_pgPropMargins->SetValue(wxT("<composed>"));
40  m_pgMgr->Collapse(m_pgPropMargins);
41  m_pgPropAxisLimit->SetValue(wxT("<composed>"));
42  m_pgMgr->Collapse(m_pgPropAxisLimit);
43 
44  // Add line type choices
45  m_pgProplineType->AddChoice(_("Solid"), wxPENSTYLE_SOLID);
46  m_pgProplineType->AddChoice(_("Dot"), wxPENSTYLE_DOT);
47  m_pgProplineType->AddChoice(_("Dash"), wxPENSTYLE_SHORT_DASH);
48  m_pgProplineType->AddChoice(_("Dot and dash"), wxPENSTYLE_DOT_DASH);
49  m_pgProplineType->AddChoice(_("Cross"), wxPENSTYLE_CROSS_HATCH);
50  m_pgProplineType->AddChoice(_("Driagonal cross"), wxPENSTYLE_CROSSDIAG_HATCH);
51 
52  SetMPWindow();
53  GetSizer()->Add(m_mpWindow, 1, wxEXPAND, WXC_FROM_DIP(5));
54  SetTreectrl();
55  Layout();
56  SetInitialSize();
57 
58  BuildColourList();
59 }
60 
61 ChartView::~ChartView() {}
62 void ChartView::SetMPWindow()
63 {
64  m_mpWindow = new mpWindow(this, wxID_ANY);
65 
66  m_mpWindow->SetDoubleBuffered(true);
67 
68  m_mpWindow->SetMargins(20, 10, 40, 60);
69  m_xaxis = new mpScaleX("", mpALIGN_BOTTOM, true);
70  m_yaxis = new mpScaleY("", mpALIGN_LEFT, true);
71  m_xaxis->SetDrawOutsideMargins(false);
72  m_yaxis->SetDrawOutsideMargins(false);
73  m_xaxis->SetTicks(m_hideGrid);
74  m_yaxis->SetTicks(m_hideGrid);
75 
76  m_leg = new mpInfoLegend(wxRect(200, 20, 40, 40), wxWHITE_BRUSH);
77  m_coords = new mpInfoCoords(wxRect(0, 0, 0, 0), wxWHITE_BRUSH);
78 
79  m_chartTitle = new mpText("", 50, 0);
80  wxFont chartTitleFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
81  m_chartTitle->SetFont(chartTitleFont);
82 
83  m_mpWindow->AddLayer(m_xaxis);
84  m_mpWindow->AddLayer(m_yaxis);
85  m_mpWindow->AddLayer(m_leg);
86  m_mpWindow->AddLayer(m_coords);
87  m_mpWindow->AddLayer(m_chartTitle);
88 
89  m_leg->SetVisible(m_showLeg);
90  m_coords->SetVisible(m_showCoords);
91 
92  m_mpWindow->EnableDoubleBuffer(true);
93  m_mpWindow->LockAspect(false);
94  Fit();
95 }
96 
97 void ChartView::SetTreectrl()
98 {
99  wxTreeItemId rootID = m_treeCtrl->AddRoot(wxT("root"));
100  m_treeTimeID = m_treeCtrl->AppendItem(rootID, _("Time"));
101  m_treeCtrl->SetItemTextColour(m_treeTimeID, *wxRED);
102 
103  bool firstElement[ElementPlotData::NUM_ELEMENTS];
104  for(int i = 0; i < ElementPlotData::NUM_ELEMENTS; ++i) firstElement[i] = true;
105 
106  wxString rootElementName[ElementPlotData::NUM_ELEMENTS];
107  rootElementName[ElementPlotData::CT_BUS] = _("Bus");
108  rootElementName[ElementPlotData::CT_IND_MOTOR] = _("Induction motor");
109  rootElementName[ElementPlotData::CT_LINE] = _("Line");
110  rootElementName[ElementPlotData::CT_LOAD] = _("Load");
111  rootElementName[ElementPlotData::CT_SHUNT_CAPACITOR] = _("Capacitor");
112  rootElementName[ElementPlotData::CT_SHUNT_INDUCTOR] = _("Inductor");
113  rootElementName[ElementPlotData::CT_SYNC_COMPENSATOR] = _("Synchronous compensator");
114  rootElementName[ElementPlotData::CT_SYNC_GENERATOR] = _("Synchronous generator");
115  rootElementName[ElementPlotData::CT_TRANSFORMER] = _("Transformer");
116  rootElementName[ElementPlotData::CT_TEST] = _("Test");
117 
118  wxTreeItemId rootItemID[ElementPlotData::NUM_ELEMENTS];
119 
120  for(auto it = m_epdList.begin(), itEnd = m_epdList.end(); it != itEnd; ++it) {
121  ElementPlotData data = *it;
122  ElementPlotData::CurveType curveType = data.GetCurveType();
123 
124  if(firstElement[curveType]) {
125  rootItemID[curveType] = m_treeCtrl->AppendItem(rootID, rootElementName[curveType]);
126  firstElement[curveType] = false;
127  }
128  wxTreeItemId itemID = m_treeCtrl->AppendItem(rootItemID[curveType], data.GetName());
129  for(int i = 0; i < data.GetElementDataNumber(); ++i) {
130  m_treeCtrl->AppendItem(itemID, data.GetDataName(i), -1, -1, data.GetPlotData(i));
131  }
132  }
133 }
134 
135 void ChartView::OnPropertyGridChange(wxPropertyGridEvent& event)
136 {
137  bool fit = false;
138 
139  if(m_treeCtrl->GetSelection()) {
140  if(PlotData* data = dynamic_cast<PlotData*>(m_treeCtrl->GetItemData(m_treeCtrl->GetSelection()))) {
141  if(event.GetPropertyName() == _("Draw")) {
142  bool isPlotting = m_pgPropDraw->GetValue();
143  data->SetPlot(isPlotting);
144  if(isPlotting) {
145  wxColour colour = GetNextColour();
146  data->SetColour(colour);
147  m_pgPropColor->SetValue(static_cast<wxVariant>(colour));
148  m_treeCtrl->SetItemBold(m_treeCtrl->GetSelection(), true);
149  } else {
150  m_treeCtrl->SetItemBold(m_treeCtrl->GetSelection(), false);
151  }
152  fit = true;
153  } else if(event.GetPropertyName() == _("Color")) {
154  wxColour colour;
155  colour << m_pgPropColor->GetValue();
156  data->SetColour(colour);
157  } else if(event.GetPropertyName() == _("Thickness")) {
158  data->SetThick(m_pgProplineThick->GetValue().GetInteger());
159  } else if(event.GetPropertyName() == _("Type")) {
160  data->SetPenType(static_cast<wxPenStyle>(m_pgProplineType->GetValue().GetInteger()));
161  } else if(event.GetPropertyName() == _("Axis")) {
162  int axis = m_pgProplineAxis->GetValue().GetInteger();
163  if(axis == 1) { // Y
164  // All lines to Y axis
165  AllToYAxis(m_treeCtrl->GetRootItem());
166  // curva selecionada para o eixo X
167  m_treeCtrl->SetItemTextColour(m_treeCtrl->GetSelection(), *wxRED);
168  m_xAxisValues = data->GetValues();
169  }
170  data->SetAxis(axis);
171  fit = true;
172  }
173  }
174  }
175 
176  if(event.GetPropertyName() == _("Margins")) {
177  m_mpWindow->SetMargins(m_pgPropMarginsUp->GetValue().GetLong(), m_pgPropMarginsRight->GetValue().GetLong(),
178  m_pgPropMarginsBot->GetValue().GetLong(), m_pgPropMarginsLeft->GetValue().GetLong());
179  m_mpWindow->UpdateAll();
180  }
181  if(event.GetPropertyName() == _("Axis limit")) {
182  m_mpWindow->Fit(m_pgPropXMin->GetValue().GetDouble(), m_pgPropXMax->GetValue().GetDouble(),
183  m_pgPropYMin->GetValue().GetDouble(), m_pgPropYMax->GetValue().GetDouble());
184  m_mpWindow->UpdateAll();
185  }
186  UpdatePlot(fit);
187 }
188 
189 void ChartView::OnMenuDarkThemeClick(wxCommandEvent& event)
190 {
191  m_darkTheme = event.IsChecked();
192  wxColour grey(96, 96, 96);
193 
194  if(m_darkTheme) {
195  m_mpWindow->SetColourTheme(*wxBLACK, *wxWHITE, grey);
196  m_leg->SetBrush(*wxBLACK_BRUSH);
197  m_coords->SetBrush(*wxBLACK_BRUSH);
198  } else {
199  m_mpWindow->SetColourTheme(*wxWHITE, *wxBLACK, grey);
200  m_leg->SetBrush(*wxWHITE_BRUSH);
201  m_coords->SetBrush(*wxWHITE_BRUSH);
202  }
203 
204  m_mpWindow->UpdateAll();
205 }
206 
207 void ChartView::OnMenuSaveImageClick(wxCommandEvent& event)
208 {
209  int x = m_mpWindow->GetScreenPosition().x;
210  int y = m_mpWindow->GetScreenPosition().y;
211  int width = m_mpWindow->GetSize().GetWidth();
212  int height = m_mpWindow->GetSize().GetHeight();
213 
214  wxScreenDC dcScreen;
215  wxBitmap screenshot(width, height);
216 
217  wxMemoryDC memDC;
218  memDC.SelectObject(screenshot);
219 
220  memDC.Blit(0, 0, width, height, &dcScreen, x, y);
221  memDC.SelectObject(wxNullBitmap);
222 
223  wxFileDialog saveFileDialog(
224  this, _("Save image"), "", "",
225  "PNG image file (*.png)|*.png|Bitmap image file (*.bmp)|*.bmp|JPEG image file (*.jpg)|*.jpg",
226  wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
227  if(saveFileDialog.ShowModal() == wxID_CANCEL) return;
228 
229  wxFileName imagePath(saveFileDialog.GetPath());
230  wxBitmapType imageType = wxBITMAP_TYPE_BMP;
231 
232  if(imagePath.GetExt() == "png")
233  imageType = wxBITMAP_TYPE_PNG;
234  else if(imagePath.GetExt() == "jpg")
235  imageType = wxBITMAP_TYPE_JPEG;
236 
237  screenshot.SaveFile(imagePath.GetFullPath(), imageType);
238 }
239 
240 void ChartView::OnMenuSendClipClick(wxCommandEvent& event)
241 {
242  int x = m_mpWindow->GetScreenPosition().x;
243  int y = m_mpWindow->GetScreenPosition().y;
244  int width = m_mpWindow->GetSize().GetWidth();
245  int height = m_mpWindow->GetSize().GetHeight();
246 
247  wxScreenDC dcScreen;
248  wxBitmap screenshot(width, height);
249 
250  wxMemoryDC memDC;
251  memDC.SelectObject(screenshot);
252 
253  memDC.Blit(0, 0, width, height, &dcScreen, x, y);
254  memDC.SelectObject(wxNullBitmap);
255 
256  if(wxTheClipboard->Open()) {
257  wxTheClipboard->SetData(new wxBitmapDataObject(screenshot));
258  wxTheClipboard->Close();
259 
260  wxMessageDialog msgDialog(this, _("Chart send to clipboard"), _("Info"), wxOK | wxICON_INFORMATION,
261  wxDefaultPosition);
262  msgDialog.ShowModal();
263  } else {
264  wxMessageDialog msgDialog(this, _("It was not possible to send to clipboard"), _("Error"), wxOK | wxICON_ERROR,
265  wxDefaultPosition);
266  msgDialog.ShowModal();
267  }
268 }
269 
270 void ChartView::OnMenuShowCoordinatesClick(wxCommandEvent& event)
271 {
272  m_showCoords = event.IsChecked();
273  m_coords->SetVisible(m_showCoords);
274  m_mpWindow->UpdateAll();
275 }
276 
277 void ChartView::OnMenuShowGridClick(wxCommandEvent& event)
278 {
279  m_hideGrid = event.IsChecked() ? false : true;
280  m_xaxis->SetTicks(m_hideGrid);
281  m_yaxis->SetTicks(m_hideGrid);
282  m_mpWindow->UpdateAll();
283 }
284 
285 void ChartView::OnMenuShowLabelClick(wxCommandEvent& event)
286 {
287  m_showLeg = event.IsChecked();
288  m_leg->SetVisible(m_showLeg);
289  m_mpWindow->UpdateAll();
290 }
291 
292 void ChartView::Fit()
293 {
294  m_mpWindow->Fit();
295  double bBox[4];
296  m_mpWindow->GetBoundingBox(bBox);
297 
298  m_pgPropXMin->SetValue(bBox[0]);
299  m_pgPropXMax->SetValue(bBox[1]);
300  m_pgPropYMin->SetValue(bBox[2]);
301  m_pgPropYMax->SetValue(bBox[3]);
302 }
303 
304 void ChartView::UpdatePlot(bool fit)
305 {
306  wxRect legRect = m_leg->GetRectangle();
307  wxRect coordsRect = m_coords->GetRectangle();
308  m_mpWindow->DelAllLayers(true, false);
309 
310  // GoAllTrees(treeCtrl_ChartSelection->GetRootItem());
311  UpdateAllPlots(m_treeCtrl->GetRootItem());
312 
313  m_xaxis = new mpScaleX(m_pgPropXLabel->GetValueAsString(), mpALIGN_BOTTOM, true);
314  m_yaxis = new mpScaleY(m_pgPropYLabel->GetValueAsString(), mpALIGN_LEFT, true);
315  m_leg = new mpInfoLegend(legRect, wxWHITE_BRUSH);
316  m_coords = new mpInfoCoords(coordsRect, wxWHITE_BRUSH);
317 
318  m_xaxis->SetDrawOutsideMargins(false);
319  m_yaxis->SetDrawOutsideMargins(false);
320  m_xaxis->SetTicks(m_hideGrid);
321  m_yaxis->SetTicks(m_hideGrid);
322 
323  mpText* chartTitle = new mpText(m_pgPropChartTitle->GetValueAsString(), 50, 0);
324  wxFont chartTitleFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
325  chartTitle->SetFont(chartTitleFont);
326 
327  m_mpWindow->AddLayer(m_xaxis);
328  m_mpWindow->AddLayer(m_yaxis);
329  m_mpWindow->AddLayer(m_leg);
330  m_mpWindow->AddLayer(m_coords);
331  m_mpWindow->AddLayer(chartTitle);
332 
333  m_leg->SetVisible(m_showLeg);
334  m_coords->SetVisible(m_showCoords);
335 
336  if(fit) Fit();
337 
338  wxColour grey(96, 96, 96);
339  if(m_darkTheme) {
340  m_mpWindow->SetColourTheme(*wxBLACK, *wxWHITE, grey);
341  m_leg->SetBrush(*wxBLACK_BRUSH);
342  m_coords->SetBrush(*wxBLACK_BRUSH);
343  } else {
344  m_mpWindow->SetColourTheme(*wxWHITE, *wxBLACK, grey);
345  m_leg->SetBrush(*wxWHITE_BRUSH);
346  m_coords->SetBrush(*wxWHITE_BRUSH);
347  }
348 }
349 
350 void ChartView::OnTreeItemActivated(wxTreeEvent& event)
351 {
352  if(PlotData* data = dynamic_cast<PlotData*>(m_treeCtrl->GetItemData(event.GetItem()))) {
353  bool isPlotting = data->IsPlot() ? false : true;
354  data->SetPlot(isPlotting);
355  m_pgPropDraw->SetValue(data->IsPlot());
356  if(isPlotting) {
357  wxColour colour = GetNextColour();
358  data->SetColour(colour);
359  m_pgPropColor->SetValue(static_cast<wxVariant>(colour));
360  m_treeCtrl->SetItemBold(m_treeCtrl->GetSelection(), true);
361  } else {
362  m_treeCtrl->SetItemBold(m_treeCtrl->GetSelection(), false);
363  }
364  UpdatePlot(true);
365  }
366 
367  if(event.GetItem() == m_treeTimeID) {
368  AllToYAxis(m_treeCtrl->GetRootItem());
369  m_treeCtrl->SetItemTextColour(m_treeTimeID, *wxRED);
370  m_xAxisValues = m_time;
371  UpdatePlot(true);
372  }
373 
374  event.Skip();
375 }
376 
377 void ChartView::OnTreeItemSelectionChanged(wxTreeEvent& event)
378 {
379  if(PlotData* data = dynamic_cast<PlotData*>(m_treeCtrl->GetItemData(event.GetItem()))) {
380  m_pgPropDraw->SetValue(data->IsPlot());
381  wxVariant colour;
382  colour << data->GetColour();
383  m_pgPropColor->SetValue(colour);
384  m_pgProplineThick->SetValue(data->GetThick());
385  m_pgProplineType->SetValue(data->GetPenType());
386  m_pgProplineAxis->SetValue(data->GetAxis());
387  }
388  event.Skip();
389 }
390 
391 void ChartView::BuildColourList()
392 {
393  m_colourList.push_back(wxColour(255, 0, 0));
394  m_colourList.push_back(wxColour(0, 0, 255));
395  m_colourList.push_back(wxColour(0, 255, 0));
396  m_colourList.push_back(wxColour(255, 128, 0));
397  m_colourList.push_back(wxColour(128, 0, 255));
398  m_colourList.push_back(wxColour(0, 255, 128));
399  m_colourList.push_back(wxColour(255, 255, 0));
400  m_colourList.push_back(wxColour(255, 0, 255));
401  m_colourList.push_back(wxColour(0, 255, 255));
402  m_colourList.push_back(wxColour(128, 255, 0));
403  m_colourList.push_back(wxColour(255, 0, 128));
404  m_colourList.push_back(wxColour(0, 128, 255));
405  m_colourList.push_back(wxColour(128, 128, 128));
406  m_colourList.push_back(*wxBLACK);
407  m_itColourList = --m_colourList.end();
408 }
409 
410 wxColour ChartView::GetNextColour()
411 {
412  if(*m_itColourList == *wxBLACK)
413  m_itColourList = m_colourList.begin();
414  else
415  ++m_itColourList;
416 
417  return *m_itColourList;
418 }
419 
420 wxTreeItemId ChartView::AllToYAxis(wxTreeItemId root)
421 {
422  wxTreeItemIdValue cookie;
423  wxTreeItemId item = m_treeCtrl->GetFirstChild(root, cookie);
424  wxTreeItemId child;
425 
426  while(item.IsOk()) {
427  m_treeCtrl->SetItemTextColour(item, *wxBLACK);
428  if(PlotData* data = dynamic_cast<PlotData*>(m_treeCtrl->GetItemData(item))) data->SetAxis(0); // X axis.
429 
430  if(m_treeCtrl->ItemHasChildren(item)) {
431  wxTreeItemId nextChild = AllToYAxis(item);
432  if(nextChild.IsOk()) return nextChild;
433  }
434  item = m_treeCtrl->GetNextChild(root, cookie);
435  }
436 
437  wxTreeItemId dummyID;
438  return dummyID;
439 }
440 
441 wxTreeItemId ChartView::UpdateAllPlots(wxTreeItemId root)
442 {
443  wxTreeItemIdValue cookie;
444  wxTreeItemId item = m_treeCtrl->GetFirstChild(root, cookie);
445  wxTreeItemId child;
446 
447  while(item.IsOk()) {
448  if(PlotData* data = dynamic_cast<PlotData*>(m_treeCtrl->GetItemData(item))) {
449  if(data->IsPlot()) {
450  wxString parentName = m_treeCtrl->GetItemText(m_treeCtrl->GetItemParent(item));
451  mpFXYVector* newLayer = new mpFXYVector(data->GetName() + " (" + parentName + ")");
452  newLayer->SetData(m_xAxisValues, data->GetValues());
453  newLayer->SetContinuity(true);
454  wxPen layerPen(data->GetColour(), data->GetThick(), data->GetPenType());
455  newLayer->SetPen(layerPen);
456  newLayer->SetDrawOutsideMargins(false);
457  newLayer->ShowName(false);
458 
459  m_mpWindow->AddLayer(newLayer);
460  }
461  }
462 
463  if(m_treeCtrl->ItemHasChildren(item)) {
464  wxTreeItemId nextChild = UpdateAllPlots(item);
465  if(nextChild.IsOk()) return nextChild;
466  }
467  item = m_treeCtrl->GetNextChild(root, cookie);
468  }
469 
470  wxTreeItemId dummyID;
471  return dummyID;
472 }
473 
474 void ChartView::OnMenuExpCSVClick(wxCommandEvent& event)
475 {
476  wxFileDialog saveFileDialog(this, _("Save CSV file"), "", "", "CSV file (*.csv)|*.csv",
477  wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
478  if(saveFileDialog.ShowModal() == wxID_CANCEL) return;
479 
480  wxTextFile csvFile(saveFileDialog.GetPath());
481  if(!csvFile.Create()) {
482  if(!csvFile.Open()) {
483  wxMessageDialog msgDialog(this, _("It was not possible to open or create the selected file."), _("Error"),
484  wxOK | wxCENTRE | wxICON_ERROR);
485  msgDialog.ShowModal();
486  }
487  } else
488  csvFile.Open();
489  if(csvFile.IsOpened()) {
490  csvFile.Clear();
491  csvFile.AddLine(GetActiveCurvesCSV());
492  csvFile.Write();
493  csvFile.Close();
494  }
495 }
496 
497 wxString ChartView::GetActiveCurvesCSV()
498 {
499  std::vector<PlotData*> activePlotDataList;
500  GetActivePlotData(m_treeCtrl->GetRootItem(), activePlotDataList);
501 
502  std::vector<double> xValues;
503  wxString xName = "";
504 
505  // Find X axis curve, if none is found, X is the m_time.
506  bool foundXAxis = false;
507  for(auto it = activePlotDataList.begin(), itEnd = activePlotDataList.end(); it != itEnd; ++it) {
508  PlotData* data = *it;
509  if(data->GetAxis() == 1) {
510  xValues = data->GetValues();
511  xName = data->GetName();
512  foundXAxis = true;
513  activePlotDataList.erase(it);
514  delete data;
515  break;
516  }
517  }
518  if(!foundXAxis) {
519  xValues = m_time;
520  xName = _("Time");
521  }
522 
523  // Build CSV text.
524  wxString csvText = xName + ";";
525  // Header
526  for(auto it = activePlotDataList.begin(), itEnd = activePlotDataList.end(); it != itEnd; ++it) {
527  PlotData* data = *it;
528  csvText += data->GetName() + ";";
529  }
530  csvText[csvText.length() - 1] = '\n';
531  // Values
532  for(unsigned int i = 0; i < xValues.size(); ++i) {
533  csvText += wxString::FromCDouble(xValues[i], 13) + ";";
534  for(unsigned int j = 0; j < activePlotDataList.size(); ++j) {
535  double value = 0.0;
536  if(i < activePlotDataList[j]->GetValues().size()) {
537  value = activePlotDataList[j]->GetValues()[i];
538  }
539  csvText += wxString::FromCDouble(value, 13) + ";";
540  }
541  csvText[csvText.length() - 1] = '\n';
542  }
543 
544  // Clear active plot data vector.
545  for(auto it = activePlotDataList.begin(); it != activePlotDataList.end(); ++it) {
546  delete(*it);
547  }
548  activePlotDataList.clear();
549 
550  return csvText;
551 }
552 
553 wxTreeItemId ChartView::GetActivePlotData(wxTreeItemId root, std::vector<PlotData*>& plotDataList)
554 {
555  wxTreeItemIdValue cookie;
556  wxTreeItemId item = m_treeCtrl->GetFirstChild(root, cookie);
557  wxTreeItemId child;
558 
559  while(item.IsOk()) {
560  if(PlotData* data = dynamic_cast<PlotData*>(m_treeCtrl->GetItemData(item))) {
561  if(data->IsPlot() || data->GetAxis() == 1) {
562  wxString parentName = m_treeCtrl->GetItemText(m_treeCtrl->GetItemParent(item));
563 
564  PlotData* dataCopy = new PlotData();
565  *dataCopy = *data;
566  dataCopy->SetName(data->GetName() + " (" + parentName + ")");
567  plotDataList.push_back(dataCopy);
568  }
569  }
570 
571  if(m_treeCtrl->ItemHasChildren(item)) {
572  wxTreeItemId nextChild = GetActivePlotData(item, plotDataList);
573  if(nextChild.IsOk()) return nextChild;
574  }
575  item = m_treeCtrl->GetNextChild(root, cookie);
576  }
577 
578  wxTreeItemId dummyID;
579  return dummyID;
580 }
+ + +
diff --git a/docs/doxygen/html/_chart_view_8h.html b/docs/doxygen/html/_chart_view_8h.html new file mode 100644 index 0000000..90336b5 --- /dev/null +++ b/docs/doxygen/html/_chart_view_8h.html @@ -0,0 +1,122 @@ + + + + + + + + + +Project/ChartView.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
ChartView.h File Reference
+
+
+
#include "ChartViewBase.h"
+#include "wxMathPlot/mathplot.h"
+#include <wx/msgdlg.h>
+#include <wx/clipbrd.h>
+#include <wx/bitmap.h>
+#include <wx/dcscreen.h>
+#include <wx/filedlg.h>
+#include <wx/textfile.h>
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  ChartView
 This class is responsible to manage the charts generated in the transient electromechanical studies. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_chart_view_8h_source.html b/docs/doxygen/html/_chart_view_8h_source.html index 2b4ad7f..45a3f99 100644 --- a/docs/doxygen/html/_chart_view_8h_source.html +++ b/docs/doxygen/html/_chart_view_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,16 +88,16 @@ $(document).ready(function(){initNavTree('_chart_view_8h_source.html','');});
ChartView.h
-
1 #ifndef CHARTVIEW_H
2 #define CHARTVIEW_H
3 #include "ChartViewBase.h"
4 #include "wxMathPlot/mathplot.h"
5 
6 #include <wx/msgdlg.h>
7 #include <wx/clipbrd.h>
8 #include <wx/bitmap.h>
9 #include <wx/dcscreen.h>
10 #include <wx/filedlg.h>
11 #include <wx/textfile.h>
12 
13 class PlotData;
14 class ElementPlotData;
15 
16 class ChartView : public ChartViewBase
17 {
18  public:
19  ChartView(wxWindow* parent, std::vector<ElementPlotData> epdList, std::vector<double> time);
20  virtual ~ChartView();
21 
22  void Fit();
23  void UpdatePlot(bool fit = true);
24 
25  protected:
26  virtual void OnMenuExpCSVClick(wxCommandEvent& event);
27  virtual void OnTreeItemActivated(wxTreeEvent& event);
28  virtual void OnTreeItemSelectionChanged(wxTreeEvent& event);
29  virtual void OnMenuDarkThemeClick(wxCommandEvent& event);
30  virtual void OnMenuExitClick(wxCommandEvent& event) { Close(); }
31  virtual void OnMenuFitClick(wxCommandEvent& event) { Fit(); }
32  virtual void OnMenuSaveImageClick(wxCommandEvent& event);
33  virtual void OnMenuSendClipClick(wxCommandEvent& event);
34  virtual void OnMenuShowCoordinatesClick(wxCommandEvent& event);
35  virtual void OnMenuShowGridClick(wxCommandEvent& event);
36  virtual void OnMenuShowLabelClick(wxCommandEvent& event);
37  virtual void OnPropertyGridChange(wxPropertyGridEvent& event);
38  virtual void SetMPWindow();
39  virtual void SetTreectrl();
40  virtual void BuildColourList();
41  virtual wxColour GetNextColour();
42  virtual wxTreeItemId AllToYAxis(wxTreeItemId root);
43  virtual wxTreeItemId UpdateAllPlots(wxTreeItemId root);
44  virtual wxString GetActiveCurvesCSV();
45  virtual wxTreeItemId GetActivePlotData(wxTreeItemId root, std::vector<PlotData*>& plotDataList);
46 
47  wxPGProperty* m_pgPropColor = NULL;
48 
49  wxTreeItemId m_treeTimeID;
50 
51  std::vector<ElementPlotData> m_epdList;
52  std::vector<double> m_time;
53  std::vector<double> m_xAxisValues;
54 
55  mpWindow* m_mpWindow = NULL;
56  mpScaleX* m_xaxis = NULL;
57  mpScaleY* m_yaxis = NULL;
58  mpText* m_chartTitle = NULL;
59  mpInfoCoords* m_coords = NULL;
60  mpInfoLegend* m_leg = NULL;
61 
62  bool m_hideGrid = true;
63  bool m_showLeg = true;
64  bool m_showCoords = false;
65  bool m_darkTheme = false;
66 
67  std::vector<wxColour> m_colourList;
68  std::vector<wxColour>::iterator m_itColourList;
69 };
70 #endif // CHARTVIEW_H
- - - +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CHARTVIEW_H
19 #define CHARTVIEW_H
20 #include "ChartViewBase.h"
21 #include "wxMathPlot/mathplot.h"
22 
23 #include <wx/msgdlg.h>
24 #include <wx/clipbrd.h>
25 #include <wx/bitmap.h>
26 #include <wx/dcscreen.h>
27 #include <wx/filedlg.h>
28 #include <wx/textfile.h>
29 
30 class PlotData;
31 class ElementPlotData;
32 
40 class ChartView : public ChartViewBase
41 {
42  public:
43  ChartView(wxWindow* parent, std::vector<ElementPlotData> epdList, std::vector<double> time);
44  virtual ~ChartView();
45 
46  void Fit();
47  void UpdatePlot(bool fit = true);
48 
49  protected:
50  virtual void OnMenuExpCSVClick(wxCommandEvent& event);
51  virtual void OnTreeItemActivated(wxTreeEvent& event);
52  virtual void OnTreeItemSelectionChanged(wxTreeEvent& event);
53  virtual void OnMenuDarkThemeClick(wxCommandEvent& event);
54  virtual void OnMenuExitClick(wxCommandEvent& event) { Close(); }
55  virtual void OnMenuFitClick(wxCommandEvent& event) { Fit(); }
56  virtual void OnMenuSaveImageClick(wxCommandEvent& event);
57  virtual void OnMenuSendClipClick(wxCommandEvent& event);
58  virtual void OnMenuShowCoordinatesClick(wxCommandEvent& event);
59  virtual void OnMenuShowGridClick(wxCommandEvent& event);
60  virtual void OnMenuShowLabelClick(wxCommandEvent& event);
61  virtual void OnPropertyGridChange(wxPropertyGridEvent& event);
62  virtual void SetMPWindow();
63  virtual void SetTreectrl();
64  virtual void BuildColourList();
65  virtual wxColour GetNextColour();
66  virtual wxTreeItemId AllToYAxis(wxTreeItemId root);
67  virtual wxTreeItemId UpdateAllPlots(wxTreeItemId root);
68  virtual wxString GetActiveCurvesCSV();
69  virtual wxTreeItemId GetActivePlotData(wxTreeItemId root, std::vector<PlotData*>& plotDataList);
70 
71  wxPGProperty* m_pgPropColor = NULL;
72 
73  wxTreeItemId m_treeTimeID;
74 
75  std::vector<ElementPlotData> m_epdList;
76  std::vector<double> m_time;
77  std::vector<double> m_xAxisValues;
78 
79  mpWindow* m_mpWindow = NULL;
80  mpScaleX* m_xaxis = NULL;
81  mpScaleY* m_yaxis = NULL;
82  mpText* m_chartTitle = NULL;
83  mpInfoCoords* m_coords = NULL;
84  mpInfoLegend* m_leg = NULL;
85 
86  bool m_hideGrid = true;
87  bool m_showLeg = true;
88  bool m_showCoords = false;
89  bool m_darkTheme = false;
90 
91  std::vector<wxColour> m_colourList;
92  std::vector<wxColour>::iterator m_itColourList;
93 };
94 #endif // CHARTVIEW_H
+ +
This class is responsible to manage the charts generated in the transient electromechanical studies...
Definition: ChartView.h:40
+
-
1 #include "ConnectionLine.h"
2 
3 ConnectionLine::ConnectionLine() : ControlElement(-1)
4 {
5 }
6 
7 ConnectionLine::ConnectionLine(Node* firstNode, int id)
8  : ControlElement(id)
9 {
10  wxPoint2DDouble pt = firstNode->GetPosition();
11  m_tmpSndPt = pt;
12  for(int i = 0; i < 6; i++) {
13  m_pointList.push_back(pt);
14  }
15  m_nodeList.push_back(firstNode);
16  firstNode->SetConnected();
17 }
18 
19 ConnectionLine::~ConnectionLine() {}
20 
21 void ConnectionLine::Draw(wxPoint2DDouble translation, double scale) const
22 {
23  // Line selected (Layer 1).
24  if(m_selected) {
25  glLineWidth(1.5 + m_borderSize * 2.0);
26  glColor4dv(m_selectionColour.GetRGBA());
27  DrawLine(m_pointList);
28  }
29 
30  // Draw line (Layer 2)
31  glLineWidth(1.5);
32  glColor4d(0.0, 0.0, 0.0, 1.0);
33  DrawLine(m_pointList);
34 
35  if(m_type == ELEMENT_LINE) {
36  glColor4d(0.0, 0.0, 0.0, 1.0);
37  DrawCircle(m_pointList[5], 3, 10, GL_POLYGON);
38  }
39 }
40 
41 bool ConnectionLine::Contains(wxPoint2DDouble position) const
42 {
43  if(PointToLineDistance(position) < 5.0) {
44  return true;
45  }
46  return false;
47 }
48 
49 bool ConnectionLine::Intersects(wxRect2DDouble rect) const
50 {
51  for(auto it = m_pointList.begin(); it != m_pointList.end(); ++it) {
52  if(rect.Contains(*it)) return true;
53  }
54  return false;
55 }
56 
57 void ConnectionLine::UpdatePoints()
58 {
59  if(m_type == ELEMENT_ELEMENT) {
60  bool hasOneNode = true;
61  wxPoint2DDouble pt1 = m_nodeList[0]->GetPosition();
62  wxPoint2DDouble pt2;
63  if(m_nodeList.size() == 1)
64  pt2 = m_tmpSndPt;
65  else {
66  pt2 = m_nodeList[1]->GetPosition();
67  hasOneNode = false;
68  }
69  wxPoint2DDouble midPt = (pt1 + pt2) / 2.0 + wxPoint2DDouble(0.0, m_lineOffset);
70 
71  m_pointList[0] = pt1;
72  if(m_nodeList[0]->GetAngle() == 0.0)
73  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(-10, 0);
74  else if(m_nodeList[0]->GetAngle() == 90.0)
75  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(0, -10);
76  else if(m_nodeList[0]->GetAngle() == 180.0)
77  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(10, 0);
78  else if(m_nodeList[0]->GetAngle() == 270.0)
79  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(0, 10);
80 
81  m_pointList[2] = m_pointList[1] + wxPoint2DDouble(0.0, midPt.m_y - m_pointList[1].m_y);
82 
83  m_pointList[5] = pt2;
84  if(hasOneNode)
85  m_pointList[4] = pt2;
86  else {
87  if(m_nodeList[1]->GetAngle() == 0.0)
88  m_pointList[4] = m_pointList[5] + wxPoint2DDouble(-10, 0);
89  else if(m_nodeList[1]->GetAngle() == 90.0)
90  m_pointList[4] = m_pointList[5] + wxPoint2DDouble(0, -10);
91  else if(m_nodeList[1]->GetAngle() == 180.0)
92  m_pointList[4] = m_pointList[5] + wxPoint2DDouble(10, 0);
93  else if(m_nodeList[1]->GetAngle() == 270.0)
94  m_pointList[4] = m_pointList[5] + wxPoint2DDouble(0, 10);
95  }
96 
97  m_pointList[3] = m_pointList[4] + wxPoint2DDouble(0.0, midPt.m_y - m_pointList[4].m_y);
98  } else if(m_type == ELEMENT_LINE) {
99  wxPoint2DDouble pt1 = m_nodeList[0]->GetPosition();
100  wxPoint2DDouble pt2 = m_parentLine->GetMidPoint();
101  wxPoint2DDouble midPt = (pt1 + pt2) / 2.0 + wxPoint2DDouble(0.0, m_lineOffset);
102 
103  m_pointList[0] = pt1;
104  if(m_nodeList[0]->GetAngle() == 0.0)
105  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(-10, 0);
106  else if(m_nodeList[0]->GetAngle() == 90.0)
107  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(0, -10);
108  else if(m_nodeList[0]->GetAngle() == 180.0)
109  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(10, 0);
110  else if(m_nodeList[0]->GetAngle() == 270.0)
111  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(0, 10);
112 
113  m_pointList[2] = m_pointList[1] + wxPoint2DDouble(0.0, midPt.m_y - m_pointList[1].m_y);
114 
115  m_pointList[5] = pt2;
116  if(m_pointList[2].m_y > pt2.m_y) {
117  m_pointList[4] = m_pointList[5] + wxPoint2DDouble(0, 10);
118  } else {
119  m_pointList[4] = m_pointList[5] + wxPoint2DDouble(0, -10);
120  }
121 
122  m_pointList[3] = m_pointList[4] + wxPoint2DDouble(0.0, midPt.m_y - m_pointList[4].m_y);
123  }
124  for(auto it = m_childList.begin(), itEnd = m_childList.end(); it != itEnd; ++it) {
125  ConnectionLine* child = static_cast<ConnectionLine*>(*it);
126  child->UpdatePoints();
127  }
128 }
129 
130 bool ConnectionLine::AppendNode(Node* node, ControlElement* parent)
131 {
132  if(m_nodeList.size() != 1) return false;
133  if(m_nodeList[0] == node) return false;
134  if(m_nodeList[0]->GetNodeType() == node->GetNodeType()) return false;
135  auto nodeList = parent->GetNodeList();
136  for(auto it = nodeList.begin(), itEnd = nodeList.end(); it != itEnd; ++it) {
137  Node* parentNode = *it;
138  if(parentNode == m_nodeList[0]) return false;
139  }
140 
141  m_nodeList.push_back(node);
142  node->SetConnected();
143  return true;
144 }
145 
146 void ConnectionLine::Move(wxPoint2DDouble position)
147 {
148  m_lineOffset = m_moveStartOffset + position.m_y - m_moveStartPtY;
149  UpdatePoints();
150 }
151 
152 void ConnectionLine::StartMove(wxPoint2DDouble position)
153 {
154  m_moveStartPtY = position.m_y;
155  m_moveStartOffset = m_lineOffset;
156 }
157 
158 wxPoint2DDouble ConnectionLine::GetMidPoint() const { return ((m_pointList[2] + m_pointList[3]) / 2.0); }
159 
160 bool ConnectionLine::SetParentLine(ConnectionLine* parent)
161 {
162  if(m_nodeList[0]->GetNodeType() != Node::NODE_IN) return false;
163  if(!parent) return false;
164 
165  m_type = ELEMENT_LINE;
166  m_parentLine = parent;
167  return true;
168 }
169 
170 std::vector<ConnectionLine*> ConnectionLine::GetLineChildList() const
171 {
172  std::vector<ConnectionLine*> childList;
173  for(auto it = m_childList.begin(), itEnd = m_childList.end(); it != itEnd; ++it) {
174  ConnectionLine* child = static_cast<ConnectionLine*>(*it);
175  childList.push_back(child);
176  }
177  return childList;
178 }
179 
181 {
182  for(auto it = m_parentList.begin(); it != m_parentList.end(); ++it) {
183  Element* element = *it;
184  if(element == parent) m_parentList.erase(it--);
185  }
186 }
187 
189 {
190  ConnectionLine* copy = new ConnectionLine();
191  *copy = *this;
192  return copy;
193 }
-
virtual void Move(wxPoint2DDouble position)
Move the element other position.
- -
Element * GetCopy()
Get a the element copy.
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
- -
virtual void RemoveParent(Element *parent)
Remove a parent.
- -
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
-
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "ConnectionLine.h"
19 
20 ConnectionLine::ConnectionLine() : ControlElement(-1) {}
21 ConnectionLine::ConnectionLine(Node* firstNode, int id) : ControlElement(id)
22 {
23  wxPoint2DDouble pt = firstNode->GetPosition();
24  m_tmpSndPt = pt;
25  for(int i = 0; i < 6; i++) {
26  m_pointList.push_back(pt);
27  }
28  m_nodeList.push_back(firstNode);
29  firstNode->SetConnected();
30 }
31 
32 ConnectionLine::~ConnectionLine() {}
33 void ConnectionLine::Draw(wxPoint2DDouble translation, double scale) const
34 {
35  // Line selected (Layer 1).
36  if(m_selected) {
37  glLineWidth(1.5 + m_borderSize * 2.0);
38  glColor4dv(m_selectionColour.GetRGBA());
39  DrawLine(m_pointList);
40  }
41 
42  // Draw line (Layer 2)
43  glLineWidth(1.5);
44  glColor4d(0.0, 0.0, 0.0, 1.0);
45  DrawLine(m_pointList);
46 
47  if(m_type == ELEMENT_LINE) {
48  glColor4d(0.0, 0.0, 0.0, 1.0);
49  DrawCircle(m_pointList[5], 3, 10, GL_POLYGON);
50  }
51 }
52 
53 bool ConnectionLine::Contains(wxPoint2DDouble position) const
54 {
55  if(PointToLineDistance(position) < 5.0) {
56  return true;
57  }
58  return false;
59 }
60 
61 bool ConnectionLine::Intersects(wxRect2DDouble rect) const
62 {
63  for(auto it = m_pointList.begin(); it != m_pointList.end(); ++it) {
64  if(rect.Contains(*it)) return true;
65  }
66  return false;
67 }
68 
69 void ConnectionLine::UpdatePoints()
70 {
71  if(m_type == ELEMENT_ELEMENT) {
72  bool hasOneNode = true;
73  wxPoint2DDouble pt1 = m_nodeList[0]->GetPosition();
74  wxPoint2DDouble pt2;
75  if(m_nodeList.size() == 1)
76  pt2 = m_tmpSndPt;
77  else {
78  pt2 = m_nodeList[1]->GetPosition();
79  hasOneNode = false;
80  }
81  wxPoint2DDouble midPt = (pt1 + pt2) / 2.0 + wxPoint2DDouble(0.0, m_lineOffset);
82 
83  m_pointList[0] = pt1;
84  if(m_nodeList[0]->GetAngle() == 0.0)
85  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(-10, 0);
86  else if(m_nodeList[0]->GetAngle() == 90.0)
87  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(0, -10);
88  else if(m_nodeList[0]->GetAngle() == 180.0)
89  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(10, 0);
90  else if(m_nodeList[0]->GetAngle() == 270.0)
91  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(0, 10);
92 
93  m_pointList[2] = m_pointList[1] + wxPoint2DDouble(0.0, midPt.m_y - m_pointList[1].m_y);
94 
95  m_pointList[5] = pt2;
96  if(hasOneNode)
97  m_pointList[4] = pt2;
98  else {
99  if(m_nodeList[1]->GetAngle() == 0.0)
100  m_pointList[4] = m_pointList[5] + wxPoint2DDouble(-10, 0);
101  else if(m_nodeList[1]->GetAngle() == 90.0)
102  m_pointList[4] = m_pointList[5] + wxPoint2DDouble(0, -10);
103  else if(m_nodeList[1]->GetAngle() == 180.0)
104  m_pointList[4] = m_pointList[5] + wxPoint2DDouble(10, 0);
105  else if(m_nodeList[1]->GetAngle() == 270.0)
106  m_pointList[4] = m_pointList[5] + wxPoint2DDouble(0, 10);
107  }
108 
109  m_pointList[3] = m_pointList[4] + wxPoint2DDouble(0.0, midPt.m_y - m_pointList[4].m_y);
110  } else if(m_type == ELEMENT_LINE) {
111  wxPoint2DDouble pt1 = m_nodeList[0]->GetPosition();
112  wxPoint2DDouble pt2 = m_parentLine->GetMidPoint();
113  wxPoint2DDouble midPt = (pt1 + pt2) / 2.0 + wxPoint2DDouble(0.0, m_lineOffset);
114 
115  m_pointList[0] = pt1;
116  if(m_nodeList[0]->GetAngle() == 0.0)
117  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(-10, 0);
118  else if(m_nodeList[0]->GetAngle() == 90.0)
119  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(0, -10);
120  else if(m_nodeList[0]->GetAngle() == 180.0)
121  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(10, 0);
122  else if(m_nodeList[0]->GetAngle() == 270.0)
123  m_pointList[1] = m_pointList[0] + wxPoint2DDouble(0, 10);
124 
125  m_pointList[2] = m_pointList[1] + wxPoint2DDouble(0.0, midPt.m_y - m_pointList[1].m_y);
126 
127  m_pointList[5] = pt2;
128  if(m_pointList[2].m_y > pt2.m_y) {
129  m_pointList[4] = m_pointList[5] + wxPoint2DDouble(0, 10);
130  } else {
131  m_pointList[4] = m_pointList[5] + wxPoint2DDouble(0, -10);
132  }
133 
134  m_pointList[3] = m_pointList[4] + wxPoint2DDouble(0.0, midPt.m_y - m_pointList[4].m_y);
135  }
136  for(auto it = m_childList.begin(), itEnd = m_childList.end(); it != itEnd; ++it) {
137  ConnectionLine* child = static_cast<ConnectionLine*>(*it);
138  child->UpdatePoints();
139  }
140 }
141 
142 bool ConnectionLine::AppendNode(Node* node, ControlElement* parent)
143 {
144  if(m_nodeList.size() != 1) return false;
145  if(m_nodeList[0] == node) return false;
146  if(m_nodeList[0]->GetNodeType() == node->GetNodeType()) return false;
147  auto nodeList = parent->GetNodeList();
148  for(auto it = nodeList.begin(), itEnd = nodeList.end(); it != itEnd; ++it) {
149  Node* parentNode = *it;
150  if(parentNode == m_nodeList[0]) return false;
151  }
152 
153  m_nodeList.push_back(node);
154  node->SetConnected();
155  return true;
156 }
157 
158 void ConnectionLine::Move(wxPoint2DDouble position)
159 {
160  m_lineOffset = m_moveStartOffset + position.m_y - m_moveStartPtY;
161  UpdatePoints();
162 }
163 
164 void ConnectionLine::StartMove(wxPoint2DDouble position)
165 {
166  m_moveStartPtY = position.m_y;
167  m_moveStartOffset = m_lineOffset;
168 }
169 
170 wxPoint2DDouble ConnectionLine::GetMidPoint() const { return ((m_pointList[2] + m_pointList[3]) / 2.0); }
171 bool ConnectionLine::SetParentLine(ConnectionLine* parent)
172 {
173  if(m_nodeList[0]->GetNodeType() != Node::NODE_IN) return false;
174  if(!parent) return false;
175 
176  m_type = ELEMENT_LINE;
177  m_parentLine = parent;
178  return true;
179 }
180 
181 std::vector<ConnectionLine*> ConnectionLine::GetLineChildList() const
182 {
183  std::vector<ConnectionLine*> childList;
184  for(auto it = m_childList.begin(), itEnd = m_childList.end(); it != itEnd; ++it) {
185  ConnectionLine* child = static_cast<ConnectionLine*>(*it);
186  childList.push_back(child);
187  }
188  return childList;
189 }
190 
192 {
193  for(auto it = m_parentList.begin(); it != m_parentList.end(); ++it) {
194  Element* element = *it;
195  if(element == parent) m_parentList.erase(it--);
196  }
197 }
198 
200 {
201  ConnectionLine* copy = new ConnectionLine();
202  *copy = *this;
203  return copy;
204 }
+
virtual void Move(wxPoint2DDouble position)
Move the element other position.
+
Node of a control element. This class manages the user interaction with the connection and control el...
+
Element * GetCopy()
Get a the element copy.
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
+ +
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
+
Connection between two control elements or other connection line and an element.
+
virtual void RemoveParent(Element *parent)
Remove a parent.
+ +
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
diff --git a/docs/doxygen/html/_connection_line_8h.html b/docs/doxygen/html/_connection_line_8h.html new file mode 100644 index 0000000..a8e17fc --- /dev/null +++ b/docs/doxygen/html/_connection_line_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/ConnectionLine.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
ConnectionLine.h File Reference
+
+
+
#include "ControlElement.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  ConnectionLine
 Connection between two control elements or other connection line and an element. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_connection_line_8h_source.html b/docs/doxygen/html/_connection_line_8h_source.html index a9d1037..5705bd2 100644 --- a/docs/doxygen/html/_connection_line_8h_source.html +++ b/docs/doxygen/html/_connection_line_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,23 +88,24 @@ $(document).ready(function(){initNavTree('_connection_line_8h_source.html','');}
ConnectionLine.h
-
1 #ifndef CONNECTIONLINE_H
2 #define CONNECTIONLINE_H
3 
4 #include "ControlElement.h"
5 
7 {
8  public:
9  enum ConnectionLineType { ELEMENT_ELEMENT = 0, ELEMENT_LINE };
11  ConnectionLine(Node* firstNode, int id);
12  ~ConnectionLine();
13 
14  virtual void Draw(wxPoint2DDouble translation, double scale) const;
15  virtual bool Contains(wxPoint2DDouble position) const;
16  virtual bool Intersects(wxRect2DDouble rect) const;
17  virtual void RemoveParent(Element* parent);
18  virtual void StartMove(wxPoint2DDouble position);
19  virtual void Move(wxPoint2DDouble position);
20  virtual bool AppendNode(Node* node, ControlElement* parent);
21  virtual void UpdatePoints();
22  virtual void SetTemporarySecondPoint(wxPoint2DDouble point) { m_tmpSndPt = point; }
23  virtual wxPoint2DDouble GetMidPoint() const;
24  virtual double GetOffset() const { return m_lineOffset; }
25  virtual void SetOffset(double offset) { m_lineOffset = offset; }
26  virtual ConnectionLineType GetType() const { return m_type; }
27  virtual void SetType(ConnectionLineType newType) { m_type = newType; }
28  virtual ConnectionLine* GetParentLine() const { return m_parentLine; }
29  virtual bool SetParentLine(ConnectionLine* parent);
30 
31  virtual std::vector<ConnectionLine*> GetLineChildList() const;
32 
33  virtual double GetValue() const { return m_value; }
34  virtual void SetValue(double value) { m_value = value; }
35 
36  Element* GetCopy();
37 
38  protected:
39  double m_lineOffset = 0.0;
40  double m_moveStartPtY = 0.0;
41  double m_moveStartOffset = 0.0;
42  wxPoint2DDouble m_tmpSndPt;
43 
44  ConnectionLineType m_type = ELEMENT_ELEMENT;
45  ConnectionLine* m_parentLine = NULL;
46 
47  double m_value;
48 };
49 
50 #endif // CONNECTIONLINE_H
-
virtual void Move(wxPoint2DDouble position)
Move the element other position.
- -
Element * GetCopy()
Get a the element copy.
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
- -
virtual void RemoveParent(Element *parent)
Remove a parent.
- -
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
-
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CONNECTIONLINE_H
19 #define CONNECTIONLINE_H
20 
21 #include "ControlElement.h"
22 
31 {
32  public:
33  enum ConnectionLineType { ELEMENT_ELEMENT = 0, ELEMENT_LINE };
35  ConnectionLine(Node* firstNode, int id);
36  ~ConnectionLine();
37 
38  virtual void Draw(wxPoint2DDouble translation, double scale) const;
39  virtual bool Contains(wxPoint2DDouble position) const;
40  virtual bool Intersects(wxRect2DDouble rect) const;
41  virtual void RemoveParent(Element* parent);
42  virtual void StartMove(wxPoint2DDouble position);
43  virtual void Move(wxPoint2DDouble position);
44  virtual bool AppendNode(Node* node, ControlElement* parent);
45  virtual void UpdatePoints();
46  virtual void SetTemporarySecondPoint(wxPoint2DDouble point) { m_tmpSndPt = point; }
47  virtual wxPoint2DDouble GetMidPoint() const;
48  virtual double GetOffset() const { return m_lineOffset; }
49  virtual void SetOffset(double offset) { m_lineOffset = offset; }
50  virtual ConnectionLineType GetType() const { return m_type; }
51  virtual void SetType(ConnectionLineType newType) { m_type = newType; }
52  virtual ConnectionLine* GetParentLine() const { return m_parentLine; }
53  virtual bool SetParentLine(ConnectionLine* parent);
54 
55  virtual std::vector<ConnectionLine*> GetLineChildList() const;
56 
57  virtual double GetValue() const { return m_value; }
58  virtual void SetValue(double value) { m_value = value; }
59  Element* GetCopy();
60 
61  protected:
62  double m_lineOffset = 0.0;
63  double m_moveStartPtY = 0.0;
64  double m_moveStartOffset = 0.0;
65  wxPoint2DDouble m_tmpSndPt;
66 
67  ConnectionLineType m_type = ELEMENT_ELEMENT;
68  ConnectionLine* m_parentLine = NULL;
69 
70  double m_value;
71 };
72 
73 #endif // CONNECTIONLINE_H
+
virtual void Move(wxPoint2DDouble position)
Move the element other position.
+
Node of a control element. This class manages the user interaction with the connection and control el...
+
Element * GetCopy()
Get a the element copy.
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
+
Connection between two control elements or other connection line and an element.
+
Base class of a control element. Provide general methods to other control classes.
+
virtual void RemoveParent(Element *parent)
Remove a parent.
+ +
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
-
1 #include "Constant.h"
2 #include "ConstantForm.h"
3 
4 Constant::Constant(int id) : ControlElement(id)
5 {
6  SetValue(m_value);
7  m_angle = 180.0;
8  Node* nodeOut = new Node(m_position + wxPoint2DDouble(m_width / 2, 0), Node::NODE_OUT, m_borderSize);
9  nodeOut->SetAngle(180.0);
10  nodeOut->StartMove(m_position);
11  m_nodeList.push_back(nodeOut);
12 }
13 
14 Constant::~Constant() {}
15 void Constant::Draw(wxPoint2DDouble translation, double scale) const
16 {
17  glLineWidth(1.0);
18  if(m_selected) {
19  glColor4dv(m_selectionColour.GetRGBA());
20  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
21  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
22  }
23  glColor4d(1.0, 1.0, 1.0, 1.0);
24  DrawRectangle(m_position, m_width, m_height);
25  glColor4d(0.0, 0.0, 0.0, 1.0);
26  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
27 
28  // Plot number.
29  glEnable(GL_TEXTURE_2D);
30  glColor4d(0.0, 0.0, 0.0, 1.0);
31  m_glStringValue->bind();
32  m_glStringValue->render(m_position.m_x, m_position.m_y);
33  glDisable(GL_TEXTURE_2D);
34 
35  glColor4d(0.0, 0.0, 0.0, 1.0);
36  DrawNodes();
37 }
38 
39 bool Constant::ShowForm(wxWindow* parent, Element* element)
40 {
41  ConstantForm* form = new ConstantForm(parent, this);
42  if(form->ShowModal() == wxID_OK) {
43  form->Destroy();
44  return true;
45  }
46  form->Destroy();
47  return false;
48 }
49 
50 void Constant::Rotate(bool clockwise)
51 {
52  if(clockwise)
53  m_angle += 90.0;
54  else
55  m_angle -= 90.0;
56  if(m_angle >= 360.0)
57  m_angle = 0.0;
58  else if(m_angle < 0)
59  m_angle = 270.0;
60 
61  UpdatePoints();
62 
63  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
64  Node* node = *it;
65  node->Rotate(clockwise);
66  }
67 }
68 
69 void Constant::UpdatePoints()
70 {
71  if(m_nodeList.size() != 0) {
72  if(m_angle == 0.0) {
73  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
74  } else if(m_angle == 90.0) {
75  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
76  } else if(m_angle == 180.0) {
77  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
78  } else if(m_angle == 270.0) {
79  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
80  }
81  }
82 }
83 
84 void Constant::SetValue(double value)
85 {
86  m_value = value;
87  wxString text = StringFromDouble(m_value);
88 
89  wxFont font(m_fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
90  wxScreenDC dc;
91 
92  if(m_glStringValue) {
93  delete m_glStringValue;
94  m_glStringValue = NULL;
95  }
96  m_glStringValue = new wxGLString(text);
97  m_glStringValue->setFont(font);
98  m_glStringValue->consolidate(&dc);
99 
100  m_width = m_glStringValue->getWidth() + 6 + 2 * m_borderSize;
101  m_height = m_glStringValue->getheight() + 6 + 2 * m_borderSize;
102 
103  UpdatePoints();
104 }
105 
107 {
108  Constant* copy = new Constant(m_elementID);
109  *copy = *this;
110  m_glStringValue = NULL;
111  SetValue(m_value);
112  return copy;
113 }
- -
virtual Element * GetCopy()
Get a the element copy.
Definition: Constant.cpp:106
-
virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode=GL_QUADS) const
Draw rectangle.
Definition: Element.cpp:53
- -
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Constant.cpp:39
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Constant.cpp:50
-
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:300
- - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Constant.h"
19 #include "ConstantForm.h"
20 
21 Constant::Constant(int id) : ControlElement(id)
22 {
23  SetValue(m_value);
24  m_angle = 180.0;
25  Node* nodeOut = new Node(m_position + wxPoint2DDouble(m_width / 2, 0), Node::NODE_OUT, m_borderSize);
26  nodeOut->SetAngle(180.0);
27  nodeOut->StartMove(m_position);
28  m_nodeList.push_back(nodeOut);
29 }
30 
31 Constant::~Constant() {}
32 void Constant::Draw(wxPoint2DDouble translation, double scale) const
33 {
34  glLineWidth(1.0);
35  if(m_selected) {
36  glColor4dv(m_selectionColour.GetRGBA());
37  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
38  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
39  }
40  glColor4d(1.0, 1.0, 1.0, 1.0);
41  DrawRectangle(m_position, m_width, m_height);
42  glColor4d(0.0, 0.0, 0.0, 1.0);
43  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
44 
45  // Plot number.
46  glEnable(GL_TEXTURE_2D);
47  glColor4d(0.0, 0.0, 0.0, 1.0);
48  m_glStringValue->bind();
49  m_glStringValue->render(m_position.m_x, m_position.m_y);
50  glDisable(GL_TEXTURE_2D);
51 
52  glColor4d(0.0, 0.0, 0.0, 1.0);
53  DrawNodes();
54 }
55 
56 bool Constant::ShowForm(wxWindow* parent, Element* element)
57 {
58  ConstantForm* form = new ConstantForm(parent, this);
59  if(form->ShowModal() == wxID_OK) {
60  form->Destroy();
61  return true;
62  }
63  form->Destroy();
64  return false;
65 }
66 
67 void Constant::Rotate(bool clockwise)
68 {
69  if(clockwise)
70  m_angle += 90.0;
71  else
72  m_angle -= 90.0;
73  if(m_angle >= 360.0)
74  m_angle = 0.0;
75  else if(m_angle < 0)
76  m_angle = 270.0;
77 
78  UpdatePoints();
79 
80  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
81  Node* node = *it;
82  node->Rotate(clockwise);
83  }
84 }
85 
86 void Constant::UpdatePoints()
87 {
88  if(m_nodeList.size() != 0) {
89  if(m_angle == 0.0) {
90  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
91  } else if(m_angle == 90.0) {
92  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
93  } else if(m_angle == 180.0) {
94  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
95  } else if(m_angle == 270.0) {
96  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
97  }
98  }
99 }
100 
101 void Constant::SetValue(double value)
102 {
103  m_value = value;
104  wxString text = StringFromDouble(m_value);
105 
106  wxFont font(m_fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
107  wxScreenDC dc;
108 
109  if(m_glStringValue) {
110  delete m_glStringValue;
111  m_glStringValue = NULL;
112  }
113  m_glStringValue = new wxGLString(text);
114  m_glStringValue->setFont(font);
115  m_glStringValue->consolidate(&dc);
116 
117  m_width = m_glStringValue->getWidth() + 6 + 2 * m_borderSize;
118  m_height = m_glStringValue->getheight() + 6 + 2 * m_borderSize;
119 
120  UpdatePoints();
121 }
122 
124 {
125  Constant* copy = new Constant(m_elementID);
126  *copy = *this;
127  m_glStringValue = NULL;
128  SetValue(m_value);
129  return copy;
130 }
+
Node of a control element. This class manages the user interaction with the connection and control el...
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Constant.cpp:123
+
virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode=GL_QUADS) const
Draw rectangle.
Definition: Element.cpp:69
+ +
Form to edit the constant control data.
Definition: ConstantForm.h:31
+ +
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Constant.cpp:56
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Constant.cpp:67
+
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:320
+ +
A control element that provides a constant value.
Definition: Constant.h:35
-
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:83
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Constant.cpp:15
+
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:101
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Constant.cpp:32
diff --git a/docs/doxygen/html/_constant_8h.html b/docs/doxygen/html/_constant_8h.html new file mode 100644 index 0000000..30c1dbf --- /dev/null +++ b/docs/doxygen/html/_constant_8h.html @@ -0,0 +1,117 @@ + + + + + + + + + +Project/Constant.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
Constant.h File Reference
+
+
+
#include "ControlElement.h"
+#include <wx/dcscreen.h>
+#include "wxGLString.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  Constant
 A control element that provides a constant value. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_constant_8h_source.html b/docs/doxygen/html/_constant_8h_source.html index 9b8c707..d698df6 100644 --- a/docs/doxygen/html/_constant_8h_source.html +++ b/docs/doxygen/html/_constant_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,23 +88,24 @@ $(document).ready(function(){initNavTree('_constant_8h_source.html','');});
Constant.h
-
1 #ifndef CONSTANT_H
2 #define CONSTANT_H
3 
4 #include "ControlElement.h"
5 
6 #include <wx/dcscreen.h>
7 #include "wxGLString.h"
8 
9 class ConstantForm;
10 
11 class Constant : public ControlElement
12 {
13  public:
14  Constant(int id);
15  ~Constant();
16 
17  virtual void Draw(wxPoint2DDouble translation, double scale) const;
18  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
19  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
20  virtual bool ShowForm(wxWindow* parent, Element* element);
21  virtual void Rotate(bool clockwise = true);
22  virtual void UpdateText() { SetValue(m_value); }
23 
24  virtual void SetValue(double value);
25  virtual double GetValue() const { return m_value; }
26  virtual void UpdatePoints();
27 
28  virtual Element* GetCopy();
29 
30  protected:
31  double m_value = 1.0;
32 
33  wxGLString* m_glStringValue = NULL;
34  int m_fontSize = 10;
35 };
36 
37 #endif // CONSTANT_H
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Constant.h:18
-
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Constant.h:19
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Constant.cpp:106
- -
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Constant.cpp:39
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Constant.cpp:50
- - +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CONSTANT_H
19 #define CONSTANT_H
20 
21 #include "ControlElement.h"
22 
23 #include <wx/dcscreen.h>
24 #include "wxGLString.h"
25 
26 class ConstantForm;
27 
35 class Constant : public ControlElement
36 {
37  public:
38  Constant(int id);
39  ~Constant();
40 
41  virtual void Draw(wxPoint2DDouble translation, double scale) const;
42  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
43  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
44  virtual bool ShowForm(wxWindow* parent, Element* element);
45  virtual void Rotate(bool clockwise = true);
46  virtual void UpdateText() { SetValue(m_value); }
47  virtual void SetValue(double value);
48  virtual double GetValue() const { return m_value; }
49  virtual void UpdatePoints();
50 
51  virtual Element* GetCopy();
52 
53  protected:
54  double m_value = 1.0;
55 
56  wxGLString* m_glStringValue = NULL;
57  int m_fontSize = 10;
58 };
59 
60 #endif // CONSTANT_H
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Constant.h:42
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Constant.h:43
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Constant.cpp:123
+
Form to edit the constant control data.
Definition: ConstantForm.h:31
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Constant.cpp:56
+
Base class of a control element. Provide general methods to other control classes.
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Constant.cpp:67
+ +
A control element that provides a constant value.
Definition: Constant.h:35
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Constant.cpp:15
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Constant.cpp:32
-
1 #include "ConstantForm.h"
2 #include "Constant.h"
3 
4 ConstantForm::ConstantForm(wxWindow* parent, Constant* constant) : ConstantFormBase(parent)
5 {
6  SetSize(GetBestSize());
7 
8  m_parent = parent;
9  m_constant = constant;
10 
11  m_textCtrlValue->SetValue(m_constant->StringFromDouble(m_constant->GetValue()));
12 }
13 
14 ConstantForm::~ConstantForm() {}
15 void ConstantForm::OnOKButtonClick(wxCommandEvent& event)
16 {
17  if(ValidateData()) EndModal(wxID_OK);
18 }
19 
20 bool ConstantForm::ValidateData()
21 {
22  double value;
23  if(!m_constant->DoubleFromString(this, m_textCtrlValue->GetValue(), value,
24  _("Value entered incorrectly in the field \"Constant value\".")))
25  return false;
26 
27  m_constant->SetValue(value);
28  return true;
29 }
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "ConstantForm.h"
19 #include "Constant.h"
20 
21 ConstantForm::ConstantForm(wxWindow* parent, Constant* constant) : ConstantFormBase(parent)
22 {
23  SetSize(GetBestSize());
24 
25  m_parent = parent;
26  m_constant = constant;
27 
28  m_textCtrlValue->SetValue(m_constant->StringFromDouble(m_constant->GetValue()));
29 }
30 
31 ConstantForm::~ConstantForm() {}
32 void ConstantForm::OnOKButtonClick(wxCommandEvent& event)
33 {
34  if(ValidateData()) EndModal(wxID_OK);
35 }
36 
37 bool ConstantForm::ValidateData()
38 {
39  double value;
40  if(!m_constant->DoubleFromString(this, m_textCtrlValue->GetValue(), value,
41  _("Value entered incorrectly in the field \"Constant value\".")))
42  return false;
43 
44  m_constant->SetValue(value);
45  return true;
46 }
+ + +
A control element that provides a constant value.
Definition: Constant.h:35
diff --git a/docs/doxygen/html/_constant_form_8h.html b/docs/doxygen/html/_constant_form_8h.html new file mode 100644 index 0000000..dfc7ed2 --- /dev/null +++ b/docs/doxygen/html/_constant_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/ConstantForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
ConstantForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  ConstantForm
 Form to edit the constant control data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_constant_form_8h_source.html b/docs/doxygen/html/_constant_form_8h_source.html index 55610ba..60eae01 100644 --- a/docs/doxygen/html/_constant_form_8h_source.html +++ b/docs/doxygen/html/_constant_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_constant_form_8h_source.html','');});
ConstantForm.h
-
1 #ifndef CONSTANTFORM_H
2 #define CONSTANTFORM_H
3 #include "ElementForm.h"
4 
5 class Constant;
6 
8 {
9  public:
10  ConstantForm(wxWindow* parent, Constant* constant);
11  virtual ~ConstantForm();
12  virtual bool ValidateData();
13 
14  protected:
15  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
16  virtual void OnOKButtonClick(wxCommandEvent& event);
17 
18  wxWindow* m_parent = NULL;
19  Constant* m_constant = NULL;
20 };
21 #endif // CONSTANTFORM_H
- - +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CONSTANTFORM_H
19 #define CONSTANTFORM_H
20 #include "ElementForm.h"
21 
22 class Constant;
23 
32 {
33  public:
34  ConstantForm(wxWindow* parent, Constant* constant);
35  virtual ~ConstantForm();
36  virtual bool ValidateData();
37 
38  protected:
39  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
40  virtual void OnOKButtonClick(wxCommandEvent& event);
41 
42  wxWindow* m_parent = NULL;
43  Constant* m_constant = NULL;
44 };
45 #endif // CONSTANTFORM_H
+
Form to edit the constant control data.
Definition: ConstantForm.h:31
+
A control element that provides a constant value.
Definition: Constant.h:35
-
1 #include "ControlEditor.h"
2 
3 #ifdef USING_WX_3_0_X
4 #include "DegreesAndRadians.h"
5 #endif
6 #include "FileHanding.h"
7 #include "Camera.h"
8 #include "ControlElement.h"
9 #include "TransferFunction.h"
10 #include "ConnectionLine.h"
11 #include "Sum.h"
12 #include "Multiplier.h"
13 #include "Limiter.h"
14 #include "RateLimiter.h"
15 #include "Exponential.h"
16 #include "Constant.h"
17 #include "Gain.h"
18 
19 #include "ControlElementSolver.h"
20 #include "ControlElementContainer.h"
21 
22 #include "ChartView.h"
23 #include "ElementPlotData.h"
24 
25 ControlElementButton::ControlElementButton(wxWindow* parent, wxString label, wxImage image, wxWindowID id)
26  : wxWindow(parent, id)
27 {
28  SetBackgroundColour(*wxWHITE);
29  // m_font = wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
30  m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
31  m_label = label;
32  m_image = image;
33  m_imageSize = wxSize(image.GetWidth(), image.GetHeight());
34 
35  // Calculate label size.
36  wxScreenDC dc;
37  dc.SetFont(m_font);
38  wxSize textSize = dc.GetTextExtent(label);
39 
40  int buttonWidth = 0;
41  if(textSize.GetWidth() > m_imageSize.GetWidth()) {
42  buttonWidth = textSize.GetWidth();
43  m_imagePosition = wxPoint((buttonWidth - m_imageSize.GetWidth()) / 2 + m_borderSize, m_borderSize);
44  m_labelPosition = wxPoint(m_borderSize, m_imageSize.GetHeight() + m_borderSize);
45  } else {
46  buttonWidth = m_imageSize.GetWidth();
47  m_imagePosition = wxPoint(m_borderSize, m_borderSize);
48  m_labelPosition =
49  wxPoint((buttonWidth - textSize.GetWidth()) / 2 + m_borderSize, m_imageSize.GetHeight() + m_borderSize);
50  }
51  m_buttonSize =
52  wxSize(buttonWidth + 2 * m_borderSize, textSize.GetHeight() + m_imageSize.GetHeight() + 2 * m_borderSize);
53  SetMinSize(m_buttonSize + wxSize(m_borderSize, m_borderSize));
54 
55  // Events.
56  Bind(wxEVT_PAINT, &ControlElementButton::OnPaint, this);
57  Bind(wxEVT_ENTER_WINDOW, &ControlElementButton::OnMouseEnter, this);
58  Bind(wxEVT_LEAVE_WINDOW, &ControlElementButton::OnMouseLeave, this);
59  Bind(wxEVT_LEFT_DOWN, &ControlElementButton::OnLeftClickDown, this);
60  Bind(wxEVT_LEFT_UP, &ControlElementButton::OnLeftClickUp, this);
61 }
62 
63 ControlElementButton::~ControlElementButton() {}
64 void ControlElementButton::OnPaint(wxPaintEvent& event)
65 {
66  wxPaintDC dc(this);
67  wxGraphicsContext* gc = wxGraphicsContext::Create(dc);
68  if(gc) {
69  if(m_mouseAbove) {
70  if(m_selected) {
71  gc->SetPen(wxPen(wxColour(0, 125, 255, 255), m_borderSize - 1));
72  gc->SetBrush(wxBrush(wxColour(0, 125, 255, 100)));
73  } else {
74  gc->SetPen(*wxTRANSPARENT_PEN);
75  gc->SetBrush(wxBrush(wxColour(0, 125, 255, 70)));
76  }
77  gc->DrawRectangle(m_borderSize / 2, m_borderSize / 2, m_buttonSize.GetWidth(), m_buttonSize.GetHeight());
78  }
79  gc->DrawBitmap(gc->CreateBitmapFromImage(m_image), m_imagePosition.x, m_imagePosition.y, m_imageSize.GetWidth(),
80  m_imageSize.GetHeight());
81  gc->SetFont(m_font, *wxBLACK);
82  gc->DrawText(m_label, m_labelPosition.x, m_labelPosition.y);
83  delete gc;
84  }
85 }
86 
87 void ControlElementButton::OnMouseEnter(wxMouseEvent& event)
88 {
89  m_mouseAbove = true;
90  Refresh();
91  event.Skip();
92 }
93 
94 void ControlElementButton::OnMouseLeave(wxMouseEvent& event)
95 {
96  m_mouseAbove = false;
97  Refresh();
98  event.Skip();
99 }
100 
101 void ControlElementButton::OnLeftClickDown(wxMouseEvent& event)
102 {
103  m_selected = true;
104  Refresh();
105  event.Skip();
106 }
107 
108 void ControlElementButton::OnLeftClickUp(wxMouseEvent& event)
109 {
110  m_selected = false;
111  Refresh();
112  event.Skip();
113 }
114 
115 ControlEditor::ControlEditor(wxWindow* parent, int ioflags) : ControlEditorBase(parent)
116 {
117  BuildControlElementPanel();
118  m_glContext = new wxGLContext(m_glCanvas);
119  m_camera = new Camera();
120  m_selectionRect = wxRect2DDouble(0, 0, 0, 0);
121  // m_camera->SetScale(1.2);
122  m_ioFlags = ioflags;
123 }
124 ControlEditor::~ControlEditor()
125 {
126  // m_tfButton->Disconnect(wxEVT_LEFT_DOWN, wxMouseEventHandler(ControlEditor::LeftClickDown), m_tfButton, this);
127 }
128 
129 void ControlEditor::BuildControlElementPanel()
130 {
131  m_panelControlElements->SetDoubleBuffered(true);
132  wxWrapSizer* wrapSizer = new wxWrapSizer();
133  m_panelControlElements->SetSizer(wrapSizer);
134 
135  ControlElementButton* ioButton = new ControlElementButton(m_panelControlElements, _("In/Out"),
136  wxImage("..\\data\\images\\control\\io.png"), ID_IO);
137  wrapSizer->Add(ioButton, 0, wxALL, 5);
138  ioButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
139 
141  m_panelControlElements, _("Transfer fcn"), wxImage("..\\data\\images\\control\\transferFunc.png"), ID_TF);
142  wrapSizer->Add(tfButton, 0, wxALL, 5);
143  tfButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
144 
145  ControlElementButton* sumButton = new ControlElementButton(m_panelControlElements, _("Sum"),
146  wxImage("..\\data\\images\\control\\sum.png"), ID_SUM);
147  wrapSizer->Add(sumButton, 0, wxALL, 5);
148  sumButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
149 
150  ControlElementButton* constButton = new ControlElementButton(
151  m_panelControlElements, _("Constant"), wxImage("..\\data\\images\\control\\value.png"), ID_CONST);
152  wrapSizer->Add(constButton, 0, wxALL, 5);
153  constButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
154 
156  m_panelControlElements, _("Limiter"), wxImage("..\\data\\images\\control\\limiter.png"), ID_LIMITER);
157  wrapSizer->Add(limButton, 0, wxALL, 5);
158  limButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
159 
160  ControlElementButton* gainButton = new ControlElementButton(
161  m_panelControlElements, _("Gain"), wxImage("..\\data\\images\\control\\gain.png"), ID_GAIN);
162  wrapSizer->Add(gainButton, 0, wxALL, 5);
163  gainButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
164 
165  ControlElementButton* multButton = new ControlElementButton(
166  m_panelControlElements, _("Multiplier"), wxImage("..\\data\\images\\control\\mult.png"), ID_MULT);
167  wrapSizer->Add(multButton, 0, wxALL, 5);
168  multButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
169 
170  ControlElementButton* satButton = new ControlElementButton(m_panelControlElements, _("Exponential"),
171  wxImage("..\\data\\images\\control\\sat.png"), ID_EXP);
172  wrapSizer->Add(satButton, 0, wxALL, 5);
173  satButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
174 
175  ControlElementButton* rateLimButton = new ControlElementButton(
176  m_panelControlElements, _("Rate limiter"), wxImage("..\\data\\images\\control\\rateLimiter.png"), ID_RATELIM);
177  wrapSizer->Add(rateLimButton, 0, wxALL, 5);
178  rateLimButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
179 }
180 
181 void ControlEditor::LeftClickDown(wxMouseEvent& event)
182 {
183  AddElement(static_cast<ControlElementButtonID>(event.GetId()));
184  event.Skip();
185 }
186 
187 void ControlEditor::SetViewport()
188 {
189  glClearColor(1.0, 1.0, 1.0, 1.0); // White background.
190  glClear(GL_COLOR_BUFFER_BIT);
191  glDisable(GL_DEPTH_TEST);
192  glDisable(GL_TEXTURE_2D);
193  glEnable(GL_COLOR_MATERIAL);
194  glEnable(GL_BLEND);
195  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
196  glEnable(GL_LINE_SMOOTH);
197 
198  double width = m_glCanvas->GetSize().x - 1;
199  double height = m_glCanvas->GetSize().y - 1;
200 
201  // Viewport fit the screen.
202  glViewport(0, 0, width, height);
203 
204  glMatrixMode(GL_PROJECTION);
205  glLoadIdentity();
206  gluOrtho2D(0.0, width, height, 0.0);
207 
208  glMatrixMode(GL_MODELVIEW);
209  glLoadIdentity();
210 }
211 
212 void ControlEditor::AddElement(ControlElementButtonID id)
213 {
214  switch(id) {
215  case ID_IO: {
216  m_mode = MODE_INSERT;
217  IOControl* io = new IOControl(m_ioFlags, m_lastElementID);
218  m_elementList.push_back(io);
219  } break;
220  case ID_TF: {
221  m_mode = MODE_INSERT;
222  TransferFunction* tf = new TransferFunction(m_lastElementID);
223  m_elementList.push_back(tf);
224  } break;
225  case ID_SUM: {
226  m_mode = MODE_INSERT;
227  Sum* sum = new Sum(m_lastElementID);
228  m_elementList.push_back(sum);
229  } break;
230  case ID_CONST: {
231  m_mode = MODE_INSERT;
232  Constant* constant = new Constant(m_lastElementID);
233  m_elementList.push_back(constant);
234  } break;
235  case ID_LIMITER: {
236  m_mode = MODE_INSERT;
237  Limiter* limiter = new Limiter(m_lastElementID);
238  m_elementList.push_back(limiter);
239  } break;
240  case ID_GAIN: {
241  m_mode = MODE_INSERT;
242  Gain* gain = new Gain(m_lastElementID);
243  m_elementList.push_back(gain);
244  } break;
245  case ID_MULT: {
246  m_mode = MODE_INSERT;
247  Multiplier* mult = new Multiplier(m_lastElementID);
248  m_elementList.push_back(mult);
249  } break;
250  case ID_EXP: {
251  m_mode = MODE_INSERT;
252  Exponential* exp = new Exponential(m_lastElementID);
253  m_elementList.push_back(exp);
254  } break;
255  case ID_RATELIM: {
256  m_mode = MODE_INSERT;
257  RateLimiter* rateLim = new RateLimiter(m_lastElementID);
258  m_elementList.push_back(rateLim);
259  } break;
260  }
261  m_lastElementID++;
262 }
263 
264 void ControlEditor::OnPaint(wxPaintEvent& event)
265 {
266  wxPaintDC dc(m_glCanvas);
267  m_glContext->SetCurrent(*m_glCanvas);
268  SetViewport();
269 
270  // Set GLCanvas scale and translation.
271  glScaled(m_camera->GetScale(), m_camera->GetScale(), 0.0); // Scale
272  glTranslated(m_camera->GetTranslation().m_x, m_camera->GetTranslation().m_y, 0.0); // Translation
273 
274  for(auto it = m_connectionList.begin(), itEnd = m_connectionList.end(); it != itEnd; ++it) {
275  ConnectionLine* line = *it;
276  line->Draw(m_camera->GetTranslation(), m_camera->GetScale());
277  }
278 
279  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
280  Element* element = *it;
281  element->Draw(m_camera->GetTranslation(), m_camera->GetScale());
282  }
283 
284  // Selection rectangle
285  glLineWidth(1.0);
286  glColor4d(0.0, 0.5, 1.0, 1.0);
287  glBegin(GL_LINE_LOOP);
288  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y);
289  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y + m_selectionRect.m_height);
290  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y + m_selectionRect.m_height);
291  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y);
292  glEnd();
293  glColor4d(0.0, 0.5, 1.0, 0.3);
294  glBegin(GL_QUADS);
295  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y);
296  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y + m_selectionRect.m_height);
297  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y + m_selectionRect.m_height);
298  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y);
299  glEnd();
300 
301  glFlush(); // Sends all pending information directly to the GPU.
302  m_glCanvas->SwapBuffers();
303  event.Skip();
304 }
305 
306 void ControlEditor::OnDoubleClick(wxMouseEvent& event)
307 {
308  wxPoint2DDouble clickPoint = event.GetPosition();
309  bool redraw = false;
310 
311  if(m_mode == MODE_EDIT) {
312  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
313  Element* element = *it;
314  if(element->Contains(m_camera->ScreenToWorld(clickPoint))) {
315  element->ShowForm(this, element);
316  CheckConnections();
317  auto childList = element->GetChildList();
318  for(auto itC = childList.begin(), itEndC = childList.end(); itC != itEndC; ++itC) {
319  ConnectionLine* line = static_cast<ConnectionLine*>(*itC);
320  line->UpdatePoints();
321  }
322  redraw = true;
323  }
324  }
325  }
326 
327  if(redraw) Redraw();
328 }
329 
330 void ControlEditor::OnLeftClickDown(wxMouseEvent& event)
331 {
332  wxPoint2DDouble clickPoint = event.GetPosition();
333  bool foundElement = false;
334 
335  if(m_mode == MODE_INSERT) {
336  m_mode = MODE_EDIT;
337  } else {
338  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
339  ControlElement* element = *it;
340  bool foundNode = false;
341  auto nodeList = element->GetNodeList();
342  for(auto itN = nodeList.begin(), itNEnd = nodeList.end(); itN != itNEnd; ++itN) {
343  Node* node = *itN;
344  if(node->Contains(m_camera->ScreenToWorld(clickPoint))) {
345  m_mode = MODE_INSERT_LINE;
346  ConnectionLine* line = new ConnectionLine(node, m_lastElementID);
347  m_lastElementID++;
348  m_connectionList.push_back(line);
349  element->AddChild(line);
350  line->AddParent(element);
351  foundElement = true;
352  foundNode = true;
353  }
354  }
355 
356  if(!foundNode) {
357  // Set movement initial position (not necessarily will be moved).
358  element->StartMove(m_camera->ScreenToWorld(clickPoint));
359 
360  // Click in an element.
361  if(element->Contains(m_camera->ScreenToWorld(clickPoint))) {
362  if(!foundElement) {
363  element->SetSelected();
364  foundElement = true;
365  }
366  m_mode = MODE_MOVE_ELEMENT;
367  }
368  }
369  }
370  if(m_mode != MODE_INSERT_LINE) {
371  for(auto it = m_connectionList.begin(), itEnd = m_connectionList.end(); it != itEnd; ++it) {
372  ConnectionLine* line = *it;
373  line->StartMove(m_camera->ScreenToWorld(clickPoint));
374  if(line->Contains(m_camera->ScreenToWorld(clickPoint))) {
375  line->SetSelected();
376  foundElement = true;
377  m_mode = MODE_MOVE_LINE;
378  }
379  }
380  }
381  }
382 
383  if(!foundElement) {
384  m_mode = MODE_SELECTION_RECT;
385  m_startSelRect = m_camera->ScreenToWorld(clickPoint);
386  }
387 
388  Redraw();
389  event.Skip();
390 }
391 
392 void ControlEditor::OnLeftClickUp(wxMouseEvent& event)
393 {
394  bool foundNode = false;
395  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; it++) {
396  ControlElement* element = *it;
397  if(m_mode == MODE_INSERT_LINE) {
398  auto nodeList = element->GetNodeList();
399  for(auto itN = nodeList.begin(), itNEnd = nodeList.end(); itN != itNEnd; ++itN) {
400  Node* node = *itN;
401  if(node->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
402  ConnectionLine* line = *(m_connectionList.end() - 1);
403  if(line->AppendNode(node, element)) {
404  line->AddParent(element);
405  element->AddChild(line);
406  line->UpdatePoints();
407  m_mode = MODE_EDIT;
408  foundNode = true;
409  }
410  }
411  }
412  } else if(m_mode == MODE_SELECTION_RECT) {
413  if(element->Intersects(m_selectionRect)) {
414  element->SetSelected();
415  } else if(!event.ControlDown()) {
416  element->SetSelected(false);
417  }
418  } else if(!event.ControlDown()) {
419  if(!element->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
420  element->SetSelected(false);
421  }
422  }
423  }
424  for(auto it = m_connectionList.begin(), itEnd = m_connectionList.end(); it != itEnd; ++it) {
425  ConnectionLine* cLine = *it;
426  if(m_mode == MODE_INSERT_LINE && !foundNode && it != (itEnd - 1)) {
427  if(cLine->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
428  ConnectionLine* iLine = *(m_connectionList.end() - 1);
429  if(iLine->SetParentLine(cLine)) {
430  cLine->AddChild(iLine);
431  iLine->UpdatePoints();
432  m_mode = MODE_EDIT;
433  foundNode = true;
434  }
435  }
436  } else if(m_mode == MODE_SELECTION_RECT) {
437  if(cLine->Intersects(m_selectionRect)) {
438  cLine->SetSelected();
439  } else if(!event.ControlDown()) {
440  cLine->SetSelected(false);
441  }
442  } else if(!event.ControlDown()) {
443  if(!cLine->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
444  cLine->SetSelected(false);
445  }
446  }
447  }
448 
449  m_selectionRect = wxRect2DDouble(0, 0, 0, 0);
450 
451  if(m_mode == MODE_INSERT_LINE && !foundNode) {
452  ConnectionLine* cLine = *(m_connectionList.end() - 1);
453  // Free nodes
454  auto nodeList = cLine->GetNodeList();
455  for(auto itN = nodeList.begin(), itEndN = nodeList.end(); itN != itEndN; ++itN) {
456  Node* node = *itN;
457  node->SetConnected(false);
458  }
459  // Remove the associated child from parents.
460  auto parentList = cLine->GetParentList();
461  for(auto it = parentList.begin(), itEnd = parentList.end(); it != itEnd; ++it) {
462  Element* element = *it;
463  element->RemoveChild(cLine);
464  }
465  m_connectionList.pop_back();
466  if(cLine) delete cLine;
467  m_mode = MODE_EDIT;
468  } else if(m_mode != MODE_INSERT) {
469  m_mode = MODE_EDIT;
470  }
471 
472  Redraw();
473  event.Skip();
474 }
475 
476 void ControlEditor::OnMiddleDown(wxMouseEvent& event)
477 {
478  // Set to drag mode.
479  switch(m_mode) {
480  case MODE_INSERT: {
481  m_mode = MODE_DRAG_INSERT;
482  } break;
483  case MODE_PASTE: {
484  m_mode = MODE_DRAG_PASTE;
485  } break;
486  default: {
487  m_mode = MODE_DRAG;
488  } break;
489  }
490  m_camera->StartTranslation(m_camera->ScreenToWorld(event.GetPosition()));
491 }
492 
493 void ControlEditor::OnMiddleUp(wxMouseEvent& event)
494 {
495  switch(m_mode) {
496  case MODE_DRAG_INSERT: {
497  m_mode = MODE_INSERT;
498  } break;
499  case MODE_DRAG_PASTE: {
500  m_mode = MODE_PASTE;
501  } break;
502  case MODE_INSERT:
503  case MODE_PASTE: {
504  // Does nothing.
505  } break;
506  default: {
507  m_mode = MODE_EDIT;
508  } break;
509  }
510 }
511 
512 void ControlEditor::OnMouseMotion(wxMouseEvent& event)
513 {
514  wxPoint2DDouble clickPoint = event.GetPosition();
515  bool redraw = false;
516 
517  switch(m_mode) {
518  case MODE_INSERT: {
519  Element* newElement = *(m_elementList.end() - 1); // Get the last element in the list.
520  newElement->Move(m_camera->ScreenToWorld(clickPoint));
521  redraw = true;
522  } break;
523  case MODE_INSERT_LINE: {
524  ConnectionLine* line = *(m_connectionList.end() - 1);
525  line->SetTemporarySecondPoint(m_camera->ScreenToWorld(clickPoint));
526  line->UpdatePoints();
527  redraw = true;
528  } break;
529  case MODE_DRAG:
530  case MODE_DRAG_INSERT:
531  case MODE_DRAG_PASTE: {
532  m_camera->SetTranslation(clickPoint);
533  redraw = true;
534  } break;
535  case MODE_MOVE_ELEMENT: {
536  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; it++) {
537  Element* element = *it;
538  if(element->IsSelected()) {
539  element->Move(m_camera->ScreenToWorld(clickPoint));
540  auto childList = element->GetChildList();
541  for(auto itC = childList.begin(), itEndC = childList.end(); itC != itEndC; itC++) {
542  ConnectionLine* line = static_cast<ConnectionLine*>(*itC);
543  line->UpdatePoints();
544  }
545  redraw = true;
546  }
547  }
548  } break;
549  case MODE_MOVE_LINE: {
550  for(auto it = m_connectionList.begin(), itEnd = m_connectionList.end(); it != itEnd; it++) {
551  ConnectionLine* line = *it;
552  if(line->IsSelected()) {
553  line->Move(m_camera->ScreenToWorld(clickPoint));
554  redraw = true;
555  }
556  }
557  } break;
558  case MODE_SELECTION_RECT: {
559  wxPoint2DDouble currentPos = m_camera->ScreenToWorld(clickPoint);
560  double x, y, w, h;
561  if(currentPos.m_x < m_startSelRect.m_x) {
562  x = currentPos.m_x;
563  w = m_startSelRect.m_x - currentPos.m_x;
564  } else {
565  x = m_startSelRect.m_x;
566  w = currentPos.m_x - m_startSelRect.m_x;
567  }
568  if(currentPos.m_y < m_startSelRect.m_y) {
569  y = currentPos.m_y;
570  h = m_startSelRect.m_y - currentPos.m_y;
571  } else {
572  y = m_startSelRect.m_y;
573  h = currentPos.m_y - m_startSelRect.m_y;
574  }
575 
576  m_selectionRect = wxRect2DDouble(x, y, w, h);
577  redraw = true;
578  } break;
579  default:
580  break;
581  }
582 
583  if(redraw) Redraw();
584  event.Skip();
585 }
586 
587 void ControlEditor::OnScroll(wxMouseEvent& event)
588 {
589  if(event.GetWheelRotation() > 0)
590  m_camera->SetScale(event.GetPosition(), +0.05);
591  else
592  m_camera->SetScale(event.GetPosition(), -0.05);
593 
594  Redraw();
595 }
596 
597 void ControlEditor::OnIdle(wxIdleEvent& event) { ConsolidateTexts(); }
598 void ControlEditor::OnKeyDown(wxKeyEvent& event)
599 {
600  char key = event.GetUnicodeKey();
601  if(key != WXK_NONE) {
602  switch(key) {
603  case WXK_DELETE: // Delete selected elements.
604  {
605  DeleteSelectedElements();
606  } break;
607  case 'R': // Rotate the selected elements.
608  {
609  RotateSelectedElements(event.GetModifiers() != wxMOD_SHIFT);
610  } break;
611  case 'L': {
612  // tests
613  } break;
614  }
615  }
616 }
617 
618 void ControlEditor::RotateSelectedElements(bool clockwise)
619 {
620  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
621  Element* element = *it;
622  if(element->IsSelected()) {
623  element->Rotate(clockwise);
624  auto childList = element->GetChildList();
625  for(auto itC = childList.begin(), itEndC = childList.end(); itC != itEndC; itC++) {
626  ConnectionLine* line = static_cast<ConnectionLine*>(*itC);
627  line->UpdatePoints();
628  }
629  }
630  }
631  Redraw();
632 }
633 
634 void ControlEditor::DeleteSelectedElements()
635 {
636  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
637  Element* element = *it;
638  if(element->IsSelected()) {
639  // Remove child/parent.
640  auto childList = element->GetChildList();
641  for(auto itC = childList.begin(), itEnd = childList.end(); itC != itEnd; ++itC) {
642  // The child is always a connection line.
643  ConnectionLine* child = static_cast<ConnectionLine*>(*itC);
644  // Delete the connection line.
645  for(auto itCo = m_connectionList.begin(); itCo != m_connectionList.end(); ++itCo) {
646  ConnectionLine* line = *itCo;
647  if(line == child) {
648  itCo = DeleteLineFromList(itCo);
649  break;
650  }
651  }
652  }
653  m_elementList.erase(it--);
654  if(element) delete element;
655  }
656  }
657 
658  for(auto it = m_connectionList.begin(); it != m_connectionList.end(); ++it) {
659  ConnectionLine* line = *it;
660  if(line->IsSelected()) {
661  it = DeleteLineFromList(it);
662  }
663  }
664  Redraw();
665 }
666 
667 std::vector<ConnectionLine*>::iterator ControlEditor::DeleteLineFromList(std::vector<ConnectionLine*>::iterator& it)
668 {
669  ConnectionLine* cLine = *it;
670  auto childList = cLine->GetLineChildList();
671  for(auto itC = childList.begin(), itEndC = childList.end(); itC != itEndC; ++itC) {
672  ConnectionLine* child = *itC;
673  for(auto itL = m_connectionList.begin(); itL != m_connectionList.end(); ++itL) {
674  ConnectionLine* childOnList = *itL;
675  if(childOnList == child) {
676  itL = DeleteLineFromList(itL);
677  }
678  }
679  }
680  // Remove
681  auto parentList = cLine->GetParentList();
682  for(auto itP = parentList.begin(), itEnd = parentList.end(); itP != itEnd; ++itP) {
683  Element* parent = *itP;
684  if(parent) parent->RemoveChild(cLine);
685  }
686  if(cLine->GetParentLine()) cLine->GetParentLine()->RemoveChild(cLine);
687  // Free nodes
688  auto nodeList = cLine->GetNodeList();
689  for(auto itN = nodeList.begin(), itEndN = nodeList.end(); itN != itEndN; ++itN) {
690  Node* node = *itN;
691  node->SetConnected(false);
692  }
693  m_connectionList.erase(it--);
694  if(cLine) delete cLine;
695  return it;
696 }
697 
698 void ControlEditor::CheckConnections()
699 {
700  for(auto it = m_connectionList.begin(); it != m_connectionList.end(); ++it) {
701  ConnectionLine* cLine = *it;
702  if(cLine->GetType() == ConnectionLine::ELEMENT_ELEMENT) {
703  if(cLine->GetParentList().size() < 2) {
704  it = DeleteLineFromList(it);
705  }
706  }
707  }
708 }
709 
710 void ControlEditor::OnExportClick(wxCommandEvent& event)
711 {
712  FileHanding fileHandling(this);
713 
714  wxFileDialog saveFileDialog(this, _("Save CTL file"), "", "", "CTL files (*.ctl)|*.ctl",
715  wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
716  if(saveFileDialog.ShowModal() == wxID_CANCEL) return;
717 
718  fileHandling.SaveControl(saveFileDialog.GetPath());
719  wxFileName fileName(saveFileDialog.GetPath());
720  event.Skip();
721 }
722 
723 void ControlEditor::OnImportClick(wxCommandEvent& event)
724 {
725  wxFileDialog openFileDialog(this, _("Open CTL file"), "", "", "CTL files (*.ctl)|*.ctl",
726  wxFD_OPEN | wxFD_FILE_MUST_EXIST);
727  if(openFileDialog.ShowModal() == wxID_CANCEL) return;
728 
729  wxFileName fileName(openFileDialog.GetPath());
730 
731  FileHanding fileHandling(this);
732  if(!fileHandling.OpenControl(fileName, m_elementList, m_connectionList)) {
733  wxMessageDialog msgDialog(this, _("It was not possible to open the selected file."), _("Error"),
734  wxOK | wxCENTRE | wxICON_ERROR);
735  msgDialog.ShowModal();
736  }
737 
738  SetLastElementID();
739  Redraw();
740  event.Skip();
741 }
742 
743 void ControlEditor::OnTestClick(wxCommandEvent& event)
744 {
745  ControlSystemTest csTest(this, &m_inputType, &m_startTime, &m_slope, &m_timeStep, &m_simTime);
746  if(csTest.ShowModal() == wxID_OK) {
747  double printStep = 1e-3;
748  double pdbStep = 1e-1;
749 
750  wxProgressDialog pbd(_("Test"), _("Initializing..."), 100, this,
751  wxPD_APP_MODAL | wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_SMOOTH);
752  ControlElementSolver solver(this, m_timeStep, 1e-5);
753  if(solver.IsOK()) {
754  bool simStopped = false;
755  double currentTime = 0.0;
756  double printTime = 0.0;
757  double pdbTime = 0.0;
758  std::vector<double> time;
759  std::vector<double> solution;
760  std::vector<double> inputV;
761  while(currentTime <= m_simTime) {
762  double input = 0.0;
763  if(currentTime >= m_startTime) {
764  switch(m_inputType) {
765  case 0: {
766  input = m_slope;
767  } break;
768  case 1: {
769  input = m_slope * (currentTime - m_startTime);
770  } break;
771  case 2: {
772  input = m_slope * std::pow(currentTime - m_startTime, 2);
773  } break;
774  default: {
775  input = 0.0;
776  break;
777  }
778  }
779  }
780 
781  solver.SolveNextStep(input);
782 
783  if(printTime >= printStep) {
784  time.push_back(currentTime);
785  solution.push_back(solver.GetLastSolution());
786  inputV.push_back(input);
787  printTime = 0.0;
788  }
789 
790  if(pdbTime > pdbStep) {
791  if(!pbd.Update((currentTime / m_simTime) * 100, wxString::Format("Time = %.2fs", currentTime))) {
792  pbd.Update(100);
793  simStopped = true;
794  currentTime = m_simTime;
795  }
796  pdbTime = 0.0;
797  }
798 
799  printTime += m_timeStep;
800  currentTime += m_timeStep;
801  pdbTime += m_timeStep;
802  }
803  if(!simStopped) {
804  std::vector<ElementPlotData> epdList;
805  ElementPlotData curveData(_("I/O"), ElementPlotData::CT_TEST);
806  curveData.AddData(inputV, _("Input"));
807  curveData.AddData(solution, _("Output"));
808 
809  curveData.SetPlot(0);
810  curveData.SetColour(0, *wxRED);
811  curveData.SetPlot(1);
812  curveData.SetColour(1, *wxBLUE);
813 
814  epdList.push_back(curveData);
815 
816  ChartView* cView = new ChartView(this, epdList, time);
817  cView->Show();
818  cView->UpdatePlot();
819  }
820  } else {
821  wxMessageDialog msgDialog(this, _("It was not possible to solve the control system"), _("Error"),
822  wxOK | wxCENTRE | wxICON_ERROR);
823  msgDialog.ShowModal();
824  }
825  }
826 }
827 
828 void ControlEditor::OnClose(wxCloseEvent& event)
829 {
830  if(m_ctrlContainer) {
831  m_ctrlContainer->FillContainer(this);
832  }
833  event.Skip();
834 }
835 
836 void ControlEditor::ConsolidateTexts()
837 {
838  // Solve wxGLString bug.
839  if(m_firstDraw) {
840  TransferFunction* tf = new TransferFunction(0);
841  m_elementList.push_back(tf);
842  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
843  ControlElement* element = *it;
844  element->UpdateText();
845  }
846  Redraw();
847  m_elementList.pop_back();
848  delete tf;
849  m_firstDraw = false;
850  }
851 }
852 
853 void ControlEditor::SetLastElementID()
854 {
855  int id = 0;
856  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
857  int elementID = (*it)->GetID();
858  if(id < elementID) id = elementID;
859  }
860  for(auto it = m_connectionList.begin(), itEnd = m_connectionList.end(); it != itEnd; ++it) {
861  int elementID = (*it)->GetID();
862  if(id < elementID) id = elementID;
863  }
864  m_lastElementID = ++id;
865 }
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Element.cpp:107
- - -
void SetSelected(bool selected=true)
Set element selection.
Definition: Element.h:123
- -
Definition: Sum.h:9
-
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:517
-
Definition: Gain.h:11
-
virtual void Move(wxPoint2DDouble position)
Move the element other position.
-
virtual std::vector< Element * > GetChildList() const
Get the Child list.
Definition: Element.h:523
- - -
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
-
Definition: Limiter.h:8
-
virtual void RemoveChild(Element *child)
Remove a child from the list.
Definition: Element.cpp:335
-
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "ControlEditor.h"
19 
20 #ifdef USING_WX_3_0_X
21 #include "DegreesAndRadians.h"
22 #endif
23 #include "FileHanding.h"
24 #include "Camera.h"
25 #include "ControlElement.h"
26 #include "TransferFunction.h"
27 #include "ConnectionLine.h"
28 #include "Sum.h"
29 #include "Multiplier.h"
30 #include "Limiter.h"
31 #include "RateLimiter.h"
32 #include "Exponential.h"
33 #include "Constant.h"
34 #include "Gain.h"
35 
36 #include "ControlElementSolver.h"
38 
39 #include "ChartView.h"
40 #include "ElementPlotData.h"
41 
42 ControlElementButton::ControlElementButton(wxWindow* parent, wxString label, wxImage image, wxWindowID id)
43  : wxWindow(parent, id)
44 {
45  SetBackgroundColour(*wxWHITE);
46  // m_font = wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
47  m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
48  m_label = label;
49  m_image = image;
50  m_imageSize = wxSize(image.GetWidth(), image.GetHeight());
51 
52  // Calculate label size.
53  wxScreenDC dc;
54  dc.SetFont(m_font);
55  wxSize textSize = dc.GetTextExtent(label);
56 
57  int buttonWidth = 0;
58  if(textSize.GetWidth() > m_imageSize.GetWidth()) {
59  buttonWidth = textSize.GetWidth();
60  m_imagePosition = wxPoint((buttonWidth - m_imageSize.GetWidth()) / 2 + m_borderSize, m_borderSize);
61  m_labelPosition = wxPoint(m_borderSize, m_imageSize.GetHeight() + m_borderSize);
62  } else {
63  buttonWidth = m_imageSize.GetWidth();
64  m_imagePosition = wxPoint(m_borderSize, m_borderSize);
65  m_labelPosition =
66  wxPoint((buttonWidth - textSize.GetWidth()) / 2 + m_borderSize, m_imageSize.GetHeight() + m_borderSize);
67  }
68  m_buttonSize =
69  wxSize(buttonWidth + 2 * m_borderSize, textSize.GetHeight() + m_imageSize.GetHeight() + 2 * m_borderSize);
70  SetMinSize(m_buttonSize + wxSize(m_borderSize, m_borderSize));
71 
72  // Events.
73  Bind(wxEVT_PAINT, &ControlElementButton::OnPaint, this);
74  Bind(wxEVT_ENTER_WINDOW, &ControlElementButton::OnMouseEnter, this);
75  Bind(wxEVT_LEAVE_WINDOW, &ControlElementButton::OnMouseLeave, this);
76  Bind(wxEVT_LEFT_DOWN, &ControlElementButton::OnLeftClickDown, this);
77  Bind(wxEVT_LEFT_UP, &ControlElementButton::OnLeftClickUp, this);
78 }
79 
80 ControlElementButton::~ControlElementButton() {}
81 void ControlElementButton::OnPaint(wxPaintEvent& event)
82 {
83  wxPaintDC dc(this);
84  wxGraphicsContext* gc = wxGraphicsContext::Create(dc);
85  if(gc) {
86  if(m_mouseAbove) {
87  if(m_selected) {
88  gc->SetPen(wxPen(wxColour(0, 125, 255, 255), m_borderSize - 1));
89  gc->SetBrush(wxBrush(wxColour(0, 125, 255, 100)));
90  } else {
91  gc->SetPen(*wxTRANSPARENT_PEN);
92  gc->SetBrush(wxBrush(wxColour(0, 125, 255, 70)));
93  }
94  gc->DrawRectangle(m_borderSize / 2, m_borderSize / 2, m_buttonSize.GetWidth(), m_buttonSize.GetHeight());
95  }
96  gc->DrawBitmap(gc->CreateBitmapFromImage(m_image), m_imagePosition.x, m_imagePosition.y, m_imageSize.GetWidth(),
97  m_imageSize.GetHeight());
98  gc->SetFont(m_font, *wxBLACK);
99  gc->DrawText(m_label, m_labelPosition.x, m_labelPosition.y);
100  delete gc;
101  }
102 }
103 
104 void ControlElementButton::OnMouseEnter(wxMouseEvent& event)
105 {
106  m_mouseAbove = true;
107  Refresh();
108  event.Skip();
109 }
110 
111 void ControlElementButton::OnMouseLeave(wxMouseEvent& event)
112 {
113  m_mouseAbove = false;
114  Refresh();
115  event.Skip();
116 }
117 
118 void ControlElementButton::OnLeftClickDown(wxMouseEvent& event)
119 {
120  m_selected = true;
121  Refresh();
122  event.Skip();
123 }
124 
125 void ControlElementButton::OnLeftClickUp(wxMouseEvent& event)
126 {
127  m_selected = false;
128  Refresh();
129  event.Skip();
130 }
131 
132 ControlEditor::ControlEditor(wxWindow* parent, int ioflags) : ControlEditorBase(parent)
133 {
134  BuildControlElementPanel();
135  m_glContext = new wxGLContext(m_glCanvas);
136  m_camera = new Camera();
137  m_selectionRect = wxRect2DDouble(0, 0, 0, 0);
138  // m_camera->SetScale(1.2);
139  m_ioFlags = ioflags;
140 }
141 ControlEditor::~ControlEditor()
142 {
143  // m_tfButton->Disconnect(wxEVT_LEFT_DOWN, wxMouseEventHandler(ControlEditor::LeftClickDown), m_tfButton, this);
144 }
145 
146 void ControlEditor::BuildControlElementPanel()
147 {
148  m_panelControlElements->SetDoubleBuffered(true);
149  wxWrapSizer* wrapSizer = new wxWrapSizer();
150  m_panelControlElements->SetSizer(wrapSizer);
151 
152  wxFileName exeFileName(wxStandardPaths::Get().GetExecutablePath());
153  wxString exePath = exeFileName.GetPath();
154 
156  m_panelControlElements, _("In/Out"), wxImage(exePath + "\\..\\data\\images\\control\\io.png"), ID_IO);
157  wrapSizer->Add(ioButton, 0, wxALL, 5);
158  ioButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
159 
160  ControlElementButton* tfButton =
161  new ControlElementButton(m_panelControlElements, _("Transfer fcn"),
162  wxImage(exePath + "\\..\\data\\images\\control\\transferFunc.png"), ID_TF);
163  wrapSizer->Add(tfButton, 0, wxALL, 5);
164  tfButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
165 
167  m_panelControlElements, _("Sum"), wxImage(exePath + "\\..\\data\\images\\control\\sum.png"), ID_SUM);
168  wrapSizer->Add(sumButton, 0, wxALL, 5);
169  sumButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
170 
171  ControlElementButton* constButton = new ControlElementButton(
172  m_panelControlElements, _("Constant"), wxImage(exePath + "\\..\\data\\images\\control\\value.png"), ID_CONST);
173  wrapSizer->Add(constButton, 0, wxALL, 5);
174  constButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
175 
176  ControlElementButton* limButton =
177  new ControlElementButton(m_panelControlElements, _("Limiter"),
178  wxImage(exePath + "\\..\\data\\images\\control\\limiter.png"), ID_LIMITER);
179  wrapSizer->Add(limButton, 0, wxALL, 5);
180  limButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
181 
182  ControlElementButton* gainButton = new ControlElementButton(
183  m_panelControlElements, _("Gain"), wxImage(exePath + "\\..\\data\\images\\control\\gain.png"), ID_GAIN);
184  wrapSizer->Add(gainButton, 0, wxALL, 5);
185  gainButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
186 
187  ControlElementButton* multButton = new ControlElementButton(
188  m_panelControlElements, _("Multiplier"), wxImage(exePath + "\\..\\data\\images\\control\\mult.png"), ID_MULT);
189  wrapSizer->Add(multButton, 0, wxALL, 5);
190  multButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
191 
193  m_panelControlElements, _("Exponential"), wxImage(exePath + "\\..\\data\\images\\control\\sat.png"), ID_EXP);
194  wrapSizer->Add(satButton, 0, wxALL, 5);
195  satButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
196 
197  ControlElementButton* rateLimButton =
198  new ControlElementButton(m_panelControlElements, _("Rate limiter"),
199  wxImage(exePath + "\\..\\data\\images\\control\\rateLimiter.png"), ID_RATELIM);
200  wrapSizer->Add(rateLimButton, 0, wxALL, 5);
201  rateLimButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this);
202 }
203 
204 void ControlEditor::LeftClickDown(wxMouseEvent& event)
205 {
206  AddElement(static_cast<ControlElementButtonID>(event.GetId()));
207  event.Skip();
208 }
209 
210 void ControlEditor::SetViewport()
211 {
212  glClearColor(1.0, 1.0, 1.0, 1.0); // White background.
213  glClear(GL_COLOR_BUFFER_BIT);
214  glDisable(GL_DEPTH_TEST);
215  glDisable(GL_TEXTURE_2D);
216  glEnable(GL_COLOR_MATERIAL);
217  glEnable(GL_BLEND);
218  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
219  glEnable(GL_LINE_SMOOTH);
220 
221  double width = m_glCanvas->GetSize().x - 1;
222  double height = m_glCanvas->GetSize().y - 1;
223 
224  // Viewport fit the screen.
225  glViewport(0, 0, width, height);
226 
227  glMatrixMode(GL_PROJECTION);
228  glLoadIdentity();
229  gluOrtho2D(0.0, width, height, 0.0);
230 
231  glMatrixMode(GL_MODELVIEW);
232  glLoadIdentity();
233 }
234 
235 void ControlEditor::AddElement(ControlElementButtonID id)
236 {
237  switch(id) {
238  case ID_IO: {
239  m_mode = MODE_INSERT;
240  IOControl* io = new IOControl(m_ioFlags, m_lastElementID);
241  m_elementList.push_back(io);
242  } break;
243  case ID_TF: {
244  m_mode = MODE_INSERT;
245  TransferFunction* tf = new TransferFunction(m_lastElementID);
246  m_elementList.push_back(tf);
247  } break;
248  case ID_SUM: {
249  m_mode = MODE_INSERT;
250  Sum* sum = new Sum(m_lastElementID);
251  m_elementList.push_back(sum);
252  } break;
253  case ID_CONST: {
254  m_mode = MODE_INSERT;
255  Constant* constant = new Constant(m_lastElementID);
256  m_elementList.push_back(constant);
257  } break;
258  case ID_LIMITER: {
259  m_mode = MODE_INSERT;
260  Limiter* limiter = new Limiter(m_lastElementID);
261  m_elementList.push_back(limiter);
262  } break;
263  case ID_GAIN: {
264  m_mode = MODE_INSERT;
265  Gain* gain = new Gain(m_lastElementID);
266  m_elementList.push_back(gain);
267  } break;
268  case ID_MULT: {
269  m_mode = MODE_INSERT;
270  Multiplier* mult = new Multiplier(m_lastElementID);
271  m_elementList.push_back(mult);
272  } break;
273  case ID_EXP: {
274  m_mode = MODE_INSERT;
275  Exponential* exp = new Exponential(m_lastElementID);
276  m_elementList.push_back(exp);
277  } break;
278  case ID_RATELIM: {
279  m_mode = MODE_INSERT;
280  RateLimiter* rateLim = new RateLimiter(m_lastElementID);
281  m_elementList.push_back(rateLim);
282  } break;
283  }
284  m_lastElementID++;
285 }
286 
287 void ControlEditor::OnPaint(wxPaintEvent& event)
288 {
289  wxPaintDC dc(m_glCanvas);
290  m_glContext->SetCurrent(*m_glCanvas);
291  SetViewport();
292 
293  // Set GLCanvas scale and translation.
294  glScaled(m_camera->GetScale(), m_camera->GetScale(), 0.0); // Scale
295  glTranslated(m_camera->GetTranslation().m_x, m_camera->GetTranslation().m_y, 0.0); // Translation
296 
297  for(auto it = m_connectionList.begin(), itEnd = m_connectionList.end(); it != itEnd; ++it) {
298  ConnectionLine* line = *it;
299  line->Draw(m_camera->GetTranslation(), m_camera->GetScale());
300  }
301 
302  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
303  Element* element = *it;
304  element->Draw(m_camera->GetTranslation(), m_camera->GetScale());
305  }
306 
307  // Selection rectangle
308  glLineWidth(1.0);
309  glColor4d(0.0, 0.5, 1.0, 1.0);
310  glBegin(GL_LINE_LOOP);
311  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y);
312  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y + m_selectionRect.m_height);
313  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y + m_selectionRect.m_height);
314  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y);
315  glEnd();
316  glColor4d(0.0, 0.5, 1.0, 0.3);
317  glBegin(GL_QUADS);
318  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y);
319  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y + m_selectionRect.m_height);
320  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y + m_selectionRect.m_height);
321  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y);
322  glEnd();
323 
324  glFlush(); // Sends all pending information directly to the GPU.
325  m_glCanvas->SwapBuffers();
326  event.Skip();
327 }
328 
329 void ControlEditor::OnDoubleClick(wxMouseEvent& event)
330 {
331  wxPoint2DDouble clickPoint = event.GetPosition();
332  bool redraw = false;
333 
334  if(m_mode == MODE_EDIT) {
335  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
336  Element* element = *it;
337  if(element->Contains(m_camera->ScreenToWorld(clickPoint))) {
338  element->ShowForm(this, element);
339  CheckConnections();
340  auto childList = element->GetChildList();
341  for(auto itC = childList.begin(), itEndC = childList.end(); itC != itEndC; ++itC) {
342  ConnectionLine* line = static_cast<ConnectionLine*>(*itC);
343  line->UpdatePoints();
344  }
345  redraw = true;
346  }
347  }
348  }
349 
350  if(redraw) Redraw();
351 }
352 
353 void ControlEditor::OnLeftClickDown(wxMouseEvent& event)
354 {
355  wxPoint2DDouble clickPoint = event.GetPosition();
356  bool foundElement = false;
357 
358  if(m_mode == MODE_INSERT) {
359  m_mode = MODE_EDIT;
360  } else {
361  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
362  ControlElement* element = *it;
363  bool foundNode = false;
364  auto nodeList = element->GetNodeList();
365  for(auto itN = nodeList.begin(), itNEnd = nodeList.end(); itN != itNEnd; ++itN) {
366  Node* node = *itN;
367  if(node->Contains(m_camera->ScreenToWorld(clickPoint))) {
368  m_mode = MODE_INSERT_LINE;
369  ConnectionLine* line = new ConnectionLine(node, m_lastElementID);
370  m_lastElementID++;
371  m_connectionList.push_back(line);
372  element->AddChild(line);
373  line->AddParent(element);
374  foundElement = true;
375  foundNode = true;
376  }
377  }
378 
379  if(!foundNode) {
380  // Set movement initial position (not necessarily will be moved).
381  element->StartMove(m_camera->ScreenToWorld(clickPoint));
382 
383  // Click in an element.
384  if(element->Contains(m_camera->ScreenToWorld(clickPoint))) {
385  if(!foundElement) {
386  element->SetSelected();
387  foundElement = true;
388  }
389  m_mode = MODE_MOVE_ELEMENT;
390  }
391  }
392  }
393  if(m_mode != MODE_INSERT_LINE) {
394  for(auto it = m_connectionList.begin(), itEnd = m_connectionList.end(); it != itEnd; ++it) {
395  ConnectionLine* line = *it;
396  line->StartMove(m_camera->ScreenToWorld(clickPoint));
397  if(line->Contains(m_camera->ScreenToWorld(clickPoint))) {
398  line->SetSelected();
399  foundElement = true;
400  m_mode = MODE_MOVE_LINE;
401  }
402  }
403  }
404  }
405 
406  if(!foundElement) {
407  m_mode = MODE_SELECTION_RECT;
408  m_startSelRect = m_camera->ScreenToWorld(clickPoint);
409  }
410 
411  Redraw();
412  event.Skip();
413 }
414 
415 void ControlEditor::OnLeftClickUp(wxMouseEvent& event)
416 {
417  bool foundNode = false;
418  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; it++) {
419  ControlElement* element = *it;
420  if(m_mode == MODE_INSERT_LINE) {
421  auto nodeList = element->GetNodeList();
422  for(auto itN = nodeList.begin(), itNEnd = nodeList.end(); itN != itNEnd; ++itN) {
423  Node* node = *itN;
424  if(node->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
425  ConnectionLine* line = *(m_connectionList.end() - 1);
426  if(line->AppendNode(node, element)) {
427  line->AddParent(element);
428  element->AddChild(line);
429  line->UpdatePoints();
430  m_mode = MODE_EDIT;
431  foundNode = true;
432  }
433  }
434  }
435  } else if(m_mode == MODE_SELECTION_RECT) {
436  if(element->Intersects(m_selectionRect)) {
437  element->SetSelected();
438  } else if(!event.ControlDown()) {
439  element->SetSelected(false);
440  }
441  } else if(!event.ControlDown()) {
442  if(!element->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
443  element->SetSelected(false);
444  }
445  }
446  }
447  for(auto it = m_connectionList.begin(), itEnd = m_connectionList.end(); it != itEnd; ++it) {
448  ConnectionLine* cLine = *it;
449  if(m_mode == MODE_INSERT_LINE && !foundNode && it != (itEnd - 1)) {
450  if(cLine->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
451  ConnectionLine* iLine = *(m_connectionList.end() - 1);
452  if(iLine->SetParentLine(cLine)) {
453  cLine->AddChild(iLine);
454  iLine->UpdatePoints();
455  m_mode = MODE_EDIT;
456  foundNode = true;
457  }
458  }
459  } else if(m_mode == MODE_SELECTION_RECT) {
460  if(cLine->Intersects(m_selectionRect)) {
461  cLine->SetSelected();
462  } else if(!event.ControlDown()) {
463  cLine->SetSelected(false);
464  }
465  } else if(!event.ControlDown()) {
466  if(!cLine->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
467  cLine->SetSelected(false);
468  }
469  }
470  }
471 
472  m_selectionRect = wxRect2DDouble(0, 0, 0, 0);
473 
474  if(m_mode == MODE_INSERT_LINE && !foundNode) {
475  ConnectionLine* cLine = *(m_connectionList.end() - 1);
476  // Free nodes
477  auto nodeList = cLine->GetNodeList();
478  for(auto itN = nodeList.begin(), itEndN = nodeList.end(); itN != itEndN; ++itN) {
479  Node* node = *itN;
480  node->SetConnected(false);
481  }
482  // Remove the associated child from parents.
483  auto parentList = cLine->GetParentList();
484  for(auto it = parentList.begin(), itEnd = parentList.end(); it != itEnd; ++it) {
485  Element* element = *it;
486  element->RemoveChild(cLine);
487  }
488  m_connectionList.pop_back();
489  if(cLine) delete cLine;
490  m_mode = MODE_EDIT;
491  } else if(m_mode != MODE_INSERT) {
492  m_mode = MODE_EDIT;
493  }
494 
495  Redraw();
496  event.Skip();
497 }
498 
499 void ControlEditor::OnMiddleDown(wxMouseEvent& event)
500 {
501  // Set to drag mode.
502  switch(m_mode) {
503  case MODE_INSERT: {
504  m_mode = MODE_DRAG_INSERT;
505  } break;
506  case MODE_PASTE: {
507  m_mode = MODE_DRAG_PASTE;
508  } break;
509  default: {
510  m_mode = MODE_DRAG;
511  } break;
512  }
513  m_camera->StartTranslation(m_camera->ScreenToWorld(event.GetPosition()));
514 }
515 
516 void ControlEditor::OnMiddleUp(wxMouseEvent& event)
517 {
518  switch(m_mode) {
519  case MODE_DRAG_INSERT: {
520  m_mode = MODE_INSERT;
521  } break;
522  case MODE_DRAG_PASTE: {
523  m_mode = MODE_PASTE;
524  } break;
525  case MODE_INSERT:
526  case MODE_PASTE: {
527  // Does nothing.
528  } break;
529  default: {
530  m_mode = MODE_EDIT;
531  } break;
532  }
533 }
534 
535 void ControlEditor::OnMouseMotion(wxMouseEvent& event)
536 {
537  wxPoint2DDouble clickPoint = event.GetPosition();
538  bool redraw = false;
539 
540  switch(m_mode) {
541  case MODE_INSERT: {
542  Element* newElement = *(m_elementList.end() - 1); // Get the last element in the list.
543  newElement->Move(m_camera->ScreenToWorld(clickPoint));
544  redraw = true;
545  } break;
546  case MODE_INSERT_LINE: {
547  ConnectionLine* line = *(m_connectionList.end() - 1);
548  line->SetTemporarySecondPoint(m_camera->ScreenToWorld(clickPoint));
549  line->UpdatePoints();
550  redraw = true;
551  } break;
552  case MODE_DRAG:
553  case MODE_DRAG_INSERT:
554  case MODE_DRAG_PASTE: {
555  m_camera->SetTranslation(clickPoint);
556  redraw = true;
557  } break;
558  case MODE_MOVE_ELEMENT: {
559  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; it++) {
560  Element* element = *it;
561  if(element->IsSelected()) {
562  element->Move(m_camera->ScreenToWorld(clickPoint));
563  auto childList = element->GetChildList();
564  for(auto itC = childList.begin(), itEndC = childList.end(); itC != itEndC; itC++) {
565  ConnectionLine* line = static_cast<ConnectionLine*>(*itC);
566  line->UpdatePoints();
567  }
568  redraw = true;
569  }
570  }
571  } break;
572  case MODE_MOVE_LINE: {
573  for(auto it = m_connectionList.begin(), itEnd = m_connectionList.end(); it != itEnd; it++) {
574  ConnectionLine* line = *it;
575  if(line->IsSelected()) {
576  line->Move(m_camera->ScreenToWorld(clickPoint));
577  redraw = true;
578  }
579  }
580  } break;
581  case MODE_SELECTION_RECT: {
582  wxPoint2DDouble currentPos = m_camera->ScreenToWorld(clickPoint);
583  double x, y, w, h;
584  if(currentPos.m_x < m_startSelRect.m_x) {
585  x = currentPos.m_x;
586  w = m_startSelRect.m_x - currentPos.m_x;
587  } else {
588  x = m_startSelRect.m_x;
589  w = currentPos.m_x - m_startSelRect.m_x;
590  }
591  if(currentPos.m_y < m_startSelRect.m_y) {
592  y = currentPos.m_y;
593  h = m_startSelRect.m_y - currentPos.m_y;
594  } else {
595  y = m_startSelRect.m_y;
596  h = currentPos.m_y - m_startSelRect.m_y;
597  }
598 
599  m_selectionRect = wxRect2DDouble(x, y, w, h);
600  redraw = true;
601  } break;
602  default:
603  break;
604  }
605 
606  if(redraw) Redraw();
607  event.Skip();
608 }
609 
610 void ControlEditor::OnScroll(wxMouseEvent& event)
611 {
612  if(event.GetWheelRotation() > 0)
613  m_camera->SetScale(event.GetPosition(), +0.05);
614  else
615  m_camera->SetScale(event.GetPosition(), -0.05);
616 
617  Redraw();
618 }
619 
620 void ControlEditor::OnIdle(wxIdleEvent& event) { ConsolidateTexts(); }
621 void ControlEditor::OnKeyDown(wxKeyEvent& event)
622 {
623  char key = event.GetUnicodeKey();
624  if(key != WXK_NONE) {
625  switch(key) {
626  case WXK_DELETE: // Delete selected elements.
627  {
628  DeleteSelectedElements();
629  } break;
630  case 'R': // Rotate the selected elements.
631  {
632  RotateSelectedElements(event.GetModifiers() != wxMOD_SHIFT);
633  } break;
634  case 'L': {
635  // tests
636  } break;
637  }
638  }
639 }
640 
641 void ControlEditor::RotateSelectedElements(bool clockwise)
642 {
643  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
644  Element* element = *it;
645  if(element->IsSelected()) {
646  element->Rotate(clockwise);
647  auto childList = element->GetChildList();
648  for(auto itC = childList.begin(), itEndC = childList.end(); itC != itEndC; itC++) {
649  ConnectionLine* line = static_cast<ConnectionLine*>(*itC);
650  line->UpdatePoints();
651  }
652  }
653  }
654  Redraw();
655 }
656 
657 void ControlEditor::DeleteSelectedElements()
658 {
659  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
660  Element* element = *it;
661  if(element->IsSelected()) {
662  // Remove child/parent.
663  auto childList = element->GetChildList();
664  for(auto itC = childList.begin(), itEnd = childList.end(); itC != itEnd; ++itC) {
665  // The child is always a connection line.
666  ConnectionLine* child = static_cast<ConnectionLine*>(*itC);
667  // Delete the connection line.
668  for(auto itCo = m_connectionList.begin(); itCo != m_connectionList.end(); ++itCo) {
669  ConnectionLine* line = *itCo;
670  if(line == child) {
671  itCo = DeleteLineFromList(itCo);
672  break;
673  }
674  }
675  }
676  m_elementList.erase(it--);
677  if(element) delete element;
678  }
679  }
680 
681  for(auto it = m_connectionList.begin(); it != m_connectionList.end(); ++it) {
682  ConnectionLine* line = *it;
683  if(line->IsSelected()) {
684  it = DeleteLineFromList(it);
685  }
686  }
687  Redraw();
688 }
689 
690 std::vector<ConnectionLine*>::iterator ControlEditor::DeleteLineFromList(std::vector<ConnectionLine*>::iterator& it)
691 {
692  ConnectionLine* cLine = *it;
693  auto childList = cLine->GetLineChildList();
694  for(auto itC = childList.begin(), itEndC = childList.end(); itC != itEndC; ++itC) {
695  ConnectionLine* child = *itC;
696  for(auto itL = m_connectionList.begin(); itL != m_connectionList.end(); ++itL) {
697  ConnectionLine* childOnList = *itL;
698  if(childOnList == child) {
699  itL = DeleteLineFromList(itL);
700  }
701  }
702  }
703  // Remove
704  auto parentList = cLine->GetParentList();
705  for(auto itP = parentList.begin(), itEnd = parentList.end(); itP != itEnd; ++itP) {
706  Element* parent = *itP;
707  if(parent) parent->RemoveChild(cLine);
708  }
709  if(cLine->GetParentLine()) cLine->GetParentLine()->RemoveChild(cLine);
710  // Free nodes
711  auto nodeList = cLine->GetNodeList();
712  for(auto itN = nodeList.begin(), itEndN = nodeList.end(); itN != itEndN; ++itN) {
713  Node* node = *itN;
714  node->SetConnected(false);
715  }
716  m_connectionList.erase(it--);
717  if(cLine) delete cLine;
718  return it;
719 }
720 
721 void ControlEditor::CheckConnections()
722 {
723  for(auto it = m_connectionList.begin(); it != m_connectionList.end(); ++it) {
724  ConnectionLine* cLine = *it;
725  if(cLine->GetType() == ConnectionLine::ELEMENT_ELEMENT) {
726  if(cLine->GetParentList().size() < 2) {
727  it = DeleteLineFromList(it);
728  }
729  }
730  }
731 }
732 
733 void ControlEditor::OnExportClick(wxCommandEvent& event)
734 {
735  FileHanding fileHandling(this);
736 
737  wxFileDialog saveFileDialog(this, _("Save CTL file"), "", "", "CTL files (*.ctl)|*.ctl",
738  wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
739  if(saveFileDialog.ShowModal() == wxID_CANCEL) return;
740 
741  fileHandling.SaveControl(saveFileDialog.GetPath());
742  wxFileName fileName(saveFileDialog.GetPath());
743  event.Skip();
744 }
745 
746 void ControlEditor::OnImportClick(wxCommandEvent& event)
747 {
748  wxFileDialog openFileDialog(this, _("Open CTL file"), "", "", "CTL files (*.ctl)|*.ctl",
749  wxFD_OPEN | wxFD_FILE_MUST_EXIST);
750  if(openFileDialog.ShowModal() == wxID_CANCEL) return;
751 
752  wxFileName fileName(openFileDialog.GetPath());
753 
754  FileHanding fileHandling(this);
755  if(!fileHandling.OpenControl(fileName, m_elementList, m_connectionList)) {
756  wxMessageDialog msgDialog(this, _("It was not possible to open the selected file."), _("Error"),
757  wxOK | wxCENTRE | wxICON_ERROR);
758  msgDialog.ShowModal();
759  }
760 
761  SetLastElementID();
762  Redraw();
763  event.Skip();
764 }
765 
766 void ControlEditor::OnTestClick(wxCommandEvent& event)
767 {
768  ControlSystemTest csTest(this, &m_inputType, &m_startTime, &m_slope, &m_timeStep, &m_simTime);
769  if(csTest.ShowModal() == wxID_OK) {
770  double printStep = 1e-3;
771  double pdbStep = 1e-1;
772 
773  wxProgressDialog pbd(_("Test"), _("Initializing..."), 100, this,
774  wxPD_APP_MODAL | wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_SMOOTH);
775  ControlElementSolver solver(this, m_timeStep, 1e-5);
776  if(solver.IsOK()) {
777  bool simStopped = false;
778  double currentTime = 0.0;
779  double printTime = 0.0;
780  double pdbTime = 0.0;
781  std::vector<double> time;
782  std::vector<double> solution;
783  std::vector<double> inputV;
784  while(currentTime <= m_simTime) {
785  double input = 0.0;
786  if(currentTime >= m_startTime) {
787  switch(m_inputType) {
788  case 0: {
789  input = m_slope;
790  } break;
791  case 1: {
792  input = m_slope * (currentTime - m_startTime);
793  } break;
794  case 2: {
795  input = m_slope * std::pow(currentTime - m_startTime, 2);
796  } break;
797  default: {
798  input = 0.0;
799  break;
800  }
801  }
802  }
803 
804  solver.SolveNextStep(input);
805 
806  if(printTime >= printStep) {
807  time.push_back(currentTime);
808  solution.push_back(solver.GetLastSolution());
809  inputV.push_back(input);
810  printTime = 0.0;
811  }
812 
813  if(pdbTime > pdbStep) {
814  if(!pbd.Update((currentTime / m_simTime) * 100, wxString::Format("Time = %.2fs", currentTime))) {
815  pbd.Update(100);
816  simStopped = true;
817  currentTime = m_simTime;
818  }
819  pdbTime = 0.0;
820  }
821 
822  printTime += m_timeStep;
823  currentTime += m_timeStep;
824  pdbTime += m_timeStep;
825  }
826  if(!simStopped) {
827  std::vector<ElementPlotData> epdList;
828  ElementPlotData curveData(_("I/O"), ElementPlotData::CT_TEST);
829  curveData.AddData(inputV, _("Input"));
830  curveData.AddData(solution, _("Output"));
831 
832  curveData.SetPlot(0);
833  curveData.SetColour(0, *wxRED);
834  curveData.SetPlot(1);
835  curveData.SetColour(1, *wxBLUE);
836 
837  epdList.push_back(curveData);
838 
839  ChartView* cView = new ChartView(this, epdList, time);
840  cView->Show();
841  cView->UpdatePlot();
842  }
843  } else {
844  wxMessageDialog msgDialog(this, _("It was not possible to solve the control system"), _("Error"),
845  wxOK | wxCENTRE | wxICON_ERROR);
846  msgDialog.ShowModal();
847  }
848  }
849 }
850 
851 void ControlEditor::OnClose(wxCloseEvent& event)
852 {
853  if(m_ctrlContainer) {
854  m_ctrlContainer->FillContainer(this);
855  }
856  event.Skip();
857 }
858 
859 void ControlEditor::ConsolidateTexts()
860 {
861  // Solve wxGLString bug.
862  if(m_firstDraw) {
863  TransferFunction* tf = new TransferFunction(0);
864  m_elementList.push_back(tf);
865  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
866  ControlElement* element = *it;
867  element->UpdateText();
868  }
869  Redraw();
870  m_elementList.pop_back();
871  delete tf;
872  m_firstDraw = false;
873  }
874 }
875 
876 void ControlEditor::SetLastElementID()
877 {
878  int id = 0;
879  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
880  int elementID = (*it)->GetID();
881  if(id < elementID) id = elementID;
882  }
883  for(auto it = m_connectionList.begin(), itEnd = m_connectionList.end(); it != itEnd; ++it) {
884  int elementID = (*it)->GetID();
885  if(id < elementID) id = elementID;
886  }
887  m_lastElementID = ++id;
888 }
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Element.cpp:123
+
Multiplies two inputs.
Definition: Multiplier.h:32
+ +
void SetSelected(bool selected=true)
Set element selection.
Definition: Element.h:146
+
Solves in the time the control system. Can solve the control system directly from a ControlEditor or ...
+
Definition: Sum.h:26
+
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:506
+
Provide an output multiplying the input by a constant. .
Definition: Gain.h:36
+
virtual void Move(wxPoint2DDouble position)
Move the element other position.
+
virtual std::vector< Element * > GetChildList() const
Get the Child list.
Definition: Element.h:511
+
Node of a control element. This class manages the user interaction with the connection and control el...
+ +
Save and opens the projects created on disk.
Definition: FileHanding.h:43
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
+
Limits the input value by superior and inferior values.
Definition: Limiter.h:32
+ +
virtual void RemoveChild(Element *child)
Remove a child from the list.
Definition: Element.cpp:354
+
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
virtual bool Intersects(wxRect2DDouble rect) const =0
Check if the element&#39;s rect intersects other rect.
-
Definition: Camera.h:6
- - -
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Element.h:234
+
Class responsible for the correct visualization of the elements on screen.
Definition: Camera.h:30
+
This class is responsible to handle the user interaction with control elements.
Definition: ControlEditor.h:63
+
Provides the communication with the power element.
Definition: IOControl.h:35
+ + +
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Element.h:240
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Element.h:302
- - -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Element.h:308
-
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:333
- - -
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Element.h:547
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
- - -
bool IsSelected() const
Checks if the element is selected.
Definition: Element.h:189
+ +
Generates an output following an exponential function. .
Definition: Exponential.h:33
+ +
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Element.h:307
+
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:353
+ +
This class is responsible to manage the charts generated in the transient electromechanical studies...
Definition: ChartView.h:40
+
Limits the rising and/or falling rate.
Definition: RateLimiter.h:32
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Element.h:534
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
+
Connection between two control elements or other connection line and an element.
+ + + +
bool IsSelected() const
Checks if the element is selected.
Definition: Element.h:202
+ +
Base class of a control element. Provide general methods to other control classes.
+ +
virtual bool Contains(wxPoint2DDouble position) const =0
Checks if the element contains a position.
- -
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
- -
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
- + + + +
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
+
A control element that provides a constant value.
Definition: Constant.h:35
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
+
Form to edit properties to test the control system created.
diff --git a/docs/doxygen/html/_control_editor_8h.html b/docs/doxygen/html/_control_editor_8h.html new file mode 100644 index 0000000..de363bb --- /dev/null +++ b/docs/doxygen/html/_control_editor_8h.html @@ -0,0 +1,145 @@ + + + + + + + + + +Project/ControlEditor.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
ControlEditor.h File Reference
+
+
+
#include "ControlEditorBase.h"
+#include <wx/wrapsizer.h>
+#include <wx/dcclient.h>
+#include <wx/dcscreen.h>
+#include <wx/graphics.h>
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include <wx/progdlg.h>
+#include "IOControl.h"
+#include "ControlSystemTest.h"
+
+

Go to the source code of this file.

+ + + + + + + +

+Classes

class  ControlElementButton
 This class is responsible to handle the user interaction with control elements. More...
 
class  ControlEditor
 
+ + + +

+Enumerations

enum  ControlElementButtonID {
+  ID_IO = 0, +ID_TF, +ID_SUM, +ID_CONST, +
+  ID_LIMITER, +ID_GAIN, +ID_MULT, +ID_EXP, +
+  ID_RATELIM +
+ }
 
+
+
+ + + + diff --git a/docs/doxygen/html/_control_editor_8h.js b/docs/doxygen/html/_control_editor_8h.js new file mode 100644 index 0000000..41a8e39 --- /dev/null +++ b/docs/doxygen/html/_control_editor_8h.js @@ -0,0 +1,16 @@ +var _control_editor_8h = +[ + [ "ControlElementButton", "class_control_element_button.html", "class_control_element_button" ], + [ "ControlEditor", "class_control_editor.html", "class_control_editor" ], + [ "ControlElementButtonID", "_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076", [ + [ "ID_IO", "_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076a82d160d51a00e0512485fb0afff4a09a", null ], + [ "ID_TF", "_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076aa141db7d0f650ecdc828cb8f36fe6ac8", null ], + [ "ID_SUM", "_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076ac09b0c2232a1d94b9cf4caeeff65a959", null ], + [ "ID_CONST", "_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076a39af4bb4f8a6a60d53796dc24c7ef52e", null ], + [ "ID_LIMITER", "_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076a007742cc97c341c08b014bc2e0385c40", null ], + [ "ID_GAIN", "_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076abc8cc51c937d00684cb6967548dbbe12", null ], + [ "ID_MULT", "_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076a4db14943629d93315bc091b2d7e8ac1b", null ], + [ "ID_EXP", "_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076a9f541dfe8890f2636816ed2d7f8d07d7", null ], + [ "ID_RATELIM", "_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076aec5fbed678b51ff6e1b215cb36ac9bfa", null ] + ] ] +]; \ No newline at end of file diff --git a/docs/doxygen/html/_control_editor_8h_source.html b/docs/doxygen/html/_control_editor_8h_source.html index 5feed6d..02a1e13 100644 --- a/docs/doxygen/html/_control_editor_8h_source.html +++ b/docs/doxygen/html/_control_editor_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,32 +88,34 @@ $(document).ready(function(){initNavTree('_control_editor_8h_source.html','');})
ControlEditor.h
-
1 #ifndef CONTROLEDITOR_H
2 #define CONTROLEDITOR_H
3 
4 #include "ControlEditorBase.h"
5 #include <wx/wrapsizer.h>
6 #include <wx/dcclient.h>
7 #include <wx/dcscreen.h>
8 #include <wx/graphics.h>
9 #include <GL/gl.h>
10 #include <GL/glu.h>
11 
12 #include <wx/progdlg.h>
13 
14 #include "IOControl.h"
15 #include "ControlSystemTest.h"
16 
17 class FileHanding;
18 class Camera;
19 class Element;
20 class ControlElement;
21 class TransferFunction;
22 class ConnectionLine;
23 class Sum;
24 class Multiplier;
25 class Limiter;
26 class RateLimiter;
27 class Exponential;
28 class Constant;
29 class Gain;
30 
33 
34 class ChartView;
35 class ElementDataObject;
36 
37 enum ControlElementButtonID { ID_IO = 0, ID_TF, ID_SUM, ID_CONST, ID_LIMITER, ID_GAIN, ID_MULT, ID_EXP, ID_RATELIM };
38 
39 class ControlElementButton : public wxWindow
40 {
41  public:
42  ControlElementButton(wxWindow* parent, wxString label, wxImage image, wxWindowID id = wxID_ANY);
44 
45  protected:
46  virtual void OnPaint(wxPaintEvent& event);
47  virtual void OnMouseEnter(wxMouseEvent& event);
48  virtual void OnMouseLeave(wxMouseEvent& event);
49  virtual void OnLeftClickDown(wxMouseEvent& event);
50  virtual void OnLeftClickUp(wxMouseEvent& event);
51 
52  wxString m_label;
53  wxFont m_font;
54  wxPoint m_labelPosition;
55 
56  wxImage m_image;
57  wxSize m_imageSize;
58  wxPoint m_imagePosition;
59 
60  int m_borderSize = 2;
61  bool m_mouseAbove = false;
62  bool m_selected = false;
63 
64  wxSize m_buttonSize;
65 };
66 
68 {
69  public:
70  enum ControlEditorMode {
71  MODE_EDIT = 0,
72  MODE_MOVE_ELEMENT,
73  MODE_MOVE_LINE,
74  MODE_DRAG,
75  MODE_DRAG_INSERT,
76  MODE_INSERT,
77  MODE_INSERT_LINE,
78  MODE_SELECTION_RECT,
79  MODE_PASTE,
80  MODE_DRAG_PASTE
81  };
82 
83  ControlEditor(wxWindow* parent,
84  int ioflags = IOControl::IN_TERMINAL_VOLTAGE | IOControl::IN_VELOCITY | IOControl::OUT_FIELD_VOLTAGE |
85  IOControl::OUT_MEC_POWER);
86  virtual ~ControlEditor();
87 
88  virtual void AddElement(ControlElementButtonID id);
89  virtual void Redraw() { m_glCanvas->Refresh(); }
90  virtual void RotateSelectedElements(bool clockwise);
91  virtual void DeleteSelectedElements();
92  virtual void CheckConnections();
93  virtual std::vector<ConnectionLine*> GetConnectionLineList() const { return m_connectionList; }
94  virtual std::vector<ControlElement*> GetControlElementList() const { return m_elementList; }
95  virtual void SetElementsList(std::vector<ControlElement*> elementList) { m_elementList = elementList; }
96  virtual void SetConnectionsList(std::vector<ConnectionLine*> connectionList) { m_connectionList = connectionList; }
97  virtual void SetControlContainer(ControlElementContainer* ctrlContainer) { m_ctrlContainer = ctrlContainer; }
98  protected:
99  virtual void OnClose(wxCloseEvent& event);
100  virtual void OnTestClick(wxCommandEvent& event);
101  virtual void OnButtonOKClick(wxCommandEvent& event) { Close(); }
102  virtual void OnImportClick(wxCommandEvent& event);
103  virtual void OnExportClick(wxCommandEvent& event);
104  virtual void OnKeyDown(wxKeyEvent& event);
105  virtual void OnIdle(wxIdleEvent& event);
106  virtual void OnScroll(wxMouseEvent& event);
107  virtual void OnDoubleClick(wxMouseEvent& event);
108  virtual void OnLeftClickDown(wxMouseEvent& event);
109  virtual void OnLeftClickUp(wxMouseEvent& event);
110  virtual void OnMiddleDown(wxMouseEvent& event);
111  virtual void OnMiddleUp(wxMouseEvent& event);
112  virtual void OnMouseMotion(wxMouseEvent& event);
113  virtual void OnPaint(wxPaintEvent& event);
114  virtual void LeftClickDown(wxMouseEvent& event);
115 
116  void BuildControlElementPanel();
117  void SetViewport();
118  void ConsolidateTexts();
119  void SetLastElementID();
120 
121  std::vector<ConnectionLine*>::iterator DeleteLineFromList(std::vector<ConnectionLine*>::iterator& it);
122 
123  wxGLContext* m_glContext = NULL;
124  Camera* m_camera = NULL;
125 
126  ControlEditorMode m_mode = MODE_EDIT;
127 
128  wxRect2DDouble m_selectionRect;
129  wxPoint2DDouble m_startSelRect;
130 
131  std::vector<ControlElement*> m_elementList;
132  std::vector<ConnectionLine*> m_connectionList;
133 
134  ControlElementContainer* m_ctrlContainer = NULL;
135 
136  bool m_firstDraw = true;
137  int m_ioFlags;
138 
139  int m_lastElementID = 0;
140 
141  int m_inputType = 0;
142  double m_startTime = 1.0;
143  double m_slope = 1.0;
144  double m_timeStep = 1e-4;
145  double m_simTime = 10.0;
146 };
147 #endif // CONTROLEDITOR_H
- - -
Definition: Sum.h:9
-
Definition: Gain.h:11
- -
Definition: Limiter.h:8
-
Definition: Camera.h:6
- +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CONTROLEDITOR_H
19 #define CONTROLEDITOR_H
20 
21 #include "ControlEditorBase.h"
22 #include <wx/wrapsizer.h>
23 #include <wx/dcclient.h>
24 #include <wx/dcscreen.h>
25 #include <wx/graphics.h>
26 #include <GL/gl.h>
27 #include <GL/glu.h>
28 
29 #include <wx/progdlg.h>
30 
31 #include "IOControl.h"
32 #include "ControlSystemTest.h"
33 
34 class FileHanding;
35 class Camera;
36 class Element;
37 class ControlElement;
38 class TransferFunction;
39 class ConnectionLine;
40 class Sum;
41 class Multiplier;
42 class Limiter;
43 class RateLimiter;
44 class Exponential;
45 class Constant;
46 class Gain;
47 
50 
51 class ChartView;
52 class ElementDataObject;
53 
54 enum ControlElementButtonID { ID_IO = 0, ID_TF, ID_SUM, ID_CONST, ID_LIMITER, ID_GAIN, ID_MULT, ID_EXP, ID_RATELIM };
55 
63 class ControlElementButton : public wxWindow
64 {
65  public:
66  ControlElementButton(wxWindow* parent, wxString label, wxImage image, wxWindowID id = wxID_ANY);
68 
69  protected:
70  virtual void OnPaint(wxPaintEvent& event);
71  virtual void OnMouseEnter(wxMouseEvent& event);
72  virtual void OnMouseLeave(wxMouseEvent& event);
73  virtual void OnLeftClickDown(wxMouseEvent& event);
74  virtual void OnLeftClickUp(wxMouseEvent& event);
75 
76  wxString m_label;
77  wxFont m_font;
78  wxPoint m_labelPosition;
79 
80  wxImage m_image;
81  wxSize m_imageSize;
82  wxPoint m_imagePosition;
83 
84  int m_borderSize = 2;
85  bool m_mouseAbove = false;
86  bool m_selected = false;
87 
88  wxSize m_buttonSize;
89 };
90 
92 {
93  public:
94  enum ControlEditorMode {
95  MODE_EDIT = 0,
96  MODE_MOVE_ELEMENT,
97  MODE_MOVE_LINE,
98  MODE_DRAG,
99  MODE_DRAG_INSERT,
100  MODE_INSERT,
101  MODE_INSERT_LINE,
102  MODE_SELECTION_RECT,
103  MODE_PASTE,
104  MODE_DRAG_PASTE
105  };
106 
107  ControlEditor(wxWindow* parent,
108  int ioflags = IOControl::IN_TERMINAL_VOLTAGE | IOControl::IN_VELOCITY | IOControl::OUT_FIELD_VOLTAGE |
109  IOControl::OUT_MEC_POWER);
110  virtual ~ControlEditor();
111 
112  virtual void AddElement(ControlElementButtonID id);
113  virtual void Redraw() { m_glCanvas->Refresh(); }
114  virtual void RotateSelectedElements(bool clockwise);
115  virtual void DeleteSelectedElements();
116  virtual void CheckConnections();
117  virtual std::vector<ConnectionLine*> GetConnectionLineList() const { return m_connectionList; }
118  virtual std::vector<ControlElement*> GetControlElementList() const { return m_elementList; }
119  virtual void SetElementsList(std::vector<ControlElement*> elementList) { m_elementList = elementList; }
120  virtual void SetConnectionsList(std::vector<ConnectionLine*> connectionList) { m_connectionList = connectionList; }
121  virtual void SetControlContainer(ControlElementContainer* ctrlContainer) { m_ctrlContainer = ctrlContainer; }
122  protected:
123  virtual void OnClose(wxCloseEvent& event);
124  virtual void OnTestClick(wxCommandEvent& event);
125  virtual void OnButtonOKClick(wxCommandEvent& event) { Close(); }
126  virtual void OnImportClick(wxCommandEvent& event);
127  virtual void OnExportClick(wxCommandEvent& event);
128  virtual void OnKeyDown(wxKeyEvent& event);
129  virtual void OnIdle(wxIdleEvent& event);
130  virtual void OnScroll(wxMouseEvent& event);
131  virtual void OnDoubleClick(wxMouseEvent& event);
132  virtual void OnLeftClickDown(wxMouseEvent& event);
133  virtual void OnLeftClickUp(wxMouseEvent& event);
134  virtual void OnMiddleDown(wxMouseEvent& event);
135  virtual void OnMiddleUp(wxMouseEvent& event);
136  virtual void OnMouseMotion(wxMouseEvent& event);
137  virtual void OnPaint(wxPaintEvent& event);
138  virtual void LeftClickDown(wxMouseEvent& event);
139 
140  void BuildControlElementPanel();
141  void SetViewport();
142  void ConsolidateTexts();
143  void SetLastElementID();
144 
145  std::vector<ConnectionLine*>::iterator DeleteLineFromList(std::vector<ConnectionLine*>::iterator& it);
146 
147  wxGLContext* m_glContext = NULL;
148  Camera* m_camera = NULL;
149 
150  ControlEditorMode m_mode = MODE_EDIT;
151 
152  wxRect2DDouble m_selectionRect;
153  wxPoint2DDouble m_startSelRect;
154 
155  std::vector<ControlElement*> m_elementList;
156  std::vector<ConnectionLine*> m_connectionList;
157 
158  ControlElementContainer* m_ctrlContainer = NULL;
159 
160  bool m_firstDraw = true;
161  int m_ioFlags;
162 
163  int m_lastElementID = 0;
164 
165  int m_inputType = 0;
166  double m_startTime = 1.0;
167  double m_slope = 1.0;
168  double m_timeStep = 1e-4;
169  double m_simTime = 10.0;
170 };
171 #endif // CONTROLEDITOR_H
Multiplies two inputs.
Definition: Multiplier.h:32
+ +
Solves in the time the control system. Can solve the control system directly from a ControlEditor or ...
+
Definition: Sum.h:26
+
Provide an output multiplying the input by a constant. .
Definition: Gain.h:36
+ +
Save and opens the projects created on disk.
Definition: FileHanding.h:43
+
Limits the input value by superior and inferior values.
Definition: Limiter.h:32
+
Class responsible for the correct visualization of the elements on screen.
Definition: Camera.h:30
+
This class is responsible to handle the user interaction with control elements.
Definition: ControlEditor.h:63
- - - - - - - - - - +
Generates an output following an exponential function. .
Definition: Exponential.h:33
+ +
This class is responsible to manage the charts generated in the transient electromechanical studies...
Definition: ChartView.h:40
+
Limits the rising and/or falling rate.
Definition: RateLimiter.h:32
+
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
+
Connection between two control elements or other connection line and an element.
+ + + + +
A control element that provides a constant value.
Definition: Constant.h:35
-
1 #include "ControlElement.h"
2 #ifdef USING_WX_3_0_X
3 #include "DegreesAndRadians.h"
4 #endif
5 
6 Node::Node(wxPoint2DDouble position, NodeType nodeType, double borderSize)
7 {
8  double totalRadius = m_radius + borderSize;
9  m_rect = wxRect2DDouble(position.m_x - totalRadius, position.m_y - totalRadius, totalRadius * 2, totalRadius * 2);
10  m_nodeType = nodeType;
11 
12  m_triPts.push_back(GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, m_radius));
13  m_triPts.push_back(GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, -m_radius));
14  m_triPts.push_back(GetPosition() + wxPoint2DDouble(-m_radius + 1, 0));
15 }
16 
17 Node::~Node() {}
18 void Node::SetPosition(wxPoint2DDouble position)
19 {
20  m_rect = wxRect2DDouble(position.m_x - m_rect.m_width / 2, position.m_y - m_rect.m_height / 2, m_rect.m_width,
21  m_rect.m_height);
22  m_triPts[0] = GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, m_radius);
23  m_triPts[1] = GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, -m_radius);
24  m_triPts[2] = GetPosition() + wxPoint2DDouble(-m_radius + 1, 0);
25 
26  // Rotate according to the angle (node rect center as reference)
27  if(m_angle != 0.0) RotateTriPt(m_angle);
28 }
29 
30 void Node::StartMove(wxPoint2DDouble position)
31 {
32  m_moveStartPt = position;
33  m_movePos = m_rect.GetPosition() - wxPoint2DDouble(-m_rect.m_width / 2, -m_rect.m_height / 2);
34 }
35 
36 void Node::Move(wxPoint2DDouble position) { SetPosition(m_movePos + position - m_moveStartPt); }
37 wxPoint2DDouble Node::GetPosition() const
38 {
39  return m_rect.GetPosition() + wxPoint2DDouble(m_rect.GetSize().GetWidth() / 2, m_rect.GetSize().GetHeight() / 2);
40 }
41 
42 void Node::RotateTriPt(double angle)
43 {
44  double radAngle = wxDegToRad(angle);
45  wxPoint2DDouble rectCenter =
46  m_rect.GetPosition() + wxPoint2DDouble(m_rect.GetSize().GetWidth() / 2.0, m_rect.GetSize().GetHeight() / 2.0);
47  m_triPts[0] = wxPoint2DDouble(std::cos(radAngle) * (m_triPts[0].m_x - rectCenter.m_x) -
48  std::sin(radAngle) * (m_triPts[0].m_y - rectCenter.m_y) + rectCenter.m_x,
49  std::sin(radAngle) * (m_triPts[0].m_x - rectCenter.m_x) +
50  std::cos(radAngle) * (m_triPts[0].m_y - rectCenter.m_y) + rectCenter.m_y);
51  m_triPts[1] = wxPoint2DDouble(std::cos(radAngle) * (m_triPts[1].m_x - rectCenter.m_x) -
52  std::sin(radAngle) * (m_triPts[1].m_y - rectCenter.m_y) + rectCenter.m_x,
53  std::sin(radAngle) * (m_triPts[1].m_x - rectCenter.m_x) +
54  std::cos(radAngle) * (m_triPts[1].m_y - rectCenter.m_y) + rectCenter.m_y);
55  m_triPts[2] = wxPoint2DDouble(std::cos(radAngle) * (m_triPts[2].m_x - rectCenter.m_x) -
56  std::sin(radAngle) * (m_triPts[2].m_y - rectCenter.m_y) + rectCenter.m_x,
57  std::sin(radAngle) * (m_triPts[2].m_x - rectCenter.m_x) +
58  std::cos(radAngle) * (m_triPts[2].m_y - rectCenter.m_y) + rectCenter.m_y);
59 }
60 
61 void Node::Rotate(bool clockwise)
62 {
63  if(clockwise)
64  m_angle += 90.0;
65  else
66  m_angle -= 90.0;
67  if(m_angle >= 360.0)
68  m_angle = 0.0;
69  else if(m_angle < 0)
70  m_angle = 270.0;
71 
72  // Update input triangle points.
73  m_triPts[0] = GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, m_radius);
74  m_triPts[1] = GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, -m_radius);
75  m_triPts[2] = GetPosition() + wxPoint2DDouble(-m_radius + 1, 0);
76 
77  // Rotate according to the angle (node rect center as reference)
78  if(m_angle != 0.0) RotateTriPt(m_angle);
79 }
80 
81 bool Node::Contains(wxPoint2DDouble position) const
82 {
83  if(m_connected) return false;
84  return m_rect.Contains(position);
85 }
86 
87 ControlElement::ControlElement(int id) : Element() { m_elementID = id; }
88 ControlElement::~ControlElement() {}
89 void ControlElement::DrawNodes() const
90 {
91  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
92  Node* node = *it;
93  DrawCircle(node->GetPosition(), node->GetRadius(), 10, GL_POLYGON);
94  if(node->GetNodeType() == Node::NODE_IN) {
95  DrawTriangle(node->GetInTrianglePts());
96  }
97  }
98 }
99 
100 void ControlElement::StartMove(wxPoint2DDouble position)
101 {
102  m_moveStartPt = position;
103  m_movePos = m_position;
104  for(int i = 0; i < (int)m_nodeList.size(); ++i) {
105  m_nodeList[i]->StartMove(position);
106  }
107 }
108 
109 void ControlElement::Move(wxPoint2DDouble position)
110 {
111  SetPosition(m_movePos + position - m_moveStartPt);
112  for(int i = 0; i < (int)m_nodeList.size(); ++i) {
113  m_nodeList[i]->Move(position);
114  }
115 }
116 
117 bool ControlElement::Solve(double input, double timeStep)
118 {
119  m_output = input;
120  return true;
121 }
122 
123 void ControlElement::ReplaceNode(Node* oldNode, Node* newNode)
124 {
125  for(unsigned int i = 0; i < m_nodeList.size(); i++) {
126  if(m_nodeList[i] == oldNode) m_nodeList[i] = newNode;
127  }
128 }
- -
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
-
virtual void Move(wxPoint2DDouble position)
Move the element other position.
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "ControlElement.h"
19 #ifdef USING_WX_3_0_X
20 #include "DegreesAndRadians.h"
21 #endif
22 
23 Node::Node(wxPoint2DDouble position, NodeType nodeType, double borderSize)
24 {
25  double totalRadius = m_radius + borderSize;
26  m_rect = wxRect2DDouble(position.m_x - totalRadius, position.m_y - totalRadius, totalRadius * 2, totalRadius * 2);
27  m_nodeType = nodeType;
28 
29  m_triPts.push_back(GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, m_radius));
30  m_triPts.push_back(GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, -m_radius));
31  m_triPts.push_back(GetPosition() + wxPoint2DDouble(-m_radius + 1, 0));
32 }
33 
34 Node::~Node() {}
35 void Node::SetPosition(wxPoint2DDouble position)
36 {
37  m_rect = wxRect2DDouble(position.m_x - m_rect.m_width / 2, position.m_y - m_rect.m_height / 2, m_rect.m_width,
38  m_rect.m_height);
39  m_triPts[0] = GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, m_radius);
40  m_triPts[1] = GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, -m_radius);
41  m_triPts[2] = GetPosition() + wxPoint2DDouble(-m_radius + 1, 0);
42 
43  // Rotate according to the angle (node rect center as reference)
44  if(m_angle != 0.0) RotateTriPt(m_angle);
45 }
46 
47 void Node::StartMove(wxPoint2DDouble position)
48 {
49  m_moveStartPt = position;
50  m_movePos = m_rect.GetPosition() - wxPoint2DDouble(-m_rect.m_width / 2, -m_rect.m_height / 2);
51 }
52 
53 void Node::Move(wxPoint2DDouble position) { SetPosition(m_movePos + position - m_moveStartPt); }
54 wxPoint2DDouble Node::GetPosition() const
55 {
56  return m_rect.GetPosition() + wxPoint2DDouble(m_rect.GetSize().GetWidth() / 2, m_rect.GetSize().GetHeight() / 2);
57 }
58 
59 void Node::RotateTriPt(double angle)
60 {
61  double radAngle = wxDegToRad(angle);
62  wxPoint2DDouble rectCenter =
63  m_rect.GetPosition() + wxPoint2DDouble(m_rect.GetSize().GetWidth() / 2.0, m_rect.GetSize().GetHeight() / 2.0);
64  m_triPts[0] = wxPoint2DDouble(std::cos(radAngle) * (m_triPts[0].m_x - rectCenter.m_x) -
65  std::sin(radAngle) * (m_triPts[0].m_y - rectCenter.m_y) + rectCenter.m_x,
66  std::sin(radAngle) * (m_triPts[0].m_x - rectCenter.m_x) +
67  std::cos(radAngle) * (m_triPts[0].m_y - rectCenter.m_y) + rectCenter.m_y);
68  m_triPts[1] = wxPoint2DDouble(std::cos(radAngle) * (m_triPts[1].m_x - rectCenter.m_x) -
69  std::sin(radAngle) * (m_triPts[1].m_y - rectCenter.m_y) + rectCenter.m_x,
70  std::sin(radAngle) * (m_triPts[1].m_x - rectCenter.m_x) +
71  std::cos(radAngle) * (m_triPts[1].m_y - rectCenter.m_y) + rectCenter.m_y);
72  m_triPts[2] = wxPoint2DDouble(std::cos(radAngle) * (m_triPts[2].m_x - rectCenter.m_x) -
73  std::sin(radAngle) * (m_triPts[2].m_y - rectCenter.m_y) + rectCenter.m_x,
74  std::sin(radAngle) * (m_triPts[2].m_x - rectCenter.m_x) +
75  std::cos(radAngle) * (m_triPts[2].m_y - rectCenter.m_y) + rectCenter.m_y);
76 }
77 
78 void Node::Rotate(bool clockwise)
79 {
80  if(clockwise)
81  m_angle += 90.0;
82  else
83  m_angle -= 90.0;
84  if(m_angle >= 360.0)
85  m_angle = 0.0;
86  else if(m_angle < 0)
87  m_angle = 270.0;
88 
89  // Update input triangle points.
90  m_triPts[0] = GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, m_radius);
91  m_triPts[1] = GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, -m_radius);
92  m_triPts[2] = GetPosition() + wxPoint2DDouble(-m_radius + 1, 0);
93 
94  // Rotate according to the angle (node rect center as reference)
95  if(m_angle != 0.0) RotateTriPt(m_angle);
96 }
97 
98 bool Node::Contains(wxPoint2DDouble position) const
99 {
100  if(m_connected) return false;
101  return m_rect.Contains(position);
102 }
103 
104 ControlElement::ControlElement(int id) : Element() { m_elementID = id; }
105 ControlElement::~ControlElement() {}
106 void ControlElement::DrawNodes() const
107 {
108  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
109  Node* node = *it;
110  DrawCircle(node->GetPosition(), node->GetRadius(), 10, GL_POLYGON);
111  if(node->GetNodeType() == Node::NODE_IN) {
112  DrawTriangle(node->GetInTrianglePts());
113  }
114  }
115 }
116 
117 void ControlElement::StartMove(wxPoint2DDouble position)
118 {
119  m_moveStartPt = position;
120  m_movePos = m_position;
121  for(int i = 0; i < (int)m_nodeList.size(); ++i) {
122  m_nodeList[i]->StartMove(position);
123  }
124 }
125 
126 void ControlElement::Move(wxPoint2DDouble position)
127 {
128  SetPosition(m_movePos + position - m_moveStartPt);
129  for(int i = 0; i < (int)m_nodeList.size(); ++i) {
130  m_nodeList[i]->Move(position);
131  }
132 }
133 
134 bool ControlElement::Solve(double input, double timeStep)
135 {
136  m_output = input;
137  return true;
138 }
139 
140 void ControlElement::ReplaceNode(Node* oldNode, Node* newNode)
141 {
142  for(unsigned int i = 0; i < m_nodeList.size(); i++) {
143  if(m_nodeList[i] == oldNode) m_nodeList[i] = newNode;
144  }
145 }
+
Node of a control element. This class manages the user interaction with the connection and control el...
+
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
+
Base class of a control element. Provide general methods to other control classes.
+
virtual void Move(wxPoint2DDouble position)
Move the element other position.
diff --git a/docs/doxygen/html/_control_element_8h.html b/docs/doxygen/html/_control_element_8h.html new file mode 100644 index 0000000..b059beb --- /dev/null +++ b/docs/doxygen/html/_control_element_8h.html @@ -0,0 +1,124 @@ + + + + + + + + + +Project/ControlElement.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
ControlElement.h File Reference
+
+
+ +

Base class of a control element. Provide general methods to other control classes. +More...

+
#include "Element.h"
+
+

Go to the source code of this file.

+ + + + + + + +

+Classes

class  Node
 Node of a control element. This class manages the user interaction with the connection and control elements. More...
 
class  ControlElement
 
+

Detailed Description

+

Base class of a control element. Provide general methods to other control classes.

+ +

Definition in file ControlElement.h.

+
+
+ + + + diff --git a/docs/doxygen/html/_control_element_8h_source.html b/docs/doxygen/html/_control_element_8h_source.html index 25475b7..2222b15 100644 --- a/docs/doxygen/html/_control_element_8h_source.html +++ b/docs/doxygen/html/_control_element_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,16 +88,16 @@ $(document).ready(function(){initNavTree('_control_element_8h_source.html','');}
ControlElement.h
-
1 #ifndef CONTROLELEMENT_H
2 #define CONTROLELEMENT_H
3 
4 #include "Element.h"
5 
6 class Node
7 {
8  public:
9  enum NodeType { NODE_IN = 0, NODE_OUT };
10 
11  Node(wxPoint2DDouble position = wxPoint2DDouble(0, 0), NodeType nodeType = NODE_IN, double borderSize = 0.0);
12  ~Node();
13 
14  wxRect2DDouble GetRect() const { return m_rect; }
15  void SetRect(wxRect2DDouble rect) { m_rect = rect; }
16  wxPoint2DDouble GetPosition() const;
17  void SetPosition(wxPoint2DDouble position);
18 
19  NodeType GetNodeType() const { return m_nodeType; }
20  void SetNodeType(NodeType nodeType) { m_nodeType = nodeType; }
21  double GetRadius() const { return m_radius; }
22  std::vector<wxPoint2DDouble> GetInTrianglePts() const { return m_triPts; }
23  double GetAngle() const { return m_angle; }
24  void SetAngle(double angle) { m_angle = angle; }
25  void Rotate(bool clockwise = true);
26 
27  void RotateTriPt(double angle);
28 
29  void StartMove(wxPoint2DDouble position);
30  void Move(wxPoint2DDouble position);
31  bool Contains(wxPoint2DDouble position) const;
32 
33  bool IsConnected() const { return m_connected; }
34  void SetConnected(bool connected = true) { m_connected = connected; }
35  int GetID() const { return m_id; }
36  void SetID(int id) { m_id = id; }
37  protected:
38  int m_id = -1;
39 
40  wxRect2DDouble m_rect;
41  NodeType m_nodeType;
42 
43  bool m_connected = false;
44 
45  wxPoint2DDouble m_moveStartPt;
46  wxPoint2DDouble m_movePos;
47 
48  double m_radius = 3.0;
49  std::vector<wxPoint2DDouble> m_triPts;
50  double m_angle = 0.0;
51 };
52 
53 class ControlElement : public Element
54 {
55  public:
56  ControlElement(int id);
57  ~ControlElement();
58 
59  virtual void StartMove(wxPoint2DDouble position);
60  virtual void Move(wxPoint2DDouble position);
61 
62  void SetNodeList(std::vector<Node*> nodeList) { m_nodeList = nodeList; }
63  std::vector<Node*> GetNodeList() const { return m_nodeList; }
64  virtual void DrawNodes() const;
65  virtual void ReplaceNode(Node* oldNode, Node* newNode);
66  virtual void UpdateText() {}
67  virtual bool IsSolved() const { return m_solved; }
68  virtual void SetSolved(bool solved = true) { m_solved = solved; }
69  virtual bool Solve(double input, double timeStep);
70  virtual double GetOutput() const { return m_output; }
71  virtual void SetOutput(double output) { m_output = output; }
72  protected:
73  std::vector<Node*> m_nodeList;
74  bool m_solved = false;
75  double m_output = 0.0;
76 };
77 
78 #endif // CONTROLELEMENT_H
- +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CONTROLELEMENT_H
19 #define CONTROLELEMENT_H
20 
21 #include "Element.h"
22 
30 class Node
31 {
32  public:
33  enum NodeType { NODE_IN = 0, NODE_OUT };
34 
35  Node(wxPoint2DDouble position = wxPoint2DDouble(0, 0), NodeType nodeType = NODE_IN, double borderSize = 0.0);
36  ~Node();
37 
38  wxRect2DDouble GetRect() const { return m_rect; }
39  void SetRect(wxRect2DDouble rect) { m_rect = rect; }
40  wxPoint2DDouble GetPosition() const;
41  void SetPosition(wxPoint2DDouble position);
42 
43  NodeType GetNodeType() const { return m_nodeType; }
44  void SetNodeType(NodeType nodeType) { m_nodeType = nodeType; }
45  double GetRadius() const { return m_radius; }
46  std::vector<wxPoint2DDouble> GetInTrianglePts() const { return m_triPts; }
47  double GetAngle() const { return m_angle; }
48  void SetAngle(double angle) { m_angle = angle; }
49  void Rotate(bool clockwise = true);
50 
51  void RotateTriPt(double angle);
52 
53  void StartMove(wxPoint2DDouble position);
54  void Move(wxPoint2DDouble position);
55  bool Contains(wxPoint2DDouble position) const;
56 
57  bool IsConnected() const { return m_connected; }
58  void SetConnected(bool connected = true) { m_connected = connected; }
59  int GetID() const { return m_id; }
60  void SetID(int id) { m_id = id; }
61  protected:
62  int m_id = -1;
63 
64  wxRect2DDouble m_rect;
65  NodeType m_nodeType;
66 
67  bool m_connected = false;
68 
69  wxPoint2DDouble m_moveStartPt;
70  wxPoint2DDouble m_movePos;
71 
72  double m_radius = 3.0;
73  std::vector<wxPoint2DDouble> m_triPts;
74  double m_angle = 0.0;
75 };
76 
84 class ControlElement : public Element
85 {
86  public:
87  ControlElement(int id);
88  ~ControlElement();
89 
90  virtual void StartMove(wxPoint2DDouble position);
91  virtual void Move(wxPoint2DDouble position);
92 
93  void SetNodeList(std::vector<Node*> nodeList) { m_nodeList = nodeList; }
94  std::vector<Node*> GetNodeList() const { return m_nodeList; }
95  virtual void DrawNodes() const;
96  virtual void ReplaceNode(Node* oldNode, Node* newNode);
97  virtual void UpdateText() {}
98  virtual bool IsSolved() const { return m_solved; }
99  virtual void SetSolved(bool solved = true) { m_solved = solved; }
100  virtual bool Solve(double input, double timeStep);
101  virtual double GetOutput() const { return m_output; }
102  virtual void SetOutput(double output) { m_output = output; }
103  protected:
104  std::vector<Node*> m_nodeList;
105  bool m_solved = false;
106  double m_output = 0.0;
107 };
108 
109 #endif // CONTROLELEMENT_H
+
Node of a control element. This class manages the user interaction with the connection and control el...
Class to manage color of OpenGL.
- +
-
1 #include "ControlElementContainer.h"
2 #include "ControlEditor.h"
3 #include "ControlElement.h"
4 
5 ControlElementContainer::ControlElementContainer() { ClearContainer(); }
6 ControlElementContainer::~ControlElementContainer() {}
7 void ControlElementContainer::FillContainer(ControlEditor* editor)
8 {
9  ClearContainer();
10  m_ctrlElementsList = editor->GetControlElementList();
11  m_cLineList = editor->GetConnectionLineList();
12  auto cElementList = editor->GetControlElementList();
13  for(auto it = cElementList.begin(), itEnd = cElementList.end(); it != itEnd; ++it) {
14  if(Constant* constant = dynamic_cast<Constant*>(*it)) {
15  m_constantList.push_back(constant);
16  } else if(Exponential* exponential = dynamic_cast<Exponential*>(*it)) {
17  m_exponentialList.push_back(exponential);
18  } else if(Gain* gain = dynamic_cast<Gain*>(*it)) {
19  m_gainList.push_back(gain);
20  } else if(IOControl* ioControl = dynamic_cast<IOControl*>(*it)) {
21  m_ioControlList.push_back(ioControl);
22  } else if(Limiter* limiter = dynamic_cast<Limiter*>(*it)) {
23  m_limiterList.push_back(limiter);
24  } else if(Multiplier* multiplier = dynamic_cast<Multiplier*>(*it)) {
25  m_multiplierList.push_back(multiplier);
26  } else if(RateLimiter* rateLimiter = dynamic_cast<RateLimiter*>(*it)) {
27  m_rateLimiterList.push_back(rateLimiter);
28  } else if(Sum* sum = dynamic_cast<Sum*>(*it)) {
29  m_sumList.push_back(sum);
30  } else if(TransferFunction* tf = dynamic_cast<TransferFunction*>(*it)) {
31  m_tfList.push_back(tf);
32  }
33  }
34 }
35 
36 void ControlElementContainer::ClearContainer()
37 {
38  m_cLineList.clear();
39  m_constantList.clear();
40  m_exponentialList.clear();
41  m_gainList.clear();
42  m_ioControlList.clear();
43  m_limiterList.clear();
44  m_multiplierList.clear();
45  m_rateLimiterList.clear();
46  m_sumList.clear();
47  m_tfList.clear();
48 }
49 
50 void ControlElementContainer::FillContainer(std::vector<ControlElement*> controlElementList,
51  std::vector<ConnectionLine*> connectionLineList)
52 {
53  ClearContainer();
54  m_ctrlElementsList = controlElementList;
55  m_cLineList = connectionLineList;
56 
57  for(auto it = controlElementList.begin(), itEnd = controlElementList.end(); it != itEnd; ++it) {
58  if(Constant* constant = dynamic_cast<Constant*>(*it)) {
59  m_constantList.push_back(constant);
60  } else if(Exponential* exponential = dynamic_cast<Exponential*>(*it)) {
61  m_exponentialList.push_back(exponential);
62  } else if(Gain* gain = dynamic_cast<Gain*>(*it)) {
63  m_gainList.push_back(gain);
64  } else if(IOControl* ioControl = dynamic_cast<IOControl*>(*it)) {
65  m_ioControlList.push_back(ioControl);
66  } else if(Limiter* limiter = dynamic_cast<Limiter*>(*it)) {
67  m_limiterList.push_back(limiter);
68  } else if(Multiplier* multiplier = dynamic_cast<Multiplier*>(*it)) {
69  m_multiplierList.push_back(multiplier);
70  } else if(RateLimiter* rateLimiter = dynamic_cast<RateLimiter*>(*it)) {
71  m_rateLimiterList.push_back(rateLimiter);
72  } else if(Sum* sum = dynamic_cast<Sum*>(*it)) {
73  m_sumList.push_back(sum);
74  } else if(TransferFunction* tf = dynamic_cast<TransferFunction*>(*it)) {
75  m_tfList.push_back(tf);
76  }
77  }
78 }
79 
80 void ControlElementContainer::GetContainerCopy(std::vector<ControlElement*>& controlElementList,
81  std::vector<ConnectionLine*>& connectionLineList)
82 {
83  controlElementList.clear();
84  connectionLineList.clear();
85 
86  // Copy connection lines
87  for(auto it = m_cLineList.begin(), itEnd = m_cLineList.end(); it != itEnd; ++it) {
88  ConnectionLine* copy = static_cast<ConnectionLine*>((*it)->GetCopy());
89  connectionLineList.push_back(copy);
90  }
91 
92  // Copy elements (exept connection line).
93  int nodeID = 0;
94  for(auto it = m_ctrlElementsList.begin(), itEnd = m_ctrlElementsList.end(); it != itEnd; ++it) {
95  Element* oldElement = *it;
96  ControlElement* copy = static_cast<ControlElement*>(oldElement->GetCopy());
97  controlElementList.push_back(copy);
98  // Copy nodes.
99  std::vector<Node*> nodeList = copy->GetNodeList();
100  std::vector<Node*> nodeListCopy;
101  for(auto itN = nodeList.begin(), itEndN = nodeList.end(); itN != itEndN; ++itN) {
102  Node* node = *itN;
103  node->SetID(nodeID);
104  Node* copyNode = new Node();
105  *copyNode = *node;
106  nodeListCopy.push_back(copyNode);
107  nodeID++;
108  }
109  copy->SetNodeList(nodeListCopy);
110 
111  // Replace children to copies.
112  auto childList = copy->GetChildList();
113  for(auto itC = childList.begin(), itEndC = childList.end(); itC != itEndC; ++itC) {
114  ConnectionLine* child = static_cast<ConnectionLine*>(*itC);
115  // Replace child's parent to copy.
116  for(auto itCL = connectionLineList.begin(), itEndCL = connectionLineList.end(); itCL != itEndCL; ++itCL) {
117  ConnectionLine* copyLine = *itCL;
118  if(copyLine->GetID() == child->GetID()) {
119  // Replace node.
120  nodeList = child->GetNodeList();
121  for(auto itN = nodeList.begin(), itEndN = nodeList.end(); itN != itEndN; ++itN) {
122  Node* node = *itN;
123  for(auto itCN = nodeListCopy.begin(), itEndCN = nodeListCopy.end(); itCN != itEndCN; ++itCN) {
124  Node* nodeCopy = *itCN;
125  if(node->GetID() == nodeCopy->GetID()) {
126  copyLine->ReplaceNode(node, nodeCopy);
127  break;
128  }
129  }
130  }
131  copyLine->ReplaceParent(oldElement, copy);
132  copy->ReplaceChild(child, copyLine);
133  }
134  }
135  }
136  }
137 }
- -
Definition: Sum.h:9
-
Definition: Gain.h:11
-
virtual std::vector< Element * > GetChildList() const
Get the Child list.
Definition: Element.h:523
- -
Definition: Limiter.h:8
- -
virtual void ReplaceChild(Element *oldChild, Element *newChild)
Replace a child from the list.
Definition: Element.cpp:343
- - - - - -
virtual int GetID() const
Get the element ID.
Definition: Element.h:270
-
virtual void ReplaceParent(Element *oldParent, Element *newParent)
Replace a parent.
Definition: Element.cpp:326
- - -
virtual Element * GetCopy()
Get a the element copy.
Definition: Element.h:258
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
19 #include "ControlEditor.h"
20 #include "ControlElement.h"
21 
22 ControlElementContainer::ControlElementContainer() { ClearContainer(); }
23 ControlElementContainer::~ControlElementContainer() {}
24 void ControlElementContainer::FillContainer(ControlEditor* editor)
25 {
26  ClearContainer();
27  m_ctrlElementsList = editor->GetControlElementList();
28  m_cLineList = editor->GetConnectionLineList();
29  auto cElementList = editor->GetControlElementList();
30  for(auto it = cElementList.begin(), itEnd = cElementList.end(); it != itEnd; ++it) {
31  if(Constant* constant = dynamic_cast<Constant*>(*it)) {
32  m_constantList.push_back(constant);
33  } else if(Exponential* exponential = dynamic_cast<Exponential*>(*it)) {
34  m_exponentialList.push_back(exponential);
35  } else if(Gain* gain = dynamic_cast<Gain*>(*it)) {
36  m_gainList.push_back(gain);
37  } else if(IOControl* ioControl = dynamic_cast<IOControl*>(*it)) {
38  m_ioControlList.push_back(ioControl);
39  } else if(Limiter* limiter = dynamic_cast<Limiter*>(*it)) {
40  m_limiterList.push_back(limiter);
41  } else if(Multiplier* multiplier = dynamic_cast<Multiplier*>(*it)) {
42  m_multiplierList.push_back(multiplier);
43  } else if(RateLimiter* rateLimiter = dynamic_cast<RateLimiter*>(*it)) {
44  m_rateLimiterList.push_back(rateLimiter);
45  } else if(Sum* sum = dynamic_cast<Sum*>(*it)) {
46  m_sumList.push_back(sum);
47  } else if(TransferFunction* tf = dynamic_cast<TransferFunction*>(*it)) {
48  m_tfList.push_back(tf);
49  }
50  }
51 }
52 
53 void ControlElementContainer::ClearContainer()
54 {
55  m_cLineList.clear();
56  m_constantList.clear();
57  m_exponentialList.clear();
58  m_gainList.clear();
59  m_ioControlList.clear();
60  m_limiterList.clear();
61  m_multiplierList.clear();
62  m_rateLimiterList.clear();
63  m_sumList.clear();
64  m_tfList.clear();
65 }
66 
67 void ControlElementContainer::FillContainer(std::vector<ControlElement*> controlElementList,
68  std::vector<ConnectionLine*> connectionLineList)
69 {
70  ClearContainer();
71  m_ctrlElementsList = controlElementList;
72  m_cLineList = connectionLineList;
73 
74  for(auto it = controlElementList.begin(), itEnd = controlElementList.end(); it != itEnd; ++it) {
75  if(Constant* constant = dynamic_cast<Constant*>(*it)) {
76  m_constantList.push_back(constant);
77  } else if(Exponential* exponential = dynamic_cast<Exponential*>(*it)) {
78  m_exponentialList.push_back(exponential);
79  } else if(Gain* gain = dynamic_cast<Gain*>(*it)) {
80  m_gainList.push_back(gain);
81  } else if(IOControl* ioControl = dynamic_cast<IOControl*>(*it)) {
82  m_ioControlList.push_back(ioControl);
83  } else if(Limiter* limiter = dynamic_cast<Limiter*>(*it)) {
84  m_limiterList.push_back(limiter);
85  } else if(Multiplier* multiplier = dynamic_cast<Multiplier*>(*it)) {
86  m_multiplierList.push_back(multiplier);
87  } else if(RateLimiter* rateLimiter = dynamic_cast<RateLimiter*>(*it)) {
88  m_rateLimiterList.push_back(rateLimiter);
89  } else if(Sum* sum = dynamic_cast<Sum*>(*it)) {
90  m_sumList.push_back(sum);
91  } else if(TransferFunction* tf = dynamic_cast<TransferFunction*>(*it)) {
92  m_tfList.push_back(tf);
93  }
94  }
95 }
96 
97 void ControlElementContainer::GetContainerCopy(std::vector<ControlElement*>& controlElementList,
98  std::vector<ConnectionLine*>& connectionLineList)
99 {
100  controlElementList.clear();
101  connectionLineList.clear();
102 
103  // Copy connection lines
104  for(auto it = m_cLineList.begin(), itEnd = m_cLineList.end(); it != itEnd; ++it) {
105  ConnectionLine* copy = static_cast<ConnectionLine*>((*it)->GetCopy());
106  connectionLineList.push_back(copy);
107  }
108 
109  // Copy elements (exept connection line).
110  int nodeID = 0;
111  for(auto it = m_ctrlElementsList.begin(), itEnd = m_ctrlElementsList.end(); it != itEnd; ++it) {
112  Element* oldElement = *it;
113  ControlElement* copy = static_cast<ControlElement*>(oldElement->GetCopy());
114  controlElementList.push_back(copy);
115  // Copy nodes.
116  std::vector<Node*> nodeList = copy->GetNodeList();
117  std::vector<Node*> nodeListCopy;
118  for(auto itN = nodeList.begin(), itEndN = nodeList.end(); itN != itEndN; ++itN) {
119  Node* node = *itN;
120  node->SetID(nodeID);
121  Node* copyNode = new Node();
122  *copyNode = *node;
123  nodeListCopy.push_back(copyNode);
124  nodeID++;
125  }
126  copy->SetNodeList(nodeListCopy);
127 
128  // Replace children to copies.
129  auto childList = copy->GetChildList();
130  for(auto itC = childList.begin(), itEndC = childList.end(); itC != itEndC; ++itC) {
131  ConnectionLine* child = static_cast<ConnectionLine*>(*itC);
132  // Replace child's parent to copy.
133  for(auto itCL = connectionLineList.begin(), itEndCL = connectionLineList.end(); itCL != itEndCL; ++itCL) {
134  ConnectionLine* copyLine = *itCL;
135  if(copyLine->GetID() == child->GetID()) {
136  // Replace node.
137  nodeList = child->GetNodeList();
138  for(auto itN = nodeList.begin(), itEndN = nodeList.end(); itN != itEndN; ++itN) {
139  Node* node = *itN;
140  for(auto itCN = nodeListCopy.begin(), itEndCN = nodeListCopy.end(); itCN != itEndCN; ++itCN) {
141  Node* nodeCopy = *itCN;
142  if(node->GetID() == nodeCopy->GetID()) {
143  copyLine->ReplaceNode(node, nodeCopy);
144  break;
145  }
146  }
147  }
148  copyLine->ReplaceParent(oldElement, copy);
149  copy->ReplaceChild(child, copyLine);
150  }
151  }
152  }
153  }
154 }
Multiplies two inputs.
Definition: Multiplier.h:32
+ +
Definition: Sum.h:26
+
Provide an output multiplying the input by a constant. .
Definition: Gain.h:36
+
virtual std::vector< Element * > GetChildList() const
Get the Child list.
Definition: Element.h:511
+
Node of a control element. This class manages the user interaction with the connection and control el...
+
Limits the input value by superior and inferior values.
Definition: Limiter.h:32
+
Provides the communication with the power element.
Definition: IOControl.h:35
+ +
virtual void ReplaceChild(Element *oldChild, Element *newChild)
Replace a child from the list.
Definition: Element.cpp:362
+
Generates an output following an exponential function. .
Definition: Exponential.h:33
+
Limits the rising and/or falling rate.
Definition: RateLimiter.h:32
+
Connection between two control elements or other connection line and an element.
+ + + +
Base class of a control element. Provide general methods to other control classes.
+
virtual int GetID() const
Get the element ID.
Definition: Element.h:272
+
virtual void ReplaceParent(Element *oldParent, Element *newParent)
Replace a parent.
Definition: Element.cpp:346
+ +
A control element that provides a constant value.
Definition: Constant.h:35
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Element.h:262
diff --git a/docs/doxygen/html/_control_element_container_8h.html b/docs/doxygen/html/_control_element_container_8h.html new file mode 100644 index 0000000..57f5343 --- /dev/null +++ b/docs/doxygen/html/_control_element_container_8h.html @@ -0,0 +1,125 @@ + + + + + + + + + +Project/ControlElementContainer.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
ControlElementContainer.h File Reference
+
+
+
#include <vector>
+#include "ConnectionLine.h"
+#include "Constant.h"
+#include "Exponential.h"
+#include "Gain.h"
+#include "IOControl.h"
+#include "Limiter.h"
+#include "Multiplier.h"
+#include "RateLimiter.h"
+#include "Sum.h"
+#include "TransferFunction.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  ControlElementContainer
 Class that can contain all control elements. Can identify (using RTTI) the elements from a generic list and store them separately. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_control_element_container_8h_source.html b/docs/doxygen/html/_control_element_container_8h_source.html index 0b62010..f0e83b3 100644 --- a/docs/doxygen/html/_control_element_container_8h_source.html +++ b/docs/doxygen/html/_control_element_container_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,23 @@ $(document).ready(function(){initNavTree('_control_element_container_8h_source.h
ControlElementContainer.h
-
1 #ifndef CONTROLELEMENTCONTAINER_H
2 #define CONTROLELEMENTCONTAINER_H
3 
4 #include <vector>
5 
6 class ControlEditor;
7 class ControlElement;
8 
9 #include "ConnectionLine.h"
10 #include "Constant.h"
11 #include "Exponential.h"
12 #include "Gain.h"
13 #include "IOControl.h"
14 #include "Limiter.h"
15 #include "Multiplier.h"
16 #include "RateLimiter.h"
17 #include "Sum.h"
18 #include "TransferFunction.h"
19 
21 {
22  public:
25 
26  virtual void FillContainer(ControlEditor* editor);
27  virtual void FillContainer(std::vector<ControlElement*> controlElementList,
28  std::vector<ConnectionLine*> connectionLineList);
29  virtual void GetContainerCopy(std::vector<ControlElement*>& controlElementList,
30  std::vector<ConnectionLine*>& connectionLineList);
31  virtual void ClearContainer();
32 
33  std::vector<ControlElement*> GetControlElementsList() const { return m_ctrlElementsList; }
34  std::vector<ConnectionLine*> GetConnectionLineList() const { return m_cLineList; }
35  std::vector<Constant*> GetConstantList() const { return m_constantList; }
36  std::vector<Exponential*> GetExponentialList() const { return m_exponentialList; }
37  std::vector<Gain*> GetGainList() const { return m_gainList; }
38  std::vector<IOControl*> GetIOControlList() const { return m_ioControlList; }
39  std::vector<Limiter*> GetLimiterList() const { return m_limiterList; }
40  std::vector<Multiplier*> GetMultiplierList() const { return m_multiplierList; }
41  std::vector<RateLimiter*> GetRateLimiterList() const { return m_rateLimiterList; }
42  std::vector<Sum*> GetSumList() const { return m_sumList; }
43  std::vector<TransferFunction*> GetTFList() const { return m_tfList; }
44  protected:
45  std::vector<ControlElement*> m_ctrlElementsList;
46  std::vector<Constant*> m_constantList;
47 
48  std::vector<ConnectionLine*> m_cLineList;
49  std::vector<Exponential*> m_exponentialList;
50  std::vector<Gain*> m_gainList;
51  std::vector<IOControl*> m_ioControlList;
52  std::vector<Limiter*> m_limiterList;
53  std::vector<Multiplier*> m_multiplierList;
54  std::vector<RateLimiter*> m_rateLimiterList;
55  std::vector<Sum*> m_sumList;
56  std::vector<TransferFunction*> m_tfList;
57 };
58 
59 #endif // CONTROLELEMENTCONTAINER_H
- - +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CONTROLELEMENTCONTAINER_H
19 #define CONTROLELEMENTCONTAINER_H
20 
21 #include <vector>
22 
23 class ControlEditor;
24 class ControlElement;
25 
26 #include "ConnectionLine.h"
27 #include "Constant.h"
28 #include "Exponential.h"
29 #include "Gain.h"
30 #include "IOControl.h"
31 #include "Limiter.h"
32 #include "Multiplier.h"
33 #include "RateLimiter.h"
34 #include "Sum.h"
35 #include "TransferFunction.h"
36 
46 {
47  public:
50 
51  virtual void FillContainer(ControlEditor* editor);
52  virtual void FillContainer(std::vector<ControlElement*> controlElementList,
53  std::vector<ConnectionLine*> connectionLineList);
54  virtual void GetContainerCopy(std::vector<ControlElement*>& controlElementList,
55  std::vector<ConnectionLine*>& connectionLineList);
56  virtual void ClearContainer();
57 
58  std::vector<ControlElement*> GetControlElementsList() const { return m_ctrlElementsList; }
59  std::vector<ConnectionLine*> GetConnectionLineList() const { return m_cLineList; }
60  std::vector<Constant*> GetConstantList() const { return m_constantList; }
61  std::vector<Exponential*> GetExponentialList() const { return m_exponentialList; }
62  std::vector<Gain*> GetGainList() const { return m_gainList; }
63  std::vector<IOControl*> GetIOControlList() const { return m_ioControlList; }
64  std::vector<Limiter*> GetLimiterList() const { return m_limiterList; }
65  std::vector<Multiplier*> GetMultiplierList() const { return m_multiplierList; }
66  std::vector<RateLimiter*> GetRateLimiterList() const { return m_rateLimiterList; }
67  std::vector<Sum*> GetSumList() const { return m_sumList; }
68  std::vector<TransferFunction*> GetTFList() const { return m_tfList; }
69  protected:
70  std::vector<ControlElement*> m_ctrlElementsList;
71  std::vector<Constant*> m_constantList;
72 
73  std::vector<ConnectionLine*> m_cLineList;
74  std::vector<Exponential*> m_exponentialList;
75  std::vector<Gain*> m_gainList;
76  std::vector<IOControl*> m_ioControlList;
77  std::vector<Limiter*> m_limiterList;
78  std::vector<Multiplier*> m_multiplierList;
79  std::vector<RateLimiter*> m_rateLimiterList;
80  std::vector<Sum*> m_sumList;
81  std::vector<TransferFunction*> m_tfList;
82 };
83 
84 #endif // CONTROLELEMENTCONTAINER_H
+ + +
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
+ + + + + + +
-
1 #include "ControlElementSolver.h"
2 
3 #include "ControlElementContainer.h"
4 #include "ControlEditor.h"
5 #include "ConnectionLine.h"
6 #include "Constant.h"
7 #include "Exponential.h"
8 #include "Gain.h"
9 #include "IOControl.h"
10 #include "Limiter.h"
11 #include "Multiplier.h"
12 #include "RateLimiter.h"
13 #include "Sum.h"
14 #include "TransferFunction.h"
15 
16 ControlElementSolver::ControlElementSolver(ControlEditor* controlEditor,
17  double timeStep,
18  double integrationError,
19  bool startAllZero,
20  double input)
21 {
22  m_ctrlContainer = new ControlElementContainer();
23  m_ctrlContainer->FillContainer(controlEditor);
24  Initialize(controlEditor, timeStep, integrationError, startAllZero, input);
25 }
26 
27 ControlElementSolver::ControlElementSolver(ControlElementContainer* ctrlContainer,
28  double timeStep,
29  double integrationError,
30  bool startAllZero,
31  double input,
32  wxWindow* parent)
33 {
34  m_ctrlContainer = ctrlContainer;
35  Initialize(parent, timeStep, integrationError, startAllZero, input);
36 }
37 
38 void ControlElementSolver::Initialize(wxWindow* parent,
39  double timeStep,
40  double integrationError,
41  bool startAllZero,
42  double input)
43 {
44  // Check if the sistem have one input and one output
45  bool fail = false;
46  wxString failMessage = "";
47  auto ioList = m_ctrlContainer->GetIOControlList();
48  if(ioList.size() != 2) {
49  fail = true;
50  failMessage = _("The control system must have one input and one output.");
51  }
52  bool haveInput, haveOutput;
53  haveInput = haveOutput = false;
54  for(auto it = ioList.begin(), itEnd = ioList.end(); it != itEnd; ++it) {
55  IOControl* io = *it;
56  if(io->GetType() == Node::NODE_OUT) {
57  m_inputControl = io;
58  haveInput = true;
59  } else if(io->GetType() == Node::NODE_IN) {
60  m_outputControl = io;
61  haveOutput = true;
62  }
63  }
64  if(!fail && !haveInput) {
65  fail = true;
66  failMessage = _("There is no input in the control system.");
67  }
68  if(!fail && !haveOutput) {
69  fail = true;
70  failMessage = _("There is no output in the control system.");
71  }
72  if(!fail) {
73  if(m_inputControl->GetChildList().size() == 0) {
74  fail = true;
75  failMessage = _("Input not connected.");
76  }
77  }
78 
79  m_timeStep = timeStep;
80  m_integrationError = integrationError;
81  if(!fail) {
82  if(!InitializeValues(input, startAllZero)) {
83  fail = true;
84  failMessage = _("It was not possible to initialize the control system.");
85  }
86  }
87 
88  if(fail) {
89  wxMessageDialog msgDialog(parent, failMessage, _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
90  msgDialog.ShowModal();
91  } else {
92  m_isOK = true;
93  }
94 }
95 
96 bool ControlElementSolver::InitializeValues(double input, bool startAllZero)
97 {
98  // Reset Elements values
99  auto elementList = m_ctrlContainer->GetControlElementsList();
100  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
101  ControlElement* element = *it;
102  element->SetSolved(false);
103  element->SetOutput(0.0);
104  }
105  auto tfList = m_ctrlContainer->GetTFList();
106  for(auto it = tfList.begin(), itEnd = tfList.end(); it != itEnd; ++it) {
107  TransferFunction* tf = *it;
108  tf->CalculateSpaceState(100, m_integrationError);
109  }
110  auto connectionLineList = m_ctrlContainer->GetConnectionLineList();
111  for(auto it = connectionLineList.begin(), itEnd = connectionLineList.end(); it != itEnd; ++it) {
112  ConnectionLine* cLine = *it;
113  cLine->SetSolved(false);
114  cLine->SetValue(0.0);
115  }
116 
117  if(!startAllZero) {
118  double origTimeStep = m_timeStep;
119  double minStep = m_timeStep / 10;
120  double maxStep = m_timeStep * 10;
121  // Calculate the steady-state results according to the input.
122  double minError = 1e-7 * m_timeStep;
123  int maxIteration = 100 / m_timeStep;
124 
125  double prevSol = 0.0;
126  double currentSol = 1.0;
127  double error = 1.0;
128  double prevError = 1.0;
129  int numIt = 0;
130  while(error > minError) {
131  prevSol = currentSol;
132  prevError = error;
133  SolveNextStep(input);
134  currentSol = GetLastSolution();
135  numIt++;
136  error = std::abs(prevSol - currentSol);
137  if(std::abs(error - prevError) < 1e-1) {
138  if(m_timeStep < maxStep) {
139  m_timeStep *= 1.5;
140  }
141  } else if(std::abs(error - prevError) > 10) {
142  if(m_timeStep > minStep) {
143  m_timeStep /= 1.5;
144  }
145  }
146  if(numIt >= maxIteration) return false;
147  }
148  m_timeStep = origTimeStep;
149  m_solutions.clear();
150  }
151 
152  return true;
153 }
154 
155 void ControlElementSolver::SolveNextStep(double input)
156 {
157  // Set all elements as not solved
158  auto elementList = m_ctrlContainer->GetControlElementsList();
159  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
160  ControlElement* element = *it;
161  element->SetSolved(false);
162  }
163  auto connectionLineList = m_ctrlContainer->GetConnectionLineList();
164  for(auto it = connectionLineList.begin(), itEnd = connectionLineList.end(); it != itEnd; ++it) {
165  ConnectionLine* cLine = *it;
166  cLine->SetSolved(false);
167  }
168 
169  // Get first node and set input value on connected lines
170  ConnectionLine* firstConn = static_cast<ConnectionLine*>(m_inputControl->GetChildList()[0]);
171  m_inputControl->SetSolved();
172  firstConn->SetValue(input);
173  firstConn->SetSolved();
174  FillAllConnectedChildren(firstConn);
175 
176  // Set value to the connected lines in constants
177  auto constantList = m_ctrlContainer->GetConstantList();
178  for(auto it = constantList.begin(), itEnd = constantList.end(); it != itEnd; ++it) {
179  Constant* constant = *it;
180  if(constant->GetChildList().size() == 1) {
181  constant->SetSolved();
182  ConnectionLine* child = static_cast<ConnectionLine*>(constant->GetChildList()[0]);
183  child->SetValue(constant->GetValue());
184  child->SetSolved();
185  FillAllConnectedChildren(child);
186  }
187  }
188 
189  ConnectionLine* currentLine = firstConn;
190  while(currentLine) {
191  currentLine = SolveNextElement(currentLine);
192  }
193 
194  bool haveUnsolvedElement = true;
195  while(haveUnsolvedElement) {
196  haveUnsolvedElement = false;
197  // Get the solved line connected with unsolved element (elements not connected in the main branch).
198  for(auto it = connectionLineList.begin(), itEnd = connectionLineList.end(); it != itEnd; ++it) {
199  ConnectionLine* cLine = *it;
200  if(cLine->IsSolved()) {
201  auto parentList = cLine->GetParentList();
202  for(auto itP = parentList.begin(), itPEnd = parentList.end(); itP != itPEnd; ++itP) {
203  ControlElement* parent = static_cast<ControlElement*>(*itP);
204  if(!parent->IsSolved()) {
205  haveUnsolvedElement = true;
206  // Solve secondary branch.
207  currentLine = cLine;
208  while(currentLine) {
209  currentLine = SolveNextElement(currentLine);
210  }
211  break;
212  }
213  }
214  }
215  if(haveUnsolvedElement) break;
216  }
217  }
218 
219  // Set the control system step output.
220  if(m_outputControl->GetChildList().size() == 1) {
221  ConnectionLine* cLine = static_cast<ConnectionLine*>(m_outputControl->GetChildList()[0]);
222  m_solutions.push_back(cLine->GetValue());
223  } else
224  m_solutions.push_back(0.0);
225 }
226 
227 void ControlElementSolver::FillAllConnectedChildren(ConnectionLine* parent)
228 {
229  auto childList = parent->GetLineChildList();
230  for(auto it = childList.begin(), itEnd = childList.end(); it != itEnd; ++it) {
231  ConnectionLine* child = *it;
232  child->SetValue(parent->GetValue());
233  child->SetSolved();
234  FillAllConnectedChildren(child);
235  }
236 }
237 
238 ConnectionLine* ControlElementSolver::SolveNextElement(ConnectionLine* currentLine)
239 {
240  auto parentList = currentLine->GetParentList();
241  for(auto it = parentList.begin(), itEnd = parentList.end(); it != itEnd; ++it) {
242  ControlElement* element = static_cast<ControlElement*>(*it);
243  // Solve the unsolved parent.
244  if(!element->IsSolved()) {
245  if(!element->Solve(currentLine->GetValue(), m_timeStep)) return NULL;
246  element->SetSolved();
247 
248  // Get the output node (must have one or will result NULL).
249  Node* outNode = NULL;
250  auto nodeList = element->GetNodeList();
251  for(auto itN = nodeList.begin(), itNEnd = nodeList.end(); itN != itNEnd; ++itN) {
252  Node* node = *itN;
253  if(node->GetNodeType() == Node::NODE_OUT) outNode = node;
254  }
255  if(!outNode) return NULL;
256 
257  // Set connection line value associated with the output node.
258  auto childList = element->GetChildList();
259  for(auto itC = childList.begin(), itCEnd = childList.end(); itC != itCEnd; ++itC) {
260  ConnectionLine* cLine = static_cast<ConnectionLine*>(*itC);
261  if(!cLine->IsSolved()) { // Only check unsolved lines
262  // Check if the connection line have the output node on the list
263  auto lineNodeList = cLine->GetNodeList();
264  for(auto itCN = nodeList.begin(), itCNEnd = nodeList.end(); itCN != itCNEnd; ++itCN) {
265  Node* childNode = *itCN;
266  if(childNode == outNode) {
267  // Check if the line connect two elements, otherwise return NULL
268  if(cLine->GetType() != ConnectionLine::ELEMENT_ELEMENT) return NULL;
269 
270  // Set the connection line value and return it.
271  cLine->SetValue(element->GetOutput());
272  cLine->SetSolved();
273  FillAllConnectedChildren(cLine);
274  return cLine;
275  }
276  }
277  }
278  }
279  }
280  }
281  return NULL;
282 }
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:517
-
virtual std::vector< Element * > GetChildList() const
Get the Child list.
Definition: Element.h:523
- - - - - - - - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "ControlElementSolver.h"
19 
21 #include "ControlEditor.h"
22 #include "ConnectionLine.h"
23 #include "Constant.h"
24 #include "Exponential.h"
25 #include "Gain.h"
26 #include "IOControl.h"
27 #include "Limiter.h"
28 #include "Multiplier.h"
29 #include "RateLimiter.h"
30 #include "Sum.h"
31 #include "TransferFunction.h"
32 
33 ControlElementSolver::ControlElementSolver(ControlEditor* controlEditor,
34  double timeStep,
35  double integrationError,
36  bool startAllZero,
37  double input)
38 {
39  m_ctrlContainer = new ControlElementContainer();
40  m_ctrlContainer->FillContainer(controlEditor);
41  Initialize(controlEditor, timeStep, integrationError, startAllZero, input);
42 }
43 
44 ControlElementSolver::ControlElementSolver(ControlElementContainer* ctrlContainer,
45  double timeStep,
46  double integrationError,
47  bool startAllZero,
48  double input,
49  wxWindow* parent)
50 {
51  m_ctrlContainer = ctrlContainer;
52  Initialize(parent, timeStep, integrationError, startAllZero, input);
53 }
54 
55 void ControlElementSolver::Initialize(wxWindow* parent,
56  double timeStep,
57  double integrationError,
58  bool startAllZero,
59  double input)
60 {
61  // Check if the sistem have one input and one output
62  bool fail = false;
63  wxString failMessage = "";
64  auto ioList = m_ctrlContainer->GetIOControlList();
65  if(ioList.size() != 2) {
66  fail = true;
67  failMessage = _("The control system must have one input and one output.");
68  }
69  bool haveInput, haveOutput;
70  haveInput = haveOutput = false;
71  for(auto it = ioList.begin(), itEnd = ioList.end(); it != itEnd; ++it) {
72  IOControl* io = *it;
73  if(io->GetType() == Node::NODE_OUT) {
74  m_inputControl = io;
75  haveInput = true;
76  } else if(io->GetType() == Node::NODE_IN) {
77  m_outputControl = io;
78  haveOutput = true;
79  }
80  }
81  if(!fail && !haveInput) {
82  fail = true;
83  failMessage = _("There is no input in the control system.");
84  }
85  if(!fail && !haveOutput) {
86  fail = true;
87  failMessage = _("There is no output in the control system.");
88  }
89  if(!fail) {
90  if(m_inputControl->GetChildList().size() == 0) {
91  fail = true;
92  failMessage = _("Input not connected.");
93  }
94  }
95 
96  m_timeStep = timeStep;
97  m_integrationError = integrationError;
98  if(!fail) {
99  if(!InitializeValues(input, startAllZero)) {
100  fail = true;
101  failMessage = _("It was not possible to initialize the control system.");
102  }
103  }
104 
105  if(fail) {
106  wxMessageDialog msgDialog(parent, failMessage, _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
107  msgDialog.ShowModal();
108  } else {
109  m_isOK = true;
110  }
111 }
112 
113 bool ControlElementSolver::InitializeValues(double input, bool startAllZero)
114 {
115  // Reset Elements values
116  auto elementList = m_ctrlContainer->GetControlElementsList();
117  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
118  ControlElement* element = *it;
119  element->SetSolved(false);
120  element->SetOutput(0.0);
121  }
122  auto tfList = m_ctrlContainer->GetTFList();
123  for(auto it = tfList.begin(), itEnd = tfList.end(); it != itEnd; ++it) {
124  TransferFunction* tf = *it;
125  tf->CalculateSpaceState(100, m_integrationError);
126  }
127  auto connectionLineList = m_ctrlContainer->GetConnectionLineList();
128  for(auto it = connectionLineList.begin(), itEnd = connectionLineList.end(); it != itEnd; ++it) {
129  ConnectionLine* cLine = *it;
130  cLine->SetSolved(false);
131  cLine->SetValue(0.0);
132  }
133 
134  if(!startAllZero) {
135  double origTimeStep = m_timeStep;
136  double minStep = m_timeStep / 10;
137  double maxStep = m_timeStep * 10;
138  // Calculate the steady-state results according to the input.
139  double minError = 1e-7 * m_timeStep;
140  int maxIteration = 100 / m_timeStep;
141 
142  double prevSol = 0.0;
143  double currentSol = 1.0;
144  double error = 1.0;
145  double prevError = 1.0;
146  int numIt = 0;
147  while(error > minError) {
148  prevSol = currentSol;
149  prevError = error;
150  SolveNextStep(input);
151  currentSol = GetLastSolution();
152  numIt++;
153  error = std::abs(prevSol - currentSol);
154  if(std::abs(error - prevError) < 1e-1) {
155  if(m_timeStep < maxStep) {
156  m_timeStep *= 1.5;
157  }
158  } else if(std::abs(error - prevError) > 10) {
159  if(m_timeStep > minStep) {
160  m_timeStep /= 1.5;
161  }
162  }
163  if(numIt >= maxIteration) return false;
164  }
165  m_timeStep = origTimeStep;
166  m_solutions.clear();
167  }
168 
169  return true;
170 }
171 
172 void ControlElementSolver::SolveNextStep(double input)
173 {
174  // Set all elements as not solved
175  auto elementList = m_ctrlContainer->GetControlElementsList();
176  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
177  ControlElement* element = *it;
178  element->SetSolved(false);
179  }
180  auto connectionLineList = m_ctrlContainer->GetConnectionLineList();
181  for(auto it = connectionLineList.begin(), itEnd = connectionLineList.end(); it != itEnd; ++it) {
182  ConnectionLine* cLine = *it;
183  cLine->SetSolved(false);
184  }
185 
186  // Get first node and set input value on connected lines
187  ConnectionLine* firstConn = static_cast<ConnectionLine*>(m_inputControl->GetChildList()[0]);
188  m_inputControl->SetSolved();
189  firstConn->SetValue(input);
190  firstConn->SetSolved();
191  FillAllConnectedChildren(firstConn);
192 
193  // Set value to the connected lines in constants
194  auto constantList = m_ctrlContainer->GetConstantList();
195  for(auto it = constantList.begin(), itEnd = constantList.end(); it != itEnd; ++it) {
196  Constant* constant = *it;
197  if(constant->GetChildList().size() == 1) {
198  constant->SetSolved();
199  ConnectionLine* child = static_cast<ConnectionLine*>(constant->GetChildList()[0]);
200  child->SetValue(constant->GetValue());
201  child->SetSolved();
202  FillAllConnectedChildren(child);
203  }
204  }
205 
206  ConnectionLine* currentLine = firstConn;
207  while(currentLine) {
208  currentLine = SolveNextElement(currentLine);
209  }
210 
211  bool haveUnsolvedElement = true;
212  while(haveUnsolvedElement) {
213  haveUnsolvedElement = false;
214  // Get the solved line connected with unsolved element (elements not connected in the main branch).
215  for(auto it = connectionLineList.begin(), itEnd = connectionLineList.end(); it != itEnd; ++it) {
216  ConnectionLine* cLine = *it;
217  if(cLine->IsSolved()) {
218  auto parentList = cLine->GetParentList();
219  for(auto itP = parentList.begin(), itPEnd = parentList.end(); itP != itPEnd; ++itP) {
220  ControlElement* parent = static_cast<ControlElement*>(*itP);
221  if(!parent->IsSolved()) {
222  haveUnsolvedElement = true;
223  // Solve secondary branch.
224  currentLine = cLine;
225  while(currentLine) {
226  currentLine = SolveNextElement(currentLine);
227  }
228  break;
229  }
230  }
231  }
232  if(haveUnsolvedElement) break;
233  }
234  }
235 
236  // Set the control system step output.
237  if(m_outputControl->GetChildList().size() == 1) {
238  ConnectionLine* cLine = static_cast<ConnectionLine*>(m_outputControl->GetChildList()[0]);
239  m_solutions.push_back(cLine->GetValue());
240  } else
241  m_solutions.push_back(0.0);
242 }
243 
244 void ControlElementSolver::FillAllConnectedChildren(ConnectionLine* parent)
245 {
246  auto childList = parent->GetLineChildList();
247  for(auto it = childList.begin(), itEnd = childList.end(); it != itEnd; ++it) {
248  ConnectionLine* child = *it;
249  child->SetValue(parent->GetValue());
250  child->SetSolved();
251  FillAllConnectedChildren(child);
252  }
253 }
254 
255 ConnectionLine* ControlElementSolver::SolveNextElement(ConnectionLine* currentLine)
256 {
257  auto parentList = currentLine->GetParentList();
258  for(auto it = parentList.begin(), itEnd = parentList.end(); it != itEnd; ++it) {
259  ControlElement* element = static_cast<ControlElement*>(*it);
260  // Solve the unsolved parent.
261  if(!element->IsSolved()) {
262  if(!element->Solve(currentLine->GetValue(), m_timeStep)) return NULL;
263  element->SetSolved();
264 
265  // Get the output node (must have one or will result NULL).
266  Node* outNode = NULL;
267  auto nodeList = element->GetNodeList();
268  for(auto itN = nodeList.begin(), itNEnd = nodeList.end(); itN != itNEnd; ++itN) {
269  Node* node = *itN;
270  if(node->GetNodeType() == Node::NODE_OUT) outNode = node;
271  }
272  if(!outNode) return NULL;
273 
274  // Set connection line value associated with the output node.
275  auto childList = element->GetChildList();
276  for(auto itC = childList.begin(), itCEnd = childList.end(); itC != itCEnd; ++itC) {
277  ConnectionLine* cLine = static_cast<ConnectionLine*>(*itC);
278  if(!cLine->IsSolved()) { // Only check unsolved lines
279  // Check if the connection line have the output node on the list
280  auto lineNodeList = cLine->GetNodeList();
281  for(auto itCN = nodeList.begin(), itCNEnd = nodeList.end(); itCN != itCNEnd; ++itCN) {
282  Node* childNode = *itCN;
283  if(childNode == outNode) {
284  // Check if the line connect two elements, otherwise return NULL
285  if(cLine->GetType() != ConnectionLine::ELEMENT_ELEMENT) return NULL;
286 
287  // Set the connection line value and return it.
288  cLine->SetValue(element->GetOutput());
289  cLine->SetSolved();
290  FillAllConnectedChildren(cLine);
291  return cLine;
292  }
293  }
294  }
295  }
296  }
297  }
298  return NULL;
299 }
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:506
+
virtual std::vector< Element * > GetChildList() const
Get the Child list.
Definition: Element.h:511
+
Node of a control element. This class manages the user interaction with the connection and control el...
+ +
Provides the communication with the power element.
Definition: IOControl.h:35
+ + + +
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
+
Connection between two control elements or other connection line and an element.
+ + + + + + + + + + +
A control element that provides a constant value.
Definition: Constant.h:35
diff --git a/docs/doxygen/html/_control_element_solver_8h.html b/docs/doxygen/html/_control_element_solver_8h.html new file mode 100644 index 0000000..6b14201 --- /dev/null +++ b/docs/doxygen/html/_control_element_solver_8h.html @@ -0,0 +1,116 @@ + + + + + + + + + +Project/ControlElementSolver.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
ControlElementSolver.h File Reference
+
+
+
#include <wx/window.h>
+#include <vector>
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  ControlElementSolver
 Solves in the time the control system. Can solve the control system directly from a ControlEditor or from a ControlEditorElement. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_control_element_solver_8h_source.html b/docs/doxygen/html/_control_element_solver_8h_source.html index 006dfa1..5fb831f 100644 --- a/docs/doxygen/html/_control_element_solver_8h_source.html +++ b/docs/doxygen/html/_control_element_solver_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,25 +88,25 @@ $(document).ready(function(){initNavTree('_control_element_solver_8h_source.html
ControlElementSolver.h
-
1 #ifndef CONTROLELEMENTSOLVER_H
2 #define CONTROLELEMENTSOLVER_H
3 
4 #include <wx/window.h>
5 #include <vector>
6 
8 class ControlEditor;
9 class ConnectionLine;
10 class Constant;
11 class Exponential;
12 class Gain;
13 class IOControl;
14 class Limiter;
15 class Multiplier;
16 class RateLimiter;
17 class Sum;
18 class TransferFunction;
19 
21 {
22  public:
24  ControlElementSolver(ControlEditor* controlEditor,
25  double timeStep = 1e-3,
26  double integrationError = 1e-3,
27  bool startAllZero = true,
28  double input = 0.0);
30  double timeStep = 1e-3,
31  double integrationError = 1e-3,
32  bool startAllZero = true,
33  double input = 0.0,
34  wxWindow* parent = NULL);
35  virtual ~ControlElementSolver() {}
36  virtual bool InitializeValues(double input, bool startAllZero);
37  virtual void SolveNextStep(double input);
38  virtual std::vector<double> GetSolutions() { return m_solutions; }
39  virtual double GetLastSolution() { return m_solutions[m_solutions.size() - 1]; }
40  virtual bool IsOK() const { return m_isOK; }
41  protected:
42  void Initialize(wxWindow* parent, double timeStep, double integrationError, bool startAllZero, double input);
43  void FillAllConnectedChildren(ConnectionLine* parent);
44  ConnectionLine* SolveNextElement(ConnectionLine* currentLine);
45 
46  ControlElementContainer* m_ctrlContainer = NULL;
47  double m_timeStep;
48  double m_integrationError;
49  std::vector<double> m_solutions;
50  bool m_isOK = false;
51 
52  IOControl* m_inputControl = NULL;
53  IOControl* m_outputControl = NULL;
54 };
55 
56 #endif // CONTROLELEMENTSOLVER_H
- -
Definition: Sum.h:9
-
Definition: Gain.h:11
-
Definition: Limiter.h:8
- - - - - - - - +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CONTROLELEMENTSOLVER_H
19 #define CONTROLELEMENTSOLVER_H
20 
21 #include <wx/window.h>
22 #include <vector>
23 
25 class ControlEditor;
26 class ConnectionLine;
27 class Constant;
28 class Exponential;
29 class Gain;
30 class IOControl;
31 class Limiter;
32 class Multiplier;
33 class RateLimiter;
34 class Sum;
35 class TransferFunction;
36 
46 {
47  public:
49  ControlElementSolver(ControlEditor* controlEditor,
50  double timeStep = 1e-3,
51  double integrationError = 1e-3,
52  bool startAllZero = true,
53  double input = 0.0);
55  double timeStep = 1e-3,
56  double integrationError = 1e-3,
57  bool startAllZero = true,
58  double input = 0.0,
59  wxWindow* parent = NULL);
60  virtual ~ControlElementSolver() {}
61  virtual bool InitializeValues(double input, bool startAllZero);
62  virtual void SolveNextStep(double input);
63  virtual std::vector<double> GetSolutions() { return m_solutions; }
64  virtual double GetLastSolution() { return m_solutions[m_solutions.size() - 1]; }
65  virtual bool IsOK() const { return m_isOK; }
66  protected:
67  void Initialize(wxWindow* parent, double timeStep, double integrationError, bool startAllZero, double input);
68  void FillAllConnectedChildren(ConnectionLine* parent);
69  ConnectionLine* SolveNextElement(ConnectionLine* currentLine);
70 
71  ControlElementContainer* m_ctrlContainer = NULL;
72  double m_timeStep;
73  double m_integrationError;
74  std::vector<double> m_solutions;
75  bool m_isOK = false;
76 
77  IOControl* m_inputControl = NULL;
78  IOControl* m_outputControl = NULL;
79 };
80 
81 #endif // CONTROLELEMENTSOLVER_H
Multiplies two inputs.
Definition: Multiplier.h:32
+
Solves in the time the control system. Can solve the control system directly from a ControlEditor or ...
+
Definition: Sum.h:26
+
Provide an output multiplying the input by a constant. .
Definition: Gain.h:36
+
Limits the input value by superior and inferior values.
Definition: Limiter.h:32
+
Provides the communication with the power element.
Definition: IOControl.h:35
+
Generates an output following an exponential function. .
Definition: Exponential.h:33
+
Limits the rising and/or falling rate.
Definition: RateLimiter.h:32
+
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
+
Connection between two control elements or other connection line and an element.
+ + +
A control element that provides a constant value.
Definition: Constant.h:35
-
1 #include "ControlSystemTest.h"
2 #include "ControlEditor.h"
3 
4 ControlSystemTest::ControlSystemTest(ControlEditor* parent,
5  int* inputType,
6  double* startTime,
7  double* slope,
8  double* timeStep,
9  double* simTime)
10  : ControlSystemTestBase(parent)
11 {
12  SetSize(GetBestSize());
13 
14  m_inputType = inputType;
15  m_startTime = startTime;
16  m_slope = slope;
17  m_timeStep = timeStep;
18  m_simTime = simTime;
19 
20  m_choiceInput->SetSelection(*m_inputType);
21  m_textCtrlStartTime->SetValue(wxString::FromDouble(*m_startTime));
22  m_textCtrlSlope->SetValue(wxString::FromDouble(*m_slope));
23  m_textCtrlTimeStep->SetValue(wxString::FromDouble(*m_timeStep));
24  m_textCtrlSimTime->SetValue(wxString::FromDouble(*m_simTime));
25 }
26 
27 ControlSystemTest::~ControlSystemTest() {}
28 void ControlSystemTest::OnRunButtonClick(wxCommandEvent& event)
29 {
30  int inputType;
31  double startTime, slope, timeStep, simTime;
32 
33  inputType = m_choiceInput->GetSelection();
34 
35  if(!m_textCtrlStartTime->GetValue().ToDouble(&startTime)) {
36  wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Start time\"."), _("Error"),
37  wxOK | wxCENTRE | wxICON_ERROR);
38  msgDialog.ShowModal();
39  return;
40  }
41 
42  if(!m_textCtrlSlope->GetValue().ToDouble(&slope)) {
43  wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Slope\"."), _("Error"),
44  wxOK | wxCENTRE | wxICON_ERROR);
45  msgDialog.ShowModal();
46  return;
47  }
48 
49  if(!m_textCtrlTimeStep->GetValue().ToDouble(&timeStep)) {
50  wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Time step\"."), _("Error"),
51  wxOK | wxCENTRE | wxICON_ERROR);
52  msgDialog.ShowModal();
53  return;
54  }
55 
56  if(!m_textCtrlSimTime->GetValue().ToDouble(&simTime)) {
57  wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Simulation time\"."), _("Error"),
58  wxOK | wxCENTRE | wxICON_ERROR);
59  msgDialog.ShowModal();
60  return;
61  }
62 
63  *m_inputType = inputType;
64  *m_startTime = startTime;
65  *m_slope = slope;
66  *m_timeStep = timeStep;
67  *m_simTime = simTime;
68 
69  EndModal(wxID_OK);
70 }
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "ControlSystemTest.h"
19 #include "ControlEditor.h"
20 
21 ControlSystemTest::ControlSystemTest(ControlEditor* parent,
22  int* inputType,
23  double* startTime,
24  double* slope,
25  double* timeStep,
26  double* simTime)
27  : ControlSystemTestBase(parent)
28 {
29  SetSize(GetBestSize());
30 
31  m_inputType = inputType;
32  m_startTime = startTime;
33  m_slope = slope;
34  m_timeStep = timeStep;
35  m_simTime = simTime;
36 
37  m_choiceInput->SetSelection(*m_inputType);
38  m_textCtrlStartTime->SetValue(wxString::FromDouble(*m_startTime));
39  m_textCtrlSlope->SetValue(wxString::FromDouble(*m_slope));
40  m_textCtrlTimeStep->SetValue(wxString::FromDouble(*m_timeStep));
41  m_textCtrlSimTime->SetValue(wxString::FromDouble(*m_simTime));
42 }
43 
44 ControlSystemTest::~ControlSystemTest() {}
45 void ControlSystemTest::OnRunButtonClick(wxCommandEvent& event)
46 {
47  int inputType;
48  double startTime, slope, timeStep, simTime;
49 
50  inputType = m_choiceInput->GetSelection();
51 
52  if(!m_textCtrlStartTime->GetValue().ToDouble(&startTime)) {
53  wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Start time\"."), _("Error"),
54  wxOK | wxCENTRE | wxICON_ERROR);
55  msgDialog.ShowModal();
56  return;
57  }
58 
59  if(!m_textCtrlSlope->GetValue().ToDouble(&slope)) {
60  wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Slope\"."), _("Error"),
61  wxOK | wxCENTRE | wxICON_ERROR);
62  msgDialog.ShowModal();
63  return;
64  }
65 
66  if(!m_textCtrlTimeStep->GetValue().ToDouble(&timeStep)) {
67  wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Time step\"."), _("Error"),
68  wxOK | wxCENTRE | wxICON_ERROR);
69  msgDialog.ShowModal();
70  return;
71  }
72 
73  if(!m_textCtrlSimTime->GetValue().ToDouble(&simTime)) {
74  wxMessageDialog msgDialog(this, _("Value entered incorrectly in the field \"Simulation time\"."), _("Error"),
75  wxOK | wxCENTRE | wxICON_ERROR);
76  msgDialog.ShowModal();
77  return;
78  }
79 
80  *m_inputType = inputType;
81  *m_startTime = startTime;
82  *m_slope = slope;
83  *m_timeStep = timeStep;
84  *m_simTime = simTime;
85 
86  EndModal(wxID_OK);
87 }
+ + +
diff --git a/docs/doxygen/html/_control_system_test_8h.html b/docs/doxygen/html/_control_system_test_8h.html new file mode 100644 index 0000000..b414db8 --- /dev/null +++ b/docs/doxygen/html/_control_system_test_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/ControlSystemTest.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
ControlSystemTest.h File Reference
+
+
+
#include "ControlEditorBase.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  ControlSystemTest
 Form to edit properties to test the control system created. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_control_system_test_8h_source.html b/docs/doxygen/html/_control_system_test_8h_source.html index 999877f..cf82a39 100644 --- a/docs/doxygen/html/_control_system_test_8h_source.html +++ b/docs/doxygen/html/_control_system_test_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_control_system_test_8h_source.html','
ControlSystemTest.h
-
1 #ifndef CONTROLSYSTEMTEST_H
2 #define CONTROLSYSTEMTEST_H
3 
4 #include "ControlEditorBase.h"
5 
6 class ControlEditor;
7 
9 {
10 public:
11  ControlSystemTest(ControlEditor* parent, int* inputType, double* startTime, double* slope, double* timeStep, double* simTime);
12  virtual ~ControlSystemTest();
13 
14 protected:
15  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
16  virtual void OnRunButtonClick(wxCommandEvent& event);
17  int* m_inputType = NULL;
18  double* m_startTime = NULL;
19  double* m_slope = NULL;
20  double* m_timeStep = NULL;
21  double* m_simTime = NULL;
22 };
23 #endif // CONTROLSYSTEMTEST_H
- - +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CONTROLSYSTEMTEST_H
19 #define CONTROLSYSTEMTEST_H
20 
21 #include "ControlEditorBase.h"
22 
23 class ControlEditor;
24 
33 {
34  public:
36  int* inputType,
37  double* startTime,
38  double* slope,
39  double* timeStep,
40  double* simTime);
41  virtual ~ControlSystemTest();
42 
43  protected:
44  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
45  virtual void OnRunButtonClick(wxCommandEvent& event);
46  int* m_inputType = NULL;
47  double* m_startTime = NULL;
48  double* m_slope = NULL;
49  double* m_timeStep = NULL;
50  double* m_simTime = NULL;
51 };
52 #endif // CONTROLSYSTEMTEST_H
+ +
Form to edit properties to test the control system created.
-
1 #include "DataReport.h"
2 #include "Workspace.h"
3 #include "ElectricCalculation.h"
4 
5 DataReport::DataReport(wxWindow* parent, Workspace* workspace) : DataReportBase(parent)
6 {
7  m_workspace = workspace;
8 
9  m_headerColour = wxColour(150, 150, 150);
10  m_offlineColour = wxColour(100, 100, 100);
11  m_oddRowColour = wxColour(220, 220, 220);
12  m_evenRowColour = wxColour(255, 255, 255);
13 
14  CreateGrids();
15  SetHeaders();
16  FillValues();
17 
18  SetRowsColours(m_gridPowerFlow);
19  SetRowsColours(m_gridPFBuses);
20  SetRowsColours(m_gridPFBranches);
21  SetRowsColours(m_gridFault, 2);
22  SetRowsColours(m_gridFaultBuses, 2);
23  SetRowsColours(m_gridFaultBranches, 2);
24  SetRowsColours(m_gridFaultGenerators, 2);
25 
26  Layout();
27 }
28 
29 DataReport::~DataReport() {}
30 void DataReport::CreateGrids()
31 {
32  wxFont headerFont = m_gridPowerFlow->GetLabelFont();
33  headerFont.SetWeight(wxFONTWEIGHT_BOLD);
34 
35  ElectricCalculation eCalc;
36  eCalc.GetElementsFromList(m_workspace->GetElementList());
37  auto lineList = eCalc.GetLineList();
38  auto transformerList = eCalc.GetTransformerList();
39  auto busList = eCalc.GetBusList();
40  auto generatorList = eCalc.GetSyncGeneratorList();
41 
42  // Power Flow
43  // Header
44  m_gridPowerFlow->AppendCols(7);
45  m_gridPowerFlow->AppendRows();
46  m_gridPowerFlow->HideColLabels();
47  m_gridPowerFlow->HideRowLabels();
48  for(int i = 0; i < 7; ++i) {
49  m_gridPowerFlow->SetCellBackgroundColour(0, i, m_headerColour);
50  m_gridPowerFlow->SetCellFont(0, i, headerFont);
51  }
52  m_gridPowerFlow->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
53  // Values
54  m_gridPowerFlow->AppendRows((lineList.size() + transformerList.size()) * 2);
55  m_gridPowerFlow->AutoSize();
56 
57  // Power Flow buses
58  // Header
59  m_gridPFBuses->AppendCols(6);
60  m_gridPFBuses->AppendRows();
61  m_gridPFBuses->HideColLabels();
62  m_gridPFBuses->HideRowLabels();
63  for(int i = 0; i < 6; ++i) {
64  m_gridPFBuses->SetCellBackgroundColour(0, i, m_headerColour);
65  m_gridPFBuses->SetCellFont(0, i, headerFont);
66  }
67  m_gridPFBuses->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
68  // Values
69  m_gridPFBuses->AppendRows(busList.size());
70  m_gridPFBuses->AutoSize();
71 
72  // Power flow branches
73  // Header
74  m_gridPFBranches->AppendCols(10);
75  m_gridPFBranches->AppendRows(1);
76  m_gridPFBranches->HideColLabels();
77  m_gridPFBranches->HideRowLabels();
78  for(int i = 0; i < 10; ++i) {
79  m_gridPFBranches->SetCellBackgroundColour(0, i, m_headerColour);
80  m_gridPFBranches->SetCellFont(0, i, headerFont);
81  }
82  m_gridPFBranches->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
83  // Values
84  m_gridPFBranches->AppendRows(lineList.size() + transformerList.size());
85  m_gridPFBranches->AutoSize();
86 
87  // Fault
88  // Header
89  m_gridFault->AppendCols(7);
90  m_gridFault->AppendRows(2);
91  m_gridFault->HideColLabels();
92  m_gridFault->HideRowLabels();
93  for(int i = 0; i < 2; ++i) {
94  for(int j = 0; j < 7; ++j) {
95  m_gridFault->SetCellBackgroundColour(i, j, m_headerColour);
96  m_gridFault->SetCellFont(i, j, headerFont);
97  }
98  }
99  m_gridFault->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
100  m_gridFault->SetCellSize(0, 0, 2, 1);
101  m_gridFault->SetCellSize(0, 1, 1, 2);
102  m_gridFault->SetCellSize(0, 3, 1, 2);
103  m_gridFault->SetCellSize(0, 5, 1, 2);
104  // Values
105  for(auto it = busList.begin(), itEnd = busList.end(); it != itEnd; ++it) {
106  Bus* bus = *it;
107  if(bus->GetElectricalData().hasFault) m_gridFault->AppendRows();
108  }
109  m_gridFault->AutoSize();
110 
111  // Fault buses
112  // Header
113  m_gridFaultBuses->AppendCols(7);
114  m_gridFaultBuses->AppendRows(2);
115  m_gridFaultBuses->HideColLabels();
116  m_gridFaultBuses->HideRowLabels();
117  for(int i = 0; i < 2; ++i) {
118  for(int j = 0; j < 7; ++j) {
119  m_gridFaultBuses->SetCellBackgroundColour(i, j, m_headerColour);
120  m_gridFaultBuses->SetCellFont(i, j, headerFont);
121  }
122  }
123  m_gridFaultBuses->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
124  m_gridFaultBuses->SetCellSize(0, 0, 2, 1);
125  m_gridFaultBuses->SetCellSize(0, 1, 1, 2);
126  m_gridFaultBuses->SetCellSize(0, 3, 1, 2);
127  m_gridFaultBuses->SetCellSize(0, 5, 1, 2);
128  // Values
129  m_gridFaultBuses->AppendRows(busList.size());
130  m_gridFaultBuses->AutoSize();
131 
132  // Fault branches
133  // Header
134  m_gridFaultBranches->AppendCols(11);
135  m_gridFaultBranches->AppendRows(2);
136  m_gridFaultBranches->HideColLabels();
137  m_gridFaultBranches->HideRowLabels();
138  for(int i = 0; i < 2; ++i) {
139  for(int j = 0; j < 11; ++j) {
140  m_gridFaultBranches->SetCellBackgroundColour(i, j, m_headerColour);
141  m_gridFaultBranches->SetCellFont(i, j, headerFont);
142  }
143  }
144  m_gridFaultBranches->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
145  m_gridFaultBranches->SetCellSize(0, 0, 2, 1);
146  m_gridFaultBranches->SetCellSize(0, 1, 2, 1);
147  m_gridFaultBranches->SetCellSize(0, 2, 2, 1);
148  m_gridFaultBranches->SetCellSize(0, 3, 2, 1);
149  m_gridFaultBranches->SetCellSize(0, 10, 2, 1);
150  m_gridFaultBranches->SetCellSize(0, 4, 1, 2);
151  m_gridFaultBranches->SetCellSize(0, 6, 1, 2);
152  m_gridFaultBranches->SetCellSize(0, 8, 1, 2);
153  // Values
154  m_gridFaultBranches->AppendRows((lineList.size() + transformerList.size()) * 2);
155  m_gridFaultBranches->AutoSize();
156 
157  // Fault generators
158  // Header
159  m_gridFaultGenerators->AppendCols(7);
160  m_gridFaultGenerators->AppendRows(2);
161  m_gridFaultGenerators->HideColLabels();
162  m_gridFaultGenerators->HideRowLabels();
163  for(int i = 0; i < 2; ++i) {
164  for(int j = 0; j < 7; ++j) {
165  m_gridFaultGenerators->SetCellBackgroundColour(i, j, m_headerColour);
166  m_gridFaultGenerators->SetCellFont(i, j, headerFont);
167  }
168  }
169  m_gridFaultGenerators->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
170  m_gridFaultGenerators->SetCellSize(0, 0, 2, 1);
171  m_gridFaultGenerators->SetCellSize(0, 1, 1, 2);
172  m_gridFaultGenerators->SetCellSize(0, 3, 1, 2);
173  m_gridFaultGenerators->SetCellSize(0, 5, 1, 2);
174  // Values
175  m_gridFaultGenerators->AppendRows(generatorList.size());
176  m_gridFaultGenerators->AutoSize();
177 }
178 
179 void DataReport::SetHeaders()
180 {
181  // Headers choices fill
182  wxString omega = static_cast<wxString>(L'\u03A9');
183 
184  m_voltageChoices.Add(_("Voltage (p.u.)"));
185  m_voltageChoices.Add(_("Voltage (V)"));
186  m_voltageChoices.Add(_("Voltage (kV)"));
187 
188  m_activePowerChoices.Add(_("Active Power (p.u.)"));
189  m_activePowerChoices.Add(_("Active Power (W)"));
190  m_activePowerChoices.Add(_("Active Power (kW)"));
191  m_activePowerChoices.Add(_("Active Power (MW)"));
192 
193  m_reactivePowerChoices.Add(_("Reactive Power (p.u.)"));
194  m_reactivePowerChoices.Add(_("Reactive Power (VAr)"));
195  m_reactivePowerChoices.Add(_("Reactive Power (kVAr)"));
196  m_reactivePowerChoices.Add(_("Reactive Power (MVAr)"));
197 
198  m_resistanceChoices.Add(_("R (p.u.)"));
199  m_resistanceChoices.Add(_("R (") + omega + wxT(")"));
200 
201  m_indReactanceChoices.Add(_("XL (p.u.)"));
202  m_indReactanceChoices.Add(_("XL (") + omega + wxT(")"));
203 
204  m_capSusceptanceChoices.Add(_("B (p.u.)"));
205  m_capSusceptanceChoices.Add(_("B (S)"));
206 
207  m_currentChoices.Add(_("Current (p.u.)"));
208  m_currentChoices.Add(_("Current (A)"));
209  m_currentChoices.Add(_("Current (kA)"));
210 
211  // Power flow
212  m_gridPowerFlow->SetCellValue(0, 0, _("Type"));
213  m_gridPowerFlow->SetCellValue(0, 1, _("Name"));
214  m_gridPowerFlow->SetCellValue(0, 2, _("From"));
215  m_gridPowerFlow->SetCellValue(0, 3, _("To"));
216  m_gridPowerFlow->SetCellEditor(0, 4, new wxGridCellChoiceEditor(m_activePowerChoices));
217  m_gridPowerFlow->SetCellValue(0, 4, m_activePowerChoices[3]);
218  m_gridPowerFlow->SetCellEditor(0, 5, new wxGridCellChoiceEditor(m_reactivePowerChoices));
219  m_gridPowerFlow->SetCellValue(0, 5, m_reactivePowerChoices[3]);
220  m_gridPowerFlow->SetCellValue(0, 6, _("Online"));
221 
222  // Power flow buses
223  m_gridPFBuses->SetCellValue(0, 0, _("Name"));
224  m_gridPFBuses->SetCellValue(0, 1, _("Type"));
225  m_gridPFBuses->SetCellEditor(0, 2, new wxGridCellChoiceEditor(m_voltageChoices));
226  m_gridPFBuses->SetCellValue(0, 2, m_voltageChoices[0]);
227  m_gridPFBuses->SetCellValue(0, 3, _("Angle"));
228  m_gridPFBuses->SetCellEditor(0, 4, new wxGridCellChoiceEditor(m_activePowerChoices));
229  m_gridPFBuses->SetCellValue(0, 4, m_activePowerChoices[3]);
230  m_gridPFBuses->SetCellEditor(0, 5, new wxGridCellChoiceEditor(m_reactivePowerChoices));
231  m_gridPFBuses->SetCellValue(0, 5, m_reactivePowerChoices[3]);
232 
233  // Power flow branches
234  m_gridPFBranches->SetCellValue(0, 0, _("Type"));
235  m_gridPFBranches->SetCellValue(0, 1, _("Name"));
236  m_gridPFBranches->SetCellValue(0, 2, _("From"));
237  m_gridPFBranches->SetCellValue(0, 3, _("To"));
238  m_gridPFBranches->SetCellEditor(0, 4, new wxGridCellChoiceEditor(m_resistanceChoices));
239  m_gridPFBranches->SetCellValue(0, 4, m_resistanceChoices[0]);
240  m_gridPFBranches->SetCellEditor(0, 5, new wxGridCellChoiceEditor(m_indReactanceChoices));
241  m_gridPFBranches->SetCellValue(0, 5, m_indReactanceChoices[0]);
242  m_gridPFBranches->SetCellEditor(0, 6, new wxGridCellChoiceEditor(m_capSusceptanceChoices));
243  m_gridPFBranches->SetCellValue(0, 6, m_capSusceptanceChoices[0]);
244  m_gridPFBranches->SetCellValue(0, 7, _("TAP"));
245  m_gridPFBranches->SetCellValue(0, 8, _("Phase Shift"));
246  m_gridPFBranches->SetCellValue(0, 9, _("Online"));
247 
248  // Fault
249  m_gridFault->SetCellValue(0, 0, _("Fault bus name"));
250  m_gridFault->SetCellValue(0, 1, _("Phase A"));
251  m_gridFault->SetCellValue(0, 3, _("Phase B"));
252  m_gridFault->SetCellValue(0, 5, _("Phase C"));
253  m_gridFault->SetCellEditor(1, 1, new wxGridCellChoiceEditor(m_currentChoices));
254  m_gridFault->SetCellValue(1, 1, m_currentChoices[1]);
255  m_gridFault->SetCellValue(1, 2, _("Angle"));
256  m_gridFault->SetCellEditor(1, 3, new wxGridCellChoiceEditor(m_currentChoices));
257  m_gridFault->SetCellValue(1, 3, m_currentChoices[1]);
258  m_gridFault->SetCellValue(1, 4, _("Angle"));
259  m_gridFault->SetCellEditor(1, 5, new wxGridCellChoiceEditor(m_currentChoices));
260  m_gridFault->SetCellValue(1, 5, m_currentChoices[1]);
261  m_gridFault->SetCellValue(1, 6, _("Angle"));
262 
263  // Fault buses
264  m_gridFaultBuses->SetCellValue(0, 0, _("Name"));
265  m_gridFaultBuses->SetCellValue(0, 1, _("Phase A"));
266  m_gridFaultBuses->SetCellValue(0, 3, _("Phase B"));
267  m_gridFaultBuses->SetCellValue(0, 5, _("Phase C"));
268  m_gridFaultBuses->SetCellEditor(1, 1, new wxGridCellChoiceEditor(m_voltageChoices));
269  m_gridFaultBuses->SetCellValue(1, 1, m_voltageChoices[0]);
270  m_gridFaultBuses->SetCellValue(1, 2, _("Angle"));
271  m_gridFaultBuses->SetCellEditor(1, 3, new wxGridCellChoiceEditor(m_voltageChoices));
272  m_gridFaultBuses->SetCellValue(1, 3, m_voltageChoices[0]);
273  m_gridFaultBuses->SetCellValue(1, 4, _("Angle"));
274  m_gridFaultBuses->SetCellEditor(1, 5, new wxGridCellChoiceEditor(m_voltageChoices));
275  m_gridFaultBuses->SetCellValue(1, 5, m_voltageChoices[0]);
276  m_gridFaultBuses->SetCellValue(1, 6, _("Angle"));
277 
278  // Fault branches
279  m_gridFaultBranches->SetCellValue(0, 0, _("Type"));
280  m_gridFaultBranches->SetCellValue(0, 1, _("Name"));
281  m_gridFaultBranches->SetCellValue(0, 2, _("From"));
282  m_gridFaultBranches->SetCellValue(0, 3, _("To"));
283  m_gridFaultBranches->SetCellValue(0, 4, _("Phase A"));
284  m_gridFaultBranches->SetCellValue(0, 6, _("Phase B"));
285  m_gridFaultBranches->SetCellValue(0, 8, _("Phase C"));
286  m_gridFaultBranches->SetCellValue(0, 10, _("Online"));
287  m_gridFaultBranches->SetCellEditor(1, 4, new wxGridCellChoiceEditor(m_currentChoices));
288  m_gridFaultBranches->SetCellValue(1, 4, m_currentChoices[1]);
289  m_gridFaultBranches->SetCellValue(1, 5, _("Angle"));
290  m_gridFaultBranches->SetCellEditor(1, 6, new wxGridCellChoiceEditor(m_currentChoices));
291  m_gridFaultBranches->SetCellValue(1, 6, m_currentChoices[1]);
292  m_gridFaultBranches->SetCellValue(1, 7, _("Angle"));
293  m_gridFaultBranches->SetCellEditor(1, 8, new wxGridCellChoiceEditor(m_currentChoices));
294  m_gridFaultBranches->SetCellValue(1, 8, m_currentChoices[1]);
295  m_gridFaultBranches->SetCellValue(1, 9, _("Angle"));
296 
297  // Fault generators
298  m_gridFaultGenerators->SetCellValue(0, 0, _("Name"));
299  m_gridFaultGenerators->SetCellValue(0, 1, _("Phase A"));
300  m_gridFaultGenerators->SetCellValue(0, 3, _("Phase B"));
301  m_gridFaultGenerators->SetCellValue(0, 5, _("Phase C"));
302  m_gridFaultGenerators->SetCellEditor(1, 1, new wxGridCellChoiceEditor(m_currentChoices));
303  m_gridFaultGenerators->SetCellValue(1, 1, m_currentChoices[1]);
304  m_gridFaultGenerators->SetCellValue(1, 2, _("Angle"));
305  m_gridFaultGenerators->SetCellEditor(1, 3, new wxGridCellChoiceEditor(m_currentChoices));
306  m_gridFaultGenerators->SetCellValue(1, 3, m_currentChoices[1]);
307  m_gridFaultGenerators->SetCellValue(1, 4, _("Angle"));
308  m_gridFaultGenerators->SetCellEditor(1, 5, new wxGridCellChoiceEditor(m_currentChoices));
309  m_gridFaultGenerators->SetCellValue(1, 5, m_currentChoices[1]);
310  m_gridFaultGenerators->SetCellValue(1, 6, _("Angle"));
311 }
312 
313 void DataReport::FillValues(GridSelection gridToFill)
314 {
315  m_changingValues = true;
316  ElectricCalculation eCalc;
317  eCalc.GetElementsFromList(m_workspace->GetElementList());
318 
319  double basePower = m_workspace->GetProperties()->GetSimulationPropertiesData().basePower;
320  switch(m_workspace->GetProperties()->GetSimulationPropertiesData().basePowerUnit) {
321  case UNIT_kVA: {
322  basePower *= 1e3;
323  } break;
324  case UNIT_MVA: {
325  basePower *= 1e6;
326  } break;
327  default:
328  break;
329  }
330 
331  int rowNumber = 1;
332  auto lineList = eCalc.GetLineList();
333  auto transformerList = eCalc.GetTransformerList();
334  auto busList = eCalc.GetBusList();
335  auto generatorList = eCalc.GetSyncGeneratorList();
336 
337  // Power Flow
338  if(gridToFill == GRID_ALL || gridToFill == GRID_PF) {
339  double kActivePower = 1.0;
340  if(m_gridPowerFlow->GetCellValue(0, 4) == m_activePowerChoices[1])
341  kActivePower = basePower;
342  else if(m_gridPowerFlow->GetCellValue(0, 4) == m_activePowerChoices[2])
343  kActivePower = basePower / 1e3;
344  else if(m_gridPowerFlow->GetCellValue(0, 4) == m_activePowerChoices[3])
345  kActivePower = basePower / 1e6;
346 
347  double kReactivePower = 1.0;
348  if(m_gridPowerFlow->GetCellValue(0, 5) == m_reactivePowerChoices[1])
349  kReactivePower = basePower;
350  else if(m_gridPowerFlow->GetCellValue(0, 5) == m_reactivePowerChoices[2])
351  kReactivePower = basePower / 1e3;
352  else if(m_gridPowerFlow->GetCellValue(0, 5) == m_reactivePowerChoices[3])
353  kReactivePower = basePower / 1e6;
354 
355  for(auto it = lineList.begin(), itEnd = lineList.end(); it != itEnd; ++it) {
356  Line* line = *it;
357 
358  wxString busName1 = "-";
359  if(line->GetParentList()[0])
360  busName1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().name;
361  wxString busName2 = "-";
362  if(line->GetParentList()[1])
363  busName2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().name;
364 
365  wxString isOnline = _("Yes");
366  wxColour textColour = m_gridPowerFlow->GetDefaultCellTextColour();
367  if(!line->IsOnline()) {
368  isOnline = _("No");
369  textColour = m_offlineColour;
370  }
371  for(int i = 0; i < 2; ++i) {
372  for(int j = 0; j < 7; ++j) {
373  m_gridPowerFlow->SetCellTextColour(rowNumber + i, j, textColour);
374  }
375  }
376 
377  m_gridPowerFlow->SetCellValue(rowNumber, 9, isOnline);
378  auto data = line->GetPUElectricalData(basePower);
379 
380  m_gridPowerFlow->SetCellValue(rowNumber, 0, _("Line"));
381  m_gridPowerFlow->SetCellValue(rowNumber, 1, data.name);
382  m_gridPowerFlow->SetCellValue(rowNumber, 2, busName1);
383  m_gridPowerFlow->SetCellValue(rowNumber, 3, busName2);
384  m_gridPowerFlow->SetCellValue(rowNumber, 4,
385  line->StringFromDouble(std::real(data.powerFlow[0]) * kActivePower));
386  m_gridPowerFlow->SetCellValue(rowNumber, 5,
387  line->StringFromDouble(std::imag(data.powerFlow[0]) * kReactivePower));
388  m_gridPowerFlow->SetCellValue(rowNumber, 6, isOnline);
389  rowNumber++;
390 
391  m_gridPowerFlow->SetCellValue(rowNumber, 0, _("Line"));
392  m_gridPowerFlow->SetCellValue(rowNumber, 1, data.name);
393  m_gridPowerFlow->SetCellValue(rowNumber, 2, busName2);
394  m_gridPowerFlow->SetCellValue(rowNumber, 3, busName1);
395  m_gridPowerFlow->SetCellValue(rowNumber, 4,
396  line->StringFromDouble(std::real(data.powerFlow[1]) * kActivePower));
397  m_gridPowerFlow->SetCellValue(rowNumber, 5,
398  line->StringFromDouble(std::imag(data.powerFlow[1]) * kReactivePower));
399  m_gridPowerFlow->SetCellValue(rowNumber, 6, isOnline);
400  rowNumber++;
401  }
402 
403  for(auto it = transformerList.begin(), itEnd = transformerList.end(); it != itEnd; ++it) {
404  Transformer* transformer = *it;
405  auto data = transformer->GetPUElectricalData(basePower);
406 
407  wxString busName1 = "-";
408  if(transformer->GetParentList()[0])
409  busName1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().name;
410  wxString busName2 = "-";
411  if(transformer->GetParentList()[1])
412  busName2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().name;
413 
414  wxString isOnline = _("Yes");
415  wxColour textColour = m_gridPowerFlow->GetDefaultCellTextColour();
416  if(!transformer->IsOnline()) {
417  isOnline = _("No");
418  textColour = m_offlineColour;
419  }
420  for(int i = 0; i < 2; ++i) {
421  for(int j = 0; j < 7; ++j) {
422  m_gridPowerFlow->SetCellTextColour(rowNumber + i, j, textColour);
423  }
424  }
425 
426  m_gridPowerFlow->SetCellValue(rowNumber, 0, _("Transformer"));
427  m_gridPowerFlow->SetCellValue(rowNumber, 1, data.name);
428  m_gridPowerFlow->SetCellValue(rowNumber, 2, busName1);
429  m_gridPowerFlow->SetCellValue(rowNumber, 3, busName2);
430  m_gridPowerFlow->SetCellValue(rowNumber, 4,
431  transformer->StringFromDouble(std::real(data.powerFlow[0]) * kActivePower));
432  m_gridPowerFlow->SetCellValue(rowNumber, 5,
433  transformer->StringFromDouble(std::imag(data.powerFlow[0]) * kReactivePower));
434  m_gridPowerFlow->SetCellValue(rowNumber, 6, isOnline);
435  rowNumber++;
436 
437  m_gridPowerFlow->SetCellValue(rowNumber, 0, _("Transformer"));
438  m_gridPowerFlow->SetCellValue(rowNumber, 1, data.name);
439  m_gridPowerFlow->SetCellValue(rowNumber, 2, busName2);
440  m_gridPowerFlow->SetCellValue(rowNumber, 3, busName1);
441  m_gridPowerFlow->SetCellValue(rowNumber, 4,
442  transformer->StringFromDouble(std::real(data.powerFlow[1]) * kActivePower));
443  m_gridPowerFlow->SetCellValue(rowNumber, 5,
444  transformer->StringFromDouble(std::imag(data.powerFlow[1]) * kReactivePower));
445  m_gridPowerFlow->SetCellValue(rowNumber, 6, isOnline);
446  rowNumber++;
447  }
448  m_gridPowerFlow->AutoSize();
449  }
450 
451  // Power Flow buses
452  if(gridToFill == GRID_ALL || gridToFill == GRID_PFBUSES) {
453  double kActivePower = 1.0;
454  if(m_gridPFBuses->GetCellValue(0, 4) == m_activePowerChoices[1])
455  kActivePower = basePower;
456  else if(m_gridPFBuses->GetCellValue(0, 4) == m_activePowerChoices[2])
457  kActivePower = basePower / 1e3;
458  else if(m_gridPFBuses->GetCellValue(0, 4) == m_activePowerChoices[3])
459  kActivePower = basePower / 1e6;
460 
461  double kReactivePower = 1.0;
462  if(m_gridPFBuses->GetCellValue(0, 5) == m_reactivePowerChoices[1])
463  kReactivePower = basePower;
464  else if(m_gridPFBuses->GetCellValue(0, 5) == m_reactivePowerChoices[2])
465  kReactivePower = basePower / 1e3;
466  else if(m_gridPFBuses->GetCellValue(0, 5) == m_reactivePowerChoices[3])
467  kReactivePower = basePower / 1e6;
468 
469  rowNumber = 1;
470  for(auto it = busList.begin(), itEnd = busList.end(); it != itEnd; ++it) {
471  Bus* bus = *it;
472  auto data = bus->GetElectricalData();
473 
474  double vb = std::abs(data.nominalVoltage);
475  if(data.nominalVoltageUnit == UNIT_kV) vb *= 1e3;
476  double kVoltage = 1.0;
477  if(m_gridPFBuses->GetCellValue(0, 2) == m_voltageChoices[1])
478  kVoltage = vb;
479  else if(m_gridPFBuses->GetCellValue(0, 2) == m_voltageChoices[2])
480  kVoltage = vb / 1e3;
481 
482  m_gridPFBuses->SetCellValue(rowNumber, 0, data.name);
483  wxString busTypeString = "";
484  switch(data.busType) {
485  case BUS_SLACK: {
486  busTypeString = _("Slack");
487  } break;
488  case BUS_PV: {
489  busTypeString = _("PV");
490  } break;
491  case BUS_PQ: {
492  busTypeString = _("PQ");
493  } break;
494  }
495  m_gridPFBuses->SetCellValue(rowNumber, 1, busTypeString);
496  m_gridPFBuses->SetCellValue(rowNumber, 2, bus->StringFromDouble(std::abs(data.voltage) * kVoltage));
497  m_gridPFBuses->SetCellValue(rowNumber, 3, bus->StringFromDouble(wxRadToDeg(std::arg(data.voltage))));
498  m_gridPFBuses->SetCellValue(rowNumber, 4, bus->StringFromDouble(std::real(data.power) * kActivePower));
499  m_gridPFBuses->SetCellValue(rowNumber, 5, bus->StringFromDouble(std::imag(data.power) * kReactivePower));
500  rowNumber++;
501  }
502  m_gridPFBuses->AutoSize();
503  }
504 
505  // Power flow branches
506  if(gridToFill == GRID_ALL || gridToFill == GRID_PFBRANCHES) {
507  rowNumber = 1;
508  for(auto it = lineList.begin(), itEnd = lineList.end(); it != itEnd; ++it) {
509  Line* line = *it;
510  auto data = line->GetPUElectricalData(basePower);
511 
512  double vb = data.nominalVoltage;
513  if(data.nominalVoltageUnit == UNIT_kV) vb *= 1e3;
514  double zb = (vb * vb) / basePower;
515 
516  wxString busName1 = "-";
517  if(line->GetParentList()[0])
518  busName1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().name;
519  wxString busName2 = "-";
520  if(line->GetParentList()[1])
521  busName2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().name;
522  wxString isOnline = _("Yes");
523  wxColour textColour = m_gridPFBranches->GetDefaultCellTextColour();
524  if(!line->IsOnline()) {
525  isOnline = _("No");
526  textColour = m_offlineColour;
527  }
528  for(int j = 0; j < 10; ++j) {
529  m_gridPFBranches->SetCellTextColour(rowNumber, j, textColour);
530  }
531 
532  m_gridPFBranches->SetCellValue(rowNumber, 0, _("Line"));
533  m_gridPFBranches->SetCellValue(rowNumber, 1, data.name);
534 
535  m_gridPFBranches->SetCellValue(rowNumber, 2, busName1);
536  m_gridPFBranches->SetCellValue(rowNumber, 3, busName2);
537 
538  double k = 1.0;
539  if(m_gridPFBranches->GetCellValue(0, 4) == m_resistanceChoices[1]) k = zb;
540  m_gridPFBranches->SetCellValue(rowNumber, 4, line->StringFromDouble(data.resistance * k));
541  k = 1.0;
542  if(m_gridPFBranches->GetCellValue(0, 5) == m_indReactanceChoices[1]) k = zb;
543  m_gridPFBranches->SetCellValue(rowNumber, 5, line->StringFromDouble(data.indReactance * k));
544  k = 1.0;
545  if(m_gridPFBranches->GetCellValue(0, 6) == m_capSusceptanceChoices[1]) k = zb;
546  m_gridPFBranches->SetCellValue(rowNumber, 6, line->StringFromDouble(data.capSusceptance / k));
547  m_gridPFBranches->SetCellValue(rowNumber, 7, "-");
548  m_gridPFBranches->SetCellValue(rowNumber, 8, "-");
549  m_gridPFBranches->SetCellValue(rowNumber, 9, isOnline);
550  rowNumber++;
551  }
552  for(auto it = transformerList.begin(), itEnd = transformerList.end(); it != itEnd; ++it) {
553  Transformer* transformer = *it;
554  auto data = transformer->GetPUElectricalData(basePower);
555 
556  double vb = 0.0;
557  if(data.baseVoltage == 0) {
558  vb = data.primaryNominalVoltage;
559  if(data.primaryNominalVoltageUnit == UNIT_kV) vb *= 1e3;
560  } else {
561  vb = data.secondaryNominalVoltage;
562  if(data.secondaryNominalVoltageUnit == UNIT_kV) vb *= 1e3;
563  }
564  double zb = (vb * vb) / basePower;
565 
566  wxString busName1 = "-";
567  if(transformer->GetParentList()[0])
568  busName1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().name;
569  wxString busName2 = "-";
570  if(transformer->GetParentList()[1])
571  busName2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().name;
572 
573  wxString isOnline = _("Yes");
574  wxColour textColour = m_gridPFBranches->GetDefaultCellTextColour();
575  if(!transformer->IsOnline()) {
576  isOnline = _("No");
577  textColour = m_offlineColour;
578  }
579  for(int j = 0; j < 10; ++j) {
580  m_gridPFBranches->SetCellTextColour(rowNumber, j, textColour);
581  }
582 
583  m_gridPFBranches->SetCellValue(rowNumber, 0, _("Transformer"));
584  m_gridPFBranches->SetCellValue(rowNumber, 1, data.name);
585  m_gridPFBranches->SetCellValue(rowNumber, 2, busName1);
586  m_gridPFBranches->SetCellValue(rowNumber, 3, busName2);
587 
588  double k = 1.0;
589  if(m_gridPFBranches->GetCellValue(0, 4) == m_resistanceChoices[1]) k = zb;
590  m_gridPFBranches->SetCellValue(rowNumber, 4, transformer->StringFromDouble(data.resistance * k));
591  k = 1.0;
592  if(m_gridPFBranches->GetCellValue(0, 5) == m_indReactanceChoices[1]) k = zb;
593  m_gridPFBranches->SetCellValue(rowNumber, 5, transformer->StringFromDouble(data.indReactance * k));
594  m_gridPFBranches->SetCellValue(rowNumber, 6, "-");
595  m_gridPFBranches->SetCellValue(rowNumber, 7, transformer->StringFromDouble(data.turnsRatio));
596  m_gridPFBranches->SetCellValue(rowNumber, 8, transformer->StringFromDouble(data.phaseShift));
597  m_gridPFBranches->SetCellValue(rowNumber, 9, isOnline);
598  rowNumber++;
599  }
600  m_gridPFBranches->AutoSize();
601  }
602 
603  // Fault
604  if(gridToFill == GRID_ALL || gridToFill == GRID_FAULT) {
605  rowNumber = 2;
606  for(auto it = busList.begin(), itEnd = busList.end(); it != itEnd; ++it) {
607  Bus* bus = *it;
608  auto data = bus->GetElectricalData();
609  if(data.hasFault) {
610  double vb = bus->GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
611  double ib = basePower / (std::sqrt(3.0) * vb);
612 
613  m_gridFault->SetCellValue(rowNumber, 0, data.name);
614 
615  double kCurrent = 1.0;
616  if(m_gridFault->GetCellValue(1, 1) == m_currentChoices[1]) {
617  kCurrent = ib;
618  } else if(m_gridFault->GetCellValue(1, 1) == m_currentChoices[2]) {
619  kCurrent = ib / 1e3;
620  }
621  m_gridFault->SetCellValue(rowNumber, 1,
622  bus->StringFromDouble(std::abs(data.faultCurrent[0]) * kCurrent));
623 
624  m_gridFault->SetCellValue(rowNumber, 2,
625  bus->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0]))));
626 
627  kCurrent = 1.0;
628  if(m_gridFault->GetCellValue(1, 3) == m_currentChoices[1]) {
629  kCurrent = ib;
630  } else if(m_gridFault->GetCellValue(1, 3) == m_currentChoices[2]) {
631  kCurrent = ib / 1e3;
632  }
633  m_gridFault->SetCellValue(rowNumber, 3,
634  bus->StringFromDouble(std::abs(data.faultCurrent[1]) * kCurrent));
635 
636  m_gridFault->SetCellValue(rowNumber, 4,
637  bus->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1]))));
638 
639  kCurrent = 1.0;
640  if(m_gridFault->GetCellValue(1, 5) == m_currentChoices[1]) {
641  kCurrent = ib;
642  } else if(m_gridFault->GetCellValue(1, 5) == m_currentChoices[2]) {
643  kCurrent = ib / 1e3;
644  }
645  m_gridFault->SetCellValue(rowNumber, 5,
646  bus->StringFromDouble(std::abs(data.faultCurrent[2]) * kCurrent));
647 
648  m_gridFault->SetCellValue(rowNumber, 6,
649  bus->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[2]))));
650 
651  rowNumber++;
652  }
653  }
654  m_gridFault->AutoSize();
655  }
656 
657  // Fault buses
658  if(gridToFill == GRID_ALL || gridToFill == GRID_FAULTBUSES) {
659  rowNumber = 2;
660  for(auto it = busList.begin(), itEnd = busList.end(); it != itEnd; ++it) {
661  Bus* bus = *it;
662  auto data = bus->GetElectricalData();
663  double vb = bus->GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
664 
665  m_gridFaultBuses->SetCellValue(rowNumber, 0, data.name);
666  double kVoltage = 1.0;
667  if(m_gridFaultBuses->GetCellValue(1, 1) == m_voltageChoices[1]) {
668  kVoltage = vb;
669  } else if(m_gridFaultBuses->GetCellValue(1, 1) == m_voltageChoices[2]) {
670  kVoltage = vb / 1e3;
671  }
672  m_gridFaultBuses->SetCellValue(rowNumber, 1,
673  bus->StringFromDouble(std::abs(data.faultVoltage[0]) * kVoltage));
674  m_gridFaultBuses->SetCellValue(rowNumber, 2,
675  bus->StringFromDouble(wxRadToDeg(std::arg(data.faultVoltage[0]))));
676 
677  kVoltage = 1.0;
678  if(m_gridFaultBuses->GetCellValue(1, 3) == m_voltageChoices[1]) {
679  kVoltage = vb;
680  } else if(m_gridFaultBuses->GetCellValue(1, 3) == m_voltageChoices[2]) {
681  kVoltage = vb / 1e3;
682  }
683  m_gridFaultBuses->SetCellValue(rowNumber, 3,
684  bus->StringFromDouble(std::abs(data.faultVoltage[1]) * kVoltage));
685  m_gridFaultBuses->SetCellValue(rowNumber, 4,
686  bus->StringFromDouble(wxRadToDeg(std::arg(data.faultVoltage[1]))));
687 
688  kVoltage = 1.0;
689  if(m_gridFaultBuses->GetCellValue(1, 5) == m_voltageChoices[1]) {
690  kVoltage = vb;
691  } else if(m_gridFaultBuses->GetCellValue(1, 5) == m_voltageChoices[2]) {
692  kVoltage = vb / 1e3;
693  }
694  m_gridFaultBuses->SetCellValue(rowNumber, 5,
695  bus->StringFromDouble(std::abs(data.faultVoltage[2]) * kVoltage));
696  m_gridFaultBuses->SetCellValue(rowNumber, 6,
697  bus->StringFromDouble(wxRadToDeg(std::arg(data.faultVoltage[2]))));
698 
699  rowNumber++;
700  }
701  m_gridFaultBuses->AutoSize();
702  }
703 
704  // Fault branches
705  if(gridToFill == GRID_ALL || gridToFill == GRID_FAULTBRANCHES) {
706  rowNumber = 2;
707  for(auto it = lineList.begin(), itEnd = lineList.end(); it != itEnd; ++it) {
708  Line* line = *it;
709  auto data = line->GetPUElectricalData(basePower);
710 
711  double vb = line->GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
712  double ib = basePower / (std::sqrt(3.0) * vb);
713 
714  wxString busName1 = "-";
715  if(line->GetParentList()[0])
716  busName1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().name;
717  wxString busName2 = "-";
718  if(line->GetParentList()[1])
719  busName2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().name;
720 
721  wxString isOnline = _("Yes");
722  wxColour textColour = m_gridFaultBranches->GetDefaultCellTextColour();
723  if(!line->IsOnline()) {
724  isOnline = _("No");
725  textColour = m_offlineColour;
726  }
727  for(int i = 0; i < 2; ++i) {
728  for(int j = 0; j < 11; ++j) {
729  m_gridFaultBranches->SetCellTextColour(rowNumber + i, j, textColour);
730  }
731  }
732 
733  m_gridFaultBranches->SetCellValue(rowNumber, 0, _("Line"));
734  m_gridFaultBranches->SetCellValue(rowNumber, 1, data.name);
735  m_gridFaultBranches->SetCellValue(rowNumber, 2, busName1);
736  m_gridFaultBranches->SetCellValue(rowNumber, 3, busName2);
737 
738  double kCurrent = 1.0;
739  if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[1]) {
740  kCurrent = ib;
741  } else if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[2]) {
742  kCurrent = ib / 1e3;
743  }
744  m_gridFaultBranches->SetCellValue(rowNumber, 4,
745  line->StringFromDouble(std::abs(data.faultCurrent[0][0]) * kCurrent));
746  m_gridFaultBranches->SetCellValue(rowNumber, 5,
747  line->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0][0]))));
748  kCurrent = 1.0;
749  if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[1]) {
750  kCurrent = ib;
751  } else if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[2]) {
752  kCurrent = ib / 1e3;
753  }
754  m_gridFaultBranches->SetCellValue(rowNumber, 6,
755  line->StringFromDouble(std::abs(data.faultCurrent[0][1]) * kCurrent));
756  m_gridFaultBranches->SetCellValue(rowNumber, 7,
757  line->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0][1]))));
758  kCurrent = 1.0;
759  if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[1]) {
760  kCurrent = ib;
761  } else if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[2]) {
762  kCurrent = ib / 1e3;
763  }
764  m_gridFaultBranches->SetCellValue(rowNumber, 8,
765  line->StringFromDouble(std::abs(data.faultCurrent[0][2]) * kCurrent));
766  m_gridFaultBranches->SetCellValue(rowNumber, 9,
767  line->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0][2]))));
768  m_gridFaultBranches->SetCellValue(rowNumber, 10, isOnline);
769  rowNumber++;
770 
771  m_gridFaultBranches->SetCellValue(rowNumber, 0, _("Line"));
772  m_gridFaultBranches->SetCellValue(rowNumber, 1, data.name);
773  m_gridFaultBranches->SetCellValue(rowNumber, 2, busName2);
774  m_gridFaultBranches->SetCellValue(rowNumber, 3, busName1);
775  kCurrent = 1.0;
776  if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[1]) {
777  kCurrent = ib;
778  } else if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[2]) {
779  kCurrent = ib / 1e3;
780  }
781  m_gridFaultBranches->SetCellValue(rowNumber, 4,
782  line->StringFromDouble(std::abs(data.faultCurrent[1][0]) * kCurrent));
783  m_gridFaultBranches->SetCellValue(rowNumber, 5,
784  line->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1][0]))));
785  kCurrent = 1.0;
786  if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[1]) {
787  kCurrent = ib;
788  } else if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[2]) {
789  kCurrent = ib / 1e3;
790  }
791  m_gridFaultBranches->SetCellValue(rowNumber, 6,
792  line->StringFromDouble(std::abs(data.faultCurrent[1][1]) * kCurrent));
793  m_gridFaultBranches->SetCellValue(rowNumber, 7,
794  line->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1][1]))));
795  kCurrent = 1.0;
796  if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[1]) {
797  kCurrent = ib;
798  } else if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[2]) {
799  kCurrent = ib / 1e3;
800  }
801  m_gridFaultBranches->SetCellValue(rowNumber, 8,
802  line->StringFromDouble(std::abs(data.faultCurrent[1][2]) * kCurrent));
803  m_gridFaultBranches->SetCellValue(rowNumber, 9,
804  line->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1][2]))));
805  m_gridFaultBranches->SetCellValue(rowNumber, 10, isOnline);
806  rowNumber++;
807  }
808 
809  for(auto it = transformerList.begin(), itEnd = transformerList.end(); it != itEnd; ++it) {
810  Transformer* transformer = *it;
811  auto data = transformer->GetPUElectricalData(basePower);
812 
813  double vb = transformer->GetValueFromUnit(data.primaryNominalVoltage, data.primaryNominalVoltageUnit);
814  double ibp = basePower / (std::sqrt(3.0) * vb);
815  vb = transformer->GetValueFromUnit(data.secondaryNominalVoltage, data.secondaryNominalVoltageUnit);
816  double ibs = basePower / (std::sqrt(3.0) * vb);
817 
818  wxString busName1 = "-";
819  if(transformer->GetParentList()[0])
820  busName1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().name;
821  wxString busName2 = "-";
822  if(transformer->GetParentList()[1])
823  busName2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().name;
824 
825  wxString isOnline = _("Yes");
826  wxColour textColour = m_gridFaultBranches->GetDefaultCellTextColour();
827  if(!transformer->IsOnline()) {
828  isOnline = _("No");
829  textColour = m_offlineColour;
830  }
831  for(int i = 0; i < 2; ++i) {
832  for(int j = 0; j < 11; ++j) {
833  m_gridFaultBranches->SetCellTextColour(rowNumber + i, j, textColour);
834  }
835  }
836 
837  m_gridFaultBranches->SetCellValue(rowNumber, 0, _("Transformer"));
838  m_gridFaultBranches->SetCellValue(rowNumber, 1, data.name);
839  m_gridFaultBranches->SetCellValue(rowNumber, 2, busName1);
840  m_gridFaultBranches->SetCellValue(rowNumber, 3, busName2);
841 
842  double kCurrent = 1.0;
843  if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[1]) {
844  kCurrent = ibp;
845  } else if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[2]) {
846  kCurrent = ibp / 1e3;
847  }
848  m_gridFaultBranches->SetCellValue(
849  rowNumber, 4, transformer->StringFromDouble(std::abs(data.faultCurrent[0][0]) * kCurrent));
850  m_gridFaultBranches->SetCellValue(
851  rowNumber, 5, transformer->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0][0]))));
852  kCurrent = 1.0;
853  if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[1]) {
854  kCurrent = ibp;
855  } else if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[2]) {
856  kCurrent = ibp / 1e3;
857  }
858  m_gridFaultBranches->SetCellValue(
859  rowNumber, 6, transformer->StringFromDouble(std::abs(data.faultCurrent[0][1]) * kCurrent));
860  m_gridFaultBranches->SetCellValue(
861  rowNumber, 7, transformer->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0][1]))));
862  kCurrent = 1.0;
863  if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[1]) {
864  kCurrent = ibp;
865  } else if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[2]) {
866  kCurrent = ibp / 1e3;
867  }
868  m_gridFaultBranches->SetCellValue(
869  rowNumber, 8, transformer->StringFromDouble(std::abs(data.faultCurrent[0][2]) * kCurrent));
870  m_gridFaultBranches->SetCellValue(
871  rowNumber, 9, transformer->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0][2]))));
872  m_gridFaultBranches->SetCellValue(rowNumber, 10, isOnline);
873  rowNumber++;
874 
875  m_gridFaultBranches->SetCellValue(rowNumber, 0, _("Transformer"));
876  m_gridFaultBranches->SetCellValue(rowNumber, 1, data.name);
877  m_gridFaultBranches->SetCellValue(rowNumber, 2, busName2);
878  m_gridFaultBranches->SetCellValue(rowNumber, 3, busName1);
879  kCurrent = 1.0;
880  if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[1]) {
881  kCurrent = ibs;
882  } else if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[2]) {
883  kCurrent = ibs / 1e3;
884  }
885  m_gridFaultBranches->SetCellValue(
886  rowNumber, 4, transformer->StringFromDouble(std::abs(data.faultCurrent[1][0]) * kCurrent));
887  m_gridFaultBranches->SetCellValue(
888  rowNumber, 5, transformer->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1][0]))));
889  kCurrent = 1.0;
890  if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[1]) {
891  kCurrent = ibs;
892  } else if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[2]) {
893  kCurrent = ibs / 1e3;
894  }
895  m_gridFaultBranches->SetCellValue(
896  rowNumber, 6, transformer->StringFromDouble(std::abs(data.faultCurrent[1][1]) * kCurrent));
897  m_gridFaultBranches->SetCellValue(
898  rowNumber, 7, transformer->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1][1]))));
899  kCurrent = 1.0;
900  if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[1]) {
901  kCurrent = ibs;
902  } else if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[2]) {
903  kCurrent = ibs / 1e3;
904  }
905  m_gridFaultBranches->SetCellValue(
906  rowNumber, 8, transformer->StringFromDouble(std::abs(data.faultCurrent[1][2]) * kCurrent));
907  m_gridFaultBranches->SetCellValue(
908  rowNumber, 9, transformer->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1][2]))));
909  m_gridFaultBranches->SetCellValue(rowNumber, 10, isOnline);
910  rowNumber++;
911  }
912 
913  m_gridFaultBranches->AutoSize();
914  }
915 
916  // Fault generators
917  if(gridToFill == GRID_ALL || gridToFill == GRID_FAULTGENERATORS) {
918  rowNumber = 2;
919  for(auto it = generatorList.begin(), itEnd = generatorList.end(); it != itEnd; ++it) {
920  SyncGenerator* generator = *it;
921  auto data = generator->GetPUElectricalData(basePower);
922  double vb = generator->GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
923  double ib = basePower / (std::sqrt(3.0) * vb);
924 
925  m_gridFaultGenerators->SetCellValue(rowNumber, 0, data.name);
926 
927  double kCurrent = 1.0;
928  if(m_gridFaultGenerators->GetCellValue(1, 1) == m_currentChoices[1])
929  kCurrent = ib;
930  else if(m_gridFaultGenerators->GetCellValue(1, 1) == m_currentChoices[2])
931  kCurrent = ib / 1e3;
932  m_gridFaultGenerators->SetCellValue(rowNumber, 1,
933  generator->StringFromDouble(std::abs(data.faultCurrent[0]) * kCurrent));
934  m_gridFaultGenerators->SetCellValue(
935  rowNumber, 2, generator->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0]))));
936 
937  kCurrent = 1.0;
938  if(m_gridFaultGenerators->GetCellValue(1, 3) == m_currentChoices[1])
939  kCurrent = ib;
940  else if(m_gridFaultGenerators->GetCellValue(1, 3) == m_currentChoices[2])
941  kCurrent = ib / 1e3;
942  m_gridFaultGenerators->SetCellValue(rowNumber, 3,
943  generator->StringFromDouble(std::abs(data.faultCurrent[1]) * kCurrent));
944  m_gridFaultGenerators->SetCellValue(
945  rowNumber, 4, generator->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1]))));
946 
947  kCurrent = 1.0;
948  if(m_gridFaultGenerators->GetCellValue(1, 5) == m_currentChoices[1])
949  kCurrent = ib;
950  else if(m_gridFaultGenerators->GetCellValue(1, 5) == m_currentChoices[2])
951  kCurrent = ib / 1e3;
952  m_gridFaultGenerators->SetCellValue(rowNumber, 5,
953  generator->StringFromDouble(std::abs(data.faultCurrent[2]) * kCurrent));
954  m_gridFaultGenerators->SetCellValue(
955  rowNumber, 6, generator->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[2]))));
956 
957  rowNumber++;
958  }
959  m_gridFaultGenerators->AutoSize();
960  }
961  m_changingValues = false;
962 }
963 
964 void DataReport::SetRowsColours(wxGrid* grid, int rowStart)
965 {
966  for(int i = rowStart; i < grid->GetNumberRows(); ++i) {
967  wxGridCellAttr* attr = grid->GetOrCreateCellAttr(i, 0);
968  if((i - rowStart) % 2 == 0)
969  attr->SetBackgroundColour(m_evenRowColour);
970  else
971  attr->SetBackgroundColour(m_oddRowColour);
972  grid->SetRowAttr(i, attr);
973  }
974 }
975 
976 void DataReport::OnPFBusGridChanged(wxGridEvent& event)
977 {
978  if(!m_changingValues) FillValues(GRID_PFBUSES);
979 }
980 void DataReport::OnFaulrGridChanged(wxGridEvent& event)
981 {
982  if(!m_changingValues) FillValues(GRID_FAULT);
983 }
984 void DataReport::OnFaultBranchesGridChanged(wxGridEvent& event)
985 {
986  if(!m_changingValues) FillValues(GRID_FAULTBRANCHES);
987 }
988 void DataReport::OnFaultBusesGridChanged(wxGridEvent& event)
989 {
990  if(!m_changingValues) FillValues(GRID_FAULTBUSES);
991 }
992 void DataReport::OnFaultGeneratorsGridChanged(wxGridEvent& event)
993 {
994  if(!m_changingValues) FillValues(GRID_FAULTGENERATORS);
995 }
996 void DataReport::OnPFBranchesGridChanged(wxGridEvent& event)
997 {
998  if(!m_changingValues) FillValues(GRID_PFBRANCHES);
999 }
1000 void DataReport::OnPowerFlowGridChanged(wxGridEvent& event)
1001 {
1002  if(!m_changingValues) FillValues(GRID_PF);
1003 }
const std::vector< Transformer * > GetTransformerList() const
Get the transformers of the system (use GetElementsFromList first).
-
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:517
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "DataReport.h"
19 #include "Workspace.h"
20 #include "ElectricCalculation.h"
21 
22 DataReport::DataReport(wxWindow* parent, Workspace* workspace) : DataReportBase(parent)
23 {
24  m_workspace = workspace;
25 
26  m_headerColour = wxColour(150, 150, 150);
27  m_offlineColour = wxColour(100, 100, 100);
28  m_oddRowColour = wxColour(220, 220, 220);
29  m_evenRowColour = wxColour(255, 255, 255);
30 
31  CreateGrids();
32  SetHeaders();
33  FillValues();
34 
35  SetRowsColours(m_gridPowerFlow);
36  SetRowsColours(m_gridPFBuses);
37  SetRowsColours(m_gridPFBranches);
38  SetRowsColours(m_gridFault, 2);
39  SetRowsColours(m_gridFaultBuses, 2);
40  SetRowsColours(m_gridFaultBranches, 2);
41  SetRowsColours(m_gridFaultGenerators, 2);
42 
43  Layout();
44 }
45 
46 DataReport::~DataReport() {}
47 void DataReport::CreateGrids()
48 {
49  wxFont headerFont = m_gridPowerFlow->GetLabelFont();
50  headerFont.SetWeight(wxFONTWEIGHT_BOLD);
51 
52  ElectricCalculation eCalc;
53  eCalc.GetElementsFromList(m_workspace->GetElementList());
54  auto lineList = eCalc.GetLineList();
55  auto transformerList = eCalc.GetTransformerList();
56  auto busList = eCalc.GetBusList();
57  auto generatorList = eCalc.GetSyncGeneratorList();
58 
59  // Power Flow
60  // Header
61  m_gridPowerFlow->AppendCols(7);
62  m_gridPowerFlow->AppendRows();
63  m_gridPowerFlow->HideColLabels();
64  m_gridPowerFlow->HideRowLabels();
65  for(int i = 0; i < 7; ++i) {
66  m_gridPowerFlow->SetCellBackgroundColour(0, i, m_headerColour);
67  m_gridPowerFlow->SetCellFont(0, i, headerFont);
68  }
69  m_gridPowerFlow->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
70  // Values
71  m_gridPowerFlow->AppendRows((lineList.size() + transformerList.size()) * 2);
72  m_gridPowerFlow->AutoSize();
73 
74  // Power Flow buses
75  // Header
76  m_gridPFBuses->AppendCols(6);
77  m_gridPFBuses->AppendRows();
78  m_gridPFBuses->HideColLabels();
79  m_gridPFBuses->HideRowLabels();
80  for(int i = 0; i < 6; ++i) {
81  m_gridPFBuses->SetCellBackgroundColour(0, i, m_headerColour);
82  m_gridPFBuses->SetCellFont(0, i, headerFont);
83  }
84  m_gridPFBuses->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
85  // Values
86  m_gridPFBuses->AppendRows(busList.size());
87  m_gridPFBuses->AutoSize();
88 
89  // Power flow branches
90  // Header
91  m_gridPFBranches->AppendCols(10);
92  m_gridPFBranches->AppendRows(1);
93  m_gridPFBranches->HideColLabels();
94  m_gridPFBranches->HideRowLabels();
95  for(int i = 0; i < 10; ++i) {
96  m_gridPFBranches->SetCellBackgroundColour(0, i, m_headerColour);
97  m_gridPFBranches->SetCellFont(0, i, headerFont);
98  }
99  m_gridPFBranches->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
100  // Values
101  m_gridPFBranches->AppendRows(lineList.size() + transformerList.size());
102  m_gridPFBranches->AutoSize();
103 
104  // Fault
105  // Header
106  m_gridFault->AppendCols(7);
107  m_gridFault->AppendRows(2);
108  m_gridFault->HideColLabels();
109  m_gridFault->HideRowLabels();
110  for(int i = 0; i < 2; ++i) {
111  for(int j = 0; j < 7; ++j) {
112  m_gridFault->SetCellBackgroundColour(i, j, m_headerColour);
113  m_gridFault->SetCellFont(i, j, headerFont);
114  }
115  }
116  m_gridFault->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
117  m_gridFault->SetCellSize(0, 0, 2, 1);
118  m_gridFault->SetCellSize(0, 1, 1, 2);
119  m_gridFault->SetCellSize(0, 3, 1, 2);
120  m_gridFault->SetCellSize(0, 5, 1, 2);
121  // Values
122  for(auto it = busList.begin(), itEnd = busList.end(); it != itEnd; ++it) {
123  Bus* bus = *it;
124  if(bus->GetElectricalData().hasFault) m_gridFault->AppendRows();
125  }
126  m_gridFault->AutoSize();
127 
128  // Fault buses
129  // Header
130  m_gridFaultBuses->AppendCols(7);
131  m_gridFaultBuses->AppendRows(2);
132  m_gridFaultBuses->HideColLabels();
133  m_gridFaultBuses->HideRowLabels();
134  for(int i = 0; i < 2; ++i) {
135  for(int j = 0; j < 7; ++j) {
136  m_gridFaultBuses->SetCellBackgroundColour(i, j, m_headerColour);
137  m_gridFaultBuses->SetCellFont(i, j, headerFont);
138  }
139  }
140  m_gridFaultBuses->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
141  m_gridFaultBuses->SetCellSize(0, 0, 2, 1);
142  m_gridFaultBuses->SetCellSize(0, 1, 1, 2);
143  m_gridFaultBuses->SetCellSize(0, 3, 1, 2);
144  m_gridFaultBuses->SetCellSize(0, 5, 1, 2);
145  // Values
146  m_gridFaultBuses->AppendRows(busList.size());
147  m_gridFaultBuses->AutoSize();
148 
149  // Fault branches
150  // Header
151  m_gridFaultBranches->AppendCols(11);
152  m_gridFaultBranches->AppendRows(2);
153  m_gridFaultBranches->HideColLabels();
154  m_gridFaultBranches->HideRowLabels();
155  for(int i = 0; i < 2; ++i) {
156  for(int j = 0; j < 11; ++j) {
157  m_gridFaultBranches->SetCellBackgroundColour(i, j, m_headerColour);
158  m_gridFaultBranches->SetCellFont(i, j, headerFont);
159  }
160  }
161  m_gridFaultBranches->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
162  m_gridFaultBranches->SetCellSize(0, 0, 2, 1);
163  m_gridFaultBranches->SetCellSize(0, 1, 2, 1);
164  m_gridFaultBranches->SetCellSize(0, 2, 2, 1);
165  m_gridFaultBranches->SetCellSize(0, 3, 2, 1);
166  m_gridFaultBranches->SetCellSize(0, 10, 2, 1);
167  m_gridFaultBranches->SetCellSize(0, 4, 1, 2);
168  m_gridFaultBranches->SetCellSize(0, 6, 1, 2);
169  m_gridFaultBranches->SetCellSize(0, 8, 1, 2);
170  // Values
171  m_gridFaultBranches->AppendRows((lineList.size() + transformerList.size()) * 2);
172  m_gridFaultBranches->AutoSize();
173 
174  // Fault generators
175  // Header
176  m_gridFaultGenerators->AppendCols(7);
177  m_gridFaultGenerators->AppendRows(2);
178  m_gridFaultGenerators->HideColLabels();
179  m_gridFaultGenerators->HideRowLabels();
180  for(int i = 0; i < 2; ++i) {
181  for(int j = 0; j < 7; ++j) {
182  m_gridFaultGenerators->SetCellBackgroundColour(i, j, m_headerColour);
183  m_gridFaultGenerators->SetCellFont(i, j, headerFont);
184  }
185  }
186  m_gridFaultGenerators->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
187  m_gridFaultGenerators->SetCellSize(0, 0, 2, 1);
188  m_gridFaultGenerators->SetCellSize(0, 1, 1, 2);
189  m_gridFaultGenerators->SetCellSize(0, 3, 1, 2);
190  m_gridFaultGenerators->SetCellSize(0, 5, 1, 2);
191  // Values
192  m_gridFaultGenerators->AppendRows(generatorList.size());
193  m_gridFaultGenerators->AutoSize();
194 }
195 
196 void DataReport::SetHeaders()
197 {
198  // Headers choices fill
199  wxString omega = static_cast<wxString>(L'\u03A9');
200 
201  m_voltageChoices.Add(_("Voltage (p.u.)"));
202  m_voltageChoices.Add(_("Voltage (V)"));
203  m_voltageChoices.Add(_("Voltage (kV)"));
204 
205  m_activePowerChoices.Add(_("Active Power (p.u.)"));
206  m_activePowerChoices.Add(_("Active Power (W)"));
207  m_activePowerChoices.Add(_("Active Power (kW)"));
208  m_activePowerChoices.Add(_("Active Power (MW)"));
209 
210  m_reactivePowerChoices.Add(_("Reactive Power (p.u.)"));
211  m_reactivePowerChoices.Add(_("Reactive Power (VAr)"));
212  m_reactivePowerChoices.Add(_("Reactive Power (kVAr)"));
213  m_reactivePowerChoices.Add(_("Reactive Power (MVAr)"));
214 
215  m_resistanceChoices.Add(_("R (p.u.)"));
216  m_resistanceChoices.Add(_("R (") + omega + wxT(")"));
217 
218  m_indReactanceChoices.Add(_("XL (p.u.)"));
219  m_indReactanceChoices.Add(_("XL (") + omega + wxT(")"));
220 
221  m_capSusceptanceChoices.Add(_("B (p.u.)"));
222  m_capSusceptanceChoices.Add(_("B (S)"));
223 
224  m_currentChoices.Add(_("Current (p.u.)"));
225  m_currentChoices.Add(_("Current (A)"));
226  m_currentChoices.Add(_("Current (kA)"));
227 
228  // Power flow
229  m_gridPowerFlow->SetCellValue(0, 0, _("Type"));
230  m_gridPowerFlow->SetCellValue(0, 1, _("Name"));
231  m_gridPowerFlow->SetCellValue(0, 2, _("From"));
232  m_gridPowerFlow->SetCellValue(0, 3, _("To"));
233  m_gridPowerFlow->SetCellEditor(0, 4, new wxGridCellChoiceEditor(m_activePowerChoices));
234  m_gridPowerFlow->SetCellValue(0, 4, m_activePowerChoices[3]);
235  m_gridPowerFlow->SetCellEditor(0, 5, new wxGridCellChoiceEditor(m_reactivePowerChoices));
236  m_gridPowerFlow->SetCellValue(0, 5, m_reactivePowerChoices[3]);
237  m_gridPowerFlow->SetCellValue(0, 6, _("Online"));
238 
239  // Power flow buses
240  m_gridPFBuses->SetCellValue(0, 0, _("Name"));
241  m_gridPFBuses->SetCellValue(0, 1, _("Type"));
242  m_gridPFBuses->SetCellEditor(0, 2, new wxGridCellChoiceEditor(m_voltageChoices));
243  m_gridPFBuses->SetCellValue(0, 2, m_voltageChoices[0]);
244  m_gridPFBuses->SetCellValue(0, 3, _("Angle"));
245  m_gridPFBuses->SetCellEditor(0, 4, new wxGridCellChoiceEditor(m_activePowerChoices));
246  m_gridPFBuses->SetCellValue(0, 4, m_activePowerChoices[3]);
247  m_gridPFBuses->SetCellEditor(0, 5, new wxGridCellChoiceEditor(m_reactivePowerChoices));
248  m_gridPFBuses->SetCellValue(0, 5, m_reactivePowerChoices[3]);
249 
250  // Power flow branches
251  m_gridPFBranches->SetCellValue(0, 0, _("Type"));
252  m_gridPFBranches->SetCellValue(0, 1, _("Name"));
253  m_gridPFBranches->SetCellValue(0, 2, _("From"));
254  m_gridPFBranches->SetCellValue(0, 3, _("To"));
255  m_gridPFBranches->SetCellEditor(0, 4, new wxGridCellChoiceEditor(m_resistanceChoices));
256  m_gridPFBranches->SetCellValue(0, 4, m_resistanceChoices[0]);
257  m_gridPFBranches->SetCellEditor(0, 5, new wxGridCellChoiceEditor(m_indReactanceChoices));
258  m_gridPFBranches->SetCellValue(0, 5, m_indReactanceChoices[0]);
259  m_gridPFBranches->SetCellEditor(0, 6, new wxGridCellChoiceEditor(m_capSusceptanceChoices));
260  m_gridPFBranches->SetCellValue(0, 6, m_capSusceptanceChoices[0]);
261  m_gridPFBranches->SetCellValue(0, 7, _("TAP"));
262  m_gridPFBranches->SetCellValue(0, 8, _("Phase Shift"));
263  m_gridPFBranches->SetCellValue(0, 9, _("Online"));
264 
265  // Fault
266  m_gridFault->SetCellValue(0, 0, _("Fault bus name"));
267  m_gridFault->SetCellValue(0, 1, _("Phase A"));
268  m_gridFault->SetCellValue(0, 3, _("Phase B"));
269  m_gridFault->SetCellValue(0, 5, _("Phase C"));
270  m_gridFault->SetCellEditor(1, 1, new wxGridCellChoiceEditor(m_currentChoices));
271  m_gridFault->SetCellValue(1, 1, m_currentChoices[1]);
272  m_gridFault->SetCellValue(1, 2, _("Angle"));
273  m_gridFault->SetCellEditor(1, 3, new wxGridCellChoiceEditor(m_currentChoices));
274  m_gridFault->SetCellValue(1, 3, m_currentChoices[1]);
275  m_gridFault->SetCellValue(1, 4, _("Angle"));
276  m_gridFault->SetCellEditor(1, 5, new wxGridCellChoiceEditor(m_currentChoices));
277  m_gridFault->SetCellValue(1, 5, m_currentChoices[1]);
278  m_gridFault->SetCellValue(1, 6, _("Angle"));
279 
280  // Fault buses
281  m_gridFaultBuses->SetCellValue(0, 0, _("Name"));
282  m_gridFaultBuses->SetCellValue(0, 1, _("Phase A"));
283  m_gridFaultBuses->SetCellValue(0, 3, _("Phase B"));
284  m_gridFaultBuses->SetCellValue(0, 5, _("Phase C"));
285  m_gridFaultBuses->SetCellEditor(1, 1, new wxGridCellChoiceEditor(m_voltageChoices));
286  m_gridFaultBuses->SetCellValue(1, 1, m_voltageChoices[0]);
287  m_gridFaultBuses->SetCellValue(1, 2, _("Angle"));
288  m_gridFaultBuses->SetCellEditor(1, 3, new wxGridCellChoiceEditor(m_voltageChoices));
289  m_gridFaultBuses->SetCellValue(1, 3, m_voltageChoices[0]);
290  m_gridFaultBuses->SetCellValue(1, 4, _("Angle"));
291  m_gridFaultBuses->SetCellEditor(1, 5, new wxGridCellChoiceEditor(m_voltageChoices));
292  m_gridFaultBuses->SetCellValue(1, 5, m_voltageChoices[0]);
293  m_gridFaultBuses->SetCellValue(1, 6, _("Angle"));
294 
295  // Fault branches
296  m_gridFaultBranches->SetCellValue(0, 0, _("Type"));
297  m_gridFaultBranches->SetCellValue(0, 1, _("Name"));
298  m_gridFaultBranches->SetCellValue(0, 2, _("From"));
299  m_gridFaultBranches->SetCellValue(0, 3, _("To"));
300  m_gridFaultBranches->SetCellValue(0, 4, _("Phase A"));
301  m_gridFaultBranches->SetCellValue(0, 6, _("Phase B"));
302  m_gridFaultBranches->SetCellValue(0, 8, _("Phase C"));
303  m_gridFaultBranches->SetCellValue(0, 10, _("Online"));
304  m_gridFaultBranches->SetCellEditor(1, 4, new wxGridCellChoiceEditor(m_currentChoices));
305  m_gridFaultBranches->SetCellValue(1, 4, m_currentChoices[1]);
306  m_gridFaultBranches->SetCellValue(1, 5, _("Angle"));
307  m_gridFaultBranches->SetCellEditor(1, 6, new wxGridCellChoiceEditor(m_currentChoices));
308  m_gridFaultBranches->SetCellValue(1, 6, m_currentChoices[1]);
309  m_gridFaultBranches->SetCellValue(1, 7, _("Angle"));
310  m_gridFaultBranches->SetCellEditor(1, 8, new wxGridCellChoiceEditor(m_currentChoices));
311  m_gridFaultBranches->SetCellValue(1, 8, m_currentChoices[1]);
312  m_gridFaultBranches->SetCellValue(1, 9, _("Angle"));
313 
314  // Fault generators
315  m_gridFaultGenerators->SetCellValue(0, 0, _("Name"));
316  m_gridFaultGenerators->SetCellValue(0, 1, _("Phase A"));
317  m_gridFaultGenerators->SetCellValue(0, 3, _("Phase B"));
318  m_gridFaultGenerators->SetCellValue(0, 5, _("Phase C"));
319  m_gridFaultGenerators->SetCellEditor(1, 1, new wxGridCellChoiceEditor(m_currentChoices));
320  m_gridFaultGenerators->SetCellValue(1, 1, m_currentChoices[1]);
321  m_gridFaultGenerators->SetCellValue(1, 2, _("Angle"));
322  m_gridFaultGenerators->SetCellEditor(1, 3, new wxGridCellChoiceEditor(m_currentChoices));
323  m_gridFaultGenerators->SetCellValue(1, 3, m_currentChoices[1]);
324  m_gridFaultGenerators->SetCellValue(1, 4, _("Angle"));
325  m_gridFaultGenerators->SetCellEditor(1, 5, new wxGridCellChoiceEditor(m_currentChoices));
326  m_gridFaultGenerators->SetCellValue(1, 5, m_currentChoices[1]);
327  m_gridFaultGenerators->SetCellValue(1, 6, _("Angle"));
328 }
329 
330 void DataReport::FillValues(GridSelection gridToFill)
331 {
332  m_changingValues = true;
333  ElectricCalculation eCalc;
334  eCalc.GetElementsFromList(m_workspace->GetElementList());
335 
336  double basePower = m_workspace->GetProperties()->GetSimulationPropertiesData().basePower;
337  switch(m_workspace->GetProperties()->GetSimulationPropertiesData().basePowerUnit) {
338  case UNIT_kVA: {
339  basePower *= 1e3;
340  } break;
341  case UNIT_MVA: {
342  basePower *= 1e6;
343  } break;
344  default:
345  break;
346  }
347 
348  int rowNumber = 1;
349  auto lineList = eCalc.GetLineList();
350  auto transformerList = eCalc.GetTransformerList();
351  auto busList = eCalc.GetBusList();
352  auto generatorList = eCalc.GetSyncGeneratorList();
353 
354  // Power Flow
355  if(gridToFill == GRID_ALL || gridToFill == GRID_PF) {
356  double kActivePower = 1.0;
357  if(m_gridPowerFlow->GetCellValue(0, 4) == m_activePowerChoices[1])
358  kActivePower = basePower;
359  else if(m_gridPowerFlow->GetCellValue(0, 4) == m_activePowerChoices[2])
360  kActivePower = basePower / 1e3;
361  else if(m_gridPowerFlow->GetCellValue(0, 4) == m_activePowerChoices[3])
362  kActivePower = basePower / 1e6;
363 
364  double kReactivePower = 1.0;
365  if(m_gridPowerFlow->GetCellValue(0, 5) == m_reactivePowerChoices[1])
366  kReactivePower = basePower;
367  else if(m_gridPowerFlow->GetCellValue(0, 5) == m_reactivePowerChoices[2])
368  kReactivePower = basePower / 1e3;
369  else if(m_gridPowerFlow->GetCellValue(0, 5) == m_reactivePowerChoices[3])
370  kReactivePower = basePower / 1e6;
371 
372  for(auto it = lineList.begin(), itEnd = lineList.end(); it != itEnd; ++it) {
373  Line* line = *it;
374 
375  wxString busName1 = "-";
376  if(line->GetParentList()[0])
377  busName1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().name;
378  wxString busName2 = "-";
379  if(line->GetParentList()[1])
380  busName2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().name;
381 
382  wxString isOnline = _("Yes");
383  wxColour textColour = m_gridPowerFlow->GetDefaultCellTextColour();
384  if(!line->IsOnline()) {
385  isOnline = _("No");
386  textColour = m_offlineColour;
387  }
388  for(int i = 0; i < 2; ++i) {
389  for(int j = 0; j < 7; ++j) {
390  m_gridPowerFlow->SetCellTextColour(rowNumber + i, j, textColour);
391  }
392  }
393 
394  m_gridPowerFlow->SetCellValue(rowNumber, 9, isOnline);
395  auto data = line->GetPUElectricalData(basePower);
396 
397  m_gridPowerFlow->SetCellValue(rowNumber, 0, _("Line"));
398  m_gridPowerFlow->SetCellValue(rowNumber, 1, data.name);
399  m_gridPowerFlow->SetCellValue(rowNumber, 2, busName1);
400  m_gridPowerFlow->SetCellValue(rowNumber, 3, busName2);
401  m_gridPowerFlow->SetCellValue(rowNumber, 4,
402  line->StringFromDouble(std::real(data.powerFlow[0]) * kActivePower));
403  m_gridPowerFlow->SetCellValue(rowNumber, 5,
404  line->StringFromDouble(std::imag(data.powerFlow[0]) * kReactivePower));
405  m_gridPowerFlow->SetCellValue(rowNumber, 6, isOnline);
406  rowNumber++;
407 
408  m_gridPowerFlow->SetCellValue(rowNumber, 0, _("Line"));
409  m_gridPowerFlow->SetCellValue(rowNumber, 1, data.name);
410  m_gridPowerFlow->SetCellValue(rowNumber, 2, busName2);
411  m_gridPowerFlow->SetCellValue(rowNumber, 3, busName1);
412  m_gridPowerFlow->SetCellValue(rowNumber, 4,
413  line->StringFromDouble(std::real(data.powerFlow[1]) * kActivePower));
414  m_gridPowerFlow->SetCellValue(rowNumber, 5,
415  line->StringFromDouble(std::imag(data.powerFlow[1]) * kReactivePower));
416  m_gridPowerFlow->SetCellValue(rowNumber, 6, isOnline);
417  rowNumber++;
418  }
419 
420  for(auto it = transformerList.begin(), itEnd = transformerList.end(); it != itEnd; ++it) {
421  Transformer* transformer = *it;
422  auto data = transformer->GetPUElectricalData(basePower);
423 
424  wxString busName1 = "-";
425  if(transformer->GetParentList()[0])
426  busName1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().name;
427  wxString busName2 = "-";
428  if(transformer->GetParentList()[1])
429  busName2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().name;
430 
431  wxString isOnline = _("Yes");
432  wxColour textColour = m_gridPowerFlow->GetDefaultCellTextColour();
433  if(!transformer->IsOnline()) {
434  isOnline = _("No");
435  textColour = m_offlineColour;
436  }
437  for(int i = 0; i < 2; ++i) {
438  for(int j = 0; j < 7; ++j) {
439  m_gridPowerFlow->SetCellTextColour(rowNumber + i, j, textColour);
440  }
441  }
442 
443  m_gridPowerFlow->SetCellValue(rowNumber, 0, _("Transformer"));
444  m_gridPowerFlow->SetCellValue(rowNumber, 1, data.name);
445  m_gridPowerFlow->SetCellValue(rowNumber, 2, busName1);
446  m_gridPowerFlow->SetCellValue(rowNumber, 3, busName2);
447  m_gridPowerFlow->SetCellValue(rowNumber, 4,
448  transformer->StringFromDouble(std::real(data.powerFlow[0]) * kActivePower));
449  m_gridPowerFlow->SetCellValue(rowNumber, 5,
450  transformer->StringFromDouble(std::imag(data.powerFlow[0]) * kReactivePower));
451  m_gridPowerFlow->SetCellValue(rowNumber, 6, isOnline);
452  rowNumber++;
453 
454  m_gridPowerFlow->SetCellValue(rowNumber, 0, _("Transformer"));
455  m_gridPowerFlow->SetCellValue(rowNumber, 1, data.name);
456  m_gridPowerFlow->SetCellValue(rowNumber, 2, busName2);
457  m_gridPowerFlow->SetCellValue(rowNumber, 3, busName1);
458  m_gridPowerFlow->SetCellValue(rowNumber, 4,
459  transformer->StringFromDouble(std::real(data.powerFlow[1]) * kActivePower));
460  m_gridPowerFlow->SetCellValue(rowNumber, 5,
461  transformer->StringFromDouble(std::imag(data.powerFlow[1]) * kReactivePower));
462  m_gridPowerFlow->SetCellValue(rowNumber, 6, isOnline);
463  rowNumber++;
464  }
465  m_gridPowerFlow->AutoSize();
466  }
467 
468  // Power Flow buses
469  if(gridToFill == GRID_ALL || gridToFill == GRID_PFBUSES) {
470  double kActivePower = 1.0;
471  if(m_gridPFBuses->GetCellValue(0, 4) == m_activePowerChoices[1])
472  kActivePower = basePower;
473  else if(m_gridPFBuses->GetCellValue(0, 4) == m_activePowerChoices[2])
474  kActivePower = basePower / 1e3;
475  else if(m_gridPFBuses->GetCellValue(0, 4) == m_activePowerChoices[3])
476  kActivePower = basePower / 1e6;
477 
478  double kReactivePower = 1.0;
479  if(m_gridPFBuses->GetCellValue(0, 5) == m_reactivePowerChoices[1])
480  kReactivePower = basePower;
481  else if(m_gridPFBuses->GetCellValue(0, 5) == m_reactivePowerChoices[2])
482  kReactivePower = basePower / 1e3;
483  else if(m_gridPFBuses->GetCellValue(0, 5) == m_reactivePowerChoices[3])
484  kReactivePower = basePower / 1e6;
485 
486  rowNumber = 1;
487  for(auto it = busList.begin(), itEnd = busList.end(); it != itEnd; ++it) {
488  Bus* bus = *it;
489  auto data = bus->GetElectricalData();
490 
491  double vb = std::abs(data.nominalVoltage);
492  if(data.nominalVoltageUnit == UNIT_kV) vb *= 1e3;
493  double kVoltage = 1.0;
494  if(m_gridPFBuses->GetCellValue(0, 2) == m_voltageChoices[1])
495  kVoltage = vb;
496  else if(m_gridPFBuses->GetCellValue(0, 2) == m_voltageChoices[2])
497  kVoltage = vb / 1e3;
498 
499  m_gridPFBuses->SetCellValue(rowNumber, 0, data.name);
500  wxString busTypeString = "";
501  switch(data.busType) {
502  case BUS_SLACK: {
503  busTypeString = _("Slack");
504  } break;
505  case BUS_PV: {
506  busTypeString = _("PV");
507  } break;
508  case BUS_PQ: {
509  busTypeString = _("PQ");
510  } break;
511  }
512  m_gridPFBuses->SetCellValue(rowNumber, 1, busTypeString);
513  m_gridPFBuses->SetCellValue(rowNumber, 2, bus->StringFromDouble(std::abs(data.voltage) * kVoltage));
514  m_gridPFBuses->SetCellValue(rowNumber, 3, bus->StringFromDouble(wxRadToDeg(std::arg(data.voltage))));
515  m_gridPFBuses->SetCellValue(rowNumber, 4, bus->StringFromDouble(std::real(data.power) * kActivePower));
516  m_gridPFBuses->SetCellValue(rowNumber, 5, bus->StringFromDouble(std::imag(data.power) * kReactivePower));
517  rowNumber++;
518  }
519  m_gridPFBuses->AutoSize();
520  }
521 
522  // Power flow branches
523  if(gridToFill == GRID_ALL || gridToFill == GRID_PFBRANCHES) {
524  rowNumber = 1;
525  for(auto it = lineList.begin(), itEnd = lineList.end(); it != itEnd; ++it) {
526  Line* line = *it;
527  auto data = line->GetPUElectricalData(basePower);
528 
529  double vb = data.nominalVoltage;
530  if(data.nominalVoltageUnit == UNIT_kV) vb *= 1e3;
531  double zb = (vb * vb) / basePower;
532 
533  wxString busName1 = "-";
534  if(line->GetParentList()[0])
535  busName1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().name;
536  wxString busName2 = "-";
537  if(line->GetParentList()[1])
538  busName2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().name;
539  wxString isOnline = _("Yes");
540  wxColour textColour = m_gridPFBranches->GetDefaultCellTextColour();
541  if(!line->IsOnline()) {
542  isOnline = _("No");
543  textColour = m_offlineColour;
544  }
545  for(int j = 0; j < 10; ++j) {
546  m_gridPFBranches->SetCellTextColour(rowNumber, j, textColour);
547  }
548 
549  m_gridPFBranches->SetCellValue(rowNumber, 0, _("Line"));
550  m_gridPFBranches->SetCellValue(rowNumber, 1, data.name);
551 
552  m_gridPFBranches->SetCellValue(rowNumber, 2, busName1);
553  m_gridPFBranches->SetCellValue(rowNumber, 3, busName2);
554 
555  double k = 1.0;
556  if(m_gridPFBranches->GetCellValue(0, 4) == m_resistanceChoices[1]) k = zb;
557  m_gridPFBranches->SetCellValue(rowNumber, 4, line->StringFromDouble(data.resistance * k));
558  k = 1.0;
559  if(m_gridPFBranches->GetCellValue(0, 5) == m_indReactanceChoices[1]) k = zb;
560  m_gridPFBranches->SetCellValue(rowNumber, 5, line->StringFromDouble(data.indReactance * k));
561  k = 1.0;
562  if(m_gridPFBranches->GetCellValue(0, 6) == m_capSusceptanceChoices[1]) k = zb;
563  m_gridPFBranches->SetCellValue(rowNumber, 6, line->StringFromDouble(data.capSusceptance / k));
564  m_gridPFBranches->SetCellValue(rowNumber, 7, "-");
565  m_gridPFBranches->SetCellValue(rowNumber, 8, "-");
566  m_gridPFBranches->SetCellValue(rowNumber, 9, isOnline);
567  rowNumber++;
568  }
569  for(auto it = transformerList.begin(), itEnd = transformerList.end(); it != itEnd; ++it) {
570  Transformer* transformer = *it;
571  auto data = transformer->GetPUElectricalData(basePower);
572 
573  double vb = 0.0;
574  if(data.baseVoltage == 0) {
575  vb = data.primaryNominalVoltage;
576  if(data.primaryNominalVoltageUnit == UNIT_kV) vb *= 1e3;
577  } else {
578  vb = data.secondaryNominalVoltage;
579  if(data.secondaryNominalVoltageUnit == UNIT_kV) vb *= 1e3;
580  }
581  double zb = (vb * vb) / basePower;
582 
583  wxString busName1 = "-";
584  if(transformer->GetParentList()[0])
585  busName1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().name;
586  wxString busName2 = "-";
587  if(transformer->GetParentList()[1])
588  busName2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().name;
589 
590  wxString isOnline = _("Yes");
591  wxColour textColour = m_gridPFBranches->GetDefaultCellTextColour();
592  if(!transformer->IsOnline()) {
593  isOnline = _("No");
594  textColour = m_offlineColour;
595  }
596  for(int j = 0; j < 10; ++j) {
597  m_gridPFBranches->SetCellTextColour(rowNumber, j, textColour);
598  }
599 
600  m_gridPFBranches->SetCellValue(rowNumber, 0, _("Transformer"));
601  m_gridPFBranches->SetCellValue(rowNumber, 1, data.name);
602  m_gridPFBranches->SetCellValue(rowNumber, 2, busName1);
603  m_gridPFBranches->SetCellValue(rowNumber, 3, busName2);
604 
605  double k = 1.0;
606  if(m_gridPFBranches->GetCellValue(0, 4) == m_resistanceChoices[1]) k = zb;
607  m_gridPFBranches->SetCellValue(rowNumber, 4, transformer->StringFromDouble(data.resistance * k));
608  k = 1.0;
609  if(m_gridPFBranches->GetCellValue(0, 5) == m_indReactanceChoices[1]) k = zb;
610  m_gridPFBranches->SetCellValue(rowNumber, 5, transformer->StringFromDouble(data.indReactance * k));
611  m_gridPFBranches->SetCellValue(rowNumber, 6, "-");
612  m_gridPFBranches->SetCellValue(rowNumber, 7, transformer->StringFromDouble(data.turnsRatio));
613  m_gridPFBranches->SetCellValue(rowNumber, 8, transformer->StringFromDouble(data.phaseShift));
614  m_gridPFBranches->SetCellValue(rowNumber, 9, isOnline);
615  rowNumber++;
616  }
617  m_gridPFBranches->AutoSize();
618  }
619 
620  // Fault
621  if(gridToFill == GRID_ALL || gridToFill == GRID_FAULT) {
622  rowNumber = 2;
623  for(auto it = busList.begin(), itEnd = busList.end(); it != itEnd; ++it) {
624  Bus* bus = *it;
625  auto data = bus->GetElectricalData();
626  if(data.hasFault) {
627  double vb = bus->GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
628  double ib = basePower / (std::sqrt(3.0) * vb);
629 
630  m_gridFault->SetCellValue(rowNumber, 0, data.name);
631 
632  double kCurrent = 1.0;
633  if(m_gridFault->GetCellValue(1, 1) == m_currentChoices[1]) {
634  kCurrent = ib;
635  } else if(m_gridFault->GetCellValue(1, 1) == m_currentChoices[2]) {
636  kCurrent = ib / 1e3;
637  }
638  m_gridFault->SetCellValue(rowNumber, 1,
639  bus->StringFromDouble(std::abs(data.faultCurrent[0]) * kCurrent));
640 
641  m_gridFault->SetCellValue(rowNumber, 2,
642  bus->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0]))));
643 
644  kCurrent = 1.0;
645  if(m_gridFault->GetCellValue(1, 3) == m_currentChoices[1]) {
646  kCurrent = ib;
647  } else if(m_gridFault->GetCellValue(1, 3) == m_currentChoices[2]) {
648  kCurrent = ib / 1e3;
649  }
650  m_gridFault->SetCellValue(rowNumber, 3,
651  bus->StringFromDouble(std::abs(data.faultCurrent[1]) * kCurrent));
652 
653  m_gridFault->SetCellValue(rowNumber, 4,
654  bus->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1]))));
655 
656  kCurrent = 1.0;
657  if(m_gridFault->GetCellValue(1, 5) == m_currentChoices[1]) {
658  kCurrent = ib;
659  } else if(m_gridFault->GetCellValue(1, 5) == m_currentChoices[2]) {
660  kCurrent = ib / 1e3;
661  }
662  m_gridFault->SetCellValue(rowNumber, 5,
663  bus->StringFromDouble(std::abs(data.faultCurrent[2]) * kCurrent));
664 
665  m_gridFault->SetCellValue(rowNumber, 6,
666  bus->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[2]))));
667 
668  rowNumber++;
669  }
670  }
671  m_gridFault->AutoSize();
672  }
673 
674  // Fault buses
675  if(gridToFill == GRID_ALL || gridToFill == GRID_FAULTBUSES) {
676  rowNumber = 2;
677  for(auto it = busList.begin(), itEnd = busList.end(); it != itEnd; ++it) {
678  Bus* bus = *it;
679  auto data = bus->GetElectricalData();
680  double vb = bus->GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
681 
682  m_gridFaultBuses->SetCellValue(rowNumber, 0, data.name);
683  double kVoltage = 1.0;
684  if(m_gridFaultBuses->GetCellValue(1, 1) == m_voltageChoices[1]) {
685  kVoltage = vb;
686  } else if(m_gridFaultBuses->GetCellValue(1, 1) == m_voltageChoices[2]) {
687  kVoltage = vb / 1e3;
688  }
689  m_gridFaultBuses->SetCellValue(rowNumber, 1,
690  bus->StringFromDouble(std::abs(data.faultVoltage[0]) * kVoltage));
691  m_gridFaultBuses->SetCellValue(rowNumber, 2,
692  bus->StringFromDouble(wxRadToDeg(std::arg(data.faultVoltage[0]))));
693 
694  kVoltage = 1.0;
695  if(m_gridFaultBuses->GetCellValue(1, 3) == m_voltageChoices[1]) {
696  kVoltage = vb;
697  } else if(m_gridFaultBuses->GetCellValue(1, 3) == m_voltageChoices[2]) {
698  kVoltage = vb / 1e3;
699  }
700  m_gridFaultBuses->SetCellValue(rowNumber, 3,
701  bus->StringFromDouble(std::abs(data.faultVoltage[1]) * kVoltage));
702  m_gridFaultBuses->SetCellValue(rowNumber, 4,
703  bus->StringFromDouble(wxRadToDeg(std::arg(data.faultVoltage[1]))));
704 
705  kVoltage = 1.0;
706  if(m_gridFaultBuses->GetCellValue(1, 5) == m_voltageChoices[1]) {
707  kVoltage = vb;
708  } else if(m_gridFaultBuses->GetCellValue(1, 5) == m_voltageChoices[2]) {
709  kVoltage = vb / 1e3;
710  }
711  m_gridFaultBuses->SetCellValue(rowNumber, 5,
712  bus->StringFromDouble(std::abs(data.faultVoltage[2]) * kVoltage));
713  m_gridFaultBuses->SetCellValue(rowNumber, 6,
714  bus->StringFromDouble(wxRadToDeg(std::arg(data.faultVoltage[2]))));
715 
716  rowNumber++;
717  }
718  m_gridFaultBuses->AutoSize();
719  }
720 
721  // Fault branches
722  if(gridToFill == GRID_ALL || gridToFill == GRID_FAULTBRANCHES) {
723  rowNumber = 2;
724  for(auto it = lineList.begin(), itEnd = lineList.end(); it != itEnd; ++it) {
725  Line* line = *it;
726  auto data = line->GetPUElectricalData(basePower);
727 
728  double vb = line->GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
729  double ib = basePower / (std::sqrt(3.0) * vb);
730 
731  wxString busName1 = "-";
732  if(line->GetParentList()[0])
733  busName1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().name;
734  wxString busName2 = "-";
735  if(line->GetParentList()[1])
736  busName2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().name;
737 
738  wxString isOnline = _("Yes");
739  wxColour textColour = m_gridFaultBranches->GetDefaultCellTextColour();
740  if(!line->IsOnline()) {
741  isOnline = _("No");
742  textColour = m_offlineColour;
743  }
744  for(int i = 0; i < 2; ++i) {
745  for(int j = 0; j < 11; ++j) {
746  m_gridFaultBranches->SetCellTextColour(rowNumber + i, j, textColour);
747  }
748  }
749 
750  m_gridFaultBranches->SetCellValue(rowNumber, 0, _("Line"));
751  m_gridFaultBranches->SetCellValue(rowNumber, 1, data.name);
752  m_gridFaultBranches->SetCellValue(rowNumber, 2, busName1);
753  m_gridFaultBranches->SetCellValue(rowNumber, 3, busName2);
754 
755  double kCurrent = 1.0;
756  if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[1]) {
757  kCurrent = ib;
758  } else if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[2]) {
759  kCurrent = ib / 1e3;
760  }
761  m_gridFaultBranches->SetCellValue(rowNumber, 4,
762  line->StringFromDouble(std::abs(data.faultCurrent[0][0]) * kCurrent));
763  m_gridFaultBranches->SetCellValue(rowNumber, 5,
764  line->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0][0]))));
765  kCurrent = 1.0;
766  if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[1]) {
767  kCurrent = ib;
768  } else if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[2]) {
769  kCurrent = ib / 1e3;
770  }
771  m_gridFaultBranches->SetCellValue(rowNumber, 6,
772  line->StringFromDouble(std::abs(data.faultCurrent[0][1]) * kCurrent));
773  m_gridFaultBranches->SetCellValue(rowNumber, 7,
774  line->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0][1]))));
775  kCurrent = 1.0;
776  if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[1]) {
777  kCurrent = ib;
778  } else if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[2]) {
779  kCurrent = ib / 1e3;
780  }
781  m_gridFaultBranches->SetCellValue(rowNumber, 8,
782  line->StringFromDouble(std::abs(data.faultCurrent[0][2]) * kCurrent));
783  m_gridFaultBranches->SetCellValue(rowNumber, 9,
784  line->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0][2]))));
785  m_gridFaultBranches->SetCellValue(rowNumber, 10, isOnline);
786  rowNumber++;
787 
788  m_gridFaultBranches->SetCellValue(rowNumber, 0, _("Line"));
789  m_gridFaultBranches->SetCellValue(rowNumber, 1, data.name);
790  m_gridFaultBranches->SetCellValue(rowNumber, 2, busName2);
791  m_gridFaultBranches->SetCellValue(rowNumber, 3, busName1);
792  kCurrent = 1.0;
793  if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[1]) {
794  kCurrent = ib;
795  } else if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[2]) {
796  kCurrent = ib / 1e3;
797  }
798  m_gridFaultBranches->SetCellValue(rowNumber, 4,
799  line->StringFromDouble(std::abs(data.faultCurrent[1][0]) * kCurrent));
800  m_gridFaultBranches->SetCellValue(rowNumber, 5,
801  line->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1][0]))));
802  kCurrent = 1.0;
803  if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[1]) {
804  kCurrent = ib;
805  } else if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[2]) {
806  kCurrent = ib / 1e3;
807  }
808  m_gridFaultBranches->SetCellValue(rowNumber, 6,
809  line->StringFromDouble(std::abs(data.faultCurrent[1][1]) * kCurrent));
810  m_gridFaultBranches->SetCellValue(rowNumber, 7,
811  line->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1][1]))));
812  kCurrent = 1.0;
813  if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[1]) {
814  kCurrent = ib;
815  } else if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[2]) {
816  kCurrent = ib / 1e3;
817  }
818  m_gridFaultBranches->SetCellValue(rowNumber, 8,
819  line->StringFromDouble(std::abs(data.faultCurrent[1][2]) * kCurrent));
820  m_gridFaultBranches->SetCellValue(rowNumber, 9,
821  line->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1][2]))));
822  m_gridFaultBranches->SetCellValue(rowNumber, 10, isOnline);
823  rowNumber++;
824  }
825 
826  for(auto it = transformerList.begin(), itEnd = transformerList.end(); it != itEnd; ++it) {
827  Transformer* transformer = *it;
828  auto data = transformer->GetPUElectricalData(basePower);
829 
830  double vb = transformer->GetValueFromUnit(data.primaryNominalVoltage, data.primaryNominalVoltageUnit);
831  double ibp = basePower / (std::sqrt(3.0) * vb);
832  vb = transformer->GetValueFromUnit(data.secondaryNominalVoltage, data.secondaryNominalVoltageUnit);
833  double ibs = basePower / (std::sqrt(3.0) * vb);
834 
835  wxString busName1 = "-";
836  if(transformer->GetParentList()[0])
837  busName1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().name;
838  wxString busName2 = "-";
839  if(transformer->GetParentList()[1])
840  busName2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().name;
841 
842  wxString isOnline = _("Yes");
843  wxColour textColour = m_gridFaultBranches->GetDefaultCellTextColour();
844  if(!transformer->IsOnline()) {
845  isOnline = _("No");
846  textColour = m_offlineColour;
847  }
848  for(int i = 0; i < 2; ++i) {
849  for(int j = 0; j < 11; ++j) {
850  m_gridFaultBranches->SetCellTextColour(rowNumber + i, j, textColour);
851  }
852  }
853 
854  m_gridFaultBranches->SetCellValue(rowNumber, 0, _("Transformer"));
855  m_gridFaultBranches->SetCellValue(rowNumber, 1, data.name);
856  m_gridFaultBranches->SetCellValue(rowNumber, 2, busName1);
857  m_gridFaultBranches->SetCellValue(rowNumber, 3, busName2);
858 
859  double kCurrent = 1.0;
860  if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[1]) {
861  kCurrent = ibp;
862  } else if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[2]) {
863  kCurrent = ibp / 1e3;
864  }
865  m_gridFaultBranches->SetCellValue(
866  rowNumber, 4, transformer->StringFromDouble(std::abs(data.faultCurrent[0][0]) * kCurrent));
867  m_gridFaultBranches->SetCellValue(
868  rowNumber, 5, transformer->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0][0]))));
869  kCurrent = 1.0;
870  if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[1]) {
871  kCurrent = ibp;
872  } else if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[2]) {
873  kCurrent = ibp / 1e3;
874  }
875  m_gridFaultBranches->SetCellValue(
876  rowNumber, 6, transformer->StringFromDouble(std::abs(data.faultCurrent[0][1]) * kCurrent));
877  m_gridFaultBranches->SetCellValue(
878  rowNumber, 7, transformer->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0][1]))));
879  kCurrent = 1.0;
880  if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[1]) {
881  kCurrent = ibp;
882  } else if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[2]) {
883  kCurrent = ibp / 1e3;
884  }
885  m_gridFaultBranches->SetCellValue(
886  rowNumber, 8, transformer->StringFromDouble(std::abs(data.faultCurrent[0][2]) * kCurrent));
887  m_gridFaultBranches->SetCellValue(
888  rowNumber, 9, transformer->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0][2]))));
889  m_gridFaultBranches->SetCellValue(rowNumber, 10, isOnline);
890  rowNumber++;
891 
892  m_gridFaultBranches->SetCellValue(rowNumber, 0, _("Transformer"));
893  m_gridFaultBranches->SetCellValue(rowNumber, 1, data.name);
894  m_gridFaultBranches->SetCellValue(rowNumber, 2, busName2);
895  m_gridFaultBranches->SetCellValue(rowNumber, 3, busName1);
896  kCurrent = 1.0;
897  if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[1]) {
898  kCurrent = ibs;
899  } else if(m_gridFaultBranches->GetCellValue(1, 4) == m_currentChoices[2]) {
900  kCurrent = ibs / 1e3;
901  }
902  m_gridFaultBranches->SetCellValue(
903  rowNumber, 4, transformer->StringFromDouble(std::abs(data.faultCurrent[1][0]) * kCurrent));
904  m_gridFaultBranches->SetCellValue(
905  rowNumber, 5, transformer->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1][0]))));
906  kCurrent = 1.0;
907  if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[1]) {
908  kCurrent = ibs;
909  } else if(m_gridFaultBranches->GetCellValue(1, 6) == m_currentChoices[2]) {
910  kCurrent = ibs / 1e3;
911  }
912  m_gridFaultBranches->SetCellValue(
913  rowNumber, 6, transformer->StringFromDouble(std::abs(data.faultCurrent[1][1]) * kCurrent));
914  m_gridFaultBranches->SetCellValue(
915  rowNumber, 7, transformer->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1][1]))));
916  kCurrent = 1.0;
917  if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[1]) {
918  kCurrent = ibs;
919  } else if(m_gridFaultBranches->GetCellValue(1, 8) == m_currentChoices[2]) {
920  kCurrent = ibs / 1e3;
921  }
922  m_gridFaultBranches->SetCellValue(
923  rowNumber, 8, transformer->StringFromDouble(std::abs(data.faultCurrent[1][2]) * kCurrent));
924  m_gridFaultBranches->SetCellValue(
925  rowNumber, 9, transformer->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1][2]))));
926  m_gridFaultBranches->SetCellValue(rowNumber, 10, isOnline);
927  rowNumber++;
928  }
929 
930  m_gridFaultBranches->AutoSize();
931  }
932 
933  // Fault generators
934  if(gridToFill == GRID_ALL || gridToFill == GRID_FAULTGENERATORS) {
935  rowNumber = 2;
936  for(auto it = generatorList.begin(), itEnd = generatorList.end(); it != itEnd; ++it) {
937  SyncGenerator* generator = *it;
938  auto data = generator->GetPUElectricalData(basePower);
939  double vb = generator->GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
940  double ib = basePower / (std::sqrt(3.0) * vb);
941 
942  m_gridFaultGenerators->SetCellValue(rowNumber, 0, data.name);
943 
944  double kCurrent = 1.0;
945  if(m_gridFaultGenerators->GetCellValue(1, 1) == m_currentChoices[1])
946  kCurrent = ib;
947  else if(m_gridFaultGenerators->GetCellValue(1, 1) == m_currentChoices[2])
948  kCurrent = ib / 1e3;
949  m_gridFaultGenerators->SetCellValue(rowNumber, 1,
950  generator->StringFromDouble(std::abs(data.faultCurrent[0]) * kCurrent));
951  m_gridFaultGenerators->SetCellValue(
952  rowNumber, 2, generator->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[0]))));
953 
954  kCurrent = 1.0;
955  if(m_gridFaultGenerators->GetCellValue(1, 3) == m_currentChoices[1])
956  kCurrent = ib;
957  else if(m_gridFaultGenerators->GetCellValue(1, 3) == m_currentChoices[2])
958  kCurrent = ib / 1e3;
959  m_gridFaultGenerators->SetCellValue(rowNumber, 3,
960  generator->StringFromDouble(std::abs(data.faultCurrent[1]) * kCurrent));
961  m_gridFaultGenerators->SetCellValue(
962  rowNumber, 4, generator->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[1]))));
963 
964  kCurrent = 1.0;
965  if(m_gridFaultGenerators->GetCellValue(1, 5) == m_currentChoices[1])
966  kCurrent = ib;
967  else if(m_gridFaultGenerators->GetCellValue(1, 5) == m_currentChoices[2])
968  kCurrent = ib / 1e3;
969  m_gridFaultGenerators->SetCellValue(rowNumber, 5,
970  generator->StringFromDouble(std::abs(data.faultCurrent[2]) * kCurrent));
971  m_gridFaultGenerators->SetCellValue(
972  rowNumber, 6, generator->StringFromDouble(wxRadToDeg(std::arg(data.faultCurrent[2]))));
973 
974  rowNumber++;
975  }
976  m_gridFaultGenerators->AutoSize();
977  }
978  m_changingValues = false;
979 }
980 
981 void DataReport::SetRowsColours(wxGrid* grid, int rowStart)
982 {
983  for(int i = rowStart; i < grid->GetNumberRows(); ++i) {
984  wxGridCellAttr* attr = grid->GetOrCreateCellAttr(i, 0);
985  if((i - rowStart) % 2 == 0)
986  attr->SetBackgroundColour(m_evenRowColour);
987  else
988  attr->SetBackgroundColour(m_oddRowColour);
989  grid->SetRowAttr(i, attr);
990  }
991 }
992 
993 void DataReport::OnPFBusGridChanged(wxGridEvent& event)
994 {
995  if(!m_changingValues) FillValues(GRID_PFBUSES);
996 }
997 void DataReport::OnFaulrGridChanged(wxGridEvent& event)
998 {
999  if(!m_changingValues) FillValues(GRID_FAULT);
1000 }
1001 void DataReport::OnFaultBranchesGridChanged(wxGridEvent& event)
1002 {
1003  if(!m_changingValues) FillValues(GRID_FAULTBRANCHES);
1004 }
1005 void DataReport::OnFaultBusesGridChanged(wxGridEvent& event)
1006 {
1007  if(!m_changingValues) FillValues(GRID_FAULTBUSES);
1008 }
1009 void DataReport::OnFaultGeneratorsGridChanged(wxGridEvent& event)
1010 {
1011  if(!m_changingValues) FillValues(GRID_FAULTGENERATORS);
1012 }
1013 void DataReport::OnPFBranchesGridChanged(wxGridEvent& event)
1014 {
1015  if(!m_changingValues) FillValues(GRID_PFBRANCHES);
1016 }
1017 void DataReport::OnPowerFlowGridChanged(wxGridEvent& event)
1018 {
1019  if(!m_changingValues) FillValues(GRID_PF);
1020 }
const std::vector< Transformer * > GetTransformerList() const
Get the transformers of the system (use GetElementsFromList first).
+ +
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:506
+
Base class of electric calculations, with general methods.
- - -
const std::vector< Bus * > GetBusList() const
Get the buses of the system (use GetElementsFromList first).
-
const std::vector< SyncGenerator * > GetSyncGeneratorList() const
Get the synchronous generators of the system (use GetElementsFromList first).
-
Definition: Bus.h:45
-
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:219
- -
Definition: Line.h:35
+ + +
const std::vector< Bus * > GetBusList() const
Get the buses of the system (use GetElementsFromList first).
+
const std::vector< SyncGenerator * > GetSyncGeneratorList() const
Get the synchronous generators of the system (use GetElementsFromList first).
+
Definition: Bus.h:62
+
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:227
+ +
Definition: Line.h:52
-
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:300
-
virtual void GetElementsFromList(std::vector< Element *> elementList)
Separate the power elements from a generic list.
- - - -
const std::vector< Line * > GetLineList() const
Get the lines of the system (use GetElementsFromList first).
- +
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:320
+
virtual void GetElementsFromList(std::vector< Element *> elementList)
Separate the power elements from a generic list.
+ +
This class manages the graphical and power elements. It is responsible for handling the user&#39;s intera...
Definition: Workspace.h:81
+ +
const std::vector< Line * > GetLineList() const
Get the lines of the system (use GetElementsFromList first).
+
diff --git a/docs/doxygen/html/_data_report_8h.html b/docs/doxygen/html/_data_report_8h.html new file mode 100644 index 0000000..9ffd33b --- /dev/null +++ b/docs/doxygen/html/_data_report_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/DataReport.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
DataReport.h File Reference
+
+
+
#include "DataReportBase.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  DataReport
 Form that shows the results of power flow and fault calculations. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_data_report_8h_source.html b/docs/doxygen/html/_data_report_8h_source.html index 314265a..b16cf97 100644 --- a/docs/doxygen/html/_data_report_8h_source.html +++ b/docs/doxygen/html/_data_report_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,16 +88,16 @@ $(document).ready(function(){initNavTree('_data_report_8h_source.html','');});
DataReport.h
-
1 #ifndef DATAREPORT_H
2 #define DATAREPORT_H
3 
4 #include "DataReportBase.h"
5 
6 class Workspace;
8 
9 class DataReport : public DataReportBase
10 {
11  public:
12  enum GridSelection {
13  GRID_ALL = 0,
14  GRID_PF,
15  GRID_PFBUSES,
16  GRID_PFBRANCHES,
17  GRID_FAULT,
18  GRID_FAULTBUSES,
19  GRID_FAULTBRANCHES,
20  GRID_FAULTGENERATORS,
21  };
22 
23  DataReport(wxWindow* parent, Workspace* workspace);
24  virtual ~DataReport();
25 
26  virtual void SetHeaders();
27  virtual void CreateGrids();
28  virtual void FillValues(GridSelection gridToFill = GRID_ALL);
29  virtual void SetRowsColours(wxGrid* grid, int rowStart = 1);
30 
31  protected:
32  virtual void OnFaulrGridChanged(wxGridEvent& event);
33  virtual void OnFaultBranchesGridChanged(wxGridEvent& event);
34  virtual void OnFaultBusesGridChanged(wxGridEvent& event);
35  virtual void OnFaultGeneratorsGridChanged(wxGridEvent& event);
36  virtual void OnPFBranchesGridChanged(wxGridEvent& event);
37  virtual void OnPowerFlowGridChanged(wxGridEvent& event);
38  virtual void OnPFBusGridChanged(wxGridEvent& event);
39  Workspace* m_workspace = NULL;
40  bool m_changingValues = false;
41 
42  // Headers choices
43  wxArrayString m_voltageChoices;
44  wxArrayString m_activePowerChoices;
45  wxArrayString m_reactivePowerChoices;
46  wxArrayString m_resistanceChoices;
47  wxArrayString m_indReactanceChoices;
48  wxArrayString m_capSusceptanceChoices;
49  wxArrayString m_currentChoices;
50 
51  // Colors
52  wxColour m_headerColour;
53  wxColour m_offlineColour;
54  wxColour m_oddRowColour;
55  wxColour m_evenRowColour;
56 };
57 #endif // DATAREPORT_H
- - - +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef DATAREPORT_H
19 #define DATAREPORT_H
20 
21 #include "DataReportBase.h"
22 
23 class Workspace;
25 
33 class DataReport : public DataReportBase
34 {
35  public:
36  enum GridSelection {
37  GRID_ALL = 0,
38  GRID_PF,
39  GRID_PFBUSES,
40  GRID_PFBRANCHES,
41  GRID_FAULT,
42  GRID_FAULTBUSES,
43  GRID_FAULTBRANCHES,
44  GRID_FAULTGENERATORS,
45  };
46 
47  DataReport(wxWindow* parent, Workspace* workspace);
48  virtual ~DataReport();
49 
50  virtual void SetHeaders();
51  virtual void CreateGrids();
52  virtual void FillValues(GridSelection gridToFill = GRID_ALL);
53  virtual void SetRowsColours(wxGrid* grid, int rowStart = 1);
54 
55  protected:
56  virtual void OnFaulrGridChanged(wxGridEvent& event);
57  virtual void OnFaultBranchesGridChanged(wxGridEvent& event);
58  virtual void OnFaultBusesGridChanged(wxGridEvent& event);
59  virtual void OnFaultGeneratorsGridChanged(wxGridEvent& event);
60  virtual void OnPFBranchesGridChanged(wxGridEvent& event);
61  virtual void OnPowerFlowGridChanged(wxGridEvent& event);
62  virtual void OnPFBusGridChanged(wxGridEvent& event);
63  Workspace* m_workspace = NULL;
64  bool m_changingValues = false;
65 
66  // Headers choices
67  wxArrayString m_voltageChoices;
68  wxArrayString m_activePowerChoices;
69  wxArrayString m_reactivePowerChoices;
70  wxArrayString m_resistanceChoices;
71  wxArrayString m_indReactanceChoices;
72  wxArrayString m_capSusceptanceChoices;
73  wxArrayString m_currentChoices;
74 
75  // Colors
76  wxColour m_headerColour;
77  wxColour m_offlineColour;
78  wxColour m_oddRowColour;
79  wxColour m_evenRowColour;
80 };
81 #endif // DATAREPORT_H
+
Form that shows the results of power flow and fault calculations.
Definition: DataReport.h:33
+ +
This class manages the graphical and power elements. It is responsible for handling the user&#39;s intera...
Definition: Workspace.h:81
-
1 #include "ElectricCalculation.h"
2 #ifdef USING_WX_3_0_X
3 #include "DegreesAndRadians.h"
4 #endif
5 
8 void ElectricCalculation::GetElementsFromList(std::vector<Element*> elementList)
9 {
10  m_powerElementList.clear();
11  m_busList.clear();
12  m_capacitorList.clear();
13  m_indMotorList.clear();
14  m_inductorList.clear();
15  m_lineList.clear();
16  m_loadList.clear();
17  m_syncGeneratorList.clear();
18  m_syncMotorList.clear();
19  m_transformerList.clear();
20  // TODO: Bad design?
21  for(auto it = elementList.begin(); it != elementList.end(); it++) {
22  Element* element = *it;
23  m_powerElementList.push_back(static_cast<PowerElement*>(element));
24 
25  if(Bus* bus = dynamic_cast<Bus*>(element))
26  m_busList.push_back(bus);
27  else if(Capacitor* capacitor = dynamic_cast<Capacitor*>(element))
28  m_capacitorList.push_back(capacitor);
29  else if(IndMotor* indMotor = dynamic_cast<IndMotor*>(element))
30  m_indMotorList.push_back(indMotor);
31  else if(Inductor* inductor = dynamic_cast<Inductor*>(element))
32  m_inductorList.push_back(inductor);
33  else if(Line* line = dynamic_cast<Line*>(element))
34  m_lineList.push_back(line);
35  else if(Load* load = dynamic_cast<Load*>(element))
36  m_loadList.push_back(load);
37  else if(SyncGenerator* syncGenerator = dynamic_cast<SyncGenerator*>(element))
38  m_syncGeneratorList.push_back(syncGenerator);
39  else if(SyncMotor* syncMotor = dynamic_cast<SyncMotor*>(element))
40  m_syncMotorList.push_back(syncMotor);
41  else if(Transformer* transformer = dynamic_cast<Transformer*>(element))
42  m_transformerList.push_back(transformer);
43  }
44 
45  // Set buses numbers
46  int busNumber = 0;
47  for(auto itb = m_busList.begin(); itb != m_busList.end(); itb++) {
48  Bus* bus = *itb;
49  BusElectricalData data = bus->GetElectricalData();
50  data.number = busNumber;
51  bus->SetElectricalData(data);
52  busNumber++;
53  }
54 }
55 
56 bool ElectricCalculation::GetYBus(std::vector<std::vector<std::complex<double> > >& yBus,
57  double systemPowerBase,
58  YBusSequence sequence,
59  bool includeSyncMachines,
60  bool allLoadsAsImpedances)
61 {
62  if(m_busList.size() == 0) return false;
63 
64  // Clear and fill with zeros the Ybus
65  yBus.clear();
66  for(int i = 0; i < (int)m_busList.size(); i++) {
67  std::vector<std::complex<double> > line;
68  for(int j = 0; j < (int)m_busList.size(); j++) {
69  line.push_back(std::complex<double>(0.0, 0.0));
70  }
71  yBus.push_back(line);
72  }
73 
74  // Set buses numbers
75  int busNumber = 0;
76  for(auto itb = m_busList.begin(); itb != m_busList.end(); itb++) {
77  Bus* bus = *itb;
78  BusElectricalData data = bus->GetElectricalData();
79  data.number = busNumber;
80  bus->SetElectricalData(data);
81  busNumber++;
82  }
83 
84  // Load
85  for(auto it = m_loadList.begin(), itEnd = m_loadList.end(); it != itEnd; ++it) {
86  Load* load = *it;
87  if(load->IsOnline()) {
88  int n = static_cast<Bus*>(load->GetParentList()[0])->GetElectricalData().number;
89  LoadElectricalData data = load->GetPUElectricalData(systemPowerBase);
90  if(data.loadType == CONST_IMPEDANCE || allLoadsAsImpedances) {
91  std::complex<double> yLoad = std::complex<double>(data.activePower, -data.reactivePower);
92  if(allLoadsAsImpedances) {
93  std::complex<double> v = static_cast<Bus*>(load->GetParentList()[0])->GetElectricalData().voltage;
94  yLoad /= (std::abs(v) * std::abs(v));
95  }
96  yBus[n][n] += yLoad;
97  }
98  }
99  }
100 
101  // Capacitor
102  for(auto it = m_capacitorList.begin(), itEnd = m_capacitorList.end(); it != itEnd; ++it) {
103  Capacitor* capacitor = *it;
104  if(capacitor->IsOnline()) {
105  int n = static_cast<Bus*>(capacitor->GetParentList()[0])->GetElectricalData().number;
106  CapacitorElectricalData data = capacitor->GetPUElectricalData(systemPowerBase);
107  yBus[n][n] += std::complex<double>(0.0, data.reactivePower);
108  }
109  }
110 
111  // Inductor
112  for(auto it = m_inductorList.begin(), itEnd = m_inductorList.end(); it != itEnd; ++it) {
113  Inductor* inductor = *it;
114  if(inductor->IsOnline()) {
115  int n = static_cast<Bus*>(inductor->GetParentList()[0])->GetElectricalData().number;
116  InductorElectricalData data = inductor->GetPUElectricalData(systemPowerBase);
117  yBus[n][n] += std::complex<double>(0.0, -data.reactivePower);
118  }
119  }
120 
121  // Power line
122  for(auto it = m_lineList.begin(), itEnd = m_lineList.end(); it != itEnd; ++it) {
123  Line* line = *it;
124  if(line->IsOnline()) {
125  LineElectricalData data = line->GetPUElectricalData(systemPowerBase);
126 
127  int n1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().number;
128  int n2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().number;
129 
130  switch(sequence) {
131  case POSITIVE_SEQ:
132  case NEGATIVE_SEQ: {
133  yBus[n1][n2] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
134  yBus[n2][n1] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
135 
136  yBus[n1][n1] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
137  yBus[n2][n2] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
138 
139  yBus[n1][n1] += std::complex<double>(0.0, data.capSusceptance / 2.0);
140  yBus[n2][n2] += std::complex<double>(0.0, data.capSusceptance / 2.0);
141  } break;
142  case ZERO_SEQ: {
143  yBus[n1][n2] -= 1.0 / std::complex<double>(data.zeroResistance, data.zeroIndReactance);
144  yBus[n2][n1] -= 1.0 / std::complex<double>(data.zeroResistance, data.zeroIndReactance);
145 
146  yBus[n1][n1] += 1.0 / std::complex<double>(data.zeroResistance, data.zeroIndReactance);
147  yBus[n2][n2] += 1.0 / std::complex<double>(data.zeroResistance, data.zeroIndReactance);
148 
149  yBus[n1][n1] += std::complex<double>(0.0, data.zeroCapSusceptance / 2.0);
150  yBus[n2][n2] += std::complex<double>(0.0, data.zeroCapSusceptance / 2.0);
151  }
152  }
153  }
154  }
155 
156  // Transformer
157  for(auto it = m_transformerList.begin(), itEnd = m_transformerList.end(); it != itEnd; ++it) {
158  Transformer* transformer = *it;
159 
160  if(transformer->IsOnline()) {
161  TransformerElectricalData data = transformer->GetPUElectricalData(systemPowerBase);
162 
163  int n1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().number;
164  int n2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().number;
165 
166  // If the transformer have nominal turns ratio (1.0) and no phase shifting, it will be modelled as series
167  // impedance.
168  if(data.turnsRatio == 1.0 && data.phaseShift == 0.0 && sequence != ZERO_SEQ) {
169  yBus[n1][n2] += -1.0 / std::complex<double>(data.resistance, data.indReactance);
170  yBus[n2][n1] += -1.0 / std::complex<double>(data.resistance, data.indReactance);
171 
172  yBus[n1][n1] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
173  yBus[n2][n2] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
174  }
175  // If the transformer have no-nominal turn ratio and/or phase shifting, it will be modelled in a different
176  // way (see references).
177  //[Ref. 1: Elementos de analise de sistemas de potencia - Stevenson - pg. 232]
178  //[Ref. 2: http://www.ee.washington.edu/research/real/Library/Reports/Tap_Adjustments_in_AC_Load_Flows.pdf]
179  //[Ref. 3: http://www.columbia.edu/~dano/courses/power/notes/power/andersson1.pdf]
180  else if(sequence != ZERO_SEQ) {
181  // Complex turns ratio
182  double radPhaseShift = wxDegToRad(data.phaseShift);
183  std::complex<double> a = std::complex<double>(data.turnsRatio * std::cos(radPhaseShift),
184  -data.turnsRatio * std::sin(radPhaseShift));
185 
186  // Transformer admitance
187  std::complex<double> y = 1.0 / std::complex<double>(data.resistance, data.indReactance);
188 
189  if(sequence == POSITIVE_SEQ) {
190  yBus[n1][n1] += y / std::pow(std::abs(a), 2.0);
191  yBus[n1][n2] += -(y / std::conj(a));
192  yBus[n2][n1] += -(y / a);
193  yBus[n2][n2] += y;
194  } else if(sequence == NEGATIVE_SEQ) {
195  yBus[n1][n1] += y / std::pow(std::abs(a), 2.0);
196  yBus[n1][n2] += -(y / a);
197  yBus[n2][n1] += -(y / std::conj(a));
198  yBus[n2][n2] += y;
199  }
200  } else if(sequence == ZERO_SEQ) {
201  switch(data.connection) {
202  case GWYE_GWYE: {
203  std::complex<double> y =
204  1.0 /
205  std::complex<double>(
206  data.zeroResistance + 3.0 * (data.primaryGrndResistance + data.secondaryGrndResistance),
207  data.zeroIndReactance +
208  3.0 * (data.primaryGrndReactance + data.secondaryGrndReactance));
209  std::complex<double> a = std::complex<double>(data.turnsRatio, 0.0);
210 
211  yBus[n1][n1] += y / (a * a);
212  yBus[n1][n2] += -(y / a);
213  yBus[n2][n1] += -(y / a);
214  yBus[n2][n2] += y;
215  } break;
216  case DELTA_GWYE: {
217  std::complex<double> y =
218  1.0 / std::complex<double>(data.zeroResistance + 3.0 * (data.secondaryGrndResistance),
219  data.zeroIndReactance + 3.0 * (data.secondaryGrndReactance));
220  yBus[n2][n2] += y;
221  break;
222  }
223  case GWYE_DELTA: {
224  std::complex<double> y =
225  1.0 / std::complex<double>(data.zeroResistance + 3.0 * (data.primaryGrndResistance),
226  data.zeroIndReactance + 3.0 * (data.primaryGrndReactance));
227  yBus[n1][n1] += y;
228  break;
229  }
230  default:
231  break;
232  }
233  }
234  }
235  }
236 
237  if(includeSyncMachines) {
238  // Synchronous generator
239  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
240  SyncGenerator* syncGenerator = *it;
241  if(syncGenerator->IsOnline()) {
242  int n = static_cast<Bus*>(syncGenerator->GetParentList()[0])->GetElectricalData().number;
243  SyncGeneratorElectricalData data = syncGenerator->GetPUElectricalData(systemPowerBase);
244  switch(sequence) {
245  case POSITIVE_SEQ: {
246  yBus[n][n] += 1.0 / std::complex<double>(data.positiveResistance, data.positiveReactance);
247  } break;
248  case NEGATIVE_SEQ: {
249  yBus[n][n] += 1.0 / std::complex<double>(data.negativeResistance, data.negativeReactance);
250  } break;
251  case ZERO_SEQ: {
252  if(data.groundNeutral) {
253  yBus[n][n] += 1.0 / std::complex<double>(data.zeroResistance + 3.0 * data.groundResistance,
254  data.zeroReactance + 3.0 * data.groundReactance);
255  }
256  } break;
257  }
258  }
259  }
260  // Synchronous motor
261  for(auto it = m_syncMotorList.begin(), itEnd = m_syncMotorList.end(); it != itEnd; ++it) {
262  SyncMotor* syncMotor = *it;
263  if(syncMotor->IsOnline()) {
264  int n = static_cast<Bus*>(syncMotor->GetParentList()[0])->GetElectricalData().number;
265  SyncMotorElectricalData data = syncMotor->GetPUElectricalData(systemPowerBase);
266  switch(sequence) {
267  case POSITIVE_SEQ: {
268  yBus[n][n] += 1.0 / std::complex<double>(data.positiveResistance, data.positiveReactance);
269  } break;
270  case NEGATIVE_SEQ: {
271  yBus[n][n] += 1.0 / std::complex<double>(data.negativeResistance, data.negativeReactance);
272  } break;
273  case ZERO_SEQ: {
274  if(data.groundNeutral) {
275  yBus[n][n] += 1.0 / std::complex<double>(data.zeroResistance + 3.0 * data.groundResistance,
276  data.zeroReactance + 3.0 * data.groundReactance);
277  }
278  } break;
279  }
280  }
281  }
282  }
283 
284  return true;
285 }
286 
287 void ElectricCalculation::UpdateElementsPowerFlow(std::vector<std::complex<double> > voltage,
288  std::vector<std::complex<double> > power,
289  std::vector<BusType> busType,
290  std::vector<ReactiveLimits> reactiveLimit,
291  double systemPowerBase)
292 {
293  double zeroLimit = 1e-4;
294  for(unsigned int i = 0; i < reactiveLimit.size(); ++i) {
295  if(reactiveLimit[i].maxLimit > -zeroLimit && reactiveLimit[i].maxLimit < zeroLimit)
296  reactiveLimit[i].maxLimit = zeroLimit;
297  if(reactiveLimit[i].minLimit > -zeroLimit && reactiveLimit[i].minLimit < zeroLimit)
298  reactiveLimit[i].minLimit = zeroLimit;
299  }
300  for(unsigned int i = 0; i < power.size(); ++i) {
301  if(std::real(power[i]) > -zeroLimit && std::real(power[i]) < zeroLimit)
302  power[i] = std::complex<double>(0.0, std::imag(power[i]));
303  if(std::imag(power[i]) > -zeroLimit && std::imag(power[i]) < zeroLimit)
304  power[i] = std::complex<double>(std::real(power[i]), 0.0);
305  }
306  // Buses
307  for(int i = 0; i < (int)m_busList.size(); i++) {
308  Bus* bus = m_busList[i];
309  BusElectricalData data = bus->GetElectricalData();
310  data.voltage = voltage[i];
311  data.power = power[i];
312  data.busType = busType[i];
313  bus->SetElectricalData(data);
314  }
315 
316  // Power line
317  for(int i = 0; i < (int)m_lineList.size(); i++) {
318  Line* line = m_lineList[i];
319  if(line->IsOnline()) {
320  int n1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().number;
321  int n2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().number;
322 
323  LineElectricalData data = line->GetElectricalData();
324  std::complex<double> v1 = voltage[n1];
325  std::complex<double> v2 = voltage[n2];
326 
327  data.current[0] = (v1 - v2) / std::complex<double>(data.resistance, data.indReactance) +
328  v1 * std::complex<double>(0.0, data.capSusceptance / 2.0);
329  data.current[1] = (v2 - v1) / std::complex<double>(data.resistance, data.indReactance) +
330  v2 * std::complex<double>(0.0, data.capSusceptance / 2.0);
331 
332  data.powerFlow[0] = v1 * std::conj(data.current[0]);
333  data.powerFlow[1] = v2 * std::conj(data.current[1]);
334 
335  if(data.powerFlow[0].real() > data.powerFlow[1].real())
337  else
339 
340  line->SetElectricalData(data);
341  }
342  }
343 
344  // Transformer
345  for(int i = 0; i < (int)m_transformerList.size(); i++) {
346  Transformer* transformer = m_transformerList[i];
347  if(transformer->IsOnline()) {
348  TransformerElectricalData data = transformer->GetElectricalData();
349  int n1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().number;
350  int n2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().number;
351  std::complex<double> v1 = voltage[n1]; // Primary voltage
352  std::complex<double> v2 = voltage[n2]; // Secondary voltage
353 
354  // Transformer admitance
355  std::complex<double> y = 1.0 / std::complex<double>(data.resistance, data.indReactance);
356 
357  if(data.turnsRatio == 1.0 && data.phaseShift == 0.0) {
358  data.current[0] = (v1 - v2) * y;
359  data.current[1] = (v2 - v1) * y;
360  } else {
361  double radPS = wxDegToRad(data.phaseShift);
362  std::complex<double> a =
363  std::complex<double>(data.turnsRatio * std::cos(radPS), -data.turnsRatio * std::sin(radPS));
364 
365  data.current[0] = v1 * (y / std::pow(std::abs(a), 2)) - v2 * (y / std::conj(a));
366  data.current[1] = -v1 * (y / a) + v2 * y;
367  }
368 
369  data.powerFlow[0] = v1 * std::conj(data.current[0]);
370  data.powerFlow[1] = v2 * std::conj(data.current[1]);
371 
372  if(data.powerFlow[0].real() > data.powerFlow[1].real())
374  else
376 
377  transformer->SetElectricaData(data);
378  }
379  }
380 
381  // Synchronous machines
382  for(int i = 0; i < (int)m_busList.size(); i++) {
383  Bus* bus = m_busList[i];
384  BusElectricalData data = bus->GetElectricalData();
385 
386  // Get the synchronous machines connected and calculate the load power on the bus.
387  std::vector<SyncGenerator*> syncGeneratorsOnBus;
388  std::vector<SyncMotor*> syncMotorsOnBus;
389  std::complex<double> loadPower(0.0, 0.0);
390 
391  for(auto itsg = m_syncGeneratorList.begin(); itsg != m_syncGeneratorList.end(); itsg++) {
392  SyncGenerator* syncGenerator = *itsg;
393  if(bus == syncGenerator->GetParentList()[0] && syncGenerator->IsOnline())
394  syncGeneratorsOnBus.push_back(syncGenerator);
395  }
396  for(auto itsm = m_syncMotorList.begin(); itsm != m_syncMotorList.end(); itsm++) {
397  SyncMotor* syncMotor = *itsm;
398  if(bus == syncMotor->GetParentList()[0] && syncMotor->IsOnline()) {
399  syncMotorsOnBus.push_back(syncMotor);
400  SyncMotorElectricalData childData = syncMotor->GetPUElectricalData(systemPowerBase);
401  loadPower += std::complex<double>(childData.activePower, 0.0);
402  }
403  }
404  for(auto itlo = m_loadList.begin(); itlo != m_loadList.end(); itlo++) {
405  Load* load = *itlo;
406  if(bus == load->GetParentList()[0] && load->IsOnline()) {
407  LoadElectricalData childData = load->GetPUElectricalData(systemPowerBase);
408  if(childData.loadType == CONST_POWER)
409  loadPower += std::complex<double>(childData.activePower, childData.reactivePower);
410 
411  if(childData.activePower >= 0.0)
413  else
415  }
416  }
417  for(auto itim = m_indMotorList.begin(); itim != m_indMotorList.end(); itim++) {
418  IndMotor* indMotor = *itim;
419  if(bus == indMotor->GetParentList()[0] && indMotor->IsOnline()) {
420  IndMotorElectricalData childData = indMotor->GetPUElectricalData(systemPowerBase);
421  loadPower += std::complex<double>(childData.activePower, childData.reactivePower);
422 
423  if(childData.activePower >= 0.0)
425  else
426  indMotor->SetPowerFlowDirection(PF_TO_BUS);
427  }
428  }
429 
430  // Set the sync generator power
431  for(auto itsg = syncGeneratorsOnBus.begin(); itsg != syncGeneratorsOnBus.end(); itsg++) {
432  SyncGenerator* generator = *itsg;
433  if(generator->IsOnline()) {
434  SyncGeneratorElectricalData childData = generator->GetElectricalData();
435 
436  if(busType[i] == BUS_SLACK) {
437  double activePower =
438  (power[i].real() + loadPower.real()) * systemPowerBase / (double)(syncGeneratorsOnBus.size());
439 
440  switch(childData.activePowerUnit) {
441  case UNIT_PU: {
442  activePower /= systemPowerBase;
443  } break;
444  case UNIT_kW: {
445  activePower /= 1e3;
446  } break;
447  case UNIT_MW: {
448  activePower /= 1e6;
449  } break;
450  default:
451  break;
452  }
453 
454  childData.activePower = activePower;
455  }
456  if(busType[i] == BUS_PV || busType[i] == BUS_SLACK) {
457  // double reactivePower = (power[i].imag() + loadPower.imag()) * systemPowerBase /
458  // (double)(syncGeneratorsOnBus.size() + syncMotorsOnBus.size());
459  SyncGeneratorElectricalData childData_PU = generator->GetPUElectricalData(systemPowerBase);
460 
461  double reactivePower = (power[i].imag() + loadPower.imag()) * systemPowerBase;
462 
463  if(reactiveLimit[i].limitReached == RL_MAX_REACHED)
464  reactivePower *= (childData_PU.maxReactive / reactiveLimit[i].maxLimit);
465 
466  else if(reactiveLimit[i].limitReached == RL_MIN_REACHED)
467  reactivePower *= (childData_PU.minReactive / reactiveLimit[i].minLimit);
468 
469  else
470  reactivePower /= (double)(syncGeneratorsOnBus.size() + syncMotorsOnBus.size());
471 
472  switch(childData.reactivePowerUnit) {
473  case UNIT_PU: {
474  reactivePower /= systemPowerBase;
475  } break;
476  case UNIT_kVAr: {
477  reactivePower /= 1e3;
478  } break;
479  case UNIT_MVAr: {
480  reactivePower /= 1e6;
481  } break;
482  default:
483  break;
484  }
485  childData.reactivePower = reactivePower;
486  }
487 
488  if(childData.activePower >= 0.0)
489  generator->SetPowerFlowDirection(PF_TO_BUS);
490  else
492 
493  generator->SetElectricalData(childData);
494  }
495  }
496 
497  // Set the sync motor reactive power
498  double exceededReactive = 0.0;
499  int numMachines = syncGeneratorsOnBus.size() + syncMotorsOnBus.size();
500  for(auto itsm = syncMotorsOnBus.begin(); itsm != syncMotorsOnBus.end(); itsm++) {
501  SyncMotor* syncMotor = *itsm;
502  SyncMotorElectricalData childData = syncMotor->GetElectricalData();
503 
504  bool reachedMachineLimit = false;
505 
506  if(busType[i] == BUS_PV || busType[i] == BUS_SLACK) {
507  // double reactivePower = (power[i].imag() + loadPower.imag()) * systemPowerBase /
508  // (double)(syncGeneratorsOnBus.size() + syncMotorsOnBus.size());
509 
510  SyncMotorElectricalData childData_PU = syncMotor->GetPUElectricalData(systemPowerBase);
511 
512  double reactivePower = power[i].imag() + loadPower.imag();
513 
514  // Bus reachd maximum reactive limit.
515  if(reactiveLimit[i].limitReached == RL_MAX_REACHED)
516  reactivePower *= (childData_PU.maxReactive / reactiveLimit[i].maxLimit);
517  // Bus reached minimum reactive limit.
518  else if(reactiveLimit[i].limitReached == RL_MIN_REACHED)
519  reactivePower *= (childData_PU.minReactive / reactiveLimit[i].minLimit);
520  // Bus didn't reach any limits
521  else {
522  reactivePower /= (double)(numMachines);
523  if(childData_PU.haveMaxReactive && (reactivePower > childData_PU.maxReactive)) {
524  exceededReactive += reactivePower - childData_PU.maxReactive;
525  reactivePower = childData_PU.maxReactive;
526  reachedMachineLimit = true;
527  } else if(childData_PU.haveMinReactive && (reactivePower < childData_PU.minReactive)) {
528  exceededReactive += reactivePower - childData_PU.minReactive;
529  reactivePower = childData_PU.minReactive;
530  reachedMachineLimit = true;
531  } else if((!childData_PU.haveMaxReactive && reactiveLimit[i].limitReached == RL_MAX_REACHED) ||
532  (!childData_PU.haveMinReactive && reactiveLimit[i].limitReached == RL_MIN_REACHED) ||
533  (!childData_PU.haveMaxReactive && !childData_PU.haveMaxReactive)) {
534  reactivePower += exceededReactive;
535  exceededReactive = 0.0;
536  }
537  }
538 
539  reactivePower *= systemPowerBase;
540 
541  switch(childData.reactivePowerUnit) {
542  case UNIT_PU: {
543  reactivePower /= systemPowerBase;
544  } break;
545  case UNIT_kVAr: {
546  reactivePower /= 1e3;
547  } break;
548  case UNIT_MVAr: {
549  reactivePower /= 1e6;
550  } break;
551  default:
552  break;
553  }
554  childData.reactivePower = reactivePower;
555  }
556 
557  if(childData.activePower > 0.0)
559  else
560  syncMotor->SetPowerFlowDirection(PF_TO_BUS);
561 
562  syncMotor->SetElectricalData(childData);
563 
564  if(reachedMachineLimit) {
565  syncMotorsOnBus.erase(itsm);
566  itsm = syncMotorsOnBus.begin();
567  }
568  }
569  }
570 }
571 
572 bool ElectricCalculation::InvertMatrix(std::vector<std::vector<std::complex<double> > > matrix,
573  std::vector<std::vector<std::complex<double> > >& inverse)
574 {
575  int order = static_cast<int>(matrix.size());
576 
577  inverse.clear();
578  // Fill the inverse matrix with identity.
579  for(int i = 0; i < order; ++i) {
580  std::vector<std::complex<double> > line;
581  for(int j = 0; j < order; ++j) {
582  line.push_back(i == j ? std::complex<double>(1.0, 0.0) : std::complex<double>(0.0, 0.0));
583  }
584  inverse.push_back(line);
585  }
586 
587  // Check if a main diagonal value of the matrix is zero, if one is zero, try a linear combination to remove it.
588  for(int i = 0; i < order; ++i) {
589  for(int j = 0; j < order; ++j) {
590  if(i == j && matrix[i][j] == std::complex<double>(0.0, 0.0)) {
591  int row = 0;
592  while(row < order) {
593  if(matrix[row][j] != std::complex<double>(0.0, 0.0)) {
594  for(int k = 0; k < order; ++k) {
595  matrix[i][k] += matrix[row][k];
596  inverse[i][k] += inverse[row][k];
597  }
598  break;
599  }
600  row++;
601  }
602  // If all line values are zero, the matrix is singular and the solution is impossible.
603  if(row == order) return false;
604  }
605  }
606  }
607 
608  // Linear combinations are made in both matrices, the goal is the input matrix become the identity. The final result
609  // have two matrices: the identity and the inverse of the input.
610  for(int i = 0; i < order; ++i) {
611  for(int j = 0; j < order; ++j) {
612  if(i != j) {
613  if(matrix[i][i] == std::complex<double>(0.0, 0.0)) return false;
614 
615  std::complex<double> factor = matrix[j][i] / matrix[i][i];
616  for(int k = 0; k < order; ++k) {
617  matrix[j][k] -= factor * matrix[i][k];
618  inverse[j][k] -= factor * inverse[i][k];
619  }
620  }
621  }
622  }
623  // Main diagonal calculation.
624  for(int i = 0; i < order; ++i) {
625  for(int j = 0; j < order; ++j) {
626  if(i == j) {
627  if(matrix[i][j] == std::complex<double>(0.0, 0.0)) return false;
628 
629  std::complex<double> factor = (matrix[i][j] - std::complex<double>(1.0, 0.0)) / matrix[i][j];
630  for(int k = 0; k < order; ++k) {
631  matrix[j][k] -= factor * matrix[i][k];
632  inverse[j][k] -= factor * inverse[i][k];
633  }
634  }
635  }
636  }
637 
638  return true;
639 }
640 
641 void ElectricCalculation::ABCtoDQ0(std::complex<double> complexValue, double angle, double& dValue, double& qValue)
642 {
643  dValue = -std::real(complexValue) * std::sin(angle) + std::imag(complexValue) * std::cos(angle);
644  qValue = std::real(complexValue) * std::cos(angle) + std::imag(complexValue) * std::sin(angle);
645 }
646 
647 void ElectricCalculation::DQ0toABC(double dValue, double qValue, double angle, std::complex<double>& complexValue)
648 {
649  double real = qValue * std::cos(angle) - dValue * std::sin(angle);
650  double imag = qValue * std::sin(angle) + dValue * std::cos(angle);
651  complexValue = std::complex<double>(real, imag);
652 }
653 
654 std::vector<std::complex<double> > ElectricCalculation::GaussianElimination(
655  std::vector<std::vector<std::complex<double> > > matrix,
656  std::vector<std::complex<double> > array)
657 {
658  //[Ref] http://pt.wikipedia.org/wiki/Elimina%C3%A7%C3%A3o_de_Gauss
659 
660  std::vector<std::complex<double> > solution;
661 
662  std::vector<std::vector<std::complex<double> > > triangMatrix;
663  triangMatrix.resize(matrix.size());
664  for(unsigned int i = 0; i < matrix.size(); i++) {
665  triangMatrix[i].resize(matrix.size());
666  }
667 
668  for(unsigned int i = 0; i < matrix.size(); i++) {
669  solution.push_back(array[i]);
670  }
671 
672  for(unsigned int i = 0; i < matrix.size(); i++) {
673  for(unsigned int j = 0; j < matrix.size(); j++) {
674  triangMatrix[i][j] = matrix[i][j];
675  }
676  }
677 
678  for(unsigned int k = 0; k < matrix.size(); k++) {
679  unsigned int k1 = k + 1;
680  for(unsigned int i = k; i < matrix.size(); i++) {
681  if(triangMatrix[i][k] != std::complex<double>(0.0, 0.0)) {
682  for(unsigned int j = k1; j < matrix.size(); j++) {
683  triangMatrix[i][j] = triangMatrix[i][j] / triangMatrix[i][k];
684  }
685  solution[i] = solution[i] / triangMatrix[i][k];
686  }
687  }
688  for(unsigned int i = k1; i < matrix.size(); i++) {
689  if(triangMatrix[i][k] != std::complex<double>(0.0, 0.0)) {
690  for(unsigned int j = k1; j < matrix.size(); j++) {
691  triangMatrix[i][j] -= triangMatrix[k][j];
692  }
693  solution[i] -= solution[k];
694  }
695  }
696  }
697  for(unsigned int i = matrix.size() - 2; i >= 0; i--) {
698  for(unsigned int j = matrix.size() - 1; j >= i + 1; j--) {
699  solution[i] -= triangMatrix[i][j] * solution[j];
700  }
701  }
702 
703  return solution;
704 }
705 
706 Machines::SyncMachineModel ElectricCalculation::GetMachineModel(SyncGenerator* generator)
707 {
708  auto data = generator->GetElectricalData();
709  if(data.transTd0 != 0.0) {
710  if(data.transTq0 != 0.0) {
711  if(data.subTd0 != 0.0 || data.subTq0 != 0.0) {
712  return Machines::SM_MODEL_5;
713  }
714  return Machines::SM_MODEL_3;
715  } else {
716  if(data.subTd0 != 0.0 || data.subTq0 != 0.0) {
717  return Machines::SM_MODEL_4;
718  }
719  return Machines::SM_MODEL_2;
720  }
721  }
722 
723  return Machines::SM_MODEL_1;
724 }
725 
726 std::vector<std::complex<double> > ElectricCalculation::ComplexMatrixTimesVector(
727  std::vector<std::vector<std::complex<double> > > matrix,
728  std::vector<std::complex<double> > vector)
729 {
730  std::vector<std::complex<double> > solution;
731  for(unsigned int i = 0; i < matrix.size(); i++) {
732  solution.push_back(std::complex<double>(0.0, 0.0));
733 
734  for(unsigned int j = 0; j < matrix.size(); j++) {
735  solution[i] += matrix[i][j] * vector[j];
736  }
737  }
738 
739  return solution;
740 }
741 
742 void ElectricCalculation::GetLUDecomposition(std::vector<std::vector<std::complex<double> > > matrix,
743  std::vector<std::vector<std::complex<double> > >& matrixL,
744  std::vector<std::vector<std::complex<double> > >& matrixU)
745 {
746  // Doolittle method
747  // [Ref] http://www3.nd.edu/~zxu2/acms40390F11/Alg-LU-Crout.pdf
748  // [Ref] http://www.engr.colostate.edu/~thompson/hPage/CourseMat/Tutorials/CompMethods/doolittle.pdf
749 
750  int size = static_cast<int>(matrix.size()); // Decomposed matrix size.
751 
752  // Set upper and lower matrices sizes.
753  matrixL.resize(size);
754  matrixU.resize(size);
755  for(int i = 0; i < size; i++) {
756  matrixL[i].resize(size);
757  matrixU[i].resize(size);
758  }
759 
760  // First row of upper matrix and first column of lower matrix.
761  for(int i = 0; i < size; i++) {
762  matrixU[0][i] = matrix[0][i];
763  matrixL[i][0] = matrix[i][0] / matrixU[0][0];
764  }
765 
766  // Lower matrix main diagonal.
767  for(int i = 1; i < size; i++) {
768  matrixL[i][i] = std::complex<double>(1.0, 0.0);
769  }
770 
771  for(int i = 1; i < size - 1; i++) {
772  // Upper matrix main diagonal.
773  matrixU[i][i] = matrix[i][i];
774  for(int k = 0; k < i; k++) {
775  matrixU[i][i] -= matrixL[i][k] * matrixU[k][i];
776  }
777 
778  // Others elements of upper matrix
779  for(int j = i + 1; j < size; j++) {
780  matrixU[i][j] = matrix[i][j];
781  for(int k = 0; k < i; k++) {
782  matrixU[i][j] -= matrixL[i][k] * matrixU[k][j];
783  }
784  }
785 
786  // Lower matrix elements
787  for(int j = i + 1; j < size; j++) {
788  matrixL[j][i] = matrix[j][i];
789  for(int k = 0; k < i; k++) {
790  matrixL[j][i] -= matrixL[j][k] * matrixU[k][i];
791  }
792  matrixL[j][i] = matrixL[j][i] / matrixU[i][i];
793  }
794  }
795 
796  // Last element of upper matrix.
797  matrixU[size - 1][size - 1] = matrix[size - 1][size - 1];
798  for(int k = 0; k < size - 1; k++) {
799  matrixU[size - 1][size - 1] -= matrixL[size - 1][k] * matrixU[k][size - 1];
800  }
801 }
802 
803 std::vector<std::complex<double> > ElectricCalculation::LUEvaluate(std::vector<std::vector<std::complex<double> > > u,
804  std::vector<std::vector<std::complex<double> > > l,
805  std::vector<std::complex<double> > b)
806 {
807  int size = static_cast<int>(b.size());
808  std::vector<std::complex<double> > x;
809  std::vector<std::complex<double> > y;
810  x.resize(size);
811  y.resize(size);
812 
813  // Forward
814  for(int i = 0; i < size; i++) {
815  y[i] = b[i];
816  for(int j = 0; j < i; j++) {
817  y[i] -= l[i][j] * y[j];
818  }
819  y[i] /= l[i][i];
820  }
821  // Backward
822  for(int i = size - 1; i >= 0; i--) {
823  x[i] = y[i];
824  for(int j = i + 1; j < size; j++) {
825  x[i] -= u[i][j] * x[j];
826  }
827  x[i] /= u[i][i];
828  }
829  return x;
830 }
- - -
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:517
-
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: PowerElement.h:170
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "ElectricCalculation.h"
19 #ifdef USING_WX_3_0_X
20 #include "DegreesAndRadians.h"
21 #endif
22 
25 void ElectricCalculation::GetElementsFromList(std::vector<Element*> elementList)
26 {
27  m_powerElementList.clear();
28  m_busList.clear();
29  m_capacitorList.clear();
30  m_indMotorList.clear();
31  m_inductorList.clear();
32  m_lineList.clear();
33  m_loadList.clear();
34  m_syncGeneratorList.clear();
35  m_syncMotorList.clear();
36  m_transformerList.clear();
37  // TODO: Bad design?
38  for(auto it = elementList.begin(); it != elementList.end(); it++) {
39  Element* element = *it;
40  m_powerElementList.push_back(static_cast<PowerElement*>(element));
41 
42  if(Bus* bus = dynamic_cast<Bus*>(element))
43  m_busList.push_back(bus);
44  else if(Capacitor* capacitor = dynamic_cast<Capacitor*>(element))
45  m_capacitorList.push_back(capacitor);
46  else if(IndMotor* indMotor = dynamic_cast<IndMotor*>(element))
47  m_indMotorList.push_back(indMotor);
48  else if(Inductor* inductor = dynamic_cast<Inductor*>(element))
49  m_inductorList.push_back(inductor);
50  else if(Line* line = dynamic_cast<Line*>(element))
51  m_lineList.push_back(line);
52  else if(Load* load = dynamic_cast<Load*>(element))
53  m_loadList.push_back(load);
54  else if(SyncGenerator* syncGenerator = dynamic_cast<SyncGenerator*>(element))
55  m_syncGeneratorList.push_back(syncGenerator);
56  else if(SyncMotor* syncMotor = dynamic_cast<SyncMotor*>(element))
57  m_syncMotorList.push_back(syncMotor);
58  else if(Transformer* transformer = dynamic_cast<Transformer*>(element))
59  m_transformerList.push_back(transformer);
60  }
61 
62  // Set buses numbers
63  int busNumber = 0;
64  for(auto itb = m_busList.begin(); itb != m_busList.end(); itb++) {
65  Bus* bus = *itb;
66  BusElectricalData data = bus->GetElectricalData();
67  data.number = busNumber;
68  bus->SetElectricalData(data);
69  busNumber++;
70  }
71 }
72 
73 bool ElectricCalculation::GetYBus(std::vector<std::vector<std::complex<double> > >& yBus,
74  double systemPowerBase,
75  YBusSequence sequence,
76  bool includeSyncMachines,
77  bool allLoadsAsImpedances)
78 {
79  if(m_busList.size() == 0) return false;
80 
81  // Clear and fill with zeros the Ybus
82  yBus.clear();
83  for(int i = 0; i < (int)m_busList.size(); i++) {
84  std::vector<std::complex<double> > line;
85  for(int j = 0; j < (int)m_busList.size(); j++) {
86  line.push_back(std::complex<double>(0.0, 0.0));
87  }
88  yBus.push_back(line);
89  }
90 
91  // Set buses numbers
92  int busNumber = 0;
93  for(auto itb = m_busList.begin(); itb != m_busList.end(); itb++) {
94  Bus* bus = *itb;
95  BusElectricalData data = bus->GetElectricalData();
96  data.number = busNumber;
97  bus->SetElectricalData(data);
98  busNumber++;
99  }
100 
101  // Load
102  for(auto it = m_loadList.begin(), itEnd = m_loadList.end(); it != itEnd; ++it) {
103  Load* load = *it;
104  if(load->IsOnline()) {
105  int n = static_cast<Bus*>(load->GetParentList()[0])->GetElectricalData().number;
106  LoadElectricalData data = load->GetPUElectricalData(systemPowerBase);
107  if(data.loadType == CONST_IMPEDANCE || allLoadsAsImpedances) {
108  std::complex<double> yLoad = std::complex<double>(data.activePower, -data.reactivePower);
109  if(allLoadsAsImpedances) {
110  std::complex<double> v = static_cast<Bus*>(load->GetParentList()[0])->GetElectricalData().voltage;
111  yLoad /= (std::abs(v) * std::abs(v));
112  }
113  yBus[n][n] += yLoad;
114  }
115  }
116  }
117 
118  // Capacitor
119  for(auto it = m_capacitorList.begin(), itEnd = m_capacitorList.end(); it != itEnd; ++it) {
120  Capacitor* capacitor = *it;
121  if(capacitor->IsOnline()) {
122  int n = static_cast<Bus*>(capacitor->GetParentList()[0])->GetElectricalData().number;
123  CapacitorElectricalData data = capacitor->GetPUElectricalData(systemPowerBase);
124  yBus[n][n] += std::complex<double>(0.0, data.reactivePower);
125  }
126  }
127 
128  // Inductor
129  for(auto it = m_inductorList.begin(), itEnd = m_inductorList.end(); it != itEnd; ++it) {
130  Inductor* inductor = *it;
131  if(inductor->IsOnline()) {
132  int n = static_cast<Bus*>(inductor->GetParentList()[0])->GetElectricalData().number;
133  InductorElectricalData data = inductor->GetPUElectricalData(systemPowerBase);
134  yBus[n][n] += std::complex<double>(0.0, -data.reactivePower);
135  }
136  }
137 
138  // Power line
139  for(auto it = m_lineList.begin(), itEnd = m_lineList.end(); it != itEnd; ++it) {
140  Line* line = *it;
141  if(line->IsOnline()) {
142  LineElectricalData data = line->GetPUElectricalData(systemPowerBase);
143 
144  int n1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().number;
145  int n2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().number;
146 
147  switch(sequence) {
148  case POSITIVE_SEQ:
149  case NEGATIVE_SEQ: {
150  yBus[n1][n2] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
151  yBus[n2][n1] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
152 
153  yBus[n1][n1] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
154  yBus[n2][n2] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
155 
156  yBus[n1][n1] += std::complex<double>(0.0, data.capSusceptance / 2.0);
157  yBus[n2][n2] += std::complex<double>(0.0, data.capSusceptance / 2.0);
158  } break;
159  case ZERO_SEQ: {
160  yBus[n1][n2] -= 1.0 / std::complex<double>(data.zeroResistance, data.zeroIndReactance);
161  yBus[n2][n1] -= 1.0 / std::complex<double>(data.zeroResistance, data.zeroIndReactance);
162 
163  yBus[n1][n1] += 1.0 / std::complex<double>(data.zeroResistance, data.zeroIndReactance);
164  yBus[n2][n2] += 1.0 / std::complex<double>(data.zeroResistance, data.zeroIndReactance);
165 
166  yBus[n1][n1] += std::complex<double>(0.0, data.zeroCapSusceptance / 2.0);
167  yBus[n2][n2] += std::complex<double>(0.0, data.zeroCapSusceptance / 2.0);
168  }
169  }
170  }
171  }
172 
173  // Transformer
174  for(auto it = m_transformerList.begin(), itEnd = m_transformerList.end(); it != itEnd; ++it) {
175  Transformer* transformer = *it;
176 
177  if(transformer->IsOnline()) {
178  TransformerElectricalData data = transformer->GetPUElectricalData(systemPowerBase);
179 
180  int n1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().number;
181  int n2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().number;
182 
183  // If the transformer have nominal turns ratio (1.0) and no phase shifting, it will be modelled as series
184  // impedance.
185  if(data.turnsRatio == 1.0 && data.phaseShift == 0.0 && sequence != ZERO_SEQ) {
186  yBus[n1][n2] += -1.0 / std::complex<double>(data.resistance, data.indReactance);
187  yBus[n2][n1] += -1.0 / std::complex<double>(data.resistance, data.indReactance);
188 
189  yBus[n1][n1] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
190  yBus[n2][n2] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
191  }
192  // If the transformer have no-nominal turn ratio and/or phase shifting, it will be modelled in a different
193  // way (see references).
194  //[Ref. 1: Elementos de analise de sistemas de potencia - Stevenson - pg. 232]
195  //[Ref. 2: http://www.ee.washington.edu/research/real/Library/Reports/Tap_Adjustments_in_AC_Load_Flows.pdf]
196  //[Ref. 3: http://www.columbia.edu/~dano/courses/power/notes/power/andersson1.pdf]
197  else if(sequence != ZERO_SEQ) {
198  // Complex turns ratio
199  double radPhaseShift = wxDegToRad(data.phaseShift);
200  std::complex<double> a = std::complex<double>(data.turnsRatio * std::cos(radPhaseShift),
201  -data.turnsRatio * std::sin(radPhaseShift));
202 
203  // Transformer admitance
204  std::complex<double> y = 1.0 / std::complex<double>(data.resistance, data.indReactance);
205 
206  if(sequence == POSITIVE_SEQ) {
207  yBus[n1][n1] += y / std::pow(std::abs(a), 2.0);
208  yBus[n1][n2] += -(y / std::conj(a));
209  yBus[n2][n1] += -(y / a);
210  yBus[n2][n2] += y;
211  } else if(sequence == NEGATIVE_SEQ) {
212  yBus[n1][n1] += y / std::pow(std::abs(a), 2.0);
213  yBus[n1][n2] += -(y / a);
214  yBus[n2][n1] += -(y / std::conj(a));
215  yBus[n2][n2] += y;
216  }
217  } else if(sequence == ZERO_SEQ) {
218  switch(data.connection) {
219  case GWYE_GWYE: {
220  std::complex<double> y =
221  1.0 /
222  std::complex<double>(
223  data.zeroResistance + 3.0 * (data.primaryGrndResistance + data.secondaryGrndResistance),
224  data.zeroIndReactance +
225  3.0 * (data.primaryGrndReactance + data.secondaryGrndReactance));
226  std::complex<double> a = std::complex<double>(data.turnsRatio, 0.0);
227 
228  yBus[n1][n1] += y / (a * a);
229  yBus[n1][n2] += -(y / a);
230  yBus[n2][n1] += -(y / a);
231  yBus[n2][n2] += y;
232  } break;
233  case DELTA_GWYE: {
234  std::complex<double> y =
235  1.0 / std::complex<double>(data.zeroResistance + 3.0 * (data.secondaryGrndResistance),
236  data.zeroIndReactance + 3.0 * (data.secondaryGrndReactance));
237  yBus[n2][n2] += y;
238  break;
239  }
240  case GWYE_DELTA: {
241  std::complex<double> y =
242  1.0 / std::complex<double>(data.zeroResistance + 3.0 * (data.primaryGrndResistance),
243  data.zeroIndReactance + 3.0 * (data.primaryGrndReactance));
244  yBus[n1][n1] += y;
245  break;
246  }
247  default:
248  break;
249  }
250  }
251  }
252  }
253 
254  if(includeSyncMachines) {
255  // Synchronous generator
256  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
257  SyncGenerator* syncGenerator = *it;
258  if(syncGenerator->IsOnline()) {
259  int n = static_cast<Bus*>(syncGenerator->GetParentList()[0])->GetElectricalData().number;
260  SyncGeneratorElectricalData data = syncGenerator->GetPUElectricalData(systemPowerBase);
261  switch(sequence) {
262  case POSITIVE_SEQ: {
263  yBus[n][n] += 1.0 / std::complex<double>(data.positiveResistance, data.positiveReactance);
264  } break;
265  case NEGATIVE_SEQ: {
266  yBus[n][n] += 1.0 / std::complex<double>(data.negativeResistance, data.negativeReactance);
267  } break;
268  case ZERO_SEQ: {
269  if(data.groundNeutral) {
270  yBus[n][n] += 1.0 / std::complex<double>(data.zeroResistance + 3.0 * data.groundResistance,
271  data.zeroReactance + 3.0 * data.groundReactance);
272  }
273  } break;
274  }
275  }
276  }
277  // Synchronous motor
278  for(auto it = m_syncMotorList.begin(), itEnd = m_syncMotorList.end(); it != itEnd; ++it) {
279  SyncMotor* syncMotor = *it;
280  if(syncMotor->IsOnline()) {
281  int n = static_cast<Bus*>(syncMotor->GetParentList()[0])->GetElectricalData().number;
282  SyncMotorElectricalData data = syncMotor->GetPUElectricalData(systemPowerBase);
283  switch(sequence) {
284  case POSITIVE_SEQ: {
285  yBus[n][n] += 1.0 / std::complex<double>(data.positiveResistance, data.positiveReactance);
286  } break;
287  case NEGATIVE_SEQ: {
288  yBus[n][n] += 1.0 / std::complex<double>(data.negativeResistance, data.negativeReactance);
289  } break;
290  case ZERO_SEQ: {
291  if(data.groundNeutral) {
292  yBus[n][n] += 1.0 / std::complex<double>(data.zeroResistance + 3.0 * data.groundResistance,
293  data.zeroReactance + 3.0 * data.groundReactance);
294  }
295  } break;
296  }
297  }
298  }
299  }
300 
301  return true;
302 }
303 
304 void ElectricCalculation::UpdateElementsPowerFlow(std::vector<std::complex<double> > voltage,
305  std::vector<std::complex<double> > power,
306  std::vector<BusType> busType,
307  std::vector<ReactiveLimits> reactiveLimit,
308  double systemPowerBase)
309 {
310  double zeroLimit = 1e-4;
311  for(unsigned int i = 0; i < reactiveLimit.size(); ++i) {
312  if(reactiveLimit[i].maxLimit > -zeroLimit && reactiveLimit[i].maxLimit < zeroLimit)
313  reactiveLimit[i].maxLimit = zeroLimit;
314  if(reactiveLimit[i].minLimit > -zeroLimit && reactiveLimit[i].minLimit < zeroLimit)
315  reactiveLimit[i].minLimit = zeroLimit;
316  }
317  for(unsigned int i = 0; i < power.size(); ++i) {
318  if(std::real(power[i]) > -zeroLimit && std::real(power[i]) < zeroLimit)
319  power[i] = std::complex<double>(0.0, std::imag(power[i]));
320  if(std::imag(power[i]) > -zeroLimit && std::imag(power[i]) < zeroLimit)
321  power[i] = std::complex<double>(std::real(power[i]), 0.0);
322  }
323  // Buses
324  for(int i = 0; i < (int)m_busList.size(); i++) {
325  Bus* bus = m_busList[i];
326  BusElectricalData data = bus->GetElectricalData();
327  data.voltage = voltage[i];
328  data.power = power[i];
329  data.busType = busType[i];
330  bus->SetElectricalData(data);
331  }
332 
333  // Power line
334  for(int i = 0; i < (int)m_lineList.size(); i++) {
335  Line* line = m_lineList[i];
336  if(line->IsOnline()) {
337  int n1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().number;
338  int n2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().number;
339 
340  LineElectricalData data = line->GetElectricalData();
341  std::complex<double> v1 = voltage[n1];
342  std::complex<double> v2 = voltage[n2];
343 
344  data.current[0] = (v1 - v2) / std::complex<double>(data.resistance, data.indReactance) +
345  v1 * std::complex<double>(0.0, data.capSusceptance / 2.0);
346  data.current[1] = (v2 - v1) / std::complex<double>(data.resistance, data.indReactance) +
347  v2 * std::complex<double>(0.0, data.capSusceptance / 2.0);
348 
349  data.powerFlow[0] = v1 * std::conj(data.current[0]);
350  data.powerFlow[1] = v2 * std::conj(data.current[1]);
351 
352  if(data.powerFlow[0].real() > data.powerFlow[1].real())
354  else
356 
357  line->SetElectricalData(data);
358  }
359  }
360 
361  // Transformer
362  for(int i = 0; i < (int)m_transformerList.size(); i++) {
363  Transformer* transformer = m_transformerList[i];
364  if(transformer->IsOnline()) {
365  TransformerElectricalData data = transformer->GetElectricalData();
366  int n1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().number;
367  int n2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().number;
368  std::complex<double> v1 = voltage[n1]; // Primary voltage
369  std::complex<double> v2 = voltage[n2]; // Secondary voltage
370 
371  // Transformer admitance
372  std::complex<double> y = 1.0 / std::complex<double>(data.resistance, data.indReactance);
373 
374  if(data.turnsRatio == 1.0 && data.phaseShift == 0.0) {
375  data.current[0] = (v1 - v2) * y;
376  data.current[1] = (v2 - v1) * y;
377  } else {
378  double radPS = wxDegToRad(data.phaseShift);
379  std::complex<double> a =
380  std::complex<double>(data.turnsRatio * std::cos(radPS), -data.turnsRatio * std::sin(radPS));
381 
382  data.current[0] = v1 * (y / std::pow(std::abs(a), 2)) - v2 * (y / std::conj(a));
383  data.current[1] = -v1 * (y / a) + v2 * y;
384  }
385 
386  data.powerFlow[0] = v1 * std::conj(data.current[0]);
387  data.powerFlow[1] = v2 * std::conj(data.current[1]);
388 
389  if(data.powerFlow[0].real() > data.powerFlow[1].real())
391  else
393 
394  transformer->SetElectricaData(data);
395  }
396  }
397 
398  // Synchronous machines
399  for(int i = 0; i < (int)m_busList.size(); i++) {
400  Bus* bus = m_busList[i];
401  BusElectricalData data = bus->GetElectricalData();
402 
403  // Get the synchronous machines connected and calculate the load power on the bus.
404  std::vector<SyncGenerator*> syncGeneratorsOnBus;
405  std::vector<SyncMotor*> syncMotorsOnBus;
406  std::complex<double> loadPower(0.0, 0.0);
407 
408  for(auto itsg = m_syncGeneratorList.begin(); itsg != m_syncGeneratorList.end(); itsg++) {
409  SyncGenerator* syncGenerator = *itsg;
410  if(bus == syncGenerator->GetParentList()[0] && syncGenerator->IsOnline())
411  syncGeneratorsOnBus.push_back(syncGenerator);
412  }
413  for(auto itsm = m_syncMotorList.begin(); itsm != m_syncMotorList.end(); itsm++) {
414  SyncMotor* syncMotor = *itsm;
415  if(bus == syncMotor->GetParentList()[0] && syncMotor->IsOnline()) {
416  syncMotorsOnBus.push_back(syncMotor);
417  SyncMotorElectricalData childData = syncMotor->GetPUElectricalData(systemPowerBase);
418  loadPower += std::complex<double>(childData.activePower, 0.0);
419  }
420  }
421  for(auto itlo = m_loadList.begin(); itlo != m_loadList.end(); itlo++) {
422  Load* load = *itlo;
423  if(bus == load->GetParentList()[0] && load->IsOnline()) {
424  LoadElectricalData childData = load->GetPUElectricalData(systemPowerBase);
425  if(childData.loadType == CONST_POWER)
426  loadPower += std::complex<double>(childData.activePower, childData.reactivePower);
427 
428  if(childData.activePower >= 0.0)
430  else
432  }
433  }
434  for(auto itim = m_indMotorList.begin(); itim != m_indMotorList.end(); itim++) {
435  IndMotor* indMotor = *itim;
436  if(bus == indMotor->GetParentList()[0] && indMotor->IsOnline()) {
437  IndMotorElectricalData childData = indMotor->GetPUElectricalData(systemPowerBase);
438  loadPower += std::complex<double>(childData.activePower, childData.reactivePower);
439 
440  if(childData.activePower >= 0.0)
442  else
443  indMotor->SetPowerFlowDirection(PF_TO_BUS);
444  }
445  }
446 
447  // Set the sync generator power
448  for(auto itsg = syncGeneratorsOnBus.begin(); itsg != syncGeneratorsOnBus.end(); itsg++) {
449  SyncGenerator* generator = *itsg;
450  if(generator->IsOnline()) {
451  SyncGeneratorElectricalData childData = generator->GetElectricalData();
452 
453  if(busType[i] == BUS_SLACK) {
454  double activePower =
455  (power[i].real() + loadPower.real()) * systemPowerBase / (double)(syncGeneratorsOnBus.size());
456 
457  switch(childData.activePowerUnit) {
458  case UNIT_PU: {
459  activePower /= systemPowerBase;
460  } break;
461  case UNIT_kW: {
462  activePower /= 1e3;
463  } break;
464  case UNIT_MW: {
465  activePower /= 1e6;
466  } break;
467  default:
468  break;
469  }
470 
471  childData.activePower = activePower;
472  }
473  if(busType[i] == BUS_PV || busType[i] == BUS_SLACK) {
474  // double reactivePower = (power[i].imag() + loadPower.imag()) * systemPowerBase /
475  // (double)(syncGeneratorsOnBus.size() + syncMotorsOnBus.size());
476  SyncGeneratorElectricalData childData_PU = generator->GetPUElectricalData(systemPowerBase);
477 
478  double reactivePower = (power[i].imag() + loadPower.imag()) * systemPowerBase;
479 
480  if(reactiveLimit[i].limitReached == RL_MAX_REACHED)
481  reactivePower *= (childData_PU.maxReactive / reactiveLimit[i].maxLimit);
482 
483  else if(reactiveLimit[i].limitReached == RL_MIN_REACHED)
484  reactivePower *= (childData_PU.minReactive / reactiveLimit[i].minLimit);
485 
486  else
487  reactivePower /= (double)(syncGeneratorsOnBus.size() + syncMotorsOnBus.size());
488 
489  switch(childData.reactivePowerUnit) {
490  case UNIT_PU: {
491  reactivePower /= systemPowerBase;
492  } break;
493  case UNIT_kVAr: {
494  reactivePower /= 1e3;
495  } break;
496  case UNIT_MVAr: {
497  reactivePower /= 1e6;
498  } break;
499  default:
500  break;
501  }
502  childData.reactivePower = reactivePower;
503  }
504 
505  if(childData.activePower >= 0.0)
506  generator->SetPowerFlowDirection(PF_TO_BUS);
507  else
509 
510  generator->SetElectricalData(childData);
511  }
512  }
513 
514  // Set the sync motor reactive power
515  double exceededReactive = 0.0;
516  int numMachines = syncGeneratorsOnBus.size() + syncMotorsOnBus.size();
517  for(auto itsm = syncMotorsOnBus.begin(); itsm != syncMotorsOnBus.end(); itsm++) {
518  SyncMotor* syncMotor = *itsm;
519  SyncMotorElectricalData childData = syncMotor->GetElectricalData();
520 
521  bool reachedMachineLimit = false;
522 
523  if(busType[i] == BUS_PV || busType[i] == BUS_SLACK) {
524  // double reactivePower = (power[i].imag() + loadPower.imag()) * systemPowerBase /
525  // (double)(syncGeneratorsOnBus.size() + syncMotorsOnBus.size());
526 
527  SyncMotorElectricalData childData_PU = syncMotor->GetPUElectricalData(systemPowerBase);
528 
529  double reactivePower = power[i].imag() + loadPower.imag();
530 
531  // Bus reachd maximum reactive limit.
532  if(reactiveLimit[i].limitReached == RL_MAX_REACHED)
533  reactivePower *= (childData_PU.maxReactive / reactiveLimit[i].maxLimit);
534  // Bus reached minimum reactive limit.
535  else if(reactiveLimit[i].limitReached == RL_MIN_REACHED)
536  reactivePower *= (childData_PU.minReactive / reactiveLimit[i].minLimit);
537  // Bus didn't reach any limits
538  else {
539  reactivePower /= (double)(numMachines);
540  if(childData_PU.haveMaxReactive && (reactivePower > childData_PU.maxReactive)) {
541  exceededReactive += reactivePower - childData_PU.maxReactive;
542  reactivePower = childData_PU.maxReactive;
543  reachedMachineLimit = true;
544  } else if(childData_PU.haveMinReactive && (reactivePower < childData_PU.minReactive)) {
545  exceededReactive += reactivePower - childData_PU.minReactive;
546  reactivePower = childData_PU.minReactive;
547  reachedMachineLimit = true;
548  } else if((!childData_PU.haveMaxReactive && reactiveLimit[i].limitReached == RL_MAX_REACHED) ||
549  (!childData_PU.haveMinReactive && reactiveLimit[i].limitReached == RL_MIN_REACHED) ||
550  (!childData_PU.haveMaxReactive && !childData_PU.haveMaxReactive)) {
551  reactivePower += exceededReactive;
552  exceededReactive = 0.0;
553  }
554  }
555 
556  reactivePower *= systemPowerBase;
557 
558  switch(childData.reactivePowerUnit) {
559  case UNIT_PU: {
560  reactivePower /= systemPowerBase;
561  } break;
562  case UNIT_kVAr: {
563  reactivePower /= 1e3;
564  } break;
565  case UNIT_MVAr: {
566  reactivePower /= 1e6;
567  } break;
568  default:
569  break;
570  }
571  childData.reactivePower = reactivePower;
572  }
573 
574  if(childData.activePower > 0.0)
576  else
577  syncMotor->SetPowerFlowDirection(PF_TO_BUS);
578 
579  syncMotor->SetElectricalData(childData);
580 
581  if(reachedMachineLimit) {
582  syncMotorsOnBus.erase(itsm);
583  itsm = syncMotorsOnBus.begin();
584  }
585  }
586  }
587 }
588 
589 bool ElectricCalculation::InvertMatrix(std::vector<std::vector<std::complex<double> > > matrix,
590  std::vector<std::vector<std::complex<double> > >& inverse)
591 {
592  int order = static_cast<int>(matrix.size());
593 
594  inverse.clear();
595  // Fill the inverse matrix with identity.
596  for(int i = 0; i < order; ++i) {
597  std::vector<std::complex<double> > line;
598  for(int j = 0; j < order; ++j) {
599  line.push_back(i == j ? std::complex<double>(1.0, 0.0) : std::complex<double>(0.0, 0.0));
600  }
601  inverse.push_back(line);
602  }
603 
604  // Check if a main diagonal value of the matrix is zero, if one is zero, try a linear combination to remove it.
605  for(int i = 0; i < order; ++i) {
606  for(int j = 0; j < order; ++j) {
607  if(i == j && matrix[i][j] == std::complex<double>(0.0, 0.0)) {
608  int row = 0;
609  while(row < order) {
610  if(matrix[row][j] != std::complex<double>(0.0, 0.0)) {
611  for(int k = 0; k < order; ++k) {
612  matrix[i][k] += matrix[row][k];
613  inverse[i][k] += inverse[row][k];
614  }
615  break;
616  }
617  row++;
618  }
619  // If all line values are zero, the matrix is singular and the solution is impossible.
620  if(row == order) return false;
621  }
622  }
623  }
624 
625  // Linear combinations are made in both matrices, the goal is the input matrix become the identity. The final result
626  // have two matrices: the identity and the inverse of the input.
627  for(int i = 0; i < order; ++i) {
628  for(int j = 0; j < order; ++j) {
629  if(i != j) {
630  if(matrix[i][i] == std::complex<double>(0.0, 0.0)) return false;
631 
632  std::complex<double> factor = matrix[j][i] / matrix[i][i];
633  for(int k = 0; k < order; ++k) {
634  matrix[j][k] -= factor * matrix[i][k];
635  inverse[j][k] -= factor * inverse[i][k];
636  }
637  }
638  }
639  }
640  // Main diagonal calculation.
641  for(int i = 0; i < order; ++i) {
642  for(int j = 0; j < order; ++j) {
643  if(i == j) {
644  if(matrix[i][j] == std::complex<double>(0.0, 0.0)) return false;
645 
646  std::complex<double> factor = (matrix[i][j] - std::complex<double>(1.0, 0.0)) / matrix[i][j];
647  for(int k = 0; k < order; ++k) {
648  matrix[j][k] -= factor * matrix[i][k];
649  inverse[j][k] -= factor * inverse[i][k];
650  }
651  }
652  }
653  }
654 
655  return true;
656 }
657 
658 void ElectricCalculation::ABCtoDQ0(std::complex<double> complexValue, double angle, double& dValue, double& qValue)
659 {
660  dValue = -std::real(complexValue) * std::sin(angle) + std::imag(complexValue) * std::cos(angle);
661  qValue = std::real(complexValue) * std::cos(angle) + std::imag(complexValue) * std::sin(angle);
662 }
663 
664 void ElectricCalculation::DQ0toABC(double dValue, double qValue, double angle, std::complex<double>& complexValue)
665 {
666  double real = qValue * std::cos(angle) - dValue * std::sin(angle);
667  double imag = qValue * std::sin(angle) + dValue * std::cos(angle);
668  complexValue = std::complex<double>(real, imag);
669 }
670 
671 std::vector<std::complex<double> > ElectricCalculation::GaussianElimination(
672  std::vector<std::vector<std::complex<double> > > matrix,
673  std::vector<std::complex<double> > array)
674 {
675  //[Ref] http://pt.wikipedia.org/wiki/Elimina%C3%A7%C3%A3o_de_Gauss
676 
677  std::vector<std::complex<double> > solution;
678 
679  std::vector<std::vector<std::complex<double> > > triangMatrix;
680  triangMatrix.resize(matrix.size());
681  for(unsigned int i = 0; i < matrix.size(); i++) {
682  triangMatrix[i].resize(matrix.size());
683  }
684 
685  for(unsigned int i = 0; i < matrix.size(); i++) {
686  solution.push_back(array[i]);
687  }
688 
689  for(unsigned int i = 0; i < matrix.size(); i++) {
690  for(unsigned int j = 0; j < matrix.size(); j++) {
691  triangMatrix[i][j] = matrix[i][j];
692  }
693  }
694 
695  for(unsigned int k = 0; k < matrix.size(); k++) {
696  unsigned int k1 = k + 1;
697  for(unsigned int i = k; i < matrix.size(); i++) {
698  if(triangMatrix[i][k] != std::complex<double>(0.0, 0.0)) {
699  for(unsigned int j = k1; j < matrix.size(); j++) {
700  triangMatrix[i][j] = triangMatrix[i][j] / triangMatrix[i][k];
701  }
702  solution[i] = solution[i] / triangMatrix[i][k];
703  }
704  }
705  for(unsigned int i = k1; i < matrix.size(); i++) {
706  if(triangMatrix[i][k] != std::complex<double>(0.0, 0.0)) {
707  for(unsigned int j = k1; j < matrix.size(); j++) {
708  triangMatrix[i][j] -= triangMatrix[k][j];
709  }
710  solution[i] -= solution[k];
711  }
712  }
713  }
714  for(unsigned int i = matrix.size() - 2; i >= 0; i--) {
715  for(unsigned int j = matrix.size() - 1; j >= i + 1; j--) {
716  solution[i] -= triangMatrix[i][j] * solution[j];
717  }
718  }
719 
720  return solution;
721 }
722 
723 Machines::SyncMachineModel ElectricCalculation::GetMachineModel(SyncGenerator* generator)
724 {
725  auto data = generator->GetElectricalData();
726  if(data.transTd0 != 0.0) {
727  if(data.transTq0 != 0.0) {
728  if(data.subTd0 != 0.0 || data.subTq0 != 0.0) {
729  return Machines::SM_MODEL_5;
730  }
731  return Machines::SM_MODEL_3;
732  } else {
733  if(data.subTd0 != 0.0 || data.subTq0 != 0.0) {
734  return Machines::SM_MODEL_4;
735  }
736  return Machines::SM_MODEL_2;
737  }
738  }
739 
740  return Machines::SM_MODEL_1;
741 }
742 
743 std::vector<std::complex<double> > ElectricCalculation::ComplexMatrixTimesVector(
744  std::vector<std::vector<std::complex<double> > > matrix,
745  std::vector<std::complex<double> > vector)
746 {
747  std::vector<std::complex<double> > solution;
748  for(unsigned int i = 0; i < matrix.size(); i++) {
749  solution.push_back(std::complex<double>(0.0, 0.0));
750 
751  for(unsigned int j = 0; j < matrix.size(); j++) {
752  solution[i] += matrix[i][j] * vector[j];
753  }
754  }
755 
756  return solution;
757 }
758 
759 void ElectricCalculation::GetLUDecomposition(std::vector<std::vector<std::complex<double> > > matrix,
760  std::vector<std::vector<std::complex<double> > >& matrixL,
761  std::vector<std::vector<std::complex<double> > >& matrixU)
762 {
763  // Doolittle method
764  // [Ref] http://www3.nd.edu/~zxu2/acms40390F11/Alg-LU-Crout.pdf
765  // [Ref] http://www.engr.colostate.edu/~thompson/hPage/CourseMat/Tutorials/CompMethods/doolittle.pdf
766 
767  int size = static_cast<int>(matrix.size()); // Decomposed matrix size.
768 
769  // Set upper and lower matrices sizes.
770  matrixL.resize(size);
771  matrixU.resize(size);
772  for(int i = 0; i < size; i++) {
773  matrixL[i].resize(size);
774  matrixU[i].resize(size);
775  }
776 
777  // First row of upper matrix and first column of lower matrix.
778  for(int i = 0; i < size; i++) {
779  matrixU[0][i] = matrix[0][i];
780  matrixL[i][0] = matrix[i][0] / matrixU[0][0];
781  }
782 
783  // Lower matrix main diagonal.
784  for(int i = 1; i < size; i++) {
785  matrixL[i][i] = std::complex<double>(1.0, 0.0);
786  }
787 
788  for(int i = 1; i < size - 1; i++) {
789  // Upper matrix main diagonal.
790  matrixU[i][i] = matrix[i][i];
791  for(int k = 0; k < i; k++) {
792  matrixU[i][i] -= matrixL[i][k] * matrixU[k][i];
793  }
794 
795  // Others elements of upper matrix
796  for(int j = i + 1; j < size; j++) {
797  matrixU[i][j] = matrix[i][j];
798  for(int k = 0; k < i; k++) {
799  matrixU[i][j] -= matrixL[i][k] * matrixU[k][j];
800  }
801  }
802 
803  // Lower matrix elements
804  for(int j = i + 1; j < size; j++) {
805  matrixL[j][i] = matrix[j][i];
806  for(int k = 0; k < i; k++) {
807  matrixL[j][i] -= matrixL[j][k] * matrixU[k][i];
808  }
809  matrixL[j][i] = matrixL[j][i] / matrixU[i][i];
810  }
811  }
812 
813  // Last element of upper matrix.
814  matrixU[size - 1][size - 1] = matrix[size - 1][size - 1];
815  for(int k = 0; k < size - 1; k++) {
816  matrixU[size - 1][size - 1] -= matrixL[size - 1][k] * matrixU[k][size - 1];
817  }
818 }
819 
820 std::vector<std::complex<double> > ElectricCalculation::LUEvaluate(std::vector<std::vector<std::complex<double> > > u,
821  std::vector<std::vector<std::complex<double> > > l,
822  std::vector<std::complex<double> > b)
823 {
824  int size = static_cast<int>(b.size());
825  std::vector<std::complex<double> > x;
826  std::vector<std::complex<double> > y;
827  x.resize(size);
828  y.resize(size);
829 
830  // Forward
831  for(int i = 0; i < size; i++) {
832  y[i] = b[i];
833  for(int j = 0; j < i; j++) {
834  y[i] -= l[i][j] * y[j];
835  }
836  y[i] /= l[i][i];
837  }
838  // Backward
839  for(int i = size - 1; i >= 0; i--) {
840  x[i] = y[i];
841  for(int j = i + 1; j < size; j++) {
842  x[i] -= u[i][j] * x[j];
843  }
844  x[i] /= u[i][i];
845  }
846  return x;
847 }
+ + +
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:506
+
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: PowerElement.h:187
Base class of electric calculations, with general methods.
- - - - - - - -
Definition: Bus.h:45
-
~ElectricCalculation()
Destructor.
-
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: Machines.cpp:250
-
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:219
-
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
- -
virtual bool InvertMatrix(std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::vector< std::complex< double > > > &inverse)
Invert a matrix.
-
Definition: Line.h:35
-
Definition: Load.h:23
- - - -
virtual bool GetYBus(std::vector< std::vector< std::complex< double > > > &yBus, double systemPowerBase, YBusSequence sequence=POSITIVE_SEQ, bool includeSyncMachines=false, bool allLoadsAsImpedances=false)
Get the admittance matrix from the list of elements (use GetElementsFromList first).
-
virtual void UpdateElementsPowerFlow(std::vector< std::complex< double > > voltage, std::vector< std::complex< double > > power, std::vector< BusType > busType, std::vector< ReactiveLimits > reactiveLimit, double systemPowerBase)
Update the elements after the power flow calculation.
- - - -
ElectricCalculation()
Constructor.
- - - - -
virtual void GetElementsFromList(std::vector< Element *> elementList)
Separate the power elements from a generic list.
- -
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: Line.cpp:429
- - - + + + + + + + +
Definition: Bus.h:62
+
~ElectricCalculation()
Destructor.
+
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: Machines.cpp:267
+
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:227
+
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
+ +
virtual bool InvertMatrix(std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::vector< std::complex< double > > > &inverse)
Invert a matrix.
+
Definition: Line.h:52
+
Definition: Load.h:35
+ + + +
virtual bool GetYBus(std::vector< std::vector< std::complex< double > > > &yBus, double systemPowerBase, YBusSequence sequence=POSITIVE_SEQ, bool includeSyncMachines=false, bool allLoadsAsImpedances=false)
Get the admittance matrix from the list of elements (use GetElementsFromList first).
+
virtual void UpdateElementsPowerFlow(std::vector< std::complex< double > > voltage, std::vector< std::complex< double > > power, std::vector< BusType > busType, std::vector< ReactiveLimits > reactiveLimit, double systemPowerBase)
Update the elements after the power flow calculation.
+ + + +
ElectricCalculation()
Constructor.
+ + + + +
virtual void GetElementsFromList(std::vector< Element *> elementList)
Separate the power elements from a generic list.
+ +
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: Line.cpp:449
+ + +
diff --git a/docs/doxygen/html/_electric_calculation_8h.html b/docs/doxygen/html/_electric_calculation_8h.html index 09344ca..900a8c0 100644 --- a/docs/doxygen/html/_electric_calculation_8h.html +++ b/docs/doxygen/html/_electric_calculation_8h.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/_electric_calculation_8h_source.html b/docs/doxygen/html/_electric_calculation_8h_source.html index 0957abb..8715e9c 100644 --- a/docs/doxygen/html/_electric_calculation_8h_source.html +++ b/docs/doxygen/html/_electric_calculation_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,20 +88,20 @@ $(document).ready(function(){initNavTree('_electric_calculation_8h_source.html',
ElectricCalculation.h
-Go to the documentation of this file.
1 #ifndef ELECTRICCALCULATION_H
2 #define ELECTRICCALCULATION_H
3 
4 #include <vector>
5 #include <complex>
6 
7 #include "Element.h"
8 #include "PowerElement.h"
9 #include "Bus.h"
10 #include "Capacitor.h"
11 #include "IndMotor.h"
12 #include "Inductor.h"
13 #include "Line.h"
14 #include "Load.h"
15 #include "SyncGenerator.h"
16 #include "SyncMotor.h"
17 #include "Transformer.h"
18 
19 #include "PropertiesData.h"
20 
21 enum BusType { BUS_SLACK = 0, BUS_PV, BUS_PQ };
22 
23 enum ReactiveLimitsType {
24  RL_UNLIMITED = 0, // The bus can generate any ammount of reactive power.
25  RL_LIMITED, // The bus reactive power generation is limited.
26  RL_UNLIMITED_SOURCE, // The bus have at least one source of infinite reative power.
27  RL_MAX_REACHED, // Max limit reached
28  RL_MIN_REACHED, // Min limit reached
29  RL_NONE_REACHED // No limits reached
30 };
31 
32 enum YBusSequence { POSITIVE_SEQ = 0, NEGATIVE_SEQ, ZERO_SEQ };
33 
35  double maxLimit = 0.0;
36  double minLimit = 0.0;
37  ReactiveLimitsType maxLimitType = RL_UNLIMITED;
38  ReactiveLimitsType minLimitType = RL_UNLIMITED;
39  ReactiveLimitsType limitReached = RL_NONE_REACHED;
40 };
41 
50 {
51  public:
56 
61 
66  virtual void GetElementsFromList(std::vector<Element*> elementList);
67 
76  virtual bool GetYBus(std::vector<std::vector<std::complex<double> > >& yBus,
77  double systemPowerBase,
78  YBusSequence sequence = POSITIVE_SEQ,
79  bool includeSyncMachines = false,
80  bool allLoadsAsImpedances = false);
81 
88  virtual bool InvertMatrix(std::vector<std::vector<std::complex<double> > > matrix,
89  std::vector<std::vector<std::complex<double> > >& inverse);
90 
99  virtual void UpdateElementsPowerFlow(std::vector<std::complex<double> > voltage,
100  std::vector<std::complex<double> > power,
101  std::vector<BusType> busType,
102  std::vector<ReactiveLimits> reactiveLimit,
103  double systemPowerBase);
104 
105  void ABCtoDQ0(std::complex<double> complexValue, double angle, double& dValue, double& qValue);
106  void DQ0toABC(double dValue, double qValue, double angle, std::complex<double>& complexValue);
107 
108  std::vector<std::complex<double> > GaussianElimination(std::vector<std::vector<std::complex<double> > > matrix,
109  std::vector<std::complex<double> > array);
110 
111  Machines::SyncMachineModel GetMachineModel(SyncGenerator* generator);
112 
113  std::vector<std::complex<double> > ComplexMatrixTimesVector(std::vector<std::vector<std::complex<double> > > matrix,
114  std::vector<std::complex<double> > vector);
115 
116  void GetLUDecomposition(std::vector<std::vector<std::complex<double> > > matrix,
117  std::vector<std::vector<std::complex<double> > >& matrixL,
118  std::vector<std::vector<std::complex<double> > >& matrixU);
119 
120  std::vector<std::complex<double> > LUEvaluate(std::vector<std::vector<std::complex<double> > > u,
121  std::vector<std::vector<std::complex<double> > > l,
122  std::vector<std::complex<double> > b);
123 
128  const std::vector<Bus*> GetBusList() const { return m_busList; }
133  const std::vector<Capacitor*> GetCapacitorList() const { return m_capacitorList; }
138  const std::vector<IndMotor*> GetIndMotorList() const { return m_indMotorList; }
143  const std::vector<Inductor*> GetInductorList() const { return m_inductorList; }
148  const std::vector<Line*> GetLineList() const { return m_lineList; }
153  const std::vector<Load*> GetLoadList() const { return m_loadList; }
158  const std::vector<SyncGenerator*> GetSyncGeneratorList() const { return m_syncGeneratorList; }
163  const std::vector<SyncMotor*> GetSyncMotorList() const { return m_syncMotorList; }
168  const std::vector<Transformer*> GetTransformerList() const { return m_transformerList; }
169  protected:
170  std::vector<PowerElement*> m_powerElementList;
171  std::vector<Bus*> m_busList;
172  std::vector<Capacitor*> m_capacitorList;
173  std::vector<IndMotor*> m_indMotorList;
174  std::vector<Inductor*> m_inductorList;
175  std::vector<Line*> m_lineList;
176  std::vector<Load*> m_loadList;
177  std::vector<SyncGenerator*> m_syncGeneratorList;
178  std::vector<SyncMotor*> m_syncMotorList;
179  std::vector<Transformer*> m_transformerList;
180 };
181 
182 #endif // ELECTRICCALCULATION_H
const std::vector< Transformer * > GetTransformerList() const
Get the transformers of the system (use GetElementsFromList first).
-
const std::vector< IndMotor * > GetIndMotorList() const
Get the induction motors of the system (use GetElementsFromList first).
- - -
const std::vector< Bus * > GetBusList() const
Get the buses of the system (use GetElementsFromList first).
-
const std::vector< SyncGenerator * > GetSyncGeneratorList() const
Get the synchronous generators of the system (use GetElementsFromList first).
-
const std::vector< Inductor * > GetInductorList() const
Get the inductors of the system (use GetElementsFromList first).
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ELECTRICCALCULATION_H
19 #define ELECTRICCALCULATION_H
20 
21 #include <vector>
22 #include <complex>
23 
24 #include "Element.h"
25 #include "PowerElement.h"
26 #include "Bus.h"
27 #include "Capacitor.h"
28 #include "IndMotor.h"
29 #include "Inductor.h"
30 #include "Line.h"
31 #include "Load.h"
32 #include "SyncGenerator.h"
33 #include "SyncMotor.h"
34 #include "Transformer.h"
35 
36 #include "PropertiesData.h"
37 
38 enum BusType { BUS_SLACK = 0, BUS_PV, BUS_PQ };
39 
40 enum ReactiveLimitsType {
41  RL_UNLIMITED = 0, // The bus can generate any ammount of reactive power.
42  RL_LIMITED, // The bus reactive power generation is limited.
43  RL_UNLIMITED_SOURCE, // The bus have at least one source of infinite reative power.
44  RL_MAX_REACHED, // Max limit reached
45  RL_MIN_REACHED, // Min limit reached
46  RL_NONE_REACHED // No limits reached
47 };
48 
49 enum YBusSequence { POSITIVE_SEQ = 0, NEGATIVE_SEQ, ZERO_SEQ };
50 
52  double maxLimit = 0.0;
53  double minLimit = 0.0;
54  ReactiveLimitsType maxLimitType = RL_UNLIMITED;
55  ReactiveLimitsType minLimitType = RL_UNLIMITED;
56  ReactiveLimitsType limitReached = RL_NONE_REACHED;
57 };
58 
67 {
68  public:
73 
78 
83  virtual void GetElementsFromList(std::vector<Element*> elementList);
84 
93  virtual bool GetYBus(std::vector<std::vector<std::complex<double> > >& yBus,
94  double systemPowerBase,
95  YBusSequence sequence = POSITIVE_SEQ,
96  bool includeSyncMachines = false,
97  bool allLoadsAsImpedances = false);
98 
105  virtual bool InvertMatrix(std::vector<std::vector<std::complex<double> > > matrix,
106  std::vector<std::vector<std::complex<double> > >& inverse);
107 
116  virtual void UpdateElementsPowerFlow(std::vector<std::complex<double> > voltage,
117  std::vector<std::complex<double> > power,
118  std::vector<BusType> busType,
119  std::vector<ReactiveLimits> reactiveLimit,
120  double systemPowerBase);
121 
122  void ABCtoDQ0(std::complex<double> complexValue, double angle, double& dValue, double& qValue);
123  void DQ0toABC(double dValue, double qValue, double angle, std::complex<double>& complexValue);
124 
125  std::vector<std::complex<double> > GaussianElimination(std::vector<std::vector<std::complex<double> > > matrix,
126  std::vector<std::complex<double> > array);
127 
128  Machines::SyncMachineModel GetMachineModel(SyncGenerator* generator);
129 
130  std::vector<std::complex<double> > ComplexMatrixTimesVector(std::vector<std::vector<std::complex<double> > > matrix,
131  std::vector<std::complex<double> > vector);
132 
133  void GetLUDecomposition(std::vector<std::vector<std::complex<double> > > matrix,
134  std::vector<std::vector<std::complex<double> > >& matrixL,
135  std::vector<std::vector<std::complex<double> > >& matrixU);
136 
137  std::vector<std::complex<double> > LUEvaluate(std::vector<std::vector<std::complex<double> > > u,
138  std::vector<std::vector<std::complex<double> > > l,
139  std::vector<std::complex<double> > b);
140 
145  const std::vector<Bus*> GetBusList() const { return m_busList; }
150  const std::vector<Capacitor*> GetCapacitorList() const { return m_capacitorList; }
155  const std::vector<IndMotor*> GetIndMotorList() const { return m_indMotorList; }
160  const std::vector<Inductor*> GetInductorList() const { return m_inductorList; }
165  const std::vector<Line*> GetLineList() const { return m_lineList; }
170  const std::vector<Load*> GetLoadList() const { return m_loadList; }
175  const std::vector<SyncGenerator*> GetSyncGeneratorList() const { return m_syncGeneratorList; }
180  const std::vector<SyncMotor*> GetSyncMotorList() const { return m_syncMotorList; }
185  const std::vector<Transformer*> GetTransformerList() const { return m_transformerList; }
186  protected:
187  std::vector<PowerElement*> m_powerElementList;
188  std::vector<Bus*> m_busList;
189  std::vector<Capacitor*> m_capacitorList;
190  std::vector<IndMotor*> m_indMotorList;
191  std::vector<Inductor*> m_inductorList;
192  std::vector<Line*> m_lineList;
193  std::vector<Load*> m_loadList;
194  std::vector<SyncGenerator*> m_syncGeneratorList;
195  std::vector<SyncMotor*> m_syncMotorList;
196  std::vector<Transformer*> m_transformerList;
197 };
198 
199 #endif // ELECTRICCALCULATION_H
const std::vector< Transformer * > GetTransformerList() const
Get the transformers of the system (use GetElementsFromList first).
+
const std::vector< IndMotor * > GetIndMotorList() const
Get the induction motors of the system (use GetElementsFromList first).
+ + +
const std::vector< Bus * > GetBusList() const
Get the buses of the system (use GetElementsFromList first).
+
const std::vector< SyncGenerator * > GetSyncGeneratorList() const
Get the synchronous generators of the system (use GetElementsFromList first).
+
const std::vector< Inductor * > GetInductorList() const
Get the inductors of the system (use GetElementsFromList first).
Class to manage color of OpenGL.
-
const std::vector< Capacitor * > GetCapacitorList() const
Get the capacitors of the system (use GetElementsFromList first).
-
const std::vector< Load * > GetLoadList() const
Get the loads of the system (use GetElementsFromList first).
+
const std::vector< Capacitor * > GetCapacitorList() const
Get the capacitors of the system (use GetElementsFromList first).
+
const std::vector< Load * > GetLoadList() const
Get the loads of the system (use GetElementsFromList first).
Switching data of power elements.
-
const std::vector< SyncMotor * > GetSyncMotorList() const
Get the synchronous motors of the system (use GetElementsFromList first).
- -
const std::vector< Line * > GetLineList() const
Get the lines of the system (use GetElementsFromList first).
+
const std::vector< SyncMotor * > GetSyncMotorList() const
Get the synchronous motors of the system (use GetElementsFromList first).
+ +
const std::vector< Line * > GetLineList() const
Get the lines of the system (use GetElementsFromList first).
diff --git a/docs/doxygen/html/_electromechanical_8cpp_source.html b/docs/doxygen/html/_electromechanical_8cpp_source.html index e256d0e..ad6d4e0 100644 --- a/docs/doxygen/html/_electromechanical_8cpp_source.html +++ b/docs/doxygen/html/_electromechanical_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,39 +88,34 @@ $(document).ready(function(){initNavTree('_electromechanical_8cpp_source.html','
Electromechanical.cpp
-
1 #include "Electromechanical.h"
2 #include "ControlElementSolver.h"
3 
4 Electromechanical::Electromechanical(wxWindow* parent, std::vector<Element*> elementList, SimulationData data)
5 {
6  m_parent = parent;
7  GetElementsFromList(elementList);
8  SetEventTimeList();
9 
10  m_powerSystemBase = GetPowerValue(data.basePower, data.basePowerUnit);
11  m_systemFreq = data.stabilityFrequency;
12  m_simTime = data.stabilitySimulationTime;
13  m_timeStep = data.timeStep;
14  m_tolerance = data.stabilityTolerance;
15  m_maxIterations = data.stabilityMaxIterations;
16 
17  m_ctrlTimeStepMultiplier = 1.0 / static_cast<double>(data.controlTimeStepRatio);
18 
19  m_plotTime = data.plotTime;
20  m_useCOI = data.useCOI;
21 }
22 
23 Electromechanical::~Electromechanical() {}
24 bool Electromechanical::RunStabilityCalculation()
25 {
26  wxProgressDialog pbd(_("Running simulation"), _("Initializing..."), 100, m_parent,
27  wxPD_APP_MODAL | wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_SMOOTH);
28 
29  SetSyncMachinesModel();
30 
31  // Calculate the admittance matrix with the synchronous machines.
32  if(!GetYBus(m_yBus, m_powerSystemBase, POSITIVE_SEQ, false, true)) {
33  m_errorMsg = _("It was not possible to build the admittance matrix.");
34  return false;
35  }
36  InsertSyncMachinesOnYBus();
37  GetLUDecomposition(m_yBus, m_yBusL, m_yBusU);
38 
39  // Get buses voltages.
40  m_vBus.clear();
41  m_vBus.resize(m_busList.size());
42  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
43  Bus* bus = *it;
44  auto data = bus->GetElectricalData();
45  m_vBus[data.number] = data.voltage;
46  }
47 
48  // Calculate injected currents
49  m_iBus = ComplexMatrixTimesVector(m_yBus, m_vBus);
50  for(unsigned int i = 0; i < m_iBus.size(); ++i) {
51  if(std::abs(m_iBus[i]) < 1e-5) m_iBus[i] = std::complex<double>(0.0, 0.0);
52  }
53 
54  if(!InitializeDynamicElements()) return false;
55 
56  double pbdTime = m_plotTime;
57  double currentTime = 0.0;
58  double currentPlotTime = 0.0;
59  double currentPbdTime = 0.0;
60  while(currentTime < m_simTime) {
61  if(HasEvent(currentTime)) {
62  SetEvent(currentTime);
63  GetLUDecomposition(m_yBus, m_yBusL, m_yBusU);
64  }
65 
66  if(currentPlotTime >= m_plotTime || currentTime == 0.0) {
67  m_timeVector.push_back(currentTime);
68  SaveData();
69  currentPlotTime = 0.0;
70  }
71 
72  if(currentPbdTime > pbdTime) {
73  if(!pbd.Update((currentTime / m_simTime) * 100, wxString::Format("Time = %.2fs", currentTime))) {
74  m_errorMsg = wxString::Format(_("Simulation cancelled at %.2fs."), currentTime);
75  pbd.Update(100);
76  return false;
77  }
78  currentPbdTime = 0.0;
79  }
80 
81  if(!SolveSynchronousMachines()) return false;
82 
83  currentTime += m_timeStep;
84  currentPlotTime += m_timeStep;
85  currentPbdTime += m_timeStep;
86  }
87  return true;
88 }
89 
90 void Electromechanical::SetEventTimeList()
91 {
92  // Fault
93  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
94  Bus* bus = *it;
95  auto data = bus->GetElectricalData();
96  if(data.stabHasFault) {
97  m_eventTimeList.push_back(data.stabFaultTime);
98  m_eventOccurrenceList.push_back(false);
99  m_eventTimeList.push_back(data.stabFaultTime + data.stabFaultLength);
100  m_eventOccurrenceList.push_back(false);
101  }
102  }
103  // Switching
104  for(auto it = m_powerElementList.begin(), itEnd = m_powerElementList.end(); it != itEnd; ++it) {
105  PowerElement* element = *it;
106  SwitchingData swData = element->GetSwitchingData();
107  for(unsigned int i = 0; i < swData.swTime.size(); ++i) {
108  m_eventTimeList.push_back(swData.swTime[i]);
109  m_eventOccurrenceList.push_back(false);
110  }
111  }
112 }
113 
114 bool Electromechanical::HasEvent(double currentTime)
115 {
116  for(unsigned int i = 0; i < m_eventTimeList.size(); ++i) {
117  if(!m_eventOccurrenceList[i]) {
118  if(EventTrigger(m_eventTimeList[i], currentTime)) {
119  m_eventOccurrenceList[i] = true;
120  return true;
121  }
122  }
123  }
124  return false;
125 }
126 
127 void Electromechanical::SetEvent(double currentTime)
128 {
129  // Fault
130  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
131  Bus* bus = *it;
132  auto data = bus->GetElectricalData();
133  if(data.stabHasFault) {
134  int n = data.number;
135 
136  // Insert fault
137  if(EventTrigger(data.stabFaultTime, currentTime)) {
138  double r, x;
139  r = data.stabFaultResistance;
140  x = data.stabFaultReactance;
141  if(x < 1e-5) x = 1e-5;
142  m_yBus[n][n] += std::complex<double>(1.0, 0.0) / std::complex<double>(r, x);
143  }
144 
145  // Remove fault
146  else if(EventTrigger(data.stabFaultTime + data.stabFaultLength, currentTime)) {
147  double r, x;
148  r = data.stabFaultResistance;
149  x = data.stabFaultReactance;
150  if(x < 1e-5) x = 1e-5;
151  m_yBus[n][n] -= std::complex<double>(1.0, 0.0) / std::complex<double>(r, x);
152  }
153  }
154  }
155 
156  // SyncGenerator switching
157  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
158  SyncGenerator* generator = *it;
159  auto swData = generator->GetSwitchingData();
160  for(unsigned int i = 0; i < swData.swType.size(); ++i) {
161  if(EventTrigger(swData.swTime[i], currentTime)) {
162  // Remove machine (only connected machines)
163  if(swData.swType[i] == SW_REMOVE && generator->IsOnline()) {
164  generator->SetOnline(false);
165  int n = static_cast<Bus*>(generator->GetParentList()[0])->GetElectricalData().number;
166  m_yBus[n][n] -= GetSyncMachineAdmittance(generator);
167  }
168 
169  // Insert machine (only disconnected machines)
170  if(swData.swType[i] == SW_INSERT && !generator->IsOnline() && generator->GetParentList().size() == 1) {
171  if(generator->SetOnline(true)) {
172  int n = static_cast<Bus*>(generator->GetParentList()[0])->GetElectricalData().number;
173  m_yBus[n][n] += GetSyncMachineAdmittance(generator);
174  }
175  }
176  }
177  }
178  }
179 
180  // Load switching
181  for(auto it = m_loadList.begin(), itEnd = m_loadList.end(); it != itEnd; ++it) {
182  Load* load = *it;
183  auto swData = load->GetSwitchingData();
184  for(unsigned int i = 0; i < swData.swType.size(); ++i) {
185  if(EventTrigger(swData.swTime[i], currentTime)) {
186  // Remove load (only connected loads)
187  if(swData.swType[i] == SW_REMOVE && load->IsOnline()) {
188  load->SetOnline(false);
189  auto data = load->GetPUElectricalData(m_powerSystemBase);
190  Bus* parentBus = static_cast<Bus*>(load->GetParentList()[0]);
191  int n = parentBus->GetElectricalData().number;
192  std::complex<double> v = parentBus->GetElectricalData().voltage;
193  m_yBus[n][n] -= std::complex<double>(data.activePower, -data.reactivePower) / (v * v);
194  }
195 
196  // Insert load (only disconnected load)
197  if(swData.swType[i] == SW_INSERT && !load->IsOnline() && load->GetParentList().size() == 1) {
198  if(load->SetOnline(true)) {
199  auto data = load->GetPUElectricalData(m_powerSystemBase);
200  Bus* parentBus = static_cast<Bus*>(load->GetParentList()[0]);
201  int n = parentBus->GetElectricalData().number;
202  std::complex<double> v = parentBus->GetElectricalData().voltage;
203  m_yBus[n][n] += std::complex<double>(data.activePower, -data.reactivePower) / (v * v);
204  }
205  }
206  }
207  }
208  }
209 
210  // Line switching
211  for(auto it = m_lineList.begin(), itEnd = m_lineList.end(); it != itEnd; ++it) {
212  Line* line = *it;
213  auto swData = line->GetSwitchingData();
214  for(unsigned int i = 0; i < swData.swType.size(); ++i) {
215  if(EventTrigger(swData.swTime[i], currentTime)) {
216  // Remove line (only connected lines)
217  if(swData.swType[i] == SW_REMOVE && line->IsOnline()) {
218  line->SetOnline(false);
219  auto data = line->GetElectricalData();
220 
221  int n1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().number;
222  int n2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().number;
223 
224  m_yBus[n1][n2] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
225  m_yBus[n2][n1] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
226 
227  m_yBus[n1][n1] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
228  m_yBus[n2][n2] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
229 
230  m_yBus[n1][n1] -= std::complex<double>(0.0, data.capSusceptance / 2.0);
231  m_yBus[n2][n2] -= std::complex<double>(0.0, data.capSusceptance / 2.0);
232  }
233 
234  // Insert line (only disconnected lines)
235  if(swData.swType[i] == SW_INSERT && !line->IsOnline() && line->GetParentList().size() == 2) {
236  if(line->SetOnline(true)) {
237  auto data = line->GetElectricalData();
238 
239  int n1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().number;
240  int n2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().number;
241 
242  m_yBus[n1][n2] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
243  m_yBus[n2][n1] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
244 
245  m_yBus[n1][n1] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
246  m_yBus[n2][n2] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
247 
248  m_yBus[n1][n1] += std::complex<double>(0.0, data.capSusceptance / 2.0);
249  m_yBus[n2][n2] += std::complex<double>(0.0, data.capSusceptance / 2.0);
250  }
251  }
252  }
253  }
254  }
255 
256  // Transformer switching
257  for(auto it = m_transformerList.begin(), itEnd = m_transformerList.end(); it != itEnd; ++it) {
258  Transformer* transformer = *it;
259  auto swData = transformer->GetSwitchingData();
260  for(unsigned int i = 0; i < swData.swType.size(); ++i) {
261  if(EventTrigger(swData.swTime[i], currentTime)) {
262  // Remove transformer (only connected transformers)
263  if(swData.swType[i] == SW_REMOVE && transformer->IsOnline()) {
264  transformer->SetOnline(false);
265  auto data = transformer->GetElectricalData();
266 
267  int n1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().number;
268  int n2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().number;
269 
270  if(data.turnsRatio == 1.0 && data.phaseShift == 0.0) {
271  m_yBus[n1][n2] -= -1.0 / std::complex<double>(data.resistance, data.indReactance);
272  m_yBus[n2][n1] -= -1.0 / std::complex<double>(data.resistance, data.indReactance);
273 
274  m_yBus[n1][n1] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
275  m_yBus[n2][n2] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
276  } else {
277  // Complex turns ratio
278  double radPhaseShift = wxDegToRad(data.phaseShift);
279  std::complex<double> a = std::complex<double>(data.turnsRatio * std::cos(radPhaseShift),
280  -data.turnsRatio * std::sin(radPhaseShift));
281 
282  // Transformer admitance
283  std::complex<double> y = 1.0 / std::complex<double>(data.resistance, data.indReactance);
284  m_yBus[n1][n1] -= y / std::pow(std::abs(a), 2.0);
285  m_yBus[n1][n2] -= -(y / std::conj(a));
286  m_yBus[n2][n1] -= -(y / a);
287  m_yBus[n2][n2] -= y;
288  }
289  }
290 
291  // Insert transformer (only disconnected transformers)
292  if(swData.swType[i] == SW_INSERT && !transformer->IsOnline() &&
293  transformer->GetParentList().size() == 2) {
294  if(transformer->SetOnline(true)) {
295  auto data = transformer->GetElectricalData();
296 
297  int n1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().number;
298  int n2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().number;
299 
300  if(data.turnsRatio == 1.0 && data.phaseShift == 0.0) {
301  m_yBus[n1][n2] += -1.0 / std::complex<double>(data.resistance, data.indReactance);
302  m_yBus[n2][n1] += -1.0 / std::complex<double>(data.resistance, data.indReactance);
303 
304  m_yBus[n1][n1] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
305  m_yBus[n2][n2] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
306  } else {
307  // Complex turns ratio
308  double radPhaseShift = wxDegToRad(data.phaseShift);
309  std::complex<double> a = std::complex<double>(data.turnsRatio * std::cos(radPhaseShift),
310  -data.turnsRatio * std::sin(radPhaseShift));
311 
312  // Transformer admitance
313  std::complex<double> y = 1.0 / std::complex<double>(data.resistance, data.indReactance);
314  m_yBus[n1][n1] += y / std::pow(std::abs(a), 2.0);
315  m_yBus[n1][n2] += -(y / std::conj(a));
316  m_yBus[n2][n1] += -(y / a);
317  m_yBus[n2][n2] += y;
318  }
319  }
320  }
321  }
322  }
323  }
324 
325  // Capacitor switching
326  for(auto it = m_capacitorList.begin(), itEnd = m_capacitorList.end(); it != itEnd; ++it) {
327  Capacitor* capacitor = *it;
328  auto swData = capacitor->GetSwitchingData();
329  for(unsigned int i = 0; i < swData.swType.size(); ++i) {
330  if(EventTrigger(swData.swTime[i], currentTime)) {
331  // Remove capacitor (only connected capacitors)
332  if(swData.swType[i] == SW_REMOVE && capacitor->IsOnline()) {
333  capacitor->SetOnline(false);
334  auto data = capacitor->GetPUElectricalData(m_powerSystemBase);
335  int n = static_cast<Bus*>(capacitor->GetParentList()[0])->GetElectricalData().number;
336  m_yBus[n][n] -= std::complex<double>(0.0, data.reactivePower);
337  }
338 
339  // Insert capacitor (only disconnected capacitors)
340  if(swData.swType[i] == SW_INSERT && !capacitor->IsOnline() && capacitor->GetParentList().size() == 1) {
341  if(capacitor->SetOnline(true)) {
342  auto data = capacitor->GetPUElectricalData(m_powerSystemBase);
343  int n = static_cast<Bus*>(capacitor->GetParentList()[0])->GetElectricalData().number;
344  m_yBus[n][n] += std::complex<double>(0.0, data.reactivePower);
345  }
346  }
347  }
348  }
349  }
350 
351  // Inductor switching
352  for(auto it = m_inductorList.begin(), itEnd = m_inductorList.end(); it != itEnd; ++it) {
353  Inductor* inductor = *it;
354  auto swData = inductor->GetSwitchingData();
355  for(unsigned int i = 0; i < swData.swType.size(); ++i) {
356  if(EventTrigger(swData.swTime[i], currentTime)) {
357  // Remove inductor (only connected inductors)
358  if(swData.swType[i] == SW_REMOVE && inductor->IsOnline()) {
359  inductor->SetOnline(false);
360  auto data = inductor->GetPUElectricalData(m_powerSystemBase);
361  int n = static_cast<Bus*>(inductor->GetParentList()[0])->GetElectricalData().number;
362  m_yBus[n][n] -= std::complex<double>(0.0, -data.reactivePower);
363  }
364 
365  // Insert inductor (only disconnected inductors)
366  if(swData.swType[i] == SW_INSERT && !inductor->IsOnline() && inductor->GetParentList().size() == 1) {
367  if(inductor->SetOnline(true)) {
368  auto data = inductor->GetPUElectricalData(m_powerSystemBase);
369  int n = static_cast<Bus*>(inductor->GetParentList()[0])->GetElectricalData().number;
370  m_yBus[n][n] += std::complex<double>(0.0, -data.reactivePower);
371  }
372  }
373  }
374  }
375  }
376 }
377 
378 void Electromechanical::InsertSyncMachinesOnYBus()
379 {
380  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
381  SyncGenerator* generator = *it;
382  if(generator->IsOnline()) {
383  auto data = generator->GetElectricalData();
384  int n = static_cast<Bus*>(generator->GetParentList()[0])->GetElectricalData().number;
385  m_yBus[n][n] += GetSyncMachineAdmittance(generator);
386  }
387  }
388 }
389 
390 bool Electromechanical::EventTrigger(double eventTime, double currentTime)
391 {
392  return (((eventTime - m_timeStep) < currentTime) && (eventTime >= currentTime));
393 }
394 
395 std::complex<double> Electromechanical::GetSyncMachineAdmittance(SyncGenerator* generator)
396 {
397  auto data = generator->GetElectricalData();
398  double k = 1.0; // Power base change factor.
399  if(data.useMachineBase) {
400  double oldBase = GetPowerValue(data.nominalPower, data.nominalPowerUnit);
401  k = m_powerSystemBase / oldBase;
402  }
403 
404  double xd = 0.0;
405  double xq = 0.0;
406  double ra = data.armResistance * k;
407 
408  switch(data.model) {
409  case Machines::SM_MODEL_1: {
410  xq = data.transXd * k;
411  xd = xq;
412  } break;
413  case Machines::SM_MODEL_2: {
414  xd = data.transXd * k;
415  xq = data.transXq * k;
416  if(xq == 0.0) {
417  xq = data.syncXq * k;
418  if(xq == 0.0) {
419  xq = data.syncXd * k;
420  }
421  }
422  } break;
423  case Machines::SM_MODEL_3: {
424  xd = data.transXd * k;
425  xq = data.transXq * k;
426  if(xq == 0.0) xq = xd;
427  } break;
428  case Machines::SM_MODEL_4:
429  case Machines::SM_MODEL_5: {
430  xd = data.subXd * k;
431  xq = data.subXq * k;
432  if(xd == 0.0) xd = xq;
433  if(xq == 0.0) xq = xd;
434  } break;
435  }
436  double xdq = 0.5 * (xd + xq);
437  return (std::complex<double>(ra, -xdq) / std::complex<double>(ra * ra + xd * xq, 0.0));
438 }
439 
440 bool Electromechanical::InitializeDynamicElements()
441 {
442  // Buses
443  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
444  Bus* bus = *it;
445  auto data = bus->GetElectricalData();
446  data.stabVoltageVector.clear();
447  bus->SetElectricalData(data);
448  }
449  // Synchronous generators
450  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
451  SyncGenerator* syncGenerator = *it;
452  auto dataPU = syncGenerator->GetPUElectricalData(m_powerSystemBase);
453  auto data = syncGenerator->GetElectricalData();
454  if(syncGenerator->IsOnline()) {
455  double k = 1.0; // Power base change factor.
456  if(data.useMachineBase) {
457  double oldBase = GetPowerValue(data.nominalPower, data.nominalPowerUnit);
458  k = m_powerSystemBase / oldBase;
459  }
460  data.terminalVoltage = static_cast<Bus*>(syncGenerator->GetParentList()[0])->GetElectricalData().voltage;
461 
462  std::complex<double> conjS(dataPU.activePower, -dataPU.reactivePower);
463  std::complex<double> conjV = std::conj(data.terminalVoltage);
464  std::complex<double> ia = conjS / conjV;
465 
466  double xd = data.syncXd * k;
467  double xq = data.syncXq * k;
468  double ra = data.armResistance * k;
469 
470  if(data.model == Machines::SM_MODEL_1) {
471  xq = data.transXd * k;
472  xd = xq;
473  } else if(data.syncXq == 0.0)
474  xq = data.syncXd * k;
475 
476  // Initialize state variables
477  std::complex<double> eq0 = data.terminalVoltage + std::complex<double>(ra, xq) * ia;
478  data.delta = std::arg(eq0);
479 
480  double fi0 = std::arg(ia);
481  double id0, iq0;
482  // ABCtoDQ0(ia, data.delta - fi0, id0, iq0);
483  iq0 = std::abs(ia) * std::cos(data.delta - fi0);
484  id0 = -std::abs(ia) * std::sin(data.delta - fi0);
485 
486  data.initialFieldVoltage = std::abs(eq0) - (xd - xq) * id0;
487  data.fieldVoltage = data.initialFieldVoltage;
488  data.pm = std::real((data.terminalVoltage * std::conj(ia)) + (std::abs(ia) * std::abs(ia) * ra));
489  data.speed = 2.0 * M_PI * m_systemFreq;
490 
491  data.pe = data.pm;
492  data.electricalPower = std::complex<double>(dataPU.activePower, dataPU.reactivePower);
493 
494  // Variables to extrapolate.
495  data.oldIq = iq0;
496  data.oldId = id0;
497  data.oldPe = data.pe;
498 
499  switch(data.model) {
500  case Machines::SM_MODEL_1: {
501  // double tranXd = data.transXd * k;
502 
503  // data.tranEq = data.initialFieldVoltage + (xd - tranXd) * id0;
504  data.tranEq = std::abs(eq0);
505 
506  data.tranEd = 0.0;
507  data.subEq = 0.0;
508  data.subEd = 0.0;
509  } break;
510  case Machines::SM_MODEL_2: {
511  double tranXd = data.transXd * k;
512 
513  data.tranEq = data.initialFieldVoltage + (xd - tranXd) * id0;
514  data.tranEd = 0.0;
515  data.subEd = 0.0;
516  data.subEq = 0.0;
517  } break;
518  case Machines::SM_MODEL_3: {
519  double tranXd = data.transXd * k;
520  double tranXq = data.transXq * k;
521  if(tranXq == 0.0) tranXq = tranXd;
522 
523  data.tranEq = data.initialFieldVoltage + (xd - tranXd) * id0;
524  data.tranEd = -(xq - tranXq) * iq0;
525 
526  data.subEd = 0.0;
527  data.subEq = 0.0;
528  } break;
529  case Machines::SM_MODEL_4: {
530  double tranXd = data.transXd * k;
531  double subXd = data.subXd * k;
532  double subXq = data.subXq * k;
533  if(subXd == 0.0) subXd = subXq;
534  if(subXq == 0.0) subXq = subXd;
535 
536  data.tranEq = data.initialFieldVoltage + (xd - tranXd) * id0;
537  data.tranEd = 0.0;
538  data.subEq = data.tranEq + (tranXd - subXd) * id0;
539  data.subEd = -(xq - subXq) * iq0;
540  } break;
541  case Machines::SM_MODEL_5: {
542  double tranXd = data.transXd * k;
543  double tranXq = data.transXq * k;
544  double subXd = data.subXd * k;
545  double subXq = data.subXq * k;
546  if(subXd == 0.0) subXd = subXq;
547  if(subXq == 0.0) subXq = subXd;
548 
549  data.tranEq = data.initialFieldVoltage + (xd - tranXd) * id0;
550  data.tranEd = -(xq - tranXq) * iq0;
551  data.subEq = data.tranEq + (tranXd - subXd) * id0;
552  data.subEd = data.tranEd - (tranXq - subXq) * iq0;
553  } break;
554  default:
555  break;
556  }
557 
558  // Initialize controllers
559  if(data.useAVR) {
560  if(data.avrSolver) delete data.avrSolver;
561  data.avrSolver = new ControlElementSolver(data.avr, m_timeStep * m_ctrlTimeStepMultiplier, m_tolerance,
562  false, std::abs(data.terminalVoltage), m_parent);
563  if(!data.avrSolver->IsOK()) {
564  m_errorMsg = _("Error on initializate the AVR of \"") + data.name + _("\".");
565  syncGenerator->SetElectricalData(data);
566  return false;
567  }
568  }
569  if(data.useSpeedGovernor) {
570  if(data.speedGovSolver) delete data.speedGovSolver;
571  data.speedGovSolver = new ControlElementSolver(data.speedGov, m_timeStep * m_ctrlTimeStepMultiplier,
572  m_tolerance, false, data.speed, m_parent);
573  if(!data.speedGovSolver->IsOK()) {
574  m_errorMsg = _("Error on initializate the speed governor of \"") + data.name + _("\".");
575  syncGenerator->SetElectricalData(data);
576  return false;
577  }
578  }
579  } else {
580  // Initialize open circuit machine.
581  }
582  // Reset plot data
583  data.terminalVoltageVector.clear();
584  data.electricalPowerVector.clear();
585  data.mechanicalPowerVector.clear();
586  data.freqVector.clear();
587  data.fieldVoltageVector.clear();
588  data.deltaVector.clear();
589 
590  syncGenerator->SetElectricalData(data);
591  }
592  CalculateReferenceSpeed();
593  return true;
594 }
595 
596 void Electromechanical::CalculateMachinesCurrents()
597 {
598  // Reset injected currents vector
599  for(unsigned int i = 0; i < m_iBus.size(); ++i) m_iBus[i] = std::complex<double>(0.0, 0.0);
600 
601  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
602  SyncGenerator* syncGenerator = *it;
603  auto data = syncGenerator->GetElectricalData();
604  if(syncGenerator->IsOnline()) {
605  double k = 1.0; // Power base change factor.
606  if(data.useMachineBase) {
607  double oldBase = GetPowerValue(data.nominalPower, data.nominalPowerUnit);
608  k = m_powerSystemBase / oldBase;
609  }
610 
611  double xd = 0.0;
612  double xq = 0.0;
613  double ra = data.armResistance * k;
614  int n = static_cast<Bus*>(syncGenerator->GetParentList()[0])->GetElectricalData().number;
615  std::complex<double> e = std::complex<double>(0.0, 0.0);
616  std::complex<double> v = m_vBus[n];
617  std::complex<double> iInj = m_iBus[n];
618  double xdq = 0.0;
619 
620  switch(data.model) {
621  case Machines::SM_MODEL_1: {
622  DQ0toABC(data.tranEd, data.tranEq, data.delta, e);
623  xq = data.transXd * k;
624  xd = xq;
625  } break;
626  case Machines::SM_MODEL_2: {
627  DQ0toABC(data.tranEd, data.tranEq, data.delta, e);
628  xd = data.transXd * k;
629  xq = data.transXq * k;
630  if(xq == 0.0) {
631  xq = data.syncXq * k;
632  if(xq == 0.0) {
633  xq = data.syncXd * k;
634  }
635  }
636  } break;
637  case Machines::SM_MODEL_3: {
638  DQ0toABC(data.tranEd, data.tranEq, data.delta, e);
639  xd = data.transXd * k;
640  xq = data.transXq * k;
641  if(xq == 0.0) xq = xd;
642  } break;
643  case Machines::SM_MODEL_4:
644  case Machines::SM_MODEL_5: {
645  DQ0toABC(data.subEd, data.subEq, data.delta, e);
646  xd = data.subXd * k;
647  xq = data.subXq * k;
648  if(xd == 0.0) xd = xq;
649  if(xq == 0.0) xq = xd;
650  } break;
651  }
652  xdq = 0.5 * (xd + xq);
653 
654  std::complex<double> y0 = std::complex<double>(ra, -xdq) / std::complex<double>(ra * ra + xd * xq, 0.0);
655  std::complex<double> iUnadj = y0 * e;
656 
657  std::complex<double> iAdj =
658  std::complex<double>(0.0, -((0.5 * (xq - xd)) / (ra * ra + xd * xq))) * (std::conj(e) - std::conj(v));
659  iAdj = iAdj * std::cos(2.0 * data.delta) + iAdj * std::complex<double>(0.0, std::sin(2.0 * data.delta));
660 
661  iInj = iUnadj + iAdj;
662 
663  m_iBus[n] += iInj;
664 
665  std::complex<double> iMachine = iInj - y0 * v;
666 
667  data.electricalPower = v * std::conj(iMachine);
668  } else {
669  data.electricalPower = std::complex<double>(0.0, 0.0);
670  }
671 
672  syncGenerator->SetElectricalData(data);
673  }
674 }
675 
676 void Electromechanical::CalculateIntegrationConstants(SyncGenerator* syncGenerator, double id, double iq, double k)
677 {
678  CalculateReferenceSpeed();
679  auto data = syncGenerator->GetElectricalData();
680 
681  double syncXd, syncXq, transXd, transXq, subXd, subXq;
682  syncXd = data.syncXd * k;
683  syncXq = data.syncXq * k;
684  transXd = data.transXd * k;
685  transXq = data.transXq * k;
686  subXd = data.subXd * k;
687  subXq = data.subXq * k;
688 
689  if(syncXq == 0.0) syncXq = syncXd;
690  if(transXq == 0.0) transXq = transXd;
691  if(subXd == 0.0) subXd = subXq;
692  if(subXq == 0.0) subXq = subXd;
693 
694  double transTd0, transTq0, subTd0, subTq0;
695  transTd0 = data.transTd0;
696  transTq0 = data.transTq0;
697  subTd0 = data.subTd0;
698  subTq0 = data.subTq0;
699 
700  if(subTd0 == 0.0) subTd0 = subTq0;
701  if(subTq0 == 0.0) subTq0 = subTd0;
702 
703  // Speed
704  data.icSpeed.m = m_timeStep / ((4.0f * data.inertia / m_refSpeed) / k + m_timeStep * data.damping * k);
705  data.icSpeed.c = (1.0f - 2.0f * data.icSpeed.m * data.damping * k) * data.speed +
706  data.icSpeed.m * (data.pm - data.pe + 2.0f * m_refSpeed * data.damping * k);
707 
708  // Delta
709  data.icDelta.m = 0.5f * m_timeStep;
710  data.icDelta.c = data.delta + data.icDelta.m * (data.speed - 2.0f * m_refSpeed);
711 
712  // Eq'
713  if(data.model == Machines::SM_MODEL_2 || data.model == Machines::SM_MODEL_3 || data.model == Machines::SM_MODEL_4 ||
714  data.model == Machines::SM_MODEL_5) {
715  data.icTranEq.m = m_timeStep / (2.0f * transTd0 + m_timeStep);
716  data.icTranEq.c = (1.0f - 2.0 * data.icTranEq.m) * data.tranEq +
717  data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id);
718  }
719 
720  // Ed'
721  if(data.model == Machines::SM_MODEL_3 || data.model == Machines::SM_MODEL_4 || data.model == Machines::SM_MODEL_5) {
722  data.icTranEd.m = m_timeStep / (2.0f * transTq0 + m_timeStep);
723  data.icTranEd.c = (1.0f - 2.0f * data.icTranEd.m) * data.tranEd - data.icTranEd.m * (syncXq - transXq) * iq;
724  }
725 
726  // Eq''
727  if(data.model == Machines::SM_MODEL_4 || data.model == Machines::SM_MODEL_5) {
728  data.icSubEq.m = m_timeStep / (2.0f * subTd0 + m_timeStep);
729  data.icSubEq.c =
730  (1.0f - 2.0f * data.icSubEq.m) * data.subEq + data.icSubEq.m * (data.tranEq + (transXd - subXd) * id);
731  }
732  // Ed''
733  if(data.model == Machines::SM_MODEL_4) {
734  data.icSubEd.m = m_timeStep / (2.0f * subTq0 + m_timeStep);
735  data.icSubEd.c = (1.0f - 2.0f * data.icSubEd.m) * data.subEd - data.icSubEd.m * (syncXq - subXq) * iq;
736  }
737  if(data.model == Machines::SM_MODEL_5) {
738  data.icSubEd.m = m_timeStep / (2.0f * subTq0 + m_timeStep);
739  data.icSubEd.c =
740  (1.0f - 2.0f * data.icSubEd.m) * data.subEd + data.icSubEd.m * (data.tranEd - (transXq - subXq) * iq);
741  }
742 
743  syncGenerator->SetElectricalData(data);
744 }
745 
746 bool Electromechanical::SolveSynchronousMachines()
747 {
748  // CalculateMachinesCurrents();
749  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
750  SyncGenerator* syncGenerator = *it;
751  auto data = syncGenerator->GetElectricalData();
752 
753  if(syncGenerator->IsOnline()) {
754  int n = static_cast<Bus*>(syncGenerator->GetParentList()[0])->GetElectricalData().number;
755  double id, iq, pe;
756 
757  pe = data.pe;
758 
759  double k = 1.0; // Power base change factor.
760  if(data.useMachineBase) {
761  double oldBase = GetPowerValue(data.nominalPower, data.nominalPowerUnit);
762  k = m_powerSystemBase / oldBase;
763  }
764 
765  std::complex<double> iMachine = std::conj(data.electricalPower) / std::conj(m_vBus[n]);
766 
767  ABCtoDQ0(iMachine, data.delta, id, iq);
768 
769  // Calculate integration constants.
770  CalculateIntegrationConstants(syncGenerator, id, iq, k);
771 
772  CalculateSyncMachineNonIntVariables(syncGenerator, id, iq, pe, k);
773  // Extrapolate nonintegrable variables.
774  id = 2.0 * id - data.oldId;
775  iq = 2.0 * iq - data.oldIq;
776  pe = 2.0 * pe - data.oldPe;
777 
778  CalculateSyncMachineIntVariables(syncGenerator, id, iq, pe, k);
779  } else {
780  CalculateIntegrationConstants(syncGenerator, 0.0f, 0.0f);
781  }
782  }
783 
784  m_wError = 0;
785 
786  double error = 1.0;
787  int iterations = 0;
788  while(error > m_tolerance) {
789  error = 0.0;
790 
791  // Calculate the injected currents.
792  CalculateMachinesCurrents();
793 
794  // Calculate the buses voltages.
795  m_vBus = LUEvaluate(m_yBusU, m_yBusL, m_iBus);
796 
797  // Solve machine equations.
798  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
799  SyncGenerator* syncGenerator = *it;
800 
801  auto data = syncGenerator->GetElectricalData();
802 
803  double id, iq, pe;
804  double k = 1.0; // Power base change factor.
805  if(data.useMachineBase) {
806  double oldBase = GetPowerValue(data.nominalPower, data.nominalPowerUnit);
807  k = m_powerSystemBase / oldBase;
808  }
809 
810  CalculateSyncMachineNonIntVariables(syncGenerator, id, iq, pe, k);
811 
812  double genError = CalculateSyncMachineIntVariables(syncGenerator, id, iq, pe, k);
813 
814  if(genError > error) error = genError;
815  }
816 
817  ++iterations;
818 
819  if(iterations > m_maxIterations) {
820  m_errorMsg = _("Impossible to solve the synchronous generators.\nCheck the system parameters and/or "
821  "decrease the time step.");
822  return false;
823  }
824  }
825  m_numIt = iterations;
826 
827  // Solve controllers.
828  int ctrlRatio = static_cast<int>(1 / m_ctrlTimeStepMultiplier);
829  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
830  SyncGenerator* syncGenerator = *it;
831  auto data = syncGenerator->GetElectricalData();
832  if(data.useAVR && data.avrSolver) {
833  for(int i = 0; i < ctrlRatio; ++i) data.avrSolver->SolveNextStep(std::abs(data.terminalVoltage));
834  data.fieldVoltage = data.initialFieldVoltage + data.avrSolver->GetLastSolution();
835  }
836 
837  if(data.useSpeedGovernor && data.speedGovSolver) {
838  for(int i = 0; i < ctrlRatio; ++i) data.speedGovSolver->SolveNextStep(data.speed);
839  data.pm = data.speedGovSolver->GetLastSolution();
840  }
841  syncGenerator->SetElectricalData(data);
842  }
843 
844  return true;
845 }
846 
847 double Electromechanical::GetPowerValue(double value, ElectricalUnit unit)
848 {
849  switch(unit) {
850  case UNIT_PU: {
851  return value;
852  } break;
853  case UNIT_VA: {
854  return value;
855  } break;
856  case UNIT_kVA: {
857  return value * 1e3;
858  } break;
859  case UNIT_MVA: {
860  return value * 1e6;
861  } break;
862  case UNIT_W: {
863  return value;
864  } break;
865  case UNIT_kW: {
866  return value * 1e3;
867  } break;
868  case UNIT_MW: {
869  return value * 1e6;
870  } break;
871  case UNIT_VAr: {
872  return value;
873  } break;
874  case UNIT_kVAr: {
875  return value * 1e3;
876  } break;
877  case UNIT_MVAr: {
878  return value * 1e6;
879  } break;
880  default: {
881  return 0.0;
882  } break;
883  }
884  return 0.0;
885 }
886 
887 void Electromechanical::SaveData()
888 {
889  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
890  SyncGenerator* syncGenerator = *it;
891  auto data = syncGenerator->GetElectricalData();
892  if(data.plotSyncMachine) {
893  data.terminalVoltageVector.push_back(data.terminalVoltage);
894  data.electricalPowerVector.push_back(data.electricalPower);
895  data.mechanicalPowerVector.push_back(data.pm);
896  data.freqVector.push_back(data.speed / (2.0f * M_PI));
897  data.fieldVoltageVector.push_back(data.fieldVoltage);
898  data.deltaVector.push_back(wxRadToDeg(data.delta));
899  syncGenerator->SetElectricalData(data);
900  }
901  }
902  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
903  Bus* bus = *it;
904  auto data = bus->GetElectricalData();
905  if(data.plotBus) {
906  data.stabVoltageVector.push_back(m_vBus[data.number]);
907  bus->SetElectricalData(data);
908  }
909  }
910 
911  m_wErrorVector.push_back(m_wError);
912  m_numItVector.push_back(m_numIt);
913 }
914 
915 void Electromechanical::SetSyncMachinesModel()
916 {
917  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
918  SyncGenerator* syncGenerator = *it;
919  auto data = syncGenerator->GetElectricalData();
920  data.model = GetMachineModel(syncGenerator);
921  syncGenerator->SetElectricalData(data);
922  }
923 }
924 
925 void Electromechanical::CalculateSyncMachineNonIntVariables(SyncGenerator* syncGenerator,
926  double& id,
927  double& iq,
928  double& pe,
929  double k)
930 {
931  auto data = syncGenerator->GetElectricalData();
932  int n = static_cast<Bus*>(syncGenerator->GetParentList()[0])->GetElectricalData().number;
933 
934  if(syncGenerator->IsOnline()) {
935  data.terminalVoltage = m_vBus[n];
936  }
937 
938  double vd, vq;
939  ABCtoDQ0(data.terminalVoltage, data.delta, vd, vq);
940 
941  if(syncGenerator->IsOnline()) {
942  std::complex<double> iMachine = std::conj(data.electricalPower) / std::conj(m_vBus[n]);
943  ABCtoDQ0(iMachine, data.delta, id, iq);
944 
945  pe = id * vd + iq * vq + (id * id + iq * iq) * data.armResistance * k;
946  } else {
947  pe = id = iq = 0.0f;
948  }
949  data.pe = pe;
950  data.oldId = id;
951  data.oldIq = iq;
952  syncGenerator->SetElectricalData(data);
953 }
954 
955 double Electromechanical::CalculateSyncMachineIntVariables(SyncGenerator* syncGenerator,
956  double id,
957  double iq,
958  double pe,
959  double k)
960 {
961  double error = 0.0;
962  auto data = syncGenerator->GetElectricalData();
963 
964  // Mechanical differential equations.
965  double w = data.icSpeed.c + data.icSpeed.m * (data.pm - pe);
966  error = std::max(error, std::abs(data.speed - w) / m_refSpeed);
967 
968  m_wError += std::abs(data.speed - w) / m_refSpeed;
969 
970  double delta = data.icDelta.c + data.icDelta.m * w;
971  error = std::max(error, std::abs(data.delta - delta));
972 
973  data.speed = w;
974  data.delta = delta;
975 
976  // Electrical differential equations
977  switch(data.model) {
978  case Machines::SM_MODEL_1: {
979  // There is no differential equations.
980  } break;
981  case Machines::SM_MODEL_2: {
982  double tranEq =
983  data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (data.syncXd * k - data.transXd * k) * id);
984  error = std::max(error, std::abs(data.tranEq - tranEq));
985 
986  data.tranEq = tranEq;
987  } break;
988  case Machines::SM_MODEL_3: {
989  double syncXd, syncXq, transXd, transXq;
990  syncXd = data.syncXd * k;
991  syncXq = data.syncXq * k;
992  transXd = data.transXd * k;
993  transXq = data.transXq * k;
994  if(syncXq == 0.0) syncXq = syncXd;
995  if(transXq == 0.0) transXq = transXd;
996 
997  double tranEq = data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id);
998  error = std::max(error, std::abs(data.tranEq - tranEq));
999 
1000  double tranEd = data.icTranEd.c - data.icTranEd.m * (syncXq - transXq) * iq;
1001  error = std::max(error, std::abs(data.tranEd - tranEd));
1002 
1003  data.tranEq = tranEq;
1004  data.tranEd = tranEd;
1005 
1006  if(!syncGenerator->IsOnline()) {
1007  std::complex<double> e;
1008  DQ0toABC(data.tranEd, data.tranEq, data.delta, e);
1009  data.terminalVoltage = e;
1010  }
1011  } break;
1012  case Machines::SM_MODEL_4: {
1013  double syncXd, syncXq, transXd, subXd, subXq;
1014  syncXd = data.syncXd * k;
1015  syncXq = data.syncXq * k;
1016  transXd = data.transXd * k;
1017  subXd = data.subXd * k;
1018  subXq = data.subXq * k;
1019  if(syncXq == 0.0) syncXq = syncXd;
1020  if(subXd == 0.0) subXd = subXq;
1021  if(subXq == 0.0) subXq = subXd;
1022 
1023  double tranEq = data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id);
1024  error = std::max(error, std::abs(data.tranEq - tranEq));
1025 
1026  double subEq = data.icSubEq.c + data.icSubEq.m * (tranEq + (transXd - subXd) * id);
1027  error = std::max(error, std::abs(data.subEq - subEq));
1028 
1029  double subEd = data.icSubEd.c - data.icSubEd.m * (syncXq - subXq) * iq;
1030  error = std::max(error, std::abs(data.subEd - subEd));
1031 
1032  data.tranEq = tranEq;
1033  data.subEq = subEq;
1034  data.subEd = subEd;
1035  } break;
1036  case Machines::SM_MODEL_5: {
1037  double syncXd, syncXq, transXd, transXq, subXd, subXq;
1038  syncXd = data.syncXd * k;
1039  syncXq = data.syncXq * k;
1040  transXd = data.transXd * k;
1041  transXq = data.transXq * k;
1042  subXd = data.subXd * k;
1043  subXq = data.subXq * k;
1044  if(syncXq == 0.0) syncXq = syncXd;
1045  if(transXq == 0.0) transXq = transXd;
1046  if(subXd == 0.0) subXd = subXq;
1047  if(subXq == 0.0) subXq = subXd;
1048 
1049  double tranEq = data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id);
1050  error = std::max(error, std::abs(data.tranEq - tranEq));
1051 
1052  double tranEd = data.icTranEd.c - data.icTranEd.m * (syncXq - transXq) * iq;
1053  error = std::max(error, std::abs(data.tranEd - tranEd));
1054 
1055  double subEq = data.icSubEq.c + data.icSubEq.m * (tranEq + (transXd - subXd) * id);
1056  error = std::max(error, std::abs(data.subEq - subEq));
1057 
1058  double subEd = data.icSubEd.c + data.icSubEd.m * (tranEd - (transXq - subXq) * iq);
1059  error = std::max(error, std::abs(data.subEd - subEd));
1060 
1061  data.tranEq = tranEq;
1062  data.tranEd = tranEd;
1063  data.subEq = subEq;
1064  data.subEd = subEd;
1065  } break;
1066  }
1067 
1068  syncGenerator->SetElectricalData(data);
1069  return error;
1070 }
1071 
1072 void Electromechanical::CalculateReferenceSpeed()
1073 {
1074  if(m_useCOI) {
1075  double sumHW = 0.0;
1076  double sumH = 0.0;
1077  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
1078  SyncGenerator* syncGenerator = *it;
1079  if(syncGenerator->IsOnline()) {
1080  auto data = syncGenerator->GetElectricalData();
1081  double k = 1.0; // Power base change factor.
1082  if(data.useMachineBase) {
1083  double oldBase = GetPowerValue(data.nominalPower, data.nominalPowerUnit);
1084  k = m_powerSystemBase / oldBase;
1085  }
1086  sumH += data.inertia / k;
1087  sumHW += data.inertia * data.speed / k;
1088  }
1089  }
1090  m_refSpeed = sumHW / sumH;
1091  } else {
1092  m_refSpeed = 2.0 * M_PI * m_systemFreq;
1093  }
1094 }
std::vector< double > swTime
Definition: PowerElement.h:78
- -
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:517
-
bool SetOnline(bool online=true)
Set if the element is online or offline.
Definition: Element.cpp:218
- - -
std::vector< SwitchingType > swType
Definition: PowerElement.h:77
-
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
- - - -
Definition: Bus.h:45
-
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:219
- - - - - -
Definition: Line.h:35
-
Definition: Load.h:23
- -
virtual bool GetYBus(std::vector< std::vector< std::complex< double > > > &yBus, double systemPowerBase, YBusSequence sequence=POSITIVE_SEQ, bool includeSyncMachines=false, bool allLoadsAsImpedances=false)
Get the admittance matrix from the list of elements (use GetElementsFromList first).
-
virtual SwitchingData GetSwitchingData()
Returns the switching data of the element.
Definition: PowerElement.h:165
- - - - - -
virtual void GetElementsFromList(std::vector< Element *> elementList)
Separate the power elements from a generic list.
- - - - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Electromechanical.h"
19 #include "ControlElementSolver.h"
20 
21 Electromechanical::Electromechanical(wxWindow* parent, std::vector<Element*> elementList, SimulationData data)
22 {
23  m_parent = parent;
24  GetElementsFromList(elementList);
25  SetEventTimeList();
26 
27  Bus dummyBus;
28  m_powerSystemBase = dummyBus.GetValueFromUnit(data.basePower, data.basePowerUnit);
29  m_systemFreq = data.stabilityFrequency;
30  m_simTime = data.stabilitySimulationTime;
31  m_timeStep = data.timeStep;
32  m_tolerance = data.stabilityTolerance;
33  m_maxIterations = data.stabilityMaxIterations;
34 
35  m_ctrlTimeStepMultiplier = 1.0 / static_cast<double>(data.controlTimeStepRatio);
36 
37  m_plotTime = data.plotTime;
38  m_useCOI = data.useCOI;
39 }
40 
41 Electromechanical::~Electromechanical() {}
42 bool Electromechanical::RunStabilityCalculation()
43 {
44  wxProgressDialog pbd(_("Running simulation"), _("Initializing..."), 100, m_parent,
45  wxPD_APP_MODAL | wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_SMOOTH);
46 
47  SetSyncMachinesModel();
48 
49  // Calculate the admittance matrix with the synchronous machines.
50  if(!GetYBus(m_yBus, m_powerSystemBase, POSITIVE_SEQ, false, true)) {
51  m_errorMsg = _("It was not possible to build the admittance matrix.");
52  return false;
53  }
54  InsertSyncMachinesOnYBus();
55  GetLUDecomposition(m_yBus, m_yBusL, m_yBusU);
56 
57  // Get buses voltages.
58  m_vBus.clear();
59  m_vBus.resize(m_busList.size());
60  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
61  Bus* bus = *it;
62  auto data = bus->GetElectricalData();
63  m_vBus[data.number] = data.voltage;
64  }
65 
66  // Calculate injected currents
67  m_iBus = ComplexMatrixTimesVector(m_yBus, m_vBus);
68  for(unsigned int i = 0; i < m_iBus.size(); ++i) {
69  if(std::abs(m_iBus[i]) < 1e-5) m_iBus[i] = std::complex<double>(0.0, 0.0);
70  }
71 
72  if(!InitializeDynamicElements()) return false;
73 
74  double pbdTime = m_plotTime;
75  double currentTime = 0.0;
76  double currentPlotTime = 0.0;
77  double currentPbdTime = 0.0;
78  while(currentTime < m_simTime) {
79  if(HasEvent(currentTime)) {
80  SetEvent(currentTime);
81  GetLUDecomposition(m_yBus, m_yBusL, m_yBusU);
82  }
83 
84  if(currentPlotTime >= m_plotTime || currentTime == 0.0) {
85  m_timeVector.push_back(currentTime);
86  SaveData();
87  currentPlotTime = 0.0;
88  }
89 
90  if(currentPbdTime > pbdTime) {
91  if(!pbd.Update((currentTime / m_simTime) * 100, wxString::Format("Time = %.2fs", currentTime))) {
92  m_errorMsg = wxString::Format(_("Simulation cancelled at %.2fs."), currentTime);
93  pbd.Update(100);
94  return false;
95  }
96  currentPbdTime = 0.0;
97  }
98 
99  if(!SolveSynchronousMachines()) return false;
100 
101  currentTime += m_timeStep;
102  currentPlotTime += m_timeStep;
103  currentPbdTime += m_timeStep;
104  }
105  return true;
106 }
107 
108 void Electromechanical::SetEventTimeList()
109 {
110  // Fault
111  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
112  Bus* bus = *it;
113  auto data = bus->GetElectricalData();
114  if(data.stabHasFault) {
115  m_eventTimeList.push_back(data.stabFaultTime);
116  m_eventOccurrenceList.push_back(false);
117  m_eventTimeList.push_back(data.stabFaultTime + data.stabFaultLength);
118  m_eventOccurrenceList.push_back(false);
119  }
120  }
121  // Switching
122  for(auto it = m_powerElementList.begin(), itEnd = m_powerElementList.end(); it != itEnd; ++it) {
123  PowerElement* element = *it;
124  SwitchingData swData = element->GetSwitchingData();
125  for(unsigned int i = 0; i < swData.swTime.size(); ++i) {
126  m_eventTimeList.push_back(swData.swTime[i]);
127  m_eventOccurrenceList.push_back(false);
128  }
129  }
130 }
131 
132 bool Electromechanical::HasEvent(double currentTime)
133 {
134  for(unsigned int i = 0; i < m_eventTimeList.size(); ++i) {
135  if(!m_eventOccurrenceList[i]) {
136  if(EventTrigger(m_eventTimeList[i], currentTime)) {
137  m_eventOccurrenceList[i] = true;
138  return true;
139  }
140  }
141  }
142  return false;
143 }
144 
145 void Electromechanical::SetEvent(double currentTime)
146 {
147  // Fault
148  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
149  Bus* bus = *it;
150  auto data = bus->GetElectricalData();
151  if(data.stabHasFault) {
152  int n = data.number;
153 
154  // Insert fault
155  if(EventTrigger(data.stabFaultTime, currentTime)) {
156  double r, x;
157  r = data.stabFaultResistance;
158  x = data.stabFaultReactance;
159  if(x < 1e-5) x = 1e-5;
160  m_yBus[n][n] += std::complex<double>(1.0, 0.0) / std::complex<double>(r, x);
161  }
162 
163  // Remove fault
164  else if(EventTrigger(data.stabFaultTime + data.stabFaultLength, currentTime)) {
165  double r, x;
166  r = data.stabFaultResistance;
167  x = data.stabFaultReactance;
168  if(x < 1e-5) x = 1e-5;
169  m_yBus[n][n] -= std::complex<double>(1.0, 0.0) / std::complex<double>(r, x);
170  }
171  }
172  }
173 
174  // SyncGenerator switching
175  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
176  SyncGenerator* generator = *it;
177  auto swData = generator->GetSwitchingData();
178  for(unsigned int i = 0; i < swData.swType.size(); ++i) {
179  if(EventTrigger(swData.swTime[i], currentTime)) {
180  // Remove machine (only connected machines)
181  if(swData.swType[i] == SW_REMOVE && generator->IsOnline()) {
182  generator->SetOnline(false);
183  int n = static_cast<Bus*>(generator->GetParentList()[0])->GetElectricalData().number;
184  m_yBus[n][n] -= GetSyncMachineAdmittance(generator);
185  }
186 
187  // Insert machine (only disconnected machines)
188  if(swData.swType[i] == SW_INSERT && !generator->IsOnline() && generator->GetParentList().size() == 1) {
189  if(generator->SetOnline(true)) {
190  int n = static_cast<Bus*>(generator->GetParentList()[0])->GetElectricalData().number;
191  m_yBus[n][n] += GetSyncMachineAdmittance(generator);
192  }
193  }
194  }
195  }
196  }
197 
198  // Load switching
199  for(auto it = m_loadList.begin(), itEnd = m_loadList.end(); it != itEnd; ++it) {
200  Load* load = *it;
201  auto swData = load->GetSwitchingData();
202  for(unsigned int i = 0; i < swData.swType.size(); ++i) {
203  if(EventTrigger(swData.swTime[i], currentTime)) {
204  // Remove load (only connected loads)
205  if(swData.swType[i] == SW_REMOVE && load->IsOnline()) {
206  load->SetOnline(false);
207  auto data = load->GetPUElectricalData(m_powerSystemBase);
208  Bus* parentBus = static_cast<Bus*>(load->GetParentList()[0]);
209  int n = parentBus->GetElectricalData().number;
210  std::complex<double> v = parentBus->GetElectricalData().voltage;
211  m_yBus[n][n] -= std::complex<double>(data.activePower, -data.reactivePower) / (v * v);
212  }
213 
214  // Insert load (only disconnected load)
215  if(swData.swType[i] == SW_INSERT && !load->IsOnline() && load->GetParentList().size() == 1) {
216  if(load->SetOnline(true)) {
217  auto data = load->GetPUElectricalData(m_powerSystemBase);
218  Bus* parentBus = static_cast<Bus*>(load->GetParentList()[0]);
219  int n = parentBus->GetElectricalData().number;
220  std::complex<double> v = parentBus->GetElectricalData().voltage;
221  m_yBus[n][n] += std::complex<double>(data.activePower, -data.reactivePower) / (v * v);
222  }
223  }
224  }
225  }
226  }
227 
228  // Line switching
229  for(auto it = m_lineList.begin(), itEnd = m_lineList.end(); it != itEnd; ++it) {
230  Line* line = *it;
231  auto swData = line->GetSwitchingData();
232  for(unsigned int i = 0; i < swData.swType.size(); ++i) {
233  if(EventTrigger(swData.swTime[i], currentTime)) {
234  // Remove line (only connected lines)
235  if(swData.swType[i] == SW_REMOVE && line->IsOnline()) {
236  line->SetOnline(false);
237  auto data = line->GetElectricalData();
238 
239  int n1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().number;
240  int n2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().number;
241 
242  m_yBus[n1][n2] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
243  m_yBus[n2][n1] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
244 
245  m_yBus[n1][n1] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
246  m_yBus[n2][n2] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
247 
248  m_yBus[n1][n1] -= std::complex<double>(0.0, data.capSusceptance / 2.0);
249  m_yBus[n2][n2] -= std::complex<double>(0.0, data.capSusceptance / 2.0);
250  }
251 
252  // Insert line (only disconnected lines)
253  if(swData.swType[i] == SW_INSERT && !line->IsOnline() && line->GetParentList().size() == 2) {
254  if(line->SetOnline(true)) {
255  auto data = line->GetElectricalData();
256 
257  int n1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().number;
258  int n2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().number;
259 
260  m_yBus[n1][n2] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
261  m_yBus[n2][n1] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
262 
263  m_yBus[n1][n1] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
264  m_yBus[n2][n2] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
265 
266  m_yBus[n1][n1] += std::complex<double>(0.0, data.capSusceptance / 2.0);
267  m_yBus[n2][n2] += std::complex<double>(0.0, data.capSusceptance / 2.0);
268  }
269  }
270  }
271  }
272  }
273 
274  // Transformer switching
275  for(auto it = m_transformerList.begin(), itEnd = m_transformerList.end(); it != itEnd; ++it) {
276  Transformer* transformer = *it;
277  auto swData = transformer->GetSwitchingData();
278  for(unsigned int i = 0; i < swData.swType.size(); ++i) {
279  if(EventTrigger(swData.swTime[i], currentTime)) {
280  // Remove transformer (only connected transformers)
281  if(swData.swType[i] == SW_REMOVE && transformer->IsOnline()) {
282  transformer->SetOnline(false);
283  auto data = transformer->GetElectricalData();
284 
285  int n1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().number;
286  int n2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().number;
287 
288  if(data.turnsRatio == 1.0 && data.phaseShift == 0.0) {
289  m_yBus[n1][n2] -= -1.0 / std::complex<double>(data.resistance, data.indReactance);
290  m_yBus[n2][n1] -= -1.0 / std::complex<double>(data.resistance, data.indReactance);
291 
292  m_yBus[n1][n1] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
293  m_yBus[n2][n2] -= 1.0 / std::complex<double>(data.resistance, data.indReactance);
294  } else {
295  // Complex turns ratio
296  double radPhaseShift = wxDegToRad(data.phaseShift);
297  std::complex<double> a = std::complex<double>(data.turnsRatio * std::cos(radPhaseShift),
298  -data.turnsRatio * std::sin(radPhaseShift));
299 
300  // Transformer admitance
301  std::complex<double> y = 1.0 / std::complex<double>(data.resistance, data.indReactance);
302  m_yBus[n1][n1] -= y / std::pow(std::abs(a), 2.0);
303  m_yBus[n1][n2] -= -(y / std::conj(a));
304  m_yBus[n2][n1] -= -(y / a);
305  m_yBus[n2][n2] -= y;
306  }
307  }
308 
309  // Insert transformer (only disconnected transformers)
310  if(swData.swType[i] == SW_INSERT && !transformer->IsOnline() &&
311  transformer->GetParentList().size() == 2) {
312  if(transformer->SetOnline(true)) {
313  auto data = transformer->GetElectricalData();
314 
315  int n1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().number;
316  int n2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().number;
317 
318  if(data.turnsRatio == 1.0 && data.phaseShift == 0.0) {
319  m_yBus[n1][n2] += -1.0 / std::complex<double>(data.resistance, data.indReactance);
320  m_yBus[n2][n1] += -1.0 / std::complex<double>(data.resistance, data.indReactance);
321 
322  m_yBus[n1][n1] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
323  m_yBus[n2][n2] += 1.0 / std::complex<double>(data.resistance, data.indReactance);
324  } else {
325  // Complex turns ratio
326  double radPhaseShift = wxDegToRad(data.phaseShift);
327  std::complex<double> a = std::complex<double>(data.turnsRatio * std::cos(radPhaseShift),
328  -data.turnsRatio * std::sin(radPhaseShift));
329 
330  // Transformer admitance
331  std::complex<double> y = 1.0 / std::complex<double>(data.resistance, data.indReactance);
332  m_yBus[n1][n1] += y / std::pow(std::abs(a), 2.0);
333  m_yBus[n1][n2] += -(y / std::conj(a));
334  m_yBus[n2][n1] += -(y / a);
335  m_yBus[n2][n2] += y;
336  }
337  }
338  }
339  }
340  }
341  }
342 
343  // Capacitor switching
344  for(auto it = m_capacitorList.begin(), itEnd = m_capacitorList.end(); it != itEnd; ++it) {
345  Capacitor* capacitor = *it;
346  auto swData = capacitor->GetSwitchingData();
347  for(unsigned int i = 0; i < swData.swType.size(); ++i) {
348  if(EventTrigger(swData.swTime[i], currentTime)) {
349  // Remove capacitor (only connected capacitors)
350  if(swData.swType[i] == SW_REMOVE && capacitor->IsOnline()) {
351  capacitor->SetOnline(false);
352  auto data = capacitor->GetPUElectricalData(m_powerSystemBase);
353  int n = static_cast<Bus*>(capacitor->GetParentList()[0])->GetElectricalData().number;
354  m_yBus[n][n] -= std::complex<double>(0.0, data.reactivePower);
355  }
356 
357  // Insert capacitor (only disconnected capacitors)
358  if(swData.swType[i] == SW_INSERT && !capacitor->IsOnline() && capacitor->GetParentList().size() == 1) {
359  if(capacitor->SetOnline(true)) {
360  auto data = capacitor->GetPUElectricalData(m_powerSystemBase);
361  int n = static_cast<Bus*>(capacitor->GetParentList()[0])->GetElectricalData().number;
362  m_yBus[n][n] += std::complex<double>(0.0, data.reactivePower);
363  }
364  }
365  }
366  }
367  }
368 
369  // Inductor switching
370  for(auto it = m_inductorList.begin(), itEnd = m_inductorList.end(); it != itEnd; ++it) {
371  Inductor* inductor = *it;
372  auto swData = inductor->GetSwitchingData();
373  for(unsigned int i = 0; i < swData.swType.size(); ++i) {
374  if(EventTrigger(swData.swTime[i], currentTime)) {
375  // Remove inductor (only connected inductors)
376  if(swData.swType[i] == SW_REMOVE && inductor->IsOnline()) {
377  inductor->SetOnline(false);
378  auto data = inductor->GetPUElectricalData(m_powerSystemBase);
379  int n = static_cast<Bus*>(inductor->GetParentList()[0])->GetElectricalData().number;
380  m_yBus[n][n] -= std::complex<double>(0.0, -data.reactivePower);
381  }
382 
383  // Insert inductor (only disconnected inductors)
384  if(swData.swType[i] == SW_INSERT && !inductor->IsOnline() && inductor->GetParentList().size() == 1) {
385  if(inductor->SetOnline(true)) {
386  auto data = inductor->GetPUElectricalData(m_powerSystemBase);
387  int n = static_cast<Bus*>(inductor->GetParentList()[0])->GetElectricalData().number;
388  m_yBus[n][n] += std::complex<double>(0.0, -data.reactivePower);
389  }
390  }
391  }
392  }
393  }
394 }
395 
396 void Electromechanical::InsertSyncMachinesOnYBus()
397 {
398  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
399  SyncGenerator* generator = *it;
400  if(generator->IsOnline()) {
401  auto data = generator->GetElectricalData();
402  int n = static_cast<Bus*>(generator->GetParentList()[0])->GetElectricalData().number;
403  m_yBus[n][n] += GetSyncMachineAdmittance(generator);
404  }
405  }
406 }
407 
408 bool Electromechanical::EventTrigger(double eventTime, double currentTime)
409 {
410  return (((eventTime - m_timeStep) < currentTime) && (eventTime >= currentTime));
411 }
412 
413 std::complex<double> Electromechanical::GetSyncMachineAdmittance(SyncGenerator* generator)
414 {
415  auto data = generator->GetElectricalData();
416  double k = 1.0; // Power base change factor.
417  if(data.useMachineBase) {
418  double oldBase = generator->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
419  k = m_powerSystemBase / oldBase;
420  }
421 
422  double ra = data.armResistance * k;
423  auto smModelData = GetSyncMachineModelData(generator);
424  double xd = smModelData.xd;
425  double xq = smModelData.xq;
426  double xdq = 0.5 * (xd + xq);
427  return (std::complex<double>(ra, -xdq) / std::complex<double>(ra * ra + xd * xq, 0.0));
428 }
429 
430 bool Electromechanical::InitializeDynamicElements()
431 {
432  // Buses
433  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
434  Bus* bus = *it;
435  auto data = bus->GetElectricalData();
436  data.stabVoltageVector.clear();
437  bus->SetElectricalData(data);
438  }
439  // Synchronous generators
440  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
441  SyncGenerator* syncGenerator = *it;
442  auto dataPU = syncGenerator->GetPUElectricalData(m_powerSystemBase);
443  auto data = syncGenerator->GetElectricalData();
444  if(syncGenerator->IsOnline()) {
445  double k = 1.0; // Power base change factor.
446  if(data.useMachineBase) {
447  double oldBase = syncGenerator->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
448  k = m_powerSystemBase / oldBase;
449  }
450  data.terminalVoltage = static_cast<Bus*>(syncGenerator->GetParentList()[0])->GetElectricalData().voltage;
451 
452  std::complex<double> conjS(dataPU.activePower, -dataPU.reactivePower);
453  std::complex<double> vt = data.terminalVoltage;
454  std::complex<double> ia = conjS / std::conj(vt);
455 
456  double xd = data.syncXd * k;
457  double xq = data.syncXq * k;
458  double ra = data.armResistance * k;
459 
460  if(data.model == Machines::SM_MODEL_1) {
461  xq = data.transXd * k;
462  xd = xq;
463  } else if(data.syncXq == 0.0)
464  xq = data.syncXd * k;
465 
466  double sd = 1.0;
467  double sq = 1.0;
468  double satF = 1.0;
469  double xp = data.potierReactance * k;
470  bool hasSaturation = false;
471  if(data.satFactor != 0.0) { // Have saturation.
472  satF = (data.satFactor - 1.2) / std::pow(1.2, 7);
473  if(xp == 0.0) xp = 0.8 * (data.transXd * k);
474  hasSaturation = true;
475  }
476 
477  // Initialize state variables
478  std::complex<double> eq0 = vt + std::complex<double>(ra, xq) * ia;
479  double delta = std::arg(eq0);
480 
481  double id0, iq0, vd0, vq0;
482  ABCtoDQ0(ia, delta, id0, iq0);
483  ABCtoDQ0(vt, delta, vd0, vq0);
484 
485  // Initialize saturation
486  double xqs = xq;
487  double xds = xd;
488  if(hasSaturation) {
489  double oldDelta = 0;
490  bool exit = false;
491  int numIt = 0;
492  while(!exit) {
493  oldDelta = delta;
494  ABCtoDQ0(ia, delta, id0, iq0);
495  ABCtoDQ0(vt, delta, vd0, vq0);
496 
497  // Direct-axis Potier voltage.
498  double epd = vd0 + ra * id0 + xp * iq0;
499 
500  sq = 1.0 + satF * (xq / xd) * std::pow(epd, 6);
501  xqs = (xq - xp) / sq + xp;
502  eq0 = data.terminalVoltage + std::complex<double>(ra, xqs) * ia;
503  delta = std::arg(eq0);
504  if(std::abs(delta - oldDelta) < m_saturationTolerance) {
505  exit = true;
506  } else if(numIt >= m_maxIterations) {
507  m_errorMsg = _("Error on initializate the saturation values of \"") + data.name + _("\".");
508  return false;
509  }
510  numIt++;
511  }
512  // Quadrature-axis Potier voltage.
513  double epq = vq0 + ra * iq0 - xp * id0;
514  sd = 1.0 + satF * std::pow(epq, 6);
515  xds = (xd - xp) / sd + xp;
516  /*CalculateSyncMachineSaturation(syncGenerator, id0, iq0, sq, sd, true, k);
517  xqs = (xq - xp) / sq + xp;
518  xds = (xd - xp) / sd + xp;
519  eq0 = data.terminalVoltage + std::complex<double>(ra, xqs) * ia;
520  delta = std::arg(eq0);*/
521  }
522 
523  double ef0 = vq0 + ra * iq0 - xds * id0;
524 
525  data.initialFieldVoltage = ef0 * sd;
526  data.fieldVoltage = data.initialFieldVoltage;
527  data.pm = std::real((data.terminalVoltage * std::conj(ia)) + (std::abs(ia) * std::abs(ia) * ra));
528  data.speed = 2.0 * M_PI * m_systemFreq;
529  data.delta = delta;
530  data.pe = data.pm;
531  data.electricalPower = std::complex<double>(dataPU.activePower, dataPU.reactivePower);
532  data.sd = sd;
533  data.sq = sq;
534  data.id = id0;
535  data.iq = iq0;
536 
537  // Variables to extrapolate.
538  data.oldIq = iq0;
539  data.oldId = id0;
540  data.oldPe = data.pe;
541  data.oldSd = sd;
542  data.oldSq = sq;
543 
544  m_sdC = sd;
545  m_sqC = sq;
546 
547  switch(data.model) {
548  case Machines::SM_MODEL_1: {
549  // double tranXd = data.transXd * k;
550 
551  // data.tranEq = data.initialFieldVoltage + (xd - tranXd) * id0;
552  data.tranEq = std::abs(eq0);
553 
554  data.tranEd = 0.0;
555  data.subEq = 0.0;
556  data.subEd = 0.0;
557  } break;
558  case Machines::SM_MODEL_2: {
559  double tranXd = data.transXd * k;
560 
561  data.tranEq = ef0 + (xd - tranXd) * (id0 / sd);
562  data.tranEd = 0.0;
563  data.subEd = 0.0;
564  data.subEq = 0.0;
565  } break;
566  case Machines::SM_MODEL_3: {
567  double tranXd = data.transXd * k;
568  double tranXq = data.transXq * k;
569  if(tranXq == 0.0) tranXq = tranXd;
570 
571  data.tranEq = ef0 + (xd - tranXd) * (id0 / sd);
572  data.tranEd = -(xq - tranXq) * (iq0 / sq);
573 
574  data.subEd = 0.0;
575  data.subEq = 0.0;
576  } break;
577  case Machines::SM_MODEL_4: {
578  double tranXd = data.transXd * k;
579  double subXd = data.subXd * k;
580  double subXq = data.subXq * k;
581  if(subXd == 0.0) subXd = subXq;
582  if(subXq == 0.0) subXq = subXd;
583 
584  data.tranEq = ef0 + (xd - tranXd) * (id0 / sd);
585  data.tranEd = 0.0;
586  data.subEq = data.tranEq + (tranXd - subXd) * (id0 / sd);
587  data.subEd = -(xq - subXq) * (iq0 / sq);
588  } break;
589  case Machines::SM_MODEL_5: {
590  double tranXd = data.transXd * k;
591  double tranXq = data.transXq * k;
592  double subXd = data.subXd * k;
593  double subXq = data.subXq * k;
594  if(subXd == 0.0) subXd = subXq;
595  if(subXq == 0.0) subXq = subXd;
596 
597  data.tranEq = ef0 + (xd - tranXd) * (id0 / sd);
598  data.tranEd = -(xq - tranXq) * (iq0 / sq);
599  data.subEq = data.tranEq + (tranXd - subXd) * (id0 / sd);
600  data.subEd = data.tranEd - (tranXq - subXq) * (iq0 / sq);
601  } break;
602  default:
603  break;
604  }
605 
606  // Initialize controllers
607  if(data.useAVR) {
608  if(data.avrSolver) delete data.avrSolver;
609  data.avrSolver = new ControlElementSolver(data.avr, m_timeStep * m_ctrlTimeStepMultiplier, m_tolerance,
610  false, std::abs(data.terminalVoltage), m_parent);
611  if(!data.avrSolver->IsOK()) {
612  m_errorMsg = _("Error on initializate the AVR of \"") + data.name + _("\".");
613  syncGenerator->SetElectricalData(data);
614  return false;
615  }
616  }
617  if(data.useSpeedGovernor) {
618  if(data.speedGovSolver) delete data.speedGovSolver;
619  data.speedGovSolver = new ControlElementSolver(data.speedGov, m_timeStep * m_ctrlTimeStepMultiplier,
620  m_tolerance, false, data.speed, m_parent);
621  if(!data.speedGovSolver->IsOK()) {
622  m_errorMsg = _("Error on initializate the speed governor of \"") + data.name + _("\".");
623  syncGenerator->SetElectricalData(data);
624  return false;
625  }
626  }
627  } else {
628  // Initialize open circuit machine.
629  }
630  // Reset plot data
631  data.terminalVoltageVector.clear();
632  data.electricalPowerVector.clear();
633  data.mechanicalPowerVector.clear();
634  data.freqVector.clear();
635  data.fieldVoltageVector.clear();
636  data.deltaVector.clear();
637 
638  syncGenerator->SetElectricalData(data);
639  }
640  CalculateReferenceSpeed();
641  return true;
642 }
643 
644 bool Electromechanical::CalculateMachinesCurrents()
645 {
646  // Reset injected currents vector
647  for(unsigned int i = 0; i < m_iBus.size(); ++i) m_iBus[i] = std::complex<double>(0.0, 0.0);
648 
649  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
650  SyncGenerator* syncGenerator = *it;
651  auto data = syncGenerator->GetElectricalData();
652  if(syncGenerator->IsOnline()) {
653  double k = 1.0; // Power base change factor.
654  if(data.useMachineBase) {
655  double oldBase = syncGenerator->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
656  k = m_powerSystemBase / oldBase;
657  }
658 
659  double ra = data.armResistance * k;
660  double xp = data.potierReactance * k;
661  if(xp == 0.0) xp = 0.8 * data.transXd * k;
662 
663  int n = static_cast<Bus*>(syncGenerator->GetParentList()[0])->GetElectricalData().number;
664  std::complex<double> e = std::complex<double>(0.0, 0.0);
665  std::complex<double> v = m_vBus[n];
666  std::complex<double> iInj = m_iBus[n];
667 
668  auto smModelData = GetSyncMachineModelData(syncGenerator);
669  DQ0toABC(smModelData.ed, smModelData.eq, data.delta, e);
670  double xd = smModelData.xd;
671  double xq = smModelData.xq;
672 
673  double sd = data.sd;
674  double sq = data.sq;
675  double id, iq;
676 
677  // Calculate the saturation effect
678  if(data.satFactor != 0.0) {
679  if(!CalculateSyncMachineSaturation(syncGenerator, id, iq, sd, sq, false, k)) return false;
680  }
681 
682  double xdq, xds, xqs, xdqs;
683  xdq = 0.5 * (xd + xq);
684  xds = (xd - xp) / sd + xp;
685  xqs = (xq - xp) / sq + xp;
686  xdqs = 0.5 * (xds + xqs);
687 
688  std::complex<double> y0 = std::complex<double>(ra, -xdq) / std::complex<double>(ra * ra + xd * xq, 0.0);
689  // std::complex<double> iUnadjusted = y0 * e;
690  std::complex<double> iUnadjusted = y0 * v;
691 
692  // [Ref] Arrillaga, J.; Arnold, C. P.. "Computer Modelling of Electrical Power Systems". Pg. 225-226
693  // [Ref] Dommell, H. W.; Sato, N.. "Fast transient stability solutions". IEEE Transactions on Power
694  // Apparatus and Systems, PAS-91 (4), 1643-1650
695  std::complex<double> iSaliency = std::complex<double>(0.0, -((0.5 * (xqs - xds)) / (ra * ra + xds * xqs))) *
696  (std::conj(e) - std::conj(v));
697  iSaliency = iSaliency * std::cos(2.0 * data.delta) +
698  iSaliency * std::complex<double>(0.0, std::sin(2.0 * data.delta));
699 
700  // [Ref] Arrillaga, J.; Arnold, C. P.; Computer Modelling of Electrical Power Systems. Pg. 258-259
701  std::complex<double> y0s = std::complex<double>(ra, -xdqs) / std::complex<double>(ra * ra + xds * xqs, 0.0);
702  std::complex<double> iSaturation = y0s * (e - v);
703 
704  iInj = iUnadjusted + iSaliency + iSaturation;
705 
706  m_iBus[n] += iInj;
707 
708  // Remove the current flowing through y0 (i.e. iUnadjusted in this case, y0 is inserted in admittance
709  // matrix) to calculate the electrical power.
710  std::complex<double> iMachine = iInj - iUnadjusted;
711  data.electricalPower = v * std::conj(iMachine);
712 
713  ABCtoDQ0(iMachine, data.delta, id, iq);
714 
715  data.id = id;
716  data.iq = iq;
717  data.sd = sd;
718  data.sq = sq;
719  } else {
720  data.electricalPower = std::complex<double>(0.0, 0.0);
721  }
722 
723  syncGenerator->SetElectricalData(data);
724  }
725  return true;
726 }
727 
728 void Electromechanical::CalculateIntegrationConstants(SyncGenerator* syncGenerator, double id, double iq, double k)
729 {
730  CalculateReferenceSpeed();
731  auto data = syncGenerator->GetElectricalData();
732 
733  double syncXd, syncXq, transXd, transXq, subXd, subXq;
734  syncXd = data.syncXd * k;
735  syncXq = data.syncXq * k;
736  transXd = data.transXd * k;
737  transXq = data.transXq * k;
738  subXd = data.subXd * k;
739  subXq = data.subXq * k;
740 
741  if(syncXq == 0.0) syncXq = syncXd;
742  if(transXq == 0.0) transXq = transXd;
743  if(subXd == 0.0) subXd = subXq;
744  if(subXq == 0.0) subXq = subXd;
745 
746  double transTd0, transTq0, subTd0, subTq0;
747  transTd0 = data.transTd0;
748  transTq0 = data.transTq0;
749  subTd0 = data.subTd0;
750  subTq0 = data.subTq0;
751 
752  if(subTd0 == 0.0) subTd0 = subTq0;
753  if(subTq0 == 0.0) subTq0 = subTd0;
754 
755  // Speed
756  data.icSpeed.m = m_timeStep / ((4.0f * data.inertia / m_refSpeed) / k + m_timeStep * data.damping * k);
757  data.icSpeed.c = (1.0f - 2.0f * data.icSpeed.m * data.damping * k) * data.speed +
758  data.icSpeed.m * (data.pm - data.pe + 2.0f * m_refSpeed * data.damping * k);
759 
760  // Delta
761  data.icDelta.m = 0.5f * m_timeStep;
762  data.icDelta.c = data.delta + data.icDelta.m * (data.speed - 2.0f * m_refSpeed);
763 
764  // Eq'
765  if(data.model == Machines::SM_MODEL_2 || data.model == Machines::SM_MODEL_3 || data.model == Machines::SM_MODEL_4 ||
766  data.model == Machines::SM_MODEL_5) {
767  data.icTranEq.m = m_timeStep / (2.0f * transTd0 + m_timeStep);
768  // data.icTranEq.c = (1.0f - 2.0 * data.icTranEq.m) * data.tranEq +
769  // data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id);
770  data.icTranEq.c = (1.0 - data.icTranEq.m * (1.0 + data.sd)) * data.tranEq +
771  data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id);
772  }
773 
774  // Ed'
775  if(data.model == Machines::SM_MODEL_3 || data.model == Machines::SM_MODEL_4 || data.model == Machines::SM_MODEL_5) {
776  data.icTranEd.m = m_timeStep / (2.0f * transTq0 + m_timeStep);
777  // data.icTranEd.c = (1.0f - 2.0f * data.icTranEd.m) * data.tranEd - data.icTranEd.m * (syncXq - transXq) * iq;
778  data.icTranEd.c =
779  (1.0 - data.icTranEd.m * (1.0 + data.sq)) * data.tranEd - data.icTranEd.m * (syncXq - transXq) * iq;
780  }
781 
782  // Eq''
783  if(data.model == Machines::SM_MODEL_4 || data.model == Machines::SM_MODEL_5) {
784  data.icSubEq.m = m_timeStep / (2.0f * subTd0 + m_timeStep);
785  // data.icSubEq.c =
786  // (1.0f - 2.0f * data.icSubEq.m) * data.subEq + data.icSubEq.m * (data.tranEq + (transXd - subXd) * id);
787  data.icSubEq.c = (1.0 - data.icSubEq.m * (1.0 + data.sd)) * data.subEq +
788  data.icSubEq.m * (data.sd * data.tranEq + (transXd - subXd) * id);
789  }
790  // Ed''
791  if(data.model == Machines::SM_MODEL_4) {
792  data.icSubEd.m = m_timeStep / (2.0f * subTq0 + m_timeStep);
793  // data.icSubEd.c = (1.0f - 2.0f * data.icSubEd.m) * data.subEd - data.icSubEd.m * (syncXq - subXq) * iq;
794  data.icSubEd.c =
795  (1.0f - data.icSubEd.m * (1.0 + data.sq)) * data.subEd - data.icSubEd.m * (syncXq - subXq) * iq;
796  }
797  if(data.model == Machines::SM_MODEL_5) {
798  data.icSubEd.m = m_timeStep / (2.0f * subTq0 + m_timeStep);
799  // data.icSubEd.c =
800  // (1.0f - 2.0f * data.icSubEd.m) * data.subEd + data.icSubEd.m * (data.tranEd - (transXq - subXq) * iq);
801  data.icSubEd.c = (1.0f - data.icSubEd.m * (1.0 + data.sq)) * data.subEd +
802  data.icSubEd.m * (data.sq * data.tranEd - (transXq - subXq) * iq);
803  }
804 
805  syncGenerator->SetElectricalData(data);
806 }
807 
808 bool Electromechanical::SolveSynchronousMachines()
809 {
810  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
811  SyncGenerator* syncGenerator = *it;
812  auto data = syncGenerator->GetElectricalData();
813 
814  if(syncGenerator->IsOnline()) {
815  double id, iq, pe, sd, sq;
816  pe = data.pe;
817  id = data.id;
818  iq = data.iq;
819  sd = data.sd;
820  sq = data.sq;
821 
822  double k = 1.0; // Power base change factor.
823  if(data.useMachineBase) {
824  double oldBase = syncGenerator->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
825  k = m_powerSystemBase / oldBase;
826  }
827 
828  // Calculate integration constants.
829  CalculateIntegrationConstants(syncGenerator, id, iq, k);
830 
831  if(!CalculateSyncMachineNonIntVariables(syncGenerator, id, iq, sd, sq, pe, k)) return false;
832  // Extrapolate nonintegrable variables.
833  id = 2.0 * id - data.oldId;
834  iq = 2.0 * iq - data.oldIq;
835  pe = 2.0 * pe - data.oldPe;
836  sd = 2.0 * sd - data.oldSd;
837  sq = 2.0 * sq - data.oldSq;
838 
839  m_sdC = sd;
840  m_sqC = sq;
841 
842  CalculateSyncMachineIntVariables(syncGenerator, id, iq, sd, sq, pe, k);
843  } else {
844  CalculateIntegrationConstants(syncGenerator, 0.0f, 0.0f);
845  }
846  }
847 
848  m_wError = 0;
849 
850  double error = 1.0;
851  int iterations = 0;
852  while(error > m_tolerance) {
853  error = 0.0;
854 
855  // Calculate the injected currents.
856  if(!CalculateMachinesCurrents()) return false;
857 
858  // Calculate the buses voltages.
859  m_vBus = LUEvaluate(m_yBusU, m_yBusL, m_iBus);
860 
861  // Solve machine equations.
862  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
863  SyncGenerator* syncGenerator = *it;
864 
865  auto data = syncGenerator->GetElectricalData();
866 
867  double id = data.id;
868  double iq = data.iq;
869  double pe = data.pe;
870  double sd = data.sd;
871  double sq = data.sq;
872 
873  // Power base change factor.
874  double k = 1.0;
875  if(data.useMachineBase) {
876  double oldBase = syncGenerator->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
877  k = m_powerSystemBase / oldBase;
878  }
879 
880  // Calculate id, iq, dq, sd
881  if(!CalculateSyncMachineNonIntVariables(syncGenerator, id, iq, sd, sq, pe, k)) return false;
882 
883  double genError = CalculateSyncMachineIntVariables(syncGenerator, id, iq, sd, sq, pe, k);
884 
885  if(genError > error) error = genError;
886  }
887 
888  ++iterations;
889 
890  if(iterations > m_maxIterations) {
891  m_errorMsg = _("Impossible to solve the synchronous generators.\nCheck the system parameters and/or "
892  "decrease the time step.");
893  return false;
894  }
895  }
896  m_numIt = iterations;
897 
898  // Solve controllers.
899  int ctrlRatio = static_cast<int>(1 / m_ctrlTimeStepMultiplier);
900  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
901  SyncGenerator* syncGenerator = *it;
902  auto data = syncGenerator->GetElectricalData();
903  if(data.useAVR && data.avrSolver) {
904  for(int i = 0; i < ctrlRatio; ++i) data.avrSolver->SolveNextStep(std::abs(data.terminalVoltage));
905  data.fieldVoltage = data.initialFieldVoltage + data.avrSolver->GetLastSolution();
906  }
907 
908  if(data.useSpeedGovernor && data.speedGovSolver) {
909  for(int i = 0; i < ctrlRatio; ++i) data.speedGovSolver->SolveNextStep(data.speed);
910  data.pm = data.speedGovSolver->GetLastSolution();
911  }
912  syncGenerator->SetElectricalData(data);
913  }
914 
915  return true;
916 }
917 
918 void Electromechanical::SaveData()
919 {
920  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
921  SyncGenerator* syncGenerator = *it;
922  auto data = syncGenerator->GetElectricalData();
923  if(data.plotSyncMachine) {
924  data.terminalVoltageVector.push_back(data.terminalVoltage);
925  data.electricalPowerVector.push_back(data.electricalPower);
926  data.mechanicalPowerVector.push_back(data.pm);
927  data.freqVector.push_back(data.speed / (2.0f * M_PI));
928  data.fieldVoltageVector.push_back(data.fieldVoltage);
929  data.deltaVector.push_back(wxRadToDeg(data.delta));
930  syncGenerator->SetElectricalData(data);
931  }
932  }
933  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
934  Bus* bus = *it;
935  auto data = bus->GetElectricalData();
936  if(data.plotBus) {
937  data.stabVoltageVector.push_back(m_vBus[data.number]);
938  bus->SetElectricalData(data);
939  }
940  }
941 
942  m_wErrorVector.push_back(m_wError);
943  m_numItVector.push_back(m_numIt);
944  m_sdCVector.push_back(m_sdC);
945  m_sqCVector.push_back(m_sqC);
946 }
947 
948 void Electromechanical::SetSyncMachinesModel()
949 {
950  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
951  SyncGenerator* syncGenerator = *it;
952  auto data = syncGenerator->GetElectricalData();
953  data.model = GetMachineModel(syncGenerator);
954  syncGenerator->SetElectricalData(data);
955  }
956 }
957 
958 bool Electromechanical::CalculateSyncMachineNonIntVariables(SyncGenerator* syncGenerator,
959  double& id,
960  double& iq,
961  double& sd,
962  double& sq,
963  double& pe,
964  double k)
965 {
966  auto data = syncGenerator->GetElectricalData();
967  int n = static_cast<Bus*>(syncGenerator->GetParentList()[0])->GetElectricalData().number;
968 
969  if(syncGenerator->IsOnline()) {
970  data.terminalVoltage = m_vBus[n];
971  }
972 
973  double vd, vq;
974  ABCtoDQ0(data.terminalVoltage, data.delta, vd, vq);
975 
976  if(data.satFactor != 0.0) {
977  if(!CalculateSyncMachineSaturation(syncGenerator, id, iq, sd, sq, true, k)) return false;
978  data.sd = sd;
979  data.sq = sq;
980  data.oldSd = sd;
981  data.oldSq = sq;
982  }
983 
984  if(syncGenerator->IsOnline()) {
985  pe = id * vd + iq * vq + (id * id + iq * iq) * data.armResistance * k;
986  } else {
987  pe = id = iq = 0.0f;
988  }
989  data.pe = pe;
990  data.id = id;
991  data.iq = iq;
992  data.oldPe = pe;
993  data.oldId = id;
994  data.oldIq = iq;
995  syncGenerator->SetElectricalData(data);
996 
997  return true;
998 }
999 
1000 double Electromechanical::CalculateSyncMachineIntVariables(SyncGenerator* syncGenerator,
1001  double id,
1002  double iq,
1003  double sd,
1004  double sq,
1005  double pe,
1006  double k)
1007 {
1008  double error = 0.0;
1009  auto data = syncGenerator->GetElectricalData();
1010 
1011  // Mechanical differential equations.
1012  double w = data.icSpeed.c + data.icSpeed.m * (data.pm - pe);
1013  error = std::max(error, std::abs(data.speed - w) / m_refSpeed);
1014 
1015  m_wError += std::abs(data.speed - w) / m_refSpeed;
1016 
1017  double delta = data.icDelta.c + data.icDelta.m * w;
1018  error = std::max(error, std::abs(data.delta - delta));
1019 
1020  data.speed = w;
1021  data.delta = delta;
1022 
1023  // Electrical differential equations
1024  switch(data.model) {
1025  case Machines::SM_MODEL_1: {
1026  // There is no differential equations.
1027  } break;
1028  case Machines::SM_MODEL_2: {
1029  double syncXd, transXd;
1030  syncXd = data.syncXd * k;
1031  transXd = data.transXd * k;
1032 
1033  double tranEq = (data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id)) /
1034  (1.0 + data.icTranEq.m * (sd - 1.0));
1035  error = std::max(error, std::abs(data.tranEq - tranEq));
1036 
1037  data.tranEq = tranEq;
1038  } break;
1039  case Machines::SM_MODEL_3: {
1040  double syncXd, syncXq, transXd, transXq;
1041  syncXd = data.syncXd * k;
1042  syncXq = data.syncXq * k;
1043  transXd = data.transXd * k;
1044  transXq = data.transXq * k;
1045  if(syncXq == 0.0) syncXq = syncXd;
1046  if(transXq == 0.0) transXq = transXd;
1047 
1048  double tranEq = (data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id)) /
1049  (1.0 + data.icTranEq.m * (sd - 1.0));
1050  error = std::max(error, std::abs(data.tranEq - tranEq));
1051 
1052  double tranEd =
1053  (data.icTranEd.c - data.icTranEd.m * (syncXq - transXq) * iq) / (1.0 + data.icTranEd.m * (sq - 1.0));
1054  error = std::max(error, std::abs(data.tranEd - tranEd));
1055 
1056  data.tranEq = tranEq;
1057  data.tranEd = tranEd;
1058 
1059  if(!syncGenerator->IsOnline()) {
1060  std::complex<double> e;
1061  DQ0toABC(data.tranEd, data.tranEq, data.delta, e);
1062  data.terminalVoltage = e;
1063  }
1064  } break;
1065  case Machines::SM_MODEL_4: {
1066  double syncXd, syncXq, transXd, subXd, subXq;
1067  syncXd = data.syncXd * k;
1068  syncXq = data.syncXq * k;
1069  transXd = data.transXd * k;
1070  subXd = data.subXd * k;
1071  subXq = data.subXq * k;
1072  if(syncXq == 0.0) syncXq = syncXd;
1073  if(subXd == 0.0) subXd = subXq;
1074  if(subXq == 0.0) subXq = subXd;
1075 
1076  double tranEq = (data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id)) /
1077  (1.0 + data.icTranEq.m * (sd - 1.0));
1078  error = std::max(error, std::abs(data.tranEq - tranEq));
1079 
1080  double subEq = (data.icSubEq.c + data.icSubEq.m * (sd * tranEq + (transXd - subXd) * id)) /
1081  (1.0 + data.icSubEq.m * (sd - 1.0));
1082  error = std::max(error, std::abs(data.subEq - subEq));
1083 
1084  double subEd =
1085  (data.icSubEd.c - data.icSubEd.m * ((syncXq - subXq) * iq)) / (1.0 + data.icSubEd.m * (sq - 1.0));
1086  error = std::max(error, std::abs(data.subEd - subEd));
1087 
1088  data.tranEq = tranEq;
1089  data.subEq = subEq;
1090  data.subEd = subEd;
1091  } break;
1092  case Machines::SM_MODEL_5: {
1093  double syncXd, syncXq, transXd, transXq, subXd, subXq;
1094  syncXd = data.syncXd * k;
1095  syncXq = data.syncXq * k;
1096  transXd = data.transXd * k;
1097  transXq = data.transXq * k;
1098  subXd = data.subXd * k;
1099  subXq = data.subXq * k;
1100  if(syncXq == 0.0) syncXq = syncXd;
1101  if(transXq == 0.0) transXq = transXd;
1102  if(subXd == 0.0) subXd = subXq;
1103  if(subXq == 0.0) subXq = subXd;
1104 
1105  double tranEq = (data.icTranEq.c + data.icTranEq.m * (data.fieldVoltage + (syncXd - transXd) * id)) /
1106  (1.0 + data.icTranEq.m * (sd - 1.0));
1107  error = std::max(error, std::abs(data.tranEq - tranEq));
1108 
1109  double tranEd =
1110  (data.icTranEd.c - data.icTranEd.m * (syncXq - transXq) * iq) / (1.0 + data.icTranEd.m * (sq - 1.0));
1111  error = std::max(error, std::abs(data.tranEd - tranEd));
1112 
1113  double subEq = (data.icSubEq.c + data.icSubEq.m * (sd * tranEq + (transXd - subXd) * id)) /
1114  (1.0 + data.icSubEq.m * (sd - 1.0));
1115  error = std::max(error, std::abs(data.subEq - subEq));
1116 
1117  double subEd = (data.icSubEd.c + data.icSubEd.m * (sq * tranEd - (transXq - subXq) * iq)) /
1118  (1.0 + data.icSubEd.m * (sq - 1.0));
1119  error = std::max(error, std::abs(data.subEd - subEd));
1120 
1121  data.tranEq = tranEq;
1122  data.tranEd = tranEd;
1123  data.subEq = subEq;
1124  data.subEd = subEd;
1125  } break;
1126  }
1127 
1128  syncGenerator->SetElectricalData(data);
1129  return error;
1130 }
1131 
1132 void Electromechanical::CalculateReferenceSpeed()
1133 {
1134  if(m_useCOI) {
1135  double sumHW = 0.0;
1136  double sumH = 0.0;
1137  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
1138  SyncGenerator* syncGenerator = *it;
1139  if(syncGenerator->IsOnline()) {
1140  auto data = syncGenerator->GetElectricalData();
1141  double k = 1.0; // Power base change factor.
1142  if(data.useMachineBase) {
1143  double oldBase = syncGenerator->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
1144  k = m_powerSystemBase / oldBase;
1145  }
1146  sumH += data.inertia / k;
1147  sumHW += data.inertia * data.speed / k;
1148  }
1149  }
1150  m_refSpeed = sumHW / sumH;
1151  } else {
1152  m_refSpeed = 2.0 * M_PI * m_systemFreq;
1153  }
1154 }
1155 
1156 bool Electromechanical::CalculateSyncMachineSaturation(SyncGenerator* syncMachine,
1157  double& id,
1158  double& iq,
1159  double& sd,
1160  double& sq,
1161  bool updateCurrents,
1162  double k)
1163 {
1164  // [Ref] Arrillaga, J.; Arnold, C. P.. "Computer Modelling of Electrical Power Systems". Pg. 254-260
1165  auto data = syncMachine->GetElectricalData();
1166  auto smDataModel = GetSyncMachineModelData(syncMachine);
1167 
1168  int n = static_cast<Bus*>(syncMachine->GetParentList()[0])->GetElectricalData().number;
1169  if(syncMachine->IsOnline()) {
1170  data.terminalVoltage = m_vBus[n];
1171  }
1172  double idCalc = id;
1173  double iqCalc = iq;
1174  double sdCalc = sd;
1175  double sqCalc = sq;
1176 
1177  double vd, vq;
1178  ABCtoDQ0(data.terminalVoltage, data.delta, vd, vq);
1179  double deltaVd = smDataModel.ed - vd;
1180  double deltaVq = smDataModel.eq - vq;
1181 
1182  double ra = data.armResistance * k;
1183  double xd = smDataModel.xd;
1184  double xq = smDataModel.xq;
1185 
1186  double syncXd = data.syncXd * k;
1187  double syncXq = data.syncXq * k;
1188  if(data.model == Machines::SM_MODEL_1) {
1189  syncXq = data.transXd * k;
1190  syncXd = syncXq;
1191  } else if(data.syncXq == 0.0)
1192  syncXq = data.syncXd * k;
1193 
1194  double xp = data.potierReactance * k;
1195  if(xp == 0.0) xp = 0.8 * data.transXd * k;
1196  double satFacd = (data.satFactor - 1.2) / std::pow(1.2, 7);
1197  double satFacq = satFacd * (syncXq / syncXd);
1198 
1199  bool exit = false;
1200  int iterations = 0;
1201  while(!exit) {
1202  double oldSd = sdCalc;
1203  double oldSq = sqCalc;
1204 
1205  // Saturated reactances.
1206  double xds = (xd - xp) / sdCalc + xp;
1207  double xqs = (xq - xp) / sqCalc + xp;
1208  // dq currents.
1209  double den = 1.0 / (ra * ra + xds * xqs);
1210  iqCalc = den * (ra * deltaVq + xds * deltaVd);
1211  idCalc = den * (-xqs * deltaVq + ra * deltaVd);
1212  // Potier voltages
1213  double epq = vq + ra * iqCalc - xp * idCalc;
1214  double epd = vd + ra * idCalc + xp * iqCalc;
1215  // Saturation factors.
1216  // Gauss
1217  /*sdCalc = 1.0 + satFacd * std::pow(epq, 6);
1218  sqCalc = 1.0 + satFacq * std::pow(epd, 6);*/
1219 
1220  // Newton-raphson
1221  double f1 = 1.0 - sdCalc + satFacd * std::pow(epq, 6);
1222  double f2 = 1.0 - sqCalc + satFacq * std::pow(epd, 6);
1223  double dF1dSd =
1224  (6.0 * satFacd * std::pow(epq, 5) * xp * (xd - xp) * deltaVq) / ((sdCalc - 1.0) * xp + xd) - 1.0;
1225  double dF2dSq =
1226  (6.0 * satFacq * std::pow(epd, 5) * xp * (xq - xp) * deltaVd) / ((sqCalc - 1.0) * xp + xq) - 1.0;
1227 
1228  sdCalc = sdCalc - f1 / dF1dSd;
1229  sqCalc = sqCalc - f2 / dF2dSq;
1230 
1231  double error = std::abs(sdCalc - oldSd) + std::abs(sqCalc - oldSq);
1232  if(error < m_saturationTolerance) exit = true;
1233 
1234  iterations++;
1235  if((iterations >= m_maxIterations) & !exit) {
1236  m_errorMsg =
1237  _("It was not possible to solve the saturation of the synchronous machine \"") + data.name + wxT("\".");
1238  return false;
1239  }
1240  }
1241 
1242  sd = sdCalc;
1243  sq = sqCalc;
1244  if(updateCurrents) {
1245  id = idCalc;
1246  iq = iqCalc;
1247  }
1248  return true;
1249 }
1250 
1251 SyncMachineModelData Electromechanical::GetSyncMachineModelData(SyncGenerator* syncMachine)
1252 {
1253  SyncMachineModelData smModelData;
1254 
1255  auto data = syncMachine->GetElectricalData();
1256  double k = 1.0; // Power base change factor.
1257  if(data.useMachineBase) {
1258  double oldBase = syncMachine->GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
1259  k = m_powerSystemBase / oldBase;
1260  }
1261 
1262  switch(data.model) {
1263  case Machines::SM_MODEL_1: {
1264  smModelData.ed = data.tranEd;
1265  smModelData.eq = data.tranEq;
1266  smModelData.xq = data.transXd * k;
1267  smModelData.xd = smModelData.xq;
1268  } break;
1269  case Machines::SM_MODEL_2: {
1270  smModelData.ed = data.tranEd;
1271  smModelData.eq = data.tranEq;
1272  smModelData.xd = data.transXd * k;
1273  smModelData.xq = data.transXq * k;
1274  if(smModelData.xq == 0.0) {
1275  smModelData.xq = data.syncXq * k;
1276  if(smModelData.xq == 0.0) {
1277  smModelData.xq = data.syncXd * k;
1278  }
1279  }
1280  } break;
1281  case Machines::SM_MODEL_3: {
1282  smModelData.ed = data.tranEd;
1283  smModelData.eq = data.tranEq;
1284  smModelData.xd = data.transXd * k;
1285  smModelData.xq = data.transXq * k;
1286  if(smModelData.xq == 0.0) smModelData.xq = smModelData.xd;
1287  } break;
1288  case Machines::SM_MODEL_4:
1289  case Machines::SM_MODEL_5: {
1290  smModelData.ed = data.subEd;
1291  smModelData.eq = data.subEq;
1292  smModelData.xd = data.subXd * k;
1293  smModelData.xq = data.subXq * k;
1294  if(smModelData.xd == 0.0) smModelData.xd = smModelData.xq;
1295  if(smModelData.xq == 0.0) smModelData.xq = smModelData.xd;
1296  } break;
1297  }
1298  return smModelData;
1299 }
std::vector< double > swTime
Definition: PowerElement.h:95
+
Solves in the time the control system. Can solve the control system directly from a ControlEditor or ...
+
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:506
+
Calculates the electromechanical transient based on disturbances (e.g. system fault).
+ +
bool SetOnline(bool online=true)
Set if the element is online or offline.
Definition: Element.cpp:235
+ + +
std::vector< SwitchingType > swType
Definition: PowerElement.h:94
+ +
Definition: Bus.h:62
+ +
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:227
+ + +
Synchronous machine data for different models.
+
Definition: Line.h:52
+
Definition: Load.h:35
+
virtual bool GetYBus(std::vector< std::vector< std::complex< double > > > &yBus, double systemPowerBase, YBusSequence sequence=POSITIVE_SEQ, bool includeSyncMachines=false, bool allLoadsAsImpedances=false)
Get the admittance matrix from the list of elements (use GetElementsFromList first).
+
virtual SwitchingData GetSwitchingData()
Returns the switching data of the element.
Definition: PowerElement.h:182
+ + + + + +
virtual void GetElementsFromList(std::vector< Element *> elementList)
Separate the power elements from a generic list.
+ +
diff --git a/docs/doxygen/html/_electromechanical_8h.html b/docs/doxygen/html/_electromechanical_8h.html new file mode 100644 index 0000000..edeac51 --- /dev/null +++ b/docs/doxygen/html/_electromechanical_8h.html @@ -0,0 +1,126 @@ + + + + + + + + + +Project/Electromechanical.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
Electromechanical.h File Reference
+
+
+ +

Calculates the electromechanical transient based on disturbances (e.g. system fault). +More...

+
#include "ElectricCalculation.h"
+#include <wx/progdlg.h>
+#include <wx/log.h>
+
+

Go to the source code of this file.

+ + + + + + + +

+Classes

struct  SyncMachineModelData
 Synchronous machine data for different models. More...
 
class  Electromechanical
 
+

Detailed Description

+

Calculates the electromechanical transient based on disturbances (e.g. system fault).

+ +

Definition in file Electromechanical.h.

+
+
+ + + + diff --git a/docs/doxygen/html/_electromechanical_8h_source.html b/docs/doxygen/html/_electromechanical_8h_source.html index 7a4e6c0..fa73240 100644 --- a/docs/doxygen/html/_electromechanical_8h_source.html +++ b/docs/doxygen/html/_electromechanical_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,19 +88,23 @@ $(document).ready(function(){initNavTree('_electromechanical_8h_source.html','')
Electromechanical.h
-
1 #ifndef ELECTROMECHANICAL_H
2 #define ELECTROMECHANICAL_H
3 
4 #include "ElectricCalculation.h"
5 
6 #include <wx/progdlg.h>
7 
9 
11 {
12  public:
13  Electromechanical(wxWindow* parent, std::vector<Element*> elementList, SimulationData data);
15 
16  bool RunStabilityCalculation();
17  wxString GetErrorMessage() const { return m_errorMsg; }
18  std::vector<double> GetTimeVector() const { return m_timeVector; }
19  std::vector<double> m_wErrorVector;
20  std::vector<double> m_deltaErrorVector;
21  std::vector<double> m_transEdErrorVector;
22  std::vector<double> m_transEqErrorVector;
23  std::vector<double> m_numItVector;
24 
25  protected:
26  void SetEventTimeList();
27  bool HasEvent(double currentTime);
28  void SetEvent(double currentTime);
29  inline bool EventTrigger(double eventTime, double currentTime);
30 
31  double GetPowerValue(double value, ElectricalUnit unit);
32 
33  void InsertSyncMachinesOnYBus();
34  std::complex<double> GetSyncMachineAdmittance(SyncGenerator* generator);
35  bool InitializeDynamicElements();
36  void CalculateMachinesCurrents();
37  void CalculateIntegrationConstants(SyncGenerator* syncGenerator, double id, double iq, double k = 1.0);
38  bool SolveSynchronousMachines();
39  void SetSyncMachinesModel();
40  double CalculateSyncMachineIntVariables(SyncGenerator* syncGenerator, double id, double iq, double pe, double k = 1.0);
41  void CalculateSyncMachineNonIntVariables(SyncGenerator* syncGenerator, double& id, double& iq, double& pe, double k = 1.0);
42  void CalculateReferenceSpeed();
43 
44  void SaveData();
45 
46  wxWindow* m_parent = NULL;
47  wxString m_errorMsg = _("Unknown error");
48 
49  double m_systemFreq = 60.0;
50  double m_refSpeed = 2.0 * M_PI * 60.0;
51  bool m_useCOI = false;
52 
53  std::vector<std::vector<std::complex<double> > > m_yBus;
54  std::vector<std::vector<std::complex<double> > > m_yBusU;
55  std::vector<std::vector<std::complex<double> > > m_yBusL;
56 
57  std::vector<std::complex<double> > m_vBus;
58  std::vector<std::complex<double> > m_iBus;
59 
60  double m_powerSystemBase = 100e6;
61  double m_simTime = 10.0;
62  double m_plotTime = 1e-2;
63  double m_timeStep = 1e-2;
64  double m_ctrlTimeStepMultiplier = 0.1;
65  double m_tolerance = 1e-8;
66  int m_maxIterations = 100;
67 
68  std::vector<double> m_eventTimeList;
69  std::vector<bool> m_eventOccurrenceList;
70 
71  std::vector<double> m_timeVector;
72 
73  // tests
74  double m_wError = 0.0;
75  double m_numIt = 0;
76 };
77 
78 #endif // ELECTROMECHANICAL_H
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ELECTROMECHANICAL_H
19 #define ELECTROMECHANICAL_H
20 
21 #include "ElectricCalculation.h"
22 
23 #include <wx/progdlg.h>
24 #include <wx/log.h>
25 
27 
35  double xd;
37  double xq;
39  double ed;
41  double eq;
42 };
43 
52 {
53  public:
54  Electromechanical(wxWindow* parent, std::vector<Element*> elementList, SimulationData data);
56 
57  bool RunStabilityCalculation();
58  wxString GetErrorMessage() const { return m_errorMsg; }
59  std::vector<double> GetTimeVector() const { return m_timeVector; }
60  std::vector<double> m_wErrorVector;
61  std::vector<double> m_deltaErrorVector;
62  std::vector<double> m_transEdErrorVector;
63  std::vector<double> m_transEqErrorVector;
64  std::vector<double> m_numItVector;
65  std::vector<double> m_sdCVector;
66  std::vector<double> m_sqCVector;
67 
68  protected:
69  void SetEventTimeList();
70  bool HasEvent(double currentTime);
71  void SetEvent(double currentTime);
72  inline bool EventTrigger(double eventTime, double currentTime);
73 
74  // double GetPowerValue(double value, ElectricalUnit unit);
75 
76  void InsertSyncMachinesOnYBus();
77  std::complex<double> GetSyncMachineAdmittance(SyncGenerator* generator);
78  bool InitializeDynamicElements();
79  bool CalculateMachinesCurrents();
80  void CalculateIntegrationConstants(SyncGenerator* syncGenerator, double id, double iq, double k = 1.0);
81  bool SolveSynchronousMachines();
82  void SetSyncMachinesModel();
83  SyncMachineModelData GetSyncMachineModelData(SyncGenerator* syncMachine);
84  double CalculateSyncMachineIntVariables(SyncGenerator* syncGenerator,
85  double id,
86  double iq,
87  double sd,
88  double sq,
89  double pe,
90  double k = 1.0);
91  bool CalculateSyncMachineNonIntVariables(SyncGenerator* syncGenerator,
92  double& id,
93  double& iq,
94  double& sd,
95  double& sq,
96  double& pe,
97  double k = 1.0);
98  void CalculateReferenceSpeed();
99  bool CalculateSyncMachineSaturation(SyncGenerator* syncMachine,
100  double& id,
101  double& iq,
102  double& sd,
103  double& sq,
104  bool updateCurrents = true,
105  double k = 1.0);
106 
107  void SaveData();
108 
109  wxWindow* m_parent = NULL;
110  wxString m_errorMsg = _("Unknown error");
111 
112  double m_systemFreq = 60.0;
113  double m_refSpeed = 2.0 * M_PI * 60.0;
114  bool m_useCOI = false;
115 
116  std::vector<std::vector<std::complex<double> > > m_yBus;
117  std::vector<std::vector<std::complex<double> > > m_yBusU;
118  std::vector<std::vector<std::complex<double> > > m_yBusL;
119 
120  std::vector<std::complex<double> > m_vBus;
121  std::vector<std::complex<double> > m_iBus;
122 
123  double m_powerSystemBase = 100e6;
124  double m_simTime = 10.0;
125  double m_plotTime = 1e-2;
126  double m_timeStep = 1e-2;
127  double m_ctrlTimeStepMultiplier = 0.1;
128  double m_tolerance = 1e-8;
129  int m_maxIterations = 100;
130  double m_saturationTolerance = 1e-8;
131 
132  std::vector<double> m_eventTimeList;
133  std::vector<bool> m_eventOccurrenceList;
134 
135  std::vector<double> m_timeVector;
136 
137  // tests
138  double m_wError = 0.0;
139  double m_sdC = 1.0;
140  double m_sqC = 1.0;
141  double m_numIt = 0;
142 };
143 
144 #endif // ELECTROMECHANICAL_H
Solves in the time the control system. Can solve the control system directly from a ControlEditor or ...
+
Base class of electric calculations, with general methods.
- -
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
- - - + + + + +
Synchronous machine data for different models.
+ + +
-
1 #include "Element.h"
2 #ifdef USING_WX_3_0_X
3 #include "DegreesAndRadians.h"
4 #endif
5 
6 Element::Element() { m_selectionColour.SetRGBA(0.0, 0.5, 1.0, 0.5); }
7 
9 
10 void Element::SetPosition(const wxPoint2DDouble position)
11 {
12  m_position = position;
13  m_rect = wxRect2DDouble(m_position.m_x - m_width / 2.0 - m_borderSize,
14  m_position.m_y - m_height / 2.0 - m_borderSize, m_width + 2.0 * m_borderSize, m_height + 2.0 * m_borderSize);
15 }
16 
17 void Element::DrawCircle(wxPoint2DDouble position, double radius, int numSegments, GLenum mode) const
18 {
19  glBegin(mode);
20  for(int i = 0; i < numSegments; i++) {
21  double theta = 2.0 * 3.1415926 * double(i) / double(numSegments);
22  glVertex2f(radius * std::cos(theta) + position.m_x, radius * std::sin(theta) + position.m_y);
23  }
24  glEnd();
25 }
26 
27 void Element::DrawArc(wxPoint2DDouble position,
28  double radius,
29  double initAngle,
30  double finalAngle,
31  int numSegments,
32  GLenum mode) const
33 {
34  double initAngRad = wxDegToRad(initAngle);
35  double finalAngRad = wxDegToRad(finalAngle);
36  glBegin(mode);
37  for(int i = 0; i <= numSegments; i++) {
38  double theta = initAngRad + (finalAngRad - initAngRad) * double(i) / double(numSegments);
39  glVertex2f(radius * std::cos(theta) + position.m_x, radius * std::sin(theta) + position.m_y);
40  }
41  glEnd();
42 }
43 
44 void Element::DrawTriangle(std::vector<wxPoint2DDouble> points, GLenum mode) const
45 {
46  glBegin(mode);
47  for(int i = 0; i < 3; i++) {
48  glVertex2d(points[i].m_x, points[i].m_y);
49  }
50  glEnd();
51 }
52 
53 void Element::DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode) const
54 {
55  glBegin(mode); // TODO: GL_QUADS é obsoleto (OpenGL 3.0+), encontrar outra solução.
56  glVertex2d(position.m_x - width / 2.0, position.m_y - height / 2.0);
57  glVertex2d(position.m_x - width / 2.0, position.m_y + height / 2.0);
58  glVertex2d(position.m_x + width / 2.0, position.m_y + height / 2.0);
59  glVertex2d(position.m_x + width / 2.0, position.m_y - height / 2.0);
60  glEnd();
61 }
62 
63 void Element::DrawRectangle(wxPoint2DDouble* points, GLenum mode) const
64 {
65  glBegin(mode); // TODO: GL_QUADS é obsoleto (OpenGL 3.0+), encontrar outra solução.
66  glVertex2d(points[0].m_x, points[0].m_y);
67  glVertex2d(points[1].m_x, points[1].m_y);
68  glVertex2d(points[2].m_x, points[2].m_y);
69  glVertex2d(points[3].m_x, points[3].m_y);
70  glEnd();
71 }
72 
73 void Element::DrawLine(std::vector<wxPoint2DDouble> points, GLenum mode) const
74 {
75  glBegin(mode);
76  for(auto it = points.begin(); it != points.end(); ++it) {
77  glVertex2d((*it).m_x, (*it).m_y);
78  }
79  glEnd();
80 }
81 
82 void Element::DrawPickbox(wxPoint2DDouble position) const
83 {
84  glLineWidth(1.0);
85  glColor4d(1.0, 1.0, 1.0, 0.8);
86  DrawRectangle(position, 8.0, 8.0);
87  glColor4d(0.0, 0.0, 0.0, 1.0);
88  DrawRectangle(position, 8.0, 8.0, GL_LINE_LOOP);
89 }
90 
91 wxPoint2DDouble Element::RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees) const
92 {
93  double radAngle = angle;
94  if(degrees) radAngle = wxDegToRad(angle);
95  return wxPoint2DDouble(std::cos(radAngle) * (pointToRotate.m_x - m_position.m_x) -
96  std::sin(radAngle) * (pointToRotate.m_y - m_position.m_y) + m_position.m_x,
97  std::sin(radAngle) * (pointToRotate.m_x - m_position.m_x) +
98  std::cos(radAngle) * (pointToRotate.m_y - m_position.m_y) + m_position.m_y);
99 }
100 
101 void Element::StartMove(wxPoint2DDouble position)
102 {
103  this->m_moveStartPt = position;
104  this->m_movePos = m_position;
105 }
106 
107 void Element::Move(wxPoint2DDouble position) { SetPosition(m_movePos + position - m_moveStartPt); }
108 
109 wxPoint2DDouble Element::WorldToScreen(wxPoint2DDouble translation, double scale, double offsetX, double offsetY) const
110 {
111  return wxPoint2DDouble(m_position.m_x + offsetX + translation.m_x, m_position.m_y + offsetY + translation.m_y) *
112  scale;
113 }
114 
115 wxPoint2DDouble Element::WorldToScreen(wxPoint2DDouble position,
116  wxPoint2DDouble translation,
117  double scale,
118  double offsetX,
119  double offsetY) const
120 {
121  return wxPoint2DDouble(position.m_x + offsetX + translation.m_x, position.m_y + offsetY + translation.m_y) * scale;
122 }
123 
124 void Element::DrawPoint(wxPoint2DDouble position, double size) const
125 {
126  glPointSize(size);
127  glBegin(GL_POINTS);
128  glVertex2d(position.m_x, position.m_y);
129  glEnd();
130 }
131 
132 bool Element::RotatedRectanglesIntersects(wxRect2DDouble rect1,
133  wxRect2DDouble rect2,
134  double angle1,
135  double angle2) const
136 {
137  wxPoint2DDouble rect1Corners[4] = { rect1.GetLeftTop(), rect1.GetLeftBottom(), rect1.GetRightBottom(),
138  rect1.GetRightTop() };
139  wxPoint2DDouble rect2Corners[4] = { rect2.GetLeftTop(), rect2.GetLeftBottom(), rect2.GetRightBottom(),
140  rect2.GetRightTop() };
141  wxPoint2DDouble rect1Center(rect1.m_x + rect1.m_width / 2.0, rect1.m_y + rect1.m_height / 2.0);
142  wxPoint2DDouble rect2Center(rect2.m_x + rect2.m_width / 2.0, rect2.m_y + rect2.m_height / 2.0);
143 
144  // Rotate the corners.
145  double radAngle1 = wxDegToRad(angle1);
146  double radAngle2 = wxDegToRad(angle2);
147 
148  for(int i = 0; i < 4; i++) {
149  rect1Corners[i] = wxPoint2DDouble(std::cos(radAngle1) * (rect1Corners[i].m_x - rect1Center.m_x) -
150  std::sin(radAngle1) * (rect1Corners[i].m_y - rect1Center.m_y) + rect1Center.m_x,
151  std::sin(radAngle1) * (rect1Corners[i].m_x - rect1Center.m_x) +
152  std::cos(radAngle1) * (rect1Corners[i].m_y - rect1Center.m_y) + rect1Center.m_y);
153 
154  rect2Corners[i] = wxPoint2DDouble(std::cos(radAngle2) * (rect2Corners[i].m_x - rect2Center.m_x) -
155  std::sin(radAngle2) * (rect2Corners[i].m_y - rect2Center.m_y) + rect2Center.m_x,
156  std::sin(radAngle2) * (rect2Corners[i].m_x - rect2Center.m_x) +
157  std::cos(radAngle2) * (rect2Corners[i].m_y - rect2Center.m_y) + rect2Center.m_y);
158  }
159 
160  //[Ref] http://www.gamedev.net/page/resources/_/technical/game-programming/2d-rotated-rectangle-collision-r2604
161 
162  // Find the rectangles axis to project
163  wxPoint2DDouble axis[4] = { rect1Corners[3] - rect1Corners[0], rect1Corners[3] - rect1Corners[2],
164  rect2Corners[3] - rect2Corners[0], rect2Corners[3] - rect2Corners[2] };
165 
166  // Calculate the projected points to each axis
167  wxPoint2DDouble rect1ProjPts[4][4]; // [axis][corner]
168  wxPoint2DDouble rect2ProjPts[4][4]; // [axis][corner]
169  for(int i = 0; i < 4; i++) {
170  double den = axis[i].m_x * axis[i].m_x + axis[i].m_y * axis[i].m_y;
171  for(int j = 0; j < 4; j++) {
172  double m_rectProj = (rect1Corners[j].m_x * axis[i].m_x + rect1Corners[j].m_y * axis[i].m_y) / den;
173  double rectProj = (rect2Corners[j].m_x * axis[i].m_x + rect2Corners[j].m_y * axis[i].m_y) / den;
174 
175  rect1ProjPts[i][j] = wxPoint2DDouble(m_rectProj * axis[i].m_x, m_rectProj * axis[i].m_y);
176  rect2ProjPts[i][j] = wxPoint2DDouble(rectProj * axis[i].m_x, rectProj * axis[i].m_y);
177  }
178  }
179 
180  // Calculate the scalar value to identify the max and min values on projections
181  double rect1Scalar[4][4]; //[axis][corner]
182  double rect2Scalar[4][4]; //[axis][corner]
183  for(int i = 0; i < 4; i++) {
184  for(int j = 0; j < 4; j++) {
185  rect1Scalar[i][j] = rect1ProjPts[i][j].m_x * axis[i].m_x + rect1ProjPts[i][j].m_y * axis[i].m_y;
186  rect2Scalar[i][j] = rect2ProjPts[i][j].m_x * axis[i].m_x + rect2ProjPts[i][j].m_y * axis[i].m_y;
187  }
188  }
189  // Identify the max and min scalar values
190  double rect1Min[4];
191  double rect1Max[4];
192  double rect2Min[4];
193  double rect2Max[4];
194 
195  for(int i = 0; i < 4; i++) {
196  rect1Max[i] = rect1Scalar[i][0];
197  rect2Max[i] = rect2Scalar[i][0];
198  rect1Min[i] = rect1Scalar[i][0];
199  rect2Min[i] = rect2Scalar[i][0];
200 
201  for(int j = 1; j < 4; j++) {
202  if(rect1Max[i] < rect1Scalar[i][j]) rect1Max[i] = rect1Scalar[i][j];
203  if(rect2Max[i] < rect2Scalar[i][j]) rect2Max[i] = rect2Scalar[i][j];
204 
205  if(rect1Min[i] > rect1Scalar[i][j]) rect1Min[i] = rect1Scalar[i][j];
206  if(rect2Min[i] > rect2Scalar[i][j]) rect2Min[i] = rect2Scalar[i][j];
207  }
208  }
209 
210  // Check if any segment don't overlap
211  for(int i = 0; i < 4; i++) {
212  if(!(rect2Min[i] <= rect1Max[i] && rect2Max[i] >= rect1Min[i])) return false;
213  }
214 
215  return true;
216 }
217 
218 bool Element::SetOnline(bool online)
219 {
220  // Check if any parent is null.
221  for(auto it = m_parentList.begin(); it != m_parentList.end(); it++) {
222  if(!(*it)) return false;
223  }
224  m_online = online;
225  return true;
226 }
227 
228 void Element::GeneralMenuItens(wxMenu& menu)
229 {
230  wxMenuItem* clockItem = new wxMenuItem(&menu, ID_ROTATE_CLOCK, _("Rotate clockwise"));
231  clockItem->SetBitmap(wxImage("..\\data\\images\\menu\\rotateClock16.png"));
232  menu.Append(clockItem);
233 
234  wxMenuItem* counterClockItem = new wxMenuItem(&menu, ID_ROTATE_COUNTERCLOCK, _("Rotate counter-clockwise"));
235  counterClockItem->SetBitmap(wxImage("..\\data\\images\\menu\\rotateCounterClock16.png"));
236  menu.Append(counterClockItem);
237 
238  wxMenuItem* deleteItem = new wxMenuItem(&menu, ID_DELETE, _("Delete"));
239  deleteItem->SetBitmap(wxImage("..\\data\\images\\menu\\delete16.png"));
240  menu.Append(deleteItem);
241 }
242 
243 void Element::CalculateBoundaries(wxPoint2DDouble& leftUp, wxPoint2DDouble& rightBottom) const
244 {
245  // Check rect corners boundaries.
246 
247  // Get rectangle corners
248  wxPoint2DDouble rectCorner[4] = { m_rect.GetLeftTop(), m_rect.GetLeftBottom(), m_rect.GetRightBottom(),
249  m_rect.GetRightTop() };
250  // Rotate corners.
251  for(int i = 0; i < 4; ++i) {
252  rectCorner[i] = RotateAtPosition(rectCorner[i], m_angle);
253  }
254  leftUp = rectCorner[0];
255  rightBottom = rectCorner[0];
256  for(int i = 1; i < 4; ++i) {
257  if(rectCorner[i].m_x < leftUp.m_x) leftUp.m_x = rectCorner[i].m_x;
258  if(rectCorner[i].m_y < leftUp.m_y) leftUp.m_y = rectCorner[i].m_y;
259  if(rectCorner[i].m_x > rightBottom.m_x) rightBottom.m_x = rectCorner[i].m_x;
260  if(rectCorner[i].m_y > rightBottom.m_y) rightBottom.m_y = rectCorner[i].m_y;
261  }
262 
263  // Check points list boundaries.
264  for(int i = 0; i < (int)m_pointList.size(); i++) {
265  if(m_pointList[i].m_x < leftUp.m_x) leftUp.m_x = m_pointList[i].m_x;
266  if(m_pointList[i].m_y < leftUp.m_y) leftUp.m_y = m_pointList[i].m_y;
267  if(m_pointList[i].m_x > rightBottom.m_x) rightBottom.m_x = m_pointList[i].m_x;
268  if(m_pointList[i].m_y > rightBottom.m_y) rightBottom.m_y = m_pointList[i].m_y;
269  }
270 }
271 
272 bool Element::DoubleFromString(wxWindow* parent, wxString strValue, double& value, wxString errorMsg)
273 {
274  double dValue = 0.0;
275 
276  if(!strValue.ToDouble(&dValue)) {
277  wxMessageDialog msgDialog(parent, errorMsg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
278  msgDialog.ShowModal();
279  return false;
280  }
281 
282  value = dValue;
283  return true;
284 }
285 
286 bool Element::IntFromString(wxWindow* parent, wxString strValue, int& value, wxString errorMsg)
287 {
288  long int iValue = 0;
289 
290  if(!strValue.ToLong(&iValue)) {
291  wxMessageDialog msgDialog(parent, errorMsg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
292  msgDialog.ShowModal();
293  return false;
294  }
295 
296  value = iValue;
297  return true;
298 }
299 
300 wxString Element::StringFromDouble(double value, int minDecimal)
301 {
302  wxString str = wxString::FromCDouble(value, 13);
303  int cutNumber = 0;
304  int numDecimal = 0;
305  bool foundCut = false;
306  for(int i = (int)str.length() - 1; i >= 0; i--) {
307  if(str[i] != '0' && !foundCut) {
308  cutNumber = i;
309  foundCut = true;
310  }
311  if(str[i] == '.') {
312  numDecimal = i;
313  break;
314  }
315  }
316 
317  wxString formatedStr = "";
318  if(cutNumber - numDecimal > minDecimal)
319  formatedStr = wxString::FromDouble(value, cutNumber - numDecimal);
320  else
321  formatedStr = wxString::FromDouble(value, minDecimal);
322 
323  return formatedStr;
324 }
325 
326 void Element::ReplaceParent(Element* oldParent, Element* newParent)
327 {
328  for(int i = 0; i < (int)m_parentList.size(); i++) {
329  if(m_parentList[i] == oldParent) m_parentList[i] = newParent;
330  }
331 }
332 
333 void Element::AddChild(Element* child) { m_childList.push_back(child); }
334 
336 {
337  for(auto it = m_childList.begin(); it != m_childList.end(); ++it) {
338  Element* element = *it;
339  if(element == child) m_childList.erase(it--);
340  }
341 }
342 
343 void Element::ReplaceChild(Element* oldChild, Element* newChild)
344 {
345  for(int i = 0; i < (int)m_childList.size(); i++) {
346  if(m_childList[i] == oldChild) m_childList[i] = newChild;
347  }
348 }
349 
350 void OpenGLColour::SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
351 {
352  rgba[0] = red;
353  rgba[1] = green;
354  rgba[2] = blue;
355  rgba[3] = alpha;
356 }
357 
358 OpenGLColour::OpenGLColour() { SetRGBA(1.0, 1.0, 1.0, 1.0); }
359 
360 OpenGLColour::OpenGLColour(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
361 {
362  SetRGBA(red, green, blue, alpha);
363 }
364 
365 double Element::PointToLineDistance(wxPoint2DDouble point, int* segmentNumber) const
366 {
367  //[Ref] http://geomalgorithms.com/a02-_lines.html
368  double distance = 100.0; // Big initial distance.
369  wxPoint2DDouble p0 = point;
370 
371  for(int i = 1; i < (int)m_pointList.size() - 2; i++) {
372  double d = 0.0;
373 
374  wxPoint2DDouble p1 = m_pointList[i];
375  wxPoint2DDouble p2 = m_pointList[i + 1];
376 
377  wxPoint2DDouble v = p2 - p1;
378  wxPoint2DDouble w = p0 - p1;
379 
380  double c1 = w.m_x * v.m_x + w.m_y * v.m_y;
381  double c2 = v.m_x * v.m_x + v.m_y * v.m_y;
382 
383  if(c1 <= 0.0) {
384  d = std::sqrt(std::pow(p0.m_y - p1.m_y, 2) + std::pow(p0.m_x - p1.m_x, 2));
385  } else if(c2 <= c1) {
386  d = std::sqrt(std::pow(p0.m_y - p2.m_y, 2) + std::pow(p0.m_x - p2.m_x, 2));
387  } else {
388  d = std::abs((p2.m_y - p1.m_y) * p0.m_x - (p2.m_x - p1.m_x) * p0.m_y + p2.m_x * p1.m_y - p2.m_y * p1.m_x) /
389  std::sqrt(std::pow(p2.m_y - p1.m_y, 2) + std::pow(p2.m_x - p1.m_x, 2));
390  }
391  if(d < distance) {
392  distance = d;
393  if(segmentNumber) *segmentNumber = i;
394  }
395  }
396 
397  return distance;
398 }
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Element.cpp:107
- -
virtual void DrawTriangle(std::vector< wxPoint2DDouble > points, GLenum mode=GL_TRIANGLES) const
Draw a triangle.
Definition: Element.cpp:44
-
virtual void DrawLine(std::vector< wxPoint2DDouble > points, GLenum mode=GL_LINE_STRIP) const
Draw line.
Definition: Element.cpp:73
-
virtual wxPoint2DDouble WorldToScreen(wxPoint2DDouble translation, double scale, double offsetX=0.0, double offsetY=0.0) const
Convert the element position to screen position.
Definition: Element.cpp:109
-
bool SetOnline(bool online=true)
Set if the element is online or offline.
Definition: Element.cpp:218
-
static bool DoubleFromString(wxWindow *parent, wxString strValue, double &value, wxString errorMsg)
Get a double value from a string. Show a error message if the conversion fail.
Definition: Element.cpp:272
- -
void SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
Set the colour in RGBA. The colour values must be between 0.0 and 1.0.
Definition: Element.cpp:350
-
virtual void RemoveChild(Element *child)
Remove a child from the list.
Definition: Element.cpp:335
-
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:91
-
virtual void CalculateBoundaries(wxPoint2DDouble &leftUp, wxPoint2DDouble &rightBottom) const
Calculate the element boundaries.
Definition: Element.cpp:243
-
virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode=GL_QUADS) const
Draw rectangle.
Definition: Element.cpp:53
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Element.h"
19 #ifdef USING_WX_3_0_X
20 #include "DegreesAndRadians.h"
21 #endif
22 
23 Element::Element() { m_selectionColour.SetRGBA(0.0, 0.5, 1.0, 0.5); }
25 void Element::SetPosition(const wxPoint2DDouble position)
26 {
27  m_position = position;
28  m_rect =
29  wxRect2DDouble(m_position.m_x - m_width / 2.0 - m_borderSize, m_position.m_y - m_height / 2.0 - m_borderSize,
30  m_width + 2.0 * m_borderSize, m_height + 2.0 * m_borderSize);
31 }
32 
33 void Element::DrawCircle(wxPoint2DDouble position, double radius, int numSegments, GLenum mode) const
34 {
35  glBegin(mode);
36  for(int i = 0; i < numSegments; i++) {
37  double theta = 2.0 * 3.1415926 * double(i) / double(numSegments);
38  glVertex2f(radius * std::cos(theta) + position.m_x, radius * std::sin(theta) + position.m_y);
39  }
40  glEnd();
41 }
42 
43 void Element::DrawArc(wxPoint2DDouble position,
44  double radius,
45  double initAngle,
46  double finalAngle,
47  int numSegments,
48  GLenum mode) const
49 {
50  double initAngRad = wxDegToRad(initAngle);
51  double finalAngRad = wxDegToRad(finalAngle);
52  glBegin(mode);
53  for(int i = 0; i <= numSegments; i++) {
54  double theta = initAngRad + (finalAngRad - initAngRad) * double(i) / double(numSegments);
55  glVertex2f(radius * std::cos(theta) + position.m_x, radius * std::sin(theta) + position.m_y);
56  }
57  glEnd();
58 }
59 
60 void Element::DrawTriangle(std::vector<wxPoint2DDouble> points, GLenum mode) const
61 {
62  glBegin(mode);
63  for(int i = 0; i < 3; i++) {
64  glVertex2d(points[i].m_x, points[i].m_y);
65  }
66  glEnd();
67 }
68 
69 void Element::DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode) const
70 {
71  glBegin(mode); // TODO: GL_QUADS é obsoleto (OpenGL 3.0+), encontrar outra solução.
72  glVertex2d(position.m_x - width / 2.0, position.m_y - height / 2.0);
73  glVertex2d(position.m_x - width / 2.0, position.m_y + height / 2.0);
74  glVertex2d(position.m_x + width / 2.0, position.m_y + height / 2.0);
75  glVertex2d(position.m_x + width / 2.0, position.m_y - height / 2.0);
76  glEnd();
77 }
78 
79 void Element::DrawRectangle(wxPoint2DDouble* points, GLenum mode) const
80 {
81  glBegin(mode); // TODO: GL_QUADS é obsoleto (OpenGL 3.0+), encontrar outra solução.
82  glVertex2d(points[0].m_x, points[0].m_y);
83  glVertex2d(points[1].m_x, points[1].m_y);
84  glVertex2d(points[2].m_x, points[2].m_y);
85  glVertex2d(points[3].m_x, points[3].m_y);
86  glEnd();
87 }
88 
89 void Element::DrawLine(std::vector<wxPoint2DDouble> points, GLenum mode) const
90 {
91  glBegin(mode);
92  for(auto it = points.begin(); it != points.end(); ++it) {
93  glVertex2d((*it).m_x, (*it).m_y);
94  }
95  glEnd();
96 }
97 
98 void Element::DrawPickbox(wxPoint2DDouble position) const
99 {
100  glLineWidth(1.0);
101  glColor4d(1.0, 1.0, 1.0, 0.8);
102  DrawRectangle(position, 8.0, 8.0);
103  glColor4d(0.0, 0.0, 0.0, 1.0);
104  DrawRectangle(position, 8.0, 8.0, GL_LINE_LOOP);
105 }
106 
107 wxPoint2DDouble Element::RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees) const
108 {
109  double radAngle = angle;
110  if(degrees) radAngle = wxDegToRad(angle);
111  return wxPoint2DDouble(std::cos(radAngle) * (pointToRotate.m_x - m_position.m_x) -
112  std::sin(radAngle) * (pointToRotate.m_y - m_position.m_y) + m_position.m_x,
113  std::sin(radAngle) * (pointToRotate.m_x - m_position.m_x) +
114  std::cos(radAngle) * (pointToRotate.m_y - m_position.m_y) + m_position.m_y);
115 }
116 
117 void Element::StartMove(wxPoint2DDouble position)
118 {
119  this->m_moveStartPt = position;
120  this->m_movePos = m_position;
121 }
122 
123 void Element::Move(wxPoint2DDouble position) { SetPosition(m_movePos + position - m_moveStartPt); }
124 wxPoint2DDouble Element::WorldToScreen(wxPoint2DDouble translation, double scale, double offsetX, double offsetY) const
125 {
126  return wxPoint2DDouble(m_position.m_x + offsetX + translation.m_x, m_position.m_y + offsetY + translation.m_y) *
127  scale;
128 }
129 
130 wxPoint2DDouble Element::WorldToScreen(wxPoint2DDouble position,
131  wxPoint2DDouble translation,
132  double scale,
133  double offsetX,
134  double offsetY) const
135 {
136  return wxPoint2DDouble(position.m_x + offsetX + translation.m_x, position.m_y + offsetY + translation.m_y) * scale;
137 }
138 
139 void Element::DrawPoint(wxPoint2DDouble position, double size) const
140 {
141  glPointSize(size);
142  glBegin(GL_POINTS);
143  glVertex2d(position.m_x, position.m_y);
144  glEnd();
145 }
146 
147 bool Element::RotatedRectanglesIntersects(wxRect2DDouble rect1,
148  wxRect2DDouble rect2,
149  double angle1,
150  double angle2) const
151 {
152  wxPoint2DDouble rect1Corners[4] = {rect1.GetLeftTop(), rect1.GetLeftBottom(), rect1.GetRightBottom(),
153  rect1.GetRightTop()};
154  wxPoint2DDouble rect2Corners[4] = {rect2.GetLeftTop(), rect2.GetLeftBottom(), rect2.GetRightBottom(),
155  rect2.GetRightTop()};
156  wxPoint2DDouble rect1Center(rect1.m_x + rect1.m_width / 2.0, rect1.m_y + rect1.m_height / 2.0);
157  wxPoint2DDouble rect2Center(rect2.m_x + rect2.m_width / 2.0, rect2.m_y + rect2.m_height / 2.0);
158 
159  // Rotate the corners.
160  double radAngle1 = wxDegToRad(angle1);
161  double radAngle2 = wxDegToRad(angle2);
162 
163  for(int i = 0; i < 4; i++) {
164  rect1Corners[i] =
165  wxPoint2DDouble(std::cos(radAngle1) * (rect1Corners[i].m_x - rect1Center.m_x) -
166  std::sin(radAngle1) * (rect1Corners[i].m_y - rect1Center.m_y) + rect1Center.m_x,
167  std::sin(radAngle1) * (rect1Corners[i].m_x - rect1Center.m_x) +
168  std::cos(radAngle1) * (rect1Corners[i].m_y - rect1Center.m_y) + rect1Center.m_y);
169 
170  rect2Corners[i] =
171  wxPoint2DDouble(std::cos(radAngle2) * (rect2Corners[i].m_x - rect2Center.m_x) -
172  std::sin(radAngle2) * (rect2Corners[i].m_y - rect2Center.m_y) + rect2Center.m_x,
173  std::sin(radAngle2) * (rect2Corners[i].m_x - rect2Center.m_x) +
174  std::cos(radAngle2) * (rect2Corners[i].m_y - rect2Center.m_y) + rect2Center.m_y);
175  }
176 
177  //[Ref] http://www.gamedev.net/page/resources/_/technical/game-programming/2d-rotated-rectangle-collision-r2604
178 
179  // Find the rectangles axis to project
180  wxPoint2DDouble axis[4] = {rect1Corners[3] - rect1Corners[0], rect1Corners[3] - rect1Corners[2],
181  rect2Corners[3] - rect2Corners[0], rect2Corners[3] - rect2Corners[2]};
182 
183  // Calculate the projected points to each axis
184  wxPoint2DDouble rect1ProjPts[4][4]; // [axis][corner]
185  wxPoint2DDouble rect2ProjPts[4][4]; // [axis][corner]
186  for(int i = 0; i < 4; i++) {
187  double den = axis[i].m_x * axis[i].m_x + axis[i].m_y * axis[i].m_y;
188  for(int j = 0; j < 4; j++) {
189  double m_rectProj = (rect1Corners[j].m_x * axis[i].m_x + rect1Corners[j].m_y * axis[i].m_y) / den;
190  double rectProj = (rect2Corners[j].m_x * axis[i].m_x + rect2Corners[j].m_y * axis[i].m_y) / den;
191 
192  rect1ProjPts[i][j] = wxPoint2DDouble(m_rectProj * axis[i].m_x, m_rectProj * axis[i].m_y);
193  rect2ProjPts[i][j] = wxPoint2DDouble(rectProj * axis[i].m_x, rectProj * axis[i].m_y);
194  }
195  }
196 
197  // Calculate the scalar value to identify the max and min values on projections
198  double rect1Scalar[4][4]; //[axis][corner]
199  double rect2Scalar[4][4]; //[axis][corner]
200  for(int i = 0; i < 4; i++) {
201  for(int j = 0; j < 4; j++) {
202  rect1Scalar[i][j] = rect1ProjPts[i][j].m_x * axis[i].m_x + rect1ProjPts[i][j].m_y * axis[i].m_y;
203  rect2Scalar[i][j] = rect2ProjPts[i][j].m_x * axis[i].m_x + rect2ProjPts[i][j].m_y * axis[i].m_y;
204  }
205  }
206  // Identify the max and min scalar values
207  double rect1Min[4];
208  double rect1Max[4];
209  double rect2Min[4];
210  double rect2Max[4];
211 
212  for(int i = 0; i < 4; i++) {
213  rect1Max[i] = rect1Scalar[i][0];
214  rect2Max[i] = rect2Scalar[i][0];
215  rect1Min[i] = rect1Scalar[i][0];
216  rect2Min[i] = rect2Scalar[i][0];
217 
218  for(int j = 1; j < 4; j++) {
219  if(rect1Max[i] < rect1Scalar[i][j]) rect1Max[i] = rect1Scalar[i][j];
220  if(rect2Max[i] < rect2Scalar[i][j]) rect2Max[i] = rect2Scalar[i][j];
221 
222  if(rect1Min[i] > rect1Scalar[i][j]) rect1Min[i] = rect1Scalar[i][j];
223  if(rect2Min[i] > rect2Scalar[i][j]) rect2Min[i] = rect2Scalar[i][j];
224  }
225  }
226 
227  // Check if any segment don't overlap
228  for(int i = 0; i < 4; i++) {
229  if(!(rect2Min[i] <= rect1Max[i] && rect2Max[i] >= rect1Min[i])) return false;
230  }
231 
232  return true;
233 }
234 
235 bool Element::SetOnline(bool online)
236 {
237  // Check if any parent is null.
238  for(auto it = m_parentList.begin(); it != m_parentList.end(); it++) {
239  if(!(*it)) return false;
240  }
241  m_online = online;
242  return true;
243 }
244 
245 void Element::GeneralMenuItens(wxMenu& menu)
246 {
247  wxFileName exeFileName(wxStandardPaths::Get().GetExecutablePath());
248  wxString exePath = exeFileName.GetPath();
249 
250  wxMenuItem* clockItem = new wxMenuItem(&menu, ID_ROTATE_CLOCK, _("Rotate clockwise"));
251  clockItem->SetBitmap(wxImage(exePath + "\\..\\data\\images\\menu\\rotateClock16.png"));
252  menu.Append(clockItem);
253 
254  wxMenuItem* counterClockItem = new wxMenuItem(&menu, ID_ROTATE_COUNTERCLOCK, _("Rotate counter-clockwise"));
255  counterClockItem->SetBitmap(wxImage(exePath + "\\..\\data\\images\\menu\\rotateCounterClock16.png"));
256  menu.Append(counterClockItem);
257 
258  wxMenuItem* deleteItem = new wxMenuItem(&menu, ID_DELETE, _("Delete"));
259  deleteItem->SetBitmap(wxImage(exePath + "\\..\\data\\images\\menu\\delete16.png"));
260  menu.Append(deleteItem);
261 }
262 
263 void Element::CalculateBoundaries(wxPoint2DDouble& leftUp, wxPoint2DDouble& rightBottom) const
264 {
265  // Check rect corners boundaries.
266 
267  // Get rectangle corners
268  wxPoint2DDouble rectCorner[4] = {m_rect.GetLeftTop(), m_rect.GetLeftBottom(), m_rect.GetRightBottom(),
269  m_rect.GetRightTop()};
270  // Rotate corners.
271  for(int i = 0; i < 4; ++i) {
272  rectCorner[i] = RotateAtPosition(rectCorner[i], m_angle);
273  }
274  leftUp = rectCorner[0];
275  rightBottom = rectCorner[0];
276  for(int i = 1; i < 4; ++i) {
277  if(rectCorner[i].m_x < leftUp.m_x) leftUp.m_x = rectCorner[i].m_x;
278  if(rectCorner[i].m_y < leftUp.m_y) leftUp.m_y = rectCorner[i].m_y;
279  if(rectCorner[i].m_x > rightBottom.m_x) rightBottom.m_x = rectCorner[i].m_x;
280  if(rectCorner[i].m_y > rightBottom.m_y) rightBottom.m_y = rectCorner[i].m_y;
281  }
282 
283  // Check points list boundaries.
284  for(int i = 0; i < (int)m_pointList.size(); i++) {
285  if(m_pointList[i].m_x < leftUp.m_x) leftUp.m_x = m_pointList[i].m_x;
286  if(m_pointList[i].m_y < leftUp.m_y) leftUp.m_y = m_pointList[i].m_y;
287  if(m_pointList[i].m_x > rightBottom.m_x) rightBottom.m_x = m_pointList[i].m_x;
288  if(m_pointList[i].m_y > rightBottom.m_y) rightBottom.m_y = m_pointList[i].m_y;
289  }
290 }
291 
292 bool Element::DoubleFromString(wxWindow* parent, wxString strValue, double& value, wxString errorMsg)
293 {
294  double dValue = 0.0;
295 
296  if(!strValue.ToDouble(&dValue)) {
297  wxMessageDialog msgDialog(parent, errorMsg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
298  msgDialog.ShowModal();
299  return false;
300  }
301 
302  value = dValue;
303  return true;
304 }
305 
306 bool Element::IntFromString(wxWindow* parent, wxString strValue, int& value, wxString errorMsg)
307 {
308  long int iValue = 0;
309 
310  if(!strValue.ToLong(&iValue)) {
311  wxMessageDialog msgDialog(parent, errorMsg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
312  msgDialog.ShowModal();
313  return false;
314  }
315 
316  value = iValue;
317  return true;
318 }
319 
320 wxString Element::StringFromDouble(double value, int minDecimal)
321 {
322  wxString str = wxString::FromCDouble(value, 13);
323  int cutNumber = 0;
324  int numDecimal = 0;
325  bool foundCut = false;
326  for(int i = (int)str.length() - 1; i >= 0; i--) {
327  if(str[i] != '0' && !foundCut) {
328  cutNumber = i;
329  foundCut = true;
330  }
331  if(str[i] == '.') {
332  numDecimal = i;
333  break;
334  }
335  }
336 
337  wxString formatedStr = "";
338  if(cutNumber - numDecimal > minDecimal)
339  formatedStr = wxString::FromDouble(value, cutNumber - numDecimal);
340  else
341  formatedStr = wxString::FromDouble(value, minDecimal);
342 
343  return formatedStr;
344 }
345 
346 void Element::ReplaceParent(Element* oldParent, Element* newParent)
347 {
348  for(int i = 0; i < (int)m_parentList.size(); i++) {
349  if(m_parentList[i] == oldParent) m_parentList[i] = newParent;
350  }
351 }
352 
353 void Element::AddChild(Element* child) { m_childList.push_back(child); }
355 {
356  for(auto it = m_childList.begin(); it != m_childList.end(); ++it) {
357  Element* element = *it;
358  if(element == child) m_childList.erase(it--);
359  }
360 }
361 
362 void Element::ReplaceChild(Element* oldChild, Element* newChild)
363 {
364  for(int i = 0; i < (int)m_childList.size(); i++) {
365  if(m_childList[i] == oldChild) m_childList[i] = newChild;
366  }
367 }
368 
369 void OpenGLColour::SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
370 {
371  rgba[0] = red;
372  rgba[1] = green;
373  rgba[2] = blue;
374  rgba[3] = alpha;
375 }
376 
377 OpenGLColour::OpenGLColour() { SetRGBA(1.0, 1.0, 1.0, 1.0); }
378 OpenGLColour::OpenGLColour(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
379 {
380  SetRGBA(red, green, blue, alpha);
381 }
382 
383 double Element::PointToLineDistance(wxPoint2DDouble point, int* segmentNumber) const
384 {
385  //[Ref] http://geomalgorithms.com/a02-_lines.html
386  double distance = 100.0; // Big initial distance.
387  wxPoint2DDouble p0 = point;
388 
389  for(int i = 1; i < (int)m_pointList.size() - 2; i++) {
390  double d = 0.0;
391 
392  wxPoint2DDouble p1 = m_pointList[i];
393  wxPoint2DDouble p2 = m_pointList[i + 1];
394 
395  wxPoint2DDouble v = p2 - p1;
396  wxPoint2DDouble w = p0 - p1;
397 
398  double c1 = w.m_x * v.m_x + w.m_y * v.m_y;
399  double c2 = v.m_x * v.m_x + v.m_y * v.m_y;
400 
401  if(c1 <= 0.0) {
402  d = std::sqrt(std::pow(p0.m_y - p1.m_y, 2) + std::pow(p0.m_x - p1.m_x, 2));
403  } else if(c2 <= c1) {
404  d = std::sqrt(std::pow(p0.m_y - p2.m_y, 2) + std::pow(p0.m_x - p2.m_x, 2));
405  } else {
406  d = std::abs((p2.m_y - p1.m_y) * p0.m_x - (p2.m_x - p1.m_x) * p0.m_y + p2.m_x * p1.m_y - p2.m_y * p1.m_x) /
407  std::sqrt(std::pow(p2.m_y - p1.m_y, 2) + std::pow(p2.m_x - p1.m_x, 2));
408  }
409  if(d < distance) {
410  distance = d;
411  if(segmentNumber) *segmentNumber = i;
412  }
413  }
414 
415  return distance;
416 }
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Element.cpp:123
+ +
virtual void DrawTriangle(std::vector< wxPoint2DDouble > points, GLenum mode=GL_TRIANGLES) const
Draw a triangle.
Definition: Element.cpp:60
+
virtual void DrawLine(std::vector< wxPoint2DDouble > points, GLenum mode=GL_LINE_STRIP) const
Draw line.
Definition: Element.cpp:89
+
virtual wxPoint2DDouble WorldToScreen(wxPoint2DDouble translation, double scale, double offsetX=0.0, double offsetY=0.0) const
Convert the element position to screen position.
Definition: Element.cpp:124
+
bool SetOnline(bool online=true)
Set if the element is online or offline.
Definition: Element.cpp:235
+
static bool DoubleFromString(wxWindow *parent, wxString strValue, double &value, wxString errorMsg)
Get a double value from a string. Show a error message if the conversion fail.
Definition: Element.cpp:292
+ +
void SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
Set the colour in RGBA. The colour values must be between 0.0 and 1.0.
Definition: Element.cpp:369
+
virtual void RemoveChild(Element *child)
Remove a child from the list.
Definition: Element.cpp:354
+
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:107
+
virtual void CalculateBoundaries(wxPoint2DDouble &leftUp, wxPoint2DDouble &rightBottom) const
Calculate the element boundaries.
Definition: Element.cpp:263
+
virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode=GL_QUADS) const
Draw rectangle.
Definition: Element.cpp:69
Class to manage color of OpenGL.
-
virtual void GeneralMenuItens(wxMenu &menu)
Insert general itens to context menu.
Definition: Element.cpp:228
-
virtual void ReplaceChild(Element *oldChild, Element *newChild)
Replace a child from the list.
Definition: Element.cpp:343
-
static bool IntFromString(wxWindow *parent, wxString strValue, int &value, wxString errorMsg)
Convert a string to int. Show a error message if the conversion fail.
Definition: Element.cpp:286
-
OpenGLColour()
Default construnctor. Use SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)...
Definition: Element.cpp:358
-
void SetPosition(const wxPoint2DDouble position)
Set the element position and update the rectangle.
Definition: Element.cpp:10
- -
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:333
-
virtual void DrawPoint(wxPoint2DDouble position, double size) const
Draw a point.
Definition: Element.cpp:124
-
virtual void DrawPickbox(wxPoint2DDouble position) const
Draw pickbox.
Definition: Element.cpp:82
- -
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:300
-
virtual void ReplaceParent(Element *oldParent, Element *newParent)
Replace a parent.
Definition: Element.cpp:326
-
virtual double PointToLineDistance(wxPoint2DDouble point, int *segmentNumber=NULL) const
Calculate the distance between a line (formed by point list) and a point.
Definition: Element.cpp:365
-
Element()
Constructor.
Definition: Element.cpp:6
-
virtual void DrawCircle(wxPoint2DDouble position, double radius, int numSegments, GLenum mode=GL_LINE_LOOP) const
Draw a circle.
Definition: Element.cpp:17
-
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Element.cpp:101
-
virtual ~Element()
Destructor.
Definition: Element.cpp:8
-
virtual bool RotatedRectanglesIntersects(wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const
Check if two roteted rectangles intersect.
Definition: Element.cpp:132
+
virtual void GeneralMenuItens(wxMenu &menu)
Insert general itens to context menu.
Definition: Element.cpp:245
+
virtual void ReplaceChild(Element *oldChild, Element *newChild)
Replace a child from the list.
Definition: Element.cpp:362
+
static bool IntFromString(wxWindow *parent, wxString strValue, int &value, wxString errorMsg)
Convert a string to int. Show a error message if the conversion fail.
Definition: Element.cpp:306
+
OpenGLColour()
Default construnctor. Use SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)...
Definition: Element.cpp:377
+
void SetPosition(const wxPoint2DDouble position)
Set the element position and update the rectangle.
Definition: Element.cpp:25
+ +
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:353
+
virtual void DrawPoint(wxPoint2DDouble position, double size) const
Draw a point.
Definition: Element.cpp:139
+
virtual void DrawPickbox(wxPoint2DDouble position) const
Draw pickbox.
Definition: Element.cpp:98
+ +
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:320
+
virtual void ReplaceParent(Element *oldParent, Element *newParent)
Replace a parent.
Definition: Element.cpp:346
+
virtual double PointToLineDistance(wxPoint2DDouble point, int *segmentNumber=NULL) const
Calculate the distance between a line (formed by point list) and a point.
Definition: Element.cpp:383
+
Element()
Constructor.
Definition: Element.cpp:23
+
virtual void DrawCircle(wxPoint2DDouble position, double radius, int numSegments, GLenum mode=GL_LINE_LOOP) const
Draw a circle.
Definition: Element.cpp:33
+
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Element.cpp:117
+
virtual ~Element()
Destructor.
Definition: Element.cpp:24
+
virtual bool RotatedRectanglesIntersects(wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const
Check if two roteted rectangles intersect.
Definition: Element.cpp:147
diff --git a/docs/doxygen/html/_element_8h.html b/docs/doxygen/html/_element_8h.html index 4a0ccc5..453f108 100644 --- a/docs/doxygen/html/_element_8h.html +++ b/docs/doxygen/html/_element_8h.html @@ -21,6 +21,12 @@ + @@ -92,6 +98,8 @@ $(document).ready(function(){initNavTree('_element_8h.html','');}); #include <wx/geometry.h>
#include <wx/cursor.h>
#include <wx/menu.h>
+#include <wx/stdpaths.h>
+#include <wx/filename.h>
#include <GL/gl.h>
#include <complex>
@@ -134,6 +142,7 @@ Enumerations

Detailed Description

Class to manage color of OpenGL.

+

Base class of all elements of the program. This class is responsible for manage graphical and his data.

Definition in file Element.h.

Enumeration Type Documentation

@@ -165,7 +174,7 @@ Enumerations -

Definition at line 32 of file Element.h.

+

Definition at line 51 of file Element.h.

@@ -199,7 +208,7 @@ Enumerations -

Definition at line 18 of file Element.h.

+

Definition at line 37 of file Element.h.

diff --git a/docs/doxygen/html/_element_8h_source.html b/docs/doxygen/html/_element_8h_source.html index ebb3281..afc215f 100644 --- a/docs/doxygen/html/_element_8h_source.html +++ b/docs/doxygen/html/_element_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,70 +88,70 @@ $(document).ready(function(){initNavTree('_element_8h_source.html','');});
Element.h
-Go to the documentation of this file.
1 #ifndef ELEMENT_H
2 #define ELEMENT_H
3 
4 #include <wx/msgdlg.h>
5 #include <wx/geometry.h>
6 #include <wx/cursor.h>
7 #include <wx/menu.h>
8 #include <GL/gl.h>
9 
10 #include <complex>
11 
12 //#include <wx/log.h>
13 
18 enum PickboxID {
19  ID_PB_NONE = 0,
26 };
27 
39 };
40 
49 {
50 public:
54  OpenGLColour();
55 
63  OpenGLColour(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
64 
68  virtual ~OpenGLColour() {}
69 
77  void SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
78 
83  const GLdouble* GetRGBA() const { return rgba; }
84 protected:
85  GLdouble rgba[4];
86 };
87 
88 class Element
89 {
90 public:
94  Element();
95 
99  virtual ~Element();
100 
105  void SetDragging(bool dragging = true) { m_dragging = dragging; }
106 
111  void SetHeight(double height) { m_height = height; }
112 
117  void SetPosition(const wxPoint2DDouble position);
118 
123  void SetSelected(bool selected = true) { m_selected = selected; }
124 
129  void SetWidth(double width) { m_width = width; }
130 
135  void SetAngle(double angle) { m_angle = angle; }
136 
141  void ShowPickbox(bool showPickbox = true) { m_showPickbox = showPickbox; }
142 
147  void SetBorderSize(double borderSize) { m_borderSize = borderSize; }
148 
153  bool SetOnline(bool online = true);
154 
159  virtual void SetPointList(std::vector<wxPoint2DDouble> pointList) { m_pointList = pointList; }
160 
165  wxRect2DDouble GetRect() const { return m_rect; }
166 
171  wxPoint2DDouble GetPosition() const { return m_position; }
172 
177  bool IsDragging() const { return m_dragging; }
178 
183  double GetHeight() const { return m_height; }
184 
189  bool IsSelected() const { return m_selected; }
190 
195  double GetWidth() const { return m_width; }
196 
201  double GetAngle() const { return m_angle; }
202 
207  double GetRotationAngle() const { return m_rotationAngle; }
208 
213  bool IsPickboxShown() const { return m_showPickbox; }
214 
219  bool IsOnline() const { return m_online; }
220 
225  virtual std::vector<wxPoint2DDouble> GetPointList() const { return m_pointList; }
226 
234  virtual bool AddParent(Element* parent, wxPoint2DDouble position) { return false; }
235 
240  virtual void AddParent(Element* parent) { m_parentList.push_back(parent); }
241 
246  virtual bool Contains(wxPoint2DDouble position) const = 0;
247 
252  virtual bool Intersects(wxRect2DDouble rect) const = 0;
253 
258  virtual Element* GetCopy() { return NULL; }
259 
264  virtual void SetID(int id) { m_elementID = id; }
265 
270  virtual int GetID() const { return m_elementID; }
271 
276  virtual void AddChild(Element* child);
277 
282  virtual void RemoveChild(Element* child);
283 
289  virtual void ReplaceChild(Element* oldChild, Element* newChild);
290 
295  virtual wxString GetTipText() const { return wxEmptyString; }
296 
302  virtual void Draw(wxPoint2DDouble translation, double scale) const {}
303 
308  virtual void Rotate(bool clockwise = true) {}
309 
315  virtual bool GetContextMenu(wxMenu& menu) { return false; }
316 
321  virtual void AddPoint(wxPoint2DDouble point) {}
322 
327  virtual void StartMove(wxPoint2DDouble position);
328 
334  virtual void Move(wxPoint2DDouble position);
335 
341  virtual void MoveNode(Element* parent, wxPoint2DDouble position) {}
342 
348  virtual bool NodeContains(wxPoint2DDouble position) { return false; }
349 
353  virtual void UpdateNodes() {}
354 
361  virtual bool SetNodeParent(Element* parent) { return false; }
362 
367  virtual void RemoveParent(Element* parent) {}
368 
374  virtual void ReplaceParent(Element* oldParent, Element* newParent);
375 
381  virtual void RotateNode(Element* parent, bool clockwise = true) {}
382 
389  virtual bool PickboxContains(wxPoint2DDouble position) { return false; }
390 
395  virtual void MovePickbox(wxPoint2DDouble position) {}
396 
401  virtual wxCursor GetBestPickboxCursor() const { return wxCURSOR_ARROW; }
402 
406  virtual void ResetPickboxes() { m_activePickboxID = ID_PB_NONE; }
407 
411  virtual void ResetNodes() { m_activeNodeID = 0; }
412 
420  virtual wxPoint2DDouble
421  WorldToScreen(wxPoint2DDouble translation, double scale, double offsetX = 0.0, double offsetY = 0.0) const;
422 
431  virtual wxPoint2DDouble WorldToScreen(wxPoint2DDouble position,
432  wxPoint2DDouble translation,
433  double scale,
434  double offsetX = 0.0,
435  double offsetY = 0.0) const;
436 
444  virtual bool
445  RotatedRectanglesIntersects(wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const;
446 
454  virtual void DrawCircle(wxPoint2DDouble position, double radius, int numSegments, GLenum mode = GL_LINE_LOOP) const;
455  virtual void DrawArc(wxPoint2DDouble position,
456  double radius,
457  double initAngle,
458  double finalAngle,
459  int numSegments,
460  GLenum mode = GL_LINE_LOOP) const;
461 
469  virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode = GL_QUADS) const;
470 
476  virtual void DrawRectangle(wxPoint2DDouble* points, GLenum mode = GL_QUADS) const;
477 
483  virtual void DrawTriangle(std::vector<wxPoint2DDouble> points, GLenum mode = GL_TRIANGLES) const;
484 
490  virtual void DrawPoint(wxPoint2DDouble position, double size) const;
491 
497  virtual void DrawLine(std::vector<wxPoint2DDouble> points, GLenum mode = GL_LINE_STRIP) const;
498 
503  virtual void DrawPickbox(wxPoint2DDouble position) const;
504 
511  virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees = true) const;
512 
517  virtual std::vector<Element*> GetParentList() const { return m_parentList; }
518 
523  virtual std::vector<Element*> GetChildList() const { return m_childList; }
524 
525  // virtual wxPoint2DDouble GetMoveStartPosition() const { return m_moveStartPt; }
526  // virtual wxPoint2DDouble GetMovePosition() const { return m_movePos; }
527 
533  virtual void CalculateBoundaries(wxPoint2DDouble& leftUp, wxPoint2DDouble& rightBottom) const;
534 
539  virtual void GeneralMenuItens(wxMenu& menu);
540 
547  virtual bool ShowForm(wxWindow* parent, Element* element) { return false; }
548 
556  static bool DoubleFromString(wxWindow* parent, wxString strValue, double& value, wxString errorMsg);
557 
565  static bool IntFromString(wxWindow* parent, wxString strValue, int& value, wxString errorMsg);
566 
572  static wxString StringFromDouble(double value, int minDecimal = 1);
573 
580  virtual double PointToLineDistance(wxPoint2DDouble point, int* segmentNumber = NULL) const;
581 
582 protected:
583  int m_elementID = 0;
584  std::vector<Element*> m_parentList;
585  std::vector<Element*> m_childList;
586 
587  wxRect2DDouble m_rect;
588  wxPoint2DDouble m_position;
589  double m_width = 0.0;
590  double m_height = 0.0;
591  double m_angle = 0.0;
592  double m_borderSize = 2.0;
593  double m_rotationAngle = 45.0;
594  double m_switchSize = 10.0;
595 
596  std::vector<wxRect2DDouble> m_switchRect;
597 
598  bool m_selected = false;
599  bool m_dragging = false;
600  bool m_showPickbox = false;
601 
602  int m_activePickboxID = ID_PB_NONE;
603  int m_activeNodeID = 0;
604 
605  std::vector<wxPoint2DDouble> m_pointList;
606  std::vector<wxPoint2DDouble> m_movePts;
607 
608  wxPoint2DDouble m_moveStartPt;
609  wxPoint2DDouble m_movePos;
610 
611  bool m_online = true;
612 
613  OpenGLColour m_selectionColour;
614 };
615 
616 #endif // ELEMENT_H
double GetAngle() const
Get the element angle.
Definition: Element.h:201
-
void ShowPickbox(bool showPickbox=true)
Set if the pickbox is shown.
Definition: Element.h:141
-
virtual void AddPoint(wxPoint2DDouble point)
Add point to the list of points that connect the element to the bus.
Definition: Element.h:321
- -
void SetSelected(bool selected=true)
Set element selection.
Definition: Element.h:123
-
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:517
-
void SetWidth(double width)
Set element width.
Definition: Element.h:129
-
virtual std::vector< Element * > GetChildList() const
Get the Child list.
Definition: Element.h:523
-
virtual void ResetPickboxes()
Remove the pickboxes.
Definition: Element.h:406
- -
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Element.h:348
-
ContextMenuID
ID of contex menu itens.
Definition: Element.h:32
-
virtual bool PickboxContains(wxPoint2DDouble position)
Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be c...
Definition: Element.h:389
-
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Element.h:353
-
virtual void SetPointList(std::vector< wxPoint2DDouble > pointList)
Set the list of points that connect the element to the bus.
Definition: Element.h:159
- -
void SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
Set the colour in RGBA. The colour values must be between 0.0 and 1.0.
Definition: Element.cpp:350
-
virtual void MoveNode(Element *parent, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Element.h:341
- -
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Element.h:234
- +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ELEMENT_H
19 #define ELEMENT_H
20 
21 #include <wx/msgdlg.h>
22 #include <wx/geometry.h>
23 #include <wx/cursor.h>
24 #include <wx/menu.h>
25 #include <wx/stdpaths.h>
26 #include <wx/filename.h>
27 #include <GL/gl.h>
28 
29 #include <complex>
30 
31 //#include <wx/log.h>
32 
37 enum PickboxID {
38  ID_PB_NONE = 0,
45 };
46 
58 };
59 
68 {
69  public:
73  OpenGLColour();
74 
82  OpenGLColour(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
83 
87  virtual ~OpenGLColour() {}
95  void SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
96 
101  const GLdouble* GetRGBA() const { return rgba; }
102  protected:
103  GLdouble rgba[4];
104 };
105 
113 class Element
114 {
115  public:
119  Element();
120 
124  virtual ~Element();
125 
130  void SetDragging(bool dragging = true) { m_dragging = dragging; }
135  void SetHeight(double height) { m_height = height; }
140  void SetPosition(const wxPoint2DDouble position);
141 
146  void SetSelected(bool selected = true) { m_selected = selected; }
151  void SetWidth(double width) { m_width = width; }
156  void SetAngle(double angle) { m_angle = angle; }
161  void ShowPickbox(bool showPickbox = true) { m_showPickbox = showPickbox; }
166  void SetBorderSize(double borderSize) { m_borderSize = borderSize; }
171  bool SetOnline(bool online = true);
172 
177  virtual void SetPointList(std::vector<wxPoint2DDouble> pointList) { m_pointList = pointList; }
182  wxRect2DDouble GetRect() const { return m_rect; }
187  wxPoint2DDouble GetPosition() const { return m_position; }
192  bool IsDragging() const { return m_dragging; }
197  double GetHeight() const { return m_height; }
202  bool IsSelected() const { return m_selected; }
207  double GetWidth() const { return m_width; }
212  double GetAngle() const { return m_angle; }
217  double GetRotationAngle() const { return m_rotationAngle; }
222  bool IsPickboxShown() const { return m_showPickbox; }
227  bool IsOnline() const { return m_online; }
232  virtual std::vector<wxPoint2DDouble> GetPointList() const { return m_pointList; }
240  virtual bool AddParent(Element* parent, wxPoint2DDouble position) { return false; }
245  virtual void AddParent(Element* parent) { m_parentList.push_back(parent); }
250  virtual bool Contains(wxPoint2DDouble position) const = 0;
251 
256  virtual bool Intersects(wxRect2DDouble rect) const = 0;
257 
262  virtual Element* GetCopy() { return NULL; }
267  virtual void SetID(int id) { m_elementID = id; }
272  virtual int GetID() const { return m_elementID; }
277  virtual void AddChild(Element* child);
278 
283  virtual void RemoveChild(Element* child);
284 
290  virtual void ReplaceChild(Element* oldChild, Element* newChild);
291 
296  virtual wxString GetTipText() const { return wxEmptyString; }
302  virtual void Draw(wxPoint2DDouble translation, double scale) const {}
307  virtual void Rotate(bool clockwise = true) {}
313  virtual bool GetContextMenu(wxMenu& menu) { return false; }
318  virtual void AddPoint(wxPoint2DDouble point) {}
323  virtual void StartMove(wxPoint2DDouble position);
324 
330  virtual void Move(wxPoint2DDouble position);
331 
337  virtual void MoveNode(Element* parent, wxPoint2DDouble position) {}
343  virtual bool NodeContains(wxPoint2DDouble position) { return false; }
347  virtual void UpdateNodes() {}
354  virtual bool SetNodeParent(Element* parent) { return false; }
359  virtual void RemoveParent(Element* parent) {}
365  virtual void ReplaceParent(Element* oldParent, Element* newParent);
366 
372  virtual void RotateNode(Element* parent, bool clockwise = true) {}
379  virtual bool PickboxContains(wxPoint2DDouble position) { return false; }
384  virtual void MovePickbox(wxPoint2DDouble position) {}
389  virtual wxCursor GetBestPickboxCursor() const { return wxCURSOR_ARROW; }
393  virtual void ResetPickboxes() { m_activePickboxID = ID_PB_NONE; }
397  virtual void ResetNodes() { m_activeNodeID = 0; }
405  virtual wxPoint2DDouble WorldToScreen(wxPoint2DDouble translation,
406  double scale,
407  double offsetX = 0.0,
408  double offsetY = 0.0) const;
409 
418  virtual wxPoint2DDouble WorldToScreen(wxPoint2DDouble position,
419  wxPoint2DDouble translation,
420  double scale,
421  double offsetX = 0.0,
422  double offsetY = 0.0) const;
423 
431  virtual bool RotatedRectanglesIntersects(wxRect2DDouble rect1,
432  wxRect2DDouble rect2,
433  double angle1,
434  double angle2) const;
435 
443  virtual void DrawCircle(wxPoint2DDouble position, double radius, int numSegments, GLenum mode = GL_LINE_LOOP) const;
444  virtual void DrawArc(wxPoint2DDouble position,
445  double radius,
446  double initAngle,
447  double finalAngle,
448  int numSegments,
449  GLenum mode = GL_LINE_LOOP) const;
450 
458  virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode = GL_QUADS) const;
459 
465  virtual void DrawRectangle(wxPoint2DDouble* points, GLenum mode = GL_QUADS) const;
466 
472  virtual void DrawTriangle(std::vector<wxPoint2DDouble> points, GLenum mode = GL_TRIANGLES) const;
473 
479  virtual void DrawPoint(wxPoint2DDouble position, double size) const;
480 
486  virtual void DrawLine(std::vector<wxPoint2DDouble> points, GLenum mode = GL_LINE_STRIP) const;
487 
492  virtual void DrawPickbox(wxPoint2DDouble position) const;
493 
500  virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees = true) const;
501 
506  virtual std::vector<Element*> GetParentList() const { return m_parentList; }
511  virtual std::vector<Element*> GetChildList() const { return m_childList; }
512  // virtual wxPoint2DDouble GetMoveStartPosition() const { return m_moveStartPt; }
513  // virtual wxPoint2DDouble GetMovePosition() const { return m_movePos; }
514 
520  virtual void CalculateBoundaries(wxPoint2DDouble& leftUp, wxPoint2DDouble& rightBottom) const;
521 
526  virtual void GeneralMenuItens(wxMenu& menu);
527 
534  virtual bool ShowForm(wxWindow* parent, Element* element) { return false; }
542  static bool DoubleFromString(wxWindow* parent, wxString strValue, double& value, wxString errorMsg);
543 
551  static bool IntFromString(wxWindow* parent, wxString strValue, int& value, wxString errorMsg);
552 
558  static wxString StringFromDouble(double value, int minDecimal = 1);
559 
566  virtual double PointToLineDistance(wxPoint2DDouble point, int* segmentNumber = NULL) const;
567 
568  protected:
569  int m_elementID = 0;
570  std::vector<Element*> m_parentList;
571  std::vector<Element*> m_childList;
572 
573  wxRect2DDouble m_rect;
574  wxPoint2DDouble m_position;
575  double m_width = 0.0;
576  double m_height = 0.0;
577  double m_angle = 0.0;
578  double m_borderSize = 2.0;
579  double m_rotationAngle = 45.0;
580  double m_switchSize = 10.0;
581 
582  std::vector<wxRect2DDouble> m_switchRect;
583 
584  bool m_selected = false;
585  bool m_dragging = false;
586  bool m_showPickbox = false;
587 
588  int m_activePickboxID = ID_PB_NONE;
589  int m_activeNodeID = 0;
590 
591  std::vector<wxPoint2DDouble> m_pointList;
592  std::vector<wxPoint2DDouble> m_movePts;
593 
594  wxPoint2DDouble m_moveStartPt;
595  wxPoint2DDouble m_movePos;
596 
597  bool m_online = true;
598 
599  OpenGLColour m_selectionColour;
600 };
601 
602 #endif // ELEMENT_H
double GetAngle() const
Get the element angle.
Definition: Element.h:212
+
void ShowPickbox(bool showPickbox=true)
Set if the pickbox is shown.
Definition: Element.h:161
+
virtual void AddPoint(wxPoint2DDouble point)
Add point to the list of points that connect the element to the bus.
Definition: Element.h:318
+ +
void SetSelected(bool selected=true)
Set element selection.
Definition: Element.h:146
+
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:506
+
void SetWidth(double width)
Set element width.
Definition: Element.h:151
+
virtual std::vector< Element * > GetChildList() const
Get the Child list.
Definition: Element.h:511
+
virtual void ResetPickboxes()
Remove the pickboxes.
Definition: Element.h:393
+ +
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Element.h:343
+
ContextMenuID
ID of contex menu itens.
Definition: Element.h:51
+
virtual bool PickboxContains(wxPoint2DDouble position)
Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be c...
Definition: Element.h:379
+
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Element.h:347
+
virtual void SetPointList(std::vector< wxPoint2DDouble > pointList)
Set the list of points that connect the element to the bus.
Definition: Element.h:177
+ +
void SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
Set the colour in RGBA. The colour values must be between 0.0 and 1.0.
Definition: Element.cpp:369
+
virtual void MoveNode(Element *parent, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Element.h:337
+ +
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Element.h:240
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Element.h:302
-
bool IsPickboxShown() const
Checks if the pickbox is shown.
Definition: Element.h:213
-
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:219
-
wxRect2DDouble GetRect() const
Get the element rectangle.
Definition: Element.h:165
-
OpenGLColour()
Default construnctor. Use SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)...
Definition: Element.cpp:358
-
void SetAngle(double angle)
Set element angle.
Definition: Element.h:135
-
double GetWidth() const
Get the element width.
Definition: Element.h:195
-
virtual wxString GetTipText() const
Get the tip text.
Definition: Element.h:295
-
virtual ~OpenGLColour()
Destructor.
Definition: Element.h:68
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Element.h:308
- - - -
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Element.h:315
-
double GetHeight() const
Get the element height.
Definition: Element.h:183
-
virtual std::vector< wxPoint2DDouble > GetPointList() const
Get the list of points that connect the element to bus.
Definition: Element.h:225
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Element.h:547
-
virtual void AddParent(Element *parent)
Add a parent to the element.
Definition: Element.h:240
-
virtual void MovePickbox(wxPoint2DDouble position)
Move the pickbox.
Definition: Element.h:395
- - -
virtual wxCursor GetBestPickboxCursor() const
Get the best cursor to shown to the user when the mouse is above a pickbox.
Definition: Element.h:401
-
void SetBorderSize(double borderSize)
Set the size of the border (shown in selected elements).
Definition: Element.h:147
-
PickboxID
ID of the pickbox.
Definition: Element.h:18
-
bool IsSelected() const
Checks if the element is selected.
Definition: Element.h:189
- -
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Element.h:381
- - -
virtual void SetID(int id)
Set the element ID.
Definition: Element.h:264
-
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Element.h:361
-
virtual int GetID() const
Get the element ID.
Definition: Element.h:270
-
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Element.h:367
- -
bool IsDragging() const
Checks if the element is being dragged.
Definition: Element.h:177
-
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:171
-
virtual void ResetNodes()
Remove the active nodes.
Definition: Element.h:411
-
void SetDragging(bool dragging=true)
Set if the element are being dragged.
Definition: Element.h:105
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Element.h:258
-
double GetRotationAngle() const
Get the angle of rotation.
Definition: Element.h:207
-
void SetHeight(double height)
Set element height.
Definition: Element.h:111
- -
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:83
+
bool IsPickboxShown() const
Checks if the pickbox is shown.
Definition: Element.h:222
+
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:227
+
wxRect2DDouble GetRect() const
Get the element rectangle.
Definition: Element.h:182
+
OpenGLColour()
Default construnctor. Use SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)...
Definition: Element.cpp:377
+
void SetAngle(double angle)
Set element angle.
Definition: Element.h:156
+
double GetWidth() const
Get the element width.
Definition: Element.h:207
+
virtual wxString GetTipText() const
Get the tip text.
Definition: Element.h:296
+
virtual ~OpenGLColour()
Destructor.
Definition: Element.h:87
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Element.h:307
+ + + +
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Element.h:313
+
double GetHeight() const
Get the element height.
Definition: Element.h:197
+
virtual std::vector< wxPoint2DDouble > GetPointList() const
Get the list of points that connect the element to bus.
Definition: Element.h:232
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Element.h:534
+
virtual void AddParent(Element *parent)
Add a parent to the element.
Definition: Element.h:245
+
virtual void MovePickbox(wxPoint2DDouble position)
Move the pickbox.
Definition: Element.h:384
+ + +
virtual wxCursor GetBestPickboxCursor() const
Get the best cursor to shown to the user when the mouse is above a pickbox.
Definition: Element.h:389
+
void SetBorderSize(double borderSize)
Set the size of the border (shown in selected elements).
Definition: Element.h:166
+
PickboxID
ID of the pickbox.
Definition: Element.h:37
+
bool IsSelected() const
Checks if the element is selected.
Definition: Element.h:202
+ +
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Element.h:372
+ + +
virtual void SetID(int id)
Set the element ID.
Definition: Element.h:267
+
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Element.h:354
+
virtual int GetID() const
Get the element ID.
Definition: Element.h:272
+
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Element.h:359
+ +
bool IsDragging() const
Checks if the element is being dragged.
Definition: Element.h:192
+
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:187
+
virtual void ResetNodes()
Remove the active nodes.
Definition: Element.h:397
+
void SetDragging(bool dragging=true)
Set if the element are being dragged.
Definition: Element.h:130
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Element.h:262
+
double GetRotationAngle() const
Get the angle of rotation.
Definition: Element.h:217
+
void SetHeight(double height)
Set element height.
Definition: Element.h:135
+ +
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:101
diff --git a/docs/doxygen/html/_element_data_object_8cpp_source.html b/docs/doxygen/html/_element_data_object_8cpp_source.html index 76da35b..6ce0314 100644 --- a/docs/doxygen/html/_element_data_object_8cpp_source.html +++ b/docs/doxygen/html/_element_data_object_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,10 +88,10 @@ $(document).ready(function(){initNavTree('_element_data_object_8cpp_source.html'
ElementDataObject.cpp
-
1 #include "ElementDataObject.h"
2 
3 ElementDataObject::ElementDataObject()
4  : wxDataObjectSimple(wxDataFormat("PSPCopy"))
5 {
6  m_elementsLists = new ElementsLists();
7 }
8 
9 ElementDataObject::ElementDataObject(std::vector<Element*> elementList)
10  : wxDataObjectSimple(wxDataFormat("PSPCopy"))
11 {
12  m_elementsLists = new ElementsLists();
13  if(elementList.size() > 0) {
14  // Separate buses (parents) from the rest of the elements (childs).
15  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
16  Element* copy = (*it)->GetCopy();
17  if(copy) {
18  if(Bus* bus = dynamic_cast<Bus*>(copy))
19  m_elementsLists->parentList.push_back(bus);
20  else
21  m_elementsLists->elementList.push_back(copy);
22  }
23  }
24  }
25 }
26 
27 ElementDataObject::~ElementDataObject() {}
28 size_t ElementDataObject::GetDataSize() const { return sizeof(void*); }
29 bool ElementDataObject::GetDataHere(void* buf) const
30 {
31  *(ElementsLists**)buf = m_elementsLists;
32  return true;
33 }
34 
35 bool ElementDataObject::SetData(size_t len, const void* buf)
36 {
37  m_elementsLists = *(ElementsLists**)buf;
38  return true;
39 }
- -
Definition: Bus.h:45
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Element.h:258
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "ElementDataObject.h"
19 
20 ElementDataObject::ElementDataObject() : wxDataObjectSimple(wxDataFormat("PSPCopy"))
21 {
22  m_elementsLists = new ElementsLists();
23 }
24 
25 ElementDataObject::ElementDataObject(std::vector<Element*> elementList) : wxDataObjectSimple(wxDataFormat("PSPCopy"))
26 {
27  m_elementsLists = new ElementsLists();
28  if(elementList.size() > 0) {
29  // Separate buses (parents) from the rest of the elements (childs).
30  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
31  Element* copy = (*it)->GetCopy();
32  if(copy) {
33  if(Bus* bus = dynamic_cast<Bus*>(copy))
34  m_elementsLists->parentList.push_back(bus);
35  else
36  m_elementsLists->elementList.push_back(copy);
37  }
38  }
39  }
40 }
41 
42 ElementDataObject::~ElementDataObject() {}
43 size_t ElementDataObject::GetDataSize() const { return sizeof(void*); }
44 bool ElementDataObject::GetDataHere(void* buf) const
45 {
46  *(ElementsLists**)buf = m_elementsLists;
47  return true;
48 }
49 
50 bool ElementDataObject::SetData(size_t len, const void* buf)
51 {
52  m_elementsLists = *(ElementsLists**)buf;
53  return true;
54 }
+ +
Definition: Bus.h:62
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Element.h:262
diff --git a/docs/doxygen/html/_element_data_object_8h_source.html b/docs/doxygen/html/_element_data_object_8h_source.html index 677d41a..99ab853 100644 --- a/docs/doxygen/html/_element_data_object_8h_source.html +++ b/docs/doxygen/html/_element_data_object_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,8 +88,9 @@ $(document).ready(function(){initNavTree('_element_data_object_8h_source.html','
ElementDataObject.h
-
1 #ifndef ELEMENTDATAOBJECT_H
2 #define ELEMENTDATAOBJECT_H
3 
4 #include "Workspace.h"
5 #include <wx/dataobj.h>
6 
7 struct ElementsLists {
8  std::vector<Element*> elementList;
9  std::vector<Bus*> parentList;
10 };
11 
12 class ElementDataObject : public wxDataObjectSimple
13 {
14 public:
16  ElementDataObject(std::vector<Element*> elementList);
18 
19  size_t GetDataSize() const override;
20  bool GetDataHere(void* buf) const override;
21  bool SetData(size_t len, const void* buf) override;
22 
23  ElementsLists* GetElementsLists() { return m_elementsLists; }
24 
25 protected:
26  ElementsLists* m_elementsLists = NULL;
27 };
28 
29 #endif // ELEMENTDATAOBJECT_H
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ELEMENTDATAOBJECT_H
19 #define ELEMENTDATAOBJECT_H
20 
21 #include "Workspace.h"
22 #include <wx/dataobj.h>
23 
24 struct ElementsLists {
25  std::vector<Element*> elementList;
26  std::vector<Bus*> parentList;
27 };
28 
29 class ElementDataObject : public wxDataObjectSimple
30 {
31  public:
33  ElementDataObject(std::vector<Element*> elementList);
35 
36  size_t GetDataSize() const override;
37  bool GetDataHere(void* buf) const override;
38  bool SetData(size_t len, const void* buf) override;
39 
40  ElementsLists* GetElementsLists() { return m_elementsLists; }
41  protected:
42  ElementsLists* m_elementsLists = NULL;
43 };
44 
45 #endif // ELEMENTDATAOBJECT_H
+ +
diff --git a/docs/doxygen/html/_element_form_8cpp_source.html b/docs/doxygen/html/_element_form_8cpp_source.html index d0cf593..ca0b601 100644 --- a/docs/doxygen/html/_element_form_8cpp_source.html +++ b/docs/doxygen/html/_element_form_8cpp_source.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/_element_form_8h_source.html b/docs/doxygen/html/_element_form_8h_source.html index 9db4411..a45a598 100644 --- a/docs/doxygen/html/_element_form_8h_source.html +++ b/docs/doxygen/html/_element_form_8h_source.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/_element_form_bitmaps_8cpp_source.html b/docs/doxygen/html/_element_form_bitmaps_8cpp_source.html index 24f54e4..e437032 100644 --- a/docs/doxygen/html/_element_form_bitmaps_8cpp_source.html +++ b/docs/doxygen/html/_element_form_bitmaps_8cpp_source.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/_element_plot_data_8cpp_source.html b/docs/doxygen/html/_element_plot_data_8cpp_source.html index 61ab4b0..2d20c4a 100644 --- a/docs/doxygen/html/_element_plot_data_8cpp_source.html +++ b/docs/doxygen/html/_element_plot_data_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,7 +88,7 @@ $(document).ready(function(){initNavTree('_element_plot_data_8cpp_source.html','
ElementPlotData.cpp
-
1 #include "ElementPlotData.h"
2 
3 ElementPlotData::ElementPlotData(wxString name, CurveType curveType)
4 {
5  m_name = name;
6  m_curveType = curveType;
7 }
8 
9 ElementPlotData::~ElementPlotData() {}
10 void ElementPlotData::AddData(std::vector<double> values, wxString name)
11 {
12  PlotData* data = new PlotData();
13  data->SetName(name);
14  data->SetValues(values);
15  data->SetPlot(false);
16  data->SetAxis(0);
17  data->SetColour(*wxBLACK);
18  data->SetPenType(wxPENSTYLE_SOLID);
19  data->SetThick(2);
20 
21  m_elementData.push_back(data);
22 }
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "ElementPlotData.h"
19 
20 ElementPlotData::ElementPlotData(wxString name, CurveType curveType)
21 {
22  m_name = name;
23  m_curveType = curveType;
24 }
25 
26 ElementPlotData::~ElementPlotData() {}
27 void ElementPlotData::AddData(std::vector<double> values, wxString name)
28 {
29  PlotData* data = new PlotData();
30  data->SetName(name);
31  data->SetValues(values);
32  data->SetPlot(false);
33  data->SetAxis(0);
34  data->SetColour(*wxBLACK);
35  data->SetPenType(wxPENSTYLE_SOLID);
36  data->SetThick(2);
37 
38  m_elementData.push_back(data);
39 }
diff --git a/docs/doxygen/html/_element_plot_data_8h_source.html b/docs/doxygen/html/_element_plot_data_8h_source.html index 90ec59b..2d65d02 100644 --- a/docs/doxygen/html/_element_plot_data_8h_source.html +++ b/docs/doxygen/html/_element_plot_data_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,8 +88,8 @@ $(document).ready(function(){initNavTree('_element_plot_data_8h_source.html','')
ElementPlotData.h
-
1 #ifndef ELEMENTPLOTDATA_H
2 #define ELEMENTPLOTDATA_H
3 
4 #include <wx/treectrl.h>
5 #include <wx/colour.h>
6 #include <wx/pen.h>
7 
8 #include <vector>
9 
10 class PlotData : public wxTreeItemData
11 {
12  public:
13  PlotData() {}
14  ~PlotData() {}
15  void SetAxis(int axis) { m_axis = axis; }
16  void SetColour(const wxColour& colour) { m_colour = colour; }
17  void SetName(const wxString& name) { m_name = name; }
18  void SetPenType(const wxPenStyle& penType) { m_penType = penType; }
19  void SetPlot(bool plot) { m_plot = plot; }
20  void SetThick(int thick) { m_thick = thick; }
21  void SetValues(const std::vector<double>& values) { m_values = values; }
22  int GetAxis() const { return m_axis; }
23  wxColour GetColour() const { return m_colour; }
24  wxString GetName() const { return m_name; }
25  wxPenStyle GetPenType() const { return m_penType; }
26  bool IsPlot() const { return m_plot; }
27  int GetThick() const { return m_thick; }
28  std::vector<double> GetValues() const { return m_values; }
29  protected:
30  std::vector<double> m_values;
31  wxString m_name;
32  bool m_plot;
33  wxColour m_colour;
34  int m_thick;
35  wxPenStyle m_penType;
36  int m_axis;
37 };
38 
40 {
41  public:
42  enum CurveType {
43  CT_BUS = 0,
44  CT_SYNC_GENERATOR,
45  CT_SYNC_COMPENSATOR,
46  CT_TRANSFORMER,
47  CT_LINE,
48  CT_IND_MOTOR,
49  CT_SHUNT_INDUCTOR,
50  CT_SHUNT_CAPACITOR,
51  CT_LOAD,
52  CT_TEST,
53  NUM_ELEMENTS,
54  CT_TIME
55  };
56  ElementPlotData() {};
57  ElementPlotData(wxString name, CurveType curveType);
58  ~ElementPlotData();
59 
60  wxString GetName() const { return m_name; }
61  void SetName(wxString name) { m_name = name; }
62  CurveType GetCurveType() const { return m_curveType; }
63  void SetCurveType(CurveType type) { m_curveType = type; }
64  PlotData* GetPlotData(int index) const { return m_elementData[index]; }
65  void AddData(std::vector<double> values, wxString name);
66 
67  int GetElementDataNumber() const { return static_cast<int>(m_elementData.size()); }
68  std::vector<double> GetValues(int index) const { return m_elementData[index]->GetValues(); }
69  void SetValues(int index, std::vector<double> values) { m_elementData[index]->SetValues(values); }
70  void SetPlot(int index, bool plot = true) { m_elementData[index]->SetPlot(plot); }
71  wxString GetDataName(int index) const { return m_elementData[index]->GetName(); }
72  void SetDataName(int index, wxString name) { m_elementData[index]->SetName(name); }
73  wxColour GetColour(int index) const { return m_elementData[index]->GetColour(); }
74  void SetColour(int index, wxColour colour) { m_elementData[index]->SetColour(colour); }
75  int GetThick(int index) const { return m_elementData[index]->GetThick(); }
76  void SetThick(int index, int thick) { m_elementData[index]->SetThick(thick); }
77  wxPenStyle GetPenType(int index) const { return m_elementData[index]->GetPenType(); }
78  void SetPenType(int index, wxPenStyle penType) { m_elementData[index]->SetPenType(penType); }
79  int GetAxis(int index) const { return m_elementData[index]->GetAxis(); }
80  void SetAxis(int index, int axis) { m_elementData[index]->SetAxis(axis); }
81  protected:
82  wxString m_name;
83  CurveType m_curveType;
84  std::vector<PlotData*> m_elementData;
85 };
86 
87 #endif // ELEMENTPLOTDATA_H
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ELEMENTPLOTDATA_H
19 #define ELEMENTPLOTDATA_H
20 
21 #include <wx/treectrl.h>
22 #include <wx/colour.h>
23 #include <wx/pen.h>
24 
25 #include <vector>
26 
27 class PlotData : public wxTreeItemData
28 {
29  public:
30  PlotData() {}
31  ~PlotData() {}
32  void SetAxis(int axis) { m_axis = axis; }
33  void SetColour(const wxColour& colour) { m_colour = colour; }
34  void SetName(const wxString& name) { m_name = name; }
35  void SetPenType(const wxPenStyle& penType) { m_penType = penType; }
36  void SetPlot(bool plot) { m_plot = plot; }
37  void SetThick(int thick) { m_thick = thick; }
38  void SetValues(const std::vector<double>& values) { m_values = values; }
39  int GetAxis() const { return m_axis; }
40  wxColour GetColour() const { return m_colour; }
41  wxString GetName() const { return m_name; }
42  wxPenStyle GetPenType() const { return m_penType; }
43  bool IsPlot() const { return m_plot; }
44  int GetThick() const { return m_thick; }
45  std::vector<double> GetValues() const { return m_values; }
46  protected:
47  std::vector<double> m_values;
48  wxString m_name;
49  bool m_plot;
50  wxColour m_colour;
51  int m_thick;
52  wxPenStyle m_penType;
53  int m_axis;
54 };
55 
57 {
58  public:
59  enum CurveType {
60  CT_BUS = 0,
61  CT_SYNC_GENERATOR,
62  CT_SYNC_COMPENSATOR,
63  CT_TRANSFORMER,
64  CT_LINE,
65  CT_IND_MOTOR,
66  CT_SHUNT_INDUCTOR,
67  CT_SHUNT_CAPACITOR,
68  CT_LOAD,
69  CT_TEST,
70  NUM_ELEMENTS,
71  CT_TIME
72  };
73  ElementPlotData(){};
74  ElementPlotData(wxString name, CurveType curveType);
75  ~ElementPlotData();
76 
77  wxString GetName() const { return m_name; }
78  void SetName(wxString name) { m_name = name; }
79  CurveType GetCurveType() const { return m_curveType; }
80  void SetCurveType(CurveType type) { m_curveType = type; }
81  PlotData* GetPlotData(int index) const { return m_elementData[index]; }
82  void AddData(std::vector<double> values, wxString name);
83 
84  int GetElementDataNumber() const { return static_cast<int>(m_elementData.size()); }
85  std::vector<double> GetValues(int index) const { return m_elementData[index]->GetValues(); }
86  void SetValues(int index, std::vector<double> values) { m_elementData[index]->SetValues(values); }
87  void SetPlot(int index, bool plot = true) { m_elementData[index]->SetPlot(plot); }
88  wxString GetDataName(int index) const { return m_elementData[index]->GetName(); }
89  void SetDataName(int index, wxString name) { m_elementData[index]->SetName(name); }
90  wxColour GetColour(int index) const { return m_elementData[index]->GetColour(); }
91  void SetColour(int index, wxColour colour) { m_elementData[index]->SetColour(colour); }
92  int GetThick(int index) const { return m_elementData[index]->GetThick(); }
93  void SetThick(int index, int thick) { m_elementData[index]->SetThick(thick); }
94  wxPenStyle GetPenType(int index) const { return m_elementData[index]->GetPenType(); }
95  void SetPenType(int index, wxPenStyle penType) { m_elementData[index]->SetPenType(penType); }
96  int GetAxis(int index) const { return m_elementData[index]->GetAxis(); }
97  void SetAxis(int index, int axis) { m_elementData[index]->SetAxis(axis); }
98  protected:
99  wxString m_name;
100  CurveType m_curveType;
101  std::vector<PlotData*> m_elementData;
102 };
103 
104 #endif // ELEMENTPLOTDATA_H
+
diff --git a/docs/doxygen/html/_exponential_8cpp_source.html b/docs/doxygen/html/_exponential_8cpp_source.html index e064fa3..78ab458 100644 --- a/docs/doxygen/html/_exponential_8cpp_source.html +++ b/docs/doxygen/html/_exponential_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,17 @@ $(document).ready(function(){initNavTree('_exponential_8cpp_source.html','');});
Exponential.cpp
-
1 #include "Exponential.h"
2 #include "ExponentialForm.h"
3 
4 Exponential::Exponential(int id) : ControlElement(id)
5 {
6  m_width = m_height = 36.0;
7  Node* nodeIn = new Node(m_position + wxPoint2DDouble(-18, 0), Node::NODE_IN, m_borderSize);
8  nodeIn->StartMove(m_position);
9  Node* nodeOut = new Node(m_position + wxPoint2DDouble(18, 0), Node::NODE_OUT, m_borderSize);
10  nodeOut->SetAngle(180.0);
11  nodeOut->StartMove(m_position);
12  m_nodeList.push_back(nodeIn);
13  m_nodeList.push_back(nodeOut);
14 }
15 
16 Exponential::~Exponential() {}
17 void Exponential::Draw(wxPoint2DDouble translation, double scale) const
18 {
19  glLineWidth(1.0);
20  if(m_selected) {
21  glColor4dv(m_selectionColour.GetRGBA());
22  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
23  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
24  }
25  glColor4d(1.0, 1.0, 1.0, 1.0);
26  DrawRectangle(m_position, m_width, m_height);
27  glColor4d(0.0, 0.0, 0.0, 1.0);
28  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
29 
30  // Plot symbol.
31  std::vector<wxPoint2DDouble> axis;
32  axis.push_back(m_position + wxPoint2DDouble(-13, 13));
33  axis.push_back(m_position + wxPoint2DDouble(13, 13));
34  axis.push_back(m_position + wxPoint2DDouble(-13, -13));
35  axis.push_back(m_position + wxPoint2DDouble(-13, 13));
36  DrawLine(axis, GL_LINES);
37 
38  glLineWidth(2.0);
39  std::vector<wxPoint2DDouble> expSymbol;
40  expSymbol.push_back(m_position + wxPoint2DDouble(-13, 13));
41  expSymbol.push_back(m_position + wxPoint2DDouble(-6, 13));
42  expSymbol.push_back(m_position + wxPoint2DDouble(2, 12));
43  expSymbol.push_back(m_position + wxPoint2DDouble(4, 11));
44  expSymbol.push_back(m_position + wxPoint2DDouble(6, 10));
45  expSymbol.push_back(m_position + wxPoint2DDouble(8, 7));
46  expSymbol.push_back(m_position + wxPoint2DDouble(11, -1));
47  expSymbol.push_back(m_position + wxPoint2DDouble(12, -7));
48  expSymbol.push_back(m_position + wxPoint2DDouble(13, -13));
49  glColor4d(0.0, 0.3, 1.0, 1.0);
50  DrawLine(expSymbol);
51 
52  glColor4d(0.0, 0.0, 0.0, 1.0);
53  DrawNodes();
54 }
55 
56 bool Exponential::ShowForm(wxWindow* parent, Element* element)
57 {
58  ExponentialForm* form = new ExponentialForm(parent, this);
59  if(form->ShowModal() == wxID_OK) {
60  form->Destroy();
61  return true;
62  }
63  form->Destroy();
64  return false;
65 }
66 
67 void Exponential::Rotate(bool clockwise)
68 {
69  if(clockwise)
70  m_angle += 90.0;
71  else
72  m_angle -= 90.0;
73  if(m_angle >= 360.0)
74  m_angle = 0.0;
75  else if(m_angle < 0)
76  m_angle = 270.0;
77 
78  UpdatePoints();
79 
80  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
81  Node* node = *it;
82  node->Rotate(clockwise);
83  }
84 }
85 
86 void Exponential::UpdatePoints()
87 {
88  if(m_angle == 0.0) {
89  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
90  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(18, 0));
91  } else if(m_angle == 90.0) {
92  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -18));
93  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, 18));
94  } else if(m_angle == 180.0) {
95  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(18, 0));
96  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
97  } else if(m_angle == 270.0) {
98  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, 18));
99  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -18));
100  }
101 }
102 
103 void Exponential::GetValues(double& aValue, double& bValue)
104 {
105  aValue = m_aValue;
106  bValue = m_bValue;
107 }
108 
109 void Exponential::SetValues(double aValue, double bValue)
110 {
111  m_aValue = aValue;
112  m_bValue = bValue;
113 }
114 
115 bool Exponential::Solve(double input, double timeStep)
116 {
117  m_output = m_aValue * std::exp(m_bValue * input);
118  return true;
119 }
120 
122 {
123  Exponential* copy = new Exponential(m_elementID);
124  *copy = *this;
125  return copy;
126 }
- -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Exponential.cpp:67
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Exponential.cpp:56
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Exponential.cpp:17
-
virtual Element * GetCopy()
Get a the element copy.
- - - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Exponential.h"
19 #include "ExponentialForm.h"
20 
21 Exponential::Exponential(int id) : ControlElement(id)
22 {
23  m_width = m_height = 36.0;
24  Node* nodeIn = new Node(m_position + wxPoint2DDouble(-18, 0), Node::NODE_IN, m_borderSize);
25  nodeIn->StartMove(m_position);
26  Node* nodeOut = new Node(m_position + wxPoint2DDouble(18, 0), Node::NODE_OUT, m_borderSize);
27  nodeOut->SetAngle(180.0);
28  nodeOut->StartMove(m_position);
29  m_nodeList.push_back(nodeIn);
30  m_nodeList.push_back(nodeOut);
31 }
32 
33 Exponential::~Exponential() {}
34 void Exponential::Draw(wxPoint2DDouble translation, double scale) const
35 {
36  glLineWidth(1.0);
37  if(m_selected) {
38  glColor4dv(m_selectionColour.GetRGBA());
39  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
40  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
41  }
42  glColor4d(1.0, 1.0, 1.0, 1.0);
43  DrawRectangle(m_position, m_width, m_height);
44  glColor4d(0.0, 0.0, 0.0, 1.0);
45  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
46 
47  // Plot symbol.
48  std::vector<wxPoint2DDouble> axis;
49  axis.push_back(m_position + wxPoint2DDouble(-13, 13));
50  axis.push_back(m_position + wxPoint2DDouble(13, 13));
51  axis.push_back(m_position + wxPoint2DDouble(-13, -13));
52  axis.push_back(m_position + wxPoint2DDouble(-13, 13));
53  DrawLine(axis, GL_LINES);
54 
55  glLineWidth(2.0);
56  std::vector<wxPoint2DDouble> expSymbol;
57  expSymbol.push_back(m_position + wxPoint2DDouble(-13, 13));
58  expSymbol.push_back(m_position + wxPoint2DDouble(-6, 13));
59  expSymbol.push_back(m_position + wxPoint2DDouble(2, 12));
60  expSymbol.push_back(m_position + wxPoint2DDouble(4, 11));
61  expSymbol.push_back(m_position + wxPoint2DDouble(6, 10));
62  expSymbol.push_back(m_position + wxPoint2DDouble(8, 7));
63  expSymbol.push_back(m_position + wxPoint2DDouble(11, -1));
64  expSymbol.push_back(m_position + wxPoint2DDouble(12, -7));
65  expSymbol.push_back(m_position + wxPoint2DDouble(13, -13));
66  glColor4d(0.0, 0.3, 1.0, 1.0);
67  DrawLine(expSymbol);
68 
69  glColor4d(0.0, 0.0, 0.0, 1.0);
70  DrawNodes();
71 }
72 
73 bool Exponential::ShowForm(wxWindow* parent, Element* element)
74 {
75  ExponentialForm* form = new ExponentialForm(parent, this);
76  if(form->ShowModal() == wxID_OK) {
77  form->Destroy();
78  return true;
79  }
80  form->Destroy();
81  return false;
82 }
83 
84 void Exponential::Rotate(bool clockwise)
85 {
86  if(clockwise)
87  m_angle += 90.0;
88  else
89  m_angle -= 90.0;
90  if(m_angle >= 360.0)
91  m_angle = 0.0;
92  else if(m_angle < 0)
93  m_angle = 270.0;
94 
95  UpdatePoints();
96 
97  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
98  Node* node = *it;
99  node->Rotate(clockwise);
100  }
101 }
102 
103 void Exponential::UpdatePoints()
104 {
105  if(m_angle == 0.0) {
106  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
107  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(18, 0));
108  } else if(m_angle == 90.0) {
109  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -18));
110  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, 18));
111  } else if(m_angle == 180.0) {
112  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(18, 0));
113  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
114  } else if(m_angle == 270.0) {
115  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, 18));
116  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -18));
117  }
118 }
119 
120 void Exponential::GetValues(double& aValue, double& bValue)
121 {
122  aValue = m_aValue;
123  bValue = m_bValue;
124 }
125 
126 void Exponential::SetValues(double aValue, double bValue)
127 {
128  m_aValue = aValue;
129  m_bValue = bValue;
130 }
131 
132 bool Exponential::Solve(double input, double timeStep)
133 {
134  m_output = m_aValue * std::exp(m_bValue * input);
135  return true;
136 }
137 
139 {
140  Exponential* copy = new Exponential(m_elementID);
141  *copy = *this;
142  return copy;
143 }
+
Node of a control element. This class manages the user interaction with the connection and control el...
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Exponential.cpp:84
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Exponential.cpp:73
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Exponential.cpp:34
+
virtual Element * GetCopy()
Get a the element copy.
+
Generates an output following an exponential function. .
Definition: Exponential.h:33
+
Form to edit the exponential control data.
+ + +
diff --git a/docs/doxygen/html/_exponential_8h.html b/docs/doxygen/html/_exponential_8h.html new file mode 100644 index 0000000..9973de9 --- /dev/null +++ b/docs/doxygen/html/_exponential_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/Exponential.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
Exponential.h File Reference
+
+
+
#include "ControlElement.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  Exponential
 Generates an output following an exponential function. \( output = A\cdot e^{B\cdot input} \). More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_exponential_8h_source.html b/docs/doxygen/html/_exponential_8h_source.html index 6ecb51b..67cb366 100644 --- a/docs/doxygen/html/_exponential_8h_source.html +++ b/docs/doxygen/html/_exponential_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,22 +88,23 @@ $(document).ready(function(){initNavTree('_exponential_8h_source.html','');});
Exponential.h
-
1 #ifndef EXPONENTIAL_H
2 #define EXPONENTIAL_H
3 
4 #include "ControlElement.h"
5 
6 class ExponentialForm;
7 
8 class Exponential : public ControlElement
9 {
10 public:
11  Exponential(int id);
12  ~Exponential();
13 
14  virtual void Draw(wxPoint2DDouble translation, double scale) const;
15  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
16  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
17  virtual bool ShowForm(wxWindow* parent, Element* element);
18  virtual void Rotate(bool clockwise = true);
19 
20  virtual void UpdatePoints();
21 
22  virtual void GetValues(double& aValue, double &bValue);
23  virtual void SetValues(double aValue, double bValue);
24 
25  virtual bool Solve(double input, double timeStep);
26 
27  virtual Element* GetCopy();
28 
29 protected:
30  double m_aValue = 0.001;
31  double m_bValue = 5.0;
32 
33 };
34 
35 #endif // EXPONENTIAL_H
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Exponential.h:15
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Exponential.cpp:67
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Exponential.cpp:56
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Exponential.cpp:17
-
virtual Element * GetCopy()
Get a the element copy.
- - -
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Exponential.h:16
- +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef EXPONENTIAL_H
19 #define EXPONENTIAL_H
20 
21 #include "ControlElement.h"
22 
23 class ExponentialForm;
24 
34 {
35  public:
36  Exponential(int id);
37  ~Exponential();
38 
39  virtual void Draw(wxPoint2DDouble translation, double scale) const;
40  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
41  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
42  virtual bool ShowForm(wxWindow* parent, Element* element);
43  virtual void Rotate(bool clockwise = true);
44 
45  virtual void UpdatePoints();
46 
47  virtual void GetValues(double& aValue, double& bValue);
48  virtual void SetValues(double aValue, double bValue);
49 
50  virtual bool Solve(double input, double timeStep);
51 
52  virtual Element* GetCopy();
53 
54  protected:
55  double m_aValue = 0.001;
56  double m_bValue = 5.0;
57 };
58 
59 #endif // EXPONENTIAL_H
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Exponential.h:40
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Exponential.cpp:84
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Exponential.cpp:73
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Exponential.cpp:34
+
virtual Element * GetCopy()
Get a the element copy.
+
Generates an output following an exponential function. .
Definition: Exponential.h:33
+
Form to edit the exponential control data.
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Exponential.h:41
+
Base class of a control element. Provide general methods to other control classes.
+
-
1 #include "ExponentialForm.h"
2 #include "Exponential.h"
3 
4 ExponentialForm::ExponentialForm(wxWindow* parent, Exponential* exponential) : ExponentialFormBase(parent)
5 {
6  SetSize(GetBestSize());
7 
8  wxString expSymbol = wxString::FromUTF8("\xF0\x9D\x91\x92");
9  wxString superscriptCapitalB = wxString::FromUTF8("\xE1\xB4\xAE");
10  wxString superscriptSmallX = wxString::FromUTF8("\xCB\xA3");
11  m_staticTextExp->SetLabel("y = A" + expSymbol + superscriptCapitalB + superscriptSmallX);
12 
13  wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
14  font.SetPointSize(14);
15  m_staticTextExp->SetFont(font);
16 
17  m_parent = parent;
18  m_exponential = exponential;
19 
20  double a, b;
21  m_exponential->GetValues(a, b);
22  m_textCtrlAValue->SetValue(m_exponential->StringFromDouble(a));
23  m_textCtrlBValue->SetValue(m_exponential->StringFromDouble(b));
24 
25  SetInitialSize();
26  Layout();
27 }
28 
29 ExponentialForm::~ExponentialForm() {}
30 void ExponentialForm::OnOKButtonClick(wxCommandEvent& event)
31 {
32  if(ValidateData()) EndModal(wxID_OK);
33 }
34 
35 bool ExponentialForm::ValidateData()
36 {
37  double a, b;
38  if(!m_exponential->DoubleFromString(this, m_textCtrlAValue->GetValue(), a,
39  _("Value entered incorrectly in the field \"A value\".")))
40  return false;
41  if(!m_exponential->DoubleFromString(this, m_textCtrlBValue->GetValue(), b,
42  _("Value entered incorrectly in the field \"B value\".")))
43  return false;
44  m_exponential->SetValues(a, b);
45  return true;
46 }
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "ExponentialForm.h"
19 #include "Exponential.h"
20 
21 ExponentialForm::ExponentialForm(wxWindow* parent, Exponential* exponential) : ExponentialFormBase(parent)
22 {
23  SetSize(GetBestSize());
24 
25  wxString expSymbol = wxString::FromUTF8("\xF0\x9D\x91\x92");
26  wxString superscriptCapitalB = wxString::FromUTF8("\xE1\xB4\xAE");
27  wxString superscriptSmallX = wxString::FromUTF8("\xCB\xA3");
28  m_staticTextExp->SetLabel("y = A" + expSymbol + superscriptCapitalB + superscriptSmallX);
29 
30  wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
31  font.SetPointSize(14);
32  m_staticTextExp->SetFont(font);
33 
34  m_parent = parent;
35  m_exponential = exponential;
36 
37  double a, b;
38  m_exponential->GetValues(a, b);
39  m_textCtrlAValue->SetValue(m_exponential->StringFromDouble(a));
40  m_textCtrlBValue->SetValue(m_exponential->StringFromDouble(b));
41 
42  SetInitialSize();
43  Layout();
44 }
45 
46 ExponentialForm::~ExponentialForm() {}
47 void ExponentialForm::OnOKButtonClick(wxCommandEvent& event)
48 {
49  if(ValidateData()) EndModal(wxID_OK);
50 }
51 
52 bool ExponentialForm::ValidateData()
53 {
54  double a, b;
55  if(!m_exponential->DoubleFromString(this, m_textCtrlAValue->GetValue(), a,
56  _("Value entered incorrectly in the field \"A value\".")))
57  return false;
58  if(!m_exponential->DoubleFromString(this, m_textCtrlBValue->GetValue(), b,
59  _("Value entered incorrectly in the field \"B value\".")))
60  return false;
61  m_exponential->SetValues(a, b);
62  return true;
63 }
+
Generates an output following an exponential function. .
Definition: Exponential.h:33
+ +
diff --git a/docs/doxygen/html/_exponential_form_8h.html b/docs/doxygen/html/_exponential_form_8h.html new file mode 100644 index 0000000..027fe13 --- /dev/null +++ b/docs/doxygen/html/_exponential_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/ExponentialForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
ExponentialForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  ExponentialForm
 Form to edit the exponential control data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_exponential_form_8h_source.html b/docs/doxygen/html/_exponential_form_8h_source.html index a9c26c4..e042b3f 100644 --- a/docs/doxygen/html/_exponential_form_8h_source.html +++ b/docs/doxygen/html/_exponential_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_exponential_form_8h_source.html','');
ExponentialForm.h
-
1 #ifndef EXPONENTIALFORM_H
2 #define EXPONENTIALFORM_H
3 #include "ElementForm.h"
4 
5 class Exponential;
6 
8 {
9  public:
10  ExponentialForm(wxWindow* parent, Exponential* exponential);
11  virtual ~ExponentialForm();
12  virtual bool ValidateData();
13 
14  protected:
15  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
16  virtual void OnOKButtonClick(wxCommandEvent& event);
17 
18  wxWindow* m_parent = NULL;
19  Exponential* m_exponential = NULL;
20 };
21 #endif // EXPONENTIALFORM_H
- - +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef EXPONENTIALFORM_H
19 #define EXPONENTIALFORM_H
20 #include "ElementForm.h"
21 
22 class Exponential;
23 
32 {
33  public:
34  ExponentialForm(wxWindow* parent, Exponential* exponential);
35  virtual ~ExponentialForm();
36  virtual bool ValidateData();
37 
38  protected:
39  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
40  virtual void OnOKButtonClick(wxCommandEvent& event);
41 
42  wxWindow* m_parent = NULL;
43  Exponential* m_exponential = NULL;
44 };
45 #endif // EXPONENTIALFORM_H
+
Generates an output following an exponential function. .
Definition: Exponential.h:33
+
Form to edit the exponential control data.
-
1 #include "Fault.h"
2 #ifdef USING_WX_3_0_X
3 #include "DegreesAndRadians.h"
4 #endif
5 
7 Fault::Fault(std::vector<Element*> elementList) { GetElementsFromList(elementList); }
9 bool Fault::RunFaultCalculation(double systemPowerBase)
10 {
11  m_systemPowerBase = systemPowerBase;
12  int numberOfBuses = static_cast<int>(m_busList.size());
13  if(numberOfBuses == 0) {
14  m_errorMsg = _("There is no buses in the system.");
15  return false;
16  }
17 
18  // Get adimittance matrices.
19  std::vector<std::vector<std::complex<double> > > yBusPos;
20  GetYBus(yBusPos, systemPowerBase, POSITIVE_SEQ, true);
21  std::vector<std::vector<std::complex<double> > > yBusNeg;
22  GetYBus(yBusNeg, systemPowerBase, NEGATIVE_SEQ, true);
23  std::vector<std::vector<std::complex<double> > > yBusZero;
24  GetYBus(yBusZero, systemPowerBase, ZERO_SEQ, true);
25 
26  // Calculate the impedance matrices.
27  if(!InvertMatrix(yBusPos, m_zBusPos)) {
28  m_errorMsg = _("Fail to invert the positive sequence admittance matrix.");
29  return false;
30  }
31  if(!InvertMatrix(yBusNeg, m_zBusNeg)) {
32  m_errorMsg = _("Fail to invert the negative sequence admittance matrix.");
33  return false;
34  }
35  if(!InvertMatrix(yBusZero, m_zBusZero)) {
36  m_errorMsg = _("Fail to invert the zero sequence admittance matrix.");
37  return false;
38  }
39 
40  // Pre-fault voltages (power flow solution).
41  std::vector<std::complex<double> > preFaultVoltages;
42  preFaultVoltages.resize(m_busList.size());
43 
44  // Get fault parameters.
45  int fNumber = -1;
47  FaultData fLocation = FAULT_LINE_A;
48  std::complex<double> fImpedance = std::complex<double>(0.0, 0.0);
49  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
50  Bus* bus = *it;
51  BusElectricalData data = bus->GetElectricalData();
52  preFaultVoltages[data.number] = data.voltage;
53  if(data.hasFault) {
54  fNumber = data.number;
55  fType = data.faultType;
56  fLocation = data.faultLocation;
57  fImpedance = std::complex<double>(data.faultResistance, data.faultReactance);
58  }
59  }
60 
61  if(fNumber == -1) {
62  m_errorMsg = _("There is no fault in the system.");
63  return false;
64  }
65 
66  // Fault calculation.
67  std::complex<double> fCurrentPos = std::complex<double>(0.0, 0.0);
68  std::complex<double> fCurrentNeg = std::complex<double>(0.0, 0.0);
69  std::complex<double> fCurrentZero = std::complex<double>(0.0, 0.0);
70 
71  std::complex<double> preFaultVoltage = preFaultVoltages[fNumber];
72  std::complex<double> a = std::complex<double>(-0.5, 0.866025403784);
73  std::complex<double> a2 = std::complex<double>(-0.5, -0.866025403784);
74 
75  switch(fType) {
76  case FAULT_THREEPHASE: {
77  fCurrentPos = preFaultVoltage / (m_zBusPos[fNumber][fNumber] + fImpedance);
78  } break;
79  case FAULT_2LINE: {
80  fCurrentPos = preFaultVoltage / (m_zBusPos[fNumber][fNumber] + m_zBusNeg[fNumber][fNumber] + fImpedance);
81 
82  switch(fLocation) {
83  case FAULT_LINE_A: {
84  fCurrentNeg = -a2 * fCurrentPos;
85  } break;
86  case FAULT_LINE_B: {
87  fCurrentNeg = -fCurrentPos;
88  } break;
89  case FAULT_LINE_C: {
90  fCurrentNeg = -a * fCurrentPos;
91  } break;
92  default:
93  break;
94  }
95  } break;
96  case FAULT_2LINE_GROUND: {
97  std::complex<double> z1 = m_zBusPos[fNumber][fNumber];
98  std::complex<double> z2 = m_zBusNeg[fNumber][fNumber];
99  std::complex<double> z0 = m_zBusZero[fNumber][fNumber];
100  std::complex<double> zf_3 = std::complex<double>(3.0, 0.0) * fImpedance;
101 
102  fCurrentPos = (preFaultVoltage * (z2 + z0 + zf_3)) / (z1 * z2 + z2 * z0 + z2 * zf_3 + z1 * z0 + z1 * zf_3);
103 
104  switch(fLocation) {
105  case FAULT_LINE_A: {
106  fCurrentNeg = -a2 * ((preFaultVoltage - z1 * fCurrentPos) / z2);
107  fCurrentZero = -a * ((preFaultVoltage - z1 * fCurrentPos) / (z0 + zf_3));
108  } break;
109  case FAULT_LINE_B: {
110  fCurrentNeg = -((preFaultVoltage - z1 * fCurrentPos) / z2);
111  fCurrentZero = -((preFaultVoltage - z1 * fCurrentPos) / (z0 + zf_3));
112  } break;
113  case FAULT_LINE_C: {
114  fCurrentNeg = -a * ((preFaultVoltage - z1 * fCurrentPos) / z2);
115  fCurrentZero = -a2 * ((preFaultVoltage - z1 * fCurrentPos) / (z0 + zf_3));
116  } break;
117  default:
118  break;
119  }
120  } break;
121  case FAULT_LINE_GROUND: {
122  fCurrentPos =
123  preFaultVoltage / (m_zBusPos[fNumber][fNumber] + m_zBusNeg[fNumber][fNumber] +
124  m_zBusZero[fNumber][fNumber] + std::complex<double>(3.0, 0.0) * fImpedance);
125  switch(fLocation) {
126  case FAULT_LINE_A: {
127  fCurrentNeg = fCurrentPos;
128  fCurrentZero = fCurrentPos;
129  } break;
130  case FAULT_LINE_B: {
131  fCurrentNeg = a * fCurrentPos;
132  fCurrentZero = a2 * fCurrentPos;
133  } break;
134  case FAULT_LINE_C: {
135  fCurrentNeg = a2 * fCurrentPos;
136  fCurrentZero = a * fCurrentPos;
137  } break;
138  default:
139  break;
140  }
141  } break;
142  default:
143  break;
144  }
145 
146  // Convert sequence currents to ABC. [Iabc] = [A]*[I012]
147  m_fCurrentA = fCurrentZero + fCurrentPos + fCurrentNeg;
148  m_fCurrentB = fCurrentZero + a2 * fCurrentPos + a * fCurrentNeg;
149  m_fCurrentC = fCurrentZero + a * fCurrentPos + a2 * fCurrentNeg;
150 
151  // Pos-fault voltages calculation
152  m_posFaultVoltagePos.clear();
153  m_posFaultVoltageNeg.clear();
154  m_posFaultVoltageZero.clear();
155  m_posFaultVoltageA.clear();
156  m_posFaultVoltageB.clear();
157  m_posFaultVoltageC.clear();
158 
159  for(int i = 0; i < numberOfBuses; ++i) {
160  m_posFaultVoltagePos.push_back(preFaultVoltages[i] - m_zBusPos[i][fNumber] * fCurrentPos);
161  m_posFaultVoltageNeg.push_back(-m_zBusNeg[i][fNumber] * fCurrentNeg);
162  m_posFaultVoltageZero.push_back(-m_zBusZero[i][fNumber] * fCurrentZero);
163 
164  // V012 -> Vabc
165  m_posFaultVoltageA.push_back(m_posFaultVoltageZero[i] + m_posFaultVoltagePos[i] + m_posFaultVoltageNeg[i]);
166  m_posFaultVoltageB.push_back(m_posFaultVoltageZero[i] + a2 * m_posFaultVoltagePos[i] +
167  a * m_posFaultVoltageNeg[i]);
168  m_posFaultVoltageC.push_back(m_posFaultVoltageZero[i] + a * m_posFaultVoltagePos[i] +
169  a2 * m_posFaultVoltageNeg[i]);
170  }
171 
172  UpdateElementsFault(systemPowerBase);
173  return true;
174 }
175 
176 void Fault::UpdateElementsFault(double systemPowerBase)
177 {
178  std::complex<double> a = std::complex<double>(-0.5, 0.866025403784);
179  std::complex<double> a2 = std::complex<double>(-0.5, -0.866025403784);
180 
181  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
182  Bus* bus = *it;
183  auto data = bus->GetElectricalData();
184  if(data.hasFault) {
185  data.faultCurrent[0] = m_fCurrentA;
186  data.faultCurrent[1] = m_fCurrentB;
187  data.faultCurrent[2] = m_fCurrentC;
188  } else {
189  data.faultCurrent[0] = data.faultCurrent[1] = data.faultCurrent[2] = std::complex<double>(0.0, 0.0);
190  }
191  data.faultVoltage[0] = m_posFaultVoltageA[data.number];
192  data.faultVoltage[1] = m_posFaultVoltageB[data.number];
193  data.faultVoltage[2] = m_posFaultVoltageC[data.number];
194  bus->SetElectricalData(data);
195  }
196 
197  for(auto it = m_lineList.begin(), itEnd = m_lineList.end(); it != itEnd; ++it) {
198  Line* line = *it;
199  if(line->IsOnline()) {
200  int n1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().number;
201  int n2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().number;
202  auto data = line->GetElectricalData();
203  auto puData = line->GetPUElectricalData(m_systemPowerBase);
204  std::complex<double> vPos[2] = {m_posFaultVoltagePos[n1], m_posFaultVoltagePos[n2]};
205  std::complex<double> vNeg[2] = {m_posFaultVoltageNeg[n1], m_posFaultVoltageNeg[n2]};
206  std::complex<double> vZero[2] = {m_posFaultVoltageZero[n1], m_posFaultVoltageZero[n2]};
207  std::complex<double> zPos(puData.resistance, puData.indReactance);
208  std::complex<double> bPos(0.0, puData.capSusceptance / 2.0);
209  std::complex<double> zZero(puData.zeroResistance, puData.zeroIndReactance);
210  std::complex<double> bZero(0.0, puData.zeroCapSusceptance / 2.0);
211 
212  std::complex<double> lineCurrentPos[2];
213  std::complex<double> lineCurrentNeg[2];
214  std::complex<double> lineCurrentZero[2];
215 
216  lineCurrentPos[0] = ((vPos[0] - vPos[1]) / zPos) + (vPos[0] * bPos);
217  lineCurrentNeg[0] = ((vNeg[0] - vNeg[1]) / zPos) + (vNeg[0] * bPos);
218  lineCurrentZero[0] = ((vZero[0] - vZero[1]) / zZero) + (vZero[0] * bZero);
219  lineCurrentPos[1] = ((vPos[1] - vPos[0]) / zPos) + (vPos[1] * bPos);
220  lineCurrentNeg[1] = ((vNeg[1] - vNeg[0]) / zPos) + (vNeg[1] * bPos);
221  lineCurrentZero[1] = ((vZero[1] - vZero[0]) / zZero) + (vZero[1] * bZero);
222 
223  data.faultCurrent[0][0] = lineCurrentZero[0] + lineCurrentPos[0] + lineCurrentNeg[0];
224  data.faultCurrent[0][1] = lineCurrentZero[0] + a2 * lineCurrentPos[0] + a * lineCurrentNeg[0];
225  data.faultCurrent[0][2] = lineCurrentZero[0] + a * lineCurrentPos[0] + a2 * lineCurrentNeg[0];
226  data.faultCurrent[1][0] = lineCurrentZero[1] + lineCurrentPos[1] + lineCurrentNeg[1];
227  data.faultCurrent[1][1] = lineCurrentZero[1] + a2 * lineCurrentPos[1] + a * lineCurrentNeg[1];
228  data.faultCurrent[1][2] = lineCurrentZero[1] + a * lineCurrentPos[1] + a2 * lineCurrentNeg[1];
229 
230  line->SetElectricalData(data);
231  }
232  }
233 
234  for(auto it = m_transformerList.begin(), itEnd = m_transformerList.end(); it != itEnd; ++it) {
235  Transformer* transformer = *it;
236  if(transformer->IsOnline()) {
237  int n1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().number;
238  int n2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().number;
239  auto data = transformer->GetElectricalData();
240  auto puData = transformer->GetPUElectricalData(m_systemPowerBase);
241 
242  std::complex<double> vPos[2] = {m_posFaultVoltagePos[n1], m_posFaultVoltagePos[n2]};
243  std::complex<double> vNeg[2] = {m_posFaultVoltageNeg[n1], m_posFaultVoltageNeg[n2]};
244  std::complex<double> vZero[2] = {m_posFaultVoltageZero[n1], m_posFaultVoltageZero[n2]};
245  std::complex<double> zPos(puData.resistance, puData.indReactance);
246  std::complex<double> zZero(puData.zeroResistance, puData.zeroIndReactance);
247 
248  std::complex<double> transformerCurrentPos[2];
249  std::complex<double> transformerCurrentNeg[2];
250  std::complex<double> transformerCurrentZero[2];
251 
252  if(data.turnsRatio == 1.0 && data.phaseShift == 0.0) {
253  transformerCurrentPos[0] = (vPos[0] - vPos[1]) / zPos;
254  transformerCurrentNeg[0] = (vNeg[0] - vNeg[1]) / zPos;
255  transformerCurrentZero[0] = (vZero[0] - vZero[1]) / zZero;
256  transformerCurrentPos[1] = (vPos[1] - vPos[0]) / zPos;
257  transformerCurrentNeg[1] = (vNeg[1] - vNeg[0]) / zPos;
258  transformerCurrentZero[1] = (vZero[1] - vZero[0]) / zZero;
259  } else {
260  double radPhaseShift = wxDegToRad(data.phaseShift);
261  std::complex<double> t = std::complex<double>(data.turnsRatio * std::cos(radPhaseShift),
262  -data.turnsRatio * std::sin(radPhaseShift));
263 
264  transformerCurrentPos[0] =
265  vPos[0] * (1.0 / (std::pow(std::abs(t), 2.0) * zPos)) - vPos[1] * (1.0 / (std::conj(t) * zPos));
266  transformerCurrentNeg[0] =
267  vNeg[0] * (1.0 / (std::pow(std::abs(t), 2.0) * zPos)) - vNeg[1] * (1.0 / (t * zPos));
268 
269  transformerCurrentPos[1] = -vPos[0] * (1.0 / (t * zPos)) + vPos[1] / zPos;
270  transformerCurrentNeg[1] = -vNeg[0] * (1.0 / (std::conj(t) * zPos)) + vNeg[1] / zPos;
271  }
272 
273  switch(data.connection) {
274  case GWYE_GWYE: {
275  transformerCurrentZero[0] = (vZero[0] - vZero[1]) / zZero;
276  transformerCurrentZero[1] = (vZero[1] - vZero[0]) / zZero;
277  break;
278  }
279  case GWYE_DELTA: {
280  transformerCurrentZero[0] = vZero[0] / zZero;
281  transformerCurrentZero[1] = std::complex<double>(0.0, 0.0);
282  break;
283  }
284  case DELTA_GWYE: {
285  transformerCurrentZero[0] = std::complex<double>(0.0, 0.0);
286  transformerCurrentZero[1] = vZero[1] / zZero;
287  break;
288  }
289  default: {
290  transformerCurrentZero[0] = std::complex<double>(0.0, 0.0);
291  transformerCurrentZero[1] = std::complex<double>(0.0, 0.0);
292  break;
293  }
294  }
295 
296  data.faultCurrent[0][0] = transformerCurrentZero[0] + transformerCurrentPos[0] + transformerCurrentNeg[0];
297  data.faultCurrent[0][1] =
298  transformerCurrentZero[0] + a2 * transformerCurrentPos[0] + a * transformerCurrentNeg[0];
299  data.faultCurrent[0][2] =
300  transformerCurrentZero[0] + a * transformerCurrentPos[0] + a2 * transformerCurrentNeg[0];
301  data.faultCurrent[1][0] = transformerCurrentZero[1] + transformerCurrentPos[1] + transformerCurrentNeg[1];
302  data.faultCurrent[1][1] =
303  transformerCurrentZero[1] + a2 * transformerCurrentPos[1] + a * transformerCurrentNeg[1];
304  data.faultCurrent[1][2] =
305  transformerCurrentZero[1] + a * transformerCurrentPos[1] + a2 * transformerCurrentNeg[1];
306 
307  transformer->SetElectricaData(data);
308  }
309  }
310 
311  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
312  SyncGenerator* syncGenerator = *it;
313  if(syncGenerator->IsOnline()) {
314  Bus* bus = static_cast<Bus*>(syncGenerator->GetParentList()[0]);
315  int n = bus->GetElectricalData().number;
316  std::complex<double> v = bus->GetElectricalData().voltage; // Pre-fault voltage.
317  auto data = syncGenerator->GetElectricalData();
318  auto puData = syncGenerator->GetPUElectricalData(m_systemPowerBase);
319 
320  std::complex<double> vPos = m_posFaultVoltagePos[n];
321  std::complex<double> vNeg = m_posFaultVoltageNeg[n];
322  std::complex<double> vZero = m_posFaultVoltageZero[n];
323 
324  std::complex<double> zPos(puData.positiveResistance, puData.positiveReactance);
325  std::complex<double> zNeg(puData.negativeResistance, puData.negativeReactance);
326  std::complex<double> zZero(puData.zeroResistance + 3.0 * puData.groundResistance,
327  puData.zeroReactance + 3.0 * puData.groundReactance);
328 
329  // Internal voltage
330  std::complex<double> i = std::complex<double>(puData.activePower, -puData.reactivePower) / std::conj(v);
331  std::complex<double> e = v + zPos * i;
332 
333  std::complex<double> syncGeneratorCurrentPos = (e - vPos) / zPos;
334  std::complex<double> syncGeneratorCurrentNeg = (-vNeg) / zNeg;
335  std::complex<double> syncGeneratorCurrentZero(0.0, 0.0);
336  if(data.groundNeutral) syncGeneratorCurrentZero = (-vZero) / zZero;
337 
338  data.faultCurrent[0] = syncGeneratorCurrentZero + syncGeneratorCurrentPos + syncGeneratorCurrentNeg;
339  data.faultCurrent[1] =
340  syncGeneratorCurrentZero + a2 * syncGeneratorCurrentPos + a * syncGeneratorCurrentNeg;
341  data.faultCurrent[2] =
342  syncGeneratorCurrentZero + a * syncGeneratorCurrentPos + a2 * syncGeneratorCurrentNeg;
343 
344  syncGenerator->SetElectricalData(data);
345  }
346  }
347 
348  for(auto it = m_syncMotorList.begin(), itEnd = m_syncMotorList.end(); it != itEnd; ++it) {
349  SyncMotor* syncMotor = *it;
350  if(syncMotor->IsOnline()) {
351  Bus* bus = static_cast<Bus*>(syncMotor->GetParentList()[0]);
352  int n = bus->GetElectricalData().number;
353  std::complex<double> v = bus->GetElectricalData().voltage; // Pre-fault voltage.
354  auto data = syncMotor->GetElectricalData();
355  auto puData = syncMotor->GetPUElectricalData(m_systemPowerBase);
356 
357  std::complex<double> vPos = m_posFaultVoltagePos[n];
358  std::complex<double> vNeg = m_posFaultVoltageNeg[n];
359  std::complex<double> vZero = m_posFaultVoltageZero[n];
360 
361  std::complex<double> zPos(puData.positiveResistance, puData.positiveReactance);
362  std::complex<double> zNeg(puData.negativeResistance, puData.negativeReactance);
363  std::complex<double> zZero(puData.zeroResistance + 3.0 * puData.groundResistance,
364  puData.zeroReactance + 3.0 * puData.groundReactance);
365 
366  std::complex<double> syncGeneratorCurrentPos = (v - vPos) / zPos;
367  std::complex<double> syncGeneratorCurrentNeg = (-vNeg) / zNeg;
368  std::complex<double> syncGeneratorCurrentZero(0.0, 0.0);
369  if(data.groundNeutral) syncGeneratorCurrentZero = (-vZero) / zZero;
370 
371  data.faultCurrent[0] = syncGeneratorCurrentZero + syncGeneratorCurrentPos + syncGeneratorCurrentNeg;
372  data.faultCurrent[1] =
373  syncGeneratorCurrentZero + a2 * syncGeneratorCurrentPos + a * syncGeneratorCurrentNeg;
374  data.faultCurrent[2] =
375  syncGeneratorCurrentZero + a * syncGeneratorCurrentPos + a2 * syncGeneratorCurrentNeg;
376 
377  syncMotor->SetElectricalData(data);
378  }
379  }
380 }
381 
382 bool Fault::RunSCPowerCalcutation(double systemPowerBase)
383 {
384  // Get adimittance matrix.
385  std::vector<std::vector<std::complex<double> > > yBusPos;
386  GetYBus(yBusPos, systemPowerBase, POSITIVE_SEQ, true);
387 
388  // Calculate the impedance matrix.
389  if(!InvertMatrix(yBusPos, m_zBusPos)) {
390  m_errorMsg = _("Fail to invert the positive sequence admittance matrix.");
391  return false;
392  }
393 
394  // Set the SC power.
395  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
396  Bus* bus = *it;
397  auto data = bus->GetElectricalData();
398  int n = data.number;
399  data.scPower = 1.0 / std::abs(m_zBusPos[n][n]);
400  bus->SetElectricalData(data);
401  }
402 
403  return true;
404 }
- -
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:517
-
FaultData
Information about fault (type and location).
Definition: PowerElement.h:38
- - -
Definition: Bus.h:45
-
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:219
-
virtual bool RunFaultCalculation(double systemPowerBase)
Calculate the fault of the system. Return true if was possible the calculation.
Definition: Fault.cpp:9
- -
Fault()
Default contructor. Use GetElementsFromList(std::vector<Element*> elementList).
Definition: Fault.cpp:6
- - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Fault.h"
19 #ifdef USING_WX_3_0_X
20 #include "DegreesAndRadians.h"
21 #endif
22 
24 Fault::Fault(std::vector<Element*> elementList) { GetElementsFromList(elementList); }
26 bool Fault::RunFaultCalculation(double systemPowerBase)
27 {
28  m_systemPowerBase = systemPowerBase;
29  int numberOfBuses = static_cast<int>(m_busList.size());
30  if(numberOfBuses == 0) {
31  m_errorMsg = _("There is no buses in the system.");
32  return false;
33  }
34 
35  // Get adimittance matrices.
36  std::vector<std::vector<std::complex<double> > > yBusPos;
37  GetYBus(yBusPos, systemPowerBase, POSITIVE_SEQ, true);
38  std::vector<std::vector<std::complex<double> > > yBusNeg;
39  GetYBus(yBusNeg, systemPowerBase, NEGATIVE_SEQ, true);
40  std::vector<std::vector<std::complex<double> > > yBusZero;
41  GetYBus(yBusZero, systemPowerBase, ZERO_SEQ, true);
42 
43  // Calculate the impedance matrices.
44  if(!InvertMatrix(yBusPos, m_zBusPos)) {
45  m_errorMsg = _("Fail to invert the positive sequence admittance matrix.");
46  return false;
47  }
48  if(!InvertMatrix(yBusNeg, m_zBusNeg)) {
49  m_errorMsg = _("Fail to invert the negative sequence admittance matrix.");
50  return false;
51  }
52  if(!InvertMatrix(yBusZero, m_zBusZero)) {
53  m_errorMsg = _("Fail to invert the zero sequence admittance matrix.");
54  return false;
55  }
56 
57  // Pre-fault voltages (power flow solution).
58  std::vector<std::complex<double> > preFaultVoltages;
59  preFaultVoltages.resize(m_busList.size());
60 
61  // Get fault parameters.
62  int fNumber = -1;
64  FaultData fLocation = FAULT_LINE_A;
65  std::complex<double> fImpedance = std::complex<double>(0.0, 0.0);
66  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
67  Bus* bus = *it;
68  BusElectricalData data = bus->GetElectricalData();
69  preFaultVoltages[data.number] = data.voltage;
70  if(data.hasFault) {
71  fNumber = data.number;
72  fType = data.faultType;
73  fLocation = data.faultLocation;
74  fImpedance = std::complex<double>(data.faultResistance, data.faultReactance);
75  }
76  }
77 
78  if(fNumber == -1) {
79  m_errorMsg = _("There is no fault in the system.");
80  return false;
81  }
82 
83  // Fault calculation.
84  std::complex<double> fCurrentPos = std::complex<double>(0.0, 0.0);
85  std::complex<double> fCurrentNeg = std::complex<double>(0.0, 0.0);
86  std::complex<double> fCurrentZero = std::complex<double>(0.0, 0.0);
87 
88  std::complex<double> preFaultVoltage = preFaultVoltages[fNumber];
89  std::complex<double> a = std::complex<double>(-0.5, 0.866025403784);
90  std::complex<double> a2 = std::complex<double>(-0.5, -0.866025403784);
91 
92  switch(fType) {
93  case FAULT_THREEPHASE: {
94  fCurrentPos = preFaultVoltage / (m_zBusPos[fNumber][fNumber] + fImpedance);
95  } break;
96  case FAULT_2LINE: {
97  fCurrentPos = preFaultVoltage / (m_zBusPos[fNumber][fNumber] + m_zBusNeg[fNumber][fNumber] + fImpedance);
98 
99  switch(fLocation) {
100  case FAULT_LINE_A: {
101  fCurrentNeg = -a2 * fCurrentPos;
102  } break;
103  case FAULT_LINE_B: {
104  fCurrentNeg = -fCurrentPos;
105  } break;
106  case FAULT_LINE_C: {
107  fCurrentNeg = -a * fCurrentPos;
108  } break;
109  default:
110  break;
111  }
112  } break;
113  case FAULT_2LINE_GROUND: {
114  std::complex<double> z1 = m_zBusPos[fNumber][fNumber];
115  std::complex<double> z2 = m_zBusNeg[fNumber][fNumber];
116  std::complex<double> z0 = m_zBusZero[fNumber][fNumber];
117  std::complex<double> zf_3 = std::complex<double>(3.0, 0.0) * fImpedance;
118 
119  fCurrentPos = (preFaultVoltage * (z2 + z0 + zf_3)) / (z1 * z2 + z2 * z0 + z2 * zf_3 + z1 * z0 + z1 * zf_3);
120 
121  switch(fLocation) {
122  case FAULT_LINE_A: {
123  fCurrentNeg = -a2 * ((preFaultVoltage - z1 * fCurrentPos) / z2);
124  fCurrentZero = -a * ((preFaultVoltage - z1 * fCurrentPos) / (z0 + zf_3));
125  } break;
126  case FAULT_LINE_B: {
127  fCurrentNeg = -((preFaultVoltage - z1 * fCurrentPos) / z2);
128  fCurrentZero = -((preFaultVoltage - z1 * fCurrentPos) / (z0 + zf_3));
129  } break;
130  case FAULT_LINE_C: {
131  fCurrentNeg = -a * ((preFaultVoltage - z1 * fCurrentPos) / z2);
132  fCurrentZero = -a2 * ((preFaultVoltage - z1 * fCurrentPos) / (z0 + zf_3));
133  } break;
134  default:
135  break;
136  }
137  } break;
138  case FAULT_LINE_GROUND: {
139  fCurrentPos =
140  preFaultVoltage / (m_zBusPos[fNumber][fNumber] + m_zBusNeg[fNumber][fNumber] +
141  m_zBusZero[fNumber][fNumber] + std::complex<double>(3.0, 0.0) * fImpedance);
142  switch(fLocation) {
143  case FAULT_LINE_A: {
144  fCurrentNeg = fCurrentPos;
145  fCurrentZero = fCurrentPos;
146  } break;
147  case FAULT_LINE_B: {
148  fCurrentNeg = a * fCurrentPos;
149  fCurrentZero = a2 * fCurrentPos;
150  } break;
151  case FAULT_LINE_C: {
152  fCurrentNeg = a2 * fCurrentPos;
153  fCurrentZero = a * fCurrentPos;
154  } break;
155  default:
156  break;
157  }
158  } break;
159  default:
160  break;
161  }
162 
163  // Convert sequence currents to ABC. [Iabc] = [A]*[I012]
164  m_fCurrentA = fCurrentZero + fCurrentPos + fCurrentNeg;
165  m_fCurrentB = fCurrentZero + a2 * fCurrentPos + a * fCurrentNeg;
166  m_fCurrentC = fCurrentZero + a * fCurrentPos + a2 * fCurrentNeg;
167 
168  // Pos-fault voltages calculation
169  m_posFaultVoltagePos.clear();
170  m_posFaultVoltageNeg.clear();
171  m_posFaultVoltageZero.clear();
172  m_posFaultVoltageA.clear();
173  m_posFaultVoltageB.clear();
174  m_posFaultVoltageC.clear();
175 
176  for(int i = 0; i < numberOfBuses; ++i) {
177  m_posFaultVoltagePos.push_back(preFaultVoltages[i] - m_zBusPos[i][fNumber] * fCurrentPos);
178  m_posFaultVoltageNeg.push_back(-m_zBusNeg[i][fNumber] * fCurrentNeg);
179  m_posFaultVoltageZero.push_back(-m_zBusZero[i][fNumber] * fCurrentZero);
180 
181  // V012 -> Vabc
182  m_posFaultVoltageA.push_back(m_posFaultVoltageZero[i] + m_posFaultVoltagePos[i] + m_posFaultVoltageNeg[i]);
183  m_posFaultVoltageB.push_back(m_posFaultVoltageZero[i] + a2 * m_posFaultVoltagePos[i] +
184  a * m_posFaultVoltageNeg[i]);
185  m_posFaultVoltageC.push_back(m_posFaultVoltageZero[i] + a * m_posFaultVoltagePos[i] +
186  a2 * m_posFaultVoltageNeg[i]);
187  }
188 
189  UpdateElementsFault(systemPowerBase);
190  return true;
191 }
192 
193 void Fault::UpdateElementsFault(double systemPowerBase)
194 {
195  std::complex<double> a = std::complex<double>(-0.5, 0.866025403784);
196  std::complex<double> a2 = std::complex<double>(-0.5, -0.866025403784);
197 
198  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
199  Bus* bus = *it;
200  auto data = bus->GetElectricalData();
201  if(data.hasFault) {
202  data.faultCurrent[0] = m_fCurrentA;
203  data.faultCurrent[1] = m_fCurrentB;
204  data.faultCurrent[2] = m_fCurrentC;
205  } else {
206  data.faultCurrent[0] = data.faultCurrent[1] = data.faultCurrent[2] = std::complex<double>(0.0, 0.0);
207  }
208  data.faultVoltage[0] = m_posFaultVoltageA[data.number];
209  data.faultVoltage[1] = m_posFaultVoltageB[data.number];
210  data.faultVoltage[2] = m_posFaultVoltageC[data.number];
211  bus->SetElectricalData(data);
212  }
213 
214  for(auto it = m_lineList.begin(), itEnd = m_lineList.end(); it != itEnd; ++it) {
215  Line* line = *it;
216  if(line->IsOnline()) {
217  int n1 = static_cast<Bus*>(line->GetParentList()[0])->GetElectricalData().number;
218  int n2 = static_cast<Bus*>(line->GetParentList()[1])->GetElectricalData().number;
219  auto data = line->GetElectricalData();
220  auto puData = line->GetPUElectricalData(m_systemPowerBase);
221  std::complex<double> vPos[2] = {m_posFaultVoltagePos[n1], m_posFaultVoltagePos[n2]};
222  std::complex<double> vNeg[2] = {m_posFaultVoltageNeg[n1], m_posFaultVoltageNeg[n2]};
223  std::complex<double> vZero[2] = {m_posFaultVoltageZero[n1], m_posFaultVoltageZero[n2]};
224  std::complex<double> zPos(puData.resistance, puData.indReactance);
225  std::complex<double> bPos(0.0, puData.capSusceptance / 2.0);
226  std::complex<double> zZero(puData.zeroResistance, puData.zeroIndReactance);
227  std::complex<double> bZero(0.0, puData.zeroCapSusceptance / 2.0);
228 
229  std::complex<double> lineCurrentPos[2];
230  std::complex<double> lineCurrentNeg[2];
231  std::complex<double> lineCurrentZero[2];
232 
233  lineCurrentPos[0] = ((vPos[0] - vPos[1]) / zPos) + (vPos[0] * bPos);
234  lineCurrentNeg[0] = ((vNeg[0] - vNeg[1]) / zPos) + (vNeg[0] * bPos);
235  lineCurrentZero[0] = ((vZero[0] - vZero[1]) / zZero) + (vZero[0] * bZero);
236  lineCurrentPos[1] = ((vPos[1] - vPos[0]) / zPos) + (vPos[1] * bPos);
237  lineCurrentNeg[1] = ((vNeg[1] - vNeg[0]) / zPos) + (vNeg[1] * bPos);
238  lineCurrentZero[1] = ((vZero[1] - vZero[0]) / zZero) + (vZero[1] * bZero);
239 
240  data.faultCurrent[0][0] = lineCurrentZero[0] + lineCurrentPos[0] + lineCurrentNeg[0];
241  data.faultCurrent[0][1] = lineCurrentZero[0] + a2 * lineCurrentPos[0] + a * lineCurrentNeg[0];
242  data.faultCurrent[0][2] = lineCurrentZero[0] + a * lineCurrentPos[0] + a2 * lineCurrentNeg[0];
243  data.faultCurrent[1][0] = lineCurrentZero[1] + lineCurrentPos[1] + lineCurrentNeg[1];
244  data.faultCurrent[1][1] = lineCurrentZero[1] + a2 * lineCurrentPos[1] + a * lineCurrentNeg[1];
245  data.faultCurrent[1][2] = lineCurrentZero[1] + a * lineCurrentPos[1] + a2 * lineCurrentNeg[1];
246 
247  line->SetElectricalData(data);
248  }
249  }
250 
251  for(auto it = m_transformerList.begin(), itEnd = m_transformerList.end(); it != itEnd; ++it) {
252  Transformer* transformer = *it;
253  if(transformer->IsOnline()) {
254  int n1 = static_cast<Bus*>(transformer->GetParentList()[0])->GetElectricalData().number;
255  int n2 = static_cast<Bus*>(transformer->GetParentList()[1])->GetElectricalData().number;
256  auto data = transformer->GetElectricalData();
257  auto puData = transformer->GetPUElectricalData(m_systemPowerBase);
258 
259  std::complex<double> vPos[2] = {m_posFaultVoltagePos[n1], m_posFaultVoltagePos[n2]};
260  std::complex<double> vNeg[2] = {m_posFaultVoltageNeg[n1], m_posFaultVoltageNeg[n2]};
261  std::complex<double> vZero[2] = {m_posFaultVoltageZero[n1], m_posFaultVoltageZero[n2]};
262  std::complex<double> zPos(puData.resistance, puData.indReactance);
263  std::complex<double> zZero(puData.zeroResistance, puData.zeroIndReactance);
264 
265  std::complex<double> transformerCurrentPos[2];
266  std::complex<double> transformerCurrentNeg[2];
267  std::complex<double> transformerCurrentZero[2];
268 
269  if(data.turnsRatio == 1.0 && data.phaseShift == 0.0) {
270  transformerCurrentPos[0] = (vPos[0] - vPos[1]) / zPos;
271  transformerCurrentNeg[0] = (vNeg[0] - vNeg[1]) / zPos;
272  transformerCurrentZero[0] = (vZero[0] - vZero[1]) / zZero;
273  transformerCurrentPos[1] = (vPos[1] - vPos[0]) / zPos;
274  transformerCurrentNeg[1] = (vNeg[1] - vNeg[0]) / zPos;
275  transformerCurrentZero[1] = (vZero[1] - vZero[0]) / zZero;
276  } else {
277  double radPhaseShift = wxDegToRad(data.phaseShift);
278  std::complex<double> t = std::complex<double>(data.turnsRatio * std::cos(radPhaseShift),
279  -data.turnsRatio * std::sin(radPhaseShift));
280 
281  transformerCurrentPos[0] =
282  vPos[0] * (1.0 / (std::pow(std::abs(t), 2.0) * zPos)) - vPos[1] * (1.0 / (std::conj(t) * zPos));
283  transformerCurrentNeg[0] =
284  vNeg[0] * (1.0 / (std::pow(std::abs(t), 2.0) * zPos)) - vNeg[1] * (1.0 / (t * zPos));
285 
286  transformerCurrentPos[1] = -vPos[0] * (1.0 / (t * zPos)) + vPos[1] / zPos;
287  transformerCurrentNeg[1] = -vNeg[0] * (1.0 / (std::conj(t) * zPos)) + vNeg[1] / zPos;
288  }
289 
290  switch(data.connection) {
291  case GWYE_GWYE: {
292  transformerCurrentZero[0] = (vZero[0] - vZero[1]) / zZero;
293  transformerCurrentZero[1] = (vZero[1] - vZero[0]) / zZero;
294  break;
295  }
296  case GWYE_DELTA: {
297  transformerCurrentZero[0] = vZero[0] / zZero;
298  transformerCurrentZero[1] = std::complex<double>(0.0, 0.0);
299  break;
300  }
301  case DELTA_GWYE: {
302  transformerCurrentZero[0] = std::complex<double>(0.0, 0.0);
303  transformerCurrentZero[1] = vZero[1] / zZero;
304  break;
305  }
306  default: {
307  transformerCurrentZero[0] = std::complex<double>(0.0, 0.0);
308  transformerCurrentZero[1] = std::complex<double>(0.0, 0.0);
309  break;
310  }
311  }
312 
313  data.faultCurrent[0][0] = transformerCurrentZero[0] + transformerCurrentPos[0] + transformerCurrentNeg[0];
314  data.faultCurrent[0][1] =
315  transformerCurrentZero[0] + a2 * transformerCurrentPos[0] + a * transformerCurrentNeg[0];
316  data.faultCurrent[0][2] =
317  transformerCurrentZero[0] + a * transformerCurrentPos[0] + a2 * transformerCurrentNeg[0];
318  data.faultCurrent[1][0] = transformerCurrentZero[1] + transformerCurrentPos[1] + transformerCurrentNeg[1];
319  data.faultCurrent[1][1] =
320  transformerCurrentZero[1] + a2 * transformerCurrentPos[1] + a * transformerCurrentNeg[1];
321  data.faultCurrent[1][2] =
322  transformerCurrentZero[1] + a * transformerCurrentPos[1] + a2 * transformerCurrentNeg[1];
323 
324  transformer->SetElectricaData(data);
325  }
326  }
327 
328  for(auto it = m_syncGeneratorList.begin(), itEnd = m_syncGeneratorList.end(); it != itEnd; ++it) {
329  SyncGenerator* syncGenerator = *it;
330  if(syncGenerator->IsOnline()) {
331  Bus* bus = static_cast<Bus*>(syncGenerator->GetParentList()[0]);
332  int n = bus->GetElectricalData().number;
333  std::complex<double> v = bus->GetElectricalData().voltage; // Pre-fault voltage.
334  auto data = syncGenerator->GetElectricalData();
335  auto puData = syncGenerator->GetPUElectricalData(m_systemPowerBase);
336 
337  std::complex<double> vPos = m_posFaultVoltagePos[n];
338  std::complex<double> vNeg = m_posFaultVoltageNeg[n];
339  std::complex<double> vZero = m_posFaultVoltageZero[n];
340 
341  std::complex<double> zPos(puData.positiveResistance, puData.positiveReactance);
342  std::complex<double> zNeg(puData.negativeResistance, puData.negativeReactance);
343  std::complex<double> zZero(puData.zeroResistance + 3.0 * puData.groundResistance,
344  puData.zeroReactance + 3.0 * puData.groundReactance);
345 
346  // Internal voltage
347  std::complex<double> i = std::complex<double>(puData.activePower, -puData.reactivePower) / std::conj(v);
348  std::complex<double> e = v + zPos * i;
349 
350  std::complex<double> syncGeneratorCurrentPos = (e - vPos) / zPos;
351  std::complex<double> syncGeneratorCurrentNeg = (-vNeg) / zNeg;
352  std::complex<double> syncGeneratorCurrentZero(0.0, 0.0);
353  if(data.groundNeutral) syncGeneratorCurrentZero = (-vZero) / zZero;
354 
355  data.faultCurrent[0] = syncGeneratorCurrentZero + syncGeneratorCurrentPos + syncGeneratorCurrentNeg;
356  data.faultCurrent[1] =
357  syncGeneratorCurrentZero + a2 * syncGeneratorCurrentPos + a * syncGeneratorCurrentNeg;
358  data.faultCurrent[2] =
359  syncGeneratorCurrentZero + a * syncGeneratorCurrentPos + a2 * syncGeneratorCurrentNeg;
360 
361  syncGenerator->SetElectricalData(data);
362  }
363  }
364 
365  for(auto it = m_syncMotorList.begin(), itEnd = m_syncMotorList.end(); it != itEnd; ++it) {
366  SyncMotor* syncMotor = *it;
367  if(syncMotor->IsOnline()) {
368  Bus* bus = static_cast<Bus*>(syncMotor->GetParentList()[0]);
369  int n = bus->GetElectricalData().number;
370  std::complex<double> v = bus->GetElectricalData().voltage; // Pre-fault voltage.
371  auto data = syncMotor->GetElectricalData();
372  auto puData = syncMotor->GetPUElectricalData(m_systemPowerBase);
373 
374  std::complex<double> vPos = m_posFaultVoltagePos[n];
375  std::complex<double> vNeg = m_posFaultVoltageNeg[n];
376  std::complex<double> vZero = m_posFaultVoltageZero[n];
377 
378  std::complex<double> zPos(puData.positiveResistance, puData.positiveReactance);
379  std::complex<double> zNeg(puData.negativeResistance, puData.negativeReactance);
380  std::complex<double> zZero(puData.zeroResistance + 3.0 * puData.groundResistance,
381  puData.zeroReactance + 3.0 * puData.groundReactance);
382 
383  std::complex<double> syncGeneratorCurrentPos = (v - vPos) / zPos;
384  std::complex<double> syncGeneratorCurrentNeg = (-vNeg) / zNeg;
385  std::complex<double> syncGeneratorCurrentZero(0.0, 0.0);
386  if(data.groundNeutral) syncGeneratorCurrentZero = (-vZero) / zZero;
387 
388  data.faultCurrent[0] = syncGeneratorCurrentZero + syncGeneratorCurrentPos + syncGeneratorCurrentNeg;
389  data.faultCurrent[1] =
390  syncGeneratorCurrentZero + a2 * syncGeneratorCurrentPos + a * syncGeneratorCurrentNeg;
391  data.faultCurrent[2] =
392  syncGeneratorCurrentZero + a * syncGeneratorCurrentPos + a2 * syncGeneratorCurrentNeg;
393 
394  syncMotor->SetElectricalData(data);
395  }
396  }
397 }
398 
399 bool Fault::RunSCPowerCalcutation(double systemPowerBase)
400 {
401  // Get adimittance matrix.
402  std::vector<std::vector<std::complex<double> > > yBusPos;
403  GetYBus(yBusPos, systemPowerBase, POSITIVE_SEQ, true);
404 
405  // Calculate the impedance matrix.
406  if(!InvertMatrix(yBusPos, m_zBusPos)) {
407  m_errorMsg = _("Fail to invert the positive sequence admittance matrix.");
408  return false;
409  }
410 
411  // Set the SC power.
412  for(auto it = m_busList.begin(), itEnd = m_busList.end(); it != itEnd; ++it) {
413  Bus* bus = *it;
414  auto data = bus->GetElectricalData();
415  int n = data.number;
416  data.scPower = 1.0 / std::abs(m_zBusPos[n][n]);
417  bus->SetElectricalData(data);
418  }
419 
420  return true;
421 }
+ +
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:506
+
FaultData
Information about fault (type and location).
Definition: PowerElement.h:55
+ + +
Definition: Bus.h:62
+
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:227
+
virtual bool RunFaultCalculation(double systemPowerBase)
Calculate the fault of the system. Return true if was possible the calculation.
Definition: Fault.cpp:26
+ +
Fault()
Default contructor. Use GetElementsFromList(std::vector<Element*> elementList).
Definition: Fault.cpp:23
+ +
Calculate the fault of the system and update the elements data.
-
virtual bool InvertMatrix(std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::vector< std::complex< double > > > &inverse)
Invert a matrix.
-
Definition: Line.h:35
-
virtual bool GetYBus(std::vector< std::vector< std::complex< double > > > &yBus, double systemPowerBase, YBusSequence sequence=POSITIVE_SEQ, bool includeSyncMachines=false, bool allLoadsAsImpedances=false)
Get the admittance matrix from the list of elements (use GetElementsFromList first).
- - -
virtual bool RunSCPowerCalcutation(double systemPowerBase)
Calculate the short-circuit power of the system. Return true if was possible the calculation.
Definition: Fault.cpp:382
-
~Fault()
Destructor.
Definition: Fault.cpp:8
- -
virtual void GetElementsFromList(std::vector< Element *> elementList)
Separate the power elements from a generic list.
- -
virtual void UpdateElementsFault(double systemPowerBase)
Update the data of the elements.
Definition: Fault.cpp:176
- +
virtual bool InvertMatrix(std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::vector< std::complex< double > > > &inverse)
Invert a matrix.
+
Definition: Line.h:52
+
virtual bool GetYBus(std::vector< std::vector< std::complex< double > > > &yBus, double systemPowerBase, YBusSequence sequence=POSITIVE_SEQ, bool includeSyncMachines=false, bool allLoadsAsImpedances=false)
Get the admittance matrix from the list of elements (use GetElementsFromList first).
+ + +
virtual bool RunSCPowerCalcutation(double systemPowerBase)
Calculate the short-circuit power of the system. Return true if was possible the calculation.
Definition: Fault.cpp:399
+
~Fault()
Destructor.
Definition: Fault.cpp:25
+ +
virtual void GetElementsFromList(std::vector< Element *> elementList)
Separate the power elements from a generic list.
+ +
virtual void UpdateElementsFault(double systemPowerBase)
Update the data of the elements.
Definition: Fault.cpp:193
+
diff --git a/docs/doxygen/html/_fault_8h.html b/docs/doxygen/html/_fault_8h.html index 311d0d7..ecd4a49 100644 --- a/docs/doxygen/html/_fault_8h.html +++ b/docs/doxygen/html/_fault_8h.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/_fault_8h_source.html b/docs/doxygen/html/_fault_8h_source.html index ffbcce0..2b601bc 100644 --- a/docs/doxygen/html/_fault_8h_source.html +++ b/docs/doxygen/html/_fault_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_fault_8h_source.html','');});
Fault.h
-Go to the documentation of this file.
1 #ifndef FAULT_H
2 #define FAULT_H
3 
4 #include "ElectricCalculation.h"
13 class Fault : public ElectricCalculation
14 {
15 public:
20  Fault(std::vector<Element*> elementList);
21 
25  Fault();
26 
30  ~Fault();
31 
36  virtual bool RunFaultCalculation(double systemPowerBase);
37 
42  virtual bool RunSCPowerCalcutation(double systemPowerBase);
43 
48  virtual void UpdateElementsFault(double systemPowerBase);
49 
54  virtual wxString GetErrorMessage() { return m_errorMsg; }
55 
56 protected:
57  wxString m_errorMsg = "";
58 
59  double m_systemPowerBase;
60 
61  std::vector<std::vector<std::complex<double> > > m_zBusPos;
62  std::vector<std::vector<std::complex<double> > > m_zBusNeg;
63  std::vector<std::vector<std::complex<double> > > m_zBusZero;
64 
65  std::vector<std::complex<double> > m_posFaultVoltagePos;
66  std::vector<std::complex<double> > m_posFaultVoltageNeg;
67  std::vector<std::complex<double> > m_posFaultVoltageZero;
68 
69  std::complex<double> m_fCurrentA;
70  std::complex<double> m_fCurrentB;
71  std::complex<double> m_fCurrentC;
72 
73  std::vector<std::complex<double> > m_posFaultVoltageA;
74  std::vector<std::complex<double> > m_posFaultVoltageB;
75  std::vector<std::complex<double> > m_posFaultVoltageC;
76 };
77 
78 #endif // FAULT_H
Base class of electric calculations, with general methods.
-
virtual wxString GetErrorMessage()
Get the error message generated in RunFaultCalculation(double systemPowerBase).
Definition: Fault.h:54
-
virtual bool RunFaultCalculation(double systemPowerBase)
Calculate the fault of the system. Return true if was possible the calculation.
Definition: Fault.cpp:9
-
Fault()
Default contructor. Use GetElementsFromList(std::vector<Element*> elementList).
Definition: Fault.cpp:6
-
Definition: Fault.h:13
-
virtual bool RunSCPowerCalcutation(double systemPowerBase)
Calculate the short-circuit power of the system. Return true if was possible the calculation.
Definition: Fault.cpp:382
-
~Fault()
Destructor.
Definition: Fault.cpp:8
- -
virtual void UpdateElementsFault(double systemPowerBase)
Update the data of the elements.
Definition: Fault.cpp:176
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef FAULT_H
19 #define FAULT_H
20 
21 #include "ElectricCalculation.h"
30 class Fault : public ElectricCalculation
31 {
32  public:
37  Fault(std::vector<Element*> elementList);
38 
42  Fault();
43 
47  ~Fault();
48 
53  virtual bool RunFaultCalculation(double systemPowerBase);
54 
59  virtual bool RunSCPowerCalcutation(double systemPowerBase);
60 
65  virtual void UpdateElementsFault(double systemPowerBase);
66 
71  virtual wxString GetErrorMessage() { return m_errorMsg; }
72  protected:
73  wxString m_errorMsg = "";
74 
75  double m_systemPowerBase;
76 
77  std::vector<std::vector<std::complex<double> > > m_zBusPos;
78  std::vector<std::vector<std::complex<double> > > m_zBusNeg;
79  std::vector<std::vector<std::complex<double> > > m_zBusZero;
80 
81  std::vector<std::complex<double> > m_posFaultVoltagePos;
82  std::vector<std::complex<double> > m_posFaultVoltageNeg;
83  std::vector<std::complex<double> > m_posFaultVoltageZero;
84 
85  std::complex<double> m_fCurrentA;
86  std::complex<double> m_fCurrentB;
87  std::complex<double> m_fCurrentC;
88 
89  std::vector<std::complex<double> > m_posFaultVoltageA;
90  std::vector<std::complex<double> > m_posFaultVoltageB;
91  std::vector<std::complex<double> > m_posFaultVoltageC;
92 };
93 
94 #endif // FAULT_H
Base class of electric calculations, with general methods.
+
virtual wxString GetErrorMessage()
Get the error message generated in RunFaultCalculation(double systemPowerBase).
Definition: Fault.h:71
+
virtual bool RunFaultCalculation(double systemPowerBase)
Calculate the fault of the system. Return true if was possible the calculation.
Definition: Fault.cpp:26
+
Fault()
Default contructor. Use GetElementsFromList(std::vector<Element*> elementList).
Definition: Fault.cpp:23
+
Definition: Fault.h:30
+
virtual bool RunSCPowerCalcutation(double systemPowerBase)
Calculate the short-circuit power of the system. Return true if was possible the calculation.
Definition: Fault.cpp:399
+
~Fault()
Destructor.
Definition: Fault.cpp:25
+ +
virtual void UpdateElementsFault(double systemPowerBase)
Update the data of the elements.
Definition: Fault.cpp:193
diff --git a/docs/doxygen/html/_file_handing_8cpp_source.html b/docs/doxygen/html/_file_handing_8cpp_source.html index 14f2099..983eb4f 100644 --- a/docs/doxygen/html/_file_handing_8cpp_source.html +++ b/docs/doxygen/html/_file_handing_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,101 +88,102 @@ $(document).ready(function(){initNavTree('_file_handing_8cpp_source.html','');})
FileHanding.cpp
-
1 #include "FileHanding.h"
2 
3 FileHanding::~FileHanding() {}
4 FileHanding::FileHanding(Workspace* workspace) { m_workspace = workspace; }
5 FileHanding::FileHanding(ControlEditor* controlEditor) { m_controlEditor = controlEditor; }
6 FileHanding::FileHanding() {}
7 void FileHanding::SaveProject(wxFileName path)
8 {
9  // Erase the file (if exists or not) and write the initial data
10  std::ofstream writeProjectsFile(path.GetFullPath());
11  writeProjectsFile.close();
12 
13  rapidxml::xml_document<> doc;
14  rapidxml::file<> xmlFile(path.GetFullPath().mb_str());
15  doc.parse<0>(xmlFile.data());
16 
17  rapidxml::xml_node<>* decl = doc.allocate_node(rapidxml::node_declaration);
18  rapidxml::xml_attribute<>* ver = doc.allocate_attribute("version", "1.0");
19  rapidxml::xml_attribute<>* encoding = doc.allocate_attribute("encoding", "utf-8");
20  decl->append_attribute(ver);
21  decl->append_attribute(encoding);
22  doc.append_node(decl);
23 
24  rapidxml::xml_node<>* rootNode = doc.allocate_node(rapidxml::node_element, "Project");
25  doc.append_node(rootNode);
26 
27  rapidxml::xml_node<>* projectNameNode = AppendNode(doc, rootNode, "Name");
28  SetNodeValue(doc, projectNameNode, path.GetName());
29 
30  auto elementsNode = AppendNode(doc, rootNode, "Elements");
31 
32  // Save all the data
33  ElectricCalculation allElements;
34  allElements.GetElementsFromList(m_workspace->GetElementList());
35 
36  //{ Buses
37  auto busesNode = AppendNode(doc, elementsNode, "BusList");
38  auto busList = allElements.GetBusList();
39  for(int i = 0; i < (int)busList.size(); i++) {
40  Bus* bus = busList[i];
41  auto busNode = AppendNode(doc, busesNode, "Bus");
42  SetNodeAttribute(doc, busNode, "ID", i);
43  auto cadProp = AppendNode(doc, busNode, "CADProperties");
44  auto position = AppendNode(doc, cadProp, "Position");
45  auto posX = AppendNode(doc, position, "X");
46  SetNodeValue(doc, posX, bus->GetPosition().m_x);
47  auto posY = AppendNode(doc, position, "Y");
48  SetNodeValue(doc, posY, bus->GetPosition().m_y);
49  auto size = AppendNode(doc, cadProp, "Size");
50  auto width = AppendNode(doc, size, "Width");
51  SetNodeValue(doc, width, bus->GetWidth());
52  auto height = AppendNode(doc, size, "Height");
53  SetNodeValue(doc, height, bus->GetHeight());
54  auto angle = AppendNode(doc, cadProp, "Angle");
55  SetNodeValue(doc, angle, bus->GetAngle());
56 
57  BusElectricalData data = bus->GetElectricalData();
58  auto electricalProp = AppendNode(doc, busNode, "ElectricalProperties");
59  auto name = AppendNode(doc, electricalProp, "Name");
60  SetNodeValue(doc, name, data.name);
61  auto nominalVoltage = AppendNode(doc, electricalProp, "NominalVoltage");
62  SetNodeValue(doc, nominalVoltage, data.nominalVoltage);
63  SetNodeAttribute(doc, nominalVoltage, "UnitID", data.nominalVoltageUnit);
64  auto isVoltageControlled = AppendNode(doc, electricalProp, "IsVoltageControlled");
65  SetNodeValue(doc, isVoltageControlled, data.isVoltageControlled);
66  auto controlledVoltage = AppendNode(doc, electricalProp, "ControlledVoltage");
67  SetNodeValue(doc, controlledVoltage, data.controlledVoltage);
68  SetNodeAttribute(doc, controlledVoltage, "Choice", data.controlledVoltageUnitChoice);
69  auto slackBus = AppendNode(doc, electricalProp, "SlackBus");
70  SetNodeValue(doc, slackBus, data.slackBus);
71 
72  auto fault = AppendNode(doc, electricalProp, "Fault");
73  auto hasFault = AppendNode(doc, fault, "HasFault");
74  SetNodeValue(doc, hasFault, data.hasFault);
75  auto faultType = AppendNode(doc, fault, "Type");
76  SetNodeValue(doc, faultType, data.faultType);
77  auto faultLocation = AppendNode(doc, fault, "Location");
78  SetNodeValue(doc, faultLocation, data.faultLocation);
79  auto faultResistance = AppendNode(doc, fault, "Resistance");
80  SetNodeValue(doc, faultResistance, data.faultResistance);
81  auto faultReactance = AppendNode(doc, fault, "Reactance");
82  SetNodeValue(doc, faultReactance, data.faultReactance);
83 
84  auto stability = AppendNode(doc, electricalProp, "Stability");
85  auto plotBus = AppendNode(doc, stability, "Plot");
86  SetNodeValue(doc, plotBus, data.plotBus);
87  auto stabHasFault = AppendNode(doc, stability, "HasFault");
88  SetNodeValue(doc, stabHasFault, data.stabHasFault);
89  auto stabFaultTime = AppendNode(doc, stability, "FaultTime");
90  SetNodeValue(doc, stabFaultTime, data.stabFaultTime);
91  auto stabFaultLength = AppendNode(doc, stability, "FaultLength");
92  SetNodeValue(doc, stabFaultLength, data.stabFaultLength);
93  auto stabFaultResistance = AppendNode(doc, stability, "FaultResistance");
94  SetNodeValue(doc, stabFaultResistance, data.stabFaultResistance);
95  auto stabFaultReactance = AppendNode(doc, stability, "FaultReactance");
96  SetNodeValue(doc, stabFaultReactance, data.stabFaultReactance);
97 
98  data.number = i;
99  bus->SetElectricalData(data);
100  } //}
101 
102  //{ Capacitor
103  auto capacitorsNode = AppendNode(doc, elementsNode, "CapacitorList");
104  auto capacitorList = allElements.GetCapacitorList();
105  for(int i = 0; i < (int)capacitorList.size(); i++) {
106  Capacitor* capacitor = capacitorList[i];
107  auto capacitorNode = AppendNode(doc, capacitorsNode, "Capacitor");
108  SetNodeAttribute(doc, capacitorNode, "ID", i);
109  auto cadProp = AppendNode(doc, capacitorNode, "CADProperties");
110  auto position = AppendNode(doc, cadProp, "Position");
111  auto posX = AppendNode(doc, position, "X");
112  SetNodeValue(doc, posX, capacitor->GetPosition().m_x);
113  auto posY = AppendNode(doc, position, "Y");
114  SetNodeValue(doc, posY, capacitor->GetPosition().m_y);
115  auto size = AppendNode(doc, cadProp, "Size");
116  auto width = AppendNode(doc, size, "Width");
117  SetNodeValue(doc, width, capacitor->GetWidth());
118  auto height = AppendNode(doc, size, "Height");
119  SetNodeValue(doc, height, capacitor->GetHeight());
120  auto angle = AppendNode(doc, cadProp, "Angle");
121  SetNodeValue(doc, angle, capacitor->GetAngle());
122  auto nodePos = AppendNode(doc, cadProp, "NodePosition");
123  auto nodePosX = AppendNode(doc, nodePos, "X");
124  SetNodeValue(doc, nodePosX, capacitor->GetPointList()[0].m_x);
125  auto nodePosY = AppendNode(doc, nodePos, "Y");
126  SetNodeValue(doc, nodePosY, capacitor->GetPointList()[0].m_y);
127  auto parentID = AppendNode(doc, cadProp, "ParentID");
128  Bus* parent = static_cast<Bus*>(capacitor->GetParentList()[0]);
129  if(parent) SetNodeValue(doc, parentID, parent->GetElectricalData().number);
130 
131  CapacitorElectricalData data = capacitor->GetElectricalData();
132  auto electricalProp = AppendNode(doc, capacitorNode, "ElectricalProperties");
133  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
134  SetNodeValue(doc, isOnline, capacitor->IsOnline());
135  auto name = AppendNode(doc, electricalProp, "Name");
136  SetNodeValue(doc, name, data.name);
137  auto reactivePower = AppendNode(doc, electricalProp, "ReactivePower");
138  SetNodeValue(doc, reactivePower, data.reactivePower);
139  SetNodeAttribute(doc, reactivePower, "UnitID", data.reactivePowerUnit);
140 
141  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
142  SwitchingData swData = capacitor->GetSwitchingData();
143  for(int j = 0; j < (int)swData.swType.size(); j++) {
144  auto switching = AppendNode(doc, switchingList, "Switching");
145  SetNodeAttribute(doc, switching, "ID", j);
146  auto swType = AppendNode(doc, switching, "Type");
147  SetNodeValue(doc, swType, swData.swType[j]);
148  auto swTime = AppendNode(doc, switching, "Time");
149  SetNodeValue(doc, swTime, swData.swTime[j]);
150  }
151  } //}
152 
153  //{ IndMotor
154  auto indMotorsNode = AppendNode(doc, elementsNode, "IndMotorList");
155  auto indMotorList = allElements.GetIndMotorList();
156  for(int i = 0; i < (int)indMotorList.size(); i++) {
157  IndMotor* indMotor = indMotorList[i];
158  auto indMotorNode = AppendNode(doc, indMotorsNode, "IndMotor");
159  SetNodeAttribute(doc, indMotorNode, "ID", i);
160  auto cadProp = AppendNode(doc, indMotorNode, "CADProperties");
161  auto position = AppendNode(doc, cadProp, "Position");
162  auto posX = AppendNode(doc, position, "X");
163  SetNodeValue(doc, posX, indMotor->GetPosition().m_x);
164  auto posY = AppendNode(doc, position, "Y");
165  SetNodeValue(doc, posY, indMotor->GetPosition().m_y);
166  auto size = AppendNode(doc, cadProp, "Size");
167  auto width = AppendNode(doc, size, "Width");
168  SetNodeValue(doc, width, indMotor->GetWidth());
169  auto height = AppendNode(doc, size, "Height");
170  SetNodeValue(doc, height, indMotor->GetHeight());
171  auto angle = AppendNode(doc, cadProp, "Angle");
172  SetNodeValue(doc, angle, indMotor->GetAngle());
173  auto nodePos = AppendNode(doc, cadProp, "NodePosition");
174  auto nodePosX = AppendNode(doc, nodePos, "X");
175  SetNodeValue(doc, nodePosX, indMotor->GetPointList()[0].m_x);
176  auto nodePosY = AppendNode(doc, nodePos, "Y");
177  SetNodeValue(doc, nodePosY, indMotor->GetPointList()[0].m_y);
178  auto parentID = AppendNode(doc, cadProp, "ParentID");
179  Bus* parent = static_cast<Bus*>(indMotor->GetParentList()[0]);
180  if(parent) SetNodeValue(doc, parentID, parent->GetElectricalData().number);
181 
182  IndMotorElectricalData data = indMotor->GetElectricalData();
183  auto electricalProp = AppendNode(doc, indMotorNode, "ElectricalProperties");
184  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
185  SetNodeValue(doc, isOnline, indMotor->IsOnline());
186  auto name = AppendNode(doc, electricalProp, "Name");
187  SetNodeValue(doc, name, data.name);
188  auto activePower = AppendNode(doc, electricalProp, "ActivePower");
189  SetNodeValue(doc, activePower, data.activePower);
190  SetNodeAttribute(doc, activePower, "UnitID", data.activePowerUnit);
191  auto reactivePower = AppendNode(doc, electricalProp, "ReactivePower");
192  SetNodeValue(doc, reactivePower, data.reactivePower);
193  SetNodeAttribute(doc, reactivePower, "UnitID", data.reactivePowerUnit);
194  } //}
195 
196  //{ Inductor
197  auto inductorsNode = AppendNode(doc, elementsNode, "InductorList");
198  auto inductorList = allElements.GetInductorList();
199  for(int i = 0; i < (int)inductorList.size(); i++) {
200  Inductor* inductor = inductorList[i];
201  auto inductorNode = AppendNode(doc, inductorsNode, "Inductor");
202  SetNodeAttribute(doc, inductorNode, "ID", i);
203  auto cadProp = AppendNode(doc, inductorNode, "CADProperties");
204  auto position = AppendNode(doc, cadProp, "Position");
205  auto posX = AppendNode(doc, position, "X");
206  SetNodeValue(doc, posX, inductor->GetPosition().m_x);
207  auto posY = AppendNode(doc, position, "Y");
208  SetNodeValue(doc, posY, inductor->GetPosition().m_y);
209  auto size = AppendNode(doc, cadProp, "Size");
210  auto width = AppendNode(doc, size, "Width");
211  SetNodeValue(doc, width, inductor->GetWidth());
212  auto height = AppendNode(doc, size, "Height");
213  SetNodeValue(doc, height, inductor->GetHeight());
214  auto angle = AppendNode(doc, cadProp, "Angle");
215  SetNodeValue(doc, angle, inductor->GetAngle());
216  auto nodePos = AppendNode(doc, cadProp, "NodePosition");
217  auto nodePosX = AppendNode(doc, nodePos, "X");
218  SetNodeValue(doc, nodePosX, inductor->GetPointList()[0].m_x);
219  auto nodePosY = AppendNode(doc, nodePos, "Y");
220  SetNodeValue(doc, nodePosY, inductor->GetPointList()[0].m_y);
221  auto parentID = AppendNode(doc, cadProp, "ParentID");
222  Bus* parent = static_cast<Bus*>(inductor->GetParentList()[0]);
223  if(parent) SetNodeValue(doc, parentID, parent->GetElectricalData().number);
224 
225  InductorElectricalData data = inductor->GetElectricalData();
226  auto electricalProp = AppendNode(doc, inductorNode, "ElectricalProperties");
227  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
228  SetNodeValue(doc, isOnline, inductor->IsOnline());
229  auto name = AppendNode(doc, electricalProp, "Name");
230  SetNodeValue(doc, name, data.name);
231  auto reactivePower = AppendNode(doc, electricalProp, "ReactivePower");
232  SetNodeValue(doc, reactivePower, data.reactivePower);
233  SetNodeAttribute(doc, reactivePower, "UnitID", data.reactivePowerUnit);
234 
235  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
236  SwitchingData swData = inductor->GetSwitchingData();
237  for(int j = 0; j < (int)swData.swType.size(); j++) {
238  auto switching = AppendNode(doc, switchingList, "Switching");
239  SetNodeAttribute(doc, switching, "ID", j);
240  auto swType = AppendNode(doc, switching, "Type");
241  SetNodeValue(doc, swType, swData.swType[j]);
242  auto swTime = AppendNode(doc, switching, "Time");
243  SetNodeValue(doc, swTime, swData.swTime[j]);
244  }
245  } //}
246 
247  //{ Line
248  auto linesNode = AppendNode(doc, elementsNode, "LineList");
249  auto lineList = allElements.GetLineList();
250  for(int i = 0; i < (int)lineList.size(); i++) {
251  Line* line = lineList[i];
252  auto lineNode = AppendNode(doc, linesNode, "Line");
253  SetNodeAttribute(doc, lineNode, "ID", i);
254  auto cadProp = AppendNode(doc, lineNode, "CADProperties");
255  auto nodeList = AppendNode(doc, cadProp, "NodeList");
256  auto ptList = line->GetPointList();
257  int nodeID = 0;
258  for(int j = 0; j < (int)ptList.size(); j++) {
259  if((j != 1) && (j != (int)ptList.size() - 2)) {
260  auto nodePos = AppendNode(doc, nodeList, "Node");
261  SetNodeAttribute(doc, nodePos, "ID", nodeID);
262  auto nodePosX = AppendNode(doc, nodePos, "X");
263  SetNodeValue(doc, nodePosX, ptList[j].m_x);
264  auto nodePosY = AppendNode(doc, nodePos, "Y");
265  SetNodeValue(doc, nodePosY, ptList[j].m_y);
266  nodeID++;
267  }
268  }
269 
270  auto parentIDList = AppendNode(doc, cadProp, "ParentIDList");
271  for(int j = 0; j < (int)line->GetParentList().size(); j++) {
272  Bus* parent = static_cast<Bus*>(line->GetParentList()[j]);
273  if(parent) {
274  auto parentID = AppendNode(doc, parentIDList, "ParentID");
275  SetNodeAttribute(doc, parentID, "ID", j);
276  SetNodeValue(doc, parentID, parent->GetElectricalData().number);
277  }
278  }
279 
280  LineElectricalData data = line->GetElectricalData();
281  auto electricalProp = AppendNode(doc, lineNode, "ElectricalProperties");
282  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
283  SetNodeValue(doc, isOnline, line->IsOnline());
284  auto name = AppendNode(doc, electricalProp, "Name");
285  SetNodeValue(doc, name, data.name);
286  auto nominalVoltage = AppendNode(doc, electricalProp, "NominalVoltage");
287  SetNodeValue(doc, nominalVoltage, data.nominalVoltage);
288  SetNodeAttribute(doc, nominalVoltage, "UnitID", data.nominalVoltageUnit);
289  auto nominalPower = AppendNode(doc, electricalProp, "NominalPower");
290  SetNodeValue(doc, nominalPower, data.nominalPower);
291  SetNodeAttribute(doc, nominalPower, "UnitID", data.nominalPowerUnit);
292  auto resistance = AppendNode(doc, electricalProp, "Resistance");
293  SetNodeValue(doc, resistance, data.resistance);
294  SetNodeAttribute(doc, resistance, "UnitID", data.resistanceUnit);
295  auto indReactance = AppendNode(doc, electricalProp, "IndReactance");
296  SetNodeValue(doc, indReactance, data.indReactance);
297  SetNodeAttribute(doc, indReactance, "UnitID", data.indReactanceUnit);
298  auto capSusceptance = AppendNode(doc, electricalProp, "CapSusceptance");
299  SetNodeValue(doc, capSusceptance, data.capSusceptance);
300  SetNodeAttribute(doc, capSusceptance, "UnitID", data.capSusceptanceUnit);
301  auto lineSize = AppendNode(doc, electricalProp, "LineSize");
302  SetNodeValue(doc, lineSize, data.lineSize);
303  auto useLinePower = AppendNode(doc, electricalProp, "UseLinePower");
304  SetNodeValue(doc, useLinePower, data.useLinePower);
305 
306  auto fault = AppendNode(doc, electricalProp, "Fault");
307  auto zeroResistance = AppendNode(doc, fault, "ZeroResistance");
308  SetNodeValue(doc, zeroResistance, data.zeroResistance);
309  auto zeroIndReactance = AppendNode(doc, fault, "ZeroIndReactance");
310  SetNodeValue(doc, zeroIndReactance, data.zeroIndReactance);
311  auto zeroCapSusceptance = AppendNode(doc, fault, "ZeroCapSusceptance");
312  SetNodeValue(doc, zeroCapSusceptance, data.zeroCapSusceptance);
313 
314  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
315  SwitchingData swData = line->GetSwitchingData();
316  for(int j = 0; j < (int)swData.swType.size(); j++) {
317  auto switching = AppendNode(doc, switchingList, "Switching");
318  SetNodeAttribute(doc, switching, "ID", j);
319  auto swType = AppendNode(doc, switching, "Type");
320  SetNodeValue(doc, swType, swData.swType[j]);
321  auto swTime = AppendNode(doc, switching, "Time");
322  SetNodeValue(doc, swTime, swData.swTime[j]);
323  }
324  } //}
325 
326  //{ Load
327  auto loadsNode = AppendNode(doc, elementsNode, "LoadList");
328  auto loadList = allElements.GetLoadList();
329  for(int i = 0; i < (int)loadList.size(); i++) {
330  Load* load = loadList[i];
331  auto loadNode = AppendNode(doc, loadsNode, "Load");
332  SetNodeAttribute(doc, loadNode, "ID", i);
333  auto cadProp = AppendNode(doc, loadNode, "CADProperties");
334  auto position = AppendNode(doc, cadProp, "Position");
335  auto posX = AppendNode(doc, position, "X");
336  SetNodeValue(doc, posX, load->GetPosition().m_x);
337  auto posY = AppendNode(doc, position, "Y");
338  SetNodeValue(doc, posY, load->GetPosition().m_y);
339  auto size = AppendNode(doc, cadProp, "Size");
340  auto width = AppendNode(doc, size, "Width");
341  SetNodeValue(doc, width, load->GetWidth());
342  auto height = AppendNode(doc, size, "Height");
343  SetNodeValue(doc, height, load->GetHeight());
344  auto angle = AppendNode(doc, cadProp, "Angle");
345  SetNodeValue(doc, angle, load->GetAngle());
346  auto nodePos = AppendNode(doc, cadProp, "NodePosition");
347  auto nodePosX = AppendNode(doc, nodePos, "X");
348  SetNodeValue(doc, nodePosX, load->GetPointList()[0].m_x);
349  auto nodePosY = AppendNode(doc, nodePos, "Y");
350  SetNodeValue(doc, nodePosY, load->GetPointList()[0].m_y);
351  auto parentID = AppendNode(doc, cadProp, "ParentID");
352  Bus* parent = static_cast<Bus*>(load->GetParentList()[0]);
353  if(parent) SetNodeValue(doc, parentID, parent->GetElectricalData().number);
354 
355  LoadElectricalData data = load->GetElectricalData();
356  auto electricalProp = AppendNode(doc, loadNode, "ElectricalProperties");
357  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
358  SetNodeValue(doc, isOnline, load->IsOnline());
359  auto name = AppendNode(doc, electricalProp, "Name");
360  SetNodeValue(doc, name, data.name);
361  auto activePower = AppendNode(doc, electricalProp, "ActivePower");
362  SetNodeValue(doc, activePower, data.activePower);
363  SetNodeAttribute(doc, activePower, "UnitID", data.activePowerUnit);
364  auto reactivePower = AppendNode(doc, electricalProp, "ReactivePower");
365  SetNodeValue(doc, reactivePower, data.reactivePower);
366  SetNodeAttribute(doc, reactivePower, "UnitID", data.reactivePowerUnit);
367  auto loadType = AppendNode(doc, electricalProp, "LoadType");
368  SetNodeValue(doc, loadType, data.loadType);
369 
370  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
371  SwitchingData swData = load->GetSwitchingData();
372  for(int j = 0; j < (int)swData.swType.size(); j++) {
373  auto switching = AppendNode(doc, switchingList, "Switching");
374  SetNodeAttribute(doc, switching, "ID", j);
375  auto swType = AppendNode(doc, switching, "Type");
376  SetNodeValue(doc, swType, swData.swType[j]);
377  auto swTime = AppendNode(doc, switching, "Time");
378  SetNodeValue(doc, swTime, swData.swTime[j]);
379  }
380  } //}
381 
382  //{ SyncGenerator
383  auto syncGeneratorsNode = AppendNode(doc, elementsNode, "SyncGeneratorList");
384  auto syncGeneratorList = allElements.GetSyncGeneratorList();
385  for(int i = 0; i < (int)syncGeneratorList.size(); i++) {
386  SyncGenerator* syncGenerator = syncGeneratorList[i];
387  auto syncGeneratorNode = AppendNode(doc, syncGeneratorsNode, "SyncGenerator");
388  SetNodeAttribute(doc, syncGeneratorNode, "ID", i);
389  auto cadProp = AppendNode(doc, syncGeneratorNode, "CADProperties");
390  auto position = AppendNode(doc, cadProp, "Position");
391  auto posX = AppendNode(doc, position, "X");
392  SetNodeValue(doc, posX, syncGenerator->GetPosition().m_x);
393  auto posY = AppendNode(doc, position, "Y");
394  SetNodeValue(doc, posY, syncGenerator->GetPosition().m_y);
395  auto size = AppendNode(doc, cadProp, "Size");
396  auto width = AppendNode(doc, size, "Width");
397  SetNodeValue(doc, width, syncGenerator->GetWidth());
398  auto height = AppendNode(doc, size, "Height");
399  SetNodeValue(doc, height, syncGenerator->GetHeight());
400  auto angle = AppendNode(doc, cadProp, "Angle");
401  SetNodeValue(doc, angle, syncGenerator->GetAngle());
402  auto nodePos = AppendNode(doc, cadProp, "NodePosition");
403  auto nodePosX = AppendNode(doc, nodePos, "X");
404  SetNodeValue(doc, nodePosX, syncGenerator->GetPointList()[0].m_x);
405  auto nodePosY = AppendNode(doc, nodePos, "Y");
406  SetNodeValue(doc, nodePosY, syncGenerator->GetPointList()[0].m_y);
407  auto parentID = AppendNode(doc, cadProp, "ParentID");
408  Bus* parent = static_cast<Bus*>(syncGenerator->GetParentList()[0]);
409  if(parent) SetNodeValue(doc, parentID, parent->GetElectricalData().number);
410 
411  SyncGeneratorElectricalData data = syncGenerator->GetElectricalData();
412  auto electricalProp = AppendNode(doc, syncGeneratorNode, "ElectricalProperties");
413  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
414  SetNodeValue(doc, isOnline, syncGenerator->IsOnline());
415  auto name = AppendNode(doc, electricalProp, "Name");
416  SetNodeValue(doc, name, data.name);
417  auto nominalPower = AppendNode(doc, electricalProp, "NominalPower");
418  SetNodeValue(doc, nominalPower, data.nominalPower);
419  SetNodeAttribute(doc, nominalPower, "UnitID", data.nominalPowerUnit);
420  auto nominalVoltage = AppendNode(doc, electricalProp, "NominalVoltage");
421  SetNodeValue(doc, nominalVoltage, data.nominalVoltage);
422  SetNodeAttribute(doc, nominalVoltage, "UnitID", data.nominalVoltageUnit);
423  auto activePower = AppendNode(doc, electricalProp, "ActivePower");
424  SetNodeValue(doc, activePower, data.activePower);
425  SetNodeAttribute(doc, activePower, "UnitID", data.activePowerUnit);
426  auto reactivePower = AppendNode(doc, electricalProp, "ReactivePower");
427  SetNodeValue(doc, reactivePower, data.reactivePower);
428  SetNodeAttribute(doc, reactivePower, "UnitID", data.reactivePowerUnit);
429  auto haveMaxReactive = AppendNode(doc, electricalProp, "HaveMaxReactive");
430  SetNodeValue(doc, haveMaxReactive, data.haveMaxReactive);
431  auto maxReactive = AppendNode(doc, electricalProp, "MaxReactive");
432  SetNodeValue(doc, maxReactive, data.maxReactive);
433  SetNodeAttribute(doc, maxReactive, "UnitID", data.maxReactiveUnit);
434  auto haveMinReactive = AppendNode(doc, electricalProp, "HaveMinReactive");
435  SetNodeValue(doc, haveMinReactive, data.haveMinReactive);
436  auto minReactive = AppendNode(doc, electricalProp, "MinReactive");
437  SetNodeValue(doc, minReactive, data.minReactive);
438  SetNodeAttribute(doc, minReactive, "UnitID", data.minReactiveUnit);
439  auto useMachineBase = AppendNode(doc, electricalProp, "UseMachineBase");
440  SetNodeValue(doc, useMachineBase, data.useMachineBase);
441 
442  auto fault = AppendNode(doc, electricalProp, "Fault");
443  auto positiveResistance = AppendNode(doc, fault, "PositiveResistance");
444  SetNodeValue(doc, positiveResistance, data.positiveResistance);
445  auto positiveReactance = AppendNode(doc, fault, "PositiveReactance");
446  SetNodeValue(doc, positiveReactance, data.positiveReactance);
447  auto negativeResistance = AppendNode(doc, fault, "NegativeResistance");
448  SetNodeValue(doc, negativeResistance, data.negativeResistance);
449  auto negativeReactance = AppendNode(doc, fault, "NegativeReactance");
450  SetNodeValue(doc, negativeReactance, data.negativeReactance);
451  auto zeroResistance = AppendNode(doc, fault, "ZeroResistance");
452  SetNodeValue(doc, zeroResistance, data.zeroResistance);
453  auto zeroReactance = AppendNode(doc, fault, "ZeroReactance");
454  SetNodeValue(doc, zeroReactance, data.zeroReactance);
455  auto groundResistance = AppendNode(doc, fault, "GroundResistance");
456  SetNodeValue(doc, groundResistance, data.groundResistance);
457  auto groundReactance = AppendNode(doc, fault, "GroundReactance");
458  SetNodeValue(doc, groundReactance, data.groundReactance);
459  auto groundNeutral = AppendNode(doc, fault, "GroundNeutral");
460  SetNodeValue(doc, groundNeutral, data.groundNeutral);
461 
462  auto stability = AppendNode(doc, electricalProp, "Stability");
463  auto plotSyncMachine = AppendNode(doc, stability, "PlotSyncMachine");
464  SetNodeValue(doc, plotSyncMachine, data.plotSyncMachine);
465  auto inertia = AppendNode(doc, stability, "Inertia");
466  SetNodeValue(doc, inertia, data.inertia);
467  auto damping = AppendNode(doc, stability, "Damping");
468  SetNodeValue(doc, damping, data.damping);
469  auto useAVR = AppendNode(doc, stability, "UseAVR");
470  SetNodeValue(doc, useAVR, data.useAVR);
471  auto useSpeedGovernor = AppendNode(doc, stability, "UseSpeedGovernor");
472  SetNodeValue(doc, useSpeedGovernor, data.useSpeedGovernor);
473  auto armResistance = AppendNode(doc, stability, "ArmResistance");
474  SetNodeValue(doc, armResistance, data.armResistance);
475  auto potierReactance = AppendNode(doc, stability, "PotierReactance");
476  SetNodeValue(doc, potierReactance, data.potierReactance);
477  auto satFactor = AppendNode(doc, stability, "SatFactor");
478  SetNodeValue(doc, satFactor, data.satFactor);
479  auto syncXd = AppendNode(doc, stability, "SyncXd");
480  SetNodeValue(doc, syncXd, data.syncXd);
481  auto syncXq = AppendNode(doc, stability, "SyncXq");
482  SetNodeValue(doc, syncXq, data.syncXq);
483  auto transXd = AppendNode(doc, stability, "TransXd");
484  SetNodeValue(doc, transXd, data.transXd);
485  auto transXq = AppendNode(doc, stability, "TransXq");
486  SetNodeValue(doc, transXq, data.transXq);
487  auto transTd0 = AppendNode(doc, stability, "TransTd0");
488  SetNodeValue(doc, transTd0, data.transTd0);
489  auto transTq0 = AppendNode(doc, stability, "TransTq0");
490  SetNodeValue(doc, transTq0, data.transTq0);
491  auto subXd = AppendNode(doc, stability, "SubXd");
492  SetNodeValue(doc, subXd, data.subXd);
493  auto subXq = AppendNode(doc, stability, "SubXq");
494  SetNodeValue(doc, subXq, data.subXq);
495  auto subTd0 = AppendNode(doc, stability, "SubTd0");
496  SetNodeValue(doc, subTd0, data.subTd0);
497  auto subTq0 = AppendNode(doc, stability, "SubTq0");
498  SetNodeValue(doc, subTq0, data.subTq0);
499 
500  auto avr = AppendNode(doc, stability, "AVR");
501  if(data.avr) SaveControlElements(doc, avr, data.avr);
502 
503  auto speedGov = AppendNode(doc, stability, "SpeedGovernor");
504  if(data.speedGov) SaveControlElements(doc, speedGov, data.speedGov);
505 
506  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
507  SwitchingData swData = syncGenerator->GetSwitchingData();
508  for(int j = 0; j < (int)swData.swType.size(); j++) {
509  auto switching = AppendNode(doc, switchingList, "Switching");
510  SetNodeAttribute(doc, switching, "ID", j);
511  auto swType = AppendNode(doc, switching, "Type");
512  SetNodeValue(doc, swType, swData.swType[j]);
513  auto swTime = AppendNode(doc, switching, "Time");
514  SetNodeValue(doc, swTime, swData.swTime[j]);
515  }
516  } //}
517 
518  //{ SyncMotor
519  auto syncMotorsNode = AppendNode(doc, elementsNode, "SyncMotorList");
520  auto syncMotorList = allElements.GetSyncMotorList();
521  for(int i = 0; i < (int)syncMotorList.size(); i++) {
522  SyncMotor* syncMotor = syncMotorList[i];
523  auto syncMotorNode = AppendNode(doc, syncMotorsNode, "SyncMotor");
524  SetNodeAttribute(doc, syncMotorNode, "ID", i);
525  auto cadProp = AppendNode(doc, syncMotorNode, "CADProperties");
526  auto position = AppendNode(doc, cadProp, "Position");
527  auto posX = AppendNode(doc, position, "X");
528  SetNodeValue(doc, posX, syncMotor->GetPosition().m_x);
529  auto posY = AppendNode(doc, position, "Y");
530  SetNodeValue(doc, posY, syncMotor->GetPosition().m_y);
531  auto size = AppendNode(doc, cadProp, "Size");
532  auto width = AppendNode(doc, size, "Width");
533  SetNodeValue(doc, width, syncMotor->GetWidth());
534  auto height = AppendNode(doc, size, "Height");
535  SetNodeValue(doc, height, syncMotor->GetHeight());
536  auto angle = AppendNode(doc, cadProp, "Angle");
537  SetNodeValue(doc, angle, syncMotor->GetAngle());
538  auto nodePos = AppendNode(doc, cadProp, "NodePosition");
539  auto nodePosX = AppendNode(doc, nodePos, "X");
540  SetNodeValue(doc, nodePosX, syncMotor->GetPointList()[0].m_x);
541  auto nodePosY = AppendNode(doc, nodePos, "Y");
542  SetNodeValue(doc, nodePosY, syncMotor->GetPointList()[0].m_y);
543  auto parentID = AppendNode(doc, cadProp, "ParentID");
544  Bus* parent = static_cast<Bus*>(syncMotor->GetParentList()[0]);
545  if(parent) SetNodeValue(doc, parentID, parent->GetElectricalData().number);
546 
547  SyncMotorElectricalData data = syncMotor->GetElectricalData();
548  auto electricalProp = AppendNode(doc, syncMotorNode, "ElectricalProperties");
549  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
550  SetNodeValue(doc, isOnline, syncMotor->IsOnline());
551  auto name = AppendNode(doc, electricalProp, "Name");
552  SetNodeValue(doc, name, data.name);
553  auto nominalPower = AppendNode(doc, electricalProp, "NominalPower");
554  SetNodeValue(doc, nominalPower, data.nominalPower);
555  SetNodeAttribute(doc, nominalPower, "UnitID", data.nominalPowerUnit);
556  // auto nominalVoltage = AppendNode(doc, electricalProp, "NominalVoltage");
557  // SetNodeValue(doc, nominalVoltage, data.nominalVoltage);
558  // SetNodeAttribute(doc, nominalVoltage, "UnitID", data.nominalVoltageUnit);
559  auto activePower = AppendNode(doc, electricalProp, "ActivePower");
560  SetNodeValue(doc, activePower, data.activePower);
561  SetNodeAttribute(doc, activePower, "UnitID", data.activePowerUnit);
562  auto reactivePower = AppendNode(doc, electricalProp, "ReactivePower");
563  SetNodeValue(doc, reactivePower, data.reactivePower);
564  SetNodeAttribute(doc, reactivePower, "UnitID", data.reactivePowerUnit);
565  auto haveMaxReactive = AppendNode(doc, electricalProp, "HaveMaxReactive");
566  SetNodeValue(doc, haveMaxReactive, data.haveMaxReactive);
567  auto maxReactive = AppendNode(doc, electricalProp, "MaxReactive");
568  SetNodeValue(doc, maxReactive, data.maxReactive);
569  SetNodeAttribute(doc, maxReactive, "UnitID", data.maxReactiveUnit);
570  auto haveMinReactive = AppendNode(doc, electricalProp, "HaveMinReactive");
571  SetNodeValue(doc, haveMinReactive, data.haveMinReactive);
572  auto minReactive = AppendNode(doc, electricalProp, "MinReactive");
573  SetNodeValue(doc, minReactive, data.minReactive);
574  SetNodeAttribute(doc, minReactive, "UnitID", data.minReactiveUnit);
575  auto useMachineBase = AppendNode(doc, electricalProp, "UseMachineBase");
576  SetNodeValue(doc, useMachineBase, data.useMachineBase);
577 
578  auto fault = AppendNode(doc, electricalProp, "Fault");
579  auto positiveResistance = AppendNode(doc, fault, "PositiveResistance");
580  SetNodeValue(doc, positiveResistance, data.positiveResistance);
581  auto positiveReactance = AppendNode(doc, fault, "PositiveReactance");
582  SetNodeValue(doc, positiveReactance, data.positiveReactance);
583  auto negativeResistance = AppendNode(doc, fault, "NegativeResistance");
584  SetNodeValue(doc, negativeResistance, data.negativeResistance);
585  auto negativeReactance = AppendNode(doc, fault, "NegativeReactance");
586  SetNodeValue(doc, negativeReactance, data.negativeReactance);
587  auto zeroResistance = AppendNode(doc, fault, "ZeroResistance");
588  SetNodeValue(doc, zeroResistance, data.zeroResistance);
589  auto zeroReactance = AppendNode(doc, fault, "ZeroReactance");
590  SetNodeValue(doc, zeroReactance, data.zeroReactance);
591  auto groundResistance = AppendNode(doc, fault, "GroundResistance");
592  SetNodeValue(doc, groundResistance, data.groundResistance);
593  auto groundReactance = AppendNode(doc, fault, "GroundReactance");
594  SetNodeValue(doc, groundReactance, data.groundReactance);
595  auto groundNeutral = AppendNode(doc, fault, "GroundNeutral");
596  SetNodeValue(doc, groundNeutral, data.groundNeutral);
597 
598  // To future use...
599  /*auto stability = AppendNode(doc, electricalProp, "Stability");
600  auto plotSyncMachine = AppendNode(doc, stability, "PlotSyncMotor");
601  SetNodeValue(doc, plotSyncMachine, data.plotSyncMachine);
602  auto inertia = AppendNode(doc, stability, "Inertia");
603  SetNodeValue(doc, inertia, data.inertia);
604  auto damping = AppendNode(doc, stability, "Damping");
605  SetNodeValue(doc, damping, data.damping);
606  auto useAVR = AppendNode(doc, stability, "UseAVR");
607  SetNodeValue(doc, useAVR, data.useAVR);
608  auto armResistance = AppendNode(doc, stability, "ArmResistance");
609  SetNodeValue(doc, armResistance, data.armResistance);
610  auto potierReactance = AppendNode(doc, stability, "PotierReactance");
611  SetNodeValue(doc, potierReactance, data.potierReactance);
612  auto satFactor = AppendNode(doc, stability, "SatFactor");
613  SetNodeValue(doc, satFactor, data.satFactor);
614  auto syncXd = AppendNode(doc, stability, "SyncXd");
615  SetNodeValue(doc, syncXd, data.syncXd);
616  auto syncXq = AppendNode(doc, stability, "SyncXq");
617  SetNodeValue(doc, syncXq, data.syncXq);
618  auto transXd = AppendNode(doc, stability, "TransXd");
619  SetNodeValue(doc, transXd, data.transXd);
620  auto transXq = AppendNode(doc, stability, "TransXq");
621  SetNodeValue(doc, transXq, data.transXq);
622  auto transTd0 = AppendNode(doc, stability, "TransTd0");
623  SetNodeValue(doc, transTd0, data.transTd0);
624  auto transTq0 = AppendNode(doc, stability, "TransTq0");
625  SetNodeValue(doc, transTq0, data.transTq0);
626  auto subXd = AppendNode(doc, stability, "SubXd");
627  SetNodeValue(doc, subXd, data.subXd);
628  auto subXq = AppendNode(doc, stability, "SubXq");
629  SetNodeValue(doc, subXq, data.subXq);
630  auto subTd0 = AppendNode(doc, stability, "SubTd0");
631  SetNodeValue(doc, subTd0, data.subTd0);
632  auto subTq0 = AppendNode(doc, stability, "SubTq0");
633  SetNodeValue(doc, subTq0, data.subTq0);
634 
635  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
636  SwitchingData swData = syncGenerator->GetSwitchingData();
637  for(int j = 0; j < (int)swData.swType.size(); j++) {
638  auto switching = AppendNode(doc, switchingList, "Switching");
639  SetNodeAttribute(doc, switching, "ID", j);
640  auto swType = AppendNode(doc, switching, "Type");
641  SetNodeValue(doc, swType, swData.swType[j]);
642  auto swTime = AppendNode(doc, switching, "Time");
643  SetNodeValue(doc, swTime, swData.swTime[j]);
644  }*/
645  } //}
646 
647  //{ Transfomer
648  auto transformersNode = AppendNode(doc, elementsNode, "TransformerList");
649  auto transformerList = allElements.GetTransformerList();
650  for(int i = 0; i < (int)transformerList.size(); i++) {
651  Transformer* transfomer = transformerList[i];
652  auto transformerNode = AppendNode(doc, transformersNode, "Transfomer");
653  SetNodeAttribute(doc, transformerNode, "ID", i);
654  auto cadProp = AppendNode(doc, transformerNode, "CADProperties");
655  auto position = AppendNode(doc, cadProp, "Position");
656  auto posX = AppendNode(doc, position, "X");
657  SetNodeValue(doc, posX, transfomer->GetPosition().m_x);
658  auto posY = AppendNode(doc, position, "Y");
659  SetNodeValue(doc, posY, transfomer->GetPosition().m_y);
660  auto size = AppendNode(doc, cadProp, "Size");
661  auto width = AppendNode(doc, size, "Width");
662  SetNodeValue(doc, width, transfomer->GetWidth());
663  auto height = AppendNode(doc, size, "Height");
664  SetNodeValue(doc, height, transfomer->GetHeight());
665  auto angle = AppendNode(doc, cadProp, "Angle");
666  SetNodeValue(doc, angle, transfomer->GetAngle());
667  auto nodeList = AppendNode(doc, cadProp, "NodeList");
668  auto nodePos1 = AppendNode(doc, nodeList, "Node");
669  SetNodeAttribute(doc, nodePos1, "ID", 0);
670  auto nodePosX1 = AppendNode(doc, nodePos1, "X");
671  SetNodeValue(doc, nodePosX1, transfomer->GetPointList()[0].m_x);
672  auto nodePosY1 = AppendNode(doc, nodePos1, "Y");
673  SetNodeValue(doc, nodePosY1, transfomer->GetPointList()[0].m_y);
674  auto nodePos2 = AppendNode(doc, nodeList, "Node");
675  SetNodeAttribute(doc, nodePos2, "ID", 1);
676  auto nodePosX2 = AppendNode(doc, nodePos2, "X");
677  SetNodeValue(doc, nodePosX2, transfomer->GetPointList()[transfomer->GetPointList().size() - 1].m_x);
678  auto nodePosY2 = AppendNode(doc, nodePos2, "Y");
679  SetNodeValue(doc, nodePosY2, transfomer->GetPointList()[transfomer->GetPointList().size() - 1].m_y);
680 
681  auto parentIDList = AppendNode(doc, cadProp, "ParentIDList");
682  for(int j = 0; j < (int)transfomer->GetParentList().size(); j++) {
683  Bus* parent = static_cast<Bus*>(transfomer->GetParentList()[j]);
684  if(parent) {
685  auto parentID = AppendNode(doc, parentIDList, "ParentID");
686  SetNodeAttribute(doc, parentID, "ID", j);
687  SetNodeValue(doc, parentID, parent->GetElectricalData().number);
688  }
689  }
690 
691  TransformerElectricalData data = transfomer->GetElectricalData();
692  auto electricalProp = AppendNode(doc, transformerNode, "ElectricalProperties");
693  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
694  SetNodeValue(doc, isOnline, transfomer->IsOnline());
695  auto name = AppendNode(doc, electricalProp, "Name");
696  SetNodeValue(doc, name, data.name);
697  auto primaryNominalVoltage = AppendNode(doc, electricalProp, "PrimaryNominalVoltage");
698  SetNodeValue(doc, primaryNominalVoltage, data.primaryNominalVoltage);
699  SetNodeAttribute(doc, primaryNominalVoltage, "UnitID", data.primaryNominalVoltageUnit);
700  auto secondaryNominalVoltage = AppendNode(doc, electricalProp, "SecondaryNominalVoltage");
701  SetNodeValue(doc, secondaryNominalVoltage, data.secondaryNominalVoltage);
702  SetNodeAttribute(doc, secondaryNominalVoltage, "UnitID", data.secondaryNominalVoltageUnit);
703  auto nominalPower = AppendNode(doc, electricalProp, "NominalPower");
704  SetNodeValue(doc, nominalPower, data.nominalPower);
705  SetNodeAttribute(doc, nominalPower, "UnitID", data.nominalPowerUnit);
706  auto resistance = AppendNode(doc, electricalProp, "Resistance");
707  SetNodeValue(doc, resistance, data.resistance);
708  SetNodeAttribute(doc, resistance, "UnitID", data.resistanceUnit);
709  auto indReactance = AppendNode(doc, electricalProp, "IndReactance");
710  SetNodeValue(doc, indReactance, data.indReactance);
711  SetNodeAttribute(doc, indReactance, "UnitID", data.indReactanceUnit);
712  auto connection = AppendNode(doc, electricalProp, "Connection");
713  SetNodeValue(doc, connection, data.connection);
714  auto turnsRatio = AppendNode(doc, electricalProp, "TurnsRatio");
715  SetNodeValue(doc, turnsRatio, data.turnsRatio);
716  auto phaseShift = AppendNode(doc, electricalProp, "PhaseShift");
717  SetNodeValue(doc, phaseShift, data.phaseShift);
718  auto useTransformerPower = AppendNode(doc, electricalProp, "UseTransfomerPower");
719  SetNodeValue(doc, useTransformerPower, data.useTransformerPower);
720 
721  auto fault = AppendNode(doc, electricalProp, "Fault");
722  auto zeroResistance = AppendNode(doc, fault, "ZeroResistance");
723  SetNodeValue(doc, zeroResistance, data.zeroResistance);
724  auto zeroIndReactance = AppendNode(doc, fault, "ZeroIndReactance");
725  SetNodeValue(doc, zeroIndReactance, data.zeroIndReactance);
726  auto primaryGrndResistance = AppendNode(doc, fault, "PrimaryGrndResistance");
727  SetNodeValue(doc, primaryGrndResistance, data.primaryGrndResistance);
728  auto primaryGrndReactance = AppendNode(doc, fault, "PrimaryGrndReactance");
729  SetNodeValue(doc, primaryGrndReactance, data.primaryGrndReactance);
730  auto secondaryGrndResistance = AppendNode(doc, fault, "SecondaryGrndResistance");
731  SetNodeValue(doc, secondaryGrndResistance, data.secondaryGrndResistance);
732  auto secondaryGrndReactance = AppendNode(doc, fault, "SecondaryGrndReactance");
733  SetNodeValue(doc, secondaryGrndReactance, data.secondaryGrndReactance);
734 
735  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
736  SwitchingData swData = transfomer->GetSwitchingData();
737  for(int j = 0; j < (int)swData.swType.size(); j++) {
738  auto switching = AppendNode(doc, switchingList, "Switching");
739  SetNodeAttribute(doc, switching, "ID", j);
740  auto swType = AppendNode(doc, switching, "Type");
741  SetNodeValue(doc, swType, swData.swType[j]);
742  auto swTime = AppendNode(doc, switching, "Time");
743  SetNodeValue(doc, swTime, swData.swTime[j]);
744  }
745  } //}
746 
747  //{ Text
748  auto textsNode = AppendNode(doc, elementsNode, "TextList");
749  auto textList = m_workspace->GetTextList();
750  for(int i = 0; i < (int)textList.size(); i++) {
751  Text* text = textList[i];
752  auto textNode = AppendNode(doc, textsNode, "Text");
753  SetNodeAttribute(doc, textNode, "ID", i);
754  auto cadProp = AppendNode(doc, textNode, "CADProperties");
755  auto position = AppendNode(doc, cadProp, "Position");
756  auto posX = AppendNode(doc, position, "X");
757  SetNodeValue(doc, posX, text->GetPosition().m_x);
758  auto posY = AppendNode(doc, position, "Y");
759  SetNodeValue(doc, posY, text->GetPosition().m_y);
760  auto size = AppendNode(doc, cadProp, "Size");
761  auto width = AppendNode(doc, size, "Width");
762  SetNodeValue(doc, width, text->GetWidth());
763  auto height = AppendNode(doc, size, "Height");
764  SetNodeValue(doc, height, text->GetHeight());
765  auto angle = AppendNode(doc, cadProp, "Angle");
766  SetNodeValue(doc, angle, text->GetAngle());
767  auto textProperties = AppendNode(doc, textNode, "TextProperties");
768  auto elementType = AppendNode(doc, textProperties, "ElementType");
769  SetNodeValue(doc, elementType, text->GetElementType());
770  auto elementNumber = AppendNode(doc, textProperties, "ElementNumber");
771  SetNodeValue(doc, elementNumber, text->GetElementNumber());
772  auto dataType = AppendNode(doc, textProperties, "DataType");
773  SetNodeValue(doc, dataType, text->GetDataType());
774  auto dataUnit = AppendNode(doc, textProperties, "DataUnit");
775  SetNodeValue(doc, dataUnit, text->GetUnit());
776  auto direction = AppendNode(doc, textProperties, "Direction");
777  SetNodeValue(doc, direction, text->GetDirection());
778  auto decimalPlaces = AppendNode(doc, textProperties, "DecimalPlaces");
779  SetNodeValue(doc, decimalPlaces, text->GetDecimalPlaces());
780  }
781  //}
782 
783  std::ofstream writeXML(path.GetFullPath());
784  writeXML << doc;
785  writeXML.close();
786 }
787 
788 bool FileHanding::OpenProject(wxFileName path)
789 {
790  rapidxml::xml_document<> doc;
791  rapidxml::file<> xmlFile(path.GetFullPath().mb_str());
792 
793  doc.parse<0>(xmlFile.data());
794 
795  auto projectNode = doc.first_node("Project");
796  if(!projectNode) return false;
797  auto nameNode = projectNode->first_node("Name");
798  if(!nameNode) return false;
799  m_workspace->SetName(nameNode->value());
800 
801  // Open elements
802  auto elementsNode = projectNode->first_node("Elements");
803  if(!elementsNode) return false;
804  std::vector<Element*> elementList;
805  // Save lists individually to get parents
806  std::vector<Bus*> busList;
807  std::vector<Capacitor*> capacitorList;
808  std::vector<IndMotor*> indMotorList;
809  std::vector<Inductor*> inductorList;
810  std::vector<Line*> lineList;
811  std::vector<Load*> loadList;
812  std::vector<SyncGenerator*> syncGeneratorList;
813  std::vector<SyncMotor*> syncMotorList;
814  std::vector<Transformer*> transformerList;
815  std::vector<Text*> textList;
816 
817  //{ Bus
818  auto busListNode = elementsNode->first_node("BusList");
819  if(!busListNode) return false;
820  auto busNode = busListNode->first_node("Bus");
821  while(busNode) {
822  auto cadPropNode = busNode->first_node("CADProperties");
823  if(!cadPropNode) return false;
824 
825  auto position = cadPropNode->first_node("Position");
826  double posX = GetNodeValueDouble(position, "X");
827  double posY = GetNodeValueDouble(position, "Y");
828  Bus* bus = new Bus(wxPoint2DDouble(posX, posY));
829 
830  auto size = cadPropNode->first_node("Size");
831  double width = GetNodeValueDouble(size, "Width");
832  double height = GetNodeValueDouble(size, "Height");
833  double angle = GetNodeValueDouble(cadPropNode, "Angle");
834  bus->SetWidth(width);
835  bus->SetHeight(height);
836  bus->SetPosition(bus->GetPosition()); // Update bus rectangle.
837  int numRot = angle / bus->GetRotationAngle();
838  bool clockwise = true;
839  if(numRot < 0) {
840  numRot = std::abs(numRot);
841  clockwise = false;
842  }
843  for(int i = 0; i < numRot; i++) bus->Rotate(clockwise);
844 
845  BusElectricalData data = bus->GetElectricalData();
846  auto electricalProp = busNode->first_node("ElectricalProperties");
847  if(!electricalProp) return false;
848 
849  data.name = electricalProp->first_node("Name")->value();
850  data.nominalVoltage = GetNodeValueDouble(electricalProp, "NominalVoltage");
851  data.nominalVoltageUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalVoltage", "UnitID");
852  data.isVoltageControlled = GetNodeValueInt(electricalProp, "IsVoltageControlled");
853  data.controlledVoltage = GetNodeValueDouble(electricalProp, "ControlledVoltage");
854  data.controlledVoltageUnitChoice = GetAttributeValueInt(electricalProp, "ControlledVoltage", "Choice");
855  data.slackBus = GetNodeValueInt(electricalProp, "SlackBus");
856  auto fault = electricalProp->first_node("Fault");
857  data.hasFault = GetNodeValueInt(fault, "HasFault");
858  data.faultType = (FaultData)GetNodeValueInt(fault, "Type");
859  data.faultLocation = (FaultData)GetNodeValueInt(fault, "Location");
860  data.faultResistance = GetNodeValueDouble(fault, "Resistance");
861  data.faultReactance = GetNodeValueDouble(fault, "Reactance");
862  auto stability = electricalProp->first_node("Stability");
863  data.plotBus = GetNodeValueInt(stability, "Plot");
864  data.stabHasFault = GetNodeValueInt(stability, "HasFault");
865  data.stabFaultTime = GetNodeValueDouble(stability, "FaultTime");
866  data.stabFaultLength = GetNodeValueDouble(stability, "FaultLength");
867  data.stabFaultResistance = GetNodeValueDouble(stability, "FaultResistance");
868  data.stabFaultReactance = GetNodeValueDouble(stability, "FaultReactance");
869 
870  bus->SetElectricalData(data);
871 
872  if(data.stabHasFault) bus->SetDynamicEvent(true);
873 
874  elementList.push_back(bus);
875  busList.push_back(bus);
876  busNode = busNode->next_sibling("Bus");
877  } //}
878 
879  //{ Capacitor
880  auto capacitorListNode = elementsNode->first_node("CapacitorList");
881  if(!capacitorListNode) return false;
882  auto capacitorNode = capacitorListNode->first_node("Capacitor");
883  while(capacitorNode) {
884  Capacitor* capacitor = new Capacitor();
885 
886  auto cadPropNode = capacitorNode->first_node("CADProperties");
887  if(!cadPropNode) return false;
888 
889  auto position = cadPropNode->first_node("Position");
890  double posX = GetNodeValueDouble(position, "X");
891  double posY = GetNodeValueDouble(position, "Y");
892  auto size = cadPropNode->first_node("Size");
893  double width = GetNodeValueDouble(size, "Width");
894  double height = GetNodeValueDouble(size, "Height");
895  double angle = GetNodeValueDouble(cadPropNode, "Angle");
896  auto nodePosition = cadPropNode->first_node("NodePosition");
897  double nodePosX = GetNodeValueDouble(nodePosition, "X");
898  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
899  int parentID = GetNodeValueInt(cadPropNode, "ParentID");
900  if(parentID == -1) {
901  // If the element has no parent, create a temporary one, remove and delete.
902  Bus* parent = new Bus(wxPoint2DDouble(nodePosX, nodePosY));
903  capacitor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
904  capacitor->StartMove(capacitor->GetPosition());
905  capacitor->Move(wxPoint2DDouble(posX, posY));
906  capacitor->RemoveParent(parent);
907  delete parent;
908  } else {
909  Bus* parent = busList[parentID];
910  capacitor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
911  capacitor->StartMove(capacitor->GetPosition());
912  capacitor->Move(wxPoint2DDouble(posX, posY));
913  }
914  capacitor->SetWidth(width);
915  capacitor->SetHeight(height);
916 
917  int numRot = angle / capacitor->GetRotationAngle();
918  bool clockwise = true;
919  if(numRot < 0) {
920  numRot = std::abs(numRot);
921  clockwise = false;
922  }
923  for(int i = 0; i < numRot; i++) capacitor->Rotate(clockwise);
924 
925  auto electricalProp = capacitorNode->first_node("ElectricalProperties");
926  if(!electricalProp) return false;
927 
928  capacitor->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
929  CapacitorElectricalData data = capacitor->GetElectricalData();
930  data.name = electricalProp->first_node("Name")->value();
931  data.reactivePower = GetNodeValueDouble(electricalProp, "ReactivePower");
932  data.reactivePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID");
933 
934  SwitchingData swData;
935  auto switchingList = electricalProp->first_node("SwitchingList");
936  if(!switchingList) return false;
937  auto swNode = switchingList->first_node("Switching");
938  while(swNode) {
939  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
940  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
941  swNode = swNode->next_sibling("Switching");
942  }
943  capacitor->SetSwitchingData(swData);
944 
945  capacitor->SetElectricalData(data);
946 
947  if(swData.swTime.size() != 0) capacitor->SetDynamicEvent(true);
948 
949  elementList.push_back(capacitor);
950  capacitorList.push_back(capacitor);
951  capacitorNode = capacitorNode->next_sibling("Capacitor");
952  } //}
953 
954  //{ IndMotor
955  auto indMotorListNode = elementsNode->first_node("IndMotorList");
956  if(!indMotorListNode) return false;
957  auto indMotorNode = indMotorListNode->first_node("IndMotor");
958  while(indMotorNode) {
959  IndMotor* indMotor = new IndMotor();
960 
961  auto cadPropNode = indMotorNode->first_node("CADProperties");
962  if(!cadPropNode) return false;
963 
964  auto position = cadPropNode->first_node("Position");
965  double posX = GetNodeValueDouble(position, "X");
966  double posY = GetNodeValueDouble(position, "Y");
967  auto size = cadPropNode->first_node("Size");
968  double width = GetNodeValueDouble(size, "Width");
969  double height = GetNodeValueDouble(size, "Height");
970  double angle = GetNodeValueDouble(cadPropNode, "Angle");
971  auto nodePosition = cadPropNode->first_node("NodePosition");
972  double nodePosX = GetNodeValueDouble(nodePosition, "X");
973  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
974  int parentID = GetNodeValueInt(cadPropNode, "ParentID");
975  if(parentID == -1) {
976  // If the element has no parent, create a temporary one, remove and delete.
977  Bus* parent = new Bus(wxPoint2DDouble(nodePosX, nodePosY));
978  indMotor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
979  indMotor->StartMove(indMotor->GetPosition());
980  indMotor->Move(wxPoint2DDouble(posX, posY));
981  indMotor->RemoveParent(parent);
982  delete parent;
983  } else {
984  Bus* parent = busList[parentID];
985  indMotor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
986  indMotor->StartMove(indMotor->GetPosition());
987  indMotor->Move(wxPoint2DDouble(posX, posY));
988  }
989  indMotor->SetWidth(width);
990  indMotor->SetHeight(height);
991 
992  int numRot = angle / indMotor->GetRotationAngle();
993  bool clockwise = true;
994  if(numRot < 0) {
995  numRot = std::abs(numRot);
996  clockwise = false;
997  }
998  for(int i = 0; i < numRot; i++) indMotor->Rotate(clockwise);
999 
1000  auto electricalProp = indMotorNode->first_node("ElectricalProperties");
1001  if(!electricalProp) return false;
1002 
1003  indMotor->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1004  IndMotorElectricalData data = indMotor->GetElectricalData();
1005  data.name = electricalProp->first_node("Name")->value();
1006  data.activePower = GetNodeValueDouble(electricalProp, "ActivePower");
1007  data.activePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ActivePower", "UnitID");
1008  data.reactivePower = GetNodeValueDouble(electricalProp, "ReactivePower");
1009  data.reactivePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID");
1010 
1011  indMotor->SetElectricalData(data);
1012  elementList.push_back(indMotor);
1013  indMotorList.push_back(indMotor);
1014  indMotorNode = indMotorNode->next_sibling("IndMotor");
1015  } //}
1016 
1017  //{ Inductor
1018  auto inductorListNode = elementsNode->first_node("InductorList");
1019  if(!inductorListNode) return false;
1020  auto inductorNode = inductorListNode->first_node("Inductor");
1021  while(inductorNode) {
1022  Inductor* inductor = new Inductor();
1023 
1024  auto cadPropNode = inductorNode->first_node("CADProperties");
1025  if(!cadPropNode) return false;
1026 
1027  auto position = cadPropNode->first_node("Position");
1028  double posX = GetNodeValueDouble(position, "X");
1029  double posY = GetNodeValueDouble(position, "Y");
1030  auto size = cadPropNode->first_node("Size");
1031  double width = GetNodeValueDouble(size, "Width");
1032  double height = GetNodeValueDouble(size, "Height");
1033  double angle = GetNodeValueDouble(cadPropNode, "Angle");
1034  auto nodePosition = cadPropNode->first_node("NodePosition");
1035  double nodePosX = GetNodeValueDouble(nodePosition, "X");
1036  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
1037  int parentID = GetNodeValueInt(cadPropNode, "ParentID");
1038  if(parentID == -1) {
1039  // If the element has no parent, create a temporary one, remove and delete.
1040  Bus* parent = new Bus(wxPoint2DDouble(nodePosX, nodePosY));
1041  inductor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1042  inductor->StartMove(inductor->GetPosition());
1043  inductor->Move(wxPoint2DDouble(posX, posY));
1044  inductor->RemoveParent(parent);
1045  delete parent;
1046  } else {
1047  Bus* parent = busList[parentID];
1048  inductor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1049  inductor->StartMove(inductor->GetPosition());
1050  inductor->Move(wxPoint2DDouble(posX, posY));
1051  }
1052  inductor->SetWidth(width);
1053  inductor->SetHeight(height);
1054 
1055  int numRot = angle / inductor->GetRotationAngle();
1056  bool clockwise = true;
1057  if(numRot < 0) {
1058  numRot = std::abs(numRot);
1059  clockwise = false;
1060  }
1061  for(int i = 0; i < numRot; i++) inductor->Rotate(clockwise);
1062 
1063  auto electricalProp = inductorNode->first_node("ElectricalProperties");
1064  if(!electricalProp) return false;
1065 
1066  inductor->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1067  InductorElectricalData data = inductor->GetElectricalData();
1068  data.name = electricalProp->first_node("Name")->value();
1069  data.reactivePower = GetNodeValueDouble(electricalProp, "ReactivePower");
1070  data.reactivePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID");
1071 
1072  SwitchingData swData;
1073  auto switchingList = electricalProp->first_node("SwitchingList");
1074  if(!switchingList) return false;
1075  auto swNode = switchingList->first_node("Switching");
1076  while(swNode) {
1077  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
1078  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
1079  swNode = swNode->next_sibling("Switching");
1080  }
1081  inductor->SetSwitchingData(swData);
1082 
1083  inductor->SetElectricalData(data);
1084 
1085  if(swData.swTime.size() != 0) inductor->SetDynamicEvent(true);
1086 
1087  elementList.push_back(inductor);
1088  inductorList.push_back(inductor);
1089  inductorNode = inductorNode->next_sibling("Inductor");
1090  } //}
1091 
1092  //{ Line
1093  auto lineListNode = elementsNode->first_node("LineList");
1094  if(!lineListNode) return false;
1095  auto lineNode = lineListNode->first_node("Line");
1096  while(lineNode) {
1097  Line* line = new Line();
1098 
1099  auto cadPropNode = lineNode->first_node("CADProperties");
1100  if(!cadPropNode) return false;
1101 
1102  // Get nodes points
1103  std::vector<wxPoint2DDouble> ptsList;
1104  auto nodePosList = cadPropNode->first_node("NodeList");
1105  if(!nodePosList) return false;
1106  auto nodePos = nodePosList->first_node("Node");
1107  while(nodePos) {
1108  double nodePosX = GetNodeValueDouble(nodePos, "X");
1109  double nodePosY = GetNodeValueDouble(nodePos, "Y");
1110  ptsList.push_back(wxPoint2DDouble(nodePosX, nodePosY));
1111  nodePos = nodePos->next_sibling("Node");
1112  }
1113 
1114  // Get parents IDs
1115  auto parentIDList = cadPropNode->first_node("ParentIDList");
1116  if(!parentIDList) return false;
1117  auto parentNode = parentIDList->first_node("ParentID");
1118  long parentID[2] = {-1, -1};
1119  while(parentNode) {
1120  long index = 0;
1121  wxString(parentNode->first_attribute("ID")->value()).ToLong(&index);
1122  wxString(parentNode->value()).ToCLong(&parentID[index]);
1123  parentNode = parentNode->next_sibling("ParentID");
1124  }
1125 
1126  // Set parents (if have)
1127  Bus *parent1, *parent2;
1128  if(parentID[0] == -1) {
1129  parent1 = new Bus(ptsList[0]);
1130  line->AddParent(parent1, ptsList[0]);
1131  } else {
1132  parent1 = busList[parentID[0]];
1133  line->AddParent(parent1, ptsList[0]);
1134  }
1135  if(parentID[1] == -1) {
1136  parent2 = new Bus(ptsList[ptsList.size() - 1]);
1137  line->AddParent(parent2, ptsList[ptsList.size() - 1]);
1138  } else {
1139  parent2 = busList[parentID[1]];
1140  line->AddParent(parent2, ptsList[ptsList.size() - 1]);
1141  }
1142 
1143  // Add the others nodes (if have)
1144  std::vector<wxPoint2DDouble> midPts;
1145  for(int i = 1; i < (int)ptsList.size() - 1; i++) midPts.push_back(ptsList[i]);
1146  std::vector<wxPoint2DDouble> edgesPts = line->GetPointList();
1147  edgesPts.insert(edgesPts.begin() + 2, midPts.begin(), midPts.end());
1148  line->SetPointList(edgesPts);
1149 
1150  if(parentID[0] == -1) {
1151  line->RemoveParent(parent1);
1152  delete parent1;
1153  }
1154  if(parentID[1] == -1) {
1155  line->RemoveParent(parent2);
1156  delete parent2;
1157  }
1158 
1159  auto electricalProp = lineNode->first_node("ElectricalProperties");
1160  if(!electricalProp) return false;
1161 
1162  line->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1163  LineElectricalData data = line->GetElectricalData();
1164  data.name = electricalProp->first_node("Name")->value();
1165  data.nominalVoltage = GetNodeValueDouble(electricalProp, "NominalVoltage");
1166  data.nominalVoltageUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalVoltage", "UnitID");
1167  data.nominalPower = GetNodeValueDouble(electricalProp, "NominalPower");
1168  data.nominalPowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalPower", "UnitID");
1169  data.resistance = GetNodeValueDouble(electricalProp, "Resistance");
1170  data.resistanceUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "Resistance", "UnitID");
1171  data.indReactance = GetNodeValueDouble(electricalProp, "IndReactance");
1172  data.indReactanceUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "IndReactance", "UnitID");
1173  data.capSusceptance = GetNodeValueDouble(electricalProp, "CapSusceptance");
1174  data.capSusceptanceUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "CapSusceptance", "UnitID");
1175  data.lineSize = GetNodeValueDouble(electricalProp, "LineSize");
1176  data.useLinePower = GetNodeValueInt(electricalProp, "UseLinePower");
1177 
1178  auto fault = electricalProp->first_node("Fault");
1179  data.zeroResistance = GetNodeValueDouble(fault, "ZeroResistance");
1180  data.zeroIndReactance = GetNodeValueDouble(fault, "ZeroIndReactance");
1181  data.zeroCapSusceptance = GetNodeValueDouble(fault, "ZeroCapSusceptance");
1182 
1183  SwitchingData swData;
1184  auto switchingList = electricalProp->first_node("SwitchingList");
1185  if(!switchingList) return false;
1186  auto swNode = switchingList->first_node("Switching");
1187  while(swNode) {
1188  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
1189  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
1190  swNode = swNode->next_sibling("Switching");
1191  }
1192  line->SetSwitchingData(swData);
1193 
1194  line->SetElectricalData(data);
1195 
1196  if(swData.swTime.size() != 0) line->SetDynamicEvent(true);
1197 
1198  elementList.push_back(line);
1199  lineList.push_back(line);
1200  lineNode = lineNode->next_sibling("Line");
1201  } //}
1202 
1203  //{ Load
1204  auto loadListNode = elementsNode->first_node("LoadList");
1205  if(!loadListNode) return false;
1206  auto loadNode = loadListNode->first_node("Load");
1207  while(loadNode) {
1208  Load* load = new Load();
1209 
1210  auto cadPropNode = loadNode->first_node("CADProperties");
1211  if(!cadPropNode) return false;
1212 
1213  auto position = cadPropNode->first_node("Position");
1214  double posX = GetNodeValueDouble(position, "X");
1215  double posY = GetNodeValueDouble(position, "Y");
1216  auto size = cadPropNode->first_node("Size");
1217  double width = GetNodeValueDouble(size, "Width");
1218  double height = GetNodeValueDouble(size, "Height");
1219  double angle = GetNodeValueDouble(cadPropNode, "Angle");
1220  auto nodePosition = cadPropNode->first_node("NodePosition");
1221  double nodePosX = GetNodeValueDouble(nodePosition, "X");
1222  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
1223  int parentID = GetNodeValueInt(cadPropNode, "ParentID");
1224  if(parentID == -1) {
1225  // If the element has no parent, create a temporary one, remove and delete.
1226  Bus* parent = new Bus(wxPoint2DDouble(nodePosX, nodePosY));
1227  load->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1228  load->StartMove(load->GetPosition());
1229  load->Move(wxPoint2DDouble(posX, posY));
1230  load->RemoveParent(parent);
1231  delete parent;
1232  } else {
1233  Bus* parent = busList[parentID];
1234  load->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1235  load->StartMove(load->GetPosition());
1236  load->Move(wxPoint2DDouble(posX, posY));
1237  }
1238  load->SetWidth(width);
1239  load->SetHeight(height);
1240 
1241  int numRot = angle / load->GetRotationAngle();
1242  bool clockwise = true;
1243  if(numRot < 0) {
1244  numRot = std::abs(numRot);
1245  clockwise = false;
1246  }
1247  for(int i = 0; i < numRot; i++) load->Rotate(clockwise);
1248 
1249  auto electricalProp = loadNode->first_node("ElectricalProperties");
1250  if(!electricalProp) return false;
1251 
1252  load->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1253  LoadElectricalData data = load->GetElectricalData();
1254  data.name = electricalProp->first_node("Name")->value();
1255  data.activePower = GetNodeValueDouble(electricalProp, "ActivePower");
1256  data.activePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ActivePower", "UnitID");
1257  data.reactivePower = GetNodeValueDouble(electricalProp, "ReactivePower");
1258  data.reactivePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID");
1259  data.loadType = (LoadType)GetNodeValueInt(electricalProp, "LoadType");
1260 
1261  SwitchingData swData;
1262  auto switchingList = electricalProp->first_node("SwitchingList");
1263  if(!switchingList) return false;
1264  auto swNode = switchingList->first_node("Switching");
1265  while(swNode) {
1266  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
1267  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
1268  swNode = swNode->next_sibling("Switching");
1269  }
1270  load->SetSwitchingData(swData);
1271 
1272  load->SetElectricalData(data);
1273 
1274  if(swData.swTime.size() != 0) load->SetDynamicEvent(true);
1275 
1276  elementList.push_back(load);
1277  loadList.push_back(load);
1278  loadNode = loadNode->next_sibling("Load");
1279  } //}
1280 
1281  //{ SyncGenerator
1282  auto syncGeneratorListNode = elementsNode->first_node("SyncGeneratorList");
1283  if(!syncGeneratorListNode) return false;
1284  auto syncGeneratorNode = syncGeneratorListNode->first_node("SyncGenerator");
1285  while(syncGeneratorNode) {
1286  SyncGenerator* syncGenerator = new SyncGenerator();
1287 
1288  auto cadPropNode = syncGeneratorNode->first_node("CADProperties");
1289  if(!cadPropNode) return false;
1290 
1291  auto position = cadPropNode->first_node("Position");
1292  double posX = GetNodeValueDouble(position, "X");
1293  double posY = GetNodeValueDouble(position, "Y");
1294  auto size = cadPropNode->first_node("Size");
1295  double width = GetNodeValueDouble(size, "Width");
1296  double height = GetNodeValueDouble(size, "Height");
1297  double angle = GetNodeValueDouble(cadPropNode, "Angle");
1298  auto nodePosition = cadPropNode->first_node("NodePosition");
1299  double nodePosX = GetNodeValueDouble(nodePosition, "X");
1300  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
1301  int parentID = GetNodeValueInt(cadPropNode, "ParentID");
1302  if(parentID == -1) {
1303  // If the element has no parent, create a temporary one, remove and delete.
1304  Bus* parent = new Bus(wxPoint2DDouble(nodePosX, nodePosY));
1305  syncGenerator->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1306  syncGenerator->StartMove(syncGenerator->GetPosition());
1307  syncGenerator->Move(wxPoint2DDouble(posX, posY));
1308  syncGenerator->RemoveParent(parent);
1309  delete parent;
1310  } else {
1311  Bus* parent = busList[parentID];
1312  syncGenerator->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1313  syncGenerator->StartMove(syncGenerator->GetPosition());
1314  syncGenerator->Move(wxPoint2DDouble(posX, posY));
1315  }
1316  syncGenerator->SetWidth(width);
1317  syncGenerator->SetHeight(height);
1318 
1319  int numRot = angle / syncGenerator->GetRotationAngle();
1320  bool clockwise = true;
1321  if(numRot < 0) {
1322  numRot = std::abs(numRot);
1323  clockwise = false;
1324  }
1325  for(int i = 0; i < numRot; i++) syncGenerator->Rotate(clockwise);
1326 
1327  auto electricalProp = syncGeneratorNode->first_node("ElectricalProperties");
1328  if(!electricalProp) return false;
1329 
1330  syncGenerator->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1331  SyncGeneratorElectricalData data = syncGenerator->GetElectricalData();
1332  data.name = electricalProp->first_node("Name")->value();
1333  data.nominalPower = GetNodeValueDouble(electricalProp, "NominalPower");
1334  data.nominalPowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalPower", "UnitID");
1335  data.nominalVoltage = GetNodeValueDouble(electricalProp, "NominalVoltage");
1336  data.nominalVoltageUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalVoltage", "UnitID");
1337  data.activePower = GetNodeValueDouble(electricalProp, "ActivePower");
1338  data.activePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ActivePower", "UnitID");
1339  data.reactivePower = GetNodeValueDouble(electricalProp, "ReactivePower");
1340  data.reactivePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID");
1341  data.haveMaxReactive = GetNodeValueInt(electricalProp, "HaveMaxReactive");
1342  data.maxReactive = GetNodeValueDouble(electricalProp, "MaxReactive");
1343  data.maxReactiveUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "MaxReactive", "UnitID");
1344  data.haveMinReactive = GetNodeValueInt(electricalProp, "HaveMinReactive");
1345  data.minReactive = GetNodeValueDouble(electricalProp, "MinReactive");
1346  data.minReactiveUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "MinReactive", "UnitID");
1347  data.useMachineBase = GetNodeValueInt(electricalProp, "UseMachineBase");
1348 
1349  auto fault = electricalProp->first_node("Fault");
1350  if(!fault) return false;
1351  data.positiveResistance = GetNodeValueDouble(fault, "PositiveResistance");
1352  data.positiveReactance = GetNodeValueDouble(fault, "PositiveReactance");
1353  data.negativeResistance = GetNodeValueDouble(fault, "NegativeResistance");
1354  data.negativeReactance = GetNodeValueDouble(fault, "NegativeReactance");
1355  data.zeroResistance = GetNodeValueDouble(fault, "ZeroResistance");
1356  data.zeroReactance = GetNodeValueDouble(fault, "ZeroReactance");
1357  data.groundResistance = GetNodeValueDouble(fault, "GroundResistance");
1358  data.groundReactance = GetNodeValueDouble(fault, "GroundReactance");
1359  data.groundNeutral = GetNodeValueInt(fault, "GroundNeutral");
1360 
1361  auto stability = electricalProp->first_node("Stability");
1362  if(!stability) return false;
1363  data.plotSyncMachine = GetNodeValueInt(stability, "PlotSyncMachine");
1364  data.inertia = GetNodeValueDouble(stability, "Inertia");
1365  data.damping = GetNodeValueDouble(stability, "Damping");
1366  data.useAVR = GetNodeValueInt(stability, "UseAVR");
1367  data.useSpeedGovernor = GetNodeValueInt(stability, "UseSpeedGovernor");
1368  data.armResistance = GetNodeValueDouble(stability, "ArmResistance");
1369  data.potierReactance = GetNodeValueDouble(stability, "PotierReactance");
1370  data.satFactor = GetNodeValueDouble(stability, "SatFactor");
1371  data.syncXd = GetNodeValueDouble(stability, "SyncXd");
1372  data.syncXq = GetNodeValueDouble(stability, "SyncXq");
1373  data.transXd = GetNodeValueDouble(stability, "TransXd");
1374  data.transXq = GetNodeValueDouble(stability, "TransXq");
1375  data.transTd0 = GetNodeValueDouble(stability, "TransTd0");
1376  data.transTq0 = GetNodeValueDouble(stability, "TransTq0");
1377  data.subXd = GetNodeValueDouble(stability, "SubXd");
1378  data.subXq = GetNodeValueDouble(stability, "SubXq");
1379  data.subTd0 = GetNodeValueDouble(stability, "SubTd0");
1380  data.subTq0 = GetNodeValueDouble(stability, "SubTq0");
1381 
1382  auto avr = stability->first_node("AVR");
1383  if(!avr) return false;
1384  if(!OpenControlElements(doc, avr, data.avr)) return false;
1385 
1386  auto speedGov = stability->first_node("SpeedGovernor");
1387  if(!speedGov) return false;
1388  if(!OpenControlElements(doc, speedGov, data.speedGov)) return false;
1389 
1390  SwitchingData swData;
1391  auto switchingList = electricalProp->first_node("SwitchingList");
1392  if(!switchingList) return false;
1393  auto swNode = switchingList->first_node("Switching");
1394  while(swNode) {
1395  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
1396  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
1397  swNode = swNode->next_sibling("Switching");
1398  }
1399  syncGenerator->SetSwitchingData(swData);
1400 
1401  syncGenerator->SetElectricalData(data);
1402 
1403  if(swData.swTime.size() != 0) syncGenerator->SetDynamicEvent(true);
1404 
1405  elementList.push_back(syncGenerator);
1406  syncGeneratorList.push_back(syncGenerator);
1407  syncGeneratorNode = syncGeneratorNode->next_sibling("SyncGenerator");
1408  } //}
1409 
1410  //{ SyncMotor
1411  auto syncMotorListNode = elementsNode->first_node("SyncMotorList");
1412  if(!syncMotorListNode) return false;
1413  auto syncMotorNode = syncMotorListNode->first_node("SyncMotor");
1414  while(syncMotorNode) {
1415  SyncMotor* syncMotor = new SyncMotor();
1416 
1417  auto cadPropNode = syncMotorNode->first_node("CADProperties");
1418  if(!cadPropNode) return false;
1419 
1420  auto position = cadPropNode->first_node("Position");
1421  double posX = GetNodeValueDouble(position, "X");
1422  double posY = GetNodeValueDouble(position, "Y");
1423  auto size = cadPropNode->first_node("Size");
1424  double width = GetNodeValueDouble(size, "Width");
1425  double height = GetNodeValueDouble(size, "Height");
1426  double angle = GetNodeValueDouble(cadPropNode, "Angle");
1427  auto nodePosition = cadPropNode->first_node("NodePosition");
1428  double nodePosX = GetNodeValueDouble(nodePosition, "X");
1429  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
1430  int parentID = GetNodeValueInt(cadPropNode, "ParentID");
1431  if(parentID == -1) {
1432  // If the element has no parent, create a temporary one, remove and delete.
1433  Bus* parent = new Bus(wxPoint2DDouble(nodePosX, nodePosY));
1434  syncMotor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1435  syncMotor->StartMove(syncMotor->GetPosition());
1436  syncMotor->Move(wxPoint2DDouble(posX, posY));
1437  syncMotor->RemoveParent(parent);
1438  delete parent;
1439  } else {
1440  Bus* parent = busList[parentID];
1441  syncMotor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1442  syncMotor->StartMove(syncMotor->GetPosition());
1443  syncMotor->Move(wxPoint2DDouble(posX, posY));
1444  }
1445  syncMotor->SetWidth(width);
1446  syncMotor->SetHeight(height);
1447 
1448  int numRot = angle / syncMotor->GetRotationAngle();
1449  bool clockwise = true;
1450  if(numRot < 0) {
1451  numRot = std::abs(numRot);
1452  clockwise = false;
1453  }
1454  for(int i = 0; i < numRot; i++) syncMotor->Rotate(clockwise);
1455 
1456  auto electricalProp = syncMotorNode->first_node("ElectricalProperties");
1457  if(!electricalProp) return false;
1458 
1459  syncMotor->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1460  SyncMotorElectricalData data = syncMotor->GetElectricalData();
1461  data.name = electricalProp->first_node("Name")->value();
1462  data.nominalPower = GetNodeValueDouble(electricalProp, "NominalPower");
1463  data.nominalPowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalPower", "UnitID");
1464  // data.nominalVoltage = GetNodeValueDouble(electricalProp, "NominalVoltage");
1465  // data.nominalVoltageUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalVoltage", "UnitID");
1466  data.activePower = GetNodeValueDouble(electricalProp, "ActivePower");
1467  data.activePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ActivePower", "UnitID");
1468  data.reactivePower = GetNodeValueDouble(electricalProp, "ReactivePower");
1469  data.reactivePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID");
1470  data.haveMaxReactive = GetNodeValueInt(electricalProp, "HaveMaxReactive");
1471  data.maxReactive = GetNodeValueDouble(electricalProp, "MaxReactive");
1472  data.maxReactiveUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "MaxReactive", "UnitID");
1473  data.haveMinReactive = GetNodeValueInt(electricalProp, "HaveMinReactive");
1474  data.minReactive = GetNodeValueDouble(electricalProp, "MinReactive");
1475  data.minReactiveUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "MinReactive", "UnitID");
1476  data.useMachineBase = GetNodeValueInt(electricalProp, "UseMachineBase");
1477 
1478  auto fault = electricalProp->first_node("Fault");
1479  if(!fault) return false;
1480  data.positiveResistance = GetNodeValueDouble(fault, "PositiveResistance");
1481  data.positiveReactance = GetNodeValueDouble(fault, "PositiveReactance");
1482  data.negativeResistance = GetNodeValueDouble(fault, "NegativeResistance");
1483  data.negativeReactance = GetNodeValueDouble(fault, "NegativeReactance");
1484  data.zeroResistance = GetNodeValueDouble(fault, "ZeroResistance");
1485  data.zeroReactance = GetNodeValueDouble(fault, "ZeroReactance");
1486  data.groundResistance = GetNodeValueDouble(fault, "GroundResistance");
1487  data.groundReactance = GetNodeValueDouble(fault, "GroundReactance");
1488  data.groundNeutral = GetNodeValueInt(fault, "GroundNeutral");
1489 
1490  /*SwitchingData swData;
1491  auto switchingList = electricalProp->first_node("SwitchingList");
1492  if(!switchingList) return false;
1493  auto swNode = switchingList->first_node("Switching");
1494  while(swNode) {
1495  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
1496  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
1497  swNode = swNode->next_sibling("Switching");
1498  }
1499  syncMotor->SetSwitchingData(swData);*/
1500 
1501  syncMotor->SetElectricalData(data);
1502  elementList.push_back(syncMotor);
1503  syncMotorList.push_back(syncMotor);
1504  syncMotorNode = syncMotorNode->next_sibling("SyncMotor");
1505  } //}
1506 
1507  //{ Transformer
1508  auto transformerListNode = elementsNode->first_node("TransformerList");
1509  if(!transformerListNode) return false;
1510  auto transfomerNode = transformerListNode->first_node("Transfomer");
1511  while(transfomerNode) {
1512  Transformer* transformer = new Transformer();
1513 
1514  auto cadPropNode = transfomerNode->first_node("CADProperties");
1515  if(!cadPropNode) return false;
1516 
1517  auto position = cadPropNode->first_node("Position");
1518  double posX = GetNodeValueDouble(position, "X");
1519  double posY = GetNodeValueDouble(position, "Y");
1520  auto size = cadPropNode->first_node("Size");
1521  double width = GetNodeValueDouble(size, "Width");
1522  double height = GetNodeValueDouble(size, "Height");
1523  double angle = GetNodeValueDouble(cadPropNode, "Angle");
1524 
1525  // Get nodes points
1526  std::vector<wxPoint2DDouble> ptsList;
1527  auto nodePosList = cadPropNode->first_node("NodeList");
1528  if(!nodePosList) return false;
1529  auto nodePos = nodePosList->first_node("Node");
1530  while(nodePos) {
1531  double nodePosX = GetNodeValueDouble(nodePos, "X");
1532  double nodePosY = GetNodeValueDouble(nodePos, "Y");
1533  ptsList.push_back(wxPoint2DDouble(nodePosX, nodePosY));
1534  nodePos = nodePos->next_sibling("Node");
1535  }
1536 
1537  // Get parents IDs
1538  auto parentIDList = cadPropNode->first_node("ParentIDList");
1539  if(!parentIDList) return false;
1540  auto parentNode = parentIDList->first_node("ParentID");
1541  long parentID[2] = {-1, -1};
1542  while(parentNode) {
1543  long index = 0;
1544  wxString(parentNode->first_attribute("ID")->value()).ToLong(&index);
1545  wxString(parentNode->value()).ToCLong(&parentID[index]);
1546  parentNode = parentNode->next_sibling("ParentID");
1547  }
1548 
1549  // Set parents (if have)
1550  Bus *parent1, *parent2;
1551  if(parentID[0] == -1) {
1552  parent1 = new Bus(ptsList[0]);
1553  transformer->AddParent(parent1, ptsList[0]);
1554  } else {
1555  parent1 = busList[parentID[0]];
1556  transformer->AddParent(parent1, ptsList[0]);
1557  }
1558  if(parentID[1] == -1) {
1559  parent2 = new Bus(ptsList[ptsList.size() - 1]);
1560  transformer->AddParent(parent2, ptsList[ptsList.size() - 1]);
1561  } else {
1562  parent2 = busList[parentID[1]];
1563  transformer->AddParent(parent2, ptsList[ptsList.size() - 1]);
1564  }
1565 
1566  transformer->StartMove(transformer->GetPosition());
1567  transformer->Move(wxPoint2DDouble(posX, posY));
1568 
1569  if(parentID[0] == -1) {
1570  transformer->RemoveParent(parent1);
1571  delete parent1;
1572  }
1573  if(parentID[1] == -1) {
1574  transformer->RemoveParent(parent2);
1575  delete parent2;
1576  }
1577 
1578  transformer->SetWidth(width);
1579  transformer->SetHeight(height);
1580 
1581  int numRot = angle / transformer->GetRotationAngle();
1582  bool clockwise = true;
1583  if(numRot < 0) {
1584  numRot = std::abs(numRot);
1585  clockwise = false;
1586  }
1587  for(int i = 0; i < numRot; i++) transformer->Rotate(clockwise);
1588 
1589  auto electricalProp = transfomerNode->first_node("ElectricalProperties");
1590  if(!electricalProp) return false;
1591 
1592  transformer->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1593  TransformerElectricalData data = transformer->GetElectricalData();
1594  data.name = electricalProp->first_node("Name")->value();
1595  data.primaryNominalVoltage = GetNodeValueDouble(electricalProp, "PrimaryNominalVoltage");
1596  data.primaryNominalVoltageUnit =
1597  (ElectricalUnit)GetAttributeValueInt(electricalProp, "PrimaryNominalVoltage", "UnitID");
1598  data.secondaryNominalVoltage = GetNodeValueDouble(electricalProp, "SecondaryNominalVoltage");
1599  data.secondaryNominalVoltageUnit =
1600  (ElectricalUnit)GetAttributeValueInt(electricalProp, "SecondaryNominalVoltage", "UnitID");
1601  data.nominalPower = GetNodeValueDouble(electricalProp, "NominalPower");
1602  data.nominalPowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalPower", "UnitID");
1603  data.resistance = GetNodeValueDouble(electricalProp, "Resistance");
1604  data.resistanceUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "Resistance", "UnitID");
1605  data.indReactance = GetNodeValueDouble(electricalProp, "IndReactance");
1606  data.indReactanceUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "IndReactance", "UnitID");
1607  data.connection = (TransformerConnection)GetNodeValueInt(electricalProp, "Connection");
1608  data.turnsRatio = GetNodeValueDouble(electricalProp, "TurnsRatio");
1609  data.phaseShift = GetNodeValueDouble(electricalProp, "PhaseShift");
1610  data.useTransformerPower = GetNodeValueInt(electricalProp, "UseTransfomerPower");
1611 
1612  auto fault = electricalProp->first_node("Fault");
1613  data.zeroResistance = GetNodeValueDouble(fault, "ZeroResistance");
1614  data.zeroIndReactance = GetNodeValueDouble(fault, "ZeroIndReactance");
1615  data.primaryGrndResistance = GetNodeValueDouble(fault, "PrimaryGrndResistance");
1616  data.primaryGrndReactance = GetNodeValueDouble(fault, "PrimaryGrndReactance");
1617  data.secondaryGrndResistance = GetNodeValueDouble(fault, "SecondaryGrndResistance");
1618  data.secondaryGrndReactance = GetNodeValueDouble(fault, "SecondaryGrndReactance");
1619 
1620  SwitchingData swData;
1621  auto switchingList = electricalProp->first_node("SwitchingList");
1622  if(!switchingList) return false;
1623  auto swNode = switchingList->first_node("Switching");
1624  while(swNode) {
1625  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
1626  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
1627  swNode = swNode->next_sibling("Switching");
1628  }
1629  transformer->SetSwitchingData(swData);
1630 
1631  transformer->SetElectricaData(data);
1632 
1633  if(swData.swTime.size() != 0) transformer->SetDynamicEvent(true);
1634 
1635  elementList.push_back(transformer);
1636  transformerList.push_back(transformer);
1637  transfomerNode = transfomerNode->next_sibling("Transfomer");
1638  } //}
1639 
1640  m_workspace->SetElementList(elementList);
1641 
1642  //{ Text
1643  auto textListNode = elementsNode->first_node("TextList");
1644  if(!textListNode) return false;
1645  auto textNode = textListNode->first_node("Text");
1646  while(textNode) {
1647  auto cadPropNode = textNode->first_node("CADProperties");
1648  if(!cadPropNode) return false;
1649 
1650  auto position = cadPropNode->first_node("Position");
1651  double posX = GetNodeValueDouble(position, "X");
1652  double posY = GetNodeValueDouble(position, "Y");
1653  auto size = cadPropNode->first_node("Size");
1654  double width = GetNodeValueDouble(size, "Width");
1655  double height = GetNodeValueDouble(size, "Height");
1656  double angle = GetNodeValueDouble(cadPropNode, "Angle");
1657 
1658  Text* text = new Text(wxPoint2DDouble(posX, posY));
1659 
1660  text->SetWidth(width);
1661  text->SetHeight(height);
1662 
1663  auto textProperties = textNode->first_node("TextProperties");
1664  if(!textProperties) return false;
1665 
1666  text->SetElementType((ElementType)GetNodeValueDouble(textProperties, "ElementType"));
1667  text->SetDataType((DataType)GetNodeValueDouble(textProperties, "DataType"));
1668  text->SetUnit((ElectricalUnit)GetNodeValueDouble(textProperties, "DataUnit"));
1669  text->SetDirection(GetNodeValueDouble(textProperties, "Direction"));
1670  text->SetDecimalPlaces(GetNodeValueDouble(textProperties, "DecimalPlaces"));
1671 
1672  text->SetElementNumber(GetNodeValueInt(textProperties, "ElementNumber"));
1673  switch(text->GetElementType()) {
1674  case TYPE_NONE:
1675  break;
1676  case TYPE_BUS: {
1677  Bus* bus = busList[text->GetElementNumber()];
1678  text->SetElement(bus);
1679  } break;
1680  case TYPE_CAPACITOR: {
1681  Capacitor* capacitor = capacitorList[text->GetElementNumber()];
1682  text->SetElement(capacitor);
1683  } break;
1684  case TYPE_IND_MOTOR: {
1685  IndMotor* indMotor = indMotorList[text->GetElementNumber()];
1686  text->SetElement(indMotor);
1687  } break;
1688  case TYPE_INDUCTOR: {
1689  Inductor* inductor = inductorList[text->GetElementNumber()];
1690  text->SetElement(inductor);
1691  } break;
1692  case TYPE_LINE: {
1693  Line* line = lineList[text->GetElementNumber()];
1694  text->SetElement(line);
1695  } break;
1696  case TYPE_LOAD: {
1697  Load* load = loadList[text->GetElementNumber()];
1698  text->SetElement(load);
1699  } break;
1700  case TYPE_SYNC_GENERATOR: {
1701  SyncGenerator* syncGenerator = syncGeneratorList[text->GetElementNumber()];
1702  text->SetElement(syncGenerator);
1703  } break;
1704  case TYPE_SYNC_MOTOR: {
1705  SyncMotor* syncMotor = syncMotorList[text->GetElementNumber()];
1706  text->SetElement(syncMotor);
1707  } break;
1708  case TYPE_TRANSFORMER: {
1709  Transformer* transformer = transformerList[text->GetElementNumber()];
1710  text->SetElement(transformer);
1711  } break;
1712  }
1713 
1714  int numRot = angle / text->GetRotationAngle();
1715  bool clockwise = true;
1716  if(numRot < 0) {
1717  numRot = std::abs(numRot);
1718  clockwise = false;
1719  }
1720  for(int i = 0; i < numRot; i++) text->Rotate(clockwise);
1721 
1722  textList.push_back(text);
1723  textNode = textNode->next_sibling("Text");
1724  } //}
1725 
1726  m_workspace->SetTextList(textList);
1727  return true;
1728 }
1729 
1730 void FileHanding::SaveControl(wxFileName path)
1731 {
1732  // Same process present in SaveProject():
1733  std::ofstream writeProjectsFile(path.GetFullPath());
1734  writeProjectsFile.close();
1735 
1736  rapidxml::xml_document<> doc;
1737  rapidxml::file<> xmlFile(path.GetFullPath().mb_str());
1738  doc.parse<0>(xmlFile.data());
1739 
1740  rapidxml::xml_node<>* decl = doc.allocate_node(rapidxml::node_declaration);
1741  rapidxml::xml_attribute<>* ver = doc.allocate_attribute("version", "1.0");
1742  rapidxml::xml_attribute<>* encoding = doc.allocate_attribute("encoding", "utf-8");
1743  decl->append_attribute(ver);
1744  decl->append_attribute(encoding);
1745  doc.append_node(decl);
1746 
1747  rapidxml::xml_node<>* rootNode = doc.allocate_node(rapidxml::node_element, "Control");
1748  doc.append_node(rootNode);
1749 
1750  rapidxml::xml_node<>* projectNameNode = AppendNode(doc, rootNode, "Name");
1751  SetNodeValue(doc, projectNameNode, path.GetName());
1752 
1753  auto elementsNode = AppendNode(doc, rootNode, "ControlElements");
1754  SaveControlElements(doc, elementsNode);
1755  std::ofstream writeXML(path.GetFullPath());
1756  writeXML << doc;
1757  writeXML.close();
1758 }
1759 
1760 bool FileHanding::OpenControl(wxFileName path,
1761  std::vector<ControlElement*>& ctrlElementList,
1762  std::vector<ConnectionLine*>& ctrlConnectionList)
1763 {
1764  rapidxml::xml_document<> doc;
1765  rapidxml::file<> xmlFile(path.GetFullPath().mb_str());
1766 
1767  doc.parse<0>(xmlFile.data());
1768 
1769  auto projectNode = doc.first_node("Control");
1770  if(!projectNode) return false;
1771  // auto nameNode = projectNode->first_node("Name");
1772  // if(!nameNode) return false;
1773  // m_controlEditor->SetName(nameNode->value());
1774 
1775  // Open elements
1776  auto elementsNode = projectNode->first_node("ControlElements");
1777  if(!elementsNode) return false;
1778 
1779  // auto elementsNode = AppendNode(doc, rootNode, "ControlElements");
1780  ControlElementContainer* ctrlElementContainer = new ControlElementContainer();
1781  if(!OpenControlElements(doc, elementsNode, ctrlElementContainer)) return false;
1782  ctrlElementList = ctrlElementContainer->GetControlElementsList();
1783  ctrlConnectionList = ctrlElementContainer->GetConnectionLineList();
1784  return true;
1785 }
1786 
1787 void FileHanding::SaveControlElements(rapidxml::xml_document<>& doc,
1788  rapidxml::xml_node<>* elementsNode,
1789  ControlElementContainer* ctrlContainer)
1790 {
1791  if(!ctrlContainer) {
1792  ctrlContainer = new ControlElementContainer();
1793  ctrlContainer->FillContainer(m_controlEditor);
1794  }
1795 
1796  //{ Constant
1797  auto constsNode = AppendNode(doc, elementsNode, "ConstantList");
1798  auto constList = ctrlContainer->GetConstantList();
1799  for(auto it = constList.begin(), itEnd = constList.end(); it != itEnd; ++it) {
1800  Constant* constant = *it;
1801  auto constNode = AppendNode(doc, constsNode, "Constant");
1802  SetNodeAttribute(doc, constNode, "ID", constant->GetID());
1803  auto cadProp = AppendNode(doc, constNode, "CADProperties");
1804  auto position = AppendNode(doc, cadProp, "Position");
1805  auto posX = AppendNode(doc, position, "X");
1806  SetNodeValue(doc, posX, constant->GetPosition().m_x);
1807  auto posY = AppendNode(doc, position, "Y");
1808  SetNodeValue(doc, posY, constant->GetPosition().m_y);
1809  auto size = AppendNode(doc, cadProp, "Size");
1810  auto width = AppendNode(doc, size, "Width");
1811  SetNodeValue(doc, width, constant->GetWidth());
1812  auto height = AppendNode(doc, size, "Height");
1813  SetNodeValue(doc, height, constant->GetHeight());
1814  auto angle = AppendNode(doc, cadProp, "Angle");
1815  SetNodeValue(doc, angle, constant->GetAngle());
1816 
1817  // Nodes
1818  auto nodeList = AppendNode(doc, constNode, "NodeList");
1819  SaveControlNodes(doc, nodeList, constant->GetNodeList());
1820 
1821  // Control properties
1822  auto value = AppendNode(doc, constNode, "Value");
1823  SetNodeValue(doc, value, constant->GetValue());
1824  } //}
1825 
1826  //{ Exponential
1827  auto expsNode = AppendNode(doc, elementsNode, "ExponentialList");
1828  auto expList = ctrlContainer->GetExponentialList();
1829  for(auto it = expList.begin(), itEnd = expList.end(); it != itEnd; ++it) {
1830  Exponential* exponential = *it;
1831  auto expNode = AppendNode(doc, expsNode, "Exponential");
1832  SetNodeAttribute(doc, expNode, "ID", exponential->GetID());
1833  auto cadProp = AppendNode(doc, expNode, "CADProperties");
1834  auto position = AppendNode(doc, cadProp, "Position");
1835  auto posX = AppendNode(doc, position, "X");
1836  SetNodeValue(doc, posX, exponential->GetPosition().m_x);
1837  auto posY = AppendNode(doc, position, "Y");
1838  SetNodeValue(doc, posY, exponential->GetPosition().m_y);
1839  auto size = AppendNode(doc, cadProp, "Size");
1840  auto width = AppendNode(doc, size, "Width");
1841  SetNodeValue(doc, width, exponential->GetWidth());
1842  auto height = AppendNode(doc, size, "Height");
1843  SetNodeValue(doc, height, exponential->GetHeight());
1844  auto angle = AppendNode(doc, cadProp, "Angle");
1845  SetNodeValue(doc, angle, exponential->GetAngle());
1846 
1847  // Nodes
1848  auto nodeList = AppendNode(doc, expNode, "NodeList");
1849  SaveControlNodes(doc, nodeList, exponential->GetNodeList());
1850 
1851  // Control properties
1852  double a, b;
1853  exponential->GetValues(a, b);
1854  auto value = AppendNode(doc, expNode, "Value");
1855  auto aValue = AppendNode(doc, value, "A");
1856  SetNodeValue(doc, aValue, a);
1857  auto bValue = AppendNode(doc, value, "B");
1858  SetNodeValue(doc, bValue, b);
1859  } //}
1860 
1861  //{ Gain
1862  auto gainsNode = AppendNode(doc, elementsNode, "GainList");
1863  auto gainList = ctrlContainer->GetGainList();
1864  for(auto it = gainList.begin(), itEnd = gainList.end(); it != itEnd; ++it) {
1865  Gain* gain = *it;
1866  auto gainNode = AppendNode(doc, gainsNode, "Gain");
1867  SetNodeAttribute(doc, gainNode, "ID", gain->GetID());
1868  auto cadProp = AppendNode(doc, gainNode, "CADProperties");
1869  auto position = AppendNode(doc, cadProp, "Position");
1870  auto posX = AppendNode(doc, position, "X");
1871  SetNodeValue(doc, posX, gain->GetPosition().m_x);
1872  auto posY = AppendNode(doc, position, "Y");
1873  SetNodeValue(doc, posY, gain->GetPosition().m_y);
1874  auto size = AppendNode(doc, cadProp, "Size");
1875  auto width = AppendNode(doc, size, "Width");
1876  SetNodeValue(doc, width, gain->GetWidth());
1877  auto height = AppendNode(doc, size, "Height");
1878  SetNodeValue(doc, height, gain->GetHeight());
1879  auto angle = AppendNode(doc, cadProp, "Angle");
1880  SetNodeValue(doc, angle, gain->GetAngle());
1881 
1882  // Nodes
1883  auto nodeList = AppendNode(doc, gainNode, "NodeList");
1884  SaveControlNodes(doc, nodeList, gain->GetNodeList());
1885 
1886  // Control properties
1887  auto value = AppendNode(doc, gainNode, "Value");
1888  SetNodeValue(doc, value, gain->GetValue());
1889  } //}
1890 
1891  //{ IO
1892  auto iosNode = AppendNode(doc, elementsNode, "IOList");
1893  auto ioList = ctrlContainer->GetIOControlList();
1894  for(auto it = ioList.begin(), itEnd = ioList.end(); it != itEnd; ++it) {
1895  IOControl* io = *it;
1896  auto ioNode = AppendNode(doc, iosNode, "IO");
1897  SetNodeAttribute(doc, ioNode, "ID", io->GetID());
1898  auto cadProp = AppendNode(doc, ioNode, "CADProperties");
1899  auto position = AppendNode(doc, cadProp, "Position");
1900  auto posX = AppendNode(doc, position, "X");
1901  SetNodeValue(doc, posX, io->GetPosition().m_x);
1902  auto posY = AppendNode(doc, position, "Y");
1903  SetNodeValue(doc, posY, io->GetPosition().m_y);
1904  auto size = AppendNode(doc, cadProp, "Size");
1905  auto width = AppendNode(doc, size, "Width");
1906  SetNodeValue(doc, width, io->GetWidth());
1907  auto height = AppendNode(doc, size, "Height");
1908  SetNodeValue(doc, height, io->GetHeight());
1909  auto angle = AppendNode(doc, cadProp, "Angle");
1910  SetNodeValue(doc, angle, io->GetAngle());
1911 
1912  // Nodes
1913  auto nodeList = AppendNode(doc, ioNode, "NodeList");
1914  SaveControlNodes(doc, nodeList, io->GetNodeList());
1915 
1916  // Control properties
1917  auto value = AppendNode(doc, ioNode, "Value");
1918  SetNodeValue(doc, value, io->GetValue());
1919  auto ioFlags = AppendNode(doc, ioNode, "IOFlags");
1920  SetNodeValue(doc, ioFlags, io->GetIOFlags());
1921  } //}
1922 
1923  //{ Limiter
1924  auto limitersNode = AppendNode(doc, elementsNode, "LimiterList");
1925  auto limiterList = ctrlContainer->GetLimiterList();
1926  for(auto it = limiterList.begin(), itEnd = limiterList.end(); it != itEnd; ++it) {
1927  Limiter* limiter = *it;
1928  auto limiterNode = AppendNode(doc, limitersNode, "Limiter");
1929  SetNodeAttribute(doc, limiterNode, "ID", limiter->GetID());
1930  auto cadProp = AppendNode(doc, limiterNode, "CADProperties");
1931  auto position = AppendNode(doc, cadProp, "Position");
1932  auto posX = AppendNode(doc, position, "X");
1933  SetNodeValue(doc, posX, limiter->GetPosition().m_x);
1934  auto posY = AppendNode(doc, position, "Y");
1935  SetNodeValue(doc, posY, limiter->GetPosition().m_y);
1936  auto size = AppendNode(doc, cadProp, "Size");
1937  auto width = AppendNode(doc, size, "Width");
1938  SetNodeValue(doc, width, limiter->GetWidth());
1939  auto height = AppendNode(doc, size, "Height");
1940  SetNodeValue(doc, height, limiter->GetHeight());
1941  auto angle = AppendNode(doc, cadProp, "Angle");
1942  SetNodeValue(doc, angle, limiter->GetAngle());
1943 
1944  // Nodes
1945  auto nodeList = AppendNode(doc, limiterNode, "NodeList");
1946  SaveControlNodes(doc, nodeList, limiter->GetNodeList());
1947 
1948  // Control properties
1949  auto upLimit = AppendNode(doc, limiterNode, "UpperLimit");
1950  SetNodeValue(doc, upLimit, limiter->GetUpLimit());
1951  auto lowLimit = AppendNode(doc, limiterNode, "LowerLimit");
1952  SetNodeValue(doc, lowLimit, limiter->GetLowLimit());
1953  } //}
1954 
1955  //{ Multiplier
1956  auto multipliersNode = AppendNode(doc, elementsNode, "MultiplierList");
1957  auto multiplierList = ctrlContainer->GetMultiplierList();
1958  for(auto it = multiplierList.begin(), itEnd = multiplierList.end(); it != itEnd; ++it) {
1959  Multiplier* multiplier = *it;
1960  auto multiplierNode = AppendNode(doc, multipliersNode, "Multiplier");
1961  SetNodeAttribute(doc, multiplierNode, "ID", multiplier->GetID());
1962  auto cadProp = AppendNode(doc, multiplierNode, "CADProperties");
1963  auto position = AppendNode(doc, cadProp, "Position");
1964  auto posX = AppendNode(doc, position, "X");
1965  SetNodeValue(doc, posX, multiplier->GetPosition().m_x);
1966  auto posY = AppendNode(doc, position, "Y");
1967  SetNodeValue(doc, posY, multiplier->GetPosition().m_y);
1968  auto size = AppendNode(doc, cadProp, "Size");
1969  auto width = AppendNode(doc, size, "Width");
1970  SetNodeValue(doc, width, multiplier->GetWidth());
1971  auto height = AppendNode(doc, size, "Height");
1972  SetNodeValue(doc, height, multiplier->GetHeight());
1973  auto angle = AppendNode(doc, cadProp, "Angle");
1974  SetNodeValue(doc, angle, multiplier->GetAngle());
1975 
1976  // Nodes
1977  auto nodeList = AppendNode(doc, multiplierNode, "NodeList");
1978  SaveControlNodes(doc, nodeList, multiplier->GetNodeList());
1979  } //}
1980 
1981  //{ Rate limiter
1982  auto rateLimitersNode = AppendNode(doc, elementsNode, "RateLimiterList");
1983  auto rateLimiterList = ctrlContainer->GetRateLimiterList();
1984  for(auto it = rateLimiterList.begin(), itEnd = rateLimiterList.end(); it != itEnd; ++it) {
1985  RateLimiter* rateLimiter = *it;
1986  auto rateLimiterNode = AppendNode(doc, rateLimitersNode, "RateLimiter");
1987  SetNodeAttribute(doc, rateLimiterNode, "ID", rateLimiter->GetID());
1988  auto cadProp = AppendNode(doc, rateLimiterNode, "CADProperties");
1989  auto position = AppendNode(doc, cadProp, "Position");
1990  auto posX = AppendNode(doc, position, "X");
1991  SetNodeValue(doc, posX, rateLimiter->GetPosition().m_x);
1992  auto posY = AppendNode(doc, position, "Y");
1993  SetNodeValue(doc, posY, rateLimiter->GetPosition().m_y);
1994  auto size = AppendNode(doc, cadProp, "Size");
1995  auto width = AppendNode(doc, size, "Width");
1996  SetNodeValue(doc, width, rateLimiter->GetWidth());
1997  auto height = AppendNode(doc, size, "Height");
1998  SetNodeValue(doc, height, rateLimiter->GetHeight());
1999  auto angle = AppendNode(doc, cadProp, "Angle");
2000  SetNodeValue(doc, angle, rateLimiter->GetAngle());
2001 
2002  // Nodes
2003  auto nodeList = AppendNode(doc, rateLimiterNode, "NodeList");
2004  SaveControlNodes(doc, nodeList, rateLimiter->GetNodeList());
2005 
2006  // Control properties
2007  auto upLimit = AppendNode(doc, rateLimiterNode, "UpperLimit");
2008  SetNodeValue(doc, upLimit, rateLimiter->GetUpLimit());
2009  auto lowLimit = AppendNode(doc, rateLimiterNode, "LowerLimit");
2010  SetNodeValue(doc, lowLimit, rateLimiter->GetLowLimit());
2011  } //}
2012 
2013  //{ Sum
2014  auto sumsNode = AppendNode(doc, elementsNode, "SumList");
2015  auto sumList = ctrlContainer->GetSumList();
2016  for(auto it = sumList.begin(), itEnd = sumList.end(); it != itEnd; ++it) {
2017  Sum* sum = *it;
2018  auto sumNode = AppendNode(doc, sumsNode, "Sum");
2019  SetNodeAttribute(doc, sumNode, "ID", sum->GetID());
2020  auto cadProp = AppendNode(doc, sumNode, "CADProperties");
2021  auto position = AppendNode(doc, cadProp, "Position");
2022  auto posX = AppendNode(doc, position, "X");
2023  SetNodeValue(doc, posX, sum->GetPosition().m_x);
2024  auto posY = AppendNode(doc, position, "Y");
2025  SetNodeValue(doc, posY, sum->GetPosition().m_y);
2026  auto size = AppendNode(doc, cadProp, "Size");
2027  auto width = AppendNode(doc, size, "Width");
2028  SetNodeValue(doc, width, sum->GetWidth());
2029  auto height = AppendNode(doc, size, "Height");
2030  SetNodeValue(doc, height, sum->GetHeight());
2031  auto angle = AppendNode(doc, cadProp, "Angle");
2032  SetNodeValue(doc, angle, sum->GetAngle());
2033 
2034  // Nodes
2035  auto nodeList = AppendNode(doc, sumNode, "NodeList");
2036  SaveControlNodes(doc, nodeList, sum->GetNodeList());
2037 
2038  // Control properties
2039  auto signsNode = AppendNode(doc, sumNode, "Signs");
2040  auto signs = sum->GetSignalList();
2041  for(int i = 0; i < (int)signs.size(); ++i) {
2042  auto value = AppendNode(doc, signsNode, "Value");
2043  SetNodeValue(doc, value, static_cast<int>(signs[i]));
2044  }
2045 
2046  } //}
2047 
2048  //{ Transfer function
2049  auto tfsNode = AppendNode(doc, elementsNode, "TransferFunctionList");
2050  auto tfList = ctrlContainer->GetTFList();
2051  for(auto it = tfList.begin(), itEnd = tfList.end(); it != itEnd; ++it) {
2052  TransferFunction* tf = *it;
2053  auto tfNode = AppendNode(doc, tfsNode, "TransferFunction");
2054  SetNodeAttribute(doc, tfNode, "ID", tf->GetID());
2055  auto cadProp = AppendNode(doc, tfNode, "CADProperties");
2056  auto position = AppendNode(doc, cadProp, "Position");
2057  auto posX = AppendNode(doc, position, "X");
2058  SetNodeValue(doc, posX, tf->GetPosition().m_x);
2059  auto posY = AppendNode(doc, position, "Y");
2060  SetNodeValue(doc, posY, tf->GetPosition().m_y);
2061  auto size = AppendNode(doc, cadProp, "Size");
2062  auto width = AppendNode(doc, size, "Width");
2063  SetNodeValue(doc, width, tf->GetWidth());
2064  auto height = AppendNode(doc, size, "Height");
2065  SetNodeValue(doc, height, tf->GetHeight());
2066  auto angle = AppendNode(doc, cadProp, "Angle");
2067  SetNodeValue(doc, angle, tf->GetAngle());
2068 
2069  // Nodes
2070  auto nodeList = AppendNode(doc, tfNode, "NodeList");
2071  SaveControlNodes(doc, nodeList, tf->GetNodeList());
2072 
2073  // Control properties
2074  auto numeratorNode = AppendNode(doc, tfNode, "Numerator");
2075  auto numerator = tf->GetNumerator();
2076  for(int i = 0; i < (int)numerator.size(); ++i) {
2077  auto value = AppendNode(doc, numeratorNode, "Value");
2078  SetNodeValue(doc, value, numerator[i]);
2079  }
2080  auto denominatorNode = AppendNode(doc, tfNode, "Denominator");
2081  auto denominator = tf->GetDenominator();
2082  for(int i = 0; i < (int)denominator.size(); ++i) {
2083  auto value = AppendNode(doc, denominatorNode, "Value");
2084  SetNodeValue(doc, value, denominator[i]);
2085  }
2086  } //}
2087 
2088  //{ Connection line
2089  auto cLinesNode = AppendNode(doc, elementsNode, "ConnectionList");
2090  auto connLineList = ctrlContainer->GetConnectionLineList();
2091  for(auto it = connLineList.begin(), itEnd = connLineList.end(); it != itEnd; ++it) {
2092  ConnectionLine* cLine = *it;
2093  auto cLineNode = AppendNode(doc, cLinesNode, "Connection");
2094  SetNodeAttribute(doc, cLineNode, "ID", cLine->GetID());
2095 
2096  // CAD properties
2097  auto cadProp = AppendNode(doc, cLineNode, "CADProperties");
2098  auto offset = AppendNode(doc, cadProp, "Offset");
2099  SetNodeValue(doc, offset, cLine->GetOffset());
2100 
2101  // Parent list
2102  auto parentsNode = AppendNode(doc, cLineNode, "ParentList");
2103  auto parentList = cLine->GetParentList();
2104  int nodeIndex = 0;
2105  for(auto itP = parentList.begin(), itPEnd = parentList.end(); itP != itPEnd; ++itP) {
2106  Element* parent = *itP;
2107  auto parentNode = AppendNode(doc, parentsNode, "Parent");
2108  auto elementID = AppendNode(doc, parentNode, "ElementID");
2109  SetNodeValue(doc, elementID, parent->GetID());
2110  auto nodeID = AppendNode(doc, parentNode, "NodeID");
2111  SetNodeValue(doc, nodeID, cLine->GetNodeList()[nodeIndex]->GetID());
2112  nodeIndex++;
2113  }
2114 
2115  auto parentLine = AppendNode(doc, cLineNode, "ParentLine");
2116  if(cLine->GetParentLine()) {
2117  ConnectionLine* parent = cLine->GetParentLine();
2118  SetNodeAttribute(doc, parentLine, "ID", parent->GetID());
2119  } else {
2120  SetNodeAttribute(doc, parentLine, "ID", -1);
2121  }
2122  } //}
2123 }
2124 
2125 bool FileHanding::OpenControlElements(rapidxml::xml_document<>& doc,
2126  rapidxml::xml_node<>* elementsNode,
2127  ControlElementContainer* ctrlContainer)
2128 {
2129  std::vector<ControlElement*> elementList;
2130  std::vector<ConnectionLine*> connectionList;
2131 
2132  //{ Constant
2133  auto constListNode = elementsNode->first_node("ConstantList");
2134  if(!constListNode) return false;
2135  auto constNode = constListNode->first_node("Constant");
2136  while(constNode) {
2137  int id = GetAttributeValueInt(constNode, "ID");
2138  Constant* constant = new Constant(id);
2139 
2140  auto cadPropNode = constNode->first_node("CADProperties");
2141  if(!cadPropNode) return false;
2142 
2143  auto position = cadPropNode->first_node("Position");
2144  double posX = GetNodeValueDouble(position, "X");
2145  double posY = GetNodeValueDouble(position, "Y");
2146  auto size = cadPropNode->first_node("Size");
2147  double width = GetNodeValueDouble(size, "Width");
2148  double height = GetNodeValueDouble(size, "Height");
2149  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2150 
2151  double value = GetNodeValueDouble(constNode, "Value");
2152 
2153  constant->SetWidth(width);
2154  constant->SetHeight(height);
2155  constant->SetAngle(angle);
2156  constant->SetPosition(wxPoint2DDouble(posX, posY));
2157  constant->StartMove(constant->GetPosition());
2158 
2159  constant->SetValue(value);
2160 
2161  std::vector<Node*> nodeVector;
2162  if(!OpenControlNodeList(constNode, nodeVector)) return false;
2163 
2164  constant->SetNodeList(nodeVector);
2165  constant->UpdatePoints();
2166  elementList.push_back(constant);
2167 
2168  constNode = constNode->next_sibling("Constant");
2169  } //}
2170 
2171  //{ Exponential
2172  auto expListNode = elementsNode->first_node("ExponentialList");
2173  if(!expListNode) return false;
2174  auto expNode = expListNode->first_node("Exponential");
2175  while(expNode) {
2176  int id = GetAttributeValueInt(expNode, "ID");
2177  Exponential* exponential = new Exponential(id);
2178 
2179  auto cadPropNode = expNode->first_node("CADProperties");
2180  if(!cadPropNode) return false;
2181 
2182  auto position = cadPropNode->first_node("Position");
2183  double posX = GetNodeValueDouble(position, "X");
2184  double posY = GetNodeValueDouble(position, "Y");
2185  auto size = cadPropNode->first_node("Size");
2186  double width = GetNodeValueDouble(size, "Width");
2187  double height = GetNodeValueDouble(size, "Height");
2188  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2189 
2190  auto value = expNode->first_node("Value");
2191  double a = GetNodeValueDouble(value, "A");
2192  double b = GetNodeValueDouble(value, "B");
2193 
2194  exponential->SetWidth(width);
2195  exponential->SetHeight(height);
2196  exponential->SetAngle(angle);
2197  exponential->SetPosition(wxPoint2DDouble(posX, posY));
2198  exponential->StartMove(exponential->GetPosition());
2199 
2200  exponential->SetValues(a, b);
2201 
2202  std::vector<Node*> nodeVector;
2203  if(!OpenControlNodeList(expNode, nodeVector)) return false;
2204 
2205  exponential->SetNodeList(nodeVector);
2206  exponential->UpdatePoints();
2207  elementList.push_back(exponential);
2208 
2209  expNode = expNode->next_sibling("Exponential");
2210  } //}
2211 
2212  //{ Gain
2213  auto gainListNode = elementsNode->first_node("GainList");
2214  if(!gainListNode) return false;
2215  auto gainNode = gainListNode->first_node("Gain");
2216  while(gainNode) {
2217  int id = GetAttributeValueInt(gainNode, "ID");
2218  Gain* gain = new Gain(id);
2219 
2220  auto cadPropNode = gainNode->first_node("CADProperties");
2221  if(!cadPropNode) return false;
2222 
2223  auto position = cadPropNode->first_node("Position");
2224  double posX = GetNodeValueDouble(position, "X");
2225  double posY = GetNodeValueDouble(position, "Y");
2226  auto size = cadPropNode->first_node("Size");
2227  double width = GetNodeValueDouble(size, "Width");
2228  double height = GetNodeValueDouble(size, "Height");
2229  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2230 
2231  double value = GetNodeValueDouble(gainNode, "Value");
2232 
2233  gain->SetWidth(width);
2234  gain->SetHeight(height);
2235  gain->SetAngle(angle);
2236  gain->SetPosition(wxPoint2DDouble(posX, posY));
2237  gain->SetValue(value);
2238  gain->StartMove(gain->GetPosition());
2239 
2240  std::vector<Node*> nodeVector;
2241  if(!OpenControlNodeList(gainNode, nodeVector)) return false;
2242 
2243  gain->SetNodeList(nodeVector);
2244  gain->UpdatePoints();
2245  elementList.push_back(gain);
2246 
2247  gainNode = gainNode->next_sibling("Gain");
2248  }
2249  //}
2250 
2251  //{ IO
2252  auto ioListNode = elementsNode->first_node("IOList");
2253  if(!ioListNode) return false;
2254  auto ioNode = ioListNode->first_node("IO");
2255  while(ioNode) {
2256  int id = GetAttributeValueInt(ioNode, "ID");
2257 
2258  auto cadPropNode = ioNode->first_node("CADProperties");
2259  if(!cadPropNode) return false;
2260 
2261  auto position = cadPropNode->first_node("Position");
2262  double posX = GetNodeValueDouble(position, "X");
2263  double posY = GetNodeValueDouble(position, "Y");
2264  auto size = cadPropNode->first_node("Size");
2265  double width = GetNodeValueDouble(size, "Width");
2266  double height = GetNodeValueDouble(size, "Height");
2267  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2268 
2269  std::vector<Node*> nodeVector;
2270  if(!OpenControlNodeList(ioNode, nodeVector)) return false;
2271 
2272  IOControl::IOFlags value = static_cast<IOControl::IOFlags>(GetNodeValueInt(ioNode, "Value"));
2273  int ioFlags = GetNodeValueInt(ioNode, "IOFlags");
2274 
2275  IOControl* io = new IOControl(ioFlags, id);
2276 
2277  io->SetWidth(width);
2278  io->SetHeight(height);
2279  io->SetAngle(angle);
2280  io->SetPosition(wxPoint2DDouble(posX, posY));
2281  io->SetValue(value);
2282  io->StartMove(io->GetPosition());
2283  io->SetNodeList(nodeVector);
2284  io->UpdatePoints();
2285  elementList.push_back(io);
2286 
2287  ioNode = ioNode->next_sibling("IO");
2288  }
2289  //}
2290 
2291  //{ Limiter
2292  auto limiterListNode = elementsNode->first_node("LimiterList");
2293  if(!limiterListNode) return false;
2294  auto limiterNode = limiterListNode->first_node("Limiter");
2295  while(limiterNode) {
2296  int id = GetAttributeValueInt(limiterNode, "ID");
2297  Limiter* limiter = new Limiter(id);
2298 
2299  auto cadPropNode = limiterNode->first_node("CADProperties");
2300  if(!cadPropNode) return false;
2301 
2302  auto position = cadPropNode->first_node("Position");
2303  double posX = GetNodeValueDouble(position, "X");
2304  double posY = GetNodeValueDouble(position, "Y");
2305  auto size = cadPropNode->first_node("Size");
2306  double width = GetNodeValueDouble(size, "Width");
2307  double height = GetNodeValueDouble(size, "Height");
2308  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2309 
2310  double upLimit = GetNodeValueDouble(limiterNode, "UpperLimit");
2311  double lowLimit = GetNodeValueDouble(limiterNode, "LowerLimit");
2312 
2313  std::vector<Node*> nodeVector;
2314  if(!OpenControlNodeList(limiterNode, nodeVector)) return false;
2315 
2316  limiter->SetWidth(width);
2317  limiter->SetHeight(height);
2318  limiter->SetAngle(angle);
2319  limiter->SetPosition(wxPoint2DDouble(posX, posY));
2320  limiter->SetUpLimit(upLimit);
2321  limiter->SetLowLimit(lowLimit);
2322 
2323  limiter->StartMove(limiter->GetPosition());
2324  limiter->SetNodeList(nodeVector);
2325  limiter->UpdatePoints();
2326  elementList.push_back(limiter);
2327 
2328  limiterNode = limiterNode->next_sibling("Limiter");
2329  }
2330  //}
2331 
2332  //{ Multiplier
2333  auto multiplierListNode = elementsNode->first_node("MultiplierList");
2334  if(!multiplierListNode) return false;
2335  auto multiplierNode = multiplierListNode->first_node("Multiplier");
2336  while(multiplierNode) {
2337  int id = GetAttributeValueInt(multiplierNode, "ID");
2338  Multiplier* multiplier = new Multiplier(id);
2339 
2340  auto cadPropNode = multiplierNode->first_node("CADProperties");
2341  if(!cadPropNode) return false;
2342 
2343  auto position = cadPropNode->first_node("Position");
2344  double posX = GetNodeValueDouble(position, "X");
2345  double posY = GetNodeValueDouble(position, "Y");
2346  auto size = cadPropNode->first_node("Size");
2347  double width = GetNodeValueDouble(size, "Width");
2348  double height = GetNodeValueDouble(size, "Height");
2349  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2350 
2351  std::vector<Node*> nodeVector;
2352  if(!OpenControlNodeList(multiplierNode, nodeVector)) return false;
2353 
2354  multiplier->SetWidth(width);
2355  multiplier->SetHeight(height);
2356  multiplier->SetAngle(angle);
2357  multiplier->SetPosition(wxPoint2DDouble(posX, posY));
2358 
2359  multiplier->StartMove(multiplier->GetPosition());
2360  multiplier->SetNodeList(nodeVector);
2361  multiplier->UpdatePoints();
2362  elementList.push_back(multiplier);
2363 
2364  multiplierNode = multiplierNode->next_sibling("Multiplier");
2365  }
2366  //}
2367 
2368  //{ Rate limiter
2369  auto rateLimiterListNode = elementsNode->first_node("RateLimiterList");
2370  if(!rateLimiterListNode) return false;
2371  auto rateLimiterNode = rateLimiterListNode->first_node("RateLimiter");
2372  while(rateLimiterNode) {
2373  int id = GetAttributeValueInt(rateLimiterNode, "ID");
2374  RateLimiter* limiter = new RateLimiter(id);
2375 
2376  auto cadPropNode = rateLimiterNode->first_node("CADProperties");
2377  if(!cadPropNode) return false;
2378 
2379  auto position = cadPropNode->first_node("Position");
2380  double posX = GetNodeValueDouble(position, "X");
2381  double posY = GetNodeValueDouble(position, "Y");
2382  auto size = cadPropNode->first_node("Size");
2383  double width = GetNodeValueDouble(size, "Width");
2384  double height = GetNodeValueDouble(size, "Height");
2385  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2386 
2387  double upLimit = GetNodeValueDouble(rateLimiterNode, "UpperLimit");
2388  double lowLimit = GetNodeValueDouble(rateLimiterNode, "LowerLimit");
2389 
2390  std::vector<Node*> nodeVector;
2391  if(!OpenControlNodeList(rateLimiterNode, nodeVector)) return false;
2392 
2393  limiter->SetWidth(width);
2394  limiter->SetHeight(height);
2395  limiter->SetAngle(angle);
2396  limiter->SetPosition(wxPoint2DDouble(posX, posY));
2397  limiter->SetUpLimit(upLimit);
2398  limiter->SetLowLimit(lowLimit);
2399 
2400  limiter->StartMove(limiter->GetPosition());
2401  limiter->SetNodeList(nodeVector);
2402  limiter->UpdatePoints();
2403  elementList.push_back(limiter);
2404 
2405  rateLimiterNode = rateLimiterNode->next_sibling("RateLimiter");
2406  }
2407  //}
2408 
2409  //{ Sum
2410  auto sumListNode = elementsNode->first_node("SumList");
2411  if(!sumListNode) return false;
2412  auto sumNode = sumListNode->first_node("Sum");
2413  while(sumNode) {
2414  int id = GetAttributeValueInt(sumNode, "ID");
2415  Sum* sum = new Sum(id);
2416 
2417  auto cadPropNode = sumNode->first_node("CADProperties");
2418  if(!cadPropNode) return false;
2419 
2420  auto position = cadPropNode->first_node("Position");
2421  double posX = GetNodeValueDouble(position, "X");
2422  double posY = GetNodeValueDouble(position, "Y");
2423  auto size = cadPropNode->first_node("Size");
2424  double width = GetNodeValueDouble(size, "Width");
2425  double height = GetNodeValueDouble(size, "Height");
2426  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2427 
2428  std::vector<Sum::Signal> signs;
2429  auto signsNode = sumNode->first_node("Signs");
2430  auto sign = signsNode->first_node("Value");
2431  while(sign) {
2432  long value;
2433  wxString(sign->value()).ToCLong(&value);
2434  signs.push_back(static_cast<Sum::Signal>(value));
2435  sign = sign->next_sibling("Value");
2436  }
2437  sum->SetSignalList(signs);
2438 
2439  std::vector<Node*> nodeVector;
2440  if(!OpenControlNodeList(sumNode, nodeVector)) return false;
2441 
2442  sum->SetWidth(width);
2443  sum->SetHeight(height);
2444  sum->SetAngle(angle);
2445  sum->SetPosition(wxPoint2DDouble(posX, posY));
2446 
2447  sum->StartMove(sum->GetPosition());
2448  sum->SetNodeList(nodeVector);
2449  sum->UpdatePoints();
2450  elementList.push_back(sum);
2451 
2452  sumNode = sumNode->next_sibling("Sum");
2453  }
2454  //}
2455 
2456  //{ Transfer function
2457  auto tfListNode = elementsNode->first_node("TransferFunctionList");
2458  if(!tfListNode) return false;
2459  auto tfNode = tfListNode->first_node("TransferFunction");
2460  while(tfNode) {
2461  int id = GetAttributeValueInt(tfNode, "ID");
2462  TransferFunction* tf = new TransferFunction(id);
2463 
2464  auto cadPropNode = tfNode->first_node("CADProperties");
2465  if(!cadPropNode) return false;
2466 
2467  auto position = cadPropNode->first_node("Position");
2468  double posX = GetNodeValueDouble(position, "X");
2469  double posY = GetNodeValueDouble(position, "Y");
2470  auto size = cadPropNode->first_node("Size");
2471  double width = GetNodeValueDouble(size, "Width");
2472  double height = GetNodeValueDouble(size, "Height");
2473  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2474 
2475  std::vector<double> numerator, denominator;
2476  auto numeratorNode = tfNode->first_node("Numerator");
2477  auto nValue = numeratorNode->first_node("Value");
2478  while(nValue) {
2479  double value = 0.0;
2480  wxString(nValue->value()).ToCDouble(&value);
2481  numerator.push_back(value);
2482  nValue = nValue->next_sibling("Value");
2483  }
2484  auto denominatorNode = tfNode->first_node("Denominator");
2485  auto dValue = denominatorNode->first_node("Value");
2486  while(dValue) {
2487  double value = 0.0;
2488  wxString(dValue->value()).ToCDouble(&value);
2489  denominator.push_back(value);
2490  dValue = dValue->next_sibling("Value");
2491  }
2492 
2493  std::vector<Node*> nodeVector;
2494  if(!OpenControlNodeList(tfNode, nodeVector)) return false;
2495 
2496  tf->SetWidth(width);
2497  tf->SetHeight(height);
2498  tf->SetAngle(angle);
2499  tf->SetPosition(wxPoint2DDouble(posX, posY));
2500 
2501  tf->SetNumerator(numerator);
2502  tf->SetDenominator(denominator);
2503 
2504  tf->StartMove(tf->GetPosition());
2505  tf->SetNodeList(nodeVector);
2506 
2507  tf->UpdateTFText();
2508 
2509  elementList.push_back(tf);
2510 
2511  tfNode = tfNode->next_sibling("TransferFunction");
2512  }
2513  //}
2514 
2515  // Connection line
2516  auto connectionListNode = elementsNode->first_node("ConnectionList");
2517  if(!connectionListNode) return false;
2518  auto connNode = connectionListNode->first_node("Connection");
2519  while(connNode) {
2520  ConnectionLine* cLine = NULL;
2521  int id = GetAttributeValueInt(connNode, "ID");
2522 
2523  auto cadPropNode = connNode->first_node("CADProperties");
2524  if(!cadPropNode) return false;
2525  double offset = GetNodeValueDouble(cadPropNode, "Offset");
2526 
2527  auto parentList = connNode->first_node("ParentList");
2528  if(!parentList) return false;
2529 
2530  auto parentNode = parentList->first_node("Parent");
2531  bool firstNode = true;
2532  while(parentNode) {
2533  int elementID = GetNodeValueInt(parentNode, "ElementID");
2534  int nodeID = GetNodeValueInt(parentNode, "NodeID");
2535 
2536  ControlElement* element = GetControlElementFromID(elementList, elementID);
2537  Node* node = element->GetNodeList()[nodeID];
2538 
2539  if(firstNode) cLine = new ConnectionLine(node, id);
2540  cLine->AddParent(element);
2541  element->AddChild(cLine);
2542  if(!firstNode) cLine->AppendNode(node, element);
2543 
2544  if(firstNode) firstNode = false;
2545  parentNode = parentNode->next_sibling("Parent");
2546  }
2547 
2548  auto parentLine = connNode->first_node("ParentLine");
2549  if(!parentLine) return false;
2550  int parentLineID = GetAttributeValueInt(parentLine, "ID");
2551  if(parentLineID != -1) {
2552  for(auto it = connectionList.begin(), itEnd = connectionList.end(); it != itEnd; ++it) {
2553  ConnectionLine* parent = *it;
2554  if(parent->GetID() == parentLineID) {
2555  cLine->SetParentLine(parent);
2556  parent->AddChild(cLine);
2557  }
2558  }
2559  }
2560 
2561  cLine->SetOffset(offset);
2562  cLine->UpdatePoints();
2563  connectionList.push_back(cLine);
2564  connNode = connNode->next_sibling("Connection");
2565  }
2566  ctrlContainer->FillContainer(elementList, connectionList);
2567  return true;
2568 }
2569 
2570 void FileHanding::SaveControlNodes(rapidxml::xml_document<>& doc,
2571  rapidxml::xml_node<>* nodesN,
2572  std::vector<Node*> nodeList)
2573 {
2574  int id = 0;
2575  for(auto it = nodeList.begin(), itEnd = nodeList.end(); it != itEnd; ++it) {
2576  Node* node = *it;
2577  node->SetID(id);
2578  auto nodeN = AppendNode(doc, nodesN, "Node");
2579  SetNodeAttribute(doc, nodeN, "ID", id);
2580  auto nodePosition = AppendNode(doc, nodeN, "Position");
2581  auto posNodeX = AppendNode(doc, nodePosition, "X");
2582  SetNodeValue(doc, posNodeX, node->GetPosition().m_x);
2583  auto posNodeY = AppendNode(doc, nodePosition, "Y");
2584  SetNodeValue(doc, posNodeY, node->GetPosition().m_y);
2585  auto angle = AppendNode(doc, nodeN, "Angle");
2586  SetNodeValue(doc, angle, node->GetAngle());
2587  auto nodeType = AppendNode(doc, nodeN, "Type");
2588  SetNodeValue(doc, nodeType, node->GetNodeType());
2589  id++;
2590  }
2591 }
2592 
2593 ControlElement* FileHanding::GetControlElementFromID(std::vector<ControlElement*> elementList, int id)
2594 {
2595  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
2596  ControlElement* element = *it;
2597  if(element->GetID() == id) return element;
2598  }
2599  return NULL;
2600 }
2601 
2602 bool FileHanding::OpenControlNodeList(rapidxml::xml_node<>* elementNode, std::vector<Node*>& nodeVector)
2603 {
2604  auto nodeList = elementNode->first_node("NodeList");
2605  if(!nodeList) return false;
2606  auto nodeN = nodeList->first_node("Node");
2607  while(nodeN) {
2608  auto nodePosition = nodeN->first_node("Position");
2609  double nodePosX = GetNodeValueDouble(nodePosition, "X");
2610  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
2611  double nodeAngle = GetNodeValueDouble(nodeN, "Angle");
2612  Node::NodeType nodeType = (Node::NodeType)GetNodeValueInt(nodeN, "Type");
2613  Node* node = new Node(wxPoint2DDouble(nodePosX, nodePosY), nodeType, 2.0);
2614  node->SetAngle(nodeAngle);
2615  nodeVector.push_back(node);
2616  nodeN = nodeN->next_sibling("Node");
2617  }
2618  return true;
2619 }
2620 
2621 rapidxml::xml_node<>* FileHanding::AppendNode(rapidxml::xml_document<>& doc,
2622  rapidxml::xml_node<>* parentNode,
2623  const char* name,
2624  rapidxml::node_type nodeType)
2625 {
2626  rapidxml::xml_node<>* node = doc.allocate_node(nodeType, name);
2627  parentNode->append_node(node);
2628  return node;
2629 }
2630 
2631 void FileHanding::SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, wxString value)
2632 {
2633  node->value(doc.allocate_string(value.mb_str()));
2634 }
2635 
2636 void FileHanding::SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, int value)
2637 {
2638  node->value(doc.allocate_string(wxString::Format("%d", value).mb_str()));
2639 }
2640 
2641 void FileHanding::SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, double value)
2642 {
2643  node->value(doc.allocate_string(wxString::FromCDouble(value, 13).mb_str()));
2644 }
2645 
2646 void FileHanding::SetNodeAttribute(rapidxml::xml_document<>& doc,
2647  rapidxml::xml_node<>* node,
2648  const char* atrName,
2649  wxString value)
2650 {
2651  node->append_attribute(doc.allocate_attribute(atrName, doc.allocate_string(value.mb_str())));
2652 }
2653 
2654 void FileHanding::SetNodeAttribute(rapidxml::xml_document<>& doc,
2655  rapidxml::xml_node<>* node,
2656  const char* atrName,
2657  int value)
2658 {
2659  node->append_attribute(
2660  doc.allocate_attribute(atrName, doc.allocate_string(wxString::Format("%d", value).mb_str())));
2661 }
2662 
2663 void FileHanding::SetNodeAttribute(rapidxml::xml_document<>& doc,
2664  rapidxml::xml_node<>* node,
2665  const char* atrName,
2666  double value)
2667 {
2668  node->append_attribute(
2669  doc.allocate_attribute(atrName, doc.allocate_string(wxString::FromCDouble(value, 13).mb_str())));
2670 }
2671 
2672 double FileHanding::GetNodeValueDouble(rapidxml::xml_node<>* parent, const char* nodeName)
2673 {
2674  double dValue = 0.0;
2675  if(parent) {
2676  auto node = parent->first_node(nodeName);
2677  if(node) wxString(node->value()).ToCDouble(&dValue);
2678  }
2679  return dValue;
2680 }
2681 
2682 int FileHanding::GetNodeValueInt(rapidxml::xml_node<>* parent, const char* nodeName)
2683 {
2684  long iValue = -1;
2685  if(parent) {
2686  auto node = parent->first_node(nodeName);
2687  if(node) wxString(node->value()).ToCLong(&iValue);
2688  }
2689  return (int)iValue;
2690 }
2691 
2692 int FileHanding::GetAttributeValueInt(rapidxml::xml_node<>* parent, const char* nodeName, const char* atrName)
2693 {
2694  long iValue = -1;
2695  if(parent) {
2696  auto node = parent->first_node(nodeName);
2697  if(node) {
2698  auto atr = node->first_attribute(atrName);
2699  if(atr) wxString(atr->value()).ToCLong(&iValue);
2700  }
2701  }
2702  return (int)iValue;
2703 }
2704 
2705 int FileHanding::GetAttributeValueInt(rapidxml::xml_node<>* node, const char* atrName)
2706 {
2707  long intValue;
2708  auto atr = node->first_attribute(atrName);
2709  if(!atr) return false;
2710  wxString(atr->value()).ToCLong(&intValue);
2711  return (int)intValue;
2712 }
double GetAngle() const
Get the element angle.
Definition: Element.h:201
-
Definition: Text.h:48
- -
std::vector< double > swTime
Definition: PowerElement.h:78
-
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Machines.cpp:129
- - -
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Branch.cpp:90
- -
const std::vector< Transformer * > GetTransformerList() const
Get the transformers of the system (use GetElementsFromList first).
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Text.cpp:145
-
Definition: Sum.h:9
-
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:517
-
void SetWidth(double width)
Set element width.
Definition: Element.h:129
-
Definition: Gain.h:11
-
FaultData
Information about fault (type and location).
Definition: PowerElement.h:38
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Capacitor.cpp:98
- -
const std::vector< IndMotor * > GetIndMotorList() const
Get the induction motors of the system (use GetElementsFromList first).
-
bool SetOnline(bool online=true)
Set if the element is online or offline.
Definition: Element.cpp:218
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
-
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Shunt.cpp:57
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Load.cpp:104
-
Definition: Limiter.h:8
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Inductor.cpp:96
- - -
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
-
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Machines.cpp:94
-
const std::vector< Bus * > GetBusList() const
Get the buses of the system (use GetElementsFromList first).
- -
std::vector< SwitchingType > swType
Definition: PowerElement.h:77
-
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
- -
virtual void SetDynamicEvent(bool dynEvent=true)
Set if the power element have dynamic event.
Definition: PowerElement.h:191
-
const std::vector< SyncGenerator * > GetSyncGeneratorList() const
Get the synchronous generators of the system (use GetElementsFromList first).
-
virtual void Move(wxPoint2DDouble position)
Move the element other position.
-
const std::vector< Inductor * > GetInductorList() const
Get the inductors of the system (use GetElementsFromList first).
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Element.h:234
-
Definition: Bus.h:45
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Inductor.cpp:7
-
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:219
- -
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Shunt.cpp:15
- -
void SetAngle(double angle)
Set element angle.
Definition: Element.h:135
-
double GetWidth() const
Get the element width.
Definition: Element.h:195
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Line.cpp:119
-
void SetPosition(const wxPoint2DDouble position)
Set the element position and update the rectangle.
Definition: Element.cpp:10
-
const std::vector< Capacitor * > GetCapacitorList() const
Get the capacitors of the system (use GetElementsFromList first).
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Machines.cpp:8
-
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:333
-
Definition: Line.h:35
-
Definition: Load.h:23
-
double GetHeight() const
Get the element height.
Definition: Element.h:183
-
virtual std::vector< wxPoint2DDouble > GetPointList() const
Get the list of points that connect the element to bus.
Definition: Element.h:225
- - - -
const std::vector< Load * > GetLoadList() const
Get the loads of the system (use GetElementsFromList first).
- - -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Machines.cpp:215
-
virtual void SetPointList(std::vector< wxPoint2DDouble > pointList)
Set the list of points that connect the element to the bus.
Definition: Line.cpp:472
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Bus.cpp:167
-
virtual SwitchingData GetSwitchingData()
Returns the switching data of the element.
Definition: PowerElement.h:165
- -
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Shunt.cpp:50
-
SwitchingType
Type of switching.
Definition: PowerElement.h:52
- - - -
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Transformer.cpp:22
-
const std::vector< SyncMotor * > GetSyncMotorList() const
Get the synchronous motors of the system (use GetElementsFromList first).
-
virtual int GetID() const
Get the element ID.
Definition: Element.h:270
- -
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Load.cpp:6
-
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Machines.cpp:148
-
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:171
- -
virtual void GetElementsFromList(std::vector< Element *> elementList)
Separate the power elements from a generic list.
- - - - - -
virtual void SetSwitchingData(SwitchingData data)
Set the switching data of the element.
Definition: PowerElement.h:160
-
double GetRotationAngle() const
Get the angle of rotation.
Definition: Element.h:207
-
const std::vector< Line * > GetLineList() const
Get the lines of the system (use GetElementsFromList first).
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Capacitor.cpp:7
- -
void SetHeight(double height)
Set element height.
Definition: Element.h:111
- - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "FileHanding.h"
19 
20 FileHanding::~FileHanding() {}
21 FileHanding::FileHanding(Workspace* workspace) { m_workspace = workspace; }
22 FileHanding::FileHanding(ControlEditor* controlEditor) { m_controlEditor = controlEditor; }
23 FileHanding::FileHanding() {}
24 void FileHanding::SaveProject(wxFileName path)
25 {
26  // Erase the file (if exists or not) and write the initial data
27  std::ofstream writeProjectsFile(path.GetFullPath());
28  writeProjectsFile.close();
29 
30  rapidxml::xml_document<> doc;
31  rapidxml::file<> xmlFile(path.GetFullPath().mb_str());
32  doc.parse<0>(xmlFile.data());
33 
34  rapidxml::xml_node<>* decl = doc.allocate_node(rapidxml::node_declaration);
35  rapidxml::xml_attribute<>* ver = doc.allocate_attribute("version", "1.0");
36  rapidxml::xml_attribute<>* encoding = doc.allocate_attribute("encoding", "utf-8");
37  decl->append_attribute(ver);
38  decl->append_attribute(encoding);
39  doc.append_node(decl);
40 
41  rapidxml::xml_node<>* rootNode = doc.allocate_node(rapidxml::node_element, "Project");
42  doc.append_node(rootNode);
43 
44  rapidxml::xml_node<>* projectNameNode = AppendNode(doc, rootNode, "Name");
45  SetNodeValue(doc, projectNameNode, path.GetName());
46 
47  auto elementsNode = AppendNode(doc, rootNode, "Elements");
48 
49  // Save all the data
50  ElectricCalculation allElements;
51  allElements.GetElementsFromList(m_workspace->GetElementList());
52 
53  //{ Buses
54  auto busesNode = AppendNode(doc, elementsNode, "BusList");
55  auto busList = allElements.GetBusList();
56  for(int i = 0; i < (int)busList.size(); i++) {
57  Bus* bus = busList[i];
58  auto busNode = AppendNode(doc, busesNode, "Bus");
59  SetNodeAttribute(doc, busNode, "ID", i);
60  auto cadProp = AppendNode(doc, busNode, "CADProperties");
61  auto position = AppendNode(doc, cadProp, "Position");
62  auto posX = AppendNode(doc, position, "X");
63  SetNodeValue(doc, posX, bus->GetPosition().m_x);
64  auto posY = AppendNode(doc, position, "Y");
65  SetNodeValue(doc, posY, bus->GetPosition().m_y);
66  auto size = AppendNode(doc, cadProp, "Size");
67  auto width = AppendNode(doc, size, "Width");
68  SetNodeValue(doc, width, bus->GetWidth());
69  auto height = AppendNode(doc, size, "Height");
70  SetNodeValue(doc, height, bus->GetHeight());
71  auto angle = AppendNode(doc, cadProp, "Angle");
72  SetNodeValue(doc, angle, bus->GetAngle());
73 
74  BusElectricalData data = bus->GetElectricalData();
75  auto electricalProp = AppendNode(doc, busNode, "ElectricalProperties");
76  auto name = AppendNode(doc, electricalProp, "Name");
77  SetNodeValue(doc, name, data.name);
78  auto nominalVoltage = AppendNode(doc, electricalProp, "NominalVoltage");
79  SetNodeValue(doc, nominalVoltage, data.nominalVoltage);
80  SetNodeAttribute(doc, nominalVoltage, "UnitID", data.nominalVoltageUnit);
81  auto isVoltageControlled = AppendNode(doc, electricalProp, "IsVoltageControlled");
82  SetNodeValue(doc, isVoltageControlled, data.isVoltageControlled);
83  auto controlledVoltage = AppendNode(doc, electricalProp, "ControlledVoltage");
84  SetNodeValue(doc, controlledVoltage, data.controlledVoltage);
85  SetNodeAttribute(doc, controlledVoltage, "Choice", data.controlledVoltageUnitChoice);
86  auto slackBus = AppendNode(doc, electricalProp, "SlackBus");
87  SetNodeValue(doc, slackBus, data.slackBus);
88 
89  auto fault = AppendNode(doc, electricalProp, "Fault");
90  auto hasFault = AppendNode(doc, fault, "HasFault");
91  SetNodeValue(doc, hasFault, data.hasFault);
92  auto faultType = AppendNode(doc, fault, "Type");
93  SetNodeValue(doc, faultType, data.faultType);
94  auto faultLocation = AppendNode(doc, fault, "Location");
95  SetNodeValue(doc, faultLocation, data.faultLocation);
96  auto faultResistance = AppendNode(doc, fault, "Resistance");
97  SetNodeValue(doc, faultResistance, data.faultResistance);
98  auto faultReactance = AppendNode(doc, fault, "Reactance");
99  SetNodeValue(doc, faultReactance, data.faultReactance);
100 
101  auto stability = AppendNode(doc, electricalProp, "Stability");
102  auto plotBus = AppendNode(doc, stability, "Plot");
103  SetNodeValue(doc, plotBus, data.plotBus);
104  auto stabHasFault = AppendNode(doc, stability, "HasFault");
105  SetNodeValue(doc, stabHasFault, data.stabHasFault);
106  auto stabFaultTime = AppendNode(doc, stability, "FaultTime");
107  SetNodeValue(doc, stabFaultTime, data.stabFaultTime);
108  auto stabFaultLength = AppendNode(doc, stability, "FaultLength");
109  SetNodeValue(doc, stabFaultLength, data.stabFaultLength);
110  auto stabFaultResistance = AppendNode(doc, stability, "FaultResistance");
111  SetNodeValue(doc, stabFaultResistance, data.stabFaultResistance);
112  auto stabFaultReactance = AppendNode(doc, stability, "FaultReactance");
113  SetNodeValue(doc, stabFaultReactance, data.stabFaultReactance);
114 
115  data.number = i;
116  bus->SetElectricalData(data);
117  } //}
118 
119  //{ Capacitor
120  auto capacitorsNode = AppendNode(doc, elementsNode, "CapacitorList");
121  auto capacitorList = allElements.GetCapacitorList();
122  for(int i = 0; i < (int)capacitorList.size(); i++) {
123  Capacitor* capacitor = capacitorList[i];
124  auto capacitorNode = AppendNode(doc, capacitorsNode, "Capacitor");
125  SetNodeAttribute(doc, capacitorNode, "ID", i);
126  auto cadProp = AppendNode(doc, capacitorNode, "CADProperties");
127  auto position = AppendNode(doc, cadProp, "Position");
128  auto posX = AppendNode(doc, position, "X");
129  SetNodeValue(doc, posX, capacitor->GetPosition().m_x);
130  auto posY = AppendNode(doc, position, "Y");
131  SetNodeValue(doc, posY, capacitor->GetPosition().m_y);
132  auto size = AppendNode(doc, cadProp, "Size");
133  auto width = AppendNode(doc, size, "Width");
134  SetNodeValue(doc, width, capacitor->GetWidth());
135  auto height = AppendNode(doc, size, "Height");
136  SetNodeValue(doc, height, capacitor->GetHeight());
137  auto angle = AppendNode(doc, cadProp, "Angle");
138  SetNodeValue(doc, angle, capacitor->GetAngle());
139  auto nodePos = AppendNode(doc, cadProp, "NodePosition");
140  auto nodePosX = AppendNode(doc, nodePos, "X");
141  SetNodeValue(doc, nodePosX, capacitor->GetPointList()[0].m_x);
142  auto nodePosY = AppendNode(doc, nodePos, "Y");
143  SetNodeValue(doc, nodePosY, capacitor->GetPointList()[0].m_y);
144  auto parentID = AppendNode(doc, cadProp, "ParentID");
145  Bus* parent = static_cast<Bus*>(capacitor->GetParentList()[0]);
146  if(parent) SetNodeValue(doc, parentID, parent->GetElectricalData().number);
147 
148  CapacitorElectricalData data = capacitor->GetElectricalData();
149  auto electricalProp = AppendNode(doc, capacitorNode, "ElectricalProperties");
150  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
151  SetNodeValue(doc, isOnline, capacitor->IsOnline());
152  auto name = AppendNode(doc, electricalProp, "Name");
153  SetNodeValue(doc, name, data.name);
154  auto reactivePower = AppendNode(doc, electricalProp, "ReactivePower");
155  SetNodeValue(doc, reactivePower, data.reactivePower);
156  SetNodeAttribute(doc, reactivePower, "UnitID", data.reactivePowerUnit);
157 
158  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
159  SwitchingData swData = capacitor->GetSwitchingData();
160  for(int j = 0; j < (int)swData.swType.size(); j++) {
161  auto switching = AppendNode(doc, switchingList, "Switching");
162  SetNodeAttribute(doc, switching, "ID", j);
163  auto swType = AppendNode(doc, switching, "Type");
164  SetNodeValue(doc, swType, swData.swType[j]);
165  auto swTime = AppendNode(doc, switching, "Time");
166  SetNodeValue(doc, swTime, swData.swTime[j]);
167  }
168  } //}
169 
170  //{ IndMotor
171  auto indMotorsNode = AppendNode(doc, elementsNode, "IndMotorList");
172  auto indMotorList = allElements.GetIndMotorList();
173  for(int i = 0; i < (int)indMotorList.size(); i++) {
174  IndMotor* indMotor = indMotorList[i];
175  auto indMotorNode = AppendNode(doc, indMotorsNode, "IndMotor");
176  SetNodeAttribute(doc, indMotorNode, "ID", i);
177  auto cadProp = AppendNode(doc, indMotorNode, "CADProperties");
178  auto position = AppendNode(doc, cadProp, "Position");
179  auto posX = AppendNode(doc, position, "X");
180  SetNodeValue(doc, posX, indMotor->GetPosition().m_x);
181  auto posY = AppendNode(doc, position, "Y");
182  SetNodeValue(doc, posY, indMotor->GetPosition().m_y);
183  auto size = AppendNode(doc, cadProp, "Size");
184  auto width = AppendNode(doc, size, "Width");
185  SetNodeValue(doc, width, indMotor->GetWidth());
186  auto height = AppendNode(doc, size, "Height");
187  SetNodeValue(doc, height, indMotor->GetHeight());
188  auto angle = AppendNode(doc, cadProp, "Angle");
189  SetNodeValue(doc, angle, indMotor->GetAngle());
190  auto nodePos = AppendNode(doc, cadProp, "NodePosition");
191  auto nodePosX = AppendNode(doc, nodePos, "X");
192  SetNodeValue(doc, nodePosX, indMotor->GetPointList()[0].m_x);
193  auto nodePosY = AppendNode(doc, nodePos, "Y");
194  SetNodeValue(doc, nodePosY, indMotor->GetPointList()[0].m_y);
195  auto parentID = AppendNode(doc, cadProp, "ParentID");
196  Bus* parent = static_cast<Bus*>(indMotor->GetParentList()[0]);
197  if(parent) SetNodeValue(doc, parentID, parent->GetElectricalData().number);
198 
199  IndMotorElectricalData data = indMotor->GetElectricalData();
200  auto electricalProp = AppendNode(doc, indMotorNode, "ElectricalProperties");
201  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
202  SetNodeValue(doc, isOnline, indMotor->IsOnline());
203  auto name = AppendNode(doc, electricalProp, "Name");
204  SetNodeValue(doc, name, data.name);
205  auto activePower = AppendNode(doc, electricalProp, "ActivePower");
206  SetNodeValue(doc, activePower, data.activePower);
207  SetNodeAttribute(doc, activePower, "UnitID", data.activePowerUnit);
208  auto reactivePower = AppendNode(doc, electricalProp, "ReactivePower");
209  SetNodeValue(doc, reactivePower, data.reactivePower);
210  SetNodeAttribute(doc, reactivePower, "UnitID", data.reactivePowerUnit);
211  } //}
212 
213  //{ Inductor
214  auto inductorsNode = AppendNode(doc, elementsNode, "InductorList");
215  auto inductorList = allElements.GetInductorList();
216  for(int i = 0; i < (int)inductorList.size(); i++) {
217  Inductor* inductor = inductorList[i];
218  auto inductorNode = AppendNode(doc, inductorsNode, "Inductor");
219  SetNodeAttribute(doc, inductorNode, "ID", i);
220  auto cadProp = AppendNode(doc, inductorNode, "CADProperties");
221  auto position = AppendNode(doc, cadProp, "Position");
222  auto posX = AppendNode(doc, position, "X");
223  SetNodeValue(doc, posX, inductor->GetPosition().m_x);
224  auto posY = AppendNode(doc, position, "Y");
225  SetNodeValue(doc, posY, inductor->GetPosition().m_y);
226  auto size = AppendNode(doc, cadProp, "Size");
227  auto width = AppendNode(doc, size, "Width");
228  SetNodeValue(doc, width, inductor->GetWidth());
229  auto height = AppendNode(doc, size, "Height");
230  SetNodeValue(doc, height, inductor->GetHeight());
231  auto angle = AppendNode(doc, cadProp, "Angle");
232  SetNodeValue(doc, angle, inductor->GetAngle());
233  auto nodePos = AppendNode(doc, cadProp, "NodePosition");
234  auto nodePosX = AppendNode(doc, nodePos, "X");
235  SetNodeValue(doc, nodePosX, inductor->GetPointList()[0].m_x);
236  auto nodePosY = AppendNode(doc, nodePos, "Y");
237  SetNodeValue(doc, nodePosY, inductor->GetPointList()[0].m_y);
238  auto parentID = AppendNode(doc, cadProp, "ParentID");
239  Bus* parent = static_cast<Bus*>(inductor->GetParentList()[0]);
240  if(parent) SetNodeValue(doc, parentID, parent->GetElectricalData().number);
241 
242  InductorElectricalData data = inductor->GetElectricalData();
243  auto electricalProp = AppendNode(doc, inductorNode, "ElectricalProperties");
244  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
245  SetNodeValue(doc, isOnline, inductor->IsOnline());
246  auto name = AppendNode(doc, electricalProp, "Name");
247  SetNodeValue(doc, name, data.name);
248  auto reactivePower = AppendNode(doc, electricalProp, "ReactivePower");
249  SetNodeValue(doc, reactivePower, data.reactivePower);
250  SetNodeAttribute(doc, reactivePower, "UnitID", data.reactivePowerUnit);
251 
252  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
253  SwitchingData swData = inductor->GetSwitchingData();
254  for(int j = 0; j < (int)swData.swType.size(); j++) {
255  auto switching = AppendNode(doc, switchingList, "Switching");
256  SetNodeAttribute(doc, switching, "ID", j);
257  auto swType = AppendNode(doc, switching, "Type");
258  SetNodeValue(doc, swType, swData.swType[j]);
259  auto swTime = AppendNode(doc, switching, "Time");
260  SetNodeValue(doc, swTime, swData.swTime[j]);
261  }
262  } //}
263 
264  //{ Line
265  auto linesNode = AppendNode(doc, elementsNode, "LineList");
266  auto lineList = allElements.GetLineList();
267  for(int i = 0; i < (int)lineList.size(); i++) {
268  Line* line = lineList[i];
269  auto lineNode = AppendNode(doc, linesNode, "Line");
270  SetNodeAttribute(doc, lineNode, "ID", i);
271  auto cadProp = AppendNode(doc, lineNode, "CADProperties");
272  auto nodeList = AppendNode(doc, cadProp, "NodeList");
273  auto ptList = line->GetPointList();
274  int nodeID = 0;
275  for(int j = 0; j < (int)ptList.size(); j++) {
276  if((j != 1) && (j != (int)ptList.size() - 2)) {
277  auto nodePos = AppendNode(doc, nodeList, "Node");
278  SetNodeAttribute(doc, nodePos, "ID", nodeID);
279  auto nodePosX = AppendNode(doc, nodePos, "X");
280  SetNodeValue(doc, nodePosX, ptList[j].m_x);
281  auto nodePosY = AppendNode(doc, nodePos, "Y");
282  SetNodeValue(doc, nodePosY, ptList[j].m_y);
283  nodeID++;
284  }
285  }
286 
287  auto parentIDList = AppendNode(doc, cadProp, "ParentIDList");
288  for(int j = 0; j < (int)line->GetParentList().size(); j++) {
289  Bus* parent = static_cast<Bus*>(line->GetParentList()[j]);
290  if(parent) {
291  auto parentID = AppendNode(doc, parentIDList, "ParentID");
292  SetNodeAttribute(doc, parentID, "ID", j);
293  SetNodeValue(doc, parentID, parent->GetElectricalData().number);
294  }
295  }
296 
297  LineElectricalData data = line->GetElectricalData();
298  auto electricalProp = AppendNode(doc, lineNode, "ElectricalProperties");
299  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
300  SetNodeValue(doc, isOnline, line->IsOnline());
301  auto name = AppendNode(doc, electricalProp, "Name");
302  SetNodeValue(doc, name, data.name);
303  auto nominalVoltage = AppendNode(doc, electricalProp, "NominalVoltage");
304  SetNodeValue(doc, nominalVoltage, data.nominalVoltage);
305  SetNodeAttribute(doc, nominalVoltage, "UnitID", data.nominalVoltageUnit);
306  auto nominalPower = AppendNode(doc, electricalProp, "NominalPower");
307  SetNodeValue(doc, nominalPower, data.nominalPower);
308  SetNodeAttribute(doc, nominalPower, "UnitID", data.nominalPowerUnit);
309  auto resistance = AppendNode(doc, electricalProp, "Resistance");
310  SetNodeValue(doc, resistance, data.resistance);
311  SetNodeAttribute(doc, resistance, "UnitID", data.resistanceUnit);
312  auto indReactance = AppendNode(doc, electricalProp, "IndReactance");
313  SetNodeValue(doc, indReactance, data.indReactance);
314  SetNodeAttribute(doc, indReactance, "UnitID", data.indReactanceUnit);
315  auto capSusceptance = AppendNode(doc, electricalProp, "CapSusceptance");
316  SetNodeValue(doc, capSusceptance, data.capSusceptance);
317  SetNodeAttribute(doc, capSusceptance, "UnitID", data.capSusceptanceUnit);
318  auto lineSize = AppendNode(doc, electricalProp, "LineSize");
319  SetNodeValue(doc, lineSize, data.lineSize);
320  auto useLinePower = AppendNode(doc, electricalProp, "UseLinePower");
321  SetNodeValue(doc, useLinePower, data.useLinePower);
322 
323  auto fault = AppendNode(doc, electricalProp, "Fault");
324  auto zeroResistance = AppendNode(doc, fault, "ZeroResistance");
325  SetNodeValue(doc, zeroResistance, data.zeroResistance);
326  auto zeroIndReactance = AppendNode(doc, fault, "ZeroIndReactance");
327  SetNodeValue(doc, zeroIndReactance, data.zeroIndReactance);
328  auto zeroCapSusceptance = AppendNode(doc, fault, "ZeroCapSusceptance");
329  SetNodeValue(doc, zeroCapSusceptance, data.zeroCapSusceptance);
330 
331  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
332  SwitchingData swData = line->GetSwitchingData();
333  for(int j = 0; j < (int)swData.swType.size(); j++) {
334  auto switching = AppendNode(doc, switchingList, "Switching");
335  SetNodeAttribute(doc, switching, "ID", j);
336  auto swType = AppendNode(doc, switching, "Type");
337  SetNodeValue(doc, swType, swData.swType[j]);
338  auto swTime = AppendNode(doc, switching, "Time");
339  SetNodeValue(doc, swTime, swData.swTime[j]);
340  }
341  } //}
342 
343  //{ Load
344  auto loadsNode = AppendNode(doc, elementsNode, "LoadList");
345  auto loadList = allElements.GetLoadList();
346  for(int i = 0; i < (int)loadList.size(); i++) {
347  Load* load = loadList[i];
348  auto loadNode = AppendNode(doc, loadsNode, "Load");
349  SetNodeAttribute(doc, loadNode, "ID", i);
350  auto cadProp = AppendNode(doc, loadNode, "CADProperties");
351  auto position = AppendNode(doc, cadProp, "Position");
352  auto posX = AppendNode(doc, position, "X");
353  SetNodeValue(doc, posX, load->GetPosition().m_x);
354  auto posY = AppendNode(doc, position, "Y");
355  SetNodeValue(doc, posY, load->GetPosition().m_y);
356  auto size = AppendNode(doc, cadProp, "Size");
357  auto width = AppendNode(doc, size, "Width");
358  SetNodeValue(doc, width, load->GetWidth());
359  auto height = AppendNode(doc, size, "Height");
360  SetNodeValue(doc, height, load->GetHeight());
361  auto angle = AppendNode(doc, cadProp, "Angle");
362  SetNodeValue(doc, angle, load->GetAngle());
363  auto nodePos = AppendNode(doc, cadProp, "NodePosition");
364  auto nodePosX = AppendNode(doc, nodePos, "X");
365  SetNodeValue(doc, nodePosX, load->GetPointList()[0].m_x);
366  auto nodePosY = AppendNode(doc, nodePos, "Y");
367  SetNodeValue(doc, nodePosY, load->GetPointList()[0].m_y);
368  auto parentID = AppendNode(doc, cadProp, "ParentID");
369  Bus* parent = static_cast<Bus*>(load->GetParentList()[0]);
370  if(parent) SetNodeValue(doc, parentID, parent->GetElectricalData().number);
371 
372  LoadElectricalData data = load->GetElectricalData();
373  auto electricalProp = AppendNode(doc, loadNode, "ElectricalProperties");
374  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
375  SetNodeValue(doc, isOnline, load->IsOnline());
376  auto name = AppendNode(doc, electricalProp, "Name");
377  SetNodeValue(doc, name, data.name);
378  auto activePower = AppendNode(doc, electricalProp, "ActivePower");
379  SetNodeValue(doc, activePower, data.activePower);
380  SetNodeAttribute(doc, activePower, "UnitID", data.activePowerUnit);
381  auto reactivePower = AppendNode(doc, electricalProp, "ReactivePower");
382  SetNodeValue(doc, reactivePower, data.reactivePower);
383  SetNodeAttribute(doc, reactivePower, "UnitID", data.reactivePowerUnit);
384  auto loadType = AppendNode(doc, electricalProp, "LoadType");
385  SetNodeValue(doc, loadType, data.loadType);
386 
387  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
388  SwitchingData swData = load->GetSwitchingData();
389  for(int j = 0; j < (int)swData.swType.size(); j++) {
390  auto switching = AppendNode(doc, switchingList, "Switching");
391  SetNodeAttribute(doc, switching, "ID", j);
392  auto swType = AppendNode(doc, switching, "Type");
393  SetNodeValue(doc, swType, swData.swType[j]);
394  auto swTime = AppendNode(doc, switching, "Time");
395  SetNodeValue(doc, swTime, swData.swTime[j]);
396  }
397  } //}
398 
399  //{ SyncGenerator
400  auto syncGeneratorsNode = AppendNode(doc, elementsNode, "SyncGeneratorList");
401  auto syncGeneratorList = allElements.GetSyncGeneratorList();
402  for(int i = 0; i < (int)syncGeneratorList.size(); i++) {
403  SyncGenerator* syncGenerator = syncGeneratorList[i];
404  auto syncGeneratorNode = AppendNode(doc, syncGeneratorsNode, "SyncGenerator");
405  SetNodeAttribute(doc, syncGeneratorNode, "ID", i);
406  auto cadProp = AppendNode(doc, syncGeneratorNode, "CADProperties");
407  auto position = AppendNode(doc, cadProp, "Position");
408  auto posX = AppendNode(doc, position, "X");
409  SetNodeValue(doc, posX, syncGenerator->GetPosition().m_x);
410  auto posY = AppendNode(doc, position, "Y");
411  SetNodeValue(doc, posY, syncGenerator->GetPosition().m_y);
412  auto size = AppendNode(doc, cadProp, "Size");
413  auto width = AppendNode(doc, size, "Width");
414  SetNodeValue(doc, width, syncGenerator->GetWidth());
415  auto height = AppendNode(doc, size, "Height");
416  SetNodeValue(doc, height, syncGenerator->GetHeight());
417  auto angle = AppendNode(doc, cadProp, "Angle");
418  SetNodeValue(doc, angle, syncGenerator->GetAngle());
419  auto nodePos = AppendNode(doc, cadProp, "NodePosition");
420  auto nodePosX = AppendNode(doc, nodePos, "X");
421  SetNodeValue(doc, nodePosX, syncGenerator->GetPointList()[0].m_x);
422  auto nodePosY = AppendNode(doc, nodePos, "Y");
423  SetNodeValue(doc, nodePosY, syncGenerator->GetPointList()[0].m_y);
424  auto parentID = AppendNode(doc, cadProp, "ParentID");
425  Bus* parent = static_cast<Bus*>(syncGenerator->GetParentList()[0]);
426  if(parent) SetNodeValue(doc, parentID, parent->GetElectricalData().number);
427 
428  SyncGeneratorElectricalData data = syncGenerator->GetElectricalData();
429  auto electricalProp = AppendNode(doc, syncGeneratorNode, "ElectricalProperties");
430  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
431  SetNodeValue(doc, isOnline, syncGenerator->IsOnline());
432  auto name = AppendNode(doc, electricalProp, "Name");
433  SetNodeValue(doc, name, data.name);
434  auto nominalPower = AppendNode(doc, electricalProp, "NominalPower");
435  SetNodeValue(doc, nominalPower, data.nominalPower);
436  SetNodeAttribute(doc, nominalPower, "UnitID", data.nominalPowerUnit);
437  auto nominalVoltage = AppendNode(doc, electricalProp, "NominalVoltage");
438  SetNodeValue(doc, nominalVoltage, data.nominalVoltage);
439  SetNodeAttribute(doc, nominalVoltage, "UnitID", data.nominalVoltageUnit);
440  auto activePower = AppendNode(doc, electricalProp, "ActivePower");
441  SetNodeValue(doc, activePower, data.activePower);
442  SetNodeAttribute(doc, activePower, "UnitID", data.activePowerUnit);
443  auto reactivePower = AppendNode(doc, electricalProp, "ReactivePower");
444  SetNodeValue(doc, reactivePower, data.reactivePower);
445  SetNodeAttribute(doc, reactivePower, "UnitID", data.reactivePowerUnit);
446  auto haveMaxReactive = AppendNode(doc, electricalProp, "HaveMaxReactive");
447  SetNodeValue(doc, haveMaxReactive, data.haveMaxReactive);
448  auto maxReactive = AppendNode(doc, electricalProp, "MaxReactive");
449  SetNodeValue(doc, maxReactive, data.maxReactive);
450  SetNodeAttribute(doc, maxReactive, "UnitID", data.maxReactiveUnit);
451  auto haveMinReactive = AppendNode(doc, electricalProp, "HaveMinReactive");
452  SetNodeValue(doc, haveMinReactive, data.haveMinReactive);
453  auto minReactive = AppendNode(doc, electricalProp, "MinReactive");
454  SetNodeValue(doc, minReactive, data.minReactive);
455  SetNodeAttribute(doc, minReactive, "UnitID", data.minReactiveUnit);
456  auto useMachineBase = AppendNode(doc, electricalProp, "UseMachineBase");
457  SetNodeValue(doc, useMachineBase, data.useMachineBase);
458 
459  auto fault = AppendNode(doc, electricalProp, "Fault");
460  auto positiveResistance = AppendNode(doc, fault, "PositiveResistance");
461  SetNodeValue(doc, positiveResistance, data.positiveResistance);
462  auto positiveReactance = AppendNode(doc, fault, "PositiveReactance");
463  SetNodeValue(doc, positiveReactance, data.positiveReactance);
464  auto negativeResistance = AppendNode(doc, fault, "NegativeResistance");
465  SetNodeValue(doc, negativeResistance, data.negativeResistance);
466  auto negativeReactance = AppendNode(doc, fault, "NegativeReactance");
467  SetNodeValue(doc, negativeReactance, data.negativeReactance);
468  auto zeroResistance = AppendNode(doc, fault, "ZeroResistance");
469  SetNodeValue(doc, zeroResistance, data.zeroResistance);
470  auto zeroReactance = AppendNode(doc, fault, "ZeroReactance");
471  SetNodeValue(doc, zeroReactance, data.zeroReactance);
472  auto groundResistance = AppendNode(doc, fault, "GroundResistance");
473  SetNodeValue(doc, groundResistance, data.groundResistance);
474  auto groundReactance = AppendNode(doc, fault, "GroundReactance");
475  SetNodeValue(doc, groundReactance, data.groundReactance);
476  auto groundNeutral = AppendNode(doc, fault, "GroundNeutral");
477  SetNodeValue(doc, groundNeutral, data.groundNeutral);
478 
479  auto stability = AppendNode(doc, electricalProp, "Stability");
480  auto plotSyncMachine = AppendNode(doc, stability, "PlotSyncMachine");
481  SetNodeValue(doc, plotSyncMachine, data.plotSyncMachine);
482  auto inertia = AppendNode(doc, stability, "Inertia");
483  SetNodeValue(doc, inertia, data.inertia);
484  auto damping = AppendNode(doc, stability, "Damping");
485  SetNodeValue(doc, damping, data.damping);
486  auto useAVR = AppendNode(doc, stability, "UseAVR");
487  SetNodeValue(doc, useAVR, data.useAVR);
488  auto useSpeedGovernor = AppendNode(doc, stability, "UseSpeedGovernor");
489  SetNodeValue(doc, useSpeedGovernor, data.useSpeedGovernor);
490  auto armResistance = AppendNode(doc, stability, "ArmResistance");
491  SetNodeValue(doc, armResistance, data.armResistance);
492  auto potierReactance = AppendNode(doc, stability, "PotierReactance");
493  SetNodeValue(doc, potierReactance, data.potierReactance);
494  auto satFactor = AppendNode(doc, stability, "SatFactor");
495  SetNodeValue(doc, satFactor, data.satFactor);
496  auto syncXd = AppendNode(doc, stability, "SyncXd");
497  SetNodeValue(doc, syncXd, data.syncXd);
498  auto syncXq = AppendNode(doc, stability, "SyncXq");
499  SetNodeValue(doc, syncXq, data.syncXq);
500  auto transXd = AppendNode(doc, stability, "TransXd");
501  SetNodeValue(doc, transXd, data.transXd);
502  auto transXq = AppendNode(doc, stability, "TransXq");
503  SetNodeValue(doc, transXq, data.transXq);
504  auto transTd0 = AppendNode(doc, stability, "TransTd0");
505  SetNodeValue(doc, transTd0, data.transTd0);
506  auto transTq0 = AppendNode(doc, stability, "TransTq0");
507  SetNodeValue(doc, transTq0, data.transTq0);
508  auto subXd = AppendNode(doc, stability, "SubXd");
509  SetNodeValue(doc, subXd, data.subXd);
510  auto subXq = AppendNode(doc, stability, "SubXq");
511  SetNodeValue(doc, subXq, data.subXq);
512  auto subTd0 = AppendNode(doc, stability, "SubTd0");
513  SetNodeValue(doc, subTd0, data.subTd0);
514  auto subTq0 = AppendNode(doc, stability, "SubTq0");
515  SetNodeValue(doc, subTq0, data.subTq0);
516 
517  auto avr = AppendNode(doc, stability, "AVR");
518  if(data.avr) SaveControlElements(doc, avr, data.avr);
519 
520  auto speedGov = AppendNode(doc, stability, "SpeedGovernor");
521  if(data.speedGov) SaveControlElements(doc, speedGov, data.speedGov);
522 
523  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
524  SwitchingData swData = syncGenerator->GetSwitchingData();
525  for(int j = 0; j < (int)swData.swType.size(); j++) {
526  auto switching = AppendNode(doc, switchingList, "Switching");
527  SetNodeAttribute(doc, switching, "ID", j);
528  auto swType = AppendNode(doc, switching, "Type");
529  SetNodeValue(doc, swType, swData.swType[j]);
530  auto swTime = AppendNode(doc, switching, "Time");
531  SetNodeValue(doc, swTime, swData.swTime[j]);
532  }
533  } //}
534 
535  //{ SyncMotor
536  auto syncMotorsNode = AppendNode(doc, elementsNode, "SyncMotorList");
537  auto syncMotorList = allElements.GetSyncMotorList();
538  for(int i = 0; i < (int)syncMotorList.size(); i++) {
539  SyncMotor* syncMotor = syncMotorList[i];
540  auto syncMotorNode = AppendNode(doc, syncMotorsNode, "SyncMotor");
541  SetNodeAttribute(doc, syncMotorNode, "ID", i);
542  auto cadProp = AppendNode(doc, syncMotorNode, "CADProperties");
543  auto position = AppendNode(doc, cadProp, "Position");
544  auto posX = AppendNode(doc, position, "X");
545  SetNodeValue(doc, posX, syncMotor->GetPosition().m_x);
546  auto posY = AppendNode(doc, position, "Y");
547  SetNodeValue(doc, posY, syncMotor->GetPosition().m_y);
548  auto size = AppendNode(doc, cadProp, "Size");
549  auto width = AppendNode(doc, size, "Width");
550  SetNodeValue(doc, width, syncMotor->GetWidth());
551  auto height = AppendNode(doc, size, "Height");
552  SetNodeValue(doc, height, syncMotor->GetHeight());
553  auto angle = AppendNode(doc, cadProp, "Angle");
554  SetNodeValue(doc, angle, syncMotor->GetAngle());
555  auto nodePos = AppendNode(doc, cadProp, "NodePosition");
556  auto nodePosX = AppendNode(doc, nodePos, "X");
557  SetNodeValue(doc, nodePosX, syncMotor->GetPointList()[0].m_x);
558  auto nodePosY = AppendNode(doc, nodePos, "Y");
559  SetNodeValue(doc, nodePosY, syncMotor->GetPointList()[0].m_y);
560  auto parentID = AppendNode(doc, cadProp, "ParentID");
561  Bus* parent = static_cast<Bus*>(syncMotor->GetParentList()[0]);
562  if(parent) SetNodeValue(doc, parentID, parent->GetElectricalData().number);
563 
564  SyncMotorElectricalData data = syncMotor->GetElectricalData();
565  auto electricalProp = AppendNode(doc, syncMotorNode, "ElectricalProperties");
566  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
567  SetNodeValue(doc, isOnline, syncMotor->IsOnline());
568  auto name = AppendNode(doc, electricalProp, "Name");
569  SetNodeValue(doc, name, data.name);
570  auto nominalPower = AppendNode(doc, electricalProp, "NominalPower");
571  SetNodeValue(doc, nominalPower, data.nominalPower);
572  SetNodeAttribute(doc, nominalPower, "UnitID", data.nominalPowerUnit);
573  // auto nominalVoltage = AppendNode(doc, electricalProp, "NominalVoltage");
574  // SetNodeValue(doc, nominalVoltage, data.nominalVoltage);
575  // SetNodeAttribute(doc, nominalVoltage, "UnitID", data.nominalVoltageUnit);
576  auto activePower = AppendNode(doc, electricalProp, "ActivePower");
577  SetNodeValue(doc, activePower, data.activePower);
578  SetNodeAttribute(doc, activePower, "UnitID", data.activePowerUnit);
579  auto reactivePower = AppendNode(doc, electricalProp, "ReactivePower");
580  SetNodeValue(doc, reactivePower, data.reactivePower);
581  SetNodeAttribute(doc, reactivePower, "UnitID", data.reactivePowerUnit);
582  auto haveMaxReactive = AppendNode(doc, electricalProp, "HaveMaxReactive");
583  SetNodeValue(doc, haveMaxReactive, data.haveMaxReactive);
584  auto maxReactive = AppendNode(doc, electricalProp, "MaxReactive");
585  SetNodeValue(doc, maxReactive, data.maxReactive);
586  SetNodeAttribute(doc, maxReactive, "UnitID", data.maxReactiveUnit);
587  auto haveMinReactive = AppendNode(doc, electricalProp, "HaveMinReactive");
588  SetNodeValue(doc, haveMinReactive, data.haveMinReactive);
589  auto minReactive = AppendNode(doc, electricalProp, "MinReactive");
590  SetNodeValue(doc, minReactive, data.minReactive);
591  SetNodeAttribute(doc, minReactive, "UnitID", data.minReactiveUnit);
592  auto useMachineBase = AppendNode(doc, electricalProp, "UseMachineBase");
593  SetNodeValue(doc, useMachineBase, data.useMachineBase);
594 
595  auto fault = AppendNode(doc, electricalProp, "Fault");
596  auto positiveResistance = AppendNode(doc, fault, "PositiveResistance");
597  SetNodeValue(doc, positiveResistance, data.positiveResistance);
598  auto positiveReactance = AppendNode(doc, fault, "PositiveReactance");
599  SetNodeValue(doc, positiveReactance, data.positiveReactance);
600  auto negativeResistance = AppendNode(doc, fault, "NegativeResistance");
601  SetNodeValue(doc, negativeResistance, data.negativeResistance);
602  auto negativeReactance = AppendNode(doc, fault, "NegativeReactance");
603  SetNodeValue(doc, negativeReactance, data.negativeReactance);
604  auto zeroResistance = AppendNode(doc, fault, "ZeroResistance");
605  SetNodeValue(doc, zeroResistance, data.zeroResistance);
606  auto zeroReactance = AppendNode(doc, fault, "ZeroReactance");
607  SetNodeValue(doc, zeroReactance, data.zeroReactance);
608  auto groundResistance = AppendNode(doc, fault, "GroundResistance");
609  SetNodeValue(doc, groundResistance, data.groundResistance);
610  auto groundReactance = AppendNode(doc, fault, "GroundReactance");
611  SetNodeValue(doc, groundReactance, data.groundReactance);
612  auto groundNeutral = AppendNode(doc, fault, "GroundNeutral");
613  SetNodeValue(doc, groundNeutral, data.groundNeutral);
614 
615  // To future use...
616  /*auto stability = AppendNode(doc, electricalProp, "Stability");
617  auto plotSyncMachine = AppendNode(doc, stability, "PlotSyncMotor");
618  SetNodeValue(doc, plotSyncMachine, data.plotSyncMachine);
619  auto inertia = AppendNode(doc, stability, "Inertia");
620  SetNodeValue(doc, inertia, data.inertia);
621  auto damping = AppendNode(doc, stability, "Damping");
622  SetNodeValue(doc, damping, data.damping);
623  auto useAVR = AppendNode(doc, stability, "UseAVR");
624  SetNodeValue(doc, useAVR, data.useAVR);
625  auto armResistance = AppendNode(doc, stability, "ArmResistance");
626  SetNodeValue(doc, armResistance, data.armResistance);
627  auto potierReactance = AppendNode(doc, stability, "PotierReactance");
628  SetNodeValue(doc, potierReactance, data.potierReactance);
629  auto satFactor = AppendNode(doc, stability, "SatFactor");
630  SetNodeValue(doc, satFactor, data.satFactor);
631  auto syncXd = AppendNode(doc, stability, "SyncXd");
632  SetNodeValue(doc, syncXd, data.syncXd);
633  auto syncXq = AppendNode(doc, stability, "SyncXq");
634  SetNodeValue(doc, syncXq, data.syncXq);
635  auto transXd = AppendNode(doc, stability, "TransXd");
636  SetNodeValue(doc, transXd, data.transXd);
637  auto transXq = AppendNode(doc, stability, "TransXq");
638  SetNodeValue(doc, transXq, data.transXq);
639  auto transTd0 = AppendNode(doc, stability, "TransTd0");
640  SetNodeValue(doc, transTd0, data.transTd0);
641  auto transTq0 = AppendNode(doc, stability, "TransTq0");
642  SetNodeValue(doc, transTq0, data.transTq0);
643  auto subXd = AppendNode(doc, stability, "SubXd");
644  SetNodeValue(doc, subXd, data.subXd);
645  auto subXq = AppendNode(doc, stability, "SubXq");
646  SetNodeValue(doc, subXq, data.subXq);
647  auto subTd0 = AppendNode(doc, stability, "SubTd0");
648  SetNodeValue(doc, subTd0, data.subTd0);
649  auto subTq0 = AppendNode(doc, stability, "SubTq0");
650  SetNodeValue(doc, subTq0, data.subTq0);
651 
652  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
653  SwitchingData swData = syncGenerator->GetSwitchingData();
654  for(int j = 0; j < (int)swData.swType.size(); j++) {
655  auto switching = AppendNode(doc, switchingList, "Switching");
656  SetNodeAttribute(doc, switching, "ID", j);
657  auto swType = AppendNode(doc, switching, "Type");
658  SetNodeValue(doc, swType, swData.swType[j]);
659  auto swTime = AppendNode(doc, switching, "Time");
660  SetNodeValue(doc, swTime, swData.swTime[j]);
661  }*/
662  } //}
663 
664  //{ Transfomer
665  auto transformersNode = AppendNode(doc, elementsNode, "TransformerList");
666  auto transformerList = allElements.GetTransformerList();
667  for(int i = 0; i < (int)transformerList.size(); i++) {
668  Transformer* transfomer = transformerList[i];
669  auto transformerNode = AppendNode(doc, transformersNode, "Transfomer");
670  SetNodeAttribute(doc, transformerNode, "ID", i);
671  auto cadProp = AppendNode(doc, transformerNode, "CADProperties");
672  auto position = AppendNode(doc, cadProp, "Position");
673  auto posX = AppendNode(doc, position, "X");
674  SetNodeValue(doc, posX, transfomer->GetPosition().m_x);
675  auto posY = AppendNode(doc, position, "Y");
676  SetNodeValue(doc, posY, transfomer->GetPosition().m_y);
677  auto size = AppendNode(doc, cadProp, "Size");
678  auto width = AppendNode(doc, size, "Width");
679  SetNodeValue(doc, width, transfomer->GetWidth());
680  auto height = AppendNode(doc, size, "Height");
681  SetNodeValue(doc, height, transfomer->GetHeight());
682  auto angle = AppendNode(doc, cadProp, "Angle");
683  SetNodeValue(doc, angle, transfomer->GetAngle());
684  auto nodeList = AppendNode(doc, cadProp, "NodeList");
685  auto nodePos1 = AppendNode(doc, nodeList, "Node");
686  SetNodeAttribute(doc, nodePos1, "ID", 0);
687  auto nodePosX1 = AppendNode(doc, nodePos1, "X");
688  SetNodeValue(doc, nodePosX1, transfomer->GetPointList()[0].m_x);
689  auto nodePosY1 = AppendNode(doc, nodePos1, "Y");
690  SetNodeValue(doc, nodePosY1, transfomer->GetPointList()[0].m_y);
691  auto nodePos2 = AppendNode(doc, nodeList, "Node");
692  SetNodeAttribute(doc, nodePos2, "ID", 1);
693  auto nodePosX2 = AppendNode(doc, nodePos2, "X");
694  SetNodeValue(doc, nodePosX2, transfomer->GetPointList()[transfomer->GetPointList().size() - 1].m_x);
695  auto nodePosY2 = AppendNode(doc, nodePos2, "Y");
696  SetNodeValue(doc, nodePosY2, transfomer->GetPointList()[transfomer->GetPointList().size() - 1].m_y);
697 
698  auto parentIDList = AppendNode(doc, cadProp, "ParentIDList");
699  for(int j = 0; j < (int)transfomer->GetParentList().size(); j++) {
700  Bus* parent = static_cast<Bus*>(transfomer->GetParentList()[j]);
701  if(parent) {
702  auto parentID = AppendNode(doc, parentIDList, "ParentID");
703  SetNodeAttribute(doc, parentID, "ID", j);
704  SetNodeValue(doc, parentID, parent->GetElectricalData().number);
705  }
706  }
707 
708  TransformerElectricalData data = transfomer->GetElectricalData();
709  auto electricalProp = AppendNode(doc, transformerNode, "ElectricalProperties");
710  auto isOnline = AppendNode(doc, electricalProp, "IsOnline");
711  SetNodeValue(doc, isOnline, transfomer->IsOnline());
712  auto name = AppendNode(doc, electricalProp, "Name");
713  SetNodeValue(doc, name, data.name);
714  auto primaryNominalVoltage = AppendNode(doc, electricalProp, "PrimaryNominalVoltage");
715  SetNodeValue(doc, primaryNominalVoltage, data.primaryNominalVoltage);
716  SetNodeAttribute(doc, primaryNominalVoltage, "UnitID", data.primaryNominalVoltageUnit);
717  auto secondaryNominalVoltage = AppendNode(doc, electricalProp, "SecondaryNominalVoltage");
718  SetNodeValue(doc, secondaryNominalVoltage, data.secondaryNominalVoltage);
719  SetNodeAttribute(doc, secondaryNominalVoltage, "UnitID", data.secondaryNominalVoltageUnit);
720  auto nominalPower = AppendNode(doc, electricalProp, "NominalPower");
721  SetNodeValue(doc, nominalPower, data.nominalPower);
722  SetNodeAttribute(doc, nominalPower, "UnitID", data.nominalPowerUnit);
723  auto resistance = AppendNode(doc, electricalProp, "Resistance");
724  SetNodeValue(doc, resistance, data.resistance);
725  SetNodeAttribute(doc, resistance, "UnitID", data.resistanceUnit);
726  auto indReactance = AppendNode(doc, electricalProp, "IndReactance");
727  SetNodeValue(doc, indReactance, data.indReactance);
728  SetNodeAttribute(doc, indReactance, "UnitID", data.indReactanceUnit);
729  auto connection = AppendNode(doc, electricalProp, "Connection");
730  SetNodeValue(doc, connection, data.connection);
731  auto turnsRatio = AppendNode(doc, electricalProp, "TurnsRatio");
732  SetNodeValue(doc, turnsRatio, data.turnsRatio);
733  auto phaseShift = AppendNode(doc, electricalProp, "PhaseShift");
734  SetNodeValue(doc, phaseShift, data.phaseShift);
735  auto useTransformerPower = AppendNode(doc, electricalProp, "UseTransfomerPower");
736  SetNodeValue(doc, useTransformerPower, data.useTransformerPower);
737 
738  auto fault = AppendNode(doc, electricalProp, "Fault");
739  auto zeroResistance = AppendNode(doc, fault, "ZeroResistance");
740  SetNodeValue(doc, zeroResistance, data.zeroResistance);
741  auto zeroIndReactance = AppendNode(doc, fault, "ZeroIndReactance");
742  SetNodeValue(doc, zeroIndReactance, data.zeroIndReactance);
743  auto primaryGrndResistance = AppendNode(doc, fault, "PrimaryGrndResistance");
744  SetNodeValue(doc, primaryGrndResistance, data.primaryGrndResistance);
745  auto primaryGrndReactance = AppendNode(doc, fault, "PrimaryGrndReactance");
746  SetNodeValue(doc, primaryGrndReactance, data.primaryGrndReactance);
747  auto secondaryGrndResistance = AppendNode(doc, fault, "SecondaryGrndResistance");
748  SetNodeValue(doc, secondaryGrndResistance, data.secondaryGrndResistance);
749  auto secondaryGrndReactance = AppendNode(doc, fault, "SecondaryGrndReactance");
750  SetNodeValue(doc, secondaryGrndReactance, data.secondaryGrndReactance);
751 
752  auto switchingList = AppendNode(doc, electricalProp, "SwitchingList");
753  SwitchingData swData = transfomer->GetSwitchingData();
754  for(int j = 0; j < (int)swData.swType.size(); j++) {
755  auto switching = AppendNode(doc, switchingList, "Switching");
756  SetNodeAttribute(doc, switching, "ID", j);
757  auto swType = AppendNode(doc, switching, "Type");
758  SetNodeValue(doc, swType, swData.swType[j]);
759  auto swTime = AppendNode(doc, switching, "Time");
760  SetNodeValue(doc, swTime, swData.swTime[j]);
761  }
762  } //}
763 
764  //{ Text
765  auto textsNode = AppendNode(doc, elementsNode, "TextList");
766  auto textList = m_workspace->GetTextList();
767  for(int i = 0; i < (int)textList.size(); i++) {
768  Text* text = textList[i];
769  auto textNode = AppendNode(doc, textsNode, "Text");
770  SetNodeAttribute(doc, textNode, "ID", i);
771  auto cadProp = AppendNode(doc, textNode, "CADProperties");
772  auto position = AppendNode(doc, cadProp, "Position");
773  auto posX = AppendNode(doc, position, "X");
774  SetNodeValue(doc, posX, text->GetPosition().m_x);
775  auto posY = AppendNode(doc, position, "Y");
776  SetNodeValue(doc, posY, text->GetPosition().m_y);
777  auto size = AppendNode(doc, cadProp, "Size");
778  auto width = AppendNode(doc, size, "Width");
779  SetNodeValue(doc, width, text->GetWidth());
780  auto height = AppendNode(doc, size, "Height");
781  SetNodeValue(doc, height, text->GetHeight());
782  auto angle = AppendNode(doc, cadProp, "Angle");
783  SetNodeValue(doc, angle, text->GetAngle());
784  auto textProperties = AppendNode(doc, textNode, "TextProperties");
785  auto elementType = AppendNode(doc, textProperties, "ElementType");
786  SetNodeValue(doc, elementType, text->GetElementType());
787  auto elementNumber = AppendNode(doc, textProperties, "ElementNumber");
788  SetNodeValue(doc, elementNumber, text->GetElementNumber());
789  auto dataType = AppendNode(doc, textProperties, "DataType");
790  SetNodeValue(doc, dataType, text->GetDataType());
791  auto dataUnit = AppendNode(doc, textProperties, "DataUnit");
792  SetNodeValue(doc, dataUnit, text->GetUnit());
793  auto direction = AppendNode(doc, textProperties, "Direction");
794  SetNodeValue(doc, direction, text->GetDirection());
795  auto decimalPlaces = AppendNode(doc, textProperties, "DecimalPlaces");
796  SetNodeValue(doc, decimalPlaces, text->GetDecimalPlaces());
797  }
798  //}
799 
800  std::ofstream writeXML(path.GetFullPath());
801  writeXML << doc;
802  writeXML.close();
803 }
804 
805 bool FileHanding::OpenProject(wxFileName path)
806 {
807  rapidxml::xml_document<> doc;
808  rapidxml::file<> xmlFile(path.GetFullPath().mb_str());
809 
810  doc.parse<0>(xmlFile.data());
811 
812  auto projectNode = doc.first_node("Project");
813  if(!projectNode) return false;
814  auto nameNode = projectNode->first_node("Name");
815  if(!nameNode) return false;
816  m_workspace->SetName(nameNode->value());
817 
818  // Open elements
819  auto elementsNode = projectNode->first_node("Elements");
820  if(!elementsNode) return false;
821  std::vector<Element*> elementList;
822  // Save lists individually to get parents
823  std::vector<Bus*> busList;
824  std::vector<Capacitor*> capacitorList;
825  std::vector<IndMotor*> indMotorList;
826  std::vector<Inductor*> inductorList;
827  std::vector<Line*> lineList;
828  std::vector<Load*> loadList;
829  std::vector<SyncGenerator*> syncGeneratorList;
830  std::vector<SyncMotor*> syncMotorList;
831  std::vector<Transformer*> transformerList;
832  std::vector<Text*> textList;
833 
834  //{ Bus
835  auto busListNode = elementsNode->first_node("BusList");
836  if(!busListNode) return false;
837  auto busNode = busListNode->first_node("Bus");
838  while(busNode) {
839  auto cadPropNode = busNode->first_node("CADProperties");
840  if(!cadPropNode) return false;
841 
842  auto position = cadPropNode->first_node("Position");
843  double posX = GetNodeValueDouble(position, "X");
844  double posY = GetNodeValueDouble(position, "Y");
845  Bus* bus = new Bus(wxPoint2DDouble(posX, posY));
846 
847  auto size = cadPropNode->first_node("Size");
848  double width = GetNodeValueDouble(size, "Width");
849  double height = GetNodeValueDouble(size, "Height");
850  double angle = GetNodeValueDouble(cadPropNode, "Angle");
851  bus->SetWidth(width);
852  bus->SetHeight(height);
853  bus->SetPosition(bus->GetPosition()); // Update bus rectangle.
854  int numRot = angle / bus->GetRotationAngle();
855  bool clockwise = true;
856  if(numRot < 0) {
857  numRot = std::abs(numRot);
858  clockwise = false;
859  }
860  for(int i = 0; i < numRot; i++) bus->Rotate(clockwise);
861 
862  BusElectricalData data = bus->GetElectricalData();
863  auto electricalProp = busNode->first_node("ElectricalProperties");
864  if(!electricalProp) return false;
865 
866  data.name = electricalProp->first_node("Name")->value();
867  data.nominalVoltage = GetNodeValueDouble(electricalProp, "NominalVoltage");
868  data.nominalVoltageUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalVoltage", "UnitID");
869  data.isVoltageControlled = GetNodeValueInt(electricalProp, "IsVoltageControlled");
870  data.controlledVoltage = GetNodeValueDouble(electricalProp, "ControlledVoltage");
871  data.controlledVoltageUnitChoice = GetAttributeValueInt(electricalProp, "ControlledVoltage", "Choice");
872  data.slackBus = GetNodeValueInt(electricalProp, "SlackBus");
873  auto fault = electricalProp->first_node("Fault");
874  data.hasFault = GetNodeValueInt(fault, "HasFault");
875  data.faultType = (FaultData)GetNodeValueInt(fault, "Type");
876  data.faultLocation = (FaultData)GetNodeValueInt(fault, "Location");
877  data.faultResistance = GetNodeValueDouble(fault, "Resistance");
878  data.faultReactance = GetNodeValueDouble(fault, "Reactance");
879  auto stability = electricalProp->first_node("Stability");
880  data.plotBus = GetNodeValueInt(stability, "Plot");
881  data.stabHasFault = GetNodeValueInt(stability, "HasFault");
882  data.stabFaultTime = GetNodeValueDouble(stability, "FaultTime");
883  data.stabFaultLength = GetNodeValueDouble(stability, "FaultLength");
884  data.stabFaultResistance = GetNodeValueDouble(stability, "FaultResistance");
885  data.stabFaultReactance = GetNodeValueDouble(stability, "FaultReactance");
886 
887  bus->SetElectricalData(data);
888 
889  if(data.stabHasFault) bus->SetDynamicEvent(true);
890 
891  elementList.push_back(bus);
892  busList.push_back(bus);
893  busNode = busNode->next_sibling("Bus");
894  } //}
895 
896  //{ Capacitor
897  auto capacitorListNode = elementsNode->first_node("CapacitorList");
898  if(!capacitorListNode) return false;
899  auto capacitorNode = capacitorListNode->first_node("Capacitor");
900  while(capacitorNode) {
901  Capacitor* capacitor = new Capacitor();
902 
903  auto cadPropNode = capacitorNode->first_node("CADProperties");
904  if(!cadPropNode) return false;
905 
906  auto position = cadPropNode->first_node("Position");
907  double posX = GetNodeValueDouble(position, "X");
908  double posY = GetNodeValueDouble(position, "Y");
909  auto size = cadPropNode->first_node("Size");
910  double width = GetNodeValueDouble(size, "Width");
911  double height = GetNodeValueDouble(size, "Height");
912  double angle = GetNodeValueDouble(cadPropNode, "Angle");
913  auto nodePosition = cadPropNode->first_node("NodePosition");
914  double nodePosX = GetNodeValueDouble(nodePosition, "X");
915  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
916  int parentID = GetNodeValueInt(cadPropNode, "ParentID");
917  if(parentID == -1) {
918  // If the element has no parent, create a temporary one, remove and delete.
919  Bus* parent = new Bus(wxPoint2DDouble(nodePosX, nodePosY));
920  capacitor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
921  capacitor->StartMove(capacitor->GetPosition());
922  capacitor->Move(wxPoint2DDouble(posX, posY));
923  capacitor->RemoveParent(parent);
924  delete parent;
925  } else {
926  Bus* parent = busList[parentID];
927  capacitor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
928  capacitor->StartMove(capacitor->GetPosition());
929  capacitor->Move(wxPoint2DDouble(posX, posY));
930  }
931  capacitor->SetWidth(width);
932  capacitor->SetHeight(height);
933 
934  int numRot = angle / capacitor->GetRotationAngle();
935  bool clockwise = true;
936  if(numRot < 0) {
937  numRot = std::abs(numRot);
938  clockwise = false;
939  }
940  for(int i = 0; i < numRot; i++) capacitor->Rotate(clockwise);
941 
942  auto electricalProp = capacitorNode->first_node("ElectricalProperties");
943  if(!electricalProp) return false;
944 
945  capacitor->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
946  CapacitorElectricalData data = capacitor->GetElectricalData();
947  data.name = electricalProp->first_node("Name")->value();
948  data.reactivePower = GetNodeValueDouble(electricalProp, "ReactivePower");
949  data.reactivePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID");
950 
951  SwitchingData swData;
952  auto switchingList = electricalProp->first_node("SwitchingList");
953  if(!switchingList) return false;
954  auto swNode = switchingList->first_node("Switching");
955  while(swNode) {
956  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
957  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
958  swNode = swNode->next_sibling("Switching");
959  }
960  capacitor->SetSwitchingData(swData);
961 
962  capacitor->SetElectricalData(data);
963 
964  if(swData.swTime.size() != 0) capacitor->SetDynamicEvent(true);
965 
966  elementList.push_back(capacitor);
967  capacitorList.push_back(capacitor);
968  capacitorNode = capacitorNode->next_sibling("Capacitor");
969  } //}
970 
971  //{ IndMotor
972  auto indMotorListNode = elementsNode->first_node("IndMotorList");
973  if(!indMotorListNode) return false;
974  auto indMotorNode = indMotorListNode->first_node("IndMotor");
975  while(indMotorNode) {
976  IndMotor* indMotor = new IndMotor();
977 
978  auto cadPropNode = indMotorNode->first_node("CADProperties");
979  if(!cadPropNode) return false;
980 
981  auto position = cadPropNode->first_node("Position");
982  double posX = GetNodeValueDouble(position, "X");
983  double posY = GetNodeValueDouble(position, "Y");
984  auto size = cadPropNode->first_node("Size");
985  double width = GetNodeValueDouble(size, "Width");
986  double height = GetNodeValueDouble(size, "Height");
987  double angle = GetNodeValueDouble(cadPropNode, "Angle");
988  auto nodePosition = cadPropNode->first_node("NodePosition");
989  double nodePosX = GetNodeValueDouble(nodePosition, "X");
990  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
991  int parentID = GetNodeValueInt(cadPropNode, "ParentID");
992  if(parentID == -1) {
993  // If the element has no parent, create a temporary one, remove and delete.
994  Bus* parent = new Bus(wxPoint2DDouble(nodePosX, nodePosY));
995  indMotor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
996  indMotor->StartMove(indMotor->GetPosition());
997  indMotor->Move(wxPoint2DDouble(posX, posY));
998  indMotor->RemoveParent(parent);
999  delete parent;
1000  } else {
1001  Bus* parent = busList[parentID];
1002  indMotor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1003  indMotor->StartMove(indMotor->GetPosition());
1004  indMotor->Move(wxPoint2DDouble(posX, posY));
1005  }
1006  indMotor->SetWidth(width);
1007  indMotor->SetHeight(height);
1008 
1009  int numRot = angle / indMotor->GetRotationAngle();
1010  bool clockwise = true;
1011  if(numRot < 0) {
1012  numRot = std::abs(numRot);
1013  clockwise = false;
1014  }
1015  for(int i = 0; i < numRot; i++) indMotor->Rotate(clockwise);
1016 
1017  auto electricalProp = indMotorNode->first_node("ElectricalProperties");
1018  if(!electricalProp) return false;
1019 
1020  indMotor->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1021  IndMotorElectricalData data = indMotor->GetElectricalData();
1022  data.name = electricalProp->first_node("Name")->value();
1023  data.activePower = GetNodeValueDouble(electricalProp, "ActivePower");
1024  data.activePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ActivePower", "UnitID");
1025  data.reactivePower = GetNodeValueDouble(electricalProp, "ReactivePower");
1026  data.reactivePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID");
1027 
1028  indMotor->SetElectricalData(data);
1029  elementList.push_back(indMotor);
1030  indMotorList.push_back(indMotor);
1031  indMotorNode = indMotorNode->next_sibling("IndMotor");
1032  } //}
1033 
1034  //{ Inductor
1035  auto inductorListNode = elementsNode->first_node("InductorList");
1036  if(!inductorListNode) return false;
1037  auto inductorNode = inductorListNode->first_node("Inductor");
1038  while(inductorNode) {
1039  Inductor* inductor = new Inductor();
1040 
1041  auto cadPropNode = inductorNode->first_node("CADProperties");
1042  if(!cadPropNode) return false;
1043 
1044  auto position = cadPropNode->first_node("Position");
1045  double posX = GetNodeValueDouble(position, "X");
1046  double posY = GetNodeValueDouble(position, "Y");
1047  auto size = cadPropNode->first_node("Size");
1048  double width = GetNodeValueDouble(size, "Width");
1049  double height = GetNodeValueDouble(size, "Height");
1050  double angle = GetNodeValueDouble(cadPropNode, "Angle");
1051  auto nodePosition = cadPropNode->first_node("NodePosition");
1052  double nodePosX = GetNodeValueDouble(nodePosition, "X");
1053  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
1054  int parentID = GetNodeValueInt(cadPropNode, "ParentID");
1055  if(parentID == -1) {
1056  // If the element has no parent, create a temporary one, remove and delete.
1057  Bus* parent = new Bus(wxPoint2DDouble(nodePosX, nodePosY));
1058  inductor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1059  inductor->StartMove(inductor->GetPosition());
1060  inductor->Move(wxPoint2DDouble(posX, posY));
1061  inductor->RemoveParent(parent);
1062  delete parent;
1063  } else {
1064  Bus* parent = busList[parentID];
1065  inductor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1066  inductor->StartMove(inductor->GetPosition());
1067  inductor->Move(wxPoint2DDouble(posX, posY));
1068  }
1069  inductor->SetWidth(width);
1070  inductor->SetHeight(height);
1071 
1072  int numRot = angle / inductor->GetRotationAngle();
1073  bool clockwise = true;
1074  if(numRot < 0) {
1075  numRot = std::abs(numRot);
1076  clockwise = false;
1077  }
1078  for(int i = 0; i < numRot; i++) inductor->Rotate(clockwise);
1079 
1080  auto electricalProp = inductorNode->first_node("ElectricalProperties");
1081  if(!electricalProp) return false;
1082 
1083  inductor->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1084  InductorElectricalData data = inductor->GetElectricalData();
1085  data.name = electricalProp->first_node("Name")->value();
1086  data.reactivePower = GetNodeValueDouble(electricalProp, "ReactivePower");
1087  data.reactivePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID");
1088 
1089  SwitchingData swData;
1090  auto switchingList = electricalProp->first_node("SwitchingList");
1091  if(!switchingList) return false;
1092  auto swNode = switchingList->first_node("Switching");
1093  while(swNode) {
1094  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
1095  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
1096  swNode = swNode->next_sibling("Switching");
1097  }
1098  inductor->SetSwitchingData(swData);
1099 
1100  inductor->SetElectricalData(data);
1101 
1102  if(swData.swTime.size() != 0) inductor->SetDynamicEvent(true);
1103 
1104  elementList.push_back(inductor);
1105  inductorList.push_back(inductor);
1106  inductorNode = inductorNode->next_sibling("Inductor");
1107  } //}
1108 
1109  //{ Line
1110  auto lineListNode = elementsNode->first_node("LineList");
1111  if(!lineListNode) return false;
1112  auto lineNode = lineListNode->first_node("Line");
1113  while(lineNode) {
1114  Line* line = new Line();
1115 
1116  auto cadPropNode = lineNode->first_node("CADProperties");
1117  if(!cadPropNode) return false;
1118 
1119  // Get nodes points
1120  std::vector<wxPoint2DDouble> ptsList;
1121  auto nodePosList = cadPropNode->first_node("NodeList");
1122  if(!nodePosList) return false;
1123  auto nodePos = nodePosList->first_node("Node");
1124  while(nodePos) {
1125  double nodePosX = GetNodeValueDouble(nodePos, "X");
1126  double nodePosY = GetNodeValueDouble(nodePos, "Y");
1127  ptsList.push_back(wxPoint2DDouble(nodePosX, nodePosY));
1128  nodePos = nodePos->next_sibling("Node");
1129  }
1130 
1131  // Get parents IDs
1132  auto parentIDList = cadPropNode->first_node("ParentIDList");
1133  if(!parentIDList) return false;
1134  auto parentNode = parentIDList->first_node("ParentID");
1135  long parentID[2] = {-1, -1};
1136  while(parentNode) {
1137  long index = 0;
1138  wxString(parentNode->first_attribute("ID")->value()).ToLong(&index);
1139  wxString(parentNode->value()).ToCLong(&parentID[index]);
1140  parentNode = parentNode->next_sibling("ParentID");
1141  }
1142 
1143  // Set parents (if have)
1144  Bus *parent1, *parent2;
1145  if(parentID[0] == -1) {
1146  parent1 = new Bus(ptsList[0]);
1147  line->AddParent(parent1, ptsList[0]);
1148  } else {
1149  parent1 = busList[parentID[0]];
1150  line->AddParent(parent1, ptsList[0]);
1151  }
1152  if(parentID[1] == -1) {
1153  parent2 = new Bus(ptsList[ptsList.size() - 1]);
1154  line->AddParent(parent2, ptsList[ptsList.size() - 1]);
1155  } else {
1156  parent2 = busList[parentID[1]];
1157  line->AddParent(parent2, ptsList[ptsList.size() - 1]);
1158  }
1159 
1160  // Add the others nodes (if have)
1161  std::vector<wxPoint2DDouble> midPts;
1162  for(int i = 1; i < (int)ptsList.size() - 1; i++) midPts.push_back(ptsList[i]);
1163  std::vector<wxPoint2DDouble> edgesPts = line->GetPointList();
1164  edgesPts.insert(edgesPts.begin() + 2, midPts.begin(), midPts.end());
1165  line->SetPointList(edgesPts);
1166 
1167  if(parentID[0] == -1) {
1168  line->RemoveParent(parent1);
1169  delete parent1;
1170  }
1171  if(parentID[1] == -1) {
1172  line->RemoveParent(parent2);
1173  delete parent2;
1174  }
1175 
1176  auto electricalProp = lineNode->first_node("ElectricalProperties");
1177  if(!electricalProp) return false;
1178 
1179  line->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1180  LineElectricalData data = line->GetElectricalData();
1181  data.name = electricalProp->first_node("Name")->value();
1182  data.nominalVoltage = GetNodeValueDouble(electricalProp, "NominalVoltage");
1183  data.nominalVoltageUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalVoltage", "UnitID");
1184  data.nominalPower = GetNodeValueDouble(electricalProp, "NominalPower");
1185  data.nominalPowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalPower", "UnitID");
1186  data.resistance = GetNodeValueDouble(electricalProp, "Resistance");
1187  data.resistanceUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "Resistance", "UnitID");
1188  data.indReactance = GetNodeValueDouble(electricalProp, "IndReactance");
1189  data.indReactanceUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "IndReactance", "UnitID");
1190  data.capSusceptance = GetNodeValueDouble(electricalProp, "CapSusceptance");
1191  data.capSusceptanceUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "CapSusceptance", "UnitID");
1192  data.lineSize = GetNodeValueDouble(electricalProp, "LineSize");
1193  data.useLinePower = GetNodeValueInt(electricalProp, "UseLinePower");
1194 
1195  auto fault = electricalProp->first_node("Fault");
1196  data.zeroResistance = GetNodeValueDouble(fault, "ZeroResistance");
1197  data.zeroIndReactance = GetNodeValueDouble(fault, "ZeroIndReactance");
1198  data.zeroCapSusceptance = GetNodeValueDouble(fault, "ZeroCapSusceptance");
1199 
1200  SwitchingData swData;
1201  auto switchingList = electricalProp->first_node("SwitchingList");
1202  if(!switchingList) return false;
1203  auto swNode = switchingList->first_node("Switching");
1204  while(swNode) {
1205  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
1206  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
1207  swNode = swNode->next_sibling("Switching");
1208  }
1209  line->SetSwitchingData(swData);
1210 
1211  line->SetElectricalData(data);
1212 
1213  if(swData.swTime.size() != 0) line->SetDynamicEvent(true);
1214 
1215  elementList.push_back(line);
1216  lineList.push_back(line);
1217  lineNode = lineNode->next_sibling("Line");
1218  } //}
1219 
1220  //{ Load
1221  auto loadListNode = elementsNode->first_node("LoadList");
1222  if(!loadListNode) return false;
1223  auto loadNode = loadListNode->first_node("Load");
1224  while(loadNode) {
1225  Load* load = new Load();
1226 
1227  auto cadPropNode = loadNode->first_node("CADProperties");
1228  if(!cadPropNode) return false;
1229 
1230  auto position = cadPropNode->first_node("Position");
1231  double posX = GetNodeValueDouble(position, "X");
1232  double posY = GetNodeValueDouble(position, "Y");
1233  auto size = cadPropNode->first_node("Size");
1234  double width = GetNodeValueDouble(size, "Width");
1235  double height = GetNodeValueDouble(size, "Height");
1236  double angle = GetNodeValueDouble(cadPropNode, "Angle");
1237  auto nodePosition = cadPropNode->first_node("NodePosition");
1238  double nodePosX = GetNodeValueDouble(nodePosition, "X");
1239  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
1240  int parentID = GetNodeValueInt(cadPropNode, "ParentID");
1241  if(parentID == -1) {
1242  // If the element has no parent, create a temporary one, remove and delete.
1243  Bus* parent = new Bus(wxPoint2DDouble(nodePosX, nodePosY));
1244  load->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1245  load->StartMove(load->GetPosition());
1246  load->Move(wxPoint2DDouble(posX, posY));
1247  load->RemoveParent(parent);
1248  delete parent;
1249  } else {
1250  Bus* parent = busList[parentID];
1251  load->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1252  load->StartMove(load->GetPosition());
1253  load->Move(wxPoint2DDouble(posX, posY));
1254  }
1255  load->SetWidth(width);
1256  load->SetHeight(height);
1257 
1258  int numRot = angle / load->GetRotationAngle();
1259  bool clockwise = true;
1260  if(numRot < 0) {
1261  numRot = std::abs(numRot);
1262  clockwise = false;
1263  }
1264  for(int i = 0; i < numRot; i++) load->Rotate(clockwise);
1265 
1266  auto electricalProp = loadNode->first_node("ElectricalProperties");
1267  if(!electricalProp) return false;
1268 
1269  load->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1270  LoadElectricalData data = load->GetElectricalData();
1271  data.name = electricalProp->first_node("Name")->value();
1272  data.activePower = GetNodeValueDouble(electricalProp, "ActivePower");
1273  data.activePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ActivePower", "UnitID");
1274  data.reactivePower = GetNodeValueDouble(electricalProp, "ReactivePower");
1275  data.reactivePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID");
1276  data.loadType = (LoadType)GetNodeValueInt(electricalProp, "LoadType");
1277 
1278  SwitchingData swData;
1279  auto switchingList = electricalProp->first_node("SwitchingList");
1280  if(!switchingList) return false;
1281  auto swNode = switchingList->first_node("Switching");
1282  while(swNode) {
1283  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
1284  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
1285  swNode = swNode->next_sibling("Switching");
1286  }
1287  load->SetSwitchingData(swData);
1288 
1289  load->SetElectricalData(data);
1290 
1291  if(swData.swTime.size() != 0) load->SetDynamicEvent(true);
1292 
1293  elementList.push_back(load);
1294  loadList.push_back(load);
1295  loadNode = loadNode->next_sibling("Load");
1296  } //}
1297 
1298  //{ SyncGenerator
1299  auto syncGeneratorListNode = elementsNode->first_node("SyncGeneratorList");
1300  if(!syncGeneratorListNode) return false;
1301  auto syncGeneratorNode = syncGeneratorListNode->first_node("SyncGenerator");
1302  while(syncGeneratorNode) {
1303  SyncGenerator* syncGenerator = new SyncGenerator();
1304 
1305  auto cadPropNode = syncGeneratorNode->first_node("CADProperties");
1306  if(!cadPropNode) return false;
1307 
1308  auto position = cadPropNode->first_node("Position");
1309  double posX = GetNodeValueDouble(position, "X");
1310  double posY = GetNodeValueDouble(position, "Y");
1311  auto size = cadPropNode->first_node("Size");
1312  double width = GetNodeValueDouble(size, "Width");
1313  double height = GetNodeValueDouble(size, "Height");
1314  double angle = GetNodeValueDouble(cadPropNode, "Angle");
1315  auto nodePosition = cadPropNode->first_node("NodePosition");
1316  double nodePosX = GetNodeValueDouble(nodePosition, "X");
1317  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
1318  int parentID = GetNodeValueInt(cadPropNode, "ParentID");
1319  if(parentID == -1) {
1320  // If the element has no parent, create a temporary one, remove and delete.
1321  Bus* parent = new Bus(wxPoint2DDouble(nodePosX, nodePosY));
1322  syncGenerator->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1323  syncGenerator->StartMove(syncGenerator->GetPosition());
1324  syncGenerator->Move(wxPoint2DDouble(posX, posY));
1325  syncGenerator->RemoveParent(parent);
1326  delete parent;
1327  } else {
1328  Bus* parent = busList[parentID];
1329  syncGenerator->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1330  syncGenerator->StartMove(syncGenerator->GetPosition());
1331  syncGenerator->Move(wxPoint2DDouble(posX, posY));
1332  }
1333  syncGenerator->SetWidth(width);
1334  syncGenerator->SetHeight(height);
1335 
1336  int numRot = angle / syncGenerator->GetRotationAngle();
1337  bool clockwise = true;
1338  if(numRot < 0) {
1339  numRot = std::abs(numRot);
1340  clockwise = false;
1341  }
1342  for(int i = 0; i < numRot; i++) syncGenerator->Rotate(clockwise);
1343 
1344  auto electricalProp = syncGeneratorNode->first_node("ElectricalProperties");
1345  if(!electricalProp) return false;
1346 
1347  syncGenerator->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1348  SyncGeneratorElectricalData data = syncGenerator->GetElectricalData();
1349  data.name = electricalProp->first_node("Name")->value();
1350  data.nominalPower = GetNodeValueDouble(electricalProp, "NominalPower");
1351  data.nominalPowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalPower", "UnitID");
1352  data.nominalVoltage = GetNodeValueDouble(electricalProp, "NominalVoltage");
1353  data.nominalVoltageUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalVoltage", "UnitID");
1354  data.activePower = GetNodeValueDouble(electricalProp, "ActivePower");
1355  data.activePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ActivePower", "UnitID");
1356  data.reactivePower = GetNodeValueDouble(electricalProp, "ReactivePower");
1357  data.reactivePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID");
1358  data.haveMaxReactive = GetNodeValueInt(electricalProp, "HaveMaxReactive");
1359  data.maxReactive = GetNodeValueDouble(electricalProp, "MaxReactive");
1360  data.maxReactiveUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "MaxReactive", "UnitID");
1361  data.haveMinReactive = GetNodeValueInt(electricalProp, "HaveMinReactive");
1362  data.minReactive = GetNodeValueDouble(electricalProp, "MinReactive");
1363  data.minReactiveUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "MinReactive", "UnitID");
1364  data.useMachineBase = GetNodeValueInt(electricalProp, "UseMachineBase");
1365 
1366  auto fault = electricalProp->first_node("Fault");
1367  if(!fault) return false;
1368  data.positiveResistance = GetNodeValueDouble(fault, "PositiveResistance");
1369  data.positiveReactance = GetNodeValueDouble(fault, "PositiveReactance");
1370  data.negativeResistance = GetNodeValueDouble(fault, "NegativeResistance");
1371  data.negativeReactance = GetNodeValueDouble(fault, "NegativeReactance");
1372  data.zeroResistance = GetNodeValueDouble(fault, "ZeroResistance");
1373  data.zeroReactance = GetNodeValueDouble(fault, "ZeroReactance");
1374  data.groundResistance = GetNodeValueDouble(fault, "GroundResistance");
1375  data.groundReactance = GetNodeValueDouble(fault, "GroundReactance");
1376  data.groundNeutral = GetNodeValueInt(fault, "GroundNeutral");
1377 
1378  auto stability = electricalProp->first_node("Stability");
1379  if(!stability) return false;
1380  data.plotSyncMachine = GetNodeValueInt(stability, "PlotSyncMachine");
1381  data.inertia = GetNodeValueDouble(stability, "Inertia");
1382  data.damping = GetNodeValueDouble(stability, "Damping");
1383  data.useAVR = GetNodeValueInt(stability, "UseAVR");
1384  data.useSpeedGovernor = GetNodeValueInt(stability, "UseSpeedGovernor");
1385  data.armResistance = GetNodeValueDouble(stability, "ArmResistance");
1386  data.potierReactance = GetNodeValueDouble(stability, "PotierReactance");
1387  data.satFactor = GetNodeValueDouble(stability, "SatFactor");
1388  data.syncXd = GetNodeValueDouble(stability, "SyncXd");
1389  data.syncXq = GetNodeValueDouble(stability, "SyncXq");
1390  data.transXd = GetNodeValueDouble(stability, "TransXd");
1391  data.transXq = GetNodeValueDouble(stability, "TransXq");
1392  data.transTd0 = GetNodeValueDouble(stability, "TransTd0");
1393  data.transTq0 = GetNodeValueDouble(stability, "TransTq0");
1394  data.subXd = GetNodeValueDouble(stability, "SubXd");
1395  data.subXq = GetNodeValueDouble(stability, "SubXq");
1396  data.subTd0 = GetNodeValueDouble(stability, "SubTd0");
1397  data.subTq0 = GetNodeValueDouble(stability, "SubTq0");
1398 
1399  auto avr = stability->first_node("AVR");
1400  if(!avr) return false;
1401  if(!OpenControlElements(doc, avr, data.avr)) return false;
1402 
1403  auto speedGov = stability->first_node("SpeedGovernor");
1404  if(!speedGov) return false;
1405  if(!OpenControlElements(doc, speedGov, data.speedGov)) return false;
1406 
1407  SwitchingData swData;
1408  auto switchingList = electricalProp->first_node("SwitchingList");
1409  if(!switchingList) return false;
1410  auto swNode = switchingList->first_node("Switching");
1411  while(swNode) {
1412  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
1413  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
1414  swNode = swNode->next_sibling("Switching");
1415  }
1416  syncGenerator->SetSwitchingData(swData);
1417 
1418  syncGenerator->SetElectricalData(data);
1419 
1420  if(swData.swTime.size() != 0) syncGenerator->SetDynamicEvent(true);
1421 
1422  elementList.push_back(syncGenerator);
1423  syncGeneratorList.push_back(syncGenerator);
1424  syncGeneratorNode = syncGeneratorNode->next_sibling("SyncGenerator");
1425  } //}
1426 
1427  //{ SyncMotor
1428  auto syncMotorListNode = elementsNode->first_node("SyncMotorList");
1429  if(!syncMotorListNode) return false;
1430  auto syncMotorNode = syncMotorListNode->first_node("SyncMotor");
1431  while(syncMotorNode) {
1432  SyncMotor* syncMotor = new SyncMotor();
1433 
1434  auto cadPropNode = syncMotorNode->first_node("CADProperties");
1435  if(!cadPropNode) return false;
1436 
1437  auto position = cadPropNode->first_node("Position");
1438  double posX = GetNodeValueDouble(position, "X");
1439  double posY = GetNodeValueDouble(position, "Y");
1440  auto size = cadPropNode->first_node("Size");
1441  double width = GetNodeValueDouble(size, "Width");
1442  double height = GetNodeValueDouble(size, "Height");
1443  double angle = GetNodeValueDouble(cadPropNode, "Angle");
1444  auto nodePosition = cadPropNode->first_node("NodePosition");
1445  double nodePosX = GetNodeValueDouble(nodePosition, "X");
1446  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
1447  int parentID = GetNodeValueInt(cadPropNode, "ParentID");
1448  if(parentID == -1) {
1449  // If the element has no parent, create a temporary one, remove and delete.
1450  Bus* parent = new Bus(wxPoint2DDouble(nodePosX, nodePosY));
1451  syncMotor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1452  syncMotor->StartMove(syncMotor->GetPosition());
1453  syncMotor->Move(wxPoint2DDouble(posX, posY));
1454  syncMotor->RemoveParent(parent);
1455  delete parent;
1456  } else {
1457  Bus* parent = busList[parentID];
1458  syncMotor->AddParent(parent, wxPoint2DDouble(nodePosX, nodePosY));
1459  syncMotor->StartMove(syncMotor->GetPosition());
1460  syncMotor->Move(wxPoint2DDouble(posX, posY));
1461  }
1462  syncMotor->SetWidth(width);
1463  syncMotor->SetHeight(height);
1464 
1465  int numRot = angle / syncMotor->GetRotationAngle();
1466  bool clockwise = true;
1467  if(numRot < 0) {
1468  numRot = std::abs(numRot);
1469  clockwise = false;
1470  }
1471  for(int i = 0; i < numRot; i++) syncMotor->Rotate(clockwise);
1472 
1473  auto electricalProp = syncMotorNode->first_node("ElectricalProperties");
1474  if(!electricalProp) return false;
1475 
1476  syncMotor->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1477  SyncMotorElectricalData data = syncMotor->GetElectricalData();
1478  data.name = electricalProp->first_node("Name")->value();
1479  data.nominalPower = GetNodeValueDouble(electricalProp, "NominalPower");
1480  data.nominalPowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalPower", "UnitID");
1481  // data.nominalVoltage = GetNodeValueDouble(electricalProp, "NominalVoltage");
1482  // data.nominalVoltageUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalVoltage", "UnitID");
1483  data.activePower = GetNodeValueDouble(electricalProp, "ActivePower");
1484  data.activePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ActivePower", "UnitID");
1485  data.reactivePower = GetNodeValueDouble(electricalProp, "ReactivePower");
1486  data.reactivePowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "ReactivePower", "UnitID");
1487  data.haveMaxReactive = GetNodeValueInt(electricalProp, "HaveMaxReactive");
1488  data.maxReactive = GetNodeValueDouble(electricalProp, "MaxReactive");
1489  data.maxReactiveUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "MaxReactive", "UnitID");
1490  data.haveMinReactive = GetNodeValueInt(electricalProp, "HaveMinReactive");
1491  data.minReactive = GetNodeValueDouble(electricalProp, "MinReactive");
1492  data.minReactiveUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "MinReactive", "UnitID");
1493  data.useMachineBase = GetNodeValueInt(electricalProp, "UseMachineBase");
1494 
1495  auto fault = electricalProp->first_node("Fault");
1496  if(!fault) return false;
1497  data.positiveResistance = GetNodeValueDouble(fault, "PositiveResistance");
1498  data.positiveReactance = GetNodeValueDouble(fault, "PositiveReactance");
1499  data.negativeResistance = GetNodeValueDouble(fault, "NegativeResistance");
1500  data.negativeReactance = GetNodeValueDouble(fault, "NegativeReactance");
1501  data.zeroResistance = GetNodeValueDouble(fault, "ZeroResistance");
1502  data.zeroReactance = GetNodeValueDouble(fault, "ZeroReactance");
1503  data.groundResistance = GetNodeValueDouble(fault, "GroundResistance");
1504  data.groundReactance = GetNodeValueDouble(fault, "GroundReactance");
1505  data.groundNeutral = GetNodeValueInt(fault, "GroundNeutral");
1506 
1507  /*SwitchingData swData;
1508  auto switchingList = electricalProp->first_node("SwitchingList");
1509  if(!switchingList) return false;
1510  auto swNode = switchingList->first_node("Switching");
1511  while(swNode) {
1512  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
1513  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
1514  swNode = swNode->next_sibling("Switching");
1515  }
1516  syncMotor->SetSwitchingData(swData);*/
1517 
1518  syncMotor->SetElectricalData(data);
1519  elementList.push_back(syncMotor);
1520  syncMotorList.push_back(syncMotor);
1521  syncMotorNode = syncMotorNode->next_sibling("SyncMotor");
1522  } //}
1523 
1524  //{ Transformer
1525  auto transformerListNode = elementsNode->first_node("TransformerList");
1526  if(!transformerListNode) return false;
1527  auto transfomerNode = transformerListNode->first_node("Transfomer");
1528  while(transfomerNode) {
1529  Transformer* transformer = new Transformer();
1530 
1531  auto cadPropNode = transfomerNode->first_node("CADProperties");
1532  if(!cadPropNode) return false;
1533 
1534  auto position = cadPropNode->first_node("Position");
1535  double posX = GetNodeValueDouble(position, "X");
1536  double posY = GetNodeValueDouble(position, "Y");
1537  auto size = cadPropNode->first_node("Size");
1538  double width = GetNodeValueDouble(size, "Width");
1539  double height = GetNodeValueDouble(size, "Height");
1540  double angle = GetNodeValueDouble(cadPropNode, "Angle");
1541 
1542  // Get nodes points
1543  std::vector<wxPoint2DDouble> ptsList;
1544  auto nodePosList = cadPropNode->first_node("NodeList");
1545  if(!nodePosList) return false;
1546  auto nodePos = nodePosList->first_node("Node");
1547  while(nodePos) {
1548  double nodePosX = GetNodeValueDouble(nodePos, "X");
1549  double nodePosY = GetNodeValueDouble(nodePos, "Y");
1550  ptsList.push_back(wxPoint2DDouble(nodePosX, nodePosY));
1551  nodePos = nodePos->next_sibling("Node");
1552  }
1553 
1554  // Get parents IDs
1555  auto parentIDList = cadPropNode->first_node("ParentIDList");
1556  if(!parentIDList) return false;
1557  auto parentNode = parentIDList->first_node("ParentID");
1558  long parentID[2] = {-1, -1};
1559  while(parentNode) {
1560  long index = 0;
1561  wxString(parentNode->first_attribute("ID")->value()).ToLong(&index);
1562  wxString(parentNode->value()).ToCLong(&parentID[index]);
1563  parentNode = parentNode->next_sibling("ParentID");
1564  }
1565 
1566  // Set parents (if have)
1567  Bus *parent1, *parent2;
1568  if(parentID[0] == -1) {
1569  parent1 = new Bus(ptsList[0]);
1570  transformer->AddParent(parent1, ptsList[0]);
1571  } else {
1572  parent1 = busList[parentID[0]];
1573  transformer->AddParent(parent1, ptsList[0]);
1574  }
1575  if(parentID[1] == -1) {
1576  parent2 = new Bus(ptsList[ptsList.size() - 1]);
1577  transformer->AddParent(parent2, ptsList[ptsList.size() - 1]);
1578  } else {
1579  parent2 = busList[parentID[1]];
1580  transformer->AddParent(parent2, ptsList[ptsList.size() - 1]);
1581  }
1582 
1583  transformer->StartMove(transformer->GetPosition());
1584  transformer->Move(wxPoint2DDouble(posX, posY));
1585 
1586  if(parentID[0] == -1) {
1587  transformer->RemoveParent(parent1);
1588  delete parent1;
1589  }
1590  if(parentID[1] == -1) {
1591  transformer->RemoveParent(parent2);
1592  delete parent2;
1593  }
1594 
1595  transformer->SetWidth(width);
1596  transformer->SetHeight(height);
1597 
1598  int numRot = angle / transformer->GetRotationAngle();
1599  bool clockwise = true;
1600  if(numRot < 0) {
1601  numRot = std::abs(numRot);
1602  clockwise = false;
1603  }
1604  for(int i = 0; i < numRot; i++) transformer->Rotate(clockwise);
1605 
1606  auto electricalProp = transfomerNode->first_node("ElectricalProperties");
1607  if(!electricalProp) return false;
1608 
1609  transformer->SetOnline(GetNodeValueInt(electricalProp, "IsOnline"));
1610  TransformerElectricalData data = transformer->GetElectricalData();
1611  data.name = electricalProp->first_node("Name")->value();
1612  data.primaryNominalVoltage = GetNodeValueDouble(electricalProp, "PrimaryNominalVoltage");
1613  data.primaryNominalVoltageUnit =
1614  (ElectricalUnit)GetAttributeValueInt(electricalProp, "PrimaryNominalVoltage", "UnitID");
1615  data.secondaryNominalVoltage = GetNodeValueDouble(electricalProp, "SecondaryNominalVoltage");
1616  data.secondaryNominalVoltageUnit =
1617  (ElectricalUnit)GetAttributeValueInt(electricalProp, "SecondaryNominalVoltage", "UnitID");
1618  data.nominalPower = GetNodeValueDouble(electricalProp, "NominalPower");
1619  data.nominalPowerUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "NominalPower", "UnitID");
1620  data.resistance = GetNodeValueDouble(electricalProp, "Resistance");
1621  data.resistanceUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "Resistance", "UnitID");
1622  data.indReactance = GetNodeValueDouble(electricalProp, "IndReactance");
1623  data.indReactanceUnit = (ElectricalUnit)GetAttributeValueInt(electricalProp, "IndReactance", "UnitID");
1624  data.connection = (TransformerConnection)GetNodeValueInt(electricalProp, "Connection");
1625  data.turnsRatio = GetNodeValueDouble(electricalProp, "TurnsRatio");
1626  data.phaseShift = GetNodeValueDouble(electricalProp, "PhaseShift");
1627  data.useTransformerPower = GetNodeValueInt(electricalProp, "UseTransfomerPower");
1628 
1629  auto fault = electricalProp->first_node("Fault");
1630  data.zeroResistance = GetNodeValueDouble(fault, "ZeroResistance");
1631  data.zeroIndReactance = GetNodeValueDouble(fault, "ZeroIndReactance");
1632  data.primaryGrndResistance = GetNodeValueDouble(fault, "PrimaryGrndResistance");
1633  data.primaryGrndReactance = GetNodeValueDouble(fault, "PrimaryGrndReactance");
1634  data.secondaryGrndResistance = GetNodeValueDouble(fault, "SecondaryGrndResistance");
1635  data.secondaryGrndReactance = GetNodeValueDouble(fault, "SecondaryGrndReactance");
1636 
1637  SwitchingData swData;
1638  auto switchingList = electricalProp->first_node("SwitchingList");
1639  if(!switchingList) return false;
1640  auto swNode = switchingList->first_node("Switching");
1641  while(swNode) {
1642  swData.swType.push_back((SwitchingType)GetNodeValueInt(swNode, "Type"));
1643  swData.swTime.push_back(GetNodeValueDouble(swNode, "Time"));
1644  swNode = swNode->next_sibling("Switching");
1645  }
1646  transformer->SetSwitchingData(swData);
1647 
1648  transformer->SetElectricaData(data);
1649 
1650  if(swData.swTime.size() != 0) transformer->SetDynamicEvent(true);
1651 
1652  elementList.push_back(transformer);
1653  transformerList.push_back(transformer);
1654  transfomerNode = transfomerNode->next_sibling("Transfomer");
1655  } //}
1656 
1657  m_workspace->SetElementList(elementList);
1658 
1659  //{ Text
1660  auto textListNode = elementsNode->first_node("TextList");
1661  if(!textListNode) return false;
1662  auto textNode = textListNode->first_node("Text");
1663  while(textNode) {
1664  auto cadPropNode = textNode->first_node("CADProperties");
1665  if(!cadPropNode) return false;
1666 
1667  auto position = cadPropNode->first_node("Position");
1668  double posX = GetNodeValueDouble(position, "X");
1669  double posY = GetNodeValueDouble(position, "Y");
1670  auto size = cadPropNode->first_node("Size");
1671  double width = GetNodeValueDouble(size, "Width");
1672  double height = GetNodeValueDouble(size, "Height");
1673  double angle = GetNodeValueDouble(cadPropNode, "Angle");
1674 
1675  Text* text = new Text(wxPoint2DDouble(posX, posY));
1676 
1677  text->SetWidth(width);
1678  text->SetHeight(height);
1679 
1680  auto textProperties = textNode->first_node("TextProperties");
1681  if(!textProperties) return false;
1682 
1683  text->SetElementType((ElementType)GetNodeValueDouble(textProperties, "ElementType"));
1684  text->SetDataType((DataType)GetNodeValueDouble(textProperties, "DataType"));
1685  text->SetUnit((ElectricalUnit)GetNodeValueDouble(textProperties, "DataUnit"));
1686  text->SetDirection(GetNodeValueDouble(textProperties, "Direction"));
1687  text->SetDecimalPlaces(GetNodeValueDouble(textProperties, "DecimalPlaces"));
1688 
1689  text->SetElementNumber(GetNodeValueInt(textProperties, "ElementNumber"));
1690  switch(text->GetElementType()) {
1691  case TYPE_NONE:
1692  break;
1693  case TYPE_BUS: {
1694  Bus* bus = busList[text->GetElementNumber()];
1695  text->SetElement(bus);
1696  } break;
1697  case TYPE_CAPACITOR: {
1698  Capacitor* capacitor = capacitorList[text->GetElementNumber()];
1699  text->SetElement(capacitor);
1700  } break;
1701  case TYPE_IND_MOTOR: {
1702  IndMotor* indMotor = indMotorList[text->GetElementNumber()];
1703  text->SetElement(indMotor);
1704  } break;
1705  case TYPE_INDUCTOR: {
1706  Inductor* inductor = inductorList[text->GetElementNumber()];
1707  text->SetElement(inductor);
1708  } break;
1709  case TYPE_LINE: {
1710  Line* line = lineList[text->GetElementNumber()];
1711  text->SetElement(line);
1712  } break;
1713  case TYPE_LOAD: {
1714  Load* load = loadList[text->GetElementNumber()];
1715  text->SetElement(load);
1716  } break;
1717  case TYPE_SYNC_GENERATOR: {
1718  SyncGenerator* syncGenerator = syncGeneratorList[text->GetElementNumber()];
1719  text->SetElement(syncGenerator);
1720  } break;
1721  case TYPE_SYNC_MOTOR: {
1722  SyncMotor* syncMotor = syncMotorList[text->GetElementNumber()];
1723  text->SetElement(syncMotor);
1724  } break;
1725  case TYPE_TRANSFORMER: {
1726  Transformer* transformer = transformerList[text->GetElementNumber()];
1727  text->SetElement(transformer);
1728  } break;
1729  }
1730 
1731  int numRot = angle / text->GetRotationAngle();
1732  bool clockwise = true;
1733  if(numRot < 0) {
1734  numRot = std::abs(numRot);
1735  clockwise = false;
1736  }
1737  for(int i = 0; i < numRot; i++) text->Rotate(clockwise);
1738 
1739  textList.push_back(text);
1740  textNode = textNode->next_sibling("Text");
1741  } //}
1742 
1743  m_workspace->SetTextList(textList);
1744  return true;
1745 }
1746 
1747 void FileHanding::SaveControl(wxFileName path)
1748 {
1749  // Same process present in SaveProject():
1750  std::ofstream writeProjectsFile(path.GetFullPath());
1751  writeProjectsFile.close();
1752 
1753  rapidxml::xml_document<> doc;
1754  rapidxml::file<> xmlFile(path.GetFullPath().mb_str());
1755  doc.parse<0>(xmlFile.data());
1756 
1757  rapidxml::xml_node<>* decl = doc.allocate_node(rapidxml::node_declaration);
1758  rapidxml::xml_attribute<>* ver = doc.allocate_attribute("version", "1.0");
1759  rapidxml::xml_attribute<>* encoding = doc.allocate_attribute("encoding", "utf-8");
1760  decl->append_attribute(ver);
1761  decl->append_attribute(encoding);
1762  doc.append_node(decl);
1763 
1764  rapidxml::xml_node<>* rootNode = doc.allocate_node(rapidxml::node_element, "Control");
1765  doc.append_node(rootNode);
1766 
1767  rapidxml::xml_node<>* projectNameNode = AppendNode(doc, rootNode, "Name");
1768  SetNodeValue(doc, projectNameNode, path.GetName());
1769 
1770  auto elementsNode = AppendNode(doc, rootNode, "ControlElements");
1771  SaveControlElements(doc, elementsNode);
1772  std::ofstream writeXML(path.GetFullPath());
1773  writeXML << doc;
1774  writeXML.close();
1775 }
1776 
1777 bool FileHanding::OpenControl(wxFileName path,
1778  std::vector<ControlElement*>& ctrlElementList,
1779  std::vector<ConnectionLine*>& ctrlConnectionList)
1780 {
1781  rapidxml::xml_document<> doc;
1782  rapidxml::file<> xmlFile(path.GetFullPath().mb_str());
1783 
1784  doc.parse<0>(xmlFile.data());
1785 
1786  auto projectNode = doc.first_node("Control");
1787  if(!projectNode) return false;
1788  // auto nameNode = projectNode->first_node("Name");
1789  // if(!nameNode) return false;
1790  // m_controlEditor->SetName(nameNode->value());
1791 
1792  // Open elements
1793  auto elementsNode = projectNode->first_node("ControlElements");
1794  if(!elementsNode) return false;
1795 
1796  // auto elementsNode = AppendNode(doc, rootNode, "ControlElements");
1797  ControlElementContainer* ctrlElementContainer = new ControlElementContainer();
1798  if(!OpenControlElements(doc, elementsNode, ctrlElementContainer)) return false;
1799  ctrlElementList = ctrlElementContainer->GetControlElementsList();
1800  ctrlConnectionList = ctrlElementContainer->GetConnectionLineList();
1801  return true;
1802 }
1803 
1804 void FileHanding::SaveControlElements(rapidxml::xml_document<>& doc,
1805  rapidxml::xml_node<>* elementsNode,
1806  ControlElementContainer* ctrlContainer)
1807 {
1808  if(!ctrlContainer) {
1809  ctrlContainer = new ControlElementContainer();
1810  ctrlContainer->FillContainer(m_controlEditor);
1811  }
1812 
1813  //{ Constant
1814  auto constsNode = AppendNode(doc, elementsNode, "ConstantList");
1815  auto constList = ctrlContainer->GetConstantList();
1816  for(auto it = constList.begin(), itEnd = constList.end(); it != itEnd; ++it) {
1817  Constant* constant = *it;
1818  auto constNode = AppendNode(doc, constsNode, "Constant");
1819  SetNodeAttribute(doc, constNode, "ID", constant->GetID());
1820  auto cadProp = AppendNode(doc, constNode, "CADProperties");
1821  auto position = AppendNode(doc, cadProp, "Position");
1822  auto posX = AppendNode(doc, position, "X");
1823  SetNodeValue(doc, posX, constant->GetPosition().m_x);
1824  auto posY = AppendNode(doc, position, "Y");
1825  SetNodeValue(doc, posY, constant->GetPosition().m_y);
1826  auto size = AppendNode(doc, cadProp, "Size");
1827  auto width = AppendNode(doc, size, "Width");
1828  SetNodeValue(doc, width, constant->GetWidth());
1829  auto height = AppendNode(doc, size, "Height");
1830  SetNodeValue(doc, height, constant->GetHeight());
1831  auto angle = AppendNode(doc, cadProp, "Angle");
1832  SetNodeValue(doc, angle, constant->GetAngle());
1833 
1834  // Nodes
1835  auto nodeList = AppendNode(doc, constNode, "NodeList");
1836  SaveControlNodes(doc, nodeList, constant->GetNodeList());
1837 
1838  // Control properties
1839  auto value = AppendNode(doc, constNode, "Value");
1840  SetNodeValue(doc, value, constant->GetValue());
1841  } //}
1842 
1843  //{ Exponential
1844  auto expsNode = AppendNode(doc, elementsNode, "ExponentialList");
1845  auto expList = ctrlContainer->GetExponentialList();
1846  for(auto it = expList.begin(), itEnd = expList.end(); it != itEnd; ++it) {
1847  Exponential* exponential = *it;
1848  auto expNode = AppendNode(doc, expsNode, "Exponential");
1849  SetNodeAttribute(doc, expNode, "ID", exponential->GetID());
1850  auto cadProp = AppendNode(doc, expNode, "CADProperties");
1851  auto position = AppendNode(doc, cadProp, "Position");
1852  auto posX = AppendNode(doc, position, "X");
1853  SetNodeValue(doc, posX, exponential->GetPosition().m_x);
1854  auto posY = AppendNode(doc, position, "Y");
1855  SetNodeValue(doc, posY, exponential->GetPosition().m_y);
1856  auto size = AppendNode(doc, cadProp, "Size");
1857  auto width = AppendNode(doc, size, "Width");
1858  SetNodeValue(doc, width, exponential->GetWidth());
1859  auto height = AppendNode(doc, size, "Height");
1860  SetNodeValue(doc, height, exponential->GetHeight());
1861  auto angle = AppendNode(doc, cadProp, "Angle");
1862  SetNodeValue(doc, angle, exponential->GetAngle());
1863 
1864  // Nodes
1865  auto nodeList = AppendNode(doc, expNode, "NodeList");
1866  SaveControlNodes(doc, nodeList, exponential->GetNodeList());
1867 
1868  // Control properties
1869  double a, b;
1870  exponential->GetValues(a, b);
1871  auto value = AppendNode(doc, expNode, "Value");
1872  auto aValue = AppendNode(doc, value, "A");
1873  SetNodeValue(doc, aValue, a);
1874  auto bValue = AppendNode(doc, value, "B");
1875  SetNodeValue(doc, bValue, b);
1876  } //}
1877 
1878  //{ Gain
1879  auto gainsNode = AppendNode(doc, elementsNode, "GainList");
1880  auto gainList = ctrlContainer->GetGainList();
1881  for(auto it = gainList.begin(), itEnd = gainList.end(); it != itEnd; ++it) {
1882  Gain* gain = *it;
1883  auto gainNode = AppendNode(doc, gainsNode, "Gain");
1884  SetNodeAttribute(doc, gainNode, "ID", gain->GetID());
1885  auto cadProp = AppendNode(doc, gainNode, "CADProperties");
1886  auto position = AppendNode(doc, cadProp, "Position");
1887  auto posX = AppendNode(doc, position, "X");
1888  SetNodeValue(doc, posX, gain->GetPosition().m_x);
1889  auto posY = AppendNode(doc, position, "Y");
1890  SetNodeValue(doc, posY, gain->GetPosition().m_y);
1891  auto size = AppendNode(doc, cadProp, "Size");
1892  auto width = AppendNode(doc, size, "Width");
1893  SetNodeValue(doc, width, gain->GetWidth());
1894  auto height = AppendNode(doc, size, "Height");
1895  SetNodeValue(doc, height, gain->GetHeight());
1896  auto angle = AppendNode(doc, cadProp, "Angle");
1897  SetNodeValue(doc, angle, gain->GetAngle());
1898 
1899  // Nodes
1900  auto nodeList = AppendNode(doc, gainNode, "NodeList");
1901  SaveControlNodes(doc, nodeList, gain->GetNodeList());
1902 
1903  // Control properties
1904  auto value = AppendNode(doc, gainNode, "Value");
1905  SetNodeValue(doc, value, gain->GetValue());
1906  } //}
1907 
1908  //{ IO
1909  auto iosNode = AppendNode(doc, elementsNode, "IOList");
1910  auto ioList = ctrlContainer->GetIOControlList();
1911  for(auto it = ioList.begin(), itEnd = ioList.end(); it != itEnd; ++it) {
1912  IOControl* io = *it;
1913  auto ioNode = AppendNode(doc, iosNode, "IO");
1914  SetNodeAttribute(doc, ioNode, "ID", io->GetID());
1915  auto cadProp = AppendNode(doc, ioNode, "CADProperties");
1916  auto position = AppendNode(doc, cadProp, "Position");
1917  auto posX = AppendNode(doc, position, "X");
1918  SetNodeValue(doc, posX, io->GetPosition().m_x);
1919  auto posY = AppendNode(doc, position, "Y");
1920  SetNodeValue(doc, posY, io->GetPosition().m_y);
1921  auto size = AppendNode(doc, cadProp, "Size");
1922  auto width = AppendNode(doc, size, "Width");
1923  SetNodeValue(doc, width, io->GetWidth());
1924  auto height = AppendNode(doc, size, "Height");
1925  SetNodeValue(doc, height, io->GetHeight());
1926  auto angle = AppendNode(doc, cadProp, "Angle");
1927  SetNodeValue(doc, angle, io->GetAngle());
1928 
1929  // Nodes
1930  auto nodeList = AppendNode(doc, ioNode, "NodeList");
1931  SaveControlNodes(doc, nodeList, io->GetNodeList());
1932 
1933  // Control properties
1934  auto value = AppendNode(doc, ioNode, "Value");
1935  SetNodeValue(doc, value, io->GetValue());
1936  auto ioFlags = AppendNode(doc, ioNode, "IOFlags");
1937  SetNodeValue(doc, ioFlags, io->GetIOFlags());
1938  } //}
1939 
1940  //{ Limiter
1941  auto limitersNode = AppendNode(doc, elementsNode, "LimiterList");
1942  auto limiterList = ctrlContainer->GetLimiterList();
1943  for(auto it = limiterList.begin(), itEnd = limiterList.end(); it != itEnd; ++it) {
1944  Limiter* limiter = *it;
1945  auto limiterNode = AppendNode(doc, limitersNode, "Limiter");
1946  SetNodeAttribute(doc, limiterNode, "ID", limiter->GetID());
1947  auto cadProp = AppendNode(doc, limiterNode, "CADProperties");
1948  auto position = AppendNode(doc, cadProp, "Position");
1949  auto posX = AppendNode(doc, position, "X");
1950  SetNodeValue(doc, posX, limiter->GetPosition().m_x);
1951  auto posY = AppendNode(doc, position, "Y");
1952  SetNodeValue(doc, posY, limiter->GetPosition().m_y);
1953  auto size = AppendNode(doc, cadProp, "Size");
1954  auto width = AppendNode(doc, size, "Width");
1955  SetNodeValue(doc, width, limiter->GetWidth());
1956  auto height = AppendNode(doc, size, "Height");
1957  SetNodeValue(doc, height, limiter->GetHeight());
1958  auto angle = AppendNode(doc, cadProp, "Angle");
1959  SetNodeValue(doc, angle, limiter->GetAngle());
1960 
1961  // Nodes
1962  auto nodeList = AppendNode(doc, limiterNode, "NodeList");
1963  SaveControlNodes(doc, nodeList, limiter->GetNodeList());
1964 
1965  // Control properties
1966  auto upLimit = AppendNode(doc, limiterNode, "UpperLimit");
1967  SetNodeValue(doc, upLimit, limiter->GetUpLimit());
1968  auto lowLimit = AppendNode(doc, limiterNode, "LowerLimit");
1969  SetNodeValue(doc, lowLimit, limiter->GetLowLimit());
1970  } //}
1971 
1972  //{ Multiplier
1973  auto multipliersNode = AppendNode(doc, elementsNode, "MultiplierList");
1974  auto multiplierList = ctrlContainer->GetMultiplierList();
1975  for(auto it = multiplierList.begin(), itEnd = multiplierList.end(); it != itEnd; ++it) {
1976  Multiplier* multiplier = *it;
1977  auto multiplierNode = AppendNode(doc, multipliersNode, "Multiplier");
1978  SetNodeAttribute(doc, multiplierNode, "ID", multiplier->GetID());
1979  auto cadProp = AppendNode(doc, multiplierNode, "CADProperties");
1980  auto position = AppendNode(doc, cadProp, "Position");
1981  auto posX = AppendNode(doc, position, "X");
1982  SetNodeValue(doc, posX, multiplier->GetPosition().m_x);
1983  auto posY = AppendNode(doc, position, "Y");
1984  SetNodeValue(doc, posY, multiplier->GetPosition().m_y);
1985  auto size = AppendNode(doc, cadProp, "Size");
1986  auto width = AppendNode(doc, size, "Width");
1987  SetNodeValue(doc, width, multiplier->GetWidth());
1988  auto height = AppendNode(doc, size, "Height");
1989  SetNodeValue(doc, height, multiplier->GetHeight());
1990  auto angle = AppendNode(doc, cadProp, "Angle");
1991  SetNodeValue(doc, angle, multiplier->GetAngle());
1992 
1993  // Nodes
1994  auto nodeList = AppendNode(doc, multiplierNode, "NodeList");
1995  SaveControlNodes(doc, nodeList, multiplier->GetNodeList());
1996  } //}
1997 
1998  //{ Rate limiter
1999  auto rateLimitersNode = AppendNode(doc, elementsNode, "RateLimiterList");
2000  auto rateLimiterList = ctrlContainer->GetRateLimiterList();
2001  for(auto it = rateLimiterList.begin(), itEnd = rateLimiterList.end(); it != itEnd; ++it) {
2002  RateLimiter* rateLimiter = *it;
2003  auto rateLimiterNode = AppendNode(doc, rateLimitersNode, "RateLimiter");
2004  SetNodeAttribute(doc, rateLimiterNode, "ID", rateLimiter->GetID());
2005  auto cadProp = AppendNode(doc, rateLimiterNode, "CADProperties");
2006  auto position = AppendNode(doc, cadProp, "Position");
2007  auto posX = AppendNode(doc, position, "X");
2008  SetNodeValue(doc, posX, rateLimiter->GetPosition().m_x);
2009  auto posY = AppendNode(doc, position, "Y");
2010  SetNodeValue(doc, posY, rateLimiter->GetPosition().m_y);
2011  auto size = AppendNode(doc, cadProp, "Size");
2012  auto width = AppendNode(doc, size, "Width");
2013  SetNodeValue(doc, width, rateLimiter->GetWidth());
2014  auto height = AppendNode(doc, size, "Height");
2015  SetNodeValue(doc, height, rateLimiter->GetHeight());
2016  auto angle = AppendNode(doc, cadProp, "Angle");
2017  SetNodeValue(doc, angle, rateLimiter->GetAngle());
2018 
2019  // Nodes
2020  auto nodeList = AppendNode(doc, rateLimiterNode, "NodeList");
2021  SaveControlNodes(doc, nodeList, rateLimiter->GetNodeList());
2022 
2023  // Control properties
2024  auto upLimit = AppendNode(doc, rateLimiterNode, "UpperLimit");
2025  SetNodeValue(doc, upLimit, rateLimiter->GetUpLimit());
2026  auto lowLimit = AppendNode(doc, rateLimiterNode, "LowerLimit");
2027  SetNodeValue(doc, lowLimit, rateLimiter->GetLowLimit());
2028  } //}
2029 
2030  //{ Sum
2031  auto sumsNode = AppendNode(doc, elementsNode, "SumList");
2032  auto sumList = ctrlContainer->GetSumList();
2033  for(auto it = sumList.begin(), itEnd = sumList.end(); it != itEnd; ++it) {
2034  Sum* sum = *it;
2035  auto sumNode = AppendNode(doc, sumsNode, "Sum");
2036  SetNodeAttribute(doc, sumNode, "ID", sum->GetID());
2037  auto cadProp = AppendNode(doc, sumNode, "CADProperties");
2038  auto position = AppendNode(doc, cadProp, "Position");
2039  auto posX = AppendNode(doc, position, "X");
2040  SetNodeValue(doc, posX, sum->GetPosition().m_x);
2041  auto posY = AppendNode(doc, position, "Y");
2042  SetNodeValue(doc, posY, sum->GetPosition().m_y);
2043  auto size = AppendNode(doc, cadProp, "Size");
2044  auto width = AppendNode(doc, size, "Width");
2045  SetNodeValue(doc, width, sum->GetWidth());
2046  auto height = AppendNode(doc, size, "Height");
2047  SetNodeValue(doc, height, sum->GetHeight());
2048  auto angle = AppendNode(doc, cadProp, "Angle");
2049  SetNodeValue(doc, angle, sum->GetAngle());
2050 
2051  // Nodes
2052  auto nodeList = AppendNode(doc, sumNode, "NodeList");
2053  SaveControlNodes(doc, nodeList, sum->GetNodeList());
2054 
2055  // Control properties
2056  auto signsNode = AppendNode(doc, sumNode, "Signs");
2057  auto signs = sum->GetSignalList();
2058  for(int i = 0; i < (int)signs.size(); ++i) {
2059  auto value = AppendNode(doc, signsNode, "Value");
2060  SetNodeValue(doc, value, static_cast<int>(signs[i]));
2061  }
2062 
2063  } //}
2064 
2065  //{ Transfer function
2066  auto tfsNode = AppendNode(doc, elementsNode, "TransferFunctionList");
2067  auto tfList = ctrlContainer->GetTFList();
2068  for(auto it = tfList.begin(), itEnd = tfList.end(); it != itEnd; ++it) {
2069  TransferFunction* tf = *it;
2070  auto tfNode = AppendNode(doc, tfsNode, "TransferFunction");
2071  SetNodeAttribute(doc, tfNode, "ID", tf->GetID());
2072  auto cadProp = AppendNode(doc, tfNode, "CADProperties");
2073  auto position = AppendNode(doc, cadProp, "Position");
2074  auto posX = AppendNode(doc, position, "X");
2075  SetNodeValue(doc, posX, tf->GetPosition().m_x);
2076  auto posY = AppendNode(doc, position, "Y");
2077  SetNodeValue(doc, posY, tf->GetPosition().m_y);
2078  auto size = AppendNode(doc, cadProp, "Size");
2079  auto width = AppendNode(doc, size, "Width");
2080  SetNodeValue(doc, width, tf->GetWidth());
2081  auto height = AppendNode(doc, size, "Height");
2082  SetNodeValue(doc, height, tf->GetHeight());
2083  auto angle = AppendNode(doc, cadProp, "Angle");
2084  SetNodeValue(doc, angle, tf->GetAngle());
2085 
2086  // Nodes
2087  auto nodeList = AppendNode(doc, tfNode, "NodeList");
2088  SaveControlNodes(doc, nodeList, tf->GetNodeList());
2089 
2090  // Control properties
2091  auto numeratorNode = AppendNode(doc, tfNode, "Numerator");
2092  auto numerator = tf->GetNumerator();
2093  for(int i = 0; i < (int)numerator.size(); ++i) {
2094  auto value = AppendNode(doc, numeratorNode, "Value");
2095  SetNodeValue(doc, value, numerator[i]);
2096  }
2097  auto denominatorNode = AppendNode(doc, tfNode, "Denominator");
2098  auto denominator = tf->GetDenominator();
2099  for(int i = 0; i < (int)denominator.size(); ++i) {
2100  auto value = AppendNode(doc, denominatorNode, "Value");
2101  SetNodeValue(doc, value, denominator[i]);
2102  }
2103  } //}
2104 
2105  //{ Connection line
2106  auto cLinesNode = AppendNode(doc, elementsNode, "ConnectionList");
2107  auto connLineList = ctrlContainer->GetConnectionLineList();
2108  for(auto it = connLineList.begin(), itEnd = connLineList.end(); it != itEnd; ++it) {
2109  ConnectionLine* cLine = *it;
2110  auto cLineNode = AppendNode(doc, cLinesNode, "Connection");
2111  SetNodeAttribute(doc, cLineNode, "ID", cLine->GetID());
2112 
2113  // CAD properties
2114  auto cadProp = AppendNode(doc, cLineNode, "CADProperties");
2115  auto offset = AppendNode(doc, cadProp, "Offset");
2116  SetNodeValue(doc, offset, cLine->GetOffset());
2117 
2118  // Parent list
2119  auto parentsNode = AppendNode(doc, cLineNode, "ParentList");
2120  auto parentList = cLine->GetParentList();
2121  int nodeIndex = 0;
2122  for(auto itP = parentList.begin(), itPEnd = parentList.end(); itP != itPEnd; ++itP) {
2123  Element* parent = *itP;
2124  auto parentNode = AppendNode(doc, parentsNode, "Parent");
2125  auto elementID = AppendNode(doc, parentNode, "ElementID");
2126  SetNodeValue(doc, elementID, parent->GetID());
2127  auto nodeID = AppendNode(doc, parentNode, "NodeID");
2128  SetNodeValue(doc, nodeID, cLine->GetNodeList()[nodeIndex]->GetID());
2129  nodeIndex++;
2130  }
2131 
2132  auto parentLine = AppendNode(doc, cLineNode, "ParentLine");
2133  if(cLine->GetParentLine()) {
2134  ConnectionLine* parent = cLine->GetParentLine();
2135  SetNodeAttribute(doc, parentLine, "ID", parent->GetID());
2136  } else {
2137  SetNodeAttribute(doc, parentLine, "ID", -1);
2138  }
2139  } //}
2140 }
2141 
2142 bool FileHanding::OpenControlElements(rapidxml::xml_document<>& doc,
2143  rapidxml::xml_node<>* elementsNode,
2144  ControlElementContainer* ctrlContainer)
2145 {
2146  std::vector<ControlElement*> elementList;
2147  std::vector<ConnectionLine*> connectionList;
2148 
2149  //{ Constant
2150  auto constListNode = elementsNode->first_node("ConstantList");
2151  if(!constListNode) return false;
2152  auto constNode = constListNode->first_node("Constant");
2153  while(constNode) {
2154  int id = GetAttributeValueInt(constNode, "ID");
2155  Constant* constant = new Constant(id);
2156 
2157  auto cadPropNode = constNode->first_node("CADProperties");
2158  if(!cadPropNode) return false;
2159 
2160  auto position = cadPropNode->first_node("Position");
2161  double posX = GetNodeValueDouble(position, "X");
2162  double posY = GetNodeValueDouble(position, "Y");
2163  auto size = cadPropNode->first_node("Size");
2164  double width = GetNodeValueDouble(size, "Width");
2165  double height = GetNodeValueDouble(size, "Height");
2166  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2167 
2168  double value = GetNodeValueDouble(constNode, "Value");
2169 
2170  constant->SetWidth(width);
2171  constant->SetHeight(height);
2172  constant->SetAngle(angle);
2173  constant->SetPosition(wxPoint2DDouble(posX, posY));
2174  constant->StartMove(constant->GetPosition());
2175 
2176  constant->SetValue(value);
2177 
2178  std::vector<Node*> nodeVector;
2179  if(!OpenControlNodeList(constNode, nodeVector)) return false;
2180 
2181  constant->SetNodeList(nodeVector);
2182  constant->UpdatePoints();
2183  elementList.push_back(constant);
2184 
2185  constNode = constNode->next_sibling("Constant");
2186  } //}
2187 
2188  //{ Exponential
2189  auto expListNode = elementsNode->first_node("ExponentialList");
2190  if(!expListNode) return false;
2191  auto expNode = expListNode->first_node("Exponential");
2192  while(expNode) {
2193  int id = GetAttributeValueInt(expNode, "ID");
2194  Exponential* exponential = new Exponential(id);
2195 
2196  auto cadPropNode = expNode->first_node("CADProperties");
2197  if(!cadPropNode) return false;
2198 
2199  auto position = cadPropNode->first_node("Position");
2200  double posX = GetNodeValueDouble(position, "X");
2201  double posY = GetNodeValueDouble(position, "Y");
2202  auto size = cadPropNode->first_node("Size");
2203  double width = GetNodeValueDouble(size, "Width");
2204  double height = GetNodeValueDouble(size, "Height");
2205  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2206 
2207  auto value = expNode->first_node("Value");
2208  double a = GetNodeValueDouble(value, "A");
2209  double b = GetNodeValueDouble(value, "B");
2210 
2211  exponential->SetWidth(width);
2212  exponential->SetHeight(height);
2213  exponential->SetAngle(angle);
2214  exponential->SetPosition(wxPoint2DDouble(posX, posY));
2215  exponential->StartMove(exponential->GetPosition());
2216 
2217  exponential->SetValues(a, b);
2218 
2219  std::vector<Node*> nodeVector;
2220  if(!OpenControlNodeList(expNode, nodeVector)) return false;
2221 
2222  exponential->SetNodeList(nodeVector);
2223  exponential->UpdatePoints();
2224  elementList.push_back(exponential);
2225 
2226  expNode = expNode->next_sibling("Exponential");
2227  } //}
2228 
2229  //{ Gain
2230  auto gainListNode = elementsNode->first_node("GainList");
2231  if(!gainListNode) return false;
2232  auto gainNode = gainListNode->first_node("Gain");
2233  while(gainNode) {
2234  int id = GetAttributeValueInt(gainNode, "ID");
2235  Gain* gain = new Gain(id);
2236 
2237  auto cadPropNode = gainNode->first_node("CADProperties");
2238  if(!cadPropNode) return false;
2239 
2240  auto position = cadPropNode->first_node("Position");
2241  double posX = GetNodeValueDouble(position, "X");
2242  double posY = GetNodeValueDouble(position, "Y");
2243  auto size = cadPropNode->first_node("Size");
2244  double width = GetNodeValueDouble(size, "Width");
2245  double height = GetNodeValueDouble(size, "Height");
2246  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2247 
2248  double value = GetNodeValueDouble(gainNode, "Value");
2249 
2250  gain->SetWidth(width);
2251  gain->SetHeight(height);
2252  gain->SetAngle(angle);
2253  gain->SetPosition(wxPoint2DDouble(posX, posY));
2254  gain->SetValue(value);
2255  gain->StartMove(gain->GetPosition());
2256 
2257  std::vector<Node*> nodeVector;
2258  if(!OpenControlNodeList(gainNode, nodeVector)) return false;
2259 
2260  gain->SetNodeList(nodeVector);
2261  gain->UpdatePoints();
2262  elementList.push_back(gain);
2263 
2264  gainNode = gainNode->next_sibling("Gain");
2265  }
2266  //}
2267 
2268  //{ IO
2269  auto ioListNode = elementsNode->first_node("IOList");
2270  if(!ioListNode) return false;
2271  auto ioNode = ioListNode->first_node("IO");
2272  while(ioNode) {
2273  int id = GetAttributeValueInt(ioNode, "ID");
2274 
2275  auto cadPropNode = ioNode->first_node("CADProperties");
2276  if(!cadPropNode) return false;
2277 
2278  auto position = cadPropNode->first_node("Position");
2279  double posX = GetNodeValueDouble(position, "X");
2280  double posY = GetNodeValueDouble(position, "Y");
2281  auto size = cadPropNode->first_node("Size");
2282  double width = GetNodeValueDouble(size, "Width");
2283  double height = GetNodeValueDouble(size, "Height");
2284  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2285 
2286  std::vector<Node*> nodeVector;
2287  if(!OpenControlNodeList(ioNode, nodeVector)) return false;
2288 
2289  IOControl::IOFlags value = static_cast<IOControl::IOFlags>(GetNodeValueInt(ioNode, "Value"));
2290  int ioFlags = GetNodeValueInt(ioNode, "IOFlags");
2291 
2292  IOControl* io = new IOControl(ioFlags, id);
2293 
2294  io->SetWidth(width);
2295  io->SetHeight(height);
2296  io->SetAngle(angle);
2297  io->SetPosition(wxPoint2DDouble(posX, posY));
2298  io->SetValue(value);
2299  io->StartMove(io->GetPosition());
2300  io->SetNodeList(nodeVector);
2301  io->UpdatePoints();
2302  elementList.push_back(io);
2303 
2304  ioNode = ioNode->next_sibling("IO");
2305  }
2306  //}
2307 
2308  //{ Limiter
2309  auto limiterListNode = elementsNode->first_node("LimiterList");
2310  if(!limiterListNode) return false;
2311  auto limiterNode = limiterListNode->first_node("Limiter");
2312  while(limiterNode) {
2313  int id = GetAttributeValueInt(limiterNode, "ID");
2314  Limiter* limiter = new Limiter(id);
2315 
2316  auto cadPropNode = limiterNode->first_node("CADProperties");
2317  if(!cadPropNode) return false;
2318 
2319  auto position = cadPropNode->first_node("Position");
2320  double posX = GetNodeValueDouble(position, "X");
2321  double posY = GetNodeValueDouble(position, "Y");
2322  auto size = cadPropNode->first_node("Size");
2323  double width = GetNodeValueDouble(size, "Width");
2324  double height = GetNodeValueDouble(size, "Height");
2325  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2326 
2327  double upLimit = GetNodeValueDouble(limiterNode, "UpperLimit");
2328  double lowLimit = GetNodeValueDouble(limiterNode, "LowerLimit");
2329 
2330  std::vector<Node*> nodeVector;
2331  if(!OpenControlNodeList(limiterNode, nodeVector)) return false;
2332 
2333  limiter->SetWidth(width);
2334  limiter->SetHeight(height);
2335  limiter->SetAngle(angle);
2336  limiter->SetPosition(wxPoint2DDouble(posX, posY));
2337  limiter->SetUpLimit(upLimit);
2338  limiter->SetLowLimit(lowLimit);
2339 
2340  limiter->StartMove(limiter->GetPosition());
2341  limiter->SetNodeList(nodeVector);
2342  limiter->UpdatePoints();
2343  elementList.push_back(limiter);
2344 
2345  limiterNode = limiterNode->next_sibling("Limiter");
2346  }
2347  //}
2348 
2349  //{ Multiplier
2350  auto multiplierListNode = elementsNode->first_node("MultiplierList");
2351  if(!multiplierListNode) return false;
2352  auto multiplierNode = multiplierListNode->first_node("Multiplier");
2353  while(multiplierNode) {
2354  int id = GetAttributeValueInt(multiplierNode, "ID");
2355  Multiplier* multiplier = new Multiplier(id);
2356 
2357  auto cadPropNode = multiplierNode->first_node("CADProperties");
2358  if(!cadPropNode) return false;
2359 
2360  auto position = cadPropNode->first_node("Position");
2361  double posX = GetNodeValueDouble(position, "X");
2362  double posY = GetNodeValueDouble(position, "Y");
2363  auto size = cadPropNode->first_node("Size");
2364  double width = GetNodeValueDouble(size, "Width");
2365  double height = GetNodeValueDouble(size, "Height");
2366  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2367 
2368  std::vector<Node*> nodeVector;
2369  if(!OpenControlNodeList(multiplierNode, nodeVector)) return false;
2370 
2371  multiplier->SetWidth(width);
2372  multiplier->SetHeight(height);
2373  multiplier->SetAngle(angle);
2374  multiplier->SetPosition(wxPoint2DDouble(posX, posY));
2375 
2376  multiplier->StartMove(multiplier->GetPosition());
2377  multiplier->SetNodeList(nodeVector);
2378  multiplier->UpdatePoints();
2379  elementList.push_back(multiplier);
2380 
2381  multiplierNode = multiplierNode->next_sibling("Multiplier");
2382  }
2383  //}
2384 
2385  //{ Rate limiter
2386  auto rateLimiterListNode = elementsNode->first_node("RateLimiterList");
2387  if(!rateLimiterListNode) return false;
2388  auto rateLimiterNode = rateLimiterListNode->first_node("RateLimiter");
2389  while(rateLimiterNode) {
2390  int id = GetAttributeValueInt(rateLimiterNode, "ID");
2391  RateLimiter* limiter = new RateLimiter(id);
2392 
2393  auto cadPropNode = rateLimiterNode->first_node("CADProperties");
2394  if(!cadPropNode) return false;
2395 
2396  auto position = cadPropNode->first_node("Position");
2397  double posX = GetNodeValueDouble(position, "X");
2398  double posY = GetNodeValueDouble(position, "Y");
2399  auto size = cadPropNode->first_node("Size");
2400  double width = GetNodeValueDouble(size, "Width");
2401  double height = GetNodeValueDouble(size, "Height");
2402  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2403 
2404  double upLimit = GetNodeValueDouble(rateLimiterNode, "UpperLimit");
2405  double lowLimit = GetNodeValueDouble(rateLimiterNode, "LowerLimit");
2406 
2407  std::vector<Node*> nodeVector;
2408  if(!OpenControlNodeList(rateLimiterNode, nodeVector)) return false;
2409 
2410  limiter->SetWidth(width);
2411  limiter->SetHeight(height);
2412  limiter->SetAngle(angle);
2413  limiter->SetPosition(wxPoint2DDouble(posX, posY));
2414  limiter->SetUpLimit(upLimit);
2415  limiter->SetLowLimit(lowLimit);
2416 
2417  limiter->StartMove(limiter->GetPosition());
2418  limiter->SetNodeList(nodeVector);
2419  limiter->UpdatePoints();
2420  elementList.push_back(limiter);
2421 
2422  rateLimiterNode = rateLimiterNode->next_sibling("RateLimiter");
2423  }
2424  //}
2425 
2426  //{ Sum
2427  auto sumListNode = elementsNode->first_node("SumList");
2428  if(!sumListNode) return false;
2429  auto sumNode = sumListNode->first_node("Sum");
2430  while(sumNode) {
2431  int id = GetAttributeValueInt(sumNode, "ID");
2432  Sum* sum = new Sum(id);
2433 
2434  auto cadPropNode = sumNode->first_node("CADProperties");
2435  if(!cadPropNode) return false;
2436 
2437  auto position = cadPropNode->first_node("Position");
2438  double posX = GetNodeValueDouble(position, "X");
2439  double posY = GetNodeValueDouble(position, "Y");
2440  auto size = cadPropNode->first_node("Size");
2441  double width = GetNodeValueDouble(size, "Width");
2442  double height = GetNodeValueDouble(size, "Height");
2443  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2444 
2445  std::vector<Sum::Signal> signs;
2446  auto signsNode = sumNode->first_node("Signs");
2447  auto sign = signsNode->first_node("Value");
2448  while(sign) {
2449  long value;
2450  wxString(sign->value()).ToCLong(&value);
2451  signs.push_back(static_cast<Sum::Signal>(value));
2452  sign = sign->next_sibling("Value");
2453  }
2454  sum->SetSignalList(signs);
2455 
2456  std::vector<Node*> nodeVector;
2457  if(!OpenControlNodeList(sumNode, nodeVector)) return false;
2458 
2459  sum->SetWidth(width);
2460  sum->SetHeight(height);
2461  sum->SetAngle(angle);
2462  sum->SetPosition(wxPoint2DDouble(posX, posY));
2463 
2464  sum->StartMove(sum->GetPosition());
2465  sum->SetNodeList(nodeVector);
2466  sum->UpdatePoints();
2467  elementList.push_back(sum);
2468 
2469  sumNode = sumNode->next_sibling("Sum");
2470  }
2471  //}
2472 
2473  //{ Transfer function
2474  auto tfListNode = elementsNode->first_node("TransferFunctionList");
2475  if(!tfListNode) return false;
2476  auto tfNode = tfListNode->first_node("TransferFunction");
2477  while(tfNode) {
2478  int id = GetAttributeValueInt(tfNode, "ID");
2479  TransferFunction* tf = new TransferFunction(id);
2480 
2481  auto cadPropNode = tfNode->first_node("CADProperties");
2482  if(!cadPropNode) return false;
2483 
2484  auto position = cadPropNode->first_node("Position");
2485  double posX = GetNodeValueDouble(position, "X");
2486  double posY = GetNodeValueDouble(position, "Y");
2487  auto size = cadPropNode->first_node("Size");
2488  double width = GetNodeValueDouble(size, "Width");
2489  double height = GetNodeValueDouble(size, "Height");
2490  double angle = GetNodeValueDouble(cadPropNode, "Angle");
2491 
2492  std::vector<double> numerator, denominator;
2493  auto numeratorNode = tfNode->first_node("Numerator");
2494  auto nValue = numeratorNode->first_node("Value");
2495  while(nValue) {
2496  double value = 0.0;
2497  wxString(nValue->value()).ToCDouble(&value);
2498  numerator.push_back(value);
2499  nValue = nValue->next_sibling("Value");
2500  }
2501  auto denominatorNode = tfNode->first_node("Denominator");
2502  auto dValue = denominatorNode->first_node("Value");
2503  while(dValue) {
2504  double value = 0.0;
2505  wxString(dValue->value()).ToCDouble(&value);
2506  denominator.push_back(value);
2507  dValue = dValue->next_sibling("Value");
2508  }
2509 
2510  std::vector<Node*> nodeVector;
2511  if(!OpenControlNodeList(tfNode, nodeVector)) return false;
2512 
2513  tf->SetWidth(width);
2514  tf->SetHeight(height);
2515  tf->SetAngle(angle);
2516  tf->SetPosition(wxPoint2DDouble(posX, posY));
2517 
2518  tf->SetNumerator(numerator);
2519  tf->SetDenominator(denominator);
2520 
2521  tf->StartMove(tf->GetPosition());
2522  tf->SetNodeList(nodeVector);
2523 
2524  tf->UpdateTFText();
2525 
2526  elementList.push_back(tf);
2527 
2528  tfNode = tfNode->next_sibling("TransferFunction");
2529  }
2530  //}
2531 
2532  // Connection line
2533  auto connectionListNode = elementsNode->first_node("ConnectionList");
2534  if(!connectionListNode) return false;
2535  auto connNode = connectionListNode->first_node("Connection");
2536  while(connNode) {
2537  ConnectionLine* cLine = NULL;
2538  int id = GetAttributeValueInt(connNode, "ID");
2539 
2540  auto cadPropNode = connNode->first_node("CADProperties");
2541  if(!cadPropNode) return false;
2542  double offset = GetNodeValueDouble(cadPropNode, "Offset");
2543 
2544  auto parentList = connNode->first_node("ParentList");
2545  if(!parentList) return false;
2546 
2547  auto parentNode = parentList->first_node("Parent");
2548  bool firstNode = true;
2549  while(parentNode) {
2550  int elementID = GetNodeValueInt(parentNode, "ElementID");
2551  int nodeID = GetNodeValueInt(parentNode, "NodeID");
2552 
2553  ControlElement* element = GetControlElementFromID(elementList, elementID);
2554  Node* node = element->GetNodeList()[nodeID];
2555 
2556  if(firstNode) cLine = new ConnectionLine(node, id);
2557  cLine->AddParent(element);
2558  element->AddChild(cLine);
2559  if(!firstNode) cLine->AppendNode(node, element);
2560 
2561  if(firstNode) firstNode = false;
2562  parentNode = parentNode->next_sibling("Parent");
2563  }
2564 
2565  auto parentLine = connNode->first_node("ParentLine");
2566  if(!parentLine) return false;
2567  int parentLineID = GetAttributeValueInt(parentLine, "ID");
2568  if(parentLineID != -1) {
2569  for(auto it = connectionList.begin(), itEnd = connectionList.end(); it != itEnd; ++it) {
2570  ConnectionLine* parent = *it;
2571  if(parent->GetID() == parentLineID) {
2572  cLine->SetParentLine(parent);
2573  parent->AddChild(cLine);
2574  }
2575  }
2576  }
2577 
2578  cLine->SetOffset(offset);
2579  cLine->UpdatePoints();
2580  connectionList.push_back(cLine);
2581  connNode = connNode->next_sibling("Connection");
2582  }
2583  ctrlContainer->FillContainer(elementList, connectionList);
2584  return true;
2585 }
2586 
2587 void FileHanding::SaveControlNodes(rapidxml::xml_document<>& doc,
2588  rapidxml::xml_node<>* nodesN,
2589  std::vector<Node*> nodeList)
2590 {
2591  int id = 0;
2592  for(auto it = nodeList.begin(), itEnd = nodeList.end(); it != itEnd; ++it) {
2593  Node* node = *it;
2594  node->SetID(id);
2595  auto nodeN = AppendNode(doc, nodesN, "Node");
2596  SetNodeAttribute(doc, nodeN, "ID", id);
2597  auto nodePosition = AppendNode(doc, nodeN, "Position");
2598  auto posNodeX = AppendNode(doc, nodePosition, "X");
2599  SetNodeValue(doc, posNodeX, node->GetPosition().m_x);
2600  auto posNodeY = AppendNode(doc, nodePosition, "Y");
2601  SetNodeValue(doc, posNodeY, node->GetPosition().m_y);
2602  auto angle = AppendNode(doc, nodeN, "Angle");
2603  SetNodeValue(doc, angle, node->GetAngle());
2604  auto nodeType = AppendNode(doc, nodeN, "Type");
2605  SetNodeValue(doc, nodeType, node->GetNodeType());
2606  id++;
2607  }
2608 }
2609 
2610 ControlElement* FileHanding::GetControlElementFromID(std::vector<ControlElement*> elementList, int id)
2611 {
2612  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
2613  ControlElement* element = *it;
2614  if(element->GetID() == id) return element;
2615  }
2616  return NULL;
2617 }
2618 
2619 bool FileHanding::OpenControlNodeList(rapidxml::xml_node<>* elementNode, std::vector<Node*>& nodeVector)
2620 {
2621  auto nodeList = elementNode->first_node("NodeList");
2622  if(!nodeList) return false;
2623  auto nodeN = nodeList->first_node("Node");
2624  while(nodeN) {
2625  auto nodePosition = nodeN->first_node("Position");
2626  double nodePosX = GetNodeValueDouble(nodePosition, "X");
2627  double nodePosY = GetNodeValueDouble(nodePosition, "Y");
2628  double nodeAngle = GetNodeValueDouble(nodeN, "Angle");
2629  Node::NodeType nodeType = (Node::NodeType)GetNodeValueInt(nodeN, "Type");
2630  Node* node = new Node(wxPoint2DDouble(nodePosX, nodePosY), nodeType, 2.0);
2631  node->SetAngle(nodeAngle);
2632  nodeVector.push_back(node);
2633  nodeN = nodeN->next_sibling("Node");
2634  }
2635  return true;
2636 }
2637 
2638 rapidxml::xml_node<>* FileHanding::AppendNode(rapidxml::xml_document<>& doc,
2639  rapidxml::xml_node<>* parentNode,
2640  const char* name,
2641  rapidxml::node_type nodeType)
2642 {
2643  rapidxml::xml_node<>* node = doc.allocate_node(nodeType, name);
2644  parentNode->append_node(node);
2645  return node;
2646 }
2647 
2648 void FileHanding::SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, wxString value)
2649 {
2650  node->value(doc.allocate_string(value.mb_str()));
2651 }
2652 
2653 void FileHanding::SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, int value)
2654 {
2655  node->value(doc.allocate_string(wxString::Format("%d", value).mb_str()));
2656 }
2657 
2658 void FileHanding::SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, double value)
2659 {
2660  node->value(doc.allocate_string(wxString::FromCDouble(value, 13).mb_str()));
2661 }
2662 
2663 void FileHanding::SetNodeAttribute(rapidxml::xml_document<>& doc,
2664  rapidxml::xml_node<>* node,
2665  const char* atrName,
2666  wxString value)
2667 {
2668  node->append_attribute(doc.allocate_attribute(atrName, doc.allocate_string(value.mb_str())));
2669 }
2670 
2671 void FileHanding::SetNodeAttribute(rapidxml::xml_document<>& doc,
2672  rapidxml::xml_node<>* node,
2673  const char* atrName,
2674  int value)
2675 {
2676  node->append_attribute(
2677  doc.allocate_attribute(atrName, doc.allocate_string(wxString::Format("%d", value).mb_str())));
2678 }
2679 
2680 void FileHanding::SetNodeAttribute(rapidxml::xml_document<>& doc,
2681  rapidxml::xml_node<>* node,
2682  const char* atrName,
2683  double value)
2684 {
2685  node->append_attribute(
2686  doc.allocate_attribute(atrName, doc.allocate_string(wxString::FromCDouble(value, 13).mb_str())));
2687 }
2688 
2689 double FileHanding::GetNodeValueDouble(rapidxml::xml_node<>* parent, const char* nodeName)
2690 {
2691  double dValue = 0.0;
2692  if(parent) {
2693  auto node = parent->first_node(nodeName);
2694  if(node) wxString(node->value()).ToCDouble(&dValue);
2695  }
2696  return dValue;
2697 }
2698 
2699 int FileHanding::GetNodeValueInt(rapidxml::xml_node<>* parent, const char* nodeName)
2700 {
2701  long iValue = -1;
2702  if(parent) {
2703  auto node = parent->first_node(nodeName);
2704  if(node) wxString(node->value()).ToCLong(&iValue);
2705  }
2706  return (int)iValue;
2707 }
2708 
2709 int FileHanding::GetAttributeValueInt(rapidxml::xml_node<>* parent, const char* nodeName, const char* atrName)
2710 {
2711  long iValue = -1;
2712  if(parent) {
2713  auto node = parent->first_node(nodeName);
2714  if(node) {
2715  auto atr = node->first_attribute(atrName);
2716  if(atr) wxString(atr->value()).ToCLong(&iValue);
2717  }
2718  }
2719  return (int)iValue;
2720 }
2721 
2722 int FileHanding::GetAttributeValueInt(rapidxml::xml_node<>* node, const char* atrName)
2723 {
2724  long intValue;
2725  auto atr = node->first_attribute(atrName);
2726  if(!atr) return false;
2727  wxString(atr->value()).ToCLong(&intValue);
2728  return (int)intValue;
2729 }
double GetAngle() const
Get the element angle.
Definition: Element.h:212
+
Definition: Text.h:65
+
Multiplies two inputs.
Definition: Multiplier.h:32
+
std::vector< double > swTime
Definition: PowerElement.h:95
+
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Machines.cpp:146
+ + +
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Branch.cpp:105
+ +
const std::vector< Transformer * > GetTransformerList() const
Get the transformers of the system (use GetElementsFromList first).
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Text.cpp:162
+
Definition: Sum.h:26
+
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:506
+
void SetWidth(double width)
Set element width.
Definition: Element.h:151
+
Provide an output multiplying the input by a constant. .
Definition: Gain.h:36
+
FaultData
Information about fault (type and location).
Definition: PowerElement.h:55
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Capacitor.cpp:115
+
Node of a control element. This class manages the user interaction with the connection and control el...
+
const std::vector< IndMotor * > GetIndMotorList() const
Get the induction motors of the system (use GetElementsFromList first).
+
bool SetOnline(bool online=true)
Set if the element is online or offline.
Definition: Element.cpp:235
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
+
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Shunt.cpp:74
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Load.cpp:121
+
Limits the input value by superior and inferior values.
Definition: Limiter.h:32
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Inductor.cpp:113
+ + +
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
+
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Machines.cpp:111
+
const std::vector< Bus * > GetBusList() const
Get the buses of the system (use GetElementsFromList first).
+ +
std::vector< SwitchingType > swType
Definition: PowerElement.h:94
+
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+
Provides the communication with the power element.
Definition: IOControl.h:35
+
virtual void SetDynamicEvent(bool dynEvent=true)
Set if the power element have dynamic event.
Definition: PowerElement.h:208
+
const std::vector< SyncGenerator * > GetSyncGeneratorList() const
Get the synchronous generators of the system (use GetElementsFromList first).
+
virtual void Move(wxPoint2DDouble position)
Move the element other position.
+
const std::vector< Inductor * > GetInductorList() const
Get the inductors of the system (use GetElementsFromList first).
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Element.h:240
+
Definition: Bus.h:62
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Inductor.cpp:24
+
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:227
+ +
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Shunt.cpp:32
+
Generates an output following an exponential function. .
Definition: Exponential.h:33
+
void SetAngle(double angle)
Set element angle.
Definition: Element.h:156
+
double GetWidth() const
Get the element width.
Definition: Element.h:207
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Line.cpp:136
+
void SetPosition(const wxPoint2DDouble position)
Set the element position and update the rectangle.
Definition: Element.cpp:25
+
const std::vector< Capacitor * > GetCapacitorList() const
Get the capacitors of the system (use GetElementsFromList first).
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Machines.cpp:25
+
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:353
+
Definition: Line.h:52
+ +
Definition: Load.h:35
+
double GetHeight() const
Get the element height.
Definition: Element.h:197
+
virtual std::vector< wxPoint2DDouble > GetPointList() const
Get the list of points that connect the element to bus.
Definition: Element.h:232
+
Limits the rising and/or falling rate.
Definition: RateLimiter.h:32
+
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
+ +
const std::vector< Load * > GetLoadList() const
Get the loads of the system (use GetElementsFromList first).
+ + +
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Machines.cpp:232
+
virtual void SetPointList(std::vector< wxPoint2DDouble > pointList)
Set the list of points that connect the element to the bus.
Definition: Line.cpp:492
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Bus.cpp:184
+
virtual SwitchingData GetSwitchingData()
Returns the switching data of the element.
Definition: PowerElement.h:182
+
Connection between two control elements or other connection line and an element.
+
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Shunt.cpp:67
+
SwitchingType
Type of switching.
Definition: PowerElement.h:69
+ + + +
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Transformer.cpp:39
+
const std::vector< SyncMotor * > GetSyncMotorList() const
Get the synchronous motors of the system (use GetElementsFromList first).
+
virtual int GetID() const
Get the element ID.
Definition: Element.h:272
+ +
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Load.cpp:23
+
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Machines.cpp:165
+
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:187
+ +
virtual void GetElementsFromList(std::vector< Element *> elementList)
Separate the power elements from a generic list.
+ + + +
A control element that provides a constant value.
Definition: Constant.h:35
+
This class manages the graphical and power elements. It is responsible for handling the user&#39;s intera...
Definition: Workspace.h:81
+
virtual void SetSwitchingData(SwitchingData data)
Set the switching data of the element.
Definition: PowerElement.h:177
+
double GetRotationAngle() const
Get the angle of rotation.
Definition: Element.h:217
+
const std::vector< Line * > GetLineList() const
Get the lines of the system (use GetElementsFromList first).
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Capacitor.cpp:24
+ +
void SetHeight(double height)
Set element height.
Definition: Element.h:135
+ +
diff --git a/docs/doxygen/html/_file_handing_8h.html b/docs/doxygen/html/_file_handing_8h.html new file mode 100644 index 0000000..12d632c --- /dev/null +++ b/docs/doxygen/html/_file_handing_8h.html @@ -0,0 +1,125 @@ + + + + + + + + + +Project/FileHanding.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
FileHanding.h File Reference
+
+
+
#include <wx/string.h>
+#include <fstream>
+#include <sstream>
+#include "Workspace.h"
+#include "ControlEditor.h"
+#include "ControlElementContainer.h"
+#include "ElectricCalculation.h"
+#include "Text.h"
+#include "rapidXML/rapidxml.hpp"
+#include "rapidXML/rapidxml_print.hpp"
+#include "rapidXML/rapidxml_utils.hpp"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  FileHanding
 Save and opens the projects created on disk. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_file_handing_8h_source.html b/docs/doxygen/html/_file_handing_8h_source.html index 7bfa9ba..4f8f3ab 100644 --- a/docs/doxygen/html/_file_handing_8h_source.html +++ b/docs/doxygen/html/_file_handing_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,18 +88,21 @@ $(document).ready(function(){initNavTree('_file_handing_8h_source.html','');});
FileHanding.h
-
1 #ifndef FILEHANDING_H
2 #define FILEHANDING_H
3 
4 #include <wx/string.h>
5 #include <fstream>
6 #include <sstream>
7 
8 #include "Workspace.h"
9 #include "ControlEditor.h"
10 #include "ControlElementContainer.h"
11 #include "ElectricCalculation.h"
12 #include "Text.h"
13 
14 #include "rapidXML/rapidxml.hpp"
15 // Modified: http://stackoverflow.com/questions/14113923/rapidxml-print-header-has-undefined-methods
16 #include "rapidXML/rapidxml_print.hpp"
17 #include "rapidXML/rapidxml_utils.hpp"
18 
20 {
21 public:
22  FileHanding();
23  FileHanding(Workspace* workspace);
24  FileHanding(ControlEditor* controlEditor);
25  ~FileHanding();
26 
27  void SetWorkspace(Workspace* workspace) { m_workspace = workspace; }
28  void SetControlEditor(ControlEditor* controlEditor) { m_controlEditor = controlEditor; }
29 
30  void SaveProject(wxFileName path);
31  bool OpenProject(wxFileName path);
32 
33  void SaveControl(wxFileName path);
34  bool OpenControl(wxFileName path, std::vector<ControlElement*>& ctrlElementList, std::vector<ConnectionLine*>& ctrlConnectionList);
35 
36  void SaveControlElements(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementsNode, ControlElementContainer* ctrlContainer = NULL);
37  bool OpenControlElements(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementsNode, ControlElementContainer* ctrlContainer = NULL);
38 
39 protected:
40  Workspace* m_workspace = NULL;
41  ControlEditor* m_controlEditor = NULL;
42 
43  rapidxml::xml_node<>* AppendNode(rapidxml::xml_document<>& doc,
44  rapidxml::xml_node<>* parentNode,
45  const char* name,
46  rapidxml::node_type nodeType = rapidxml::node_element);
47  void SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, wxString value);
48  void SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, int value);
49  void SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, double value);
50  void SetNodeAttribute(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, const char* atrName, wxString value);
51  void SetNodeAttribute(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, const char* atrName, int value);
52  void SetNodeAttribute(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, const char* atrName, double value);
53  double GetNodeValueDouble(rapidxml::xml_node<>* parent, const char* nodeName);
54  int GetNodeValueInt(rapidxml::xml_node<>* parent, const char* nodeName);
55  int GetAttributeValueInt(rapidxml::xml_node<>* parent, const char* nodeName, const char* atrName);
56  int GetAttributeValueInt(rapidxml::xml_node<>* node, const char* atrName);
57 
58  void SaveControlNodes(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* nodesN, std::vector<Node*> nodeList);
59  ControlElement* GetControlElementFromID(std::vector<ControlElement*> elementList, int id);
60  bool OpenControlNodeList(rapidxml::xml_node<>* elementNode, std::vector<Node*>& nodeVector);
61 };
62 
63 #endif // FILEHANDING_H
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef FILEHANDING_H
19 #define FILEHANDING_H
20 
21 #include <wx/string.h>
22 #include <fstream>
23 #include <sstream>
24 
25 #include "Workspace.h"
26 #include "ControlEditor.h"
28 #include "ElectricCalculation.h"
29 #include "Text.h"
30 
31 #include "rapidXML/rapidxml.hpp"
32 // Modified: http://stackoverflow.com/questions/14113923/rapidxml-print-header-has-undefined-methods
33 #include "rapidXML/rapidxml_print.hpp"
34 #include "rapidXML/rapidxml_utils.hpp"
35 
44 {
45 public:
46  FileHanding();
47  FileHanding(Workspace* workspace);
48  FileHanding(ControlEditor* controlEditor);
49  ~FileHanding();
50 
51  void SetWorkspace(Workspace* workspace) { m_workspace = workspace; }
52  void SetControlEditor(ControlEditor* controlEditor) { m_controlEditor = controlEditor; }
53 
54  void SaveProject(wxFileName path);
55  bool OpenProject(wxFileName path);
56 
57  void SaveControl(wxFileName path);
58  bool OpenControl(wxFileName path, std::vector<ControlElement*>& ctrlElementList, std::vector<ConnectionLine*>& ctrlConnectionList);
59 
60  void SaveControlElements(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementsNode, ControlElementContainer* ctrlContainer = NULL);
61  bool OpenControlElements(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementsNode, ControlElementContainer* ctrlContainer = NULL);
62 
63 protected:
64  Workspace* m_workspace = NULL;
65  ControlEditor* m_controlEditor = NULL;
66 
67  rapidxml::xml_node<>* AppendNode(rapidxml::xml_document<>& doc,
68  rapidxml::xml_node<>* parentNode,
69  const char* name,
70  rapidxml::node_type nodeType = rapidxml::node_element);
71  void SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, wxString value);
72  void SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, int value);
73  void SetNodeValue(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, double value);
74  void SetNodeAttribute(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, const char* atrName, wxString value);
75  void SetNodeAttribute(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, const char* atrName, int value);
76  void SetNodeAttribute(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* node, const char* atrName, double value);
77  double GetNodeValueDouble(rapidxml::xml_node<>* parent, const char* nodeName);
78  int GetNodeValueInt(rapidxml::xml_node<>* parent, const char* nodeName);
79  int GetAttributeValueInt(rapidxml::xml_node<>* parent, const char* nodeName, const char* atrName);
80  int GetAttributeValueInt(rapidxml::xml_node<>* node, const char* atrName);
81 
82  void SaveControlNodes(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* nodesN, std::vector<Node*> nodeList);
83  ControlElement* GetControlElementFromID(std::vector<ControlElement*> elementList, int id);
84  bool OpenControlNodeList(rapidxml::xml_node<>* elementNode, std::vector<Node*>& nodeVector);
85 };
86 
87 #endif // FILEHANDING_H
+
Save and opens the projects created on disk.
Definition: FileHanding.h:43
Base class of electric calculations, with general methods.
- - - - + +
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
+ + + +
This class manages the graphical and power elements. It is responsible for handling the user&#39;s intera...
Definition: Workspace.h:81
-
1 #include "Gain.h"
2 #include "GainForm.h"
3 
4 Gain::Gain(int id) : ControlElement(id)
5 {
6  m_triPts.resize(3);
7  SetValue(m_value);
8  Node* nodeIn = new Node(m_position + wxPoint2DDouble(-m_width / 2, 0), Node::NODE_IN, m_borderSize);
9  nodeIn->StartMove(m_position);
10  Node* nodeOut = new Node(m_position + wxPoint2DDouble(m_width / 2, 0), Node::NODE_OUT, m_borderSize);
11  nodeOut->SetAngle(180.0);
12  nodeOut->StartMove(m_position);
13  m_nodeList.push_back(nodeIn);
14  m_nodeList.push_back(nodeOut);
15 }
16 
17 Gain::~Gain() {}
18 void Gain::Draw(wxPoint2DDouble translation, double scale) const
19 {
20  if(m_selected) {
21  glColor4dv(m_selectionColour.GetRGBA());
22  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
23  std::vector<wxPoint2DDouble> m_triSelectedPts;
24  if(m_angle == 0.0) {
25  m_triSelectedPts.push_back(m_triPts[0] - wxPoint2DDouble(borderSize / 2, borderSize / 1.5));
26  m_triSelectedPts.push_back(m_triPts[1] - wxPoint2DDouble(borderSize / 2, -borderSize / 1.5));
27  m_triSelectedPts.push_back(m_triPts[2] - wxPoint2DDouble(-borderSize, 0));
28  } else if(m_angle == 90.0) {
29  m_triSelectedPts.push_back(m_triPts[0] - wxPoint2DDouble(borderSize / 1.5, borderSize / 2));
30  m_triSelectedPts.push_back(m_triPts[1] - wxPoint2DDouble(-borderSize / 1.5, borderSize / 2));
31  m_triSelectedPts.push_back(m_triPts[2] - wxPoint2DDouble(0, -borderSize));
32  } else if(m_angle == 180.0) {
33  m_triSelectedPts.push_back(m_triPts[0] - wxPoint2DDouble(borderSize, 0));
34  m_triSelectedPts.push_back(m_triPts[1] - wxPoint2DDouble(-borderSize / 2, borderSize / 1.5));
35  m_triSelectedPts.push_back(m_triPts[2] - wxPoint2DDouble(-borderSize / 2, -borderSize / 1.5));
36  } else if(m_angle == 270.0) {
37  m_triSelectedPts.push_back(m_triPts[0] - wxPoint2DDouble(0, borderSize));
38  m_triSelectedPts.push_back(m_triPts[1] - wxPoint2DDouble(-borderSize / 1.5, -borderSize / 2));
39  m_triSelectedPts.push_back(m_triPts[2] - wxPoint2DDouble(borderSize / 1.5, -borderSize / 2));
40  }
41  DrawTriangle(m_triSelectedPts);
42  }
43  glLineWidth(1.0);
44  glColor4d(1.0, 1.0, 1.0, 1.0);
45  DrawTriangle(m_triPts);
46  glColor4d(0.0, 0.0, 0.0, 1.0);
47  DrawTriangle(m_triPts, GL_LINE_LOOP);
48 
49  // Plot number.
50  glEnable(GL_TEXTURE_2D);
51  glColor4d(0.0, 0.0, 0.0, 1.0);
52  m_glStringValue->bind();
53  if(m_angle == 0.0)
54  m_glStringValue->render(m_position.m_x - m_width / 2 + m_glStringValue->getWidth() / 2 + 2 + m_borderSize,
55  m_position.m_y);
56  else if(m_angle == 90.0)
57  m_glStringValue->render(m_position.m_x,
58  m_position.m_y - m_height / 2 + m_glStringValue->getheight() / 2 + 2 + m_borderSize);
59  else if(m_angle == 180.0)
60  m_glStringValue->render(m_position.m_x + m_width / 2 - m_glStringValue->getWidth() / 2 - 2 - m_borderSize,
61  m_position.m_y);
62  else if(m_angle == 270.0)
63  m_glStringValue->render(m_position.m_x,
64  m_position.m_y + m_height / 2 - m_glStringValue->getheight() / 2 - 2 - m_borderSize);
65  glDisable(GL_TEXTURE_2D);
66 
67  glColor4d(0.0, 0.0, 0.0, 1.0);
68  DrawNodes();
69 }
70 
71 bool Gain::ShowForm(wxWindow* parent, Element* element)
72 {
73  GainForm* form = new GainForm(parent, this);
74  if(form->ShowModal() == wxID_OK) {
75  form->Destroy();
76  return true;
77  }
78  form->Destroy();
79  return false;
80 }
81 
82 void Gain::Rotate(bool clockwise)
83 {
84  if(clockwise)
85  m_angle += 90.0;
86  else
87  m_angle -= 90.0;
88  if(m_angle >= 360.0)
89  m_angle = 0.0;
90  else if(m_angle < 0)
91  m_angle = 270.0;
92 
93  UpdatePoints();
94 
95  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
96  Node* node = *it;
97  node->Rotate(clockwise);
98  }
99 }
100 
101 void Gain::SetValue(double value)
102 {
103  m_value = value;
104  wxString text = "";
105  if(std::abs(m_value) > 1e3 || std::abs(m_value) < 1e-3)
106  text = wxString::Format("%g", m_value);
107  else
108  text = StringFromDouble(m_value);
109 
110  wxFont font(m_fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
111  wxScreenDC dc;
112 
113  if(m_glStringValue) {
114  delete m_glStringValue;
115  m_glStringValue = NULL;
116  }
117  m_glStringValue = new wxGLString(text);
118  m_glStringValue->setFont(font);
119  m_glStringValue->consolidate(&dc);
120 
121  m_width = m_glStringValue->getWidth() + 18 + 2 * m_borderSize;
122  m_height = m_glStringValue->getheight() + 18 + 2 * m_borderSize;
123 
124  if(m_width > m_height)
125  m_height = m_width;
126  else
127  m_width = m_height;
128 
129  SetPosition(m_position); // Update rectangle.
130 
131  UpdatePoints();
132 }
133 
134 void Gain::UpdatePoints()
135 {
136  if(m_nodeList.size() != 0) {
137  if(m_angle == 0.0) {
138  m_triPts[0] = m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize, m_borderSize);
139  m_triPts[1] = m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize, -m_borderSize);
140  m_triPts[2] = m_position + wxPoint2DDouble(m_width / 2 - m_borderSize, 0);
141  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
142  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(m_width / 2 - 2, 0));
143  } else if(m_angle == 90.0) {
144  m_triPts[0] = m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize, m_borderSize);
145  m_triPts[1] = m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize, m_borderSize);
146  m_triPts[2] = m_position + wxPoint2DDouble(0, m_height / 2 - m_borderSize);
147  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
148  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2 - 2));
149  } else if(m_angle == 180.0) {
150  m_triPts[0] = m_position + wxPoint2DDouble(-m_width / 2 + m_borderSize, 0);
151  m_triPts[1] = m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize, m_borderSize);
152  m_triPts[2] = m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize, -m_borderSize);
153  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
154  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2 + 2, 0));
155  } else if(m_angle == 270.0) {
156  m_triPts[0] = m_position + wxPoint2DDouble(0, -m_height / 2 + m_borderSize);
157  m_triPts[1] = m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize, -m_borderSize);
158  m_triPts[2] = m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize, -m_borderSize);
159  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
160  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2 + 2));
161  }
162  }
163 }
164 
165 void Gain::Move(wxPoint2DDouble position)
166 {
167  SetPosition(m_movePos + position - m_moveStartPt);
168  UpdatePoints();
169 }
170 
171 bool Gain::Solve(double input, double timeStep)
172 {
173  m_output = input * m_value;
174  return true;
175 }
176 
178 {
179  Gain* copy = new Gain(m_elementID);
180  *copy = *this;
181  m_glStringValue = NULL;
182  SetValue(m_value);
183  return copy;
184 }
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Gain.cpp:165
- -
Definition: Gain.h:11
- -
virtual Element * GetCopy()
Get a the element copy.
Definition: Gain.cpp:177
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Gain.cpp:71
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Gain.cpp:82
- -
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Gain.cpp:18
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Gain.h"
19 #include "GainForm.h"
20 
21 Gain::Gain(int id) : ControlElement(id)
22 {
23  m_triPts.resize(3);
24  SetValue(m_value);
25  Node* nodeIn = new Node(m_position + wxPoint2DDouble(-m_width / 2, 0), Node::NODE_IN, m_borderSize);
26  nodeIn->StartMove(m_position);
27  Node* nodeOut = new Node(m_position + wxPoint2DDouble(m_width / 2, 0), Node::NODE_OUT, m_borderSize);
28  nodeOut->SetAngle(180.0);
29  nodeOut->StartMove(m_position);
30  m_nodeList.push_back(nodeIn);
31  m_nodeList.push_back(nodeOut);
32 }
33 
34 Gain::~Gain() {}
35 void Gain::Draw(wxPoint2DDouble translation, double scale) const
36 {
37  if(m_selected) {
38  glColor4dv(m_selectionColour.GetRGBA());
39  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
40  std::vector<wxPoint2DDouble> m_triSelectedPts;
41  if(m_angle == 0.0) {
42  m_triSelectedPts.push_back(m_triPts[0] - wxPoint2DDouble(borderSize / 2, borderSize / 1.5));
43  m_triSelectedPts.push_back(m_triPts[1] - wxPoint2DDouble(borderSize / 2, -borderSize / 1.5));
44  m_triSelectedPts.push_back(m_triPts[2] - wxPoint2DDouble(-borderSize, 0));
45  } else if(m_angle == 90.0) {
46  m_triSelectedPts.push_back(m_triPts[0] - wxPoint2DDouble(borderSize / 1.5, borderSize / 2));
47  m_triSelectedPts.push_back(m_triPts[1] - wxPoint2DDouble(-borderSize / 1.5, borderSize / 2));
48  m_triSelectedPts.push_back(m_triPts[2] - wxPoint2DDouble(0, -borderSize));
49  } else if(m_angle == 180.0) {
50  m_triSelectedPts.push_back(m_triPts[0] - wxPoint2DDouble(borderSize, 0));
51  m_triSelectedPts.push_back(m_triPts[1] - wxPoint2DDouble(-borderSize / 2, borderSize / 1.5));
52  m_triSelectedPts.push_back(m_triPts[2] - wxPoint2DDouble(-borderSize / 2, -borderSize / 1.5));
53  } else if(m_angle == 270.0) {
54  m_triSelectedPts.push_back(m_triPts[0] - wxPoint2DDouble(0, borderSize));
55  m_triSelectedPts.push_back(m_triPts[1] - wxPoint2DDouble(-borderSize / 1.5, -borderSize / 2));
56  m_triSelectedPts.push_back(m_triPts[2] - wxPoint2DDouble(borderSize / 1.5, -borderSize / 2));
57  }
58  DrawTriangle(m_triSelectedPts);
59  }
60  glLineWidth(1.0);
61  glColor4d(1.0, 1.0, 1.0, 1.0);
62  DrawTriangle(m_triPts);
63  glColor4d(0.0, 0.0, 0.0, 1.0);
64  DrawTriangle(m_triPts, GL_LINE_LOOP);
65 
66  // Plot number.
67  glEnable(GL_TEXTURE_2D);
68  glColor4d(0.0, 0.0, 0.0, 1.0);
69  m_glStringValue->bind();
70  if(m_angle == 0.0)
71  m_glStringValue->render(m_position.m_x - m_width / 2 + m_glStringValue->getWidth() / 2 + 2 + m_borderSize,
72  m_position.m_y);
73  else if(m_angle == 90.0)
74  m_glStringValue->render(m_position.m_x,
75  m_position.m_y - m_height / 2 + m_glStringValue->getheight() / 2 + 2 + m_borderSize);
76  else if(m_angle == 180.0)
77  m_glStringValue->render(m_position.m_x + m_width / 2 - m_glStringValue->getWidth() / 2 - 2 - m_borderSize,
78  m_position.m_y);
79  else if(m_angle == 270.0)
80  m_glStringValue->render(m_position.m_x,
81  m_position.m_y + m_height / 2 - m_glStringValue->getheight() / 2 - 2 - m_borderSize);
82  glDisable(GL_TEXTURE_2D);
83 
84  glColor4d(0.0, 0.0, 0.0, 1.0);
85  DrawNodes();
86 }
87 
88 bool Gain::ShowForm(wxWindow* parent, Element* element)
89 {
90  GainForm* form = new GainForm(parent, this);
91  if(form->ShowModal() == wxID_OK) {
92  form->Destroy();
93  return true;
94  }
95  form->Destroy();
96  return false;
97 }
98 
99 void Gain::Rotate(bool clockwise)
100 {
101  if(clockwise)
102  m_angle += 90.0;
103  else
104  m_angle -= 90.0;
105  if(m_angle >= 360.0)
106  m_angle = 0.0;
107  else if(m_angle < 0)
108  m_angle = 270.0;
109 
110  UpdatePoints();
111 
112  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
113  Node* node = *it;
114  node->Rotate(clockwise);
115  }
116 }
117 
118 void Gain::SetValue(double value)
119 {
120  m_value = value;
121  wxString text = "";
122  if(std::abs(m_value) > 1e3 || std::abs(m_value) < 1e-3)
123  text = wxString::Format("%g", m_value);
124  else
125  text = StringFromDouble(m_value);
126 
127  wxFont font(m_fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
128  wxScreenDC dc;
129 
130  if(m_glStringValue) {
131  delete m_glStringValue;
132  m_glStringValue = NULL;
133  }
134  m_glStringValue = new wxGLString(text);
135  m_glStringValue->setFont(font);
136  m_glStringValue->consolidate(&dc);
137 
138  m_width = m_glStringValue->getWidth() + 18 + 2 * m_borderSize;
139  m_height = m_glStringValue->getheight() + 18 + 2 * m_borderSize;
140 
141  if(m_width > m_height)
142  m_height = m_width;
143  else
144  m_width = m_height;
145 
146  SetPosition(m_position); // Update rectangle.
147 
148  UpdatePoints();
149 }
150 
151 void Gain::UpdatePoints()
152 {
153  if(m_nodeList.size() != 0) {
154  if(m_angle == 0.0) {
155  m_triPts[0] = m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize, m_borderSize);
156  m_triPts[1] = m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize, -m_borderSize);
157  m_triPts[2] = m_position + wxPoint2DDouble(m_width / 2 - m_borderSize, 0);
158  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
159  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(m_width / 2 - 2, 0));
160  } else if(m_angle == 90.0) {
161  m_triPts[0] = m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize, m_borderSize);
162  m_triPts[1] = m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize, m_borderSize);
163  m_triPts[2] = m_position + wxPoint2DDouble(0, m_height / 2 - m_borderSize);
164  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
165  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2 - 2));
166  } else if(m_angle == 180.0) {
167  m_triPts[0] = m_position + wxPoint2DDouble(-m_width / 2 + m_borderSize, 0);
168  m_triPts[1] = m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize, m_borderSize);
169  m_triPts[2] = m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize, -m_borderSize);
170  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
171  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2 + 2, 0));
172  } else if(m_angle == 270.0) {
173  m_triPts[0] = m_position + wxPoint2DDouble(0, -m_height / 2 + m_borderSize);
174  m_triPts[1] = m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize, -m_borderSize);
175  m_triPts[2] = m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize, -m_borderSize);
176  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
177  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2 + 2));
178  }
179  }
180 }
181 
182 void Gain::Move(wxPoint2DDouble position)
183 {
184  SetPosition(m_movePos + position - m_moveStartPt);
185  UpdatePoints();
186 }
187 
188 bool Gain::Solve(double input, double timeStep)
189 {
190  m_output = input * m_value;
191  return true;
192 }
193 
195 {
196  Gain* copy = new Gain(m_elementID);
197  *copy = *this;
198  m_glStringValue = NULL;
199  SetValue(m_value);
200  return copy;
201 }
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Gain.cpp:182
+ + +
Provide an output multiplying the input by a constant. .
Definition: Gain.h:36
+
Node of a control element. This class manages the user interaction with the connection and control el...
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Gain.cpp:194
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Gain.cpp:88
+ +
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Gain.cpp:99
+
Form to edit the gain control data.
Definition: GainForm.h:31
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Gain.cpp:35
+
diff --git a/docs/doxygen/html/_gain_8h.html b/docs/doxygen/html/_gain_8h.html new file mode 100644 index 0000000..0f255cc --- /dev/null +++ b/docs/doxygen/html/_gain_8h.html @@ -0,0 +1,117 @@ + + + + + + + + + +Project/Gain.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
Gain.h File Reference
+
+
+
#include "ControlElement.h"
+#include <wx/dcscreen.h>
+#include "wxGLString.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  Gain
 Provide an output multiplying the input by a constant. \( output = K \cdot input \). More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_gain_8h_source.html b/docs/doxygen/html/_gain_8h_source.html index 26b1090..41069c4 100644 --- a/docs/doxygen/html/_gain_8h_source.html +++ b/docs/doxygen/html/_gain_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,24 +88,25 @@ $(document).ready(function(){initNavTree('_gain_8h_source.html','');});
Gain.h
-
1 #ifndef GAIN_H
2 #define GAIN_H
3 
4 #include "ControlElement.h"
5 
6 #include <wx/dcscreen.h>
7 #include "wxGLString.h"
8 
9 class GainForm;
10 
11 class Gain : public ControlElement
12 {
13  public:
14  Gain(int id);
15  ~Gain();
16 
17  virtual void Draw(wxPoint2DDouble translation, double scale) const;
18  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
19  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
20  virtual bool ShowForm(wxWindow* parent, Element* element);
21  virtual void Rotate(bool clockwise = true);
22  virtual void Move(wxPoint2DDouble position);
23  virtual void UpdateText() { SetValue(m_value); }
24  virtual void SetValue(double value);
25  virtual double GetValue() const { return m_value; }
26  virtual void UpdatePoints();
27 
28  virtual bool Solve(double input, double timeStep);
29 
30  virtual Element* GetCopy();
31 
32  protected:
33  double m_value = 1.0;
34 
35  wxGLString* m_glStringValue = NULL;
36  int m_fontSize = 10;
37 
38  std::vector<wxPoint2DDouble> m_triPts;
39 };
40 
41 #endif // GAIN_H
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Gain.cpp:165
- -
Definition: Gain.h:11
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Gain.cpp:177
-
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Gain.h:19
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Gain.cpp:71
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Gain.cpp:82
- -
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Gain.h:18
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Gain.cpp:18
- +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef GAIN_H
19 #define GAIN_H
20 
21 #include "ControlElement.h"
22 
23 #include <wx/dcscreen.h>
24 #include "wxGLString.h"
25 
26 class GainForm;
27 
36 class Gain : public ControlElement
37 {
38  public:
39  Gain(int id);
40  ~Gain();
41 
42  virtual void Draw(wxPoint2DDouble translation, double scale) const;
43  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
44  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
45  virtual bool ShowForm(wxWindow* parent, Element* element);
46  virtual void Rotate(bool clockwise = true);
47  virtual void Move(wxPoint2DDouble position);
48  virtual void UpdateText() { SetValue(m_value); }
49  virtual void SetValue(double value);
50  virtual double GetValue() const { return m_value; }
51  virtual void UpdatePoints();
52 
53  virtual bool Solve(double input, double timeStep);
54 
55  virtual Element* GetCopy();
56 
57  protected:
58  double m_value = 1.0;
59 
60  wxGLString* m_glStringValue = NULL;
61  int m_fontSize = 10;
62 
63  std::vector<wxPoint2DDouble> m_triPts;
64 };
65 
66 #endif // GAIN_H
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Gain.cpp:182
+ +
Provide an output multiplying the input by a constant. .
Definition: Gain.h:36
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Gain.cpp:194
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Gain.h:44
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Gain.cpp:88
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Gain.cpp:99
+
Form to edit the gain control data.
Definition: GainForm.h:31
+
Base class of a control element. Provide general methods to other control classes.
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Gain.h:43
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Gain.cpp:35
+
-
1 #include "GainForm.h"
2 #include "Gain.h"
3 
4 GainForm::GainForm(wxWindow* parent, Gain* gain) : GainFormBase(parent)
5 {
6  SetSize(GetBestSize());
7 
8  m_parent = parent;
9  m_gain = gain;
10 
11  m_textCtrlValue->SetValue(m_gain->StringFromDouble(m_gain->GetValue()));
12 }
13 
14 GainForm::~GainForm() {}
15 void GainForm::OnOKButtonClick(wxCommandEvent& event)
16 {
17  if(ValidateData()) EndModal(wxID_OK);
18 }
19 
20 bool GainForm::ValidateData()
21 {
22  double value;
23  if(!m_gain->DoubleFromString(this, m_textCtrlValue->GetValue(), value,
24  _("Value entered incorrectly in the field \"Gain value\".")))
25  return false;
26 
27  m_gain->SetValue(value);
28  return true;
29 }
Definition: Gain.h:11
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "GainForm.h"
19 #include "Gain.h"
20 
21 GainForm::GainForm(wxWindow* parent, Gain* gain) : GainFormBase(parent)
22 {
23  SetSize(GetBestSize());
24 
25  m_parent = parent;
26  m_gain = gain;
27 
28  m_textCtrlValue->SetValue(m_gain->StringFromDouble(m_gain->GetValue()));
29 }
30 
31 GainForm::~GainForm() {}
32 void GainForm::OnOKButtonClick(wxCommandEvent& event)
33 {
34  if(ValidateData()) EndModal(wxID_OK);
35 }
36 
37 bool GainForm::ValidateData()
38 {
39  double value;
40  if(!m_gain->DoubleFromString(this, m_textCtrlValue->GetValue(), value,
41  _("Value entered incorrectly in the field \"Gain value\".")))
42  return false;
43 
44  m_gain->SetValue(value);
45  return true;
46 }
+
Provide an output multiplying the input by a constant. .
Definition: Gain.h:36
+
diff --git a/docs/doxygen/html/_gain_form_8h.html b/docs/doxygen/html/_gain_form_8h.html new file mode 100644 index 0000000..d7db441 --- /dev/null +++ b/docs/doxygen/html/_gain_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/GainForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
GainForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  GainForm
 Form to edit the gain control data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_gain_form_8h_source.html b/docs/doxygen/html/_gain_form_8h_source.html index f61892a..e0eb282 100644 --- a/docs/doxygen/html/_gain_form_8h_source.html +++ b/docs/doxygen/html/_gain_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_gain_form_8h_source.html','');});
GainForm.h
-
1 #ifndef GAINFORM_H
2 #define GAINFORM_H
3 #include "ElementForm.h"
4 
5 class Gain;
6 
7 class GainForm : public GainFormBase
8 {
9  public:
10  GainForm(wxWindow* parent, Gain* gain);
11  virtual ~GainForm();
12 
13  virtual bool ValidateData();
14 
15  protected:
16  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
17  virtual void OnOKButtonClick(wxCommandEvent& event);
18 
19  wxWindow* m_parent;
20  Gain* m_gain;
21 };
22 #endif // GAINFORM_H
Definition: Gain.h:11
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef GAINFORM_H
19 #define GAINFORM_H
20 #include "ElementForm.h"
21 
22 class Gain;
23 
31 class GainForm : public GainFormBase
32 {
33  public:
34  GainForm(wxWindow* parent, Gain* gain);
35  virtual ~GainForm();
36 
37  virtual bool ValidateData();
38 
39  protected:
40  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
41  virtual void OnOKButtonClick(wxCommandEvent& event);
42 
43  wxWindow* m_parent;
44  Gain* m_gain;
45 };
46 #endif // GAINFORM_H
Provide an output multiplying the input by a constant. .
Definition: Gain.h:36
- +
Form to edit the gain control data.
Definition: GainForm.h:31
-
1 #include "GeneralPropertiesForm.h"
2 #include "PropertiesData.h"
3 
4 GeneralPropertiesForm::GeneralPropertiesForm(wxWindow* parent, PropertiesData* properties)
6 {
7  m_properties = properties;
8  auto data = m_properties->GetGeneralPropertiesData();
9 
10  // Clear the choices and rebuild to set the correct translations.
11  m_choiceLanguage->Clear();
12  m_choiceLanguage->Insert(_("English"), 0);
13  m_choiceLanguage->Insert(_("Portuguese"), 1);
14  m_choiceTheme->Clear();
15  m_choiceTheme->Insert(_("Light"), 0);
16  m_choiceTheme->Insert(_("Dark"), 1);
17 
18  switch(data.language) {
19  case wxLANGUAGE_ENGLISH: {
20  m_choiceLanguage->SetSelection(0);
21  } break;
22  case wxLANGUAGE_PORTUGUESE_BRAZILIAN: {
23  m_choiceLanguage->SetSelection(1);
24  } break;
25  default: {
26  m_choiceLanguage->SetSelection(wxNOT_FOUND);
27  } break;
28  }
29  switch(data.theme) {
30  case THEME_LIGHT: {
31  m_choiceTheme->SetSelection(0);
32  } break;
33  case THEME_DARK: {
34  m_choiceTheme->SetSelection(1);
35  } break;
36  }
37 }
38 
39 GeneralPropertiesForm::~GeneralPropertiesForm() {}
40 void GeneralPropertiesForm::OnButtonOKClick(wxCommandEvent& event)
41 {
42  if(ValidateData()) EndModal(wxID_OK);
43 }
44 
45 bool GeneralPropertiesForm::ValidateData()
46 {
47  auto data = m_properties->GetGeneralPropertiesData();
48  auto checkData = m_properties->GetGeneralPropertiesData();
49  bool hasChanges = false;
50 
51  wxTextFile file("config.ini");
52  if(!file.Create()) {
53  if(!file.Open()) {
54  // Fail to access the file.
55  wxMessageDialog msgDialog(this,
56  _("It was not possible to access the init file.\nThe settings won't be applied."),
57  _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
58  msgDialog.ShowModal();
59  }
60  file.Clear();
61  }
62 
63  wxString line = "lang=";
64  switch(m_choiceLanguage->GetSelection()) {
65  case 0: {
66  line += "en";
67  data.language = wxLANGUAGE_ENGLISH;
68  } break;
69  case 1: {
70  line += "pt-br";
71  data.language = wxLANGUAGE_PORTUGUESE_BRAZILIAN;
72  } break;
73  }
74  file.AddLine(line);
75  if(data.language != checkData.language) hasChanges = true;
76 
77  line = "theme=";
78  switch(m_choiceTheme->GetSelection()) {
79  case 0: {
80  line += "light";
81  data.theme = THEME_LIGHT;
82  } break;
83  case 1: {
84  line += "dark";
85  data.theme = THEME_DARK;
86  } break;
87  }
88  file.AddLine(line);
89  if(data.theme != checkData.theme) hasChanges = true;
90 
91  file.Write();
92  file.Close();
93 
94  if(hasChanges) {
95  wxMessageDialog msgDialog(this, _("The application must be restarted to settings changes be applied."),
96  _("Info"), wxOK | wxCENTRE | wxICON_INFORMATION);
97  msgDialog.ShowModal();
98  }
99  m_properties->SetGeneralPropertiesData(data);
100  return true;
101 }
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "GeneralPropertiesForm.h"
19 #include "PropertiesData.h"
20 
21 GeneralPropertiesForm::GeneralPropertiesForm(wxWindow* parent, PropertiesData* properties)
23 {
24  m_properties = properties;
25  auto data = m_properties->GetGeneralPropertiesData();
26 
27  // Clear the choices and rebuild to set the correct translations.
28  m_choiceLanguage->Clear();
29  m_choiceLanguage->Insert(_("English"), 0);
30  m_choiceLanguage->Insert(_("Portuguese"), 1);
31  m_choiceTheme->Clear();
32  m_choiceTheme->Insert(_("Light"), 0);
33  m_choiceTheme->Insert(_("Dark"), 1);
34 
35  switch(data.language) {
36  case wxLANGUAGE_ENGLISH: {
37  m_choiceLanguage->SetSelection(0);
38  } break;
39  case wxLANGUAGE_PORTUGUESE_BRAZILIAN: {
40  m_choiceLanguage->SetSelection(1);
41  } break;
42  default: {
43  m_choiceLanguage->SetSelection(wxNOT_FOUND);
44  } break;
45  }
46  switch(data.theme) {
47  case THEME_LIGHT: {
48  m_choiceTheme->SetSelection(0);
49  } break;
50  case THEME_DARK: {
51  m_choiceTheme->SetSelection(1);
52  } break;
53  }
54 }
55 
56 GeneralPropertiesForm::~GeneralPropertiesForm() {}
57 void GeneralPropertiesForm::OnButtonOKClick(wxCommandEvent& event)
58 {
59  if(ValidateData()) EndModal(wxID_OK);
60 }
61 
62 bool GeneralPropertiesForm::ValidateData()
63 {
64  auto data = m_properties->GetGeneralPropertiesData();
65  auto checkData = m_properties->GetGeneralPropertiesData();
66  bool hasChanges = false;
67 
68  wxTextFile file("config.ini");
69  if(!file.Create()) {
70  if(!file.Open()) {
71  // Fail to access the file.
72  wxMessageDialog msgDialog(this,
73  _("It was not possible to access the init file.\nThe settings won't be applied."),
74  _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
75  msgDialog.ShowModal();
76  }
77  file.Clear();
78  }
79 
80  wxString line = "lang=";
81  switch(m_choiceLanguage->GetSelection()) {
82  case 0: {
83  line += "en";
84  data.language = wxLANGUAGE_ENGLISH;
85  } break;
86  case 1: {
87  line += "pt-br";
88  data.language = wxLANGUAGE_PORTUGUESE_BRAZILIAN;
89  } break;
90  }
91  file.AddLine(line);
92  if(data.language != checkData.language) hasChanges = true;
93 
94  line = "theme=";
95  switch(m_choiceTheme->GetSelection()) {
96  case 0: {
97  line += "light";
98  data.theme = THEME_LIGHT;
99  } break;
100  case 1: {
101  line += "dark";
102  data.theme = THEME_DARK;
103  } break;
104  }
105  file.AddLine(line);
106  if(data.theme != checkData.theme) hasChanges = true;
107 
108  file.Write();
109  file.Close();
110 
111  if(hasChanges) {
112  wxMessageDialog msgDialog(this, _("The application must be restarted to settings changes be applied."),
113  _("Info"), wxOK | wxCENTRE | wxICON_INFORMATION);
114  msgDialog.ShowModal();
115  }
116  m_properties->SetGeneralPropertiesData(data);
117  return true;
118 }
+
diff --git a/docs/doxygen/html/_general_properties_form_8h.html b/docs/doxygen/html/_general_properties_form_8h.html new file mode 100644 index 0000000..86aa7a7 --- /dev/null +++ b/docs/doxygen/html/_general_properties_form_8h.html @@ -0,0 +1,117 @@ + + + + + + + + + +Project/GeneralPropertiesForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
GeneralPropertiesForm.h File Reference
+
+
+
#include "PropertiesForm.h"
+#include <wx/textfile.h>
+#include <wx/msgdlg.h>
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  GeneralPropertiesForm
 Form to edit the software's general data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_general_properties_form_8h_source.html b/docs/doxygen/html/_general_properties_form_8h_source.html index f4bbdd7..63f2c24 100644 --- a/docs/doxygen/html/_general_properties_form_8h_source.html +++ b/docs/doxygen/html/_general_properties_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_general_properties_form_8h_source.htm
GeneralPropertiesForm.h
-
1 #ifndef GENERALPROPERTIESFORM_H
2 #define GENERALPROPERTIESFORM_H
3 
4 #include "PropertiesForm.h"
5 
6 #include <wx/textfile.h>
7 #include <wx/msgdlg.h>
8 
9 class PropertiesData;
10 
12 {
13 public:
14  GeneralPropertiesForm(wxWindow* parent, PropertiesData* properties);
15  virtual ~GeneralPropertiesForm();
16 
17 protected:
18  virtual void OnButtonCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
19  virtual void OnButtonOKClick(wxCommandEvent& event);
20  virtual bool ValidateData();
21 
22  PropertiesData* m_properties = NULL;
23 };
24 #endif // GENERALPROPERTIESFORM_H
- +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef GENERALPROPERTIESFORM_H
19 #define GENERALPROPERTIESFORM_H
20 
21 #include "PropertiesForm.h"
22 
23 #include <wx/textfile.h>
24 #include <wx/msgdlg.h>
25 
26 class PropertiesData;
27 
36 {
37  public:
38  GeneralPropertiesForm(wxWindow* parent, PropertiesData* properties);
39  virtual ~GeneralPropertiesForm();
40 
41  protected:
42  virtual void OnButtonCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
43  virtual void OnButtonOKClick(wxCommandEvent& event);
44  virtual bool ValidateData();
45 
46  PropertiesData* m_properties = NULL;
47 };
48 #endif // GENERALPROPERTIESFORM_H
+
Form to edit the software&#39;s general data.
-
1 #include "GeneratorStabForm.h"
2 #include "SwitchingForm.h"
3 #include "SyncGenerator.h"
4 #include "ControlEditor.h"
5 #include "ControlElementContainer.h"
6 
7 GeneratorStabForm::GeneratorStabForm(wxWindow* parent, SyncGenerator* syncGenerator) : GeneratorStabFormBase(parent)
8 {
9  SetSize(GetBestSize());
10  m_syncGenerator = syncGenerator;
11  m_parent = parent;
12 
13  SyncGeneratorElectricalData data = syncGenerator->GetElectricalData();
14 
15  m_checkBoxPlotSyncMachine->SetValue(data.plotSyncMachine);
16 
17  m_textCtrlInertia->SetValue(SyncGenerator::StringFromDouble(data.inertia));
18  m_textCtrlDamping->SetValue(SyncGenerator::StringFromDouble(data.damping));
19 
20  m_checkBoxUseAVR->SetValue(data.useAVR);
21  m_buttonEditAVR->Enable(data.useAVR);
22 
23  m_checkBoxUseSG->SetValue(data.useSpeedGovernor);
24  m_buttonEditSG->Enable(data.useSpeedGovernor);
25 
26  m_textCtrlRa->SetValue(SyncGenerator::StringFromDouble(data.armResistance));
27  m_textCtrlXp->SetValue(SyncGenerator::StringFromDouble(data.potierReactance));
28  m_textCtrlSat->SetValue(SyncGenerator::StringFromDouble(data.satFactor));
29 
30  m_textCtrlSyncXd->SetValue(SyncGenerator::StringFromDouble(data.syncXd));
31  m_textCtrlSyncXq->SetValue(SyncGenerator::StringFromDouble(data.syncXq));
32 
33  m_textCtrlTranXd->SetValue(SyncGenerator::StringFromDouble(data.transXd));
34  m_textCtrlTranXq->SetValue(SyncGenerator::StringFromDouble(data.transXq));
35  m_textCtrlTranTd0->SetValue(SyncGenerator::StringFromDouble(data.transTd0));
36  m_textCtrlTranTq0->SetValue(SyncGenerator::StringFromDouble(data.transTq0));
37 
38  m_textCtrlSubXd->SetValue(SyncGenerator::StringFromDouble(data.subXd));
39  m_textCtrlSubXq->SetValue(SyncGenerator::StringFromDouble(data.subXq));
40  m_textCtrlSubTd0->SetValue(SyncGenerator::StringFromDouble(data.subTd0));
41  m_textCtrlSubTq0->SetValue(SyncGenerator::StringFromDouble(data.subTq0));
42 }
43 
44 GeneratorStabForm::~GeneratorStabForm() {}
45 void GeneratorStabForm::OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
46 void GeneratorStabForm::OnEditAVRButtonClick(wxCommandEvent& event)
47 {
48  SyncGeneratorElectricalData data = m_syncGenerator->GetElectricalData();
49  if(!data.avr) {
50  data.avr = new ControlElementContainer();
51  m_syncGenerator->SetElectricalData(data);
52  }
53  ControlEditor* cEditor = new ControlEditor(m_parent, IOControl::IN_TERMINAL_VOLTAGE | IOControl::OUT_FIELD_VOLTAGE);
54  cEditor->SetElementsList(data.avr->GetControlElementsList());
55  cEditor->SetConnectionsList(data.avr->GetConnectionLineList());
56  cEditor->SetControlContainer(data.avr);
57  cEditor->Show();
58 }
59 
60 void GeneratorStabForm::OnOKButtonClick(wxCommandEvent& event)
61 {
62  if(ValidateData()) EndModal(wxID_OK);
63 }
64 
65 void GeneratorStabForm::OnSpeedGovernorButtonClick(wxCommandEvent& event)
66 {
67  SyncGeneratorElectricalData data = m_syncGenerator->GetElectricalData();
68  if(!data.speedGov) {
69  data.speedGov = new ControlElementContainer();
70  m_syncGenerator->SetElectricalData(data);
71  }
72  ControlEditor* cEditor = new ControlEditor(m_parent, IOControl::IN_VELOCITY | IOControl::OUT_MEC_POWER);
73  cEditor->SetElementsList(data.speedGov->GetControlElementsList());
74  cEditor->SetConnectionsList(data.speedGov->GetConnectionLineList());
75  cEditor->SetControlContainer(data.speedGov);
76  cEditor->Show();
77 }
78 
79 void GeneratorStabForm::OnSwitchingButtonClick(wxCommandEvent& event)
80 {
81  if(ValidateData()) {
82  SwitchingForm swForm(m_parent, m_syncGenerator);
83  swForm.SetTitle(_("Synchronous generator: Switching"));
84  swForm.ShowModal();
85  EndModal(wxID_OK);
86  }
87 }
88 
89 bool GeneratorStabForm::ValidateData()
90 {
91  SyncGeneratorElectricalData data = m_syncGenerator->GetElectricalData();
92 
93  data.plotSyncMachine = m_checkBoxPlotSyncMachine->GetValue();
94 
95  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlInertia->GetValue(), data.inertia,
96  _("Value entered incorrectly in the field \"Inertia\".")))
97  return false;
98 
99  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlDamping->GetValue(), data.damping,
100  _("Value entered incorrectly in the field \"Damping factor\".")))
101  return false;
102 
103  data.useAVR = m_checkBoxUseAVR->GetValue();
104  data.useSpeedGovernor = m_checkBoxUseSG->GetValue();
105 
106  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlRa->GetValue(), data.armResistance,
107  _("Value entered incorrectly in the field \"Armature resistance\".")))
108  return false;
109 
110  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlXp->GetValue(), data.potierReactance,
111  _("Value entered incorrectly in the field \"Potier reactance\".")))
112  return false;
113 
114  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlSat->GetValue(), data.satFactor,
115  _("Value entered incorrectly in the field \"Saturation factor\".")))
116  return false;
117 
118  if(!m_syncGenerator->DoubleFromString(
119  m_parent, m_textCtrlSyncXd->GetValue(), data.syncXd,
120  _("Value entered incorrectly in the field \"Synchronous direct-axis reactance\".")))
121  return false;
122 
123  if(!m_syncGenerator->DoubleFromString(
124  m_parent, m_textCtrlSyncXq->GetValue(), data.syncXq,
125  _("Value entered incorrectly in the field \"Synchronous quadrature-axis reactance\".")))
126  return false;
127 
128  if(!m_syncGenerator->DoubleFromString(
129  m_parent, m_textCtrlTranXd->GetValue(), data.transXd,
130  _("Value entered incorrectly in the field \"Transitory direct-axis reactance\".")))
131  return false;
132 
133  if(!m_syncGenerator->DoubleFromString(
134  m_parent, m_textCtrlTranXq->GetValue(), data.transXq,
135  _("Value entered incorrectly in the field \"Transitory quadrature-axis reactance\".")))
136  return false;
137 
138  if(!m_syncGenerator->DoubleFromString(
139  m_parent, m_textCtrlTranTd0->GetValue(), data.transTd0,
140  _("Value entered incorrectly in the field \"Transitory direct-axis time constant\".")))
141  return false;
142 
143  if(!m_syncGenerator->DoubleFromString(
144  m_parent, m_textCtrlTranTq0->GetValue(), data.transTq0,
145  _("Value entered incorrectly in the field \"Transitory quadrature-axis time constant\".")))
146  return false;
147 
148  if(!m_syncGenerator->DoubleFromString(
149  m_parent, m_textCtrlSubXd->GetValue(), data.subXd,
150  _("Value entered incorrectly in the field \"Subtransitory direct-axis reactance\".")))
151  return false;
152 
153  if(!m_syncGenerator->DoubleFromString(
154  m_parent, m_textCtrlSubXq->GetValue(), data.subXq,
155  _("Value entered incorrectly in the field \"Subtransitory quadrature-axis reactance\".")))
156  return false;
157 
158  if(!m_syncGenerator->DoubleFromString(
159  m_parent, m_textCtrlSubTd0->GetValue(), data.subTd0,
160  _("Value entered incorrectly in the field \"Subtransitory direct-axis time constant\".")))
161  return false;
162 
163  if(!m_syncGenerator->DoubleFromString(
164  m_parent, m_textCtrlSubTq0->GetValue(), data.subTq0,
165  _("Value entered incorrectly in the field \"Subtransitory quadrature-axis time constant\".")))
166  return false;
167 
168  m_syncGenerator->SetElectricalData(data);
169 
170  return true;
171 }
172 void GeneratorStabForm::UseAVRClick(wxCommandEvent& event) { m_buttonEditAVR->Enable(m_checkBoxUseAVR->GetValue()); }
173 void GeneratorStabForm::UseSGClick(wxCommandEvent& event) { m_buttonEditSG->Enable(m_checkBoxUseSG->GetValue()); }
- - - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "GeneratorStabForm.h"
19 #include "SwitchingForm.h"
20 #include "SyncGenerator.h"
21 #include "ControlEditor.h"
23 
24 GeneratorStabForm::GeneratorStabForm(wxWindow* parent, SyncGenerator* syncGenerator) : GeneratorStabFormBase(parent)
25 {
26  SetSize(GetBestSize());
27  m_syncGenerator = syncGenerator;
28  m_parent = parent;
29 
30  SyncGeneratorElectricalData data = syncGenerator->GetElectricalData();
31 
32  m_checkBoxPlotSyncMachine->SetValue(data.plotSyncMachine);
33 
34  m_textCtrlInertia->SetValue(SyncGenerator::StringFromDouble(data.inertia));
35  m_textCtrlDamping->SetValue(SyncGenerator::StringFromDouble(data.damping));
36 
37  m_checkBoxUseAVR->SetValue(data.useAVR);
38  m_buttonEditAVR->Enable(data.useAVR);
39 
40  m_checkBoxUseSG->SetValue(data.useSpeedGovernor);
41  m_buttonEditSG->Enable(data.useSpeedGovernor);
42 
43  m_textCtrlRa->SetValue(SyncGenerator::StringFromDouble(data.armResistance));
44  m_textCtrlXp->SetValue(SyncGenerator::StringFromDouble(data.potierReactance));
45  m_textCtrlSat->SetValue(SyncGenerator::StringFromDouble(data.satFactor));
46 
47  m_textCtrlSyncXd->SetValue(SyncGenerator::StringFromDouble(data.syncXd));
48  m_textCtrlSyncXq->SetValue(SyncGenerator::StringFromDouble(data.syncXq));
49 
50  m_textCtrlTranXd->SetValue(SyncGenerator::StringFromDouble(data.transXd));
51  m_textCtrlTranXq->SetValue(SyncGenerator::StringFromDouble(data.transXq));
52  m_textCtrlTranTd0->SetValue(SyncGenerator::StringFromDouble(data.transTd0));
53  m_textCtrlTranTq0->SetValue(SyncGenerator::StringFromDouble(data.transTq0));
54 
55  m_textCtrlSubXd->SetValue(SyncGenerator::StringFromDouble(data.subXd));
56  m_textCtrlSubXq->SetValue(SyncGenerator::StringFromDouble(data.subXq));
57  m_textCtrlSubTd0->SetValue(SyncGenerator::StringFromDouble(data.subTd0));
58  m_textCtrlSubTq0->SetValue(SyncGenerator::StringFromDouble(data.subTq0));
59 }
60 
61 GeneratorStabForm::~GeneratorStabForm() {}
62 void GeneratorStabForm::OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
63 void GeneratorStabForm::OnEditAVRButtonClick(wxCommandEvent& event)
64 {
65  SyncGeneratorElectricalData data = m_syncGenerator->GetElectricalData();
66  if(!data.avr) {
67  data.avr = new ControlElementContainer();
68  m_syncGenerator->SetElectricalData(data);
69  }
70  ControlEditor* cEditor = new ControlEditor(m_parent, IOControl::IN_TERMINAL_VOLTAGE | IOControl::OUT_FIELD_VOLTAGE);
71  cEditor->SetElementsList(data.avr->GetControlElementsList());
72  cEditor->SetConnectionsList(data.avr->GetConnectionLineList());
73  cEditor->SetControlContainer(data.avr);
74  cEditor->Show();
75 }
76 
77 void GeneratorStabForm::OnOKButtonClick(wxCommandEvent& event)
78 {
79  if(ValidateData()) EndModal(wxID_OK);
80 }
81 
82 void GeneratorStabForm::OnSpeedGovernorButtonClick(wxCommandEvent& event)
83 {
84  SyncGeneratorElectricalData data = m_syncGenerator->GetElectricalData();
85  if(!data.speedGov) {
86  data.speedGov = new ControlElementContainer();
87  m_syncGenerator->SetElectricalData(data);
88  }
89  ControlEditor* cEditor = new ControlEditor(m_parent, IOControl::IN_VELOCITY | IOControl::OUT_MEC_POWER);
90  cEditor->SetElementsList(data.speedGov->GetControlElementsList());
91  cEditor->SetConnectionsList(data.speedGov->GetConnectionLineList());
92  cEditor->SetControlContainer(data.speedGov);
93  cEditor->Show();
94 }
95 
96 void GeneratorStabForm::OnSwitchingButtonClick(wxCommandEvent& event)
97 {
98  if(ValidateData()) {
99  SwitchingForm swForm(m_parent, m_syncGenerator);
100  swForm.SetTitle(_("Synchronous generator: Switching"));
101  swForm.ShowModal();
102  EndModal(wxID_OK);
103  }
104 }
105 
106 bool GeneratorStabForm::ValidateData()
107 {
108  SyncGeneratorElectricalData data = m_syncGenerator->GetElectricalData();
109 
110  data.plotSyncMachine = m_checkBoxPlotSyncMachine->GetValue();
111 
112  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlInertia->GetValue(), data.inertia,
113  _("Value entered incorrectly in the field \"Inertia\".")))
114  return false;
115 
116  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlDamping->GetValue(), data.damping,
117  _("Value entered incorrectly in the field \"Damping factor\".")))
118  return false;
119 
120  data.useAVR = m_checkBoxUseAVR->GetValue();
121  data.useSpeedGovernor = m_checkBoxUseSG->GetValue();
122 
123  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlRa->GetValue(), data.armResistance,
124  _("Value entered incorrectly in the field \"Armature resistance\".")))
125  return false;
126 
127  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlXp->GetValue(), data.potierReactance,
128  _("Value entered incorrectly in the field \"Potier reactance\".")))
129  return false;
130 
131  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlSat->GetValue(), data.satFactor,
132  _("Value entered incorrectly in the field \"Saturation factor\".")))
133  return false;
134 
135  if(!m_syncGenerator->DoubleFromString(
136  m_parent, m_textCtrlSyncXd->GetValue(), data.syncXd,
137  _("Value entered incorrectly in the field \"Synchronous direct-axis reactance\".")))
138  return false;
139 
140  if(!m_syncGenerator->DoubleFromString(
141  m_parent, m_textCtrlSyncXq->GetValue(), data.syncXq,
142  _("Value entered incorrectly in the field \"Synchronous quadrature-axis reactance\".")))
143  return false;
144 
145  if(!m_syncGenerator->DoubleFromString(
146  m_parent, m_textCtrlTranXd->GetValue(), data.transXd,
147  _("Value entered incorrectly in the field \"Transitory direct-axis reactance\".")))
148  return false;
149 
150  if(!m_syncGenerator->DoubleFromString(
151  m_parent, m_textCtrlTranXq->GetValue(), data.transXq,
152  _("Value entered incorrectly in the field \"Transitory quadrature-axis reactance\".")))
153  return false;
154 
155  if(!m_syncGenerator->DoubleFromString(
156  m_parent, m_textCtrlTranTd0->GetValue(), data.transTd0,
157  _("Value entered incorrectly in the field \"Transitory direct-axis time constant\".")))
158  return false;
159 
160  if(!m_syncGenerator->DoubleFromString(
161  m_parent, m_textCtrlTranTq0->GetValue(), data.transTq0,
162  _("Value entered incorrectly in the field \"Transitory quadrature-axis time constant\".")))
163  return false;
164 
165  if(!m_syncGenerator->DoubleFromString(
166  m_parent, m_textCtrlSubXd->GetValue(), data.subXd,
167  _("Value entered incorrectly in the field \"Subtransitory direct-axis reactance\".")))
168  return false;
169 
170  if(!m_syncGenerator->DoubleFromString(
171  m_parent, m_textCtrlSubXq->GetValue(), data.subXq,
172  _("Value entered incorrectly in the field \"Subtransitory quadrature-axis reactance\".")))
173  return false;
174 
175  if(!m_syncGenerator->DoubleFromString(
176  m_parent, m_textCtrlSubTd0->GetValue(), data.subTd0,
177  _("Value entered incorrectly in the field \"Subtransitory direct-axis time constant\".")))
178  return false;
179 
180  if(!m_syncGenerator->DoubleFromString(
181  m_parent, m_textCtrlSubTq0->GetValue(), data.subTq0,
182  _("Value entered incorrectly in the field \"Subtransitory quadrature-axis time constant\".")))
183  return false;
184 
185  m_syncGenerator->SetElectricalData(data);
186 
187  return true;
188 }
189 void GeneratorStabForm::UseAVRClick(wxCommandEvent& event) { m_buttonEditAVR->Enable(m_checkBoxUseAVR->GetValue()); }
190 void GeneratorStabForm::UseSGClick(wxCommandEvent& event) { m_buttonEditSG->Enable(m_checkBoxUseSG->GetValue()); }
+
Form to edit the switching data of power elements for electromechanical transient studies...
Definition: SwitchingForm.h:32
+ + + + +
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
+ - -
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:300
+ +
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:320
diff --git a/docs/doxygen/html/_generator_stab_form_8h.html b/docs/doxygen/html/_generator_stab_form_8h.html new file mode 100644 index 0000000..780c73c --- /dev/null +++ b/docs/doxygen/html/_generator_stab_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/GeneratorStabForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
GeneratorStabForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  GeneratorStabForm
 Form to edit the synchronous generator data for electromechanical studies. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_generator_stab_form_8h_source.html b/docs/doxygen/html/_generator_stab_form_8h_source.html index bdea5a8..3469265 100644 --- a/docs/doxygen/html/_generator_stab_form_8h_source.html +++ b/docs/doxygen/html/_generator_stab_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,18 +88,18 @@ $(document).ready(function(){initNavTree('_generator_stab_form_8h_source.html','
GeneratorStabForm.h
-
1 #ifndef GENERATORSTABFORM_H
2 #define GENERATORSTABFORM_H
3 
4 #include "ElementForm.h"
5 
6 class SwitchingForm;
7 class SyncGenerator;
8 class ControlEditor;
10 
12 {
13  public:
14  GeneratorStabForm(wxWindow* parent, SyncGenerator* syncGenerator);
15  virtual ~GeneratorStabForm();
16 
17  protected:
18  virtual void UseAVRClick(wxCommandEvent& event);
19  virtual void UseSGClick(wxCommandEvent& event);
20  virtual void OnCancelButtonClick(wxCommandEvent& event);
21  virtual void OnEditAVRButtonClick(wxCommandEvent& event);
22  virtual void OnOKButtonClick(wxCommandEvent& event);
23  virtual void OnSpeedGovernorButtonClick(wxCommandEvent& event);
24  virtual void OnSwitchingButtonClick(wxCommandEvent& event);
25 
26  virtual bool ValidateData();
27 
28  SyncGenerator* m_syncGenerator = NULL;
29  wxWindow* m_parent = NULL;
30 };
31 #endif // GENERATORSTABFORM_H
- - - +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef GENERATORSTABFORM_H
19 #define GENERATORSTABFORM_H
20 
21 #include "ElementForm.h"
22 
23 class SwitchingForm;
24 class SyncGenerator;
25 class ControlEditor;
27 
36 {
37  public:
38  GeneratorStabForm(wxWindow* parent, SyncGenerator* syncGenerator);
39  virtual ~GeneratorStabForm();
40 
41  protected:
42  virtual void UseAVRClick(wxCommandEvent& event);
43  virtual void UseSGClick(wxCommandEvent& event);
44  virtual void OnCancelButtonClick(wxCommandEvent& event);
45  virtual void OnEditAVRButtonClick(wxCommandEvent& event);
46  virtual void OnOKButtonClick(wxCommandEvent& event);
47  virtual void OnSpeedGovernorButtonClick(wxCommandEvent& event);
48  virtual void OnSwitchingButtonClick(wxCommandEvent& event);
49 
50  virtual bool ValidateData();
51 
52  SyncGenerator* m_syncGenerator = NULL;
53  wxWindow* m_parent = NULL;
54 };
55 #endif // GENERATORSTABFORM_H
Form to edit the switching data of power elements for electromechanical transient studies...
Definition: SwitchingForm.h:32
+ +
Form to edit the synchronous generator data for electromechanical studies.
+
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
- +
-
1 #include "GraphicalElement.h"
2 
3 GraphicalElement::GraphicalElement() : Element()
4 {
5 }
6 
7 GraphicalElement::~GraphicalElement()
8 {
9 }
10 
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "GraphicalElement.h"
19 
20 GraphicalElement::GraphicalElement() : Element()
21 {
22 }
23 
24 GraphicalElement::~GraphicalElement()
25 {
26 }
27 
diff --git a/docs/doxygen/html/_graphical_element_8h_source.html b/docs/doxygen/html/_graphical_element_8h_source.html index a6fb132..3331a7f 100644 --- a/docs/doxygen/html/_graphical_element_8h_source.html +++ b/docs/doxygen/html/_graphical_element_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,8 +88,8 @@ $(document).ready(function(){initNavTree('_graphical_element_8h_source.html','')
GraphicalElement.h
-
1 #ifndef GRAPHICALELEMENT_H
2 #define GRAPHICALELEMENT_H
3 
4 #include "Element.h"
5 
6 class GraphicalElement : public Element
7 {
8 public:
11 
12 };
13 
14 #endif // GRAPHICALELEMENT_H
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef GRAPHICALELEMENT_H
19 #define GRAPHICALELEMENT_H
20 
21 #include "Element.h"
22 
23 class GraphicalElement : public Element
24 {
25  public:
28 };
29 
30 #endif // GRAPHICALELEMENT_H
+
Class to manage color of OpenGL.
diff --git a/docs/doxygen/html/_i_o_control_8cpp_source.html b/docs/doxygen/html/_i_o_control_8cpp_source.html index b0d035a..8e9be8b 100644 --- a/docs/doxygen/html/_i_o_control_8cpp_source.html +++ b/docs/doxygen/html/_i_o_control_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,19 +88,21 @@ $(document).ready(function(){initNavTree('_i_o_control_8cpp_source.html','');});
IOControl.cpp
-
1 #include "IOControl.h"
2 #include "IOControlForm.h"
3 
4 IOControl::IOControl(int ioFlags, int id) : ControlElement(id)
5 {
6  m_ioFlags = ioFlags;
7 
8  Node* node = new Node(m_position, Node::NODE_IN, m_borderSize);
9  m_nodeList.push_back(node);
10 
11  if(ioFlags & IN_TERMINAL_VOLTAGE)
12  SetValue(IN_TERMINAL_VOLTAGE);
13  else if(ioFlags & IN_VELOCITY)
14  SetValue(IN_VELOCITY);
15  node->StartMove(m_position);
16 }
17 
18 IOControl::~IOControl() {}
19 void IOControl::Draw(wxPoint2DDouble translation, double scale) const
20 {
21  std::vector<wxPoint2DDouble> pts;
22  if(m_angle == 0.0) {
23  pts.push_back(m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize, m_borderSize));
24  pts.push_back(m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize - 10, m_borderSize));
25  pts.push_back(m_position + wxPoint2DDouble(m_width / 2 - m_borderSize, 0));
26  pts.push_back(m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize - 10, -m_borderSize));
27  pts.push_back(m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize, -m_borderSize));
28  } else if(m_angle == 90.0) {
29  pts.push_back(m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize, m_borderSize));
30  pts.push_back(m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize, m_borderSize));
31  pts.push_back(m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize, -m_borderSize - 10));
32  pts.push_back(m_position + wxPoint2DDouble(0, m_height / 2 - m_borderSize));
33  pts.push_back(m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize, -m_borderSize - 10));
34  } else if(m_angle == 180.0) {
35  pts.push_back(m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize + 10, m_borderSize));
36  pts.push_back(m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize, m_borderSize));
37  pts.push_back(m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize, -m_borderSize));
38  pts.push_back(m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize + 10, -m_borderSize));
39  pts.push_back(m_position + wxPoint2DDouble(-m_width / 2 + m_borderSize, 0));
40  } else if(m_angle == 270.0) {
41  pts.push_back(m_position + wxPoint2DDouble(0, -m_height / 2 + m_borderSize));
42  pts.push_back(m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize, m_borderSize + 10));
43  pts.push_back(m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize, -m_borderSize));
44  pts.push_back(m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize, -m_borderSize));
45  pts.push_back(m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize, m_borderSize + 10));
46  }
47 
48  if(m_selected) {
49  glColor4dv(m_selectionColour.GetRGBA());
50  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
51  std::vector<wxPoint2DDouble> selPts = pts;
52  if(m_angle == 0.0) {
53  selPts[0] += wxPoint2DDouble(-borderSize / 2, -borderSize / 2);
54  selPts[1] += wxPoint2DDouble(borderSize / 2, -borderSize / 2);
55  selPts[2] += wxPoint2DDouble(1.5 * borderSize / 2, 0);
56  selPts[3] += wxPoint2DDouble(borderSize / 2, borderSize / 2);
57  selPts[4] += wxPoint2DDouble(-borderSize / 2, borderSize / 2);
58  } else if(m_angle == 90.0) {
59  selPts[0] += wxPoint2DDouble(-borderSize / 2, -borderSize / 2);
60  selPts[1] += wxPoint2DDouble(borderSize / 2, -borderSize / 2);
61  selPts[2] += wxPoint2DDouble(borderSize / 2, borderSize / 2);
62  selPts[3] += wxPoint2DDouble(0, 1.5 * borderSize / 2);
63  selPts[4] += wxPoint2DDouble(-borderSize / 2, borderSize / 2);
64  } else if(m_angle == 180.0) {
65  selPts[0] += wxPoint2DDouble(-borderSize / 2, -borderSize / 2);
66  selPts[1] += wxPoint2DDouble(borderSize / 2, -borderSize / 2);
67  selPts[2] += wxPoint2DDouble(borderSize / 2, borderSize / 2);
68  selPts[3] += wxPoint2DDouble(-borderSize / 2, borderSize / 2);
69  selPts[4] += wxPoint2DDouble(-1.5 * borderSize / 2, 0);
70  } else if(m_angle == 270.0) {
71  selPts[0] += wxPoint2DDouble(0, -1.5 * borderSize / 2);
72  selPts[1] += wxPoint2DDouble(borderSize / 2, -borderSize / 2);
73  selPts[2] += wxPoint2DDouble(borderSize / 2, borderSize / 2);
74  selPts[3] += wxPoint2DDouble(-borderSize / 2, borderSize / 2);
75  selPts[4] += wxPoint2DDouble(-borderSize / 2, -borderSize / 2);
76  }
77  DrawLine(selPts, GL_POLYGON);
78  }
79  glLineWidth(1.0);
80  glColor4d(1.0, 1.0, 1.0, 1.0);
81  DrawLine(pts, GL_POLYGON);
82  glColor4d(0.0, 0.0, 0.0, 1.0);
83  DrawLine(pts, GL_LINE_LOOP);
84 
85  // Plot number.
86  glEnable(GL_TEXTURE_2D);
87  glColor4d(0.0, 0.0, 0.0, 1.0);
88  m_glStringValue->bind();
89  if(m_angle == 0.0) {
90  m_glStringValue->render(m_position.m_x - 5, m_position.m_y);
91  } else if(m_angle == 90.0) {
92  m_glStringValue->render(m_position.m_x, m_position.m_y - 5);
93  } else if(m_angle == 180.0) {
94  m_glStringValue->render(m_position.m_x + 5, m_position.m_y);
95  } else if(m_angle == 270.0) {
96  m_glStringValue->render(m_position.m_x, m_position.m_y + 5);
97  }
98 
99  glDisable(GL_TEXTURE_2D);
100 
101  glColor4d(0.0, 0.0, 0.0, 1.0);
102  DrawNodes();
103 }
104 
105 bool IOControl::ShowForm(wxWindow* parent, Element* element)
106 {
107  IOControlForm* form = new IOControlForm(parent, this);
108  if(form->ShowModal() == wxID_OK) {
109  form->Destroy();
110  return true;
111  }
112  form->Destroy();
113  return false;
114 }
115 
116 void IOControl::Rotate(bool clockwise)
117 {
118  if(clockwise)
119  m_angle += 90.0;
120  else
121  m_angle -= 90.0;
122  if(m_angle >= 360.0)
123  m_angle = 0.0;
124  else if(m_angle < 0)
125  m_angle = 270.0;
126 
127  UpdatePoints();
128 
129  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
130  Node* node = *it;
131  node->Rotate(clockwise);
132  }
133 }
134 
135 wxString IOControl::GenerateText()
136 {
137  wxString omega = wxString::FromUTF8("\xCF\x89");
138 
139  switch(m_value) {
140  case IN_TERMINAL_VOLTAGE: {
141  m_ioNodeType = Node::NODE_OUT;
142  return _("Vt");
143  } break;
144  case IN_VELOCITY: {
145  m_ioNodeType = Node::NODE_OUT;
146  return omega;
147  } break;
148  case IN_ACTIVE_POWER: {
149  m_ioNodeType = Node::NODE_OUT;
150  return _("Pe");
151  } break;
152  case IN_REACTIVE_POWER: {
153  m_ioNodeType = Node::NODE_OUT;
154  return _("Qe");
155  } break;
156  case OUT_FIELD_VOLTAGE: {
157  m_ioNodeType = Node::NODE_IN;
158  return _("Vf");
159  } break;
160  case OUT_MEC_POWER: {
161  m_ioNodeType = Node::NODE_IN;
162  return _("Pm");
163  } break;
164  }
165  return "";
166 }
167 
168 void IOControl::SetValue(IOFlags value)
169 {
170  m_value = value;
171  wxString text = GenerateText();
172 
173  wxFont font(m_fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
174  wxScreenDC dc;
175 
176  if(m_glStringValue) {
177  delete m_glStringValue;
178  m_glStringValue = NULL;
179  }
180  m_glStringValue = new wxGLString(text);
181  m_glStringValue->setFont(font);
182  m_glStringValue->consolidate(&dc);
183 
184  m_width = m_glStringValue->getWidth() + 10 + 2 * m_borderSize;
185  m_height = m_glStringValue->getheight() + 10 + 2 * m_borderSize;
186 
187  SetPosition(m_position); // Update rectangle.
188 
189  UpdatePoints();
190 }
191 
192 void IOControl::UpdatePoints()
193 {
194  if(m_nodeList.size() != 0) {
195  Node* node = m_nodeList[0];
196  if(node->GetNodeType() != m_ioNodeType) {
197  // Rotate 180 degrees
198  node->Rotate();
199  node->Rotate();
200  }
201  node->SetNodeType(m_ioNodeType);
202  if(m_angle == 0.0) {
203  if(m_ioNodeType == Node::NODE_IN)
204  node->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
205  else
206  node->SetPosition(m_position + wxPoint2DDouble(m_width / 2 - 2, 0));
207  } else if(m_angle == 90.0) {
208  if(m_ioNodeType == Node::NODE_IN)
209  node->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
210  else
211  node->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2 - 2));
212  } else if(m_angle == 180.0) {
213  if(m_ioNodeType == Node::NODE_IN)
214  node->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
215  else
216  node->SetPosition(m_position + wxPoint2DDouble(2 - m_width / 2, 0));
217  } else if(m_angle == 270.0) {
218  if(m_ioNodeType == Node::NODE_IN)
219  node->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
220  else
221  node->SetPosition(m_position + wxPoint2DDouble(0, 2 - m_height / 2));
222  }
223  }
224 }
225 
227 {
228  IOControl* copy = new IOControl(m_ioFlags, m_elementID);
229  *copy = *this;
230  m_glStringValue = NULL;
231  SetValue(m_value);
232  return copy;
233 }
-
virtual void DrawLine(std::vector< wxPoint2DDouble > points, GLenum mode=GL_LINE_STRIP) const
Draw line.
Definition: Element.cpp:73
- -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: IOControl.cpp:116
- -
virtual Element * GetCopy()
Get a the element copy.
Definition: IOControl.cpp:226
-
void SetPosition(const wxPoint2DDouble position)
Set the element position and update the rectangle.
Definition: Element.cpp:10
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: IOControl.cpp:105
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: IOControl.cpp:19
- - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "IOControl.h"
19 #include "IOControlForm.h"
20 
21 IOControl::IOControl(int ioFlags, int id) : ControlElement(id)
22 {
23  m_ioFlags = ioFlags;
24 
25  Node* node = new Node(m_position, Node::NODE_IN, m_borderSize);
26  m_nodeList.push_back(node);
27 
28  if(ioFlags & IN_TERMINAL_VOLTAGE)
29  SetValue(IN_TERMINAL_VOLTAGE);
30  else if(ioFlags & IN_VELOCITY)
31  SetValue(IN_VELOCITY);
32  node->StartMove(m_position);
33 }
34 
35 IOControl::~IOControl() {}
36 void IOControl::Draw(wxPoint2DDouble translation, double scale) const
37 {
38  std::vector<wxPoint2DDouble> pts;
39  if(m_angle == 0.0) {
40  pts.push_back(m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize, m_borderSize));
41  pts.push_back(m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize - 10, m_borderSize));
42  pts.push_back(m_position + wxPoint2DDouble(m_width / 2 - m_borderSize, 0));
43  pts.push_back(m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize - 10, -m_borderSize));
44  pts.push_back(m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize, -m_borderSize));
45  } else if(m_angle == 90.0) {
46  pts.push_back(m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize, m_borderSize));
47  pts.push_back(m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize, m_borderSize));
48  pts.push_back(m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize, -m_borderSize - 10));
49  pts.push_back(m_position + wxPoint2DDouble(0, m_height / 2 - m_borderSize));
50  pts.push_back(m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize, -m_borderSize - 10));
51  } else if(m_angle == 180.0) {
52  pts.push_back(m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize + 10, m_borderSize));
53  pts.push_back(m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize, m_borderSize));
54  pts.push_back(m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize, -m_borderSize));
55  pts.push_back(m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize + 10, -m_borderSize));
56  pts.push_back(m_position + wxPoint2DDouble(-m_width / 2 + m_borderSize, 0));
57  } else if(m_angle == 270.0) {
58  pts.push_back(m_position + wxPoint2DDouble(0, -m_height / 2 + m_borderSize));
59  pts.push_back(m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize, m_borderSize + 10));
60  pts.push_back(m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize, -m_borderSize));
61  pts.push_back(m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize, -m_borderSize));
62  pts.push_back(m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize, m_borderSize + 10));
63  }
64 
65  if(m_selected) {
66  glColor4dv(m_selectionColour.GetRGBA());
67  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
68  std::vector<wxPoint2DDouble> selPts = pts;
69  if(m_angle == 0.0) {
70  selPts[0] += wxPoint2DDouble(-borderSize / 2, -borderSize / 2);
71  selPts[1] += wxPoint2DDouble(borderSize / 2, -borderSize / 2);
72  selPts[2] += wxPoint2DDouble(1.5 * borderSize / 2, 0);
73  selPts[3] += wxPoint2DDouble(borderSize / 2, borderSize / 2);
74  selPts[4] += wxPoint2DDouble(-borderSize / 2, borderSize / 2);
75  } else if(m_angle == 90.0) {
76  selPts[0] += wxPoint2DDouble(-borderSize / 2, -borderSize / 2);
77  selPts[1] += wxPoint2DDouble(borderSize / 2, -borderSize / 2);
78  selPts[2] += wxPoint2DDouble(borderSize / 2, borderSize / 2);
79  selPts[3] += wxPoint2DDouble(0, 1.5 * borderSize / 2);
80  selPts[4] += wxPoint2DDouble(-borderSize / 2, borderSize / 2);
81  } else if(m_angle == 180.0) {
82  selPts[0] += wxPoint2DDouble(-borderSize / 2, -borderSize / 2);
83  selPts[1] += wxPoint2DDouble(borderSize / 2, -borderSize / 2);
84  selPts[2] += wxPoint2DDouble(borderSize / 2, borderSize / 2);
85  selPts[3] += wxPoint2DDouble(-borderSize / 2, borderSize / 2);
86  selPts[4] += wxPoint2DDouble(-1.5 * borderSize / 2, 0);
87  } else if(m_angle == 270.0) {
88  selPts[0] += wxPoint2DDouble(0, -1.5 * borderSize / 2);
89  selPts[1] += wxPoint2DDouble(borderSize / 2, -borderSize / 2);
90  selPts[2] += wxPoint2DDouble(borderSize / 2, borderSize / 2);
91  selPts[3] += wxPoint2DDouble(-borderSize / 2, borderSize / 2);
92  selPts[4] += wxPoint2DDouble(-borderSize / 2, -borderSize / 2);
93  }
94  DrawLine(selPts, GL_POLYGON);
95  }
96  glLineWidth(1.0);
97  glColor4d(1.0, 1.0, 1.0, 1.0);
98  DrawLine(pts, GL_POLYGON);
99  glColor4d(0.0, 0.0, 0.0, 1.0);
100  DrawLine(pts, GL_LINE_LOOP);
101 
102  // Plot number.
103  glEnable(GL_TEXTURE_2D);
104  glColor4d(0.0, 0.0, 0.0, 1.0);
105  m_glStringValue->bind();
106  if(m_angle == 0.0) {
107  m_glStringValue->render(m_position.m_x - 5, m_position.m_y);
108  } else if(m_angle == 90.0) {
109  m_glStringValue->render(m_position.m_x, m_position.m_y - 5);
110  } else if(m_angle == 180.0) {
111  m_glStringValue->render(m_position.m_x + 5, m_position.m_y);
112  } else if(m_angle == 270.0) {
113  m_glStringValue->render(m_position.m_x, m_position.m_y + 5);
114  }
115 
116  glDisable(GL_TEXTURE_2D);
117 
118  glColor4d(0.0, 0.0, 0.0, 1.0);
119  DrawNodes();
120 }
121 
122 bool IOControl::ShowForm(wxWindow* parent, Element* element)
123 {
124  IOControlForm* form = new IOControlForm(parent, this);
125  if(form->ShowModal() == wxID_OK) {
126  form->Destroy();
127  return true;
128  }
129  form->Destroy();
130  return false;
131 }
132 
133 void IOControl::Rotate(bool clockwise)
134 {
135  if(clockwise)
136  m_angle += 90.0;
137  else
138  m_angle -= 90.0;
139  if(m_angle >= 360.0)
140  m_angle = 0.0;
141  else if(m_angle < 0)
142  m_angle = 270.0;
143 
144  UpdatePoints();
145 
146  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
147  Node* node = *it;
148  node->Rotate(clockwise);
149  }
150 }
151 
152 wxString IOControl::GenerateText()
153 {
154  wxString omega = wxString::FromUTF8("\xCF\x89");
155 
156  switch(m_value) {
157  case IN_TERMINAL_VOLTAGE: {
158  m_ioNodeType = Node::NODE_OUT;
159  return _("Vt");
160  } break;
161  case IN_VELOCITY: {
162  m_ioNodeType = Node::NODE_OUT;
163  return omega;
164  } break;
165  case IN_ACTIVE_POWER: {
166  m_ioNodeType = Node::NODE_OUT;
167  return _("Pe");
168  } break;
169  case IN_REACTIVE_POWER: {
170  m_ioNodeType = Node::NODE_OUT;
171  return _("Qe");
172  } break;
173  case OUT_FIELD_VOLTAGE: {
174  m_ioNodeType = Node::NODE_IN;
175  return _("Vf");
176  } break;
177  case OUT_MEC_POWER: {
178  m_ioNodeType = Node::NODE_IN;
179  return _("Pm");
180  } break;
181  }
182  return "";
183 }
184 
185 void IOControl::SetValue(IOFlags value)
186 {
187  m_value = value;
188  wxString text = GenerateText();
189 
190  wxFont font(m_fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
191  wxScreenDC dc;
192 
193  if(m_glStringValue) {
194  delete m_glStringValue;
195  m_glStringValue = NULL;
196  }
197  m_glStringValue = new wxGLString(text);
198  m_glStringValue->setFont(font);
199  m_glStringValue->consolidate(&dc);
200 
201  m_width = m_glStringValue->getWidth() + 10 + 2 * m_borderSize;
202  m_height = m_glStringValue->getheight() + 10 + 2 * m_borderSize;
203 
204  SetPosition(m_position); // Update rectangle.
205 
206  UpdatePoints();
207 }
208 
209 void IOControl::UpdatePoints()
210 {
211  if(m_nodeList.size() != 0) {
212  Node* node = m_nodeList[0];
213  if(node->GetNodeType() != m_ioNodeType) {
214  // Rotate 180 degrees
215  node->Rotate();
216  node->Rotate();
217  }
218  node->SetNodeType(m_ioNodeType);
219  if(m_angle == 0.0) {
220  if(m_ioNodeType == Node::NODE_IN)
221  node->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
222  else
223  node->SetPosition(m_position + wxPoint2DDouble(m_width / 2 - 2, 0));
224  } else if(m_angle == 90.0) {
225  if(m_ioNodeType == Node::NODE_IN)
226  node->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
227  else
228  node->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2 - 2));
229  } else if(m_angle == 180.0) {
230  if(m_ioNodeType == Node::NODE_IN)
231  node->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
232  else
233  node->SetPosition(m_position + wxPoint2DDouble(2 - m_width / 2, 0));
234  } else if(m_angle == 270.0) {
235  if(m_ioNodeType == Node::NODE_IN)
236  node->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
237  else
238  node->SetPosition(m_position + wxPoint2DDouble(0, 2 - m_height / 2));
239  }
240  }
241 }
242 
244 {
245  IOControl* copy = new IOControl(m_ioFlags, m_elementID);
246  *copy = *this;
247  m_glStringValue = NULL;
248  SetValue(m_value);
249  return copy;
250 }
+
virtual void DrawLine(std::vector< wxPoint2DDouble > points, GLenum mode=GL_LINE_STRIP) const
Draw line.
Definition: Element.cpp:89
+
Node of a control element. This class manages the user interaction with the connection and control el...
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: IOControl.cpp:133
+
Provides the communication with the power element.
Definition: IOControl.h:35
+ +
virtual Element * GetCopy()
Get a the element copy.
Definition: IOControl.cpp:243
+
void SetPosition(const wxPoint2DDouble position)
Set the element position and update the rectangle.
Definition: Element.cpp:25
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: IOControl.cpp:122
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: IOControl.cpp:36
+ +
Form to edit the input/output control data.
Definition: IOControlForm.h:31
+ -
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:83
+
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:101
diff --git a/docs/doxygen/html/_i_o_control_8h.html b/docs/doxygen/html/_i_o_control_8h.html new file mode 100644 index 0000000..e4a200a --- /dev/null +++ b/docs/doxygen/html/_i_o_control_8h.html @@ -0,0 +1,117 @@ + + + + + + + + + +Project/IOControl.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
IOControl.h File Reference
+
+
+
#include "ControlElement.h"
+#include <wx/dcscreen.h>
+#include "wxGLString.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  IOControl
 Provides the communication with the power element. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_i_o_control_8h_source.html b/docs/doxygen/html/_i_o_control_8h_source.html index ab97414..ae24203 100644 --- a/docs/doxygen/html/_i_o_control_8h_source.html +++ b/docs/doxygen/html/_i_o_control_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,23 +88,24 @@ $(document).ready(function(){initNavTree('_i_o_control_8h_source.html','');});
IOControl.h
-
1 #ifndef IOCONTROL_H
2 #define IOCONTROL_H
3 
4 #include "ControlElement.h"
5 
6 #include <wx/dcscreen.h>
7 #include "wxGLString.h"
8 
9 class IOControlForm;
10 
11 class IOControl : public ControlElement
12 {
13  public:
14  enum IOFlags {
15  IN_TERMINAL_VOLTAGE = 1 << 0,
16  IN_VELOCITY = 1 << 1,
17  IN_ACTIVE_POWER = 1 << 2,
18  IN_REACTIVE_POWER = 1 << 3,
19  OUT_FIELD_VOLTAGE = 1 << 4,
20  OUT_MEC_POWER = 1 << 5
21  };
22 
23  IOControl(int ioFlags, int id);
24  ~IOControl();
25 
26  virtual void Draw(wxPoint2DDouble translation, double scale) const;
27  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
28  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
29  virtual bool ShowForm(wxWindow* parent, Element* element);
30  virtual void Rotate(bool clockwise = true);
31  virtual void UpdateText() { SetValue(m_value); }
32  virtual wxString GenerateText();
33  virtual void UpdatePoints();
34 
35  virtual IOFlags GetValue() const { return m_value; }
36  virtual void SetValue(IOFlags value);
37  virtual int GetIOFlags() const { return m_ioFlags; }
38  virtual Node::NodeType GetType() { return m_ioNodeType; }
39 
40  virtual Element* GetCopy();
41  protected:
42  IOFlags m_value;
43  int m_ioFlags;
44 
45  Node::NodeType m_ioNodeType = Node::NODE_IN;
46 
47  wxGLString* m_glStringValue = NULL;
48  int m_fontSize = 10;
49 };
50 
51 #endif // IOCONTROL_H
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: IOControl.h:27
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: IOControl.cpp:116
- -
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: IOControl.h:28
-
virtual Element * GetCopy()
Get a the element copy.
Definition: IOControl.cpp:226
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: IOControl.cpp:105
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: IOControl.cpp:19
- - +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef IOCONTROL_H
19 #define IOCONTROL_H
20 
21 #include "ControlElement.h"
22 
23 #include <wx/dcscreen.h>
24 #include "wxGLString.h"
25 
26 class IOControlForm;
27 
35 class IOControl : public ControlElement
36 {
37  public:
38  enum IOFlags {
39  IN_TERMINAL_VOLTAGE = 1 << 0,
40  IN_VELOCITY = 1 << 1,
41  IN_ACTIVE_POWER = 1 << 2,
42  IN_REACTIVE_POWER = 1 << 3,
43  OUT_FIELD_VOLTAGE = 1 << 4,
44  OUT_MEC_POWER = 1 << 5
45  };
46 
47  IOControl(int ioFlags, int id);
48  ~IOControl();
49 
50  virtual void Draw(wxPoint2DDouble translation, double scale) const;
51  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
52  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
53  virtual bool ShowForm(wxWindow* parent, Element* element);
54  virtual void Rotate(bool clockwise = true);
55  virtual void UpdateText() { SetValue(m_value); }
56  virtual wxString GenerateText();
57  virtual void UpdatePoints();
58 
59  virtual IOFlags GetValue() const { return m_value; }
60  virtual void SetValue(IOFlags value);
61  virtual int GetIOFlags() const { return m_ioFlags; }
62  virtual Node::NodeType GetType() { return m_ioNodeType; }
63  virtual Element* GetCopy();
64 
65  protected:
66  IOFlags m_value;
67  int m_ioFlags;
68 
69  Node::NodeType m_ioNodeType = Node::NODE_IN;
70 
71  wxGLString* m_glStringValue = NULL;
72  int m_fontSize = 10;
73 };
74 
75 #endif // IOCONTROL_H
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: IOControl.h:51
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: IOControl.cpp:133
+
Provides the communication with the power element.
Definition: IOControl.h:35
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: IOControl.h:52
+
virtual Element * GetCopy()
Get a the element copy.
Definition: IOControl.cpp:243
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: IOControl.cpp:122
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: IOControl.cpp:36
+
Base class of a control element. Provide general methods to other control classes.
+
Form to edit the input/output control data.
Definition: IOControlForm.h:31
+
-
1 #include "IOControlForm.h"
2 
3 IOControlForm::IOControlForm(wxWindow* parent, IOControl* ioControl) : IOControlFormBase(parent)
4 {
5  SetSize(GetBestSize());
6 
7  m_parent = parent;
8  m_ioControl = ioControl;
9 
10  int ioFlags = m_ioControl->GetIOFlags();
11  int inChoiceNumber = -1;
12  int outChoiceNumber = -1;
13 
14  if(ioFlags & IOControl::IN_TERMINAL_VOLTAGE) {
15  m_choiceInput->Append(_("Terminal voltage"));
16  m_inputFlags.push_back(IOControl::IN_TERMINAL_VOLTAGE);
17  if(m_ioControl->GetValue() == IOControl::IN_TERMINAL_VOLTAGE) inChoiceNumber = (int)m_inputFlags.size() - 1;
18  }
19  if(ioFlags & IOControl::IN_VELOCITY) {
20  m_choiceInput->Append(_("Velocity"));
21  m_inputFlags.push_back(IOControl::IN_VELOCITY);
22  if(m_ioControl->GetValue() == IOControl::IN_VELOCITY) inChoiceNumber = (int)m_inputFlags.size() - 1;
23  }
24  if(ioFlags & IOControl::IN_ACTIVE_POWER) {
25  m_choiceInput->Append(_("Active power"));
26  m_inputFlags.push_back(IOControl::IN_ACTIVE_POWER);
27  if(m_ioControl->GetValue() == IOControl::IN_ACTIVE_POWER) inChoiceNumber = (int)m_inputFlags.size() - 1;
28  }
29  if(ioFlags & IOControl::IN_REACTIVE_POWER) {
30  m_choiceInput->Append(_("Reactive power"));
31  m_inputFlags.push_back(IOControl::IN_REACTIVE_POWER);
32  if(m_ioControl->GetValue() == IOControl::IN_REACTIVE_POWER) inChoiceNumber = (int)m_inputFlags.size() - 1;
33  }
34  if(ioFlags & IOControl::OUT_FIELD_VOLTAGE) {
35  m_choiceOutput->Append(_("Field voltage"));
36  m_outputFlags.push_back(IOControl::OUT_FIELD_VOLTAGE);
37  if(m_ioControl->GetValue() == IOControl::OUT_FIELD_VOLTAGE) outChoiceNumber = (int)m_outputFlags.size() - 1;
38  }
39  if(ioFlags & IOControl::OUT_MEC_POWER) {
40  m_choiceOutput->Append(_("Mechanical power"));
41  m_outputFlags.push_back(IOControl::OUT_MEC_POWER);
42  if(m_ioControl->GetValue() == IOControl::OUT_MEC_POWER) outChoiceNumber = (int)m_outputFlags.size() - 1;
43  }
44 
45  if(inChoiceNumber != -1) {
46  m_choiceInput->SetSelection(inChoiceNumber);
47  m_checkBoxInput->SetValue(true);
48  m_checkBoxOutput->SetValue(false);
49  m_choiceOutput->Enable(false);
50  } else {
51  m_choiceOutput->SetSelection(outChoiceNumber);
52  m_checkBoxInput->SetValue(false);
53  m_checkBoxOutput->SetValue(true);
54  m_choiceInput->Enable(false);
55  }
56 }
57 
58 IOControlForm::~IOControlForm() {}
59 void IOControlForm::OnOKButtonClick(wxCommandEvent& event)
60 {
61  if(ValidateData()) EndModal(wxID_OK);
62 }
63 
64 bool IOControlForm::ValidateData()
65 {
66  if(m_checkBoxInput->GetValue() && m_choiceInput->GetSelection() != -1) {
67  m_ioControl->SetValue(m_inputFlags[m_choiceInput->GetSelection()]);
68  return true;
69  } else if(m_checkBoxOutput->GetValue() && m_choiceOutput->GetSelection() != -1) {
70  m_ioControl->SetValue(m_outputFlags[m_choiceOutput->GetSelection()]);
71  return true;
72  }
73 
74  return false;
75 }
76 
77 void IOControlForm::OnInputChecked(wxCommandEvent& event)
78 {
79  m_checkBoxInput->SetValue(true);
80  m_checkBoxOutput->SetValue(false);
81  m_choiceOutput->Enable(false);
82  m_choiceInput->Enable(true);
83 }
84 
85 void IOControlForm::OnOutputChecked(wxCommandEvent& event)
86 {
87  m_checkBoxOutput->SetValue(true);
88  m_checkBoxInput->SetValue(false);
89  m_choiceOutput->Enable(true);
90  m_choiceInput->Enable(false);
91 }
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "IOControlForm.h"
19 
20 IOControlForm::IOControlForm(wxWindow* parent, IOControl* ioControl) : IOControlFormBase(parent)
21 {
22  SetSize(GetBestSize());
23 
24  m_parent = parent;
25  m_ioControl = ioControl;
26 
27  int ioFlags = m_ioControl->GetIOFlags();
28  int inChoiceNumber = -1;
29  int outChoiceNumber = -1;
30 
31  if(ioFlags & IOControl::IN_TERMINAL_VOLTAGE) {
32  m_choiceInput->Append(_("Terminal voltage"));
33  m_inputFlags.push_back(IOControl::IN_TERMINAL_VOLTAGE);
34  if(m_ioControl->GetValue() == IOControl::IN_TERMINAL_VOLTAGE) inChoiceNumber = (int)m_inputFlags.size() - 1;
35  }
36  if(ioFlags & IOControl::IN_VELOCITY) {
37  m_choiceInput->Append(_("Velocity"));
38  m_inputFlags.push_back(IOControl::IN_VELOCITY);
39  if(m_ioControl->GetValue() == IOControl::IN_VELOCITY) inChoiceNumber = (int)m_inputFlags.size() - 1;
40  }
41  if(ioFlags & IOControl::IN_ACTIVE_POWER) {
42  m_choiceInput->Append(_("Active power"));
43  m_inputFlags.push_back(IOControl::IN_ACTIVE_POWER);
44  if(m_ioControl->GetValue() == IOControl::IN_ACTIVE_POWER) inChoiceNumber = (int)m_inputFlags.size() - 1;
45  }
46  if(ioFlags & IOControl::IN_REACTIVE_POWER) {
47  m_choiceInput->Append(_("Reactive power"));
48  m_inputFlags.push_back(IOControl::IN_REACTIVE_POWER);
49  if(m_ioControl->GetValue() == IOControl::IN_REACTIVE_POWER) inChoiceNumber = (int)m_inputFlags.size() - 1;
50  }
51  if(ioFlags & IOControl::OUT_FIELD_VOLTAGE) {
52  m_choiceOutput->Append(_("Field voltage"));
53  m_outputFlags.push_back(IOControl::OUT_FIELD_VOLTAGE);
54  if(m_ioControl->GetValue() == IOControl::OUT_FIELD_VOLTAGE) outChoiceNumber = (int)m_outputFlags.size() - 1;
55  }
56  if(ioFlags & IOControl::OUT_MEC_POWER) {
57  m_choiceOutput->Append(_("Mechanical power"));
58  m_outputFlags.push_back(IOControl::OUT_MEC_POWER);
59  if(m_ioControl->GetValue() == IOControl::OUT_MEC_POWER) outChoiceNumber = (int)m_outputFlags.size() - 1;
60  }
61 
62  if(inChoiceNumber != -1) {
63  m_choiceInput->SetSelection(inChoiceNumber);
64  m_checkBoxInput->SetValue(true);
65  m_checkBoxOutput->SetValue(false);
66  m_choiceOutput->Enable(false);
67  } else {
68  m_choiceOutput->SetSelection(outChoiceNumber);
69  m_checkBoxInput->SetValue(false);
70  m_checkBoxOutput->SetValue(true);
71  m_choiceInput->Enable(false);
72  }
73 }
74 
75 IOControlForm::~IOControlForm() {}
76 void IOControlForm::OnOKButtonClick(wxCommandEvent& event)
77 {
78  if(ValidateData()) EndModal(wxID_OK);
79 }
80 
81 bool IOControlForm::ValidateData()
82 {
83  if(m_checkBoxInput->GetValue() && m_choiceInput->GetSelection() != -1) {
84  m_ioControl->SetValue(m_inputFlags[m_choiceInput->GetSelection()]);
85  return true;
86  } else if(m_checkBoxOutput->GetValue() && m_choiceOutput->GetSelection() != -1) {
87  m_ioControl->SetValue(m_outputFlags[m_choiceOutput->GetSelection()]);
88  return true;
89  }
90 
91  return false;
92 }
93 
94 void IOControlForm::OnInputChecked(wxCommandEvent& event)
95 {
96  m_checkBoxInput->SetValue(true);
97  m_checkBoxOutput->SetValue(false);
98  m_choiceOutput->Enable(false);
99  m_choiceInput->Enable(true);
100 }
101 
102 void IOControlForm::OnOutputChecked(wxCommandEvent& event)
103 {
104  m_checkBoxOutput->SetValue(true);
105  m_checkBoxInput->SetValue(false);
106  m_choiceOutput->Enable(true);
107  m_choiceInput->Enable(false);
108 }
+
Provides the communication with the power element.
Definition: IOControl.h:35
+
diff --git a/docs/doxygen/html/_i_o_control_form_8h.html b/docs/doxygen/html/_i_o_control_form_8h.html new file mode 100644 index 0000000..dac7afb --- /dev/null +++ b/docs/doxygen/html/_i_o_control_form_8h.html @@ -0,0 +1,116 @@ + + + + + + + + + +Project/IOControlForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
IOControlForm.h File Reference
+
+
+
#include "ElementForm.h"
+#include "IOControl.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  IOControlForm
 Form to edit the input/output control data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_i_o_control_form_8h_source.html b/docs/doxygen/html/_i_o_control_form_8h_source.html index d9e71ff..f24ff47 100644 --- a/docs/doxygen/html/_i_o_control_form_8h_source.html +++ b/docs/doxygen/html/_i_o_control_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,16 @@ $(document).ready(function(){initNavTree('_i_o_control_form_8h_source.html','');
IOControlForm.h
-
1 #ifndef IOCONTROLFORM_H
2 #define IOCONTROLFORM_H
3 
4 #include "ElementForm.h"
5 #include "IOControl.h"
6 
8 {
9  public:
10  IOControlForm(wxWindow* parent, IOControl* ioControl);
11  virtual ~IOControlForm();
12 
13  virtual bool ValidateData();
14 
15  protected:
16  virtual void OnInputChecked(wxCommandEvent& event);
17  virtual void OnOutputChecked(wxCommandEvent& event);
18  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); };
19  virtual void OnOKButtonClick(wxCommandEvent& event);
20 
21  wxWindow* m_parent;
22  IOControl* m_ioControl;
23 
24  std::vector<IOControl::IOFlags> m_inputFlags;
25  std::vector<IOControl::IOFlags> m_outputFlags;
26 };
27 #endif // IOCONTROLFORM_H
- - +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef IOCONTROLFORM_H
19 #define IOCONTROLFORM_H
20 
21 #include "ElementForm.h"
22 #include "IOControl.h"
23 
32 {
33  public:
34  IOControlForm(wxWindow* parent, IOControl* ioControl);
35  virtual ~IOControlForm();
36 
37  virtual bool ValidateData();
38 
39  protected:
40  virtual void OnInputChecked(wxCommandEvent& event);
41  virtual void OnOutputChecked(wxCommandEvent& event);
42  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); };
43  virtual void OnOKButtonClick(wxCommandEvent& event);
44 
45  wxWindow* m_parent;
46  IOControl* m_ioControl;
47 
48  std::vector<IOControl::IOFlags> m_inputFlags;
49  std::vector<IOControl::IOFlags> m_outputFlags;
50 };
51 #endif // IOCONTROLFORM_H
+
Provides the communication with the power element.
Definition: IOControl.h:35
+ +
Form to edit the input/output control data.
Definition: IOControlForm.h:31
-
1 #include "IndMotorForm.h"
2 #include "IndMotor.h"
3 
4 IndMotor::IndMotor()
5  : Machines()
6 {
7 }
8 IndMotor::IndMotor(wxString name)
9  : Machines()
10 {
11  m_electricalData.name = name;
12 }
13 IndMotor::~IndMotor() {}
14 void IndMotor::DrawSymbol() const
15 {
16  std::vector<wxPoint2DDouble> mPts;
17  mPts.push_back(wxPoint2DDouble(-10, 13) + m_position);
18  mPts.push_back(wxPoint2DDouble(-10, -13) + m_position);
19  mPts.push_back(wxPoint2DDouble(0, 2) + m_position);
20  mPts.push_back(wxPoint2DDouble(10, -13) + m_position);
21  mPts.push_back(wxPoint2DDouble(10, 13) + m_position);
22  DrawLine(mPts);
23 }
24 
25 bool IndMotor::GetContextMenu(wxMenu& menu)
26 {
27  menu.Append(ID_EDIT_ELEMENT, _("Edit induction motor"));
28  GeneralMenuItens(menu);
29  return true;
30 }
31 
32 bool IndMotor::ShowForm(wxWindow* parent, Element* element)
33 {
34  IndMotorForm* indMotorForm = new IndMotorForm(parent, this);
35  if(indMotorForm->ShowModal() == wxID_OK) {
36  indMotorForm->Destroy();
37  return true;
38  }
39  indMotorForm->Destroy();
40  return false;
41 }
42 
43 IndMotorElectricalData IndMotor::GetPUElectricalData(double systemPowerBase)
44 {
45  IndMotorElectricalData data = m_electricalData;
46 
47  switch(data.activePowerUnit) {
48  case UNIT_W: {
49  data.activePower = data.activePower / systemPowerBase;
50  data.activePowerUnit = UNIT_PU;
51  } break;
52  case UNIT_kW: {
53  data.activePower = (data.activePower * 1e3) / systemPowerBase;
54  data.activePowerUnit = UNIT_PU;
55  } break;
56  case UNIT_MW: {
57  data.activePower = (data.activePower * 1e6) / systemPowerBase;
58  data.activePowerUnit = UNIT_PU;
59  } break;
60  default:
61  break;
62  }
63  switch(data.reactivePowerUnit) {
64  case UNIT_VAr: {
65  data.reactivePower = data.reactivePower / systemPowerBase;
66  data.reactivePowerUnit = UNIT_PU;
67  } break;
68  case UNIT_kVAr: {
69  data.reactivePower = (data.reactivePower * 1e3) / systemPowerBase;
70  data.reactivePowerUnit = UNIT_PU;
71  } break;
72  case UNIT_MVAr: {
73  data.reactivePower = (data.reactivePower * 1e6) / systemPowerBase;
74  data.reactivePowerUnit = UNIT_PU;
75  } break;
76  default:
77  break;
78  }
79 
80  return data;
81 }
82 
84 {
85  IndMotor* copy = new IndMotor();
86  *copy = *this;
87  return copy;
88 }
89 
90 wxString IndMotor::GetTipText() const
91 {
92  wxString tipText = m_electricalData.name;
93  tipText += "\n";
94  double activePower = m_electricalData.activePower;
95  if(!m_online) activePower = 0.0;
96  tipText += _("\nP = ") + wxString::FromDouble(activePower, 5);
97  switch(m_electricalData.activePowerUnit) {
98  case UNIT_PU: {
99  tipText += _(" p.u.");
100  } break;
101  case UNIT_W: {
102  tipText += _(" W");
103  } break;
104  case UNIT_kW: {
105  tipText += _(" kW");
106  } break;
107  case UNIT_MW: {
108  tipText += _(" MW");
109  } break;
110  default:
111  break;
112  }
113  double reactivePower = m_electricalData.reactivePower;
114  if(!m_online) reactivePower = 0.0;
115  tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
116  switch(m_electricalData.reactivePowerUnit) {
117  case UNIT_PU: {
118  tipText += _(" p.u.");
119  } break;
120  case UNIT_VAr: {
121  tipText += _(" VAr");
122  } break;
123  case UNIT_kVAr: {
124  tipText += _(" kVAr");
125  } break;
126  case UNIT_MVAr: {
127  tipText += _(" MVAr");
128  } break;
129  default:
130  break;
131  }
132 
133  return tipText;
134 }
- -
virtual void DrawLine(std::vector< wxPoint2DDouble > points, GLenum mode=GL_LINE_STRIP) const
Draw line.
Definition: Element.cpp:73
- -
virtual wxString GetTipText() const
Get the tip text.
Definition: IndMotor.cpp:90
- - -
virtual void GeneralMenuItens(wxMenu &menu)
Insert general itens to context menu.
Definition: Element.cpp:228
- - - -
virtual Element * GetCopy()
Get a the element copy.
Definition: IndMotor.cpp:83
- - - - -
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: IndMotor.cpp:32
-
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: IndMotor.cpp:25
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "IndMotorForm.h"
19 #include "IndMotor.h"
20 
21 IndMotor::IndMotor() : Machines() {}
22 IndMotor::IndMotor(wxString name) : Machines() { m_electricalData.name = name; }
23 IndMotor::~IndMotor() {}
24 void IndMotor::DrawSymbol() const
25 {
26  std::vector<wxPoint2DDouble> mPts;
27  mPts.push_back(wxPoint2DDouble(-10, 13) + m_position);
28  mPts.push_back(wxPoint2DDouble(-10, -13) + m_position);
29  mPts.push_back(wxPoint2DDouble(0, 2) + m_position);
30  mPts.push_back(wxPoint2DDouble(10, -13) + m_position);
31  mPts.push_back(wxPoint2DDouble(10, 13) + m_position);
32  DrawLine(mPts);
33 }
34 
35 bool IndMotor::GetContextMenu(wxMenu& menu)
36 {
37  menu.Append(ID_EDIT_ELEMENT, _("Edit induction motor"));
38  GeneralMenuItens(menu);
39  return true;
40 }
41 
42 bool IndMotor::ShowForm(wxWindow* parent, Element* element)
43 {
44  IndMotorForm* indMotorForm = new IndMotorForm(parent, this);
45  if(indMotorForm->ShowModal() == wxID_OK) {
46  indMotorForm->Destroy();
47  return true;
48  }
49  indMotorForm->Destroy();
50  return false;
51 }
52 
53 IndMotorElectricalData IndMotor::GetPUElectricalData(double systemPowerBase)
54 {
55  IndMotorElectricalData data = m_electricalData;
56 
57  switch(data.activePowerUnit) {
58  case UNIT_W: {
59  data.activePower = data.activePower / systemPowerBase;
60  data.activePowerUnit = UNIT_PU;
61  } break;
62  case UNIT_kW: {
63  data.activePower = (data.activePower * 1e3) / systemPowerBase;
64  data.activePowerUnit = UNIT_PU;
65  } break;
66  case UNIT_MW: {
67  data.activePower = (data.activePower * 1e6) / systemPowerBase;
68  data.activePowerUnit = UNIT_PU;
69  } break;
70  default:
71  break;
72  }
73  switch(data.reactivePowerUnit) {
74  case UNIT_VAr: {
75  data.reactivePower = data.reactivePower / systemPowerBase;
76  data.reactivePowerUnit = UNIT_PU;
77  } break;
78  case UNIT_kVAr: {
79  data.reactivePower = (data.reactivePower * 1e3) / systemPowerBase;
80  data.reactivePowerUnit = UNIT_PU;
81  } break;
82  case UNIT_MVAr: {
83  data.reactivePower = (data.reactivePower * 1e6) / systemPowerBase;
84  data.reactivePowerUnit = UNIT_PU;
85  } break;
86  default:
87  break;
88  }
89 
90  return data;
91 }
92 
94 {
95  IndMotor* copy = new IndMotor();
96  *copy = *this;
97  return copy;
98 }
99 
100 wxString IndMotor::GetTipText() const
101 {
102  wxString tipText = m_electricalData.name;
103  tipText += "\n";
104  double activePower = m_electricalData.activePower;
105  if(!m_online) activePower = 0.0;
106  tipText += _("\nP = ") + wxString::FromDouble(activePower, 5);
107  switch(m_electricalData.activePowerUnit) {
108  case UNIT_PU: {
109  tipText += _(" p.u.");
110  } break;
111  case UNIT_W: {
112  tipText += _(" W");
113  } break;
114  case UNIT_kW: {
115  tipText += _(" kW");
116  } break;
117  case UNIT_MW: {
118  tipText += _(" MW");
119  } break;
120  default:
121  break;
122  }
123  double reactivePower = m_electricalData.reactivePower;
124  if(!m_online) reactivePower = 0.0;
125  tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
126  switch(m_electricalData.reactivePowerUnit) {
127  case UNIT_PU: {
128  tipText += _(" p.u.");
129  } break;
130  case UNIT_VAr: {
131  tipText += _(" VAr");
132  } break;
133  case UNIT_kVAr: {
134  tipText += _(" kVAr");
135  } break;
136  case UNIT_MVAr: {
137  tipText += _(" MVAr");
138  } break;
139  default:
140  break;
141  }
142 
143  return tipText;
144 }
+ + +
virtual void DrawLine(std::vector< wxPoint2DDouble > points, GLenum mode=GL_LINE_STRIP) const
Draw line.
Definition: Element.cpp:89
+ +
virtual wxString GetTipText() const
Get the tip text.
Definition: IndMotor.cpp:100
+ + +
virtual void GeneralMenuItens(wxMenu &menu)
Insert general itens to context menu.
Definition: Element.cpp:245
+ + + +
virtual Element * GetCopy()
Get a the element copy.
Definition: IndMotor.cpp:93
+ + + +
Form to edit the induction motor power data.
Definition: IndMotorForm.h:31
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: IndMotor.cpp:42
+
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: IndMotor.cpp:35
+
diff --git a/docs/doxygen/html/_ind_motor_8h_source.html b/docs/doxygen/html/_ind_motor_8h_source.html index ee9f487..c81f671 100644 --- a/docs/doxygen/html/_ind_motor_8h_source.html +++ b/docs/doxygen/html/_ind_motor_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,14 +88,14 @@ $(document).ready(function(){initNavTree('_ind_motor_8h_source.html','');});
IndMotor.h
-
1 #ifndef INDMOTOR_H
2 #define INDMOTOR_H
3 
4 #include "Machines.h"
5 
6 class IndMotorForm;
7 
9 {
10  wxString name;
11  double activePower = 100.0;
12  ElectricalUnit activePowerUnit = UNIT_MW;
13  double reactivePower = 0.0;
14  ElectricalUnit reactivePowerUnit = UNIT_MVAr;
15 };
16 
17 class IndMotor : public Machines
18 {
19  public:
20  IndMotor();
21  IndMotor(wxString name);
22  ~IndMotor();
23 
24  virtual Element* GetCopy();
25  virtual void DrawSymbol() const;
26  virtual bool GetContextMenu(wxMenu& menu);
27  virtual wxString GetTipText() const;
28  virtual bool ShowForm(wxWindow* parent, Element* element);
29  virtual IndMotorElectricalData GetElectricalData() { return m_electricalData; }
30  virtual IndMotorElectricalData GetPUElectricalData(double systemPowerBase);
31  virtual void SetElectricalData(IndMotorElectricalData electricalData) { m_electricalData = electricalData; }
32  protected:
33  IndMotorElectricalData m_electricalData;
34 };
35 
36 #endif // INDMOTOR_H
- - -
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
- - - - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INDMOTOR_H
19 #define INDMOTOR_H
20 
21 #include "Machines.h"
22 
23 class IndMotorForm;
24 
26  wxString name;
27  double activePower = 100.0;
28  ElectricalUnit activePowerUnit = UNIT_MW;
29  double reactivePower = 0.0;
30  ElectricalUnit reactivePowerUnit = UNIT_MVAr;
31 };
32 
33 class IndMotor : public Machines
34 {
35  public:
36  IndMotor();
37  IndMotor(wxString name);
38  ~IndMotor();
39 
40  virtual Element* GetCopy();
41  virtual void DrawSymbol() const;
42  virtual bool GetContextMenu(wxMenu& menu);
43  virtual wxString GetTipText() const;
44  virtual bool ShowForm(wxWindow* parent, Element* element);
45  virtual IndMotorElectricalData GetElectricalData() { return m_electricalData; }
46  virtual IndMotorElectricalData GetPUElectricalData(double systemPowerBase);
47  virtual void SetElectricalData(IndMotorElectricalData electricalData) { m_electricalData = electricalData; }
48  protected:
49  IndMotorElectricalData m_electricalData;
50 };
51 
52 #endif // INDMOTOR_H
+ + +
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+ + + +
Form to edit the induction motor power data.
Definition: IndMotorForm.h:31
diff --git a/docs/doxygen/html/_ind_motor_form_8cpp_source.html b/docs/doxygen/html/_ind_motor_form_8cpp_source.html index 6d7b442..c8007c6 100644 --- a/docs/doxygen/html/_ind_motor_form_8cpp_source.html +++ b/docs/doxygen/html/_ind_motor_form_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,17 +88,18 @@ $(document).ready(function(){initNavTree('_ind_motor_form_8cpp_source.html','');
IndMotorForm.cpp
-
1 #include "IndMotorForm.h"
2 #include "IndMotor.h"
3 
4 IndMotorForm::IndMotorForm(wxWindow* parent, IndMotor* indMotor) : IndMotorFormBase(parent)
5 {
6  SetSize(GetBestSize());
7  m_buttonStabButton->Enable(false);
8  IndMotorElectricalData data = indMotor->GetElectricalData();
9 
10  m_textCtrlName->SetValue(data.name);
11 
12  m_textCtrlActivePower->SetValue(IndMotor::StringFromDouble(data.activePower));
13  switch(data.activePowerUnit) {
14  case UNIT_PU: {
15  m_choiceActivePower->SetSelection(0);
16  } break;
17  case UNIT_W: {
18  m_choiceActivePower->SetSelection(1);
19  } break;
20  case UNIT_kW: {
21  m_choiceActivePower->SetSelection(2);
22  } break;
23  case UNIT_MW: {
24  m_choiceActivePower->SetSelection(3);
25  } break;
26  default:
27  break;
28  }
29 
30  m_textCtrlReactivePower->SetValue(IndMotor::StringFromDouble(data.reactivePower));
31  switch(data.reactivePowerUnit) {
32  case UNIT_PU: {
33  m_choiceReactivePower->SetSelection(0);
34  } break;
35  case UNIT_VAr: {
36  m_choiceReactivePower->SetSelection(1);
37  } break;
38  case UNIT_kVAr: {
39  m_choiceReactivePower->SetSelection(2);
40  } break;
41  case UNIT_MVAr: {
42  m_choiceReactivePower->SetSelection(3);
43  } break;
44  default:
45  break;
46  }
47 
48  m_parent = parent;
49  m_indMotor = indMotor;
50 }
51 
52 IndMotorForm::~IndMotorForm() {}
53 void IndMotorForm::OnOKButtonClick(wxCommandEvent& event)
54 {
55  if(ValidateData()) EndModal(wxID_OK);
56 }
57 void IndMotorForm::OnStabilityButtonClick(wxCommandEvent& event)
58 {
59  // TODO: Induction motor stability form
60 }
61 
62 bool IndMotorForm::ValidateData()
63 {
65 
66  data.name = m_textCtrlName->GetValue();
67 
68  if(!m_indMotor->DoubleFromString(m_parent, m_textCtrlActivePower->GetValue(), data.activePower,
69  _("Value entered incorrectly in the field \"Active power\".")))
70  return false;
71  switch(m_choiceActivePower->GetSelection()) {
72  case 0: {
73  data.activePowerUnit = UNIT_PU;
74  } break;
75  case 1: {
76  data.activePowerUnit = UNIT_W;
77  } break;
78  case 2: {
79  data.activePowerUnit = UNIT_kW;
80  } break;
81  case 3: {
82  data.activePowerUnit = UNIT_MW;
83  } break;
84  }
85 
86  if(!m_indMotor->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
87  _("Value entered incorrectly in the field \"Reactive power\".")))
88  return false;
89  switch(m_choiceReactivePower->GetSelection()) {
90  case 0: {
91  data.reactivePowerUnit = UNIT_PU;
92  } break;
93  case 1: {
94  data.reactivePowerUnit = UNIT_VAr;
95  } break;
96  case 2: {
97  data.reactivePowerUnit = UNIT_kVAr;
98  } break;
99  case 3: {
100  data.reactivePowerUnit = UNIT_MVAr;
101  } break;
102  }
103 
104  m_indMotor->SetElectricalData(data);
105  return true;
106 }
- - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "IndMotorForm.h"
19 #include "IndMotor.h"
20 
21 IndMotorForm::IndMotorForm(wxWindow* parent, IndMotor* indMotor) : IndMotorFormBase(parent)
22 {
23  SetSize(GetBestSize());
24  m_buttonStabButton->Enable(false);
25  IndMotorElectricalData data = indMotor->GetElectricalData();
26 
27  m_textCtrlName->SetValue(data.name);
28 
29  m_textCtrlActivePower->SetValue(IndMotor::StringFromDouble(data.activePower));
30  switch(data.activePowerUnit) {
31  case UNIT_PU: {
32  m_choiceActivePower->SetSelection(0);
33  } break;
34  case UNIT_W: {
35  m_choiceActivePower->SetSelection(1);
36  } break;
37  case UNIT_kW: {
38  m_choiceActivePower->SetSelection(2);
39  } break;
40  case UNIT_MW: {
41  m_choiceActivePower->SetSelection(3);
42  } break;
43  default:
44  break;
45  }
46 
47  m_textCtrlReactivePower->SetValue(IndMotor::StringFromDouble(data.reactivePower));
48  switch(data.reactivePowerUnit) {
49  case UNIT_PU: {
50  m_choiceReactivePower->SetSelection(0);
51  } break;
52  case UNIT_VAr: {
53  m_choiceReactivePower->SetSelection(1);
54  } break;
55  case UNIT_kVAr: {
56  m_choiceReactivePower->SetSelection(2);
57  } break;
58  case UNIT_MVAr: {
59  m_choiceReactivePower->SetSelection(3);
60  } break;
61  default:
62  break;
63  }
64 
65  m_parent = parent;
66  m_indMotor = indMotor;
67 }
68 
69 IndMotorForm::~IndMotorForm() {}
70 void IndMotorForm::OnOKButtonClick(wxCommandEvent& event)
71 {
72  if(ValidateData()) EndModal(wxID_OK);
73 }
74 void IndMotorForm::OnStabilityButtonClick(wxCommandEvent& event)
75 {
76  // TODO: Induction motor stability form
77 }
78 
79 bool IndMotorForm::ValidateData()
80 {
82 
83  data.name = m_textCtrlName->GetValue();
84 
85  if(!m_indMotor->DoubleFromString(m_parent, m_textCtrlActivePower->GetValue(), data.activePower,
86  _("Value entered incorrectly in the field \"Active power\".")))
87  return false;
88  switch(m_choiceActivePower->GetSelection()) {
89  case 0: {
90  data.activePowerUnit = UNIT_PU;
91  } break;
92  case 1: {
93  data.activePowerUnit = UNIT_W;
94  } break;
95  case 2: {
96  data.activePowerUnit = UNIT_kW;
97  } break;
98  case 3: {
99  data.activePowerUnit = UNIT_MW;
100  } break;
101  }
102 
103  if(!m_indMotor->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
104  _("Value entered incorrectly in the field \"Reactive power\".")))
105  return false;
106  switch(m_choiceReactivePower->GetSelection()) {
107  case 0: {
108  data.reactivePowerUnit = UNIT_PU;
109  } break;
110  case 1: {
111  data.reactivePowerUnit = UNIT_VAr;
112  } break;
113  case 2: {
114  data.reactivePowerUnit = UNIT_kVAr;
115  } break;
116  case 3: {
117  data.reactivePowerUnit = UNIT_MVAr;
118  } break;
119  }
120 
121  m_indMotor->SetElectricalData(data);
122  return true;
123 }
+ + + - - - - - -
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:300
- + + + + + +
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:320
+
diff --git a/docs/doxygen/html/_ind_motor_form_8h.html b/docs/doxygen/html/_ind_motor_form_8h.html new file mode 100644 index 0000000..404c7ed --- /dev/null +++ b/docs/doxygen/html/_ind_motor_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/IndMotorForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
IndMotorForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  IndMotorForm
 Form to edit the induction motor power data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_ind_motor_form_8h_source.html b/docs/doxygen/html/_ind_motor_form_8h_source.html index 8c0868c..526fa6a 100644 --- a/docs/doxygen/html/_ind_motor_form_8h_source.html +++ b/docs/doxygen/html/_ind_motor_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_ind_motor_form_8h_source.html','');})
IndMotorForm.h
-
1 #ifndef INDMOTORFORM_H
2 #define INDMOTORFORM_H
3 #include "ElementForm.h"
4 
5 class IndMotor;
6 
8 {
9  public:
10  IndMotorForm(wxWindow* parent, IndMotor* indMotor);
11  virtual ~IndMotorForm();
12  virtual bool ValidateData();
13 
14  protected:
15  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); };
16  virtual void OnOKButtonClick(wxCommandEvent& event);
17  virtual void OnStabilityButtonClick(wxCommandEvent& event);
18 
19  wxWindow* m_parent = NULL;
20  IndMotor* m_indMotor = NULL;
21 };
22 #endif // INDMOTORFORM_H
- - +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INDMOTORFORM_H
19 #define INDMOTORFORM_H
20 #include "ElementForm.h"
21 
22 class IndMotor;
23 
32 {
33  public:
34  IndMotorForm(wxWindow* parent, IndMotor* indMotor);
35  virtual ~IndMotorForm();
36  virtual bool ValidateData();
37 
38  protected:
39  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); };
40  virtual void OnOKButtonClick(wxCommandEvent& event);
41  virtual void OnStabilityButtonClick(wxCommandEvent& event);
42 
43  wxWindow* m_parent = NULL;
44  IndMotor* m_indMotor = NULL;
45 };
46 #endif // INDMOTORFORM_H
+ +
Form to edit the induction motor power data.
Definition: IndMotorForm.h:31
-
1 #include "ReactiveShuntElementForm.h"
2 #include "Inductor.h"
3 
4 Inductor::Inductor() : Shunt() {}
5 Inductor::Inductor(wxString name) : Shunt() { m_electricalData.name = name; }
6 Inductor::~Inductor() {}
7 bool Inductor::AddParent(Element* parent, wxPoint2DDouble position)
8 {
9  if(parent) {
10  m_parentList.push_back(parent);
11  parent->AddChild(this);
12  wxPoint2DDouble parentPt =
13  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
14  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
15  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
16 
17  m_position = parentPt + wxPoint2DDouble(0.0, 100.0); // Shifts the position to the down of the bus.
18  m_width = 20.0;
19  m_height = 70.0;
20  m_rect = wxRect2DDouble(m_position.m_x - m_width / 2.0, m_position.m_y - m_height / 2.0, m_width, m_height);
21 
22  m_pointList.push_back(parentPt);
23  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
24  m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -m_height / 2.0 - 10.0));
25  m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -m_height / 2.0));
26 
27  m_inserted = true;
28 
29  wxRect2DDouble genRect(0, 0, 0, 0);
30  m_switchRect.push_back(genRect); // Push a general rectangle.
31  UpdateSwitches();
32 
33  return true;
34  }
35  return false;
36 }
37 
38 void Inductor::Draw(wxPoint2DDouble translation, double scale) const
39 {
40  OpenGLColour elementColour;
41  if(m_online) {
42  if(m_dynEvent)
43  elementColour = m_dynamicEventColour;
44  else
45  elementColour = m_onlineElementColour;
46  } else
47  elementColour = m_offlineElementColour;
48 
49  if(m_inserted) {
50  if(m_selected) {
51  glLineWidth(1.5 + m_borderSize * 2.0);
52  glColor4dv(m_selectionColour.GetRGBA());
53 
54  DrawLine(m_pointList);
55 
56  glPushMatrix();
57  glTranslated(m_position.m_x, m_position.m_y, 0.0);
58  glRotated(m_angle, 0.0, 0.0, 1.0);
59  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
60 
61  DrawArc(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 10.0), 10, 45, 270, 30, GL_LINE_STRIP);
62  DrawArc(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 25.0), 10, 45, 315, 30, GL_LINE_STRIP);
63  DrawArc(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 40.0), 10, 90, 315, 30, GL_LINE_STRIP);
64 
65  DrawGround(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 50.0));
66 
67  glPopMatrix();
68 
69  // Draw node selection.
70  DrawCircle(m_pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
71  }
72  // Draw Load (layer 2).
73  glLineWidth(1.5);
74  glColor4dv(elementColour.GetRGBA());
75  DrawCircle(m_pointList[0], 5.0, 10, GL_POLYGON);
76  DrawLine(m_pointList);
77 
78  DrawSwitches();
79 
80  glPushMatrix();
81  glTranslated(m_position.m_x, m_position.m_y, 0.0);
82  glRotated(m_angle, 0.0, 0.0, 1.0);
83  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
84 
85  glColor4dv(elementColour.GetRGBA());
86  DrawArc(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 10.0), 10, 45, 270, 10, GL_LINE_STRIP);
87  DrawArc(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 25.0), 10, 45, 315, 10, GL_LINE_STRIP);
88  DrawArc(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 40.0), 10, 90, 315, 10, GL_LINE_STRIP);
89 
90  DrawGround(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 50.0));
91 
92  glPopMatrix();
93  }
94 }
95 
96 void Inductor::Rotate(bool clockwise)
97 {
98  double rotAngle = m_rotationAngle;
99  if(!clockwise) rotAngle = -m_rotationAngle;
100 
101  m_angle += rotAngle;
102  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
103  m_pointList[2] = RotateAtPosition(m_pointList[2], rotAngle);
104  m_pointList[3] = RotateAtPosition(m_pointList[3], rotAngle);
105  UpdateSwitchesPosition();
106 }
107 
108 bool Inductor::GetContextMenu(wxMenu& menu)
109 {
110  menu.Append(ID_EDIT_ELEMENT, _("Edit Inductor"));
111  GeneralMenuItens(menu);
112  return true;
113 }
114 
115 bool Inductor::Contains(wxPoint2DDouble position) const
116 {
117  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
118  return m_rect.Contains(ptR);
119 }
120 
121 bool Inductor::Intersects(wxRect2DDouble rect) const { return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0); }
122 bool Inductor::ShowForm(wxWindow* parent, Element* element)
123 {
124  ReactiveShuntElementForm* capacitorForm = new ReactiveShuntElementForm(parent, this);
125  capacitorForm->SetTitle(_("Inductor"));
126  if(capacitorForm->ShowModal() == wxID_OK) {
127  capacitorForm->Destroy();
128  return true;
129  }
130  capacitorForm->Destroy();
131  return false;
132 }
133 
134 InductorElectricalData Inductor::GetPUElectricalData(double systemPowerBase)
135 {
136  InductorElectricalData data = m_electricalData;
137  switch(data.reactivePowerUnit) {
138  case UNIT_VAr: {
139  data.reactivePower = data.reactivePower / systemPowerBase;
140  data.reactivePowerUnit = UNIT_PU;
141  } break;
142  case UNIT_kVAr: {
143  data.reactivePower = (data.reactivePower * 1e3) / systemPowerBase;
144  data.reactivePowerUnit = UNIT_PU;
145  } break;
146  case UNIT_MVAr: {
147  data.reactivePower = (data.reactivePower * 1e6) / systemPowerBase;
148  data.reactivePowerUnit = UNIT_PU;
149  } break;
150  default:
151  break;
152  }
153 
154  return data;
155 }
156 
158 {
159  Inductor* copy = new Inductor();
160  *copy = *this;
161  return copy;
162 }
163 
164 wxString Inductor::GetTipText() const
165 {
166  wxString tipText = m_electricalData.name;
167 
168  // TODO: Avoid reactive power calculation.
169  double reactivePower = m_electricalData.reactivePower;
170  if(!m_online)
171  reactivePower = 0.0;
172  else {
173  std::complex<double> v = static_cast<Bus*>(m_parentList[0])->GetElectricalData().voltage;
174  reactivePower *= std::pow(std::abs(v), 2);
175  }
176  tipText += "\n";
177  tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
178  switch(m_electricalData.reactivePowerUnit) {
179  case UNIT_PU: {
180  tipText += _(" p.u.");
181  } break;
182  case UNIT_VAr: {
183  tipText += _(" VAr");
184  } break;
185  case UNIT_kVAr: {
186  tipText += _(" kVAr");
187  } break;
188  case UNIT_MVAr: {
189  tipText += _(" MVAr");
190  } break;
191  default:
192  break;
193  }
194 
195  return tipText;
196 }
double GetAngle() const
Get the element angle.
Definition: Element.h:201
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Inductor.cpp:122
- - -
virtual wxString GetTipText() const
Get the tip text.
Definition: Inductor.cpp:164
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Inductor.cpp:115
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Inductor.cpp:96
- -
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:91
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Inductor.cpp:157
-
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Inductor.cpp:108
- -
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Inductor.cpp:38
-
Definition: Bus.h:45
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Inductor.cpp:7
- -
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:333
- - - -
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Inductor.cpp:121
-
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:171
- -
Definition: Shunt.h:7
- -
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:83
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
19 #include "Inductor.h"
20 
21 Inductor::Inductor() : Shunt() {}
22 Inductor::Inductor(wxString name) : Shunt() { m_electricalData.name = name; }
23 Inductor::~Inductor() {}
24 bool Inductor::AddParent(Element* parent, wxPoint2DDouble position)
25 {
26  if(parent) {
27  m_parentList.push_back(parent);
28  parent->AddChild(this);
29  wxPoint2DDouble parentPt =
30  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
31  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
32  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
33 
34  m_position = parentPt + wxPoint2DDouble(0.0, 100.0); // Shifts the position to the down of the bus.
35  m_width = 20.0;
36  m_height = 70.0;
37  m_rect = wxRect2DDouble(m_position.m_x - m_width / 2.0, m_position.m_y - m_height / 2.0, m_width, m_height);
38 
39  m_pointList.push_back(parentPt);
40  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
41  m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -m_height / 2.0 - 10.0));
42  m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -m_height / 2.0));
43 
44  m_inserted = true;
45 
46  wxRect2DDouble genRect(0, 0, 0, 0);
47  m_switchRect.push_back(genRect); // Push a general rectangle.
48  UpdateSwitches();
49 
50  return true;
51  }
52  return false;
53 }
54 
55 void Inductor::Draw(wxPoint2DDouble translation, double scale) const
56 {
57  OpenGLColour elementColour;
58  if(m_online) {
59  if(m_dynEvent)
60  elementColour = m_dynamicEventColour;
61  else
62  elementColour = m_onlineElementColour;
63  } else
64  elementColour = m_offlineElementColour;
65 
66  if(m_inserted) {
67  if(m_selected) {
68  glLineWidth(1.5 + m_borderSize * 2.0);
69  glColor4dv(m_selectionColour.GetRGBA());
70 
71  DrawLine(m_pointList);
72 
73  glPushMatrix();
74  glTranslated(m_position.m_x, m_position.m_y, 0.0);
75  glRotated(m_angle, 0.0, 0.0, 1.0);
76  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
77 
78  DrawArc(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 10.0), 10, 45, 270, 30, GL_LINE_STRIP);
79  DrawArc(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 25.0), 10, 45, 315, 30, GL_LINE_STRIP);
80  DrawArc(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 40.0), 10, 90, 315, 30, GL_LINE_STRIP);
81 
82  DrawGround(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 50.0));
83 
84  glPopMatrix();
85 
86  // Draw node selection.
87  DrawCircle(m_pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
88  }
89  // Draw Load (layer 2).
90  glLineWidth(1.5);
91  glColor4dv(elementColour.GetRGBA());
92  DrawCircle(m_pointList[0], 5.0, 10, GL_POLYGON);
93  DrawLine(m_pointList);
94 
95  DrawSwitches();
96 
97  glPushMatrix();
98  glTranslated(m_position.m_x, m_position.m_y, 0.0);
99  glRotated(m_angle, 0.0, 0.0, 1.0);
100  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
101 
102  glColor4dv(elementColour.GetRGBA());
103  DrawArc(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 10.0), 10, 45, 270, 10, GL_LINE_STRIP);
104  DrawArc(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 25.0), 10, 45, 315, 10, GL_LINE_STRIP);
105  DrawArc(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 40.0), 10, 90, 315, 10, GL_LINE_STRIP);
106 
107  DrawGround(m_position + wxPoint2DDouble(0, -m_height / 2.0 + 50.0));
108 
109  glPopMatrix();
110  }
111 }
112 
113 void Inductor::Rotate(bool clockwise)
114 {
115  double rotAngle = m_rotationAngle;
116  if(!clockwise) rotAngle = -m_rotationAngle;
117 
118  m_angle += rotAngle;
119  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
120  m_pointList[2] = RotateAtPosition(m_pointList[2], rotAngle);
121  m_pointList[3] = RotateAtPosition(m_pointList[3], rotAngle);
122  UpdateSwitchesPosition();
123 }
124 
125 bool Inductor::GetContextMenu(wxMenu& menu)
126 {
127  menu.Append(ID_EDIT_ELEMENT, _("Edit Inductor"));
128  GeneralMenuItens(menu);
129  return true;
130 }
131 
132 bool Inductor::Contains(wxPoint2DDouble position) const
133 {
134  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
135  return m_rect.Contains(ptR);
136 }
137 
138 bool Inductor::Intersects(wxRect2DDouble rect) const { return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0); }
139 bool Inductor::ShowForm(wxWindow* parent, Element* element)
140 {
141  ReactiveShuntElementForm* capacitorForm = new ReactiveShuntElementForm(parent, this);
142  capacitorForm->SetTitle(_("Inductor"));
143  if(capacitorForm->ShowModal() == wxID_OK) {
144  capacitorForm->Destroy();
145  return true;
146  }
147  capacitorForm->Destroy();
148  return false;
149 }
150 
151 InductorElectricalData Inductor::GetPUElectricalData(double systemPowerBase)
152 {
153  InductorElectricalData data = m_electricalData;
154  switch(data.reactivePowerUnit) {
155  case UNIT_VAr: {
156  data.reactivePower = data.reactivePower / systemPowerBase;
157  data.reactivePowerUnit = UNIT_PU;
158  } break;
159  case UNIT_kVAr: {
160  data.reactivePower = (data.reactivePower * 1e3) / systemPowerBase;
161  data.reactivePowerUnit = UNIT_PU;
162  } break;
163  case UNIT_MVAr: {
164  data.reactivePower = (data.reactivePower * 1e6) / systemPowerBase;
165  data.reactivePowerUnit = UNIT_PU;
166  } break;
167  default:
168  break;
169  }
170 
171  return data;
172 }
173 
175 {
176  Inductor* copy = new Inductor();
177  *copy = *this;
178  return copy;
179 }
180 
181 wxString Inductor::GetTipText() const
182 {
183  wxString tipText = m_electricalData.name;
184 
185  // TODO: Avoid reactive power calculation.
186  double reactivePower = m_electricalData.reactivePower;
187  if(!m_online)
188  reactivePower = 0.0;
189  else {
190  std::complex<double> v = static_cast<Bus*>(m_parentList[0])->GetElectricalData().voltage;
191  reactivePower *= std::pow(std::abs(v), 2);
192  }
193  tipText += "\n";
194  tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
195  switch(m_electricalData.reactivePowerUnit) {
196  case UNIT_PU: {
197  tipText += _(" p.u.");
198  } break;
199  case UNIT_VAr: {
200  tipText += _(" VAr");
201  } break;
202  case UNIT_kVAr: {
203  tipText += _(" kVAr");
204  } break;
205  case UNIT_MVAr: {
206  tipText += _(" MVAr");
207  } break;
208  default:
209  break;
210  }
211 
212  return tipText;
213 }
double GetAngle() const
Get the element angle.
Definition: Element.h:212
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Inductor.cpp:139
+ + +
virtual wxString GetTipText() const
Get the tip text.
Definition: Inductor.cpp:181
+ +
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Inductor.cpp:132
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Inductor.cpp:113
+ +
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:107
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Inductor.cpp:174
+
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Inductor.cpp:125
+ +
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Inductor.cpp:55
+
Definition: Bus.h:62
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Inductor.cpp:24
+ +
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:353
+ + + +
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Inductor.cpp:138
+
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:187
+ +
Definition: Shunt.h:24
+
Form to edit the reactive shunt element power data.
+
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:101
diff --git a/docs/doxygen/html/_inductor_8h_source.html b/docs/doxygen/html/_inductor_8h_source.html index cabc03d..6c82c0b 100644 --- a/docs/doxygen/html/_inductor_8h_source.html +++ b/docs/doxygen/html/_inductor_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,13 +88,13 @@ $(document).ready(function(){initNavTree('_inductor_8h_source.html','');});
Inductor.h
-
1 #ifndef INDUCTOR_H
2 #define INDUCTOR_H
3 
4 #include "Shunt.h"
5 
7 
9  wxString name;
10  double reactivePower = 100.0;
11  ElectricalUnit reactivePowerUnit = UNIT_MVAr;
12 };
13 
14 class Inductor : public Shunt
15 {
16  public:
17  Inductor();
18  Inductor(wxString name);
19  ~Inductor();
20 
21  virtual Element* GetCopy();
22  virtual bool AddParent(Element* parent, wxPoint2DDouble position);
23  virtual void Draw(wxPoint2DDouble translation, double scale) const;
24  virtual bool Contains(wxPoint2DDouble position) const;
25  virtual bool Intersects(wxRect2DDouble rect) const;
26  virtual void Rotate(bool clockwise = true);
27  virtual bool GetContextMenu(wxMenu& menu);
28  virtual wxString GetTipText() const;
29  virtual bool ShowForm(wxWindow* parent, Element* element);
30  virtual InductorElectricalData GetElectricalData() { return m_electricalData; }
31  virtual InductorElectricalData GetPUElectricalData(double systemPowerBase);
32  virtual void SetElectricalData(InductorElectricalData electricalData) { m_electricalData = electricalData; }
33  protected:
34  InductorElectricalData m_electricalData;
35 };
36 
37 #endif // INDUCTOR_H
- -
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
- - -
Definition: Shunt.h:7
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INDUCTOR_H
19 #define INDUCTOR_H
20 
21 #include "Shunt.h"
22 
24 
26  wxString name;
27  double reactivePower = 100.0;
28  ElectricalUnit reactivePowerUnit = UNIT_MVAr;
29 };
30 
31 class Inductor : public Shunt
32 {
33  public:
34  Inductor();
35  Inductor(wxString name);
36  ~Inductor();
37 
38  virtual Element* GetCopy();
39  virtual bool AddParent(Element* parent, wxPoint2DDouble position);
40  virtual void Draw(wxPoint2DDouble translation, double scale) const;
41  virtual bool Contains(wxPoint2DDouble position) const;
42  virtual bool Intersects(wxRect2DDouble rect) const;
43  virtual void Rotate(bool clockwise = true);
44  virtual bool GetContextMenu(wxMenu& menu);
45  virtual wxString GetTipText() const;
46  virtual bool ShowForm(wxWindow* parent, Element* element);
47  virtual InductorElectricalData GetElectricalData() { return m_electricalData; }
48  virtual InductorElectricalData GetPUElectricalData(double systemPowerBase);
49  virtual void SetElectricalData(InductorElectricalData electricalData) { m_electricalData = electricalData; }
50  protected:
51  InductorElectricalData m_electricalData;
52 };
53 
54 #endif // INDUCTOR_H
+ +
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+ + +
Definition: Shunt.h:24
+
Form to edit the reactive shunt element power data.
diff --git a/docs/doxygen/html/_limiter_8cpp_source.html b/docs/doxygen/html/_limiter_8cpp_source.html index 912af4c..2edb03e 100644 --- a/docs/doxygen/html/_limiter_8cpp_source.html +++ b/docs/doxygen/html/_limiter_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,17 @@ $(document).ready(function(){initNavTree('_limiter_8cpp_source.html','');});
Limiter.cpp
-
1 #include "Limiter.h"
2 #include "LimiterForm.h"
3 
4 Limiter::Limiter(int id) : ControlElement(id)
5 {
6  m_width = m_height = 36.0;
7  Node* nodeIn = new Node(m_position + wxPoint2DDouble(-18, 0), Node::NODE_IN, m_borderSize);
8  nodeIn->StartMove(m_position);
9  Node* nodeOut = new Node(m_position + wxPoint2DDouble(18, 0), Node::NODE_OUT, m_borderSize);
10  nodeOut->SetAngle(180.0);
11  nodeOut->StartMove(m_position);
12  m_nodeList.push_back(nodeIn);
13  m_nodeList.push_back(nodeOut);
14 }
15 
16 Limiter::~Limiter() {}
17 void Limiter::Draw(wxPoint2DDouble translation, double scale) const
18 {
19  glLineWidth(1.0);
20  if(m_selected) {
21  glColor4dv(m_selectionColour.GetRGBA());
22  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
23  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
24  }
25  glColor4d(1.0, 1.0, 1.0, 1.0);
26  DrawRectangle(m_position, m_width, m_height);
27  glColor4d(0.0, 0.0, 0.0, 1.0);
28  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
29 
30  // Plot symbol.
31  glLineWidth(2.0);
32  std::vector<wxPoint2DDouble> limSymbol;
33  limSymbol.push_back(m_position + wxPoint2DDouble(10, -10));
34  limSymbol.push_back(m_position + wxPoint2DDouble(2, -10));
35  limSymbol.push_back(m_position + wxPoint2DDouble(-2, 10));
36  limSymbol.push_back(m_position + wxPoint2DDouble(-10, 10));
37  glColor4d(0.0, 0.3, 1.0, 1.0);
38  DrawLine(limSymbol);
39 
40  glColor4d(0.0, 0.0, 0.0, 1.0);
41  DrawNodes();
42 }
43 
44 bool Limiter::ShowForm(wxWindow* parent, Element* element)
45 {
46  LimiterForm* limiter = new LimiterForm(parent, this);
47  if(limiter->ShowModal() == wxID_OK) {
48  limiter->Destroy();
49  return true;
50  }
51  limiter->Destroy();
52  return false;
53 }
54 
55 void Limiter::Rotate(bool clockwise)
56 {
57  if(clockwise)
58  m_angle += 90.0;
59  else
60  m_angle -= 90.0;
61  if(m_angle >= 360.0)
62  m_angle = 0.0;
63  else if(m_angle < 0)
64  m_angle = 270.0;
65 
66  UpdatePoints();
67 
68  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
69  Node* node = *it;
70  node->Rotate(clockwise);
71  }
72 }
73 
74 void Limiter::UpdatePoints()
75 {
76  if(m_angle == 0.0) {
77  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
78  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(18, 0));
79  } else if(m_angle == 90.0) {
80  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -18));
81  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, 18));
82  } else if(m_angle == 180.0) {
83  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(18, 0));
84  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
85  } else if(m_angle == 270.0) {
86  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, 18));
87  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -18));
88  }
89 }
90 
91 bool Limiter::Solve(double input, double timeStep)
92 {
93  m_output = input;
94  if(m_output > m_upLimit) m_output = m_upLimit;
95  else if(m_output < m_lowLimit) m_output = m_lowLimit;
96 
97  return true;
98 }
99 
101 {
102  Limiter* copy = new Limiter(m_elementID);
103  *copy = *this;
104  return copy;
105 }
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Limiter.cpp:17
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Limiter.cpp:100
- - -
Definition: Limiter.h:8
- -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Limiter.cpp:55
- -
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Limiter.cpp:44
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Limiter.h"
19 #include "LimiterForm.h"
20 
21 Limiter::Limiter(int id) : ControlElement(id)
22 {
23  m_width = m_height = 36.0;
24  Node* nodeIn = new Node(m_position + wxPoint2DDouble(-18, 0), Node::NODE_IN, m_borderSize);
25  nodeIn->StartMove(m_position);
26  Node* nodeOut = new Node(m_position + wxPoint2DDouble(18, 0), Node::NODE_OUT, m_borderSize);
27  nodeOut->SetAngle(180.0);
28  nodeOut->StartMove(m_position);
29  m_nodeList.push_back(nodeIn);
30  m_nodeList.push_back(nodeOut);
31 }
32 
33 Limiter::~Limiter() {}
34 void Limiter::Draw(wxPoint2DDouble translation, double scale) const
35 {
36  glLineWidth(1.0);
37  if(m_selected) {
38  glColor4dv(m_selectionColour.GetRGBA());
39  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
40  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
41  }
42  glColor4d(1.0, 1.0, 1.0, 1.0);
43  DrawRectangle(m_position, m_width, m_height);
44  glColor4d(0.0, 0.0, 0.0, 1.0);
45  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
46 
47  // Plot symbol.
48  glLineWidth(2.0);
49  std::vector<wxPoint2DDouble> limSymbol;
50  limSymbol.push_back(m_position + wxPoint2DDouble(10, -10));
51  limSymbol.push_back(m_position + wxPoint2DDouble(2, -10));
52  limSymbol.push_back(m_position + wxPoint2DDouble(-2, 10));
53  limSymbol.push_back(m_position + wxPoint2DDouble(-10, 10));
54  glColor4d(0.0, 0.3, 1.0, 1.0);
55  DrawLine(limSymbol);
56 
57  glColor4d(0.0, 0.0, 0.0, 1.0);
58  DrawNodes();
59 }
60 
61 bool Limiter::ShowForm(wxWindow* parent, Element* element)
62 {
63  LimiterForm* limiter = new LimiterForm(parent, this);
64  if(limiter->ShowModal() == wxID_OK) {
65  limiter->Destroy();
66  return true;
67  }
68  limiter->Destroy();
69  return false;
70 }
71 
72 void Limiter::Rotate(bool clockwise)
73 {
74  if(clockwise)
75  m_angle += 90.0;
76  else
77  m_angle -= 90.0;
78  if(m_angle >= 360.0)
79  m_angle = 0.0;
80  else if(m_angle < 0)
81  m_angle = 270.0;
82 
83  UpdatePoints();
84 
85  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
86  Node* node = *it;
87  node->Rotate(clockwise);
88  }
89 }
90 
91 void Limiter::UpdatePoints()
92 {
93  if(m_angle == 0.0) {
94  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
95  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(18, 0));
96  } else if(m_angle == 90.0) {
97  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -18));
98  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, 18));
99  } else if(m_angle == 180.0) {
100  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(18, 0));
101  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
102  } else if(m_angle == 270.0) {
103  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, 18));
104  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -18));
105  }
106 }
107 
108 bool Limiter::Solve(double input, double timeStep)
109 {
110  m_output = input;
111  if(m_output > m_upLimit)
112  m_output = m_upLimit;
113  else if(m_output < m_lowLimit)
114  m_output = m_lowLimit;
115 
116  return true;
117 }
118 
120 {
121  Limiter* copy = new Limiter(m_elementID);
122  *copy = *this;
123  return copy;
124 }
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Limiter.cpp:34
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Limiter.cpp:119
+ +
Node of a control element. This class manages the user interaction with the connection and control el...
+
Limits the input value by superior and inferior values.
Definition: Limiter.h:32
+
Form to edit the limit control data.
Definition: LimiterForm.h:31
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Limiter.cpp:72
+ + + +
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Limiter.cpp:61
diff --git a/docs/doxygen/html/_limiter_8h.html b/docs/doxygen/html/_limiter_8h.html new file mode 100644 index 0000000..41e6b15 --- /dev/null +++ b/docs/doxygen/html/_limiter_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/Limiter.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
Limiter.h File Reference
+
+
+
#include "ControlElement.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  Limiter
 Limits the input value by superior and inferior values. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_limiter_8h_source.html b/docs/doxygen/html/_limiter_8h_source.html index 48280f2..4373c00 100644 --- a/docs/doxygen/html/_limiter_8h_source.html +++ b/docs/doxygen/html/_limiter_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,22 +88,23 @@ $(document).ready(function(){initNavTree('_limiter_8h_source.html','');});
Limiter.h
-
1 #ifndef LIMITER_H
2 #define LIMITER_H
3 
4 #include "ControlElement.h"
5 
6 class LimiterForm;
7 
8 class Limiter : public ControlElement
9 {
10 public:
11  Limiter(int id);
12  ~Limiter();
13 
14  virtual void Draw(wxPoint2DDouble translation, double scale) const;
15  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
16  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
17  virtual bool ShowForm(wxWindow* parent, Element* element);
18  virtual void Rotate(bool clockwise = true);
19  virtual bool Solve(double input, double timeStep);
20 
21  virtual void UpdatePoints();
22 
23  double GetUpLimit() const { return m_upLimit; }
24  double GetLowLimit() const { return m_lowLimit; }
25 
26  void SetUpLimit(double upLimit) { m_upLimit = upLimit; }
27  void SetLowLimit(double lowLimit) { m_lowLimit = lowLimit; }
28 
29  virtual Element* GetCopy();
30 
31 protected:
32  double m_upLimit = 5.0;
33  double m_lowLimit = -5.0;
34 };
35 
36 #endif // LIMITER_H
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Limiter.cpp:17
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Limiter.cpp:100
- -
Definition: Limiter.h:8
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Limiter.h:15
- -
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Limiter.h:16
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Limiter.cpp:55
- -
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Limiter.cpp:44
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef LIMITER_H
19 #define LIMITER_H
20 
21 #include "ControlElement.h"
22 
23 class LimiterForm;
24 
32 class Limiter : public ControlElement
33 {
34  public:
35  Limiter(int id);
36  ~Limiter();
37 
38  virtual void Draw(wxPoint2DDouble translation, double scale) const;
39  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
40  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
41  virtual bool ShowForm(wxWindow* parent, Element* element);
42  virtual void Rotate(bool clockwise = true);
43  virtual bool Solve(double input, double timeStep);
44 
45  virtual void UpdatePoints();
46 
47  double GetUpLimit() const { return m_upLimit; }
48  double GetLowLimit() const { return m_lowLimit; }
49  void SetUpLimit(double upLimit) { m_upLimit = upLimit; }
50  void SetLowLimit(double lowLimit) { m_lowLimit = lowLimit; }
51  virtual Element* GetCopy();
52 
53  protected:
54  double m_upLimit = 5.0;
55  double m_lowLimit = -5.0;
56 };
57 
58 #endif // LIMITER_H
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Limiter.cpp:34
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Limiter.cpp:119
+ +
Limits the input value by superior and inferior values.
Definition: Limiter.h:32
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Limiter.h:39
+
Form to edit the limit control data.
Definition: LimiterForm.h:31
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Limiter.h:40
+
Base class of a control element. Provide general methods to other control classes.
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Limiter.cpp:72
+ +
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Limiter.cpp:61
-
1 #include "LimiterForm.h"
2 #include "Limiter.h"
3 
4 LimiterForm::LimiterForm(wxWindow* parent, Limiter* limiter) : LimiterFormBase(parent)
5 {
6  SetSize(GetBestSize());
7 
8  m_limiter = limiter;
9  m_parent = parent;
10 
11  m_textCtrlUpLimit->SetValue(m_limiter->StringFromDouble(m_limiter->GetUpLimit()));
12  m_textCtrlLowLimit->SetValue(m_limiter->StringFromDouble(m_limiter->GetLowLimit()));
13 }
14 
15 LimiterForm::~LimiterForm() {}
16 void LimiterForm::OnOKButtonClick(wxCommandEvent& event)
17 {
18  if(ValidateData()) EndModal(wxID_OK);
19 }
20 
21 bool LimiterForm::ValidateData()
22 {
23  double upLimit;
24  double lowLimit;
25 
26  if(!m_limiter->DoubleFromString(this, m_textCtrlUpLimit->GetValue(), upLimit,
27  _("Value entered incorrectly in the field \"Upper limit\".")))
28  return false;
29  if(!m_limiter->DoubleFromString(this, m_textCtrlLowLimit->GetValue(), lowLimit,
30  _("Value entered incorrectly in the field \"Lower limit\".")))
31  return false;
32 
33  m_limiter->SetUpLimit(upLimit);
34  m_limiter->SetLowLimit(lowLimit);
35  return true;
36 }
Definition: Limiter.h:8
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "LimiterForm.h"
19 #include "Limiter.h"
20 
21 LimiterForm::LimiterForm(wxWindow* parent, Limiter* limiter) : LimiterFormBase(parent)
22 {
23  SetSize(GetBestSize());
24 
25  m_limiter = limiter;
26  m_parent = parent;
27 
28  m_textCtrlUpLimit->SetValue(m_limiter->StringFromDouble(m_limiter->GetUpLimit()));
29  m_textCtrlLowLimit->SetValue(m_limiter->StringFromDouble(m_limiter->GetLowLimit()));
30 }
31 
32 LimiterForm::~LimiterForm() {}
33 void LimiterForm::OnOKButtonClick(wxCommandEvent& event)
34 {
35  if(ValidateData()) EndModal(wxID_OK);
36 }
37 
38 bool LimiterForm::ValidateData()
39 {
40  double upLimit;
41  double lowLimit;
42 
43  if(!m_limiter->DoubleFromString(this, m_textCtrlUpLimit->GetValue(), upLimit,
44  _("Value entered incorrectly in the field \"Upper limit\".")))
45  return false;
46  if(!m_limiter->DoubleFromString(this, m_textCtrlLowLimit->GetValue(), lowLimit,
47  _("Value entered incorrectly in the field \"Lower limit\".")))
48  return false;
49 
50  m_limiter->SetUpLimit(upLimit);
51  m_limiter->SetLowLimit(lowLimit);
52  return true;
53 }
Limits the input value by superior and inferior values.
Definition: Limiter.h:32
+ +
diff --git a/docs/doxygen/html/_limiter_form_8h.html b/docs/doxygen/html/_limiter_form_8h.html new file mode 100644 index 0000000..cca1910 --- /dev/null +++ b/docs/doxygen/html/_limiter_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/LimiterForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
LimiterForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  LimiterForm
 Form to edit the limit control data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_limiter_form_8h_source.html b/docs/doxygen/html/_limiter_form_8h_source.html index b79f2ed..e5f60e9 100644 --- a/docs/doxygen/html/_limiter_form_8h_source.html +++ b/docs/doxygen/html/_limiter_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_limiter_form_8h_source.html','');});
LimiterForm.h
-
1 #ifndef LIMITERFORM_H
2 #define LIMITERFORM_H
3 #include "ElementForm.h"
4 
5 class Limiter;
6 
8 {
9  public:
10  LimiterForm(wxWindow* parent, Limiter* limiter);
11  virtual ~LimiterForm();
12  virtual bool ValidateData();
13 
14  protected:
15  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
16  virtual void OnOKButtonClick(wxCommandEvent& event);
17 
18  wxWindow* m_parent = NULL;
19  Limiter* m_limiter = NULL;
20 };
21 #endif // LIMITERFORM_H
Definition: Limiter.h:8
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef LIMITERFORM_H
19 #define LIMITERFORM_H
20 #include "ElementForm.h"
21 
22 class Limiter;
23 
32 {
33  public:
34  LimiterForm(wxWindow* parent, Limiter* limiter);
35  virtual ~LimiterForm();
36  virtual bool ValidateData();
37 
38  protected:
39  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
40  virtual void OnOKButtonClick(wxCommandEvent& event);
41 
42  wxWindow* m_parent = NULL;
43  Limiter* m_limiter = NULL;
44 };
45 #endif // LIMITERFORM_H
Limits the input value by superior and inferior values.
Definition: Limiter.h:32
- +
Form to edit the limit control data.
Definition: LimiterForm.h:31
-
1 #include "Line.h"
2 
3 Line::Line() : Branch()
4 {
5  for(int i = 0; i < 2; i++) {
6  for(int j = 0; j < 3; j++) {
7  m_electricalData.faultCurrent[i][j] = std::complex<double>(0.0, 0.0);
8  }
9  }
10 }
11 
12 Line::Line(wxString name) : Branch()
13 {
14  for(int i = 0; i < 2; i++) {
15  for(int j = 0; j < 3; j++) {
16  m_electricalData.faultCurrent[i][j] = std::complex<double>(0.0, 0.0);
17  }
18  }
19  m_electricalData.name = name;
20 }
21 Line::~Line() {}
22 bool Line::Contains(wxPoint2DDouble position) const
23 {
24  if(PointToLineDistance(position) < 5.0) {
25  return true;
26  }
27  return false;
28 }
29 
30 void Line::Draw(wxPoint2DDouble translation, double scale) const
31 {
32  OpenGLColour elementColour;
33  if(m_online) {
34  if(m_dynEvent)
35  elementColour = m_dynamicEventColour;
36  else
37  elementColour = m_onlineElementColour;
38 
39  } else
40  elementColour = m_offlineElementColour;
41 
42  std::vector<wxPoint2DDouble> pointList = m_pointList;
43  if(!m_inserted && pointList.size() > 0) {
44  wxPoint2DDouble secondPoint = m_position;
45  if(pointList.size() > 2) {
46  secondPoint = pointList[2];
47  }
48  pointList[1] = GetSwitchPoint(m_parentList[0], pointList[0], secondPoint);
49  pointList.push_back(m_position);
50  }
51 
52  // Line selected (Layer 1).
53  if(m_selected) {
54  glLineWidth(1.5 + m_borderSize * 2.0);
55  glColor4dv(m_selectionColour.GetRGBA());
56  DrawLine(pointList);
57 
58  // Draw nodes selection.
59  if(pointList.size() > 0) {
60  DrawCircle(pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
61  if(m_inserted) {
62  DrawCircle(pointList[pointList.size() - 1], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
63  }
64  }
65  }
66 
67  // Draw line (Layer 2)
68  glLineWidth(1.5);
69  glColor4dv(elementColour.GetRGBA());
70  DrawLine(pointList);
71 
72  if(m_inserted) {
73  DrawSwitches();
74  DrawPowerFlowPts();
75  }
76 
77  // Draw nodes.
78  if(pointList.size() > 0) {
79  glColor4dv(elementColour.GetRGBA());
80  DrawCircle(pointList[0], 5.0, 10, GL_POLYGON);
81  if(m_inserted) {
82  DrawCircle(pointList[pointList.size() - 1], 5.0, 10, GL_POLYGON);
83  }
84  }
85 
86  // Draw pickboxes (Layer 3).
87  if(m_showPickbox) {
88  glPushMatrix();
89  glLoadIdentity();
90 
91  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
92  DrawPickbox(WorldToScreen(m_pointList[i], translation, scale));
93  }
94 
95  glPopMatrix();
96  }
97 }
98 
99 void Line::Move(wxPoint2DDouble position)
100 {
101  if(!m_parentList[0]) {
102  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
103  UpdateSwitchesPosition();
104  UpdatePowerFlowArrowsPosition();
105  }
106  if(!m_parentList[1]) {
107  m_pointList[m_pointList.size() - 1] = m_movePts[m_pointList.size() - 1] + position - m_moveStartPt;
108  UpdateSwitchesPosition();
109  UpdatePowerFlowArrowsPosition();
110  }
111 
112  if(!m_parentList[0] && !m_parentList[1]) {
113  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
114  m_pointList[i] = m_movePts[i] + position - m_moveStartPt;
115  }
116  }
117 }
118 
119 bool Line::AddParent(Element* parent, wxPoint2DDouble position)
120 {
121  if(parent) {
122  // First bus.
123  if(m_parentList.size() == 0) {
124  m_position = position;
125  m_parentList.push_back(parent);
126  parent->AddChild(this);
127  wxPoint2DDouble parentPt =
128  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
129  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
130  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
131  m_pointList.push_back(parentPt); // First point
132  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
133 
134  wxRect2DDouble genRect(0, 0, 0, 0);
135  m_switchRect.push_back(genRect);
136  UpdateSwitches();
137 
138  Bus* parentBus = static_cast<Bus*>(parent);
139  m_electricalData.nominalVoltage = parentBus->GetElectricalData().nominalVoltage;
140  m_electricalData.nominalVoltageUnit = parentBus->GetElectricalData().nominalVoltageUnit;
141 
142  return false;
143  }
144  // Second bus.
145  else if(parent != m_parentList[0]) {
146  Bus* parentBus = static_cast<Bus*>(parent);
147  if(m_electricalData.nominalVoltage != parentBus->GetElectricalData().nominalVoltage ||
148  m_electricalData.nominalVoltageUnit != parentBus->GetElectricalData().nominalVoltageUnit) {
149  wxMessageDialog msgDialog(NULL, _("Unable to connect two buses with different nominal voltages.\n"
150  "Use a transformer or edit the bus properties."),
151  _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
152  msgDialog.ShowModal();
153  return false;
154  }
155 
156  m_parentList.push_back(parent);
157  parent->AddChild(this);
158  wxPoint2DDouble parentPt =
159  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
160  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
161  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
162 
163  // Set first switch point.
164  wxPoint2DDouble secondPoint = parentPt;
165  if(m_pointList.size() > 2) {
166  secondPoint = m_pointList[2];
167  }
168  m_pointList[1] = GetSwitchPoint(m_parentList[0], m_pointList[0], secondPoint);
169 
170  // Set the second switch point.
171  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_pointList[m_pointList.size() - 1]));
172 
173  m_pointList.push_back(parentPt); // Last point.
174 
175  wxRect2DDouble genRect(0, 0, 0, 0);
176  m_switchRect.push_back(genRect);
177  UpdateSwitches();
178 
179  m_inserted = true;
180  UpdatePowerFlowArrowsPosition();
181  return true;
182  }
183  }
184  return false;
185 }
186 bool Line::Intersects(wxRect2DDouble rect) const
187 {
188  for(auto it = m_pointList.begin(); it != m_pointList.end(); ++it) {
189  if(rect.Contains(*it)) return true;
190  }
191  return false;
192 }
193 void Line::MovePickbox(wxPoint2DDouble position)
194 {
195  if(m_activePickboxID == ID_PB_NONE) return;
196 
197  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
198  if(m_activePickboxID == i) {
199  m_pointList[i] = m_movePts[i] + position - m_moveStartPt;
200  UpdateSwitchesPosition();
201  UpdatePowerFlowArrowsPosition();
202  }
203  }
204 }
205 bool Line::PickboxContains(wxPoint2DDouble position)
206 {
207  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
208  wxRect2DDouble rect(m_pointList[i].m_x - 5.0, m_pointList[i].m_y - 5.0, 10.0, 10.0);
209  if(rect.Contains(position)) {
210  m_activePickboxID = i;
211  return true;
212  }
213  }
214  return false;
215 }
216 
217 void Line::AddPoint(wxPoint2DDouble point)
218 {
219  if(m_parentList.size() != 0) {
220  m_pointList.push_back(point);
221  }
222 }
223 
224 void Line::StartMove(wxPoint2DDouble position)
225 {
226  m_moveStartPt = position;
227  m_movePts = m_pointList;
228 }
229 
230 void Line::MoveNode(Element* parent, wxPoint2DDouble position)
231 {
232  if(parent) {
233  // First bus.
234  if(parent == m_parentList[0]) {
235  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
236  }
237  // Second bus.
238  else if(parent == m_parentList[1]) {
239  m_pointList[m_pointList.size() - 1] = m_movePts[m_pointList.size() - 1] + position - m_moveStartPt;
240  }
241 
242  // If the line is selected, move all the points, except the switches and buses points.
243  if(m_selected) {
244  for(int i = 2; i < (int)m_pointList.size() - 1; i++) {
245  m_pointList[i] = m_movePts[i] + position - m_moveStartPt;
246  }
247  }
248  } else {
249  // If parent is setted to NULL for the firts time, remove the parent child
250  if(m_activeNodeID == 1) {
251  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
252  if(m_parentList[0]) {
253  m_parentList[0]->RemoveChild(this);
254  m_parentList[0] = NULL;
255  m_online = false;
256  }
257  } else if(m_activeNodeID == 2) {
258  m_pointList[m_pointList.size() - 1] = m_movePts[m_pointList.size() - 1] + position - m_moveStartPt;
259  if(m_parentList[1]) {
260  m_parentList[1]->RemoveChild(this);
261  m_parentList[1] = NULL;
262  m_online = false;
263  }
264  }
265  }
266 
267  // Recalculate switches positions
268  UpdateSwitchesPosition();
269  UpdatePowerFlowArrowsPosition();
270 }
271 
272 bool Line::GetContextMenu(wxMenu& menu)
273 {
274  menu.Append(ID_EDIT_ELEMENT, _("Edit line"));
275  if(m_activePickboxID == ID_PB_NONE) {
276  wxMenuItem* addNodeItem = new wxMenuItem(&menu, ID_LINE_ADD_NODE, _("Insert node"));
277  addNodeItem->SetBitmap(wxImage("..\\data\\images\\menu\\addNode16.png"));
278  menu.Append(addNodeItem);
279  } else {
280  wxMenuItem* addNodeItem = new wxMenuItem(&menu, ID_LINE_REMOVE_NODE, _("Remove node"));
281  addNodeItem->SetBitmap(wxImage("..\\data\\images\\menu\\removeNode16.png"));
282  menu.Append(addNodeItem);
283  }
284  wxMenuItem* deleteItem = new wxMenuItem(&menu, ID_DELETE, _("Delete"));
285  deleteItem->SetBitmap(wxImage("..\\data\\images\\menu\\delete16.png"));
286  menu.Append(deleteItem);
287  return true;
288 }
289 
290 void Line::RemoveNode(wxPoint2DDouble point)
291 {
292  if(PickboxContains(point)) {
293  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
294  if(m_activePickboxID == i) {
295  m_pointList.erase(m_pointList.begin() + i);
296  break;
297  }
298  }
299  }
300  UpdateSwitchesPosition();
301  UpdatePowerFlowArrowsPosition();
302 }
303 
304 void Line::AddNode(wxPoint2DDouble point)
305 {
306  int segmentNumber = 0;
307  PointToLineDistance(point, &segmentNumber);
308  if(segmentNumber > 0 && segmentNumber < (int)m_pointList.size() - 2) {
309  m_pointList.insert(m_pointList.begin() + segmentNumber + 1, point);
310  }
311  UpdateSwitchesPosition();
312  UpdatePowerFlowArrowsPosition();
313 }
314 
315 void Line::CalculateBoundaries(wxPoint2DDouble& leftUp, wxPoint2DDouble& rightBottom) const
316 {
317  if(m_pointList.size() > 0) {
318  // Check points list boundaries.
319  leftUp = m_pointList[0];
320  rightBottom = m_pointList[0];
321  for(int i = 1; i < (int)m_pointList.size(); i++) {
322  if(m_pointList[i].m_x < leftUp.m_x) leftUp.m_x = m_pointList[i].m_x;
323  if(m_pointList[i].m_y < leftUp.m_y) leftUp.m_y = m_pointList[i].m_y;
324  if(m_pointList[i].m_x > rightBottom.m_x) rightBottom.m_x = m_pointList[i].m_x;
325  if(m_pointList[i].m_y > rightBottom.m_y) rightBottom.m_y = m_pointList[i].m_y;
326  }
327  }
328 }
329 
330 bool Line::ShowForm(wxWindow* parent, Element* element)
331 {
332  LineForm* lineForm = new LineForm(parent, this);
333  if(lineForm->ShowModal() == wxID_OK) {
334  lineForm->Destroy();
335  return true;
336  }
337  lineForm->Destroy();
338  return false;
339 }
340 
341 void Line::SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit)
342 {
343  if(nominalVoltage.size() > 0) {
344  m_electricalData.nominalVoltage = nominalVoltage[0];
345  m_electricalData.nominalVoltageUnit = nominalVoltageUnit[0];
346  }
347 }
348 
350 {
351  if(m_activeNodeID == 1 && parent == m_parentList[0]) return false;
352  if(m_activeNodeID == 2 && parent == m_parentList[1]) return false;
353 
354  if(parent && m_activeNodeID != 0) {
355  wxRect2DDouble nodeRect(0, 0, 0, 0);
356  if(m_activeNodeID == 1) {
357  nodeRect = wxRect2DDouble(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
358  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
359  }
360  if(m_activeNodeID == 2) {
361  nodeRect = wxRect2DDouble(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize,
362  m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize,
363  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
364  }
365 
366  if(parent->Intersects(nodeRect)) {
367  // If the line has no parents set the new rated voltage, otherwise check if it's not connecting
368  // two different voltages buses
369  Bus* parentBus = static_cast<Bus*>(parent);
370  if(!m_parentList[0] && !m_parentList[1]) {
371  m_electricalData.nominalVoltage = parentBus->GetElectricalData().nominalVoltage;
372  m_electricalData.nominalVoltageUnit = parentBus->GetElectricalData().nominalVoltageUnit;
373  } else if(m_electricalData.nominalVoltage != parentBus->GetElectricalData().nominalVoltage ||
374  m_electricalData.nominalVoltageUnit != parentBus->GetElectricalData().nominalVoltageUnit) {
375  wxMessageDialog msgDialog(NULL, _("Unable to connect two buses with different nominal voltages.\n"
376  "Use a transformer or edit the bus properties."),
377  _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
378  msgDialog.ShowModal();
379  m_activeNodeID = 0;
380  return false;
381  }
382 
383  if(m_activeNodeID == 1) {
384  // Check if the user is trying to connect the same bus.
385  if(m_parentList[1] == parent) {
386  m_activeNodeID = 0;
387  return false;
388  }
389 
390  m_parentList[0] = parent;
391 
392  // Centralize the node on bus.
393  wxPoint2DDouble parentPt = parent->RotateAtPosition(
394  m_pointList[0], -parent->GetAngle()); // Rotate click to horizontal position.
395  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
396  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
397  m_pointList[0] = parentPt;
398 
399  UpdateSwitchesPosition();
400  UpdatePowerFlowArrowsPosition();
401  return true;
402  }
403  if(m_activeNodeID == 2) {
404  if(m_parentList[0] == parent) {
405  m_activeNodeID = 0;
406  return false;
407  }
408 
409  m_parentList[1] = parent;
410 
411  wxPoint2DDouble parentPt =
412  parent->RotateAtPosition(m_pointList[m_pointList.size() - 1], -parent->GetAngle());
413  parentPt.m_y = parent->GetPosition().m_y;
414  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
415  m_pointList[m_pointList.size() - 1] = parentPt;
416 
417  UpdateSwitchesPosition();
418  UpdatePowerFlowArrowsPosition();
419  return true;
420  }
421  } else {
422  if(m_activeNodeID == 1) m_parentList[0] = NULL;
423  if(m_activeNodeID == 2) m_parentList[1] = NULL;
424  }
425  }
426  return false;
427 }
428 
430 {
431  m_pfDirection = pfDirection;
432  UpdatePowerFlowArrowsPosition();
433 }
434 
435 void Line::UpdatePowerFlowArrowsPosition()
436 {
437  std::vector<wxPoint2DDouble> edges;
438  switch(m_pfDirection) {
439  case PF_NONE: {
440  m_powerFlowArrow.clear();
441  } break;
442  case PF_BUS1_TO_BUS2: {
443  for(int i = 1; i < (int)m_pointList.size() - 1; i++) {
444  edges.push_back(m_pointList[i]);
445  }
446  } break;
447  case PF_BUS2_TO_BUS1: {
448  for(int i = (int)m_pointList.size() - 2; i > 0; i--) {
449  edges.push_back(m_pointList[i]);
450  }
451  } break;
452  default:
453  break;
454  }
455  CalculatePowerFlowPts(edges);
456 }
457 
458 void Line::RotateNode(Element* parent, bool clockwise)
459 {
460  double rotAngle = m_rotationAngle;
461  if(!clockwise) rotAngle = -m_rotationAngle;
462 
463  if(parent == m_parentList[0]) {
464  m_pointList[0] = parent->RotateAtPosition(m_pointList[0], rotAngle);
465  } else if(parent == m_parentList[1]) {
466  m_pointList[m_pointList.size() - 1] = parent->RotateAtPosition(m_pointList[m_pointList.size() - 1], rotAngle);
467  }
468  UpdateSwitchesPosition();
469  UpdatePowerFlowArrowsPosition();
470 }
471 
472 void Line::SetPointList(std::vector<wxPoint2DDouble> pointList)
473 {
474  m_pointList = pointList;
475  UpdateSwitchesPosition();
476  UpdatePowerFlowArrowsPosition();
477 }
478 
480 {
481  Line* copy = new Line();
482  *copy = *this;
483  return copy;
484 }
485 
486 wxString Line::GetTipText() const
487 {
488  wxString tipText = m_electricalData.name;
489 
490  if(m_online) {
491  tipText += "\n";
492  int busNumber[2];
493  busNumber[0] = static_cast<Bus*>(m_parentList[0])->GetElectricalData().number + 1;
494  busNumber[1] = static_cast<Bus*>(m_parentList[1])->GetElectricalData().number + 1;
495 
496  tipText += _("\nP") + wxString::Format("(%d-%d) = ", busNumber[0], busNumber[1]) +
497  wxString::FromDouble(m_electricalData.powerFlow[0].real(), 5) + _(" p.u.");
498  tipText += _("\nQ") + wxString::Format("(%d-%d) = ", busNumber[0], busNumber[1]) +
499  wxString::FromDouble(m_electricalData.powerFlow[0].imag(), 5) + _(" p.u.");
500  tipText += _("\nP") + wxString::Format("(%d-%d) = ", busNumber[1], busNumber[0]) +
501  wxString::FromDouble(m_electricalData.powerFlow[1].real(), 5) + _(" p.u.");
502  tipText += _("\nQ") + wxString::Format("(%d-%d) = ", busNumber[1], busNumber[0]) +
503  wxString::FromDouble(m_electricalData.powerFlow[1].imag(), 5) + _(" p.u.");
504  }
505 
506  return tipText;
507 }
508 
509 LineElectricalData Line::GetPUElectricalData(double systemBasePower)
510 {
511  LineElectricalData data = m_electricalData;
512  double lineBasePower = GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
513  double baseVoltage = GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
514  double systemBaseImpedance = (baseVoltage * baseVoltage) / systemBasePower;
515  double lineBaseImpedance = (baseVoltage * baseVoltage) / lineBasePower;
516 
517  // Resistance
518  double r = data.resistance;
519  if(data.resistanceUnit == UNIT_OHM_km) r *= data.lineSize;
520  if(data.resistanceUnit == UNIT_PU) {
521  if(data.useLinePower) data.resistance = (r * lineBaseImpedance) / systemBaseImpedance;
522  } else {
523  data.resistance = r / systemBaseImpedance;
524  }
525  data.resistanceUnit = UNIT_PU;
526 
527  // Inductive reactance
528  double x = data.indReactance;
529  if(data.indReactanceUnit == UNIT_OHM_km) x *= data.lineSize;
530  if(data.indReactanceUnit == UNIT_PU) {
531  if(data.useLinePower) data.indReactance = (x * lineBaseImpedance) / systemBaseImpedance;
532  } else {
533  data.indReactance = x / systemBaseImpedance;
534  }
535  data.indReactanceUnit = UNIT_PU;
536 
537  // Capacitive susceptance
538  double b = data.capSusceptance;
539  if(data.capSusceptanceUnit == UNIT_OHM_km) b *= data.lineSize;
540  if(data.capSusceptanceUnit == UNIT_PU) {
541  if(data.useLinePower) data.capSusceptance = (b * lineBaseImpedance) / systemBaseImpedance;
542  } else {
543  data.capSusceptance = b / systemBaseImpedance;
544  }
545  data.capSusceptanceUnit = UNIT_PU;
546 
547  // Fault
548 
549  // Zero seq. resistance
550  double r0 = data.zeroResistance;
551  if(data.useLinePower) data.zeroResistance = (r0 * lineBaseImpedance) / systemBaseImpedance;
552 
553  // Zero seq. ind. reactance
554  double x0 = data.zeroIndReactance;
555  if(data.useLinePower) data.zeroIndReactance = (x0 * lineBaseImpedance) / systemBaseImpedance;
556 
557  // Zero seq. cap. susceptance
558  double b0 = data.zeroCapSusceptance;
559  if(data.useLinePower) data.zeroCapSusceptance = (b0 * lineBaseImpedance) / systemBaseImpedance;
560 
561  if(!m_online) {
562  data.powerFlow[0] = std::complex<double>(0,0);
563  data.powerFlow[1] = std::complex<double>(0,0);
564  data.faultCurrent[0][0] = std::complex<double>(0,0);
565  data.faultCurrent[0][1] = std::complex<double>(0,0);
566  data.faultCurrent[0][2] = std::complex<double>(0,0);
567  data.faultCurrent[1][0] = std::complex<double>(0,0);
568  data.faultCurrent[1][1] = std::complex<double>(0,0);
569  data.faultCurrent[1][2] = std::complex<double>(0,0);
570  }
571 
572  return data;
573 }
double GetAngle() const
Get the element angle.
Definition: Element.h:201
- -
virtual void MovePickbox(wxPoint2DDouble position)
Move the pickbox.
Definition: Line.cpp:193
- - -
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Line.cpp:224
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Line.cpp:22
-
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Line.cpp:349
-
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:91
-
virtual void MoveNode(Element *parent, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Line.cpp:230
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Line.h"
19 
20 Line::Line() : Branch()
21 {
22  for(int i = 0; i < 2; i++) {
23  for(int j = 0; j < 3; j++) {
24  m_electricalData.faultCurrent[i][j] = std::complex<double>(0.0, 0.0);
25  }
26  }
27 }
28 
29 Line::Line(wxString name) : Branch()
30 {
31  for(int i = 0; i < 2; i++) {
32  for(int j = 0; j < 3; j++) {
33  m_electricalData.faultCurrent[i][j] = std::complex<double>(0.0, 0.0);
34  }
35  }
36  m_electricalData.name = name;
37 }
38 Line::~Line() {}
39 bool Line::Contains(wxPoint2DDouble position) const
40 {
41  if(PointToLineDistance(position) < 5.0) {
42  return true;
43  }
44  return false;
45 }
46 
47 void Line::Draw(wxPoint2DDouble translation, double scale) const
48 {
49  OpenGLColour elementColour;
50  if(m_online) {
51  if(m_dynEvent)
52  elementColour = m_dynamicEventColour;
53  else
54  elementColour = m_onlineElementColour;
55 
56  } else
57  elementColour = m_offlineElementColour;
58 
59  std::vector<wxPoint2DDouble> pointList = m_pointList;
60  if(!m_inserted && pointList.size() > 0) {
61  wxPoint2DDouble secondPoint = m_position;
62  if(pointList.size() > 2) {
63  secondPoint = pointList[2];
64  }
65  pointList[1] = GetSwitchPoint(m_parentList[0], pointList[0], secondPoint);
66  pointList.push_back(m_position);
67  }
68 
69  // Line selected (Layer 1).
70  if(m_selected) {
71  glLineWidth(1.5 + m_borderSize * 2.0);
72  glColor4dv(m_selectionColour.GetRGBA());
73  DrawLine(pointList);
74 
75  // Draw nodes selection.
76  if(pointList.size() > 0) {
77  DrawCircle(pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
78  if(m_inserted) {
79  DrawCircle(pointList[pointList.size() - 1], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
80  }
81  }
82  }
83 
84  // Draw line (Layer 2)
85  glLineWidth(1.5);
86  glColor4dv(elementColour.GetRGBA());
87  DrawLine(pointList);
88 
89  if(m_inserted) {
90  DrawSwitches();
91  DrawPowerFlowPts();
92  }
93 
94  // Draw nodes.
95  if(pointList.size() > 0) {
96  glColor4dv(elementColour.GetRGBA());
97  DrawCircle(pointList[0], 5.0, 10, GL_POLYGON);
98  if(m_inserted) {
99  DrawCircle(pointList[pointList.size() - 1], 5.0, 10, GL_POLYGON);
100  }
101  }
102 
103  // Draw pickboxes (Layer 3).
104  if(m_showPickbox) {
105  glPushMatrix();
106  glLoadIdentity();
107 
108  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
109  DrawPickbox(WorldToScreen(m_pointList[i], translation, scale));
110  }
111 
112  glPopMatrix();
113  }
114 }
115 
116 void Line::Move(wxPoint2DDouble position)
117 {
118  if(!m_parentList[0]) {
119  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
120  UpdateSwitchesPosition();
121  UpdatePowerFlowArrowsPosition();
122  }
123  if(!m_parentList[1]) {
124  m_pointList[m_pointList.size() - 1] = m_movePts[m_pointList.size() - 1] + position - m_moveStartPt;
125  UpdateSwitchesPosition();
126  UpdatePowerFlowArrowsPosition();
127  }
128 
129  if(!m_parentList[0] && !m_parentList[1]) {
130  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
131  m_pointList[i] = m_movePts[i] + position - m_moveStartPt;
132  }
133  }
134 }
135 
136 bool Line::AddParent(Element* parent, wxPoint2DDouble position)
137 {
138  if(parent) {
139  // First bus.
140  if(m_parentList.size() == 0) {
141  m_position = position;
142  m_parentList.push_back(parent);
143  parent->AddChild(this);
144  wxPoint2DDouble parentPt =
145  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
146  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
147  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
148  m_pointList.push_back(parentPt); // First point
149  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
150 
151  wxRect2DDouble genRect(0, 0, 0, 0);
152  m_switchRect.push_back(genRect);
153  UpdateSwitches();
154 
155  Bus* parentBus = static_cast<Bus*>(parent);
156  m_electricalData.nominalVoltage = parentBus->GetElectricalData().nominalVoltage;
157  m_electricalData.nominalVoltageUnit = parentBus->GetElectricalData().nominalVoltageUnit;
158 
159  return false;
160  }
161  // Second bus.
162  else if(parent != m_parentList[0]) {
163  Bus* parentBus = static_cast<Bus*>(parent);
164  if(m_electricalData.nominalVoltage != parentBus->GetElectricalData().nominalVoltage ||
165  m_electricalData.nominalVoltageUnit != parentBus->GetElectricalData().nominalVoltageUnit) {
166  wxMessageDialog msgDialog(NULL, _("Unable to connect two buses with different nominal voltages.\n"
167  "Use a transformer or edit the bus properties."),
168  _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
169  msgDialog.ShowModal();
170  return false;
171  }
172 
173  m_parentList.push_back(parent);
174  parent->AddChild(this);
175  wxPoint2DDouble parentPt =
176  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
177  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
178  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
179 
180  // Set first switch point.
181  wxPoint2DDouble secondPoint = parentPt;
182  if(m_pointList.size() > 2) {
183  secondPoint = m_pointList[2];
184  }
185  m_pointList[1] = GetSwitchPoint(m_parentList[0], m_pointList[0], secondPoint);
186 
187  // Set the second switch point.
188  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_pointList[m_pointList.size() - 1]));
189 
190  m_pointList.push_back(parentPt); // Last point.
191 
192  wxRect2DDouble genRect(0, 0, 0, 0);
193  m_switchRect.push_back(genRect);
194  UpdateSwitches();
195 
196  m_inserted = true;
197  UpdatePowerFlowArrowsPosition();
198  return true;
199  }
200  }
201  return false;
202 }
203 bool Line::Intersects(wxRect2DDouble rect) const
204 {
205  for(auto it = m_pointList.begin(); it != m_pointList.end(); ++it) {
206  if(rect.Contains(*it)) return true;
207  }
208  return false;
209 }
210 void Line::MovePickbox(wxPoint2DDouble position)
211 {
212  if(m_activePickboxID == ID_PB_NONE) return;
213 
214  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
215  if(m_activePickboxID == i) {
216  m_pointList[i] = m_movePts[i] + position - m_moveStartPt;
217  UpdateSwitchesPosition();
218  UpdatePowerFlowArrowsPosition();
219  }
220  }
221 }
222 bool Line::PickboxContains(wxPoint2DDouble position)
223 {
224  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
225  wxRect2DDouble rect(m_pointList[i].m_x - 5.0, m_pointList[i].m_y - 5.0, 10.0, 10.0);
226  if(rect.Contains(position)) {
227  m_activePickboxID = i;
228  return true;
229  }
230  }
231  return false;
232 }
233 
234 void Line::AddPoint(wxPoint2DDouble point)
235 {
236  if(m_parentList.size() != 0) {
237  m_pointList.push_back(point);
238  }
239 }
240 
241 void Line::StartMove(wxPoint2DDouble position)
242 {
243  m_moveStartPt = position;
244  m_movePts = m_pointList;
245 }
246 
247 void Line::MoveNode(Element* parent, wxPoint2DDouble position)
248 {
249  if(parent) {
250  // First bus.
251  if(parent == m_parentList[0]) {
252  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
253  }
254  // Second bus.
255  else if(parent == m_parentList[1]) {
256  m_pointList[m_pointList.size() - 1] = m_movePts[m_pointList.size() - 1] + position - m_moveStartPt;
257  }
258 
259  // If the line is selected, move all the points, except the switches and buses points.
260  if(m_selected) {
261  for(int i = 2; i < (int)m_pointList.size() - 1; i++) {
262  m_pointList[i] = m_movePts[i] + position - m_moveStartPt;
263  }
264  }
265  } else {
266  // If parent is setted to NULL for the firts time, remove the parent child
267  if(m_activeNodeID == 1) {
268  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
269  if(m_parentList[0]) {
270  m_parentList[0]->RemoveChild(this);
271  m_parentList[0] = NULL;
272  m_online = false;
273  }
274  } else if(m_activeNodeID == 2) {
275  m_pointList[m_pointList.size() - 1] = m_movePts[m_pointList.size() - 1] + position - m_moveStartPt;
276  if(m_parentList[1]) {
277  m_parentList[1]->RemoveChild(this);
278  m_parentList[1] = NULL;
279  m_online = false;
280  }
281  }
282  }
283 
284  // Recalculate switches positions
285  UpdateSwitchesPosition();
286  UpdatePowerFlowArrowsPosition();
287 }
288 
289 bool Line::GetContextMenu(wxMenu& menu)
290 {
291  wxFileName exeFileName(wxStandardPaths::Get().GetExecutablePath());
292  wxString exePath = exeFileName.GetPath();
293 
294  menu.Append(ID_EDIT_ELEMENT, _("Edit line"));
295  if(m_activePickboxID == ID_PB_NONE) {
296  wxMenuItem* addNodeItem = new wxMenuItem(&menu, ID_LINE_ADD_NODE, _("Insert node"));
297  addNodeItem->SetBitmap(wxImage(exePath + "\\..\\data\\images\\menu\\addNode16.png"));
298  menu.Append(addNodeItem);
299  } else {
300  wxMenuItem* addNodeItem = new wxMenuItem(&menu, ID_LINE_REMOVE_NODE, _("Remove node"));
301  addNodeItem->SetBitmap(wxImage(exePath + "\\..\\data\\images\\menu\\removeNode16.png"));
302  menu.Append(addNodeItem);
303  }
304  wxMenuItem* deleteItem = new wxMenuItem(&menu, ID_DELETE, _("Delete"));
305  deleteItem->SetBitmap(wxImage(exePath + "\\..\\data\\images\\menu\\delete16.png"));
306  menu.Append(deleteItem);
307  return true;
308 }
309 
310 void Line::RemoveNode(wxPoint2DDouble point)
311 {
312  if(PickboxContains(point)) {
313  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
314  if(m_activePickboxID == i) {
315  m_pointList.erase(m_pointList.begin() + i);
316  break;
317  }
318  }
319  }
320  UpdateSwitchesPosition();
321  UpdatePowerFlowArrowsPosition();
322 }
323 
324 void Line::AddNode(wxPoint2DDouble point)
325 {
326  int segmentNumber = 0;
327  PointToLineDistance(point, &segmentNumber);
328  if(segmentNumber > 0 && segmentNumber < (int)m_pointList.size() - 2) {
329  m_pointList.insert(m_pointList.begin() + segmentNumber + 1, point);
330  }
331  UpdateSwitchesPosition();
332  UpdatePowerFlowArrowsPosition();
333 }
334 
335 void Line::CalculateBoundaries(wxPoint2DDouble& leftUp, wxPoint2DDouble& rightBottom) const
336 {
337  if(m_pointList.size() > 0) {
338  // Check points list boundaries.
339  leftUp = m_pointList[0];
340  rightBottom = m_pointList[0];
341  for(int i = 1; i < (int)m_pointList.size(); i++) {
342  if(m_pointList[i].m_x < leftUp.m_x) leftUp.m_x = m_pointList[i].m_x;
343  if(m_pointList[i].m_y < leftUp.m_y) leftUp.m_y = m_pointList[i].m_y;
344  if(m_pointList[i].m_x > rightBottom.m_x) rightBottom.m_x = m_pointList[i].m_x;
345  if(m_pointList[i].m_y > rightBottom.m_y) rightBottom.m_y = m_pointList[i].m_y;
346  }
347  }
348 }
349 
350 bool Line::ShowForm(wxWindow* parent, Element* element)
351 {
352  LineForm* lineForm = new LineForm(parent, this);
353  if(lineForm->ShowModal() == wxID_OK) {
354  lineForm->Destroy();
355  return true;
356  }
357  lineForm->Destroy();
358  return false;
359 }
360 
361 void Line::SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit)
362 {
363  if(nominalVoltage.size() > 0) {
364  m_electricalData.nominalVoltage = nominalVoltage[0];
365  m_electricalData.nominalVoltageUnit = nominalVoltageUnit[0];
366  }
367 }
368 
370 {
371  if(m_activeNodeID == 1 && parent == m_parentList[0]) return false;
372  if(m_activeNodeID == 2 && parent == m_parentList[1]) return false;
373 
374  if(parent && m_activeNodeID != 0) {
375  wxRect2DDouble nodeRect(0, 0, 0, 0);
376  if(m_activeNodeID == 1) {
377  nodeRect = wxRect2DDouble(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
378  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
379  }
380  if(m_activeNodeID == 2) {
381  nodeRect = wxRect2DDouble(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize,
382  m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize,
383  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
384  }
385 
386  if(parent->Intersects(nodeRect)) {
387  // If the line has no parents set the new rated voltage, otherwise check if it's not connecting
388  // two different voltages buses
389  Bus* parentBus = static_cast<Bus*>(parent);
390  if(!m_parentList[0] && !m_parentList[1]) {
391  m_electricalData.nominalVoltage = parentBus->GetElectricalData().nominalVoltage;
392  m_electricalData.nominalVoltageUnit = parentBus->GetElectricalData().nominalVoltageUnit;
393  } else if(m_electricalData.nominalVoltage != parentBus->GetElectricalData().nominalVoltage ||
394  m_electricalData.nominalVoltageUnit != parentBus->GetElectricalData().nominalVoltageUnit) {
395  wxMessageDialog msgDialog(NULL, _("Unable to connect two buses with different nominal voltages.\n"
396  "Use a transformer or edit the bus properties."),
397  _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
398  msgDialog.ShowModal();
399  m_activeNodeID = 0;
400  return false;
401  }
402 
403  if(m_activeNodeID == 1) {
404  // Check if the user is trying to connect the same bus.
405  if(m_parentList[1] == parent) {
406  m_activeNodeID = 0;
407  return false;
408  }
409 
410  m_parentList[0] = parent;
411 
412  // Centralize the node on bus.
413  wxPoint2DDouble parentPt = parent->RotateAtPosition(
414  m_pointList[0], -parent->GetAngle()); // Rotate click to horizontal position.
415  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
416  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
417  m_pointList[0] = parentPt;
418 
419  UpdateSwitchesPosition();
420  UpdatePowerFlowArrowsPosition();
421  return true;
422  }
423  if(m_activeNodeID == 2) {
424  if(m_parentList[0] == parent) {
425  m_activeNodeID = 0;
426  return false;
427  }
428 
429  m_parentList[1] = parent;
430 
431  wxPoint2DDouble parentPt =
432  parent->RotateAtPosition(m_pointList[m_pointList.size() - 1], -parent->GetAngle());
433  parentPt.m_y = parent->GetPosition().m_y;
434  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
435  m_pointList[m_pointList.size() - 1] = parentPt;
436 
437  UpdateSwitchesPosition();
438  UpdatePowerFlowArrowsPosition();
439  return true;
440  }
441  } else {
442  if(m_activeNodeID == 1) m_parentList[0] = NULL;
443  if(m_activeNodeID == 2) m_parentList[1] = NULL;
444  }
445  }
446  return false;
447 }
448 
450 {
451  m_pfDirection = pfDirection;
452  UpdatePowerFlowArrowsPosition();
453 }
454 
455 void Line::UpdatePowerFlowArrowsPosition()
456 {
457  std::vector<wxPoint2DDouble> edges;
458  switch(m_pfDirection) {
459  case PF_NONE: {
460  m_powerFlowArrow.clear();
461  } break;
462  case PF_BUS1_TO_BUS2: {
463  for(int i = 1; i < (int)m_pointList.size() - 1; i++) {
464  edges.push_back(m_pointList[i]);
465  }
466  } break;
467  case PF_BUS2_TO_BUS1: {
468  for(int i = (int)m_pointList.size() - 2; i > 0; i--) {
469  edges.push_back(m_pointList[i]);
470  }
471  } break;
472  default:
473  break;
474  }
475  CalculatePowerFlowPts(edges);
476 }
477 
478 void Line::RotateNode(Element* parent, bool clockwise)
479 {
480  double rotAngle = m_rotationAngle;
481  if(!clockwise) rotAngle = -m_rotationAngle;
482 
483  if(parent == m_parentList[0]) {
484  m_pointList[0] = parent->RotateAtPosition(m_pointList[0], rotAngle);
485  } else if(parent == m_parentList[1]) {
486  m_pointList[m_pointList.size() - 1] = parent->RotateAtPosition(m_pointList[m_pointList.size() - 1], rotAngle);
487  }
488  UpdateSwitchesPosition();
489  UpdatePowerFlowArrowsPosition();
490 }
491 
492 void Line::SetPointList(std::vector<wxPoint2DDouble> pointList)
493 {
494  m_pointList = pointList;
495  UpdateSwitchesPosition();
496  UpdatePowerFlowArrowsPosition();
497 }
498 
500 {
501  Line* copy = new Line();
502  *copy = *this;
503  return copy;
504 }
505 
506 wxString Line::GetTipText() const
507 {
508  wxString tipText = m_electricalData.name;
509 
510  if(m_online) {
511  tipText += "\n";
512  int busNumber[2];
513  busNumber[0] = static_cast<Bus*>(m_parentList[0])->GetElectricalData().number + 1;
514  busNumber[1] = static_cast<Bus*>(m_parentList[1])->GetElectricalData().number + 1;
515 
516  tipText += _("\nP") + wxString::Format("(%d-%d) = ", busNumber[0], busNumber[1]) +
517  wxString::FromDouble(m_electricalData.powerFlow[0].real(), 5) + _(" p.u.");
518  tipText += _("\nQ") + wxString::Format("(%d-%d) = ", busNumber[0], busNumber[1]) +
519  wxString::FromDouble(m_electricalData.powerFlow[0].imag(), 5) + _(" p.u.");
520  tipText += _("\nP") + wxString::Format("(%d-%d) = ", busNumber[1], busNumber[0]) +
521  wxString::FromDouble(m_electricalData.powerFlow[1].real(), 5) + _(" p.u.");
522  tipText += _("\nQ") + wxString::Format("(%d-%d) = ", busNumber[1], busNumber[0]) +
523  wxString::FromDouble(m_electricalData.powerFlow[1].imag(), 5) + _(" p.u.");
524  }
525 
526  return tipText;
527 }
528 
529 LineElectricalData Line::GetPUElectricalData(double systemBasePower)
530 {
531  LineElectricalData data = m_electricalData;
532  double lineBasePower = GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
533  double baseVoltage = GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
534  double systemBaseImpedance = (baseVoltage * baseVoltage) / systemBasePower;
535  double lineBaseImpedance = (baseVoltage * baseVoltage) / lineBasePower;
536 
537  // Resistance
538  double r = data.resistance;
539  if(data.resistanceUnit == UNIT_OHM_km) r *= data.lineSize;
540  if(data.resistanceUnit == UNIT_PU) {
541  if(data.useLinePower) data.resistance = (r * lineBaseImpedance) / systemBaseImpedance;
542  } else {
543  data.resistance = r / systemBaseImpedance;
544  }
545  data.resistanceUnit = UNIT_PU;
546 
547  // Inductive reactance
548  double x = data.indReactance;
549  if(data.indReactanceUnit == UNIT_OHM_km) x *= data.lineSize;
550  if(data.indReactanceUnit == UNIT_PU) {
551  if(data.useLinePower) data.indReactance = (x * lineBaseImpedance) / systemBaseImpedance;
552  } else {
553  data.indReactance = x / systemBaseImpedance;
554  }
555  data.indReactanceUnit = UNIT_PU;
556 
557  // Capacitive susceptance
558  double b = data.capSusceptance;
559  if(data.capSusceptanceUnit == UNIT_OHM_km) b *= data.lineSize;
560  if(data.capSusceptanceUnit == UNIT_PU) {
561  if(data.useLinePower) data.capSusceptance = (b * lineBaseImpedance) / systemBaseImpedance;
562  } else {
563  data.capSusceptance = b / systemBaseImpedance;
564  }
565  data.capSusceptanceUnit = UNIT_PU;
566 
567  // Fault
568 
569  // Zero seq. resistance
570  double r0 = data.zeroResistance;
571  if(data.useLinePower) data.zeroResistance = (r0 * lineBaseImpedance) / systemBaseImpedance;
572 
573  // Zero seq. ind. reactance
574  double x0 = data.zeroIndReactance;
575  if(data.useLinePower) data.zeroIndReactance = (x0 * lineBaseImpedance) / systemBaseImpedance;
576 
577  // Zero seq. cap. susceptance
578  double b0 = data.zeroCapSusceptance;
579  if(data.useLinePower) data.zeroCapSusceptance = (b0 * lineBaseImpedance) / systemBaseImpedance;
580 
581  if(!m_online) {
582  data.powerFlow[0] = std::complex<double>(0, 0);
583  data.powerFlow[1] = std::complex<double>(0, 0);
584  data.faultCurrent[0][0] = std::complex<double>(0, 0);
585  data.faultCurrent[0][1] = std::complex<double>(0, 0);
586  data.faultCurrent[0][2] = std::complex<double>(0, 0);
587  data.faultCurrent[1][0] = std::complex<double>(0, 0);
588  data.faultCurrent[1][1] = std::complex<double>(0, 0);
589  data.faultCurrent[1][2] = std::complex<double>(0, 0);
590  }
591 
592  return data;
593 }
double GetAngle() const
Get the element angle.
Definition: Element.h:212
+ +
virtual void MovePickbox(wxPoint2DDouble position)
Move the pickbox.
Definition: Line.cpp:210
+ +
Form to edit the line power data.
Definition: LineForm.h:32
+
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Line.cpp:241
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Line.cpp:39
+
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Line.cpp:369
+
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:107
+
virtual void MoveNode(Element *parent, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Line.cpp:247
virtual bool Intersects(wxRect2DDouble rect) const =0
Check if the element&#39;s rect intersects other rect.
- - -
virtual bool PickboxContains(wxPoint2DDouble position)
Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be c...
Definition: Line.cpp:205
-
Definition: Bus.h:45
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Line.cpp:119
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Line.cpp:330
-
virtual void CalculateBoundaries(wxPoint2DDouble &leftUp, wxPoint2DDouble &rightBottom) const
Calculate the element boundaries.
Definition: Line.cpp:315
- - -
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Line.cpp:99
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Line.cpp:30
-
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:333
-
Definition: Line.h:35
-
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Line.cpp:458
- - - -
virtual void SetPointList(std::vector< wxPoint2DDouble > pointList)
Set the list of points that connect the element to the bus.
Definition: Line.cpp:472
-
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Line.cpp:186
-
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Line.cpp:272
- -
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
Definition: Line.cpp:341
- -
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:61
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Line.cpp:479
-
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:171
- -
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: Line.cpp:429
-
virtual void AddPoint(wxPoint2DDouble point)
Add point to the list of points that connect the element to the bus.
Definition: Line.cpp:217
-
virtual wxString GetTipText() const
Get the tip text.
Definition: Line.cpp:486
- -
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:83
-
Definition: Branch.h:7
+ + +
virtual bool PickboxContains(wxPoint2DDouble position)
Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be c...
Definition: Line.cpp:222
+
Definition: Bus.h:62
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Line.cpp:136
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Line.cpp:350
+
virtual void CalculateBoundaries(wxPoint2DDouble &leftUp, wxPoint2DDouble &rightBottom) const
Calculate the element boundaries.
Definition: Line.cpp:335
+ + +
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Line.cpp:116
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Line.cpp:47
+
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:353
+
Definition: Line.h:52
+
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Line.cpp:478
+ + + +
virtual void SetPointList(std::vector< wxPoint2DDouble > pointList)
Set the list of points that connect the element to the bus.
Definition: Line.cpp:492
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Line.cpp:203
+
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Line.cpp:289
+ +
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
Definition: Line.cpp:361
+ +
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:78
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Line.cpp:499
+
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:187
+ +
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: Line.cpp:449
+
virtual void AddPoint(wxPoint2DDouble point)
Add point to the list of points that connect the element to the bus.
Definition: Line.cpp:234
+
virtual wxString GetTipText() const
Get the tip text.
Definition: Line.cpp:506
+ +
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:101
+
Definition: Branch.h:24
diff --git a/docs/doxygen/html/_line_8h_source.html b/docs/doxygen/html/_line_8h_source.html index 82d22e5..5c484ac 100644 --- a/docs/doxygen/html/_line_8h_source.html +++ b/docs/doxygen/html/_line_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,16 +88,17 @@ $(document).ready(function(){initNavTree('_line_8h_source.html','');});
Line.h
-
1 #ifndef LINE_H
2 #define LINE_H
3 
4 #include "LineForm.h"
5 #include "Branch.h"
6 
8  // General
9  wxString name = "";
10  double nominalVoltage = 138.0;
11  ElectricalUnit nominalVoltageUnit = UNIT_kV;
12  double nominalPower = 100.0;
13  ElectricalUnit nominalPowerUnit = UNIT_MVA;
14  double resistance = 0.0;
15  ElectricalUnit resistanceUnit = UNIT_PU;
16  double indReactance = 1.0;
17  ElectricalUnit indReactanceUnit = UNIT_PU;
18  double capSusceptance = 0.0;
19  ElectricalUnit capSusceptanceUnit = UNIT_PU;
20  double lineSize = 100.0;
21  bool useLinePower = false;
22 
23  // Power flow (p.u.)
24  std::complex<double> current[2] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0)};
25  std::complex<double> powerFlow[2] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0)};
26 
27  // Fault
28  double zeroResistance = 0.0;
29  double zeroIndReactance = 1.0;
30  double zeroCapSusceptance = 0.0;
31  // p.u. fault data
32  std::complex<double> faultCurrent[2][3];
33 };
34 
35 class Line : public Branch
36 {
37  public:
38  Line();
39  Line(wxString name);
40  ~Line();
41  virtual bool Contains(wxPoint2DDouble position) const;
42  virtual void Draw(wxPoint2DDouble translation, double scale) const;
43  virtual void Move(wxPoint2DDouble position);
44  virtual void StartMove(wxPoint2DDouble position);
45  virtual void MoveNode(Element* parent, wxPoint2DDouble position);
46  virtual bool SetNodeParent(Element* parent);
47  virtual wxCursor GetBestPickboxCursor() const { return wxCURSOR_SIZING; }
48  virtual Element* GetCopy();
49  virtual bool AddParent(Element* parent, wxPoint2DDouble position);
50  virtual bool Intersects(wxRect2DDouble rect) const;
51  virtual void MovePickbox(wxPoint2DDouble position);
52  virtual bool PickboxContains(wxPoint2DDouble position);
53  virtual void AddPoint(wxPoint2DDouble point);
54  virtual bool GetContextMenu(wxMenu& menu);
55  virtual wxString GetTipText() const;
56  virtual void RemoveNode(wxPoint2DDouble point);
57  virtual void AddNode(wxPoint2DDouble point);
58  virtual void RotateNode(Element* parent, bool clockwise = true);
59  virtual void CalculateBoundaries(wxPoint2DDouble& leftUp, wxPoint2DDouble& rightBottom) const;
60  virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection);
61  virtual bool ShowForm(wxWindow* parent, Element* element);
62  virtual LineElectricalData GetElectricalData() const { return m_electricalData; }
63  virtual LineElectricalData GetPUElectricalData(double systemBasePower);
64  virtual void SetElectricalData(LineElectricalData electricalData) { m_electricalData = electricalData; }
65  virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
66  virtual void SetPointList(std::vector<wxPoint2DDouble> pointList);
67 
68  protected:
69  void UpdatePowerFlowArrowsPosition();
70  LineElectricalData m_electricalData;
71 };
72 
73 #endif // LINE_H
- -
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
- -
virtual wxCursor GetBestPickboxCursor() const
Get the best cursor to shown to the user when the mouse is above a pickbox.
Definition: Line.h:47
- -
Definition: Line.h:35
- -
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:61
-
Definition: Branch.h:7
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef LINE_H
19 #define LINE_H
20 
21 #include "LineForm.h"
22 #include "Branch.h"
23 
25  // General
26  wxString name = "";
27  double nominalVoltage = 138.0;
28  ElectricalUnit nominalVoltageUnit = UNIT_kV;
29  double nominalPower = 100.0;
30  ElectricalUnit nominalPowerUnit = UNIT_MVA;
31  double resistance = 0.0;
32  ElectricalUnit resistanceUnit = UNIT_PU;
33  double indReactance = 1.0;
34  ElectricalUnit indReactanceUnit = UNIT_PU;
35  double capSusceptance = 0.0;
36  ElectricalUnit capSusceptanceUnit = UNIT_PU;
37  double lineSize = 100.0;
38  bool useLinePower = false;
39 
40  // Power flow (p.u.)
41  std::complex<double> current[2] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0)};
42  std::complex<double> powerFlow[2] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0)};
43 
44  // Fault
45  double zeroResistance = 0.0;
46  double zeroIndReactance = 1.0;
47  double zeroCapSusceptance = 0.0;
48  // p.u. fault data
49  std::complex<double> faultCurrent[2][3];
50 };
51 
52 class Line : public Branch
53 {
54  public:
55  Line();
56  Line(wxString name);
57  ~Line();
58  virtual bool Contains(wxPoint2DDouble position) const;
59  virtual void Draw(wxPoint2DDouble translation, double scale) const;
60  virtual void Move(wxPoint2DDouble position);
61  virtual void StartMove(wxPoint2DDouble position);
62  virtual void MoveNode(Element* parent, wxPoint2DDouble position);
63  virtual bool SetNodeParent(Element* parent);
64  virtual wxCursor GetBestPickboxCursor() const { return wxCURSOR_SIZING; }
65  virtual Element* GetCopy();
66  virtual bool AddParent(Element* parent, wxPoint2DDouble position);
67  virtual bool Intersects(wxRect2DDouble rect) const;
68  virtual void MovePickbox(wxPoint2DDouble position);
69  virtual bool PickboxContains(wxPoint2DDouble position);
70  virtual void AddPoint(wxPoint2DDouble point);
71  virtual bool GetContextMenu(wxMenu& menu);
72  virtual wxString GetTipText() const;
73  virtual void RemoveNode(wxPoint2DDouble point);
74  virtual void AddNode(wxPoint2DDouble point);
75  virtual void RotateNode(Element* parent, bool clockwise = true);
76  virtual void CalculateBoundaries(wxPoint2DDouble& leftUp, wxPoint2DDouble& rightBottom) const;
77  virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection);
78  virtual bool ShowForm(wxWindow* parent, Element* element);
79  virtual LineElectricalData GetElectricalData() const { return m_electricalData; }
80  virtual LineElectricalData GetPUElectricalData(double systemBasePower);
81  virtual void SetElectricalData(LineElectricalData electricalData) { m_electricalData = electricalData; }
82  virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
83  virtual void SetPointList(std::vector<wxPoint2DDouble> pointList);
84 
85  protected:
86  void UpdatePowerFlowArrowsPosition();
87  LineElectricalData m_electricalData;
88 };
89 
90 #endif // LINE_H
+ +
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+ + +
virtual wxCursor GetBestPickboxCursor() const
Get the best cursor to shown to the user when the mouse is above a pickbox.
Definition: Line.h:64
+ +
Definition: Line.h:52
+ +
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:78
+
Definition: Branch.h:24
diff --git a/docs/doxygen/html/_line_form_8cpp_source.html b/docs/doxygen/html/_line_form_8cpp_source.html index 8a4aac0..f0eab08 100644 --- a/docs/doxygen/html/_line_form_8cpp_source.html +++ b/docs/doxygen/html/_line_form_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,21 +88,23 @@ $(document).ready(function(){initNavTree('_line_form_8cpp_source.html','');});
LineForm.cpp
-
1 #include "LineForm.h"
2 #include "SwitchingForm.h"
3 #include "Line.h"
4 
5 LineForm::LineForm(wxWindow* parent, Line* line) : LineFormBase(parent)
6 {
7  SetSize(GetBestSize());
8  m_choiceResistance->SetString(1, L'\u03A9');
9  m_choiceResistance->SetString(2, (wxString)L'\u03A9' + "/km");
10  m_choiceResistance->SetInitialSize();
11  m_textCtrlResistance->SetInitialSize();
12 
13  m_choiceReactance->SetString(1, L'\u03A9');
14  m_choiceReactance->SetString(2, (wxString)L'\u03A9' + "/km");
15  m_choiceReactance->SetInitialSize();
16  m_textCtrlReactance->SetInitialSize();
17 
18  ReplaceStaticTextLabelChar(m_staticTextZeroResistance, L'\u2080');
19  ReplaceStaticTextLabelChar(m_staticTextZeroReactance, L'\u2080');
20  ReplaceStaticTextLabelChar(m_staticTextZeroSusceptance, L'\u2080');
21 
22  SetSize(GetBestSize());
23  Layout();
24  m_parent = parent;
25  m_line = line;
26 
27  LineElectricalData data = line->GetElectricalData();
28 
29  m_textCtrlName->SetValue(data.name);
30 
31  wxString nominalVoltageStr = Line::StringFromDouble(data.nominalVoltage);
32  switch(data.nominalVoltageUnit) {
33  case UNIT_V: {
34  nominalVoltageStr += " V";
35  } break;
36  case UNIT_kV: {
37  nominalVoltageStr += " kV";
38  } break;
39  default:
40  break;
41  }
42  m_staticTextNominalVoltageValue->SetLabel(nominalVoltageStr);
43 
44  m_textCtrlNominalPower->SetValue(Line::StringFromDouble(data.nominalPower));
45  switch(data.nominalPowerUnit) {
46  case UNIT_VA: {
47  m_choiceNominalPower->SetSelection(0);
48  } break;
49  case UNIT_kVA: {
50  m_choiceNominalPower->SetSelection(1);
51  } break;
52  case UNIT_MVA: {
53  m_choiceNominalPower->SetSelection(2);
54  } break;
55  default:
56  break;
57  }
58 
59  m_textCtrlResistance->SetValue(Line::StringFromDouble(data.resistance));
60  switch(data.resistanceUnit) {
61  case UNIT_PU: {
62  m_choiceResistance->SetSelection(0);
63  } break;
64  case UNIT_OHM: {
65  m_choiceResistance->SetSelection(1);
66  } break;
67  case UNIT_OHM_km: {
68  m_choiceResistance->SetSelection(2);
69  } break;
70  default:
71  break;
72  }
73 
74  m_textCtrlReactance->SetValue(Line::StringFromDouble(data.indReactance));
75  switch(data.indReactanceUnit) {
76  case UNIT_PU: {
77  m_choiceReactance->SetSelection(0);
78  } break;
79  case UNIT_OHM: {
80  m_choiceReactance->SetSelection(1);
81  } break;
82  case UNIT_OHM_km: {
83  m_choiceReactance->SetSelection(2);
84  } break;
85  default:
86  break;
87  }
88 
89  m_textCtrlSusceptance->SetValue(Line::StringFromDouble(data.capSusceptance));
90  switch(data.capSusceptanceUnit) {
91  case UNIT_PU: {
92  m_choiceSusceptance->SetSelection(0);
93  } break;
94  case UNIT_S: {
95  m_choiceSusceptance->SetSelection(1);
96  } break;
97  case UNIT_S_km: {
98  m_choiceSusceptance->SetSelection(2);
99  } break;
100  default:
101  break;
102  }
103 
104  m_textCtrlLineSize->SetValue(Line::StringFromDouble(data.lineSize));
105  m_checkUseLinePower->SetValue(data.useLinePower);
106 
107  m_textCtrlZeroResistance->SetValue(Line::StringFromDouble(data.zeroResistance));
108  m_textCtrlZeroReactance->SetValue(Line::StringFromDouble(data.zeroIndReactance));
109  m_textCtrlZeroSusceptance->SetValue(Line::StringFromDouble(data.zeroCapSusceptance));
110 }
111 
112 LineForm::~LineForm() {}
113 void LineForm::OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
114 void LineForm::OnOKButtonClick(wxCommandEvent& event)
115 {
116  if(ValidateData()) EndModal(wxID_OK);
117 }
118 
119 void LineForm::OnStabilityButtonClick(wxCommandEvent& event)
120 {
121  if(ValidateData()) {
122  SwitchingForm swForm(m_parent, m_line);
123  swForm.SetTitle(_("Line: Switching"));
124  swForm.ShowModal();
125  EndModal(wxID_OK);
126  }
127 }
128 
129 void LineForm::ReplaceStaticTextLabelChar(wxStaticText* staticText, wchar_t newChar)
130 {
131  wxString label = staticText->GetLabel();
132  label[label.length() - 2] = newChar;
133  staticText->SetLabel(label);
134 }
135 
136 bool LineForm::ValidateData()
137 {
138  LineElectricalData data = m_line->GetElectricalData();
139 
140  data.name = m_textCtrlName->GetValue();
141 
142  if(!m_line->DoubleFromString(m_parent, m_textCtrlNominalPower->GetValue(), data.nominalPower,
143  _("Value entered incorrectly in the field \"Nominal power\".")))
144  return false;
145  switch(m_choiceNominalPower->GetSelection()) {
146  case 0: {
147  data.nominalPowerUnit = UNIT_VA;
148  } break;
149  case 1: {
150  data.nominalPowerUnit = UNIT_kVA;
151  } break;
152  case 2: {
153  data.nominalPowerUnit = UNIT_MVA;
154  } break;
155  }
156 
157  if(!m_line->DoubleFromString(m_parent, m_textCtrlResistance->GetValue(), data.resistance,
158  _("Value entered incorrectly in the field \"Resistance\".")))
159  return false;
160  switch(m_choiceResistance->GetSelection()) {
161  case 0: {
162  data.resistanceUnit = UNIT_PU;
163  } break;
164  case 1: {
165  data.resistanceUnit = UNIT_OHM;
166  } break;
167  case 2: {
168  data.resistanceUnit = UNIT_OHM_km;
169  } break;
170  }
171 
172  if(!m_line->DoubleFromString(m_parent, m_textCtrlReactance->GetValue(), data.indReactance,
173  _("Value entered incorrectly in the field \"Indutive Reactance\".")))
174  return false;
175  switch(m_choiceReactance->GetSelection()) {
176  case 0: {
177  data.indReactanceUnit = UNIT_PU;
178  } break;
179  case 1: {
180  data.indReactanceUnit = UNIT_OHM;
181  } break;
182  case 2: {
183  data.indReactanceUnit = UNIT_OHM_km;
184  } break;
185  }
186 
187  if(!m_line->DoubleFromString(m_parent, m_textCtrlSusceptance->GetValue(), data.capSusceptance,
188  _("Value entered incorrectly in the field \"Capacitive Susceptance\".")))
189  return false;
190  switch(m_choiceSusceptance->GetSelection()) {
191  case 0: {
192  data.capSusceptanceUnit = UNIT_PU;
193  } break;
194  case 1: {
195  data.capSusceptanceUnit = UNIT_S;
196  } break;
197  case 2: {
198  data.capSusceptanceUnit = UNIT_S_km;
199  } break;
200  }
201 
202  if(!m_line->DoubleFromString(m_parent, m_textCtrlLineSize->GetValue(), data.lineSize,
203  _("Value entered incorrectly in the field \"Line size\".")))
204  return false;
205 
206  data.useLinePower = m_checkUseLinePower->GetValue();
207 
208  if(!m_line->DoubleFromString(m_parent, m_textCtrlZeroResistance->GetValue(), data.zeroResistance,
209  _("Value entered incorrectly in the field \"Zero-sequence resistance\".")))
210  return false;
211  if(!m_line->DoubleFromString(m_parent, m_textCtrlZeroReactance->GetValue(), data.zeroIndReactance,
212  _("Value entered incorrectly in the field \"Zero-sequence indutive reactance\".")))
213  return false;
214  if(!m_line->DoubleFromString(m_parent, m_textCtrlZeroSusceptance->GetValue(), data.zeroCapSusceptance,
215  _("Value entered incorrectly in the field \"Zero-sequence capacitive susceptance\".")))
216  return false;
217 
218  m_line->SetElectricalData(data);
219 
220  return true;
221 }
- - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "LineForm.h"
19 #include "SwitchingForm.h"
20 #include "Line.h"
21 
22 LineForm::LineForm(wxWindow* parent, Line* line) : LineFormBase(parent)
23 {
24  SetSize(GetBestSize());
25  m_choiceResistance->SetString(1, L'\u03A9');
26  m_choiceResistance->SetString(2, (wxString)L'\u03A9' + "/km");
27  m_choiceResistance->SetInitialSize();
28  m_textCtrlResistance->SetInitialSize();
29 
30  m_choiceReactance->SetString(1, L'\u03A9');
31  m_choiceReactance->SetString(2, (wxString)L'\u03A9' + "/km");
32  m_choiceReactance->SetInitialSize();
33  m_textCtrlReactance->SetInitialSize();
34 
35  ReplaceStaticTextLabelChar(m_staticTextZeroResistance, L'\u2080');
36  ReplaceStaticTextLabelChar(m_staticTextZeroReactance, L'\u2080');
37  ReplaceStaticTextLabelChar(m_staticTextZeroSusceptance, L'\u2080');
38 
39  SetSize(GetBestSize());
40  Layout();
41  m_parent = parent;
42  m_line = line;
43 
44  LineElectricalData data = line->GetElectricalData();
45 
46  m_textCtrlName->SetValue(data.name);
47 
48  wxString nominalVoltageStr = Line::StringFromDouble(data.nominalVoltage);
49  switch(data.nominalVoltageUnit) {
50  case UNIT_V: {
51  nominalVoltageStr += " V";
52  } break;
53  case UNIT_kV: {
54  nominalVoltageStr += " kV";
55  } break;
56  default:
57  break;
58  }
59  m_staticTextNominalVoltageValue->SetLabel(nominalVoltageStr);
60 
61  m_textCtrlNominalPower->SetValue(Line::StringFromDouble(data.nominalPower));
62  switch(data.nominalPowerUnit) {
63  case UNIT_VA: {
64  m_choiceNominalPower->SetSelection(0);
65  } break;
66  case UNIT_kVA: {
67  m_choiceNominalPower->SetSelection(1);
68  } break;
69  case UNIT_MVA: {
70  m_choiceNominalPower->SetSelection(2);
71  } break;
72  default:
73  break;
74  }
75 
76  m_textCtrlResistance->SetValue(Line::StringFromDouble(data.resistance));
77  switch(data.resistanceUnit) {
78  case UNIT_PU: {
79  m_choiceResistance->SetSelection(0);
80  } break;
81  case UNIT_OHM: {
82  m_choiceResistance->SetSelection(1);
83  } break;
84  case UNIT_OHM_km: {
85  m_choiceResistance->SetSelection(2);
86  } break;
87  default:
88  break;
89  }
90 
91  m_textCtrlReactance->SetValue(Line::StringFromDouble(data.indReactance));
92  switch(data.indReactanceUnit) {
93  case UNIT_PU: {
94  m_choiceReactance->SetSelection(0);
95  } break;
96  case UNIT_OHM: {
97  m_choiceReactance->SetSelection(1);
98  } break;
99  case UNIT_OHM_km: {
100  m_choiceReactance->SetSelection(2);
101  } break;
102  default:
103  break;
104  }
105 
106  m_textCtrlSusceptance->SetValue(Line::StringFromDouble(data.capSusceptance));
107  switch(data.capSusceptanceUnit) {
108  case UNIT_PU: {
109  m_choiceSusceptance->SetSelection(0);
110  } break;
111  case UNIT_S: {
112  m_choiceSusceptance->SetSelection(1);
113  } break;
114  case UNIT_S_km: {
115  m_choiceSusceptance->SetSelection(2);
116  } break;
117  default:
118  break;
119  }
120 
121  m_textCtrlLineSize->SetValue(Line::StringFromDouble(data.lineSize));
122  m_checkUseLinePower->SetValue(data.useLinePower);
123 
124  m_textCtrlZeroResistance->SetValue(Line::StringFromDouble(data.zeroResistance));
125  m_textCtrlZeroReactance->SetValue(Line::StringFromDouble(data.zeroIndReactance));
126  m_textCtrlZeroSusceptance->SetValue(Line::StringFromDouble(data.zeroCapSusceptance));
127 }
128 
129 LineForm::~LineForm() {}
130 void LineForm::OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
131 void LineForm::OnOKButtonClick(wxCommandEvent& event)
132 {
133  if(ValidateData()) EndModal(wxID_OK);
134 }
135 
136 void LineForm::OnStabilityButtonClick(wxCommandEvent& event)
137 {
138  if(ValidateData()) {
139  SwitchingForm swForm(m_parent, m_line);
140  swForm.SetTitle(_("Line: Switching"));
141  swForm.ShowModal();
142  EndModal(wxID_OK);
143  }
144 }
145 
146 void LineForm::ReplaceStaticTextLabelChar(wxStaticText* staticText, wchar_t newChar)
147 {
148  wxString label = staticText->GetLabel();
149  label[label.length() - 2] = newChar;
150  staticText->SetLabel(label);
151 }
152 
153 bool LineForm::ValidateData()
154 {
155  LineElectricalData data = m_line->GetElectricalData();
156 
157  data.name = m_textCtrlName->GetValue();
158 
159  if(!m_line->DoubleFromString(m_parent, m_textCtrlNominalPower->GetValue(), data.nominalPower,
160  _("Value entered incorrectly in the field \"Nominal power\".")))
161  return false;
162  switch(m_choiceNominalPower->GetSelection()) {
163  case 0: {
164  data.nominalPowerUnit = UNIT_VA;
165  } break;
166  case 1: {
167  data.nominalPowerUnit = UNIT_kVA;
168  } break;
169  case 2: {
170  data.nominalPowerUnit = UNIT_MVA;
171  } break;
172  }
173 
174  if(!m_line->DoubleFromString(m_parent, m_textCtrlResistance->GetValue(), data.resistance,
175  _("Value entered incorrectly in the field \"Resistance\".")))
176  return false;
177  switch(m_choiceResistance->GetSelection()) {
178  case 0: {
179  data.resistanceUnit = UNIT_PU;
180  } break;
181  case 1: {
182  data.resistanceUnit = UNIT_OHM;
183  } break;
184  case 2: {
185  data.resistanceUnit = UNIT_OHM_km;
186  } break;
187  }
188 
189  if(!m_line->DoubleFromString(m_parent, m_textCtrlReactance->GetValue(), data.indReactance,
190  _("Value entered incorrectly in the field \"Indutive Reactance\".")))
191  return false;
192  switch(m_choiceReactance->GetSelection()) {
193  case 0: {
194  data.indReactanceUnit = UNIT_PU;
195  } break;
196  case 1: {
197  data.indReactanceUnit = UNIT_OHM;
198  } break;
199  case 2: {
200  data.indReactanceUnit = UNIT_OHM_km;
201  } break;
202  }
203 
204  if(!m_line->DoubleFromString(m_parent, m_textCtrlSusceptance->GetValue(), data.capSusceptance,
205  _("Value entered incorrectly in the field \"Capacitive Susceptance\".")))
206  return false;
207  switch(m_choiceSusceptance->GetSelection()) {
208  case 0: {
209  data.capSusceptanceUnit = UNIT_PU;
210  } break;
211  case 1: {
212  data.capSusceptanceUnit = UNIT_S;
213  } break;
214  case 2: {
215  data.capSusceptanceUnit = UNIT_S_km;
216  } break;
217  }
218 
219  if(!m_line->DoubleFromString(m_parent, m_textCtrlLineSize->GetValue(), data.lineSize,
220  _("Value entered incorrectly in the field \"Line size\".")))
221  return false;
222 
223  data.useLinePower = m_checkUseLinePower->GetValue();
224 
225  if(!m_line->DoubleFromString(m_parent, m_textCtrlZeroResistance->GetValue(), data.zeroResistance,
226  _("Value entered incorrectly in the field \"Zero-sequence resistance\".")))
227  return false;
228  if(!m_line->DoubleFromString(m_parent, m_textCtrlZeroReactance->GetValue(), data.zeroIndReactance,
229  _("Value entered incorrectly in the field \"Zero-sequence indutive reactance\".")))
230  return false;
231  if(!m_line->DoubleFromString(m_parent, m_textCtrlZeroSusceptance->GetValue(), data.zeroCapSusceptance,
232  _("Value entered incorrectly in the field \"Zero-sequence capacitive susceptance\".")))
233  return false;
234 
235  m_line->SetElectricalData(data);
236 
237  return true;
238 }
+ +
Form to edit the switching data of power elements for electromechanical transient studies...
Definition: SwitchingForm.h:32
- - - - - -
Definition: Line.h:35
- -
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:300
- - - + + + + + + +
Definition: Line.h:52
+ + +
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:320
+ + +
diff --git a/docs/doxygen/html/_line_form_8h.html b/docs/doxygen/html/_line_form_8h.html new file mode 100644 index 0000000..10dd01f --- /dev/null +++ b/docs/doxygen/html/_line_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/LineForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
LineForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  LineForm
 Form to edit the line power data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_line_form_8h_source.html b/docs/doxygen/html/_line_form_8h_source.html index dc850a8..df9f02e 100644 --- a/docs/doxygen/html/_line_form_8h_source.html +++ b/docs/doxygen/html/_line_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,16 +88,16 @@ $(document).ready(function(){initNavTree('_line_form_8h_source.html','');});
LineForm.h
-
1 #ifndef LINEFORM_H
2 #define LINEFORM_H
3 #include "ElementForm.h"
4 
5 class Line;
6 class SwitchingForm;
7 
8 class LineForm : public LineFormBase
9 {
10 public:
11  LineForm(wxWindow* parent, Line* line);
12  virtual ~LineForm();
13 protected:
14  virtual void OnCancelButtonClick(wxCommandEvent& event);
15  virtual void OnOKButtonClick(wxCommandEvent& event);
16  virtual void OnStabilityButtonClick(wxCommandEvent& event);
17  virtual void ReplaceStaticTextLabelChar(wxStaticText* staticText, wchar_t newChar);
18  virtual bool ValidateData();
19 
20  wxWindow* m_parent = NULL;
21  Line* m_line = NULL;
22 
23 };
24 #endif // LINEFORM_H
- +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef LINEFORM_H
19 #define LINEFORM_H
20 #include "ElementForm.h"
21 
22 class Line;
23 class SwitchingForm;
24 
32 class LineForm : public LineFormBase
33 {
34  public:
35  LineForm(wxWindow* parent, Line* line);
36  virtual ~LineForm();
37 
38  protected:
39  virtual void OnCancelButtonClick(wxCommandEvent& event);
40  virtual void OnOKButtonClick(wxCommandEvent& event);
41  virtual void OnStabilityButtonClick(wxCommandEvent& event);
42  virtual void ReplaceStaticTextLabelChar(wxStaticText* staticText, wchar_t newChar);
43  virtual bool ValidateData();
44 
45  wxWindow* m_parent = NULL;
46  Line* m_line = NULL;
47 };
48 #endif // LINEFORM_H
Form to edit the line power data.
Definition: LineForm.h:32
+
Form to edit the switching data of power elements for electromechanical transient studies...
Definition: SwitchingForm.h:32
-
Definition: Line.h:35
+
Definition: Line.h:52
-
1 #include "Load.h"
2 
3 Load::Load() : Shunt() {}
4 Load::Load(wxString name) : Shunt() { m_electricalData.name = name; }
5 Load::~Load() {}
6 bool Load::AddParent(Element* parent, wxPoint2DDouble position)
7 {
8  if(parent) {
9  m_parentList.push_back(parent);
10  parent->AddChild(this);
11  wxPoint2DDouble parentPt =
12  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
13  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
14  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
15 
16  m_position = parentPt + wxPoint2DDouble(0.0, 100.0); // Shifts the position to the down of the bus.
17  m_width = m_height = 20.0;
18  m_rect = wxRect2DDouble(m_position.m_x - 10.0, m_position.m_y - 10.0, m_width, m_height);
19 
20  m_pointList.push_back(parentPt);
21  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
22  m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -20.0));
23  m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -10.0));
24 
25  m_triangPts.push_back(wxPoint2DDouble(-m_width / 2.0, -m_height / 2.0));
26  m_triangPts.push_back(wxPoint2DDouble(m_width / 2.0, -m_height / 2.0));
27  m_triangPts.push_back(wxPoint2DDouble(0.0, m_height / 2.0));
28 
29  m_inserted = true;
30 
31  wxRect2DDouble genRect(0, 0, 0, 0);
32  m_switchRect.push_back(genRect); // Push a general rectangle.
33  UpdateSwitches();
34  m_pfDirection = PF_TO_ELEMENT;
35  UpdatePowerFlowArrowsPosition();
36 
37  return true;
38  }
39  return false;
40 }
41 
42 void Load::Draw(wxPoint2DDouble translation, double scale) const
43 {
44  OpenGLColour elementColour;
45  if(m_online) {
46  if(m_dynEvent)
47  elementColour = m_dynamicEventColour;
48  else
49  elementColour = m_onlineElementColour;
50  } else
51  elementColour = m_offlineElementColour;
52 
53  if(m_inserted) {
54  // Draw Selection (layer 1).
55  if(m_selected) {
56  glLineWidth(1.5 + m_borderSize * 2.0);
57  glColor4dv(m_selectionColour.GetRGBA());
58  std::vector<wxPoint2DDouble> selTriangPts;
59  selTriangPts.push_back(m_triangPts[0] + m_position +
60  wxPoint2DDouble(-m_borderSize / scale, -m_borderSize / scale));
61  selTriangPts.push_back(m_triangPts[1] + m_position +
62  wxPoint2DDouble(m_borderSize / scale, -m_borderSize / scale));
63  selTriangPts.push_back(m_triangPts[2] + m_position + wxPoint2DDouble(0.0, m_borderSize / scale));
64 
65  glPushMatrix();
66  glTranslated(m_position.m_x, m_position.m_y, 0.0);
67  glRotated(m_angle, 0.0, 0.0, 1.0);
68  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
69  DrawTriangle(selTriangPts);
70  glPopMatrix();
71 
72  DrawLine(m_pointList);
73 
74  // Draw node selection.
75  DrawCircle(m_pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
76  }
77 
78  // Draw Load (layer 2).
79  glLineWidth(1.5);
80 
81  // Draw node.
82  glColor4dv(elementColour.GetRGBA());
83  DrawCircle(m_pointList[0], 5.0, 10, GL_POLYGON);
84 
85  DrawLine(m_pointList);
86 
87  DrawSwitches();
88  DrawPowerFlowPts();
89 
90  std::vector<wxPoint2DDouble> triangPts;
91  for(int i = 0; i < 3; i++) {
92  triangPts.push_back(m_triangPts[i] + m_position);
93  }
94  glPushMatrix();
95  glTranslated(m_position.m_x, m_position.m_y, 0.0);
96  glRotated(m_angle, 0.0, 0.0, 1.0);
97  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
98  glColor4dv(elementColour.GetRGBA());
99  DrawTriangle(triangPts);
100  glPopMatrix();
101  }
102 }
103 
104 void Load::Rotate(bool clockwise)
105 {
106  double rotAngle = m_rotationAngle;
107  if(!clockwise) rotAngle = -m_rotationAngle;
108 
109  m_angle += rotAngle;
110  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
111  m_pointList[2] = RotateAtPosition(m_pointList[2], rotAngle);
112  m_pointList[3] = RotateAtPosition(m_pointList[3], rotAngle);
113  UpdateSwitchesPosition();
114  UpdatePowerFlowArrowsPosition();
115 }
116 
117 bool Load::GetContextMenu(wxMenu& menu)
118 {
119  menu.Append(ID_EDIT_ELEMENT, _("Edit Load"));
120  GeneralMenuItens(menu);
121  return true;
122 }
123 
124 bool Load::ShowForm(wxWindow* parent, Element* element)
125 {
126  LoadForm* loadForm = new LoadForm(parent, this);
127  if(loadForm->ShowModal() == wxID_OK) {
128  loadForm->Destroy();
129  return true;
130  }
131  loadForm->Destroy();
132  return false;
133 }
134 
135 LoadElectricalData Load::GetPUElectricalData(double systemPowerBase)
136 {
137  LoadElectricalData data = m_electricalData;
138  switch(data.activePowerUnit) {
139  case UNIT_W: {
140  data.activePower = data.activePower / systemPowerBase;
141  data.activePowerUnit = UNIT_PU;
142  } break;
143  case UNIT_kW: {
144  data.activePower = (data.activePower * 1e3) / systemPowerBase;
145  data.activePowerUnit = UNIT_PU;
146  } break;
147  case UNIT_MW: {
148  data.activePower = (data.activePower * 1e6) / systemPowerBase;
149  data.activePowerUnit = UNIT_PU;
150  } break;
151  default:
152  break;
153  }
154  switch(data.reactivePowerUnit) {
155  case UNIT_VAr: {
156  data.reactivePower = data.reactivePower / systemPowerBase;
157  data.reactivePowerUnit = UNIT_PU;
158  } break;
159  case UNIT_kVAr: {
160  data.reactivePower = (data.reactivePower * 1e3) / systemPowerBase;
161  data.reactivePowerUnit = UNIT_PU;
162  } break;
163  case UNIT_MVAr: {
164  data.reactivePower = (data.reactivePower * 1e6) / systemPowerBase;
165  data.reactivePowerUnit = UNIT_PU;
166  } break;
167  default:
168  break;
169  }
170 
171  return data;
172 }
173 
175 {
176  Load* copy = new Load();
177  *copy = *this;
178  return copy;
179 }
180 
181 wxString Load::GetTipText() const
182 {
183  wxString tipText = m_electricalData.name;
184 
185  // TODO: Avoid power calculation.
186  double activePower = m_electricalData.activePower;
187  double reactivePower = m_electricalData.reactivePower;
188  if(!m_online) {
189  activePower = 0.0;
190  reactivePower = 0.0;
191  }
192  if(m_online && m_electricalData.loadType == CONST_IMPEDANCE) {
193  std::complex<double> v = static_cast<Bus*>(m_parentList[0])->GetElectricalData().voltage;
194  reactivePower *= std::pow(std::abs(v), 2);
195  activePower *= std::pow(std::abs(v), 2);
196  }
197  tipText += "\n";
198  tipText += _("\nP = ") + wxString::FromDouble(activePower, 5);
199  switch(m_electricalData.activePowerUnit) {
200  case UNIT_PU: {
201  tipText += _(" p.u.");
202  } break;
203  case UNIT_W: {
204  tipText += _(" W");
205  } break;
206  case UNIT_kW: {
207  tipText += _(" kW");
208  } break;
209  case UNIT_MW: {
210  tipText += _(" MW");
211  } break;
212  default:
213  break;
214  }
215  tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
216  switch(m_electricalData.reactivePowerUnit) {
217  case UNIT_PU: {
218  tipText += _(" p.u.");
219  } break;
220  case UNIT_VAr: {
221  tipText += _(" VAr");
222  } break;
223  case UNIT_kVAr: {
224  tipText += _(" kVAr");
225  } break;
226  case UNIT_MVAr: {
227  tipText += _(" MVAr");
228  } break;
229  default:
230  break;
231  }
232 
233  return tipText;
234 }
double GetAngle() const
Get the element angle.
Definition: Element.h:201
- - -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Load.cpp:104
- -
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:91
- - - -
Definition: Bus.h:45
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Load.cpp:174
- -
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Load.cpp:117
-
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:333
-
Definition: Load.h:23
- -
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Load.cpp:42
- - - - -
virtual wxString GetTipText() const
Get the tip text.
Definition: Load.cpp:181
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Load.cpp:6
-
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:171
-
Definition: Shunt.h:7
- -
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Load.cpp:124
-
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:83
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Load.h"
19 
20 Load::Load() : Shunt() {}
21 Load::Load(wxString name) : Shunt() { m_electricalData.name = name; }
22 Load::~Load() {}
23 bool Load::AddParent(Element* parent, wxPoint2DDouble position)
24 {
25  if(parent) {
26  m_parentList.push_back(parent);
27  parent->AddChild(this);
28  wxPoint2DDouble parentPt =
29  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
30  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
31  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
32 
33  m_position = parentPt + wxPoint2DDouble(0.0, 100.0); // Shifts the position to the down of the bus.
34  m_width = m_height = 20.0;
35  m_rect = wxRect2DDouble(m_position.m_x - 10.0, m_position.m_y - 10.0, m_width, m_height);
36 
37  m_pointList.push_back(parentPt);
38  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
39  m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -20.0));
40  m_pointList.push_back(m_position + wxPoint2DDouble(0.0, -10.0));
41 
42  m_triangPts.push_back(wxPoint2DDouble(-m_width / 2.0, -m_height / 2.0));
43  m_triangPts.push_back(wxPoint2DDouble(m_width / 2.0, -m_height / 2.0));
44  m_triangPts.push_back(wxPoint2DDouble(0.0, m_height / 2.0));
45 
46  m_inserted = true;
47 
48  wxRect2DDouble genRect(0, 0, 0, 0);
49  m_switchRect.push_back(genRect); // Push a general rectangle.
50  UpdateSwitches();
51  m_pfDirection = PF_TO_ELEMENT;
52  UpdatePowerFlowArrowsPosition();
53 
54  return true;
55  }
56  return false;
57 }
58 
59 void Load::Draw(wxPoint2DDouble translation, double scale) const
60 {
61  OpenGLColour elementColour;
62  if(m_online) {
63  if(m_dynEvent)
64  elementColour = m_dynamicEventColour;
65  else
66  elementColour = m_onlineElementColour;
67  } else
68  elementColour = m_offlineElementColour;
69 
70  if(m_inserted) {
71  // Draw Selection (layer 1).
72  if(m_selected) {
73  glLineWidth(1.5 + m_borderSize * 2.0);
74  glColor4dv(m_selectionColour.GetRGBA());
75  std::vector<wxPoint2DDouble> selTriangPts;
76  selTriangPts.push_back(m_triangPts[0] + m_position +
77  wxPoint2DDouble(-m_borderSize / scale, -m_borderSize / scale));
78  selTriangPts.push_back(m_triangPts[1] + m_position +
79  wxPoint2DDouble(m_borderSize / scale, -m_borderSize / scale));
80  selTriangPts.push_back(m_triangPts[2] + m_position + wxPoint2DDouble(0.0, m_borderSize / scale));
81 
82  glPushMatrix();
83  glTranslated(m_position.m_x, m_position.m_y, 0.0);
84  glRotated(m_angle, 0.0, 0.0, 1.0);
85  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
86  DrawTriangle(selTriangPts);
87  glPopMatrix();
88 
89  DrawLine(m_pointList);
90 
91  // Draw node selection.
92  DrawCircle(m_pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
93  }
94 
95  // Draw Load (layer 2).
96  glLineWidth(1.5);
97 
98  // Draw node.
99  glColor4dv(elementColour.GetRGBA());
100  DrawCircle(m_pointList[0], 5.0, 10, GL_POLYGON);
101 
102  DrawLine(m_pointList);
103 
104  DrawSwitches();
105  DrawPowerFlowPts();
106 
107  std::vector<wxPoint2DDouble> triangPts;
108  for(int i = 0; i < 3; i++) {
109  triangPts.push_back(m_triangPts[i] + m_position);
110  }
111  glPushMatrix();
112  glTranslated(m_position.m_x, m_position.m_y, 0.0);
113  glRotated(m_angle, 0.0, 0.0, 1.0);
114  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
115  glColor4dv(elementColour.GetRGBA());
116  DrawTriangle(triangPts);
117  glPopMatrix();
118  }
119 }
120 
121 void Load::Rotate(bool clockwise)
122 {
123  double rotAngle = m_rotationAngle;
124  if(!clockwise) rotAngle = -m_rotationAngle;
125 
126  m_angle += rotAngle;
127  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
128  m_pointList[2] = RotateAtPosition(m_pointList[2], rotAngle);
129  m_pointList[3] = RotateAtPosition(m_pointList[3], rotAngle);
130  UpdateSwitchesPosition();
131  UpdatePowerFlowArrowsPosition();
132 }
133 
134 bool Load::GetContextMenu(wxMenu& menu)
135 {
136  menu.Append(ID_EDIT_ELEMENT, _("Edit Load"));
137  GeneralMenuItens(menu);
138  return true;
139 }
140 
141 bool Load::ShowForm(wxWindow* parent, Element* element)
142 {
143  LoadForm* loadForm = new LoadForm(parent, this);
144  if(loadForm->ShowModal() == wxID_OK) {
145  loadForm->Destroy();
146  return true;
147  }
148  loadForm->Destroy();
149  return false;
150 }
151 
152 LoadElectricalData Load::GetPUElectricalData(double systemPowerBase)
153 {
154  LoadElectricalData data = m_electricalData;
155  switch(data.activePowerUnit) {
156  case UNIT_W: {
157  data.activePower = data.activePower / systemPowerBase;
158  data.activePowerUnit = UNIT_PU;
159  } break;
160  case UNIT_kW: {
161  data.activePower = (data.activePower * 1e3) / systemPowerBase;
162  data.activePowerUnit = UNIT_PU;
163  } break;
164  case UNIT_MW: {
165  data.activePower = (data.activePower * 1e6) / systemPowerBase;
166  data.activePowerUnit = UNIT_PU;
167  } break;
168  default:
169  break;
170  }
171  switch(data.reactivePowerUnit) {
172  case UNIT_VAr: {
173  data.reactivePower = data.reactivePower / systemPowerBase;
174  data.reactivePowerUnit = UNIT_PU;
175  } break;
176  case UNIT_kVAr: {
177  data.reactivePower = (data.reactivePower * 1e3) / systemPowerBase;
178  data.reactivePowerUnit = UNIT_PU;
179  } break;
180  case UNIT_MVAr: {
181  data.reactivePower = (data.reactivePower * 1e6) / systemPowerBase;
182  data.reactivePowerUnit = UNIT_PU;
183  } break;
184  default:
185  break;
186  }
187 
188  return data;
189 }
190 
192 {
193  Load* copy = new Load();
194  *copy = *this;
195  return copy;
196 }
197 
198 wxString Load::GetTipText() const
199 {
200  wxString tipText = m_electricalData.name;
201 
202  // TODO: Avoid power calculation.
203  double activePower = m_electricalData.activePower;
204  double reactivePower = m_electricalData.reactivePower;
205  if(!m_online) {
206  activePower = 0.0;
207  reactivePower = 0.0;
208  }
209  if(m_online && m_electricalData.loadType == CONST_IMPEDANCE) {
210  std::complex<double> v = static_cast<Bus*>(m_parentList[0])->GetElectricalData().voltage;
211  reactivePower *= std::pow(std::abs(v), 2);
212  activePower *= std::pow(std::abs(v), 2);
213  }
214  tipText += "\n";
215  tipText += _("\nP = ") + wxString::FromDouble(activePower, 5);
216  switch(m_electricalData.activePowerUnit) {
217  case UNIT_PU: {
218  tipText += _(" p.u.");
219  } break;
220  case UNIT_W: {
221  tipText += _(" W");
222  } break;
223  case UNIT_kW: {
224  tipText += _(" kW");
225  } break;
226  case UNIT_MW: {
227  tipText += _(" MW");
228  } break;
229  default:
230  break;
231  }
232  tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
233  switch(m_electricalData.reactivePowerUnit) {
234  case UNIT_PU: {
235  tipText += _(" p.u.");
236  } break;
237  case UNIT_VAr: {
238  tipText += _(" VAr");
239  } break;
240  case UNIT_kVAr: {
241  tipText += _(" kVAr");
242  } break;
243  case UNIT_MVAr: {
244  tipText += _(" MVAr");
245  } break;
246  default:
247  break;
248  }
249 
250  return tipText;
251 }
double GetAngle() const
Get the element angle.
Definition: Element.h:212
+ + +
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Load.cpp:121
+ +
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:107
+ + + +
Definition: Bus.h:62
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Load.cpp:191
+ +
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Load.cpp:134
+
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:353
+
Definition: Load.h:35
+ +
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Load.cpp:59
+ + + +
Form to edit the load power data.
Definition: LoadForm.h:32
+
virtual wxString GetTipText() const
Get the tip text.
Definition: Load.cpp:198
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Load.cpp:23
+
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:187
+
Definition: Shunt.h:24
+ +
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Load.cpp:141
+
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:101
diff --git a/docs/doxygen/html/_load_8h_source.html b/docs/doxygen/html/_load_8h_source.html index 307dd3e..05f39b3 100644 --- a/docs/doxygen/html/_load_8h_source.html +++ b/docs/doxygen/html/_load_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,13 +88,14 @@ $(document).ready(function(){initNavTree('_load_8h_source.html','');});
Load.h
-
1 #ifndef LOAD_H
2 #define LOAD_H
3 
4 #include "LoadForm.h"
5 #include "Shunt.h"
6 
7 enum LoadType
8 {
9  CONST_POWER = 0,
10  CONST_IMPEDANCE
11 };
12 
14 {
15  wxString name;
16  double activePower = 100.0;
17  ElectricalUnit activePowerUnit = UNIT_MW;
18  double reactivePower = 0.0;
19  ElectricalUnit reactivePowerUnit = UNIT_MVAr;
20  LoadType loadType = CONST_POWER;
21 };
22 
23 class Load : public Shunt
24 {
25  public:
26  Load();
27  Load(wxString name);
28  ~Load();
29 
30  virtual Element* GetCopy();
31  virtual bool AddParent(Element* parent, wxPoint2DDouble position);
32  virtual void Draw(wxPoint2DDouble translation, double scale) const;
33  virtual void Rotate(bool clockwise = true);
34  virtual bool GetContextMenu(wxMenu& menu);
35  virtual wxString GetTipText() const;
36  virtual bool ShowForm(wxWindow* parent, Element* element);
37  LoadElectricalData GetElectricalData() { return m_electricalData; }
38  LoadElectricalData GetPUElectricalData(double systemPowerBase);
39  void SetElectricalData(LoadElectricalData electricalData) { m_electricalData = electricalData; }
40 
41  protected:
42  std::vector<wxPoint2DDouble> m_triangPts;
43  LoadElectricalData m_electricalData;
44 };
45 
46 #endif // LOAD_H
- -
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
- -
Definition: Load.h:23
- -
Definition: Shunt.h:7
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef LOAD_H
19 #define LOAD_H
20 
21 #include "LoadForm.h"
22 #include "Shunt.h"
23 
24 enum LoadType { CONST_POWER = 0, CONST_IMPEDANCE };
25 
27  wxString name;
28  double activePower = 100.0;
29  ElectricalUnit activePowerUnit = UNIT_MW;
30  double reactivePower = 0.0;
31  ElectricalUnit reactivePowerUnit = UNIT_MVAr;
32  LoadType loadType = CONST_POWER;
33 };
34 
35 class Load : public Shunt
36 {
37  public:
38  Load();
39  Load(wxString name);
40  ~Load();
41 
42  virtual Element* GetCopy();
43  virtual bool AddParent(Element* parent, wxPoint2DDouble position);
44  virtual void Draw(wxPoint2DDouble translation, double scale) const;
45  virtual void Rotate(bool clockwise = true);
46  virtual bool GetContextMenu(wxMenu& menu);
47  virtual wxString GetTipText() const;
48  virtual bool ShowForm(wxWindow* parent, Element* element);
49  LoadElectricalData GetElectricalData() { return m_electricalData; }
50  LoadElectricalData GetPUElectricalData(double systemPowerBase);
51  void SetElectricalData(LoadElectricalData electricalData) { m_electricalData = electricalData; }
52  protected:
53  std::vector<wxPoint2DDouble> m_triangPts;
54  LoadElectricalData m_electricalData;
55 };
56 
57 #endif // LOAD_H
+ +
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+ + +
Definition: Load.h:35
+ +
Definition: Shunt.h:24
diff --git a/docs/doxygen/html/_load_form_8cpp_source.html b/docs/doxygen/html/_load_form_8cpp_source.html index 2cce217..fe5a754 100644 --- a/docs/doxygen/html/_load_form_8cpp_source.html +++ b/docs/doxygen/html/_load_form_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,18 +88,20 @@ $(document).ready(function(){initNavTree('_load_form_8cpp_source.html','');});
LoadForm.cpp
-
1 #include "LoadForm.h"
2 #include "SwitchingForm.h"
3 #include "Load.h"
4 
5 LoadForm::LoadForm(wxWindow* parent, Load* load) : LoadFormBase(parent)
6 {
7  SetSize(GetBestSize());
8  LoadElectricalData data = load->GetElectricalData();
9 
10  m_textCtrlName->SetValue(data.name);
11 
12  m_textCtrlActivePower->SetValue(Load::StringFromDouble(data.activePower));
13  switch(data.activePowerUnit) {
14  case UNIT_PU: {
15  m_choiceActivePower->SetSelection(0);
16  } break;
17  case UNIT_W: {
18  m_choiceActivePower->SetSelection(1);
19  } break;
20  case UNIT_kW: {
21  m_choiceActivePower->SetSelection(2);
22  } break;
23  case UNIT_MW: {
24  m_choiceActivePower->SetSelection(3);
25  } break;
26  default:
27  break;
28  }
29 
30  m_textCtrlReactivePower->SetValue(Load::StringFromDouble(data.reactivePower));
31  switch(data.reactivePowerUnit) {
32  case UNIT_PU: {
33  m_choiceReactivePower->SetSelection(0);
34  } break;
35  case UNIT_VAr: {
36  m_choiceReactivePower->SetSelection(1);
37  } break;
38  case UNIT_kVAr: {
39  m_choiceReactivePower->SetSelection(2);
40  } break;
41  case UNIT_MVAr: {
42  m_choiceReactivePower->SetSelection(3);
43  } break;
44  default:
45  break;
46  }
47 
48  switch(data.loadType) {
49  case CONST_POWER: {
50  m_choiceType->SetSelection(0);
51  } break;
52  case CONST_IMPEDANCE: {
53  m_choiceType->SetSelection(1);
54  } break;
55  }
56 
57  m_parent = parent;
58  m_load = load;
59 }
60 
61 LoadForm::~LoadForm() {}
62 void LoadForm::OnOnButtonClick(wxCommandEvent& event)
63 {
64  if(ValidateData()) EndModal(wxID_OK);
65 }
66 
67 void LoadForm::OnStabilityButtonClick(wxCommandEvent& event)
68 {
69  if(ValidateData()) {
70  SwitchingForm swForm(m_parent, m_load);
71  swForm.SetTitle(_("Load: Switching"));
72  swForm.ShowModal();
73  EndModal(wxID_OK);
74  }
75 }
76 
77 bool LoadForm::ValidateData()
78 {
79  LoadElectricalData data;
80 
81  data.name = m_textCtrlName->GetValue();
82 
83  if(!m_load->DoubleFromString(m_parent, m_textCtrlActivePower->GetValue(), data.activePower,
84  _("Value entered incorrectly in the field \"Active power\".")))
85  return false;
86  switch(m_choiceActivePower->GetSelection()) {
87  case 0: {
88  data.activePowerUnit = UNIT_PU;
89  } break;
90  case 1: {
91  data.activePowerUnit = UNIT_W;
92  } break;
93  case 2: {
94  data.activePowerUnit = UNIT_kW;
95  } break;
96  case 3: {
97  data.activePowerUnit = UNIT_MW;
98  } break;
99  }
100 
101  if(!m_load->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
102  _("Value entered incorrectly in the field \"Reactive power\".")))
103  return false;
104  switch(m_choiceReactivePower->GetSelection()) {
105  case 0: {
106  data.reactivePowerUnit = UNIT_PU;
107  } break;
108  case 1: {
109  data.reactivePowerUnit = UNIT_VAr;
110  } break;
111  case 2: {
112  data.reactivePowerUnit = UNIT_kVAr;
113  } break;
114  case 3: {
115  data.reactivePowerUnit = UNIT_MVAr;
116  } break;
117  }
118 
119  switch(m_choiceType->GetSelection()) {
120  case 0: {
121  data.loadType = CONST_POWER;
122  } break;
123  case 1: {
124  data.loadType = CONST_IMPEDANCE;
125  } break;
126  }
127 
128  m_load->SetElectricalData(data);
129  return true;
130 }
- - - - -
Definition: Load.h:23
- - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "LoadForm.h"
19 #include "SwitchingForm.h"
20 #include "Load.h"
21 
22 LoadForm::LoadForm(wxWindow* parent, Load* load) : LoadFormBase(parent)
23 {
24  SetSize(GetBestSize());
25  LoadElectricalData data = load->GetElectricalData();
26 
27  m_textCtrlName->SetValue(data.name);
28 
29  m_textCtrlActivePower->SetValue(Load::StringFromDouble(data.activePower));
30  switch(data.activePowerUnit) {
31  case UNIT_PU: {
32  m_choiceActivePower->SetSelection(0);
33  } break;
34  case UNIT_W: {
35  m_choiceActivePower->SetSelection(1);
36  } break;
37  case UNIT_kW: {
38  m_choiceActivePower->SetSelection(2);
39  } break;
40  case UNIT_MW: {
41  m_choiceActivePower->SetSelection(3);
42  } break;
43  default:
44  break;
45  }
46 
47  m_textCtrlReactivePower->SetValue(Load::StringFromDouble(data.reactivePower));
48  switch(data.reactivePowerUnit) {
49  case UNIT_PU: {
50  m_choiceReactivePower->SetSelection(0);
51  } break;
52  case UNIT_VAr: {
53  m_choiceReactivePower->SetSelection(1);
54  } break;
55  case UNIT_kVAr: {
56  m_choiceReactivePower->SetSelection(2);
57  } break;
58  case UNIT_MVAr: {
59  m_choiceReactivePower->SetSelection(3);
60  } break;
61  default:
62  break;
63  }
64 
65  switch(data.loadType) {
66  case CONST_POWER: {
67  m_choiceType->SetSelection(0);
68  } break;
69  case CONST_IMPEDANCE: {
70  m_choiceType->SetSelection(1);
71  } break;
72  }
73 
74  m_parent = parent;
75  m_load = load;
76 }
77 
78 LoadForm::~LoadForm() {}
79 void LoadForm::OnOnButtonClick(wxCommandEvent& event)
80 {
81  if(ValidateData()) EndModal(wxID_OK);
82 }
83 
84 void LoadForm::OnStabilityButtonClick(wxCommandEvent& event)
85 {
86  if(ValidateData()) {
87  SwitchingForm swForm(m_parent, m_load);
88  swForm.SetTitle(_("Load: Switching"));
89  swForm.ShowModal();
90  EndModal(wxID_OK);
91  }
92 }
93 
94 bool LoadForm::ValidateData()
95 {
96  LoadElectricalData data;
97 
98  data.name = m_textCtrlName->GetValue();
99 
100  if(!m_load->DoubleFromString(m_parent, m_textCtrlActivePower->GetValue(), data.activePower,
101  _("Value entered incorrectly in the field \"Active power\".")))
102  return false;
103  switch(m_choiceActivePower->GetSelection()) {
104  case 0: {
105  data.activePowerUnit = UNIT_PU;
106  } break;
107  case 1: {
108  data.activePowerUnit = UNIT_W;
109  } break;
110  case 2: {
111  data.activePowerUnit = UNIT_kW;
112  } break;
113  case 3: {
114  data.activePowerUnit = UNIT_MW;
115  } break;
116  }
117 
118  if(!m_load->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
119  _("Value entered incorrectly in the field \"Reactive power\".")))
120  return false;
121  switch(m_choiceReactivePower->GetSelection()) {
122  case 0: {
123  data.reactivePowerUnit = UNIT_PU;
124  } break;
125  case 1: {
126  data.reactivePowerUnit = UNIT_VAr;
127  } break;
128  case 2: {
129  data.reactivePowerUnit = UNIT_kVAr;
130  } break;
131  case 3: {
132  data.reactivePowerUnit = UNIT_MVAr;
133  } break;
134  }
135 
136  switch(m_choiceType->GetSelection()) {
137  case 0: {
138  data.loadType = CONST_POWER;
139  } break;
140  case 1: {
141  data.loadType = CONST_IMPEDANCE;
142  } break;
143  }
144 
145  m_load->SetElectricalData(data);
146  return true;
147 }
Form to edit the switching data of power elements for electromechanical transient studies...
Definition: SwitchingForm.h:32
+ + + + + + +
Definition: Load.h:35
+ + - -
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:300
- + +
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:320
+
diff --git a/docs/doxygen/html/_load_form_8h.html b/docs/doxygen/html/_load_form_8h.html new file mode 100644 index 0000000..8e881d7 --- /dev/null +++ b/docs/doxygen/html/_load_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/LoadForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
LoadForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  LoadForm
 Form to edit the load power data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_load_form_8h_source.html b/docs/doxygen/html/_load_form_8h_source.html index 210e4ca..284ad8b 100644 --- a/docs/doxygen/html/_load_form_8h_source.html +++ b/docs/doxygen/html/_load_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,16 +88,16 @@ $(document).ready(function(){initNavTree('_load_form_8h_source.html','');});
LoadForm.h
-
1 #ifndef LOADFORM_H
2 #define LOADFORM_H
3 #include "ElementForm.h"
4 
5 class Load;
6 class SwitchingForm;
7 
8 class LoadForm : public LoadFormBase
9 {
10  public:
11  LoadForm(wxWindow* parent, Load* load);
12  virtual ~LoadForm();
13 
14  virtual bool ValidateData();
15 
16  protected:
17  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); };
18  virtual void OnOnButtonClick(wxCommandEvent& event);
19  virtual void OnStabilityButtonClick(wxCommandEvent& event);
20 
21  wxWindow* m_parent = NULL;
22  Load* m_load = NULL;
23 };
24 #endif // LOADFORM_H
-
Definition: Load.h:23
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef LOADFORM_H
19 #define LOADFORM_H
20 #include "ElementForm.h"
21 
22 class Load;
23 class SwitchingForm;
24 
32 class LoadForm : public LoadFormBase
33 {
34  public:
35  LoadForm(wxWindow* parent, Load* load);
36  virtual ~LoadForm();
37 
38  virtual bool ValidateData();
39 
40  protected:
41  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); };
42  virtual void OnOnButtonClick(wxCommandEvent& event);
43  virtual void OnStabilityButtonClick(wxCommandEvent& event);
44 
45  wxWindow* m_parent = NULL;
46  Load* m_load = NULL;
47 };
48 #endif // LOADFORM_H
Form to edit the switching data of power elements for electromechanical transient studies...
Definition: SwitchingForm.h:32
+
Definition: Load.h:35
- +
Form to edit the load power data.
Definition: LoadForm.h:32
-
1 #include "Machines.h"
2 
3 #include "ControlElementContainer.h"
4 #include "ControlElementSolver.h"
5 
6 Machines::Machines() : PowerElement() {}
7 Machines::~Machines() {}
8 bool Machines::AddParent(Element* parent, wxPoint2DDouble position)
9 {
10  if(parent) {
11  m_parentList.push_back(parent);
12  parent->AddChild(this);
13  wxPoint2DDouble parentPt =
14  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
15  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
16  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
17 
18  m_position = parentPt + wxPoint2DDouble(-100.0, 0.0); // Shifts the position to the left of the bus.
19  m_width = m_height = 50.0;
20  m_rect = wxRect2DDouble(m_position.m_x - 25.0, m_position.m_y - 25.0, m_width, m_height);
21 
22  m_pointList.push_back(parentPt);
23  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
24  m_pointList.push_back(m_position + wxPoint2DDouble(35.0, 0.0));
25  m_pointList.push_back(m_position + wxPoint2DDouble(25.0, 0.0));
26  m_inserted = true;
27 
28  wxRect2DDouble genRect(0, 0, 0, 0);
29  m_switchRect.push_back(genRect); // Push a general rectangle.
30  UpdateSwitches();
31  UpdatePowerFlowArrowsPosition();
32  return true;
33  }
34  return false;
35 }
36 
37 void Machines::Draw(wxPoint2DDouble translation, double scale) const
38 {
39  OpenGLColour elementColour;
40  if(m_online) {
41  if(m_dynEvent)
42  elementColour = m_dynamicEventColour;
43  else
44  elementColour = m_onlineElementColour;
45  } else
46  elementColour = m_offlineElementColour;
47 
48  if(m_inserted) {
49  // Draw Selection (layer 1).
50  if(m_selected) {
51  glLineWidth(1.5 + m_borderSize * 2.0);
52  glColor4dv(m_selectionColour.GetRGBA());
53  DrawCircle(m_position, 25.0 + (m_borderSize + 1.5) / scale, 20, GL_POLYGON);
54  DrawLine(m_pointList);
55 
56  // Draw node selection.
57  DrawCircle(m_pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
58  }
59 
60  // Draw Machines (layer 2).
61  glLineWidth(1.5);
62 
63  // Draw node.
64  glColor4dv(elementColour.GetRGBA());
65  DrawCircle(m_pointList[0], 5.0, 10, GL_POLYGON);
66 
67  DrawLine(m_pointList);
68 
69  DrawSwitches();
70  DrawPowerFlowPts();
71 
72  glColor4d(1.0, 1.0, 1.0, 1.0);
73  DrawCircle(m_position, 25.0, 20, GL_POLYGON);
74 
75  glColor4dv(elementColour.GetRGBA());
76  DrawCircle(m_position, 25.0, 20);
77 
78  // Draw machine symbol.
79  glLineWidth(2.0);
80  DrawSymbol();
81  }
82 }
83 
84 void Machines::UpdateSwitchesPosition()
85 {
86  if(m_parentList[0]) {
87  m_pointList[1] = GetSwitchPoint(m_parentList[0], m_pointList[0], m_pointList[2]);
88  } else {
89  m_pointList[1] = m_pointList[0];
90  }
91  UpdateSwitches();
92 }
93 
94 void Machines::Move(wxPoint2DDouble position)
95 {
96  SetPosition(m_movePos + position - m_moveStartPt);
97  for(int i = 2; i < (int)m_pointList.size(); i++) {
98  m_pointList[i] = m_movePts[i] + position - m_moveStartPt;
99  }
100  if(!m_parentList[0]) {
101  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
102  }
103  UpdateSwitchesPosition();
104  UpdatePowerFlowArrowsPosition();
105 }
106 
107 void Machines::MoveNode(Element* element, wxPoint2DDouble position)
108 {
109  if(element) {
110  if(element == m_parentList[0]) {
111  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
112  }
113  } else {
114  if(m_activeNodeID == 1) {
115  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
116  if(m_parentList[0]) {
117  m_parentList[0]->RemoveChild(this);
118  m_parentList[0] = NULL;
119  m_online = false;
120  }
121  }
122  }
123 
124  // Recalculate switches positions
125  UpdateSwitchesPosition();
126  UpdatePowerFlowArrowsPosition();
127 }
128 
129 void Machines::StartMove(wxPoint2DDouble position)
130 {
131  m_moveStartPt = position;
132  m_movePts = m_pointList;
133  m_movePos = m_position;
134 }
135 
136 void Machines::RotateNode(Element* parent, bool clockwise)
137 {
138  double rotAngle = m_rotationAngle;
139  if(!clockwise) rotAngle = -m_rotationAngle;
140 
141  if(parent == m_parentList[0]) {
142  m_pointList[0] = parent->RotateAtPosition(m_pointList[0], rotAngle);
143  UpdateSwitchesPosition();
144  UpdatePowerFlowArrowsPosition();
145  }
146 }
147 
149 {
150  if(parent == m_parentList[0]) {
151  m_parentList[0] = NULL;
152  m_online = false;
153  UpdateSwitchesPosition();
154  UpdatePowerFlowArrowsPosition();
155  }
156 }
157 
158 bool Machines::NodeContains(wxPoint2DDouble position)
159 {
160  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
161  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
162 
163  if(nodeRect.Contains(position)) {
164  m_activeNodeID = 1;
165  return true;
166  }
167 
168  m_activeNodeID = 0;
169  return false;
170 }
171 
173 {
174  if(parent && m_activeNodeID != 0) {
175  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
176  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
177 
178  if(parent->Intersects(nodeRect)) {
179  m_parentList[0] = parent;
180 
181  // Centralize the node on bus.
182  wxPoint2DDouble parentPt =
183  parent->RotateAtPosition(m_pointList[0], -parent->GetAngle()); // Rotate click to horizontal position.
184  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
185  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
186  m_pointList[0] = parentPt;
187 
188  UpdateSwitchesPosition();
189  UpdatePowerFlowArrowsPosition();
190  return true;
191  } else {
192  m_parentList[0] = NULL;
193  m_online = false;
194  }
195  }
196  return false;
197 }
198 
200 {
201  if(m_parentList[0]) {
202  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
203  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
204 
205  if(!m_parentList[0]->Intersects(nodeRect)) {
206  m_parentList[0]->RemoveChild(this);
207  m_parentList[0] = NULL;
208  m_online = false;
209  UpdateSwitchesPosition();
210  UpdatePowerFlowArrowsPosition();
211  }
212  }
213 }
214 
215 void Machines::Rotate(bool clockwise)
216 {
217  double rotAngle = m_rotationAngle;
218  if(!clockwise) rotAngle = -m_rotationAngle;
219 
220  m_angle += rotAngle;
221  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
222  m_pointList[2] = RotateAtPosition(m_pointList[2], rotAngle);
223  m_pointList[3] = RotateAtPosition(m_pointList[3], rotAngle);
224  UpdateSwitchesPosition();
225  UpdatePowerFlowArrowsPosition();
226 }
227 
228 void Machines::UpdatePowerFlowArrowsPosition()
229 {
230  std::vector<wxPoint2DDouble> edges;
231  switch(m_pfDirection) {
232  case PF_NONE: {
233  m_powerFlowArrow.clear();
234  } break;
235  case PF_TO_BUS: {
236  edges.push_back(m_pointList[2]);
237  edges.push_back(m_pointList[1]);
238  } break;
239  case PF_TO_ELEMENT: {
240  edges.push_back(m_pointList[1]);
241  edges.push_back(m_pointList[2]);
242  } break;
243  default:
244  break;
245  }
246 
247  CalculatePowerFlowPts(edges);
248 }
249 
251 {
252  m_pfDirection = pfDirection;
253  UpdatePowerFlowArrowsPosition();
254 }
double GetAngle() const
Get the element angle.
Definition: Element.h:201
-
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Machines.cpp:129
- -
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Machines.cpp:94
-
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:91
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Machines.h"
19 
21 #include "ControlElementSolver.h"
22 
23 Machines::Machines() : PowerElement() {}
24 Machines::~Machines() {}
25 bool Machines::AddParent(Element* parent, wxPoint2DDouble position)
26 {
27  if(parent) {
28  m_parentList.push_back(parent);
29  parent->AddChild(this);
30  wxPoint2DDouble parentPt =
31  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
32  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
33  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
34 
35  m_position = parentPt + wxPoint2DDouble(-100.0, 0.0); // Shifts the position to the left of the bus.
36  m_width = m_height = 50.0;
37  m_rect = wxRect2DDouble(m_position.m_x - 25.0, m_position.m_y - 25.0, m_width, m_height);
38 
39  m_pointList.push_back(parentPt);
40  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
41  m_pointList.push_back(m_position + wxPoint2DDouble(35.0, 0.0));
42  m_pointList.push_back(m_position + wxPoint2DDouble(25.0, 0.0));
43  m_inserted = true;
44 
45  wxRect2DDouble genRect(0, 0, 0, 0);
46  m_switchRect.push_back(genRect); // Push a general rectangle.
47  UpdateSwitches();
48  UpdatePowerFlowArrowsPosition();
49  return true;
50  }
51  return false;
52 }
53 
54 void Machines::Draw(wxPoint2DDouble translation, double scale) const
55 {
56  OpenGLColour elementColour;
57  if(m_online) {
58  if(m_dynEvent)
59  elementColour = m_dynamicEventColour;
60  else
61  elementColour = m_onlineElementColour;
62  } else
63  elementColour = m_offlineElementColour;
64 
65  if(m_inserted) {
66  // Draw Selection (layer 1).
67  if(m_selected) {
68  glLineWidth(1.5 + m_borderSize * 2.0);
69  glColor4dv(m_selectionColour.GetRGBA());
70  DrawCircle(m_position, 25.0 + (m_borderSize + 1.5) / scale, 20, GL_POLYGON);
71  DrawLine(m_pointList);
72 
73  // Draw node selection.
74  DrawCircle(m_pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
75  }
76 
77  // Draw Machines (layer 2).
78  glLineWidth(1.5);
79 
80  // Draw node.
81  glColor4dv(elementColour.GetRGBA());
82  DrawCircle(m_pointList[0], 5.0, 10, GL_POLYGON);
83 
84  DrawLine(m_pointList);
85 
86  DrawSwitches();
87  DrawPowerFlowPts();
88 
89  glColor4d(1.0, 1.0, 1.0, 1.0);
90  DrawCircle(m_position, 25.0, 20, GL_POLYGON);
91 
92  glColor4dv(elementColour.GetRGBA());
93  DrawCircle(m_position, 25.0, 20);
94 
95  // Draw machine symbol.
96  glLineWidth(2.0);
97  DrawSymbol();
98  }
99 }
100 
101 void Machines::UpdateSwitchesPosition()
102 {
103  if(m_parentList[0]) {
104  m_pointList[1] = GetSwitchPoint(m_parentList[0], m_pointList[0], m_pointList[2]);
105  } else {
106  m_pointList[1] = m_pointList[0];
107  }
108  UpdateSwitches();
109 }
110 
111 void Machines::Move(wxPoint2DDouble position)
112 {
113  SetPosition(m_movePos + position - m_moveStartPt);
114  for(int i = 2; i < (int)m_pointList.size(); i++) {
115  m_pointList[i] = m_movePts[i] + position - m_moveStartPt;
116  }
117  if(!m_parentList[0]) {
118  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
119  }
120  UpdateSwitchesPosition();
121  UpdatePowerFlowArrowsPosition();
122 }
123 
124 void Machines::MoveNode(Element* element, wxPoint2DDouble position)
125 {
126  if(element) {
127  if(element == m_parentList[0]) {
128  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
129  }
130  } else {
131  if(m_activeNodeID == 1) {
132  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
133  if(m_parentList[0]) {
134  m_parentList[0]->RemoveChild(this);
135  m_parentList[0] = NULL;
136  m_online = false;
137  }
138  }
139  }
140 
141  // Recalculate switches positions
142  UpdateSwitchesPosition();
143  UpdatePowerFlowArrowsPosition();
144 }
145 
146 void Machines::StartMove(wxPoint2DDouble position)
147 {
148  m_moveStartPt = position;
149  m_movePts = m_pointList;
150  m_movePos = m_position;
151 }
152 
153 void Machines::RotateNode(Element* parent, bool clockwise)
154 {
155  double rotAngle = m_rotationAngle;
156  if(!clockwise) rotAngle = -m_rotationAngle;
157 
158  if(parent == m_parentList[0]) {
159  m_pointList[0] = parent->RotateAtPosition(m_pointList[0], rotAngle);
160  UpdateSwitchesPosition();
161  UpdatePowerFlowArrowsPosition();
162  }
163 }
164 
166 {
167  if(parent == m_parentList[0]) {
168  m_parentList[0] = NULL;
169  m_online = false;
170  UpdateSwitchesPosition();
171  UpdatePowerFlowArrowsPosition();
172  }
173 }
174 
175 bool Machines::NodeContains(wxPoint2DDouble position)
176 {
177  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
178  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
179 
180  if(nodeRect.Contains(position)) {
181  m_activeNodeID = 1;
182  return true;
183  }
184 
185  m_activeNodeID = 0;
186  return false;
187 }
188 
190 {
191  if(parent && m_activeNodeID != 0) {
192  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
193  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
194 
195  if(parent->Intersects(nodeRect)) {
196  m_parentList[0] = parent;
197 
198  // Centralize the node on bus.
199  wxPoint2DDouble parentPt =
200  parent->RotateAtPosition(m_pointList[0], -parent->GetAngle()); // Rotate click to horizontal position.
201  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
202  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
203  m_pointList[0] = parentPt;
204 
205  UpdateSwitchesPosition();
206  UpdatePowerFlowArrowsPosition();
207  return true;
208  } else {
209  m_parentList[0] = NULL;
210  m_online = false;
211  }
212  }
213  return false;
214 }
215 
217 {
218  if(m_parentList[0]) {
219  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
220  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
221 
222  if(!m_parentList[0]->Intersects(nodeRect)) {
223  m_parentList[0]->RemoveChild(this);
224  m_parentList[0] = NULL;
225  m_online = false;
226  UpdateSwitchesPosition();
227  UpdatePowerFlowArrowsPosition();
228  }
229  }
230 }
231 
232 void Machines::Rotate(bool clockwise)
233 {
234  double rotAngle = m_rotationAngle;
235  if(!clockwise) rotAngle = -m_rotationAngle;
236 
237  m_angle += rotAngle;
238  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
239  m_pointList[2] = RotateAtPosition(m_pointList[2], rotAngle);
240  m_pointList[3] = RotateAtPosition(m_pointList[3], rotAngle);
241  UpdateSwitchesPosition();
242  UpdatePowerFlowArrowsPosition();
243 }
244 
245 void Machines::UpdatePowerFlowArrowsPosition()
246 {
247  std::vector<wxPoint2DDouble> edges;
248  switch(m_pfDirection) {
249  case PF_NONE: {
250  m_powerFlowArrow.clear();
251  } break;
252  case PF_TO_BUS: {
253  edges.push_back(m_pointList[2]);
254  edges.push_back(m_pointList[1]);
255  } break;
256  case PF_TO_ELEMENT: {
257  edges.push_back(m_pointList[1]);
258  edges.push_back(m_pointList[2]);
259  } break;
260  default:
261  break;
262  }
263 
264  CalculatePowerFlowPts(edges);
265 }
266 
268 {
269  m_pfDirection = pfDirection;
270  UpdatePowerFlowArrowsPosition();
271 }
double GetAngle() const
Get the element angle.
Definition: Element.h:212
+
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Machines.cpp:146
+ +
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Machines.cpp:111
+
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:107
virtual bool Intersects(wxRect2DDouble rect) const =0
Check if the element&#39;s rect intersects other rect.
-
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Machines.cpp:158
- -
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: Machines.cpp:250
-
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Machines.cpp:136
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Machines.cpp:8
-
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Machines.cpp:172
-
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Machines.cpp:199
-
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:333
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Machines.cpp:215
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Machines.cpp:37
- - - -
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:61
-
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Machines.cpp:148
- -
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:171
-
virtual void MoveNode(Element *element, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Machines.cpp:107
-
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:83
+
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Machines.cpp:175
+ +
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: Machines.cpp:267
+
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Machines.cpp:153
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Machines.cpp:25
+
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Machines.cpp:189
+
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Machines.cpp:216
+
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:353
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Machines.cpp:232
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Machines.cpp:54
+ + + + + +
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:78
+
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Machines.cpp:165
+ +
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:187
+
virtual void MoveNode(Element *element, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Machines.cpp:124
+
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:101
diff --git a/docs/doxygen/html/_machines_8h_source.html b/docs/doxygen/html/_machines_8h_source.html index ea9370b..9b7c76c 100644 --- a/docs/doxygen/html/_machines_8h_source.html +++ b/docs/doxygen/html/_machines_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,27 +88,27 @@ $(document).ready(function(){initNavTree('_machines_8h_source.html','');});
Machines.h
-
1 #ifndef MACHINES_H
2 #define MACHINES_H
3 
4 #include "PowerElement.h"
5 
8 
9 class Machines : public PowerElement
10 {
11  public:
12  enum SyncMachineModel { SM_MODEL_1 = 0, SM_MODEL_2, SM_MODEL_3, SM_MODEL_4, SM_MODEL_5 };
13 
14  Machines();
15  ~Machines();
16 
17  virtual bool AddParent(Element* parent, wxPoint2DDouble position);
18  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
19  virtual void Draw(wxPoint2DDouble translation, double scale) const;
20  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
21  virtual void Move(wxPoint2DDouble position);
22  virtual void MoveNode(Element* element, wxPoint2DDouble position);
23  virtual void StartMove(wxPoint2DDouble position);
24  virtual void RotateNode(Element* parent, bool clockwise = true);
25  virtual void RemoveParent(Element* parent);
26  virtual bool NodeContains(wxPoint2DDouble position);
27  virtual bool SetNodeParent(Element* parent);
28  virtual void UpdateNodes();
29  virtual void Rotate(bool clockwise = true);
30  virtual void DrawSymbol() const {}
31  virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection);
32 
33  protected:
34  void UpdateSwitchesPosition();
35  void UpdatePowerFlowArrowsPosition();
36  bool m_inserted = false;
37 };
38 
39 #endif // MACHINES_H
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Machines.h:18
-
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Machines.cpp:129
- - -
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Machines.cpp:94
-
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Machines.cpp:158
-
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: Machines.cpp:250
-
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Machines.cpp:136
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Machines.cpp:8
-
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Machines.cpp:172
-
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Machines.cpp:199
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef MACHINES_H
19 #define MACHINES_H
20 
21 #include "PowerElement.h"
22 
25 
26 class Machines : public PowerElement
27 {
28  public:
29  enum SyncMachineModel { SM_MODEL_1 = 0, SM_MODEL_2, SM_MODEL_3, SM_MODEL_4, SM_MODEL_5 };
30 
31  Machines();
32  ~Machines();
33 
34  virtual bool AddParent(Element* parent, wxPoint2DDouble position);
35  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
36  virtual void Draw(wxPoint2DDouble translation, double scale) const;
37  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
38  virtual void Move(wxPoint2DDouble position);
39  virtual void MoveNode(Element* element, wxPoint2DDouble position);
40  virtual void StartMove(wxPoint2DDouble position);
41  virtual void RotateNode(Element* parent, bool clockwise = true);
42  virtual void RemoveParent(Element* parent);
43  virtual bool NodeContains(wxPoint2DDouble position);
44  virtual bool SetNodeParent(Element* parent);
45  virtual void UpdateNodes();
46  virtual void Rotate(bool clockwise = true);
47  virtual void DrawSymbol() const {}
48  virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection);
49 
50  protected:
51  void UpdateSwitchesPosition();
52  void UpdatePowerFlowArrowsPosition();
53  bool m_inserted = false;
54 };
55 
56 #endif // MACHINES_H
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Machines.h:35
+
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Machines.cpp:146
+ +
Solves in the time the control system. Can solve the control system directly from a ControlEditor or ...
+
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Machines.cpp:111
+
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Machines.cpp:175
+
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: Machines.cpp:267
+
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Machines.cpp:153
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Machines.cpp:25
+
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Machines.cpp:189
+
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Machines.cpp:216
+
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
Switching data of power elements.
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Machines.cpp:215
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Machines.cpp:37
-
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Machines.h:20
- -
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:61
-
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Machines.cpp:148
- -
virtual void MoveNode(Element *element, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Machines.cpp:107
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Machines.cpp:232
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Machines.cpp:54
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Machines.h:37
+ +
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:78
+
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Machines.cpp:165
+ +
virtual void MoveNode(Element *element, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Machines.cpp:124
diff --git a/docs/doxygen/html/_main_frame_8cpp_source.html b/docs/doxygen/html/_main_frame_8cpp_source.html index a371fc9..224579e 100644 --- a/docs/doxygen/html/_main_frame_8cpp_source.html +++ b/docs/doxygen/html/_main_frame_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,31 +88,41 @@ $(document).ready(function(){initNavTree('_main_frame_8cpp_source.html','');});
MainFrame.cpp
-
1 #include "MainFrame.h"
2 #include "ArtMetro.h"
3 #include "Workspace.h"
4 #include "Bus.h"
5 #include "Line.h"
6 #include "Transformer.h"
7 #include "SyncGenerator.h"
8 #include "IndMotor.h"
9 #include "SyncMotor.h"
10 #include "Load.h"
11 #include "Inductor.h"
12 #include "Capacitor.h"
13 #include "FileHanding.h"
14 #include "GeneralPropertiesForm.h"
15 #include "SimulationsSettingsForm.h"
16 #include "PropertiesData.h"
17 #include "ChartView.h"
18 #include "DataReport.h"
19 #include "AboutForm.h"
20 
21 MainFrame::MainFrame() : MainFrameBase(NULL) {}
22 MainFrame::MainFrame(wxWindow* parent, wxLocale* locale, PropertiesData* initProperties) : MainFrameBase(parent)
23 {
24  m_locale = locale;
25  m_generalProperties = initProperties;
26 
27  Init();
28 }
29 
30 MainFrame::~MainFrame()
31 {
32  // if(m_artMetro) delete m_artMetro;
33  if(m_addElementsMenu) {
34  m_addElementsMenu->Disconnect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnAddElementsClick),
35  NULL, this);
36  delete m_addElementsMenu;
37  }
38  if(m_locale) delete m_locale;
39  if(m_generalProperties) delete m_generalProperties;
40 }
41 
42 void MainFrame::Init()
43 {
44  this->SetSize(800, 600);
45 
46  CreateAddElementsMenu();
47 
48  EnableCurrentProjectRibbon(false);
49 
50  m_artMetro = new wxRibbonMetroArtProvider();
51  m_ribbonBar->SetArtProvider(m_artMetro);
52  m_ribbonBar->Realize();
53 
54  this->Layout();
55 }
56 
57 void MainFrame::EnableCurrentProjectRibbon(bool enable)
58 {
59  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_ADDELEMENT, enable);
60  m_ribbonButtonBarReports->EnableButton(ID_RIBBON_CHARTS, enable);
61  m_ribbonButtonBarCProject->EnableButton(ID_RIBBON_CLOSE, enable);
62  m_ribbonButtonBarClipboard->EnableButton(ID_RIBBON_COPY, enable);
63  m_ribbonButtonBarReports->EnableButton(ID_RIBBON_DATAREPORT, enable);
64  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_DELETE, enable);
65  m_ribbonButtonBarContinuous->EnableButton(ID_RIBBON_DISABLESOL, enable);
66  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_DRAG, enable);
67  m_ribbonButtonBarContinuous->EnableButton(ID_RIBBON_ENABLESOL, enable);
68  m_ribbonButtonBarSimulations->EnableButton(ID_RIBBON_FAULT, enable);
69  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_FIT, enable);
70  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_MOVE, enable);
71  m_ribbonButtonBarClipboard->EnableButton(ID_RIBBON_PASTE, enable);
72  m_ribbonButtonBarSimulations->EnableButton(ID_RIBBON_POWERFLOW, enable);
73  m_ribbonButtonBarClipboard->EnableButton(ID_RIBBON_REDO, enable);
74  m_ribbonButtonBarContinuous->EnableButton(ID_RIBBON_RESETVOLT, enable);
75  m_ribbonButtonBarSimulations->EnableButton(ID_RIBBON_RUNSTAB, enable);
76  m_ribbonButtonBarCProject->EnableButton(ID_RIBBON_SAVE, enable);
77  m_ribbonButtonBarCProject->EnableButton(ID_RIBBON_SAVEAS, enable);
78  m_ribbonButtonBarSimulations->EnableButton(ID_RIBBON_SCPOWER, enable);
79  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_PROJSETTINGS, enable);
80  m_ribbonButtonBarReports->EnableButton(ID_RIBBON_SNAPSHOT, enable);
81  m_ribbonButtonBarSimulations->EnableButton(ID_RIBBON_SIMULSETTINGS, enable);
82  m_ribbonButtonBarClipboard->EnableButton(ID_RIBBON_UNDO, enable);
83  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_ROTATEC, enable);
84  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_ROTATECC, enable);
85 }
86 
87 void MainFrame::CreateAddElementsMenu()
88 {
89  m_addElementsMenu = new wxMenu();
90 
91  wxMenuItem* busElement =
92  new wxMenuItem(m_addElementsMenu, ID_ADDMENU_BUS, _("&Bus\tB"), _("Adds a bus at the circuit"));
93  // busElement->SetBitmap(wxArtProvider::GetBitmap(wxART_WARNING));
94  wxMenuItem* lineElement =
95  new wxMenuItem(m_addElementsMenu, ID_ADDMENU_LINE, _("&Line\tL"), _("Adds a power line at the circuit"));
96  wxMenuItem* transformerElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_TRANSFORMER, _("&Transformer\tT"),
97  _("Adds a transformer at the circuit"));
98  wxMenuItem* generatorElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_GENERATOR, _("&Generator\tG"),
99  _("Adds a generator at the circuit"));
100  wxMenuItem* indMotorElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_INDMOTOR, _("&Induction motor\tI"),
101  _("Adds an induction motor at the circuit"));
102  wxMenuItem* syncCompElement =
103  new wxMenuItem(m_addElementsMenu, ID_ADDMENU_SYNCCOMP, _("&Synchronous compensator \tK"),
104  _("Adds an induction motor at the circuit"));
105  wxMenuItem* loadElement =
106  new wxMenuItem(m_addElementsMenu, ID_ADDMENU_LOAD, _("&Load\tShift-L"), _("Adds a load at the circuit"));
107  wxMenuItem* capacitorElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_CAPACITOR, _("&Capacitor\tShift-C"),
108  _("Adds a shunt capacitor at the circuit"));
109  wxMenuItem* inductorElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_INDUCTOR, _("&Inductor\tShift-I"),
110  _("Adds a shunt inductor at the circuit"));
111 
112  m_addElementsMenu->Append(busElement);
113  m_addElementsMenu->Append(lineElement);
114  m_addElementsMenu->Append(transformerElement);
115  m_addElementsMenu->Append(generatorElement);
116  m_addElementsMenu->Append(indMotorElement);
117  m_addElementsMenu->Append(syncCompElement);
118  m_addElementsMenu->Append(loadElement);
119  m_addElementsMenu->Append(capacitorElement);
120  m_addElementsMenu->Append(inductorElement);
121 
122  m_addElementsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnAddElementsClick, this);
123 }
124 
125 void MainFrame::OnNewClick(wxRibbonButtonBarEvent& event)
126 {
127  EnableCurrentProjectRibbon();
128 
129  Workspace* newWorkspace =
130  new Workspace(this, wxString::Format(_("New project %d"), m_projectNumber), this->GetStatusBar());
131  m_workspaceList.push_back(newWorkspace);
132 
133  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true);
134  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);
135 
136  m_auiNotebook->AddPage(newWorkspace, newWorkspace->GetName(), true);
137  newWorkspace->Redraw();
138  m_projectNumber++;
139 }
140 
141 void MainFrame::OnAboutClick(wxRibbonButtonBarEvent& event)
142 {
143  AboutForm about(this);
144  about.ShowModal();
145 }
146 
147 void MainFrame::OnAddElementDropdown(wxRibbonButtonBarEvent& event) { event.PopupMenu(m_addElementsMenu); }
148 void MainFrame::OnChartsClick(wxRibbonButtonBarEvent& event)
149 {
150  if(Workspace* workspace = dynamic_cast<Workspace*>(m_auiNotebook->GetCurrentPage())) {
151  std::vector<ElementPlotData> plotDataList;
152  auto elementList = workspace->GetElementList();
153  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
154  if(PowerElement* powerElement = dynamic_cast<PowerElement*>(*it)) {
155  ElementPlotData plotData;
156  if(powerElement->GetPlotData(plotData)) plotDataList.push_back(plotData);
157  }
158  }
159  ChartView* cView = new ChartView(workspace, plotDataList, workspace->GetStabilityTimeVector());
160  cView->Show();
161  }
162 }
163 
164 void MainFrame::OnCloseClick(wxRibbonButtonBarEvent& event) {}
165 void MainFrame::OnCopyClick(wxRibbonButtonBarEvent& event) {}
166 void MainFrame::OnDataReportClick(wxRibbonButtonBarEvent& event)
167 {
168  if(Workspace* workspace = dynamic_cast<Workspace*>(m_auiNotebook->GetCurrentPage())) {
169  DataReport* dataReport = new DataReport(workspace, workspace);
170  dataReport->Show();
171  }
172 }
173 void MainFrame::OnDeleteClick(wxRibbonButtonBarEvent& event)
174 {
175  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
176  if(workspace) {
177  workspace->DeleteSelectedElements();
178  }
179 }
180 void MainFrame::OnDisableSolutionClick(wxRibbonButtonBarEvent& event)
181 {
182  if(Workspace* workspace = dynamic_cast<Workspace*>(m_auiNotebook->GetCurrentPage())) {
183  workspace->SetContinuousCalculationActive(false);
184  }
185  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true);
186  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);
187 }
188 
189 void MainFrame::OnDragClick(wxRibbonButtonBarEvent& event) {}
190 void MainFrame::OnEnableSolutionClick(wxRibbonButtonBarEvent& event)
191 {
192  if(Workspace* workspace = dynamic_cast<Workspace*>(m_auiNotebook->GetCurrentPage())) {
193  workspace->SetContinuousCalculationActive(true);
194  workspace->RunStaticStudies();
195  }
196  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, true);
197  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, false);
198 }
199 
200 void MainFrame::OnExpImpClick(wxRibbonButtonBarEvent& event) {}
201 void MainFrame::OnFaultClick(wxRibbonButtonBarEvent& event)
202 {
203  if(Workspace* workspace = dynamic_cast<Workspace*>(m_auiNotebook->GetCurrentPage())) {
204  workspace->RunFault();
205  }
206 }
207 
208 void MainFrame::OnFitClick(wxRibbonButtonBarEvent& event)
209 {
210  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
211  if(workspace) {
212  workspace->Fit();
213  }
214 }
215 
216 void MainFrame::OnMoveClick(wxRibbonButtonBarEvent& event)
217 {
218  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
219  if(workspace) {
220  auto elementList = workspace->GetAllElements();
221  // Calculate the average position of selected elements.
222  wxPoint2DDouble averagePos(0, 0);
223  int numSelElements = 0;
224  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
225  Element* element = *it;
226  if(element->IsSelected()) {
227  averagePos += element->GetPosition();
228  numSelElements++;
229  }
230  }
231  averagePos = wxPoint2DDouble(averagePos.m_x / double(numSelElements), averagePos.m_y / double(numSelElements));
232  // Set the move position to the average of selected elements.
233  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
234  Element* element = *it;
235  if(element->IsSelected()) {
236  element->StartMove(averagePos);
237  }
238  }
239  workspace->SetWorkspaceMode(Workspace::MODE_MOVE_ELEMENT);
240  }
241 }
242 
243 void MainFrame::OnOpenClick(wxRibbonButtonBarEvent& event)
244 {
245  wxFileDialog openFileDialog(this, _("Open PSP file"), "", "", "PSP files (*.psp)|*.psp",
246  wxFD_OPEN | wxFD_FILE_MUST_EXIST);
247  if(openFileDialog.ShowModal() == wxID_CANCEL) return;
248 
249  wxFileName fileName(openFileDialog.GetPath());
250 
251  EnableCurrentProjectRibbon();
252  Workspace* newWorkspace = new Workspace(this, _("Open project"), this->GetStatusBar());
253 
254  FileHanding fileHandling(newWorkspace);
255  if(fileHandling.OpenProject(fileName)) {
256  newWorkspace->SetSavedPath(fileName);
257 
258  m_workspaceList.push_back(newWorkspace);
259 
260  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true);
261  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);
262 
263  m_auiNotebook->AddPage(newWorkspace, newWorkspace->GetName(), true);
264  m_auiNotebook->Layout();
265  newWorkspace->Redraw();
266  newWorkspace->SetJustOpened(true);
267  m_projectNumber++;
268  } else {
269  wxMessageDialog msgDialog(this, _("It was not possible to open the selected file."), _("Error"),
270  wxOK | wxCENTRE | wxICON_ERROR);
271  msgDialog.ShowModal();
272  delete newWorkspace;
273  }
274 }
275 
276 void MainFrame::OnPSPGuideClick(wxRibbonButtonBarEvent& event) {}
277 void MainFrame::OnPasteClick(wxRibbonButtonBarEvent& event) {}
278 void MainFrame::OnPowerFlowClick(wxRibbonButtonBarEvent& event)
279 {
280  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
281  if(workspace) {
282  workspace->RunPowerFlow();
283  }
284 }
285 
286 void MainFrame::OnRedoClick(wxRibbonButtonBarEvent& event) {}
287 void MainFrame::OnResetVoltagesClick(wxRibbonButtonBarEvent& event) {}
288 void MainFrame::OnRunStabilityClick(wxRibbonButtonBarEvent& event)
289 {
290  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
291  if(workspace) {
292  workspace->RunStability();
293  }
294 }
295 
296 void MainFrame::OnSCPowerClick(wxRibbonButtonBarEvent& event)
297 {
298  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
299  if(workspace) {
300  workspace->RunSCPower();
301  }
302 }
303 
304 void MainFrame::OnSaveAsClick(wxRibbonButtonBarEvent& event)
305 {
306  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
307  if(workspace) {
308  FileHanding fileHandling(workspace);
309 
310  wxFileDialog saveFileDialog(this, _("Save PSP file"), "", "", "PSP files (*.psp)|*.psp",
311  wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
312  if(saveFileDialog.ShowModal() == wxID_CANCEL) return;
313 
314  fileHandling.SaveProject(saveFileDialog.GetPath());
315  wxFileName fileName(saveFileDialog.GetPath());
316  workspace->SetName(fileName.GetName());
317  m_auiNotebook->SetPageText(m_auiNotebook->GetPageIndex(workspace), workspace->GetName());
318  workspace->SetSavedPath(fileName);
319  }
320 }
321 
322 void MainFrame::OnSaveClick(wxRibbonButtonBarEvent& event)
323 {
324  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
325  if(workspace) {
326  FileHanding fileHandling(workspace);
327 
328  if(workspace->GetSavedPath().IsOk()) {
329  fileHandling.SaveProject(workspace->GetSavedPath());
330  } else {
331  wxFileDialog saveFileDialog(this, _("Save PSP file"), "", "", "PSP files (*.psp)|*.psp",
332  wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
333  if(saveFileDialog.ShowModal() == wxID_CANCEL) return;
334 
335  fileHandling.SaveProject(saveFileDialog.GetPath());
336  wxFileName fileName(saveFileDialog.GetPath());
337  workspace->SetName(fileName.GetName());
338  m_auiNotebook->SetPageText(m_auiNotebook->GetPageIndex(workspace), workspace->GetName());
339  workspace->SetSavedPath(fileName);
340  }
341  }
342 }
343 
344 void MainFrame::OnSnapshotClick(wxRibbonButtonBarEvent& event) {}
345 void MainFrame::OnUndoClick(wxRibbonButtonBarEvent& event) {}
346 void MainFrame::OnAddElementsClick(wxCommandEvent& event)
347 {
348  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
349 
350  if(workspace) {
351  if(workspace->GetWorkspaceMode() != Workspace::MODE_INSERT) {
352  auto elementList = workspace->GetElementList();
353  wxString statusBarText = "";
354  bool newElement = false;
355 
356  switch(event.GetId()) {
357  case ID_ADDMENU_BUS: {
358  Bus* newBus = new Bus(wxPoint2DDouble(0, 0),
359  wxString::Format(_("Bus %d"), workspace->GetElementNumber(ID_BUS)));
360  workspace->IncrementElementNumber(ID_BUS);
361  elementList.push_back(newBus);
362  statusBarText = _("Insert Bus: Click to insert, ESC to cancel.");
363  newElement = true;
364  } break;
365  case ID_ADDMENU_LINE: {
366  Line* newLine = new Line(wxString::Format(_("Line %d"), workspace->GetElementNumber(ID_LINE)));
367  elementList.push_back(newLine);
368  workspace->IncrementElementNumber(ID_LINE);
369  statusBarText = _("Insert Line: Click on two buses, ESC to cancel.");
370  newElement = true;
371  } break;
372  case ID_ADDMENU_TRANSFORMER: {
373  Transformer* newTransformer = new Transformer(
374  wxString::Format(_("Transformer %d"), workspace->GetElementNumber(ID_TRANSFORMER)));
375  workspace->IncrementElementNumber(ID_TRANSFORMER);
376  elementList.push_back(newTransformer);
377  statusBarText = _("Insert Transformer: Click on two buses, ESC to cancel.");
378  newElement = true;
379  } break;
380  case ID_ADDMENU_GENERATOR: {
381  SyncGenerator* newGenerator = new SyncGenerator(
382  wxString::Format(_("Generator %d"), workspace->GetElementNumber(ID_SYNCGENERATOR)));
383  workspace->IncrementElementNumber(ID_SYNCGENERATOR);
384  elementList.push_back(newGenerator);
385  statusBarText = _("Insert Generator: Click on a buses, ESC to cancel.");
386  newElement = true;
387  } break;
388  case ID_ADDMENU_LOAD: {
389  Load* newLoad = new Load(wxString::Format(_("Load %d"), workspace->GetElementNumber(ID_LOAD)));
390  workspace->IncrementElementNumber(ID_LOAD);
391  elementList.push_back(newLoad);
392  statusBarText = _("Insert Load: Click on a buses, ESC to cancel.");
393  newElement = true;
394  } break;
395  case ID_ADDMENU_CAPACITOR: {
396  Capacitor* newCapacitor =
397  new Capacitor(wxString::Format(_("Capacitor %d"), workspace->GetElementNumber(ID_CAPACITOR)));
398  workspace->IncrementElementNumber(ID_CAPACITOR);
399  elementList.push_back(newCapacitor);
400  statusBarText = _("Insert Capacitor: Click on a buses, ESC to cancel.");
401  newElement = true;
402  } break;
403  case ID_ADDMENU_INDUCTOR: {
404  Inductor* newInductor =
405  new Inductor(wxString::Format(_("Inductor %d"), workspace->GetElementNumber(ID_INDUCTOR)));
406  workspace->IncrementElementNumber(ID_INDUCTOR);
407  elementList.push_back(newInductor);
408  statusBarText = _("Insert Inductor: Click on a buses, ESC to cancel.");
409  newElement = true;
410  } break;
411  case ID_ADDMENU_INDMOTOR: {
412  IndMotor* newIndMotor = new IndMotor(
413  wxString::Format(_("Induction motor %d"), workspace->GetElementNumber(ID_INDMOTOR)));
414  workspace->IncrementElementNumber(ID_INDMOTOR);
415  elementList.push_back(newIndMotor);
416  statusBarText = _("Insert Induction Motor: Click on a buses, ESC to cancel.");
417  newElement = true;
418  } break;
419  case ID_ADDMENU_SYNCCOMP: {
420  SyncMotor* newSyncCondenser = new SyncMotor(
421  wxString::Format(_("Synchronous condenser %d"), workspace->GetElementNumber(ID_SYNCMOTOR)));
422  workspace->IncrementElementNumber(ID_SYNCMOTOR);
423  elementList.push_back(newSyncCondenser);
424  statusBarText = _("Insert Synchronous Condenser: Click on a buses, ESC to cancel.");
425  newElement = true;
426  } break;
427  }
428  if(newElement) {
429  workspace->SetElementList(elementList);
430  workspace->SetWorkspaceMode(Workspace::MODE_INSERT);
431  workspace->SetStatusBarText(statusBarText);
432  workspace->Redraw();
433  }
434  }
435  }
436 }
437 void MainFrame::NotebookPageClosed(wxAuiNotebookEvent& event)
438 {
439  if(m_auiNotebook->GetPageCount() == 0) EnableCurrentProjectRibbon(false);
440 }
441 
442 void MainFrame::NotebookPageClosing(wxAuiNotebookEvent& event)
443 {
444  auto it = m_workspaceList.begin();
445  while(it != m_workspaceList.end()) {
446  if(*it == m_auiNotebook->GetCurrentPage()) {
447  m_workspaceList.erase(it);
448  break;
449  }
450  it++;
451  }
452  event.Skip();
453 }
454 
455 void MainFrame::OnRotClockClick(wxRibbonButtonBarEvent& event)
456 {
457  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
458  if(workspace) {
459  workspace->RotateSelectedElements();
460  }
461 }
462 
463 void MainFrame::OnRotCounterClockClick(wxRibbonButtonBarEvent& event)
464 {
465  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
466  if(workspace) {
467  workspace->RotateSelectedElements(false);
468  }
469 }
470 
471 void MainFrame::OnGeneralSettingsClick(wxRibbonButtonBarEvent& event)
472 {
473  GeneralPropertiesForm genPropForm(this, m_generalProperties);
474  genPropForm.SetInitialSize();
475  genPropForm.ShowModal();
476 }
477 
478 void MainFrame::OnSimulationSettingsClick(wxRibbonButtonBarEvent& event)
479 {
480  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
481  if(workspace) {
482  SimulationsSettingsForm simulSettingsForm(this, workspace->GetProperties());
483  simulSettingsForm.SetInitialSize();
484  simulSettingsForm.ShowModal();
485  }
486 }
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "MainFrame.h"
19 #include "ArtMetro.h"
20 #include "Workspace.h"
21 #include "Bus.h"
22 #include "Line.h"
23 #include "Transformer.h"
24 #include "SyncGenerator.h"
25 #include "IndMotor.h"
26 #include "SyncMotor.h"
27 #include "Load.h"
28 #include "Inductor.h"
29 #include "Capacitor.h"
30 #include "FileHanding.h"
31 #include "GeneralPropertiesForm.h"
33 #include "PropertiesData.h"
34 #include "ChartView.h"
35 #include "DataReport.h"
36 #include "AboutForm.h"
37 
39 MainFrame::MainFrame(wxWindow* parent, wxLocale* locale, PropertiesData* initProperties, wxString openPath)
40  : MainFrameBase(parent)
41 {
42  m_locale = locale;
43  m_generalProperties = initProperties;
44 
45  Init();
46 
47  if(openPath != "") {
48  EnableCurrentProjectRibbon();
49  Workspace* newWorkspace = new Workspace(this, _("Open project"), this->GetStatusBar());
50 
51  FileHanding fileHandling(newWorkspace);
52  if(fileHandling.OpenProject(openPath)) {
53  newWorkspace->SetSavedPath(openPath);
54 
55  m_workspaceList.push_back(newWorkspace);
56 
57  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true);
58  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);
59 
60  m_auiNotebook->AddPage(newWorkspace, newWorkspace->GetName(), true);
61  m_auiNotebook->Layout();
62  newWorkspace->Redraw();
63  newWorkspace->SetJustOpened(true);
64  m_projectNumber++;
65  }
66  }
67 }
68 
70 {
71  // if(m_artMetro) delete m_artMetro;
72  if(m_addElementsMenu) {
73  m_addElementsMenu->Disconnect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnAddElementsClick),
74  NULL, this);
75  delete m_addElementsMenu;
76  }
77  if(m_locale) delete m_locale;
78  if(m_generalProperties) delete m_generalProperties;
79 }
80 
81 void MainFrame::Init()
82 {
83  this->SetSize(800, 600);
84 
85  CreateAddElementsMenu();
86 
87  EnableCurrentProjectRibbon(false);
88 
89  m_artMetro = new wxRibbonMetroArtProvider();
90  m_ribbonBar->SetArtProvider(m_artMetro);
91  m_ribbonBar->Realize();
92 
93  this->Layout();
94 }
95 
96 void MainFrame::EnableCurrentProjectRibbon(bool enable)
97 {
98  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_ADDELEMENT, enable);
99  m_ribbonButtonBarReports->EnableButton(ID_RIBBON_CHARTS, enable);
100  m_ribbonButtonBarCProject->EnableButton(ID_RIBBON_CLOSE, enable);
101  m_ribbonButtonBarClipboard->EnableButton(ID_RIBBON_COPY, enable);
102  m_ribbonButtonBarReports->EnableButton(ID_RIBBON_DATAREPORT, enable);
103  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_DELETE, enable);
104  m_ribbonButtonBarContinuous->EnableButton(ID_RIBBON_DISABLESOL, enable);
105  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_DRAG, enable);
106  m_ribbonButtonBarContinuous->EnableButton(ID_RIBBON_ENABLESOL, enable);
107  m_ribbonButtonBarSimulations->EnableButton(ID_RIBBON_FAULT, enable);
108  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_FIT, enable);
109  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_MOVE, enable);
110  m_ribbonButtonBarClipboard->EnableButton(ID_RIBBON_PASTE, enable);
111  m_ribbonButtonBarSimulations->EnableButton(ID_RIBBON_POWERFLOW, enable);
112  m_ribbonButtonBarClipboard->EnableButton(ID_RIBBON_REDO, enable);
113  m_ribbonButtonBarContinuous->EnableButton(ID_RIBBON_RESETVOLT, enable);
114  m_ribbonButtonBarSimulations->EnableButton(ID_RIBBON_RUNSTAB, enable);
115  m_ribbonButtonBarCProject->EnableButton(ID_RIBBON_SAVE, enable);
116  m_ribbonButtonBarCProject->EnableButton(ID_RIBBON_SAVEAS, enable);
117  m_ribbonButtonBarSimulations->EnableButton(ID_RIBBON_SCPOWER, enable);
118  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_PROJSETTINGS, enable);
119  m_ribbonButtonBarReports->EnableButton(ID_RIBBON_SNAPSHOT, enable);
120  m_ribbonButtonBarSimulations->EnableButton(ID_RIBBON_SIMULSETTINGS, enable);
121  m_ribbonButtonBarClipboard->EnableButton(ID_RIBBON_UNDO, enable);
122  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_ROTATEC, enable);
123  m_ribbonButtonBarCircuit->EnableButton(ID_RIBBON_ROTATECC, enable);
124 }
125 
126 void MainFrame::CreateAddElementsMenu()
127 {
128  m_addElementsMenu = new wxMenu();
129 
130  wxMenuItem* busElement =
131  new wxMenuItem(m_addElementsMenu, ID_ADDMENU_BUS, _("&Bus\tB"), _("Adds a bus at the circuit"));
132  // busElement->SetBitmap(wxArtProvider::GetBitmap(wxART_WARNING));
133  wxMenuItem* lineElement =
134  new wxMenuItem(m_addElementsMenu, ID_ADDMENU_LINE, _("&Line\tL"), _("Adds a power line at the circuit"));
135  wxMenuItem* transformerElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_TRANSFORMER, _("&Transformer\tT"),
136  _("Adds a transformer at the circuit"));
137  wxMenuItem* generatorElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_GENERATOR, _("&Generator\tG"),
138  _("Adds a generator at the circuit"));
139  wxMenuItem* indMotorElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_INDMOTOR, _("&Induction motor\tI"),
140  _("Adds an induction motor at the circuit"));
141  wxMenuItem* syncCompElement =
142  new wxMenuItem(m_addElementsMenu, ID_ADDMENU_SYNCCOMP, _("&Synchronous compensator \tK"),
143  _("Adds an induction motor at the circuit"));
144  wxMenuItem* loadElement =
145  new wxMenuItem(m_addElementsMenu, ID_ADDMENU_LOAD, _("&Load\tShift-L"), _("Adds a load at the circuit"));
146  wxMenuItem* capacitorElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_CAPACITOR, _("&Capacitor\tShift-C"),
147  _("Adds a shunt capacitor at the circuit"));
148  wxMenuItem* inductorElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_INDUCTOR, _("&Inductor\tShift-I"),
149  _("Adds a shunt inductor at the circuit"));
150 
151  m_addElementsMenu->Append(busElement);
152  m_addElementsMenu->Append(lineElement);
153  m_addElementsMenu->Append(transformerElement);
154  m_addElementsMenu->Append(generatorElement);
155  m_addElementsMenu->Append(indMotorElement);
156  m_addElementsMenu->Append(syncCompElement);
157  m_addElementsMenu->Append(loadElement);
158  m_addElementsMenu->Append(capacitorElement);
159  m_addElementsMenu->Append(inductorElement);
160 
161  m_addElementsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnAddElementsClick, this);
162 }
163 
164 void MainFrame::OnNewClick(wxRibbonButtonBarEvent& event)
165 {
166  EnableCurrentProjectRibbon();
167 
168  Workspace* newWorkspace =
169  new Workspace(this, wxString::Format(_("New project %d"), m_projectNumber), this->GetStatusBar());
170  m_workspaceList.push_back(newWorkspace);
171 
172  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true);
173  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);
174 
175  m_auiNotebook->AddPage(newWorkspace, newWorkspace->GetName(), true);
176  newWorkspace->Redraw();
177  m_projectNumber++;
178 }
179 
180 void MainFrame::OnAboutClick(wxRibbonButtonBarEvent& event)
181 {
182  AboutForm about(this);
183  about.ShowModal();
184 }
185 
186 void MainFrame::OnAddElementDropdown(wxRibbonButtonBarEvent& event) { event.PopupMenu(m_addElementsMenu); }
187 void MainFrame::OnChartsClick(wxRibbonButtonBarEvent& event)
188 {
189  if(Workspace* workspace = dynamic_cast<Workspace*>(m_auiNotebook->GetCurrentPage())) {
190  std::vector<ElementPlotData> plotDataList;
191  auto elementList = workspace->GetElementList();
192  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
193  if(PowerElement* powerElement = dynamic_cast<PowerElement*>(*it)) {
194  ElementPlotData plotData;
195  if(powerElement->GetPlotData(plotData)) plotDataList.push_back(plotData);
196  }
197  }
198  ChartView* cView = new ChartView(workspace, plotDataList, workspace->GetStabilityTimeVector());
199  cView->Show();
200  }
201 }
202 
203 void MainFrame::OnCloseClick(wxRibbonButtonBarEvent& event) {}
204 void MainFrame::OnCopyClick(wxRibbonButtonBarEvent& event) {}
205 void MainFrame::OnDataReportClick(wxRibbonButtonBarEvent& event)
206 {
207  if(Workspace* workspace = dynamic_cast<Workspace*>(m_auiNotebook->GetCurrentPage())) {
208  DataReport* dataReport = new DataReport(workspace, workspace);
209  dataReport->Show();
210  }
211 }
212 void MainFrame::OnDeleteClick(wxRibbonButtonBarEvent& event)
213 {
214  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
215  if(workspace) {
216  workspace->DeleteSelectedElements();
217  }
218 }
219 void MainFrame::OnDisableSolutionClick(wxRibbonButtonBarEvent& event)
220 {
221  if(Workspace* workspace = dynamic_cast<Workspace*>(m_auiNotebook->GetCurrentPage())) {
222  workspace->SetContinuousCalculationActive(false);
223  }
224  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true);
225  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);
226 }
227 
228 void MainFrame::OnDragClick(wxRibbonButtonBarEvent& event) {}
229 void MainFrame::OnEnableSolutionClick(wxRibbonButtonBarEvent& event)
230 {
231  if(Workspace* workspace = dynamic_cast<Workspace*>(m_auiNotebook->GetCurrentPage())) {
232  workspace->SetContinuousCalculationActive(true);
233  workspace->RunStaticStudies();
234  }
235  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, true);
236  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, false);
237 }
238 
239 void MainFrame::OnExpImpClick(wxRibbonButtonBarEvent& event) {}
240 void MainFrame::OnFaultClick(wxRibbonButtonBarEvent& event)
241 {
242  if(Workspace* workspace = dynamic_cast<Workspace*>(m_auiNotebook->GetCurrentPage())) {
243  workspace->RunFault();
244  }
245 }
246 
247 void MainFrame::OnFitClick(wxRibbonButtonBarEvent& event)
248 {
249  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
250  if(workspace) {
251  workspace->Fit();
252  }
253 }
254 
255 void MainFrame::OnMoveClick(wxRibbonButtonBarEvent& event)
256 {
257  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
258  if(workspace) {
259  auto elementList = workspace->GetAllElements();
260  // Calculate the average position of selected elements.
261  wxPoint2DDouble averagePos(0, 0);
262  int numSelElements = 0;
263  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
264  Element* element = *it;
265  if(element->IsSelected()) {
266  averagePos += element->GetPosition();
267  numSelElements++;
268  }
269  }
270  averagePos = wxPoint2DDouble(averagePos.m_x / double(numSelElements), averagePos.m_y / double(numSelElements));
271  // Set the move position to the average of selected elements.
272  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
273  Element* element = *it;
274  if(element->IsSelected()) {
275  element->StartMove(averagePos);
276  }
277  }
278  workspace->SetWorkspaceMode(Workspace::MODE_MOVE_ELEMENT);
279  }
280 }
281 
282 void MainFrame::OnOpenClick(wxRibbonButtonBarEvent& event)
283 {
284  wxFileDialog openFileDialog(this, _("Open PSP file"), "", "", "PSP files (*.psp)|*.psp",
285  wxFD_OPEN | wxFD_FILE_MUST_EXIST);
286  if(openFileDialog.ShowModal() == wxID_CANCEL) return;
287 
288  wxFileName fileName(openFileDialog.GetPath());
289 
290  EnableCurrentProjectRibbon();
291  Workspace* newWorkspace = new Workspace(this, _("Open project"), this->GetStatusBar());
292 
293  FileHanding fileHandling(newWorkspace);
294  if(fileHandling.OpenProject(fileName)) {
295  newWorkspace->SetSavedPath(fileName);
296 
297  m_workspaceList.push_back(newWorkspace);
298 
299  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true);
300  m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);
301 
302  m_auiNotebook->AddPage(newWorkspace, newWorkspace->GetName(), true);
303  m_auiNotebook->Layout();
304  newWorkspace->Redraw();
305  newWorkspace->SetJustOpened(true);
306  m_projectNumber++;
307  } else {
308  wxMessageDialog msgDialog(this, _("It was not possible to open the selected file."), _("Error"),
309  wxOK | wxCENTRE | wxICON_ERROR);
310  msgDialog.ShowModal();
311  delete newWorkspace;
312  }
313 }
314 
315 void MainFrame::OnPSPGuideClick(wxRibbonButtonBarEvent& event) {}
316 void MainFrame::OnPasteClick(wxRibbonButtonBarEvent& event) {}
317 void MainFrame::OnPowerFlowClick(wxRibbonButtonBarEvent& event)
318 {
319  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
320  if(workspace) {
321  workspace->RunPowerFlow();
322  }
323 }
324 
325 void MainFrame::OnRedoClick(wxRibbonButtonBarEvent& event) {}
326 void MainFrame::OnResetVoltagesClick(wxRibbonButtonBarEvent& event) {}
327 void MainFrame::OnRunStabilityClick(wxRibbonButtonBarEvent& event)
328 {
329  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
330  if(workspace) {
331  workspace->RunStability();
332  }
333 }
334 
335 void MainFrame::OnSCPowerClick(wxRibbonButtonBarEvent& event)
336 {
337  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
338  if(workspace) {
339  workspace->RunSCPower();
340  }
341 }
342 
343 void MainFrame::OnSaveAsClick(wxRibbonButtonBarEvent& event)
344 {
345  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
346  if(workspace) {
347  FileHanding fileHandling(workspace);
348 
349  wxFileDialog saveFileDialog(this, _("Save PSP file"), "", "", "PSP files (*.psp)|*.psp",
350  wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
351  if(saveFileDialog.ShowModal() == wxID_CANCEL) return;
352 
353  fileHandling.SaveProject(saveFileDialog.GetPath());
354  wxFileName fileName(saveFileDialog.GetPath());
355  workspace->SetName(fileName.GetName());
356  m_auiNotebook->SetPageText(m_auiNotebook->GetPageIndex(workspace), workspace->GetName());
357  workspace->SetSavedPath(fileName);
358  }
359 }
360 
361 void MainFrame::OnSaveClick(wxRibbonButtonBarEvent& event)
362 {
363  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
364  if(workspace) {
365  FileHanding fileHandling(workspace);
366 
367  if(workspace->GetSavedPath().IsOk()) {
368  fileHandling.SaveProject(workspace->GetSavedPath());
369  } else {
370  wxFileDialog saveFileDialog(this, _("Save PSP file"), "", "", "PSP files (*.psp)|*.psp",
371  wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
372  if(saveFileDialog.ShowModal() == wxID_CANCEL) return;
373 
374  fileHandling.SaveProject(saveFileDialog.GetPath());
375  wxFileName fileName(saveFileDialog.GetPath());
376  workspace->SetName(fileName.GetName());
377  m_auiNotebook->SetPageText(m_auiNotebook->GetPageIndex(workspace), workspace->GetName());
378  workspace->SetSavedPath(fileName);
379  }
380  }
381 }
382 
383 void MainFrame::OnSnapshotClick(wxRibbonButtonBarEvent& event) {}
384 void MainFrame::OnUndoClick(wxRibbonButtonBarEvent& event) {}
385 void MainFrame::OnAddElementsClick(wxCommandEvent& event)
386 {
387  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
388 
389  if(workspace) {
390  if(workspace->GetWorkspaceMode() != Workspace::MODE_INSERT) {
391  auto elementList = workspace->GetElementList();
392  wxString statusBarText = "";
393  bool newElement = false;
394 
395  switch(event.GetId()) {
396  case ID_ADDMENU_BUS: {
397  Bus* newBus = new Bus(wxPoint2DDouble(0, 0),
398  wxString::Format(_("Bus %d"), workspace->GetElementNumber(ID_BUS)));
399  workspace->IncrementElementNumber(ID_BUS);
400  elementList.push_back(newBus);
401  statusBarText = _("Insert Bus: Click to insert, ESC to cancel.");
402  newElement = true;
403  } break;
404  case ID_ADDMENU_LINE: {
405  Line* newLine = new Line(wxString::Format(_("Line %d"), workspace->GetElementNumber(ID_LINE)));
406  elementList.push_back(newLine);
407  workspace->IncrementElementNumber(ID_LINE);
408  statusBarText = _("Insert Line: Click on two buses, ESC to cancel.");
409  newElement = true;
410  } break;
411  case ID_ADDMENU_TRANSFORMER: {
412  Transformer* newTransformer = new Transformer(
413  wxString::Format(_("Transformer %d"), workspace->GetElementNumber(ID_TRANSFORMER)));
414  workspace->IncrementElementNumber(ID_TRANSFORMER);
415  elementList.push_back(newTransformer);
416  statusBarText = _("Insert Transformer: Click on two buses, ESC to cancel.");
417  newElement = true;
418  } break;
419  case ID_ADDMENU_GENERATOR: {
420  SyncGenerator* newGenerator = new SyncGenerator(
421  wxString::Format(_("Generator %d"), workspace->GetElementNumber(ID_SYNCGENERATOR)));
422  workspace->IncrementElementNumber(ID_SYNCGENERATOR);
423  elementList.push_back(newGenerator);
424  statusBarText = _("Insert Generator: Click on a buses, ESC to cancel.");
425  newElement = true;
426  } break;
427  case ID_ADDMENU_LOAD: {
428  Load* newLoad = new Load(wxString::Format(_("Load %d"), workspace->GetElementNumber(ID_LOAD)));
429  workspace->IncrementElementNumber(ID_LOAD);
430  elementList.push_back(newLoad);
431  statusBarText = _("Insert Load: Click on a buses, ESC to cancel.");
432  newElement = true;
433  } break;
434  case ID_ADDMENU_CAPACITOR: {
435  Capacitor* newCapacitor =
436  new Capacitor(wxString::Format(_("Capacitor %d"), workspace->GetElementNumber(ID_CAPACITOR)));
437  workspace->IncrementElementNumber(ID_CAPACITOR);
438  elementList.push_back(newCapacitor);
439  statusBarText = _("Insert Capacitor: Click on a buses, ESC to cancel.");
440  newElement = true;
441  } break;
442  case ID_ADDMENU_INDUCTOR: {
443  Inductor* newInductor =
444  new Inductor(wxString::Format(_("Inductor %d"), workspace->GetElementNumber(ID_INDUCTOR)));
445  workspace->IncrementElementNumber(ID_INDUCTOR);
446  elementList.push_back(newInductor);
447  statusBarText = _("Insert Inductor: Click on a buses, ESC to cancel.");
448  newElement = true;
449  } break;
450  case ID_ADDMENU_INDMOTOR: {
451  IndMotor* newIndMotor = new IndMotor(
452  wxString::Format(_("Induction motor %d"), workspace->GetElementNumber(ID_INDMOTOR)));
453  workspace->IncrementElementNumber(ID_INDMOTOR);
454  elementList.push_back(newIndMotor);
455  statusBarText = _("Insert Induction Motor: Click on a buses, ESC to cancel.");
456  newElement = true;
457  } break;
458  case ID_ADDMENU_SYNCCOMP: {
459  SyncMotor* newSyncCondenser = new SyncMotor(
460  wxString::Format(_("Synchronous condenser %d"), workspace->GetElementNumber(ID_SYNCMOTOR)));
461  workspace->IncrementElementNumber(ID_SYNCMOTOR);
462  elementList.push_back(newSyncCondenser);
463  statusBarText = _("Insert Synchronous Condenser: Click on a buses, ESC to cancel.");
464  newElement = true;
465  } break;
466  }
467  if(newElement) {
468  workspace->SetElementList(elementList);
469  workspace->SetWorkspaceMode(Workspace::MODE_INSERT);
470  workspace->SetStatusBarText(statusBarText);
471  workspace->Redraw();
472  }
473  }
474  }
475 }
476 void MainFrame::NotebookPageClosed(wxAuiNotebookEvent& event)
477 {
478  if(m_auiNotebook->GetPageCount() == 0) EnableCurrentProjectRibbon(false);
479 }
480 
481 void MainFrame::NotebookPageClosing(wxAuiNotebookEvent& event)
482 {
483  auto it = m_workspaceList.begin();
484  while(it != m_workspaceList.end()) {
485  if(*it == m_auiNotebook->GetCurrentPage()) {
486  m_workspaceList.erase(it);
487  break;
488  }
489  it++;
490  }
491  event.Skip();
492 }
493 
494 void MainFrame::OnRotClockClick(wxRibbonButtonBarEvent& event)
495 {
496  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
497  if(workspace) {
498  workspace->RotateSelectedElements();
499  }
500 }
501 
502 void MainFrame::OnRotCounterClockClick(wxRibbonButtonBarEvent& event)
503 {
504  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
505  if(workspace) {
506  workspace->RotateSelectedElements(false);
507  }
508 }
509 
510 void MainFrame::OnGeneralSettingsClick(wxRibbonButtonBarEvent& event)
511 {
512  GeneralPropertiesForm genPropForm(this, m_generalProperties);
513  genPropForm.SetInitialSize();
514  genPropForm.ShowModal();
515 }
516 
517 void MainFrame::OnSimulationSettingsClick(wxRibbonButtonBarEvent& event)
518 {
519  Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
520  if(workspace) {
521  SimulationsSettingsForm simulSettingsForm(this, workspace->GetProperties());
522  simulSettingsForm.SetInitialSize();
523  simulSettingsForm.ShowModal();
524  }
525 }
- - - - -
Definition: Bus.h:45
- + + +
~MainFrame()
Default destructor.
Definition: MainFrame.cpp:69
+ + + +
MainFrame()
Default constructor.
Definition: MainFrame.cpp:38
+
Save and opens the projects created on disk.
Definition: FileHanding.h:43
+
Form to edit the software&#39;s general data.
+ + +
Definition: Bus.h:62
+ -
Definition: Line.h:35
-
Definition: Load.h:23
- - - - -
bool IsSelected() const
Checks if the element is selected.
Definition: Element.h:189
- - -
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Element.cpp:101
- -
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:171
- - - - +
Definition: Line.h:52
+ +
Definition: Load.h:35
+
This class is responsible to manage the charts generated in the transient electromechanical studies...
Definition: ChartView.h:40
+ + +
Form to edit the simulation data.
+ +
bool IsSelected() const
Checks if the element is selected.
Definition: Element.h:202
+ + +
Form that shows the results of power flow and fault calculations.
Definition: DataReport.h:33
+
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Element.cpp:117
+ +
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:187
+ +
Form to show some informations.
Definition: AboutForm.h:32
+
This class manages the graphical and power elements. It is responsible for handling the user&#39;s intera...
Definition: Workspace.h:81
+
diff --git a/docs/doxygen/html/_main_frame_8h.html b/docs/doxygen/html/_main_frame_8h.html new file mode 100644 index 0000000..0239390 --- /dev/null +++ b/docs/doxygen/html/_main_frame_8h.html @@ -0,0 +1,137 @@ + + + + + + + + + +Project/MainFrame.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
MainFrame.h File Reference
+
+
+
#include <wx/menu.h>
+#include <wx/msgdlg.h>
+#include <wx/filedlg.h>
+#include "MainFrameBase.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  MainFrame
 Main frame of the program. This class manage the ribbon menu and the notebook behavior. More...
 
+ + + +

+Enumerations

enum  {
+  ID_ADDMENU_BUS = 20000, +ID_ADDMENU_LINE, +ID_ADDMENU_TRANSFORMER, +ID_ADDMENU_GENERATOR, +
+  ID_ADDMENU_LOAD, +ID_ADDMENU_CAPACITOR, +ID_ADDMENU_INDUCTOR, +ID_ADDMENU_INDMOTOR, +
+  ID_ADDMENU_SYNCCOMP +
+ }
 
+
+
+ + + + diff --git a/docs/doxygen/html/_main_frame_8h.js b/docs/doxygen/html/_main_frame_8h.js new file mode 100644 index 0000000..f2a8e51 --- /dev/null +++ b/docs/doxygen/html/_main_frame_8h.js @@ -0,0 +1,13 @@ +var _main_frame_8h = +[ + [ "MainFrame", "class_main_frame.html", "class_main_frame" ], + [ "ID_ADDMENU_BUS", "_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a972a4490c2c106d50fad31bf61c954ee", null ], + [ "ID_ADDMENU_LINE", "_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a8f622d047e7be05ca22e68cf3c495891", null ], + [ "ID_ADDMENU_TRANSFORMER", "_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7ac723eda89da3d08df66556102f04fb3f", null ], + [ "ID_ADDMENU_GENERATOR", "_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a78ef6f7d5925a2d3f66fb4b985cde4c8", null ], + [ "ID_ADDMENU_LOAD", "_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a0448f71ade0850cce41f666113d61646", null ], + [ "ID_ADDMENU_CAPACITOR", "_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a19b41804a810ff58604d9a2e98a12d9b", null ], + [ "ID_ADDMENU_INDUCTOR", "_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7ae8447bb338d69f233187fa7ecddb269b", null ], + [ "ID_ADDMENU_INDMOTOR", "_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a88478f64002d3686cd141ab42431c654", null ], + [ "ID_ADDMENU_SYNCCOMP", "_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a713348ad9d91573d5729b0a8b8e66e04", null ] +]; \ No newline at end of file diff --git a/docs/doxygen/html/_main_frame_8h_source.html b/docs/doxygen/html/_main_frame_8h_source.html index 18f8eb9..2396190 100644 --- a/docs/doxygen/html/_main_frame_8h_source.html +++ b/docs/doxygen/html/_main_frame_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,23 +88,25 @@ $(document).ready(function(){initNavTree('_main_frame_8h_source.html','');});
MainFrame.h
-
1 #ifndef MAINFRAME_H
2 #define MAINFRAME_H
3 
4 #include <wx/menu.h>
5 #include <wx/msgdlg.h>
6 #include <wx/filedlg.h>
7 
8 #include "MainFrameBase.h"
9 
10 class MainFrameBase;
12 class Workspace;
13 class FileHanding;
16 class PropertiesData;
17 class ChartView;
18 class DataReport;
19 class AboutForm;
20 
21 enum {
22  ID_ADDMENU_BUS = 20000,
23  ID_ADDMENU_LINE,
24  ID_ADDMENU_TRANSFORMER,
25  ID_ADDMENU_GENERATOR,
26  ID_ADDMENU_LOAD,
27  ID_ADDMENU_CAPACITOR,
28  ID_ADDMENU_INDUCTOR,
29  ID_ADDMENU_INDMOTOR,
30  ID_ADDMENU_SYNCCOMP
31 };
32 
33 class MainFrame : public MainFrameBase
34 {
35  public:
36  MainFrame();
37  MainFrame(wxWindow* parent, wxLocale* locale, PropertiesData* initProperties);
38  ~MainFrame();
39 
40  protected:
41  virtual void OnGeneralSettingsClick(wxRibbonButtonBarEvent& event);
42  virtual void OnSimulationSettingsClick(wxRibbonButtonBarEvent& event);
43  virtual void OnRotClockClick(wxRibbonButtonBarEvent& event);
44  virtual void OnRotCounterClockClick(wxRibbonButtonBarEvent& event);
45  virtual void NotebookPageClosed(wxAuiNotebookEvent& event);
46  virtual void NotebookPageClosing(wxAuiNotebookEvent& event);
47  virtual void OnAboutClick(wxRibbonButtonBarEvent& event);
48  virtual void OnAddElementDropdown(wxRibbonButtonBarEvent& event);
49  virtual void OnChartsClick(wxRibbonButtonBarEvent& event);
50  virtual void OnCloseClick(wxRibbonButtonBarEvent& event);
51  virtual void OnCopyClick(wxRibbonButtonBarEvent& event);
52  virtual void OnDataReportClick(wxRibbonButtonBarEvent& event);
53  virtual void OnDeleteClick(wxRibbonButtonBarEvent& event);
54  virtual void OnDisableSolutionClick(wxRibbonButtonBarEvent& event);
55  virtual void OnDragClick(wxRibbonButtonBarEvent& event);
56  virtual void OnEnableSolutionClick(wxRibbonButtonBarEvent& event);
57  virtual void OnExitClick(wxRibbonButtonBarEvent& event) { this->Close(); };
58  virtual void OnExpImpClick(wxRibbonButtonBarEvent& event);
59  virtual void OnFaultClick(wxRibbonButtonBarEvent& event);
60  virtual void OnFitClick(wxRibbonButtonBarEvent& event);
61  virtual void OnMoveClick(wxRibbonButtonBarEvent& event);
62  virtual void OnOpenClick(wxRibbonButtonBarEvent& event);
63  virtual void OnPSPGuideClick(wxRibbonButtonBarEvent& event);
64  virtual void OnPasteClick(wxRibbonButtonBarEvent& event);
65  virtual void OnPowerFlowClick(wxRibbonButtonBarEvent& event);
66  virtual void OnRedoClick(wxRibbonButtonBarEvent& event);
67  virtual void OnResetVoltagesClick(wxRibbonButtonBarEvent& event);
68  virtual void OnRunStabilityClick(wxRibbonButtonBarEvent& event);
69  virtual void OnSCPowerClick(wxRibbonButtonBarEvent& event);
70  virtual void OnSaveAsClick(wxRibbonButtonBarEvent& event);
71  virtual void OnSaveClick(wxRibbonButtonBarEvent& event);
72  virtual void OnSnapshotClick(wxRibbonButtonBarEvent& event);
73  virtual void OnUndoClick(wxRibbonButtonBarEvent& event);
74  virtual void OnNewClick(wxRibbonButtonBarEvent& event);
75 
76  protected:
77  std::vector<Workspace*> m_workspaceList;
78  int m_projectNumber = 1;
79 
80  wxRibbonMetroArtProvider* m_artMetro = NULL;
81  wxMenu* m_addElementsMenu = NULL;
82  wxLocale* m_locale = NULL;
83  PropertiesData* m_generalProperties = NULL;
84 
85  void Init();
86  void EnableCurrentProjectRibbon(bool enable = true);
87  void CreateAddElementsMenu();
88 
89  void OnAddElementsClick(wxCommandEvent& event);
90 };
91 
92 #endif // MAINFRAME_H
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef MAINFRAME_H
19 #define MAINFRAME_H
20 
21 #include <wx/menu.h>
22 #include <wx/msgdlg.h>
23 #include <wx/filedlg.h>
24 
25 #include "MainFrameBase.h"
26 
27 class MainFrameBase;
29 class Workspace;
30 class FileHanding;
33 class PropertiesData;
34 class ChartView;
35 class DataReport;
36 class AboutForm;
37 
38 enum {
39  ID_ADDMENU_BUS = 20000,
40  ID_ADDMENU_LINE,
41  ID_ADDMENU_TRANSFORMER,
42  ID_ADDMENU_GENERATOR,
43  ID_ADDMENU_LOAD,
44  ID_ADDMENU_CAPACITOR,
45  ID_ADDMENU_INDUCTOR,
46  ID_ADDMENU_INDMOTOR,
47  ID_ADDMENU_SYNCCOMP
48 };
49 
57 class MainFrame : public MainFrameBase
58 {
59  public:
64  MainFrame();
71  MainFrame(wxWindow* parent, wxLocale* locale, PropertiesData* initProperties, wxString openPath = "");
72 
76  ~MainFrame();
77 
78  protected:
79  virtual void OnGeneralSettingsClick(wxRibbonButtonBarEvent& event);
80  virtual void OnSimulationSettingsClick(wxRibbonButtonBarEvent& event);
81  virtual void OnRotClockClick(wxRibbonButtonBarEvent& event);
82  virtual void OnRotCounterClockClick(wxRibbonButtonBarEvent& event);
83  virtual void NotebookPageClosed(wxAuiNotebookEvent& event);
84  virtual void NotebookPageClosing(wxAuiNotebookEvent& event);
85  virtual void OnAboutClick(wxRibbonButtonBarEvent& event);
86  virtual void OnAddElementDropdown(wxRibbonButtonBarEvent& event);
87  virtual void OnChartsClick(wxRibbonButtonBarEvent& event);
88  virtual void OnCloseClick(wxRibbonButtonBarEvent& event);
89  virtual void OnCopyClick(wxRibbonButtonBarEvent& event);
90  virtual void OnDataReportClick(wxRibbonButtonBarEvent& event);
91  virtual void OnDeleteClick(wxRibbonButtonBarEvent& event);
92  virtual void OnDisableSolutionClick(wxRibbonButtonBarEvent& event);
93  virtual void OnDragClick(wxRibbonButtonBarEvent& event);
94  virtual void OnEnableSolutionClick(wxRibbonButtonBarEvent& event);
95  virtual void OnExitClick(wxRibbonButtonBarEvent& event) { this->Close(); };
96  virtual void OnExpImpClick(wxRibbonButtonBarEvent& event);
97  virtual void OnFaultClick(wxRibbonButtonBarEvent& event);
98  virtual void OnFitClick(wxRibbonButtonBarEvent& event);
99  virtual void OnMoveClick(wxRibbonButtonBarEvent& event);
100  virtual void OnOpenClick(wxRibbonButtonBarEvent& event);
101  virtual void OnPSPGuideClick(wxRibbonButtonBarEvent& event);
102  virtual void OnPasteClick(wxRibbonButtonBarEvent& event);
103  virtual void OnPowerFlowClick(wxRibbonButtonBarEvent& event);
104  virtual void OnRedoClick(wxRibbonButtonBarEvent& event);
105  virtual void OnResetVoltagesClick(wxRibbonButtonBarEvent& event);
106  virtual void OnRunStabilityClick(wxRibbonButtonBarEvent& event);
107  virtual void OnSCPowerClick(wxRibbonButtonBarEvent& event);
108  virtual void OnSaveAsClick(wxRibbonButtonBarEvent& event);
109  virtual void OnSaveClick(wxRibbonButtonBarEvent& event);
110  virtual void OnSnapshotClick(wxRibbonButtonBarEvent& event);
111  virtual void OnUndoClick(wxRibbonButtonBarEvent& event);
112  virtual void OnNewClick(wxRibbonButtonBarEvent& event);
113 
114  std::vector<Workspace*> m_workspaceList;
115  int m_projectNumber = 1;
116 
117  wxRibbonMetroArtProvider* m_artMetro = NULL;
118  wxMenu* m_addElementsMenu = NULL;
119  wxLocale* m_locale = NULL;
120  PropertiesData* m_generalProperties = NULL;
121 
122  void Init();
123  void EnableCurrentProjectRibbon(bool enable = true);
124  void CreateAddElementsMenu();
125 
126  void OnAddElementsClick(wxCommandEvent& event);
127 };
128 
129 #endif // MAINFRAME_H
- - - +
~MainFrame()
Default destructor.
Definition: MainFrame.cpp:69
+
MainFrame()
Default constructor.
Definition: MainFrame.cpp:38
+
Save and opens the projects created on disk.
Definition: FileHanding.h:43
+
Form to edit the software&#39;s general data.
+
Main frame of the program. This class manage the ribbon menu and the notebook behavior.
Definition: MainFrame.h:57
- - - - - +
This class is responsible to manage the charts generated in the transient electromechanical studies...
Definition: ChartView.h:40
+
Form to edit the simulation data.
+
Form that shows the results of power flow and fault calculations.
Definition: DataReport.h:33
+
Form to show some informations.
Definition: AboutForm.h:32
+
This class manages the graphical and power elements. It is responsible for handling the user&#39;s intera...
Definition: Workspace.h:81
-
1 #include "Multiplier.h"
2 #include "ConnectionLine.h"
3 
4 Multiplier::Multiplier(int id) : ControlElement(id)
5 {
6  m_width = m_height = 36.0;
7  Node* nodeIn1 = new Node(m_position + wxPoint2DDouble(-18, -9), Node::NODE_IN, m_borderSize);
8  nodeIn1->StartMove(m_position);
9  Node* nodeIn2 = new Node(m_position + wxPoint2DDouble(-18, 9), Node::NODE_IN, m_borderSize);
10  nodeIn2->StartMove(m_position);
11  Node* nodeOut = new Node(m_position + wxPoint2DDouble(18, 0), Node::NODE_OUT, m_borderSize);
12  nodeOut->SetAngle(180.0);
13  nodeOut->StartMove(m_position);
14  m_nodeList.push_back(nodeIn1);
15  m_nodeList.push_back(nodeIn2);
16  m_nodeList.push_back(nodeOut);
17 }
18 
19 Multiplier::~Multiplier() {}
20 void Multiplier::Draw(wxPoint2DDouble translation, double scale) const
21 {
22  glLineWidth(1.0);
23  if(m_selected) {
24  glColor4dv(m_selectionColour.GetRGBA());
25  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
26  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
27  }
28  glColor4d(1.0, 1.0, 1.0, 1.0);
29  DrawRectangle(m_position, m_width, m_height);
30  glColor4d(0.0, 0.0, 0.0, 1.0);
31  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
32 
33  // Plot x.
34  glLineWidth(2.0);
35  std::vector<wxPoint2DDouble> xSymbol;
36  xSymbol.push_back(m_position + wxPoint2DDouble(-5, -5));
37  xSymbol.push_back(m_position + wxPoint2DDouble(5, 5));
38  xSymbol.push_back(m_position + wxPoint2DDouble(-5, 5));
39  xSymbol.push_back(m_position + wxPoint2DDouble(5, -5));
40  glColor4d(0.0, 0.3, 1.0, 1.0);
41  DrawLine(xSymbol, GL_LINES);
42 
43  glColor4d(0.0, 0.0, 0.0, 1.0);
44  DrawNodes();
45 }
46 
47 void Multiplier::Rotate(bool clockwise)
48 {
49  if(clockwise)
50  m_angle += 90.0;
51  else
52  m_angle -= 90.0;
53  if(m_angle >= 360.0)
54  m_angle = 0.0;
55  else if(m_angle < 0)
56  m_angle = 270.0;
57 
58  UpdatePoints();
59 
60  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
61  Node* node = *it;
62  node->Rotate(clockwise);
63  }
64 }
65 
66 void Multiplier::UpdatePoints()
67 {
68  if(m_angle == 0.0) {
69  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-18, -9));
70  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-18, 9));
71  m_nodeList[2]->SetPosition(m_position + wxPoint2DDouble(18, 0));
72  } else if(m_angle == 90.0) {
73  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(9, -18));
74  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-9, -18));
75  m_nodeList[2]->SetPosition(m_position + wxPoint2DDouble(0, 18));
76  } else if(m_angle == 180.0) {
77  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(18, 9));
78  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(18, -9));
79  m_nodeList[2]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
80  } else if(m_angle == 270.0) {
81  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-9, 18));
82  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(9, 18));
83  m_nodeList[2]->SetPosition(m_position + wxPoint2DDouble(0, -18));
84  }
85 }
86 
87 bool Multiplier::Solve(double input, double timeStep)
88 {
89  std::vector<double> inputVector;
90  for(auto itN = m_nodeList.begin(), itNEnd = m_nodeList.end(); itN != itNEnd; ++itN) {
91  Node* node = *itN;
92  if(node->GetNodeType() != Node::NODE_OUT) {
93  if(!node->IsConnected()) {
94  inputVector.push_back(1.0);
95  } else {
96  for(auto itC = m_childList.begin(), itCEnd = m_childList.end(); itC != itCEnd; ++itC) {
97  ConnectionLine* cLine = static_cast<ConnectionLine*>(*itC);
98  auto nodeList = cLine->GetNodeList();
99  for(auto itCN = nodeList.begin(), itCNEnd = nodeList.end(); itCN != itCNEnd; ++itCN) {
100  Node* childNode = *itCN;
101  if(childNode == node) {
102  inputVector.push_back(cLine->GetValue());
103  break;
104  }
105  }
106  }
107  }
108  }
109  }
110 
111  m_output = 1.0;
112  for(unsigned int i = 0; i < inputVector.size(); ++i) {
113  m_output *= inputVector[i];
114  }
115 
116  return true;
117 }
118 
120 {
121  Multiplier* copy = new Multiplier(m_elementID);
122  *copy = *this;
123  return copy;
124 }
- -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Multiplier.cpp:47
- -
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Multiplier.cpp:20
- - -
virtual Element * GetCopy()
Get a the element copy.
Definition: Multiplier.cpp:119
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Multiplier.h"
19 #include "ConnectionLine.h"
20 
21 Multiplier::Multiplier(int id) : ControlElement(id)
22 {
23  m_width = m_height = 36.0;
24  Node* nodeIn1 = new Node(m_position + wxPoint2DDouble(-18, -9), Node::NODE_IN, m_borderSize);
25  nodeIn1->StartMove(m_position);
26  Node* nodeIn2 = new Node(m_position + wxPoint2DDouble(-18, 9), Node::NODE_IN, m_borderSize);
27  nodeIn2->StartMove(m_position);
28  Node* nodeOut = new Node(m_position + wxPoint2DDouble(18, 0), Node::NODE_OUT, m_borderSize);
29  nodeOut->SetAngle(180.0);
30  nodeOut->StartMove(m_position);
31  m_nodeList.push_back(nodeIn1);
32  m_nodeList.push_back(nodeIn2);
33  m_nodeList.push_back(nodeOut);
34 }
35 
36 Multiplier::~Multiplier() {}
37 void Multiplier::Draw(wxPoint2DDouble translation, double scale) const
38 {
39  glLineWidth(1.0);
40  if(m_selected) {
41  glColor4dv(m_selectionColour.GetRGBA());
42  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
43  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
44  }
45  glColor4d(1.0, 1.0, 1.0, 1.0);
46  DrawRectangle(m_position, m_width, m_height);
47  glColor4d(0.0, 0.0, 0.0, 1.0);
48  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
49 
50  // Plot x.
51  glLineWidth(2.0);
52  std::vector<wxPoint2DDouble> xSymbol;
53  xSymbol.push_back(m_position + wxPoint2DDouble(-5, -5));
54  xSymbol.push_back(m_position + wxPoint2DDouble(5, 5));
55  xSymbol.push_back(m_position + wxPoint2DDouble(-5, 5));
56  xSymbol.push_back(m_position + wxPoint2DDouble(5, -5));
57  glColor4d(0.0, 0.3, 1.0, 1.0);
58  DrawLine(xSymbol, GL_LINES);
59 
60  glColor4d(0.0, 0.0, 0.0, 1.0);
61  DrawNodes();
62 }
63 
64 void Multiplier::Rotate(bool clockwise)
65 {
66  if(clockwise)
67  m_angle += 90.0;
68  else
69  m_angle -= 90.0;
70  if(m_angle >= 360.0)
71  m_angle = 0.0;
72  else if(m_angle < 0)
73  m_angle = 270.0;
74 
75  UpdatePoints();
76 
77  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
78  Node* node = *it;
79  node->Rotate(clockwise);
80  }
81 }
82 
83 void Multiplier::UpdatePoints()
84 {
85  if(m_angle == 0.0) {
86  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-18, -9));
87  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-18, 9));
88  m_nodeList[2]->SetPosition(m_position + wxPoint2DDouble(18, 0));
89  } else if(m_angle == 90.0) {
90  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(9, -18));
91  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-9, -18));
92  m_nodeList[2]->SetPosition(m_position + wxPoint2DDouble(0, 18));
93  } else if(m_angle == 180.0) {
94  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(18, 9));
95  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(18, -9));
96  m_nodeList[2]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
97  } else if(m_angle == 270.0) {
98  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-9, 18));
99  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(9, 18));
100  m_nodeList[2]->SetPosition(m_position + wxPoint2DDouble(0, -18));
101  }
102 }
103 
104 bool Multiplier::Solve(double input, double timeStep)
105 {
106  std::vector<double> inputVector;
107  for(auto itN = m_nodeList.begin(), itNEnd = m_nodeList.end(); itN != itNEnd; ++itN) {
108  Node* node = *itN;
109  if(node->GetNodeType() != Node::NODE_OUT) {
110  if(!node->IsConnected()) {
111  inputVector.push_back(1.0);
112  } else {
113  for(auto itC = m_childList.begin(), itCEnd = m_childList.end(); itC != itCEnd; ++itC) {
114  ConnectionLine* cLine = static_cast<ConnectionLine*>(*itC);
115  auto nodeList = cLine->GetNodeList();
116  for(auto itCN = nodeList.begin(), itCNEnd = nodeList.end(); itCN != itCNEnd; ++itCN) {
117  Node* childNode = *itCN;
118  if(childNode == node) {
119  inputVector.push_back(cLine->GetValue());
120  break;
121  }
122  }
123  }
124  }
125  }
126  }
127 
128  m_output = 1.0;
129  for(unsigned int i = 0; i < inputVector.size(); ++i) {
130  m_output *= inputVector[i];
131  }
132 
133  return true;
134 }
135 
137 {
138  Multiplier* copy = new Multiplier(m_elementID);
139  *copy = *this;
140  return copy;
141 }
Multiplies two inputs.
Definition: Multiplier.h:32
+ +
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Multiplier.cpp:64
+
Node of a control element. This class manages the user interaction with the connection and control el...
+ + +
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Multiplier.cpp:37
+
Connection between two control elements or other connection line and an element.
+ +
virtual Element * GetCopy()
Get a the element copy.
Definition: Multiplier.cpp:136
diff --git a/docs/doxygen/html/_multiplier_8h.html b/docs/doxygen/html/_multiplier_8h.html new file mode 100644 index 0000000..cddba01 --- /dev/null +++ b/docs/doxygen/html/_multiplier_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/Multiplier.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
Multiplier.h File Reference
+
+
+
#include "ControlElement.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  Multiplier
 Multiplies two inputs. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_multiplier_8h_source.html b/docs/doxygen/html/_multiplier_8h_source.html index 3077bd1..7588220 100644 --- a/docs/doxygen/html/_multiplier_8h_source.html +++ b/docs/doxygen/html/_multiplier_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,22 +88,23 @@ $(document).ready(function(){initNavTree('_multiplier_8h_source.html','');});
Multiplier.h
-
1 #ifndef MULTIPLIER_H
2 #define MULTIPLIER_H
3 
4 #include "ControlElement.h"
5 
6 class ConnectionLine;
7 
8 class Multiplier : public ControlElement
9 {
10  public:
11  Multiplier(int id);
12  ~Multiplier();
13 
14  virtual void Draw(wxPoint2DDouble translation, double scale) const;
15  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
16  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
17  virtual bool ShowForm(wxWindow* parent, Element* element) { return false; }
18  virtual void Rotate(bool clockwise = true);
19 
20  virtual void UpdatePoints();
21 
22  virtual bool Solve(double input, double timeStep);
23 
24  virtual Element* GetCopy();
25 };
26 
27 #endif // MULTIPLIER_H
- -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Multiplier.cpp:47
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Multiplier.h:17
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Multiplier.h:15
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Multiplier.cpp:20
- -
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Multiplier.h:16
- -
virtual Element * GetCopy()
Get a the element copy.
Definition: Multiplier.cpp:119
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef MULTIPLIER_H
19 #define MULTIPLIER_H
20 
21 #include "ControlElement.h"
22 
23 class ConnectionLine;
24 
32 class Multiplier : public ControlElement
33 {
34  public:
35  Multiplier(int id);
36  ~Multiplier();
37 
38  virtual void Draw(wxPoint2DDouble translation, double scale) const;
39  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
40  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
41  virtual bool ShowForm(wxWindow* parent, Element* element) { return false; }
42  virtual void Rotate(bool clockwise = true);
43 
44  virtual void UpdatePoints();
45 
46  virtual bool Solve(double input, double timeStep);
47 
48  virtual Element* GetCopy();
49 };
50 
51 #endif // MULTIPLIER_H
Multiplies two inputs.
Definition: Multiplier.h:32
+ +
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Multiplier.cpp:64
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Multiplier.h:41
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Multiplier.h:39
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Multiplier.cpp:37
+
Connection between two control elements or other connection line and an element.
+
Base class of a control element. Provide general methods to other control classes.
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Multiplier.h:40
+ +
virtual Element * GetCopy()
Get a the element copy.
Definition: Multiplier.cpp:136
-
1 #include "PowerElement.h"
2 #ifdef USING_WX_3_0_X
3 #include "DegreesAndRadians.h"
4 #endif
5 
7 {
8  m_busColour.SetRGBA(0.0, 0.3, 1.0, 1.0);
9  m_onlineElementColour.SetRGBA(0.2, 0.2, 0.2, 1.0);
10  m_offlineElementColour.SetRGBA(0.5, 0.5, 0.5, 1.0);
11  m_closedSwitchColour.SetRGBA(0.0, 0.4, 0.0, 1.0);
12  m_openedSwitchColour.SetRGBA(1.0, 0.1, 0.1, 1.0);
13  m_powerFlowArrowColour.SetRGBA(1.0, 0.51, 0.0, 1.0);
14  m_dynamicEventColour.SetRGBA(1.0, 0.51, 0.0, 1.0);
15 }
16 
18 void PowerElement::SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit)
19 {
20 }
21 
22 wxPoint2DDouble PowerElement::GetSwitchPoint(Element* parent,
23  wxPoint2DDouble parentPoint,
24  wxPoint2DDouble secondPoint) const
25 {
26  double swLineSize = 25.0;
27  wxPoint2DDouble swPoint = wxPoint2DDouble(parentPoint.m_x, parentPoint.m_y - swLineSize);
28 
29  // Rotate the second point (to compare).
30  double angle = parent->GetAngle();
31 
32  secondPoint =
33  wxPoint2DDouble(std::cos(wxDegToRad(-angle)) * (secondPoint.m_x - parentPoint.m_x) -
34  std::sin(wxDegToRad(-angle)) * (secondPoint.m_y - parentPoint.m_y) + parentPoint.m_x,
35  std::sin(wxDegToRad(-angle)) * (secondPoint.m_x - parentPoint.m_x) +
36  std::cos(wxDegToRad(-angle)) * (secondPoint.m_y - parentPoint.m_y) + parentPoint.m_y);
37 
38  // Rotate
39  if(secondPoint.m_y > parentPoint.m_y) angle -= 180.0;
40  return wxPoint2DDouble(std::cos(wxDegToRad(angle)) * (swPoint.m_x - parentPoint.m_x) -
41  std::sin(wxDegToRad(angle)) * (swPoint.m_y - parentPoint.m_y) + parentPoint.m_x,
42  std::sin(wxDegToRad(angle)) * (swPoint.m_x - parentPoint.m_x) +
43  std::cos(wxDegToRad(angle)) * (swPoint.m_y - parentPoint.m_y) + parentPoint.m_y);
44 }
45 
46 bool PowerElement::SwitchesContains(wxPoint2DDouble position) const
47 {
48  for(int i = 0; i < (int)m_switchRect.size(); i++) {
49  if(m_parentList[i]) {
50  if(m_switchRect[i].Contains(position)) return true;
51  }
52  }
53  return false;
54 }
55 
57 {
58  // General method, to one switch only.
59  wxPoint2DDouble swCenter = wxPoint2DDouble((m_pointList[0].m_x + m_pointList[1].m_x) / 2.0,
60  (m_pointList[0].m_y + m_pointList[1].m_y) / 2.0);
61  m_switchRect[0] = wxRect2DDouble(swCenter.m_x - m_switchSize / 2.0, swCenter.m_y - m_switchSize / 2.0, m_switchSize,
62  m_switchSize);
63 }
64 
66 {
67  int i = 0;
68  for(auto it = m_parentList.begin(); it != m_parentList.end(); it++) {
69  Element* parent = *it;
70  if(parent) {
71  if(m_online) {
72  glColor4dv(m_closedSwitchColour.GetRGBA());
73  } else {
74  glColor4dv(m_openedSwitchColour.GetRGBA());
75  }
76 
77  glPushMatrix();
78  glTranslated(m_switchRect[i].GetPosition().m_x + m_switchSize / 2.0,
79  m_switchRect[i].GetPosition().m_y + m_switchSize / 2.0, 0.0);
80  glRotated(parent->GetAngle(), 0.0, 0.0, 1.0);
81  glTranslated(-m_switchRect[i].GetPosition().m_x - m_switchSize / 2.0,
82  -m_switchRect[i].GetPosition().m_y - m_switchSize / 2.0, 0.0);
83 
84  DrawRectangle(m_switchRect[i].GetPosition() + wxPoint2DDouble(m_switchSize / 2.0, m_switchSize / 2.0),
85  m_switchSize, m_switchSize);
86 
87  glPopMatrix();
88  }
89  i++;
90  }
91 }
92 
93 void PowerElement::CalculatePowerFlowPts(std::vector<wxPoint2DDouble> edges)
94 {
95  double arrowRate = 100.0; // One arrow to each "arrowRate" distance in pixels.
96 
97  if(edges.size() < 2) return;
98 
99  // Clear all power flow points
100  for(int i = 0; i < (int)m_powerFlowArrow.size(); i++) m_powerFlowArrow[i].clear();
101  m_powerFlowArrow.clear();
102 
103  for(int i = 1; i < (int)edges.size(); i++) {
104  wxPoint2DDouble pt1 = edges[i - 1];
105  wxPoint2DDouble pt2 = edges[i];
106 
107  double angle = std::atan2(pt2.m_y - pt1.m_y, pt2.m_x - pt1.m_x);
108 
109  wxPoint2DDouble rotPt2(
110  std::cos(-angle) * (pt2.m_x - pt1.m_x) - std::sin(-angle) * (pt2.m_y - pt1.m_y) + pt1.m_x,
111  std::sin(-angle) * (pt2.m_x - pt1.m_x) + std::cos(-angle) * (pt2.m_y - pt1.m_y) + pt1.m_y);
112 
113  int numArrows = std::abs(pt1.m_x - rotPt2.m_x) / arrowRate;
114  if(numArrows == 0) numArrows = 1;
115 
116  for(int i = 0; i < numArrows; i++) {
117  wxPoint2DDouble arrowCenter(pt1.m_x + ((rotPt2.m_x - pt1.m_x) / double(numArrows + 1)) * double(i + 1),
118  pt1.m_y + ((rotPt2.m_y - pt1.m_y) / double(numArrows + 1)) * double(i + 1));
119 
120  std::vector<wxPoint2DDouble> triPts;
121  triPts.push_back(arrowCenter + wxPoint2DDouble(5.0, 0.0));
122  triPts.push_back(arrowCenter + wxPoint2DDouble(-5.0, 5.0));
123  triPts.push_back(arrowCenter + wxPoint2DDouble(-5.0, -5.0));
124 
125  // Rotate back.
126  for(int i = 0; i < 3; i++) {
127  triPts[i] = wxPoint2DDouble(
128  std::cos(angle) * (triPts[i].m_x - pt1.m_x) - std::sin(angle) * (triPts[i].m_y - pt1.m_y) + pt1.m_x,
129  std::sin(angle) * (triPts[i].m_x - pt1.m_x) + std::cos(angle) * (triPts[i].m_y - pt1.m_y) +
130  pt1.m_y);
131  }
132  m_powerFlowArrow.push_back(triPts);
133  }
134  }
135 }
136 
138 {
139  if(m_online) {
140  glColor4dv(m_powerFlowArrowColour.GetRGBA());
141  for(int i = 0; i < (int)m_powerFlowArrow.size(); i++) {
142  DrawTriangle(m_powerFlowArrow[i]);
143  }
144  }
145 }
146 
147 double PowerElement::GetValueFromUnit(double value, ElectricalUnit valueUnit)
148 {
149  switch(valueUnit) {
150  case UNIT_kV:
151  case UNIT_kA:
152  case UNIT_kW:
153  case UNIT_kVA:
154  case UNIT_kVAr: {
155  return value * 1e3;
156  } break;
157  case UNIT_MW:
158  case UNIT_MVA:
159  case UNIT_MVAr: {
160  return value * 1e6;
161  }
162  default:
163  break;
164  }
165  return value;
166 }
double GetAngle() const
Get the element angle.
Definition: Element.h:201
- -
virtual void DrawTriangle(std::vector< wxPoint2DDouble > points, GLenum mode=GL_TRIANGLES) const
Draw a triangle.
Definition: Element.cpp:44
-
virtual void UpdateSwitches()
Update the switch position.
-
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
-
void SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
Set the colour in RGBA. The colour values must be between 0.0 and 1.0.
Definition: Element.cpp:350
- - -
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
-
virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode=GL_QUADS) const
Draw rectangle.
Definition: Element.cpp:53
- - - - -
virtual void CalculatePowerFlowPts(std::vector< wxPoint2DDouble > edges)
Calculate the points of the power flow arrows.
- -
virtual void DrawPowerFlowPts() const
Draw power flow arrows.
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "PowerElement.h"
19 #ifdef USING_WX_3_0_X
20 #include "DegreesAndRadians.h"
21 #endif
22 
24 {
25  m_busColour.SetRGBA(0.0, 0.3, 1.0, 1.0);
26  m_onlineElementColour.SetRGBA(0.2, 0.2, 0.2, 1.0);
27  m_offlineElementColour.SetRGBA(0.5, 0.5, 0.5, 1.0);
28  m_closedSwitchColour.SetRGBA(0.0, 0.4, 0.0, 1.0);
29  m_openedSwitchColour.SetRGBA(1.0, 0.1, 0.1, 1.0);
30  m_powerFlowArrowColour.SetRGBA(1.0, 0.51, 0.0, 1.0);
31  m_dynamicEventColour.SetRGBA(1.0, 0.51, 0.0, 1.0);
32 }
33 
35 void PowerElement::SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit)
36 {
37 }
38 
39 wxPoint2DDouble PowerElement::GetSwitchPoint(Element* parent,
40  wxPoint2DDouble parentPoint,
41  wxPoint2DDouble secondPoint) const
42 {
43  double swLineSize = 25.0;
44  wxPoint2DDouble swPoint = wxPoint2DDouble(parentPoint.m_x, parentPoint.m_y - swLineSize);
45 
46  // Rotate the second point (to compare).
47  double angle = parent->GetAngle();
48 
49  secondPoint =
50  wxPoint2DDouble(std::cos(wxDegToRad(-angle)) * (secondPoint.m_x - parentPoint.m_x) -
51  std::sin(wxDegToRad(-angle)) * (secondPoint.m_y - parentPoint.m_y) + parentPoint.m_x,
52  std::sin(wxDegToRad(-angle)) * (secondPoint.m_x - parentPoint.m_x) +
53  std::cos(wxDegToRad(-angle)) * (secondPoint.m_y - parentPoint.m_y) + parentPoint.m_y);
54 
55  // Rotate
56  if(secondPoint.m_y > parentPoint.m_y) angle -= 180.0;
57  return wxPoint2DDouble(std::cos(wxDegToRad(angle)) * (swPoint.m_x - parentPoint.m_x) -
58  std::sin(wxDegToRad(angle)) * (swPoint.m_y - parentPoint.m_y) + parentPoint.m_x,
59  std::sin(wxDegToRad(angle)) * (swPoint.m_x - parentPoint.m_x) +
60  std::cos(wxDegToRad(angle)) * (swPoint.m_y - parentPoint.m_y) + parentPoint.m_y);
61 }
62 
63 bool PowerElement::SwitchesContains(wxPoint2DDouble position) const
64 {
65  for(int i = 0; i < (int)m_switchRect.size(); i++) {
66  if(m_parentList[i]) {
67  if(m_switchRect[i].Contains(position)) return true;
68  }
69  }
70  return false;
71 }
72 
74 {
75  // General method, to one switch only.
76  wxPoint2DDouble swCenter = wxPoint2DDouble((m_pointList[0].m_x + m_pointList[1].m_x) / 2.0,
77  (m_pointList[0].m_y + m_pointList[1].m_y) / 2.0);
78  m_switchRect[0] = wxRect2DDouble(swCenter.m_x - m_switchSize / 2.0, swCenter.m_y - m_switchSize / 2.0, m_switchSize,
79  m_switchSize);
80 }
81 
83 {
84  int i = 0;
85  for(auto it = m_parentList.begin(); it != m_parentList.end(); it++) {
86  Element* parent = *it;
87  if(parent) {
88  if(m_online) {
89  glColor4dv(m_closedSwitchColour.GetRGBA());
90  } else {
91  glColor4dv(m_openedSwitchColour.GetRGBA());
92  }
93 
94  glPushMatrix();
95  glTranslated(m_switchRect[i].GetPosition().m_x + m_switchSize / 2.0,
96  m_switchRect[i].GetPosition().m_y + m_switchSize / 2.0, 0.0);
97  glRotated(parent->GetAngle(), 0.0, 0.0, 1.0);
98  glTranslated(-m_switchRect[i].GetPosition().m_x - m_switchSize / 2.0,
99  -m_switchRect[i].GetPosition().m_y - m_switchSize / 2.0, 0.0);
100 
101  DrawRectangle(m_switchRect[i].GetPosition() + wxPoint2DDouble(m_switchSize / 2.0, m_switchSize / 2.0),
102  m_switchSize, m_switchSize);
103 
104  glPopMatrix();
105  }
106  i++;
107  }
108 }
109 
110 void PowerElement::CalculatePowerFlowPts(std::vector<wxPoint2DDouble> edges)
111 {
112  double arrowRate = 100.0; // One arrow to each "arrowRate" distance in pixels.
113 
114  if(edges.size() < 2) return;
115 
116  // Clear all power flow points
117  for(int i = 0; i < (int)m_powerFlowArrow.size(); i++) m_powerFlowArrow[i].clear();
118  m_powerFlowArrow.clear();
119 
120  for(int i = 1; i < (int)edges.size(); i++) {
121  wxPoint2DDouble pt1 = edges[i - 1];
122  wxPoint2DDouble pt2 = edges[i];
123 
124  double angle = std::atan2(pt2.m_y - pt1.m_y, pt2.m_x - pt1.m_x);
125 
126  wxPoint2DDouble rotPt2(
127  std::cos(-angle) * (pt2.m_x - pt1.m_x) - std::sin(-angle) * (pt2.m_y - pt1.m_y) + pt1.m_x,
128  std::sin(-angle) * (pt2.m_x - pt1.m_x) + std::cos(-angle) * (pt2.m_y - pt1.m_y) + pt1.m_y);
129 
130  int numArrows = std::abs(pt1.m_x - rotPt2.m_x) / arrowRate;
131  if(numArrows == 0) numArrows = 1;
132 
133  for(int i = 0; i < numArrows; i++) {
134  wxPoint2DDouble arrowCenter(pt1.m_x + ((rotPt2.m_x - pt1.m_x) / double(numArrows + 1)) * double(i + 1),
135  pt1.m_y + ((rotPt2.m_y - pt1.m_y) / double(numArrows + 1)) * double(i + 1));
136 
137  std::vector<wxPoint2DDouble> triPts;
138  triPts.push_back(arrowCenter + wxPoint2DDouble(5.0, 0.0));
139  triPts.push_back(arrowCenter + wxPoint2DDouble(-5.0, 5.0));
140  triPts.push_back(arrowCenter + wxPoint2DDouble(-5.0, -5.0));
141 
142  // Rotate back.
143  for(int i = 0; i < 3; i++) {
144  triPts[i] = wxPoint2DDouble(
145  std::cos(angle) * (triPts[i].m_x - pt1.m_x) - std::sin(angle) * (triPts[i].m_y - pt1.m_y) + pt1.m_x,
146  std::sin(angle) * (triPts[i].m_x - pt1.m_x) + std::cos(angle) * (triPts[i].m_y - pt1.m_y) +
147  pt1.m_y);
148  }
149  m_powerFlowArrow.push_back(triPts);
150  }
151  }
152 }
153 
155 {
156  if(m_online) {
157  glColor4dv(m_powerFlowArrowColour.GetRGBA());
158  for(int i = 0; i < (int)m_powerFlowArrow.size(); i++) {
159  DrawTriangle(m_powerFlowArrow[i]);
160  }
161  }
162 }
163 
164 double PowerElement::GetValueFromUnit(double value, ElectricalUnit valueUnit)
165 {
166  switch(valueUnit) {
167  case UNIT_kV:
168  case UNIT_kA:
169  case UNIT_kW:
170  case UNIT_kVA:
171  case UNIT_kVAr: {
172  return value * 1e3;
173  } break;
174  case UNIT_MW:
175  case UNIT_MVA:
176  case UNIT_MVAr: {
177  return value * 1e6;
178  }
179  default:
180  break;
181  }
182  return value;
183 }
double GetAngle() const
Get the element angle.
Definition: Element.h:212
+ +
virtual void DrawTriangle(std::vector< wxPoint2DDouble > points, GLenum mode=GL_TRIANGLES) const
Draw a triangle.
Definition: Element.cpp:60
+
virtual void UpdateSwitches()
Update the switch position.
+
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
+
void SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
Set the colour in RGBA. The colour values must be between 0.0 and 1.0.
Definition: Element.cpp:369
+ + +
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+
virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode=GL_QUADS) const
Draw rectangle.
Definition: Element.cpp:69
+ + + + +
virtual void CalculatePowerFlowPts(std::vector< wxPoint2DDouble > edges)
Calculate the points of the power flow arrows.
+ +
virtual void DrawPowerFlowPts() const
Draw power flow arrows.
Switching data of power elements.
-
PowerElement()
Constructor.
Definition: PowerElement.cpp:6
-
~PowerElement()
Destructor.
-
virtual void DrawSwitches() const
Draw switch.
-
virtual bool SwitchesContains(wxPoint2DDouble position) const
Check if switch contains position.
+
PowerElement()
Constructor.
+
~PowerElement()
Destructor.
+
virtual void DrawSwitches() const
Draw switch.
+
virtual bool SwitchesContains(wxPoint2DDouble position) const
Check if switch contains position.
virtual bool Contains(wxPoint2DDouble position) const =0
Checks if the element contains a position.
-
virtual wxPoint2DDouble GetSwitchPoint(Element *parent, wxPoint2DDouble parentPoint, wxPoint2DDouble secondPoint) const
Get the correct switch position.
-
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:171
- -
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:83
+
virtual wxPoint2DDouble GetSwitchPoint(Element *parent, wxPoint2DDouble parentPoint, wxPoint2DDouble secondPoint) const
Get the correct switch position.
+
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:187
+ +
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:101
diff --git a/docs/doxygen/html/_power_element_8h.html b/docs/doxygen/html/_power_element_8h.html index 9c299bf..de32ed6 100644 --- a/docs/doxygen/html/_power_element_8h.html +++ b/docs/doxygen/html/_power_element_8h.html @@ -21,6 +21,12 @@ + @@ -226,7 +232,7 @@ Enumerations -

Definition at line 11 of file PowerElement.h.

+

Definition at line 28 of file PowerElement.h.

@@ -260,7 +266,7 @@ Enumerations -

Definition at line 38 of file PowerElement.h.

+

Definition at line 55 of file PowerElement.h.

@@ -290,7 +296,7 @@ Enumerations -

Definition at line 61 of file PowerElement.h.

+

Definition at line 78 of file PowerElement.h.

@@ -314,7 +320,7 @@ Enumerations -

Definition at line 52 of file PowerElement.h.

+

Definition at line 69 of file PowerElement.h.

diff --git a/docs/doxygen/html/_power_element_8h_source.html b/docs/doxygen/html/_power_element_8h_source.html index 5570e28..abd7623 100644 --- a/docs/doxygen/html/_power_element_8h_source.html +++ b/docs/doxygen/html/_power_element_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,62 +88,62 @@ $(document).ready(function(){initNavTree('_power_element_8h_source.html','');});
PowerElement.h
-Go to the documentation of this file.
1 #ifndef POWERELEMENT_H
2 #define POWERELEMENT_H
3 
4 #include "Element.h"
5 #include "ElementPlotData.h"
6 
12  UNIT_PU = 0,
32 };
33 
38 enum FaultData {
46 };
47 
53  SW_INSERT = 0,
55 };
56 
62  PF_NONE = 0,
67 };
68 
76 struct SwitchingData {
77  std::vector<SwitchingType> swType;
78  std::vector<double> swTime;
79 };
80 
89  double c;
90  double m;
91 };
92 
100 class PowerElement : public Element
101 {
102  public:
106  PowerElement();
110  ~PowerElement();
111 
118  virtual wxPoint2DDouble GetSwitchPoint(Element* parent,
119  wxPoint2DDouble parentPoint,
120  wxPoint2DDouble secondPoint) const;
121 
126  virtual bool SwitchesContains(wxPoint2DDouble position) const;
127 
131  virtual void UpdateSwitches();
132 
136  virtual void DrawSwitches() const;
137 
142  virtual void CalculatePowerFlowPts(std::vector<wxPoint2DDouble> edges);
143 
147  virtual void DrawPowerFlowPts() const;
148 
154  virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
155 
160  virtual void SetSwitchingData(SwitchingData data) { m_swData = data; }
165  virtual SwitchingData GetSwitchingData() { return m_swData; }
170  virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection) { m_pfDirection = pfDirection; }
175  virtual PowerFlowDirection GetPowerFlowDirection() const { return m_pfDirection; }
181  virtual bool GetPlotData(ElementPlotData& plotData) { return false; }
186  virtual bool HaveDynamicEvent() const { return m_dynEvent; }
191  virtual void SetDynamicEvent(bool dynEvent = true) { m_dynEvent = dynEvent; }
192  virtual double GetValueFromUnit(double value, ElectricalUnit valueUnit);
193 
194  protected:
195  SwitchingData m_swData;
196  std::vector<std::vector<wxPoint2DDouble> > m_powerFlowArrow;
197  PowerFlowDirection m_pfDirection = PF_NONE;
198 
199  OpenGLColour m_busColour;
200  OpenGLColour m_onlineElementColour;
201  OpenGLColour m_offlineElementColour;
202  OpenGLColour m_closedSwitchColour;
203  OpenGLColour m_openedSwitchColour;
204  OpenGLColour m_powerFlowArrowColour;
205  OpenGLColour m_dynamicEventColour;
206 
207  bool m_dynEvent = false;
208 };
209 
210 #endif // POWERELEMENT_H
- -
std::vector< double > swTime
Definition: PowerElement.h:78
- - - - - -
FaultData
Information about fault (type and location).
Definition: PowerElement.h:38
-
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: PowerElement.h:170
-
virtual bool HaveDynamicEvent() const
Check if the power element have dynamic event.
Definition: PowerElement.h:186
- - -
std::vector< SwitchingType > swType
Definition: PowerElement.h:77
-
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
- - -
virtual void SetDynamicEvent(bool dynEvent=true)
Set if the power element have dynamic event.
Definition: PowerElement.h:191
- - +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef POWERELEMENT_H
19 #define POWERELEMENT_H
20 
21 #include "Element.h"
22 #include "ElementPlotData.h"
23 
29  UNIT_PU = 0,
49 };
50 
55 enum FaultData {
63 };
64 
70  SW_INSERT = 0,
72 };
73 
79  PF_NONE = 0,
84 };
85 
93 struct SwitchingData {
94  std::vector<SwitchingType> swType;
95  std::vector<double> swTime;
96 };
97 
106  double c;
107  double m;
108 };
109 
117 class PowerElement : public Element
118 {
119  public:
123  PowerElement();
127  ~PowerElement();
128 
135  virtual wxPoint2DDouble GetSwitchPoint(Element* parent,
136  wxPoint2DDouble parentPoint,
137  wxPoint2DDouble secondPoint) const;
138 
143  virtual bool SwitchesContains(wxPoint2DDouble position) const;
144 
148  virtual void UpdateSwitches();
149 
153  virtual void DrawSwitches() const;
154 
159  virtual void CalculatePowerFlowPts(std::vector<wxPoint2DDouble> edges);
160 
164  virtual void DrawPowerFlowPts() const;
165 
171  virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
172 
177  virtual void SetSwitchingData(SwitchingData data) { m_swData = data; }
182  virtual SwitchingData GetSwitchingData() { return m_swData; }
187  virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection) { m_pfDirection = pfDirection; }
192  virtual PowerFlowDirection GetPowerFlowDirection() const { return m_pfDirection; }
198  virtual bool GetPlotData(ElementPlotData& plotData) { return false; }
203  virtual bool HaveDynamicEvent() const { return m_dynEvent; }
208  virtual void SetDynamicEvent(bool dynEvent = true) { m_dynEvent = dynEvent; }
209  virtual double GetValueFromUnit(double value, ElectricalUnit valueUnit);
210 
211  protected:
212  SwitchingData m_swData;
213  std::vector<std::vector<wxPoint2DDouble> > m_powerFlowArrow;
214  PowerFlowDirection m_pfDirection = PF_NONE;
215 
216  OpenGLColour m_busColour;
217  OpenGLColour m_onlineElementColour;
218  OpenGLColour m_offlineElementColour;
219  OpenGLColour m_closedSwitchColour;
220  OpenGLColour m_openedSwitchColour;
221  OpenGLColour m_powerFlowArrowColour;
222  OpenGLColour m_dynamicEventColour;
223 
224  bool m_dynEvent = false;
225 };
226 
227 #endif // POWERELEMENT_H
+ +
std::vector< double > swTime
Definition: PowerElement.h:95
+ + + + + +
FaultData
Information about fault (type and location).
Definition: PowerElement.h:55
+
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
Definition: PowerElement.h:187
+
virtual bool HaveDynamicEvent() const
Check if the power element have dynamic event.
Definition: PowerElement.h:203
+ + +
std::vector< SwitchingType > swType
Definition: PowerElement.h:94
+
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+ + +
virtual void SetDynamicEvent(bool dynEvent=true)
Set if the power element have dynamic event.
Definition: PowerElement.h:208
+ +
Class to manage color of OpenGL.
- - -
virtual bool GetPlotData(ElementPlotData &plotData)
Fill the plot data.
Definition: PowerElement.h:181
- - - - - - - - - - - - - -
virtual PowerFlowDirection GetPowerFlowDirection() const
Return the direction of the power flow.
Definition: PowerElement.h:175
- -
virtual SwitchingData GetSwitchingData()
Returns the switching data of the element.
Definition: PowerElement.h:165
- -
SwitchingType
Type of switching.
Definition: PowerElement.h:52
- - - -
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:61
- - - - - - -
virtual void SetSwitchingData(SwitchingData data)
Set the switching data of the element.
Definition: PowerElement.h:160
- - - + + +
virtual bool GetPlotData(ElementPlotData &plotData)
Fill the plot data.
Definition: PowerElement.h:198
+ + + + + + + + + + + + + +
virtual PowerFlowDirection GetPowerFlowDirection() const
Return the direction of the power flow.
Definition: PowerElement.h:192
+ +
virtual SwitchingData GetSwitchingData()
Returns the switching data of the element.
Definition: PowerElement.h:182
+ +
SwitchingType
Type of switching.
Definition: PowerElement.h:69
+ + + +
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:78
+ + + + + + +
virtual void SetSwitchingData(SwitchingData data)
Set the switching data of the element.
Definition: PowerElement.h:177
+ + +
diff --git a/docs/doxygen/html/_power_flow_8cpp_source.html b/docs/doxygen/html/_power_flow_8cpp_source.html index d05c53d..7143bea 100644 --- a/docs/doxygen/html/_power_flow_8cpp_source.html +++ b/docs/doxygen/html/_power_flow_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,19 +88,19 @@ $(document).ready(function(){initNavTree('_power_flow_8cpp_source.html','');});
PowerFlow.cpp
-
1 #include "PowerFlow.h"
2 
3 PowerFlow::PowerFlow()
5 {
6 }
7 
8 PowerFlow::PowerFlow(std::vector<Element*> elementList)
10 {
11  GetElementsFromList(elementList);
12 }
13 
14 PowerFlow::~PowerFlow() {}
15 
16 bool PowerFlow::RunGaussSeidel(double systemPowerBase,
17  int maxIteration,
18  double error,
19  double initAngle,
20  double accFactor)
21 {
22  // Calculate the Ybus.
23  if(!GetYBus(m_yBus, systemPowerBase)) {
24  m_errorMsg = _("No buses found on the system.");
25  return false;
26  }
27 
28  // Number of buses on the system.
29  int numberOfBuses = static_cast<int>(m_busList.size());
30 
31  std::vector<BusType> busType; // Bus type
32  std::vector<std::complex<double> > voltage; // Voltage of buses
33  std::vector<std::complex<double> > power; // Injected power
34  std::vector<std::complex<double> > loadPower; // Only the load power
35  std::vector<ReactiveLimits> reactiveLimit; // Limit of reactive power on PV buses
36 
37  reactiveLimit.resize(numberOfBuses);
38 
39  int busNumber = 0;
40  for(auto itb = m_busList.begin(); itb != m_busList.end(); itb++) {
41  Bus* bus = *itb;
42  BusElectricalData data = bus->GetElectricalData();
43 
44  // Fill the bus type
45  if(data.slackBus) busType.push_back(BUS_SLACK);
46  // If the bus have controlled voltage, check if at least one synchronous machine is connected, then set the
47  // bus type.
48  else if(data.isVoltageControlled) {
49  bool hasSyncMachine = false;
50  // Synchronous generator
51  for(auto itsg = m_syncGeneratorList.begin(); itsg != m_syncGeneratorList.end(); itsg++) {
52  SyncGenerator* syncGenerator = *itsg;
53  if(bus == syncGenerator->GetParentList()[0] && syncGenerator->IsOnline()) hasSyncMachine = true;
54  }
55  // Synchronous motor
56  for(auto itsm = m_syncMotorList.begin(); itsm != m_syncMotorList.end(); itsm++) {
57  SyncMotor* syncMotor = *itsm;
58  if(bus == syncMotor->GetParentList()[0] && syncMotor->IsOnline()) hasSyncMachine = true;
59  }
60  if(hasSyncMachine)
61  busType.push_back(BUS_PV);
62  else
63  busType.push_back(BUS_PQ);
64  } else
65  busType.push_back(BUS_PQ);
66 
67  // Fill the voltages array
68  if(data.isVoltageControlled && busType[busNumber] != BUS_PQ) {
69  voltage.push_back(std::complex<double>(data.controlledVoltage, 0.0));
70  } else {
71  voltage.push_back(std::complex<double>(1.0, 0.0));
72  }
73 
74  // Fill the power array
75  power.push_back(std::complex<double>(0.0, 0.0)); // Initial value
76  loadPower.push_back(std::complex<double>(0.0, 0.0));
77 
78  // Synchronous generator
79  for(auto itsg = m_syncGeneratorList.begin(); itsg != m_syncGeneratorList.end(); itsg++) {
80  SyncGenerator* syncGenerator = *itsg;
81  if(syncGenerator->IsOnline()) {
82  if(bus == syncGenerator->GetParentList()[0]) {
83  SyncGeneratorElectricalData childData = syncGenerator->GetPUElectricalData(systemPowerBase);
84  power[busNumber] += std::complex<double>(childData.activePower, childData.reactivePower);
85 
86  if(busType[busNumber] == BUS_PV) {
87  if(childData.haveMaxReactive && reactiveLimit[busNumber].maxLimitType != RL_UNLIMITED_SOURCE) {
88  reactiveLimit[busNumber].maxLimitType = RL_LIMITED;
89  reactiveLimit[busNumber].maxLimit += childData.maxReactive;
90  } else if(!childData.haveMaxReactive)
91  reactiveLimit[busNumber].maxLimitType = RL_UNLIMITED_SOURCE;
92 
93  if(childData.haveMinReactive && reactiveLimit[busNumber].minLimitType != RL_UNLIMITED_SOURCE) {
94  reactiveLimit[busNumber].minLimitType = RL_LIMITED;
95  reactiveLimit[busNumber].minLimit += childData.minReactive;
96  } else if(!childData.haveMinReactive)
97  reactiveLimit[busNumber].minLimitType = RL_UNLIMITED_SOURCE;
98  }
99  }
100  }
101  }
102  // Synchronous motor
103  for(auto itsm = m_syncMotorList.begin(); itsm != m_syncMotorList.end(); itsm++) {
104  SyncMotor* syncMotor = *itsm;
105  if(syncMotor->IsOnline()) {
106  if(bus == syncMotor->GetParentList()[0]) {
107  SyncMotorElectricalData childData = syncMotor->GetPUElectricalData(systemPowerBase);
108  power[busNumber] += std::complex<double>(-childData.activePower, childData.reactivePower);
109  loadPower[busNumber] += std::complex<double>(-childData.activePower, 0.0);
110 
111  if(busType[busNumber] == BUS_PV) {
112  if(childData.haveMaxReactive && reactiveLimit[busNumber].maxLimitType != RL_UNLIMITED_SOURCE) {
113  reactiveLimit[busNumber].maxLimitType = RL_LIMITED;
114  reactiveLimit[busNumber].maxLimit += childData.maxReactive;
115  } else if(!childData.haveMaxReactive)
116  reactiveLimit[busNumber].maxLimitType = RL_UNLIMITED_SOURCE;
117 
118  if(childData.haveMinReactive && reactiveLimit[busNumber].minLimitType != RL_UNLIMITED_SOURCE) {
119  reactiveLimit[busNumber].minLimitType = RL_LIMITED;
120  reactiveLimit[busNumber].minLimit += childData.minReactive;
121  } else if(!childData.haveMinReactive)
122  reactiveLimit[busNumber].minLimitType = RL_UNLIMITED_SOURCE;
123  }
124  }
125  }
126  }
127  // Load
128  for(auto itl = m_loadList.begin(); itl != m_loadList.end(); itl++) {
129  Load* load = *itl;
130  if(load->IsOnline()) {
131  if(bus == load->GetParentList()[0]) {
132  LoadElectricalData childData = load->GetPUElectricalData(systemPowerBase);
133  if(childData.loadType == CONST_POWER) {
134  power[busNumber] += std::complex<double>(-childData.activePower, -childData.reactivePower);
135  loadPower[busNumber] += std::complex<double>(-childData.activePower, -childData.reactivePower);
136  }
137  }
138  }
139  }
140 
141  // Induction motor
142  for(auto itim = m_indMotorList.begin(); itim != m_indMotorList.end(); itim++) {
143  IndMotor* indMotor = *itim;
144  if(indMotor->IsOnline()) {
145  if(bus == indMotor->GetParentList()[0]) {
146  IndMotorElectricalData childData = indMotor->GetPUElectricalData(systemPowerBase);
147  power[busNumber] += std::complex<double>(-childData.activePower, -childData.reactivePower);
148  loadPower[busNumber] += std::complex<double>(-childData.activePower, -childData.reactivePower);
149  }
150  }
151  }
152 
153  busNumber++;
154  }
155 
156  // Check if have slack bus and if have generation on the slack bus
157  bool haveSlackBus = false;
158  bool slackBusHaveGeneration = false;
159  for(int i = 0; i < (int)busType.size(); i++) {
160  if(busType[i] == BUS_SLACK) {
161  auto itb = m_busList.begin();
162  std::advance(itb, i);
163  Bus* bus = *itb;
164 
165  for(auto itsg = m_syncGeneratorList.begin(); itsg != m_syncGeneratorList.end(); itsg++) {
166  SyncGenerator* syncGenerator = *itsg;
167  if(syncGenerator->IsOnline() && bus == syncGenerator->GetParentList()[0]) slackBusHaveGeneration = true;
168  }
169  haveSlackBus = true;
170  }
171  }
172  if(!haveSlackBus) {
173  m_errorMsg = _("There is no slack bus on the system.");
174  return false;
175  }
176  if(!slackBusHaveGeneration) {
177  m_errorMsg = _("The slack bus don't have generation.");
178  return false;
179  }
180 
181  // Gauss-Seidel method
182  std::vector<std::complex<double> > oldVoltage; // Old voltage array.
183  oldVoltage.resize(voltage.size());
184 
185  auto oldBusType = busType;
186 
187  int iteration = 0; // Current itaration number.
188 
189  while(true) {
190  // Reach the max number of iterations.
191  if(iteration >= maxIteration) {
192  m_errorMsg = _("The maximum number of iterations was reached.");
193  return false;
194  }
195 
196  // Update the old voltage array to current iteration values.
197  for(int i = 0; i < numberOfBuses; i++) oldVoltage[i] = voltage[i];
198 
199  double iterationError = 0.0;
200 
201  for(int i = 0; i < numberOfBuses; i++) {
202  if(busType[i] == BUS_PQ) {
203  std::complex<double> yeSum(0.0, 0.0);
204  for(int k = 0; k < numberOfBuses; k++) {
205  if(i != k) {
206  // Sum { Y[i,k] * E[k] } | k = 1->n; k diff i
207  yeSum += m_yBus[i][k] * voltage[k];
208  }
209  }
210 
211  // E[i] = (1/Y[i,i])*((P[i]-jQ[i])/E*[i] - Sum { Y[i,k] * E[k] (k diff i) })
212  std::complex<double> newVolt =
213  (1.0 / m_yBus[i][i]) * (std::conj(power[i]) / std::conj(voltage[i]) - yeSum);
214 
215  // Apply the acceleration factor.
216  newVolt = std::complex<double>(accFactor * (newVolt.real() - voltage[i].real()) + voltage[i].real(),
217  accFactor * (newVolt.imag() - voltage[i].imag()) + voltage[i].imag());
218 
219  voltage[i] = newVolt;
220  }
221  if(busType[i] == BUS_PV) {
222  std::complex<double> yeSum(0.0, 0.0);
223  for(int k = 0; k < numberOfBuses; k++) {
224  if(i != k) {
225  // Sum { Y[i,k] * E[k] } | k = 1->n; k diff i
226  yeSum += m_yBus[i][k] * voltage[k];
227  }
228  }
229  std::complex<double> yeSumT = yeSum + (m_yBus[i][i] * voltage[i]);
230 
231  // Q[i] = - Im( E*[i] * Sum { Y[i,k] * E[k] } )
232  std::complex<double> qCalc = std::conj(voltage[i]) * yeSumT;
233  power[i] = std::complex<double>(power[i].real(), -qCalc.imag());
234 
235  // E[i] = (1/Y[i,i])*((P[i]-jQ[i])/E*[i] - Sum { Y[i,k] * E[k] (k diff i) })
236  std::complex<double> newVolt =
237  (1.0 / m_yBus[i][i]) * (std::conj(power[i]) / std::conj(voltage[i]) - yeSum);
238 
239  // Apply the acceleration factor.
240  newVolt = std::complex<double>(accFactor * (newVolt.real() - voltage[i].real()) + voltage[i].real(),
241  accFactor * (newVolt.imag() - voltage[i].imag()) + voltage[i].imag());
242 
243  // Keep the same voltage magnitude.
244  voltage[i] = std::complex<double>(std::abs(voltage[i]) * std::cos(std::arg(newVolt)),
245  std::abs(voltage[i]) * std::sin(std::arg(newVolt)));
246  }
247 
248  double busError = std::max(
249  std::abs(voltage[i].real() - oldVoltage[i].real()), std::abs(voltage[i].imag() - oldVoltage[i].imag()));
250 
251  if(busError > iterationError) iterationError = busError;
252  }
253 
254  if(iterationError < error) {
255  bool limitReach = false;
256  for(int i = 0; i < numberOfBuses; i++) {
257  if(busType[i] == BUS_PV) {
258  if(reactiveLimit[i].maxLimitType == RL_LIMITED) {
259  if(power[i].imag() - loadPower[i].imag() > reactiveLimit[i].maxLimit) {
260  power[i] =
261  std::complex<double>(power[i].real(), reactiveLimit[i].maxLimit + loadPower[i].imag());
262  busType[i] = BUS_PQ;
263  reactiveLimit[i].limitReached = RL_MAX_REACHED;
264  limitReach = true;
265  }
266  }
267  if(reactiveLimit[i].minLimitType == RL_LIMITED) {
268  if(power[i].imag() - loadPower[i].imag() < reactiveLimit[i].minLimit) {
269  power[i] =
270  std::complex<double>(power[i].real(), reactiveLimit[i].minLimit + loadPower[i].imag());
271  busType[i] = BUS_PQ;
272  reactiveLimit[i].limitReached = RL_MIN_REACHED;
273  limitReach = true;
274  }
275  }
276  }
277  }
278  if(!limitReach) break;
279  }
280 
281  iteration++;
282  }
283 
284  // Adjust the power array.
285  // TODO: Only the slack bus??
286  for(int i = 0; i < numberOfBuses; i++) {
287  std::complex<double> sBus = std::complex<double>(0.0, 0.0);
288  for(int j = 0; j < numberOfBuses; j++) sBus += voltage[i] * std::conj(voltage[j]) * std::conj(m_yBus[i][j]);
289  power[i] = sBus;
290  }
291 
292  UpdateElementsPowerFlow(voltage, power, oldBusType, reactiveLimit, systemPowerBase);
293 
294  return true;
295 }
- -
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:517
- - -
Definition: Bus.h:45
-
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:219
-
Definition: Load.h:23
- - - - - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "PowerFlow.h"
19 
20 PowerFlow::PowerFlow() : ElectricCalculation() {}
21 PowerFlow::PowerFlow(std::vector<Element*> elementList) : ElectricCalculation() { GetElementsFromList(elementList); }
22 PowerFlow::~PowerFlow() {}
23 bool PowerFlow::RunGaussSeidel(double systemPowerBase,
24  int maxIteration,
25  double error,
26  double initAngle,
27  double accFactor)
28 {
29  // Calculate the Ybus.
30  if(!GetYBus(m_yBus, systemPowerBase)) {
31  m_errorMsg = _("No buses found on the system.");
32  return false;
33  }
34 
35  // Number of buses on the system.
36  int numberOfBuses = static_cast<int>(m_busList.size());
37 
38  std::vector<BusType> busType; // Bus type
39  std::vector<std::complex<double> > voltage; // Voltage of buses
40  std::vector<std::complex<double> > power; // Injected power
41  std::vector<std::complex<double> > loadPower; // Only the load power
42  std::vector<ReactiveLimits> reactiveLimit; // Limit of reactive power on PV buses
43 
44  reactiveLimit.resize(numberOfBuses);
45 
46  int busNumber = 0;
47  for(auto itb = m_busList.begin(); itb != m_busList.end(); itb++) {
48  Bus* bus = *itb;
49  BusElectricalData data = bus->GetElectricalData();
50 
51  // Fill the bus type
52  if(data.slackBus) busType.push_back(BUS_SLACK);
53  // If the bus have controlled voltage, check if at least one synchronous machine is connected, then set the
54  // bus type.
55  else if(data.isVoltageControlled) {
56  bool hasSyncMachine = false;
57  // Synchronous generator
58  for(auto itsg = m_syncGeneratorList.begin(); itsg != m_syncGeneratorList.end(); itsg++) {
59  SyncGenerator* syncGenerator = *itsg;
60  if(bus == syncGenerator->GetParentList()[0] && syncGenerator->IsOnline()) hasSyncMachine = true;
61  }
62  // Synchronous motor
63  for(auto itsm = m_syncMotorList.begin(); itsm != m_syncMotorList.end(); itsm++) {
64  SyncMotor* syncMotor = *itsm;
65  if(bus == syncMotor->GetParentList()[0] && syncMotor->IsOnline()) hasSyncMachine = true;
66  }
67  if(hasSyncMachine)
68  busType.push_back(BUS_PV);
69  else
70  busType.push_back(BUS_PQ);
71  } else
72  busType.push_back(BUS_PQ);
73 
74  // Fill the voltages array
75  if(data.isVoltageControlled && busType[busNumber] != BUS_PQ) {
76  voltage.push_back(std::complex<double>(data.controlledVoltage, 0.0));
77  } else {
78  voltage.push_back(std::complex<double>(1.0, 0.0));
79  }
80 
81  // Fill the power array
82  power.push_back(std::complex<double>(0.0, 0.0)); // Initial value
83  loadPower.push_back(std::complex<double>(0.0, 0.0));
84 
85  // Synchronous generator
86  for(auto itsg = m_syncGeneratorList.begin(); itsg != m_syncGeneratorList.end(); itsg++) {
87  SyncGenerator* syncGenerator = *itsg;
88  if(syncGenerator->IsOnline()) {
89  if(bus == syncGenerator->GetParentList()[0]) {
90  SyncGeneratorElectricalData childData = syncGenerator->GetPUElectricalData(systemPowerBase);
91  power[busNumber] += std::complex<double>(childData.activePower, childData.reactivePower);
92 
93  if(busType[busNumber] == BUS_PV) {
94  if(childData.haveMaxReactive && reactiveLimit[busNumber].maxLimitType != RL_UNLIMITED_SOURCE) {
95  reactiveLimit[busNumber].maxLimitType = RL_LIMITED;
96  reactiveLimit[busNumber].maxLimit += childData.maxReactive;
97  } else if(!childData.haveMaxReactive)
98  reactiveLimit[busNumber].maxLimitType = RL_UNLIMITED_SOURCE;
99 
100  if(childData.haveMinReactive && reactiveLimit[busNumber].minLimitType != RL_UNLIMITED_SOURCE) {
101  reactiveLimit[busNumber].minLimitType = RL_LIMITED;
102  reactiveLimit[busNumber].minLimit += childData.minReactive;
103  } else if(!childData.haveMinReactive)
104  reactiveLimit[busNumber].minLimitType = RL_UNLIMITED_SOURCE;
105  }
106  }
107  }
108  }
109  // Synchronous motor
110  for(auto itsm = m_syncMotorList.begin(); itsm != m_syncMotorList.end(); itsm++) {
111  SyncMotor* syncMotor = *itsm;
112  if(syncMotor->IsOnline()) {
113  if(bus == syncMotor->GetParentList()[0]) {
114  SyncMotorElectricalData childData = syncMotor->GetPUElectricalData(systemPowerBase);
115  power[busNumber] += std::complex<double>(-childData.activePower, childData.reactivePower);
116  loadPower[busNumber] += std::complex<double>(-childData.activePower, 0.0);
117 
118  if(busType[busNumber] == BUS_PV) {
119  if(childData.haveMaxReactive && reactiveLimit[busNumber].maxLimitType != RL_UNLIMITED_SOURCE) {
120  reactiveLimit[busNumber].maxLimitType = RL_LIMITED;
121  reactiveLimit[busNumber].maxLimit += childData.maxReactive;
122  } else if(!childData.haveMaxReactive)
123  reactiveLimit[busNumber].maxLimitType = RL_UNLIMITED_SOURCE;
124 
125  if(childData.haveMinReactive && reactiveLimit[busNumber].minLimitType != RL_UNLIMITED_SOURCE) {
126  reactiveLimit[busNumber].minLimitType = RL_LIMITED;
127  reactiveLimit[busNumber].minLimit += childData.minReactive;
128  } else if(!childData.haveMinReactive)
129  reactiveLimit[busNumber].minLimitType = RL_UNLIMITED_SOURCE;
130  }
131  }
132  }
133  }
134  // Load
135  for(auto itl = m_loadList.begin(); itl != m_loadList.end(); itl++) {
136  Load* load = *itl;
137  if(load->IsOnline()) {
138  if(bus == load->GetParentList()[0]) {
139  LoadElectricalData childData = load->GetPUElectricalData(systemPowerBase);
140  if(childData.loadType == CONST_POWER) {
141  power[busNumber] += std::complex<double>(-childData.activePower, -childData.reactivePower);
142  loadPower[busNumber] += std::complex<double>(-childData.activePower, -childData.reactivePower);
143  }
144  }
145  }
146  }
147 
148  // Induction motor
149  for(auto itim = m_indMotorList.begin(); itim != m_indMotorList.end(); itim++) {
150  IndMotor* indMotor = *itim;
151  if(indMotor->IsOnline()) {
152  if(bus == indMotor->GetParentList()[0]) {
153  IndMotorElectricalData childData = indMotor->GetPUElectricalData(systemPowerBase);
154  power[busNumber] += std::complex<double>(-childData.activePower, -childData.reactivePower);
155  loadPower[busNumber] += std::complex<double>(-childData.activePower, -childData.reactivePower);
156  }
157  }
158  }
159 
160  busNumber++;
161  }
162 
163  // Check if have slack bus and if have generation on the slack bus
164  bool haveSlackBus = false;
165  bool slackBusHaveGeneration = false;
166  for(int i = 0; i < (int)busType.size(); i++) {
167  if(busType[i] == BUS_SLACK) {
168  auto itb = m_busList.begin();
169  std::advance(itb, i);
170  Bus* bus = *itb;
171 
172  for(auto itsg = m_syncGeneratorList.begin(); itsg != m_syncGeneratorList.end(); itsg++) {
173  SyncGenerator* syncGenerator = *itsg;
174  if(syncGenerator->IsOnline() && bus == syncGenerator->GetParentList()[0]) slackBusHaveGeneration = true;
175  }
176  haveSlackBus = true;
177  }
178  }
179  if(!haveSlackBus) {
180  m_errorMsg = _("There is no slack bus on the system.");
181  return false;
182  }
183  if(!slackBusHaveGeneration) {
184  m_errorMsg = _("The slack bus don't have generation.");
185  return false;
186  }
187 
188  // Gauss-Seidel method
189  std::vector<std::complex<double> > oldVoltage; // Old voltage array.
190  oldVoltage.resize(voltage.size());
191 
192  auto oldBusType = busType;
193 
194  int iteration = 0; // Current itaration number.
195 
196  while(true) {
197  // Reach the max number of iterations.
198  if(iteration >= maxIteration) {
199  m_errorMsg = _("The maximum number of iterations was reached.");
200  return false;
201  }
202 
203  // Update the old voltage array to current iteration values.
204  for(int i = 0; i < numberOfBuses; i++) oldVoltage[i] = voltage[i];
205 
206  double iterationError = 0.0;
207 
208  for(int i = 0; i < numberOfBuses; i++) {
209  if(busType[i] == BUS_PQ) {
210  std::complex<double> yeSum(0.0, 0.0);
211  for(int k = 0; k < numberOfBuses; k++) {
212  if(i != k) {
213  // Sum { Y[i,k] * E[k] } | k = 1->n; k diff i
214  yeSum += m_yBus[i][k] * voltage[k];
215  }
216  }
217 
218  // E[i] = (1/Y[i,i])*((P[i]-jQ[i])/E*[i] - Sum { Y[i,k] * E[k] (k diff i) })
219  std::complex<double> newVolt =
220  (1.0 / m_yBus[i][i]) * (std::conj(power[i]) / std::conj(voltage[i]) - yeSum);
221 
222  // Apply the acceleration factor.
223  newVolt = std::complex<double>(accFactor * (newVolt.real() - voltage[i].real()) + voltage[i].real(),
224  accFactor * (newVolt.imag() - voltage[i].imag()) + voltage[i].imag());
225 
226  voltage[i] = newVolt;
227  }
228  if(busType[i] == BUS_PV) {
229  std::complex<double> yeSum(0.0, 0.0);
230  for(int k = 0; k < numberOfBuses; k++) {
231  if(i != k) {
232  // Sum { Y[i,k] * E[k] } | k = 1->n; k diff i
233  yeSum += m_yBus[i][k] * voltage[k];
234  }
235  }
236  std::complex<double> yeSumT = yeSum + (m_yBus[i][i] * voltage[i]);
237 
238  // Q[i] = - Im( E*[i] * Sum { Y[i,k] * E[k] } )
239  std::complex<double> qCalc = std::conj(voltage[i]) * yeSumT;
240  power[i] = std::complex<double>(power[i].real(), -qCalc.imag());
241 
242  // E[i] = (1/Y[i,i])*((P[i]-jQ[i])/E*[i] - Sum { Y[i,k] * E[k] (k diff i) })
243  std::complex<double> newVolt =
244  (1.0 / m_yBus[i][i]) * (std::conj(power[i]) / std::conj(voltage[i]) - yeSum);
245 
246  // Apply the acceleration factor.
247  newVolt = std::complex<double>(accFactor * (newVolt.real() - voltage[i].real()) + voltage[i].real(),
248  accFactor * (newVolt.imag() - voltage[i].imag()) + voltage[i].imag());
249 
250  // Keep the same voltage magnitude.
251  voltage[i] = std::complex<double>(std::abs(voltage[i]) * std::cos(std::arg(newVolt)),
252  std::abs(voltage[i]) * std::sin(std::arg(newVolt)));
253  }
254 
255  double busError = std::max(std::abs(voltage[i].real() - oldVoltage[i].real()),
256  std::abs(voltage[i].imag() - oldVoltage[i].imag()));
257 
258  if(busError > iterationError) iterationError = busError;
259  }
260 
261  if(iterationError < error) {
262  bool limitReach = false;
263  for(int i = 0; i < numberOfBuses; i++) {
264  if(busType[i] == BUS_PV) {
265  if(reactiveLimit[i].maxLimitType == RL_LIMITED) {
266  if(power[i].imag() - loadPower[i].imag() > reactiveLimit[i].maxLimit) {
267  power[i] =
268  std::complex<double>(power[i].real(), reactiveLimit[i].maxLimit + loadPower[i].imag());
269  busType[i] = BUS_PQ;
270  reactiveLimit[i].limitReached = RL_MAX_REACHED;
271  limitReach = true;
272  }
273  }
274  if(reactiveLimit[i].minLimitType == RL_LIMITED) {
275  if(power[i].imag() - loadPower[i].imag() < reactiveLimit[i].minLimit) {
276  power[i] =
277  std::complex<double>(power[i].real(), reactiveLimit[i].minLimit + loadPower[i].imag());
278  busType[i] = BUS_PQ;
279  reactiveLimit[i].limitReached = RL_MIN_REACHED;
280  limitReach = true;
281  }
282  }
283  }
284  }
285  if(!limitReach) break;
286  }
287 
288  iteration++;
289  }
290 
291  // Adjust the power array.
292  // TODO: Only the slack bus??
293  for(int i = 0; i < numberOfBuses; i++) {
294  std::complex<double> sBus = std::complex<double>(0.0, 0.0);
295  for(int j = 0; j < numberOfBuses; j++) sBus += voltage[i] * std::conj(voltage[j]) * std::conj(m_yBus[i][j]);
296  power[i] = sBus;
297  }
298 
299  UpdateElementsPowerFlow(voltage, power, oldBusType, reactiveLimit, systemPowerBase);
300 
301  return true;
302 }
+ +
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:506
+ + +
Definition: Bus.h:62
+
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:227
+
Definition: Load.h:35
+ + + + +
diff --git a/docs/doxygen/html/_power_flow_8h_source.html b/docs/doxygen/html/_power_flow_8h_source.html index c66b86a..677dd50 100644 --- a/docs/doxygen/html/_power_flow_8h_source.html +++ b/docs/doxygen/html/_power_flow_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,9 +88,9 @@ $(document).ready(function(){initNavTree('_power_flow_8h_source.html','');});
PowerFlow.h
-
1 #ifndef POWERFLOW_H
2 #define POWERFLOW_H
3 
4 #include "ElectricCalculation.h"
5 
6 #include <wx/string.h>
7 #include <wx/intl.h> //_()
8 
10 {
11 public:
12  PowerFlow();
13  PowerFlow(std::vector<Element*> elementList);
14  ~PowerFlow();
15  virtual bool RunGaussSeidel(double systemPowerBase = 100e6,
16  int maxIteration = 5000,
17  double error = 1e-6,
18  double initAngle = 0.0,
19  double accFactor = 1.0);
20 
21  virtual wxString GetErrorMessage() { return m_errorMsg; }
22 
23 protected:
24  std::vector<std::vector<std::complex<double> > > m_yBus;
25  wxString m_errorMsg = "";
26 };
27 
28 #endif // POWERFLOW_H
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef POWERFLOW_H
19 #define POWERFLOW_H
20 
21 #include "ElectricCalculation.h"
22 
23 #include <wx/string.h>
24 #include <wx/intl.h> //_()
25 
27 {
28  public:
29  PowerFlow();
30  PowerFlow(std::vector<Element*> elementList);
31  ~PowerFlow();
32  virtual bool RunGaussSeidel(double systemPowerBase = 100e6,
33  int maxIteration = 5000,
34  double error = 1e-6,
35  double initAngle = 0.0,
36  double accFactor = 1.0);
37 
38  virtual wxString GetErrorMessage() { return m_errorMsg; }
39  protected:
40  std::vector<std::vector<std::complex<double> > > m_yBus;
41  wxString m_errorMsg = "";
42 };
43 
44 #endif // POWERFLOW_H
Base class of electric calculations, with general methods.
- +
diff --git a/docs/doxygen/html/_properties_data_8cpp_source.html b/docs/doxygen/html/_properties_data_8cpp_source.html index 9fa7f45..768b0fb 100644 --- a/docs/doxygen/html/_properties_data_8cpp_source.html +++ b/docs/doxygen/html/_properties_data_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,7 +88,7 @@ $(document).ready(function(){initNavTree('_properties_data_8cpp_source.html','')
PropertiesData.cpp
-
1 #include "PropertiesData.h"
2 
3 PropertiesData::PropertiesData()
4 {
5 }
6 
7 PropertiesData::~PropertiesData()
8 {
9 }
10 
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "PropertiesData.h"
19 
20 PropertiesData::PropertiesData() {}
21 PropertiesData::~PropertiesData() {}
-
1 #ifndef PROPERTIESDATA_H
2 #define PROPERTIESDATA_H
3 
4 #include "wx/language.h"
5 #include "Element.h"
6 #include "PowerElement.h"
7 
8 enum PowerFlowMethod { GAUSS_SEIDEL = 0, NEWTON_RAPHSON };
9 enum GUITheme { THEME_LIGHT = 0, THEME_DARK };
10 
12  // General simulation data
13  double basePower = 100.0;
14  ElectricalUnit basePowerUnit = UNIT_MVA;
15  bool faultAfterPowerFlow = true;
16  bool scPowerAfterPowerFlow = true;
17 
18  // Power flow
19  PowerFlowMethod powerFlowMethod = GAUSS_SEIDEL;
20  double accFator = 1.0;
21  double powerFlowTolerance = 1e-7;
22  int powerFlowMaxIterations = 5000;
23 
24  // Stability
25  double stabilityFrequency = 60.0;
26  double timeStep = 1e-2;
27  double stabilitySimulationTime = 10.0;
28  double stabilityTolerance = 1e-8;
29  int stabilityMaxIterations = 100;
30  int controlTimeStepRatio = 10;
31  double plotTime = 1e-2;
32  bool useCOI = true;
33 };
34 
35 struct GeneralData {
36  wxLanguage language = wxLANGUAGE_ENGLISH;
37  GUITheme theme = THEME_LIGHT;
38 };
39 
41 {
42  public:
44  ~PropertiesData();
45 
46  SimulationData GetSimulationPropertiesData() const { return m_simulData; }
47  void SetSimulationPropertiesData(SimulationData simulationData) { m_simulData = simulationData; }
48  GeneralData GetGeneralPropertiesData() const { return m_genData; }
49  void SetGeneralPropertiesData(GeneralData generalData) { m_genData = generalData; }
50  protected:
51  SimulationData m_simulData;
52  GeneralData m_genData;
53 };
54 
55 #endif // PROPERTIESDATA_H
-
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef PROPERTIESDATA_H
19 #define PROPERTIESDATA_H
20 
21 #include "wx/language.h"
22 #include "Element.h"
23 #include "PowerElement.h"
24 
25 enum PowerFlowMethod { GAUSS_SEIDEL = 0, NEWTON_RAPHSON };
26 enum GUITheme { THEME_LIGHT = 0, THEME_DARK };
27 
29  // General simulation data
30  double basePower = 100.0;
31  ElectricalUnit basePowerUnit = UNIT_MVA;
32  bool faultAfterPowerFlow = true;
33  bool scPowerAfterPowerFlow = true;
34 
35  // Power flow
36  PowerFlowMethod powerFlowMethod = GAUSS_SEIDEL;
37  double accFator = 1.0;
38  double powerFlowTolerance = 1e-7;
39  int powerFlowMaxIterations = 5000;
40 
41  // Stability
42  double stabilityFrequency = 60.0;
43  double timeStep = 1e-2;
44  double stabilitySimulationTime = 10.0;
45  double stabilityTolerance = 1e-8;
46  int stabilityMaxIterations = 100;
47  int controlTimeStepRatio = 10;
48  double plotTime = 1e-2;
49  bool useCOI = true;
50 };
51 
52 struct GeneralData {
53  wxLanguage language = wxLANGUAGE_ENGLISH;
54  GUITheme theme = THEME_LIGHT;
55 };
56 
58 {
59  public:
61  ~PropertiesData();
62 
63  SimulationData GetSimulationPropertiesData() const { return m_simulData; }
64  void SetSimulationPropertiesData(SimulationData simulationData) { m_simulData = simulationData; }
65  GeneralData GetGeneralPropertiesData() const { return m_genData; }
66  void SetGeneralPropertiesData(GeneralData generalData) { m_genData = generalData; }
67  protected:
68  SimulationData m_simulData;
69  GeneralData m_genData;
70 };
71 
72 #endif // PROPERTIESDATA_H
+
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
Class to manage color of OpenGL.
- - + +
Switching data of power elements.
- +
diff --git a/docs/doxygen/html/_properties_form_8cpp_source.html b/docs/doxygen/html/_properties_form_8cpp_source.html index df50ee0..82cfe31 100644 --- a/docs/doxygen/html/_properties_form_8cpp_source.html +++ b/docs/doxygen/html/_properties_form_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,7 +88,7 @@ $(document).ready(function(){initNavTree('_properties_form_8cpp_source.html','')
PropertiesForm.cpp
-
1 // This file was auto-generated by codelite's wxCrafter Plugin
3 // wxCrafter project file: PropertiesForm.wxcp
4 // Do not modify this file by hand!
6 
7 #include "PropertiesForm.h"
8 
9 
10 // Declare the bitmap loading function
11 extern void wxCDAD0InitBitmapResources();
12 
13 static bool bBitmapLoaded = false;
14 
15 
16 GeneralPropertiesFormBase::GeneralPropertiesFormBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
17  : wxDialog(parent, id, title, pos, size, style)
18 {
19  if ( !bBitmapLoaded ) {
20  // We need to initialise the default bitmap handler
21  wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
22  wxCDAD0InitBitmapResources();
23  bBitmapLoaded = true;
24  }
25 
26  wxBoxSizer* boxSizer_lvl1_1 = new wxBoxSizer(wxVERTICAL);
27  this->SetSizer(boxSizer_lvl1_1);
28 
29  m_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxBK_DEFAULT);
30  m_notebook->SetName(wxT("m_notebook"));
31 
32  boxSizer_lvl1_1->Add(m_notebook, 1, wxALL|wxEXPAND, WXC_FROM_DIP(5));
33 
34  m_panelGeneral = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
35  m_notebook->AddPage(m_panelGeneral, _("General"), false);
36 
37  wxBoxSizer* boxSizerLvl2_1 = new wxBoxSizer(wxVERTICAL);
38  m_panelGeneral->SetSizer(boxSizerLvl2_1);
39 
40  wxBoxSizer* boxSizerLvl3_1 = new wxBoxSizer(wxVERTICAL);
41 
42  boxSizerLvl2_1->Add(boxSizerLvl3_1, 0, wxEXPAND, WXC_FROM_DIP(5));
43 
44  m_staticTextLanguage = new wxStaticText(m_panelGeneral, wxID_ANY, _("Language"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0);
45 
46  boxSizerLvl3_1->Add(m_staticTextLanguage, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
47 
48  wxArrayString m_choiceLanguageArr;
49  m_choiceLanguageArr.Add(wxT("English"));
50  m_choiceLanguageArr.Add(wxT("Portuguese"));
51  m_choiceLanguage = new wxChoice(m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), m_choiceLanguageArr, 0);
52  m_choiceLanguage->SetSelection(0);
53 
54  boxSizerLvl3_1->Add(m_choiceLanguage, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND, WXC_FROM_DIP(5));
55 
56  wxBoxSizer* boxSizerLvl3_2 = new wxBoxSizer(wxVERTICAL);
57 
58  boxSizerLvl2_1->Add(boxSizerLvl3_2, 0, wxEXPAND, WXC_FROM_DIP(5));
59 
60  m_staticTextTheme = new wxStaticText(m_panelGeneral, wxID_ANY, _("Theme"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0);
61 
62  boxSizerLvl3_2->Add(m_staticTextTheme, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
63 
64  wxArrayString m_choiceThemeArr;
65  m_choiceThemeArr.Add(wxT("Light"));
66  m_choiceThemeArr.Add(wxT("Dark"));
67  m_choiceTheme = new wxChoice(m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), m_choiceThemeArr, 0);
68  m_choiceTheme->SetSelection(0);
69 
70  boxSizerLvl3_2->Add(m_choiceTheme, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND, WXC_FROM_DIP(5));
71 
72  wxBoxSizer* boxSizer_bottonButtons = new wxBoxSizer(wxHORIZONTAL);
73 
74  boxSizer_lvl1_1->Add(boxSizer_bottonButtons, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
75 
76  boxSizer_bottonButtons->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5));
77 
78  m_buttonOK = new wxButton(this, wxID_ANY, _("OK"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
79 
80  boxSizer_bottonButtons->Add(m_buttonOK, 0, wxALL|wxALIGN_RIGHT, WXC_FROM_DIP(5));
81 
82  m_buttonCancel = new wxButton(this, wxID_ANY, _("Cancel"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
83 
84  boxSizer_bottonButtons->Add(m_buttonCancel, 0, wxALL|wxALIGN_RIGHT, WXC_FROM_DIP(5));
85 
86 
87  #if wxVERSION_NUMBER >= 2900
88  if(!wxPersistenceManager::Get().Find(m_notebook)){
89  wxPersistenceManager::Get().RegisterAndRestore(m_notebook);
90  } else {
91  wxPersistenceManager::Get().Restore(m_notebook);
92  }
93  #endif
94 
95  SetName(wxT("GeneralPropertiesFormBase"));
96  SetSize(-1,-1);
97  if (GetSizer()) {
98  GetSizer()->Fit(this);
99  }
100  if(GetParent()) {
101  CentreOnParent(wxBOTH);
102  } else {
103  CentreOnScreen(wxBOTH);
104  }
105 #if wxVERSION_NUMBER >= 2900
106  if(!wxPersistenceManager::Get().Find(this)) {
107  wxPersistenceManager::Get().RegisterAndRestore(this);
108  } else {
109  wxPersistenceManager::Get().Restore(this);
110  }
111 #endif
112  // Connect events
113  m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(GeneralPropertiesFormBase::OnButtonOKClick), NULL, this);
114  m_buttonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(GeneralPropertiesFormBase::OnButtonCancelClick), NULL, this);
115 
116 }
117 
118 GeneralPropertiesFormBase::~GeneralPropertiesFormBase()
119 {
120  m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(GeneralPropertiesFormBase::OnButtonOKClick), NULL, this);
121  m_buttonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(GeneralPropertiesFormBase::OnButtonCancelClick), NULL, this);
122 
123 }
124 
125 SimulationsSettingsFormBase::SimulationsSettingsFormBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
126  : wxDialog(parent, id, title, pos, size, style)
127 {
128  if ( !bBitmapLoaded ) {
129  // We need to initialise the default bitmap handler
130  wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
131  wxCDAD0InitBitmapResources();
132  bBitmapLoaded = true;
133  }
134 
135  wxBoxSizer* boxSizer_lvl1_1 = new wxBoxSizer(wxVERTICAL);
136  this->SetSizer(boxSizer_lvl1_1);
137 
138  m_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxBK_DEFAULT);
139  m_notebook->SetName(wxT("m_notebook"));
140 
141  boxSizer_lvl1_1->Add(m_notebook, 1, wxALL|wxEXPAND, WXC_FROM_DIP(5));
142 
143  m_panelGeneral = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
144  m_notebook->AddPage(m_panelGeneral, _("General"), false);
145 
146  wxBoxSizer* boxSizerLvl2_1 = new wxBoxSizer(wxVERTICAL);
147  m_panelGeneral->SetSizer(boxSizerLvl2_1);
148 
149  wxBoxSizer* boxSizerLvl3_1 = new wxBoxSizer(wxVERTICAL);
150 
151  boxSizerLvl2_1->Add(boxSizerLvl3_1, 0, wxEXPAND, WXC_FROM_DIP(5));
152 
153  m_staticTextBasePower = new wxStaticText(m_panelGeneral, wxID_ANY, _("Base power"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0);
154 
155  boxSizerLvl3_1->Add(m_staticTextBasePower, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
156 
157  wxBoxSizer* boxSizerLvl4_1 = new wxBoxSizer(wxHORIZONTAL);
158 
159  boxSizerLvl3_1->Add(boxSizerLvl4_1, 0, wxEXPAND, WXC_FROM_DIP(5));
160 
161  m_textCtrlbasePower = new wxTextCtrl(m_panelGeneral, wxID_ANY, wxT("100,0"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0);
162  #if wxVERSION_NUMBER >= 3000
163  m_textCtrlbasePower->SetHint(wxT(""));
164  #endif
165 
166  boxSizerLvl4_1->Add(m_textCtrlbasePower, 1, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
167 
168  wxArrayString m_choiceBasePowerArr;
169  m_choiceBasePowerArr.Add(wxT("VA"));
170  m_choiceBasePowerArr.Add(wxT("kVA"));
171  m_choiceBasePowerArr.Add(wxT("MVA"));
172  m_choiceBasePower = new wxChoice(m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), m_choiceBasePowerArr, 0);
173  m_choiceBasePower->SetSelection(2);
174 
175  boxSizerLvl4_1->Add(m_choiceBasePower, 0, wxLEFT|wxRIGHT|wxBOTTOM, WXC_FROM_DIP(5));
176 
177  wxStaticBoxSizer* staticBoxSizerLvl3_2 = new wxStaticBoxSizer( new wxStaticBox(m_panelGeneral, wxID_ANY, _("Continuous calculation")), wxVERTICAL);
178 
179  boxSizerLvl2_1->Add(staticBoxSizerLvl3_2, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
180 
181  m_checkBoxFaultAfterPF = new wxCheckBox(m_panelGeneral, wxID_ANY, _("Calculate fault after power flow"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0);
182  m_checkBoxFaultAfterPF->SetValue(true);
183 
184  staticBoxSizerLvl3_2->Add(m_checkBoxFaultAfterPF, 0, wxALL, WXC_FROM_DIP(5));
185 
186  m_checkBoxSCPowerAfterPF = new wxCheckBox(m_panelGeneral, wxID_ANY, _("Calculate short-circuit power after power flow"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0);
187  m_checkBoxSCPowerAfterPF->SetValue(true);
188 
189  staticBoxSizerLvl3_2->Add(m_checkBoxSCPowerAfterPF, 0, wxALL, WXC_FROM_DIP(5));
190 
191  m_panelPF = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
192  m_notebook->AddPage(m_panelPF, _("Power flow"), false);
193 
194  wxBoxSizer* boxSizerLvl2_2 = new wxBoxSizer(wxVERTICAL);
195  m_panelPF->SetSizer(boxSizerLvl2_2);
196 
197  wxBoxSizer* boxSizerLvl3_3 = new wxBoxSizer(wxVERTICAL);
198 
199  boxSizerLvl2_2->Add(boxSizerLvl3_3, 0, wxEXPAND, WXC_FROM_DIP(5));
200 
201  m_staticTextPFMethod = new wxStaticText(m_panelPF, wxID_ANY, _("Solution method"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
202 
203  boxSizerLvl3_3->Add(m_staticTextPFMethod, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
204 
205  wxArrayString m_choicePFMethodArr;
206  m_choicePFMethodArr.Add(wxT("Gauss-Seidel"));
207  m_choicePFMethodArr.Add(wxT("Newton-Raphson"));
208  m_choicePFMethod = new wxChoice(m_panelPF, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), m_choicePFMethodArr, 0);
209  m_choicePFMethod->SetSelection(0);
210 
211  boxSizerLvl3_3->Add(m_choicePFMethod, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND, WXC_FROM_DIP(5));
212 
213  wxGridSizer* gridSizerLvl_3_4 = new wxGridSizer(0, 2, 0, 0);
214 
215  boxSizerLvl2_2->Add(gridSizerLvl_3_4, 0, wxEXPAND, WXC_FROM_DIP(5));
216 
217  wxBoxSizer* boxSizerLvl4_2 = new wxBoxSizer(wxVERTICAL);
218 
219  gridSizerLvl_3_4->Add(boxSizerLvl4_2, 0, wxEXPAND, WXC_FROM_DIP(5));
220 
221  m_staticTextAccFactor = new wxStaticText(m_panelPF, wxID_ANY, _("Acceleration factor"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
222 
223  boxSizerLvl4_2->Add(m_staticTextAccFactor, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
224 
225  m_textCtrlAccFactor = new wxTextCtrl(m_panelPF, wxID_ANY, wxT("1,0"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
226  #if wxVERSION_NUMBER >= 3000
227  m_textCtrlAccFactor->SetHint(wxT(""));
228  #endif
229 
230  boxSizerLvl4_2->Add(m_textCtrlAccFactor, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
231 
232  wxBoxSizer* boxSizerLvl4_3 = new wxBoxSizer(wxVERTICAL);
233 
234  gridSizerLvl_3_4->Add(boxSizerLvl4_3, 0, wxEXPAND, WXC_FROM_DIP(5));
235 
236  m_staticTextPFTolerance = new wxStaticText(m_panelPF, wxID_ANY, _("Tolerance"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
237 
238  boxSizerLvl4_3->Add(m_staticTextPFTolerance, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
239 
240  m_textCtrlPFTolerance = new wxTextCtrl(m_panelPF, wxID_ANY, wxT("1e-7"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
241  #if wxVERSION_NUMBER >= 3000
242  m_textCtrlPFTolerance->SetHint(wxT(""));
243  #endif
244 
245  boxSizerLvl4_3->Add(m_textCtrlPFTolerance, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
246 
247  wxBoxSizer* boxSizerLvl4_4 = new wxBoxSizer(wxVERTICAL);
248 
249  gridSizerLvl_3_4->Add(boxSizerLvl4_4, 0, wxEXPAND, WXC_FROM_DIP(5));
250 
251  m_staticTextPFMaxIterations = new wxStaticText(m_panelPF, wxID_ANY, _("Max. iterations"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
252 
253  boxSizerLvl4_4->Add(m_staticTextPFMaxIterations, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
254 
255  m_textCtrlPFMaxIterations = new wxTextCtrl(m_panelPF, wxID_ANY, wxT("5000"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
256  #if wxVERSION_NUMBER >= 3000
257  m_textCtrlPFMaxIterations->SetHint(wxT(""));
258  #endif
259 
260  boxSizerLvl4_4->Add(m_textCtrlPFMaxIterations, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
261 
262  m_panelStability = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
263  m_notebook->AddPage(m_panelStability, _("Stability"), false);
264 
265  wxBoxSizer* boxSizerLvl2_232 = new wxBoxSizer(wxVERTICAL);
266  m_panelStability->SetSizer(boxSizerLvl2_232);
267 
268  wxGridSizer* gridSizerLvl_2_3 = new wxGridSizer(0, 2, 0, 0);
269 
270  boxSizerLvl2_232->Add(gridSizerLvl_2_3, 0, wxEXPAND, WXC_FROM_DIP(5));
271 
272  wxBoxSizer* boxSizerLvl3_6 = new wxBoxSizer(wxVERTICAL);
273 
274  gridSizerLvl_2_3->Add(boxSizerLvl3_6, 0, wxEXPAND, WXC_FROM_DIP(5));
275 
276  m_staticTextTimeStep = new wxStaticText(m_panelStability, wxID_ANY, _("Time step"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
277 
278  boxSizerLvl3_6->Add(m_staticTextTimeStep, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
279 
280  wxBoxSizer* boxSizerLvl4_6 = new wxBoxSizer(wxHORIZONTAL);
281 
282  boxSizerLvl3_6->Add(boxSizerLvl4_6, 0, wxEXPAND, WXC_FROM_DIP(5));
283 
284  m_textCtrlTimeStep = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("0,01"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
285  #if wxVERSION_NUMBER >= 3000
286  m_textCtrlTimeStep->SetHint(wxT(""));
287  #endif
288 
289  boxSizerLvl4_6->Add(m_textCtrlTimeStep, 1, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
290 
291  m_staticTextSec_1 = new wxStaticText(m_panelStability, wxID_ANY, _("s"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
292 
293  boxSizerLvl4_6->Add(m_staticTextSec_1, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
294 
295  wxBoxSizer* boxSizerLvl3_7 = new wxBoxSizer(wxVERTICAL);
296 
297  gridSizerLvl_2_3->Add(boxSizerLvl3_7, 0, wxEXPAND, WXC_FROM_DIP(5));
298 
299  m_staticTextTSimTime = new wxStaticText(m_panelStability, wxID_ANY, _("Simulation time"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
300 
301  boxSizerLvl3_7->Add(m_staticTextTSimTime, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
302 
303  wxBoxSizer* boxSizerLvl4_7 = new wxBoxSizer(wxHORIZONTAL);
304 
305  boxSizerLvl3_7->Add(boxSizerLvl4_7, 0, wxEXPAND, WXC_FROM_DIP(5));
306 
307  m_textCtrlSimTime = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("10"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
308  #if wxVERSION_NUMBER >= 3000
309  m_textCtrlSimTime->SetHint(wxT(""));
310  #endif
311 
312  boxSizerLvl4_7->Add(m_textCtrlSimTime, 1, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
313 
314  m_staticTextSec_2 = new wxStaticText(m_panelStability, wxID_ANY, _("s"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
315 
316  boxSizerLvl4_7->Add(m_staticTextSec_2, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
317 
318  wxBoxSizer* boxSizerLvl3_5 = new wxBoxSizer(wxVERTICAL);
319 
320  gridSizerLvl_2_3->Add(boxSizerLvl3_5, 0, wxEXPAND, WXC_FROM_DIP(5));
321 
322  m_staticTextFreq = new wxStaticText(m_panelStability, wxID_ANY, _("System frequency"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
323 
324  boxSizerLvl3_5->Add(m_staticTextFreq, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
325 
326  wxBoxSizer* boxSizerLvl4_5 = new wxBoxSizer(wxHORIZONTAL);
327 
328  boxSizerLvl3_5->Add(boxSizerLvl4_5, 0, wxEXPAND, WXC_FROM_DIP(5));
329 
330  m_textCtrlFreq = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("60,0"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
331  #if wxVERSION_NUMBER >= 3000
332  m_textCtrlFreq->SetHint(wxT(""));
333  #endif
334 
335  boxSizerLvl4_5->Add(m_textCtrlFreq, 1, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
336 
337  m_staticTextFreqUnit = new wxStaticText(m_panelStability, wxID_ANY, _("Hz"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
338 
339  boxSizerLvl4_5->Add(m_staticTextFreqUnit, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
340 
341  wxBoxSizer* boxSizerLvl3_8 = new wxBoxSizer(wxVERTICAL);
342 
343  gridSizerLvl_2_3->Add(boxSizerLvl3_8, 0, wxEXPAND, WXC_FROM_DIP(5));
344 
345  m_staticTextTStabTolerance = new wxStaticText(m_panelStability, wxID_ANY, _("Tolerance"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
346 
347  boxSizerLvl3_8->Add(m_staticTextTStabTolerance, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
348 
349  m_textCtrlStabTolerance = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("1e-8"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
350  #if wxVERSION_NUMBER >= 3000
351  m_textCtrlStabTolerance->SetHint(wxT(""));
352  #endif
353 
354  boxSizerLvl3_8->Add(m_textCtrlStabTolerance, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
355 
356  wxBoxSizer* boxSizerLvl3_9 = new wxBoxSizer(wxVERTICAL);
357 
358  gridSizerLvl_2_3->Add(boxSizerLvl3_9, 0, wxEXPAND, WXC_FROM_DIP(5));
359 
360  m_staticTextTStabMaxIterations = new wxStaticText(m_panelStability, wxID_ANY, _("Max. Iterations"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
361 
362  boxSizerLvl3_9->Add(m_staticTextTStabMaxIterations, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
363 
364  m_textCtrlStabMaxIterations = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("100"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
365  #if wxVERSION_NUMBER >= 3000
366  m_textCtrlStabMaxIterations->SetHint(wxT(""));
367  #endif
368 
369  boxSizerLvl3_9->Add(m_textCtrlStabMaxIterations, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
370 
371  wxBoxSizer* boxSizerLvl3_10 = new wxBoxSizer(wxVERTICAL);
372 
373  gridSizerLvl_2_3->Add(boxSizerLvl3_10, 0, wxEXPAND, WXC_FROM_DIP(5));
374 
375  m_staticTextCtrlStepRation = new wxStaticText(m_panelStability, wxID_ANY, _("Controls step ratio"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
376 
377  boxSizerLvl3_10->Add(m_staticTextCtrlStepRation, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
378 
379  m_textCtrlCtrlStepRatio = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("10"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
380  #if wxVERSION_NUMBER >= 3000
381  m_textCtrlCtrlStepRatio->SetHint(wxT(""));
382  #endif
383 
384  boxSizerLvl3_10->Add(m_textCtrlCtrlStepRatio, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
385 
386  wxBoxSizer* boxSizerLvl3_11 = new wxBoxSizer(wxVERTICAL);
387 
388  gridSizerLvl_2_3->Add(boxSizerLvl3_11, 0, wxEXPAND, WXC_FROM_DIP(5));
389 
390  m_staticTextPrintTime = new wxStaticText(m_panelStability, wxID_ANY, _("Plot time"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
391 
392  boxSizerLvl3_11->Add(m_staticTextPrintTime, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
393 
394  wxBoxSizer* boxSizerLvl4_8 = new wxBoxSizer(wxHORIZONTAL);
395 
396  boxSizerLvl3_11->Add(boxSizerLvl4_8, 0, wxEXPAND, WXC_FROM_DIP(5));
397 
398  m_textCtrlPrintTime = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("0,01"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
399  #if wxVERSION_NUMBER >= 3000
400  m_textCtrlPrintTime->SetHint(wxT(""));
401  #endif
402 
403  boxSizerLvl4_8->Add(m_textCtrlPrintTime, 1, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
404 
405  m_staticTextSec_4 = new wxStaticText(m_panelStability, wxID_ANY, _("s"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
406 
407  boxSizerLvl4_8->Add(m_staticTextSec_4, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
408 
409  m_checkBoxUseCOI = new wxCheckBox(m_panelStability, wxID_ANY, _("Use center of inertia as reference"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
410  m_checkBoxUseCOI->SetValue(true);
411 
412  boxSizerLvl2_232->Add(m_checkBoxUseCOI, 0, wxALL, WXC_FROM_DIP(5));
413 
414  wxBoxSizer* boxSizer_bottonButtons = new wxBoxSizer(wxHORIZONTAL);
415 
416  boxSizer_lvl1_1->Add(boxSizer_bottonButtons, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
417 
418  boxSizer_bottonButtons->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5));
419 
420  m_buttonOK = new wxButton(this, wxID_ANY, _("OK"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
421 
422  boxSizer_bottonButtons->Add(m_buttonOK, 0, wxALL|wxALIGN_RIGHT, WXC_FROM_DIP(5));
423 
424  m_buttonCancel = new wxButton(this, wxID_ANY, _("Cancel"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
425 
426  boxSizer_bottonButtons->Add(m_buttonCancel, 0, wxALL|wxALIGN_RIGHT, WXC_FROM_DIP(5));
427 
428 
429  #if wxVERSION_NUMBER >= 2900
430  if(!wxPersistenceManager::Get().Find(m_notebook)){
431  wxPersistenceManager::Get().RegisterAndRestore(m_notebook);
432  } else {
433  wxPersistenceManager::Get().Restore(m_notebook);
434  }
435  #endif
436 
437  SetName(wxT("SimulationsSettingsFormBase"));
438  SetSize(-1,-1);
439  if (GetSizer()) {
440  GetSizer()->Fit(this);
441  }
442  if(GetParent()) {
443  CentreOnParent(wxBOTH);
444  } else {
445  CentreOnScreen(wxBOTH);
446  }
447 #if wxVERSION_NUMBER >= 2900
448  if(!wxPersistenceManager::Get().Find(this)) {
449  wxPersistenceManager::Get().RegisterAndRestore(this);
450  } else {
451  wxPersistenceManager::Get().Restore(this);
452  }
453 #endif
454  // Connect events
455  m_choicePFMethod->Connect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(SimulationsSettingsFormBase::OnPFMethodChoiceSelected), NULL, this);
456  m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SimulationsSettingsFormBase::OnButtonOKClick), NULL, this);
457  m_buttonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SimulationsSettingsFormBase::OnButtonCancelClick), NULL, this);
458 
459 }
460 
461 SimulationsSettingsFormBase::~SimulationsSettingsFormBase()
462 {
463  m_choicePFMethod->Disconnect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(SimulationsSettingsFormBase::OnPFMethodChoiceSelected), NULL, this);
464  m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SimulationsSettingsFormBase::OnButtonOKClick), NULL, this);
465  m_buttonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SimulationsSettingsFormBase::OnButtonCancelClick), NULL, this);
466 
467 }
468 
469 AboutFormBase::AboutFormBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
470  : wxDialog(parent, id, title, pos, size, style)
471 {
472  if ( !bBitmapLoaded ) {
473  // We need to initialise the default bitmap handler
474  wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
475  wxCDAD0InitBitmapResources();
476  bBitmapLoaded = true;
477  }
478 
479  wxBoxSizer* boxSizerMain = new wxBoxSizer(wxVERTICAL);
480  this->SetSizer(boxSizerMain);
481 
482  m_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxBK_DEFAULT);
483  m_notebook->SetName(wxT("m_notebook"));
484 
485  boxSizerMain->Add(m_notebook, 1, wxALL|wxEXPAND, WXC_FROM_DIP(5));
486 
487  m_panelLogo = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
488  m_notebook->AddPage(m_panelLogo, _("About"), false);
489 
490  wxBoxSizer* boxSizerLvl1_1 = new wxBoxSizer(wxVERTICAL);
491  m_panelLogo->SetSizer(boxSizerLvl1_1);
492 
493  m_staticBitmapLogo = new wxStaticBitmap(m_panelLogo, wxID_ANY, wxXmlResource::Get()->LoadBitmap(wxT("About2017")), wxDefaultPosition, wxDLG_UNIT(m_panelLogo, wxSize(-1,-1)), 0 );
494 
495  boxSizerLvl1_1->Add(m_staticBitmapLogo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, WXC_FROM_DIP(5));
496 
497  m_panelCredits = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
498  m_notebook->AddPage(m_panelCredits, _("Credits"), false);
499 
500  wxBoxSizer* boxSizerLvl1_2 = new wxBoxSizer(wxVERTICAL);
501  m_panelCredits->SetSizer(boxSizerLvl1_2);
502 
503  m_gridCredits = new wxGrid(m_panelCredits, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelCredits, wxSize(-1,-1)), wxWANTS_CHARS);
504  m_gridCredits->CreateGrid(0, 0);
505  m_gridCredits->SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE);
506  m_gridCredits->SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
507  #if wxVERSION_NUMBER >= 2904
508  m_gridCredits->UseNativeColHeader(true);
509  #endif
510  m_gridCredits->EnableEditing(false);
511 
512  boxSizerLvl1_2->Add(m_gridCredits, 1, wxEXPAND, WXC_FROM_DIP(5));
513 
514  m_panelLicense = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
515  m_notebook->AddPage(m_panelLicense, _("License"), false);
516 
517  wxBoxSizer* boxSizerLvl1_3 = new wxBoxSizer(wxVERTICAL);
518  m_panelLicense->SetSizer(boxSizerLvl1_3);
519 
520  m_richTextCtrlLicense = new wxRichTextCtrl(m_panelLicense, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(m_panelLicense, wxSize(-1,-1)), wxTE_MULTILINE|wxTE_PROCESS_TAB|wxTE_PROCESS_ENTER|wxWANTS_CHARS);
521 
522  boxSizerLvl1_3->Add(m_richTextCtrlLicense, 1, wxALL|wxEXPAND, WXC_FROM_DIP(5));
523 
524  wxFlexGridSizer* flexGridSizer247 = new wxFlexGridSizer(2, 2, 0, 0);
525  flexGridSizer247->SetFlexibleDirection( wxBOTH );
526  flexGridSizer247->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
527  flexGridSizer247->AddGrowableCol(1);
528 
529  boxSizerMain->Add(flexGridSizer247, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
530 
531  m_staticTextVersionLabel = new wxStaticText(this, wxID_ANY, _("Version:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
532 
533  flexGridSizer247->Add(m_staticTextVersionLabel, 0, wxALL, WXC_FROM_DIP(5));
534 
535  m_staticTextVersion = new wxStaticText(this, wxID_ANY, _("Alpha 2017w37a"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
536 
537  flexGridSizer247->Add(m_staticTextVersion, 0, wxALL, WXC_FROM_DIP(5));
538 
539  m_staticTextHome = new wxStaticText(this, wxID_ANY, _("Home page:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
540 
541  flexGridSizer247->Add(m_staticTextHome, 0, wxALL, WXC_FROM_DIP(5));
542 
543  m_hyperLinkPSP = new wxHyperlinkCtrl(this, wxID_ANY, _("https://thales1330.github.io/PSP/"), wxT("https://thales1330.github.io/PSP/"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxHL_DEFAULT_STYLE);
544  m_hyperLinkPSP->SetNormalColour(wxColour(wxT("#0000FF")));
545  m_hyperLinkPSP->SetHoverColour(wxColour(wxT("#0000FF")));
546  m_hyperLinkPSP->SetVisitedColour(wxColour(wxT("#FF0000")));
547 
548  flexGridSizer247->Add(m_hyperLinkPSP, 0, wxALL, WXC_FROM_DIP(5));
549 
550  m_buttonOK = new wxButton(this, wxID_ANY, _("OK"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
551 
552  boxSizerMain->Add(m_buttonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, WXC_FROM_DIP(5));
553 
554 
555  #if wxVERSION_NUMBER >= 2900
556  if(!wxPersistenceManager::Get().Find(m_notebook)){
557  wxPersistenceManager::Get().RegisterAndRestore(m_notebook);
558  } else {
559  wxPersistenceManager::Get().Restore(m_notebook);
560  }
561  #endif
562 
563  SetName(wxT("AboutFormBase"));
564  SetSize(-1,-1);
565  if (GetSizer()) {
566  GetSizer()->Fit(this);
567  }
568  if(GetParent()) {
569  CentreOnParent(wxBOTH);
570  } else {
571  CentreOnScreen(wxBOTH);
572  }
573 #if wxVERSION_NUMBER >= 2900
574  if(!wxPersistenceManager::Get().Find(this)) {
575  wxPersistenceManager::Get().RegisterAndRestore(this);
576  } else {
577  wxPersistenceManager::Get().Restore(this);
578  }
579 #endif
580  // Connect events
581  m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AboutFormBase::OnOKButtonClick), NULL, this);
582 
583 }
584 
585 AboutFormBase::~AboutFormBase()
586 {
587  m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AboutFormBase::OnOKButtonClick), NULL, this);
588 
589 }
+
1 // This file was auto-generated by codelite's wxCrafter Plugin
3 // wxCrafter project file: PropertiesForm.wxcp
4 // Do not modify this file by hand!
6 
7 #include "PropertiesForm.h"
8 
9 
10 // Declare the bitmap loading function
11 extern void wxCDAD0InitBitmapResources();
12 
13 static bool bBitmapLoaded = false;
14 
15 
16 GeneralPropertiesFormBase::GeneralPropertiesFormBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
17  : wxDialog(parent, id, title, pos, size, style)
18 {
19  if ( !bBitmapLoaded ) {
20  // We need to initialise the default bitmap handler
21  wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
22  wxCDAD0InitBitmapResources();
23  bBitmapLoaded = true;
24  }
25 
26  wxBoxSizer* boxSizer_lvl1_1 = new wxBoxSizer(wxVERTICAL);
27  this->SetSizer(boxSizer_lvl1_1);
28 
29  m_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxBK_DEFAULT);
30  m_notebook->SetName(wxT("m_notebook"));
31 
32  boxSizer_lvl1_1->Add(m_notebook, 1, wxALL|wxEXPAND, WXC_FROM_DIP(5));
33 
34  m_panelGeneral = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
35  m_notebook->AddPage(m_panelGeneral, _("General"), false);
36 
37  wxBoxSizer* boxSizerLvl2_1 = new wxBoxSizer(wxVERTICAL);
38  m_panelGeneral->SetSizer(boxSizerLvl2_1);
39 
40  wxBoxSizer* boxSizerLvl3_1 = new wxBoxSizer(wxVERTICAL);
41 
42  boxSizerLvl2_1->Add(boxSizerLvl3_1, 0, wxEXPAND, WXC_FROM_DIP(5));
43 
44  m_staticTextLanguage = new wxStaticText(m_panelGeneral, wxID_ANY, _("Language"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0);
45 
46  boxSizerLvl3_1->Add(m_staticTextLanguage, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
47 
48  wxArrayString m_choiceLanguageArr;
49  m_choiceLanguageArr.Add(wxT("English"));
50  m_choiceLanguageArr.Add(wxT("Portuguese"));
51  m_choiceLanguage = new wxChoice(m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), m_choiceLanguageArr, 0);
52  m_choiceLanguage->SetSelection(0);
53 
54  boxSizerLvl3_1->Add(m_choiceLanguage, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND, WXC_FROM_DIP(5));
55 
56  wxBoxSizer* boxSizerLvl3_2 = new wxBoxSizer(wxVERTICAL);
57 
58  boxSizerLvl2_1->Add(boxSizerLvl3_2, 0, wxEXPAND, WXC_FROM_DIP(5));
59 
60  m_staticTextTheme = new wxStaticText(m_panelGeneral, wxID_ANY, _("Theme"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0);
61 
62  boxSizerLvl3_2->Add(m_staticTextTheme, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
63 
64  wxArrayString m_choiceThemeArr;
65  m_choiceThemeArr.Add(wxT("Light"));
66  m_choiceThemeArr.Add(wxT("Dark"));
67  m_choiceTheme = new wxChoice(m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), m_choiceThemeArr, 0);
68  m_choiceTheme->SetSelection(0);
69 
70  boxSizerLvl3_2->Add(m_choiceTheme, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND, WXC_FROM_DIP(5));
71 
72  wxBoxSizer* boxSizer_bottonButtons = new wxBoxSizer(wxHORIZONTAL);
73 
74  boxSizer_lvl1_1->Add(boxSizer_bottonButtons, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
75 
76  boxSizer_bottonButtons->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5));
77 
78  m_buttonOK = new wxButton(this, wxID_ANY, _("OK"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
79 
80  boxSizer_bottonButtons->Add(m_buttonOK, 0, wxALL|wxALIGN_RIGHT, WXC_FROM_DIP(5));
81 
82  m_buttonCancel = new wxButton(this, wxID_ANY, _("Cancel"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
83 
84  boxSizer_bottonButtons->Add(m_buttonCancel, 0, wxALL|wxALIGN_RIGHT, WXC_FROM_DIP(5));
85 
86 
87  #if wxVERSION_NUMBER >= 2900
88  if(!wxPersistenceManager::Get().Find(m_notebook)){
89  wxPersistenceManager::Get().RegisterAndRestore(m_notebook);
90  } else {
91  wxPersistenceManager::Get().Restore(m_notebook);
92  }
93  #endif
94 
95  SetName(wxT("GeneralPropertiesFormBase"));
96  SetSize(-1,-1);
97  if (GetSizer()) {
98  GetSizer()->Fit(this);
99  }
100  if(GetParent()) {
101  CentreOnParent(wxBOTH);
102  } else {
103  CentreOnScreen(wxBOTH);
104  }
105 #if wxVERSION_NUMBER >= 2900
106  if(!wxPersistenceManager::Get().Find(this)) {
107  wxPersistenceManager::Get().RegisterAndRestore(this);
108  } else {
109  wxPersistenceManager::Get().Restore(this);
110  }
111 #endif
112  // Connect events
113  m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(GeneralPropertiesFormBase::OnButtonOKClick), NULL, this);
114  m_buttonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(GeneralPropertiesFormBase::OnButtonCancelClick), NULL, this);
115 
116 }
117 
118 GeneralPropertiesFormBase::~GeneralPropertiesFormBase()
119 {
120  m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(GeneralPropertiesFormBase::OnButtonOKClick), NULL, this);
121  m_buttonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(GeneralPropertiesFormBase::OnButtonCancelClick), NULL, this);
122 
123 }
124 
125 SimulationsSettingsFormBase::SimulationsSettingsFormBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
126  : wxDialog(parent, id, title, pos, size, style)
127 {
128  if ( !bBitmapLoaded ) {
129  // We need to initialise the default bitmap handler
130  wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
131  wxCDAD0InitBitmapResources();
132  bBitmapLoaded = true;
133  }
134 
135  wxBoxSizer* boxSizer_lvl1_1 = new wxBoxSizer(wxVERTICAL);
136  this->SetSizer(boxSizer_lvl1_1);
137 
138  m_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxBK_DEFAULT);
139  m_notebook->SetName(wxT("m_notebook"));
140 
141  boxSizer_lvl1_1->Add(m_notebook, 1, wxALL|wxEXPAND, WXC_FROM_DIP(5));
142 
143  m_panelGeneral = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
144  m_notebook->AddPage(m_panelGeneral, _("General"), false);
145 
146  wxBoxSizer* boxSizerLvl2_1 = new wxBoxSizer(wxVERTICAL);
147  m_panelGeneral->SetSizer(boxSizerLvl2_1);
148 
149  wxBoxSizer* boxSizerLvl3_1 = new wxBoxSizer(wxVERTICAL);
150 
151  boxSizerLvl2_1->Add(boxSizerLvl3_1, 0, wxEXPAND, WXC_FROM_DIP(5));
152 
153  m_staticTextBasePower = new wxStaticText(m_panelGeneral, wxID_ANY, _("Base power"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0);
154 
155  boxSizerLvl3_1->Add(m_staticTextBasePower, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
156 
157  wxBoxSizer* boxSizerLvl4_1 = new wxBoxSizer(wxHORIZONTAL);
158 
159  boxSizerLvl3_1->Add(boxSizerLvl4_1, 0, wxEXPAND, WXC_FROM_DIP(5));
160 
161  m_textCtrlbasePower = new wxTextCtrl(m_panelGeneral, wxID_ANY, wxT("100,0"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0);
162  #if wxVERSION_NUMBER >= 3000
163  m_textCtrlbasePower->SetHint(wxT(""));
164  #endif
165 
166  boxSizerLvl4_1->Add(m_textCtrlbasePower, 1, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
167 
168  wxArrayString m_choiceBasePowerArr;
169  m_choiceBasePowerArr.Add(wxT("VA"));
170  m_choiceBasePowerArr.Add(wxT("kVA"));
171  m_choiceBasePowerArr.Add(wxT("MVA"));
172  m_choiceBasePower = new wxChoice(m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), m_choiceBasePowerArr, 0);
173  m_choiceBasePower->SetSelection(2);
174 
175  boxSizerLvl4_1->Add(m_choiceBasePower, 0, wxLEFT|wxRIGHT|wxBOTTOM, WXC_FROM_DIP(5));
176 
177  wxStaticBoxSizer* staticBoxSizerLvl3_2 = new wxStaticBoxSizer( new wxStaticBox(m_panelGeneral, wxID_ANY, _("Continuous calculation")), wxVERTICAL);
178 
179  boxSizerLvl2_1->Add(staticBoxSizerLvl3_2, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
180 
181  m_checkBoxFaultAfterPF = new wxCheckBox(m_panelGeneral, wxID_ANY, _("Calculate fault after power flow"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0);
182  m_checkBoxFaultAfterPF->SetValue(true);
183 
184  staticBoxSizerLvl3_2->Add(m_checkBoxFaultAfterPF, 0, wxALL, WXC_FROM_DIP(5));
185 
186  m_checkBoxSCPowerAfterPF = new wxCheckBox(m_panelGeneral, wxID_ANY, _("Calculate short-circuit power after power flow"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0);
187  m_checkBoxSCPowerAfterPF->SetValue(true);
188 
189  staticBoxSizerLvl3_2->Add(m_checkBoxSCPowerAfterPF, 0, wxALL, WXC_FROM_DIP(5));
190 
191  m_panelPF = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
192  m_notebook->AddPage(m_panelPF, _("Power flow"), false);
193 
194  wxBoxSizer* boxSizerLvl2_2 = new wxBoxSizer(wxVERTICAL);
195  m_panelPF->SetSizer(boxSizerLvl2_2);
196 
197  wxBoxSizer* boxSizerLvl3_3 = new wxBoxSizer(wxVERTICAL);
198 
199  boxSizerLvl2_2->Add(boxSizerLvl3_3, 0, wxEXPAND, WXC_FROM_DIP(5));
200 
201  m_staticTextPFMethod = new wxStaticText(m_panelPF, wxID_ANY, _("Solution method"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
202 
203  boxSizerLvl3_3->Add(m_staticTextPFMethod, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
204 
205  wxArrayString m_choicePFMethodArr;
206  m_choicePFMethodArr.Add(wxT("Gauss-Seidel"));
207  m_choicePFMethodArr.Add(wxT("Newton-Raphson"));
208  m_choicePFMethod = new wxChoice(m_panelPF, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), m_choicePFMethodArr, 0);
209  m_choicePFMethod->SetSelection(0);
210 
211  boxSizerLvl3_3->Add(m_choicePFMethod, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND, WXC_FROM_DIP(5));
212 
213  wxGridSizer* gridSizerLvl_3_4 = new wxGridSizer(0, 2, 0, 0);
214 
215  boxSizerLvl2_2->Add(gridSizerLvl_3_4, 0, wxEXPAND, WXC_FROM_DIP(5));
216 
217  wxBoxSizer* boxSizerLvl4_2 = new wxBoxSizer(wxVERTICAL);
218 
219  gridSizerLvl_3_4->Add(boxSizerLvl4_2, 0, wxEXPAND, WXC_FROM_DIP(5));
220 
221  m_staticTextAccFactor = new wxStaticText(m_panelPF, wxID_ANY, _("Acceleration factor"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
222 
223  boxSizerLvl4_2->Add(m_staticTextAccFactor, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
224 
225  m_textCtrlAccFactor = new wxTextCtrl(m_panelPF, wxID_ANY, wxT("1,0"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
226  #if wxVERSION_NUMBER >= 3000
227  m_textCtrlAccFactor->SetHint(wxT(""));
228  #endif
229 
230  boxSizerLvl4_2->Add(m_textCtrlAccFactor, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
231 
232  wxBoxSizer* boxSizerLvl4_3 = new wxBoxSizer(wxVERTICAL);
233 
234  gridSizerLvl_3_4->Add(boxSizerLvl4_3, 0, wxEXPAND, WXC_FROM_DIP(5));
235 
236  m_staticTextPFTolerance = new wxStaticText(m_panelPF, wxID_ANY, _("Tolerance"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
237 
238  boxSizerLvl4_3->Add(m_staticTextPFTolerance, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
239 
240  m_textCtrlPFTolerance = new wxTextCtrl(m_panelPF, wxID_ANY, wxT("1e-7"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
241  #if wxVERSION_NUMBER >= 3000
242  m_textCtrlPFTolerance->SetHint(wxT(""));
243  #endif
244 
245  boxSizerLvl4_3->Add(m_textCtrlPFTolerance, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
246 
247  wxBoxSizer* boxSizerLvl4_4 = new wxBoxSizer(wxVERTICAL);
248 
249  gridSizerLvl_3_4->Add(boxSizerLvl4_4, 0, wxEXPAND, WXC_FROM_DIP(5));
250 
251  m_staticTextPFMaxIterations = new wxStaticText(m_panelPF, wxID_ANY, _("Max. iterations"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
252 
253  boxSizerLvl4_4->Add(m_staticTextPFMaxIterations, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
254 
255  m_textCtrlPFMaxIterations = new wxTextCtrl(m_panelPF, wxID_ANY, wxT("5000"), wxDefaultPosition, wxDLG_UNIT(m_panelPF, wxSize(-1,-1)), 0);
256  #if wxVERSION_NUMBER >= 3000
257  m_textCtrlPFMaxIterations->SetHint(wxT(""));
258  #endif
259 
260  boxSizerLvl4_4->Add(m_textCtrlPFMaxIterations, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
261 
262  m_panelStability = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
263  m_notebook->AddPage(m_panelStability, _("Stability"), false);
264 
265  wxBoxSizer* boxSizerLvl2_232 = new wxBoxSizer(wxVERTICAL);
266  m_panelStability->SetSizer(boxSizerLvl2_232);
267 
268  wxGridSizer* gridSizerLvl_2_3 = new wxGridSizer(0, 2, 0, 0);
269 
270  boxSizerLvl2_232->Add(gridSizerLvl_2_3, 0, wxEXPAND, WXC_FROM_DIP(5));
271 
272  wxBoxSizer* boxSizerLvl3_6 = new wxBoxSizer(wxVERTICAL);
273 
274  gridSizerLvl_2_3->Add(boxSizerLvl3_6, 0, wxEXPAND, WXC_FROM_DIP(5));
275 
276  m_staticTextTimeStep = new wxStaticText(m_panelStability, wxID_ANY, _("Time step"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
277 
278  boxSizerLvl3_6->Add(m_staticTextTimeStep, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
279 
280  wxBoxSizer* boxSizerLvl4_6 = new wxBoxSizer(wxHORIZONTAL);
281 
282  boxSizerLvl3_6->Add(boxSizerLvl4_6, 0, wxEXPAND, WXC_FROM_DIP(5));
283 
284  m_textCtrlTimeStep = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("0,01"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
285  #if wxVERSION_NUMBER >= 3000
286  m_textCtrlTimeStep->SetHint(wxT(""));
287  #endif
288 
289  boxSizerLvl4_6->Add(m_textCtrlTimeStep, 1, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
290 
291  m_staticTextSec_1 = new wxStaticText(m_panelStability, wxID_ANY, _("s"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
292 
293  boxSizerLvl4_6->Add(m_staticTextSec_1, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
294 
295  wxBoxSizer* boxSizerLvl3_7 = new wxBoxSizer(wxVERTICAL);
296 
297  gridSizerLvl_2_3->Add(boxSizerLvl3_7, 0, wxEXPAND, WXC_FROM_DIP(5));
298 
299  m_staticTextTSimTime = new wxStaticText(m_panelStability, wxID_ANY, _("Simulation time"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
300 
301  boxSizerLvl3_7->Add(m_staticTextTSimTime, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
302 
303  wxBoxSizer* boxSizerLvl4_7 = new wxBoxSizer(wxHORIZONTAL);
304 
305  boxSizerLvl3_7->Add(boxSizerLvl4_7, 0, wxEXPAND, WXC_FROM_DIP(5));
306 
307  m_textCtrlSimTime = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("10"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
308  #if wxVERSION_NUMBER >= 3000
309  m_textCtrlSimTime->SetHint(wxT(""));
310  #endif
311 
312  boxSizerLvl4_7->Add(m_textCtrlSimTime, 1, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
313 
314  m_staticTextSec_2 = new wxStaticText(m_panelStability, wxID_ANY, _("s"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
315 
316  boxSizerLvl4_7->Add(m_staticTextSec_2, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
317 
318  wxBoxSizer* boxSizerLvl3_5 = new wxBoxSizer(wxVERTICAL);
319 
320  gridSizerLvl_2_3->Add(boxSizerLvl3_5, 0, wxEXPAND, WXC_FROM_DIP(5));
321 
322  m_staticTextFreq = new wxStaticText(m_panelStability, wxID_ANY, _("System frequency"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
323 
324  boxSizerLvl3_5->Add(m_staticTextFreq, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
325 
326  wxBoxSizer* boxSizerLvl4_5 = new wxBoxSizer(wxHORIZONTAL);
327 
328  boxSizerLvl3_5->Add(boxSizerLvl4_5, 0, wxEXPAND, WXC_FROM_DIP(5));
329 
330  m_textCtrlFreq = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("60,0"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
331  #if wxVERSION_NUMBER >= 3000
332  m_textCtrlFreq->SetHint(wxT(""));
333  #endif
334 
335  boxSizerLvl4_5->Add(m_textCtrlFreq, 1, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
336 
337  m_staticTextFreqUnit = new wxStaticText(m_panelStability, wxID_ANY, _("Hz"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
338 
339  boxSizerLvl4_5->Add(m_staticTextFreqUnit, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
340 
341  wxBoxSizer* boxSizerLvl3_8 = new wxBoxSizer(wxVERTICAL);
342 
343  gridSizerLvl_2_3->Add(boxSizerLvl3_8, 0, wxEXPAND, WXC_FROM_DIP(5));
344 
345  m_staticTextTStabTolerance = new wxStaticText(m_panelStability, wxID_ANY, _("Tolerance"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
346 
347  boxSizerLvl3_8->Add(m_staticTextTStabTolerance, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
348 
349  m_textCtrlStabTolerance = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("1e-8"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
350  #if wxVERSION_NUMBER >= 3000
351  m_textCtrlStabTolerance->SetHint(wxT(""));
352  #endif
353 
354  boxSizerLvl3_8->Add(m_textCtrlStabTolerance, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
355 
356  wxBoxSizer* boxSizerLvl3_9 = new wxBoxSizer(wxVERTICAL);
357 
358  gridSizerLvl_2_3->Add(boxSizerLvl3_9, 0, wxEXPAND, WXC_FROM_DIP(5));
359 
360  m_staticTextTStabMaxIterations = new wxStaticText(m_panelStability, wxID_ANY, _("Max. Iterations"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
361 
362  boxSizerLvl3_9->Add(m_staticTextTStabMaxIterations, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
363 
364  m_textCtrlStabMaxIterations = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("100"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
365  #if wxVERSION_NUMBER >= 3000
366  m_textCtrlStabMaxIterations->SetHint(wxT(""));
367  #endif
368 
369  boxSizerLvl3_9->Add(m_textCtrlStabMaxIterations, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
370 
371  wxBoxSizer* boxSizerLvl3_10 = new wxBoxSizer(wxVERTICAL);
372 
373  gridSizerLvl_2_3->Add(boxSizerLvl3_10, 0, wxEXPAND, WXC_FROM_DIP(5));
374 
375  m_staticTextCtrlStepRation = new wxStaticText(m_panelStability, wxID_ANY, _("Controls step ratio"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
376 
377  boxSizerLvl3_10->Add(m_staticTextCtrlStepRation, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
378 
379  m_textCtrlCtrlStepRatio = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("10"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
380  #if wxVERSION_NUMBER >= 3000
381  m_textCtrlCtrlStepRatio->SetHint(wxT(""));
382  #endif
383 
384  boxSizerLvl3_10->Add(m_textCtrlCtrlStepRatio, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
385 
386  wxBoxSizer* boxSizerLvl3_11 = new wxBoxSizer(wxVERTICAL);
387 
388  gridSizerLvl_2_3->Add(boxSizerLvl3_11, 0, wxEXPAND, WXC_FROM_DIP(5));
389 
390  m_staticTextPrintTime = new wxStaticText(m_panelStability, wxID_ANY, _("Plot time"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
391 
392  boxSizerLvl3_11->Add(m_staticTextPrintTime, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
393 
394  wxBoxSizer* boxSizerLvl4_8 = new wxBoxSizer(wxHORIZONTAL);
395 
396  boxSizerLvl3_11->Add(boxSizerLvl4_8, 0, wxEXPAND, WXC_FROM_DIP(5));
397 
398  m_textCtrlPrintTime = new wxTextCtrl(m_panelStability, wxID_ANY, wxT("0,01"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
399  #if wxVERSION_NUMBER >= 3000
400  m_textCtrlPrintTime->SetHint(wxT(""));
401  #endif
402 
403  boxSizerLvl4_8->Add(m_textCtrlPrintTime, 1, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
404 
405  m_staticTextSec_4 = new wxStaticText(m_panelStability, wxID_ANY, _("s"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
406 
407  boxSizerLvl4_8->Add(m_staticTextSec_4, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
408 
409  m_checkBoxUseCOI = new wxCheckBox(m_panelStability, wxID_ANY, _("Use center of inertia as reference"), wxDefaultPosition, wxDLG_UNIT(m_panelStability, wxSize(-1,-1)), 0);
410  m_checkBoxUseCOI->SetValue(true);
411 
412  boxSizerLvl2_232->Add(m_checkBoxUseCOI, 0, wxALL, WXC_FROM_DIP(5));
413 
414  wxBoxSizer* boxSizer_bottonButtons = new wxBoxSizer(wxHORIZONTAL);
415 
416  boxSizer_lvl1_1->Add(boxSizer_bottonButtons, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
417 
418  boxSizer_bottonButtons->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5));
419 
420  m_buttonOK = new wxButton(this, wxID_ANY, _("OK"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
421 
422  boxSizer_bottonButtons->Add(m_buttonOK, 0, wxALL|wxALIGN_RIGHT, WXC_FROM_DIP(5));
423 
424  m_buttonCancel = new wxButton(this, wxID_ANY, _("Cancel"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
425 
426  boxSizer_bottonButtons->Add(m_buttonCancel, 0, wxALL|wxALIGN_RIGHT, WXC_FROM_DIP(5));
427 
428 
429  #if wxVERSION_NUMBER >= 2900
430  if(!wxPersistenceManager::Get().Find(m_notebook)){
431  wxPersistenceManager::Get().RegisterAndRestore(m_notebook);
432  } else {
433  wxPersistenceManager::Get().Restore(m_notebook);
434  }
435  #endif
436 
437  SetName(wxT("SimulationsSettingsFormBase"));
438  SetSize(-1,-1);
439  if (GetSizer()) {
440  GetSizer()->Fit(this);
441  }
442  if(GetParent()) {
443  CentreOnParent(wxBOTH);
444  } else {
445  CentreOnScreen(wxBOTH);
446  }
447 #if wxVERSION_NUMBER >= 2900
448  if(!wxPersistenceManager::Get().Find(this)) {
449  wxPersistenceManager::Get().RegisterAndRestore(this);
450  } else {
451  wxPersistenceManager::Get().Restore(this);
452  }
453 #endif
454  // Connect events
455  m_choicePFMethod->Connect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(SimulationsSettingsFormBase::OnPFMethodChoiceSelected), NULL, this);
456  m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SimulationsSettingsFormBase::OnButtonOKClick), NULL, this);
457  m_buttonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SimulationsSettingsFormBase::OnButtonCancelClick), NULL, this);
458 
459 }
460 
461 SimulationsSettingsFormBase::~SimulationsSettingsFormBase()
462 {
463  m_choicePFMethod->Disconnect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(SimulationsSettingsFormBase::OnPFMethodChoiceSelected), NULL, this);
464  m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SimulationsSettingsFormBase::OnButtonOKClick), NULL, this);
465  m_buttonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SimulationsSettingsFormBase::OnButtonCancelClick), NULL, this);
466 
467 }
468 
469 AboutFormBase::AboutFormBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
470  : wxDialog(parent, id, title, pos, size, style)
471 {
472  if ( !bBitmapLoaded ) {
473  // We need to initialise the default bitmap handler
474  wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
475  wxCDAD0InitBitmapResources();
476  bBitmapLoaded = true;
477  }
478 
479  wxBoxSizer* boxSizerMain = new wxBoxSizer(wxVERTICAL);
480  this->SetSizer(boxSizerMain);
481 
482  m_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxBK_DEFAULT);
483  m_notebook->SetName(wxT("m_notebook"));
484 
485  boxSizerMain->Add(m_notebook, 1, wxALL|wxEXPAND, WXC_FROM_DIP(5));
486 
487  m_panelLogo = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
488  m_notebook->AddPage(m_panelLogo, _("About"), false);
489 
490  wxBoxSizer* boxSizerLvl1_1 = new wxBoxSizer(wxVERTICAL);
491  m_panelLogo->SetSizer(boxSizerLvl1_1);
492 
493  m_staticBitmapLogo = new wxStaticBitmap(m_panelLogo, wxID_ANY, wxXmlResource::Get()->LoadBitmap(wxT("About2017")), wxDefaultPosition, wxDLG_UNIT(m_panelLogo, wxSize(-1,-1)), 0 );
494 
495  boxSizerLvl1_1->Add(m_staticBitmapLogo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, WXC_FROM_DIP(5));
496 
497  m_panelCredits = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
498  m_notebook->AddPage(m_panelCredits, _("Credits"), false);
499 
500  wxBoxSizer* boxSizerLvl1_2 = new wxBoxSizer(wxVERTICAL);
501  m_panelCredits->SetSizer(boxSizerLvl1_2);
502 
503  m_gridCredits = new wxGrid(m_panelCredits, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelCredits, wxSize(-1,-1)), wxWANTS_CHARS);
504  m_gridCredits->CreateGrid(0, 0);
505  m_gridCredits->SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE);
506  m_gridCredits->SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
507  #if wxVERSION_NUMBER >= 2904
508  m_gridCredits->UseNativeColHeader(true);
509  #endif
510  m_gridCredits->EnableEditing(false);
511 
512  boxSizerLvl1_2->Add(m_gridCredits, 1, wxEXPAND, WXC_FROM_DIP(5));
513 
514  m_panelLicense = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL);
515  m_notebook->AddPage(m_panelLicense, _("License"), false);
516 
517  wxBoxSizer* boxSizerLvl1_3 = new wxBoxSizer(wxVERTICAL);
518  m_panelLicense->SetSizer(boxSizerLvl1_3);
519 
520  m_richTextCtrlLicense = new wxRichTextCtrl(m_panelLicense, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(m_panelLicense, wxSize(-1,-1)), wxTE_MULTILINE|wxTE_PROCESS_TAB|wxTE_PROCESS_ENTER|wxWANTS_CHARS);
521 
522  boxSizerLvl1_3->Add(m_richTextCtrlLicense, 1, wxALL|wxEXPAND, WXC_FROM_DIP(5));
523 
524  wxFlexGridSizer* flexGridSizer247 = new wxFlexGridSizer(2, 2, 0, 0);
525  flexGridSizer247->SetFlexibleDirection( wxBOTH );
526  flexGridSizer247->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
527  flexGridSizer247->AddGrowableCol(1);
528 
529  boxSizerMain->Add(flexGridSizer247, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
530 
531  m_staticTextVersionLabel = new wxStaticText(this, wxID_ANY, _("Version:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
532 
533  flexGridSizer247->Add(m_staticTextVersionLabel, 0, wxALL, WXC_FROM_DIP(5));
534 
535  m_staticTextVersion = new wxStaticText(this, wxID_ANY, _("Alpha 2017w38b"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
536 
537  flexGridSizer247->Add(m_staticTextVersion, 0, wxALL, WXC_FROM_DIP(5));
538 
539  m_staticTextHome = new wxStaticText(this, wxID_ANY, _("Home page:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
540 
541  flexGridSizer247->Add(m_staticTextHome, 0, wxALL, WXC_FROM_DIP(5));
542 
543  m_hyperLinkPSP = new wxHyperlinkCtrl(this, wxID_ANY, _("https://thales1330.github.io/PSP/"), wxT("https://thales1330.github.io/PSP/"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxHL_DEFAULT_STYLE);
544  m_hyperLinkPSP->SetNormalColour(wxColour(wxT("#0000FF")));
545  m_hyperLinkPSP->SetHoverColour(wxColour(wxT("#0000FF")));
546  m_hyperLinkPSP->SetVisitedColour(wxColour(wxT("#FF0000")));
547 
548  flexGridSizer247->Add(m_hyperLinkPSP, 0, wxALL, WXC_FROM_DIP(5));
549 
550  m_buttonOK = new wxButton(this, wxID_ANY, _("OK"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
551 
552  boxSizerMain->Add(m_buttonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, WXC_FROM_DIP(5));
553 
554 
555  #if wxVERSION_NUMBER >= 2900
556  if(!wxPersistenceManager::Get().Find(m_notebook)){
557  wxPersistenceManager::Get().RegisterAndRestore(m_notebook);
558  } else {
559  wxPersistenceManager::Get().Restore(m_notebook);
560  }
561  #endif
562 
563  SetName(wxT("AboutFormBase"));
564  SetSize(-1,-1);
565  if (GetSizer()) {
566  GetSizer()->Fit(this);
567  }
568  if(GetParent()) {
569  CentreOnParent(wxBOTH);
570  } else {
571  CentreOnScreen(wxBOTH);
572  }
573 #if wxVERSION_NUMBER >= 2900
574  if(!wxPersistenceManager::Get().Find(this)) {
575  wxPersistenceManager::Get().RegisterAndRestore(this);
576  } else {
577  wxPersistenceManager::Get().Restore(this);
578  }
579 #endif
580  // Connect events
581  m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AboutFormBase::OnOKButtonClick), NULL, this);
582 
583 }
584 
585 AboutFormBase::~AboutFormBase()
586 {
587  m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AboutFormBase::OnOKButtonClick), NULL, this);
588 
589 }
-
1 #include "RateLimiter.h"
2 #include "RateLimiterForm.h"
3 
4 RateLimiter::RateLimiter(int id) : ControlElement(id)
5 {
6  m_width = m_height = 36.0;
7  Node* nodeIn = new Node(m_position + wxPoint2DDouble(-18, 0), Node::NODE_IN, m_borderSize);
8  nodeIn->StartMove(m_position);
9  Node* nodeOut = new Node(m_position + wxPoint2DDouble(18, 0), Node::NODE_OUT, m_borderSize);
10  nodeOut->SetAngle(180.0);
11  nodeOut->StartMove(m_position);
12  m_nodeList.push_back(nodeIn);
13  m_nodeList.push_back(nodeOut);
14 }
15 
16 RateLimiter::~RateLimiter() {}
17 void RateLimiter::Draw(wxPoint2DDouble translation, double scale) const
18 {
19  glLineWidth(1.0);
20  if(m_selected) {
21  glColor4dv(m_selectionColour.GetRGBA());
22  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
23  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
24  }
25  glColor4d(1.0, 1.0, 1.0, 1.0);
26  DrawRectangle(m_position, m_width, m_height);
27  glColor4d(0.0, 0.0, 0.0, 1.0);
28  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
29 
30  // Plot symbol.
31  std::vector<wxPoint2DDouble> axis;
32  axis.push_back(m_position + wxPoint2DDouble(-13, 0));
33  axis.push_back(m_position + wxPoint2DDouble(13, 0));
34  axis.push_back(m_position + wxPoint2DDouble(0, -13));
35  axis.push_back(m_position + wxPoint2DDouble(0, 13));
36  DrawLine(axis, GL_LINES);
37 
38  glLineWidth(2.0);
39  std::vector<wxPoint2DDouble> limSymbol;
40  limSymbol.push_back(m_position + wxPoint2DDouble(10, -10));
41  limSymbol.push_back(m_position + wxPoint2DDouble(-10, 10));
42  glColor4d(0.0, 0.3, 1.0, 1.0);
43  DrawLine(limSymbol);
44 
45  glColor4d(0.0, 0.0, 0.0, 1.0);
46  DrawNodes();
47 }
48 
49 bool RateLimiter::ShowForm(wxWindow* parent, Element* element)
50 {
51  RateLimiterForm* form = new RateLimiterForm(parent, this);
52  if(form->ShowModal() == wxID_OK) {
53  form->Destroy();
54  return true;
55  }
56  form->Destroy();
57  return false;
58 }
59 
60 void RateLimiter::Rotate(bool clockwise)
61 {
62  if(clockwise)
63  m_angle += 90.0;
64  else
65  m_angle -= 90.0;
66  if(m_angle >= 360.0)
67  m_angle = 0.0;
68  else if(m_angle < 0)
69  m_angle = 270.0;
70 
71  UpdatePoints();
72 
73  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
74  Node* node = *it;
75  node->Rotate(clockwise);
76  }
77 }
78 
79 void RateLimiter::UpdatePoints()
80 {
81  if(m_angle == 0.0) {
82  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
83  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(18, 0));
84  } else if(m_angle == 90.0) {
85  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -18));
86  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, 18));
87  } else if(m_angle == 180.0) {
88  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(18, 0));
89  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
90  } else if(m_angle == 270.0) {
91  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, 18));
92  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -18));
93  }
94 }
95 
96 bool RateLimiter::Solve(double input, double timeStep)
97 {
98  double rate = (input - m_output) / timeStep;
99 
100  bool reachLimit = false;
101  if(rate > m_upLimit) {
102  rate = m_upLimit;
103  reachLimit = true;
104  } else if(rate < m_lowLimit) {
105  rate = m_lowLimit;
106  reachLimit = true;
107  }
108 
109  if(reachLimit)
110  m_output += rate * timeStep;
111  else
112  m_output = input;
113  return true;
114 }
115 
117 {
118  RateLimiter* copy = new RateLimiter(m_elementID);
119  *copy = *this;
120  return copy;
121 }
- -
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: RateLimiter.cpp:49
- -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: RateLimiter.cpp:60
- -
virtual Element * GetCopy()
Get a the element copy.
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: RateLimiter.cpp:17
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "RateLimiter.h"
19 #include "RateLimiterForm.h"
20 
21 RateLimiter::RateLimiter(int id) : ControlElement(id)
22 {
23  m_width = m_height = 36.0;
24  Node* nodeIn = new Node(m_position + wxPoint2DDouble(-18, 0), Node::NODE_IN, m_borderSize);
25  nodeIn->StartMove(m_position);
26  Node* nodeOut = new Node(m_position + wxPoint2DDouble(18, 0), Node::NODE_OUT, m_borderSize);
27  nodeOut->SetAngle(180.0);
28  nodeOut->StartMove(m_position);
29  m_nodeList.push_back(nodeIn);
30  m_nodeList.push_back(nodeOut);
31 }
32 
33 RateLimiter::~RateLimiter() {}
34 void RateLimiter::Draw(wxPoint2DDouble translation, double scale) const
35 {
36  glLineWidth(1.0);
37  if(m_selected) {
38  glColor4dv(m_selectionColour.GetRGBA());
39  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
40  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
41  }
42  glColor4d(1.0, 1.0, 1.0, 1.0);
43  DrawRectangle(m_position, m_width, m_height);
44  glColor4d(0.0, 0.0, 0.0, 1.0);
45  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
46 
47  // Plot symbol.
48  std::vector<wxPoint2DDouble> axis;
49  axis.push_back(m_position + wxPoint2DDouble(-13, 0));
50  axis.push_back(m_position + wxPoint2DDouble(13, 0));
51  axis.push_back(m_position + wxPoint2DDouble(0, -13));
52  axis.push_back(m_position + wxPoint2DDouble(0, 13));
53  DrawLine(axis, GL_LINES);
54 
55  glLineWidth(2.0);
56  std::vector<wxPoint2DDouble> limSymbol;
57  limSymbol.push_back(m_position + wxPoint2DDouble(10, -10));
58  limSymbol.push_back(m_position + wxPoint2DDouble(-10, 10));
59  glColor4d(0.0, 0.3, 1.0, 1.0);
60  DrawLine(limSymbol);
61 
62  glColor4d(0.0, 0.0, 0.0, 1.0);
63  DrawNodes();
64 }
65 
66 bool RateLimiter::ShowForm(wxWindow* parent, Element* element)
67 {
68  RateLimiterForm* form = new RateLimiterForm(parent, this);
69  if(form->ShowModal() == wxID_OK) {
70  form->Destroy();
71  return true;
72  }
73  form->Destroy();
74  return false;
75 }
76 
77 void RateLimiter::Rotate(bool clockwise)
78 {
79  if(clockwise)
80  m_angle += 90.0;
81  else
82  m_angle -= 90.0;
83  if(m_angle >= 360.0)
84  m_angle = 0.0;
85  else if(m_angle < 0)
86  m_angle = 270.0;
87 
88  UpdatePoints();
89 
90  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
91  Node* node = *it;
92  node->Rotate(clockwise);
93  }
94 }
95 
96 void RateLimiter::UpdatePoints()
97 {
98  if(m_angle == 0.0) {
99  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
100  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(18, 0));
101  } else if(m_angle == 90.0) {
102  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -18));
103  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, 18));
104  } else if(m_angle == 180.0) {
105  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(18, 0));
106  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-18, 0));
107  } else if(m_angle == 270.0) {
108  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, 18));
109  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -18));
110  }
111 }
112 
113 bool RateLimiter::Solve(double input, double timeStep)
114 {
115  double rate = (input - m_output) / timeStep;
116 
117  bool reachLimit = false;
118  if(rate > m_upLimit) {
119  rate = m_upLimit;
120  reachLimit = true;
121  } else if(rate < m_lowLimit) {
122  rate = m_lowLimit;
123  reachLimit = true;
124  }
125 
126  if(reachLimit)
127  m_output += rate * timeStep;
128  else
129  m_output = input;
130  return true;
131 }
132 
134 {
135  RateLimiter* copy = new RateLimiter(m_elementID);
136  *copy = *this;
137  return copy;
138 }
+
Node of a control element. This class manages the user interaction with the connection and control el...
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: RateLimiter.cpp:66
+
Limits the rising and/or falling rate.
Definition: RateLimiter.h:32
+
virtual bool Solve(double input, double timeStep)
Calculate the rate and limits it if exceeds. The rate is calculated by: is the current input a...
+ +
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: RateLimiter.cpp:77
+ + +
virtual Element * GetCopy()
Get a the element copy.
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: RateLimiter.cpp:34
+
Form to edit the rate limit control data.
diff --git a/docs/doxygen/html/_rate_limiter_8h.html b/docs/doxygen/html/_rate_limiter_8h.html new file mode 100644 index 0000000..1721183 --- /dev/null +++ b/docs/doxygen/html/_rate_limiter_8h.html @@ -0,0 +1,116 @@ + + + + + + + + + +Project/RateLimiter.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
RateLimiter.h File Reference
+
+
+
#include "ControlElement.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  RateLimiter
 Limits the rising and/or falling rate.
+ More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_rate_limiter_8h_source.html b/docs/doxygen/html/_rate_limiter_8h_source.html index 6d7bab0..b956dd1 100644 --- a/docs/doxygen/html/_rate_limiter_8h_source.html +++ b/docs/doxygen/html/_rate_limiter_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,22 +88,24 @@ $(document).ready(function(){initNavTree('_rate_limiter_8h_source.html','');});
RateLimiter.h
-
1 #ifndef RATELIMITER_H
2 #define RATELIMITER_H
3 
4 #include "ControlElement.h"
5 
6 class RateLimiterForm;
7 
8 class RateLimiter : public ControlElement
9 {
10  public:
11  RateLimiter(int id);
12  ~RateLimiter();
13 
14  virtual void Draw(wxPoint2DDouble translation, double scale) const;
15  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
16  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
17  virtual bool ShowForm(wxWindow* parent, Element* element);
18  virtual void Rotate(bool clockwise = true);
19 
20  virtual void UpdatePoints();
21 
22  double GetUpLimit() const { return m_upLimit; }
23  double GetLowLimit() const { return m_lowLimit; }
24  void SetUpLimit(double upLimit) { m_upLimit = upLimit; }
25  void SetLowLimit(double lowLimit) { m_lowLimit = lowLimit; }
26 
27  virtual bool Solve(double input, double timeStep);
28 
29  virtual Element* GetCopy();
30 
31  protected:
32  double m_upLimit = 5.0;
33  double m_lowLimit = -5.0;
34 };
35 
36 #endif // RATELIMITER_H
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: RateLimiter.cpp:49
-
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: RateLimiter.h:16
- -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: RateLimiter.cpp:60
- -
virtual Element * GetCopy()
Get a the element copy.
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: RateLimiter.h:15
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: RateLimiter.cpp:17
- +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef RATELIMITER_H
19 #define RATELIMITER_H
20 
21 #include "ControlElement.h"
22 
23 class RateLimiterForm;
24 
33 {
34  public:
35  RateLimiter(int id);
36  ~RateLimiter();
37 
38  virtual void Draw(wxPoint2DDouble translation, double scale) const;
39  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
40  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
41  virtual bool ShowForm(wxWindow* parent, Element* element);
42  virtual void Rotate(bool clockwise = true);
43 
44  virtual void UpdatePoints();
45 
46  double GetUpLimit() const { return m_upLimit; }
47  double GetLowLimit() const { return m_lowLimit; }
48  void SetUpLimit(double upLimit) { m_upLimit = upLimit; }
49  void SetLowLimit(double lowLimit) { m_lowLimit = lowLimit; }
65  virtual bool Solve(double input, double timeStep);
66 
67  virtual Element* GetCopy();
68 
69  protected:
70  double m_upLimit = 5.0;
71  double m_lowLimit = -5.0;
72 };
73 
74 #endif // RATELIMITER_H
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: RateLimiter.cpp:66
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: RateLimiter.h:40
+
Limits the rising and/or falling rate.
Definition: RateLimiter.h:32
+
virtual bool Solve(double input, double timeStep)
Calculate the rate and limits it if exceeds. The rate is calculated by: is the current input a...
+
Base class of a control element. Provide general methods to other control classes.
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: RateLimiter.cpp:77
+ +
virtual Element * GetCopy()
Get a the element copy.
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: RateLimiter.h:39
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: RateLimiter.cpp:34
+
Form to edit the rate limit control data.
-
1 #include "RateLimiterForm.h"
2 #include "RateLimiter.h"
3 
4 RateLimiterForm::RateLimiterForm(wxWindow* parent, RateLimiter* rateLimiter) : RateLimiterFormBase(parent)
5 {
6  SetSize(GetBestSize());
7 
8  m_rateLimiter = rateLimiter;
9  m_parent = parent;
10 
11  m_textCtrlUpLimit->SetValue(m_rateLimiter->StringFromDouble(m_rateLimiter->GetUpLimit()));
12  m_textCtrlLowLimit->SetValue(m_rateLimiter->StringFromDouble(m_rateLimiter->GetLowLimit()));
13 }
14 
15 RateLimiterForm::~RateLimiterForm() {}
16 bool RateLimiterForm::ValidateData()
17 {
18  double upLimit;
19  double lowLimit;
20 
21  if(!m_rateLimiter->DoubleFromString(this, m_textCtrlUpLimit->GetValue(), upLimit,
22  _("Value entered incorrectly in the field \"Upper limit\".")))
23  return false;
24  if(!m_rateLimiter->DoubleFromString(this, m_textCtrlLowLimit->GetValue(), lowLimit,
25  _("Value entered incorrectly in the field \"Lower limit\".")))
26  return false;
27 
28  m_rateLimiter->SetUpLimit(upLimit);
29  m_rateLimiter->SetLowLimit(lowLimit);
30 
31  return true;
32 }
33 
34 void RateLimiterForm::OnOKButtonClick(wxCommandEvent& event)
35 {
36  if(ValidateData()) EndModal(wxID_OK);
37 }
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "RateLimiterForm.h"
19 #include "RateLimiter.h"
20 
21 RateLimiterForm::RateLimiterForm(wxWindow* parent, RateLimiter* rateLimiter) : RateLimiterFormBase(parent)
22 {
23  SetSize(GetBestSize());
24 
25  m_rateLimiter = rateLimiter;
26  m_parent = parent;
27 
28  m_textCtrlUpLimit->SetValue(m_rateLimiter->StringFromDouble(m_rateLimiter->GetUpLimit()));
29  m_textCtrlLowLimit->SetValue(m_rateLimiter->StringFromDouble(m_rateLimiter->GetLowLimit()));
30 }
31 
32 RateLimiterForm::~RateLimiterForm() {}
33 bool RateLimiterForm::ValidateData()
34 {
35  double upLimit;
36  double lowLimit;
37 
38  if(!m_rateLimiter->DoubleFromString(this, m_textCtrlUpLimit->GetValue(), upLimit,
39  _("Value entered incorrectly in the field \"Upper limit\".")))
40  return false;
41  if(!m_rateLimiter->DoubleFromString(this, m_textCtrlLowLimit->GetValue(), lowLimit,
42  _("Value entered incorrectly in the field \"Lower limit\".")))
43  return false;
44 
45  m_rateLimiter->SetUpLimit(upLimit);
46  m_rateLimiter->SetLowLimit(lowLimit);
47 
48  return true;
49 }
50 
51 void RateLimiterForm::OnOKButtonClick(wxCommandEvent& event)
52 {
53  if(ValidateData()) EndModal(wxID_OK);
54 }
Limits the rising and/or falling rate.
Definition: RateLimiter.h:32
+ +
diff --git a/docs/doxygen/html/_rate_limiter_form_8h.html b/docs/doxygen/html/_rate_limiter_form_8h.html new file mode 100644 index 0000000..a2da6a5 --- /dev/null +++ b/docs/doxygen/html/_rate_limiter_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/RateLimiterForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
RateLimiterForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  RateLimiterForm
 Form to edit the rate limit control data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_rate_limiter_form_8h_source.html b/docs/doxygen/html/_rate_limiter_form_8h_source.html index 31108ce..900c9e8 100644 --- a/docs/doxygen/html/_rate_limiter_form_8h_source.html +++ b/docs/doxygen/html/_rate_limiter_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_rate_limiter_form_8h_source.html','')
RateLimiterForm.h
-
1 #ifndef RATELIMITERFORM_H
2 #define RATELIMITERFORM_H
3 #include "ElementForm.h"
4 
5 class RateLimiter;
6 
8 {
9  public:
10  RateLimiterForm(wxWindow* parent, RateLimiter* rateLimiter);
11  virtual ~RateLimiterForm();
12  bool ValidateData();
13 
14  protected:
15  virtual void OnCancelButtonClick(wxCommandEvent& event) {EndModal(wxID_OK);}
16  virtual void OnOKButtonClick(wxCommandEvent& event);
17 
18  wxWindow* m_parent = NULL;
19  RateLimiter* m_rateLimiter = NULL;
20 };
21 #endif // RATELIMITERFORM_H
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef RATELIMITERFORM_H
19 #define RATELIMITERFORM_H
20 #include "ElementForm.h"
21 
22 class RateLimiter;
23 
32 {
33  public:
34  RateLimiterForm(wxWindow* parent, RateLimiter* rateLimiter);
35  virtual ~RateLimiterForm();
36  bool ValidateData();
37 
38  protected:
39  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_OK); }
40  virtual void OnOKButtonClick(wxCommandEvent& event);
41 
42  wxWindow* m_parent = NULL;
43  RateLimiter* m_rateLimiter = NULL;
44 };
45 #endif // RATELIMITERFORM_H
Limits the rising and/or falling rate.
Definition: RateLimiter.h:32
- +
Form to edit the rate limit control data.
-
1 #include "ReactiveShuntElementForm.h"
2 #include "SwitchingForm.h"
3 #include "Capacitor.h"
4 #include "Inductor.h"
5 
6 ReactiveShuntElementForm::ReactiveShuntElementForm(wxWindow* parent, Capacitor* capacitor)
8 {
9  SetSize(GetBestSize());
10  CapacitorElectricalData data = capacitor->GetElectricalData();
11 
12  m_textCtrlName->SetValue(data.name);
13 
14  m_textCtrlReactivePower->SetValue(Capacitor::StringFromDouble(data.reactivePower));
15  switch(data.reactivePowerUnit) {
16  case UNIT_PU: {
17  m_choiceReactivePower->SetSelection(0);
18  } break;
19  case UNIT_VAr: {
20  m_choiceReactivePower->SetSelection(1);
21  } break;
22  case UNIT_kVAr: {
23  m_choiceReactivePower->SetSelection(2);
24  } break;
25  case UNIT_MVAr: {
26  m_choiceReactivePower->SetSelection(3);
27  } break;
28  default:
29  break;
30  }
31 
32  m_parent = parent;
33  m_capacitor = capacitor;
34 }
35 
36 ReactiveShuntElementForm::ReactiveShuntElementForm(wxWindow* parent, Inductor* inductor)
38 {
39  InductorElectricalData data = inductor->GetElectricalData();
40 
41  m_textCtrlName->SetValue(data.name);
42 
43  m_textCtrlReactivePower->SetValue(Inductor::StringFromDouble(data.reactivePower));
44  switch(data.reactivePowerUnit) {
45  case UNIT_PU: {
46  m_choiceReactivePower->SetSelection(0);
47  } break;
48  case UNIT_VAr: {
49  m_choiceReactivePower->SetSelection(1);
50  } break;
51  case UNIT_kVAr: {
52  m_choiceReactivePower->SetSelection(2);
53  } break;
54  case UNIT_MVAr: {
55  m_choiceReactivePower->SetSelection(3);
56  } break;
57  default:
58  break;
59  }
60 
61  m_parent = parent;
62  m_inductor = inductor;
63 }
64 
65 ReactiveShuntElementForm::~ReactiveShuntElementForm() {}
66 void ReactiveShuntElementForm::OnOKButtonClick(wxCommandEvent& event)
67 {
68  if(ValidateData()) EndModal(wxID_OK);
69 }
70 
71 void ReactiveShuntElementForm::OnStabilityButtonClick(wxCommandEvent& event)
72 {
73  if(ValidateData()) {
74  if(m_capacitor) {
75  SwitchingForm swForm(m_parent, m_capacitor);
76  swForm.SetTitle(_("Capacitor: Switching"));
77  swForm.ShowModal();
78  } else if(m_inductor) {
79  SwitchingForm swForm(m_parent, m_inductor);
80  swForm.SetTitle(_("Inductor: Switching"));
81  swForm.ShowModal();
82  }
83 
84  EndModal(wxID_OK);
85  }
86 }
87 
88 bool ReactiveShuntElementForm::ValidateData()
89 {
90  if(m_capacitor) {
92 
93  data.name = m_textCtrlName->GetValue();
94 
95  if(!m_capacitor->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
96  _("Value entered incorrectly in the field \"Reactive power\".")))
97  return false;
98  switch(m_choiceReactivePower->GetSelection()) {
99  case 0: {
100  data.reactivePowerUnit = UNIT_PU;
101  } break;
102  case 1: {
103  data.reactivePowerUnit = UNIT_VAr;
104  } break;
105  case 2: {
106  data.reactivePowerUnit = UNIT_kVAr;
107  } break;
108  case 3: {
109  data.reactivePowerUnit = UNIT_MVAr;
110  } break;
111  }
112 
113  m_capacitor->SetElectricalData(data);
114  } else if(m_inductor) {
116 
117  data.name = m_textCtrlName->GetValue();
118 
119  if(!m_inductor->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
120  _("Value entered incorrectly in the field \"Reactive power\".")))
121  return false;
122  switch(m_choiceReactivePower->GetSelection()) {
123  case 0: {
124  data.reactivePowerUnit = UNIT_PU;
125  } break;
126  case 1: {
127  data.reactivePowerUnit = UNIT_VAr;
128  } break;
129  case 2: {
130  data.reactivePowerUnit = UNIT_kVAr;
131  } break;
132  case 3: {
133  data.reactivePowerUnit = UNIT_MVAr;
134  } break;
135  }
136 
137  m_inductor->SetElectricalData(data);
138  }
139  return true;
140 }
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
19 #include "SwitchingForm.h"
20 #include "Capacitor.h"
21 #include "Inductor.h"
22 
23 ReactiveShuntElementForm::ReactiveShuntElementForm(wxWindow* parent, Capacitor* capacitor)
25 {
26  SetSize(GetBestSize());
27  CapacitorElectricalData data = capacitor->GetElectricalData();
28 
29  m_textCtrlName->SetValue(data.name);
30 
31  m_textCtrlReactivePower->SetValue(Capacitor::StringFromDouble(data.reactivePower));
32  switch(data.reactivePowerUnit) {
33  case UNIT_PU: {
34  m_choiceReactivePower->SetSelection(0);
35  } break;
36  case UNIT_VAr: {
37  m_choiceReactivePower->SetSelection(1);
38  } break;
39  case UNIT_kVAr: {
40  m_choiceReactivePower->SetSelection(2);
41  } break;
42  case UNIT_MVAr: {
43  m_choiceReactivePower->SetSelection(3);
44  } break;
45  default:
46  break;
47  }
48 
49  m_parent = parent;
50  m_capacitor = capacitor;
51 }
52 
53 ReactiveShuntElementForm::ReactiveShuntElementForm(wxWindow* parent, Inductor* inductor)
55 {
56  InductorElectricalData data = inductor->GetElectricalData();
57 
58  m_textCtrlName->SetValue(data.name);
59 
60  m_textCtrlReactivePower->SetValue(Inductor::StringFromDouble(data.reactivePower));
61  switch(data.reactivePowerUnit) {
62  case UNIT_PU: {
63  m_choiceReactivePower->SetSelection(0);
64  } break;
65  case UNIT_VAr: {
66  m_choiceReactivePower->SetSelection(1);
67  } break;
68  case UNIT_kVAr: {
69  m_choiceReactivePower->SetSelection(2);
70  } break;
71  case UNIT_MVAr: {
72  m_choiceReactivePower->SetSelection(3);
73  } break;
74  default:
75  break;
76  }
77 
78  m_parent = parent;
79  m_inductor = inductor;
80 }
81 
82 ReactiveShuntElementForm::~ReactiveShuntElementForm() {}
83 void ReactiveShuntElementForm::OnOKButtonClick(wxCommandEvent& event)
84 {
85  if(ValidateData()) EndModal(wxID_OK);
86 }
87 
88 void ReactiveShuntElementForm::OnStabilityButtonClick(wxCommandEvent& event)
89 {
90  if(ValidateData()) {
91  if(m_capacitor) {
92  SwitchingForm swForm(m_parent, m_capacitor);
93  swForm.SetTitle(_("Capacitor: Switching"));
94  swForm.ShowModal();
95  } else if(m_inductor) {
96  SwitchingForm swForm(m_parent, m_inductor);
97  swForm.SetTitle(_("Inductor: Switching"));
98  swForm.ShowModal();
99  }
100 
101  EndModal(wxID_OK);
102  }
103 }
104 
105 bool ReactiveShuntElementForm::ValidateData()
106 {
107  if(m_capacitor) {
109 
110  data.name = m_textCtrlName->GetValue();
111 
112  if(!m_capacitor->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
113  _("Value entered incorrectly in the field \"Reactive power\".")))
114  return false;
115  switch(m_choiceReactivePower->GetSelection()) {
116  case 0: {
117  data.reactivePowerUnit = UNIT_PU;
118  } break;
119  case 1: {
120  data.reactivePowerUnit = UNIT_VAr;
121  } break;
122  case 2: {
123  data.reactivePowerUnit = UNIT_kVAr;
124  } break;
125  case 3: {
126  data.reactivePowerUnit = UNIT_MVAr;
127  } break;
128  }
129 
130  m_capacitor->SetElectricalData(data);
131  } else if(m_inductor) {
133 
134  data.name = m_textCtrlName->GetValue();
135 
136  if(!m_inductor->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
137  _("Value entered incorrectly in the field \"Reactive power\".")))
138  return false;
139  switch(m_choiceReactivePower->GetSelection()) {
140  case 0: {
141  data.reactivePowerUnit = UNIT_PU;
142  } break;
143  case 1: {
144  data.reactivePowerUnit = UNIT_VAr;
145  } break;
146  case 2: {
147  data.reactivePowerUnit = UNIT_kVAr;
148  } break;
149  case 3: {
150  data.reactivePowerUnit = UNIT_MVAr;
151  } break;
152  }
153 
154  m_inductor->SetElectricalData(data);
155  }
156  return true;
157 }
+
Form to edit the switching data of power elements for electromechanical transient studies...
Definition: SwitchingForm.h:32
+ - - - - -
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:300
- - - + + + + + +
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:320
+ + +
diff --git a/docs/doxygen/html/_reactive_shunt_element_form_8h.html b/docs/doxygen/html/_reactive_shunt_element_form_8h.html new file mode 100644 index 0000000..970bb11 --- /dev/null +++ b/docs/doxygen/html/_reactive_shunt_element_form_8h.html @@ -0,0 +1,116 @@ + + + + + + + + + +Project/ReactiveShuntElementForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
ReactiveShuntElementForm.h File Reference
+
+
+
#include "ElementForm.h"
+#include <wx/log.h>
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  ReactiveShuntElementForm
 Form to edit the reactive shunt element power data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_reactive_shunt_element_form_8h_source.html b/docs/doxygen/html/_reactive_shunt_element_form_8h_source.html index 2843cfe..484283a 100644 --- a/docs/doxygen/html/_reactive_shunt_element_form_8h_source.html +++ b/docs/doxygen/html/_reactive_shunt_element_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,17 +88,17 @@ $(document).ready(function(){initNavTree('_reactive_shunt_element_form_8h_source
ReactiveShuntElementForm.h
-
1 #ifndef REACTIVESHUNTELEMENTFORM_H
2 #define REACTIVESHUNTELEMENTFORM_H
3 #include "ElementForm.h"
4 #include <wx/log.h>
5 
6 class Capacitor;
7 class Inductor;
8 class SwitchingForm;
9 
11 {
12  public:
13  ReactiveShuntElementForm(wxWindow* parent, Capacitor* capacitor);
14  ReactiveShuntElementForm(wxWindow* parent, Inductor* inductor);
15  virtual ~ReactiveShuntElementForm();
16  virtual bool ValidateData();
17 
18  protected:
19  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
20  virtual void OnOKButtonClick(wxCommandEvent& event);
21  virtual void OnStabilityButtonClick(wxCommandEvent& event);
22 
23  wxWindow* m_parent;
24  Capacitor* m_capacitor = NULL;
25  Inductor* m_inductor = NULL;
26 };
27 #endif // REACTIVESHUNTELEMENTFORM_H
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef REACTIVESHUNTELEMENTFORM_H
19 #define REACTIVESHUNTELEMENTFORM_H
20 #include "ElementForm.h"
21 #include <wx/log.h>
22 
23 class Capacitor;
24 class Inductor;
25 class SwitchingForm;
26 
35 {
36  public:
37  ReactiveShuntElementForm(wxWindow* parent, Capacitor* capacitor);
38  ReactiveShuntElementForm(wxWindow* parent, Inductor* inductor);
39  virtual ~ReactiveShuntElementForm();
40  virtual bool ValidateData();
41 
42  protected:
43  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
44  virtual void OnOKButtonClick(wxCommandEvent& event);
45  virtual void OnStabilityButtonClick(wxCommandEvent& event);
46 
47  wxWindow* m_parent;
48  Capacitor* m_capacitor = NULL;
49  Inductor* m_inductor = NULL;
50 };
51 #endif // REACTIVESHUNTELEMENTFORM_H
Form to edit the switching data of power elements for electromechanical transient studies...
Definition: SwitchingForm.h:32
- - - + + +
Form to edit the reactive shunt element power data.
-
1 #include "Shunt.h"
2 
3 Shunt::Shunt() : PowerElement() {}
4 Shunt::~Shunt() {}
5 void Shunt::UpdateSwitchesPosition()
6 {
7  if(m_parentList[0]) {
8  m_pointList[1] = GetSwitchPoint(m_parentList[0], m_pointList[0], m_pointList[2]);
9  } else {
10  m_pointList[1] = m_pointList[0];
11  }
12  UpdateSwitches();
13 }
14 
15 void Shunt::Move(wxPoint2DDouble position)
16 {
17  SetPosition(m_movePos + position - m_moveStartPt);
18  for(int i = 2; i < (int)m_pointList.size(); i++) {
19  m_pointList[i] = m_movePts[i] + position - m_moveStartPt;
20  }
21  if(!m_parentList[0]) {
22  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
23  }
24  UpdateSwitchesPosition();
25  UpdatePowerFlowArrowsPosition();
26 }
27 
28 void Shunt::MoveNode(Element* element, wxPoint2DDouble position)
29 {
30  if(element) {
31  if(element == m_parentList[0]) {
32  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
33  }
34  } else {
35  if(m_activeNodeID == 1) {
36  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
37  if(m_parentList[0]) {
38  m_parentList[0]->RemoveChild(this);
39  m_parentList[0] = NULL;
40  m_online = false;
41  }
42  }
43  }
44 
45  // Recalculate switches positions
46  UpdateSwitchesPosition();
47  UpdatePowerFlowArrowsPosition();
48 }
49 
50 void Shunt::StartMove(wxPoint2DDouble position)
51 {
52  m_moveStartPt = position;
53  m_movePts = m_pointList;
54  m_movePos = m_position;
55 }
56 
58 {
59  if(parent == m_parentList[0]) {
60  m_parentList[0] = NULL;
61  m_online = false;
62  UpdateSwitchesPosition();
63  UpdatePowerFlowArrowsPosition();
64  }
65 }
66 
67 bool Shunt::NodeContains(wxPoint2DDouble position)
68 {
69  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
70  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
71 
72  if(nodeRect.Contains(position)) {
73  m_activeNodeID = 1;
74  return true;
75  }
76 
77  m_activeNodeID = 0;
78  return false;
79 }
80 
82 {
83  if(parent && m_activeNodeID != 0) {
84  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
85  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
86 
87  if(parent->Intersects(nodeRect)) {
88  m_parentList[0] = parent;
89 
90  // Centralize the node on bus.
91  wxPoint2DDouble parentPt =
92  parent->RotateAtPosition(m_pointList[0], -parent->GetAngle()); // Rotate click to horizontal position.
93  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
94  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
95  m_pointList[0] = parentPt;
96 
97  UpdateSwitchesPosition();
98  UpdatePowerFlowArrowsPosition();
99  return true;
100  } else {
101  m_parentList[0] = NULL;
102  m_online = false;
103  }
104  }
105  return false;
106 }
107 
109 {
110  if(m_parentList[0]) {
111  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
112  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
113 
114  if(!m_parentList[0]->Intersects(nodeRect)) {
115  m_parentList[0]->RemoveChild(this);
116  m_parentList[0] = NULL;
117  m_online = false;
118  UpdateSwitchesPosition();
119  UpdatePowerFlowArrowsPosition();
120  }
121  }
122 }
123 
124 void Shunt::RotateNode(Element* parent, bool clockwise)
125 {
126  double rotAngle = m_rotationAngle;
127  if(!clockwise) rotAngle = -m_rotationAngle;
128 
129  if(parent == m_parentList[0]) {
130  m_pointList[0] = parent->RotateAtPosition(m_pointList[0], rotAngle);
131  UpdateSwitchesPosition();
132  UpdatePowerFlowArrowsPosition();
133  }
134 }
135 
136 void Shunt::DrawGround(wxPoint2DDouble position) const
137 {
138  std::vector<wxPoint2DDouble> groundPts;
139  groundPts.push_back(position);
140  groundPts.push_back(position + wxPoint2DDouble(0, 10));
141  groundPts.push_back(position + wxPoint2DDouble(-10, 10));
142  groundPts.push_back(position + wxPoint2DDouble(10, 10));
143  groundPts.push_back(position + wxPoint2DDouble(-6, 15));
144  groundPts.push_back(position + wxPoint2DDouble(6, 15));
145  groundPts.push_back(position + wxPoint2DDouble(-3, 20));
146  groundPts.push_back(position + wxPoint2DDouble(3, 20));
147 
148  DrawLine(groundPts, GL_LINES);
149 }
150 
151 void Shunt::UpdatePowerFlowArrowsPosition()
152 {
153  std::vector<wxPoint2DDouble> edges;
154  switch(m_pfDirection) {
155  case PF_NONE: {
156  m_powerFlowArrow.clear();
157  } break;
158  case PF_TO_BUS: {
159  edges.push_back(m_pointList[2]);
160  edges.push_back(m_pointList[1]);
161  } break;
162  case PF_TO_ELEMENT: {
163  edges.push_back(m_pointList[1]);
164  edges.push_back(m_pointList[2]);
165  } break;
166  default:
167  break;
168  }
169  CalculatePowerFlowPts(edges);
170 }
double GetAngle() const
Get the element angle.
Definition: Element.h:201
- -
virtual void MoveNode(Element *element, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Shunt.cpp:28
-
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Shunt.cpp:108
-
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Shunt.cpp:57
-
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:91
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Shunt.h"
19 
20 Shunt::Shunt() : PowerElement() {}
21 Shunt::~Shunt() {}
22 void Shunt::UpdateSwitchesPosition()
23 {
24  if(m_parentList[0]) {
25  m_pointList[1] = GetSwitchPoint(m_parentList[0], m_pointList[0], m_pointList[2]);
26  } else {
27  m_pointList[1] = m_pointList[0];
28  }
29  UpdateSwitches();
30 }
31 
32 void Shunt::Move(wxPoint2DDouble position)
33 {
34  SetPosition(m_movePos + position - m_moveStartPt);
35  for(int i = 2; i < (int)m_pointList.size(); i++) {
36  m_pointList[i] = m_movePts[i] + position - m_moveStartPt;
37  }
38  if(!m_parentList[0]) {
39  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
40  }
41  UpdateSwitchesPosition();
42  UpdatePowerFlowArrowsPosition();
43 }
44 
45 void Shunt::MoveNode(Element* element, wxPoint2DDouble position)
46 {
47  if(element) {
48  if(element == m_parentList[0]) {
49  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
50  }
51  } else {
52  if(m_activeNodeID == 1) {
53  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
54  if(m_parentList[0]) {
55  m_parentList[0]->RemoveChild(this);
56  m_parentList[0] = NULL;
57  m_online = false;
58  }
59  }
60  }
61 
62  // Recalculate switches positions
63  UpdateSwitchesPosition();
64  UpdatePowerFlowArrowsPosition();
65 }
66 
67 void Shunt::StartMove(wxPoint2DDouble position)
68 {
69  m_moveStartPt = position;
70  m_movePts = m_pointList;
71  m_movePos = m_position;
72 }
73 
75 {
76  if(parent == m_parentList[0]) {
77  m_parentList[0] = NULL;
78  m_online = false;
79  UpdateSwitchesPosition();
80  UpdatePowerFlowArrowsPosition();
81  }
82 }
83 
84 bool Shunt::NodeContains(wxPoint2DDouble position)
85 {
86  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
87  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
88 
89  if(nodeRect.Contains(position)) {
90  m_activeNodeID = 1;
91  return true;
92  }
93 
94  m_activeNodeID = 0;
95  return false;
96 }
97 
99 {
100  if(parent && m_activeNodeID != 0) {
101  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
102  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
103 
104  if(parent->Intersects(nodeRect)) {
105  m_parentList[0] = parent;
106 
107  // Centralize the node on bus.
108  wxPoint2DDouble parentPt =
109  parent->RotateAtPosition(m_pointList[0], -parent->GetAngle()); // Rotate click to horizontal position.
110  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
111  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
112  m_pointList[0] = parentPt;
113 
114  UpdateSwitchesPosition();
115  UpdatePowerFlowArrowsPosition();
116  return true;
117  } else {
118  m_parentList[0] = NULL;
119  m_online = false;
120  }
121  }
122  return false;
123 }
124 
126 {
127  if(m_parentList[0]) {
128  wxRect2DDouble nodeRect(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
129  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
130 
131  if(!m_parentList[0]->Intersects(nodeRect)) {
132  m_parentList[0]->RemoveChild(this);
133  m_parentList[0] = NULL;
134  m_online = false;
135  UpdateSwitchesPosition();
136  UpdatePowerFlowArrowsPosition();
137  }
138  }
139 }
140 
141 void Shunt::RotateNode(Element* parent, bool clockwise)
142 {
143  double rotAngle = m_rotationAngle;
144  if(!clockwise) rotAngle = -m_rotationAngle;
145 
146  if(parent == m_parentList[0]) {
147  m_pointList[0] = parent->RotateAtPosition(m_pointList[0], rotAngle);
148  UpdateSwitchesPosition();
149  UpdatePowerFlowArrowsPosition();
150  }
151 }
152 
153 void Shunt::DrawGround(wxPoint2DDouble position) const
154 {
155  std::vector<wxPoint2DDouble> groundPts;
156  groundPts.push_back(position);
157  groundPts.push_back(position + wxPoint2DDouble(0, 10));
158  groundPts.push_back(position + wxPoint2DDouble(-10, 10));
159  groundPts.push_back(position + wxPoint2DDouble(10, 10));
160  groundPts.push_back(position + wxPoint2DDouble(-6, 15));
161  groundPts.push_back(position + wxPoint2DDouble(6, 15));
162  groundPts.push_back(position + wxPoint2DDouble(-3, 20));
163  groundPts.push_back(position + wxPoint2DDouble(3, 20));
164 
165  DrawLine(groundPts, GL_LINES);
166 }
167 
168 void Shunt::UpdatePowerFlowArrowsPosition()
169 {
170  std::vector<wxPoint2DDouble> edges;
171  switch(m_pfDirection) {
172  case PF_NONE: {
173  m_powerFlowArrow.clear();
174  } break;
175  case PF_TO_BUS: {
176  edges.push_back(m_pointList[2]);
177  edges.push_back(m_pointList[1]);
178  } break;
179  case PF_TO_ELEMENT: {
180  edges.push_back(m_pointList[1]);
181  edges.push_back(m_pointList[2]);
182  } break;
183  default:
184  break;
185  }
186  CalculatePowerFlowPts(edges);
187 }
double GetAngle() const
Get the element angle.
Definition: Element.h:212
+ +
virtual void MoveNode(Element *element, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Shunt.cpp:45
+
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Shunt.cpp:125
+
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Shunt.cpp:74
+
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:107
virtual bool Intersects(wxRect2DDouble rect) const =0
Check if the element&#39;s rect intersects other rect.
-
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Shunt.cpp:124
- -
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Shunt.cpp:15
-
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Shunt.cpp:50
- - -
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Shunt.cpp:81
-
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Shunt.cpp:67
- -
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:171
+
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Shunt.cpp:141
+ +
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Shunt.cpp:32
+
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Shunt.cpp:67
+ + +
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Shunt.cpp:98
+
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Shunt.cpp:84
+ +
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:187
diff --git a/docs/doxygen/html/_shunt_8h_source.html b/docs/doxygen/html/_shunt_8h_source.html index 670bf95..a047246 100644 --- a/docs/doxygen/html/_shunt_8h_source.html +++ b/docs/doxygen/html/_shunt_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,20 +88,20 @@ $(document).ready(function(){initNavTree('_shunt_8h_source.html','');});
Shunt.h
-
1 #ifndef SHUNT_H
2 #define SHUNT_H
3 
4 #include "PowerElement.h"
5 #include "Bus.h"
6 
7 class Shunt : public PowerElement
8 {
9 public:
10  Shunt();
11  ~Shunt();
12 
13  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
14  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
15  virtual void Move(wxPoint2DDouble position);
16  virtual void MoveNode(Element* element, wxPoint2DDouble position);
17  virtual void StartMove(wxPoint2DDouble position);
18  virtual void RotateNode(Element* parent, bool clockwise = true);
19  virtual void RemoveParent(Element* parent);
20  virtual bool NodeContains(wxPoint2DDouble position);
21  virtual bool SetNodeParent(Element* parent);
22  virtual void UpdateNodes();
23 
24  protected:
25  void UpdateSwitchesPosition();
26  void UpdatePowerFlowArrowsPosition();
27  void DrawGround(wxPoint2DDouble position) const;
28  bool m_inserted = false;
29 
30 };
31 
32 #endif // SHUNT_H
-
virtual void MoveNode(Element *element, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Shunt.cpp:28
-
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Shunt.cpp:108
-
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Shunt.cpp:57
-
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Shunt.cpp:124
-
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Shunt.cpp:15
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Shunt.h:13
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef SHUNT_H
19 #define SHUNT_H
20 
21 #include "PowerElement.h"
22 #include "Bus.h"
23 
24 class Shunt : public PowerElement
25 {
26  public:
27  Shunt();
28  ~Shunt();
29 
30  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
31  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
32  virtual void Move(wxPoint2DDouble position);
33  virtual void MoveNode(Element* element, wxPoint2DDouble position);
34  virtual void StartMove(wxPoint2DDouble position);
35  virtual void RotateNode(Element* parent, bool clockwise = true);
36  virtual void RemoveParent(Element* parent);
37  virtual bool NodeContains(wxPoint2DDouble position);
38  virtual bool SetNodeParent(Element* parent);
39  virtual void UpdateNodes();
40 
41  protected:
42  void UpdateSwitchesPosition();
43  void UpdatePowerFlowArrowsPosition();
44  void DrawGround(wxPoint2DDouble position) const;
45  bool m_inserted = false;
46 };
47 
48 #endif // SHUNT_H
+
virtual void MoveNode(Element *element, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Shunt.cpp:45
+
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Shunt.cpp:125
+
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Shunt.cpp:74
+
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Shunt.cpp:141
+
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Shunt.cpp:32
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Shunt.h:30
Switching data of power elements.
-
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Shunt.cpp:50
-
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Shunt.cpp:81
-
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Shunt.cpp:67
- -
Definition: Shunt.h:7
-
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Shunt.h:14
+
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Shunt.cpp:67
+
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Shunt.cpp:98
+
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Shunt.cpp:84
+ +
Definition: Shunt.h:24
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Shunt.h:31
diff --git a/docs/doxygen/html/_simulations_settings_form_8cpp_source.html b/docs/doxygen/html/_simulations_settings_form_8cpp_source.html index 666a8fc..a7199da 100644 --- a/docs/doxygen/html/_simulations_settings_form_8cpp_source.html +++ b/docs/doxygen/html/_simulations_settings_form_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,14 +88,15 @@ $(document).ready(function(){initNavTree('_simulations_settings_form_8cpp_source
SimulationsSettingsForm.cpp
-
1 #include "SimulationsSettingsForm.h"
2 #include "PropertiesData.h"
3 
4 SimulationsSettingsForm::SimulationsSettingsForm(wxWindow* parent, PropertiesData* properties)
6 {
7  m_properties = properties;
8  auto data = m_properties->GetSimulationPropertiesData();
9 
10  m_textCtrlbasePower->SetValue(Element::StringFromDouble(data.basePower));
11  switch(data.basePowerUnit) {
12  case UNIT_VA: {
13  m_choiceBasePower->SetSelection(0);
14  } break;
15  case UNIT_kVA: {
16  m_choiceBasePower->SetSelection(1);
17  } break;
18  case UNIT_MVA: {
19  m_choiceBasePower->SetSelection(2);
20  } break;
21  default: {
22  m_choiceBasePower->SetSelection(wxNOT_FOUND);
23  } break;
24  }
25  m_checkBoxFaultAfterPF->SetValue(data.faultAfterPowerFlow);
26  m_checkBoxSCPowerAfterPF->SetValue(data.scPowerAfterPowerFlow);
27  switch(data.powerFlowMethod) {
28  case GAUSS_SEIDEL: {
29  m_choicePFMethod->SetSelection(0);
30  } break;
31  case NEWTON_RAPHSON: {
32  m_choicePFMethod->SetSelection(1);
33  m_textCtrlAccFactor->Enable(false);
34  } break;
35  default: {
36  m_choicePFMethod->SetSelection(wxNOT_FOUND);
37  } break;
38  }
39  m_textCtrlAccFactor->SetValue(Element::StringFromDouble(data.accFator));
40  m_textCtrlPFTolerance->SetValue(wxString::Format("%g", data.powerFlowTolerance));
41  m_textCtrlPFMaxIterations->SetValue(wxString::Format("%d", data.powerFlowMaxIterations));
42  m_textCtrlTimeStep->SetValue(wxString::Format("%g", data.timeStep));
43  m_textCtrlSimTime->SetValue(Element::StringFromDouble(data.stabilitySimulationTime));
44  m_textCtrlFreq->SetValue(Element::StringFromDouble(data.stabilityFrequency));
45  m_textCtrlStabTolerance->SetValue(wxString::Format("%g", data.stabilityTolerance));
46  m_textCtrlStabMaxIterations->SetValue(wxString::Format("%d", data.stabilityMaxIterations));
47  m_textCtrlCtrlStepRatio->SetValue(wxString::Format("%d", data.controlTimeStepRatio));
48  m_textCtrlPrintTime->SetValue(wxString::Format("%g", data.plotTime));
49 
50  m_checkBoxUseCOI->SetValue(data.useCOI);
51 }
52 
53 SimulationsSettingsForm::~SimulationsSettingsForm() {}
54 void SimulationsSettingsForm::OnButtonOKClick(wxCommandEvent& event)
55 {
56  if(ValidateData()) EndModal(wxID_OK);
57 }
58 
59 bool SimulationsSettingsForm::ValidateData()
60 {
61  auto data = m_properties->GetSimulationPropertiesData();
62  if(!Element::DoubleFromString(this, m_textCtrlbasePower->GetValue(), data.basePower,
63  _("Value entered incorrectly in the field \"Base power\".")))
64  return false;
65  switch(m_choiceBasePower->GetSelection()) {
66  case 0: {
67  data.basePowerUnit = UNIT_VA;
68  } break;
69  case 1: {
70  data.basePowerUnit = UNIT_kVA;
71  } break;
72  default: {
73  data.basePowerUnit = UNIT_MVA;
74  } break;
75  }
76  data.faultAfterPowerFlow = m_checkBoxFaultAfterPF->GetValue();
77  data.scPowerAfterPowerFlow = m_checkBoxSCPowerAfterPF->GetValue();
78  switch(m_choicePFMethod->GetSelection()) {
79  case 0: {
80  data.powerFlowMethod = GAUSS_SEIDEL;
81  } break;
82  case 1: {
83  data.powerFlowMethod = NEWTON_RAPHSON;
84  } break;
85  }
86  if(!Element::DoubleFromString(this, m_textCtrlAccFactor->GetValue(), data.accFator,
87  _("Value entered incorrectly in the field \"Acceleration factor\".")))
88  return false;
89  if(!Element::DoubleFromString(this, m_textCtrlPFTolerance->GetValue(), data.powerFlowTolerance,
90  _("Value entered incorrectly in the field \"Tolerance (Power flow)\".")))
91  return false;
92  if(!Element::IntFromString(this, m_textCtrlPFMaxIterations->GetValue(), data.powerFlowMaxIterations,
93  _("Value entered incorrectly in the field \"Max. iterations (Power flow)\".")))
94  return false;
95  if(!Element::DoubleFromString(this, m_textCtrlTimeStep->GetValue(), data.timeStep,
96  _("Value entered incorrectly in the field \"Time step\".")))
97  return false;
98  if(!Element::DoubleFromString(this, m_textCtrlSimTime->GetValue(), data.stabilitySimulationTime,
99  _("Value entered incorrectly in the field \"Simulation time\".")))
100  return false;
101  if(!Element::DoubleFromString(this, m_textCtrlFreq->GetValue(), data.stabilityFrequency,
102  _("Value entered incorrectly in the field \"System frequency\".")))
103  return false;
104  if(!Element::DoubleFromString(this, m_textCtrlStabTolerance->GetValue(), data.stabilityTolerance,
105  _("Value entered incorrectly in the field \"Tolerance (Stability)\".")))
106  return false;
107  if(!Element::IntFromString(this, m_textCtrlStabMaxIterations->GetValue(), data.stabilityMaxIterations,
108  _("Value entered incorrectly in the field \"Max. iterations (Stability)\".")))
109  return false;
110  if(!Element::IntFromString(this, m_textCtrlCtrlStepRatio->GetValue(), data.controlTimeStepRatio,
111  _("Value entered incorrectly in the field \"Controls step ratio\".")))
112  return false;
113  if(!Element::DoubleFromString(this, m_textCtrlPrintTime->GetValue(), data.plotTime,
114  _("Value entered incorrectly in the field \"Plot time\".")))
115  return false;
116  data.useCOI = m_checkBoxUseCOI->GetValue();
117 
118  m_properties->SetSimulationPropertiesData(data);
119  return true;
120 }
121 void SimulationsSettingsForm::OnPFMethodChoiceSelected(wxCommandEvent& event)
122 {
123  if(m_choicePFMethod->GetSelection() == 0)
124  m_textCtrlAccFactor->Enable();
125  else
126  m_textCtrlAccFactor->Enable(false);
127 }
-
static bool DoubleFromString(wxWindow *parent, wxString strValue, double &value, wxString errorMsg)
Get a double value from a string. Show a error message if the conversion fail.
Definition: Element.cpp:272
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
19 #include "PropertiesData.h"
20 
21 SimulationsSettingsForm::SimulationsSettingsForm(wxWindow* parent, PropertiesData* properties)
23 {
24  m_properties = properties;
25  auto data = m_properties->GetSimulationPropertiesData();
26 
27  m_textCtrlbasePower->SetValue(Element::StringFromDouble(data.basePower));
28  switch(data.basePowerUnit) {
29  case UNIT_VA: {
30  m_choiceBasePower->SetSelection(0);
31  } break;
32  case UNIT_kVA: {
33  m_choiceBasePower->SetSelection(1);
34  } break;
35  case UNIT_MVA: {
36  m_choiceBasePower->SetSelection(2);
37  } break;
38  default: {
39  m_choiceBasePower->SetSelection(wxNOT_FOUND);
40  } break;
41  }
42  m_checkBoxFaultAfterPF->SetValue(data.faultAfterPowerFlow);
43  m_checkBoxSCPowerAfterPF->SetValue(data.scPowerAfterPowerFlow);
44  switch(data.powerFlowMethod) {
45  case GAUSS_SEIDEL: {
46  m_choicePFMethod->SetSelection(0);
47  } break;
48  case NEWTON_RAPHSON: {
49  m_choicePFMethod->SetSelection(1);
50  m_textCtrlAccFactor->Enable(false);
51  } break;
52  default: {
53  m_choicePFMethod->SetSelection(wxNOT_FOUND);
54  } break;
55  }
56  m_textCtrlAccFactor->SetValue(Element::StringFromDouble(data.accFator));
57  m_textCtrlPFTolerance->SetValue(wxString::Format("%g", data.powerFlowTolerance));
58  m_textCtrlPFMaxIterations->SetValue(wxString::Format("%d", data.powerFlowMaxIterations));
59  m_textCtrlTimeStep->SetValue(wxString::Format("%g", data.timeStep));
60  m_textCtrlSimTime->SetValue(Element::StringFromDouble(data.stabilitySimulationTime));
61  m_textCtrlFreq->SetValue(Element::StringFromDouble(data.stabilityFrequency));
62  m_textCtrlStabTolerance->SetValue(wxString::Format("%g", data.stabilityTolerance));
63  m_textCtrlStabMaxIterations->SetValue(wxString::Format("%d", data.stabilityMaxIterations));
64  m_textCtrlCtrlStepRatio->SetValue(wxString::Format("%d", data.controlTimeStepRatio));
65  m_textCtrlPrintTime->SetValue(wxString::Format("%g", data.plotTime));
66 
67  m_checkBoxUseCOI->SetValue(data.useCOI);
68 }
69 
70 SimulationsSettingsForm::~SimulationsSettingsForm() {}
71 void SimulationsSettingsForm::OnButtonOKClick(wxCommandEvent& event)
72 {
73  if(ValidateData()) EndModal(wxID_OK);
74 }
75 
76 bool SimulationsSettingsForm::ValidateData()
77 {
78  auto data = m_properties->GetSimulationPropertiesData();
79  if(!Element::DoubleFromString(this, m_textCtrlbasePower->GetValue(), data.basePower,
80  _("Value entered incorrectly in the field \"Base power\".")))
81  return false;
82  switch(m_choiceBasePower->GetSelection()) {
83  case 0: {
84  data.basePowerUnit = UNIT_VA;
85  } break;
86  case 1: {
87  data.basePowerUnit = UNIT_kVA;
88  } break;
89  default: {
90  data.basePowerUnit = UNIT_MVA;
91  } break;
92  }
93  data.faultAfterPowerFlow = m_checkBoxFaultAfterPF->GetValue();
94  data.scPowerAfterPowerFlow = m_checkBoxSCPowerAfterPF->GetValue();
95  switch(m_choicePFMethod->GetSelection()) {
96  case 0: {
97  data.powerFlowMethod = GAUSS_SEIDEL;
98  } break;
99  case 1: {
100  data.powerFlowMethod = NEWTON_RAPHSON;
101  } break;
102  }
103  if(!Element::DoubleFromString(this, m_textCtrlAccFactor->GetValue(), data.accFator,
104  _("Value entered incorrectly in the field \"Acceleration factor\".")))
105  return false;
106  if(!Element::DoubleFromString(this, m_textCtrlPFTolerance->GetValue(), data.powerFlowTolerance,
107  _("Value entered incorrectly in the field \"Tolerance (Power flow)\".")))
108  return false;
109  if(!Element::IntFromString(this, m_textCtrlPFMaxIterations->GetValue(), data.powerFlowMaxIterations,
110  _("Value entered incorrectly in the field \"Max. iterations (Power flow)\".")))
111  return false;
112  if(!Element::DoubleFromString(this, m_textCtrlTimeStep->GetValue(), data.timeStep,
113  _("Value entered incorrectly in the field \"Time step\".")))
114  return false;
115  if(!Element::DoubleFromString(this, m_textCtrlSimTime->GetValue(), data.stabilitySimulationTime,
116  _("Value entered incorrectly in the field \"Simulation time\".")))
117  return false;
118  if(!Element::DoubleFromString(this, m_textCtrlFreq->GetValue(), data.stabilityFrequency,
119  _("Value entered incorrectly in the field \"System frequency\".")))
120  return false;
121  if(!Element::DoubleFromString(this, m_textCtrlStabTolerance->GetValue(), data.stabilityTolerance,
122  _("Value entered incorrectly in the field \"Tolerance (Stability)\".")))
123  return false;
124  if(!Element::IntFromString(this, m_textCtrlStabMaxIterations->GetValue(), data.stabilityMaxIterations,
125  _("Value entered incorrectly in the field \"Max. iterations (Stability)\".")))
126  return false;
127  if(!Element::IntFromString(this, m_textCtrlCtrlStepRatio->GetValue(), data.controlTimeStepRatio,
128  _("Value entered incorrectly in the field \"Controls step ratio\".")))
129  return false;
130  if(!Element::DoubleFromString(this, m_textCtrlPrintTime->GetValue(), data.plotTime,
131  _("Value entered incorrectly in the field \"Plot time\".")))
132  return false;
133  data.useCOI = m_checkBoxUseCOI->GetValue();
134 
135  m_properties->SetSimulationPropertiesData(data);
136  return true;
137 }
138 void SimulationsSettingsForm::OnPFMethodChoiceSelected(wxCommandEvent& event)
139 {
140  if(m_choicePFMethod->GetSelection() == 0)
141  m_textCtrlAccFactor->Enable();
142  else
143  m_textCtrlAccFactor->Enable(false);
144 }
+ +
static bool DoubleFromString(wxWindow *parent, wxString strValue, double &value, wxString errorMsg)
Get a double value from a string. Show a error message if the conversion fail.
Definition: Element.cpp:292
-
static bool IntFromString(wxWindow *parent, wxString strValue, int &value, wxString errorMsg)
Convert a string to int. Show a error message if the conversion fail.
Definition: Element.cpp:286
- -
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:300
- - +
static bool IntFromString(wxWindow *parent, wxString strValue, int &value, wxString errorMsg)
Convert a string to int. Show a error message if the conversion fail.
Definition: Element.cpp:306
+ +
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:320
+ +
diff --git a/docs/doxygen/html/_simulations_settings_form_8h.html b/docs/doxygen/html/_simulations_settings_form_8h.html new file mode 100644 index 0000000..71fac47 --- /dev/null +++ b/docs/doxygen/html/_simulations_settings_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/SimulationsSettingsForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
SimulationsSettingsForm.h File Reference
+
+
+
#include "PropertiesForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  SimulationsSettingsForm
 Form to edit the simulation data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_simulations_settings_form_8h_source.html b/docs/doxygen/html/_simulations_settings_form_8h_source.html index 939c0ba..2cf48f0 100644 --- a/docs/doxygen/html/_simulations_settings_form_8h_source.html +++ b/docs/doxygen/html/_simulations_settings_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_simulations_settings_form_8h_source.h
SimulationsSettingsForm.h
-
1 #ifndef SIMULATIONSSETTINGSFORM_H
2 #define SIMULATIONSSETTINGSFORM_H
3 
4 #include "PropertiesForm.h"
5 
6 class PropertiesData;
7 
9 {
10 public:
11  SimulationsSettingsForm(wxWindow* parent, PropertiesData* properties);
12  virtual ~SimulationsSettingsForm();
13 protected:
14  virtual void OnPFMethodChoiceSelected(wxCommandEvent& event);
15  virtual void OnButtonCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
16  virtual void OnButtonOKClick(wxCommandEvent& event);
17  virtual bool ValidateData();
18 
19  PropertiesData* m_properties;
20 };
21 #endif // SIMULATIONSSETTINGSFORM_H
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef SIMULATIONSSETTINGSFORM_H
19 #define SIMULATIONSSETTINGSFORM_H
20 
21 #include "PropertiesForm.h"
22 
23 class PropertiesData;
24 
33 {
34  public:
35  SimulationsSettingsForm(wxWindow* parent, PropertiesData* properties);
36  virtual ~SimulationsSettingsForm();
37 
38  protected:
39  virtual void OnPFMethodChoiceSelected(wxCommandEvent& event);
40  virtual void OnButtonCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
41  virtual void OnButtonOKClick(wxCommandEvent& event);
42  virtual bool ValidateData();
43 
44  PropertiesData* m_properties;
45 };
46 #endif // SIMULATIONSSETTINGSFORM_H
- +
Form to edit the simulation data.
-
1 #include "Sum.h"
2 #include "SumForm.h"
3 #include "ConnectionLine.h"
4 
5 Sum::Sum(int id) : ControlElement(id)
6 {
7  m_width = m_height = 36.0;
8  Node* nodeIn1 = new Node(m_position + wxPoint2DDouble(-m_width / 2, 9 - m_height / 2), Node::NODE_IN, m_borderSize);
9  nodeIn1->StartMove(m_position);
10  Node* nodeIn2 =
11  new Node(m_position + wxPoint2DDouble(-m_width / 2, 27 - m_height / 2), Node::NODE_IN, m_borderSize);
12  nodeIn2->StartMove(m_position);
13  Node* nodeOut = new Node(m_position + wxPoint2DDouble(m_width / 2, 0), Node::NODE_OUT, m_borderSize);
14  nodeOut->SetAngle(180.0);
15  nodeOut->StartMove(m_position);
16  m_nodeList.push_back(nodeIn1);
17  m_nodeList.push_back(nodeIn2);
18  m_nodeList.push_back(nodeOut);
19  m_signalList.push_back(SIGNAL_POSITIVE);
20  m_signalList.push_back(SIGNAL_NEGATIVE);
21 
22  UpdatePoints();
23 }
24 
25 Sum::~Sum() {}
26 void Sum::Draw(wxPoint2DDouble translation, double scale) const
27 {
28  glLineWidth(1.0);
29  if(m_selected) {
30  glColor4dv(m_selectionColour.GetRGBA());
31  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
32  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
33  }
34  glColor4d(1.0, 1.0, 1.0, 1.0);
35  DrawRectangle(m_position, m_width, m_height);
36  glColor4d(0.0, 0.0, 0.0, 1.0);
37  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
38 
39  // Plot signals.
40  glLineWidth(2.0);
41  wxPoint2DDouble signalOffset[4];
42  wxPoint2DDouble sigmaOffset;
43  if(m_angle == 0.0) {
44  signalOffset[0] = wxPoint2DDouble(6, 0);
45  signalOffset[1] = wxPoint2DDouble(12, 0);
46  signalOffset[2] = wxPoint2DDouble(9, -3);
47  signalOffset[3] = wxPoint2DDouble(9, 3);
48  sigmaOffset = wxPoint2DDouble(6, 0);
49  } else if(m_angle == 90.0) {
50  signalOffset[0] = wxPoint2DDouble(-3, 9);
51  signalOffset[1] = wxPoint2DDouble(3, 9);
52  signalOffset[2] = wxPoint2DDouble(0, 6);
53  signalOffset[3] = wxPoint2DDouble(0, 12);
54  sigmaOffset = wxPoint2DDouble(0, 6);
55  } else if(m_angle == 180.0) {
56  signalOffset[0] = wxPoint2DDouble(-6, 0);
57  signalOffset[1] = wxPoint2DDouble(-12, 0);
58  signalOffset[2] = wxPoint2DDouble(-9, -3);
59  signalOffset[3] = wxPoint2DDouble(-9, 3);
60  sigmaOffset = wxPoint2DDouble(-6, 0);
61  } else if(m_angle == 270.0) {
62  signalOffset[0] = wxPoint2DDouble(-3, -9);
63  signalOffset[1] = wxPoint2DDouble(3, -9);
64  signalOffset[2] = wxPoint2DDouble(0, -6);
65  signalOffset[3] = wxPoint2DDouble(0, -12);
66  sigmaOffset = wxPoint2DDouble(0, -6);
67  }
68  for(int i = 0; i < (int)m_nodeList.size() - 1; ++i) {
69  std::vector<wxPoint2DDouble> hLine;
70  hLine.push_back(m_nodeList[i]->GetPosition() + signalOffset[0]);
71  hLine.push_back(m_nodeList[i]->GetPosition() + signalOffset[1]);
72  DrawLine(hLine);
73  if(m_signalList[i] == SIGNAL_POSITIVE) {
74  std::vector<wxPoint2DDouble> vLine;
75  vLine.push_back(m_nodeList[i]->GetPosition() + signalOffset[2]);
76  vLine.push_back(m_nodeList[i]->GetPosition() + signalOffset[3]);
77  DrawLine(vLine);
78  }
79  }
80 
81  // Plot sigma.
82  std::vector<wxPoint2DDouble> sigma;
83  sigma.push_back(m_position + wxPoint2DDouble(4, 9) + sigmaOffset);
84  sigma.push_back(m_position + wxPoint2DDouble(-6, 9) + sigmaOffset);
85  sigma.push_back(m_position + wxPoint2DDouble(0, 0) + sigmaOffset);
86  sigma.push_back(m_position + wxPoint2DDouble(-6, -9) + sigmaOffset);
87  sigma.push_back(m_position + wxPoint2DDouble(4, -9) + sigmaOffset);
88  glColor4d(0.0, 0.3, 1.0, 1.0);
89  DrawLine(sigma);
90 
91  glColor4d(0.0, 0.0, 0.0, 1.0);
92  DrawNodes();
93 }
94 
95 bool Sum::ShowForm(wxWindow* parent, Element* element)
96 {
97  SumForm* sumForm = new SumForm(parent, this);
98  if(sumForm->ShowModal() == wxID_OK) {
99  sumForm->Destroy();
100  return true;
101  }
102  sumForm->Destroy();
103  return false;
104 }
105 
106 void Sum::UpdatePoints()
107 {
108  if(m_angle == 0.0 || m_angle == 180.0) {
109  m_height = 18.0 * (m_nodeList.size() - 1);
110  m_width = 36.0;
111  } else {
112  m_width = 18.0 * (m_nodeList.size() - 1);
113  m_height = 42.0;
114  }
115 
116  for(int i = 0; i < (int)m_nodeList.size() - 1; ++i) {
117  if(m_angle == 0.0)
118  m_nodeList[i]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 9 + 18 * i - m_height / 2));
119  else if(m_angle == 90.0)
120  m_nodeList[i]->SetPosition(m_position + wxPoint2DDouble(m_width / 2 - 9 - 18 * i, -m_height / 2));
121  else if(m_angle == 180.0)
122  m_nodeList[i]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, m_height / 2 - 9 - 18 * i));
123  else if(m_angle == 270.0)
124  m_nodeList[i]->SetPosition(m_position + wxPoint2DDouble(9 + 18 * i - m_width / 2, m_height / 2));
125  }
126  if(m_angle == 0.0)
127  m_nodeList[m_nodeList.size() - 1]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
128  else if(m_angle == 90.0)
129  m_nodeList[m_nodeList.size() - 1]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
130  else if(m_angle == 180.0)
131  m_nodeList[m_nodeList.size() - 1]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
132  else if(m_angle == 270.0)
133  m_nodeList[m_nodeList.size() - 1]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
134 
135  SetPosition(m_position); // Update rect.
136 }
137 
138 void Sum::AddInNode()
139 {
140  Node* newNode = new Node(wxPoint2DDouble(0, 0), Node::NODE_IN, m_borderSize);
141  newNode->SetAngle(m_angle);
142  m_nodeList.insert(m_nodeList.end() - 1, newNode);
143 }
144 
145 void Sum::RemoveInNode()
146 {
147  Node* nodeToRemove = *(m_nodeList.end() - 2);
148  bool foundChild = false;
149  for(auto it = m_childList.begin(), itEnd = m_childList.end(); it != itEnd; ++it) {
150  ControlElement* child = static_cast<ControlElement*>(*it);
151  auto childNodeList = child->GetNodeList();
152  for(auto itN = childNodeList.begin(), itEndN = childNodeList.end(); itN != itEndN; ++itN) {
153  Node* node = *itN;
154  if(node == nodeToRemove) {
155  child->RemoveParent(this);
156  RemoveChild(child);
157  foundChild = true;
158  break;
159  }
160  }
161  if(foundChild) break;
162  }
163  m_nodeList.erase(m_nodeList.end() - 2);
164 }
165 
166 void Sum::Rotate(bool clockwise)
167 {
168  if(clockwise)
169  m_angle += 90.0;
170  else
171  m_angle -= 90.0;
172  if(m_angle >= 360.0)
173  m_angle = 0.0;
174  else if(m_angle < 0)
175  m_angle = 270.0;
176 
177  UpdatePoints();
178 
179  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
180  Node* node = *it;
181  node->Rotate(clockwise);
182  }
183 }
184 
185 bool Sum::Solve(double input, double timeStep)
186 {
187  std::vector<double> inputVector;
188  for(auto itN = m_nodeList.begin(), itNEnd = m_nodeList.end(); itN != itNEnd; ++itN) {
189  Node* node = *itN;
190  if(node->GetNodeType() != Node::NODE_OUT) {
191  if(!node->IsConnected()) {
192  inputVector.push_back(0.0);
193  } else {
194  for(auto itC = m_childList.begin(), itCEnd = m_childList.end(); itC != itCEnd; ++itC) {
195  ConnectionLine* cLine = static_cast<ConnectionLine*>(*itC);
196  auto nodeList = cLine->GetNodeList();
197  for(auto itCN = nodeList.begin(), itCNEnd = nodeList.end(); itCN != itCNEnd; ++itCN) {
198  Node* childNode = *itCN;
199  if(childNode == node) {
200  inputVector.push_back(cLine->GetValue());
201  break;
202  }
203  }
204  }
205  }
206  }
207  }
208 
209  if(m_signalList.size() != inputVector.size()) return false;
210 
211  m_output = 0.0;
212  for(unsigned int i = 0; i < m_signalList.size(); ++i) {
213  if(m_signalList[i] == SIGNAL_POSITIVE)
214  m_output += inputVector[i];
215  else if(m_signalList[i] == SIGNAL_NEGATIVE)
216  m_output -= inputVector[i];
217  }
218  return true;
219 }
220 
222 {
223  Sum* copy = new Sum(m_elementID);
224  *copy = *this;
225  return copy;
226 }
Definition: SumForm.h:8
- -
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Sum.cpp:95
-
Definition: Sum.h:9
- -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Sum.cpp:166
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Sum.cpp:221
- -
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Element.h:367
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Sum.cpp:26
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Sum.h"
19 #include "SumForm.h"
20 #include "ConnectionLine.h"
21 
22 Sum::Sum(int id) : ControlElement(id)
23 {
24  m_width = m_height = 36.0;
25  Node* nodeIn1 = new Node(m_position + wxPoint2DDouble(-m_width / 2, 9 - m_height / 2), Node::NODE_IN, m_borderSize);
26  nodeIn1->StartMove(m_position);
27  Node* nodeIn2 =
28  new Node(m_position + wxPoint2DDouble(-m_width / 2, 27 - m_height / 2), Node::NODE_IN, m_borderSize);
29  nodeIn2->StartMove(m_position);
30  Node* nodeOut = new Node(m_position + wxPoint2DDouble(m_width / 2, 0), Node::NODE_OUT, m_borderSize);
31  nodeOut->SetAngle(180.0);
32  nodeOut->StartMove(m_position);
33  m_nodeList.push_back(nodeIn1);
34  m_nodeList.push_back(nodeIn2);
35  m_nodeList.push_back(nodeOut);
36  m_signalList.push_back(SIGNAL_POSITIVE);
37  m_signalList.push_back(SIGNAL_NEGATIVE);
38 
39  UpdatePoints();
40 }
41 
42 Sum::~Sum() {}
43 void Sum::Draw(wxPoint2DDouble translation, double scale) const
44 {
45  glLineWidth(1.0);
46  if(m_selected) {
47  glColor4dv(m_selectionColour.GetRGBA());
48  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
49  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
50  }
51  glColor4d(1.0, 1.0, 1.0, 1.0);
52  DrawRectangle(m_position, m_width, m_height);
53  glColor4d(0.0, 0.0, 0.0, 1.0);
54  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
55 
56  // Plot signals.
57  glLineWidth(2.0);
58  wxPoint2DDouble signalOffset[4];
59  wxPoint2DDouble sigmaOffset;
60  if(m_angle == 0.0) {
61  signalOffset[0] = wxPoint2DDouble(6, 0);
62  signalOffset[1] = wxPoint2DDouble(12, 0);
63  signalOffset[2] = wxPoint2DDouble(9, -3);
64  signalOffset[3] = wxPoint2DDouble(9, 3);
65  sigmaOffset = wxPoint2DDouble(6, 0);
66  } else if(m_angle == 90.0) {
67  signalOffset[0] = wxPoint2DDouble(-3, 9);
68  signalOffset[1] = wxPoint2DDouble(3, 9);
69  signalOffset[2] = wxPoint2DDouble(0, 6);
70  signalOffset[3] = wxPoint2DDouble(0, 12);
71  sigmaOffset = wxPoint2DDouble(0, 6);
72  } else if(m_angle == 180.0) {
73  signalOffset[0] = wxPoint2DDouble(-6, 0);
74  signalOffset[1] = wxPoint2DDouble(-12, 0);
75  signalOffset[2] = wxPoint2DDouble(-9, -3);
76  signalOffset[3] = wxPoint2DDouble(-9, 3);
77  sigmaOffset = wxPoint2DDouble(-6, 0);
78  } else if(m_angle == 270.0) {
79  signalOffset[0] = wxPoint2DDouble(-3, -9);
80  signalOffset[1] = wxPoint2DDouble(3, -9);
81  signalOffset[2] = wxPoint2DDouble(0, -6);
82  signalOffset[3] = wxPoint2DDouble(0, -12);
83  sigmaOffset = wxPoint2DDouble(0, -6);
84  }
85  for(int i = 0; i < (int)m_nodeList.size() - 1; ++i) {
86  std::vector<wxPoint2DDouble> hLine;
87  hLine.push_back(m_nodeList[i]->GetPosition() + signalOffset[0]);
88  hLine.push_back(m_nodeList[i]->GetPosition() + signalOffset[1]);
89  DrawLine(hLine);
90  if(m_signalList[i] == SIGNAL_POSITIVE) {
91  std::vector<wxPoint2DDouble> vLine;
92  vLine.push_back(m_nodeList[i]->GetPosition() + signalOffset[2]);
93  vLine.push_back(m_nodeList[i]->GetPosition() + signalOffset[3]);
94  DrawLine(vLine);
95  }
96  }
97 
98  // Plot sigma.
99  std::vector<wxPoint2DDouble> sigma;
100  sigma.push_back(m_position + wxPoint2DDouble(4, 9) + sigmaOffset);
101  sigma.push_back(m_position + wxPoint2DDouble(-6, 9) + sigmaOffset);
102  sigma.push_back(m_position + wxPoint2DDouble(0, 0) + sigmaOffset);
103  sigma.push_back(m_position + wxPoint2DDouble(-6, -9) + sigmaOffset);
104  sigma.push_back(m_position + wxPoint2DDouble(4, -9) + sigmaOffset);
105  glColor4d(0.0, 0.3, 1.0, 1.0);
106  DrawLine(sigma);
107 
108  glColor4d(0.0, 0.0, 0.0, 1.0);
109  DrawNodes();
110 }
111 
112 bool Sum::ShowForm(wxWindow* parent, Element* element)
113 {
114  SumForm* sumForm = new SumForm(parent, this);
115  if(sumForm->ShowModal() == wxID_OK) {
116  sumForm->Destroy();
117  return true;
118  }
119  sumForm->Destroy();
120  return false;
121 }
122 
123 void Sum::UpdatePoints()
124 {
125  if(m_angle == 0.0 || m_angle == 180.0) {
126  m_height = 18.0 * (m_nodeList.size() - 1);
127  m_width = 36.0;
128  } else {
129  m_width = 18.0 * (m_nodeList.size() - 1);
130  m_height = 42.0;
131  }
132 
133  for(int i = 0; i < (int)m_nodeList.size() - 1; ++i) {
134  if(m_angle == 0.0)
135  m_nodeList[i]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 9 + 18 * i - m_height / 2));
136  else if(m_angle == 90.0)
137  m_nodeList[i]->SetPosition(m_position + wxPoint2DDouble(m_width / 2 - 9 - 18 * i, -m_height / 2));
138  else if(m_angle == 180.0)
139  m_nodeList[i]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, m_height / 2 - 9 - 18 * i));
140  else if(m_angle == 270.0)
141  m_nodeList[i]->SetPosition(m_position + wxPoint2DDouble(9 + 18 * i - m_width / 2, m_height / 2));
142  }
143  if(m_angle == 0.0)
144  m_nodeList[m_nodeList.size() - 1]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
145  else if(m_angle == 90.0)
146  m_nodeList[m_nodeList.size() - 1]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
147  else if(m_angle == 180.0)
148  m_nodeList[m_nodeList.size() - 1]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
149  else if(m_angle == 270.0)
150  m_nodeList[m_nodeList.size() - 1]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
151 
152  SetPosition(m_position); // Update rect.
153 }
154 
155 void Sum::AddInNode()
156 {
157  Node* newNode = new Node(wxPoint2DDouble(0, 0), Node::NODE_IN, m_borderSize);
158  newNode->SetAngle(m_angle);
159  m_nodeList.insert(m_nodeList.end() - 1, newNode);
160 }
161 
162 void Sum::RemoveInNode()
163 {
164  Node* nodeToRemove = *(m_nodeList.end() - 2);
165  bool foundChild = false;
166  for(auto it = m_childList.begin(), itEnd = m_childList.end(); it != itEnd; ++it) {
167  ControlElement* child = static_cast<ControlElement*>(*it);
168  auto childNodeList = child->GetNodeList();
169  for(auto itN = childNodeList.begin(), itEndN = childNodeList.end(); itN != itEndN; ++itN) {
170  Node* node = *itN;
171  if(node == nodeToRemove) {
172  child->RemoveParent(this);
173  RemoveChild(child);
174  foundChild = true;
175  break;
176  }
177  }
178  if(foundChild) break;
179  }
180  m_nodeList.erase(m_nodeList.end() - 2);
181 }
182 
183 void Sum::Rotate(bool clockwise)
184 {
185  if(clockwise)
186  m_angle += 90.0;
187  else
188  m_angle -= 90.0;
189  if(m_angle >= 360.0)
190  m_angle = 0.0;
191  else if(m_angle < 0)
192  m_angle = 270.0;
193 
194  UpdatePoints();
195 
196  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
197  Node* node = *it;
198  node->Rotate(clockwise);
199  }
200 }
201 
202 bool Sum::Solve(double input, double timeStep)
203 {
204  std::vector<double> inputVector;
205  for(auto itN = m_nodeList.begin(), itNEnd = m_nodeList.end(); itN != itNEnd; ++itN) {
206  Node* node = *itN;
207  if(node->GetNodeType() != Node::NODE_OUT) {
208  if(!node->IsConnected()) {
209  inputVector.push_back(0.0);
210  } else {
211  for(auto itC = m_childList.begin(), itCEnd = m_childList.end(); itC != itCEnd; ++itC) {
212  ConnectionLine* cLine = static_cast<ConnectionLine*>(*itC);
213  auto nodeList = cLine->GetNodeList();
214  for(auto itCN = nodeList.begin(), itCNEnd = nodeList.end(); itCN != itCNEnd; ++itCN) {
215  Node* childNode = *itCN;
216  if(childNode == node) {
217  inputVector.push_back(cLine->GetValue());
218  break;
219  }
220  }
221  }
222  }
223  }
224  }
225 
226  if(m_signalList.size() != inputVector.size()) return false;
227 
228  m_output = 0.0;
229  for(unsigned int i = 0; i < m_signalList.size(); ++i) {
230  if(m_signalList[i] == SIGNAL_POSITIVE)
231  m_output += inputVector[i];
232  else if(m_signalList[i] == SIGNAL_NEGATIVE)
233  m_output -= inputVector[i];
234  }
235  return true;
236 }
237 
239 {
240  Sum* copy = new Sum(m_elementID);
241  *copy = *this;
242  return copy;
243 }
Form to edit the sum control data.
Definition: SumForm.h:32
+ +
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Sum.cpp:112
+
Definition: Sum.h:26
+
Node of a control element. This class manages the user interaction with the connection and control el...
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Sum.cpp:183
+ + +
virtual Element * GetCopy()
Get a the element copy.
Definition: Sum.cpp:238
+
Connection between two control elements or other connection line and an element.
+
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Element.h:359
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Sum.cpp:43
+
diff --git a/docs/doxygen/html/_sum_8h_source.html b/docs/doxygen/html/_sum_8h_source.html index 6b1f41c..bb4d08e 100644 --- a/docs/doxygen/html/_sum_8h_source.html +++ b/docs/doxygen/html/_sum_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,17 +88,18 @@ $(document).ready(function(){initNavTree('_sum_8h_source.html','');});
Sum.h
-
1 #ifndef SUM_H
2 #define SUM_H
3 
4 #include "ControlElement.h"
5 
6 class SumForm;
7 class ConnectionLine;
8 
9 class Sum : public ControlElement
10 {
11 public:
12  enum Signal { SIGNAL_POSITIVE = 0, SIGNAL_NEGATIVE };
13  Sum(int id);
14  ~Sum();
15 
16  virtual void Draw(wxPoint2DDouble translation, double scale) const;
17  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
18  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
19  virtual bool ShowForm(wxWindow* parent, Element* element);
20  virtual void Rotate(bool clockwise = true);
21 
22  virtual std::vector<Signal> GetSignalList() const { return m_signalList; }
23  virtual void SetSignalList(std::vector<Signal> signalList) { m_signalList = signalList; }
24 
25  virtual bool Solve(double input, double timeStep);
26 
27  virtual void UpdatePoints();
28  void AddInNode();
29  void RemoveInNode();
30 
31  virtual Element* GetCopy();
32 
33 protected:
34  std::vector<Signal> m_signalList;
35 };
36 
37 #endif // SUM_H
Definition: SumForm.h:8
- -
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Sum.cpp:95
-
Definition: Sum.h:9
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Sum.cpp:166
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Sum.h:17
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Sum.cpp:221
- -
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Sum.h:18
-
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Sum.cpp:26
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef SUM_H
19 #define SUM_H
20 
21 #include "ControlElement.h"
22 
23 class SumForm;
24 class ConnectionLine;
25 
26 class Sum : public ControlElement
27 {
28  public:
29  enum Signal { SIGNAL_POSITIVE = 0, SIGNAL_NEGATIVE };
30  Sum(int id);
31  ~Sum();
32 
33  virtual void Draw(wxPoint2DDouble translation, double scale) const;
34  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
35  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
36  virtual bool ShowForm(wxWindow* parent, Element* element);
37  virtual void Rotate(bool clockwise = true);
38 
39  virtual std::vector<Signal> GetSignalList() const { return m_signalList; }
40  virtual void SetSignalList(std::vector<Signal> signalList) { m_signalList = signalList; }
41  virtual bool Solve(double input, double timeStep);
42 
43  virtual void UpdatePoints();
44  void AddInNode();
45  void RemoveInNode();
46 
47  virtual Element* GetCopy();
48 
49  protected:
50  std::vector<Signal> m_signalList;
51 };
52 
53 #endif // SUM_H
Form to edit the sum control data.
Definition: SumForm.h:32
+ +
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Sum.cpp:112
+
Definition: Sum.h:26
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Sum.cpp:183
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Sum.h:34
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Sum.cpp:238
+
Connection between two control elements or other connection line and an element.
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Sum.h:35
+
Base class of a control element. Provide general methods to other control classes.
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Sum.cpp:43
+
diff --git a/docs/doxygen/html/_sum_form_8cpp_source.html b/docs/doxygen/html/_sum_form_8cpp_source.html index 16f9f33..9eb2483 100644 --- a/docs/doxygen/html/_sum_form_8cpp_source.html +++ b/docs/doxygen/html/_sum_form_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,7 +88,8 @@ $(document).ready(function(){initNavTree('_sum_form_8cpp_source.html','');});
SumForm.cpp
-
1 #include "SumForm.h"
2 #include "Sum.h"
3 
4 SumForm::SumForm(wxWindow* parent, Sum* sum)
5  : SumFormBase(parent)
6 {
7  SetSize(GetBestSize());
8 
9  m_parent = parent;
10  m_sum = sum;
11 
12  wxString signalStr = "";
13  auto signalList = m_sum->GetSignalList();
14  for(auto it = signalList.begin(), itEnd = signalList.end(); it != itEnd; ++it) {
15  Sum::Signal signal = *it;
16  switch(signal) {
17  case Sum::SIGNAL_POSITIVE: {
18  signalStr += "+";
19  } break;
20  case Sum::SIGNAL_NEGATIVE: {
21  signalStr += "-";
22  } break;
23  }
24  if(it != itEnd - 1) signalStr += " ";
25  }
26  m_textCtrlSigns->SetValue(signalStr);
27 }
28 
29 SumForm::~SumForm() {}
30 
31 void SumForm::OnOKClick(wxCommandEvent& event)
32 {
33  if(ValidateData()) EndModal(wxID_OK);
34 }
35 
36 bool SumForm::ValidateData()
37 {
38  wxString signalStr = "";
39  for(int i = 0; i < (int)m_textCtrlSigns->GetValue().length(); ++i) {
40  if(m_textCtrlSigns->GetValue()[i] != ' ') signalStr += m_textCtrlSigns->GetValue()[i];
41  }
42  if(signalStr.size() < 2){
43  wxMessageDialog msg(this, _("You must assign at least two signals."), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
44  msg.ShowModal();
45  return false;
46  }
47 
48  std::vector<Sum::Signal> signalList;
49  for(int i = 0; i < (int)signalStr.length(); ++i) {
50  switch(signalStr[i].GetValue()) {
51  case '+': {
52  signalList.push_back(Sum::SIGNAL_POSITIVE);
53  } break;
54  case '-': {
55  signalList.push_back(Sum::SIGNAL_NEGATIVE);
56  } break;
57  default: {
58  wxMessageDialog msg(this, _("Value entered incorrectly in the field \"Signs\"."), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
59  msg.ShowModal();
60  return false;
61  }
62  }
63  }
64 
65  int diff = (int)signalList.size() - (int)m_sum->GetSignalList().size();
66 
67  if(diff < 0) {
68  diff = std::abs(diff);
69  for(int i = 0; i < diff; ++i) {
70  m_sum->RemoveInNode();
71  }
72  } else if(diff > 0) {
73  for(int i = 0; i < diff; ++i) {
74  m_sum->AddInNode();
75  }
76  }
77  m_sum->SetSignalList(signalList);
78  m_sum->UpdatePoints();
79  return true;
80 }
Definition: Sum.h:9
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "SumForm.h"
19 #include "Sum.h"
20 
21 SumForm::SumForm(wxWindow* parent, Sum* sum) : SumFormBase(parent)
22 {
23  SetSize(GetBestSize());
24 
25  m_parent = parent;
26  m_sum = sum;
27 
28  wxString signalStr = "";
29  auto signalList = m_sum->GetSignalList();
30  for(auto it = signalList.begin(), itEnd = signalList.end(); it != itEnd; ++it) {
31  Sum::Signal signal = *it;
32  switch(signal) {
33  case Sum::SIGNAL_POSITIVE: {
34  signalStr += "+";
35  } break;
36  case Sum::SIGNAL_NEGATIVE: {
37  signalStr += "-";
38  } break;
39  }
40  if(it != itEnd - 1) signalStr += " ";
41  }
42  m_textCtrlSigns->SetValue(signalStr);
43 }
44 
45 SumForm::~SumForm() {}
46 void SumForm::OnOKClick(wxCommandEvent& event)
47 {
48  if(ValidateData()) EndModal(wxID_OK);
49 }
50 
51 bool SumForm::ValidateData()
52 {
53  wxString signalStr = "";
54  for(int i = 0; i < (int)m_textCtrlSigns->GetValue().length(); ++i) {
55  if(m_textCtrlSigns->GetValue()[i] != ' ') signalStr += m_textCtrlSigns->GetValue()[i];
56  }
57  if(signalStr.size() < 2) {
58  wxMessageDialog msg(this, _("You must assign at least two signals."), _("Error"),
59  wxOK | wxCENTRE | wxICON_ERROR);
60  msg.ShowModal();
61  return false;
62  }
63 
64  std::vector<Sum::Signal> signalList;
65  for(int i = 0; i < (int)signalStr.length(); ++i) {
66  switch(signalStr[i].GetValue()) {
67  case '+': {
68  signalList.push_back(Sum::SIGNAL_POSITIVE);
69  } break;
70  case '-': {
71  signalList.push_back(Sum::SIGNAL_NEGATIVE);
72  } break;
73  default: {
74  wxMessageDialog msg(this, _("Value entered incorrectly in the field \"Signs\"."), _("Error"),
75  wxOK | wxCENTRE | wxICON_ERROR);
76  msg.ShowModal();
77  return false;
78  }
79  }
80  }
81 
82  int diff = (int)signalList.size() - (int)m_sum->GetSignalList().size();
83 
84  if(diff < 0) {
85  diff = std::abs(diff);
86  for(int i = 0; i < diff; ++i) {
87  m_sum->RemoveInNode();
88  }
89  } else if(diff > 0) {
90  for(int i = 0; i < diff; ++i) {
91  m_sum->AddInNode();
92  }
93  }
94  m_sum->SetSignalList(signalList);
95  m_sum->UpdatePoints();
96  return true;
97 }
Definition: Sum.h:26
+
diff --git a/docs/doxygen/html/_sum_form_8h.html b/docs/doxygen/html/_sum_form_8h.html new file mode 100644 index 0000000..cd6a738 --- /dev/null +++ b/docs/doxygen/html/_sum_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/SumForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
SumForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  SumForm
 Form to edit the sum control data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_sum_form_8h_source.html b/docs/doxygen/html/_sum_form_8h_source.html index 701a141..6e71e39 100644 --- a/docs/doxygen/html/_sum_form_8h_source.html +++ b/docs/doxygen/html/_sum_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_sum_form_8h_source.html','');});
SumForm.h
-
1 #ifndef SUMFORM_H
2 #define SUMFORM_H
3 
4 #include "ElementForm.h"
5 
6 class Sum;
7 
8 class SumForm : public SumFormBase
9 {
10 public:
11  SumForm(wxWindow* parent, Sum* sum);
12  virtual ~SumForm();
13 
14  bool ValidateData();
15 
16 protected:
17  virtual void OnCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
18  virtual void OnOKClick(wxCommandEvent& event);
19  wxWindow* m_parent = NULL;
20  Sum* m_sum = NULL;
21 };
22 #endif // SUMFORM_H
Definition: SumForm.h:8
-
Definition: Sum.h:9
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef SUMFORM_H
19 #define SUMFORM_H
20 
21 #include "ElementForm.h"
22 
23 class Sum;
24 
32 class SumForm : public SumFormBase
33 {
34  public:
35  SumForm(wxWindow* parent, Sum* sum);
36  virtual ~SumForm();
37 
38  bool ValidateData();
39 
40  protected:
41  virtual void OnCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
42  virtual void OnOKClick(wxCommandEvent& event);
43  wxWindow* m_parent = NULL;
44  Sum* m_sum = NULL;
45 };
46 #endif // SUMFORM_H
Form to edit the sum control data.
Definition: SumForm.h:32
+
Definition: Sum.h:26
-
1 #include "SwitchingForm.h"
2 #include "PowerElement.h"
3 
4 SwitchingForm::SwitchingForm(wxWindow* parent) : SwitchingFormBase(parent)
5 {
6  m_listCtrlSwitchings->AppendColumn(_("Type"));
7  m_listCtrlSwitchings->AppendColumn(_("Time (s)"));
8 
9  SetSize(GetBestSize());
10  Layout();
11 }
12 
13 SwitchingForm::SwitchingForm(wxWindow* parent, PowerElement* element) : SwitchingFormBase(parent)
14 {
15  m_listCtrlSwitchings->AppendColumn(_("Type"));
16  m_listCtrlSwitchings->AppendColumn(_("Time (s)"));
17 
18  SetSize(GetBestSize());
19  Layout();
20 
21  SwitchingData data = element->GetSwitchingData();
22  for(int i = 0; i < (int)data.swType.size(); i++) {
23  long index = m_listCtrlSwitchings->InsertItem(m_maxID, data.swType[i] == SW_INSERT ? _("Insert") : _("Remove"));
24  m_listCtrlSwitchings->SetItem(index, 1, wxString::FromDouble(data.swTime[i]));
25  m_maxID++;
26  }
27 
28  m_element = element;
29 }
30 
31 SwitchingForm::~SwitchingForm() {}
32 void SwitchingForm::OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
33 void SwitchingForm::OnInsertButtonClick(wxCommandEvent& event)
34 {
35  long index = m_listCtrlSwitchings->InsertItem(
36  m_maxID, m_pgPropType->GetValue().GetInteger() == 0 ? _("Insert") : _("Remove"));
37  m_listCtrlSwitchings->SetItem(index, 1, m_pgPropTime->GetValue().GetString());
38  m_maxID++;
39 }
40 void SwitchingForm::OnOKButtonClick(wxCommandEvent& event)
41 {
42  std::vector<long> itemList;
43  long item = -1;
44  while(true) {
45  item = m_listCtrlSwitchings->GetNextItem(item);
46  if(item == -1) break;
47  itemList.push_back(item);
48  }
49 
50  SwitchingData data;
51  for(int i = 0; i < (int)itemList.size(); i++) {
52  if(m_listCtrlSwitchings->GetItemText(itemList[i], 0) == _("Insert"))
53  data.swType.push_back(SW_INSERT);
54  else
55  data.swType.push_back(SW_REMOVE);
56 
57  double swTime;
58  m_listCtrlSwitchings->GetItemText(itemList[i], 1).ToDouble(&swTime);
59  data.swTime.push_back(swTime);
60  }
61  m_element->SetSwitchingData(data);
62 
63  if(data.swTime.size() != 0)
64  m_element->SetDynamicEvent(true);
65  else
66  m_element->SetDynamicEvent(false);
67 
68  EndModal(wxID_OK);
69 }
70 
71 void SwitchingForm::OnRemoveButtonClick(wxCommandEvent& event)
72 {
73  std::vector<long> itemList;
74  long item = -1;
75  while(true) {
76  item = m_listCtrlSwitchings->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
77  if(item == -1) break;
78  itemList.push_back(item);
79  }
80  for(int i = (int)itemList.size() - 1; i >= 0; i--) {
81  m_listCtrlSwitchings->DeleteItem(itemList[i]);
82  }
83 }
84 void SwitchingForm::OnChangeProperties(wxPropertyGridEvent& event) {}
85 void SwitchingForm::OnSelectItem(wxListEvent& event) {}
86 void SwitchingForm::OnDownButtonClick(wxCommandEvent& event)
87 {
88  std::vector<long> selectedList;
89  std::vector<long> itemList;
90  long item = -1;
91  while(true) {
92  item = m_listCtrlSwitchings->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
93  if(item == -1) break;
94  selectedList.push_back(item);
95  }
96  while(true) {
97  item = m_listCtrlSwitchings->GetNextItem(item);
98  if(item == -1) break;
99  itemList.push_back(item);
100  }
101 
102  for(int i = 1; i < (int)itemList.size(); i++) {
103  for(int j = 0; j < (int)selectedList.size(); j++) {
104  if(itemList[i - 1] == selectedList[j]) {
105  wxString col1Str[2];
106  wxString col2Str[2];
107 
108  col1Str[0] = m_listCtrlSwitchings->GetItemText(itemList[i], 0);
109  col1Str[1] = m_listCtrlSwitchings->GetItemText(selectedList[j], 0);
110  col2Str[0] = m_listCtrlSwitchings->GetItemText(itemList[i], 1);
111  col2Str[1] = m_listCtrlSwitchings->GetItemText(selectedList[j], 1);
112 
113  m_listCtrlSwitchings->SetItem(itemList[i], 0, col1Str[1]);
114  m_listCtrlSwitchings->SetItem(selectedList[j], 0, col1Str[0]);
115  m_listCtrlSwitchings->SetItem(itemList[i], 1, col2Str[1]);
116  m_listCtrlSwitchings->SetItem(selectedList[j], 1, col2Str[0]);
117 
118  m_listCtrlSwitchings->SetItemState(itemList[i], wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
119  m_listCtrlSwitchings->SetItemState(selectedList[j], 0, wxLIST_STATE_SELECTED);
120 
121  i++;
122  break;
123  }
124  }
125  }
126 }
127 void SwitchingForm::OnUpButtonClick(wxCommandEvent& event)
128 {
129  std::vector<long> selectedList;
130  std::vector<long> itemList;
131  long item = -1;
132  while(true) {
133  item = m_listCtrlSwitchings->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
134  if(item == -1) break;
135  selectedList.push_back(item);
136  }
137  while(true) {
138  item = m_listCtrlSwitchings->GetNextItem(item);
139  if(item == -1) break;
140  itemList.push_back(item);
141  }
142 
143  for(int i = 0; i < (int)itemList.size(); i++) {
144  for(int j = 0; j < (int)selectedList.size(); j++) {
145  if(i + 1 < (int)itemList.size()) {
146  if(itemList[i + 1] == selectedList[j]) {
147  wxString col1Str[2];
148  wxString col2Str[2];
149 
150  col1Str[0] = m_listCtrlSwitchings->GetItemText(itemList[i], 0);
151  col1Str[1] = m_listCtrlSwitchings->GetItemText(selectedList[j], 0);
152  col2Str[0] = m_listCtrlSwitchings->GetItemText(itemList[i], 1);
153  col2Str[1] = m_listCtrlSwitchings->GetItemText(selectedList[j], 1);
154 
155  m_listCtrlSwitchings->SetItem(itemList[i], 0, col1Str[1]);
156  m_listCtrlSwitchings->SetItem(selectedList[j], 0, col1Str[0]);
157  m_listCtrlSwitchings->SetItem(itemList[i], 1, col2Str[1]);
158  m_listCtrlSwitchings->SetItem(selectedList[j], 1, col2Str[0]);
159 
160  m_listCtrlSwitchings->SetItemState(itemList[i], wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
161  m_listCtrlSwitchings->SetItemState(selectedList[j], 0, wxLIST_STATE_SELECTED);
162 
163  i++;
164  break;
165  }
166  }
167  }
168  }
169 }
std::vector< double > swTime
Definition: PowerElement.h:78
-
std::vector< SwitchingType > swType
Definition: PowerElement.h:77
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "SwitchingForm.h"
19 #include "PowerElement.h"
20 
21 SwitchingForm::SwitchingForm(wxWindow* parent) : SwitchingFormBase(parent)
22 {
23  m_listCtrlSwitchings->AppendColumn(_("Type"));
24  m_listCtrlSwitchings->AppendColumn(_("Time (s)"));
25 
26  SetSize(GetBestSize());
27  Layout();
28 }
29 
30 SwitchingForm::SwitchingForm(wxWindow* parent, PowerElement* element) : SwitchingFormBase(parent)
31 {
32  m_listCtrlSwitchings->AppendColumn(_("Type"));
33  m_listCtrlSwitchings->AppendColumn(_("Time (s)"));
34 
35  SetSize(GetBestSize());
36  Layout();
37 
38  SwitchingData data = element->GetSwitchingData();
39  for(int i = 0; i < (int)data.swType.size(); i++) {
40  long index = m_listCtrlSwitchings->InsertItem(m_maxID, data.swType[i] == SW_INSERT ? _("Insert") : _("Remove"));
41  m_listCtrlSwitchings->SetItem(index, 1, wxString::FromDouble(data.swTime[i]));
42  m_maxID++;
43  }
44 
45  m_element = element;
46 }
47 
48 SwitchingForm::~SwitchingForm() {}
49 void SwitchingForm::OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
50 void SwitchingForm::OnInsertButtonClick(wxCommandEvent& event)
51 {
52  long index = m_listCtrlSwitchings->InsertItem(
53  m_maxID, m_pgPropType->GetValue().GetInteger() == 0 ? _("Insert") : _("Remove"));
54  m_listCtrlSwitchings->SetItem(index, 1, m_pgPropTime->GetValue().GetString());
55  m_maxID++;
56 }
57 void SwitchingForm::OnOKButtonClick(wxCommandEvent& event)
58 {
59  std::vector<long> itemList;
60  long item = -1;
61  while(true) {
62  item = m_listCtrlSwitchings->GetNextItem(item);
63  if(item == -1) break;
64  itemList.push_back(item);
65  }
66 
67  SwitchingData data;
68  for(int i = 0; i < (int)itemList.size(); i++) {
69  if(m_listCtrlSwitchings->GetItemText(itemList[i], 0) == _("Insert"))
70  data.swType.push_back(SW_INSERT);
71  else
72  data.swType.push_back(SW_REMOVE);
73 
74  double swTime;
75  m_listCtrlSwitchings->GetItemText(itemList[i], 1).ToDouble(&swTime);
76  data.swTime.push_back(swTime);
77  }
78  m_element->SetSwitchingData(data);
79 
80  if(data.swTime.size() != 0)
81  m_element->SetDynamicEvent(true);
82  else
83  m_element->SetDynamicEvent(false);
84 
85  EndModal(wxID_OK);
86 }
87 
88 void SwitchingForm::OnRemoveButtonClick(wxCommandEvent& event)
89 {
90  std::vector<long> itemList;
91  long item = -1;
92  while(true) {
93  item = m_listCtrlSwitchings->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
94  if(item == -1) break;
95  itemList.push_back(item);
96  }
97  for(int i = (int)itemList.size() - 1; i >= 0; i--) {
98  m_listCtrlSwitchings->DeleteItem(itemList[i]);
99  }
100 }
101 void SwitchingForm::OnChangeProperties(wxPropertyGridEvent& event) {}
102 void SwitchingForm::OnSelectItem(wxListEvent& event) {}
103 void SwitchingForm::OnDownButtonClick(wxCommandEvent& event)
104 {
105  std::vector<long> selectedList;
106  std::vector<long> itemList;
107  long item = -1;
108  while(true) {
109  item = m_listCtrlSwitchings->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
110  if(item == -1) break;
111  selectedList.push_back(item);
112  }
113  while(true) {
114  item = m_listCtrlSwitchings->GetNextItem(item);
115  if(item == -1) break;
116  itemList.push_back(item);
117  }
118 
119  for(int i = 1; i < (int)itemList.size(); i++) {
120  for(int j = 0; j < (int)selectedList.size(); j++) {
121  if(itemList[i - 1] == selectedList[j]) {
122  wxString col1Str[2];
123  wxString col2Str[2];
124 
125  col1Str[0] = m_listCtrlSwitchings->GetItemText(itemList[i], 0);
126  col1Str[1] = m_listCtrlSwitchings->GetItemText(selectedList[j], 0);
127  col2Str[0] = m_listCtrlSwitchings->GetItemText(itemList[i], 1);
128  col2Str[1] = m_listCtrlSwitchings->GetItemText(selectedList[j], 1);
129 
130  m_listCtrlSwitchings->SetItem(itemList[i], 0, col1Str[1]);
131  m_listCtrlSwitchings->SetItem(selectedList[j], 0, col1Str[0]);
132  m_listCtrlSwitchings->SetItem(itemList[i], 1, col2Str[1]);
133  m_listCtrlSwitchings->SetItem(selectedList[j], 1, col2Str[0]);
134 
135  m_listCtrlSwitchings->SetItemState(itemList[i], wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
136  m_listCtrlSwitchings->SetItemState(selectedList[j], 0, wxLIST_STATE_SELECTED);
137 
138  i++;
139  break;
140  }
141  }
142  }
143 }
144 void SwitchingForm::OnUpButtonClick(wxCommandEvent& event)
145 {
146  std::vector<long> selectedList;
147  std::vector<long> itemList;
148  long item = -1;
149  while(true) {
150  item = m_listCtrlSwitchings->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
151  if(item == -1) break;
152  selectedList.push_back(item);
153  }
154  while(true) {
155  item = m_listCtrlSwitchings->GetNextItem(item);
156  if(item == -1) break;
157  itemList.push_back(item);
158  }
159 
160  for(int i = 0; i < (int)itemList.size(); i++) {
161  for(int j = 0; j < (int)selectedList.size(); j++) {
162  if(i + 1 < (int)itemList.size()) {
163  if(itemList[i + 1] == selectedList[j]) {
164  wxString col1Str[2];
165  wxString col2Str[2];
166 
167  col1Str[0] = m_listCtrlSwitchings->GetItemText(itemList[i], 0);
168  col1Str[1] = m_listCtrlSwitchings->GetItemText(selectedList[j], 0);
169  col2Str[0] = m_listCtrlSwitchings->GetItemText(itemList[i], 1);
170  col2Str[1] = m_listCtrlSwitchings->GetItemText(selectedList[j], 1);
171 
172  m_listCtrlSwitchings->SetItem(itemList[i], 0, col1Str[1]);
173  m_listCtrlSwitchings->SetItem(selectedList[j], 0, col1Str[0]);
174  m_listCtrlSwitchings->SetItem(itemList[i], 1, col2Str[1]);
175  m_listCtrlSwitchings->SetItem(selectedList[j], 1, col2Str[0]);
176 
177  m_listCtrlSwitchings->SetItemState(itemList[i], wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
178  m_listCtrlSwitchings->SetItemState(selectedList[j], 0, wxLIST_STATE_SELECTED);
179 
180  i++;
181  break;
182  }
183  }
184  }
185  }
186 }
std::vector< double > swTime
Definition: PowerElement.h:95
+
std::vector< SwitchingType > swType
Definition: PowerElement.h:94
+ - + +
Switching data of power elements.
-
virtual SwitchingData GetSwitchingData()
Returns the switching data of the element.
Definition: PowerElement.h:165
- - +
virtual SwitchingData GetSwitchingData()
Returns the switching data of the element.
Definition: PowerElement.h:182
+ +
diff --git a/docs/doxygen/html/_switching_form_8h.html b/docs/doxygen/html/_switching_form_8h.html new file mode 100644 index 0000000..473756f --- /dev/null +++ b/docs/doxygen/html/_switching_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/SwitchingForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
SwitchingForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  SwitchingForm
 Form to edit the switching data of power elements for electromechanical transient studies. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_switching_form_8h_source.html b/docs/doxygen/html/_switching_form_8h_source.html index 1a898bc..51cbf31 100644 --- a/docs/doxygen/html/_switching_form_8h_source.html +++ b/docs/doxygen/html/_switching_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_switching_form_8h_source.html','');})
SwitchingForm.h
-
1 #ifndef SWITCHINGFORM_H
2 #define SWITCHINGFORM_H
3 
4 #include "ElementForm.h"
5 
6 class PowerElement;
7 
9 {
10 public:
11  SwitchingForm(wxWindow* parent);
12  SwitchingForm(wxWindow* parent, PowerElement* element);
13  virtual ~SwitchingForm();
14 protected:
15  virtual void OnDownButtonClick(wxCommandEvent& event);
16  virtual void OnUpButtonClick(wxCommandEvent& event);
17  virtual void OnChangeProperties(wxPropertyGridEvent& event);
18  virtual void OnSelectItem(wxListEvent& event);
19  virtual void OnCancelButtonClick(wxCommandEvent& event);
20  virtual void OnInsertButtonClick(wxCommandEvent& event);
21  virtual void OnOKButtonClick(wxCommandEvent& event);
22  virtual void OnRemoveButtonClick(wxCommandEvent& event);
23 
24  int m_maxID = 0;
25 
26  PowerElement* m_element = NULL;
27 };
28 #endif // SWITCHINGFORM_H
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef SWITCHINGFORM_H
19 #define SWITCHINGFORM_H
20 
21 #include "ElementForm.h"
22 
23 class PowerElement;
24 
33 {
34  public:
35  SwitchingForm(wxWindow* parent);
36  SwitchingForm(wxWindow* parent, PowerElement* element);
37  virtual ~SwitchingForm();
38 
39  protected:
40  virtual void OnDownButtonClick(wxCommandEvent& event);
41  virtual void OnUpButtonClick(wxCommandEvent& event);
42  virtual void OnChangeProperties(wxPropertyGridEvent& event);
43  virtual void OnSelectItem(wxListEvent& event);
44  virtual void OnCancelButtonClick(wxCommandEvent& event);
45  virtual void OnInsertButtonClick(wxCommandEvent& event);
46  virtual void OnOKButtonClick(wxCommandEvent& event);
47  virtual void OnRemoveButtonClick(wxCommandEvent& event);
48 
49  int m_maxID = 0;
50 
51  PowerElement* m_element = NULL;
52 };
53 #endif // SWITCHINGFORM_H
Form to edit the switching data of power elements for electromechanical transient studies...
Definition: SwitchingForm.h:32
- +
-
1 #include "SyncMachineForm.h"
2 #include "SyncGenerator.h"
3 #include "ControlElementContainer.h"
4 
5 SyncGenerator::SyncGenerator() : Machines() { Init(); }
6 SyncGenerator::SyncGenerator(wxString name) : Machines()
7 {
8  Init();
9  m_electricalData.name = name;
10 }
11 
12 SyncGenerator::~SyncGenerator() {}
13 void SyncGenerator::Init()
14 {
15  int numPtsSine = 10;
16  double mx = 15.0;
17  double my = 10.0;
18  double pi = 3.14159265359;
19 
20  for(int i = 0; i <= numPtsSine; i++) {
21  double x = (2.0 * pi / double(numPtsSine)) * double(i) - pi;
22  double y = std::sin(x);
23  m_sinePts.push_back(wxPoint2DDouble((x / pi) * mx, y * my));
24  }
25 
26  m_electricalData.avr = new ControlElementContainer();
27  m_electricalData.speedGov = new ControlElementContainer();
28 }
29 
30 void SyncGenerator::DrawSymbol() const
31 {
32  // Draw sine.
33  std::vector<wxPoint2DDouble> sinePts;
34  for(int i = 0; i < (int)m_sinePts.size(); i++) {
35  sinePts.push_back(m_sinePts[i] + m_position);
36  }
37  DrawLine(sinePts);
38 }
40 {
41  menu.Append(ID_EDIT_ELEMENT, _("Edit Generator"));
42  GeneralMenuItens(menu);
43  return true;
44 }
45 
46 bool SyncGenerator::ShowForm(wxWindow* parent, Element* element)
47 {
48  SyncMachineForm* generatorForm = new SyncMachineForm(parent, this);
49  generatorForm->SetTitle(_("Generator"));
50  if(generatorForm->ShowModal() == wxID_OK) {
51  generatorForm->Destroy();
52  return true;
53  }
54 
55  generatorForm->Destroy();
56  return false;
57 }
58 
59 SyncGeneratorElectricalData SyncGenerator::GetPUElectricalData(double systemPowerBase)
60 {
61  SyncGeneratorElectricalData data = m_electricalData;
62  double machineBasePower = 1.0;
63  if(data.useMachineBase) {
64  machineBasePower = GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
65  }
66 
67  // Active power
68  double activePower = GetValueFromUnit(data.activePower, data.activePowerUnit);
69  if(!m_online) activePower = 0.0;
70  if(data.activePowerUnit == UNIT_PU) {
71  if(data.useMachineBase) data.activePower = (activePower * machineBasePower) / systemPowerBase;
72  } else {
73  data.activePower = activePower / systemPowerBase;
74  }
75  data.activePowerUnit = UNIT_PU;
76 
77  // Reactive power
78  double reactivePower = GetValueFromUnit(data.reactivePower, data.reactivePowerUnit);
79  if(!m_online) reactivePower = 0.0;
80  if(data.reactivePowerUnit == UNIT_PU) {
81  if(data.useMachineBase) data.reactivePower = (reactivePower * machineBasePower) / systemPowerBase;
82  } else {
83  data.reactivePower = reactivePower / systemPowerBase;
84  }
85  data.reactivePowerUnit = UNIT_PU;
86 
87  // Max reactive power
88  double maxReactive = GetValueFromUnit(data.maxReactive, data.maxReactiveUnit);
89  if(data.maxReactiveUnit == UNIT_PU) {
90  if(data.useMachineBase) data.maxReactive = (maxReactive * machineBasePower) / systemPowerBase;
91  } else {
92  data.maxReactive = maxReactive / systemPowerBase;
93  }
94  data.maxReactiveUnit = UNIT_PU;
95 
96  // Min reactive power
97  double minReactive = GetValueFromUnit(data.minReactive, data.minReactiveUnit);
98  if(data.minReactiveUnit == UNIT_PU) {
99  if(data.useMachineBase) data.minReactive = (minReactive * machineBasePower) / systemPowerBase;
100  } else {
101  data.minReactive = minReactive / systemPowerBase;
102  }
103  data.minReactiveUnit = UNIT_PU;
104 
105  double baseVoltage = GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
106  double systemBaseImpedance = (baseVoltage * baseVoltage) / systemPowerBase;
107  double machineBaseImpedance = (baseVoltage * baseVoltage) / machineBasePower;
108 
109  // Fault data
110  if(data.useMachineBase) {
111  data.positiveResistance = (data.positiveResistance * machineBaseImpedance) / systemBaseImpedance;
112  data.positiveReactance = (data.positiveReactance * machineBaseImpedance) / systemBaseImpedance;
113  data.negativeResistance = (data.negativeResistance * machineBaseImpedance) / systemBaseImpedance;
114  data.negativeReactance = (data.negativeReactance * machineBaseImpedance) / systemBaseImpedance;
115  data.zeroResistance = (data.zeroResistance * machineBaseImpedance) / systemBaseImpedance;
116  data.zeroReactance = (data.zeroReactance * machineBaseImpedance) / systemBaseImpedance;
117  data.groundResistance = (data.groundResistance * machineBaseImpedance) / systemBaseImpedance;
118  data.groundReactance = (data.groundReactance * machineBaseImpedance) / systemBaseImpedance;
119  }
120 
121  if(!m_online) {
122  data.faultCurrent[0] = std::complex<double>(0, 0);
123  data.faultCurrent[1] = std::complex<double>(0, 0);
124  data.faultCurrent[2] = std::complex<double>(0, 0);
125  }
126 
127  return data;
128 }
129 
130 void SyncGenerator::SetNominalVoltage(std::vector<double> nominalVoltage,
131  std::vector<ElectricalUnit> nominalVoltageUnit)
132 {
133  if(nominalVoltage.size() > 0) {
134  m_electricalData.nominalVoltage = nominalVoltage[0];
135  m_electricalData.nominalVoltageUnit = nominalVoltageUnit[0];
136  }
137 }
138 
140 {
141  SyncGenerator* copy = new SyncGenerator();
142  *copy = *this;
143  auto data = copy->GetElectricalData();
144 
145  // Copy AVR
146  std::vector<ConnectionLine*> cLineList;
147  std::vector<ControlElement*> elementList;
148  m_electricalData.avr->GetContainerCopy(elementList, cLineList);
149 
151  avrCopy->FillContainer(elementList, cLineList);
152  data.avr = avrCopy;
153 
154  // Copy Speed Governor
155  cLineList.clear();
156  elementList.clear();
157  m_electricalData.speedGov->GetContainerCopy(elementList, cLineList);
158 
159  ControlElementContainer* speedGovCopy = new ControlElementContainer();
160  speedGovCopy->FillContainer(elementList, cLineList);
161  data.speedGov = speedGovCopy;
162 
163  copy->SetElectricalData(data);
164  return copy;
165 }
166 
168 {
169  wxString tipText = m_electricalData.name;
170  tipText += "\n";
171  double activePower = m_electricalData.activePower;
172  if(!m_online) activePower = 0.0;
173  tipText += _("\nP = ") + wxString::FromDouble(activePower, 5);
174  switch(m_electricalData.activePowerUnit) {
175  case UNIT_PU: {
176  tipText += _(" p.u.");
177  } break;
178  case UNIT_W: {
179  tipText += _(" W");
180  } break;
181  case UNIT_kW: {
182  tipText += _(" kW");
183  } break;
184  case UNIT_MW: {
185  tipText += _(" MW");
186  } break;
187  default:
188  break;
189  }
190  double reactivePower = m_electricalData.reactivePower;
191  if(!m_online) reactivePower = 0.0;
192  tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
193  switch(m_electricalData.reactivePowerUnit) {
194  case UNIT_PU: {
195  tipText += _(" p.u.");
196  } break;
197  case UNIT_VAr: {
198  tipText += _(" VAr");
199  } break;
200  case UNIT_kVAr: {
201  tipText += _(" kVAr");
202  } break;
203  case UNIT_MVAr: {
204  tipText += _(" MVAr");
205  } break;
206  default:
207  break;
208  }
209 
210  return tipText;
211 }
212 
214 {
215  if(!m_electricalData.plotSyncMachine) return false;
216  plotData.SetName(m_electricalData.name);
217  plotData.SetCurveType(ElementPlotData::CT_SYNC_GENERATOR);
218 
219  std::vector<double> absTerminalVoltage, activePower, reactivePower;
220  for(unsigned int i = 0; i < m_electricalData.terminalVoltageVector.size(); ++i) {
221  absTerminalVoltage.push_back(std::abs(m_electricalData.terminalVoltageVector[i]));
222  activePower.push_back(std::real(m_electricalData.electricalPowerVector[i]));
223  reactivePower.push_back(std::imag(m_electricalData.electricalPowerVector[i]));
224  }
225  plotData.AddData(absTerminalVoltage, _("Terminal voltage"));
226  plotData.AddData(activePower, _("Active power"));
227  plotData.AddData(reactivePower, _("Reactive power"));
228  plotData.AddData(m_electricalData.mechanicalPowerVector, _("Mechanical power"));
229  plotData.AddData(m_electricalData.freqVector, _("Frequency"));
230  plotData.AddData(m_electricalData.fieldVoltageVector, _("Field voltage"));
231  plotData.AddData(m_electricalData.deltaVector, _("Delta"));
232  return true;
233 }
- - -
virtual bool GetPlotData(ElementPlotData &plotData)
Fill the plot data.
- - - - - -
virtual Element * GetCopy()
Get a the element copy.
- - -
virtual wxString GetTipText() const
Get the tip text.
- -
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
- -
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
- -
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
- - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "SyncMachineForm.h"
19 #include "SyncGenerator.h"
21 
22 SyncGenerator::SyncGenerator() : Machines() { Init(); }
23 SyncGenerator::SyncGenerator(wxString name) : Machines()
24 {
25  Init();
26  m_electricalData.name = name;
27 }
28 
29 SyncGenerator::~SyncGenerator() {}
30 void SyncGenerator::Init()
31 {
32  int numPtsSine = 10;
33  double mx = 15.0;
34  double my = 10.0;
35  double pi = 3.14159265359;
36 
37  for(int i = 0; i <= numPtsSine; i++) {
38  double x = (2.0 * pi / double(numPtsSine)) * double(i) - pi;
39  double y = std::sin(x);
40  m_sinePts.push_back(wxPoint2DDouble((x / pi) * mx, y * my));
41  }
42 
43  m_electricalData.avr = new ControlElementContainer();
44  m_electricalData.speedGov = new ControlElementContainer();
45 }
46 
47 void SyncGenerator::DrawSymbol() const
48 {
49  // Draw sine.
50  std::vector<wxPoint2DDouble> sinePts;
51  for(int i = 0; i < (int)m_sinePts.size(); i++) {
52  sinePts.push_back(m_sinePts[i] + m_position);
53  }
54  DrawLine(sinePts);
55 }
57 {
58  menu.Append(ID_EDIT_ELEMENT, _("Edit Generator"));
59  GeneralMenuItens(menu);
60  return true;
61 }
62 
63 bool SyncGenerator::ShowForm(wxWindow* parent, Element* element)
64 {
65  SyncMachineForm* generatorForm = new SyncMachineForm(parent, this);
66  generatorForm->SetTitle(_("Generator"));
67  if(generatorForm->ShowModal() == wxID_OK) {
68  generatorForm->Destroy();
69  return true;
70  }
71 
72  generatorForm->Destroy();
73  return false;
74 }
75 
76 SyncGeneratorElectricalData SyncGenerator::GetPUElectricalData(double systemPowerBase)
77 {
78  SyncGeneratorElectricalData data = m_electricalData;
79  double machineBasePower = 1.0;
80  if(data.useMachineBase) {
81  machineBasePower = GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
82  }
83 
84  // Active power
85  double activePower = GetValueFromUnit(data.activePower, data.activePowerUnit);
86  if(!m_online) activePower = 0.0;
87  if(data.activePowerUnit == UNIT_PU) {
88  if(data.useMachineBase) data.activePower = (activePower * machineBasePower) / systemPowerBase;
89  } else {
90  data.activePower = activePower / systemPowerBase;
91  }
92  data.activePowerUnit = UNIT_PU;
93 
94  // Reactive power
95  double reactivePower = GetValueFromUnit(data.reactivePower, data.reactivePowerUnit);
96  if(!m_online) reactivePower = 0.0;
97  if(data.reactivePowerUnit == UNIT_PU) {
98  if(data.useMachineBase) data.reactivePower = (reactivePower * machineBasePower) / systemPowerBase;
99  } else {
100  data.reactivePower = reactivePower / systemPowerBase;
101  }
102  data.reactivePowerUnit = UNIT_PU;
103 
104  // Max reactive power
105  double maxReactive = GetValueFromUnit(data.maxReactive, data.maxReactiveUnit);
106  if(data.maxReactiveUnit == UNIT_PU) {
107  if(data.useMachineBase) data.maxReactive = (maxReactive * machineBasePower) / systemPowerBase;
108  } else {
109  data.maxReactive = maxReactive / systemPowerBase;
110  }
111  data.maxReactiveUnit = UNIT_PU;
112 
113  // Min reactive power
114  double minReactive = GetValueFromUnit(data.minReactive, data.minReactiveUnit);
115  if(data.minReactiveUnit == UNIT_PU) {
116  if(data.useMachineBase) data.minReactive = (minReactive * machineBasePower) / systemPowerBase;
117  } else {
118  data.minReactive = minReactive / systemPowerBase;
119  }
120  data.minReactiveUnit = UNIT_PU;
121 
122  double baseVoltage = GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
123  double systemBaseImpedance = (baseVoltage * baseVoltage) / systemPowerBase;
124  double machineBaseImpedance = (baseVoltage * baseVoltage) / machineBasePower;
125 
126  // Fault data
127  if(data.useMachineBase) {
128  data.positiveResistance = (data.positiveResistance * machineBaseImpedance) / systemBaseImpedance;
129  data.positiveReactance = (data.positiveReactance * machineBaseImpedance) / systemBaseImpedance;
130  data.negativeResistance = (data.negativeResistance * machineBaseImpedance) / systemBaseImpedance;
131  data.negativeReactance = (data.negativeReactance * machineBaseImpedance) / systemBaseImpedance;
132  data.zeroResistance = (data.zeroResistance * machineBaseImpedance) / systemBaseImpedance;
133  data.zeroReactance = (data.zeroReactance * machineBaseImpedance) / systemBaseImpedance;
134  data.groundResistance = (data.groundResistance * machineBaseImpedance) / systemBaseImpedance;
135  data.groundReactance = (data.groundReactance * machineBaseImpedance) / systemBaseImpedance;
136  }
137 
138  if(!m_online) {
139  data.faultCurrent[0] = std::complex<double>(0, 0);
140  data.faultCurrent[1] = std::complex<double>(0, 0);
141  data.faultCurrent[2] = std::complex<double>(0, 0);
142  }
143 
144  return data;
145 }
146 
147 void SyncGenerator::SetNominalVoltage(std::vector<double> nominalVoltage,
148  std::vector<ElectricalUnit> nominalVoltageUnit)
149 {
150  if(nominalVoltage.size() > 0) {
151  m_electricalData.nominalVoltage = nominalVoltage[0];
152  m_electricalData.nominalVoltageUnit = nominalVoltageUnit[0];
153  }
154 }
155 
157 {
158  SyncGenerator* copy = new SyncGenerator();
159  *copy = *this;
160  auto data = copy->GetElectricalData();
161 
162  // Copy AVR
163  std::vector<ConnectionLine*> cLineList;
164  std::vector<ControlElement*> elementList;
165  m_electricalData.avr->GetContainerCopy(elementList, cLineList);
166 
168  avrCopy->FillContainer(elementList, cLineList);
169  data.avr = avrCopy;
170 
171  // Copy Speed Governor
172  cLineList.clear();
173  elementList.clear();
174  m_electricalData.speedGov->GetContainerCopy(elementList, cLineList);
175 
176  ControlElementContainer* speedGovCopy = new ControlElementContainer();
177  speedGovCopy->FillContainer(elementList, cLineList);
178  data.speedGov = speedGovCopy;
179 
180  copy->SetElectricalData(data);
181  return copy;
182 }
183 
185 {
186  wxString tipText = m_electricalData.name;
187  tipText += "\n";
188  double activePower = m_electricalData.activePower;
189  if(!m_online) activePower = 0.0;
190  tipText += _("\nP = ") + wxString::FromDouble(activePower, 5);
191  switch(m_electricalData.activePowerUnit) {
192  case UNIT_PU: {
193  tipText += _(" p.u.");
194  } break;
195  case UNIT_W: {
196  tipText += _(" W");
197  } break;
198  case UNIT_kW: {
199  tipText += _(" kW");
200  } break;
201  case UNIT_MW: {
202  tipText += _(" MW");
203  } break;
204  default:
205  break;
206  }
207  double reactivePower = m_electricalData.reactivePower;
208  if(!m_online) reactivePower = 0.0;
209  tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
210  switch(m_electricalData.reactivePowerUnit) {
211  case UNIT_PU: {
212  tipText += _(" p.u.");
213  } break;
214  case UNIT_VAr: {
215  tipText += _(" VAr");
216  } break;
217  case UNIT_kVAr: {
218  tipText += _(" kVAr");
219  } break;
220  case UNIT_MVAr: {
221  tipText += _(" MVAr");
222  } break;
223  default:
224  break;
225  }
226 
227  return tipText;
228 }
229 
231 {
232  if(!m_electricalData.plotSyncMachine) return false;
233  plotData.SetName(m_electricalData.name);
234  plotData.SetCurveType(ElementPlotData::CT_SYNC_GENERATOR);
235 
236  std::vector<double> absTerminalVoltage, activePower, reactivePower;
237  for(unsigned int i = 0; i < m_electricalData.terminalVoltageVector.size(); ++i) {
238  absTerminalVoltage.push_back(std::abs(m_electricalData.terminalVoltageVector[i]));
239  activePower.push_back(std::real(m_electricalData.electricalPowerVector[i]));
240  reactivePower.push_back(std::imag(m_electricalData.electricalPowerVector[i]));
241  }
242  plotData.AddData(absTerminalVoltage, _("Terminal voltage"));
243  plotData.AddData(activePower, _("Active power"));
244  plotData.AddData(reactivePower, _("Reactive power"));
245  plotData.AddData(m_electricalData.mechanicalPowerVector, _("Mechanical power"));
246  plotData.AddData(m_electricalData.freqVector, _("Frequency"));
247  plotData.AddData(m_electricalData.fieldVoltageVector, _("Field voltage"));
248  plotData.AddData(m_electricalData.deltaVector, _("Delta"));
249  return true;
250 }
+ + + +
virtual bool GetPlotData(ElementPlotData &plotData)
Fill the plot data.
+ + + + +
Form to edit the synchronous machine power data.
+
virtual Element * GetCopy()
Get a the element copy.
+ + +
virtual wxString GetTipText() const
Get the tip text.
+ +
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
+
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
+ +
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
+ +
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
+ +
diff --git a/docs/doxygen/html/_sync_generator_8h_source.html b/docs/doxygen/html/_sync_generator_8h_source.html index 6453d66..8e16b85 100644 --- a/docs/doxygen/html/_sync_generator_8h_source.html +++ b/docs/doxygen/html/_sync_generator_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,20 +88,20 @@ $(document).ready(function(){initNavTree('_sync_generator_8h_source.html','');})
SyncGenerator.h
-
1 #ifndef SYNCGENERATOR_H
2 #define SYNCGENERATOR_H
3 
4 #include "Machines.h"
5 
6 class SyncMachineForm;
7 
9  // General
10  wxString name = "";
11  double nominalPower = 100.0;
12  ElectricalUnit nominalPowerUnit = UNIT_MVA;
13  double nominalVoltage = 13.8;
14  ElectricalUnit nominalVoltageUnit = UNIT_kV;
15  double activePower = 100.0;
16  ElectricalUnit activePowerUnit = UNIT_MW;
17  double reactivePower = 0.0;
18  ElectricalUnit reactivePowerUnit = UNIT_MVAr;
19  bool haveMaxReactive = false;
20  double maxReactive = 9999.0;
21  ElectricalUnit maxReactiveUnit = UNIT_MVAr;
22  bool haveMinReactive = false;
23  double minReactive = -9999.0;
24  ElectricalUnit minReactiveUnit = UNIT_MVAr;
25  bool useMachineBase = true;
26 
27  // Fault
28  double positiveResistance = 0.0;
29  double positiveReactance = 1.0;
30  double negativeResistance = 0.0;
31  double negativeReactance = 1.0;
32  double zeroResistance = 0.0;
33  double zeroReactance = 1.0;
34  double groundResistance = 0.0;
35  double groundReactance = 0.0;
36  bool groundNeutral = true;
37  // p.u. fault data
38  std::complex<double> faultCurrent[3] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
39  std::complex<double>(0.0, 0.0)};
40 
41  // Stability
42  bool plotSyncMachine = false;
43  double inertia = 1.0;
44  double damping = 0.0;
45  bool useAVR = false;
46  bool useSpeedGovernor = false;
47 
48  double armResistance = 0.0;
49  double potierReactance = 0.0;
50  double satFactor = 0.0;
51 
52  double syncXd = 0.0;
53  double syncXq = 0.0;
54  double transXd = 1.0;
55  double transXq = 0.0;
56  double transTd0 = 0.0;
57  double transTq0 = 0.0;
58  double subXd = 0.0;
59  double subXq = 0.0;
60  double subTd0 = 0.0;
61  double subTq0 = 0.0;
62 
63  // Machine state variables
64  std::complex<double> terminalVoltage;
65  std::vector<std::complex<double> > terminalVoltageVector;
66  std::complex<double> electricalPower;
67  std::vector<std::complex<double> > electricalPowerVector;
68  double pm;
69  std::vector<double> mechanicalPowerVector;
70  double speed;
71  std::vector<double> freqVector;
72  double fieldVoltage;
73  std::vector<double> fieldVoltageVector;
74  double delta;
75  std::vector<double> deltaVector;
76 
77  double initialFieldVoltage;
78 
79  // Internal machine variables
80  double tranEq;
81  double tranEd;
82  double subEq;
83  double subEd;
84  double pe;
85 
86  // Variables to extrapolate
87  double oldId;
88  double oldIq;
89  double oldPe;
90 
91  // Integration constants
92  IntegrationConstant icSpeed;
93  IntegrationConstant icDelta;
94  IntegrationConstant icTranEq;
95  IntegrationConstant icTranEd;
96  IntegrationConstant icSubEq;
97  IntegrationConstant icSubEd;
98 
99  // Control
100  ControlElementContainer* avr = NULL;
101  ControlElementContainer* speedGov = NULL;
102 
103  // Control solvers
104  ControlElementSolver* avrSolver = NULL;
105  ControlElementSolver* speedGovSolver = NULL;
106 
107  Machines::SyncMachineModel model = Machines::SM_MODEL_1;
108 };
109 
110 class SyncGenerator : public Machines
111 {
112  public:
113  SyncGenerator();
114  SyncGenerator(wxString name);
115  ~SyncGenerator();
116 
117  virtual Element* GetCopy();
118  virtual void Init();
119  virtual void DrawSymbol() const;
120  virtual bool GetContextMenu(wxMenu& menu);
121  virtual bool ShowForm(wxWindow* parent, Element* element);
122  virtual wxString GetTipText() const;
123  virtual SyncGeneratorElectricalData GetElectricalData() { return m_electricalData; }
124  virtual SyncGeneratorElectricalData GetPUElectricalData(double systemPowerBase);
125  virtual void SetElectricalData(SyncGeneratorElectricalData electricalData) { m_electricalData = electricalData; }
126  virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
127  virtual bool GetPlotData(ElementPlotData& plotData);
128 
129  protected:
130  std::vector<wxPoint2DDouble> m_sinePts;
131 
132  SyncGeneratorElectricalData m_electricalData;
133 };
134 
135 #endif // SYNCGENERATOR_H
- - - - - -
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
- - - - - - - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef SYNCGENERATOR_H
19 #define SYNCGENERATOR_H
20 
21 #include "Machines.h"
22 
23 class SyncMachineForm;
24 
26  // General
27  wxString name = "";
28  double nominalPower = 100.0;
29  ElectricalUnit nominalPowerUnit = UNIT_MVA;
30  double nominalVoltage = 13.8;
31  ElectricalUnit nominalVoltageUnit = UNIT_kV;
32  double activePower = 100.0;
33  ElectricalUnit activePowerUnit = UNIT_MW;
34  double reactivePower = 0.0;
35  ElectricalUnit reactivePowerUnit = UNIT_MVAr;
36  bool haveMaxReactive = false;
37  double maxReactive = 9999.0;
38  ElectricalUnit maxReactiveUnit = UNIT_MVAr;
39  bool haveMinReactive = false;
40  double minReactive = -9999.0;
41  ElectricalUnit minReactiveUnit = UNIT_MVAr;
42  bool useMachineBase = true;
43 
44  // Fault
45  double positiveResistance = 0.0;
46  double positiveReactance = 1.0;
47  double negativeResistance = 0.0;
48  double negativeReactance = 1.0;
49  double zeroResistance = 0.0;
50  double zeroReactance = 1.0;
51  double groundResistance = 0.0;
52  double groundReactance = 0.0;
53  bool groundNeutral = true;
54  // p.u. fault data
55  std::complex<double> faultCurrent[3] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
56  std::complex<double>(0.0, 0.0)};
57 
58  // Stability
59  bool plotSyncMachine = false;
60  double inertia = 1.0;
61  double damping = 0.0;
62  bool useAVR = false;
63  bool useSpeedGovernor = false;
64 
65  double armResistance = 0.0;
66  double potierReactance = 0.0;
67  double satFactor = 0.0;
68 
69  double syncXd = 0.0;
70  double syncXq = 0.0;
71  double transXd = 1.0;
72  double transXq = 0.0;
73  double transTd0 = 0.0;
74  double transTq0 = 0.0;
75  double subXd = 0.0;
76  double subXq = 0.0;
77  double subTd0 = 0.0;
78  double subTq0 = 0.0;
79 
80  // Machine state variables
81  std::complex<double> terminalVoltage;
82  std::vector<std::complex<double> > terminalVoltageVector;
83  std::complex<double> electricalPower;
84  std::vector<std::complex<double> > electricalPowerVector;
85  double pm;
86  std::vector<double> mechanicalPowerVector;
87  double speed;
88  std::vector<double> freqVector;
89  double fieldVoltage;
90  std::vector<double> fieldVoltageVector;
91  double delta;
92  std::vector<double> deltaVector;
93 
94  double initialFieldVoltage;
95 
96  // Internal machine variables
97  double tranEq;
98  double tranEd;
99  double subEq;
100  double subEd;
101  double pe;
102  double id;
103  double iq;
104  double sd;
105  double sq;
106 
107  // Variables to extrapolate
108  double oldId;
109  double oldIq;
110  double oldPe;
111  double oldSd;
112  double oldSq;
113 
114  // Integration constants
115  IntegrationConstant icSpeed;
116  IntegrationConstant icDelta;
117  IntegrationConstant icTranEq;
118  IntegrationConstant icTranEd;
119  IntegrationConstant icSubEq;
120  IntegrationConstant icSubEd;
121 
122  // Control
123  ControlElementContainer* avr = NULL;
124  ControlElementContainer* speedGov = NULL;
125 
126  // Control solvers
127  ControlElementSolver* avrSolver = NULL;
128  ControlElementSolver* speedGovSolver = NULL;
129 
130  Machines::SyncMachineModel model = Machines::SM_MODEL_1;
131 };
132 
133 class SyncGenerator : public Machines
134 {
135  public:
136  SyncGenerator();
137  SyncGenerator(wxString name);
138  ~SyncGenerator();
139 
140  virtual Element* GetCopy();
141  virtual void Init();
142  virtual void DrawSymbol() const;
143  virtual bool GetContextMenu(wxMenu& menu);
144  virtual bool ShowForm(wxWindow* parent, Element* element);
145  virtual wxString GetTipText() const;
146  virtual SyncGeneratorElectricalData GetElectricalData() { return m_electricalData; }
147  virtual SyncGeneratorElectricalData GetPUElectricalData(double systemPowerBase);
148  virtual void SetElectricalData(SyncGeneratorElectricalData electricalData) { m_electricalData = electricalData; }
149  virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
150  virtual bool GetPlotData(ElementPlotData& plotData);
151 
152  protected:
153  std::vector<wxPoint2DDouble> m_sinePts;
154 
155  SyncGeneratorElectricalData m_electricalData;
156 };
157 
158 #endif // SYNCGENERATOR_H
+ +
Solves in the time the control system. Can solve the control system directly from a ControlEditor or ...
+ + + +
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+ +
Form to edit the synchronous machine power data.
+ + + +
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
+
diff --git a/docs/doxygen/html/_sync_machine_form_8cpp_source.html b/docs/doxygen/html/_sync_machine_form_8cpp_source.html index d780763..cf10a40 100644 --- a/docs/doxygen/html/_sync_machine_form_8cpp_source.html +++ b/docs/doxygen/html/_sync_machine_form_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,23 +88,25 @@ $(document).ready(function(){initNavTree('_sync_machine_form_8cpp_source.html','
SyncMachineForm.cpp
-
1 #include "GeneratorStabForm.h"
2 #include "SyncMachineForm.h"
3 #include "SyncGenerator.h"
4 #include "SyncMotor.h"
5 
6 SyncMachineForm::SyncMachineForm(wxWindow* parent, SyncGenerator* syncGenerator) : SyncMachineFormBase(parent)
7 {
8  SetSize(GetBestSize());
9  ReplaceStaticTextLabelChar(m_staticTextPosResistance, L'\u2081');
10  ReplaceStaticTextLabelChar(m_staticTextPosReactance, L'\u2081');
11  ReplaceStaticTextLabelChar(m_staticTextNegResistance, L'\u2082');
12  ReplaceStaticTextLabelChar(m_staticTextNegReactance, L'\u2082');
13  ReplaceStaticTextLabelChar(m_staticTextZeroResistance, L'\u2080');
14  ReplaceStaticTextLabelChar(m_staticTextZeroReactance, L'\u2080');
15  Layout();
16  m_syncGenerator = syncGenerator;
17  m_parent = parent;
18 
19  SyncGeneratorElectricalData data = syncGenerator->GetElectricalData();
20 
21  m_textCtrlName->SetValue(data.name);
22 
23  m_textCtrlnominalPower->SetValue(SyncGenerator::StringFromDouble(data.nominalPower));
24  switch(data.nominalPowerUnit) {
25  case UNIT_VA:
26  m_choiceNominalPower->SetSelection(0);
27  break;
28  case UNIT_kVA:
29  m_choiceNominalPower->SetSelection(1);
30  break;
31  case UNIT_MVA:
32  m_choiceNominalPower->SetSelection(2);
33  break;
34  default:
35  break;
36  }
37 
38  m_textCtrlActivePower->SetValue(SyncGenerator::StringFromDouble(data.activePower));
39  switch(data.activePowerUnit) {
40  case UNIT_PU:
41  m_choiceActivePower->SetSelection(0);
42  break;
43  case UNIT_W:
44  m_choiceActivePower->SetSelection(1);
45  break;
46  case UNIT_kW:
47  m_choiceActivePower->SetSelection(2);
48  break;
49  case UNIT_MW:
50  m_choiceActivePower->SetSelection(3);
51  break;
52  default:
53  break;
54  }
55 
56  m_textCtrlReactivePower->SetValue(SyncGenerator::StringFromDouble(data.reactivePower));
57  switch(data.reactivePowerUnit) {
58  case UNIT_PU:
59  m_choiceReactivePower->SetSelection(0);
60  break;
61  case UNIT_VAr:
62  m_choiceReactivePower->SetSelection(1);
63  break;
64  case UNIT_kVAr:
65  m_choiceReactivePower->SetSelection(2);
66  break;
67  case UNIT_MVAr:
68  m_choiceReactivePower->SetSelection(3);
69  break;
70  default:
71  break;
72  }
73  m_checkBoxMaxReactive->SetValue(data.haveMaxReactive);
74 
75  m_textCtrlMaxRectivePower->SetValue(SyncGenerator::StringFromDouble(data.maxReactive));
76  switch(data.maxReactiveUnit) {
77  case UNIT_PU:
78  m_choiceMaxRectivePower->SetSelection(0);
79  break;
80  case UNIT_VAr:
81  m_choiceMaxRectivePower->SetSelection(1);
82  break;
83  case UNIT_kVAr:
84  m_choiceMaxRectivePower->SetSelection(2);
85  break;
86  case UNIT_MVAr:
87  m_choiceMaxRectivePower->SetSelection(3);
88  break;
89  default:
90  break;
91  }
92  m_textCtrlMaxRectivePower->Enable(data.haveMaxReactive);
93  m_choiceMaxRectivePower->Enable(data.haveMaxReactive);
94 
95  m_checkBoxMinReactive->SetValue(data.haveMinReactive);
96  m_textCtrlMinRectivePower->SetValue(SyncGenerator::StringFromDouble(data.minReactive));
97  switch(data.minReactiveUnit) {
98  case UNIT_PU:
99  m_choiceMinRectivePower->SetSelection(0);
100  break;
101  case UNIT_VAr:
102  m_choiceMinRectivePower->SetSelection(1);
103  break;
104  case UNIT_kVAr:
105  m_choiceMinRectivePower->SetSelection(2);
106  break;
107  case UNIT_MVAr:
108  m_choiceMinRectivePower->SetSelection(3);
109  break;
110  default:
111  break;
112  }
113  m_textCtrlMinRectivePower->Enable(data.haveMinReactive);
114  m_choiceMinRectivePower->Enable(data.haveMinReactive);
115 
116  m_checkBoxUseMachinePower->SetValue(data.useMachineBase);
117 
118  m_textCtrlPosResistance->SetValue(SyncGenerator::StringFromDouble(data.positiveResistance));
119  m_textCtrlPosReactance->SetValue(SyncGenerator::StringFromDouble(data.positiveReactance));
120  m_textCtrlNegResistance->SetValue(SyncGenerator::StringFromDouble(data.negativeResistance));
121  m_textCtrlNegReactance->SetValue(SyncGenerator::StringFromDouble(data.negativeReactance));
122  m_textCtrlZeroResistance->SetValue(SyncGenerator::StringFromDouble(data.zeroResistance));
123  m_textCtrlZeroReactance->SetValue(SyncGenerator::StringFromDouble(data.zeroReactance));
124  m_textCtrlGrdResistance->SetValue(SyncGenerator::StringFromDouble(data.groundResistance));
125  m_textCtrlGrdReactance->SetValue(SyncGenerator::StringFromDouble(data.groundReactance));
126  m_checkBoxGroundNeutral->SetValue(data.groundNeutral);
127 }
128 
129 SyncMachineForm::SyncMachineForm(wxWindow* parent, SyncMotor* syncMotor) : SyncMachineFormBase(parent)
130 {
131  m_buttonStab->Enable(false);
132  SetSize(GetBestSize());
133  ReplaceStaticTextLabelChar(m_staticTextPosResistance, L'\u2081');
134  ReplaceStaticTextLabelChar(m_staticTextPosReactance, L'\u2081');
135  ReplaceStaticTextLabelChar(m_staticTextNegResistance, L'\u2082');
136  ReplaceStaticTextLabelChar(m_staticTextNegReactance, L'\u2082');
137  ReplaceStaticTextLabelChar(m_staticTextZeroResistance, L'\u2080');
138  ReplaceStaticTextLabelChar(m_staticTextZeroReactance, L'\u2080');
139  Layout();
140  m_syncMotor = syncMotor;
141  m_parent = parent;
142 
143  SyncMotorElectricalData data = syncMotor->GetElectricalData();
144 
145  m_textCtrlName->SetValue(data.name);
146 
147  m_textCtrlnominalPower->SetValue(SyncMotor::StringFromDouble(data.nominalPower));
148  switch(data.nominalPowerUnit) {
149  case UNIT_VA:
150  m_choiceNominalPower->SetSelection(0);
151  break;
152  case UNIT_kVA:
153  m_choiceNominalPower->SetSelection(1);
154  break;
155  case UNIT_MVA:
156  m_choiceNominalPower->SetSelection(2);
157  break;
158  default:
159  break;
160  }
161 
162  m_textCtrlActivePower->SetValue(SyncMotor::StringFromDouble(data.activePower));
163  switch(data.activePowerUnit) {
164  case UNIT_PU:
165  m_choiceActivePower->SetSelection(0);
166  break;
167  case UNIT_W:
168  m_choiceActivePower->SetSelection(1);
169  break;
170  case UNIT_kW:
171  m_choiceActivePower->SetSelection(2);
172  break;
173  case UNIT_MW:
174  m_choiceActivePower->SetSelection(3);
175  break;
176  default:
177  break;
178  }
179 
180  m_textCtrlReactivePower->SetValue(SyncMotor::StringFromDouble(data.reactivePower));
181  switch(data.reactivePowerUnit) {
182  case UNIT_PU:
183  m_choiceReactivePower->SetSelection(0);
184  break;
185  case UNIT_VAr:
186  m_choiceReactivePower->SetSelection(1);
187  break;
188  case UNIT_kVAr:
189  m_choiceReactivePower->SetSelection(2);
190  break;
191  case UNIT_MVAr:
192  m_choiceReactivePower->SetSelection(3);
193  break;
194  default:
195  break;
196  }
197  m_checkBoxMaxReactive->SetValue(data.haveMaxReactive);
198 
199  m_textCtrlMaxRectivePower->SetValue(SyncMotor::StringFromDouble(data.maxReactive));
200  switch(data.maxReactiveUnit) {
201  case UNIT_PU:
202  m_choiceMaxRectivePower->SetSelection(0);
203  break;
204  case UNIT_VAr:
205  m_choiceMaxRectivePower->SetSelection(1);
206  break;
207  case UNIT_kVAr:
208  m_choiceMaxRectivePower->SetSelection(2);
209  break;
210  case UNIT_MVAr:
211  m_choiceMaxRectivePower->SetSelection(3);
212  break;
213  default:
214  break;
215  }
216  m_textCtrlMaxRectivePower->Enable(data.haveMaxReactive);
217  m_choiceMaxRectivePower->Enable(data.haveMaxReactive);
218 
219  m_checkBoxMinReactive->SetValue(data.haveMinReactive);
220  m_textCtrlMinRectivePower->SetValue(SyncMotor::StringFromDouble(data.minReactive));
221  switch(data.minReactiveUnit) {
222  case UNIT_PU:
223  m_choiceMinRectivePower->SetSelection(0);
224  break;
225  case UNIT_VAr:
226  m_choiceMinRectivePower->SetSelection(1);
227  break;
228  case UNIT_kVAr:
229  m_choiceMinRectivePower->SetSelection(2);
230  break;
231  case UNIT_MVAr:
232  m_choiceMinRectivePower->SetSelection(3);
233  break;
234  default:
235  break;
236  }
237  m_textCtrlMinRectivePower->Enable(data.haveMinReactive);
238  m_choiceMinRectivePower->Enable(data.haveMinReactive);
239 
240  m_checkBoxUseMachinePower->SetValue(data.useMachineBase);
241 
242  m_textCtrlPosResistance->SetValue(SyncMotor::StringFromDouble(data.positiveResistance));
243  m_textCtrlPosReactance->SetValue(SyncMotor::StringFromDouble(data.positiveReactance));
244  m_textCtrlNegResistance->SetValue(SyncMotor::StringFromDouble(data.negativeResistance));
245  m_textCtrlNegReactance->SetValue(SyncMotor::StringFromDouble(data.negativeReactance));
246  m_textCtrlZeroResistance->SetValue(SyncMotor::StringFromDouble(data.zeroResistance));
247  m_textCtrlZeroReactance->SetValue(SyncMotor::StringFromDouble(data.zeroReactance));
248  m_textCtrlGrdResistance->SetValue(SyncMotor::StringFromDouble(data.groundResistance));
249  m_textCtrlGrdReactance->SetValue(SyncMotor::StringFromDouble(data.groundReactance));
250  m_checkBoxGroundNeutral->SetValue(data.groundNeutral);
251 }
252 
253 SyncMachineForm::~SyncMachineForm() {}
254 void SyncMachineForm::OnCheckMaxReactive(wxCommandEvent& event)
255 {
256  m_textCtrlMaxRectivePower->Enable(m_checkBoxMaxReactive->GetValue());
257  m_choiceMaxRectivePower->Enable(m_checkBoxMaxReactive->GetValue());
258 }
259 void SyncMachineForm::OnCheckMinReactive(wxCommandEvent& event)
260 {
261  m_textCtrlMinRectivePower->Enable(m_checkBoxMinReactive->GetValue());
262  m_choiceMinRectivePower->Enable(m_checkBoxMinReactive->GetValue());
263 }
264 void SyncMachineForm::OnOKButtonClick(wxCommandEvent& event)
265 {
266  if(ValidateData()) EndModal(wxID_OK);
267 }
268 void SyncMachineForm::OnStabilityButtonClick(wxCommandEvent& event)
269 {
270  if(ValidateData()) {
271  if(m_syncGenerator) {
272  GeneratorStabForm* stabForm = new GeneratorStabForm(m_parent, m_syncGenerator);
273  if(stabForm->ShowModal() == wxID_OK) {
274  stabForm->Destroy();
275  EndModal(wxID_OK);
276  }
277 
278  stabForm->Destroy();
279  EndModal(wxID_CANCEL);
280  }
281  }
282 }
283 
284 bool SyncMachineForm::ValidateData()
285 {
286  if(m_syncGenerator) {
287  SyncGeneratorElectricalData data = m_syncGenerator->GetElectricalData();
288  data.name = m_textCtrlName->GetValue();
289 
290  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlnominalPower->GetValue(), data.nominalPower,
291  _("Value entered incorrectly in the field \"Nominal power\".")))
292  return false;
293  switch(m_choiceNominalPower->GetSelection()) {
294  case 0:
295  data.nominalPowerUnit = UNIT_VA;
296  break;
297  case 1:
298  data.nominalPowerUnit = UNIT_kVA;
299  break;
300  case 2:
301  data.nominalPowerUnit = UNIT_MVA;
302  break;
303  }
304 
305  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlActivePower->GetValue(), data.activePower,
306  _("Value entered incorrectly in the field \"Active power\".")))
307  return false;
308  switch(m_choiceActivePower->GetSelection()) {
309  case 0:
310  data.activePowerUnit = UNIT_PU;
311  break;
312  case 1:
313  data.activePowerUnit = UNIT_W;
314  break;
315  case 2:
316  data.activePowerUnit = UNIT_kW;
317  break;
318  case 3:
319  data.activePowerUnit = UNIT_MW;
320  break;
321  }
322 
323  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
324  _("Value entered incorrectly in the field \"Reactive power\".")))
325  return false;
326  switch(m_choiceReactivePower->GetSelection()) {
327  case 0:
328  data.reactivePowerUnit = UNIT_PU;
329  break;
330  case 1:
331  data.reactivePowerUnit = UNIT_VAr;
332  break;
333  case 2:
334  data.reactivePowerUnit = UNIT_kVAr;
335  break;
336  case 3:
337  data.reactivePowerUnit = UNIT_MVAr;
338  break;
339  }
340 
341  data.haveMaxReactive = m_checkBoxMaxReactive->GetValue();
342  if(data.haveMaxReactive) {
343  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlMaxRectivePower->GetValue(), data.maxReactive,
344  _("Value entered incorrectly in the field \"Max reactive power\".")))
345  return false;
346  switch(m_choiceMaxRectivePower->GetSelection()) {
347  case 0:
348  data.maxReactiveUnit = UNIT_PU;
349  break;
350  case 1:
351  data.maxReactiveUnit = UNIT_VAr;
352  break;
353  case 2:
354  data.maxReactiveUnit = UNIT_kVAr;
355  break;
356  case 3:
357  data.maxReactiveUnit = UNIT_MVAr;
358  break;
359  }
360  }
361 
362  data.haveMinReactive = m_checkBoxMinReactive->GetValue();
363  if(data.haveMinReactive) {
364  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlMinRectivePower->GetValue(), data.minReactive,
365  _("Value entered incorrectly in the field \"Min reactive power\".")))
366  return false;
367  switch(m_choiceMinRectivePower->GetSelection()) {
368  case 0:
369  data.minReactiveUnit = UNIT_PU;
370  break;
371  case 1:
372  data.minReactiveUnit = UNIT_VAr;
373  break;
374  case 2:
375  data.minReactiveUnit = UNIT_kVAr;
376  break;
377  case 3:
378  data.minReactiveUnit = UNIT_MVAr;
379  break;
380  }
381  }
382 
383  data.useMachineBase = m_checkBoxUseMachinePower->GetValue();
384 
385  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlPosResistance->GetValue(), data.positiveResistance,
386  _("Value entered incorrectly in the field \"Positive resistance\".")))
387  return false;
388 
389  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlPosReactance->GetValue(), data.positiveReactance,
390  _("Value entered incorrectly in the field \"Positive reactance\".")))
391  return false;
392 
393  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlNegResistance->GetValue(), data.negativeResistance,
394  _("Value entered incorrectly in the field \"Negative resistance\".")))
395  return false;
396 
397  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlNegReactance->GetValue(), data.negativeReactance,
398  _("Value entered incorrectly in the field \"Negative reactance\".")))
399  return false;
400 
401  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlZeroResistance->GetValue(), data.zeroResistance,
402  _("Value entered incorrectly in the field \"Zero resistance\".")))
403  return false;
404 
405  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlZeroReactance->GetValue(), data.zeroReactance,
406  _("Value entered incorrectly in the field \"Zero reactance\".")))
407  return false;
408 
409  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlGrdResistance->GetValue(), data.groundResistance,
410  _("Value entered incorrectly in the field \"Ground resistance\".")))
411  return false;
412 
413  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlGrdReactance->GetValue(), data.groundReactance,
414  _("Value entered incorrectly in the field \"Ground reactance\".")))
415  return false;
416 
417  data.groundNeutral = m_checkBoxGroundNeutral->GetValue();
418 
419  m_syncGenerator->SetElectricalData(data);
420  } else if(m_syncMotor) {
421  SyncMotorElectricalData data = m_syncMotor->GetElectricalData();
422  data.name = m_textCtrlName->GetValue();
423 
424  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlnominalPower->GetValue(), data.nominalPower,
425  _("Value entered incorrectly in the field \"Nominal power\".")))
426  return false;
427  switch(m_choiceNominalPower->GetSelection()) {
428  case 0:
429  data.nominalPowerUnit = UNIT_VA;
430  break;
431  case 1:
432  data.nominalPowerUnit = UNIT_kVA;
433  break;
434  case 2:
435  data.nominalPowerUnit = UNIT_MVA;
436  break;
437  }
438 
439  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlActivePower->GetValue(), data.activePower,
440  _("Value entered incorrectly in the field \"Active power\".")))
441  return false;
442  switch(m_choiceActivePower->GetSelection()) {
443  case 0:
444  data.activePowerUnit = UNIT_PU;
445  break;
446  case 1:
447  data.activePowerUnit = UNIT_W;
448  break;
449  case 2:
450  data.activePowerUnit = UNIT_kW;
451  break;
452  case 3:
453  data.activePowerUnit = UNIT_MW;
454  break;
455  }
456 
457  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
458  _("Value entered incorrectly in the field \"Reactive power\".")))
459  return false;
460  switch(m_choiceReactivePower->GetSelection()) {
461  case 0:
462  data.reactivePowerUnit = UNIT_PU;
463  break;
464  case 1:
465  data.reactivePowerUnit = UNIT_VAr;
466  break;
467  case 2:
468  data.reactivePowerUnit = UNIT_kVAr;
469  break;
470  case 3:
471  data.reactivePowerUnit = UNIT_MVAr;
472  break;
473  }
474 
475  data.haveMaxReactive = m_checkBoxMaxReactive->GetValue();
476  if(data.haveMaxReactive) {
477  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlMaxRectivePower->GetValue(), data.maxReactive,
478  _("Value entered incorrectly in the field \"Max reactive power\".")))
479  return false;
480  switch(m_choiceMaxRectivePower->GetSelection()) {
481  case 0:
482  data.maxReactiveUnit = UNIT_PU;
483  break;
484  case 1:
485  data.maxReactiveUnit = UNIT_VAr;
486  break;
487  case 2:
488  data.maxReactiveUnit = UNIT_kVAr;
489  break;
490  case 3:
491  data.maxReactiveUnit = UNIT_MVAr;
492  break;
493  }
494  }
495 
496  data.haveMinReactive = m_checkBoxMinReactive->GetValue();
497  if(data.haveMinReactive) {
498  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlMinRectivePower->GetValue(), data.minReactive,
499  _("Value entered incorrectly in the field \"Min reactive power\".")))
500  return false;
501  switch(m_choiceMinRectivePower->GetSelection()) {
502  case 0:
503  data.minReactiveUnit = UNIT_PU;
504  break;
505  case 1:
506  data.minReactiveUnit = UNIT_VAr;
507  break;
508  case 2:
509  data.minReactiveUnit = UNIT_kVAr;
510  break;
511  case 3:
512  data.minReactiveUnit = UNIT_MVAr;
513  break;
514  }
515  }
516 
517  data.useMachineBase = m_checkBoxUseMachinePower->GetValue();
518 
519  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlPosResistance->GetValue(), data.positiveResistance,
520  _("Value entered incorrectly in the field \"Positive resistance\".")))
521  return false;
522 
523  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlPosReactance->GetValue(), data.positiveReactance,
524  _("Value entered incorrectly in the field \"Positive reactance\".")))
525  return false;
526 
527  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlNegResistance->GetValue(), data.negativeResistance,
528  _("Value entered incorrectly in the field \"Negative resistance\".")))
529  return false;
530 
531  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlNegReactance->GetValue(), data.negativeReactance,
532  _("Value entered incorrectly in the field \"Negative reactance\".")))
533  return false;
534 
535  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlZeroResistance->GetValue(), data.zeroResistance,
536  _("Value entered incorrectly in the field \"Zero resistance\".")))
537  return false;
538 
539  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlZeroReactance->GetValue(), data.zeroReactance,
540  _("Value entered incorrectly in the field \"Zero reactance\".")))
541  return false;
542 
543  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlGrdResistance->GetValue(), data.groundResistance,
544  _("Value entered incorrectly in the field \"Ground resistance\".")))
545  return false;
546 
547  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlGrdReactance->GetValue(), data.groundReactance,
548  _("Value entered incorrectly in the field \"Ground reactance\".")))
549  return false;
550 
551  data.groundNeutral = m_checkBoxGroundNeutral->GetValue();
552 
553  m_syncMotor->SetElectricalData(data);
554  }
555  return true;
556 }
557 
558 void SyncMachineForm::ReplaceStaticTextLabelChar(wxStaticText* staticText, wchar_t newChar)
559 {
560  wxString label = staticText->GetLabel();
561  label[label.length() - 2] = newChar;
562  staticText->SetLabel(label);
563 }
- - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "GeneratorStabForm.h"
19 #include "SyncMachineForm.h"
20 #include "SyncGenerator.h"
21 #include "SyncMotor.h"
22 
23 SyncMachineForm::SyncMachineForm(wxWindow* parent, SyncGenerator* syncGenerator) : SyncMachineFormBase(parent)
24 {
25  SetSize(GetBestSize());
26  ReplaceStaticTextLabelChar(m_staticTextPosResistance, L'\u2081');
27  ReplaceStaticTextLabelChar(m_staticTextPosReactance, L'\u2081');
28  ReplaceStaticTextLabelChar(m_staticTextNegResistance, L'\u2082');
29  ReplaceStaticTextLabelChar(m_staticTextNegReactance, L'\u2082');
30  ReplaceStaticTextLabelChar(m_staticTextZeroResistance, L'\u2080');
31  ReplaceStaticTextLabelChar(m_staticTextZeroReactance, L'\u2080');
32  Layout();
33  m_syncGenerator = syncGenerator;
34  m_parent = parent;
35 
36  SyncGeneratorElectricalData data = syncGenerator->GetElectricalData();
37 
38  m_textCtrlName->SetValue(data.name);
39 
40  m_textCtrlnominalPower->SetValue(SyncGenerator::StringFromDouble(data.nominalPower));
41  switch(data.nominalPowerUnit) {
42  case UNIT_VA:
43  m_choiceNominalPower->SetSelection(0);
44  break;
45  case UNIT_kVA:
46  m_choiceNominalPower->SetSelection(1);
47  break;
48  case UNIT_MVA:
49  m_choiceNominalPower->SetSelection(2);
50  break;
51  default:
52  break;
53  }
54 
55  m_textCtrlActivePower->SetValue(SyncGenerator::StringFromDouble(data.activePower));
56  switch(data.activePowerUnit) {
57  case UNIT_PU:
58  m_choiceActivePower->SetSelection(0);
59  break;
60  case UNIT_W:
61  m_choiceActivePower->SetSelection(1);
62  break;
63  case UNIT_kW:
64  m_choiceActivePower->SetSelection(2);
65  break;
66  case UNIT_MW:
67  m_choiceActivePower->SetSelection(3);
68  break;
69  default:
70  break;
71  }
72 
73  m_textCtrlReactivePower->SetValue(SyncGenerator::StringFromDouble(data.reactivePower));
74  switch(data.reactivePowerUnit) {
75  case UNIT_PU:
76  m_choiceReactivePower->SetSelection(0);
77  break;
78  case UNIT_VAr:
79  m_choiceReactivePower->SetSelection(1);
80  break;
81  case UNIT_kVAr:
82  m_choiceReactivePower->SetSelection(2);
83  break;
84  case UNIT_MVAr:
85  m_choiceReactivePower->SetSelection(3);
86  break;
87  default:
88  break;
89  }
90  m_checkBoxMaxReactive->SetValue(data.haveMaxReactive);
91 
92  m_textCtrlMaxRectivePower->SetValue(SyncGenerator::StringFromDouble(data.maxReactive));
93  switch(data.maxReactiveUnit) {
94  case UNIT_PU:
95  m_choiceMaxRectivePower->SetSelection(0);
96  break;
97  case UNIT_VAr:
98  m_choiceMaxRectivePower->SetSelection(1);
99  break;
100  case UNIT_kVAr:
101  m_choiceMaxRectivePower->SetSelection(2);
102  break;
103  case UNIT_MVAr:
104  m_choiceMaxRectivePower->SetSelection(3);
105  break;
106  default:
107  break;
108  }
109  m_textCtrlMaxRectivePower->Enable(data.haveMaxReactive);
110  m_choiceMaxRectivePower->Enable(data.haveMaxReactive);
111 
112  m_checkBoxMinReactive->SetValue(data.haveMinReactive);
113  m_textCtrlMinRectivePower->SetValue(SyncGenerator::StringFromDouble(data.minReactive));
114  switch(data.minReactiveUnit) {
115  case UNIT_PU:
116  m_choiceMinRectivePower->SetSelection(0);
117  break;
118  case UNIT_VAr:
119  m_choiceMinRectivePower->SetSelection(1);
120  break;
121  case UNIT_kVAr:
122  m_choiceMinRectivePower->SetSelection(2);
123  break;
124  case UNIT_MVAr:
125  m_choiceMinRectivePower->SetSelection(3);
126  break;
127  default:
128  break;
129  }
130  m_textCtrlMinRectivePower->Enable(data.haveMinReactive);
131  m_choiceMinRectivePower->Enable(data.haveMinReactive);
132 
133  m_checkBoxUseMachinePower->SetValue(data.useMachineBase);
134 
135  m_textCtrlPosResistance->SetValue(SyncGenerator::StringFromDouble(data.positiveResistance));
136  m_textCtrlPosReactance->SetValue(SyncGenerator::StringFromDouble(data.positiveReactance));
137  m_textCtrlNegResistance->SetValue(SyncGenerator::StringFromDouble(data.negativeResistance));
138  m_textCtrlNegReactance->SetValue(SyncGenerator::StringFromDouble(data.negativeReactance));
139  m_textCtrlZeroResistance->SetValue(SyncGenerator::StringFromDouble(data.zeroResistance));
140  m_textCtrlZeroReactance->SetValue(SyncGenerator::StringFromDouble(data.zeroReactance));
141  m_textCtrlGrdResistance->SetValue(SyncGenerator::StringFromDouble(data.groundResistance));
142  m_textCtrlGrdReactance->SetValue(SyncGenerator::StringFromDouble(data.groundReactance));
143  m_checkBoxGroundNeutral->SetValue(data.groundNeutral);
144 }
145 
146 SyncMachineForm::SyncMachineForm(wxWindow* parent, SyncMotor* syncMotor) : SyncMachineFormBase(parent)
147 {
148  m_buttonStab->Enable(false);
149  SetSize(GetBestSize());
150  ReplaceStaticTextLabelChar(m_staticTextPosResistance, L'\u2081');
151  ReplaceStaticTextLabelChar(m_staticTextPosReactance, L'\u2081');
152  ReplaceStaticTextLabelChar(m_staticTextNegResistance, L'\u2082');
153  ReplaceStaticTextLabelChar(m_staticTextNegReactance, L'\u2082');
154  ReplaceStaticTextLabelChar(m_staticTextZeroResistance, L'\u2080');
155  ReplaceStaticTextLabelChar(m_staticTextZeroReactance, L'\u2080');
156  Layout();
157  m_syncMotor = syncMotor;
158  m_parent = parent;
159 
160  SyncMotorElectricalData data = syncMotor->GetElectricalData();
161 
162  m_textCtrlName->SetValue(data.name);
163 
164  m_textCtrlnominalPower->SetValue(SyncMotor::StringFromDouble(data.nominalPower));
165  switch(data.nominalPowerUnit) {
166  case UNIT_VA:
167  m_choiceNominalPower->SetSelection(0);
168  break;
169  case UNIT_kVA:
170  m_choiceNominalPower->SetSelection(1);
171  break;
172  case UNIT_MVA:
173  m_choiceNominalPower->SetSelection(2);
174  break;
175  default:
176  break;
177  }
178 
179  m_textCtrlActivePower->SetValue(SyncMotor::StringFromDouble(data.activePower));
180  switch(data.activePowerUnit) {
181  case UNIT_PU:
182  m_choiceActivePower->SetSelection(0);
183  break;
184  case UNIT_W:
185  m_choiceActivePower->SetSelection(1);
186  break;
187  case UNIT_kW:
188  m_choiceActivePower->SetSelection(2);
189  break;
190  case UNIT_MW:
191  m_choiceActivePower->SetSelection(3);
192  break;
193  default:
194  break;
195  }
196 
197  m_textCtrlReactivePower->SetValue(SyncMotor::StringFromDouble(data.reactivePower));
198  switch(data.reactivePowerUnit) {
199  case UNIT_PU:
200  m_choiceReactivePower->SetSelection(0);
201  break;
202  case UNIT_VAr:
203  m_choiceReactivePower->SetSelection(1);
204  break;
205  case UNIT_kVAr:
206  m_choiceReactivePower->SetSelection(2);
207  break;
208  case UNIT_MVAr:
209  m_choiceReactivePower->SetSelection(3);
210  break;
211  default:
212  break;
213  }
214  m_checkBoxMaxReactive->SetValue(data.haveMaxReactive);
215 
216  m_textCtrlMaxRectivePower->SetValue(SyncMotor::StringFromDouble(data.maxReactive));
217  switch(data.maxReactiveUnit) {
218  case UNIT_PU:
219  m_choiceMaxRectivePower->SetSelection(0);
220  break;
221  case UNIT_VAr:
222  m_choiceMaxRectivePower->SetSelection(1);
223  break;
224  case UNIT_kVAr:
225  m_choiceMaxRectivePower->SetSelection(2);
226  break;
227  case UNIT_MVAr:
228  m_choiceMaxRectivePower->SetSelection(3);
229  break;
230  default:
231  break;
232  }
233  m_textCtrlMaxRectivePower->Enable(data.haveMaxReactive);
234  m_choiceMaxRectivePower->Enable(data.haveMaxReactive);
235 
236  m_checkBoxMinReactive->SetValue(data.haveMinReactive);
237  m_textCtrlMinRectivePower->SetValue(SyncMotor::StringFromDouble(data.minReactive));
238  switch(data.minReactiveUnit) {
239  case UNIT_PU:
240  m_choiceMinRectivePower->SetSelection(0);
241  break;
242  case UNIT_VAr:
243  m_choiceMinRectivePower->SetSelection(1);
244  break;
245  case UNIT_kVAr:
246  m_choiceMinRectivePower->SetSelection(2);
247  break;
248  case UNIT_MVAr:
249  m_choiceMinRectivePower->SetSelection(3);
250  break;
251  default:
252  break;
253  }
254  m_textCtrlMinRectivePower->Enable(data.haveMinReactive);
255  m_choiceMinRectivePower->Enable(data.haveMinReactive);
256 
257  m_checkBoxUseMachinePower->SetValue(data.useMachineBase);
258 
259  m_textCtrlPosResistance->SetValue(SyncMotor::StringFromDouble(data.positiveResistance));
260  m_textCtrlPosReactance->SetValue(SyncMotor::StringFromDouble(data.positiveReactance));
261  m_textCtrlNegResistance->SetValue(SyncMotor::StringFromDouble(data.negativeResistance));
262  m_textCtrlNegReactance->SetValue(SyncMotor::StringFromDouble(data.negativeReactance));
263  m_textCtrlZeroResistance->SetValue(SyncMotor::StringFromDouble(data.zeroResistance));
264  m_textCtrlZeroReactance->SetValue(SyncMotor::StringFromDouble(data.zeroReactance));
265  m_textCtrlGrdResistance->SetValue(SyncMotor::StringFromDouble(data.groundResistance));
266  m_textCtrlGrdReactance->SetValue(SyncMotor::StringFromDouble(data.groundReactance));
267  m_checkBoxGroundNeutral->SetValue(data.groundNeutral);
268 }
269 
270 SyncMachineForm::~SyncMachineForm() {}
271 void SyncMachineForm::OnCheckMaxReactive(wxCommandEvent& event)
272 {
273  m_textCtrlMaxRectivePower->Enable(m_checkBoxMaxReactive->GetValue());
274  m_choiceMaxRectivePower->Enable(m_checkBoxMaxReactive->GetValue());
275 }
276 void SyncMachineForm::OnCheckMinReactive(wxCommandEvent& event)
277 {
278  m_textCtrlMinRectivePower->Enable(m_checkBoxMinReactive->GetValue());
279  m_choiceMinRectivePower->Enable(m_checkBoxMinReactive->GetValue());
280 }
281 void SyncMachineForm::OnOKButtonClick(wxCommandEvent& event)
282 {
283  if(ValidateData()) EndModal(wxID_OK);
284 }
285 void SyncMachineForm::OnStabilityButtonClick(wxCommandEvent& event)
286 {
287  if(ValidateData()) {
288  if(m_syncGenerator) {
289  GeneratorStabForm* stabForm = new GeneratorStabForm(m_parent, m_syncGenerator);
290  if(stabForm->ShowModal() == wxID_OK) {
291  stabForm->Destroy();
292  EndModal(wxID_OK);
293  }
294 
295  stabForm->Destroy();
296  EndModal(wxID_CANCEL);
297  }
298  }
299 }
300 
301 bool SyncMachineForm::ValidateData()
302 {
303  if(m_syncGenerator) {
304  SyncGeneratorElectricalData data = m_syncGenerator->GetElectricalData();
305  data.name = m_textCtrlName->GetValue();
306 
307  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlnominalPower->GetValue(), data.nominalPower,
308  _("Value entered incorrectly in the field \"Nominal power\".")))
309  return false;
310  switch(m_choiceNominalPower->GetSelection()) {
311  case 0:
312  data.nominalPowerUnit = UNIT_VA;
313  break;
314  case 1:
315  data.nominalPowerUnit = UNIT_kVA;
316  break;
317  case 2:
318  data.nominalPowerUnit = UNIT_MVA;
319  break;
320  }
321 
322  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlActivePower->GetValue(), data.activePower,
323  _("Value entered incorrectly in the field \"Active power\".")))
324  return false;
325  switch(m_choiceActivePower->GetSelection()) {
326  case 0:
327  data.activePowerUnit = UNIT_PU;
328  break;
329  case 1:
330  data.activePowerUnit = UNIT_W;
331  break;
332  case 2:
333  data.activePowerUnit = UNIT_kW;
334  break;
335  case 3:
336  data.activePowerUnit = UNIT_MW;
337  break;
338  }
339 
340  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
341  _("Value entered incorrectly in the field \"Reactive power\".")))
342  return false;
343  switch(m_choiceReactivePower->GetSelection()) {
344  case 0:
345  data.reactivePowerUnit = UNIT_PU;
346  break;
347  case 1:
348  data.reactivePowerUnit = UNIT_VAr;
349  break;
350  case 2:
351  data.reactivePowerUnit = UNIT_kVAr;
352  break;
353  case 3:
354  data.reactivePowerUnit = UNIT_MVAr;
355  break;
356  }
357 
358  data.haveMaxReactive = m_checkBoxMaxReactive->GetValue();
359  if(data.haveMaxReactive) {
360  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlMaxRectivePower->GetValue(), data.maxReactive,
361  _("Value entered incorrectly in the field \"Max reactive power\".")))
362  return false;
363  switch(m_choiceMaxRectivePower->GetSelection()) {
364  case 0:
365  data.maxReactiveUnit = UNIT_PU;
366  break;
367  case 1:
368  data.maxReactiveUnit = UNIT_VAr;
369  break;
370  case 2:
371  data.maxReactiveUnit = UNIT_kVAr;
372  break;
373  case 3:
374  data.maxReactiveUnit = UNIT_MVAr;
375  break;
376  }
377  }
378 
379  data.haveMinReactive = m_checkBoxMinReactive->GetValue();
380  if(data.haveMinReactive) {
381  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlMinRectivePower->GetValue(), data.minReactive,
382  _("Value entered incorrectly in the field \"Min reactive power\".")))
383  return false;
384  switch(m_choiceMinRectivePower->GetSelection()) {
385  case 0:
386  data.minReactiveUnit = UNIT_PU;
387  break;
388  case 1:
389  data.minReactiveUnit = UNIT_VAr;
390  break;
391  case 2:
392  data.minReactiveUnit = UNIT_kVAr;
393  break;
394  case 3:
395  data.minReactiveUnit = UNIT_MVAr;
396  break;
397  }
398  }
399 
400  data.useMachineBase = m_checkBoxUseMachinePower->GetValue();
401 
402  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlPosResistance->GetValue(), data.positiveResistance,
403  _("Value entered incorrectly in the field \"Positive resistance\".")))
404  return false;
405 
406  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlPosReactance->GetValue(), data.positiveReactance,
407  _("Value entered incorrectly in the field \"Positive reactance\".")))
408  return false;
409 
410  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlNegResistance->GetValue(), data.negativeResistance,
411  _("Value entered incorrectly in the field \"Negative resistance\".")))
412  return false;
413 
414  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlNegReactance->GetValue(), data.negativeReactance,
415  _("Value entered incorrectly in the field \"Negative reactance\".")))
416  return false;
417 
418  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlZeroResistance->GetValue(), data.zeroResistance,
419  _("Value entered incorrectly in the field \"Zero resistance\".")))
420  return false;
421 
422  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlZeroReactance->GetValue(), data.zeroReactance,
423  _("Value entered incorrectly in the field \"Zero reactance\".")))
424  return false;
425 
426  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlGrdResistance->GetValue(), data.groundResistance,
427  _("Value entered incorrectly in the field \"Ground resistance\".")))
428  return false;
429 
430  if(!m_syncGenerator->DoubleFromString(m_parent, m_textCtrlGrdReactance->GetValue(), data.groundReactance,
431  _("Value entered incorrectly in the field \"Ground reactance\".")))
432  return false;
433 
434  data.groundNeutral = m_checkBoxGroundNeutral->GetValue();
435 
436  m_syncGenerator->SetElectricalData(data);
437  } else if(m_syncMotor) {
438  SyncMotorElectricalData data = m_syncMotor->GetElectricalData();
439  data.name = m_textCtrlName->GetValue();
440 
441  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlnominalPower->GetValue(), data.nominalPower,
442  _("Value entered incorrectly in the field \"Nominal power\".")))
443  return false;
444  switch(m_choiceNominalPower->GetSelection()) {
445  case 0:
446  data.nominalPowerUnit = UNIT_VA;
447  break;
448  case 1:
449  data.nominalPowerUnit = UNIT_kVA;
450  break;
451  case 2:
452  data.nominalPowerUnit = UNIT_MVA;
453  break;
454  }
455 
456  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlActivePower->GetValue(), data.activePower,
457  _("Value entered incorrectly in the field \"Active power\".")))
458  return false;
459  switch(m_choiceActivePower->GetSelection()) {
460  case 0:
461  data.activePowerUnit = UNIT_PU;
462  break;
463  case 1:
464  data.activePowerUnit = UNIT_W;
465  break;
466  case 2:
467  data.activePowerUnit = UNIT_kW;
468  break;
469  case 3:
470  data.activePowerUnit = UNIT_MW;
471  break;
472  }
473 
474  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
475  _("Value entered incorrectly in the field \"Reactive power\".")))
476  return false;
477  switch(m_choiceReactivePower->GetSelection()) {
478  case 0:
479  data.reactivePowerUnit = UNIT_PU;
480  break;
481  case 1:
482  data.reactivePowerUnit = UNIT_VAr;
483  break;
484  case 2:
485  data.reactivePowerUnit = UNIT_kVAr;
486  break;
487  case 3:
488  data.reactivePowerUnit = UNIT_MVAr;
489  break;
490  }
491 
492  data.haveMaxReactive = m_checkBoxMaxReactive->GetValue();
493  if(data.haveMaxReactive) {
494  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlMaxRectivePower->GetValue(), data.maxReactive,
495  _("Value entered incorrectly in the field \"Max reactive power\".")))
496  return false;
497  switch(m_choiceMaxRectivePower->GetSelection()) {
498  case 0:
499  data.maxReactiveUnit = UNIT_PU;
500  break;
501  case 1:
502  data.maxReactiveUnit = UNIT_VAr;
503  break;
504  case 2:
505  data.maxReactiveUnit = UNIT_kVAr;
506  break;
507  case 3:
508  data.maxReactiveUnit = UNIT_MVAr;
509  break;
510  }
511  }
512 
513  data.haveMinReactive = m_checkBoxMinReactive->GetValue();
514  if(data.haveMinReactive) {
515  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlMinRectivePower->GetValue(), data.minReactive,
516  _("Value entered incorrectly in the field \"Min reactive power\".")))
517  return false;
518  switch(m_choiceMinRectivePower->GetSelection()) {
519  case 0:
520  data.minReactiveUnit = UNIT_PU;
521  break;
522  case 1:
523  data.minReactiveUnit = UNIT_VAr;
524  break;
525  case 2:
526  data.minReactiveUnit = UNIT_kVAr;
527  break;
528  case 3:
529  data.minReactiveUnit = UNIT_MVAr;
530  break;
531  }
532  }
533 
534  data.useMachineBase = m_checkBoxUseMachinePower->GetValue();
535 
536  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlPosResistance->GetValue(), data.positiveResistance,
537  _("Value entered incorrectly in the field \"Positive resistance\".")))
538  return false;
539 
540  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlPosReactance->GetValue(), data.positiveReactance,
541  _("Value entered incorrectly in the field \"Positive reactance\".")))
542  return false;
543 
544  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlNegResistance->GetValue(), data.negativeResistance,
545  _("Value entered incorrectly in the field \"Negative resistance\".")))
546  return false;
547 
548  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlNegReactance->GetValue(), data.negativeReactance,
549  _("Value entered incorrectly in the field \"Negative reactance\".")))
550  return false;
551 
552  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlZeroResistance->GetValue(), data.zeroResistance,
553  _("Value entered incorrectly in the field \"Zero resistance\".")))
554  return false;
555 
556  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlZeroReactance->GetValue(), data.zeroReactance,
557  _("Value entered incorrectly in the field \"Zero reactance\".")))
558  return false;
559 
560  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlGrdResistance->GetValue(), data.groundResistance,
561  _("Value entered incorrectly in the field \"Ground resistance\".")))
562  return false;
563 
564  if(!m_syncMotor->DoubleFromString(m_parent, m_textCtrlGrdReactance->GetValue(), data.groundReactance,
565  _("Value entered incorrectly in the field \"Ground reactance\".")))
566  return false;
567 
568  data.groundNeutral = m_checkBoxGroundNeutral->GetValue();
569 
570  m_syncMotor->SetElectricalData(data);
571  }
572  return true;
573 }
574 
575 void SyncMachineForm::ReplaceStaticTextLabelChar(wxStaticText* staticText, wchar_t newChar)
576 {
577  wxString label = staticText->GetLabel();
578  label[label.length() - 2] = newChar;
579  staticText->SetLabel(label);
580 }
+ + + - - - - - - - - -
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:300
- - - - + + + + +
Form to edit the synchronous generator data for electromechanical studies.
+ + + + +
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:320
+ + + +
diff --git a/docs/doxygen/html/_sync_machine_form_8h.html b/docs/doxygen/html/_sync_machine_form_8h.html new file mode 100644 index 0000000..30ad9aa --- /dev/null +++ b/docs/doxygen/html/_sync_machine_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/SyncMachineForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
SyncMachineForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  SyncMachineForm
 Form to edit the synchronous machine power data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_sync_machine_form_8h_source.html b/docs/doxygen/html/_sync_machine_form_8h_source.html index e57afbf..bd189b2 100644 --- a/docs/doxygen/html/_sync_machine_form_8h_source.html +++ b/docs/doxygen/html/_sync_machine_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,17 +88,17 @@ $(document).ready(function(){initNavTree('_sync_machine_form_8h_source.html','')
SyncMachineForm.h
-
1 #ifndef SYNCMACHINEFORM_H
2 #define SYNCMACHINEFORM_H
3 
4 #include "ElementForm.h"
5 
7 class SyncGenerator;
8 class SyncMotor;
9 
11 {
12  public:
13  SyncMachineForm(wxWindow* parent, SyncGenerator* syncGenerator);
14  SyncMachineForm(wxWindow* parent, SyncMotor* syncMotor);
15  virtual ~SyncMachineForm();
16 
17  protected:
18  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); };
19  virtual void OnCheckMaxReactive(wxCommandEvent& event);
20  virtual void OnCheckMinReactive(wxCommandEvent& event);
21  virtual void OnOKButtonClick(wxCommandEvent& event);
22  virtual void OnStabilityButtonClick(wxCommandEvent& event);
23 
24  virtual bool ValidateData();
25  virtual void ReplaceStaticTextLabelChar(wxStaticText* staticText, wchar_t newChar);
26 
27  SyncGenerator* m_syncGenerator = NULL;
28  SyncMotor* m_syncMotor = NULL;
29  wxWindow* m_parent = NULL;
30 };
31 #endif // SYNCMACHINEFORM_H
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef SYNCMACHINEFORM_H
19 #define SYNCMACHINEFORM_H
20 
21 #include "ElementForm.h"
22 
23 class GeneratorStabForm;
24 class SyncGenerator;
25 class SyncMotor;
26 
35 {
36  public:
37  SyncMachineForm(wxWindow* parent, SyncGenerator* syncGenerator);
38  SyncMachineForm(wxWindow* parent, SyncMotor* syncMotor);
39  virtual ~SyncMachineForm();
40 
41  protected:
42  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); };
43  virtual void OnCheckMaxReactive(wxCommandEvent& event);
44  virtual void OnCheckMinReactive(wxCommandEvent& event);
45  virtual void OnOKButtonClick(wxCommandEvent& event);
46  virtual void OnStabilityButtonClick(wxCommandEvent& event);
47 
48  virtual bool ValidateData();
49  virtual void ReplaceStaticTextLabelChar(wxStaticText* staticText, wchar_t newChar);
50 
51  SyncGenerator* m_syncGenerator = NULL;
52  SyncMotor* m_syncMotor = NULL;
53  wxWindow* m_parent = NULL;
54 };
55 #endif // SYNCMACHINEFORM_H
- - - +
Form to edit the synchronous machine power data.
+
Form to edit the synchronous generator data for electromechanical studies.
+
-
1 #include "SyncMachineForm.h"
2 #include "SyncMotor.h"
3 
4 SyncMotor::SyncMotor() : Machines() {}
5 SyncMotor::SyncMotor(wxString name) : Machines() { m_electricalData.name = name; }
6 SyncMotor::~SyncMotor() {}
7 void SyncMotor::DrawSymbol() const { DrawArc(m_position, 12, 30, 330, 10, GL_LINE_STRIP); }
8 bool SyncMotor::GetContextMenu(wxMenu& menu)
9 {
10  menu.Append(ID_EDIT_ELEMENT, _("Edit Synchronous Condenser"));
11  GeneralMenuItens(menu);
12 
13  return true;
14 }
15 
16 bool SyncMotor::ShowForm(wxWindow* parent, Element* element)
17 {
18  SyncMachineForm* syncMotorForm = new SyncMachineForm(parent, this);
19  syncMotorForm->SetTitle(_("Synchronous Condenser"));
20  if(syncMotorForm->ShowModal() == wxID_OK) {
21  syncMotorForm->Destroy();
22  return true;
23  }
24 
25  syncMotorForm->Destroy();
26  return false;
27 }
28 
29 SyncMotorElectricalData SyncMotor::GetPUElectricalData(double systemPowerBase)
30 {
31  SyncMotorElectricalData data = m_electricalData;
32  double machineBasePower = 1.0;
33  if(data.useMachineBase) {
34  machineBasePower = GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
35  }
36 
37  // Active power
38  double activePower = GetValueFromUnit(data.activePower, data.activePowerUnit);
39  if(!m_online) activePower = 0.0;
40  if(data.activePowerUnit == UNIT_PU) {
41  if(data.useMachineBase) data.activePower = (activePower * machineBasePower) / systemPowerBase;
42  } else {
43  data.activePower = activePower / systemPowerBase;
44  }
45  data.activePowerUnit = UNIT_PU;
46 
47  // Reactive power
48  double reactivePower = GetValueFromUnit(data.reactivePower, data.reactivePowerUnit);
49  if(!m_online) reactivePower = 0.0;
50  if(data.reactivePowerUnit == UNIT_PU) {
51  if(data.useMachineBase) data.reactivePower = (reactivePower * machineBasePower) / systemPowerBase;
52  } else {
53  data.reactivePower = reactivePower / systemPowerBase;
54  }
55  data.reactivePowerUnit = UNIT_PU;
56 
57  // Max reactive power
58  double maxReactive = GetValueFromUnit(data.maxReactive, data.maxReactiveUnit);
59  if(data.maxReactiveUnit == UNIT_PU) {
60  if(data.useMachineBase) data.maxReactive = (maxReactive * machineBasePower) / systemPowerBase;
61  } else {
62  data.maxReactive = maxReactive / systemPowerBase;
63  }
64  data.maxReactiveUnit = UNIT_PU;
65 
66  // Min reactive power
67  double minReactive = GetValueFromUnit(data.minReactive, data.minReactiveUnit);
68  if(data.minReactiveUnit == UNIT_PU) {
69  if(data.useMachineBase) data.minReactive = (minReactive * machineBasePower) / systemPowerBase;
70  } else {
71  data.minReactive = minReactive / systemPowerBase;
72  }
73  data.minReactiveUnit = UNIT_PU;
74 
75  double baseVoltage = GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
76  double systemBaseImpedance = (baseVoltage * baseVoltage) / systemPowerBase;
77  double machineBaseImpedance = (baseVoltage * baseVoltage) / machineBasePower;
78 
79  // Fault data
80  if(data.useMachineBase) {
81  data.positiveResistance = (data.positiveResistance * machineBaseImpedance) / systemBaseImpedance;
82  data.positiveReactance = (data.positiveReactance * machineBaseImpedance) / systemBaseImpedance;
83  data.negativeResistance = (data.negativeResistance * machineBaseImpedance) / systemBaseImpedance;
84  data.negativeReactance = (data.negativeReactance * machineBaseImpedance) / systemBaseImpedance;
85  data.zeroResistance = (data.zeroResistance * machineBaseImpedance) / systemBaseImpedance;
86  data.zeroReactance = (data.zeroReactance * machineBaseImpedance) / systemBaseImpedance;
87  data.groundResistance = (data.groundResistance * machineBaseImpedance) / systemBaseImpedance;
88  data.groundReactance = (data.groundReactance * machineBaseImpedance) / systemBaseImpedance;
89  }
90 
91  if(!m_online) {
92  data.faultCurrent[0] = std::complex<double>(0, 0);
93  data.faultCurrent[1] = std::complex<double>(0, 0);
94  data.faultCurrent[2] = std::complex<double>(0, 0);
95  }
96 
97  return data;
98 }
99 
100 void SyncMotor::SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit)
101 {
102  if(nominalVoltage.size() > 0) {
103  m_electricalData.nominalVoltage = nominalVoltage[0];
104  m_electricalData.nominalVoltageUnit = nominalVoltageUnit[0];
105  }
106 }
107 
109 {
110  SyncMotor* copy = new SyncMotor();
111  *copy = *this;
112  return copy;
113 }
114 
115 wxString SyncMotor::GetTipText() const
116 {
117  wxString tipText = m_electricalData.name;
118  tipText += "\n";
119  double activePower = m_electricalData.activePower;
120  if(!m_online) activePower = 0.0;
121  tipText += _("\nP = ") + wxString::FromDouble(activePower, 5);
122  switch(m_electricalData.activePowerUnit) {
123  case UNIT_PU: {
124  tipText += _(" p.u.");
125  } break;
126  case UNIT_W: {
127  tipText += _(" W");
128  } break;
129  case UNIT_kW: {
130  tipText += _(" kW");
131  } break;
132  case UNIT_MW: {
133  tipText += _(" MW");
134  } break;
135  default:
136  break;
137  }
138  double reactivePower = m_electricalData.reactivePower;
139  if(!m_online) reactivePower = 0.0;
140  tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
141  switch(m_electricalData.reactivePowerUnit) {
142  case UNIT_PU: {
143  tipText += _(" p.u.");
144  } break;
145  case UNIT_VAr: {
146  tipText += _(" VAr");
147  } break;
148  case UNIT_kVAr: {
149  tipText += _(" kVAr");
150  } break;
151  case UNIT_MVAr: {
152  tipText += _(" MVAr");
153  } break;
154  default:
155  break;
156  }
157 
158  return tipText;
159 }
-
virtual Element * GetCopy()
Get a the element copy.
Definition: SyncMotor.cpp:108
-
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: SyncMotor.cpp:8
-
virtual wxString GetTipText() const
Get the tip text.
Definition: SyncMotor.cpp:115
- - - - - - - - - -
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
Definition: SyncMotor.cpp:100
- -
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: SyncMotor.cpp:16
- - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "SyncMachineForm.h"
19 #include "SyncMotor.h"
20 
21 SyncMotor::SyncMotor() : Machines() {}
22 SyncMotor::SyncMotor(wxString name) : Machines() { m_electricalData.name = name; }
23 SyncMotor::~SyncMotor() {}
24 void SyncMotor::DrawSymbol() const { DrawArc(m_position, 12, 30, 330, 10, GL_LINE_STRIP); }
25 bool SyncMotor::GetContextMenu(wxMenu& menu)
26 {
27  menu.Append(ID_EDIT_ELEMENT, _("Edit Synchronous Condenser"));
28  GeneralMenuItens(menu);
29 
30  return true;
31 }
32 
33 bool SyncMotor::ShowForm(wxWindow* parent, Element* element)
34 {
35  SyncMachineForm* syncMotorForm = new SyncMachineForm(parent, this);
36  syncMotorForm->SetTitle(_("Synchronous Condenser"));
37  if(syncMotorForm->ShowModal() == wxID_OK) {
38  syncMotorForm->Destroy();
39  return true;
40  }
41 
42  syncMotorForm->Destroy();
43  return false;
44 }
45 
46 SyncMotorElectricalData SyncMotor::GetPUElectricalData(double systemPowerBase)
47 {
48  SyncMotorElectricalData data = m_electricalData;
49  double machineBasePower = 1.0;
50  if(data.useMachineBase) {
51  machineBasePower = GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
52  }
53 
54  // Active power
55  double activePower = GetValueFromUnit(data.activePower, data.activePowerUnit);
56  if(!m_online) activePower = 0.0;
57  if(data.activePowerUnit == UNIT_PU) {
58  if(data.useMachineBase) data.activePower = (activePower * machineBasePower) / systemPowerBase;
59  } else {
60  data.activePower = activePower / systemPowerBase;
61  }
62  data.activePowerUnit = UNIT_PU;
63 
64  // Reactive power
65  double reactivePower = GetValueFromUnit(data.reactivePower, data.reactivePowerUnit);
66  if(!m_online) reactivePower = 0.0;
67  if(data.reactivePowerUnit == UNIT_PU) {
68  if(data.useMachineBase) data.reactivePower = (reactivePower * machineBasePower) / systemPowerBase;
69  } else {
70  data.reactivePower = reactivePower / systemPowerBase;
71  }
72  data.reactivePowerUnit = UNIT_PU;
73 
74  // Max reactive power
75  double maxReactive = GetValueFromUnit(data.maxReactive, data.maxReactiveUnit);
76  if(data.maxReactiveUnit == UNIT_PU) {
77  if(data.useMachineBase) data.maxReactive = (maxReactive * machineBasePower) / systemPowerBase;
78  } else {
79  data.maxReactive = maxReactive / systemPowerBase;
80  }
81  data.maxReactiveUnit = UNIT_PU;
82 
83  // Min reactive power
84  double minReactive = GetValueFromUnit(data.minReactive, data.minReactiveUnit);
85  if(data.minReactiveUnit == UNIT_PU) {
86  if(data.useMachineBase) data.minReactive = (minReactive * machineBasePower) / systemPowerBase;
87  } else {
88  data.minReactive = minReactive / systemPowerBase;
89  }
90  data.minReactiveUnit = UNIT_PU;
91 
92  double baseVoltage = GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
93  double systemBaseImpedance = (baseVoltage * baseVoltage) / systemPowerBase;
94  double machineBaseImpedance = (baseVoltage * baseVoltage) / machineBasePower;
95 
96  // Fault data
97  if(data.useMachineBase) {
98  data.positiveResistance = (data.positiveResistance * machineBaseImpedance) / systemBaseImpedance;
99  data.positiveReactance = (data.positiveReactance * machineBaseImpedance) / systemBaseImpedance;
100  data.negativeResistance = (data.negativeResistance * machineBaseImpedance) / systemBaseImpedance;
101  data.negativeReactance = (data.negativeReactance * machineBaseImpedance) / systemBaseImpedance;
102  data.zeroResistance = (data.zeroResistance * machineBaseImpedance) / systemBaseImpedance;
103  data.zeroReactance = (data.zeroReactance * machineBaseImpedance) / systemBaseImpedance;
104  data.groundResistance = (data.groundResistance * machineBaseImpedance) / systemBaseImpedance;
105  data.groundReactance = (data.groundReactance * machineBaseImpedance) / systemBaseImpedance;
106  }
107 
108  if(!m_online) {
109  data.faultCurrent[0] = std::complex<double>(0, 0);
110  data.faultCurrent[1] = std::complex<double>(0, 0);
111  data.faultCurrent[2] = std::complex<double>(0, 0);
112  }
113 
114  return data;
115 }
116 
117 void SyncMotor::SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit)
118 {
119  if(nominalVoltage.size() > 0) {
120  m_electricalData.nominalVoltage = nominalVoltage[0];
121  m_electricalData.nominalVoltageUnit = nominalVoltageUnit[0];
122  }
123 }
124 
126 {
127  SyncMotor* copy = new SyncMotor();
128  *copy = *this;
129  return copy;
130 }
131 
132 wxString SyncMotor::GetTipText() const
133 {
134  wxString tipText = m_electricalData.name;
135  tipText += "\n";
136  double activePower = m_electricalData.activePower;
137  if(!m_online) activePower = 0.0;
138  tipText += _("\nP = ") + wxString::FromDouble(activePower, 5);
139  switch(m_electricalData.activePowerUnit) {
140  case UNIT_PU: {
141  tipText += _(" p.u.");
142  } break;
143  case UNIT_W: {
144  tipText += _(" W");
145  } break;
146  case UNIT_kW: {
147  tipText += _(" kW");
148  } break;
149  case UNIT_MW: {
150  tipText += _(" MW");
151  } break;
152  default:
153  break;
154  }
155  double reactivePower = m_electricalData.reactivePower;
156  if(!m_online) reactivePower = 0.0;
157  tipText += _("\nQ = ") + wxString::FromDouble(reactivePower, 5);
158  switch(m_electricalData.reactivePowerUnit) {
159  case UNIT_PU: {
160  tipText += _(" p.u.");
161  } break;
162  case UNIT_VAr: {
163  tipText += _(" VAr");
164  } break;
165  case UNIT_kVAr: {
166  tipText += _(" kVAr");
167  } break;
168  case UNIT_MVAr: {
169  tipText += _(" MVAr");
170  } break;
171  default:
172  break;
173  }
174 
175  return tipText;
176 }
+
virtual Element * GetCopy()
Get a the element copy.
Definition: SyncMotor.cpp:125
+
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: SyncMotor.cpp:25
+
virtual wxString GetTipText() const
Get the tip text.
Definition: SyncMotor.cpp:132
+ + + + + +
Form to edit the synchronous machine power data.
+ + + + +
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
Definition: SyncMotor.cpp:117
+ +
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: SyncMotor.cpp:33
+ +
diff --git a/docs/doxygen/html/_sync_motor_8h_source.html b/docs/doxygen/html/_sync_motor_8h_source.html index d4a2879..d443e20 100644 --- a/docs/doxygen/html/_sync_motor_8h_source.html +++ b/docs/doxygen/html/_sync_motor_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,19 +88,19 @@ $(document).ready(function(){initNavTree('_sync_motor_8h_source.html','');});
SyncMotor.h
-
1 #ifndef SYNCMOTOR_H
2 #define SYNCMOTOR_H
3 
4 #include "Machines.h"
5 
6 class SyncMachineForm;
7 
9  // General
10  wxString name = "";
11  double nominalPower = 100.0;
12  ElectricalUnit nominalPowerUnit = UNIT_MVA;
13  double nominalVoltage = 13.8;
14  ElectricalUnit nominalVoltageUnit = UNIT_kV;
15  double activePower = 100.0;
16  ElectricalUnit activePowerUnit = UNIT_MW;
17  double reactivePower = 0.0;
18  ElectricalUnit reactivePowerUnit = UNIT_MVAr;
19  bool haveMaxReactive = false;
20  double maxReactive = 9999.0;
21  ElectricalUnit maxReactiveUnit = UNIT_MVAr;
22  bool haveMinReactive = false;
23  double minReactive = -9999.0;
24  ElectricalUnit minReactiveUnit = UNIT_MVAr;
25  bool useMachineBase = true;
26 
27  // Fault
28  double positiveResistance = 0.0;
29  double positiveReactance = 1.0;
30  double negativeResistance = 0.0;
31  double negativeReactance = 1.0;
32  double zeroResistance = 0.0;
33  double zeroReactance = 1.0;
34  double groundResistance = 0.0;
35  double groundReactance = 0.0;
36  bool groundNeutral = true;
37  // p.u. fault data
38  std::complex<double> faultCurrent[3] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
39  std::complex<double>(0.0, 0.0)};
40 
41  // Stability
42  bool plotSyncMachine = false;
43  double inertia = 1.0;
44  double damping = 0.0;
45  bool useAVR = false;
46  bool useSpeedGovernor = false;
47 
48  double armResistance = 0.0;
49  double potierReactance = 0.0;
50  double satFactor = 0.0;
51 
52  double syncXd = 0.0;
53  double syncXq = 0.0;
54  double transXd = 1.0;
55  double transXq = 0.0;
56  double transTd0 = 0.0;
57  double transTq0 = 0.0;
58  double subXd = 0.0;
59  double subXq = 0.0;
60  double subTd0 = 0.0;
61  double subTq0 = 0.0;
62 
63  // Machine state variables
64  std::complex<double> terminalVoltage;
65  std::vector<std::complex<double> > terminalVoltageVector;
66  std::complex<double> electricalPower;
67  std::vector<std::complex<double> > electricalPowerVector;
68  double pm;
69  std::vector<double> mechanicalPowerVector;
70  double speed;
71  std::vector<double> freqVector;
72  double fieldVoltage;
73  std::vector<double> fieldVoltageVector;
74  double delta;
75  std::vector<double> deltaVector;
76 
77  double initialFieldVoltage;
78 
79  // Internal machine variables
80  double tranEq;
81  double tranEd;
82  double subEq;
83  double subEd;
84  double pe;
85 
86  // Variables to extrapolate
87  double oldId;
88  double oldIq;
89  double oldPe;
90 
91  // Integration constants
92  IntegrationConstant icSpeed;
93  IntegrationConstant icDelta;
94  IntegrationConstant icTranEq;
95  IntegrationConstant icTranEd;
96  IntegrationConstant icSubEq;
97  IntegrationConstant icSubEd;
98 
99  // Control
100  ControlElementContainer* avr = NULL;
101  ControlElementContainer* speedGov = NULL;
102 
103  // Control solvers
104  ControlElementSolver* avrSolver = NULL;
105  ControlElementSolver* speedGovSolver = NULL;
106 
107  Machines::SyncMachineModel model = Machines::SM_MODEL_1;
108 };
109 
110 class SyncMotor : public Machines
111 {
112  public:
113  SyncMotor();
114  SyncMotor(wxString name);
115  ~SyncMotor();
116 
117  virtual Element* GetCopy();
118  virtual void DrawSymbol() const;
119  virtual bool GetContextMenu(wxMenu& menu);
120  virtual wxString GetTipText() const;
121  virtual SyncMotorElectricalData GetElectricalData() { return m_electricalData; }
122  virtual SyncMotorElectricalData GetPUElectricalData(double systemPowerBase);
123  virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
124  virtual void SetElectricalData(SyncMotorElectricalData electricalData) { m_electricalData = electricalData; }
125  virtual bool ShowForm(wxWindow* parent, Element* element);
126 
127  protected:
128  SyncMotorElectricalData m_electricalData;
129 };
130 
131 #endif // SYNCMOTOR_H
- - - -
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
- - - - - - - - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef SYNCMOTOR_H
19 #define SYNCMOTOR_H
20 
21 #include "Machines.h"
22 
23 class SyncMachineForm;
24 
26  // General
27  wxString name = "";
28  double nominalPower = 100.0;
29  ElectricalUnit nominalPowerUnit = UNIT_MVA;
30  double nominalVoltage = 13.8;
31  ElectricalUnit nominalVoltageUnit = UNIT_kV;
32  double activePower = 100.0;
33  ElectricalUnit activePowerUnit = UNIT_MW;
34  double reactivePower = 0.0;
35  ElectricalUnit reactivePowerUnit = UNIT_MVAr;
36  bool haveMaxReactive = false;
37  double maxReactive = 9999.0;
38  ElectricalUnit maxReactiveUnit = UNIT_MVAr;
39  bool haveMinReactive = false;
40  double minReactive = -9999.0;
41  ElectricalUnit minReactiveUnit = UNIT_MVAr;
42  bool useMachineBase = true;
43 
44  // Fault
45  double positiveResistance = 0.0;
46  double positiveReactance = 1.0;
47  double negativeResistance = 0.0;
48  double negativeReactance = 1.0;
49  double zeroResistance = 0.0;
50  double zeroReactance = 1.0;
51  double groundResistance = 0.0;
52  double groundReactance = 0.0;
53  bool groundNeutral = true;
54  // p.u. fault data
55  std::complex<double> faultCurrent[3] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
56  std::complex<double>(0.0, 0.0)};
57 
58  // Stability
59  bool plotSyncMachine = false;
60  double inertia = 1.0;
61  double damping = 0.0;
62  bool useAVR = false;
63  bool useSpeedGovernor = false;
64 
65  double armResistance = 0.0;
66  double potierReactance = 0.0;
67  double satFactor = 0.0;
68 
69  double syncXd = 0.0;
70  double syncXq = 0.0;
71  double transXd = 1.0;
72  double transXq = 0.0;
73  double transTd0 = 0.0;
74  double transTq0 = 0.0;
75  double subXd = 0.0;
76  double subXq = 0.0;
77  double subTd0 = 0.0;
78  double subTq0 = 0.0;
79 
80  // Machine state variables
81  std::complex<double> terminalVoltage;
82  std::vector<std::complex<double> > terminalVoltageVector;
83  std::complex<double> electricalPower;
84  std::vector<std::complex<double> > electricalPowerVector;
85  double pm;
86  std::vector<double> mechanicalPowerVector;
87  double speed;
88  std::vector<double> freqVector;
89  double fieldVoltage;
90  std::vector<double> fieldVoltageVector;
91  double delta;
92  std::vector<double> deltaVector;
93 
94  double initialFieldVoltage;
95 
96  // Internal machine variables
97  double tranEq;
98  double tranEd;
99  double subEq;
100  double subEd;
101  double pe;
102 
103  // Variables to extrapolate
104  double oldId;
105  double oldIq;
106  double oldPe;
107 
108  // Integration constants
109  IntegrationConstant icSpeed;
110  IntegrationConstant icDelta;
111  IntegrationConstant icTranEq;
112  IntegrationConstant icTranEd;
113  IntegrationConstant icSubEq;
114  IntegrationConstant icSubEd;
115 
116  // Control
117  ControlElementContainer* avr = NULL;
118  ControlElementContainer* speedGov = NULL;
119 
120  // Control solvers
121  ControlElementSolver* avrSolver = NULL;
122  ControlElementSolver* speedGovSolver = NULL;
123 
124  Machines::SyncMachineModel model = Machines::SM_MODEL_1;
125 };
126 
127 class SyncMotor : public Machines
128 {
129  public:
130  SyncMotor();
131  SyncMotor(wxString name);
132  ~SyncMotor();
133 
134  virtual Element* GetCopy();
135  virtual void DrawSymbol() const;
136  virtual bool GetContextMenu(wxMenu& menu);
137  virtual wxString GetTipText() const;
138  virtual SyncMotorElectricalData GetElectricalData() { return m_electricalData; }
139  virtual SyncMotorElectricalData GetPUElectricalData(double systemPowerBase);
140  virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
141  virtual void SetElectricalData(SyncMotorElectricalData electricalData) { m_electricalData = electricalData; }
142  virtual bool ShowForm(wxWindow* parent, Element* element);
143 
144  protected:
145  SyncMotorElectricalData m_electricalData;
146 };
147 
148 #endif // SYNCMOTOR_H
+
Solves in the time the control system. Can solve the control system directly from a ControlEditor or ...
+ + +
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+ +
Form to edit the synchronous machine power data.
+ + +
Class that can contain all control elements. Can identify (using RTTI) the elements from a generic li...
+ + +
diff --git a/docs/doxygen/html/_text_8cpp_source.html b/docs/doxygen/html/_text_8cpp_source.html index f42b498..836d285 100644 --- a/docs/doxygen/html/_text_8cpp_source.html +++ b/docs/doxygen/html/_text_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,57 +88,58 @@ $(document).ready(function(){initNavTree('_text_8cpp_source.html','');});
Text.cpp
-
1 #include "TextForm.h"
2 #include "Text.h"
3 
4 #ifdef USING_WX_3_0_X
5 #include "DegreesAndRadians.h"
6 #endif
7 #include "ElectricCalculation.h"
8 #include "Bus.h"
9 #include "Line.h"
10 #include "Transformer.h"
11 #include "SyncGenerator.h"
12 #include "IndMotor.h"
13 #include "SyncMotor.h"
14 #include "Load.h"
15 #include "Inductor.h"
16 #include "Capacitor.h"
17 
18 Text::Text() : GraphicalElement() { SetText(m_text); }
19 Text::Text(wxPoint2DDouble position) : GraphicalElement()
20 {
21  m_position = position;
22  SetText(m_text);
23 }
24 
25 Text::~Text()
26 {
27  if(m_glString) delete m_glString;
28  if(m_glStringArray) delete m_glStringArray;
29 }
30 bool Text::Contains(wxPoint2DDouble position) const
31 {
32  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
33  return m_rect.Contains(ptR);
34 }
35 
36 void Text::Draw(wxPoint2DDouble translation, double scale)
37 {
38  wxScreenDC dc;
39 
40  // Draw selection rectangle
41 
42  // Push the current matrix on stack.
43  glPushMatrix();
44  // Rotate the matrix around the object position.
45  glTranslated(m_position.m_x, m_position.m_y, 0.0);
46  glRotated(m_angle, 0.0, 0.0, 1.0);
47  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
48 
49  if(m_selected) {
50  glColor4d(0.0, 0.5, 1.0, 0.5);
51  DrawRectangle(m_position + wxPoint2DDouble(m_borderSize / 2.0, m_borderSize / 2.0), m_rect.m_width,
52  m_rect.m_height);
53  }
54 
55  // Draw text (layer 2)
56  glEnable(GL_TEXTURE_2D);
57  glColor4d(0.0, 0.0, 0.0, 1.0);
58  if(!m_isMultlineText) { // Only one line
59  m_glString->bind();
60  m_glString->render(m_position.m_x, m_position.m_y);
61  } else { // Multiples lines
62  m_glStringArray->bind();
63  // The text will be printed centralized.
64  double lineHeight = m_height / (double)m_numberOfLines;
65  for(int i = 0; i < m_numberOfLines; i++) {
66  m_glStringArray->get(i)
67  .render(m_position.m_x, m_position.m_y - m_height / 2.0 + lineHeight / 2.0 + lineHeight * double(i));
68  }
69  }
70  glDisable(GL_TEXTURE_2D);
71 
72  glPopMatrix();
73 }
74 
75 bool Text::Intersects(wxRect2DDouble rect) const
76 {
77  if(m_angle == 0.0 || m_angle == 180.0) return m_rect.Intersects(rect);
78  return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0);
79 }
80 
81 void Text::SetText(wxString text)
82 {
83  glEnable(GL_TEXTURE_2D);
84  m_text = text;
85  wxFont font(m_fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
86 
87  wxScreenDC dc;
88  GLuint* idString = NULL;
89  GLuint* idStringArray = NULL;
90 
91  if(m_glString) {
92  delete m_glString;
93  m_glString = NULL;
94 
95  idString = new GLuint;
96  glGenTextures(1, idString);
97  }
98  if(m_glStringArray) {
99  delete m_glStringArray;
100  m_glStringArray = NULL;
101 
102  idStringArray = new GLuint;
103  glGenTextures(1, idStringArray);
104  }
105 
106  m_numberOfLines = m_text.Freq('\n') + 1;
107  if(m_numberOfLines == 1) { // Only one line
108  m_isMultlineText = false;
109  m_glString = new wxGLString(m_text);
110  m_glString->setFont(font);
111  m_glString->consolidate(&dc);
112  m_width = m_glString->getWidth();
113  m_height = m_glString->getheight();
114  } else {
115  m_isMultlineText = true;
116  m_glStringArray = new wxGLStringArray();
117  dc.SetFont(font);
118 
119  m_width = 0.0;
120  m_height = 0.0;
121  wxString multText = m_text;
122  for(int i = 0; i < m_numberOfLines; ++i) {
123  wxString nextLine;
124  wxString currentLine = multText.BeforeFirst('\n', &nextLine);
125  multText = nextLine;
126  m_glStringArray->addString(currentLine);
127 
128  wxSize size = dc.GetTextExtent(currentLine);
129  if(size.GetWidth() > m_width) m_width = size.GetWidth();
130  m_height += size.GetHeight();
131  }
132 
133  m_glStringArray->setFont(font);
134  m_glStringArray->consolidate(&dc);
135  }
136 
137  if(idString) glDeleteTextures(1, idString);
138  if(idStringArray) glDeleteTextures(1, idStringArray);
139 
140  // Update text rectangle.
141  SetPosition(m_position);
142  glDisable(GL_TEXTURE_2D);
143 }
144 
145 void Text::Rotate(bool clockwise)
146 {
147  double rotAngle = m_rotationAngle;
148  if(!clockwise) rotAngle = -m_rotationAngle;
149 
150  m_angle += rotAngle;
151  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
152 }
153 
154 bool Text::ShowForm(wxWindow* parent, std::vector<Element*> elementList)
155 {
156  TextForm* textForm = new TextForm(parent, this, elementList);
157  if(textForm->ShowModal() == wxID_OK) {
158  textForm->Destroy();
159  return true;
160  }
161  textForm->Destroy();
162  return false;
163 }
164 
165 void Text::UpdateText(double systemPowerBase)
166 {
167  switch(m_elementType) {
168  case TYPE_NONE:
169  SetText(m_text);
170  break;
171  case TYPE_BUS: {
172  Bus* bus = static_cast<Bus*>(m_element);
173  if(bus) {
174  BusElectricalData data = bus->GetElectricalData();
175  double baseVoltage = data.nominalVoltage;
176  if(data.nominalVoltageUnit == UNIT_kV) baseVoltage *= 1e3;
177  double baseCurrent = systemPowerBase / (std::sqrt(3.0) * baseVoltage);
178 
179  switch(m_dataType) {
180  case DATA_NAME: {
181  SetText(bus->GetElectricalData().name);
182  } break;
183  case DATA_VOLTAGE: {
184  double voltage = std::abs(data.voltage);
185  switch(m_unit) {
186  case UNIT_PU: {
187  SetText(wxString::FromDouble(voltage, m_decimalPlaces) + " p.u.");
188  } break;
189  case UNIT_V: {
190  SetText(wxString::FromDouble(voltage * baseVoltage, m_decimalPlaces) + " V");
191  } break;
192  case UNIT_kV: {
193  SetText(wxString::FromDouble(voltage * baseVoltage / 1e3, m_decimalPlaces) + " kV");
194  } break;
195  default:
196  break;
197  }
198  } break;
199  case DATA_ANGLE: {
200  double angle = std::arg(data.voltage);
201  switch(m_unit) {
202  case UNIT_RADIAN: {
203  SetText(wxString::FromDouble(angle, m_decimalPlaces) + " rad");
204  } break;
205  case UNIT_DEGREE: {
206  SetText(wxString::FromDouble(wxRadToDeg(angle), m_decimalPlaces) + (wxString)L'\u00B0');
207  } break;
208  default:
209  break;
210  }
211  } break;
212  case DATA_SC_CURRENT: {
213  double faultCurrent[3] = {std::abs(data.faultCurrent[0]), std::abs(data.faultCurrent[1]),
214  std::abs(data.faultCurrent[2])};
215  switch(m_unit) {
216  case UNIT_PU: {
217  wxString str =
218  "Ia = " + wxString::FromDouble(faultCurrent[0], m_decimalPlaces) + " p.u.";
219  str += "\nIb = " + wxString::FromDouble(faultCurrent[1], m_decimalPlaces) + " p.u.";
220  str += "\nIc = " + wxString::FromDouble(faultCurrent[2], m_decimalPlaces) + " p.u.";
221  SetText(str);
222  } break;
223  case UNIT_A: {
224  wxString str = "Ia = " +
225  wxString::FromDouble(faultCurrent[0] * baseCurrent, m_decimalPlaces) +
226  " A";
227  str += "\nIb = " +
228  wxString::FromDouble(faultCurrent[1] * baseCurrent, m_decimalPlaces) + " A";
229  str += "\nIc = " +
230  wxString::FromDouble(faultCurrent[2] * baseCurrent, m_decimalPlaces) + " A";
231  SetText(str);
232  } break;
233  case UNIT_kA: {
234  wxString str =
235  "Ia = " +
236  wxString::FromDouble(faultCurrent[0] * baseCurrent / 1e3, m_decimalPlaces) + " kA";
237  str += "\nIb = " +
238  wxString::FromDouble(faultCurrent[1] * baseCurrent / 1e3, m_decimalPlaces) +
239  " kA";
240  str += "\nIc = " +
241  wxString::FromDouble(faultCurrent[2] * baseCurrent / 1e3, m_decimalPlaces) +
242  " kA";
243  SetText(str);
244  } break;
245  default:
246  break;
247  }
248  } break;
249  case DATA_SC_VOLTAGE: {
250  double faultVoltage[3] = {std::abs(data.faultVoltage[0]), std::abs(data.faultVoltage[1]),
251  std::abs(data.faultVoltage[2])};
252  switch(m_unit) {
253  case UNIT_PU: {
254  wxString str =
255  "Va = " + wxString::FromDouble(faultVoltage[0], m_decimalPlaces) + " p.u.";
256  str += "\nVb = " + wxString::FromDouble(faultVoltage[1], m_decimalPlaces) + " p.u.";
257  str += "\nVc = " + wxString::FromDouble(faultVoltage[2], m_decimalPlaces) + " p.u.";
258  SetText(str);
259  } break;
260  case UNIT_V: {
261  wxString str = "Va = " +
262  wxString::FromDouble(faultVoltage[0] * baseVoltage, m_decimalPlaces) +
263  " V";
264  str += "\nVb = " +
265  wxString::FromDouble(faultVoltage[1] * baseVoltage, m_decimalPlaces) + " V";
266  str += "\nVc = " +
267  wxString::FromDouble(faultVoltage[2] * baseVoltage, m_decimalPlaces) + " V";
268  SetText(str);
269  } break;
270  case UNIT_kV: {
271  wxString str =
272  "Va = " +
273  wxString::FromDouble(faultVoltage[0] * baseVoltage / 1e3, m_decimalPlaces) + " kV";
274  str += "\nVb = " +
275  wxString::FromDouble(faultVoltage[1] * baseVoltage / 1e3, m_decimalPlaces) +
276  " kV";
277  str += "\nVc = " +
278  wxString::FromDouble(faultVoltage[2] * baseVoltage / 1e3, m_decimalPlaces) +
279  " kV";
280  SetText(str);
281  } break;
282  default:
283  break;
284  }
285  } break;
286  case DATA_SC_POWER: {
287  switch(m_unit) {
288  case UNIT_PU: {
289  SetText(wxString::FromDouble(data.scPower, m_decimalPlaces) + " p.u.");
290  } break;
291  case UNIT_VA: {
292  SetText(wxString::FromDouble(data.scPower * systemPowerBase, m_decimalPlaces) + " VA");
293  } break;
294  case UNIT_kVA: {
295  SetText(wxString::FromDouble(data.scPower * systemPowerBase / 1e3, m_decimalPlaces) +
296  " kVA");
297  } break;
298  case UNIT_MVA: {
299  SetText(wxString::FromDouble(data.scPower * systemPowerBase / 1e6, m_decimalPlaces) +
300  " MVA");
301  } break;
302  default:
303  break;
304  }
305  } break;
306  default:
307  break;
308  }
309  }
310  } break;
311  case TYPE_SYNC_GENERATOR: {
312  SyncGenerator* syncGenerator = static_cast<SyncGenerator*>(m_element);
313  if(syncGenerator) {
314  SyncGeneratorElectricalData data = syncGenerator->GetPUElectricalData(systemPowerBase);
315  double baseVoltage = syncGenerator->GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
316  double baseCurrent = systemPowerBase / (std::sqrt(3.0) * baseVoltage);
317  switch(m_dataType) {
318  case DATA_NAME: {
319  SetText(data.name);
320  } break;
321  case DATA_ACTIVE_POWER: {
322  double activePower = data.activePower;
323  if(!syncGenerator->IsOnline()) activePower = 0.0;
324  switch(m_unit) {
325  case UNIT_PU: {
326  SetText(wxString::FromDouble(activePower, m_decimalPlaces) + " p.u.");
327  } break;
328  case UNIT_W: {
329  SetText(wxString::FromDouble(activePower * systemPowerBase, m_decimalPlaces) + " W");
330  } break;
331  case UNIT_kW: {
332  SetText(wxString::FromDouble(activePower * systemPowerBase / 1e3, m_decimalPlaces) +
333  " kW");
334  } break;
335  case UNIT_MW: {
336  SetText(wxString::FromDouble(activePower * systemPowerBase / 1e6, m_decimalPlaces) +
337  " MW");
338  } break;
339  default:
340  break;
341  }
342  } break;
343  case DATA_REACTIVE_POWER: {
344  double reactivePower = data.reactivePower;
345  if(!syncGenerator->IsOnline()) reactivePower = 0.0;
346  switch(m_unit) {
347  case UNIT_PU: {
348  SetText(wxString::FromDouble(reactivePower, m_decimalPlaces) + " p.u.");
349  } break;
350  case UNIT_VAr: {
351  SetText(wxString::FromDouble(reactivePower * systemPowerBase, m_decimalPlaces) +
352  " VAr");
353  } break;
354  case UNIT_kVAr: {
355  SetText(wxString::FromDouble(reactivePower * systemPowerBase / 1e3, m_decimalPlaces) +
356  " kVAr");
357  } break;
358  case UNIT_MVAr: {
359  SetText(wxString::FromDouble(reactivePower * systemPowerBase / 1e6, m_decimalPlaces) +
360  " MVAr");
361  } break;
362  default:
363  break;
364  }
365  } break;
366  case DATA_SC_CURRENT: {
367  double faultCurrent[3] = {std::abs(data.faultCurrent[0]), std::abs(data.faultCurrent[1]),
368  std::abs(data.faultCurrent[2])};
369  switch(m_unit) {
370  case UNIT_PU: {
371  wxString str =
372  "Ia = " + wxString::FromDouble(faultCurrent[0], m_decimalPlaces) + " p.u.";
373  str += "\nIb = " + wxString::FromDouble(faultCurrent[1], m_decimalPlaces) + " p.u.";
374  str += "\nIc = " + wxString::FromDouble(faultCurrent[2], m_decimalPlaces) + " p.u.";
375  SetText(str);
376  } break;
377  case UNIT_A: {
378  wxString str = "Ia = " +
379  wxString::FromDouble(faultCurrent[0] * baseCurrent, m_decimalPlaces) +
380  " A";
381  str += "\nIb = " +
382  wxString::FromDouble(faultCurrent[1] * baseCurrent, m_decimalPlaces) + " A";
383  str += "\nIc = " +
384  wxString::FromDouble(faultCurrent[2] * baseCurrent, m_decimalPlaces) + " A";
385  SetText(str);
386  } break;
387  case UNIT_kA: {
388  wxString str =
389  "Ia = " +
390  wxString::FromDouble(faultCurrent[0] * baseCurrent / 1e3, m_decimalPlaces) + " kA";
391  str += "\nIb = " +
392  wxString::FromDouble(faultCurrent[1] * baseCurrent / 1e3, m_decimalPlaces) +
393  " kA";
394  str += "\nIc = " +
395  wxString::FromDouble(faultCurrent[2] * baseCurrent / 1e3, m_decimalPlaces) +
396  " kA";
397  SetText(str);
398  } break;
399  default:
400  break;
401  }
402  } break;
403  default:
404  break;
405  }
406  }
407  } break;
408  case TYPE_LINE: {
409  Line* line = static_cast<Line*>(m_element);
410  if(line) {
411  LineElectricalData data = line->GetElectricalData();
412  double baseVoltage = data.nominalVoltage;
413  if(data.nominalVoltageUnit == UNIT_kV) baseVoltage *= 1e3;
414  double baseCurrent = systemPowerBase / (std::sqrt(3.0) * baseVoltage);
415  switch(m_dataType) {
416  case DATA_NAME: {
417  SetText(data.name);
418  } break;
419  case DATA_PF_ACTIVE: {
420  double activePF = std::real(data.powerFlow[m_direction]);
421  if(!line->IsOnline()) activePF = 0.0;
422  switch(m_unit) {
423  case UNIT_PU: {
424  SetText(wxString::FromDouble(activePF, m_decimalPlaces) + " p.u.");
425  } break;
426  case UNIT_W: {
427  SetText(wxString::FromDouble(activePF * systemPowerBase, m_decimalPlaces) + " W");
428  } break;
429  case UNIT_kW: {
430  SetText(wxString::FromDouble(activePF * systemPowerBase / 1e3, m_decimalPlaces) +
431  " kW");
432  } break;
433  case UNIT_MW: {
434  SetText(wxString::FromDouble(activePF * systemPowerBase / 1e6, m_decimalPlaces) +
435  " MW");
436  } break;
437  default:
438  break;
439  }
440  } break;
441  case DATA_PF_REACTIVE: {
442  double reactivePF = std::imag(data.powerFlow[m_direction]);
443  if(!line->IsOnline()) reactivePF = 0.0;
444  switch(m_unit) {
445  case UNIT_PU: {
446  SetText(wxString::FromDouble(reactivePF, m_decimalPlaces) + " p.u.");
447  } break;
448  case UNIT_VAr: {
449  SetText(wxString::FromDouble(reactivePF * systemPowerBase, m_decimalPlaces) + " VAr");
450  } break;
451  case UNIT_kVAr: {
452  SetText(wxString::FromDouble(reactivePF * systemPowerBase / 1e3, m_decimalPlaces) +
453  " kVAr");
454  } break;
455  case UNIT_MVAr: {
456  SetText(wxString::FromDouble(reactivePF * systemPowerBase / 1e6, m_decimalPlaces) +
457  " MVAr");
458  } break;
459  default:
460  break;
461  }
462  } break;
463  case DATA_PF_LOSSES: {
464  double losses = std::abs(std::real(data.powerFlow[0]) + std::real(data.powerFlow[1]));
465  if(!line->IsOnline()) losses = 0.0;
466  switch(m_unit) {
467  case UNIT_PU: {
468  SetText(wxString::FromDouble(losses, m_decimalPlaces) + " p.u.");
469  } break;
470  case UNIT_W: {
471  SetText(wxString::FromDouble(losses * systemPowerBase, m_decimalPlaces) + " W");
472  } break;
473  case UNIT_kW: {
474  SetText(wxString::FromDouble(losses * systemPowerBase / 1e3, m_decimalPlaces) + " kW");
475  } break;
476  case UNIT_MW: {
477  SetText(wxString::FromDouble(losses * systemPowerBase / 1e6, m_decimalPlaces) + " MW");
478  } break;
479  default:
480  break;
481  }
482  } break;
483  case DATA_PF_CURRENT: {
484  double current = std::abs(data.current[m_direction]);
485  if(!line->IsOnline()) current = 0.0;
486  switch(m_unit) {
487  case UNIT_PU: {
488  SetText(wxString::FromDouble(current, m_decimalPlaces) + " p.u.");
489  } break;
490  case UNIT_A: {
491  SetText(wxString::FromDouble(current * baseCurrent, m_decimalPlaces) + " A");
492  } break;
493  case UNIT_kA: {
494  SetText(wxString::FromDouble(current * baseCurrent / 1e3, m_decimalPlaces) + " kA");
495  } break;
496  default:
497  break;
498  }
499  } break;
500  case DATA_SC_CURRENT: {
501  double faultCurrent[3] = {std::abs(data.faultCurrent[m_direction][0]),
502  std::abs(data.faultCurrent[m_direction][1]),
503  std::abs(data.faultCurrent[m_direction][2])};
504  if(!line->IsOnline()) faultCurrent[0] = faultCurrent[1] = faultCurrent[2] = 0.0;
505  switch(m_unit) {
506  case UNIT_PU: {
507  wxString str =
508  "Ia = " + wxString::FromDouble(faultCurrent[0], m_decimalPlaces) + " p.u.";
509  str += "\nIb = " + wxString::FromDouble(faultCurrent[1], m_decimalPlaces) + " p.u.";
510  str += "\nIc = " + wxString::FromDouble(faultCurrent[2], m_decimalPlaces) + " p.u.";
511  SetText(str);
512  } break;
513  case UNIT_A: {
514  wxString str = "Ia = " +
515  wxString::FromDouble(faultCurrent[0] * baseCurrent, m_decimalPlaces) +
516  " A";
517  str += "\nIb = " +
518  wxString::FromDouble(faultCurrent[1] * baseCurrent, m_decimalPlaces) + " A";
519  str += "\nIc = " +
520  wxString::FromDouble(faultCurrent[2] * baseCurrent, m_decimalPlaces) + " A";
521  SetText(str);
522  } break;
523  case UNIT_kA: {
524  wxString str =
525  "Ia = " +
526  wxString::FromDouble(faultCurrent[0] * baseCurrent / 1e3, m_decimalPlaces) + " kA";
527  str += "\nIb = " +
528  wxString::FromDouble(faultCurrent[1] * baseCurrent / 1e3, m_decimalPlaces) +
529  " kA";
530  str += "\nIc = " +
531  wxString::FromDouble(faultCurrent[2] * baseCurrent / 1e3, m_decimalPlaces) +
532  " kA";
533  SetText(str);
534  } break;
535  default:
536  break;
537  }
538  } break;
539  default:
540  break;
541  }
542  }
543  } break;
544  case TYPE_TRANSFORMER: {
545  Transformer* transformer = static_cast<Transformer*>(m_element);
546  if(transformer) {
547  TransformerElectricalData data = transformer->GetElectricalData();
548  double baseVoltage[2] = {data.primaryNominalVoltage, data.secondaryNominalVoltage};
549 
550  if(data.primaryNominalVoltageUnit == UNIT_kV) baseVoltage[0] *= 1e3;
551  if(data.secondaryNominalVoltageUnit == UNIT_kV) baseVoltage[1] *= 1e3;
552 
553  double baseCurrent[2] = {systemPowerBase / (std::sqrt(3.0) * baseVoltage[0]),
554  systemPowerBase / (std::sqrt(3.0) * baseVoltage[1])};
555  switch(m_dataType) {
556  case DATA_NAME: {
557  SetText(data.name);
558  } break;
559  case DATA_PF_ACTIVE: {
560  double activePF = std::real(data.powerFlow[m_direction]);
561  if(!transformer->IsOnline()) activePF = 0.0;
562  switch(m_unit) {
563  case UNIT_PU: {
564  SetText(wxString::FromDouble(activePF, m_decimalPlaces) + " p.u.");
565  } break;
566  case UNIT_W: {
567  SetText(wxString::FromDouble(activePF * systemPowerBase, m_decimalPlaces) + " W");
568  } break;
569  case UNIT_kW: {
570  SetText(wxString::FromDouble(activePF * systemPowerBase / 1e3, m_decimalPlaces) +
571  " kW");
572  } break;
573  case UNIT_MW: {
574  SetText(wxString::FromDouble(activePF * systemPowerBase / 1e6, m_decimalPlaces) +
575  " MW");
576  } break;
577  default:
578  break;
579  }
580  } break;
581  case DATA_PF_REACTIVE: {
582  double reactivePF = std::imag(data.powerFlow[m_direction]);
583  if(!transformer->IsOnline()) reactivePF = 0.0;
584  switch(m_unit) {
585  case UNIT_PU: {
586  SetText(wxString::FromDouble(reactivePF, m_decimalPlaces) + " p.u.");
587  } break;
588  case UNIT_VAr: {
589  SetText(wxString::FromDouble(reactivePF * systemPowerBase, m_decimalPlaces) + " VAr");
590  } break;
591  case UNIT_kVAr: {
592  SetText(wxString::FromDouble(reactivePF * systemPowerBase / 1e3, m_decimalPlaces) +
593  " kVAr");
594  } break;
595  case UNIT_MVAr: {
596  SetText(wxString::FromDouble(reactivePF * systemPowerBase / 1e6, m_decimalPlaces) +
597  " MVAr");
598  } break;
599  default:
600  break;
601  }
602  } break;
603  case DATA_PF_LOSSES: {
604  double losses = std::abs(std::real(data.powerFlow[0]) + std::real(data.powerFlow[1]));
605  if(!transformer->IsOnline()) losses = 0.0;
606  switch(m_unit) {
607  case UNIT_PU: {
608  SetText(wxString::FromDouble(losses, m_decimalPlaces) + " p.u.");
609  } break;
610  case UNIT_W: {
611  SetText(wxString::FromDouble(losses * systemPowerBase, m_decimalPlaces) + " W");
612  } break;
613  case UNIT_kW: {
614  SetText(wxString::FromDouble(losses * systemPowerBase / 1e3, m_decimalPlaces) + " kW");
615  } break;
616  case UNIT_MW: {
617  SetText(wxString::FromDouble(losses * systemPowerBase / 1e6, m_decimalPlaces) + " MW");
618  } break;
619  default:
620  break;
621  }
622  } break;
623  case DATA_PF_CURRENT: {
624  double current = std::abs(data.current[m_direction]);
625  if(!transformer->IsOnline()) current = 0.0;
626  switch(m_unit) {
627  case UNIT_PU: {
628  SetText(wxString::FromDouble(current, m_decimalPlaces) + " p.u.");
629  } break;
630  case UNIT_A: {
631  SetText(wxString::FromDouble(current * baseCurrent[m_direction], m_decimalPlaces) +
632  " A");
633  } break;
634  case UNIT_kA: {
635  SetText(
636  wxString::FromDouble(current * baseCurrent[m_direction] / 1e3, m_decimalPlaces) +
637  " kA");
638  } break;
639  default:
640  break;
641  }
642  } break;
643  case DATA_SC_CURRENT: {
644  double faultCurrent[3] = {std::abs(data.faultCurrent[m_direction][0]),
645  std::abs(data.faultCurrent[m_direction][1]),
646  std::abs(data.faultCurrent[m_direction][2])};
647  if(!transformer->IsOnline()) faultCurrent[0] = faultCurrent[1] = faultCurrent[2] = 0.0;
648  switch(m_unit) {
649  case UNIT_PU: {
650  wxString str =
651  "Ia = " + wxString::FromDouble(faultCurrent[0], m_decimalPlaces) + " p.u.";
652  str += "\nIb = " + wxString::FromDouble(faultCurrent[1], m_decimalPlaces) + " p.u.";
653  str += "\nIc = " + wxString::FromDouble(faultCurrent[2], m_decimalPlaces) + " p.u.";
654  SetText(str);
655  } break;
656  case UNIT_A: {
657  wxString str =
658  "Ia = " +
659  wxString::FromDouble(faultCurrent[0] * baseCurrent[m_direction], m_decimalPlaces) +
660  " A";
661  str += "\nIb = " + wxString::FromDouble(faultCurrent[1] * baseCurrent[m_direction],
662  m_decimalPlaces) +
663  " A";
664  str += "\nIc = " + wxString::FromDouble(faultCurrent[2] * baseCurrent[m_direction],
665  m_decimalPlaces) +
666  " A";
667  SetText(str);
668  } break;
669  case UNIT_kA: {
670  wxString str = "Ia = " +
671  wxString::FromDouble(faultCurrent[0] * baseCurrent[m_direction] / 1e3,
672  m_decimalPlaces) +
673  " kA";
674  str += "\nIb = " +
675  wxString::FromDouble(faultCurrent[1] * baseCurrent[m_direction] / 1e3,
676  m_decimalPlaces) +
677  " kA";
678  str += "\nIc = " +
679  wxString::FromDouble(faultCurrent[2] * baseCurrent[m_direction] / 1e3,
680  m_decimalPlaces) +
681  " kA";
682  SetText(str);
683  } break;
684  default:
685  break;
686  }
687  } break;
688  default:
689  break;
690  }
691  }
692  } break;
693  case TYPE_LOAD: {
694  Load* load = static_cast<Load*>(m_element);
695  if(load) {
696  LoadElectricalData data = load->GetPUElectricalData(systemPowerBase);
697  std::complex<double> sPower(data.activePower, data.reactivePower);
698  if(data.loadType == CONST_IMPEDANCE && load->IsOnline()) {
699  std::complex<double> v = static_cast<Bus*>(load->GetParentList()[0])->GetElectricalData().voltage;
700  sPower = std::pow(std::abs(v), 2) * sPower;
701  }
702  if(!load->IsOnline()) sPower = std::complex<double>(0.0, 0.0);
703  switch(m_dataType) {
704  case DATA_NAME: {
705  SetText(data.name);
706  } break;
707  case DATA_ACTIVE_POWER: {
708  switch(m_unit) {
709  case UNIT_PU: {
710  SetText(wxString::FromDouble(sPower.real(), m_decimalPlaces) + " p.u.");
711  }
712  case UNIT_W: {
713  SetText(wxString::FromDouble(sPower.real() * systemPowerBase, m_decimalPlaces) + " W");
714  }
715  case UNIT_kW: {
716  SetText(wxString::FromDouble(sPower.real() * systemPowerBase / 1e3, m_decimalPlaces) +
717  " kW");
718  }
719  case UNIT_MW: {
720  SetText(wxString::FromDouble(sPower.real() * systemPowerBase / 1e6, m_decimalPlaces) +
721  " MW");
722  }
723  default:
724  break;
725  }
726  } break;
727  case DATA_REACTIVE_POWER: {
728  switch(m_unit) {
729  case UNIT_PU: {
730  SetText(wxString::FromDouble(sPower.imag(), m_decimalPlaces) + " p.u.");
731  }
732  case UNIT_VAr: {
733  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase, m_decimalPlaces) +
734  " VAr");
735  }
736  case UNIT_kVAr: {
737  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase / 1e3, m_decimalPlaces) +
738  " kVAr");
739  }
740  case UNIT_MVAr: {
741  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase / 1e6, m_decimalPlaces) +
742  " MVAr");
743  }
744  default:
745  break;
746  }
747  } break;
748  default:
749  break;
750  }
751  }
752  } break;
753  case TYPE_SYNC_MOTOR: {
754  SyncMotor* syncMotor = static_cast<SyncMotor*>(m_element);
755  if(syncMotor) {
756  SyncMotorElectricalData data = syncMotor->GetPUElectricalData(systemPowerBase);
757  std::complex<double> sPower(data.activePower, data.reactivePower);
758  if(!syncMotor->IsOnline()) sPower = std::complex<double>(0.0, 0.0);
759  switch(m_dataType) {
760  case DATA_NAME: {
761  SetText(data.name);
762  } break;
763  case DATA_ACTIVE_POWER: {
764  switch(m_unit) {
765  case UNIT_PU: {
766  SetText(wxString::FromDouble(sPower.real(), m_decimalPlaces) + " p.u.");
767  }
768  case UNIT_W: {
769  SetText(wxString::FromDouble(sPower.real() * systemPowerBase, m_decimalPlaces) + " W");
770  }
771  case UNIT_kW: {
772  SetText(wxString::FromDouble(sPower.real() * systemPowerBase / 1e3, m_decimalPlaces) +
773  " kW");
774  }
775  case UNIT_MW: {
776  SetText(wxString::FromDouble(sPower.real() * systemPowerBase / 1e6, m_decimalPlaces) +
777  " MW");
778  }
779  default:
780  break;
781  }
782  } break;
783  case DATA_REACTIVE_POWER: {
784  switch(m_unit) {
785  case UNIT_PU: {
786  SetText(wxString::FromDouble(sPower.imag(), m_decimalPlaces) + " p.u.");
787  }
788  case UNIT_VAr: {
789  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase, m_decimalPlaces) +
790  " VAr");
791  }
792  case UNIT_kVAr: {
793  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase / 1e3, m_decimalPlaces) +
794  " kVAr");
795  }
796  case UNIT_MVAr: {
797  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase / 1e6, m_decimalPlaces) +
798  " MVAr");
799  }
800  default:
801  break;
802  }
803  } break;
804  default:
805  break;
806  }
807  }
808  } break;
809  case TYPE_IND_MOTOR: {
810  IndMotor* indMotor = static_cast<IndMotor*>(m_element);
811  if(indMotor) {
812  IndMotorElectricalData data = indMotor->GetPUElectricalData(systemPowerBase);
813  std::complex<double> sPower(data.activePower, data.reactivePower);
814  if(!indMotor->IsOnline()) sPower = std::complex<double>(0.0, 0.0);
815  switch(m_dataType) {
816  case DATA_NAME: {
817  SetText(data.name);
818  } break;
819  case DATA_ACTIVE_POWER: {
820  switch(m_unit) {
821  case UNIT_PU: {
822  SetText(wxString::FromDouble(sPower.real(), m_decimalPlaces) + " p.u.");
823  }
824  case UNIT_W: {
825  SetText(wxString::FromDouble(sPower.real() * systemPowerBase, m_decimalPlaces) + " W");
826  }
827  case UNIT_kW: {
828  SetText(wxString::FromDouble(sPower.real() * systemPowerBase / 1e3, m_decimalPlaces) +
829  " kW");
830  }
831  case UNIT_MW: {
832  SetText(wxString::FromDouble(sPower.real() * systemPowerBase / 1e6, m_decimalPlaces) +
833  " MW");
834  }
835  default:
836  break;
837  }
838  } break;
839  case DATA_REACTIVE_POWER: {
840  switch(m_unit) {
841  case UNIT_PU: {
842  SetText(wxString::FromDouble(sPower.imag(), m_decimalPlaces) + " p.u.");
843  }
844  case UNIT_VAr: {
845  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase, m_decimalPlaces) +
846  " VAr");
847  }
848  case UNIT_kVAr: {
849  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase / 1e3, m_decimalPlaces) +
850  " kVAr");
851  }
852  case UNIT_MVAr: {
853  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase / 1e6, m_decimalPlaces) +
854  " MVAr");
855  }
856  default:
857  break;
858  }
859  } break;
860  default:
861  break;
862  }
863  }
864  } break;
865  case TYPE_CAPACITOR: {
866  Capacitor* capacitor = static_cast<Capacitor*>(m_element);
867  if(capacitor) {
868  CapacitorElectricalData data = capacitor->GetPUElectricalData(systemPowerBase);
869  double reativePower = data.reactivePower;
870  if(!capacitor->IsOnline())
871  reativePower = 0.0;
872  else {
873  std::complex<double> v =
874  static_cast<Bus*>(capacitor->GetParentList()[0])->GetElectricalData().voltage;
875  reativePower *= std::pow(std::abs(v), 2);
876  }
877  switch(m_dataType) {
878  case DATA_NAME: {
879  SetText(data.name);
880  } break;
881  case DATA_REACTIVE_POWER: {
882  switch(m_unit) {
883  case UNIT_PU: {
884  SetText(wxString::FromDouble(reativePower, m_decimalPlaces) + " p.u.");
885  }
886  case UNIT_VAr: {
887  SetText(wxString::FromDouble(reativePower * systemPowerBase, m_decimalPlaces) + " VAr");
888  }
889  case UNIT_kVAr: {
890  SetText(wxString::FromDouble(reativePower * systemPowerBase / 1e3, m_decimalPlaces) +
891  " kVAr");
892  }
893  case UNIT_MVAr: {
894  SetText(wxString::FromDouble(reativePower * systemPowerBase / 1e6, m_decimalPlaces) +
895  " MVAr");
896  }
897  default:
898  break;
899  }
900  } break;
901  default:
902  break;
903  }
904  }
905  } break;
906  case TYPE_INDUCTOR: {
907  Inductor* inductor = static_cast<Inductor*>(m_element);
908  if(inductor) {
909  InductorElectricalData data = inductor->GetPUElectricalData(systemPowerBase);
910  double reativePower = data.reactivePower;
911  if(!inductor->IsOnline())
912  reativePower = 0.0;
913  else {
914  std::complex<double> v =
915  static_cast<Bus*>(inductor->GetParentList()[0])->GetElectricalData().voltage;
916  reativePower *= std::pow(std::abs(v), 2);
917  }
918  switch(m_dataType) {
919  case DATA_NAME: {
920  SetText(data.name);
921  } break;
922  case DATA_REACTIVE_POWER: {
923  switch(m_unit) {
924  case UNIT_PU: {
925  SetText(wxString::FromDouble(reativePower, m_decimalPlaces) + " p.u.");
926  }
927  case UNIT_VAr: {
928  SetText(wxString::FromDouble(reativePower * systemPowerBase, m_decimalPlaces) + " VAr");
929  }
930  case UNIT_kVAr: {
931  SetText(wxString::FromDouble(reativePower * systemPowerBase / 1e3, m_decimalPlaces) +
932  " kVAr");
933  }
934  case UNIT_MVAr: {
935  SetText(wxString::FromDouble(reativePower * systemPowerBase / 1e6, m_decimalPlaces) +
936  " MVAr");
937  }
938  default:
939  break;
940  }
941  } break;
942  default:
943  break;
944  }
945  }
946  } break;
947  }
948 }
949 
951 {
952  Text* copy = new Text();
953  *copy = *this;
954  // The pointers to wxGLString must be different or can cause crashes.
955  copy->m_glString = NULL;
956  copy->m_glStringArray = NULL;
957  copy->SetText(copy->m_text);
958  return copy;
959 }
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Text.cpp:30
-
Definition: Text.h:48
- - - - - -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Text.cpp:145
- -
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:517
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "TextForm.h"
19 #include "Text.h"
20 
21 #ifdef USING_WX_3_0_X
22 #include "DegreesAndRadians.h"
23 #endif
24 #include "ElectricCalculation.h"
25 #include "Bus.h"
26 #include "Line.h"
27 #include "Transformer.h"
28 #include "SyncGenerator.h"
29 #include "IndMotor.h"
30 #include "SyncMotor.h"
31 #include "Load.h"
32 #include "Inductor.h"
33 #include "Capacitor.h"
34 
35 Text::Text() : GraphicalElement() { SetText(m_text); }
36 Text::Text(wxPoint2DDouble position) : GraphicalElement()
37 {
38  m_position = position;
39  SetText(m_text);
40 }
41 
42 Text::~Text()
43 {
44  if(m_glString) delete m_glString;
45  if(m_glStringArray) delete m_glStringArray;
46 }
47 bool Text::Contains(wxPoint2DDouble position) const
48 {
49  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
50  return m_rect.Contains(ptR);
51 }
52 
53 void Text::Draw(wxPoint2DDouble translation, double scale)
54 {
55  wxScreenDC dc;
56 
57  // Draw selection rectangle
58 
59  // Push the current matrix on stack.
60  glPushMatrix();
61  // Rotate the matrix around the object position.
62  glTranslated(m_position.m_x, m_position.m_y, 0.0);
63  glRotated(m_angle, 0.0, 0.0, 1.0);
64  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
65 
66  if(m_selected) {
67  glColor4d(0.0, 0.5, 1.0, 0.5);
68  DrawRectangle(m_position + wxPoint2DDouble(m_borderSize / 2.0, m_borderSize / 2.0), m_rect.m_width,
69  m_rect.m_height);
70  }
71 
72  // Draw text (layer 2)
73  glEnable(GL_TEXTURE_2D);
74  glColor4d(0.0, 0.0, 0.0, 1.0);
75  if(!m_isMultlineText) { // Only one line
76  m_glString->bind();
77  m_glString->render(m_position.m_x, m_position.m_y);
78  } else { // Multiples lines
79  m_glStringArray->bind();
80  // The text will be printed centralized.
81  double lineHeight = m_height / (double)m_numberOfLines;
82  for(int i = 0; i < m_numberOfLines; i++) {
83  m_glStringArray->get(i)
84  .render(m_position.m_x, m_position.m_y - m_height / 2.0 + lineHeight / 2.0 + lineHeight * double(i));
85  }
86  }
87  glDisable(GL_TEXTURE_2D);
88 
89  glPopMatrix();
90 }
91 
92 bool Text::Intersects(wxRect2DDouble rect) const
93 {
94  if(m_angle == 0.0 || m_angle == 180.0) return m_rect.Intersects(rect);
95  return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0);
96 }
97 
98 void Text::SetText(wxString text)
99 {
100  glEnable(GL_TEXTURE_2D);
101  m_text = text;
102  wxFont font(m_fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
103 
104  wxScreenDC dc;
105  GLuint* idString = NULL;
106  GLuint* idStringArray = NULL;
107 
108  if(m_glString) {
109  delete m_glString;
110  m_glString = NULL;
111 
112  idString = new GLuint;
113  glGenTextures(1, idString);
114  }
115  if(m_glStringArray) {
116  delete m_glStringArray;
117  m_glStringArray = NULL;
118 
119  idStringArray = new GLuint;
120  glGenTextures(1, idStringArray);
121  }
122 
123  m_numberOfLines = m_text.Freq('\n') + 1;
124  if(m_numberOfLines == 1) { // Only one line
125  m_isMultlineText = false;
126  m_glString = new wxGLString(m_text);
127  m_glString->setFont(font);
128  m_glString->consolidate(&dc);
129  m_width = m_glString->getWidth();
130  m_height = m_glString->getheight();
131  } else {
132  m_isMultlineText = true;
133  m_glStringArray = new wxGLStringArray();
134  dc.SetFont(font);
135 
136  m_width = 0.0;
137  m_height = 0.0;
138  wxString multText = m_text;
139  for(int i = 0; i < m_numberOfLines; ++i) {
140  wxString nextLine;
141  wxString currentLine = multText.BeforeFirst('\n', &nextLine);
142  multText = nextLine;
143  m_glStringArray->addString(currentLine);
144 
145  wxSize size = dc.GetTextExtent(currentLine);
146  if(size.GetWidth() > m_width) m_width = size.GetWidth();
147  m_height += size.GetHeight();
148  }
149 
150  m_glStringArray->setFont(font);
151  m_glStringArray->consolidate(&dc);
152  }
153 
154  if(idString) glDeleteTextures(1, idString);
155  if(idStringArray) glDeleteTextures(1, idStringArray);
156 
157  // Update text rectangle.
158  SetPosition(m_position);
159  glDisable(GL_TEXTURE_2D);
160 }
161 
162 void Text::Rotate(bool clockwise)
163 {
164  double rotAngle = m_rotationAngle;
165  if(!clockwise) rotAngle = -m_rotationAngle;
166 
167  m_angle += rotAngle;
168  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
169 }
170 
171 bool Text::ShowForm(wxWindow* parent, std::vector<Element*> elementList)
172 {
173  TextForm* textForm = new TextForm(parent, this, elementList);
174  if(textForm->ShowModal() == wxID_OK) {
175  textForm->Destroy();
176  return true;
177  }
178  textForm->Destroy();
179  return false;
180 }
181 
182 void Text::UpdateText(double systemPowerBase)
183 {
184  switch(m_elementType) {
185  case TYPE_NONE:
186  SetText(m_text);
187  break;
188  case TYPE_BUS: {
189  Bus* bus = static_cast<Bus*>(m_element);
190  if(bus) {
191  BusElectricalData data = bus->GetElectricalData();
192  double baseVoltage = data.nominalVoltage;
193  if(data.nominalVoltageUnit == UNIT_kV) baseVoltage *= 1e3;
194  double baseCurrent = systemPowerBase / (std::sqrt(3.0) * baseVoltage);
195 
196  switch(m_dataType) {
197  case DATA_NAME: {
198  SetText(bus->GetElectricalData().name);
199  } break;
200  case DATA_VOLTAGE: {
201  double voltage = std::abs(data.voltage);
202  switch(m_unit) {
203  case UNIT_PU: {
204  SetText(wxString::FromDouble(voltage, m_decimalPlaces) + " p.u.");
205  } break;
206  case UNIT_V: {
207  SetText(wxString::FromDouble(voltage * baseVoltage, m_decimalPlaces) + " V");
208  } break;
209  case UNIT_kV: {
210  SetText(wxString::FromDouble(voltage * baseVoltage / 1e3, m_decimalPlaces) + " kV");
211  } break;
212  default:
213  break;
214  }
215  } break;
216  case DATA_ANGLE: {
217  double angle = std::arg(data.voltage);
218  switch(m_unit) {
219  case UNIT_RADIAN: {
220  SetText(wxString::FromDouble(angle, m_decimalPlaces) + " rad");
221  } break;
222  case UNIT_DEGREE: {
223  SetText(wxString::FromDouble(wxRadToDeg(angle), m_decimalPlaces) + (wxString)L'\u00B0');
224  } break;
225  default:
226  break;
227  }
228  } break;
229  case DATA_SC_CURRENT: {
230  double faultCurrent[3] = {std::abs(data.faultCurrent[0]), std::abs(data.faultCurrent[1]),
231  std::abs(data.faultCurrent[2])};
232  switch(m_unit) {
233  case UNIT_PU: {
234  wxString str =
235  "Ia = " + wxString::FromDouble(faultCurrent[0], m_decimalPlaces) + " p.u.";
236  str += "\nIb = " + wxString::FromDouble(faultCurrent[1], m_decimalPlaces) + " p.u.";
237  str += "\nIc = " + wxString::FromDouble(faultCurrent[2], m_decimalPlaces) + " p.u.";
238  SetText(str);
239  } break;
240  case UNIT_A: {
241  wxString str = "Ia = " +
242  wxString::FromDouble(faultCurrent[0] * baseCurrent, m_decimalPlaces) +
243  " A";
244  str += "\nIb = " +
245  wxString::FromDouble(faultCurrent[1] * baseCurrent, m_decimalPlaces) + " A";
246  str += "\nIc = " +
247  wxString::FromDouble(faultCurrent[2] * baseCurrent, m_decimalPlaces) + " A";
248  SetText(str);
249  } break;
250  case UNIT_kA: {
251  wxString str =
252  "Ia = " +
253  wxString::FromDouble(faultCurrent[0] * baseCurrent / 1e3, m_decimalPlaces) + " kA";
254  str += "\nIb = " +
255  wxString::FromDouble(faultCurrent[1] * baseCurrent / 1e3, m_decimalPlaces) +
256  " kA";
257  str += "\nIc = " +
258  wxString::FromDouble(faultCurrent[2] * baseCurrent / 1e3, m_decimalPlaces) +
259  " kA";
260  SetText(str);
261  } break;
262  default:
263  break;
264  }
265  } break;
266  case DATA_SC_VOLTAGE: {
267  double faultVoltage[3] = {std::abs(data.faultVoltage[0]), std::abs(data.faultVoltage[1]),
268  std::abs(data.faultVoltage[2])};
269  switch(m_unit) {
270  case UNIT_PU: {
271  wxString str =
272  "Va = " + wxString::FromDouble(faultVoltage[0], m_decimalPlaces) + " p.u.";
273  str += "\nVb = " + wxString::FromDouble(faultVoltage[1], m_decimalPlaces) + " p.u.";
274  str += "\nVc = " + wxString::FromDouble(faultVoltage[2], m_decimalPlaces) + " p.u.";
275  SetText(str);
276  } break;
277  case UNIT_V: {
278  wxString str = "Va = " +
279  wxString::FromDouble(faultVoltage[0] * baseVoltage, m_decimalPlaces) +
280  " V";
281  str += "\nVb = " +
282  wxString::FromDouble(faultVoltage[1] * baseVoltage, m_decimalPlaces) + " V";
283  str += "\nVc = " +
284  wxString::FromDouble(faultVoltage[2] * baseVoltage, m_decimalPlaces) + " V";
285  SetText(str);
286  } break;
287  case UNIT_kV: {
288  wxString str =
289  "Va = " +
290  wxString::FromDouble(faultVoltage[0] * baseVoltage / 1e3, m_decimalPlaces) + " kV";
291  str += "\nVb = " +
292  wxString::FromDouble(faultVoltage[1] * baseVoltage / 1e3, m_decimalPlaces) +
293  " kV";
294  str += "\nVc = " +
295  wxString::FromDouble(faultVoltage[2] * baseVoltage / 1e3, m_decimalPlaces) +
296  " kV";
297  SetText(str);
298  } break;
299  default:
300  break;
301  }
302  } break;
303  case DATA_SC_POWER: {
304  switch(m_unit) {
305  case UNIT_PU: {
306  SetText(wxString::FromDouble(data.scPower, m_decimalPlaces) + " p.u.");
307  } break;
308  case UNIT_VA: {
309  SetText(wxString::FromDouble(data.scPower * systemPowerBase, m_decimalPlaces) + " VA");
310  } break;
311  case UNIT_kVA: {
312  SetText(wxString::FromDouble(data.scPower * systemPowerBase / 1e3, m_decimalPlaces) +
313  " kVA");
314  } break;
315  case UNIT_MVA: {
316  SetText(wxString::FromDouble(data.scPower * systemPowerBase / 1e6, m_decimalPlaces) +
317  " MVA");
318  } break;
319  default:
320  break;
321  }
322  } break;
323  default:
324  break;
325  }
326  }
327  } break;
328  case TYPE_SYNC_GENERATOR: {
329  SyncGenerator* syncGenerator = static_cast<SyncGenerator*>(m_element);
330  if(syncGenerator) {
331  SyncGeneratorElectricalData data = syncGenerator->GetPUElectricalData(systemPowerBase);
332  double baseVoltage = syncGenerator->GetValueFromUnit(data.nominalVoltage, data.nominalVoltageUnit);
333  double baseCurrent = systemPowerBase / (std::sqrt(3.0) * baseVoltage);
334  switch(m_dataType) {
335  case DATA_NAME: {
336  SetText(data.name);
337  } break;
338  case DATA_ACTIVE_POWER: {
339  double activePower = data.activePower;
340  if(!syncGenerator->IsOnline()) activePower = 0.0;
341  switch(m_unit) {
342  case UNIT_PU: {
343  SetText(wxString::FromDouble(activePower, m_decimalPlaces) + " p.u.");
344  } break;
345  case UNIT_W: {
346  SetText(wxString::FromDouble(activePower * systemPowerBase, m_decimalPlaces) + " W");
347  } break;
348  case UNIT_kW: {
349  SetText(wxString::FromDouble(activePower * systemPowerBase / 1e3, m_decimalPlaces) +
350  " kW");
351  } break;
352  case UNIT_MW: {
353  SetText(wxString::FromDouble(activePower * systemPowerBase / 1e6, m_decimalPlaces) +
354  " MW");
355  } break;
356  default:
357  break;
358  }
359  } break;
360  case DATA_REACTIVE_POWER: {
361  double reactivePower = data.reactivePower;
362  if(!syncGenerator->IsOnline()) reactivePower = 0.0;
363  switch(m_unit) {
364  case UNIT_PU: {
365  SetText(wxString::FromDouble(reactivePower, m_decimalPlaces) + " p.u.");
366  } break;
367  case UNIT_VAr: {
368  SetText(wxString::FromDouble(reactivePower * systemPowerBase, m_decimalPlaces) +
369  " VAr");
370  } break;
371  case UNIT_kVAr: {
372  SetText(wxString::FromDouble(reactivePower * systemPowerBase / 1e3, m_decimalPlaces) +
373  " kVAr");
374  } break;
375  case UNIT_MVAr: {
376  SetText(wxString::FromDouble(reactivePower * systemPowerBase / 1e6, m_decimalPlaces) +
377  " MVAr");
378  } break;
379  default:
380  break;
381  }
382  } break;
383  case DATA_SC_CURRENT: {
384  double faultCurrent[3] = {std::abs(data.faultCurrent[0]), std::abs(data.faultCurrent[1]),
385  std::abs(data.faultCurrent[2])};
386  switch(m_unit) {
387  case UNIT_PU: {
388  wxString str =
389  "Ia = " + wxString::FromDouble(faultCurrent[0], m_decimalPlaces) + " p.u.";
390  str += "\nIb = " + wxString::FromDouble(faultCurrent[1], m_decimalPlaces) + " p.u.";
391  str += "\nIc = " + wxString::FromDouble(faultCurrent[2], m_decimalPlaces) + " p.u.";
392  SetText(str);
393  } break;
394  case UNIT_A: {
395  wxString str = "Ia = " +
396  wxString::FromDouble(faultCurrent[0] * baseCurrent, m_decimalPlaces) +
397  " A";
398  str += "\nIb = " +
399  wxString::FromDouble(faultCurrent[1] * baseCurrent, m_decimalPlaces) + " A";
400  str += "\nIc = " +
401  wxString::FromDouble(faultCurrent[2] * baseCurrent, m_decimalPlaces) + " A";
402  SetText(str);
403  } break;
404  case UNIT_kA: {
405  wxString str =
406  "Ia = " +
407  wxString::FromDouble(faultCurrent[0] * baseCurrent / 1e3, m_decimalPlaces) + " kA";
408  str += "\nIb = " +
409  wxString::FromDouble(faultCurrent[1] * baseCurrent / 1e3, m_decimalPlaces) +
410  " kA";
411  str += "\nIc = " +
412  wxString::FromDouble(faultCurrent[2] * baseCurrent / 1e3, m_decimalPlaces) +
413  " kA";
414  SetText(str);
415  } break;
416  default:
417  break;
418  }
419  } break;
420  default:
421  break;
422  }
423  }
424  } break;
425  case TYPE_LINE: {
426  Line* line = static_cast<Line*>(m_element);
427  if(line) {
428  LineElectricalData data = line->GetElectricalData();
429  double baseVoltage = data.nominalVoltage;
430  if(data.nominalVoltageUnit == UNIT_kV) baseVoltage *= 1e3;
431  double baseCurrent = systemPowerBase / (std::sqrt(3.0) * baseVoltage);
432  switch(m_dataType) {
433  case DATA_NAME: {
434  SetText(data.name);
435  } break;
436  case DATA_PF_ACTIVE: {
437  double activePF = std::real(data.powerFlow[m_direction]);
438  if(!line->IsOnline()) activePF = 0.0;
439  switch(m_unit) {
440  case UNIT_PU: {
441  SetText(wxString::FromDouble(activePF, m_decimalPlaces) + " p.u.");
442  } break;
443  case UNIT_W: {
444  SetText(wxString::FromDouble(activePF * systemPowerBase, m_decimalPlaces) + " W");
445  } break;
446  case UNIT_kW: {
447  SetText(wxString::FromDouble(activePF * systemPowerBase / 1e3, m_decimalPlaces) +
448  " kW");
449  } break;
450  case UNIT_MW: {
451  SetText(wxString::FromDouble(activePF * systemPowerBase / 1e6, m_decimalPlaces) +
452  " MW");
453  } break;
454  default:
455  break;
456  }
457  } break;
458  case DATA_PF_REACTIVE: {
459  double reactivePF = std::imag(data.powerFlow[m_direction]);
460  if(!line->IsOnline()) reactivePF = 0.0;
461  switch(m_unit) {
462  case UNIT_PU: {
463  SetText(wxString::FromDouble(reactivePF, m_decimalPlaces) + " p.u.");
464  } break;
465  case UNIT_VAr: {
466  SetText(wxString::FromDouble(reactivePF * systemPowerBase, m_decimalPlaces) + " VAr");
467  } break;
468  case UNIT_kVAr: {
469  SetText(wxString::FromDouble(reactivePF * systemPowerBase / 1e3, m_decimalPlaces) +
470  " kVAr");
471  } break;
472  case UNIT_MVAr: {
473  SetText(wxString::FromDouble(reactivePF * systemPowerBase / 1e6, m_decimalPlaces) +
474  " MVAr");
475  } break;
476  default:
477  break;
478  }
479  } break;
480  case DATA_PF_LOSSES: {
481  double losses = std::abs(std::real(data.powerFlow[0]) + std::real(data.powerFlow[1]));
482  if(!line->IsOnline()) losses = 0.0;
483  switch(m_unit) {
484  case UNIT_PU: {
485  SetText(wxString::FromDouble(losses, m_decimalPlaces) + " p.u.");
486  } break;
487  case UNIT_W: {
488  SetText(wxString::FromDouble(losses * systemPowerBase, m_decimalPlaces) + " W");
489  } break;
490  case UNIT_kW: {
491  SetText(wxString::FromDouble(losses * systemPowerBase / 1e3, m_decimalPlaces) + " kW");
492  } break;
493  case UNIT_MW: {
494  SetText(wxString::FromDouble(losses * systemPowerBase / 1e6, m_decimalPlaces) + " MW");
495  } break;
496  default:
497  break;
498  }
499  } break;
500  case DATA_PF_CURRENT: {
501  double current = std::abs(data.current[m_direction]);
502  if(!line->IsOnline()) current = 0.0;
503  switch(m_unit) {
504  case UNIT_PU: {
505  SetText(wxString::FromDouble(current, m_decimalPlaces) + " p.u.");
506  } break;
507  case UNIT_A: {
508  SetText(wxString::FromDouble(current * baseCurrent, m_decimalPlaces) + " A");
509  } break;
510  case UNIT_kA: {
511  SetText(wxString::FromDouble(current * baseCurrent / 1e3, m_decimalPlaces) + " kA");
512  } break;
513  default:
514  break;
515  }
516  } break;
517  case DATA_SC_CURRENT: {
518  double faultCurrent[3] = {std::abs(data.faultCurrent[m_direction][0]),
519  std::abs(data.faultCurrent[m_direction][1]),
520  std::abs(data.faultCurrent[m_direction][2])};
521  if(!line->IsOnline()) faultCurrent[0] = faultCurrent[1] = faultCurrent[2] = 0.0;
522  switch(m_unit) {
523  case UNIT_PU: {
524  wxString str =
525  "Ia = " + wxString::FromDouble(faultCurrent[0], m_decimalPlaces) + " p.u.";
526  str += "\nIb = " + wxString::FromDouble(faultCurrent[1], m_decimalPlaces) + " p.u.";
527  str += "\nIc = " + wxString::FromDouble(faultCurrent[2], m_decimalPlaces) + " p.u.";
528  SetText(str);
529  } break;
530  case UNIT_A: {
531  wxString str = "Ia = " +
532  wxString::FromDouble(faultCurrent[0] * baseCurrent, m_decimalPlaces) +
533  " A";
534  str += "\nIb = " +
535  wxString::FromDouble(faultCurrent[1] * baseCurrent, m_decimalPlaces) + " A";
536  str += "\nIc = " +
537  wxString::FromDouble(faultCurrent[2] * baseCurrent, m_decimalPlaces) + " A";
538  SetText(str);
539  } break;
540  case UNIT_kA: {
541  wxString str =
542  "Ia = " +
543  wxString::FromDouble(faultCurrent[0] * baseCurrent / 1e3, m_decimalPlaces) + " kA";
544  str += "\nIb = " +
545  wxString::FromDouble(faultCurrent[1] * baseCurrent / 1e3, m_decimalPlaces) +
546  " kA";
547  str += "\nIc = " +
548  wxString::FromDouble(faultCurrent[2] * baseCurrent / 1e3, m_decimalPlaces) +
549  " kA";
550  SetText(str);
551  } break;
552  default:
553  break;
554  }
555  } break;
556  default:
557  break;
558  }
559  }
560  } break;
561  case TYPE_TRANSFORMER: {
562  Transformer* transformer = static_cast<Transformer*>(m_element);
563  if(transformer) {
564  TransformerElectricalData data = transformer->GetElectricalData();
565  double baseVoltage[2] = {data.primaryNominalVoltage, data.secondaryNominalVoltage};
566 
567  if(data.primaryNominalVoltageUnit == UNIT_kV) baseVoltage[0] *= 1e3;
568  if(data.secondaryNominalVoltageUnit == UNIT_kV) baseVoltage[1] *= 1e3;
569 
570  double baseCurrent[2] = {systemPowerBase / (std::sqrt(3.0) * baseVoltage[0]),
571  systemPowerBase / (std::sqrt(3.0) * baseVoltage[1])};
572  switch(m_dataType) {
573  case DATA_NAME: {
574  SetText(data.name);
575  } break;
576  case DATA_PF_ACTIVE: {
577  double activePF = std::real(data.powerFlow[m_direction]);
578  if(!transformer->IsOnline()) activePF = 0.0;
579  switch(m_unit) {
580  case UNIT_PU: {
581  SetText(wxString::FromDouble(activePF, m_decimalPlaces) + " p.u.");
582  } break;
583  case UNIT_W: {
584  SetText(wxString::FromDouble(activePF * systemPowerBase, m_decimalPlaces) + " W");
585  } break;
586  case UNIT_kW: {
587  SetText(wxString::FromDouble(activePF * systemPowerBase / 1e3, m_decimalPlaces) +
588  " kW");
589  } break;
590  case UNIT_MW: {
591  SetText(wxString::FromDouble(activePF * systemPowerBase / 1e6, m_decimalPlaces) +
592  " MW");
593  } break;
594  default:
595  break;
596  }
597  } break;
598  case DATA_PF_REACTIVE: {
599  double reactivePF = std::imag(data.powerFlow[m_direction]);
600  if(!transformer->IsOnline()) reactivePF = 0.0;
601  switch(m_unit) {
602  case UNIT_PU: {
603  SetText(wxString::FromDouble(reactivePF, m_decimalPlaces) + " p.u.");
604  } break;
605  case UNIT_VAr: {
606  SetText(wxString::FromDouble(reactivePF * systemPowerBase, m_decimalPlaces) + " VAr");
607  } break;
608  case UNIT_kVAr: {
609  SetText(wxString::FromDouble(reactivePF * systemPowerBase / 1e3, m_decimalPlaces) +
610  " kVAr");
611  } break;
612  case UNIT_MVAr: {
613  SetText(wxString::FromDouble(reactivePF * systemPowerBase / 1e6, m_decimalPlaces) +
614  " MVAr");
615  } break;
616  default:
617  break;
618  }
619  } break;
620  case DATA_PF_LOSSES: {
621  double losses = std::abs(std::real(data.powerFlow[0]) + std::real(data.powerFlow[1]));
622  if(!transformer->IsOnline()) losses = 0.0;
623  switch(m_unit) {
624  case UNIT_PU: {
625  SetText(wxString::FromDouble(losses, m_decimalPlaces) + " p.u.");
626  } break;
627  case UNIT_W: {
628  SetText(wxString::FromDouble(losses * systemPowerBase, m_decimalPlaces) + " W");
629  } break;
630  case UNIT_kW: {
631  SetText(wxString::FromDouble(losses * systemPowerBase / 1e3, m_decimalPlaces) + " kW");
632  } break;
633  case UNIT_MW: {
634  SetText(wxString::FromDouble(losses * systemPowerBase / 1e6, m_decimalPlaces) + " MW");
635  } break;
636  default:
637  break;
638  }
639  } break;
640  case DATA_PF_CURRENT: {
641  double current = std::abs(data.current[m_direction]);
642  if(!transformer->IsOnline()) current = 0.0;
643  switch(m_unit) {
644  case UNIT_PU: {
645  SetText(wxString::FromDouble(current, m_decimalPlaces) + " p.u.");
646  } break;
647  case UNIT_A: {
648  SetText(wxString::FromDouble(current * baseCurrent[m_direction], m_decimalPlaces) +
649  " A");
650  } break;
651  case UNIT_kA: {
652  SetText(
653  wxString::FromDouble(current * baseCurrent[m_direction] / 1e3, m_decimalPlaces) +
654  " kA");
655  } break;
656  default:
657  break;
658  }
659  } break;
660  case DATA_SC_CURRENT: {
661  double faultCurrent[3] = {std::abs(data.faultCurrent[m_direction][0]),
662  std::abs(data.faultCurrent[m_direction][1]),
663  std::abs(data.faultCurrent[m_direction][2])};
664  if(!transformer->IsOnline()) faultCurrent[0] = faultCurrent[1] = faultCurrent[2] = 0.0;
665  switch(m_unit) {
666  case UNIT_PU: {
667  wxString str =
668  "Ia = " + wxString::FromDouble(faultCurrent[0], m_decimalPlaces) + " p.u.";
669  str += "\nIb = " + wxString::FromDouble(faultCurrent[1], m_decimalPlaces) + " p.u.";
670  str += "\nIc = " + wxString::FromDouble(faultCurrent[2], m_decimalPlaces) + " p.u.";
671  SetText(str);
672  } break;
673  case UNIT_A: {
674  wxString str =
675  "Ia = " +
676  wxString::FromDouble(faultCurrent[0] * baseCurrent[m_direction], m_decimalPlaces) +
677  " A";
678  str += "\nIb = " + wxString::FromDouble(faultCurrent[1] * baseCurrent[m_direction],
679  m_decimalPlaces) +
680  " A";
681  str += "\nIc = " + wxString::FromDouble(faultCurrent[2] * baseCurrent[m_direction],
682  m_decimalPlaces) +
683  " A";
684  SetText(str);
685  } break;
686  case UNIT_kA: {
687  wxString str = "Ia = " +
688  wxString::FromDouble(faultCurrent[0] * baseCurrent[m_direction] / 1e3,
689  m_decimalPlaces) +
690  " kA";
691  str += "\nIb = " +
692  wxString::FromDouble(faultCurrent[1] * baseCurrent[m_direction] / 1e3,
693  m_decimalPlaces) +
694  " kA";
695  str += "\nIc = " +
696  wxString::FromDouble(faultCurrent[2] * baseCurrent[m_direction] / 1e3,
697  m_decimalPlaces) +
698  " kA";
699  SetText(str);
700  } break;
701  default:
702  break;
703  }
704  } break;
705  default:
706  break;
707  }
708  }
709  } break;
710  case TYPE_LOAD: {
711  Load* load = static_cast<Load*>(m_element);
712  if(load) {
713  LoadElectricalData data = load->GetPUElectricalData(systemPowerBase);
714  std::complex<double> sPower(data.activePower, data.reactivePower);
715  if(data.loadType == CONST_IMPEDANCE && load->IsOnline()) {
716  std::complex<double> v = static_cast<Bus*>(load->GetParentList()[0])->GetElectricalData().voltage;
717  sPower = std::pow(std::abs(v), 2) * sPower;
718  }
719  if(!load->IsOnline()) sPower = std::complex<double>(0.0, 0.0);
720  switch(m_dataType) {
721  case DATA_NAME: {
722  SetText(data.name);
723  } break;
724  case DATA_ACTIVE_POWER: {
725  switch(m_unit) {
726  case UNIT_PU: {
727  SetText(wxString::FromDouble(sPower.real(), m_decimalPlaces) + " p.u.");
728  }
729  case UNIT_W: {
730  SetText(wxString::FromDouble(sPower.real() * systemPowerBase, m_decimalPlaces) + " W");
731  }
732  case UNIT_kW: {
733  SetText(wxString::FromDouble(sPower.real() * systemPowerBase / 1e3, m_decimalPlaces) +
734  " kW");
735  }
736  case UNIT_MW: {
737  SetText(wxString::FromDouble(sPower.real() * systemPowerBase / 1e6, m_decimalPlaces) +
738  " MW");
739  }
740  default:
741  break;
742  }
743  } break;
744  case DATA_REACTIVE_POWER: {
745  switch(m_unit) {
746  case UNIT_PU: {
747  SetText(wxString::FromDouble(sPower.imag(), m_decimalPlaces) + " p.u.");
748  }
749  case UNIT_VAr: {
750  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase, m_decimalPlaces) +
751  " VAr");
752  }
753  case UNIT_kVAr: {
754  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase / 1e3, m_decimalPlaces) +
755  " kVAr");
756  }
757  case UNIT_MVAr: {
758  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase / 1e6, m_decimalPlaces) +
759  " MVAr");
760  }
761  default:
762  break;
763  }
764  } break;
765  default:
766  break;
767  }
768  }
769  } break;
770  case TYPE_SYNC_MOTOR: {
771  SyncMotor* syncMotor = static_cast<SyncMotor*>(m_element);
772  if(syncMotor) {
773  SyncMotorElectricalData data = syncMotor->GetPUElectricalData(systemPowerBase);
774  std::complex<double> sPower(data.activePower, data.reactivePower);
775  if(!syncMotor->IsOnline()) sPower = std::complex<double>(0.0, 0.0);
776  switch(m_dataType) {
777  case DATA_NAME: {
778  SetText(data.name);
779  } break;
780  case DATA_ACTIVE_POWER: {
781  switch(m_unit) {
782  case UNIT_PU: {
783  SetText(wxString::FromDouble(sPower.real(), m_decimalPlaces) + " p.u.");
784  }
785  case UNIT_W: {
786  SetText(wxString::FromDouble(sPower.real() * systemPowerBase, m_decimalPlaces) + " W");
787  }
788  case UNIT_kW: {
789  SetText(wxString::FromDouble(sPower.real() * systemPowerBase / 1e3, m_decimalPlaces) +
790  " kW");
791  }
792  case UNIT_MW: {
793  SetText(wxString::FromDouble(sPower.real() * systemPowerBase / 1e6, m_decimalPlaces) +
794  " MW");
795  }
796  default:
797  break;
798  }
799  } break;
800  case DATA_REACTIVE_POWER: {
801  switch(m_unit) {
802  case UNIT_PU: {
803  SetText(wxString::FromDouble(sPower.imag(), m_decimalPlaces) + " p.u.");
804  }
805  case UNIT_VAr: {
806  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase, m_decimalPlaces) +
807  " VAr");
808  }
809  case UNIT_kVAr: {
810  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase / 1e3, m_decimalPlaces) +
811  " kVAr");
812  }
813  case UNIT_MVAr: {
814  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase / 1e6, m_decimalPlaces) +
815  " MVAr");
816  }
817  default:
818  break;
819  }
820  } break;
821  default:
822  break;
823  }
824  }
825  } break;
826  case TYPE_IND_MOTOR: {
827  IndMotor* indMotor = static_cast<IndMotor*>(m_element);
828  if(indMotor) {
829  IndMotorElectricalData data = indMotor->GetPUElectricalData(systemPowerBase);
830  std::complex<double> sPower(data.activePower, data.reactivePower);
831  if(!indMotor->IsOnline()) sPower = std::complex<double>(0.0, 0.0);
832  switch(m_dataType) {
833  case DATA_NAME: {
834  SetText(data.name);
835  } break;
836  case DATA_ACTIVE_POWER: {
837  switch(m_unit) {
838  case UNIT_PU: {
839  SetText(wxString::FromDouble(sPower.real(), m_decimalPlaces) + " p.u.");
840  }
841  case UNIT_W: {
842  SetText(wxString::FromDouble(sPower.real() * systemPowerBase, m_decimalPlaces) + " W");
843  }
844  case UNIT_kW: {
845  SetText(wxString::FromDouble(sPower.real() * systemPowerBase / 1e3, m_decimalPlaces) +
846  " kW");
847  }
848  case UNIT_MW: {
849  SetText(wxString::FromDouble(sPower.real() * systemPowerBase / 1e6, m_decimalPlaces) +
850  " MW");
851  }
852  default:
853  break;
854  }
855  } break;
856  case DATA_REACTIVE_POWER: {
857  switch(m_unit) {
858  case UNIT_PU: {
859  SetText(wxString::FromDouble(sPower.imag(), m_decimalPlaces) + " p.u.");
860  }
861  case UNIT_VAr: {
862  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase, m_decimalPlaces) +
863  " VAr");
864  }
865  case UNIT_kVAr: {
866  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase / 1e3, m_decimalPlaces) +
867  " kVAr");
868  }
869  case UNIT_MVAr: {
870  SetText(wxString::FromDouble(sPower.imag() * systemPowerBase / 1e6, m_decimalPlaces) +
871  " MVAr");
872  }
873  default:
874  break;
875  }
876  } break;
877  default:
878  break;
879  }
880  }
881  } break;
882  case TYPE_CAPACITOR: {
883  Capacitor* capacitor = static_cast<Capacitor*>(m_element);
884  if(capacitor) {
885  CapacitorElectricalData data = capacitor->GetPUElectricalData(systemPowerBase);
886  double reativePower = data.reactivePower;
887  if(!capacitor->IsOnline())
888  reativePower = 0.0;
889  else {
890  std::complex<double> v =
891  static_cast<Bus*>(capacitor->GetParentList()[0])->GetElectricalData().voltage;
892  reativePower *= std::pow(std::abs(v), 2);
893  }
894  switch(m_dataType) {
895  case DATA_NAME: {
896  SetText(data.name);
897  } break;
898  case DATA_REACTIVE_POWER: {
899  switch(m_unit) {
900  case UNIT_PU: {
901  SetText(wxString::FromDouble(reativePower, m_decimalPlaces) + " p.u.");
902  }
903  case UNIT_VAr: {
904  SetText(wxString::FromDouble(reativePower * systemPowerBase, m_decimalPlaces) + " VAr");
905  }
906  case UNIT_kVAr: {
907  SetText(wxString::FromDouble(reativePower * systemPowerBase / 1e3, m_decimalPlaces) +
908  " kVAr");
909  }
910  case UNIT_MVAr: {
911  SetText(wxString::FromDouble(reativePower * systemPowerBase / 1e6, m_decimalPlaces) +
912  " MVAr");
913  }
914  default:
915  break;
916  }
917  } break;
918  default:
919  break;
920  }
921  }
922  } break;
923  case TYPE_INDUCTOR: {
924  Inductor* inductor = static_cast<Inductor*>(m_element);
925  if(inductor) {
926  InductorElectricalData data = inductor->GetPUElectricalData(systemPowerBase);
927  double reativePower = data.reactivePower;
928  if(!inductor->IsOnline())
929  reativePower = 0.0;
930  else {
931  std::complex<double> v =
932  static_cast<Bus*>(inductor->GetParentList()[0])->GetElectricalData().voltage;
933  reativePower *= std::pow(std::abs(v), 2);
934  }
935  switch(m_dataType) {
936  case DATA_NAME: {
937  SetText(data.name);
938  } break;
939  case DATA_REACTIVE_POWER: {
940  switch(m_unit) {
941  case UNIT_PU: {
942  SetText(wxString::FromDouble(reativePower, m_decimalPlaces) + " p.u.");
943  }
944  case UNIT_VAr: {
945  SetText(wxString::FromDouble(reativePower * systemPowerBase, m_decimalPlaces) + " VAr");
946  }
947  case UNIT_kVAr: {
948  SetText(wxString::FromDouble(reativePower * systemPowerBase / 1e3, m_decimalPlaces) +
949  " kVAr");
950  }
951  case UNIT_MVAr: {
952  SetText(wxString::FromDouble(reativePower * systemPowerBase / 1e6, m_decimalPlaces) +
953  " MVAr");
954  }
955  default:
956  break;
957  }
958  } break;
959  default:
960  break;
961  }
962  }
963  } break;
964  }
965 }
966 
968 {
969  Text* copy = new Text();
970  *copy = *this;
971  // The pointers to wxGLString must be different or can cause crashes.
972  copy->m_glString = NULL;
973  copy->m_glStringArray = NULL;
974  copy->SetText(copy->m_text);
975  return copy;
976 }
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Text.cpp:47
+
Definition: Text.h:65
+ + + + + +
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Text.cpp:162
+ +
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:506
+
Base class of electric calculations, with general methods.
- - - - -
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Text.cpp:75
- -
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:91
- -
virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode=GL_QUADS) const
Draw rectangle.
Definition: Element.cpp:53
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Text.cpp:950
- -
Definition: Bus.h:45
-
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:219
- - -
void SetPosition(const wxPoint2DDouble position)
Set the element position and update the rectangle.
Definition: Element.cpp:10
- - -
Definition: Line.h:35
-
Definition: Load.h:23
- - - - - - - - - - - + + + + +
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Text.cpp:92
+ +
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:107
+ +
virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode=GL_QUADS) const
Draw rectangle.
Definition: Element.cpp:69
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Text.cpp:967
+ +
Definition: Bus.h:62
+
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:227
+ + +
void SetPosition(const wxPoint2DDouble position)
Set the element position and update the rectangle.
Definition: Element.cpp:25
+ +
Form to edit the text graphical data.
Definition: TextForm.h:32
+
Definition: Line.h:52
+
Definition: Load.h:35
+ + + + + + + + + + + + -
virtual bool RotatedRectanglesIntersects(wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const
Check if two roteted rectangles intersect.
Definition: Element.cpp:132
- +
virtual bool RotatedRectanglesIntersects(wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const
Check if two roteted rectangles intersect.
Definition: Element.cpp:147
+ - - - - + + + +
diff --git a/docs/doxygen/html/_text_8h_source.html b/docs/doxygen/html/_text_8h_source.html index 1eff68c..7d6d796 100644 --- a/docs/doxygen/html/_text_8h_source.html +++ b/docs/doxygen/html/_text_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,28 +88,28 @@ $(document).ready(function(){initNavTree('_text_8h_source.html','');});
Text.h
-
1 #ifndef TEXT_H
2 #define TEXT_H
3 
4 #include "GraphicalElement.h"
5 #include "PowerElement.h"
6 #include "wxGLString.h"
7 
8 class TextForm;
9 
10 class Bus;
11 class Line;
12 class Transformer;
13 class SyncGenerator;
14 class IndMotor;
15 class SyncMotor;
16 class Load;
17 class Inductor;
18 class Capacitor;
19 
20 enum ElementType {
21  TYPE_NONE = 0,
22  TYPE_BUS,
23  TYPE_CAPACITOR,
24  TYPE_IND_MOTOR,
25  TYPE_INDUCTOR,
26  TYPE_LINE,
27  TYPE_LOAD,
28  TYPE_SYNC_GENERATOR,
29  TYPE_SYNC_MOTOR,
30  TYPE_TRANSFORMER
31 };
32 
33 enum DataType {
34  DATA_NAME,
35  DATA_VOLTAGE,
36  DATA_ANGLE,
37  DATA_SC_CURRENT,
38  DATA_SC_VOLTAGE,
39  DATA_SC_POWER,
40  DATA_ACTIVE_POWER,
41  DATA_REACTIVE_POWER,
42  DATA_PF_ACTIVE,
43  DATA_PF_REACTIVE,
44  DATA_PF_LOSSES,
45  DATA_PF_CURRENT
46 };
47 
48 class Text : public GraphicalElement
49 {
50 public:
51  Text();
52  Text(wxPoint2DDouble position);
53  ~Text();
54 
55  virtual Element* GetCopy();
56  virtual bool AddParent(Element* parent, wxPoint2DDouble position) { return true; };
57  virtual bool Contains(wxPoint2DDouble position) const;
58  virtual void Draw(wxPoint2DDouble translation, double scale);
59  virtual bool Intersects(wxRect2DDouble rect) const;
60  virtual void Rotate(bool clockwise = true);
61  virtual bool ShowForm(wxWindow* parent, std::vector<Element*> elementList);
62  virtual void UpdateText(double systemPowerBase);
63  virtual wxString GetText() const { return m_text; }
64  virtual void SetText(wxString text);
65 
66  void SetDataType(const DataType& dataType) { m_dataType = dataType; }
67  void SetDirection(int direction) { m_direction = direction; }
68  void SetElement(Element* element) { m_element = element; }
69  void SetElementNumber(int elementNumber) { m_elementNumber = elementNumber; }
70  void SetElementType(const ElementType elementType) { m_elementType = elementType; }
71  void SetFontSize(int fontSize) { m_fontSize = fontSize; }
72  void SetUnit(const ElectricalUnit unit) { m_unit = unit; }
73  void SetDecimalPlaces(int decimalPlaces) { m_decimalPlaces = decimalPlaces; }
74  const DataType GetDataType() const { return m_dataType; }
75  int GetDirection() const { return m_direction; }
76  Element* GetElement() { return m_element; }
77  int GetElementNumber() const { return m_elementNumber; }
78  const ElementType GetElementType() const { return m_elementType; }
79  int GetFontSize() const { return m_fontSize; }
80  const ElectricalUnit GetUnit() const { return m_unit; }
81  int GetDecimalPlaces() const { return m_decimalPlaces; }
82 
83 protected:
84  wxGLString* m_glString = NULL;
85  wxGLStringArray* m_glStringArray = NULL;
86 
87  wxString m_text = _("Text");
88  int m_numberOfLines;
89  bool m_isMultlineText = false;
90  int m_fontSize = 10;
91 
92  Element* m_element = NULL;
93  ElementType m_elementType = TYPE_NONE;
94  int m_elementNumber;
95  DataType m_dataType;
96  ElectricalUnit m_unit;
97  int m_direction = 0;
98  int m_decimalPlaces = 2;
99 };
100 
101 #endif // TEXT_H
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Text.cpp:30
-
Definition: Text.h:48
- - -
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Text.cpp:145
- -
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Text.cpp:75
-
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Text.cpp:950
-
Definition: Bus.h:45
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Text.h:56
- -
Definition: Line.h:35
-
Definition: Load.h:23
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef TEXT_H
19 #define TEXT_H
20 
21 #include "GraphicalElement.h"
22 #include "PowerElement.h"
23 #include "wxGLString.h"
24 
25 class TextForm;
26 
27 class Bus;
28 class Line;
29 class Transformer;
30 class SyncGenerator;
31 class IndMotor;
32 class SyncMotor;
33 class Load;
34 class Inductor;
35 class Capacitor;
36 
37 enum ElementType {
38  TYPE_NONE = 0,
39  TYPE_BUS,
40  TYPE_CAPACITOR,
41  TYPE_IND_MOTOR,
42  TYPE_INDUCTOR,
43  TYPE_LINE,
44  TYPE_LOAD,
45  TYPE_SYNC_GENERATOR,
46  TYPE_SYNC_MOTOR,
47  TYPE_TRANSFORMER
48 };
49 
50 enum DataType {
51  DATA_NAME,
52  DATA_VOLTAGE,
53  DATA_ANGLE,
54  DATA_SC_CURRENT,
55  DATA_SC_VOLTAGE,
56  DATA_SC_POWER,
57  DATA_ACTIVE_POWER,
58  DATA_REACTIVE_POWER,
59  DATA_PF_ACTIVE,
60  DATA_PF_REACTIVE,
61  DATA_PF_LOSSES,
62  DATA_PF_CURRENT
63 };
64 
65 class Text : public GraphicalElement
66 {
67  public:
68  Text();
69  Text(wxPoint2DDouble position);
70  ~Text();
71 
72  virtual Element* GetCopy();
73  virtual bool AddParent(Element* parent, wxPoint2DDouble position) { return true; };
74  virtual bool Contains(wxPoint2DDouble position) const;
75  virtual void Draw(wxPoint2DDouble translation, double scale);
76  virtual bool Intersects(wxRect2DDouble rect) const;
77  virtual void Rotate(bool clockwise = true);
78  virtual bool ShowForm(wxWindow* parent, std::vector<Element*> elementList);
79  virtual void UpdateText(double systemPowerBase);
80  virtual wxString GetText() const { return m_text; }
81  virtual void SetText(wxString text);
82 
83  void SetDataType(const DataType& dataType) { m_dataType = dataType; }
84  void SetDirection(int direction) { m_direction = direction; }
85  void SetElement(Element* element) { m_element = element; }
86  void SetElementNumber(int elementNumber) { m_elementNumber = elementNumber; }
87  void SetElementType(const ElementType elementType) { m_elementType = elementType; }
88  void SetFontSize(int fontSize) { m_fontSize = fontSize; }
89  void SetUnit(const ElectricalUnit unit) { m_unit = unit; }
90  void SetDecimalPlaces(int decimalPlaces) { m_decimalPlaces = decimalPlaces; }
91  const DataType GetDataType() const { return m_dataType; }
92  int GetDirection() const { return m_direction; }
93  Element* GetElement() { return m_element; }
94  int GetElementNumber() const { return m_elementNumber; }
95  const ElementType GetElementType() const { return m_elementType; }
96  int GetFontSize() const { return m_fontSize; }
97  const ElectricalUnit GetUnit() const { return m_unit; }
98  int GetDecimalPlaces() const { return m_decimalPlaces; }
99  protected:
100  wxGLString* m_glString = NULL;
101  wxGLStringArray* m_glStringArray = NULL;
102 
103  wxString m_text = _("Text");
104  int m_numberOfLines;
105  bool m_isMultlineText = false;
106  int m_fontSize = 10;
107 
108  Element* m_element = NULL;
109  ElementType m_elementType = TYPE_NONE;
110  int m_elementNumber;
111  DataType m_dataType;
112  ElectricalUnit m_unit;
113  int m_direction = 0;
114  int m_decimalPlaces = 2;
115 };
116 
117 #endif // TEXT_H
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Text.cpp:47
+
Definition: Text.h:65
+ + +
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Text.cpp:162
+ +
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Text.cpp:92
+
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Text.cpp:967
+
Definition: Bus.h:62
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Text.h:73
+
Form to edit the text graphical data.
Definition: TextForm.h:32
+
Definition: Line.h:52
+
Definition: Load.h:35
Switching data of power elements.
- - - - + + + + - +
diff --git a/docs/doxygen/html/_text_form_8cpp_source.html b/docs/doxygen/html/_text_form_8cpp_source.html index 560f7a4..9fc285f 100644 --- a/docs/doxygen/html/_text_form_8cpp_source.html +++ b/docs/doxygen/html/_text_form_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,33 +88,34 @@ $(document).ready(function(){initNavTree('_text_form_8cpp_source.html','');});
TextForm.cpp
-
1 #include "TextForm.h"
2 
3 TextForm::TextForm(wxWindow* parent, Text* text, std::vector<Element*> elementList, double systemPowerBase)
4  : TextFormBase(parent)
5 {
6  SetSize(GetBestSize());
7  m_parent = parent;
8  m_textToEdit = text;
9  m_allElements.GetElementsFromList(elementList);
10  m_systemPowerBase = systemPowerBase;
11 
12  m_text = new Text();
13  m_text->SetElementType(text->GetElementType());
14  m_text->SetElementNumber(text->GetElementNumber());
15  m_text->SetElement(text->GetElement());
16  m_text->SetDataType(text->GetDataType());
17  m_text->SetDirection(text->GetDirection());
18  m_text->SetUnit(text->GetUnit());
19  m_text->SetDecimalPlaces(text->GetDecimalPlaces());
20 
21  if(!LoadChoices()) {
22  m_choiceName->Enable(false);
23  m_choiceTextType->Enable(false);
24  m_choiceTextFromBus->Enable(false);
25  m_choiceTextToBus->Enable(false);
26  m_choiceTextUnit->Enable(false);
27  }
28 }
29 
30 TextForm::~TextForm() {}
31 void TextForm::OnElementChoiceSelected(wxCommandEvent& event)
32 {
33  switch(m_choiceElement->GetSelection()) {
34  case 0: {
35  m_text->SetElementType(TYPE_BUS);
36  } break;
37  case 1: {
38  m_text->SetElementType(TYPE_SYNC_GENERATOR);
39  } break;
40  case 2: {
41  m_text->SetElementType(TYPE_LINE);
42  } break;
43  case 3: {
44  m_text->SetElementType(TYPE_TRANSFORMER);
45  } break;
46  case 4: {
47  m_text->SetElementType(TYPE_LOAD);
48  } break;
49  case 5: {
50  m_text->SetElementType(TYPE_CAPACITOR);
51  } break;
52  case 6: {
53  m_text->SetElementType(TYPE_INDUCTOR);
54  } break;
55  case 7: {
56  m_text->SetElementType(TYPE_SYNC_MOTOR);
57  } break;
58  case 8: {
59  m_text->SetElementType(TYPE_IND_MOTOR);
60  } break;
61 
62  default:
63  break;
64  }
65 
66  ElementTypeChoice();
67 }
68 
69 void TextForm::OnFromBusChoiceSelected(wxCommandEvent& event)
70 {
71  m_text->SetDirection(m_choiceTextFromBus->GetSelection());
72  m_choiceTextToBus->SetSelection(m_choiceTextFromBus->GetSelection());
73 }
74 
75 void TextForm::OnNameChoiceSelected(wxCommandEvent& event)
76 {
77  m_text->SetElementNumber(m_choiceName->GetSelection());
78  ElementNumberChoice();
79 }
80 
81 void TextForm::OnTextEnter(wxCommandEvent& event) { Preview(); }
82 void TextForm::OnToBusChoiceSelected(wxCommandEvent& event)
83 {
84  m_text->SetDirection(m_choiceTextToBus->GetSelection());
85  m_choiceTextFromBus->SetSelection(m_choiceTextToBus->GetSelection());
86 }
87 
88 void TextForm::OnUnitChoiceSelected(wxCommandEvent& event)
89 {
90  UnitChoice();
91  Preview();
92 }
93 
94 void TextForm::OnTypeChoiceSelected(wxCommandEvent& event)
95 {
96  switch(m_text->GetElementType()) {
97  case TYPE_BUS: {
98  switch(m_choiceTextType->GetSelection()) {
99  case 0: {
100  m_text->SetDataType(DATA_NAME);
101  } break;
102  case 1: {
103  m_text->SetDataType(DATA_VOLTAGE);
104  } break;
105  case 2: {
106  m_text->SetDataType(DATA_ANGLE);
107  } break;
108  case 3: {
109  m_text->SetDataType(DATA_SC_CURRENT);
110  } break;
111  case 4: {
112  m_text->SetDataType(DATA_SC_VOLTAGE);
113  } break;
114  case 5: {
115  m_text->SetDataType(DATA_SC_POWER);
116  } break;
117  }
118  } break;
119  case TYPE_SYNC_GENERATOR: {
120  switch(m_choiceTextType->GetSelection()) {
121  case 0: {
122  m_text->SetDataType(DATA_NAME);
123  } break;
124  case 1: {
125  m_text->SetDataType(DATA_ACTIVE_POWER);
126  } break;
127  case 2: {
128  m_text->SetDataType(DATA_REACTIVE_POWER);
129  } break;
130  case 3: {
131  m_text->SetDataType(DATA_SC_CURRENT);
132  } break;
133  }
134  } break;
135  case TYPE_LINE:
136  case TYPE_TRANSFORMER: {
137  switch(m_choiceTextType->GetSelection()) {
138  case 0: {
139  m_text->SetDataType(DATA_NAME);
140  } break;
141  case 1: {
142  m_text->SetDataType(DATA_PF_ACTIVE);
143  } break;
144  case 2: {
145  m_text->SetDataType(DATA_PF_REACTIVE);
146  } break;
147  case 3: {
148  m_text->SetDataType(DATA_PF_LOSSES);
149  } break;
150  case 4: {
151  m_text->SetDataType(DATA_PF_CURRENT);
152  } break;
153  case 5: {
154  m_text->SetDataType(DATA_SC_CURRENT);
155  } break;
156  }
157  } break;
158  case TYPE_LOAD:
159  case TYPE_SYNC_MOTOR:
160  case TYPE_IND_MOTOR: {
161  switch(m_choiceTextType->GetSelection()) {
162  case 0: {
163  m_text->SetDataType(DATA_NAME);
164  } break;
165  case 1: {
166  m_text->SetDataType(DATA_ACTIVE_POWER);
167  } break;
168  case 2: {
169  m_text->SetDataType(DATA_REACTIVE_POWER);
170  } break;
171  }
172  } break;
173  case TYPE_CAPACITOR:
174  case TYPE_INDUCTOR: {
175  switch(m_choiceTextType->GetSelection()) {
176  case 0: {
177  m_text->SetDataType(DATA_NAME);
178  } break;
179  case 1: {
180  m_text->SetDataType(DATA_REACTIVE_POWER);
181  } break;
182  }
183  } break;
184  default:
185  break;
186  }
187  DataTypeChoice();
188 
189  if(m_text->GetDataType() == DATA_NAME) Preview();
190 }
191 
192 bool TextForm::LoadChoices()
193 {
194  if(m_text->GetElementType() == TYPE_NONE) return false;
195 
196  // Fill the element possible choices.
197  ElementTypeChoice();
198  m_choiceName->SetSelection(m_text->GetElementNumber());
199  ElementNumberChoice();
200  DataTypeChoice();
201 
202  // Select the saved choices.
203  switch(m_text->GetElementType()) {
204  case TYPE_BUS: {
205  m_choiceElement->SetSelection(0);
206  switch(m_text->GetDataType()) {
207  case DATA_NAME: {
208  m_choiceTextType->SetSelection(0);
209  } break;
210  case DATA_VOLTAGE: {
211  m_choiceTextType->SetSelection(1);
212  switch(m_text->GetUnit()) {
213  case UNIT_PU: {
214  m_choiceTextUnit->SetSelection(0);
215  } break;
216  case UNIT_V: {
217  m_choiceTextUnit->SetSelection(1);
218  } break;
219  case UNIT_kV: {
220  m_choiceTextUnit->SetSelection(2);
221  } break;
222  default:
223  break;
224  }
225 
226  } break;
227  case DATA_ANGLE: {
228  m_choiceTextType->SetSelection(2);
229  switch(m_text->GetUnit()) {
230  case UNIT_DEGREE: {
231  m_choiceTextUnit->SetSelection(0);
232  } break;
233  case UNIT_RADIAN: {
234  m_choiceTextUnit->SetSelection(1);
235  } break;
236  default:
237  break;
238  }
239  } break;
240  case DATA_SC_CURRENT: {
241  m_choiceTextType->SetSelection(3);
242  switch(m_text->GetUnit()) {
243  case UNIT_PU: {
244  m_choiceTextUnit->SetSelection(0);
245  } break;
246  case UNIT_A: {
247  m_choiceTextUnit->SetSelection(1);
248  } break;
249  case UNIT_kA: {
250  m_choiceTextUnit->SetSelection(2);
251  } break;
252  default:
253  break;
254  }
255  } break;
256  case DATA_SC_VOLTAGE: {
257  m_choiceTextType->SetSelection(4);
258  switch(m_text->GetUnit()) {
259  case UNIT_PU: {
260  m_choiceTextUnit->SetSelection(0);
261  } break;
262  case UNIT_V: {
263  m_choiceTextUnit->SetSelection(1);
264  } break;
265  case UNIT_kV: {
266  m_choiceTextUnit->SetSelection(2);
267  } break;
268  default:
269  break;
270  }
271  } break;
272  case DATA_SC_POWER: {
273  m_choiceTextType->SetSelection(5);
274  switch(m_text->GetUnit()) {
275  case UNIT_PU: {
276  m_choiceTextUnit->SetSelection(0);
277  } break;
278  case UNIT_VA: {
279  m_choiceTextUnit->SetSelection(1);
280  } break;
281  case UNIT_kVA: {
282  m_choiceTextUnit->SetSelection(2);
283  } break;
284  case UNIT_MVA: {
285  m_choiceTextUnit->SetSelection(3);
286  } break;
287  default:
288  break;
289  }
290  } break;
291  default:
292  break;
293  }
294  } break;
295  case TYPE_SYNC_GENERATOR: {
296  m_choiceElement->SetSelection(1);
297  switch(m_text->GetDataType()) {
298  case DATA_NAME: {
299  m_choiceTextType->SetSelection(0);
300  } break;
301  case DATA_ACTIVE_POWER: {
302  m_choiceTextType->SetSelection(1);
303  switch(m_text->GetUnit()) {
304  case UNIT_PU: {
305  m_choiceTextUnit->SetSelection(0);
306  } break;
307  case UNIT_W: {
308  m_choiceTextUnit->SetSelection(1);
309  } break;
310  case UNIT_kW: {
311  m_choiceTextUnit->SetSelection(2);
312  } break;
313  case UNIT_MW: {
314  m_choiceTextUnit->SetSelection(3);
315  } break;
316  default:
317  break;
318  }
319  } break;
320  case DATA_REACTIVE_POWER: {
321  m_choiceTextType->SetSelection(2);
322  switch(m_text->GetUnit()) {
323  case UNIT_PU: {
324  m_choiceTextUnit->SetSelection(0);
325  } break;
326  case UNIT_VAr: {
327  m_choiceTextUnit->SetSelection(1);
328  } break;
329  case UNIT_kVAr: {
330  m_choiceTextUnit->SetSelection(2);
331  } break;
332  case UNIT_MVAr: {
333  m_choiceTextUnit->SetSelection(3);
334  } break;
335  default:
336  break;
337  }
338  } break;
339  case DATA_SC_CURRENT: {
340  m_choiceTextType->SetSelection(3);
341  switch(m_text->GetUnit()) {
342  case UNIT_PU: {
343  m_choiceTextUnit->SetSelection(0);
344  } break;
345  case UNIT_A: {
346  m_choiceTextUnit->SetSelection(1);
347  } break;
348  case UNIT_kA: {
349  m_choiceTextUnit->SetSelection(2);
350  } break;
351  default:
352  break;
353  }
354  } break;
355  default:
356  break;
357  }
358  } break;
359  case TYPE_LINE: {
360  m_choiceElement->SetSelection(2);
361  switch(m_text->GetDataType()) {
362  case DATA_NAME: {
363  m_choiceTextType->SetSelection(0);
364  } break;
365  case DATA_PF_ACTIVE: {
366  m_choiceTextType->SetSelection(1);
367  switch(m_text->GetUnit()) {
368  case UNIT_PU: {
369  m_choiceTextUnit->SetSelection(0);
370  } break;
371  case UNIT_W: {
372  m_choiceTextUnit->SetSelection(1);
373  } break;
374  case UNIT_kW: {
375  m_choiceTextUnit->SetSelection(2);
376  } break;
377  case UNIT_MW: {
378  m_choiceTextUnit->SetSelection(3);
379  } break;
380  default:
381  break;
382  }
383  } break;
384  case DATA_PF_REACTIVE: {
385  m_choiceTextType->SetSelection(2);
386  switch(m_text->GetUnit()) {
387  case UNIT_PU: {
388  m_choiceTextUnit->SetSelection(0);
389  } break;
390  case UNIT_VAr: {
391  m_choiceTextUnit->SetSelection(1);
392  } break;
393  case UNIT_kVAr: {
394  m_choiceTextUnit->SetSelection(2);
395  } break;
396  case UNIT_MVAr: {
397  m_choiceTextUnit->SetSelection(3);
398  } break;
399  default:
400  break;
401  }
402  } break;
403  case DATA_PF_LOSSES: {
404  m_choiceTextType->SetSelection(3);
405  switch(m_text->GetUnit()) {
406  case UNIT_PU: {
407  m_choiceTextUnit->SetSelection(0);
408  } break;
409  case UNIT_W: {
410  m_choiceTextUnit->SetSelection(1);
411  } break;
412  case UNIT_kW: {
413  m_choiceTextUnit->SetSelection(2);
414  } break;
415  case UNIT_MW: {
416  m_choiceTextUnit->SetSelection(3);
417  } break;
418  default:
419  break;
420  }
421  } break;
422  case DATA_PF_CURRENT: {
423  m_choiceTextType->SetSelection(4);
424  switch(m_text->GetUnit()) {
425  case UNIT_PU: {
426  m_choiceTextUnit->SetSelection(0);
427  } break;
428  case UNIT_A: {
429  m_choiceTextUnit->SetSelection(1);
430  } break;
431  case UNIT_kA: {
432  m_choiceTextUnit->SetSelection(2);
433  } break;
434  default:
435  break;
436  }
437  } break;
438  case DATA_SC_CURRENT: {
439  m_choiceTextType->SetSelection(5);
440  switch(m_text->GetUnit()) {
441  case UNIT_PU: {
442  m_choiceTextUnit->SetSelection(0);
443  } break;
444  case UNIT_A: {
445  m_choiceTextUnit->SetSelection(1);
446  } break;
447  case UNIT_kA: {
448  m_choiceTextUnit->SetSelection(2);
449  } break;
450  case UNIT_MW: {
451  m_choiceTextUnit->SetSelection(3);
452  } break;
453  default:
454  break;
455  }
456  } break;
457  default:
458  break;
459  }
460  } break;
461  case TYPE_TRANSFORMER: {
462  m_choiceElement->SetSelection(3);
463  switch(m_text->GetDataType()) {
464  case DATA_NAME: {
465  m_choiceTextType->SetSelection(0);
466  } break;
467  case DATA_PF_ACTIVE: {
468  m_choiceTextType->SetSelection(1);
469  switch(m_text->GetUnit()) {
470  case UNIT_PU: {
471  m_choiceTextUnit->SetSelection(0);
472  } break;
473  case UNIT_W: {
474  m_choiceTextUnit->SetSelection(1);
475  } break;
476  case UNIT_kW: {
477  m_choiceTextUnit->SetSelection(2);
478  } break;
479  case UNIT_MW: {
480  m_choiceTextUnit->SetSelection(3);
481  } break;
482  default:
483  break;
484  }
485  } break;
486  case DATA_PF_REACTIVE: {
487  m_choiceTextType->SetSelection(2);
488  switch(m_text->GetUnit()) {
489  case UNIT_PU: {
490  m_choiceTextUnit->SetSelection(0);
491  } break;
492  case UNIT_VAr: {
493  m_choiceTextUnit->SetSelection(1);
494  } break;
495  case UNIT_kVAr: {
496  m_choiceTextUnit->SetSelection(2);
497  } break;
498  case UNIT_MVAr: {
499  m_choiceTextUnit->SetSelection(3);
500  } break;
501  default:
502  break;
503  }
504  } break;
505  case DATA_PF_LOSSES: {
506  m_choiceTextType->SetSelection(3);
507  switch(m_text->GetUnit()) {
508  case UNIT_PU: {
509  m_choiceTextUnit->SetSelection(0);
510  } break;
511  case UNIT_W: {
512  m_choiceTextUnit->SetSelection(1);
513  } break;
514  case UNIT_kW: {
515  m_choiceTextUnit->SetSelection(2);
516  } break;
517  case UNIT_MW: {
518  m_choiceTextUnit->SetSelection(3);
519  } break;
520  default:
521  break;
522  }
523  } break;
524  case DATA_PF_CURRENT: {
525  m_choiceTextType->SetSelection(4);
526  switch(m_text->GetUnit()) {
527  case UNIT_PU: {
528  m_choiceTextUnit->SetSelection(0);
529  } break;
530  case UNIT_A: {
531  m_choiceTextUnit->SetSelection(1);
532  } break;
533  case UNIT_kA: {
534  m_choiceTextUnit->SetSelection(2);
535  } break;
536  default:
537  break;
538  }
539  } break;
540  case DATA_SC_CURRENT: {
541  m_choiceTextType->SetSelection(5);
542  switch(m_text->GetUnit()) {
543  case UNIT_PU: {
544  m_choiceTextUnit->SetSelection(0);
545  } break;
546  case UNIT_A: {
547  m_choiceTextUnit->SetSelection(1);
548  } break;
549  case UNIT_kA: {
550  m_choiceTextUnit->SetSelection(2);
551  } break;
552  default:
553  break;
554  }
555  } break;
556  default:
557  break;
558  }
559  } break;
560  case TYPE_LOAD: {
561  m_choiceElement->SetSelection(4);
562  switch(m_text->GetDataType()) {
563  case DATA_NAME: {
564  m_choiceTextType->SetSelection(0);
565  } break;
566  case DATA_ACTIVE_POWER: {
567  m_choiceTextType->SetSelection(1);
568  switch(m_text->GetUnit()) {
569  case UNIT_PU: {
570  m_choiceTextUnit->SetSelection(0);
571  } break;
572  case UNIT_W: {
573  m_choiceTextUnit->SetSelection(1);
574  } break;
575  case UNIT_kW: {
576  m_choiceTextUnit->SetSelection(2);
577  } break;
578  case UNIT_MW: {
579  m_choiceTextUnit->SetSelection(3);
580  } break;
581  default:
582  break;
583  }
584  } break;
585  case DATA_REACTIVE_POWER: {
586  m_choiceTextType->SetSelection(2);
587  switch(m_text->GetUnit()) {
588  case UNIT_PU: {
589  m_choiceTextUnit->SetSelection(0);
590  } break;
591  case UNIT_VAr: {
592  m_choiceTextUnit->SetSelection(1);
593  } break;
594  case UNIT_kVAr: {
595  m_choiceTextUnit->SetSelection(2);
596  } break;
597  case UNIT_MVAr: {
598  m_choiceTextUnit->SetSelection(3);
599  } break;
600  default:
601  break;
602  }
603  } break;
604  default:
605  break;
606  }
607  } break;
608  case TYPE_CAPACITOR: {
609  m_choiceElement->SetSelection(5);
610  switch(m_text->GetDataType()) {
611  case DATA_NAME: {
612  m_choiceTextType->SetSelection(0);
613  } break;
614  case DATA_REACTIVE_POWER: {
615  m_choiceTextType->SetSelection(1);
616 
617  } break;
618  default:
619  break;
620  }
621  } break;
622  case TYPE_INDUCTOR: {
623  m_choiceElement->SetSelection(6);
624  switch(m_text->GetDataType()) {
625  case DATA_NAME: {
626  m_choiceTextType->SetSelection(0);
627  } break;
628  case DATA_REACTIVE_POWER: {
629  m_choiceTextType->SetSelection(1);
630  switch(m_text->GetUnit()) {
631  case UNIT_PU: {
632  m_choiceTextUnit->SetSelection(0);
633  } break;
634  case UNIT_VAr: {
635  m_choiceTextUnit->SetSelection(1);
636  } break;
637  case UNIT_kVAr: {
638  m_choiceTextUnit->SetSelection(2);
639  } break;
640  case UNIT_MVAr: {
641  m_choiceTextUnit->SetSelection(3);
642  } break;
643  default:
644  break;
645  }
646  } break;
647  default:
648  break;
649  }
650  } break;
651  case TYPE_SYNC_MOTOR: {
652  m_choiceElement->SetSelection(7);
653  switch(m_text->GetDataType()) {
654  case DATA_NAME: {
655  m_choiceTextType->SetSelection(0);
656  } break;
657  case DATA_ACTIVE_POWER: {
658  m_choiceTextType->SetSelection(1);
659  switch(m_text->GetUnit()) {
660  case UNIT_PU: {
661  m_choiceTextUnit->SetSelection(0);
662  } break;
663  case UNIT_W: {
664  m_choiceTextUnit->SetSelection(1);
665  } break;
666  case UNIT_kW: {
667  m_choiceTextUnit->SetSelection(2);
668  } break;
669  case UNIT_MW: {
670  m_choiceTextUnit->SetSelection(3);
671  } break;
672  default:
673  break;
674  }
675  } break;
676  case DATA_REACTIVE_POWER: {
677  m_choiceTextType->SetSelection(2);
678  switch(m_text->GetUnit()) {
679  case UNIT_PU: {
680  m_choiceTextUnit->SetSelection(0);
681  } break;
682  case UNIT_VAr: {
683  m_choiceTextUnit->SetSelection(1);
684  } break;
685  case UNIT_kVAr: {
686  m_choiceTextUnit->SetSelection(2);
687  } break;
688  case UNIT_MVAr: {
689  m_choiceTextUnit->SetSelection(3);
690  } break;
691  default:
692  break;
693  }
694  } break;
695  default:
696  break;
697  }
698  } break;
699  case TYPE_IND_MOTOR: {
700  m_choiceElement->SetSelection(8);
701  switch(m_text->GetDataType()) {
702  case DATA_NAME: {
703  m_choiceTextType->SetSelection(0);
704  } break;
705  case DATA_ACTIVE_POWER: {
706  m_choiceTextType->SetSelection(1);
707  switch(m_text->GetUnit()) {
708  case UNIT_PU: {
709  m_choiceTextUnit->SetSelection(0);
710  } break;
711  case UNIT_W: {
712  m_choiceTextUnit->SetSelection(1);
713  } break;
714  case UNIT_kW: {
715  m_choiceTextUnit->SetSelection(2);
716  } break;
717  case UNIT_MW: {
718  m_choiceTextUnit->SetSelection(3);
719  } break;
720  default:
721  break;
722  }
723  } break;
724  case DATA_REACTIVE_POWER: {
725  m_choiceTextType->SetSelection(2);
726  switch(m_text->GetUnit()) {
727  case UNIT_PU: {
728  m_choiceTextUnit->SetSelection(0);
729  } break;
730  case UNIT_VAr: {
731  m_choiceTextUnit->SetSelection(1);
732  } break;
733  case UNIT_kVAr: {
734  m_choiceTextUnit->SetSelection(2);
735  } break;
736  case UNIT_MVAr: {
737  m_choiceTextUnit->SetSelection(3);
738  } break;
739  default:
740  break;
741  }
742  } break;
743  default:
744  break;
745  }
746  } break;
747  default:
748  break;
749  }
750 
751  if(m_choiceTextFromBus->IsEnabled()) m_choiceTextFromBus->SetSelection(m_text->GetDirection());
752  if(m_choiceTextToBus->IsEnabled()) m_choiceTextToBus->SetSelection(m_text->GetDirection());
753 
754  m_textCtrlDecimal->SetValue(wxString::Format("%d", m_text->GetDecimalPlaces()));
755  Preview();
756 
757  return true;
758 }
759 
760 void TextForm::ElementTypeChoice()
761 {
762  m_choiceTextType->Enable(false);
763  m_choiceTextFromBus->Enable(false);
764  m_choiceTextToBus->Enable(false);
765  m_choiceTextUnit->Enable(false);
766  m_choiceTextType->Clear();
767  m_choiceTextFromBus->Clear();
768  m_choiceTextToBus->Clear();
769  m_choiceTextUnit->Clear();
770 
771  m_choiceName->Clear();
772  wxArrayString arrayString;
773  switch(m_text->GetElementType()) {
774  case TYPE_BUS: {
775  for(int i = 0; i < (int)m_allElements.GetBusList().size(); i++) {
776  Bus* bus = m_allElements.GetBusList()[i];
777  arrayString.Add(bus->GetElectricalData().name);
778  }
779  } break;
780  case TYPE_SYNC_GENERATOR: {
781  for(int i = 0; i < (int)m_allElements.GetSyncGeneratorList().size(); i++) {
782  SyncGenerator* syncGenerator = m_allElements.GetSyncGeneratorList()[i];
783  arrayString.Add(syncGenerator->GetElectricalData().name);
784  }
785  } break;
786  case TYPE_LINE: {
787  for(int i = 0; i < (int)m_allElements.GetLineList().size(); i++) {
788  Line* line = m_allElements.GetLineList()[i];
789  arrayString.Add(line->GetElectricalData().name);
790  }
791  } break;
792  case TYPE_TRANSFORMER: {
793  for(int i = 0; i < (int)m_allElements.GetTransformerList().size(); i++) {
794  Transformer* transformer = m_allElements.GetTransformerList()[i];
795  arrayString.Add(transformer->GetElectricalData().name);
796  }
797  } break;
798  case TYPE_LOAD: {
799  for(int i = 0; i < (int)m_allElements.GetLoadList().size(); i++) {
800  Load* load = m_allElements.GetLoadList()[i];
801  arrayString.Add(load->GetElectricalData().name);
802  }
803  } break;
804  case TYPE_CAPACITOR: {
805  for(int i = 0; i < (int)m_allElements.GetCapacitorList().size(); i++) {
806  Capacitor* capacitor = m_allElements.GetCapacitorList()[i];
807  arrayString.Add(capacitor->GetElectricalData().name);
808  }
809  } break;
810  case TYPE_INDUCTOR: {
811  for(int i = 0; i < (int)m_allElements.GetInductorList().size(); i++) {
812  Inductor* inductor = m_allElements.GetInductorList()[i];
813  arrayString.Add(inductor->GetElectricalData().name);
814  }
815  } break;
816  case TYPE_SYNC_MOTOR: {
817  for(int i = 0; i < (int)m_allElements.GetSyncMotorList().size(); i++) {
818  SyncMotor* syncMotor = m_allElements.GetSyncMotorList()[i];
819  arrayString.Add(syncMotor->GetElectricalData().name);
820  }
821  } break;
822  case TYPE_IND_MOTOR: {
823  for(int i = 0; i < (int)m_allElements.GetIndMotorList().size(); i++) {
824  IndMotor* indMotor = m_allElements.GetIndMotorList()[i];
825  arrayString.Add(indMotor->GetElectricalData().name);
826  }
827  } break;
828 
829  default:
830  break;
831  }
832  m_choiceName->Append(arrayString);
833  m_choiceName->Enable();
834 }
835 
836 void TextForm::ElementNumberChoice()
837 {
838  m_choiceTextFromBus->Enable(false);
839  m_choiceTextToBus->Enable(false);
840  m_choiceTextUnit->Enable(false);
841  m_choiceTextFromBus->Clear();
842  m_choiceTextToBus->Clear();
843  m_choiceTextUnit->Clear();
844 
845  int index = m_choiceName->GetSelection();
846  m_text->SetElementNumber(index);
847 
848  m_choiceTextType->Clear();
849  wxArrayString arrayString;
850  switch(m_text->GetElementType()) {
851  case TYPE_BUS: {
852  Bus* bus = m_allElements.GetBusList()[index];
853  m_text->SetElement(bus);
854 
855  arrayString.Add(_("Name"));
856  arrayString.Add(_("Voltage"));
857  arrayString.Add(_("Angle"));
858  arrayString.Add(_("Fault current"));
859  arrayString.Add(_("Fault voltage"));
860  arrayString.Add(_("Short-circuit power"));
861  } break;
862  case TYPE_SYNC_GENERATOR: {
863  SyncGenerator* syncGenerator = m_allElements.GetSyncGeneratorList()[index];
864  m_text->SetElement(syncGenerator);
865 
866  arrayString.Add(_("Name"));
867  arrayString.Add(_("Active power"));
868  arrayString.Add(_("Reactive power"));
869  arrayString.Add(_("Fault current"));
870  } break;
871  case TYPE_LINE: {
872  Line* line = m_allElements.GetLineList()[index];
873  m_text->SetElement(line);
874 
875  arrayString.Add(_("Name"));
876  arrayString.Add(_("Active power flow"));
877  arrayString.Add(_("Reactive power flow"));
878  arrayString.Add(_("Losses"));
879  arrayString.Add(_("Current"));
880  arrayString.Add(_("Fault current"));
881  } break;
882  case TYPE_TRANSFORMER: {
883  Transformer* transformer = m_allElements.GetTransformerList()[index];
884  m_text->SetElement(transformer);
885 
886  arrayString.Add(_("Name"));
887  arrayString.Add(_("Active power flow"));
888  arrayString.Add(_("Reactive power flow"));
889  arrayString.Add(_("Losses"));
890  arrayString.Add(_("Current"));
891  arrayString.Add(_("Fault current"));
892  } break;
893  case TYPE_LOAD: {
894  Load* load = m_allElements.GetLoadList()[index];
895  m_text->SetElement(load);
896 
897  arrayString.Add(_("Name"));
898  arrayString.Add(_("Active power"));
899  arrayString.Add(_("Reactive power"));
900  } break;
901  case TYPE_CAPACITOR: {
902  Capacitor* capacitor = m_allElements.GetCapacitorList()[index];
903  m_text->SetElement(capacitor);
904 
905  arrayString.Add(_("Name"));
906  arrayString.Add(_("Reactive power"));
907  } break;
908  case TYPE_INDUCTOR: {
909  Inductor* inductor = m_allElements.GetInductorList()[index];
910  m_text->SetElement(inductor);
911 
912  arrayString.Add(_("Name"));
913  arrayString.Add(_("Reactive power"));
914  } break;
915  case TYPE_SYNC_MOTOR: {
916  SyncMotor* syncMotor = m_allElements.GetSyncMotorList()[index];
917  m_text->SetElement(syncMotor);
918 
919  arrayString.Add(_("Name"));
920  arrayString.Add(_("Active power"));
921  arrayString.Add(_("Reactive power"));
922  } break;
923  case TYPE_IND_MOTOR: {
924  IndMotor* indMotor = m_allElements.GetIndMotorList()[index];
925  m_text->SetElement(indMotor);
926 
927  arrayString.Add(_("Name"));
928  arrayString.Add(_("Active power"));
929  arrayString.Add(_("Reactive power"));
930  } break;
931 
932  default:
933  break;
934  }
935  m_choiceTextType->Append(arrayString);
936  m_choiceTextType->Enable();
937 }
938 
939 void TextForm::DataTypeChoice()
940 {
941  m_choiceTextFromBus->Enable(false);
942  m_choiceTextToBus->Enable(false);
943 
944  m_choiceTextToBus->Clear();
945  m_choiceTextFromBus->Clear();
946  m_choiceTextUnit->Clear();
947 
948  m_choiceTextUnit->Enable();
949 
950  wxArrayString arrayString;
951  switch(m_text->GetDataType()) {
952  case DATA_NAME: {
953  m_choiceTextUnit->Enable(false);
954  return;
955  } break;
956  case DATA_VOLTAGE:
957  case DATA_SC_VOLTAGE: {
958  arrayString.Add(_("p.u."));
959  arrayString.Add(_("V"));
960  arrayString.Add(_("kV"));
961  } break;
962  case DATA_ANGLE: {
963  arrayString.Add(_("Degrees"));
964  arrayString.Add(_("Radians"));
965  } break;
966  case DATA_SC_CURRENT:
967  case DATA_PF_CURRENT: {
968  arrayString.Add(_("p.u."));
969  arrayString.Add(_("A"));
970  arrayString.Add(_("kA"));
971  } break;
972  case DATA_SC_POWER: {
973  arrayString.Add(_("p.u."));
974  arrayString.Add(_("VA"));
975  arrayString.Add(_("kVA"));
976  arrayString.Add(_("MVA"));
977  } break;
978  case DATA_ACTIVE_POWER:
979  case DATA_PF_ACTIVE:
980  case DATA_PF_LOSSES: {
981  arrayString.Add(_("p.u."));
982  arrayString.Add(_("W"));
983  arrayString.Add(_("kW"));
984  arrayString.Add(_("MW"));
985  m_choiceTextUnit->Enable();
986  } break;
987  case DATA_REACTIVE_POWER:
988  case DATA_PF_REACTIVE: {
989  arrayString.Add(_("p.u."));
990  arrayString.Add(_("VAr"));
991  arrayString.Add(_("kVAr"));
992  arrayString.Add(_("MVAr"));
993  } break;
994  default:
995  break;
996  }
997  m_choiceTextUnit->Append(arrayString);
998 
999  switch(m_text->GetElementType()) {
1000  case TYPE_LINE: {
1001  if(m_text->GetDataType() != DATA_PF_LOSSES) {
1002  auto it = m_allElements.GetLineList().begin();
1003  std::advance(it, m_text->GetElementNumber());
1004  Line* line = *it;
1005 
1006  Bus* bus1 = static_cast<Bus*>(line->GetParentList()[0]);
1007  Bus* bus2 = static_cast<Bus*>(line->GetParentList()[1]);
1008  wxString bus1Name = bus1->GetElectricalData().name;
1009  wxString bus2Name = bus2->GetElectricalData().name;
1010 
1011  m_choiceTextFromBus->Append(bus1Name);
1012  m_choiceTextFromBus->Append(bus2Name);
1013  m_choiceTextToBus->Append(bus2Name);
1014  m_choiceTextToBus->Append(bus1Name);
1015  m_choiceTextFromBus->SetSelection(0);
1016  m_choiceTextToBus->SetSelection(0);
1017 
1018  m_choiceTextFromBus->Enable();
1019  m_choiceTextToBus->Enable();
1020  }
1021  } break;
1022  case TYPE_TRANSFORMER: {
1023  if(m_text->GetDataType() != DATA_PF_LOSSES) {
1024  auto it = m_allElements.GetTransformerList().begin();
1025  std::advance(it, m_text->GetElementNumber());
1026  Transformer* transformer = *it;
1027 
1028  Bus* bus1 = static_cast<Bus*>(transformer->GetParentList()[0]);
1029  Bus* bus2 = static_cast<Bus*>(transformer->GetParentList()[1]);
1030  wxString bus1Name = bus1->GetElectricalData().name;
1031  wxString bus2Name = bus2->GetElectricalData().name;
1032 
1033  m_choiceTextFromBus->Append(bus1Name);
1034  m_choiceTextFromBus->Append(bus2Name);
1035  m_choiceTextToBus->Append(bus2Name);
1036  m_choiceTextToBus->Append(bus1Name);
1037  m_choiceTextFromBus->SetSelection(0);
1038  m_choiceTextToBus->SetSelection(0);
1039 
1040  m_choiceTextFromBus->Enable();
1041  m_choiceTextToBus->Enable();
1042  }
1043  } break;
1044  default:
1045  break;
1046  }
1047 }
1048 
1049 void TextForm::UnitChoice()
1050 {
1051  switch(m_text->GetDataType()) {
1052  case DATA_NAME: {
1053  m_choiceTextUnit->Enable(false);
1054  return;
1055  } break;
1056  case DATA_VOLTAGE:
1057  case DATA_SC_VOLTAGE: {
1058  switch(m_choiceTextUnit->GetSelection()) {
1059  case 0: {
1060  m_text->SetUnit(UNIT_PU);
1061  } break;
1062  case 1: {
1063  m_text->SetUnit(UNIT_V);
1064  } break;
1065  case 2: {
1066  m_text->SetUnit(UNIT_kV);
1067  } break;
1068  default:
1069  break;
1070  }
1071  } break;
1072  case DATA_ANGLE: {
1073  switch(m_choiceTextUnit->GetSelection()) {
1074  case 0: {
1075  m_text->SetUnit(UNIT_DEGREE);
1076  } break;
1077  case 1: {
1078  m_text->SetUnit(UNIT_RADIAN);
1079  } break;
1080  default:
1081  break;
1082  }
1083  } break;
1084  case DATA_SC_CURRENT:
1085  case DATA_PF_CURRENT: {
1086  switch(m_choiceTextUnit->GetSelection()) {
1087  case 0: {
1088  m_text->SetUnit(UNIT_PU);
1089  } break;
1090  case 1: {
1091  m_text->SetUnit(UNIT_A);
1092  } break;
1093  case 2: {
1094  m_text->SetUnit(UNIT_kA);
1095  } break;
1096  default:
1097  break;
1098  }
1099  } break;
1100  case DATA_SC_POWER: {
1101  switch(m_choiceTextUnit->GetSelection()) {
1102  case 0: {
1103  m_text->SetUnit(UNIT_PU);
1104  } break;
1105  case 1: {
1106  m_text->SetUnit(UNIT_VA);
1107  } break;
1108  case 2: {
1109  m_text->SetUnit(UNIT_kVA);
1110  } break;
1111  case 3: {
1112  m_text->SetUnit(UNIT_MVA);
1113  } break;
1114  default:
1115  break;
1116  }
1117  } break;
1118  case DATA_ACTIVE_POWER:
1119  case DATA_PF_ACTIVE:
1120  case DATA_PF_LOSSES: {
1121  switch(m_choiceTextUnit->GetSelection()) {
1122  case 0: {
1123  m_text->SetUnit(UNIT_PU);
1124  } break;
1125  case 1: {
1126  m_text->SetUnit(UNIT_W);
1127  } break;
1128  case 2: {
1129  m_text->SetUnit(UNIT_kW);
1130  } break;
1131  case 3: {
1132  m_text->SetUnit(UNIT_MW);
1133  } break;
1134  default:
1135  break;
1136  }
1137  } break;
1138  case DATA_REACTIVE_POWER:
1139  case DATA_PF_REACTIVE: {
1140  switch(m_choiceTextUnit->GetSelection()) {
1141  case 0: {
1142  m_text->SetUnit(UNIT_PU);
1143  } break;
1144  case 1: {
1145  m_text->SetUnit(UNIT_VAr);
1146  } break;
1147  case 2: {
1148  m_text->SetUnit(UNIT_kVAr);
1149  } break;
1150  case 3: {
1151  m_text->SetUnit(UNIT_MVAr);
1152  } break;
1153  default:
1154  break;
1155  }
1156  } break;
1157  default:
1158  break;
1159  }
1160 }
1161 
1162 void TextForm::Preview()
1163 {
1164  double decimalPlaces = m_text->GetDecimalPlaces();
1165  if(m_textCtrlDecimal->GetValue().ToDouble(&decimalPlaces)) m_text->SetDecimalPlaces(decimalPlaces);
1166 
1167  m_text->UpdateText(m_systemPowerBase);
1168 
1169  m_textCtrlPreview->SetValue(m_text->GetText());
1170 }
1171 
1172 bool TextForm::ValidateData()
1173 {
1174  if(m_choiceElement->GetSelection() == -1) return false;
1175  if(m_choiceName->GetSelection() == -1) return false;
1176  if(m_choiceTextType->GetSelection() == -1) return false;
1177  if(m_text->GetDataType() != DATA_NAME && m_choiceTextUnit->GetSelection() == -1) return false;
1178  if(m_text->GetElementType() == TYPE_LINE || m_text->GetElementType() == TYPE_TRANSFORMER) {
1179  if(m_text->GetDataType() != DATA_PF_LOSSES && m_text->GetDataType() != DATA_NAME) {
1180  if(m_choiceTextFromBus->GetSelection() == -1) return false;
1181  if(m_choiceTextToBus->GetSelection() == -1) return false;
1182  }
1183  }
1184 
1185  if(m_choiceTextFromBus->IsEnabled() && m_choiceTextToBus->IsEnabled())
1186  m_text->SetDirection(m_choiceTextFromBus->GetSelection());
1187  double decimalPlaces = m_text->GetDecimalPlaces();
1188  if(m_textCtrlDecimal->GetValue().ToDouble(&decimalPlaces)) m_text->SetDecimalPlaces(decimalPlaces);
1189 
1190  m_textToEdit->SetElementType(m_text->GetElementType());
1191  m_textToEdit->SetElementNumber(m_text->GetElementNumber());
1192  m_textToEdit->SetElement(m_text->GetElement());
1193  m_textToEdit->SetDataType(m_text->GetDataType());
1194  m_textToEdit->SetDirection(m_text->GetDirection());
1195  m_textToEdit->SetUnit(m_text->GetUnit());
1196  m_textToEdit->SetDecimalPlaces(decimalPlaces);
1197  m_textToEdit->UpdateText(m_systemPowerBase);
1198 
1199  return true;
1200 }
1201 
1202 void TextForm::OnOKButtonClick(wxCommandEvent& event)
1203 {
1204  if(ValidateData()) {
1205  EndModal(wxID_OK);
1206  } else {
1207  wxString errorMsg = _("There are blank fields.");
1208  wxMessageDialog msgDialog(this, errorMsg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
1209  msgDialog.ShowModal();
1210  }
1211 }
Definition: Text.h:48
- - - - - - - - -
Definition: Bus.h:45
- - - -
Definition: Line.h:35
-
Definition: Load.h:23
- - - - - - - - - - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "TextForm.h"
19 
20 TextForm::TextForm(wxWindow* parent, Text* text, std::vector<Element*> elementList, double systemPowerBase)
21  : TextFormBase(parent)
22 {
23  SetSize(GetBestSize());
24  m_parent = parent;
25  m_textToEdit = text;
26  m_allElements.GetElementsFromList(elementList);
27  m_systemPowerBase = systemPowerBase;
28 
29  m_text = new Text();
30  m_text->SetElementType(text->GetElementType());
31  m_text->SetElementNumber(text->GetElementNumber());
32  m_text->SetElement(text->GetElement());
33  m_text->SetDataType(text->GetDataType());
34  m_text->SetDirection(text->GetDirection());
35  m_text->SetUnit(text->GetUnit());
36  m_text->SetDecimalPlaces(text->GetDecimalPlaces());
37 
38  if(!LoadChoices()) {
39  m_choiceName->Enable(false);
40  m_choiceTextType->Enable(false);
41  m_choiceTextFromBus->Enable(false);
42  m_choiceTextToBus->Enable(false);
43  m_choiceTextUnit->Enable(false);
44  }
45 }
46 
47 TextForm::~TextForm() {}
48 void TextForm::OnElementChoiceSelected(wxCommandEvent& event)
49 {
50  switch(m_choiceElement->GetSelection()) {
51  case 0: {
52  m_text->SetElementType(TYPE_BUS);
53  } break;
54  case 1: {
55  m_text->SetElementType(TYPE_SYNC_GENERATOR);
56  } break;
57  case 2: {
58  m_text->SetElementType(TYPE_LINE);
59  } break;
60  case 3: {
61  m_text->SetElementType(TYPE_TRANSFORMER);
62  } break;
63  case 4: {
64  m_text->SetElementType(TYPE_LOAD);
65  } break;
66  case 5: {
67  m_text->SetElementType(TYPE_CAPACITOR);
68  } break;
69  case 6: {
70  m_text->SetElementType(TYPE_INDUCTOR);
71  } break;
72  case 7: {
73  m_text->SetElementType(TYPE_SYNC_MOTOR);
74  } break;
75  case 8: {
76  m_text->SetElementType(TYPE_IND_MOTOR);
77  } break;
78 
79  default:
80  break;
81  }
82 
83  ElementTypeChoice();
84 }
85 
86 void TextForm::OnFromBusChoiceSelected(wxCommandEvent& event)
87 {
88  m_text->SetDirection(m_choiceTextFromBus->GetSelection());
89  m_choiceTextToBus->SetSelection(m_choiceTextFromBus->GetSelection());
90 }
91 
92 void TextForm::OnNameChoiceSelected(wxCommandEvent& event)
93 {
94  m_text->SetElementNumber(m_choiceName->GetSelection());
95  ElementNumberChoice();
96 }
97 
98 void TextForm::OnTextEnter(wxCommandEvent& event) { Preview(); }
99 void TextForm::OnToBusChoiceSelected(wxCommandEvent& event)
100 {
101  m_text->SetDirection(m_choiceTextToBus->GetSelection());
102  m_choiceTextFromBus->SetSelection(m_choiceTextToBus->GetSelection());
103 }
104 
105 void TextForm::OnUnitChoiceSelected(wxCommandEvent& event)
106 {
107  UnitChoice();
108  Preview();
109 }
110 
111 void TextForm::OnTypeChoiceSelected(wxCommandEvent& event)
112 {
113  switch(m_text->GetElementType()) {
114  case TYPE_BUS: {
115  switch(m_choiceTextType->GetSelection()) {
116  case 0: {
117  m_text->SetDataType(DATA_NAME);
118  } break;
119  case 1: {
120  m_text->SetDataType(DATA_VOLTAGE);
121  } break;
122  case 2: {
123  m_text->SetDataType(DATA_ANGLE);
124  } break;
125  case 3: {
126  m_text->SetDataType(DATA_SC_CURRENT);
127  } break;
128  case 4: {
129  m_text->SetDataType(DATA_SC_VOLTAGE);
130  } break;
131  case 5: {
132  m_text->SetDataType(DATA_SC_POWER);
133  } break;
134  }
135  } break;
136  case TYPE_SYNC_GENERATOR: {
137  switch(m_choiceTextType->GetSelection()) {
138  case 0: {
139  m_text->SetDataType(DATA_NAME);
140  } break;
141  case 1: {
142  m_text->SetDataType(DATA_ACTIVE_POWER);
143  } break;
144  case 2: {
145  m_text->SetDataType(DATA_REACTIVE_POWER);
146  } break;
147  case 3: {
148  m_text->SetDataType(DATA_SC_CURRENT);
149  } break;
150  }
151  } break;
152  case TYPE_LINE:
153  case TYPE_TRANSFORMER: {
154  switch(m_choiceTextType->GetSelection()) {
155  case 0: {
156  m_text->SetDataType(DATA_NAME);
157  } break;
158  case 1: {
159  m_text->SetDataType(DATA_PF_ACTIVE);
160  } break;
161  case 2: {
162  m_text->SetDataType(DATA_PF_REACTIVE);
163  } break;
164  case 3: {
165  m_text->SetDataType(DATA_PF_LOSSES);
166  } break;
167  case 4: {
168  m_text->SetDataType(DATA_PF_CURRENT);
169  } break;
170  case 5: {
171  m_text->SetDataType(DATA_SC_CURRENT);
172  } break;
173  }
174  } break;
175  case TYPE_LOAD:
176  case TYPE_SYNC_MOTOR:
177  case TYPE_IND_MOTOR: {
178  switch(m_choiceTextType->GetSelection()) {
179  case 0: {
180  m_text->SetDataType(DATA_NAME);
181  } break;
182  case 1: {
183  m_text->SetDataType(DATA_ACTIVE_POWER);
184  } break;
185  case 2: {
186  m_text->SetDataType(DATA_REACTIVE_POWER);
187  } break;
188  }
189  } break;
190  case TYPE_CAPACITOR:
191  case TYPE_INDUCTOR: {
192  switch(m_choiceTextType->GetSelection()) {
193  case 0: {
194  m_text->SetDataType(DATA_NAME);
195  } break;
196  case 1: {
197  m_text->SetDataType(DATA_REACTIVE_POWER);
198  } break;
199  }
200  } break;
201  default:
202  break;
203  }
204  DataTypeChoice();
205 
206  if(m_text->GetDataType() == DATA_NAME) Preview();
207 }
208 
209 bool TextForm::LoadChoices()
210 {
211  if(m_text->GetElementType() == TYPE_NONE) return false;
212 
213  // Fill the element possible choices.
214  ElementTypeChoice();
215  m_choiceName->SetSelection(m_text->GetElementNumber());
216  ElementNumberChoice();
217  DataTypeChoice();
218 
219  // Select the saved choices.
220  switch(m_text->GetElementType()) {
221  case TYPE_BUS: {
222  m_choiceElement->SetSelection(0);
223  switch(m_text->GetDataType()) {
224  case DATA_NAME: {
225  m_choiceTextType->SetSelection(0);
226  } break;
227  case DATA_VOLTAGE: {
228  m_choiceTextType->SetSelection(1);
229  switch(m_text->GetUnit()) {
230  case UNIT_PU: {
231  m_choiceTextUnit->SetSelection(0);
232  } break;
233  case UNIT_V: {
234  m_choiceTextUnit->SetSelection(1);
235  } break;
236  case UNIT_kV: {
237  m_choiceTextUnit->SetSelection(2);
238  } break;
239  default:
240  break;
241  }
242 
243  } break;
244  case DATA_ANGLE: {
245  m_choiceTextType->SetSelection(2);
246  switch(m_text->GetUnit()) {
247  case UNIT_DEGREE: {
248  m_choiceTextUnit->SetSelection(0);
249  } break;
250  case UNIT_RADIAN: {
251  m_choiceTextUnit->SetSelection(1);
252  } break;
253  default:
254  break;
255  }
256  } break;
257  case DATA_SC_CURRENT: {
258  m_choiceTextType->SetSelection(3);
259  switch(m_text->GetUnit()) {
260  case UNIT_PU: {
261  m_choiceTextUnit->SetSelection(0);
262  } break;
263  case UNIT_A: {
264  m_choiceTextUnit->SetSelection(1);
265  } break;
266  case UNIT_kA: {
267  m_choiceTextUnit->SetSelection(2);
268  } break;
269  default:
270  break;
271  }
272  } break;
273  case DATA_SC_VOLTAGE: {
274  m_choiceTextType->SetSelection(4);
275  switch(m_text->GetUnit()) {
276  case UNIT_PU: {
277  m_choiceTextUnit->SetSelection(0);
278  } break;
279  case UNIT_V: {
280  m_choiceTextUnit->SetSelection(1);
281  } break;
282  case UNIT_kV: {
283  m_choiceTextUnit->SetSelection(2);
284  } break;
285  default:
286  break;
287  }
288  } break;
289  case DATA_SC_POWER: {
290  m_choiceTextType->SetSelection(5);
291  switch(m_text->GetUnit()) {
292  case UNIT_PU: {
293  m_choiceTextUnit->SetSelection(0);
294  } break;
295  case UNIT_VA: {
296  m_choiceTextUnit->SetSelection(1);
297  } break;
298  case UNIT_kVA: {
299  m_choiceTextUnit->SetSelection(2);
300  } break;
301  case UNIT_MVA: {
302  m_choiceTextUnit->SetSelection(3);
303  } break;
304  default:
305  break;
306  }
307  } break;
308  default:
309  break;
310  }
311  } break;
312  case TYPE_SYNC_GENERATOR: {
313  m_choiceElement->SetSelection(1);
314  switch(m_text->GetDataType()) {
315  case DATA_NAME: {
316  m_choiceTextType->SetSelection(0);
317  } break;
318  case DATA_ACTIVE_POWER: {
319  m_choiceTextType->SetSelection(1);
320  switch(m_text->GetUnit()) {
321  case UNIT_PU: {
322  m_choiceTextUnit->SetSelection(0);
323  } break;
324  case UNIT_W: {
325  m_choiceTextUnit->SetSelection(1);
326  } break;
327  case UNIT_kW: {
328  m_choiceTextUnit->SetSelection(2);
329  } break;
330  case UNIT_MW: {
331  m_choiceTextUnit->SetSelection(3);
332  } break;
333  default:
334  break;
335  }
336  } break;
337  case DATA_REACTIVE_POWER: {
338  m_choiceTextType->SetSelection(2);
339  switch(m_text->GetUnit()) {
340  case UNIT_PU: {
341  m_choiceTextUnit->SetSelection(0);
342  } break;
343  case UNIT_VAr: {
344  m_choiceTextUnit->SetSelection(1);
345  } break;
346  case UNIT_kVAr: {
347  m_choiceTextUnit->SetSelection(2);
348  } break;
349  case UNIT_MVAr: {
350  m_choiceTextUnit->SetSelection(3);
351  } break;
352  default:
353  break;
354  }
355  } break;
356  case DATA_SC_CURRENT: {
357  m_choiceTextType->SetSelection(3);
358  switch(m_text->GetUnit()) {
359  case UNIT_PU: {
360  m_choiceTextUnit->SetSelection(0);
361  } break;
362  case UNIT_A: {
363  m_choiceTextUnit->SetSelection(1);
364  } break;
365  case UNIT_kA: {
366  m_choiceTextUnit->SetSelection(2);
367  } break;
368  default:
369  break;
370  }
371  } break;
372  default:
373  break;
374  }
375  } break;
376  case TYPE_LINE: {
377  m_choiceElement->SetSelection(2);
378  switch(m_text->GetDataType()) {
379  case DATA_NAME: {
380  m_choiceTextType->SetSelection(0);
381  } break;
382  case DATA_PF_ACTIVE: {
383  m_choiceTextType->SetSelection(1);
384  switch(m_text->GetUnit()) {
385  case UNIT_PU: {
386  m_choiceTextUnit->SetSelection(0);
387  } break;
388  case UNIT_W: {
389  m_choiceTextUnit->SetSelection(1);
390  } break;
391  case UNIT_kW: {
392  m_choiceTextUnit->SetSelection(2);
393  } break;
394  case UNIT_MW: {
395  m_choiceTextUnit->SetSelection(3);
396  } break;
397  default:
398  break;
399  }
400  } break;
401  case DATA_PF_REACTIVE: {
402  m_choiceTextType->SetSelection(2);
403  switch(m_text->GetUnit()) {
404  case UNIT_PU: {
405  m_choiceTextUnit->SetSelection(0);
406  } break;
407  case UNIT_VAr: {
408  m_choiceTextUnit->SetSelection(1);
409  } break;
410  case UNIT_kVAr: {
411  m_choiceTextUnit->SetSelection(2);
412  } break;
413  case UNIT_MVAr: {
414  m_choiceTextUnit->SetSelection(3);
415  } break;
416  default:
417  break;
418  }
419  } break;
420  case DATA_PF_LOSSES: {
421  m_choiceTextType->SetSelection(3);
422  switch(m_text->GetUnit()) {
423  case UNIT_PU: {
424  m_choiceTextUnit->SetSelection(0);
425  } break;
426  case UNIT_W: {
427  m_choiceTextUnit->SetSelection(1);
428  } break;
429  case UNIT_kW: {
430  m_choiceTextUnit->SetSelection(2);
431  } break;
432  case UNIT_MW: {
433  m_choiceTextUnit->SetSelection(3);
434  } break;
435  default:
436  break;
437  }
438  } break;
439  case DATA_PF_CURRENT: {
440  m_choiceTextType->SetSelection(4);
441  switch(m_text->GetUnit()) {
442  case UNIT_PU: {
443  m_choiceTextUnit->SetSelection(0);
444  } break;
445  case UNIT_A: {
446  m_choiceTextUnit->SetSelection(1);
447  } break;
448  case UNIT_kA: {
449  m_choiceTextUnit->SetSelection(2);
450  } break;
451  default:
452  break;
453  }
454  } break;
455  case DATA_SC_CURRENT: {
456  m_choiceTextType->SetSelection(5);
457  switch(m_text->GetUnit()) {
458  case UNIT_PU: {
459  m_choiceTextUnit->SetSelection(0);
460  } break;
461  case UNIT_A: {
462  m_choiceTextUnit->SetSelection(1);
463  } break;
464  case UNIT_kA: {
465  m_choiceTextUnit->SetSelection(2);
466  } break;
467  case UNIT_MW: {
468  m_choiceTextUnit->SetSelection(3);
469  } break;
470  default:
471  break;
472  }
473  } break;
474  default:
475  break;
476  }
477  } break;
478  case TYPE_TRANSFORMER: {
479  m_choiceElement->SetSelection(3);
480  switch(m_text->GetDataType()) {
481  case DATA_NAME: {
482  m_choiceTextType->SetSelection(0);
483  } break;
484  case DATA_PF_ACTIVE: {
485  m_choiceTextType->SetSelection(1);
486  switch(m_text->GetUnit()) {
487  case UNIT_PU: {
488  m_choiceTextUnit->SetSelection(0);
489  } break;
490  case UNIT_W: {
491  m_choiceTextUnit->SetSelection(1);
492  } break;
493  case UNIT_kW: {
494  m_choiceTextUnit->SetSelection(2);
495  } break;
496  case UNIT_MW: {
497  m_choiceTextUnit->SetSelection(3);
498  } break;
499  default:
500  break;
501  }
502  } break;
503  case DATA_PF_REACTIVE: {
504  m_choiceTextType->SetSelection(2);
505  switch(m_text->GetUnit()) {
506  case UNIT_PU: {
507  m_choiceTextUnit->SetSelection(0);
508  } break;
509  case UNIT_VAr: {
510  m_choiceTextUnit->SetSelection(1);
511  } break;
512  case UNIT_kVAr: {
513  m_choiceTextUnit->SetSelection(2);
514  } break;
515  case UNIT_MVAr: {
516  m_choiceTextUnit->SetSelection(3);
517  } break;
518  default:
519  break;
520  }
521  } break;
522  case DATA_PF_LOSSES: {
523  m_choiceTextType->SetSelection(3);
524  switch(m_text->GetUnit()) {
525  case UNIT_PU: {
526  m_choiceTextUnit->SetSelection(0);
527  } break;
528  case UNIT_W: {
529  m_choiceTextUnit->SetSelection(1);
530  } break;
531  case UNIT_kW: {
532  m_choiceTextUnit->SetSelection(2);
533  } break;
534  case UNIT_MW: {
535  m_choiceTextUnit->SetSelection(3);
536  } break;
537  default:
538  break;
539  }
540  } break;
541  case DATA_PF_CURRENT: {
542  m_choiceTextType->SetSelection(4);
543  switch(m_text->GetUnit()) {
544  case UNIT_PU: {
545  m_choiceTextUnit->SetSelection(0);
546  } break;
547  case UNIT_A: {
548  m_choiceTextUnit->SetSelection(1);
549  } break;
550  case UNIT_kA: {
551  m_choiceTextUnit->SetSelection(2);
552  } break;
553  default:
554  break;
555  }
556  } break;
557  case DATA_SC_CURRENT: {
558  m_choiceTextType->SetSelection(5);
559  switch(m_text->GetUnit()) {
560  case UNIT_PU: {
561  m_choiceTextUnit->SetSelection(0);
562  } break;
563  case UNIT_A: {
564  m_choiceTextUnit->SetSelection(1);
565  } break;
566  case UNIT_kA: {
567  m_choiceTextUnit->SetSelection(2);
568  } break;
569  default:
570  break;
571  }
572  } break;
573  default:
574  break;
575  }
576  } break;
577  case TYPE_LOAD: {
578  m_choiceElement->SetSelection(4);
579  switch(m_text->GetDataType()) {
580  case DATA_NAME: {
581  m_choiceTextType->SetSelection(0);
582  } break;
583  case DATA_ACTIVE_POWER: {
584  m_choiceTextType->SetSelection(1);
585  switch(m_text->GetUnit()) {
586  case UNIT_PU: {
587  m_choiceTextUnit->SetSelection(0);
588  } break;
589  case UNIT_W: {
590  m_choiceTextUnit->SetSelection(1);
591  } break;
592  case UNIT_kW: {
593  m_choiceTextUnit->SetSelection(2);
594  } break;
595  case UNIT_MW: {
596  m_choiceTextUnit->SetSelection(3);
597  } break;
598  default:
599  break;
600  }
601  } break;
602  case DATA_REACTIVE_POWER: {
603  m_choiceTextType->SetSelection(2);
604  switch(m_text->GetUnit()) {
605  case UNIT_PU: {
606  m_choiceTextUnit->SetSelection(0);
607  } break;
608  case UNIT_VAr: {
609  m_choiceTextUnit->SetSelection(1);
610  } break;
611  case UNIT_kVAr: {
612  m_choiceTextUnit->SetSelection(2);
613  } break;
614  case UNIT_MVAr: {
615  m_choiceTextUnit->SetSelection(3);
616  } break;
617  default:
618  break;
619  }
620  } break;
621  default:
622  break;
623  }
624  } break;
625  case TYPE_CAPACITOR: {
626  m_choiceElement->SetSelection(5);
627  switch(m_text->GetDataType()) {
628  case DATA_NAME: {
629  m_choiceTextType->SetSelection(0);
630  } break;
631  case DATA_REACTIVE_POWER: {
632  m_choiceTextType->SetSelection(1);
633 
634  } break;
635  default:
636  break;
637  }
638  } break;
639  case TYPE_INDUCTOR: {
640  m_choiceElement->SetSelection(6);
641  switch(m_text->GetDataType()) {
642  case DATA_NAME: {
643  m_choiceTextType->SetSelection(0);
644  } break;
645  case DATA_REACTIVE_POWER: {
646  m_choiceTextType->SetSelection(1);
647  switch(m_text->GetUnit()) {
648  case UNIT_PU: {
649  m_choiceTextUnit->SetSelection(0);
650  } break;
651  case UNIT_VAr: {
652  m_choiceTextUnit->SetSelection(1);
653  } break;
654  case UNIT_kVAr: {
655  m_choiceTextUnit->SetSelection(2);
656  } break;
657  case UNIT_MVAr: {
658  m_choiceTextUnit->SetSelection(3);
659  } break;
660  default:
661  break;
662  }
663  } break;
664  default:
665  break;
666  }
667  } break;
668  case TYPE_SYNC_MOTOR: {
669  m_choiceElement->SetSelection(7);
670  switch(m_text->GetDataType()) {
671  case DATA_NAME: {
672  m_choiceTextType->SetSelection(0);
673  } break;
674  case DATA_ACTIVE_POWER: {
675  m_choiceTextType->SetSelection(1);
676  switch(m_text->GetUnit()) {
677  case UNIT_PU: {
678  m_choiceTextUnit->SetSelection(0);
679  } break;
680  case UNIT_W: {
681  m_choiceTextUnit->SetSelection(1);
682  } break;
683  case UNIT_kW: {
684  m_choiceTextUnit->SetSelection(2);
685  } break;
686  case UNIT_MW: {
687  m_choiceTextUnit->SetSelection(3);
688  } break;
689  default:
690  break;
691  }
692  } break;
693  case DATA_REACTIVE_POWER: {
694  m_choiceTextType->SetSelection(2);
695  switch(m_text->GetUnit()) {
696  case UNIT_PU: {
697  m_choiceTextUnit->SetSelection(0);
698  } break;
699  case UNIT_VAr: {
700  m_choiceTextUnit->SetSelection(1);
701  } break;
702  case UNIT_kVAr: {
703  m_choiceTextUnit->SetSelection(2);
704  } break;
705  case UNIT_MVAr: {
706  m_choiceTextUnit->SetSelection(3);
707  } break;
708  default:
709  break;
710  }
711  } break;
712  default:
713  break;
714  }
715  } break;
716  case TYPE_IND_MOTOR: {
717  m_choiceElement->SetSelection(8);
718  switch(m_text->GetDataType()) {
719  case DATA_NAME: {
720  m_choiceTextType->SetSelection(0);
721  } break;
722  case DATA_ACTIVE_POWER: {
723  m_choiceTextType->SetSelection(1);
724  switch(m_text->GetUnit()) {
725  case UNIT_PU: {
726  m_choiceTextUnit->SetSelection(0);
727  } break;
728  case UNIT_W: {
729  m_choiceTextUnit->SetSelection(1);
730  } break;
731  case UNIT_kW: {
732  m_choiceTextUnit->SetSelection(2);
733  } break;
734  case UNIT_MW: {
735  m_choiceTextUnit->SetSelection(3);
736  } break;
737  default:
738  break;
739  }
740  } break;
741  case DATA_REACTIVE_POWER: {
742  m_choiceTextType->SetSelection(2);
743  switch(m_text->GetUnit()) {
744  case UNIT_PU: {
745  m_choiceTextUnit->SetSelection(0);
746  } break;
747  case UNIT_VAr: {
748  m_choiceTextUnit->SetSelection(1);
749  } break;
750  case UNIT_kVAr: {
751  m_choiceTextUnit->SetSelection(2);
752  } break;
753  case UNIT_MVAr: {
754  m_choiceTextUnit->SetSelection(3);
755  } break;
756  default:
757  break;
758  }
759  } break;
760  default:
761  break;
762  }
763  } break;
764  default:
765  break;
766  }
767 
768  if(m_choiceTextFromBus->IsEnabled()) m_choiceTextFromBus->SetSelection(m_text->GetDirection());
769  if(m_choiceTextToBus->IsEnabled()) m_choiceTextToBus->SetSelection(m_text->GetDirection());
770 
771  m_textCtrlDecimal->SetValue(wxString::Format("%d", m_text->GetDecimalPlaces()));
772  Preview();
773 
774  return true;
775 }
776 
777 void TextForm::ElementTypeChoice()
778 {
779  m_choiceTextType->Enable(false);
780  m_choiceTextFromBus->Enable(false);
781  m_choiceTextToBus->Enable(false);
782  m_choiceTextUnit->Enable(false);
783  m_choiceTextType->Clear();
784  m_choiceTextFromBus->Clear();
785  m_choiceTextToBus->Clear();
786  m_choiceTextUnit->Clear();
787 
788  m_choiceName->Clear();
789  wxArrayString arrayString;
790  switch(m_text->GetElementType()) {
791  case TYPE_BUS: {
792  for(int i = 0; i < (int)m_allElements.GetBusList().size(); i++) {
793  Bus* bus = m_allElements.GetBusList()[i];
794  arrayString.Add(bus->GetElectricalData().name);
795  }
796  } break;
797  case TYPE_SYNC_GENERATOR: {
798  for(int i = 0; i < (int)m_allElements.GetSyncGeneratorList().size(); i++) {
799  SyncGenerator* syncGenerator = m_allElements.GetSyncGeneratorList()[i];
800  arrayString.Add(syncGenerator->GetElectricalData().name);
801  }
802  } break;
803  case TYPE_LINE: {
804  for(int i = 0; i < (int)m_allElements.GetLineList().size(); i++) {
805  Line* line = m_allElements.GetLineList()[i];
806  arrayString.Add(line->GetElectricalData().name);
807  }
808  } break;
809  case TYPE_TRANSFORMER: {
810  for(int i = 0; i < (int)m_allElements.GetTransformerList().size(); i++) {
811  Transformer* transformer = m_allElements.GetTransformerList()[i];
812  arrayString.Add(transformer->GetElectricalData().name);
813  }
814  } break;
815  case TYPE_LOAD: {
816  for(int i = 0; i < (int)m_allElements.GetLoadList().size(); i++) {
817  Load* load = m_allElements.GetLoadList()[i];
818  arrayString.Add(load->GetElectricalData().name);
819  }
820  } break;
821  case TYPE_CAPACITOR: {
822  for(int i = 0; i < (int)m_allElements.GetCapacitorList().size(); i++) {
823  Capacitor* capacitor = m_allElements.GetCapacitorList()[i];
824  arrayString.Add(capacitor->GetElectricalData().name);
825  }
826  } break;
827  case TYPE_INDUCTOR: {
828  for(int i = 0; i < (int)m_allElements.GetInductorList().size(); i++) {
829  Inductor* inductor = m_allElements.GetInductorList()[i];
830  arrayString.Add(inductor->GetElectricalData().name);
831  }
832  } break;
833  case TYPE_SYNC_MOTOR: {
834  for(int i = 0; i < (int)m_allElements.GetSyncMotorList().size(); i++) {
835  SyncMotor* syncMotor = m_allElements.GetSyncMotorList()[i];
836  arrayString.Add(syncMotor->GetElectricalData().name);
837  }
838  } break;
839  case TYPE_IND_MOTOR: {
840  for(int i = 0; i < (int)m_allElements.GetIndMotorList().size(); i++) {
841  IndMotor* indMotor = m_allElements.GetIndMotorList()[i];
842  arrayString.Add(indMotor->GetElectricalData().name);
843  }
844  } break;
845 
846  default:
847  break;
848  }
849  m_choiceName->Append(arrayString);
850  m_choiceName->Enable();
851 }
852 
853 void TextForm::ElementNumberChoice()
854 {
855  m_choiceTextFromBus->Enable(false);
856  m_choiceTextToBus->Enable(false);
857  m_choiceTextUnit->Enable(false);
858  m_choiceTextFromBus->Clear();
859  m_choiceTextToBus->Clear();
860  m_choiceTextUnit->Clear();
861 
862  int index = m_choiceName->GetSelection();
863  m_text->SetElementNumber(index);
864 
865  m_choiceTextType->Clear();
866  wxArrayString arrayString;
867  switch(m_text->GetElementType()) {
868  case TYPE_BUS: {
869  Bus* bus = m_allElements.GetBusList()[index];
870  m_text->SetElement(bus);
871 
872  arrayString.Add(_("Name"));
873  arrayString.Add(_("Voltage"));
874  arrayString.Add(_("Angle"));
875  arrayString.Add(_("Fault current"));
876  arrayString.Add(_("Fault voltage"));
877  arrayString.Add(_("Short-circuit power"));
878  } break;
879  case TYPE_SYNC_GENERATOR: {
880  SyncGenerator* syncGenerator = m_allElements.GetSyncGeneratorList()[index];
881  m_text->SetElement(syncGenerator);
882 
883  arrayString.Add(_("Name"));
884  arrayString.Add(_("Active power"));
885  arrayString.Add(_("Reactive power"));
886  arrayString.Add(_("Fault current"));
887  } break;
888  case TYPE_LINE: {
889  Line* line = m_allElements.GetLineList()[index];
890  m_text->SetElement(line);
891 
892  arrayString.Add(_("Name"));
893  arrayString.Add(_("Active power flow"));
894  arrayString.Add(_("Reactive power flow"));
895  arrayString.Add(_("Losses"));
896  arrayString.Add(_("Current"));
897  arrayString.Add(_("Fault current"));
898  } break;
899  case TYPE_TRANSFORMER: {
900  Transformer* transformer = m_allElements.GetTransformerList()[index];
901  m_text->SetElement(transformer);
902 
903  arrayString.Add(_("Name"));
904  arrayString.Add(_("Active power flow"));
905  arrayString.Add(_("Reactive power flow"));
906  arrayString.Add(_("Losses"));
907  arrayString.Add(_("Current"));
908  arrayString.Add(_("Fault current"));
909  } break;
910  case TYPE_LOAD: {
911  Load* load = m_allElements.GetLoadList()[index];
912  m_text->SetElement(load);
913 
914  arrayString.Add(_("Name"));
915  arrayString.Add(_("Active power"));
916  arrayString.Add(_("Reactive power"));
917  } break;
918  case TYPE_CAPACITOR: {
919  Capacitor* capacitor = m_allElements.GetCapacitorList()[index];
920  m_text->SetElement(capacitor);
921 
922  arrayString.Add(_("Name"));
923  arrayString.Add(_("Reactive power"));
924  } break;
925  case TYPE_INDUCTOR: {
926  Inductor* inductor = m_allElements.GetInductorList()[index];
927  m_text->SetElement(inductor);
928 
929  arrayString.Add(_("Name"));
930  arrayString.Add(_("Reactive power"));
931  } break;
932  case TYPE_SYNC_MOTOR: {
933  SyncMotor* syncMotor = m_allElements.GetSyncMotorList()[index];
934  m_text->SetElement(syncMotor);
935 
936  arrayString.Add(_("Name"));
937  arrayString.Add(_("Active power"));
938  arrayString.Add(_("Reactive power"));
939  } break;
940  case TYPE_IND_MOTOR: {
941  IndMotor* indMotor = m_allElements.GetIndMotorList()[index];
942  m_text->SetElement(indMotor);
943 
944  arrayString.Add(_("Name"));
945  arrayString.Add(_("Active power"));
946  arrayString.Add(_("Reactive power"));
947  } break;
948 
949  default:
950  break;
951  }
952  m_choiceTextType->Append(arrayString);
953  m_choiceTextType->Enable();
954 }
955 
956 void TextForm::DataTypeChoice()
957 {
958  m_choiceTextFromBus->Enable(false);
959  m_choiceTextToBus->Enable(false);
960 
961  m_choiceTextToBus->Clear();
962  m_choiceTextFromBus->Clear();
963  m_choiceTextUnit->Clear();
964 
965  m_choiceTextUnit->Enable();
966 
967  wxArrayString arrayString;
968  switch(m_text->GetDataType()) {
969  case DATA_NAME: {
970  m_choiceTextUnit->Enable(false);
971  return;
972  } break;
973  case DATA_VOLTAGE:
974  case DATA_SC_VOLTAGE: {
975  arrayString.Add(_("p.u."));
976  arrayString.Add(_("V"));
977  arrayString.Add(_("kV"));
978  } break;
979  case DATA_ANGLE: {
980  arrayString.Add(_("Degrees"));
981  arrayString.Add(_("Radians"));
982  } break;
983  case DATA_SC_CURRENT:
984  case DATA_PF_CURRENT: {
985  arrayString.Add(_("p.u."));
986  arrayString.Add(_("A"));
987  arrayString.Add(_("kA"));
988  } break;
989  case DATA_SC_POWER: {
990  arrayString.Add(_("p.u."));
991  arrayString.Add(_("VA"));
992  arrayString.Add(_("kVA"));
993  arrayString.Add(_("MVA"));
994  } break;
995  case DATA_ACTIVE_POWER:
996  case DATA_PF_ACTIVE:
997  case DATA_PF_LOSSES: {
998  arrayString.Add(_("p.u."));
999  arrayString.Add(_("W"));
1000  arrayString.Add(_("kW"));
1001  arrayString.Add(_("MW"));
1002  m_choiceTextUnit->Enable();
1003  } break;
1004  case DATA_REACTIVE_POWER:
1005  case DATA_PF_REACTIVE: {
1006  arrayString.Add(_("p.u."));
1007  arrayString.Add(_("VAr"));
1008  arrayString.Add(_("kVAr"));
1009  arrayString.Add(_("MVAr"));
1010  } break;
1011  default:
1012  break;
1013  }
1014  m_choiceTextUnit->Append(arrayString);
1015 
1016  switch(m_text->GetElementType()) {
1017  case TYPE_LINE: {
1018  if(m_text->GetDataType() != DATA_PF_LOSSES) {
1019  auto it = m_allElements.GetLineList().begin();
1020  std::advance(it, m_text->GetElementNumber());
1021  Line* line = *it;
1022 
1023  Bus* bus1 = static_cast<Bus*>(line->GetParentList()[0]);
1024  Bus* bus2 = static_cast<Bus*>(line->GetParentList()[1]);
1025  wxString bus1Name = bus1->GetElectricalData().name;
1026  wxString bus2Name = bus2->GetElectricalData().name;
1027 
1028  m_choiceTextFromBus->Append(bus1Name);
1029  m_choiceTextFromBus->Append(bus2Name);
1030  m_choiceTextToBus->Append(bus2Name);
1031  m_choiceTextToBus->Append(bus1Name);
1032  m_choiceTextFromBus->SetSelection(0);
1033  m_choiceTextToBus->SetSelection(0);
1034 
1035  m_choiceTextFromBus->Enable();
1036  m_choiceTextToBus->Enable();
1037  }
1038  } break;
1039  case TYPE_TRANSFORMER: {
1040  if(m_text->GetDataType() != DATA_PF_LOSSES) {
1041  auto it = m_allElements.GetTransformerList().begin();
1042  std::advance(it, m_text->GetElementNumber());
1043  Transformer* transformer = *it;
1044 
1045  Bus* bus1 = static_cast<Bus*>(transformer->GetParentList()[0]);
1046  Bus* bus2 = static_cast<Bus*>(transformer->GetParentList()[1]);
1047  wxString bus1Name = bus1->GetElectricalData().name;
1048  wxString bus2Name = bus2->GetElectricalData().name;
1049 
1050  m_choiceTextFromBus->Append(bus1Name);
1051  m_choiceTextFromBus->Append(bus2Name);
1052  m_choiceTextToBus->Append(bus2Name);
1053  m_choiceTextToBus->Append(bus1Name);
1054  m_choiceTextFromBus->SetSelection(0);
1055  m_choiceTextToBus->SetSelection(0);
1056 
1057  m_choiceTextFromBus->Enable();
1058  m_choiceTextToBus->Enable();
1059  }
1060  } break;
1061  default:
1062  break;
1063  }
1064 }
1065 
1066 void TextForm::UnitChoice()
1067 {
1068  switch(m_text->GetDataType()) {
1069  case DATA_NAME: {
1070  m_choiceTextUnit->Enable(false);
1071  return;
1072  } break;
1073  case DATA_VOLTAGE:
1074  case DATA_SC_VOLTAGE: {
1075  switch(m_choiceTextUnit->GetSelection()) {
1076  case 0: {
1077  m_text->SetUnit(UNIT_PU);
1078  } break;
1079  case 1: {
1080  m_text->SetUnit(UNIT_V);
1081  } break;
1082  case 2: {
1083  m_text->SetUnit(UNIT_kV);
1084  } break;
1085  default:
1086  break;
1087  }
1088  } break;
1089  case DATA_ANGLE: {
1090  switch(m_choiceTextUnit->GetSelection()) {
1091  case 0: {
1092  m_text->SetUnit(UNIT_DEGREE);
1093  } break;
1094  case 1: {
1095  m_text->SetUnit(UNIT_RADIAN);
1096  } break;
1097  default:
1098  break;
1099  }
1100  } break;
1101  case DATA_SC_CURRENT:
1102  case DATA_PF_CURRENT: {
1103  switch(m_choiceTextUnit->GetSelection()) {
1104  case 0: {
1105  m_text->SetUnit(UNIT_PU);
1106  } break;
1107  case 1: {
1108  m_text->SetUnit(UNIT_A);
1109  } break;
1110  case 2: {
1111  m_text->SetUnit(UNIT_kA);
1112  } break;
1113  default:
1114  break;
1115  }
1116  } break;
1117  case DATA_SC_POWER: {
1118  switch(m_choiceTextUnit->GetSelection()) {
1119  case 0: {
1120  m_text->SetUnit(UNIT_PU);
1121  } break;
1122  case 1: {
1123  m_text->SetUnit(UNIT_VA);
1124  } break;
1125  case 2: {
1126  m_text->SetUnit(UNIT_kVA);
1127  } break;
1128  case 3: {
1129  m_text->SetUnit(UNIT_MVA);
1130  } break;
1131  default:
1132  break;
1133  }
1134  } break;
1135  case DATA_ACTIVE_POWER:
1136  case DATA_PF_ACTIVE:
1137  case DATA_PF_LOSSES: {
1138  switch(m_choiceTextUnit->GetSelection()) {
1139  case 0: {
1140  m_text->SetUnit(UNIT_PU);
1141  } break;
1142  case 1: {
1143  m_text->SetUnit(UNIT_W);
1144  } break;
1145  case 2: {
1146  m_text->SetUnit(UNIT_kW);
1147  } break;
1148  case 3: {
1149  m_text->SetUnit(UNIT_MW);
1150  } break;
1151  default:
1152  break;
1153  }
1154  } break;
1155  case DATA_REACTIVE_POWER:
1156  case DATA_PF_REACTIVE: {
1157  switch(m_choiceTextUnit->GetSelection()) {
1158  case 0: {
1159  m_text->SetUnit(UNIT_PU);
1160  } break;
1161  case 1: {
1162  m_text->SetUnit(UNIT_VAr);
1163  } break;
1164  case 2: {
1165  m_text->SetUnit(UNIT_kVAr);
1166  } break;
1167  case 3: {
1168  m_text->SetUnit(UNIT_MVAr);
1169  } break;
1170  default:
1171  break;
1172  }
1173  } break;
1174  default:
1175  break;
1176  }
1177 }
1178 
1179 void TextForm::Preview()
1180 {
1181  double decimalPlaces = m_text->GetDecimalPlaces();
1182  if(m_textCtrlDecimal->GetValue().ToDouble(&decimalPlaces)) m_text->SetDecimalPlaces(decimalPlaces);
1183 
1184  m_text->UpdateText(m_systemPowerBase);
1185 
1186  m_textCtrlPreview->SetValue(m_text->GetText());
1187 }
1188 
1189 bool TextForm::ValidateData()
1190 {
1191  if(m_choiceElement->GetSelection() == -1) return false;
1192  if(m_choiceName->GetSelection() == -1) return false;
1193  if(m_choiceTextType->GetSelection() == -1) return false;
1194  if(m_text->GetDataType() != DATA_NAME && m_choiceTextUnit->GetSelection() == -1) return false;
1195  if(m_text->GetElementType() == TYPE_LINE || m_text->GetElementType() == TYPE_TRANSFORMER) {
1196  if(m_text->GetDataType() != DATA_PF_LOSSES && m_text->GetDataType() != DATA_NAME) {
1197  if(m_choiceTextFromBus->GetSelection() == -1) return false;
1198  if(m_choiceTextToBus->GetSelection() == -1) return false;
1199  }
1200  }
1201 
1202  if(m_choiceTextFromBus->IsEnabled() && m_choiceTextToBus->IsEnabled())
1203  m_text->SetDirection(m_choiceTextFromBus->GetSelection());
1204  double decimalPlaces = m_text->GetDecimalPlaces();
1205  if(m_textCtrlDecimal->GetValue().ToDouble(&decimalPlaces)) m_text->SetDecimalPlaces(decimalPlaces);
1206 
1207  m_textToEdit->SetElementType(m_text->GetElementType());
1208  m_textToEdit->SetElementNumber(m_text->GetElementNumber());
1209  m_textToEdit->SetElement(m_text->GetElement());
1210  m_textToEdit->SetDataType(m_text->GetDataType());
1211  m_textToEdit->SetDirection(m_text->GetDirection());
1212  m_textToEdit->SetUnit(m_text->GetUnit());
1213  m_textToEdit->SetDecimalPlaces(decimalPlaces);
1214  m_textToEdit->UpdateText(m_systemPowerBase);
1215 
1216  return true;
1217 }
1218 
1219 void TextForm::OnOKButtonClick(wxCommandEvent& event)
1220 {
1221  if(ValidateData()) {
1222  EndModal(wxID_OK);
1223  } else {
1224  wxString errorMsg = _("There are blank fields.");
1225  wxMessageDialog msgDialog(this, errorMsg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
1226  msgDialog.ShowModal();
1227  }
1228 }
Definition: Text.h:65
+ + + + + + + + +
Definition: Bus.h:62
+ + + +
Definition: Line.h:52
+
Definition: Load.h:35
+ + + + + + + + + + + - +
diff --git a/docs/doxygen/html/_text_form_8h.html b/docs/doxygen/html/_text_form_8h.html new file mode 100644 index 0000000..3914266 --- /dev/null +++ b/docs/doxygen/html/_text_form_8h.html @@ -0,0 +1,117 @@ + + + + + + + + + +Project/TextForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
TextForm.h File Reference
+
+
+
#include "ElementForm.h"
+#include "Text.h"
+#include "ElectricCalculation.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  TextForm
 Form to edit the text graphical data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_text_form_8h_source.html b/docs/doxygen/html/_text_form_8h_source.html index c57318c..140e411 100644 --- a/docs/doxygen/html/_text_form_8h_source.html +++ b/docs/doxygen/html/_text_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,17 +88,17 @@ $(document).ready(function(){initNavTree('_text_form_8h_source.html','');});
TextForm.h
-
1 #ifndef TEXTFORM_H
2 #define TEXTFORM_H
3 #include "ElementForm.h"
4 
5 #include "Text.h"
6 #include "ElectricCalculation.h"
7 
8 class TextForm : public TextFormBase
9 {
10 public:
11  TextForm(wxWindow* parent, Text* text, std::vector<Element*> elementList, double systemPowerBase = 100e6);
12  virtual ~TextForm();
13 
14  virtual bool LoadChoices();
15 
16  virtual void ElementTypeChoice();
17  virtual void ElementNumberChoice();
18  virtual void DataTypeChoice();
19  virtual void UnitChoice();
20 
21  virtual void Preview();
22  virtual bool ValidateData();
23 
24 protected:
25  virtual void OnUnitChoiceSelected(wxCommandEvent& event);
26  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
27  virtual void OnOKButtonClick(wxCommandEvent& event);
28  virtual void OnElementChoiceSelected(wxCommandEvent& event);
29  virtual void OnFromBusChoiceSelected(wxCommandEvent& event);
30  virtual void OnNameChoiceSelected(wxCommandEvent& event);
31  virtual void OnTextEnter(wxCommandEvent& event);
32  virtual void OnToBusChoiceSelected(wxCommandEvent& event);
33  virtual void OnTypeChoiceSelected(wxCommandEvent& event);
34 
35  Text* m_text = NULL;
36  Text* m_textToEdit = NULL;
37  wxWindow* m_parent = NULL;
38  ElectricCalculation m_allElements;
39  double m_systemPowerBase;
40 };
41 #endif // TEXTFORM_H
Definition: Text.h:48
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef TEXTFORM_H
19 #define TEXTFORM_H
20 #include "ElementForm.h"
21 
22 #include "Text.h"
23 #include "ElectricCalculation.h"
24 
32 class TextForm : public TextFormBase
33 {
34  public:
35  TextForm(wxWindow* parent, Text* text, std::vector<Element*> elementList, double systemPowerBase = 100e6);
36  virtual ~TextForm();
37 
38  virtual bool LoadChoices();
39 
40  virtual void ElementTypeChoice();
41  virtual void ElementNumberChoice();
42  virtual void DataTypeChoice();
43  virtual void UnitChoice();
44 
45  virtual void Preview();
46  virtual bool ValidateData();
47 
48  protected:
49  virtual void OnUnitChoiceSelected(wxCommandEvent& event);
50  virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
51  virtual void OnOKButtonClick(wxCommandEvent& event);
52  virtual void OnElementChoiceSelected(wxCommandEvent& event);
53  virtual void OnFromBusChoiceSelected(wxCommandEvent& event);
54  virtual void OnNameChoiceSelected(wxCommandEvent& event);
55  virtual void OnTextEnter(wxCommandEvent& event);
56  virtual void OnToBusChoiceSelected(wxCommandEvent& event);
57  virtual void OnTypeChoiceSelected(wxCommandEvent& event);
58 
59  Text* m_text = NULL;
60  Text* m_textToEdit = NULL;
61  wxWindow* m_parent = NULL;
62  ElectricCalculation m_allElements;
63  double m_systemPowerBase;
64 };
65 #endif // TEXTFORM_H
Definition: Text.h:65
Base class of electric calculations, with general methods.
- - +
Form to edit the text graphical data.
Definition: TextForm.h:32
+
-
1 #include "TransferFunction.h"
2 #include "TransferFunctionForm.h"
3 
4 TransferFunction::TransferFunction(int id) : ControlElement(id)
5 {
6  // Superscript unicode numbers
7  m_supNumber[0] = L'\u2070';
8  m_supNumber[1] = L'\u00B9';
9  m_supNumber[2] = L'\u00B2';
10  m_supNumber[3] = L'\u00B3';
11  m_supNumber[4] = L'\u2074';
12  m_supNumber[5] = L'\u2075';
13  m_supNumber[6] = L'\u2076';
14  m_supNumber[7] = L'\u2077';
15  m_supNumber[8] = L'\u2078';
16  m_supNumber[9] = L'\u2079';
17 
18  m_numerator.clear();
19  m_numerator.push_back(1);
20  m_denominator.clear();
21  m_denominator.push_back(1);
22  m_denominator.push_back(1);
23  UpdateTFText();
24 
25  Node* node1 = new Node(m_position + wxPoint2DDouble(-m_width / 2, 0), Node::NODE_IN, m_borderSize);
26  node1->StartMove(m_position);
27  Node* node2 = new Node(m_position + wxPoint2DDouble(m_width / 2, 0), Node::NODE_OUT, m_borderSize);
28  node2->SetAngle(180.0);
29  node2->StartMove(m_position);
30  m_nodeList.push_back(node1);
31  m_nodeList.push_back(node2);
32 }
33 
34 TransferFunction::~TransferFunction() {}
35 void TransferFunction::Draw(wxPoint2DDouble translation, double scale) const
36 {
37  glLineWidth(1.0);
38  if(m_selected) {
39  glColor4dv(m_selectionColour.GetRGBA());
40  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
41  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
42  }
43  glColor4d(1.0, 1.0, 1.0, 1.0);
44  DrawRectangle(m_position, m_width, m_height);
45  glColor4d(0.0, 0.0, 0.0, 1.0);
46  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
47 
48  std::vector<wxPoint2DDouble> linePts;
49  linePts.push_back(wxPoint2DDouble(m_position.m_x - m_width / 2 + 5 + m_borderSize, m_position.m_y));
50  linePts.push_back(wxPoint2DDouble(m_position.m_x + m_width / 2 - 5 - m_borderSize, m_position.m_y));
51  DrawLine(linePts);
52 
53  DrawNodes();
54 
55  glEnable(GL_TEXTURE_2D);
56  glColor4d(0.0, 0.0, 0.0, 1.0);
57  m_glStringNum->bind();
58  m_glStringNum->render(m_position.m_x, m_position.m_y - m_height / 4);
59  m_glStringDen->bind();
60  m_glStringDen->render(m_position.m_x, m_position.m_y + m_height / 4);
61  glDisable(GL_TEXTURE_2D);
62 }
63 
64 void TransferFunction::SetText(wxString numerator, wxString denominator)
65 {
66  wxFont font(m_fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
67  wxScreenDC dc;
68 
69  if(m_glStringNum) {
70  delete m_glStringNum;
71  m_glStringNum = NULL;
72  }
73  m_glStringNum = new wxGLString(numerator);
74  m_glStringNum->setFont(font);
75  m_glStringNum->consolidate(&dc);
76 
77  if(m_glStringDen) {
78  delete m_glStringDen;
79  m_glStringDen = NULL;
80  }
81  m_glStringDen = new wxGLString(denominator);
82  m_glStringDen->setFont(font);
83  m_glStringDen->consolidate(&dc);
84 
85  double nWidth = m_glStringNum->getWidth() + 5 + m_borderSize;
86  double dWidth = m_glStringDen->getWidth() + 5 + m_borderSize;
87 
88  m_width = nWidth > dWidth ? nWidth : dWidth;
89  m_height = m_glStringNum->getheight() + m_glStringDen->getheight() + 2 * m_borderSize;
90  SetPosition(m_position); // Update rect properly.
91 }
92 
93 wxString TransferFunction::GetSuperscriptNumber(int number)
94 {
95  wxString strNumber = wxString::Format("%d", number);
96  wxString superscriptStr = "";
97  for(int i = 0; i < (int)strNumber.length(); ++i) {
98  wxString digitStr = strNumber[i];
99  long digit = 0;
100  digitStr.ToLong(&digit);
101  superscriptStr += wxString(m_supNumber[digit]);
102  }
103  return superscriptStr;
104 }
105 
106 void TransferFunction::GetTFString(wxString& numerator, wxString& denominator)
107 {
108  numerator = "";
109  denominator = "";
110  int index = static_cast<int>(m_numerator.size()) - 1;
111  for(auto it = m_numerator.begin(), itEnd = m_numerator.end(); it != itEnd; ++it) {
112  double value = *it;
113  if(value != 0.0) {
114  wxString signal;
115  if(index == static_cast<int>(m_numerator.size()) - 1) {
116  if(value >= 0.0)
117  signal += "";
118  else
119  signal += "-";
120  } else {
121  if(value >= 0.0)
122  signal += "+ ";
123  else
124  signal += "- ";
125  }
126 
127  if(index == 0) {
128  numerator += signal + StringFromDouble(std::abs(value), 0);
129  break;
130  } else if(index == 1) {
131  if(value == 1.0) {
132  numerator += signal + "s";
133  } else {
134  numerator += signal + StringFromDouble(std::abs(value), 0) + "s";
135  }
136  } else {
137  if(value == 1.0) {
138  numerator += signal + "s" + GetSuperscriptNumber(index);
139  } else {
140  numerator += signal + StringFromDouble(std::abs(value), 0) + "s" + GetSuperscriptNumber(index);
141  }
142  }
143  numerator += " ";
144  }
145  --index;
146  }
147 
148  index = static_cast<int>(m_denominator.size()) - 1;
149  for(auto it = m_denominator.begin(), itEnd = m_denominator.end(); it != itEnd; ++it) {
150  double value = *it;
151  if(value != 0.0) {
152  wxString signal;
153  if(index == static_cast<int>(m_denominator.size()) - 1) {
154  if(value >= 0.0)
155  signal += "";
156  else
157  signal += "-";
158  } else {
159  if(value >= 0.0)
160  signal += "+ ";
161  else
162  signal += "- ";
163  }
164 
165  if(index == 0) {
166  denominator += signal + StringFromDouble(std::abs(value), 0);
167  break;
168  } else if(index == 1) {
169  if(value == 1.0) {
170  denominator += signal + "s";
171  } else {
172  denominator += signal + StringFromDouble(std::abs(value), 0) + "s";
173  }
174  } else {
175  if(value == 1.0) {
176  denominator += signal + "s" + GetSuperscriptNumber(index);
177  } else {
178  denominator += signal + StringFromDouble(std::abs(value), 0) + "s" + GetSuperscriptNumber(index);
179  }
180  }
181  denominator += " ";
182  }
183  --index;
184  }
185 }
186 
187 void TransferFunction::UpdateTFText()
188 {
189  wxString num, den;
190  GetTFString(num, den);
191  SetText(num, den);
192  if(m_nodeList.size() == 2) {
193  if(m_angle == 0.0) {
194  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
195  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
196  } else if(m_angle == 90.0) {
197  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
198  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
199  } else if(m_angle == 180.0) {
200  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
201  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
202  } else if(m_angle == 270.0) {
203  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
204  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
205  }
206  }
207 }
208 
209 bool TransferFunction::ShowForm(wxWindow* parent, Element* element)
210 {
211  TransferFunctionForm* tfForm = new TransferFunctionForm(parent, this);
212  if(tfForm->ShowModal() == wxID_OK) {
213  tfForm->Destroy();
214  return true;
215  }
216  tfForm->Destroy();
217  return false;
218 }
219 
220 void TransferFunction::Rotate(bool clockwise)
221 {
222  if(clockwise)
223  m_angle += 90.0;
224  else
225  m_angle -= 90.0;
226  if(m_angle >= 360.0)
227  m_angle = 0.0;
228  else if(m_angle < 0)
229  m_angle = 270.0;
230 
231  if(m_angle == 0.0) {
232  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
233  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
234  } else if(m_angle == 90.0) {
235  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
236  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
237  } else if(m_angle == 180.0) {
238  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
239  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
240  } else if(m_angle == 270.0) {
241  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
242  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
243  }
244 
245  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
246  Node* node = *it;
247  node->Rotate(clockwise);
248  }
249 }
250 
251 void TransferFunction::CalculateSpaceState(int maxIteration, double error)
252 {
253  m_maxIteration = maxIteration;
254  m_error = error;
255 
256  int order = static_cast<int>(m_denominator.size());
257  std::vector<double> denominator = m_denominator;
258  std::vector<double> numerator;
259 
260  int k = order;
261  for(int i = 0; i < order; i++) {
262  int numIndex = i - (order - static_cast<int>(m_numerator.size()));
263  if(numIndex < 0)
264  numerator.push_back(0.0);
265  else
266  numerator.push_back(m_numerator[numIndex]);
267  k--;
268  }
269 
270  SpaceState ss;
271  for(int i = 0; i < (order - 1); i++) {
272  std::vector<double> lineA;
273  for(int j = 0; j < (order - 1); j++) {
274  if(j == i + 1)
275  lineA.push_back(1.0);
276  else
277  lineA.push_back(0.0);
278  }
279  ss.A.push_back(lineA);
280  ss.B.push_back(0.0);
281  ss.C.push_back(0.0);
282  }
283  for(int i = 0; i < order - 1; i++) {
284  ss.A[order - 2][i] = -(denominator[order - 1 - i] / denominator[0]);
285  ss.C[i] = (numerator[order - 1 - i] - denominator[order - 1 - i] * numerator[0]) / denominator[0];
286  }
287  ss.B[order - 2] = 1.0;
288  ss.D = numerator[0];
289 
290  m_ss = ss;
291 
292  // Reset state
293  m_x.clear();
294  m_dx.clear();
295 
296  for(unsigned int i = 0; i < m_denominator.size(); ++i) {
297  m_x.push_back(0.0);
298  m_dx.push_back(0.0);
299  }
300 }
301 
302 bool TransferFunction::Solve(double input, double timeStep)
303 {
304  int order = static_cast<int>(m_ss.A.size());
305 
306  std::vector<double> x;
307  std::vector<double> oldx;
308  std::vector<double> dx;
309  std::vector<double> olddx;
310  for(int i = 0; i < order; i++) {
311  x.push_back(m_x[i]);
312  oldx.push_back(m_x[i]);
313 
314  dx.push_back(m_dx[i]);
315  olddx.push_back(m_dx[i]);
316  }
317 
318  bool exit = false;
319  int iter = 0;
320  while(!exit) {
321  double xError = 0.0;
322  double dxError = 0.0;
323  for(int i = 0; i < order; i++) {
324  // Trapezoidal method
325  x[i] = m_x[i] + 0.5 * timeStep * (m_dx[i] + dx[i]);
326 
327  if(std::abs(x[i] - oldx[i]) > xError) xError = std::abs(x[i] - oldx[i]);
328 
329  oldx[i] = x[i];
330  }
331  for(int i = 0; i < order; i++) {
332  // x' = Ax + Bu
333  dx[i] = 0.0;
334  for(int j = 0; j < order; j++) dx[i] += m_ss.A[i][j] * x[j];
335  dx[i] += m_ss.B[i] * input;
336 
337  if(std::abs(dx[i] - olddx[i]) > dxError) dxError = std::abs(dx[i] - olddx[i]);
338 
339  olddx[i] = dx[i];
340  }
341  if(std::max(xError, dxError) < m_error) exit = true;
342 
343  iter++;
344  if(iter >= m_maxIteration) return false;
345  }
346 
347  m_output = 0.0;
348  for(int i = 0; i < order; i++) {
349  m_output += m_ss.C[i] * x[i];
350  m_x[i] = x[i];
351  m_dx[i] = dx[i];
352  }
353 
354  m_output += m_ss.D * input;
355 
356  return true;
357 }
358 
360 {
361  TransferFunction* copy = new TransferFunction(m_elementID);
362  *copy = *this;
363  m_glStringNum = NULL;
364  m_glStringDen = NULL;
365  UpdateTFText();
366  return copy;
367 }
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
- -
virtual Element * GetCopy()
Get a the element copy.
- - -
virtual void Rotate(bool clockwise=true)
Rotate the element.
- -
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "TransferFunction.h"
19 #include "TransferFunctionForm.h"
20 
21 TransferFunction::TransferFunction(int id) : ControlElement(id)
22 {
23  // Superscript unicode numbers
24  m_supNumber[0] = L'\u2070';
25  m_supNumber[1] = L'\u00B9';
26  m_supNumber[2] = L'\u00B2';
27  m_supNumber[3] = L'\u00B3';
28  m_supNumber[4] = L'\u2074';
29  m_supNumber[5] = L'\u2075';
30  m_supNumber[6] = L'\u2076';
31  m_supNumber[7] = L'\u2077';
32  m_supNumber[8] = L'\u2078';
33  m_supNumber[9] = L'\u2079';
34 
35  m_numerator.clear();
36  m_numerator.push_back(1);
37  m_denominator.clear();
38  m_denominator.push_back(1);
39  m_denominator.push_back(1);
40  UpdateTFText();
41 
42  Node* node1 = new Node(m_position + wxPoint2DDouble(-m_width / 2, 0), Node::NODE_IN, m_borderSize);
43  node1->StartMove(m_position);
44  Node* node2 = new Node(m_position + wxPoint2DDouble(m_width / 2, 0), Node::NODE_OUT, m_borderSize);
45  node2->SetAngle(180.0);
46  node2->StartMove(m_position);
47  m_nodeList.push_back(node1);
48  m_nodeList.push_back(node2);
49 }
50 
51 TransferFunction::~TransferFunction() {}
52 void TransferFunction::Draw(wxPoint2DDouble translation, double scale) const
53 {
54  glLineWidth(1.0);
55  if(m_selected) {
56  glColor4dv(m_selectionColour.GetRGBA());
57  double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
58  DrawRectangle(m_position, m_width + borderSize, m_height + borderSize);
59  }
60  glColor4d(1.0, 1.0, 1.0, 1.0);
61  DrawRectangle(m_position, m_width, m_height);
62  glColor4d(0.0, 0.0, 0.0, 1.0);
63  DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP);
64 
65  std::vector<wxPoint2DDouble> linePts;
66  linePts.push_back(wxPoint2DDouble(m_position.m_x - m_width / 2 + 5 + m_borderSize, m_position.m_y));
67  linePts.push_back(wxPoint2DDouble(m_position.m_x + m_width / 2 - 5 - m_borderSize, m_position.m_y));
68  DrawLine(linePts);
69 
70  DrawNodes();
71 
72  glEnable(GL_TEXTURE_2D);
73  glColor4d(0.0, 0.0, 0.0, 1.0);
74  m_glStringNum->bind();
75  m_glStringNum->render(m_position.m_x, m_position.m_y - m_height / 4);
76  m_glStringDen->bind();
77  m_glStringDen->render(m_position.m_x, m_position.m_y + m_height / 4);
78  glDisable(GL_TEXTURE_2D);
79 }
80 
81 void TransferFunction::SetText(wxString numerator, wxString denominator)
82 {
83  wxFont font(m_fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
84  wxScreenDC dc;
85 
86  if(m_glStringNum) {
87  delete m_glStringNum;
88  m_glStringNum = NULL;
89  }
90  m_glStringNum = new wxGLString(numerator);
91  m_glStringNum->setFont(font);
92  m_glStringNum->consolidate(&dc);
93 
94  if(m_glStringDen) {
95  delete m_glStringDen;
96  m_glStringDen = NULL;
97  }
98  m_glStringDen = new wxGLString(denominator);
99  m_glStringDen->setFont(font);
100  m_glStringDen->consolidate(&dc);
101 
102  double nWidth = m_glStringNum->getWidth() + 5 + m_borderSize;
103  double dWidth = m_glStringDen->getWidth() + 5 + m_borderSize;
104 
105  m_width = nWidth > dWidth ? nWidth : dWidth;
106  m_height = m_glStringNum->getheight() + m_glStringDen->getheight() + 2 * m_borderSize;
107  SetPosition(m_position); // Update rect properly.
108 }
109 
110 wxString TransferFunction::GetSuperscriptNumber(int number)
111 {
112  wxString strNumber = wxString::Format("%d", number);
113  wxString superscriptStr = "";
114  for(int i = 0; i < (int)strNumber.length(); ++i) {
115  wxString digitStr = strNumber[i];
116  long digit = 0;
117  digitStr.ToLong(&digit);
118  superscriptStr += wxString(m_supNumber[digit]);
119  }
120  return superscriptStr;
121 }
122 
123 void TransferFunction::GetTFString(wxString& numerator, wxString& denominator)
124 {
125  numerator = "";
126  denominator = "";
127  int index = static_cast<int>(m_numerator.size()) - 1;
128  for(auto it = m_numerator.begin(), itEnd = m_numerator.end(); it != itEnd; ++it) {
129  double value = *it;
130  if(value != 0.0) {
131  wxString signal;
132  if(index == static_cast<int>(m_numerator.size()) - 1) {
133  if(value >= 0.0)
134  signal += "";
135  else
136  signal += "-";
137  } else {
138  if(value >= 0.0)
139  signal += "+ ";
140  else
141  signal += "- ";
142  }
143 
144  if(index == 0) {
145  numerator += signal + StringFromDouble(std::abs(value), 0);
146  break;
147  } else if(index == 1) {
148  if(value == 1.0) {
149  numerator += signal + "s";
150  } else {
151  numerator += signal + StringFromDouble(std::abs(value), 0) + "s";
152  }
153  } else {
154  if(value == 1.0) {
155  numerator += signal + "s" + GetSuperscriptNumber(index);
156  } else {
157  numerator += signal + StringFromDouble(std::abs(value), 0) + "s" + GetSuperscriptNumber(index);
158  }
159  }
160  numerator += " ";
161  }
162  --index;
163  }
164 
165  index = static_cast<int>(m_denominator.size()) - 1;
166  for(auto it = m_denominator.begin(), itEnd = m_denominator.end(); it != itEnd; ++it) {
167  double value = *it;
168  if(value != 0.0) {
169  wxString signal;
170  if(index == static_cast<int>(m_denominator.size()) - 1) {
171  if(value >= 0.0)
172  signal += "";
173  else
174  signal += "-";
175  } else {
176  if(value >= 0.0)
177  signal += "+ ";
178  else
179  signal += "- ";
180  }
181 
182  if(index == 0) {
183  denominator += signal + StringFromDouble(std::abs(value), 0);
184  break;
185  } else if(index == 1) {
186  if(value == 1.0) {
187  denominator += signal + "s";
188  } else {
189  denominator += signal + StringFromDouble(std::abs(value), 0) + "s";
190  }
191  } else {
192  if(value == 1.0) {
193  denominator += signal + "s" + GetSuperscriptNumber(index);
194  } else {
195  denominator += signal + StringFromDouble(std::abs(value), 0) + "s" + GetSuperscriptNumber(index);
196  }
197  }
198  denominator += " ";
199  }
200  --index;
201  }
202 }
203 
204 void TransferFunction::UpdateTFText()
205 {
206  wxString num, den;
207  GetTFString(num, den);
208  SetText(num, den);
209  if(m_nodeList.size() == 2) {
210  if(m_angle == 0.0) {
211  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
212  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
213  } else if(m_angle == 90.0) {
214  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
215  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
216  } else if(m_angle == 180.0) {
217  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
218  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
219  } else if(m_angle == 270.0) {
220  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
221  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
222  }
223  }
224 }
225 
226 bool TransferFunction::ShowForm(wxWindow* parent, Element* element)
227 {
228  TransferFunctionForm* tfForm = new TransferFunctionForm(parent, this);
229  if(tfForm->ShowModal() == wxID_OK) {
230  tfForm->Destroy();
231  return true;
232  }
233  tfForm->Destroy();
234  return false;
235 }
236 
237 void TransferFunction::Rotate(bool clockwise)
238 {
239  if(clockwise)
240  m_angle += 90.0;
241  else
242  m_angle -= 90.0;
243  if(m_angle >= 360.0)
244  m_angle = 0.0;
245  else if(m_angle < 0)
246  m_angle = 270.0;
247 
248  if(m_angle == 0.0) {
249  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
250  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
251  } else if(m_angle == 90.0) {
252  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
253  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
254  } else if(m_angle == 180.0) {
255  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
256  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
257  } else if(m_angle == 270.0) {
258  m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
259  m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
260  }
261 
262  for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
263  Node* node = *it;
264  node->Rotate(clockwise);
265  }
266 }
267 
268 void TransferFunction::CalculateSpaceState(int maxIteration, double error)
269 {
270  m_maxIteration = maxIteration;
271  m_error = error;
272 
273  int order = static_cast<int>(m_denominator.size());
274  std::vector<double> denominator = m_denominator;
275  std::vector<double> numerator;
276 
277  int k = order;
278  for(int i = 0; i < order; i++) {
279  int numIndex = i - (order - static_cast<int>(m_numerator.size()));
280  if(numIndex < 0)
281  numerator.push_back(0.0);
282  else
283  numerator.push_back(m_numerator[numIndex]);
284  k--;
285  }
286 
287  SpaceState ss;
288  for(int i = 0; i < (order - 1); i++) {
289  std::vector<double> lineA;
290  for(int j = 0; j < (order - 1); j++) {
291  if(j == i + 1)
292  lineA.push_back(1.0);
293  else
294  lineA.push_back(0.0);
295  }
296  ss.A.push_back(lineA);
297  ss.B.push_back(0.0);
298  ss.C.push_back(0.0);
299  }
300  for(int i = 0; i < order - 1; i++) {
301  ss.A[order - 2][i] = -(denominator[order - 1 - i] / denominator[0]);
302  ss.C[i] = (numerator[order - 1 - i] - denominator[order - 1 - i] * numerator[0]) / denominator[0];
303  }
304  ss.B[order - 2] = 1.0;
305  ss.D = numerator[0];
306 
307  m_ss = ss;
308 
309  // Reset state
310  m_x.clear();
311  m_dx.clear();
312 
313  for(unsigned int i = 0; i < m_denominator.size(); ++i) {
314  m_x.push_back(0.0);
315  m_dx.push_back(0.0);
316  }
317 }
318 
319 bool TransferFunction::Solve(double input, double timeStep)
320 {
321  int order = static_cast<int>(m_ss.A.size());
322 
323  std::vector<double> x;
324  std::vector<double> oldx;
325  std::vector<double> dx;
326  std::vector<double> olddx;
327  for(int i = 0; i < order; i++) {
328  x.push_back(m_x[i]);
329  oldx.push_back(m_x[i]);
330 
331  dx.push_back(m_dx[i]);
332  olddx.push_back(m_dx[i]);
333  }
334 
335  bool exit = false;
336  int iter = 0;
337  while(!exit) {
338  double xError = 0.0;
339  double dxError = 0.0;
340  for(int i = 0; i < order; i++) {
341  // Trapezoidal method
342  x[i] = m_x[i] + 0.5 * timeStep * (m_dx[i] + dx[i]);
343 
344  if(std::abs(x[i] - oldx[i]) > xError) xError = std::abs(x[i] - oldx[i]);
345 
346  oldx[i] = x[i];
347  }
348  for(int i = 0; i < order; i++) {
349  // x' = Ax + Bu
350  dx[i] = 0.0;
351  for(int j = 0; j < order; j++) dx[i] += m_ss.A[i][j] * x[j];
352  dx[i] += m_ss.B[i] * input;
353 
354  if(std::abs(dx[i] - olddx[i]) > dxError) dxError = std::abs(dx[i] - olddx[i]);
355 
356  olddx[i] = dx[i];
357  }
358  if(std::max(xError, dxError) < m_error) exit = true;
359 
360  iter++;
361  if(iter >= m_maxIteration) return false;
362  }
363 
364  m_output = 0.0;
365  for(int i = 0; i < order; i++) {
366  m_output += m_ss.C[i] * x[i];
367  m_x[i] = x[i];
368  m_dx[i] = dx[i];
369  }
370 
371  m_output += m_ss.D * input;
372 
373  return true;
374 }
375 
377 {
378  TransferFunction* copy = new TransferFunction(m_elementID);
379  *copy = *this;
380  m_glStringNum = NULL;
381  m_glStringDen = NULL;
382  UpdateTFText();
383  return copy;
384 }
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
+
Node of a control element. This class manages the user interaction with the connection and control el...
+
virtual Element * GetCopy()
Get a the element copy.
+
Form to edit the transfer function control data.
+ +
virtual void Rotate(bool clockwise=true)
Rotate the element.
+ + +
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
+
diff --git a/docs/doxygen/html/_transfer_function_8h_source.html b/docs/doxygen/html/_transfer_function_8h_source.html index 5fd75a8..bd51bfe 100644 --- a/docs/doxygen/html/_transfer_function_8h_source.html +++ b/docs/doxygen/html/_transfer_function_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,17 +88,18 @@ $(document).ready(function(){initNavTree('_transfer_function_8h_source.html','')
TransferFunction.h
-
1 #ifndef TRANSFERFUNCTION_H
2 #define TRANSFERFUNCTION_H
3 
4 #include "ControlElement.h"
5 
6 #include <wx/dcscreen.h>
7 #include "wxGLString.h"
8 
10 
12 {
13  public:
14  struct SpaceState {
15  std::vector<std::vector<double> > A;
16  std::vector<double> B;
17  std::vector<double> C;
18  double D;
19  };
20 
21  TransferFunction(int id);
23 
24  virtual void Draw(wxPoint2DDouble translation, double scale) const;
25  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
26  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
27  virtual bool ShowForm(wxWindow* parent, Element* element);
28  virtual void Rotate(bool clockwise = true);
29 
30  virtual std::vector<double> GetNumerator() const { return m_numerator; }
31  virtual std::vector<double> GetDenominator() const { return m_denominator; }
32  virtual void SetNumerator(std::vector<double> numerator) { m_numerator = numerator; }
33  virtual void SetDenominator(std::vector<double> denominator) { m_denominator = denominator; }
34  virtual void UpdateTFText();
35  virtual void UpdateText() { UpdateTFText(); }
36  virtual SpaceState GetSpaceState() { return m_ss; }
37  virtual void CalculateSpaceState(int maxIteration = 100, double error = 1e-3);
38  virtual bool Solve(double input, double timeStep);
39 
40  virtual Element* GetCopy();
41 
42  protected:
43  virtual void SetText(wxString numerator, wxString denominator);
44  virtual wxString GetSuperscriptNumber(int number);
45  virtual void GetTFString(wxString& numerator, wxString& denominator);
46 
47  wchar_t m_supNumber[10];
48 
49  wxGLString* m_glStringNum = NULL;
50  wxGLString* m_glStringDen = NULL;
51  int m_fontSize = 10;
52 
53  std::vector<double> m_numerator;
54  std::vector<double> m_denominator;
55  SpaceState m_ss;
56 
57  std::vector<double> m_x;
58  std::vector<double> m_dx;
59  double m_error = 1e-3;
60  int m_maxIteration = 100;
61 };
62 
63 #endif // TRANSFERFUNCTION_H
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
-
virtual Element * GetCopy()
Get a the element copy.
-
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
- - -
virtual void Rotate(bool clockwise=true)
Rotate the element.
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
- -
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef TRANSFERFUNCTION_H
19 #define TRANSFERFUNCTION_H
20 
21 #include "ControlElement.h"
22 
23 #include <wx/dcscreen.h>
24 #include "wxGLString.h"
25 
27 
29 {
30  public:
31  struct SpaceState {
32  std::vector<std::vector<double> > A;
33  std::vector<double> B;
34  std::vector<double> C;
35  double D;
36  };
37 
38  TransferFunction(int id);
40 
41  virtual void Draw(wxPoint2DDouble translation, double scale) const;
42  virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
43  virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
44  virtual bool ShowForm(wxWindow* parent, Element* element);
45  virtual void Rotate(bool clockwise = true);
46 
47  virtual std::vector<double> GetNumerator() const { return m_numerator; }
48  virtual std::vector<double> GetDenominator() const { return m_denominator; }
49  virtual void SetNumerator(std::vector<double> numerator) { m_numerator = numerator; }
50  virtual void SetDenominator(std::vector<double> denominator) { m_denominator = denominator; }
51  virtual void UpdateTFText();
52  virtual void UpdateText() { UpdateTFText(); }
53  virtual SpaceState GetSpaceState() { return m_ss; }
54  virtual void CalculateSpaceState(int maxIteration = 100, double error = 1e-3);
55  virtual bool Solve(double input, double timeStep);
56 
57  virtual Element* GetCopy();
58 
59  protected:
60  virtual void SetText(wxString numerator, wxString denominator);
61  virtual wxString GetSuperscriptNumber(int number);
62  virtual void GetTFString(wxString& numerator, wxString& denominator);
63 
64  wchar_t m_supNumber[10];
65 
66  wxGLString* m_glStringNum = NULL;
67  wxGLString* m_glStringDen = NULL;
68  int m_fontSize = 10;
69 
70  std::vector<double> m_numerator;
71  std::vector<double> m_denominator;
72  SpaceState m_ss;
73 
74  std::vector<double> m_x;
75  std::vector<double> m_dx;
76  double m_error = 1e-3;
77  int m_maxIteration = 100;
78 };
79 
80 #endif // TRANSFERFUNCTION_H
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
+
virtual Element * GetCopy()
Get a the element copy.
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
+
Form to edit the transfer function control data.
+ +
virtual void Rotate(bool clockwise=true)
Rotate the element.
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
+ +
Base class of a control element. Provide general methods to other control classes.
+
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
+
diff --git a/docs/doxygen/html/_transfer_function_form_8cpp_source.html b/docs/doxygen/html/_transfer_function_form_8cpp_source.html index ef0077b..3cce3f7 100644 --- a/docs/doxygen/html/_transfer_function_form_8cpp_source.html +++ b/docs/doxygen/html/_transfer_function_form_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,8 +88,9 @@ $(document).ready(function(){initNavTree('_transfer_function_form_8cpp_source.ht
TransferFunctionForm.cpp
-
1 #include "TransferFunctionForm.h"
2 #include "TransferFunction.h"
3 
4 TransferFunctionForm::TransferFunctionForm(wxWindow* parent, TransferFunction* transferFunction)
6 {
7  SetSize(GetBestSize());
8 
9  m_parent = parent;
10  m_tf = transferFunction;
11  LoadTFData();
12 }
13 
14 TransferFunctionForm::~TransferFunctionForm() {}
15 void TransferFunctionForm::OnCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
16 void TransferFunctionForm::OnOKClick(wxCommandEvent& event)
17 {
18  if(ValidateData()) EndModal(wxID_OK);
19 }
20 
21 void TransferFunctionForm::LoadTFData()
22 {
23  auto num = m_tf->GetNumerator();
24  auto den = m_tf->GetDenominator();
25 
26  wxString numStr = "";
27  for(auto it = num.begin(), itEnd = num.end(); it != itEnd; ++it) {
28  double value = *it;
29  if(it == num.begin())
30  numStr = m_tf->StringFromDouble(value, 0);
31  else
32  numStr += " " + m_tf->StringFromDouble(value, 0);
33  }
34  m_textCtrlNumerator->SetValue(numStr);
35 
36  wxString denStr = "";
37  for(auto it = den.begin(), itEnd = den.end(); it != itEnd; ++it) {
38  double value = *it;
39  if(it == den.begin())
40  denStr = m_tf->StringFromDouble(value, 0);
41  else
42  denStr += " " + m_tf->StringFromDouble(value, 0);
43  }
44  m_textCtrlDenominator->SetValue(denStr);
45 }
46 
47 bool TransferFunctionForm::ValidateData()
48 {
49  wxString num = m_textCtrlNumerator->GetValue();
50  std::vector<double> numerator;
51  while(num != "") {
52  wxString rest;
53  wxString strValue = num.BeforeFirst(' ', &rest);
54  num = rest;
55  double value = 0;
56  if(!m_tf->DoubleFromString(this, strValue, value,
57  _("Value entered incorrectly in the field \"Numerator parameters\".")))
58  return false;
59  numerator.push_back(value);
60  }
61 
62  wxString den = m_textCtrlDenominator->GetValue();
63  std::vector<double> denominator;
64  while(den != "") {
65  wxString rest;
66  wxString strValue = den.BeforeFirst(' ', &rest);
67  den = rest;
68  double value = 0;
69  if(!m_tf->DoubleFromString(this, strValue, value,
70  _("Value entered incorrectly in the field \"Denominator parameters\".")))
71  return false;
72  denominator.push_back(value);
73  }
74  m_tf->SetNumerator(numerator);
75  m_tf->SetDenominator(denominator);
76  m_tf->UpdateTFText();
77  return true;
78 }
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "TransferFunctionForm.h"
19 #include "TransferFunction.h"
20 
21 TransferFunctionForm::TransferFunctionForm(wxWindow* parent, TransferFunction* transferFunction)
22  : TransferFunctionFormBase(parent)
23 {
24  SetSize(GetBestSize());
25 
26  m_parent = parent;
27  m_tf = transferFunction;
28  LoadTFData();
29 }
30 
31 TransferFunctionForm::~TransferFunctionForm() {}
32 void TransferFunctionForm::OnCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
33 void TransferFunctionForm::OnOKClick(wxCommandEvent& event)
34 {
35  if(ValidateData()) EndModal(wxID_OK);
36 }
37 
38 void TransferFunctionForm::LoadTFData()
39 {
40  auto num = m_tf->GetNumerator();
41  auto den = m_tf->GetDenominator();
42 
43  wxString numStr = "";
44  for(auto it = num.begin(), itEnd = num.end(); it != itEnd; ++it) {
45  double value = *it;
46  if(it == num.begin())
47  numStr = m_tf->StringFromDouble(value, 0);
48  else
49  numStr += " " + m_tf->StringFromDouble(value, 0);
50  }
51  m_textCtrlNumerator->SetValue(numStr);
52 
53  wxString denStr = "";
54  for(auto it = den.begin(), itEnd = den.end(); it != itEnd; ++it) {
55  double value = *it;
56  if(it == den.begin())
57  denStr = m_tf->StringFromDouble(value, 0);
58  else
59  denStr += " " + m_tf->StringFromDouble(value, 0);
60  }
61  m_textCtrlDenominator->SetValue(denStr);
62 }
63 
64 bool TransferFunctionForm::ValidateData()
65 {
66  wxString num = m_textCtrlNumerator->GetValue();
67  std::vector<double> numerator;
68  while(num != "") {
69  wxString rest;
70  wxString strValue = num.BeforeFirst(' ', &rest);
71  num = rest;
72  double value = 0;
73  if(!m_tf->DoubleFromString(this, strValue, value,
74  _("Value entered incorrectly in the field \"Numerator parameters\".")))
75  return false;
76  numerator.push_back(value);
77  }
78 
79  wxString den = m_textCtrlDenominator->GetValue();
80  std::vector<double> denominator;
81  while(den != "") {
82  wxString rest;
83  wxString strValue = den.BeforeFirst(' ', &rest);
84  den = rest;
85  double value = 0;
86  if(!m_tf->DoubleFromString(this, strValue, value,
87  _("Value entered incorrectly in the field \"Denominator parameters\".")))
88  return false;
89  denominator.push_back(value);
90  }
91  m_tf->SetNumerator(numerator);
92  m_tf->SetDenominator(denominator);
93  m_tf->UpdateTFText();
94  return true;
95 }
+ +
diff --git a/docs/doxygen/html/_transfer_function_form_8h.html b/docs/doxygen/html/_transfer_function_form_8h.html new file mode 100644 index 0000000..759ef39 --- /dev/null +++ b/docs/doxygen/html/_transfer_function_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/TransferFunctionForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
TransferFunctionForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  TransferFunctionForm
 Form to edit the transfer function control data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_transfer_function_form_8h_source.html b/docs/doxygen/html/_transfer_function_form_8h_source.html index d33d245..20ec72f 100644 --- a/docs/doxygen/html/_transfer_function_form_8h_source.html +++ b/docs/doxygen/html/_transfer_function_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,15 +88,15 @@ $(document).ready(function(){initNavTree('_transfer_function_form_8h_source.html
TransferFunctionForm.h
-
1 #ifndef TRANSFERFUNCTIONFORM_H
2 #define TRANSFERFUNCTIONFORM_H
3 
4 #include "ElementForm.h"
5 
6 class TransferFunction;
7 
9 {
10 public:
11  TransferFunctionForm(wxWindow* parent, TransferFunction* transferFunction);
12  virtual ~TransferFunctionForm();
13  bool ValidateData();
14 
15 protected:
16  virtual void OnCancelClick(wxCommandEvent& event);
17  virtual void OnOKClick(wxCommandEvent& event);
18  void LoadTFData();
19 
20  wxWindow* m_parent = NULL;
21  TransferFunction* m_tf = NULL;
22 };
23 #endif // TRANSFERFUNCTIONFORM_H
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef TRANSFERFUNCTIONFORM_H
19 #define TRANSFERFUNCTIONFORM_H
20 
21 #include "ElementForm.h"
22 
23 class TransferFunction;
24 
33 {
34  public:
35  TransferFunctionForm(wxWindow* parent, TransferFunction* transferFunction);
36  virtual ~TransferFunctionForm();
37  bool ValidateData();
38 
39  protected:
40  virtual void OnCancelClick(wxCommandEvent& event);
41  virtual void OnOKClick(wxCommandEvent& event);
42  void LoadTFData();
43 
44  wxWindow* m_parent = NULL;
45  TransferFunction* m_tf = NULL;
46 };
47 #endif // TRANSFERFUNCTIONFORM_H
Form to edit the transfer function control data.
- +
-
1 #include "TransformerForm.h"
2 #include "Transformer.h"
3 
4 Transformer::Transformer() : Branch()
5 {
6  for(int i = 0; i < 2; i++) {
7  for(int j = 0; j < 3; j++) {
8  m_electricalData.faultCurrent[i][j] = std::complex<double>(0.0, 0.0);
9  }
10  }
11 }
12 Transformer::Transformer(wxString name) : Branch()
13 {
14  for(int i = 0; i < 2; i++) {
15  for(int j = 0; j < 3; j++) {
16  m_electricalData.faultCurrent[i][j] = std::complex<double>(0.0, 0.0);
17  }
18  }
19  m_electricalData.name = name;
20 }
21 Transformer::~Transformer() {}
22 bool Transformer::AddParent(Element* parent, wxPoint2DDouble position)
23 {
24  if(parent) {
25  // First bus.
26  if(m_parentList.size() == 0) {
27  m_position = position;
28  m_parentList.push_back(parent);
29  parent->AddChild(this);
30  wxPoint2DDouble parentPt =
31  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
32  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
33  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
34  m_pointList.push_back(parentPt); // First point
35  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
36 
37  wxRect2DDouble genRect(0, 0, 0, 0);
38  m_switchRect.push_back(genRect);
39 
40  return false;
41  }
42  // Second bus.
43  else if(parent != m_parentList[0]) {
44  m_parentList.push_back(parent);
45  parent->AddChild(this);
46  wxPoint2DDouble parentPt =
47  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
48  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
49  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
50 
51  // Get the average between the two bus points.
52  m_position =
53  wxPoint2DDouble((m_pointList[0].m_x + parentPt.m_x) / 2.0, (m_pointList[0].m_y + parentPt.m_y) / 2.0);
54  // Set the transformer rectangle.
55  m_width = 70.0;
56  m_height = 40.0;
57  SetPosition(m_position); // This method calculates the rectangle propely.
58  // Set the "side" points.
59  m_pointList.push_back(
60  wxPoint2DDouble(m_rect.GetPosition() + wxPoint2DDouble(-10 - m_borderSize, m_height / 2.0)));
61  m_pointList.push_back(
62  wxPoint2DDouble(m_rect.GetPosition() + wxPoint2DDouble(m_width + 10 + m_borderSize, m_height / 2.0)));
63 
64  // Set first switch point.
65  wxPoint2DDouble secondPoint = parentPt;
66  if(m_pointList.size() > 2) {
67  secondPoint = m_pointList[2];
68  }
69  m_pointList[1] = GetSwitchPoint(m_parentList[0], m_pointList[0], secondPoint);
70 
71  // Set the second switch point.
72  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_pointList[m_pointList.size() - 1]));
73 
74  m_pointList.push_back(parentPt); // Last point.
75  m_inserted = true;
76 
77  wxRect2DDouble genRect(0, 0, 0, 0);
78  m_switchRect.push_back(genRect);
79  UpdateSwitches();
80  UpdatePowerFlowArrowsPosition();
81 
82  return true;
83  }
84  }
85  return false;
86 }
87 
88 bool Transformer::Contains(wxPoint2DDouble position) const
89 {
90  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
91  return m_rect.Contains(ptR);
92 }
93 
94 void Transformer::Draw(wxPoint2DDouble translation, double scale) const
95 {
96  OpenGLColour elementColour;
97  if(m_online) {
98  if(m_dynEvent)
99  elementColour = m_dynamicEventColour;
100  else
101  elementColour = m_onlineElementColour;
102  } else
103  elementColour = m_offlineElementColour;
104 
105  if(m_inserted) {
106  // Draw selection (layer 1).
107  if(m_selected) {
108  // Push the current matrix on stack.
109  glLineWidth(1.5 + m_borderSize * 2.0);
110  glColor4dv(m_selectionColour.GetRGBA());
111  DrawLine(m_pointList);
112  glPushMatrix();
113  // Rotate the matrix around the object position.
114  glTranslated(m_position.m_x, m_position.m_y, 0.0);
115  glRotated(m_angle, 0.0, 0.0, 1.0);
116  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
117 
118  DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(20.0, 20.0), 20 + (m_borderSize + 1.5) / scale, 20,
119  GL_POLYGON);
120  DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(50.0, 20.0), 20 + (m_borderSize + 1.5) / scale, 20,
121  GL_POLYGON);
122 
123  glPopMatrix();
124 
125  // Draw nodes selection.
126  if(m_pointList.size() > 0) {
127  DrawCircle(m_pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
128  if(m_inserted) {
129  DrawCircle(m_pointList[m_pointList.size() - 1], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
130  }
131  }
132  }
133 
134  // Draw transformer (layer 2).
135  // Transformer line
136  glLineWidth(1.5);
137  glColor4dv(elementColour.GetRGBA());
138  DrawLine(m_pointList);
139 
140  // Draw nodes.
141  if(m_pointList.size() > 0) {
142  glColor4dv(elementColour.GetRGBA());
143  DrawCircle(m_pointList[0], 5.0, 10, GL_POLYGON);
144  if(m_inserted) {
145  DrawCircle(m_pointList[m_pointList.size() - 1], 5.0, 10, GL_POLYGON);
146  }
147  }
148 
149  DrawSwitches();
150  DrawPowerFlowPts();
151 
152  // Push the current matrix on stack.
153  glPushMatrix();
154  // Rotate the matrix around the object position.
155  glTranslated(m_position.m_x, m_position.m_y, 0.0);
156  glRotated(m_angle, 0.0, 0.0, 1.0);
157  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
158 
159  glColor4d(1.0, 1.0, 1.0, 1.0);
160  DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(20.0, 20.0), 20, 20, GL_POLYGON);
161  DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(50.0, 20.0), 20, 20, GL_POLYGON);
162 
163  glColor4dv(elementColour.GetRGBA());
164  DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(20.0, 20.0), 20, 20);
165  DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(50.0, 20.0), 20, 20);
166 
167  DrawPoint(m_rect.GetPosition(), 8.0 * scale);
168 
169  glPopMatrix();
170  }
171 }
172 
173 bool Transformer::Intersects(wxRect2DDouble rect) const
174 {
175  if(m_angle == 0.0 || m_angle == 180.0) return m_rect.Intersects(rect);
176  return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0);
177 }
178 
179 void Transformer::Rotate(bool clockwise)
180 {
181  double rotAngle = m_rotationAngle;
182  if(!clockwise) rotAngle = -m_rotationAngle;
183 
184  m_angle += rotAngle;
185  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
186 
187  // Rotate all the points, except the switches and buses points.
188  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
189  m_pointList[i] = RotateAtPosition(m_pointList[i], rotAngle);
190  }
191  UpdateSwitchesPosition();
192  UpdatePowerFlowArrowsPosition();
193 }
194 
195 void Transformer::Move(wxPoint2DDouble position)
196 {
197  SetPosition(m_movePos + position - m_moveStartPt);
198 
199  // Move all the points, except the switches and buses points.
200  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
201  m_pointList[i] = m_movePts[i] + position - m_moveStartPt;
202  }
203 
204  if(!m_parentList[0]) {
205  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
206  }
207  if(!m_parentList[1]) {
208  m_pointList[m_pointList.size() - 1] = m_movePts[m_pointList.size() - 1] + position - m_moveStartPt;
209  }
210 
211  UpdateSwitchesPosition();
212  UpdatePowerFlowArrowsPosition();
213 }
214 
215 void Transformer::MoveNode(Element* parent, wxPoint2DDouble position)
216 {
217  if(parent) {
218  // First bus.
219  if(parent == m_parentList[0]) {
220  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
221  }
222  // Second bus.
223  else if(parent == m_parentList[1]) {
224  m_pointList[m_pointList.size() - 1] = m_movePts[m_pointList.size() - 1] + position - m_moveStartPt;
225  }
226  } else {
227  if(m_activeNodeID == 1) {
228  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
229  if(m_parentList[0]) {
230  m_parentList[0]->RemoveChild(this);
231  m_parentList[0] = NULL;
232  m_online = false;
233  }
234  } else if(m_activeNodeID == 2) {
235  m_pointList[m_pointList.size() - 1] = m_movePts[m_pointList.size() - 1] + position - m_moveStartPt;
236  if(m_parentList[1]) {
237  m_parentList[1]->RemoveChild(this);
238  m_parentList[1] = NULL;
239  m_online = false;
240  }
241  }
242  }
243 
244  // Recalculate switches positions
245  UpdateSwitchesPosition();
246  UpdatePowerFlowArrowsPosition();
247 }
248 
249 void Transformer::StartMove(wxPoint2DDouble position)
250 {
251  m_moveStartPt = position;
252  m_movePts = m_pointList;
253  m_movePos = m_position;
254 }
255 
256 bool Transformer::GetContextMenu(wxMenu& menu)
257 {
258  menu.Append(ID_EDIT_ELEMENT, _("Edit tranformer"));
259  GeneralMenuItens(menu);
260  return true;
261 }
262 
263 bool Transformer::ShowForm(wxWindow* parent, Element* element)
264 {
265  TransformerForm* transfForm = new TransformerForm(parent, this);
266  if(transfForm->ShowModal() == wxID_OK) {
267  transfForm->Destroy();
268  return true;
269  }
270  transfForm->Destroy();
271  return false;
272 }
273 
274 void Transformer::SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit)
275 {
276  if(nominalVoltage.size() == 1) {
277  m_electricalData.primaryNominalVoltage = nominalVoltage[0];
278  m_electricalData.primaryNominalVoltageUnit = nominalVoltageUnit[0];
279  } else if(nominalVoltage.size() == 2) {
280  m_electricalData.primaryNominalVoltage = nominalVoltage[0];
281  m_electricalData.primaryNominalVoltageUnit = nominalVoltageUnit[0];
282  m_electricalData.secondaryNominalVoltage = nominalVoltage[1];
283  m_electricalData.secondaryNominalVoltageUnit = nominalVoltageUnit[1];
284  }
285 }
286 
287 void Transformer::UpdatePowerFlowArrowsPosition()
288 {
289  std::vector<wxPoint2DDouble> edges;
290  switch(m_pfDirection) {
291  case PF_NONE: {
292  m_powerFlowArrow.clear();
293  } break;
294  case PF_BUS1_TO_BUS2: {
295  for(int i = 1; i < (int)m_pointList.size() - 1; i++) {
296  edges.push_back(m_pointList[i]);
297  }
298  } break;
299  case PF_BUS2_TO_BUS1: {
300  for(int i = (int)m_pointList.size() - 2; i > 0; i--) {
301  edges.push_back(m_pointList[i]);
302  }
303  } break;
304  default:
305  break;
306  }
307  CalculatePowerFlowPts(edges);
308 }
309 
310 void Transformer::RotateNode(Element* parent, bool clockwise)
311 {
312  double rotAngle = m_rotationAngle;
313  if(!clockwise) rotAngle = -m_rotationAngle;
314 
315  if(parent == m_parentList[0]) {
316  m_pointList[0] = parent->RotateAtPosition(m_pointList[0], rotAngle);
317  } else if(parent == m_parentList[1]) {
318  m_pointList[m_pointList.size() - 1] = parent->RotateAtPosition(m_pointList[m_pointList.size() - 1], rotAngle);
319  }
320  UpdateSwitchesPosition();
321  UpdatePowerFlowArrowsPosition();
322 }
323 
325 {
326  if(m_activeNodeID == 1 && parent == m_parentList[0]) return false;
327  if(m_activeNodeID == 2 && parent == m_parentList[1]) return false;
328 
329  if(parent && m_activeNodeID != 0) {
330  wxRect2DDouble nodeRect(0, 0, 0, 0);
331  if(m_activeNodeID == 1) {
332  nodeRect = wxRect2DDouble(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
333  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
334  }
335  if(m_activeNodeID == 2) {
336  nodeRect = wxRect2DDouble(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize,
337  m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize,
338  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
339  }
340 
341  if(parent->Intersects(nodeRect)) {
342  if(m_activeNodeID == 1) {
343  // Check if the user is trying to connect the same bus.
344  if(m_parentList[1] == parent) {
345  m_activeNodeID = 0;
346  return false;
347  }
348 
349  m_parentList[0] = parent;
350 
351  // Centralize the node on bus.
352  wxPoint2DDouble parentPt = parent->RotateAtPosition(
353  m_pointList[0], -parent->GetAngle()); // Rotate click to horizontal position.
354  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
355  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
356  m_pointList[0] = parentPt;
357 
358  UpdateSwitchesPosition();
359  UpdatePowerFlowArrowsPosition();
360  return true;
361  }
362  if(m_activeNodeID == 2) {
363  if(m_parentList[0] == parent) {
364  m_activeNodeID = 0;
365  return false;
366  }
367 
368  m_parentList[1] = parent;
369 
370  wxPoint2DDouble parentPt =
371  parent->RotateAtPosition(m_pointList[m_pointList.size() - 1], -parent->GetAngle());
372  parentPt.m_y = parent->GetPosition().m_y;
373  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
374  m_pointList[m_pointList.size() - 1] = parentPt;
375 
376  UpdateSwitchesPosition();
377  UpdatePowerFlowArrowsPosition();
378  return true;
379  }
380  } else {
381  if(m_activeNodeID == 1) m_parentList[0] = NULL;
382  if(m_activeNodeID == 2) m_parentList[1] = NULL;
383  }
384  }
385  return false;
386 }
387 
389 {
390  m_pfDirection = pfDirection;
391  UpdatePowerFlowArrowsPosition();
392 }
393 
395 {
396  Transformer* copy = new Transformer();
397  *copy = *this;
398  return copy;
399 }
400 
401 wxString Transformer::GetTipText() const
402 {
403  wxString tipText = m_electricalData.name;
404  wxString primVoltage = StringFromDouble(m_electricalData.primaryNominalVoltage);
405  switch(m_electricalData.primaryNominalVoltageUnit) {
406  case UNIT_V: {
407  primVoltage += _(" V");
408  } break;
409  case UNIT_kV: {
410  primVoltage += _(" kV");
411  } break;
412  default:
413  break;
414  }
415  wxString secVoltage = StringFromDouble(m_electricalData.secondaryNominalVoltage);
416  switch(m_electricalData.secondaryNominalVoltageUnit) {
417  case UNIT_V: {
418  secVoltage += _(" V");
419  } break;
420  case UNIT_kV: {
421  secVoltage += _(" kV");
422  } break;
423  default:
424  break;
425  }
426 
427  tipText += "\n" + primVoltage + " / " + secVoltage;
428 
429  if(m_online) {
430  tipText += "\n";
431  int busNumber[2];
432  busNumber[0] = static_cast<Bus*>(m_parentList[0])->GetElectricalData().number + 1;
433  busNumber[1] = static_cast<Bus*>(m_parentList[1])->GetElectricalData().number + 1;
434 
435  tipText += _("\nP") + wxString::Format("(%d-%d) = ", busNumber[0], busNumber[1]) +
436  wxString::FromDouble(m_electricalData.powerFlow[0].real(), 5) + _(" p.u.");
437  tipText += _("\nQ") + wxString::Format("(%d-%d) = ", busNumber[0], busNumber[1]) +
438  wxString::FromDouble(m_electricalData.powerFlow[0].imag(), 5) + _(" p.u.");
439  tipText += _("\nP") + wxString::Format("(%d-%d) = ", busNumber[1], busNumber[0]) +
440  wxString::FromDouble(m_electricalData.powerFlow[1].real(), 5) + _(" p.u.");
441  tipText += _("\nQ") + wxString::Format("(%d-%d) = ", busNumber[1], busNumber[0]) +
442  wxString::FromDouble(m_electricalData.powerFlow[1].imag(), 5) + _(" p.u.");
443  }
444 
445  return tipText;
446 }
447 
448 TransformerElectricalData Transformer::GetPUElectricalData(double systemBasePower)
449 {
450  TransformerElectricalData data = m_electricalData;
451  double transformerBasePower = GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
452  double baseVoltage = 0.0;
453  if(data.baseVoltage == 0) {
454  baseVoltage = GetValueFromUnit(data.primaryNominalVoltage, data.primaryNominalVoltageUnit);
455  } else {
456  baseVoltage = GetValueFromUnit(data.secondaryNominalVoltage, data.secondaryNominalVoltageUnit);
457  }
458  double systemBaseImpedance = (baseVoltage * baseVoltage) / systemBasePower;
459  double transformerBaseImpedance = (baseVoltage * baseVoltage) / transformerBasePower;
460 
461  // Resistance
462  double r = data.resistance;
463  if(data.resistanceUnit == UNIT_PU) {
464  if(data.useTransformerPower) data.resistance = (r * transformerBaseImpedance) / systemBaseImpedance;
465  } else {
466  data.resistance = r / systemBaseImpedance;
467  }
468  data.resistanceUnit = UNIT_PU;
469 
470  // Indutive reactance
471  double x = data.indReactance;
472  if(data.indReactanceUnit == UNIT_PU) {
473  if(data.useTransformerPower) data.indReactance = (x * transformerBaseImpedance) / systemBaseImpedance;
474  } else {
475  data.indReactance = x / systemBaseImpedance;
476  }
477  data.indReactanceUnit = UNIT_PU;
478 
479  // Fault
480 
481  // Zero seq. resistance
482  double r0 = data.zeroResistance;
483  if(data.useTransformerPower) data.zeroResistance = (r0 * transformerBaseImpedance) / systemBaseImpedance;
484 
485  // Zero seq. ind. reactance
486  double x0 = data.zeroIndReactance;
487  if(data.useTransformerPower) data.zeroIndReactance = (x0 * transformerBaseImpedance) / systemBaseImpedance;
488 
489  // Primary ground resistance
490  double rgp = data.primaryGrndResistance;
491  if(data.useTransformerPower) data.primaryGrndResistance = (rgp * transformerBaseImpedance) / systemBaseImpedance;
492 
493  // Primary ground ind reactance
494  double xgp = data.primaryGrndReactance;
495  if(data.useTransformerPower) data.primaryGrndReactance = (xgp * transformerBaseImpedance) / systemBaseImpedance;
496 
497  // Secondary ground resistance
498  double rgs = data.secondaryGrndResistance;
499  if(data.useTransformerPower) data.secondaryGrndResistance = (rgs * transformerBaseImpedance) / systemBaseImpedance;
500 
501  // Secondary ground ind reactance
502  double xgs = data.secondaryGrndReactance;
503  if(data.useTransformerPower) data.secondaryGrndReactance = (xgs * transformerBaseImpedance) / systemBaseImpedance;
504 
505  if(!m_online) {
506  data.powerFlow[0] = std::complex<double>(0,0);
507  data.powerFlow[1] = std::complex<double>(0,0);
508  data.faultCurrent[0][0] = std::complex<double>(0,0);
509  data.faultCurrent[0][1] = std::complex<double>(0,0);
510  data.faultCurrent[0][2] = std::complex<double>(0,0);
511  data.faultCurrent[1][0] = std::complex<double>(0,0);
512  data.faultCurrent[1][1] = std::complex<double>(0,0);
513  data.faultCurrent[1][2] = std::complex<double>(0,0);
514  }
515 
516  return data;
517 }
double GetAngle() const
Get the element angle.
Definition: Element.h:201
-
virtual Element * GetCopy()
Get a the element copy.
- - - -
virtual void Rotate(bool clockwise=true)
Rotate the element.
-
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
-
virtual wxString GetTipText() const
Get the tip text.
- -
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:91
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "TransformerForm.h"
19 #include "Transformer.h"
20 
21 Transformer::Transformer() : Branch()
22 {
23  for(int i = 0; i < 2; i++) {
24  for(int j = 0; j < 3; j++) {
25  m_electricalData.faultCurrent[i][j] = std::complex<double>(0.0, 0.0);
26  }
27  }
28 }
29 Transformer::Transformer(wxString name) : Branch()
30 {
31  for(int i = 0; i < 2; i++) {
32  for(int j = 0; j < 3; j++) {
33  m_electricalData.faultCurrent[i][j] = std::complex<double>(0.0, 0.0);
34  }
35  }
36  m_electricalData.name = name;
37 }
38 Transformer::~Transformer() {}
39 bool Transformer::AddParent(Element* parent, wxPoint2DDouble position)
40 {
41  if(parent) {
42  // First bus.
43  if(m_parentList.size() == 0) {
44  m_position = position;
45  m_parentList.push_back(parent);
46  parent->AddChild(this);
47  wxPoint2DDouble parentPt =
48  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
49  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
50  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
51  m_pointList.push_back(parentPt); // First point
52  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
53 
54  wxRect2DDouble genRect(0, 0, 0, 0);
55  m_switchRect.push_back(genRect);
56 
57  return false;
58  }
59  // Second bus.
60  else if(parent != m_parentList[0]) {
61  m_parentList.push_back(parent);
62  parent->AddChild(this);
63  wxPoint2DDouble parentPt =
64  parent->RotateAtPosition(position, -parent->GetAngle()); // Rotate click to horizontal position.
65  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
66  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
67 
68  // Get the average between the two bus points.
69  m_position =
70  wxPoint2DDouble((m_pointList[0].m_x + parentPt.m_x) / 2.0, (m_pointList[0].m_y + parentPt.m_y) / 2.0);
71  // Set the transformer rectangle.
72  m_width = 70.0;
73  m_height = 40.0;
74  SetPosition(m_position); // This method calculates the rectangle propely.
75  // Set the "side" points.
76  m_pointList.push_back(
77  wxPoint2DDouble(m_rect.GetPosition() + wxPoint2DDouble(-10 - m_borderSize, m_height / 2.0)));
78  m_pointList.push_back(
79  wxPoint2DDouble(m_rect.GetPosition() + wxPoint2DDouble(m_width + 10 + m_borderSize, m_height / 2.0)));
80 
81  // Set first switch point.
82  wxPoint2DDouble secondPoint = parentPt;
83  if(m_pointList.size() > 2) {
84  secondPoint = m_pointList[2];
85  }
86  m_pointList[1] = GetSwitchPoint(m_parentList[0], m_pointList[0], secondPoint);
87 
88  // Set the second switch point.
89  m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_pointList[m_pointList.size() - 1]));
90 
91  m_pointList.push_back(parentPt); // Last point.
92  m_inserted = true;
93 
94  wxRect2DDouble genRect(0, 0, 0, 0);
95  m_switchRect.push_back(genRect);
96  UpdateSwitches();
97  UpdatePowerFlowArrowsPosition();
98 
99  return true;
100  }
101  }
102  return false;
103 }
104 
105 bool Transformer::Contains(wxPoint2DDouble position) const
106 {
107  wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle);
108  return m_rect.Contains(ptR);
109 }
110 
111 void Transformer::Draw(wxPoint2DDouble translation, double scale) const
112 {
113  OpenGLColour elementColour;
114  if(m_online) {
115  if(m_dynEvent)
116  elementColour = m_dynamicEventColour;
117  else
118  elementColour = m_onlineElementColour;
119  } else
120  elementColour = m_offlineElementColour;
121 
122  if(m_inserted) {
123  // Draw selection (layer 1).
124  if(m_selected) {
125  // Push the current matrix on stack.
126  glLineWidth(1.5 + m_borderSize * 2.0);
127  glColor4dv(m_selectionColour.GetRGBA());
128  DrawLine(m_pointList);
129  glPushMatrix();
130  // Rotate the matrix around the object position.
131  glTranslated(m_position.m_x, m_position.m_y, 0.0);
132  glRotated(m_angle, 0.0, 0.0, 1.0);
133  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
134 
135  DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(20.0, 20.0), 20 + (m_borderSize + 1.5) / scale, 20,
136  GL_POLYGON);
137  DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(50.0, 20.0), 20 + (m_borderSize + 1.5) / scale, 20,
138  GL_POLYGON);
139 
140  glPopMatrix();
141 
142  // Draw nodes selection.
143  if(m_pointList.size() > 0) {
144  DrawCircle(m_pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
145  if(m_inserted) {
146  DrawCircle(m_pointList[m_pointList.size() - 1], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
147  }
148  }
149  }
150 
151  // Draw transformer (layer 2).
152  // Transformer line
153  glLineWidth(1.5);
154  glColor4dv(elementColour.GetRGBA());
155  DrawLine(m_pointList);
156 
157  // Draw nodes.
158  if(m_pointList.size() > 0) {
159  glColor4dv(elementColour.GetRGBA());
160  DrawCircle(m_pointList[0], 5.0, 10, GL_POLYGON);
161  if(m_inserted) {
162  DrawCircle(m_pointList[m_pointList.size() - 1], 5.0, 10, GL_POLYGON);
163  }
164  }
165 
166  DrawSwitches();
167  DrawPowerFlowPts();
168 
169  // Push the current matrix on stack.
170  glPushMatrix();
171  // Rotate the matrix around the object position.
172  glTranslated(m_position.m_x, m_position.m_y, 0.0);
173  glRotated(m_angle, 0.0, 0.0, 1.0);
174  glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
175 
176  glColor4d(1.0, 1.0, 1.0, 1.0);
177  DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(20.0, 20.0), 20, 20, GL_POLYGON);
178  DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(50.0, 20.0), 20, 20, GL_POLYGON);
179 
180  glColor4dv(elementColour.GetRGBA());
181  DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(20.0, 20.0), 20, 20);
182  DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(50.0, 20.0), 20, 20);
183 
184  DrawPoint(m_rect.GetPosition(), 8.0 * scale);
185 
186  glPopMatrix();
187  }
188 }
189 
190 bool Transformer::Intersects(wxRect2DDouble rect) const
191 {
192  if(m_angle == 0.0 || m_angle == 180.0) return m_rect.Intersects(rect);
193  return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0);
194 }
195 
196 void Transformer::Rotate(bool clockwise)
197 {
198  double rotAngle = m_rotationAngle;
199  if(!clockwise) rotAngle = -m_rotationAngle;
200 
201  m_angle += rotAngle;
202  if(m_angle >= 360 || m_angle <= -360) m_angle = 0.0;
203 
204  // Rotate all the points, except the switches and buses points.
205  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
206  m_pointList[i] = RotateAtPosition(m_pointList[i], rotAngle);
207  }
208  UpdateSwitchesPosition();
209  UpdatePowerFlowArrowsPosition();
210 }
211 
212 void Transformer::Move(wxPoint2DDouble position)
213 {
214  SetPosition(m_movePos + position - m_moveStartPt);
215 
216  // Move all the points, except the switches and buses points.
217  for(int i = 2; i < (int)m_pointList.size() - 2; i++) {
218  m_pointList[i] = m_movePts[i] + position - m_moveStartPt;
219  }
220 
221  if(!m_parentList[0]) {
222  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
223  }
224  if(!m_parentList[1]) {
225  m_pointList[m_pointList.size() - 1] = m_movePts[m_pointList.size() - 1] + position - m_moveStartPt;
226  }
227 
228  UpdateSwitchesPosition();
229  UpdatePowerFlowArrowsPosition();
230 }
231 
232 void Transformer::MoveNode(Element* parent, wxPoint2DDouble position)
233 {
234  if(parent) {
235  // First bus.
236  if(parent == m_parentList[0]) {
237  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
238  }
239  // Second bus.
240  else if(parent == m_parentList[1]) {
241  m_pointList[m_pointList.size() - 1] = m_movePts[m_pointList.size() - 1] + position - m_moveStartPt;
242  }
243  } else {
244  if(m_activeNodeID == 1) {
245  m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
246  if(m_parentList[0]) {
247  m_parentList[0]->RemoveChild(this);
248  m_parentList[0] = NULL;
249  m_online = false;
250  }
251  } else if(m_activeNodeID == 2) {
252  m_pointList[m_pointList.size() - 1] = m_movePts[m_pointList.size() - 1] + position - m_moveStartPt;
253  if(m_parentList[1]) {
254  m_parentList[1]->RemoveChild(this);
255  m_parentList[1] = NULL;
256  m_online = false;
257  }
258  }
259  }
260 
261  // Recalculate switches positions
262  UpdateSwitchesPosition();
263  UpdatePowerFlowArrowsPosition();
264 }
265 
266 void Transformer::StartMove(wxPoint2DDouble position)
267 {
268  m_moveStartPt = position;
269  m_movePts = m_pointList;
270  m_movePos = m_position;
271 }
272 
273 bool Transformer::GetContextMenu(wxMenu& menu)
274 {
275  menu.Append(ID_EDIT_ELEMENT, _("Edit tranformer"));
276  GeneralMenuItens(menu);
277  return true;
278 }
279 
280 bool Transformer::ShowForm(wxWindow* parent, Element* element)
281 {
282  TransformerForm* transfForm = new TransformerForm(parent, this);
283  if(transfForm->ShowModal() == wxID_OK) {
284  transfForm->Destroy();
285  return true;
286  }
287  transfForm->Destroy();
288  return false;
289 }
290 
291 void Transformer::SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit)
292 {
293  if(nominalVoltage.size() == 1) {
294  m_electricalData.primaryNominalVoltage = nominalVoltage[0];
295  m_electricalData.primaryNominalVoltageUnit = nominalVoltageUnit[0];
296  } else if(nominalVoltage.size() == 2) {
297  m_electricalData.primaryNominalVoltage = nominalVoltage[0];
298  m_electricalData.primaryNominalVoltageUnit = nominalVoltageUnit[0];
299  m_electricalData.secondaryNominalVoltage = nominalVoltage[1];
300  m_electricalData.secondaryNominalVoltageUnit = nominalVoltageUnit[1];
301  }
302 }
303 
304 void Transformer::UpdatePowerFlowArrowsPosition()
305 {
306  std::vector<wxPoint2DDouble> edges;
307  switch(m_pfDirection) {
308  case PF_NONE: {
309  m_powerFlowArrow.clear();
310  } break;
311  case PF_BUS1_TO_BUS2: {
312  for(int i = 1; i < (int)m_pointList.size() - 1; i++) {
313  edges.push_back(m_pointList[i]);
314  }
315  } break;
316  case PF_BUS2_TO_BUS1: {
317  for(int i = (int)m_pointList.size() - 2; i > 0; i--) {
318  edges.push_back(m_pointList[i]);
319  }
320  } break;
321  default:
322  break;
323  }
324  CalculatePowerFlowPts(edges);
325 }
326 
327 void Transformer::RotateNode(Element* parent, bool clockwise)
328 {
329  double rotAngle = m_rotationAngle;
330  if(!clockwise) rotAngle = -m_rotationAngle;
331 
332  if(parent == m_parentList[0]) {
333  m_pointList[0] = parent->RotateAtPosition(m_pointList[0], rotAngle);
334  } else if(parent == m_parentList[1]) {
335  m_pointList[m_pointList.size() - 1] = parent->RotateAtPosition(m_pointList[m_pointList.size() - 1], rotAngle);
336  }
337  UpdateSwitchesPosition();
338  UpdatePowerFlowArrowsPosition();
339 }
340 
342 {
343  if(m_activeNodeID == 1 && parent == m_parentList[0]) return false;
344  if(m_activeNodeID == 2 && parent == m_parentList[1]) return false;
345 
346  if(parent && m_activeNodeID != 0) {
347  wxRect2DDouble nodeRect(0, 0, 0, 0);
348  if(m_activeNodeID == 1) {
349  nodeRect = wxRect2DDouble(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize,
350  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
351  }
352  if(m_activeNodeID == 2) {
353  nodeRect = wxRect2DDouble(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize,
354  m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize,
355  10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize);
356  }
357 
358  if(parent->Intersects(nodeRect)) {
359  if(m_activeNodeID == 1) {
360  // Check if the user is trying to connect the same bus.
361  if(m_parentList[1] == parent) {
362  m_activeNodeID = 0;
363  return false;
364  }
365 
366  m_parentList[0] = parent;
367 
368  // Centralize the node on bus.
369  wxPoint2DDouble parentPt = parent->RotateAtPosition(
370  m_pointList[0], -parent->GetAngle()); // Rotate click to horizontal position.
371  parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus.
372  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
373  m_pointList[0] = parentPt;
374 
375  UpdateSwitchesPosition();
376  UpdatePowerFlowArrowsPosition();
377  return true;
378  }
379  if(m_activeNodeID == 2) {
380  if(m_parentList[0] == parent) {
381  m_activeNodeID = 0;
382  return false;
383  }
384 
385  m_parentList[1] = parent;
386 
387  wxPoint2DDouble parentPt =
388  parent->RotateAtPosition(m_pointList[m_pointList.size() - 1], -parent->GetAngle());
389  parentPt.m_y = parent->GetPosition().m_y;
390  parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle());
391  m_pointList[m_pointList.size() - 1] = parentPt;
392 
393  UpdateSwitchesPosition();
394  UpdatePowerFlowArrowsPosition();
395  return true;
396  }
397  } else {
398  if(m_activeNodeID == 1) m_parentList[0] = NULL;
399  if(m_activeNodeID == 2) m_parentList[1] = NULL;
400  }
401  }
402  return false;
403 }
404 
406 {
407  m_pfDirection = pfDirection;
408  UpdatePowerFlowArrowsPosition();
409 }
410 
412 {
413  Transformer* copy = new Transformer();
414  *copy = *this;
415  return copy;
416 }
417 
418 wxString Transformer::GetTipText() const
419 {
420  wxString tipText = m_electricalData.name;
421  wxString primVoltage = StringFromDouble(m_electricalData.primaryNominalVoltage);
422  switch(m_electricalData.primaryNominalVoltageUnit) {
423  case UNIT_V: {
424  primVoltage += _(" V");
425  } break;
426  case UNIT_kV: {
427  primVoltage += _(" kV");
428  } break;
429  default:
430  break;
431  }
432  wxString secVoltage = StringFromDouble(m_electricalData.secondaryNominalVoltage);
433  switch(m_electricalData.secondaryNominalVoltageUnit) {
434  case UNIT_V: {
435  secVoltage += _(" V");
436  } break;
437  case UNIT_kV: {
438  secVoltage += _(" kV");
439  } break;
440  default:
441  break;
442  }
443 
444  tipText += "\n" + primVoltage + " / " + secVoltage;
445 
446  if(m_online) {
447  tipText += "\n";
448  int busNumber[2];
449  busNumber[0] = static_cast<Bus*>(m_parentList[0])->GetElectricalData().number + 1;
450  busNumber[1] = static_cast<Bus*>(m_parentList[1])->GetElectricalData().number + 1;
451 
452  tipText += _("\nP") + wxString::Format("(%d-%d) = ", busNumber[0], busNumber[1]) +
453  wxString::FromDouble(m_electricalData.powerFlow[0].real(), 5) + _(" p.u.");
454  tipText += _("\nQ") + wxString::Format("(%d-%d) = ", busNumber[0], busNumber[1]) +
455  wxString::FromDouble(m_electricalData.powerFlow[0].imag(), 5) + _(" p.u.");
456  tipText += _("\nP") + wxString::Format("(%d-%d) = ", busNumber[1], busNumber[0]) +
457  wxString::FromDouble(m_electricalData.powerFlow[1].real(), 5) + _(" p.u.");
458  tipText += _("\nQ") + wxString::Format("(%d-%d) = ", busNumber[1], busNumber[0]) +
459  wxString::FromDouble(m_electricalData.powerFlow[1].imag(), 5) + _(" p.u.");
460  }
461 
462  return tipText;
463 }
464 
465 TransformerElectricalData Transformer::GetPUElectricalData(double systemBasePower)
466 {
467  TransformerElectricalData data = m_electricalData;
468  double transformerBasePower = GetValueFromUnit(data.nominalPower, data.nominalPowerUnit);
469  double baseVoltage = 0.0;
470  if(data.baseVoltage == 0) {
471  baseVoltage = GetValueFromUnit(data.primaryNominalVoltage, data.primaryNominalVoltageUnit);
472  } else {
473  baseVoltage = GetValueFromUnit(data.secondaryNominalVoltage, data.secondaryNominalVoltageUnit);
474  }
475  double systemBaseImpedance = (baseVoltage * baseVoltage) / systemBasePower;
476  double transformerBaseImpedance = (baseVoltage * baseVoltage) / transformerBasePower;
477 
478  // Resistance
479  double r = data.resistance;
480  if(data.resistanceUnit == UNIT_PU) {
481  if(data.useTransformerPower) data.resistance = (r * transformerBaseImpedance) / systemBaseImpedance;
482  } else {
483  data.resistance = r / systemBaseImpedance;
484  }
485  data.resistanceUnit = UNIT_PU;
486 
487  // Indutive reactance
488  double x = data.indReactance;
489  if(data.indReactanceUnit == UNIT_PU) {
490  if(data.useTransformerPower) data.indReactance = (x * transformerBaseImpedance) / systemBaseImpedance;
491  } else {
492  data.indReactance = x / systemBaseImpedance;
493  }
494  data.indReactanceUnit = UNIT_PU;
495 
496  // Fault
497 
498  // Zero seq. resistance
499  double r0 = data.zeroResistance;
500  if(data.useTransformerPower) data.zeroResistance = (r0 * transformerBaseImpedance) / systemBaseImpedance;
501 
502  // Zero seq. ind. reactance
503  double x0 = data.zeroIndReactance;
504  if(data.useTransformerPower) data.zeroIndReactance = (x0 * transformerBaseImpedance) / systemBaseImpedance;
505 
506  // Primary ground resistance
507  double rgp = data.primaryGrndResistance;
508  if(data.useTransformerPower) data.primaryGrndResistance = (rgp * transformerBaseImpedance) / systemBaseImpedance;
509 
510  // Primary ground ind reactance
511  double xgp = data.primaryGrndReactance;
512  if(data.useTransformerPower) data.primaryGrndReactance = (xgp * transformerBaseImpedance) / systemBaseImpedance;
513 
514  // Secondary ground resistance
515  double rgs = data.secondaryGrndResistance;
516  if(data.useTransformerPower) data.secondaryGrndResistance = (rgs * transformerBaseImpedance) / systemBaseImpedance;
517 
518  // Secondary ground ind reactance
519  double xgs = data.secondaryGrndReactance;
520  if(data.useTransformerPower) data.secondaryGrndReactance = (xgs * transformerBaseImpedance) / systemBaseImpedance;
521 
522  if(!m_online) {
523  data.powerFlow[0] = std::complex<double>(0, 0);
524  data.powerFlow[1] = std::complex<double>(0, 0);
525  data.faultCurrent[0][0] = std::complex<double>(0, 0);
526  data.faultCurrent[0][1] = std::complex<double>(0, 0);
527  data.faultCurrent[0][2] = std::complex<double>(0, 0);
528  data.faultCurrent[1][0] = std::complex<double>(0, 0);
529  data.faultCurrent[1][1] = std::complex<double>(0, 0);
530  data.faultCurrent[1][2] = std::complex<double>(0, 0);
531  }
532 
533  return data;
534 }
double GetAngle() const
Get the element angle.
Definition: Element.h:212
+
virtual Element * GetCopy()
Get a the element copy.
+ + + +
virtual void Rotate(bool clockwise=true)
Rotate the element.
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
+
virtual wxString GetTipText() const
Get the tip text.
+ +
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
Rotate a point as element position being the origin.
Definition: Element.cpp:107
virtual bool Intersects(wxRect2DDouble rect) const =0
Check if the element&#39;s rect intersects other rect.
-
virtual void MoveNode(Element *parent, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
- - -
virtual void Move(wxPoint2DDouble position)
Move the element other position.
-
Definition: Bus.h:45
-
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
-
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
-
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
-
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:333
- -
virtual void RotateNode(Element *parent, bool clockwise)
Rotate a node.
-
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
-
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Transformer.cpp:88
-
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
- - -
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Transformer.cpp:94
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Transformer.cpp:22
-
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:61
-
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
-
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:171
- - - -
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:83
-
Definition: Branch.h:7
+
virtual void MoveNode(Element *parent, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
+ +
Form to edit the transformer power data.
+
virtual void Move(wxPoint2DDouble position)
Move the element other position.
+ +
Definition: Bus.h:62
+
virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection)
Set the direction of the power flow.
+
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
+
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
+
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:353
+ +
virtual void RotateNode(Element *parent, bool clockwise)
Rotate a node.
+
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
+
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
+
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
+ + +
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Transformer.cpp:39
+
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:78
+
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
+
wxPoint2DDouble GetPosition() const
Get the element position.
Definition: Element.h:187
+ + + +
const GLdouble * GetRGBA() const
Get colour in RGBA.
Definition: Element.h:101
+
Definition: Branch.h:24
diff --git a/docs/doxygen/html/_transformer_8h_source.html b/docs/doxygen/html/_transformer_8h_source.html index f67c9bb..7e5bca5 100644 --- a/docs/doxygen/html/_transformer_8h_source.html +++ b/docs/doxygen/html/_transformer_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,16 +88,16 @@ $(document).ready(function(){initNavTree('_transformer_8h_source.html','');});
Transformer.h
-
1 #ifndef TRANSFORMER_H
2 #define TRANSFORMER_H
3 
4 #include "Branch.h"
5 
6 class TransformerForm;
7 
8 enum TransformerConnection {
9  GWYE_GWYE = 0,
10  WYE_GWYE,
11  GWYE_WYE,
12  WYE_WYE,
13  DELTA_GWYE,
14  DELTA_WYE,
15  GWYE_DELTA,
16  WYE_DELTA,
17  DELTA_DELTA
18 };
19 
21  // General
22  wxString name = "";
23  double primaryNominalVoltage = 138.0;
24  ElectricalUnit primaryNominalVoltageUnit = UNIT_kV;
25  double secondaryNominalVoltage = 138.0;
26  ElectricalUnit secondaryNominalVoltageUnit = UNIT_kV;
27  int baseVoltage = 0;
28  double nominalPower = 100.0;
29  ElectricalUnit nominalPowerUnit = UNIT_MVA;
30  double resistance = 0.0;
31  ElectricalUnit resistanceUnit = UNIT_PU;
32  double indReactance = 1.0;
33  ElectricalUnit indReactanceUnit = UNIT_PU;
34  TransformerConnection connection = GWYE_GWYE;
35  double turnsRatio = 1.0;
36  double phaseShift = 0.0;
37  bool useTransformerPower = false;
38 
39  // Power flow (p.u.)
40  std::complex<double> current[2] = { std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0) };
41  std::complex<double> powerFlow[2] = { std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0) };
42 
43  // Fault
44  double zeroResistance = 0.0;
45  double zeroIndReactance = 1.0;
46  double primaryGrndResistance = 0.0;
47  double primaryGrndReactance = 0.0;
48  double secondaryGrndResistance = 0.0;
49  double secondaryGrndReactance = 0.0;
50  // p.u. fault data
51  std::complex<double> faultCurrent[2][3];
52 };
53 
54 class Transformer : public Branch
55 {
56 public:
57  Transformer();
58  Transformer(wxString name);
59  virtual ~Transformer();
60 
61  virtual Element* GetCopy();
62  virtual bool AddParent(Element* parent, wxPoint2DDouble position);
63  virtual bool Contains(wxPoint2DDouble position) const;
64  virtual void Draw(wxPoint2DDouble translation, double scale) const;
65  virtual bool Intersects(wxRect2DDouble rect) const;
66  virtual void Rotate(bool clockwise = true);
67  virtual void Move(wxPoint2DDouble position);
68  virtual void MoveNode(Element* parent, wxPoint2DDouble position);
69  virtual void StartMove(wxPoint2DDouble position);
70  virtual bool GetContextMenu(wxMenu& menu);
71  virtual wxString GetTipText() const;
72  virtual void RotateNode(Element* parent, bool clockwise);
73  virtual bool SetNodeParent(Element* parent);
74  virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection);
75  virtual bool ShowForm(wxWindow* parent, Element* element);
76  virtual TransformerElectricalData GetElectricalData() const { return m_electricalData; }
77  virtual TransformerElectricalData GetPUElectricalData(double systemBasePower);
78  virtual void SetElectricaData(TransformerElectricalData electricalData) { m_electricalData = electricalData; }
79  virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
80 
81 protected:
82  void UpdatePowerFlowArrowsPosition();
83  TransformerElectricalData m_electricalData;
84 };
85 
86 #endif // TRANSFORMER_H
- -
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
- - - -
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:61
- - -
Definition: Branch.h:7
+
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef TRANSFORMER_H
19 #define TRANSFORMER_H
20 
21 #include "Branch.h"
22 
23 class TransformerForm;
24 
25 enum TransformerConnection {
26  GWYE_GWYE = 0,
27  WYE_GWYE,
28  GWYE_WYE,
29  WYE_WYE,
30  DELTA_GWYE,
31  DELTA_WYE,
32  GWYE_DELTA,
33  WYE_DELTA,
34  DELTA_DELTA
35 };
36 
38  // General
39  wxString name = "";
40  double primaryNominalVoltage = 138.0;
41  ElectricalUnit primaryNominalVoltageUnit = UNIT_kV;
42  double secondaryNominalVoltage = 138.0;
43  ElectricalUnit secondaryNominalVoltageUnit = UNIT_kV;
44  int baseVoltage = 0;
45  double nominalPower = 100.0;
46  ElectricalUnit nominalPowerUnit = UNIT_MVA;
47  double resistance = 0.0;
48  ElectricalUnit resistanceUnit = UNIT_PU;
49  double indReactance = 1.0;
50  ElectricalUnit indReactanceUnit = UNIT_PU;
51  TransformerConnection connection = GWYE_GWYE;
52  double turnsRatio = 1.0;
53  double phaseShift = 0.0;
54  bool useTransformerPower = false;
55 
56  // Power flow (p.u.)
57  std::complex<double> current[2] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0)};
58  std::complex<double> powerFlow[2] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0)};
59 
60  // Fault
61  double zeroResistance = 0.0;
62  double zeroIndReactance = 1.0;
63  double primaryGrndResistance = 0.0;
64  double primaryGrndReactance = 0.0;
65  double secondaryGrndResistance = 0.0;
66  double secondaryGrndReactance = 0.0;
67  // p.u. fault data
68  std::complex<double> faultCurrent[2][3];
69 };
70 
71 class Transformer : public Branch
72 {
73  public:
74  Transformer();
75  Transformer(wxString name);
76  virtual ~Transformer();
77 
78  virtual Element* GetCopy();
79  virtual bool AddParent(Element* parent, wxPoint2DDouble position);
80  virtual bool Contains(wxPoint2DDouble position) const;
81  virtual void Draw(wxPoint2DDouble translation, double scale) const;
82  virtual bool Intersects(wxRect2DDouble rect) const;
83  virtual void Rotate(bool clockwise = true);
84  virtual void Move(wxPoint2DDouble position);
85  virtual void MoveNode(Element* parent, wxPoint2DDouble position);
86  virtual void StartMove(wxPoint2DDouble position);
87  virtual bool GetContextMenu(wxMenu& menu);
88  virtual wxString GetTipText() const;
89  virtual void RotateNode(Element* parent, bool clockwise);
90  virtual bool SetNodeParent(Element* parent);
91  virtual void SetPowerFlowDirection(PowerFlowDirection pfDirection);
92  virtual bool ShowForm(wxWindow* parent, Element* element);
93  virtual TransformerElectricalData GetElectricalData() const { return m_electricalData; }
94  virtual TransformerElectricalData GetPUElectricalData(double systemBasePower);
95  virtual void SetElectricaData(TransformerElectricalData electricalData) { m_electricalData = electricalData; }
96  virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit);
97 
98  protected:
99  void UpdatePowerFlowArrowsPosition();
100  TransformerElectricalData m_electricalData;
101 };
102 
103 #endif // TRANSFORMER_H
+ +
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+ +
Form to edit the transformer power data.
+ +
PowerFlowDirection
Direction of power flow arrows.
Definition: PowerElement.h:78
+ + +
Definition: Branch.h:24
diff --git a/docs/doxygen/html/_transformer_form_8cpp_source.html b/docs/doxygen/html/_transformer_form_8cpp_source.html index 196aa16..20a3fa2 100644 --- a/docs/doxygen/html/_transformer_form_8cpp_source.html +++ b/docs/doxygen/html/_transformer_form_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,18 +88,20 @@ $(document).ready(function(){initNavTree('_transformer_form_8cpp_source.html',''
TransformerForm.cpp
-
1 #include "TransformerForm.h"
2 #include "SwitchingForm.h"
3 #include "Transformer.h"
4 
5 TransformerForm::TransformerForm(wxWindow* parent, Transformer* transformer) : TransformerFormBase(parent)
6 {
7  m_choiceResistance->SetString(1, L'\u03A9');
8  m_choiceReactance->SetString(1, L'\u03A9');
9 
10  //Reset connections choice labels (to be translated)
11  m_choiceConnection->SetString(0, _("Grounded Wye - Grounded Wye"));
12  m_choiceConnection->SetString(1, _("Wye - Grounded Wye"));
13  m_choiceConnection->SetString(2, _("Grounded Wye - Wye"));
14  m_choiceConnection->SetString(3, _("Wye - Wye"));
15  m_choiceConnection->SetString(4, _("Delta - Grounded Wye"));
16  m_choiceConnection->SetString(5, _("Delta - Wye"));
17  m_choiceConnection->SetString(6, _("Grounded Wye - Delta"));
18  m_choiceConnection->SetString(7, _("Wye - Delta"));
19  m_choiceConnection->SetString(8, _("Delta - Delta"));
20 
21  SetSize(GetBestSize());
22  Layout();
23 
24  m_parent = parent;
25  m_transformer = transformer;
26 
27  TransformerElectricalData data = transformer->GetElectricalData();
28 
29  m_textCtrlName->SetValue(data.name);
30 
31  wxString primVoltStr = Transformer::StringFromDouble(data.primaryNominalVoltage);
32  switch(data.primaryNominalVoltageUnit) {
33  case UNIT_V: {
34  primVoltStr += " V";
35  } break;
36  case UNIT_kV: {
37  primVoltStr += " kV";
38  } break;
39  default:
40  break;
41  }
42  wxString secVoltStr = Transformer::StringFromDouble(data.secondaryNominalVoltage);
43  switch(data.secondaryNominalVoltageUnit) {
44  case UNIT_V: {
45  secVoltStr += " V";
46  } break;
47  case UNIT_kV: {
48  secVoltStr += " kV";
49  } break;
50  default:
51  break;
52  }
53  m_staticTextNominalVoltageValue->SetLabel(wxString::Format("%s / %s", primVoltStr, secVoltStr));
54 
55  m_choiceBaseVoltage->SetString(0, primVoltStr);
56  m_choiceBaseVoltage->SetString(1, secVoltStr);
57  m_choiceBaseVoltage->SetSelection(data.baseVoltage);
58 
59  m_textCtrlNominalPower->SetValue(Transformer::StringFromDouble(data.nominalPower));
60  switch(data.nominalPowerUnit) {
61  case UNIT_VA: {
62  m_choiceNominalPower->SetSelection(0);
63  } break;
64  case UNIT_kVA: {
65  m_choiceNominalPower->SetSelection(1);
66  } break;
67  case UNIT_MVA: {
68  m_choiceNominalPower->SetSelection(2);
69  } break;
70  default:
71  break;
72  }
73 
74  m_textCtrlResistance->SetValue(Transformer::StringFromDouble(data.resistance));
75  switch(data.resistanceUnit) {
76  case UNIT_PU: {
77  m_choiceResistance->SetSelection(0);
78  } break;
79  case UNIT_OHM: {
80  m_choiceResistance->SetSelection(1);
81  } break;
82  default:
83  break;
84  }
85 
86  m_textCtrlReactance->SetValue(Transformer::StringFromDouble(data.indReactance));
87  switch(data.indReactanceUnit) {
88  case UNIT_PU: {
89  m_choiceReactance->SetSelection(0);
90  } break;
91  case UNIT_OHM: {
92  m_choiceReactance->SetSelection(1);
93  } break;
94  default:
95  break;
96  }
97 
98  m_choiceConnection->SetSelection(data.connection);
99 
100  m_textCtrlTurnRatio->SetValue(Transformer::StringFromDouble(data.turnsRatio));
101  m_textCtrlPhaseShift->SetValue(Transformer::StringFromDouble(data.phaseShift));
102 
103  m_checkUseTransformerPower->SetValue(data.useTransformerPower);
104 
105  m_textCtrlZeroResistance->SetValue(Transformer::StringFromDouble(data.zeroResistance));
106  m_textCtrlZeroReactance->SetValue(Transformer::StringFromDouble(data.zeroIndReactance));
107  m_textCtrlPrimResistance->SetValue(Transformer::StringFromDouble(data.primaryGrndResistance));
108  m_textCtrlPrimReactance->SetValue(Transformer::StringFromDouble(data.primaryGrndReactance));
109  m_textCtrlSecResistance->SetValue(Transformer::StringFromDouble(data.secondaryGrndResistance));
110  m_textCtrlSecReactance->SetValue(Transformer::StringFromDouble(data.secondaryGrndReactance));
111 }
112 
113 TransformerForm::~TransformerForm() {}
114 void TransformerForm::OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
115 void TransformerForm::OnOKButtonClick(wxCommandEvent& event)
116 {
117  if(ValidateData()) EndModal(wxID_OK);
118 }
119 void TransformerForm::OnStabilityButtonClick(wxCommandEvent& event)
120 {
121  if(ValidateData()) {
122  SwitchingForm swForm(m_parent, m_transformer);
123  swForm.SetTitle(_("Transfomer: Switching"));
124  swForm.ShowModal();
125  EndModal(wxID_OK);
126  }
127 }
128 
129 bool TransformerForm::ValidateData()
130 {
131  TransformerElectricalData data = m_transformer->GetElectricalData();
132 
133  data.name = m_textCtrlName->GetValue();
134  data.baseVoltage = m_choiceBaseVoltage->GetSelection();
135 
136  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlNominalPower->GetValue(), data.nominalPower,
137  _("Value entered incorrectly in the field \"Nominal power\".")))
138  return false;
139  switch(m_choiceNominalPower->GetSelection()) {
140  case 0: {
141  data.nominalPowerUnit = UNIT_VA;
142  } break;
143  case 1: {
144  data.nominalPowerUnit = UNIT_kVA;
145  } break;
146  case 2: {
147  data.nominalPowerUnit = UNIT_MVA;
148  } break;
149  }
150 
151  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlResistance->GetValue(), data.resistance,
152  _("Value entered incorrectly in the field \"Resistance\".")))
153  return false;
154  switch(m_choiceResistance->GetSelection()) {
155  case 0: {
156  data.resistanceUnit = UNIT_PU;
157  } break;
158  case 1: {
159  data.resistanceUnit = UNIT_OHM;
160  } break;
161  }
162 
163  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlReactance->GetValue(), data.indReactance,
164  _("Value entered incorrectly in the field \"Indutive reactance\".")))
165  return false;
166  switch(m_choiceReactance->GetSelection()) {
167  case 0: {
168  data.indReactanceUnit = UNIT_PU;
169  } break;
170  case 1: {
171  data.indReactanceUnit = UNIT_OHM;
172  } break;
173  }
174 
175  switch(m_choiceConnection->GetSelection()) {
176  case 0: {
177  data.connection = GWYE_GWYE;
178  } break;
179  case 1: {
180  data.connection = WYE_GWYE;
181  } break;
182  case 2: {
183  data.connection = GWYE_WYE;
184  } break;
185  case 3: {
186  data.connection = WYE_WYE;
187  } break;
188  case 4: {
189  data.connection = DELTA_GWYE;
190  } break;
191  case 5: {
192  data.connection = DELTA_WYE;
193  } break;
194  case 6: {
195  data.connection = GWYE_DELTA;
196  } break;
197  case 7: {
198  data.connection = WYE_DELTA;
199  } break;
200  case 8: {
201  data.connection = DELTA_DELTA;
202  } break;
203  }
204 
205  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlTurnRatio->GetValue(), data.turnsRatio,
206  _("Value entered incorrectly in the field \"Turns ratio\".")))
207  return false;
208 
209  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlPhaseShift->GetValue(), data.phaseShift,
210  _("Value entered incorrectly in the field \"Phase shift\".")))
211  return false;
212 
213  data.useTransformerPower = m_checkUseTransformerPower->GetValue();
214 
215  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlZeroResistance->GetValue(), data.zeroResistance,
216  _("Value entered incorrectly in the field \"Zero sequence resistance\".")))
217  return false;
218 
219  if(!m_transformer->DoubleFromString(
220  m_parent, m_textCtrlZeroReactance->GetValue(), data.zeroIndReactance,
221  _("Value entered incorrectly in the field \"Zero sequence indutive reactance\".")))
222  return false;
223 
224  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlPrimResistance->GetValue(), data.primaryGrndResistance,
225  _("Value entered incorrectly in the field \"Primary ground resistance\".")))
226  return false;
227 
228  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlPrimReactance->GetValue(), data.primaryGrndReactance,
229  _("Value entered incorrectly in the field \"Primary ground reactance\".")))
230  return false;
231 
232  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlSecResistance->GetValue(), data.secondaryGrndResistance,
233  _("Value entered incorrectly in the field \"Secondary ground resistance\".")))
234  return false;
235 
236  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlSecReactance->GetValue(), data.secondaryGrndReactance,
237  _("Value entered incorrectly in the field \"Secondary ground reactance\".")))
238  return false;
239 
240  m_transformer->SetElectricaData(data);
241  return true;
242 }
- - - - - +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "TransformerForm.h"
19 #include "SwitchingForm.h"
20 #include "Transformer.h"
21 
22 TransformerForm::TransformerForm(wxWindow* parent, Transformer* transformer) : TransformerFormBase(parent)
23 {
24  m_choiceResistance->SetString(1, L'\u03A9');
25  m_choiceReactance->SetString(1, L'\u03A9');
26 
27  // Reset connections choice labels (to be translated)
28  m_choiceConnection->SetString(0, _("Grounded Wye - Grounded Wye"));
29  m_choiceConnection->SetString(1, _("Wye - Grounded Wye"));
30  m_choiceConnection->SetString(2, _("Grounded Wye - Wye"));
31  m_choiceConnection->SetString(3, _("Wye - Wye"));
32  m_choiceConnection->SetString(4, _("Delta - Grounded Wye"));
33  m_choiceConnection->SetString(5, _("Delta - Wye"));
34  m_choiceConnection->SetString(6, _("Grounded Wye - Delta"));
35  m_choiceConnection->SetString(7, _("Wye - Delta"));
36  m_choiceConnection->SetString(8, _("Delta - Delta"));
37 
38  SetSize(GetBestSize());
39  Layout();
40 
41  m_parent = parent;
42  m_transformer = transformer;
43 
44  TransformerElectricalData data = transformer->GetElectricalData();
45 
46  m_textCtrlName->SetValue(data.name);
47 
48  wxString primVoltStr = Transformer::StringFromDouble(data.primaryNominalVoltage);
49  switch(data.primaryNominalVoltageUnit) {
50  case UNIT_V: {
51  primVoltStr += " V";
52  } break;
53  case UNIT_kV: {
54  primVoltStr += " kV";
55  } break;
56  default:
57  break;
58  }
59  wxString secVoltStr = Transformer::StringFromDouble(data.secondaryNominalVoltage);
60  switch(data.secondaryNominalVoltageUnit) {
61  case UNIT_V: {
62  secVoltStr += " V";
63  } break;
64  case UNIT_kV: {
65  secVoltStr += " kV";
66  } break;
67  default:
68  break;
69  }
70  m_staticTextNominalVoltageValue->SetLabel(wxString::Format("%s / %s", primVoltStr, secVoltStr));
71 
72  m_choiceBaseVoltage->SetString(0, primVoltStr);
73  m_choiceBaseVoltage->SetString(1, secVoltStr);
74  m_choiceBaseVoltage->SetSelection(data.baseVoltage);
75 
76  m_textCtrlNominalPower->SetValue(Transformer::StringFromDouble(data.nominalPower));
77  switch(data.nominalPowerUnit) {
78  case UNIT_VA: {
79  m_choiceNominalPower->SetSelection(0);
80  } break;
81  case UNIT_kVA: {
82  m_choiceNominalPower->SetSelection(1);
83  } break;
84  case UNIT_MVA: {
85  m_choiceNominalPower->SetSelection(2);
86  } break;
87  default:
88  break;
89  }
90 
91  m_textCtrlResistance->SetValue(Transformer::StringFromDouble(data.resistance));
92  switch(data.resistanceUnit) {
93  case UNIT_PU: {
94  m_choiceResistance->SetSelection(0);
95  } break;
96  case UNIT_OHM: {
97  m_choiceResistance->SetSelection(1);
98  } break;
99  default:
100  break;
101  }
102 
103  m_textCtrlReactance->SetValue(Transformer::StringFromDouble(data.indReactance));
104  switch(data.indReactanceUnit) {
105  case UNIT_PU: {
106  m_choiceReactance->SetSelection(0);
107  } break;
108  case UNIT_OHM: {
109  m_choiceReactance->SetSelection(1);
110  } break;
111  default:
112  break;
113  }
114 
115  m_choiceConnection->SetSelection(data.connection);
116 
117  m_textCtrlTurnRatio->SetValue(Transformer::StringFromDouble(data.turnsRatio));
118  m_textCtrlPhaseShift->SetValue(Transformer::StringFromDouble(data.phaseShift));
119 
120  m_checkUseTransformerPower->SetValue(data.useTransformerPower);
121 
122  m_textCtrlZeroResistance->SetValue(Transformer::StringFromDouble(data.zeroResistance));
123  m_textCtrlZeroReactance->SetValue(Transformer::StringFromDouble(data.zeroIndReactance));
124  m_textCtrlPrimResistance->SetValue(Transformer::StringFromDouble(data.primaryGrndResistance));
125  m_textCtrlPrimReactance->SetValue(Transformer::StringFromDouble(data.primaryGrndReactance));
126  m_textCtrlSecResistance->SetValue(Transformer::StringFromDouble(data.secondaryGrndResistance));
127  m_textCtrlSecReactance->SetValue(Transformer::StringFromDouble(data.secondaryGrndReactance));
128 }
129 
130 TransformerForm::~TransformerForm() {}
131 void TransformerForm::OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); }
132 void TransformerForm::OnOKButtonClick(wxCommandEvent& event)
133 {
134  if(ValidateData()) EndModal(wxID_OK);
135 }
136 void TransformerForm::OnStabilityButtonClick(wxCommandEvent& event)
137 {
138  if(ValidateData()) {
139  SwitchingForm swForm(m_parent, m_transformer);
140  swForm.SetTitle(_("Transfomer: Switching"));
141  swForm.ShowModal();
142  EndModal(wxID_OK);
143  }
144 }
145 
146 bool TransformerForm::ValidateData()
147 {
148  TransformerElectricalData data = m_transformer->GetElectricalData();
149 
150  data.name = m_textCtrlName->GetValue();
151  data.baseVoltage = m_choiceBaseVoltage->GetSelection();
152 
153  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlNominalPower->GetValue(), data.nominalPower,
154  _("Value entered incorrectly in the field \"Nominal power\".")))
155  return false;
156  switch(m_choiceNominalPower->GetSelection()) {
157  case 0: {
158  data.nominalPowerUnit = UNIT_VA;
159  } break;
160  case 1: {
161  data.nominalPowerUnit = UNIT_kVA;
162  } break;
163  case 2: {
164  data.nominalPowerUnit = UNIT_MVA;
165  } break;
166  }
167 
168  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlResistance->GetValue(), data.resistance,
169  _("Value entered incorrectly in the field \"Resistance\".")))
170  return false;
171  switch(m_choiceResistance->GetSelection()) {
172  case 0: {
173  data.resistanceUnit = UNIT_PU;
174  } break;
175  case 1: {
176  data.resistanceUnit = UNIT_OHM;
177  } break;
178  }
179 
180  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlReactance->GetValue(), data.indReactance,
181  _("Value entered incorrectly in the field \"Indutive reactance\".")))
182  return false;
183  switch(m_choiceReactance->GetSelection()) {
184  case 0: {
185  data.indReactanceUnit = UNIT_PU;
186  } break;
187  case 1: {
188  data.indReactanceUnit = UNIT_OHM;
189  } break;
190  }
191 
192  switch(m_choiceConnection->GetSelection()) {
193  case 0: {
194  data.connection = GWYE_GWYE;
195  } break;
196  case 1: {
197  data.connection = WYE_GWYE;
198  } break;
199  case 2: {
200  data.connection = GWYE_WYE;
201  } break;
202  case 3: {
203  data.connection = WYE_WYE;
204  } break;
205  case 4: {
206  data.connection = DELTA_GWYE;
207  } break;
208  case 5: {
209  data.connection = DELTA_WYE;
210  } break;
211  case 6: {
212  data.connection = GWYE_DELTA;
213  } break;
214  case 7: {
215  data.connection = WYE_DELTA;
216  } break;
217  case 8: {
218  data.connection = DELTA_DELTA;
219  } break;
220  }
221 
222  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlTurnRatio->GetValue(), data.turnsRatio,
223  _("Value entered incorrectly in the field \"Turns ratio\".")))
224  return false;
225 
226  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlPhaseShift->GetValue(), data.phaseShift,
227  _("Value entered incorrectly in the field \"Phase shift\".")))
228  return false;
229 
230  data.useTransformerPower = m_checkUseTransformerPower->GetValue();
231 
232  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlZeroResistance->GetValue(), data.zeroResistance,
233  _("Value entered incorrectly in the field \"Zero sequence resistance\".")))
234  return false;
235 
236  if(!m_transformer->DoubleFromString(
237  m_parent, m_textCtrlZeroReactance->GetValue(), data.zeroIndReactance,
238  _("Value entered incorrectly in the field \"Zero sequence indutive reactance\".")))
239  return false;
240 
241  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlPrimResistance->GetValue(), data.primaryGrndResistance,
242  _("Value entered incorrectly in the field \"Primary ground resistance\".")))
243  return false;
244 
245  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlPrimReactance->GetValue(), data.primaryGrndReactance,
246  _("Value entered incorrectly in the field \"Primary ground reactance\".")))
247  return false;
248 
249  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlSecResistance->GetValue(), data.secondaryGrndResistance,
250  _("Value entered incorrectly in the field \"Secondary ground resistance\".")))
251  return false;
252 
253  if(!m_transformer->DoubleFromString(m_parent, m_textCtrlSecReactance->GetValue(), data.secondaryGrndReactance,
254  _("Value entered incorrectly in the field \"Secondary ground reactance\".")))
255  return false;
256 
257  m_transformer->SetElectricaData(data);
258  return true;
259 }
+ +
Form to edit the switching data of power elements for electromechanical transient studies...
Definition: SwitchingForm.h:32
+ + + + -
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:300
- - - - + +
static wxString StringFromDouble(double value, int minDecimal=1)
Convert a double value to string.
Definition: Element.cpp:320
+ + + +
diff --git a/docs/doxygen/html/_transformer_form_8h.html b/docs/doxygen/html/_transformer_form_8h.html new file mode 100644 index 0000000..a6734d9 --- /dev/null +++ b/docs/doxygen/html/_transformer_form_8h.html @@ -0,0 +1,115 @@ + + + + + + + + + +Project/TransformerForm.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
TransformerForm.h File Reference
+
+
+
#include "ElementForm.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  TransformerForm
 Form to edit the transformer power data. More...
 
+
+
+ + + + diff --git a/docs/doxygen/html/_transformer_form_8h_source.html b/docs/doxygen/html/_transformer_form_8h_source.html index 6833e7d..2f3c75a 100644 --- a/docs/doxygen/html/_transformer_form_8h_source.html +++ b/docs/doxygen/html/_transformer_form_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,16 +88,16 @@ $(document).ready(function(){initNavTree('_transformer_form_8h_source.html','');
TransformerForm.h
-
1 #ifndef TRANSFORMERFORM_H
2 #define TRANSFORMERFORM_H
3 
4 #include "ElementForm.h"
5 
6 class SwitchingForm;
7 class Transformer;
8 
10 {
11  public:
12  TransformerForm(wxWindow* parent, Transformer* transformer);
13  virtual ~TransformerForm();
14  bool ValidateData();
15 
16  protected:
17  virtual void OnCancelButtonClick(wxCommandEvent& event);
18  virtual void OnOKButtonClick(wxCommandEvent& event);
19  virtual void OnStabilityButtonClick(wxCommandEvent& event);
20 
21  wxWindow* m_parent = NULL;
22  Transformer* m_transformer = NULL;
23 };
24 #endif // TRANSFORMERFORM_H
- +Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef TRANSFORMERFORM_H
19 #define TRANSFORMERFORM_H
20 
21 #include "ElementForm.h"
22 
23 class SwitchingForm;
24 class Transformer;
25 
34 {
35  public:
36  TransformerForm(wxWindow* parent, Transformer* transformer);
37  virtual ~TransformerForm();
38  bool ValidateData();
39 
40  protected:
41  virtual void OnCancelButtonClick(wxCommandEvent& event);
42  virtual void OnOKButtonClick(wxCommandEvent& event);
43  virtual void OnStabilityButtonClick(wxCommandEvent& event);
44 
45  wxWindow* m_parent = NULL;
46  Transformer* m_transformer = NULL;
47 };
48 #endif // TRANSFORMERFORM_H
Form to edit the switching data of power elements for electromechanical transient studies...
Definition: SwitchingForm.h:32
+
Form to edit the transformer power data.
- +
-
1 #include "Workspace.h"
2 #include "Camera.h"
3 #include "Element.h"
4 //#include "Bus.h"
5 #include "Line.h"
6 #include "Transformer.h"
7 #include "SyncGenerator.h"
8 #include "IndMotor.h"
9 #include "SyncMotor.h"
10 #include "Load.h"
11 #include "Inductor.h"
12 #include "Capacitor.h"
13 #include "ElementDataObject.h"
14 
15 #include "Text.h"
16 
17 #include "PowerFlow.h"
18 #include "Fault.h"
19 #include "Electromechanical.h"
20 
21 #include "ElementPlotData.h"
22 #include "ChartView.h"
23 
24 #include "PropertiesData.h"
25 
26 // Workspace
27 Workspace::Workspace() : WorkspaceBase(NULL) {}
28 Workspace::Workspace(wxWindow* parent, wxString name, wxStatusBar* statusBar) : WorkspaceBase(parent)
29 {
30  m_timer->Start();
31  m_name = name;
32  m_statusBar = statusBar;
33  m_glContext = new wxGLContext(m_glCanvas);
34  m_camera = new Camera();
35  m_selectionRect = wxRect2DDouble(0, 0, 0, 0);
36 
37  for(int i = 0; i < NUM_ELEMENTS; ++i) {
38  m_elementNumber[i] = 1;
39  }
40 
41  const int widths[4] = {-3, -1, 100, 100};
42  m_statusBar->SetStatusWidths(4, widths);
43 
44  m_properties = new PropertiesData();
45 }
46 
47 Workspace::~Workspace()
48 {
49  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
50  if(*it) delete *it;
51  }
52  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) {
53  if(*it) delete *it;
54  }
55  if(m_camera) delete m_camera;
56  if(m_glContext) delete m_glContext;
57  if(m_tipWindow) delete m_tipWindow;
58  if(m_properties) delete m_properties;
59 }
60 
61 void Workspace::OnPaint(wxPaintEvent& event)
62 {
63  wxPaintDC dc(m_glCanvas);
64  m_glContext->SetCurrent(*m_glCanvas);
65  SetViewport();
66 
67  // Set GLCanvas scale and translation.
68  glScaled(m_camera->GetScale(), m_camera->GetScale(), 0.0); // Scale
69  glTranslated(m_camera->GetTranslation().m_x, m_camera->GetTranslation().m_y, 0.0); // Translation
70 
71  // Draw
72 
73  // Elements
74  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
75  Element* element = *it;
76  element->Draw(m_camera->GetTranslation(), m_camera->GetScale());
77  }
78 
79  // Texts
80  for(auto it = m_textList.begin(); it != m_textList.end(); ++it) {
81  Text* text = *it;
82  text->Draw(m_camera->GetTranslation(), m_camera->GetScale());
83  }
84 
85  // Selection rectangle
86  glLineWidth(1.0);
87  glColor4d(0.0, 0.5, 1.0, 1.0);
88  glBegin(GL_LINE_LOOP);
89  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y);
90  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y + m_selectionRect.m_height);
91  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y + m_selectionRect.m_height);
92  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y);
93  glEnd();
94  glColor4d(0.0, 0.5, 1.0, 0.3);
95  glBegin(GL_QUADS);
96  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y);
97  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y + m_selectionRect.m_height);
98  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y + m_selectionRect.m_height);
99  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y);
100  glEnd();
101 
102  glFlush(); // Sends all pending information directly to the GPU.
103  m_glCanvas->SwapBuffers();
104  event.Skip();
105 }
106 
107 void Workspace::SetViewport()
108 {
109  glClearColor(1.0, 1.0, 1.0, 1.0); // White background.
110  glClear(GL_COLOR_BUFFER_BIT);
111  glDisable(GL_DEPTH_TEST);
112  glDisable(GL_TEXTURE_2D);
113  glEnable(GL_COLOR_MATERIAL);
114  glEnable(GL_BLEND);
115  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
116  glEnable(GL_LINE_SMOOTH);
117 
118  double width = m_glCanvas->GetSize().x - 1;
119  double height = m_glCanvas->GetSize().y - 1;
120 
121  // Viewport fit the screen.
122  glViewport(0, 0, width, height);
123 
124  glMatrixMode(GL_PROJECTION);
125  glLoadIdentity();
126  gluOrtho2D(0.0, width, height, 0.0);
127 
128  glMatrixMode(GL_MODELVIEW);
129  glLoadIdentity();
130 }
131 
132 void Workspace::OnLeftClickDown(wxMouseEvent& event)
133 {
134  wxPoint clickPoint = event.GetPosition();
135  bool foundElement = false;
136  Element* newElement = NULL;
137  bool showNewElementForm = false;
138  bool clickOnSwitch = false;
139  if(m_mode == MODE_INSERT_TEXT || m_mode == MODE_PASTE || m_mode == MODE_DRAG_PASTE) {
140  m_mode = MODE_EDIT;
141  } else if(m_mode == MODE_INSERT || m_mode == MODE_DRAG_INSERT || m_mode == MODE_DRAG_INSERT_TEXT) {
142  // Get the last element inserted on the list.
143  newElement = *(m_elementList.end() - 1);
144  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
145  Element* element = *it;
146  // Clicked in any element.
147  if(element->Contains(m_camera->ScreenToWorld(clickPoint))) {
148  // Click at a bus.
149  if(typeid(*element) == typeid(Bus)) {
150  // Select the bus.
151  element->SetSelected();
152  foundElement = true; // Element found.
153  // Add the new element's parent. If the element being inserted returns true, back to
154  // edit mode.
155  if(newElement->AddParent(element, m_camera->ScreenToWorld(clickPoint))) {
156  ValidateElementsVoltages();
157  m_timer->Stop();
158  showNewElementForm = true;
159  m_mode = MODE_EDIT;
160  }
161  }
162  }
163  }
164  // The line element can have an indefined number of points.
165  if(!foundElement) {
166  if(typeid(*newElement) == typeid(Line)) {
167  newElement->AddPoint(m_camera->ScreenToWorld(clickPoint));
168  }
169  }
170  foundElement = true;
171  } else {
172  bool clickPickbox = false;
173  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
174  PowerElement* element = *it;
175  element->ResetPickboxes(); // Reset pickbox state.
176 
177  // Set movement initial position (not necessarily will be moved).
178  element->StartMove(m_camera->ScreenToWorld(clickPoint));
179 
180  // Click in selected element node.
181  if(element->NodeContains(m_camera->ScreenToWorld(clickPoint)) != 0 && element->IsSelected()) {
182  m_mode = MODE_MOVE_NODE;
183  m_disconnectedElement = true;
184  foundElement = true;
185  }
186 
187  // Click in an element.
188  else if(element->Contains(m_camera->ScreenToWorld(clickPoint))) {
189  if(!foundElement) {
190  // Select and show pickbox.
191  element->SetSelected();
192  element->ShowPickbox();
193  foundElement = true;
194  }
195  // If pickbox contains the click, move the pickbox
196  if(element->PickboxContains(m_camera->ScreenToWorld(clickPoint))) {
197  m_mode = MODE_MOVE_PICKBOX;
198  clickPickbox = true;
199  }
200  // If didn't found a pickbox, move the element
201  if(!clickPickbox) {
202  m_mode = MODE_MOVE_ELEMENT;
203  }
204  }
205 
206  // Click in a switch.
207  else if(element->SwitchesContains(m_camera->ScreenToWorld(clickPoint))) {
208  element->SetOnline(element->IsOnline() ? false : true);
209  clickOnSwitch = true;
210  }
211  }
212 
213  // Text element
214  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) {
215  Text* text = *it;
216 
217  text->StartMove(m_camera->ScreenToWorld(clickPoint));
218 
219  if(text->Contains(m_camera->ScreenToWorld(clickPoint))) {
220  if(!foundElement) {
221  text->SetSelected();
222  m_mode = MODE_MOVE_ELEMENT;
223  foundElement = true;
224  }
225  }
226  }
227  }
228 
229  if(!foundElement) {
230  m_mode = MODE_SELECTION_RECT;
231  m_startSelRect = m_camera->ScreenToWorld(clickPoint);
232  }
233 
234  Redraw();
235  UpdateStatusBar();
236 
237  if(showNewElementForm) {
238  if(newElement) {
239  newElement->ShowForm(this, newElement);
240  if(m_continuousCalc) RunStaticStudies();
241  }
242  }
243  if(clickOnSwitch && m_continuousCalc) RunStaticStudies();
244 
245  event.Skip();
246 }
247 
248 void Workspace::OnLeftDoubleClick(wxMouseEvent& event)
249 {
250  bool elementEdited = false;
251  bool clickOnSwitch = false;
252  bool redraw = false;
253 
254  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
255  PowerElement* element = *it;
256 
257  // Click in an element.
258  if(element->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
259  bool elementIsBus = false;
260  Bus oldBus;
261  Bus* currentBus = NULL;
262  if((currentBus = dynamic_cast<Bus*>(element))) {
263  elementIsBus = true;
264  oldBus = *currentBus;
265  }
266  m_timer->Stop();
267  element->ShowForm(this, element);
268  elementEdited = true;
269  redraw = true;
270 
271  // If the edited element is a bus and was changed the rated voltage, this voltage must be
272  // propagated through the lines
273  if(elementIsBus) {
274  // The voltage was changed
275  if(oldBus.GetElectricalData().nominalVoltage != currentBus->GetElectricalData().nominalVoltage ||
276  oldBus.GetElectricalData().nominalVoltageUnit !=
277  currentBus->GetElectricalData().nominalVoltageUnit) {
278  // Check if the bus has line as child.
279  std::vector<Element*> childList = element->GetChildList();
280  for(auto itc = childList.begin(), itcEnd = childList.end(); itc != itcEnd; ++itc) {
281  Element* child = *itc;
282  if(typeid(*child) == typeid(Line)) {
283  wxMessageDialog msgDialog(this, _("Do you want to change the rated voltage of the path?"),
284  _("Warning"), wxYES_NO | wxCENTRE | wxICON_WARNING);
285  if(msgDialog.ShowModal() == wxID_YES)
286  ValidateBusesVoltages(element);
287  else {
288  auto data = currentBus->GetElectricalData();
289  data.nominalVoltage = oldBus.GetElectricalData().nominalVoltage;
290  data.nominalVoltageUnit = oldBus.GetElectricalData().nominalVoltageUnit;
291  currentBus->SetElectricalData(data);
292  }
293  break;
294  }
295  }
296  }
297  ValidateElementsVoltages();
298  }
299  }
300 
301  // Click in a switch.
302  else if(element->SwitchesContains(m_camera->ScreenToWorld(event.GetPosition()))) {
303  element->SetOnline(element->IsOnline() ? false : true);
304  clickOnSwitch = true;
305  }
306  }
307 
308  // Text element
309  for(auto it = m_textList.begin(); it != m_textList.end(); ++it) {
310  Text* text = *it;
311  if(text->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
312  text->ShowForm(this, GetElementList());
313  redraw = true;
314  }
315  }
316  if(elementEdited) {
317  UpdateTextElements();
318  if(m_continuousCalc) RunStaticStudies();
319  }
320  if(clickOnSwitch && m_continuousCalc) RunStaticStudies();
321 
322  if(redraw) Redraw();
323  m_timer->Start();
324 }
325 
326 void Workspace::OnRightClickDown(wxMouseEvent& event)
327 {
328  bool redraw = false;
329  if(m_mode == MODE_EDIT) {
330  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
331  Element* element = *it;
332  if(element->IsSelected()) {
333  // Show context menu.
334  if(element->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
335  element->ShowPickbox(false);
336  wxMenu menu;
337  if(element->GetContextMenu(menu)) {
338  m_timer->Stop();
339  menu.SetClientData(element);
340  menu.Bind(wxEVT_COMMAND_MENU_SELECTED, &Workspace::OnPopupClick, this);
341  PopupMenu(&menu);
342  redraw = true;
343 
344  if(!menu.GetClientData()) break;
345  }
346  element->ResetPickboxes();
347  }
348  }
349  }
350  }
351  if(redraw) Redraw();
352  m_timer->Start();
353 }
354 
355 void Workspace::OnLeftClickUp(wxMouseEvent& event)
356 {
357  // This event (under certain conditions) deselects the elements and back to edit mode or select the elements using
358  // the selection rectangle.
359  bool foundPickbox = false;
360  bool findNewParent = false;
361  bool updateVoltages = false;
362  auto itnp = m_elementList.begin();
363 
364  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
365  Element* element = *it;
366 
367  // The user was moving a pickbox.
368  if(m_mode == MODE_MOVE_PICKBOX) {
369  // Catch only the element that have the pickbox shown.
370  if(element->IsPickboxShown()) {
371  // If the element is a bus, check if a node is outside.
372  if(typeid(*element) == typeid(Bus)) {
373  // Get all the bus children.
374  for(int i = 0; i < (int)m_elementList.size(); i++) {
375  Element* child = m_elementList[i];
376  for(int j = 0; j < (int)child->GetParentList().size(); j++) {
377  Element* parent = child->GetParentList()[j];
378  // The child have a parent that is the element.
379  if(parent == element) {
380  child->UpdateNodes();
381  m_disconnectedElement = true;
382  }
383  }
384  }
385  }
386  }
387  }
388 
389  if(m_mode == MODE_SELECTION_RECT) {
390  if(element->Intersects(m_selectionRect)) {
391  element->SetSelected();
392  } else if(!event.ControlDown()) {
393  element->SetSelected(false);
394  }
395  } else if(m_mode == MODE_MOVE_NODE) {
396  if(element->IsSelected()) {
397  for(int i = 0; i < (int)m_elementList.size(); i++) {
398  Element* parent = m_elementList[i];
399  if(typeid(*parent) == typeid(Bus)) {
400  if(element->SetNodeParent(parent)) {
401  parent->AddChild(element);
402  findNewParent = true;
403  itnp = it;
404  element->ResetNodes();
405  break;
406  }
407  }
408  }
409  // element->ResetNodes();
410  }
411  } else {
412  // Deselect
413  if(!event.ControlDown()) {
414  if(!element->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
415  element->SetSelected(false);
416  }
417  }
418 
419  if(element->PickboxContains(m_camera->ScreenToWorld(event.GetPosition()))) {
420  foundPickbox = true;
421  } else {
422  element->ShowPickbox(false);
423  element->ResetPickboxes();
424  }
425  }
426  }
427 
428  // Text element
429  for(auto it = m_textList.begin(); it != m_textList.end(); it++) {
430  Text* text = *it;
431  if(m_mode == MODE_SELECTION_RECT) {
432  if(text->Intersects(m_selectionRect)) {
433  text->SetSelected();
434  } else if(!event.ControlDown()) {
435  text->SetSelected(false);
436  }
437  } else if(!event.ControlDown()) {
438  if(!text->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
439  text->SetSelected(false);
440  }
441  }
442  }
443 
444  if(findNewParent) {
445  std::rotate(itnp, itnp + 1, m_elementList.end());
446  updateVoltages = true;
447  }
448  if(!foundPickbox) {
449  SetCursor(wxCURSOR_ARROW);
450  }
451 
452  if(m_mode != MODE_INSERT) {
453  m_mode = MODE_EDIT;
454  }
455 
456  if(updateVoltages) {
457  ValidateElementsVoltages();
458  }
459 
460  if(m_continuousCalc && m_disconnectedElement) {
461  m_disconnectedElement = false;
462  RunStaticStudies();
463  }
464 
465  m_selectionRect = wxRect2DDouble(0, 0, 0, 0);
466  Redraw();
467  UpdateStatusBar();
468 }
469 
470 void Workspace::OnMouseMotion(wxMouseEvent& event)
471 {
472  bool redraw = false;
473  switch(m_mode) {
474  case MODE_INSERT: {
475  Element* newElement = *(m_elementList.end() - 1); // Get the last element in the list.
476  newElement->SetPosition(m_camera->ScreenToWorld(event.GetPosition()));
477  redraw = true;
478  } break;
479 
480  case MODE_INSERT_TEXT: {
481  Text* newText = *(m_textList.end() - 1);
482  newText->SetPosition(m_camera->ScreenToWorld(event.GetPosition()));
483  redraw = true;
484  } break;
485 
486  case MODE_DRAG:
487  case MODE_DRAG_INSERT:
488  case MODE_DRAG_INSERT_TEXT:
489  case MODE_DRAG_PASTE: {
490  m_camera->SetTranslation(event.GetPosition());
491  redraw = true;
492  } break;
493 
494  case MODE_EDIT: {
495  bool foundPickbox = false;
496  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
497  Element* element = *it;
498  if(element->IsSelected()) {
499  // Show element pickbox (when it has) if the mouse is over the selected object.
500  if(element->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
501  element->ShowPickbox();
502  redraw = true;
503 
504  // If the mouse is over a pickbox set correct mouse cursor.
505  if(element->PickboxContains(m_camera->ScreenToWorld(event.GetPosition()))) {
506  foundPickbox = true;
507  SetCursor(element->GetBestPickboxCursor());
508  } else if(!foundPickbox) {
509  SetCursor(wxCURSOR_ARROW);
510  element->ResetPickboxes();
511  }
512  } else if(!foundPickbox) {
513  if(element->IsPickboxShown()) redraw = true;
514 
515  element->ShowPickbox(false);
516  element->ResetPickboxes();
517  SetCursor(wxCURSOR_ARROW);
518  }
519  }
520  }
521  } break;
522 
523  case MODE_MOVE_NODE: {
524  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
525  Element* element = *it;
526  if(element->IsSelected()) {
527  element->MoveNode(NULL, m_camera->ScreenToWorld(event.GetPosition()));
528  redraw = true;
529  }
530  }
531  } break;
532 
533  case MODE_MOVE_PICKBOX: {
534  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
535  Element* element = *it;
536  if(element->IsSelected()) {
537  element->MovePickbox(m_camera->ScreenToWorld(event.GetPosition()));
538  redraw = true;
539  }
540  }
541  } break;
542 
543  case MODE_MOVE_ELEMENT:
544  case MODE_PASTE: {
545  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
546  Element* element = *it;
547  if(element->IsSelected()) {
548  element->Move(m_camera->ScreenToWorld(event.GetPosition()));
549  // Move child nodes
550  std::vector<Element*> childList = element->GetChildList();
551  for(auto it = childList.begin(), itEnd = childList.end(); it != itEnd; ++it) {
552  (*it)->MoveNode(element, m_camera->ScreenToWorld(event.GetPosition()));
553  }
554  redraw = true;
555  }
556  }
557  // Text element motion
558  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; it++) {
559  Text* text = *it;
560  if(text->IsSelected()) {
561  text->Move(m_camera->ScreenToWorld(event.GetPosition()));
562  redraw = true;
563  }
564  }
565  } break;
566 
567  case MODE_SELECTION_RECT: {
568  wxPoint2DDouble currentPos = m_camera->ScreenToWorld(event.GetPosition());
569  double x, y, w, h;
570  if(currentPos.m_x < m_startSelRect.m_x) {
571  x = currentPos.m_x;
572  w = m_startSelRect.m_x - currentPos.m_x;
573  } else {
574  x = m_startSelRect.m_x;
575  w = currentPos.m_x - m_startSelRect.m_x;
576  }
577  if(currentPos.m_y < m_startSelRect.m_y) {
578  y = currentPos.m_y;
579  h = m_startSelRect.m_y - currentPos.m_y;
580  } else {
581  y = m_startSelRect.m_y;
582  h = currentPos.m_y - m_startSelRect.m_y;
583  }
584 
585  m_selectionRect = wxRect2DDouble(x, y, w, h);
586  redraw = true;
587  } break;
588  }
589 
590  if(redraw) Redraw();
591  m_camera->UpdateMousePosition(event.GetPosition());
592  UpdateStatusBar();
593  m_timer->Start(); // Restart the timer.
594  event.Skip();
595 }
596 
597 void Workspace::OnMiddleDown(wxMouseEvent& event)
598 {
599  // Set to drag mode.
600  switch(m_mode) {
601  case MODE_INSERT: {
602  m_mode = MODE_DRAG_INSERT;
603  } break;
604  case MODE_INSERT_TEXT: {
605  m_mode = MODE_DRAG_INSERT_TEXT;
606  } break;
607  case MODE_PASTE: {
608  m_mode = MODE_DRAG_PASTE;
609  } break;
610  default: {
611  m_mode = MODE_DRAG;
612  } break;
613  }
614  m_camera->StartTranslation(m_camera->ScreenToWorld(event.GetPosition()));
615  UpdateStatusBar();
616  event.Skip();
617 }
618 
619 void Workspace::OnMiddleUp(wxMouseEvent& event)
620 {
621  switch(m_mode) {
622  case MODE_DRAG_INSERT: {
623  m_mode = MODE_INSERT;
624  } break;
625  case MODE_DRAG_INSERT_TEXT: {
626  m_mode = MODE_INSERT_TEXT;
627  } break;
628  case MODE_DRAG_PASTE: {
629  m_mode = MODE_PASTE;
630  } break;
631  case MODE_INSERT:
632  case MODE_INSERT_TEXT:
633  case MODE_PASTE: {
634  // Does nothing.
635  } break;
636  default: {
637  m_mode = MODE_EDIT;
638  } break;
639  }
640  UpdateStatusBar();
641  event.Skip();
642 }
643 
644 void Workspace::OnScroll(wxMouseEvent& event)
645 {
646  if(event.GetWheelRotation() > 0)
647  m_camera->SetScale(event.GetPosition(), +0.05);
648  else
649  m_camera->SetScale(event.GetPosition(), -0.05);
650 
651  UpdateStatusBar();
652  Redraw();
653 }
654 
655 void Workspace::OnKeyDown(wxKeyEvent& event)
656 {
657  bool insertingElement = false;
658  if(m_mode == MODE_INSERT || m_mode == MODE_INSERT_TEXT) insertingElement = true;
659 
660  char key = event.GetUnicodeKey();
661  if(key != WXK_NONE) {
662  switch(key) {
663  case WXK_ESCAPE: // Cancel operations.
664  {
665  if(m_mode == MODE_INSERT) {
666  m_elementList.pop_back(); // Removes the last element being inserted.
667  m_mode = MODE_EDIT;
668  Redraw();
669  } else if(m_mode == MODE_INSERT_TEXT) {
670  m_textList.pop_back();
671  m_mode = MODE_EDIT;
672  Redraw();
673  }
674  } break;
675  case WXK_DELETE: // Delete selected elements
676  {
677  DeleteSelectedElements();
678  } break;
679  case 'A': {
680  if(!insertingElement) {
681  Text* newBus = new Text(m_camera->ScreenToWorld(event.GetPosition()));
682  m_textList.push_back(newBus);
683  m_mode = MODE_INSERT_TEXT;
684  m_statusBar->SetStatusText(_("Insert Text: Click to insert, ESC to cancel."));
685  Redraw();
686  }
687  } break;
688  case 'F': {
689  if(event.GetModifiers() == wxMOD_SHIFT) {
690  Fit();
691  }
692  } break;
693  case 'R': // Rotate the selected elements.
694  {
695  RotateSelectedElements(event.GetModifiers() != wxMOD_SHIFT);
696  } break;
697  case 'B': // Insert a bus.
698  {
699  if(!insertingElement) {
700  Bus* newBus = new Bus(m_camera->ScreenToWorld(event.GetPosition()),
701  wxString::Format(_("Bus %d"), GetElementNumber(ID_BUS)));
702  IncrementElementNumber(ID_BUS);
703  m_elementList.push_back(newBus);
704  m_mode = MODE_INSERT;
705  m_statusBar->SetStatusText(_("Insert Bus: Click to insert, ESC to cancel."));
706  Redraw();
707  }
708  } break;
709  case 'L': {
710  if(!insertingElement) {
711  if(!event.ControlDown() && event.ShiftDown()) { // Insert a load.
712  Load* newLoad = new Load(wxString::Format(_("Load %d"), GetElementNumber(ID_LOAD)));
713  IncrementElementNumber(ID_LOAD);
714  m_elementList.push_back(newLoad);
715  m_mode = MODE_INSERT;
716  m_statusBar->SetStatusText(_("Insert Load: Click on a buses, ESC to cancel."));
717  } else if(!event.ControlDown() && !event.ShiftDown()) { // Insert a power line.
718  Line* newLine = new Line(wxString::Format(_("Line %d"), GetElementNumber(ID_LINE)));
719  IncrementElementNumber(ID_LINE);
720  m_elementList.push_back(newLine);
721  m_mode = MODE_INSERT;
722  m_statusBar->SetStatusText(_("Insert Line: Click on two buses, ESC to cancel."));
723  }
724  Redraw();
725  }
726  // Tests - Ctrl + Shift + L
727  if(event.ControlDown() && event.ShiftDown()) {
728  UpdateTextElements();
729  }
730  } break;
731  case 'T': // Insert a transformer.
732  {
733  if(!insertingElement) {
734  Transformer* newTransformer =
735  new Transformer(wxString::Format(_("Transformer %d"), GetElementNumber(ID_TRANSFORMER)));
736  IncrementElementNumber(ID_TRANSFORMER);
737  m_elementList.push_back(newTransformer);
738  m_mode = MODE_INSERT;
739  m_statusBar->SetStatusText(_("Insert Transformer: Click on two buses, ESC to cancel."));
740  Redraw();
741  }
742  } break;
743  case 'G': // Insert a generator.
744  {
745  if(!insertingElement) {
746  SyncGenerator* newGenerator =
747  new SyncGenerator(wxString::Format(_("Generator %d"), GetElementNumber(ID_SYNCGENERATOR)));
748  IncrementElementNumber(ID_SYNCGENERATOR);
749  m_elementList.push_back(newGenerator);
750  m_mode = MODE_INSERT;
751  m_statusBar->SetStatusText(_("Insert Generator: Click on a buses, ESC to cancel."));
752  Redraw();
753  }
754  } break;
755  case 'I': {
756  if(!insertingElement) {
757  if(event.GetModifiers() == wxMOD_SHIFT) { // Insert an inductor.
758  Inductor* newInductor =
759  new Inductor(wxString::Format(_("Inductor %d"), GetElementNumber(ID_INDUCTOR)));
760  IncrementElementNumber(ID_INDUCTOR);
761  m_elementList.push_back(newInductor);
762  m_mode = MODE_INSERT;
763  m_statusBar->SetStatusText(_("Insert Inductor: Click on a buses, ESC to cancel."));
764  } else // Insert an induction motor.
765  {
766  IndMotor* newIndMotor =
767  new IndMotor(wxString::Format(_("Induction motor %d"), GetElementNumber(ID_INDMOTOR)));
768  IncrementElementNumber(ID_INDMOTOR);
769  m_elementList.push_back(newIndMotor);
770  m_mode = MODE_INSERT;
771  m_statusBar->SetStatusText(_("Insert Induction Motor: Click on a buses, ESC to cancel."));
772  }
773  Redraw();
774  }
775  } break;
776  case 'K': // Insert a synchronous condenser.
777  {
778  if(!insertingElement) {
779  SyncMotor* newSyncCondenser =
780  new SyncMotor(wxString::Format(_("Synchronous condenser %d"), GetElementNumber(ID_SYNCMOTOR)));
781  IncrementElementNumber(ID_SYNCMOTOR);
782  m_elementList.push_back(newSyncCondenser);
783  m_mode = MODE_INSERT;
784  m_statusBar->SetStatusText(_("Insert Synchronous Condenser: Click on a buses, ESC to cancel."));
785  Redraw();
786  }
787  } break;
788  case 'C': {
789  if(!insertingElement) {
790  if(event.GetModifiers() == wxMOD_SHIFT) { // Insert a capacitor.
791  Capacitor* newCapacitor =
792  new Capacitor(wxString::Format(_("Capacitor %d"), GetElementNumber(ID_CAPACITOR)));
793  IncrementElementNumber(ID_CAPACITOR);
794  m_elementList.push_back(newCapacitor);
795  m_mode = MODE_INSERT;
796  m_statusBar->SetStatusText(_("Insert Capacitor: Click on a buses, ESC to cancel."));
797  Redraw();
798  } else if(event.GetModifiers() == wxMOD_CONTROL) { // Copy.
799  CopySelection();
800  }
801  }
802  } break;
803  case 'V': {
804  if(!insertingElement) {
805  if(event.GetModifiers() == wxMOD_CONTROL) {
806  Paste();
807  }
808  }
809  } break;
810  default:
811  break;
812  }
813  }
814 
815  UpdateStatusBar();
816  event.Skip();
817 }
818 
819 void Workspace::UpdateStatusBar()
820 {
821  switch(m_mode) {
822  case MODE_DRAG: {
823  m_statusBar->SetStatusText(_("MODE: DRAG"), 1);
824  } break;
825 
826  case MODE_PASTE:
827  case MODE_DRAG_PASTE: {
828  m_statusBar->SetStatusText(_("MODE: PASTE"), 1);
829  }
830 
831  case MODE_INSERT:
832  case MODE_INSERT_TEXT:
833  case MODE_DRAG_INSERT:
834  case MODE_DRAG_INSERT_TEXT: {
835  m_statusBar->SetStatusText(_("MODE: INSERT"), 1);
836  } break;
837 
838  case MODE_MOVE_ELEMENT:
839  case MODE_MOVE_PICKBOX:
840  case MODE_MOVE_NODE:
841  case MODE_SELECTION_RECT:
842  case MODE_EDIT: {
843  m_statusBar->SetStatusText(wxT(""));
844  m_statusBar->SetStatusText(_("MODE: EDIT"), 1);
845  } break;
846  }
847 
848  m_statusBar->SetStatusText(wxString::Format(_("ZOOM: %d%%"), (int)(m_camera->GetScale() * 100.0)), 2);
849  m_statusBar->SetStatusText(
850  wxString::Format(wxT("X: %.1f Y: %.1f"), m_camera->GetMousePosition().m_x, m_camera->GetMousePosition().m_y),
851  3);
852 }
853 
854 void Workspace::OnPopupClick(wxCommandEvent& event)
855 {
856  wxMenu* menu = static_cast<wxMenu*>(event.GetEventObject());
857  Element* element = static_cast<Element*>(menu->GetClientData());
858  switch(event.GetId()) {
859  case ID_EDIT_ELEMENT: {
860  if(element->ShowForm(this, element)) UpdateTextElements();
861  } break;
862  case ID_LINE_ADD_NODE: {
863  Line* line = static_cast<Line*>(element);
864  line->AddNode(m_camera->GetMousePosition());
865  Redraw();
866  } break;
867  case ID_LINE_REMOVE_NODE: {
868  Line* line = static_cast<Line*>(element);
869  line->RemoveNode(m_camera->GetMousePosition());
870  Redraw();
871  } break;
872  case ID_ROTATE_CLOCK: {
873  element->Rotate();
874  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
875  Element* iElement = *it;
876  // Parent's element rotating...
877  for(int i = 0; i < (int)iElement->GetParentList().size(); i++) {
878  Element* parent = iElement->GetParentList()[i];
879  if(parent == element) {
880  iElement->RotateNode(parent);
881  }
882  }
883  }
884  Redraw();
885  } break;
886  case ID_ROTATE_COUNTERCLOCK: {
887  element->Rotate(false);
888  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
889  Element* iElement = *it;
890  // Parent's element rotating...
891  for(int i = 0; i < (int)iElement->GetParentList().size(); i++) {
892  Element* parent = iElement->GetParentList()[i];
893  if(parent == element) {
894  iElement->RotateNode(parent, false);
895  }
896  }
897  }
898  Redraw();
899  } break;
900  case ID_DELETE: {
901  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
902  Element* iElement = *it;
903 
904  if(element == iElement) {
905  // Remove child/parent.
906  std::vector<Element*> childList = element->GetChildList();
907  for(auto itc = childList.begin(), itEnd = childList.end(); itc != itEnd; ++itc) {
908  Element* child = *itc;
909  if(child) {
910  child->RemoveParent(element);
911  element->RemoveChild(child);
912  }
913  }
914  std::vector<Element*> parentList = element->GetParentList();
915  for(auto itp = parentList.begin(), itEnd = parentList.end(); itp != itEnd; ++itp) {
916  Element* parent = *itp;
917  if(parent) {
918  parent->RemoveChild(element);
919  }
920  }
921 
922  for(auto itt = m_textList.begin(); itt != m_textList.end(); ++itt) {
923  Text* text = *itt;
924  if(text->GetElement() == element) {
925  m_textList.erase(itt--);
926  if(text) delete text;
927  }
928  }
929 
930  m_elementList.erase(it);
931  if(element) delete element;
932  menu->SetClientData(NULL);
933  break;
934  }
935  }
936  } break;
937  }
938 }
939 
940 void Workspace::RotateSelectedElements(bool clockwise)
941 {
942  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
943  Element* element = *it;
944  // Parent's element rotating...
945  for(int i = 0; i < (int)element->GetParentList().size(); i++) {
946  Element* parent = element->GetParentList()[i];
947  if(parent) { // Check if parent is not null
948  if(parent->IsSelected()) {
949  element->RotateNode(parent, clockwise);
950  // Update the positions used on motion action, the element will not be necessarily
951  // moved.
952  element->StartMove(m_camera->GetMousePosition());
953  }
954  }
955  }
956  if(element->IsSelected()) {
957  element->Rotate(clockwise);
958  element->StartMove(m_camera->GetMousePosition());
959  }
960  }
961 
962  // Rotate text element
963  for(auto it = m_textList.begin(); it != m_textList.end(); it++) {
964  Text* text = *it;
965  if(text->IsSelected()) {
966  text->Rotate(clockwise);
967  text->StartMove(m_camera->GetMousePosition());
968  }
969  }
970  Redraw();
971 }
972 
973 void Workspace::DeleteSelectedElements()
974 {
975  // Don't set the end of the list at the loop's begin.
976  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
977  Element* element = *it;
978 
979  if(element->IsSelected()) {
980  // Remove child/parent.
981  std::vector<Element*> childList = element->GetChildList();
982  for(auto itc = childList.begin(), itEnd = childList.end(); itc != itEnd; ++itc) {
983  Element* child = *itc;
984  if(child) {
985  child->RemoveParent(element);
986  element->RemoveChild(child);
987  }
988  }
989  std::vector<Element*> parentList = element->GetParentList();
990  for(auto itp = parentList.begin(), itEnd = parentList.end(); itp != itEnd; ++itp) {
991  Element* parent = *itp;
992  if(parent) {
993  parent->RemoveChild(element);
994  }
995  }
996 
997  for(auto itt = m_textList.begin(); itt != m_textList.end(); ++itt) {
998  Text* text = *itt;
999  if(text->GetElement() == element) {
1000  m_textList.erase(itt--);
1001  if(text) delete text;
1002  }
1003  }
1004 
1005  m_elementList.erase(it--);
1006  if(element) delete element;
1007  }
1008  }
1009 
1010  for(auto it = m_textList.begin(); it != m_textList.end(); ++it) {
1011  Text* text = *it;
1012  if(text->IsSelected()) {
1013  m_textList.erase(it--);
1014  if(text) delete text;
1015  }
1016  }
1017 
1018  Redraw();
1019 }
1020 
1021 bool Workspace::GetElementsCorners(wxPoint2DDouble& leftUpCorner,
1022  wxPoint2DDouble& rightDownCorner,
1023  std::vector<Element*> elementList)
1024 {
1025  if(elementList.size() == 0) return false;
1026 
1027  elementList[0]->CalculateBoundaries(leftUpCorner, rightDownCorner);
1028 
1029  for(auto it = elementList.begin() + 1, itEnd = elementList.end(); it != itEnd; it++) {
1030  Element* element = *it;
1031  wxPoint2DDouble leftUp;
1032  wxPoint2DDouble rightDown;
1033  element->CalculateBoundaries(leftUp, rightDown);
1034  if(leftUp.m_x < leftUpCorner.m_x) leftUpCorner.m_x = leftUp.m_x;
1035  if(leftUp.m_y < leftUpCorner.m_y) leftUpCorner.m_y = leftUp.m_y;
1036  if(rightDown.m_x > rightDownCorner.m_x) rightDownCorner.m_x = rightDown.m_x;
1037  if(rightDown.m_y > rightDownCorner.m_y) rightDownCorner.m_y = rightDown.m_y;
1038  }
1039  return true;
1040 }
1041 
1042 void Workspace::Fit()
1043 {
1044  wxPoint2DDouble leftUpCorner(0, 0);
1045  wxPoint2DDouble rightDownCorner(0, 0);
1046  std::vector<Element*> elementList = GetElementList();
1047  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) {
1048  elementList.push_back(*it);
1049  }
1050 
1051  if(!GetElementsCorners(leftUpCorner, rightDownCorner, elementList)) return;
1052  wxPoint2DDouble middleCoords = (leftUpCorner + rightDownCorner) / 2.0;
1053 
1054  int width = 0.0;
1055  int height = 0.0;
1056  GetSize(&width, &height);
1057 
1058  double scaleX = double(width) / (rightDownCorner.m_x - leftUpCorner.m_x);
1059  double scaleY = double(height) / (rightDownCorner.m_y - leftUpCorner.m_y);
1060 
1061  double scale = scaleX < scaleY ? scaleX : scaleY;
1062  if(scale > m_camera->GetZoomMax()) scale = m_camera->GetZoomMax();
1063  if(scale < m_camera->GetZoomMin()) scale = m_camera->GetZoomMin();
1064 
1065  m_camera->SetScale(scale);
1066 
1067  m_camera->StartTranslation(middleCoords);
1068  m_camera->SetTranslation(wxPoint2DDouble(width / 2, height / 2));
1069  Redraw();
1070 }
1071 
1072 void Workspace::ValidateBusesVoltages(Element* initialBus)
1073 {
1074  double nominalVoltage = static_cast<Bus*>(initialBus)->GetElectricalData().nominalVoltage;
1075  ElectricalUnit nominalVoltageUnit = static_cast<Bus*>(initialBus)->GetElectricalData().nominalVoltageUnit;
1076 
1077  for(auto it = m_elementList.begin(); it != m_elementList.end(); it++) {
1078  Element* child = *it;
1079 
1080  if(typeid(*child) == typeid(Line)) {
1081  if(child->GetParentList()[0] && child->GetParentList()[1]) {
1082  BusElectricalData data1 = static_cast<Bus*>(child->GetParentList()[0])->GetElectricalData();
1083  BusElectricalData data2 = static_cast<Bus*>(child->GetParentList()[1])->GetElectricalData();
1084 
1085  if(data1.nominalVoltage != data2.nominalVoltage ||
1086  data1.nominalVoltageUnit != data2.nominalVoltageUnit) {
1087  data1.nominalVoltage = nominalVoltage;
1088  data2.nominalVoltage = nominalVoltage;
1089  data1.nominalVoltageUnit = nominalVoltageUnit;
1090  data2.nominalVoltageUnit = nominalVoltageUnit;
1091 
1092  static_cast<Bus*>(child->GetParentList()[0])->SetElectricalData(data1);
1093  static_cast<Bus*>(child->GetParentList()[1])->SetElectricalData(data2);
1094 
1095  it = m_elementList.begin(); // Restart search.
1096  }
1097  }
1098  }
1099  }
1100 
1101  // ValidateElementsVoltages();
1102 }
1103 
1104 void Workspace::ValidateElementsVoltages()
1105 {
1106  for(auto it = m_elementList.begin(); it != m_elementList.end(); it++) {
1107  PowerElement* child = *it;
1108 
1109  std::vector<double> nominalVoltage;
1110  std::vector<ElectricalUnit> nominalVoltageUnit;
1111  for(int i = 0; i < (int)child->GetParentList().size(); i++) {
1112  Bus* parent = static_cast<Bus*>(child->GetParentList()[i]);
1113  if(parent) {
1114  nominalVoltage.push_back(parent->GetElectricalData().nominalVoltage);
1115  nominalVoltageUnit.push_back(parent->GetElectricalData().nominalVoltageUnit);
1116  }
1117  }
1118  child->SetNominalVoltage(nominalVoltage, nominalVoltageUnit);
1119  }
1120 }
1121 
1122 bool Workspace::RunPowerFlow()
1123 {
1124  PowerFlow pf(GetElementList());
1125  bool result = pf.RunGaussSeidel();
1126  if(!result) {
1127  wxMessageDialog msgDialog(this, pf.GetErrorMessage(), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
1128  msgDialog.ShowModal();
1129  }
1130 
1131  UpdateTextElements();
1132  Redraw();
1133 
1134  return result;
1135 }
1136 
1137 void Workspace::UpdateTextElements()
1138 {
1139  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) {
1140  Text* text = *it;
1141  text->UpdateText(m_properties->GetSimulationPropertiesData().basePower);
1142  }
1143 }
1144 
1145 void Workspace::CopySelection()
1146 {
1147  UpdateElementsID();
1148  std::vector<Element*> selectedElements;
1149  // The buses need to be numerated to associate the child's parents to the copies.
1150  int busNumber = 0;
1151  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
1152  Element* element = *it;
1153  if(typeid(*element) == typeid(Bus)) {
1154  Bus* bus = static_cast<Bus*>(element);
1155  auto data = bus->GetElectricalData();
1156  data.number = busNumber;
1157  bus->SetElectricalData(data);
1158  busNumber++;
1159  }
1160  if(element->IsSelected()) {
1161  selectedElements.push_back(element);
1162  }
1163  }
1164  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) {
1165  Text* text = *it;
1166  if(text->IsSelected()) {
1167  selectedElements.push_back(text);
1168  }
1169  }
1170  ElementDataObject* dataObject = new ElementDataObject(selectedElements);
1171  wxTheClipboard->SetData(dataObject);
1172  wxTheClipboard->Close();
1173 }
1174 
1175 bool Workspace::Paste()
1176 {
1177  if(wxTheClipboard->Open()) {
1178  ElementDataObject dataObject;
1179 
1180  if(wxTheClipboard->IsSupported(wxDataFormat("PSPCopy"))) {
1181  if(!wxTheClipboard->GetData(dataObject)) {
1182  wxMessageDialog dialog(this, _("It was not possible to paste from clipboard."), _("Error"),
1183  wxOK | wxCENTER | wxICON_ERROR, wxDefaultPosition);
1184  dialog.ShowModal();
1185  wxTheClipboard->Close();
1186  return false;
1187  }
1188  } else {
1189  wxTheClipboard->Close();
1190  return false;
1191  }
1192  wxTheClipboard->Close();
1193 
1194  UnselectAll();
1195 
1196  std::vector<Element*> pastedElements;
1197  ElementsLists* elementsLists = dataObject.GetElementsLists();
1198 
1199  // Paste buses (parents).
1200  auto parentList = elementsLists->parentList;
1201  std::vector<Bus*> pastedBusList; // To set new parents;
1202  for(auto it = parentList.begin(), itEnd = parentList.end(); it != itEnd; ++it) {
1203  Element* copy = (*it)->GetCopy();
1204  if(copy) {
1205  pastedElements.push_back(copy);
1206  pastedBusList.push_back(static_cast<Bus*>(copy));
1207  m_elementList.push_back(static_cast<PowerElement*>(copy));
1208  }
1209  }
1210 
1211  // Paste other elements.
1212  auto elementLists = elementsLists->elementList;
1213  for(auto it = elementLists.begin(), itEnd = elementLists.end(); it != itEnd; ++it) {
1214  Element* copy = (*it)->GetCopy();
1215  if(copy) {
1216  // Check if is text element
1217  if(Text* text = dynamic_cast<Text*>(copy)) {
1218  // Check if element associated with the text exists.
1219  bool elementExist = false;
1220  for(int i = 0; i < (int)m_elementList.size(); i++) {
1221  if(text->GetElement() == m_elementList[i]) {
1222  elementExist = true;
1223  break;
1224  }
1225  }
1226  if(elementExist) {
1227  pastedElements.push_back(copy);
1228  m_textList.push_back(text);
1229  }
1230  } else {
1231  // Change the parent if copied, otherwise remove it.
1232  for(int j = 0; j < (int)copy->GetParentList().size(); j++) {
1233  Bus* currentParent = static_cast<Bus*>(copy->GetParentList()[j]);
1234  if(currentParent) {
1235  int parentID = currentParent->GetID();
1236  bool parentCopied = false;
1237  for(int k = 0; k < (int)pastedBusList.size(); k++) {
1238  Bus* newParent = pastedBusList[k];
1239  if(parentID == newParent->GetID()) {
1240  parentCopied = true;
1241  copy->ReplaceParent(currentParent, newParent);
1242  break;
1243  }
1244  }
1245  if(!parentCopied) copy->RemoveParent(currentParent);
1246  }
1247  }
1248 
1249  pastedElements.push_back(copy);
1250  m_elementList.push_back(static_cast<PowerElement*>(copy));
1251  }
1252  }
1253  }
1254 
1255  // Update buses childs
1256  for(auto it = pastedBusList.begin(), itEnd = pastedBusList.end(); it != itEnd; ++it) {
1257  Bus* bus = *it;
1258  std::vector<Element*> childList = bus->GetChildList();
1259  for(auto it = childList.begin(), itEnd = childList.end(); it != itEnd; ++it) {
1260  Element* currentChild = *it;
1261  int childID = currentChild->GetID();
1262  bool childCopied = false;
1263  for(int i = 0; i < (int)pastedElements.size(); i++) {
1264  Element* newChild = pastedElements[i];
1265  if(childID == newChild->GetID()) {
1266  childCopied = true;
1267  bus->ReplaceChild(currentChild, newChild);
1268  break;
1269  }
1270  }
1271  if(!childCopied) bus->RemoveChild(currentChild);
1272  }
1273  }
1274 
1275  // Move elements (and nodes) to the mouse position.
1276  // The start position it's the center of the pasted objects.
1277  wxPoint2DDouble leftUpCorner, rightDownCorner;
1278  GetElementsCorners(leftUpCorner, rightDownCorner, pastedElements);
1279  wxPoint2DDouble startPosition = (leftUpCorner + rightDownCorner) / 2.0;
1280  for(auto it = pastedElements.begin(), itEnd = pastedElements.end(); it != itEnd; ++it) {
1281  Element* element = *it;
1282  element->StartMove(startPosition);
1283  element->Move(m_camera->GetMousePosition());
1284  for(int i = 0; i < (int)element->GetParentList().size(); i++) {
1285  Element* parent = element->GetParentList()[i];
1286  element->MoveNode(parent, m_camera->GetMousePosition());
1287  }
1288  }
1289  } else {
1290  wxMessageDialog dialog(this, _("It was not possible to paste from clipboard."), _("Error"),
1291  wxOK | wxCENTER | wxICON_ERROR, wxDefaultPosition);
1292  dialog.ShowModal();
1293  return false;
1294  }
1295 
1296  UpdateElementsID();
1297  m_mode = MODE_PASTE;
1298  m_statusBar->SetStatusText(_("Click to paste."));
1299  UpdateStatusBar();
1300  Redraw();
1301  return true;
1302 }
1303 
1304 void Workspace::UnselectAll()
1305 {
1306  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; it++) {
1307  Element* element = *it;
1308  element->SetSelected(false);
1309  }
1310  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; it++) {
1311  Text* text = *it;
1312  text->SetSelected(false);
1313  }
1314 }
1315 
1316 void Workspace::UpdateElementsID()
1317 {
1318  int id = 0;
1319  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
1320  Element* element = *it;
1321  element->SetID(id);
1322  id++;
1323  }
1324  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) {
1325  Text* text = *it;
1326  text->SetID(id);
1327  id++;
1328  }
1329 }
1330 void Workspace::OnTimer(wxTimerEvent& event)
1331 {
1332  if(m_tipWindow) {
1333  m_tipWindow->Close();
1334  m_tipWindow = NULL;
1335  }
1336  if(m_mode == MODE_EDIT) {
1337  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
1338  Element* element = *it;
1339  if(element->Contains(m_camera->GetMousePosition())) {
1340  wxString tipText = element->GetTipText();
1341  if(!tipText.IsEmpty()) {
1342  m_tipWindow = new wxTipWindow(this, tipText, 10000, &m_tipWindow);
1343  // Creates a very tiny bounding rect to remove the tip on any mouse movement.
1344  m_tipWindow->SetBoundingRect(wxRect(wxGetMousePosition(), wxSize(1, 1)));
1345  break;
1346  }
1347  }
1348  }
1349  }
1350 
1351  m_timer->Stop();
1352 }
1353 
1354 void Workspace::SetTextList(std::vector<Text*> textList)
1355 {
1356  m_textList.clear();
1357  for(auto it = textList.begin(), itEnd = textList.end(); it != itEnd; ++it) m_textList.push_back(*it);
1358 
1359  UpdateTextElements();
1360 }
1361 
1362 void Workspace::SetElementList(std::vector<Element*> elementList)
1363 {
1364  m_elementList.clear();
1365  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it)
1366  m_elementList.push_back(static_cast<PowerElement*>(*it));
1367 }
1368 
1369 void Workspace::OnIdle(wxIdleEvent& event)
1370 {
1371  // TODO: Find other solution to text displayed wrong on opened file.
1372  if(m_justOpened) {
1373  m_justOpened = false;
1374  UpdateTextElements();
1375  Redraw();
1376  }
1377 }
1378 
1379 std::vector<Element*> Workspace::GetAllElements() const
1380 {
1381  std::vector<Element*> allElements;
1382 
1383  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) allElements.push_back(*it);
1384  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) allElements.push_back(*it);
1385 
1386  return allElements;
1387 }
1388 
1389 bool Workspace::RunFault()
1390 {
1391  Fault fault(GetElementList());
1392  bool result = fault.RunFaultCalculation(100e6);
1393  if(!result) {
1394  wxMessageDialog msgDialog(this, fault.GetErrorMessage(), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
1395  msgDialog.ShowModal();
1396  }
1397 
1398  UpdateTextElements();
1399  Redraw();
1400 
1401  return result;
1402 }
1403 
1404 std::vector<Element*> Workspace::GetElementList() const
1405 {
1406  std::vector<Element*> elementList;
1407  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) elementList.push_back(*it);
1408  return elementList;
1409 }
1410 
1411 bool Workspace::RunSCPower()
1412 {
1413  Fault fault(GetElementList());
1414  bool result = fault.RunSCPowerCalcutation(100e6);
1415  if(!result) {
1416  wxMessageDialog msgDialog(this, fault.GetErrorMessage(), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
1417  msgDialog.ShowModal();
1418  }
1419 
1420  UpdateTextElements();
1421  Redraw();
1422 
1423  return result;
1424 }
1425 
1426 bool Workspace::RunStability()
1427 {
1428  // Run power flow before stability.
1429  RunPowerFlow();
1430 
1431  Electromechanical stability(this, GetElementList(), m_properties->GetSimulationPropertiesData());
1432  bool result = stability.RunStabilityCalculation();
1433  if(!result) {
1434  wxMessageDialog msgDialog(this, stability.GetErrorMessage(), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
1435  msgDialog.ShowModal();
1436  }
1437  m_stabilityTimeVector.clear();
1438  m_stabilityTimeVector = stability.GetTimeVector();
1439 
1440  // Run power flow after stability.
1441  RunPowerFlow();
1442 
1443  wxMessageDialog msgDialog(this, _("Do you wish to open the stability graphics?"), _("Question"),
1444  wxYES_NO | wxCENTRE | wxICON_QUESTION);
1445  if(msgDialog.ShowModal() == wxID_YES) {
1446  std::vector<ElementPlotData> plotDataList;
1447  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
1448  PowerElement* element = *it;
1449  ElementPlotData plotData;
1450  if(element->GetPlotData(plotData)) plotDataList.push_back(plotData);
1451  }
1452  ElementPlotData tests(_("Error"), ElementPlotData::CT_TEST);
1453  tests.AddData(stability.m_wErrorVector, _("Speed error"));
1454  tests.AddData(stability.m_numItVector, _("Number iterations"));
1455  plotDataList.push_back(tests);
1456 
1457  ChartView* cView = new ChartView(this, plotDataList, m_stabilityTimeVector);
1458  cView->Show();
1459  }
1460 
1461  return result;
1462 }
1463 void Workspace::OnMiddleDoubleClick(wxMouseEvent& event)
1464 {
1465  Fit();
1466  event.Skip();
1467 }
1468 
1469 bool Workspace::RunStaticStudies()
1470 {
1471  bool pfStatus, faultStatus, scStatus;
1472  pfStatus = faultStatus = scStatus = false;
1473 
1474  pfStatus = RunPowerFlow();
1475 
1476  if(m_properties->GetSimulationPropertiesData().faultAfterPowerFlow) {
1477  if(pfStatus) faultStatus = RunFault();
1478  } else {
1479  faultStatus = true;
1480  }
1481 
1482  if(m_properties->GetSimulationPropertiesData().scPowerAfterPowerFlow) {
1483  if(pfStatus) scStatus = RunSCPower();
1484  } else {
1485  scStatus = true;
1486  }
1487 
1488  if(pfStatus && faultStatus && scStatus) return true;
1489 
1490  return false;
1491 }
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Text.cpp:30
-
Definition: Text.h:48
-
void ShowPickbox(bool showPickbox=true)
Set if the pickbox is shown.
Definition: Element.h:141
- -
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Element.cpp:107
-
virtual void AddPoint(wxPoint2DDouble point)
Add point to the list of points that connect the element to the bus.
Definition: Element.h:321
- -
void SetSelected(bool selected=true)
Set element selection.
Definition: Element.h:123
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Text.cpp:145
-
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:517
- -
virtual std::vector< Element * > GetChildList() const
Get the Child list.
Definition: Element.h:523
-
virtual void ResetPickboxes()
Remove the pickboxes.
Definition: Element.h:406
- -
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Element.h:348
-
bool SetOnline(bool online=true)
Set if the element is online or offline.
Definition: Element.cpp:218
-
virtual bool PickboxContains(wxPoint2DDouble position)
Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be c...
Definition: Element.h:389
-
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Element.h:353
-
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
- -
virtual void RemoveChild(Element *child)
Remove a child from the list.
Definition: Element.cpp:335
- -
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Text.cpp:75
- +
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Workspace.h"
19 #include "Camera.h"
20 #include "Element.h"
21 //#include "Bus.h"
22 #include "Line.h"
23 #include "Transformer.h"
24 #include "SyncGenerator.h"
25 #include "IndMotor.h"
26 #include "SyncMotor.h"
27 #include "Load.h"
28 #include "Inductor.h"
29 #include "Capacitor.h"
30 #include "ElementDataObject.h"
31 
32 #include "Text.h"
33 
34 #include "PowerFlow.h"
35 #include "Fault.h"
36 #include "Electromechanical.h"
37 
38 #include "ElementPlotData.h"
39 #include "ChartView.h"
40 
41 #include "PropertiesData.h"
42 
43 // Workspace
44 Workspace::Workspace() : WorkspaceBase(NULL) {}
45 Workspace::Workspace(wxWindow* parent, wxString name, wxStatusBar* statusBar) : WorkspaceBase(parent)
46 {
47  m_timer->Start();
48  m_name = name;
49  m_statusBar = statusBar;
50  m_glContext = new wxGLContext(m_glCanvas);
51  m_camera = new Camera();
52  m_selectionRect = wxRect2DDouble(0, 0, 0, 0);
53 
54  for(int i = 0; i < NUM_ELEMENTS; ++i) {
55  m_elementNumber[i] = 1;
56  }
57 
58  const int widths[4] = {-3, -1, 100, 100};
59  m_statusBar->SetStatusWidths(4, widths);
60 
61  m_properties = new PropertiesData();
62 }
63 
64 Workspace::~Workspace()
65 {
66  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
67  if(*it) delete *it;
68  }
69  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) {
70  if(*it) delete *it;
71  }
72  if(m_camera) delete m_camera;
73  if(m_glContext) delete m_glContext;
74  if(m_tipWindow) delete m_tipWindow;
75  if(m_properties) delete m_properties;
76 }
77 
78 void Workspace::OnPaint(wxPaintEvent& event)
79 {
80  wxPaintDC dc(m_glCanvas);
81  m_glContext->SetCurrent(*m_glCanvas);
82  SetViewport();
83 
84  // Set GLCanvas scale and translation.
85  glScaled(m_camera->GetScale(), m_camera->GetScale(), 0.0); // Scale
86  glTranslated(m_camera->GetTranslation().m_x, m_camera->GetTranslation().m_y, 0.0); // Translation
87 
88  // Draw
89 
90  // Elements
91  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
92  Element* element = *it;
93  element->Draw(m_camera->GetTranslation(), m_camera->GetScale());
94  }
95 
96  // Texts
97  for(auto it = m_textList.begin(); it != m_textList.end(); ++it) {
98  Text* text = *it;
99  text->Draw(m_camera->GetTranslation(), m_camera->GetScale());
100  }
101 
102  // Selection rectangle
103  glLineWidth(1.0);
104  glColor4d(0.0, 0.5, 1.0, 1.0);
105  glBegin(GL_LINE_LOOP);
106  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y);
107  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y + m_selectionRect.m_height);
108  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y + m_selectionRect.m_height);
109  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y);
110  glEnd();
111  glColor4d(0.0, 0.5, 1.0, 0.3);
112  glBegin(GL_QUADS);
113  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y);
114  glVertex2d(m_selectionRect.m_x, m_selectionRect.m_y + m_selectionRect.m_height);
115  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y + m_selectionRect.m_height);
116  glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y);
117  glEnd();
118 
119  glFlush(); // Sends all pending information directly to the GPU.
120  m_glCanvas->SwapBuffers();
121  event.Skip();
122 }
123 
124 void Workspace::SetViewport()
125 {
126  glClearColor(1.0, 1.0, 1.0, 1.0); // White background.
127  glClear(GL_COLOR_BUFFER_BIT);
128  glDisable(GL_DEPTH_TEST);
129  glDisable(GL_TEXTURE_2D);
130  glEnable(GL_COLOR_MATERIAL);
131  glEnable(GL_BLEND);
132  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
133  glEnable(GL_LINE_SMOOTH);
134 
135  double width = m_glCanvas->GetSize().x - 1;
136  double height = m_glCanvas->GetSize().y - 1;
137 
138  // Viewport fit the screen.
139  glViewport(0, 0, width, height);
140 
141  glMatrixMode(GL_PROJECTION);
142  glLoadIdentity();
143  gluOrtho2D(0.0, width, height, 0.0);
144 
145  glMatrixMode(GL_MODELVIEW);
146  glLoadIdentity();
147 }
148 
149 void Workspace::OnLeftClickDown(wxMouseEvent& event)
150 {
151  wxPoint clickPoint = event.GetPosition();
152  bool foundElement = false;
153  Element* newElement = NULL;
154  bool showNewElementForm = false;
155  bool clickOnSwitch = false;
156  if(m_mode == MODE_INSERT_TEXT || m_mode == MODE_PASTE || m_mode == MODE_DRAG_PASTE) {
157  m_mode = MODE_EDIT;
158  } else if(m_mode == MODE_INSERT || m_mode == MODE_DRAG_INSERT || m_mode == MODE_DRAG_INSERT_TEXT) {
159  // Get the last element inserted on the list.
160  newElement = *(m_elementList.end() - 1);
161  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
162  Element* element = *it;
163  // Clicked in any element.
164  if(element->Contains(m_camera->ScreenToWorld(clickPoint))) {
165  // Click at a bus.
166  if(typeid(*element) == typeid(Bus)) {
167  // Select the bus.
168  element->SetSelected();
169  foundElement = true; // Element found.
170  // Add the new element's parent. If the element being inserted returns true, back to
171  // edit mode.
172  if(newElement->AddParent(element, m_camera->ScreenToWorld(clickPoint))) {
173  ValidateElementsVoltages();
174  m_timer->Stop();
175  showNewElementForm = true;
176  m_mode = MODE_EDIT;
177  }
178  }
179  }
180  }
181  // The line element can have an indefined number of points.
182  if(!foundElement) {
183  if(typeid(*newElement) == typeid(Line)) {
184  newElement->AddPoint(m_camera->ScreenToWorld(clickPoint));
185  }
186  }
187  foundElement = true;
188  } else {
189  bool clickPickbox = false;
190  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
191  PowerElement* element = *it;
192  element->ResetPickboxes(); // Reset pickbox state.
193 
194  // Set movement initial position (not necessarily will be moved).
195  element->StartMove(m_camera->ScreenToWorld(clickPoint));
196 
197  // Click in selected element node.
198  if(element->NodeContains(m_camera->ScreenToWorld(clickPoint)) != 0 && element->IsSelected()) {
199  m_mode = MODE_MOVE_NODE;
200  m_disconnectedElement = true;
201  foundElement = true;
202  }
203 
204  // Click in an element.
205  else if(element->Contains(m_camera->ScreenToWorld(clickPoint))) {
206  if(!foundElement) {
207  // Select and show pickbox.
208  element->SetSelected();
209  element->ShowPickbox();
210  foundElement = true;
211  }
212  // If pickbox contains the click, move the pickbox
213  if(element->PickboxContains(m_camera->ScreenToWorld(clickPoint))) {
214  m_mode = MODE_MOVE_PICKBOX;
215  clickPickbox = true;
216  }
217  // If didn't found a pickbox, move the element
218  if(!clickPickbox) {
219  m_mode = MODE_MOVE_ELEMENT;
220  }
221  }
222 
223  // Click in a switch.
224  else if(element->SwitchesContains(m_camera->ScreenToWorld(clickPoint))) {
225  element->SetOnline(element->IsOnline() ? false : true);
226  clickOnSwitch = true;
227  }
228  }
229 
230  // Text element
231  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) {
232  Text* text = *it;
233 
234  text->StartMove(m_camera->ScreenToWorld(clickPoint));
235 
236  if(text->Contains(m_camera->ScreenToWorld(clickPoint))) {
237  if(!foundElement) {
238  text->SetSelected();
239  m_mode = MODE_MOVE_ELEMENT;
240  foundElement = true;
241  }
242  }
243  }
244  }
245 
246  if(!foundElement) {
247  m_mode = MODE_SELECTION_RECT;
248  m_startSelRect = m_camera->ScreenToWorld(clickPoint);
249  }
250 
251  Redraw();
252  UpdateStatusBar();
253 
254  if(showNewElementForm) {
255  if(newElement) {
256  newElement->ShowForm(this, newElement);
257  if(m_continuousCalc) RunStaticStudies();
258  }
259  }
260  if(clickOnSwitch && m_continuousCalc) RunStaticStudies();
261 
262  event.Skip();
263 }
264 
265 void Workspace::OnLeftDoubleClick(wxMouseEvent& event)
266 {
267  bool elementEdited = false;
268  bool clickOnSwitch = false;
269  bool redraw = false;
270 
271  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
272  PowerElement* element = *it;
273 
274  // Click in an element.
275  if(element->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
276  bool elementIsBus = false;
277  Bus oldBus;
278  Bus* currentBus = NULL;
279  if((currentBus = dynamic_cast<Bus*>(element))) {
280  elementIsBus = true;
281  oldBus = *currentBus;
282  }
283  m_timer->Stop();
284  element->ShowForm(this, element);
285  elementEdited = true;
286  redraw = true;
287 
288  // If the edited element is a bus and was changed the rated voltage, this voltage must be
289  // propagated through the lines
290  if(elementIsBus) {
291  // The voltage was changed
292  if(oldBus.GetElectricalData().nominalVoltage != currentBus->GetElectricalData().nominalVoltage ||
293  oldBus.GetElectricalData().nominalVoltageUnit !=
294  currentBus->GetElectricalData().nominalVoltageUnit) {
295  // Check if the bus has line as child.
296  std::vector<Element*> childList = element->GetChildList();
297  for(auto itc = childList.begin(), itcEnd = childList.end(); itc != itcEnd; ++itc) {
298  Element* child = *itc;
299  if(typeid(*child) == typeid(Line)) {
300  wxMessageDialog msgDialog(this, _("Do you want to change the rated voltage of the path?"),
301  _("Warning"), wxYES_NO | wxCENTRE | wxICON_WARNING);
302  if(msgDialog.ShowModal() == wxID_YES)
303  ValidateBusesVoltages(element);
304  else {
305  auto data = currentBus->GetElectricalData();
306  data.nominalVoltage = oldBus.GetElectricalData().nominalVoltage;
307  data.nominalVoltageUnit = oldBus.GetElectricalData().nominalVoltageUnit;
308  currentBus->SetElectricalData(data);
309  }
310  break;
311  }
312  }
313  }
314  ValidateElementsVoltages();
315  }
316  }
317 
318  // Click in a switch.
319  else if(element->SwitchesContains(m_camera->ScreenToWorld(event.GetPosition()))) {
320  element->SetOnline(element->IsOnline() ? false : true);
321  clickOnSwitch = true;
322  }
323  }
324 
325  // Text element
326  for(auto it = m_textList.begin(); it != m_textList.end(); ++it) {
327  Text* text = *it;
328  if(text->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
329  text->ShowForm(this, GetElementList());
330  redraw = true;
331  }
332  }
333  if(elementEdited) {
334  UpdateTextElements();
335  if(m_continuousCalc) RunStaticStudies();
336  }
337  if(clickOnSwitch && m_continuousCalc) RunStaticStudies();
338 
339  if(redraw) Redraw();
340  m_timer->Start();
341 }
342 
343 void Workspace::OnRightClickDown(wxMouseEvent& event)
344 {
345  bool redraw = false;
346  if(m_mode == MODE_EDIT) {
347  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
348  Element* element = *it;
349  if(element->IsSelected()) {
350  // Show context menu.
351  if(element->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
352  element->ShowPickbox(false);
353  wxMenu menu;
354  if(element->GetContextMenu(menu)) {
355  m_timer->Stop();
356  menu.SetClientData(element);
357  menu.Bind(wxEVT_COMMAND_MENU_SELECTED, &Workspace::OnPopupClick, this);
358  PopupMenu(&menu);
359  redraw = true;
360 
361  if(!menu.GetClientData()) break;
362  }
363  element->ResetPickboxes();
364  }
365  }
366  }
367  }
368  if(redraw) Redraw();
369  m_timer->Start();
370 }
371 
372 void Workspace::OnLeftClickUp(wxMouseEvent& event)
373 {
374  // This event (under certain conditions) deselects the elements and back to edit mode or select the elements using
375  // the selection rectangle.
376  bool foundPickbox = false;
377  bool findNewParent = false;
378  bool updateVoltages = false;
379  auto itnp = m_elementList.begin();
380 
381  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
382  Element* element = *it;
383 
384  // The user was moving a pickbox.
385  if(m_mode == MODE_MOVE_PICKBOX) {
386  // Catch only the element that have the pickbox shown.
387  if(element->IsPickboxShown()) {
388  // If the element is a bus, check if a node is outside.
389  if(typeid(*element) == typeid(Bus)) {
390  // Get all the bus children.
391  for(int i = 0; i < (int)m_elementList.size(); i++) {
392  Element* child = m_elementList[i];
393  for(int j = 0; j < (int)child->GetParentList().size(); j++) {
394  Element* parent = child->GetParentList()[j];
395  // The child have a parent that is the element.
396  if(parent == element) {
397  child->UpdateNodes();
398  m_disconnectedElement = true;
399  }
400  }
401  }
402  }
403  }
404  }
405 
406  if(m_mode == MODE_SELECTION_RECT) {
407  if(element->Intersects(m_selectionRect)) {
408  element->SetSelected();
409  } else if(!event.ControlDown()) {
410  element->SetSelected(false);
411  }
412  } else if(m_mode == MODE_MOVE_NODE) {
413  if(element->IsSelected()) {
414  for(int i = 0; i < (int)m_elementList.size(); i++) {
415  Element* parent = m_elementList[i];
416  if(typeid(*parent) == typeid(Bus)) {
417  if(element->SetNodeParent(parent)) {
418  parent->AddChild(element);
419  findNewParent = true;
420  itnp = it;
421  element->ResetNodes();
422  break;
423  }
424  }
425  }
426  // element->ResetNodes();
427  }
428  } else {
429  // Deselect
430  if(!event.ControlDown()) {
431  if(!element->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
432  element->SetSelected(false);
433  }
434  }
435 
436  if(element->PickboxContains(m_camera->ScreenToWorld(event.GetPosition()))) {
437  foundPickbox = true;
438  } else {
439  element->ShowPickbox(false);
440  element->ResetPickboxes();
441  }
442  }
443  }
444 
445  // Text element
446  for(auto it = m_textList.begin(); it != m_textList.end(); it++) {
447  Text* text = *it;
448  if(m_mode == MODE_SELECTION_RECT) {
449  if(text->Intersects(m_selectionRect)) {
450  text->SetSelected();
451  } else if(!event.ControlDown()) {
452  text->SetSelected(false);
453  }
454  } else if(!event.ControlDown()) {
455  if(!text->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
456  text->SetSelected(false);
457  }
458  }
459  }
460 
461  if(findNewParent) {
462  std::rotate(itnp, itnp + 1, m_elementList.end());
463  updateVoltages = true;
464  }
465  if(!foundPickbox) {
466  SetCursor(wxCURSOR_ARROW);
467  }
468 
469  if(m_mode != MODE_INSERT) {
470  m_mode = MODE_EDIT;
471  }
472 
473  if(updateVoltages) {
474  ValidateElementsVoltages();
475  }
476 
477  if(m_continuousCalc && m_disconnectedElement) {
478  m_disconnectedElement = false;
479  RunStaticStudies();
480  }
481 
482  m_selectionRect = wxRect2DDouble(0, 0, 0, 0);
483  Redraw();
484  UpdateStatusBar();
485 }
486 
487 void Workspace::OnMouseMotion(wxMouseEvent& event)
488 {
489  bool redraw = false;
490  switch(m_mode) {
491  case MODE_INSERT: {
492  Element* newElement = *(m_elementList.end() - 1); // Get the last element in the list.
493  newElement->SetPosition(m_camera->ScreenToWorld(event.GetPosition()));
494  redraw = true;
495  } break;
496 
497  case MODE_INSERT_TEXT: {
498  Text* newText = *(m_textList.end() - 1);
499  newText->SetPosition(m_camera->ScreenToWorld(event.GetPosition()));
500  redraw = true;
501  } break;
502 
503  case MODE_DRAG:
504  case MODE_DRAG_INSERT:
505  case MODE_DRAG_INSERT_TEXT:
506  case MODE_DRAG_PASTE: {
507  m_camera->SetTranslation(event.GetPosition());
508  redraw = true;
509  } break;
510 
511  case MODE_EDIT: {
512  bool foundPickbox = false;
513  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
514  Element* element = *it;
515  if(element->IsSelected()) {
516  // Show element pickbox (when it has) if the mouse is over the selected object.
517  if(element->Contains(m_camera->ScreenToWorld(event.GetPosition()))) {
518  element->ShowPickbox();
519  redraw = true;
520 
521  // If the mouse is over a pickbox set correct mouse cursor.
522  if(element->PickboxContains(m_camera->ScreenToWorld(event.GetPosition()))) {
523  foundPickbox = true;
524  SetCursor(element->GetBestPickboxCursor());
525  } else if(!foundPickbox) {
526  SetCursor(wxCURSOR_ARROW);
527  element->ResetPickboxes();
528  }
529  } else if(!foundPickbox) {
530  if(element->IsPickboxShown()) redraw = true;
531 
532  element->ShowPickbox(false);
533  element->ResetPickboxes();
534  SetCursor(wxCURSOR_ARROW);
535  }
536  }
537  }
538  } break;
539 
540  case MODE_MOVE_NODE: {
541  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
542  Element* element = *it;
543  if(element->IsSelected()) {
544  element->MoveNode(NULL, m_camera->ScreenToWorld(event.GetPosition()));
545  redraw = true;
546  }
547  }
548  } break;
549 
550  case MODE_MOVE_PICKBOX: {
551  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
552  Element* element = *it;
553  if(element->IsSelected()) {
554  element->MovePickbox(m_camera->ScreenToWorld(event.GetPosition()));
555  redraw = true;
556  }
557  }
558  } break;
559 
560  case MODE_MOVE_ELEMENT:
561  case MODE_PASTE: {
562  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
563  Element* element = *it;
564  if(element->IsSelected()) {
565  element->Move(m_camera->ScreenToWorld(event.GetPosition()));
566  // Move child nodes
567  std::vector<Element*> childList = element->GetChildList();
568  for(auto it = childList.begin(), itEnd = childList.end(); it != itEnd; ++it) {
569  (*it)->MoveNode(element, m_camera->ScreenToWorld(event.GetPosition()));
570  }
571  redraw = true;
572  }
573  }
574  // Text element motion
575  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; it++) {
576  Text* text = *it;
577  if(text->IsSelected()) {
578  text->Move(m_camera->ScreenToWorld(event.GetPosition()));
579  redraw = true;
580  }
581  }
582  } break;
583 
584  case MODE_SELECTION_RECT: {
585  wxPoint2DDouble currentPos = m_camera->ScreenToWorld(event.GetPosition());
586  double x, y, w, h;
587  if(currentPos.m_x < m_startSelRect.m_x) {
588  x = currentPos.m_x;
589  w = m_startSelRect.m_x - currentPos.m_x;
590  } else {
591  x = m_startSelRect.m_x;
592  w = currentPos.m_x - m_startSelRect.m_x;
593  }
594  if(currentPos.m_y < m_startSelRect.m_y) {
595  y = currentPos.m_y;
596  h = m_startSelRect.m_y - currentPos.m_y;
597  } else {
598  y = m_startSelRect.m_y;
599  h = currentPos.m_y - m_startSelRect.m_y;
600  }
601 
602  m_selectionRect = wxRect2DDouble(x, y, w, h);
603  redraw = true;
604  } break;
605  }
606 
607  if(redraw) Redraw();
608  m_camera->UpdateMousePosition(event.GetPosition());
609  UpdateStatusBar();
610  m_timer->Start(); // Restart the timer.
611  event.Skip();
612 }
613 
614 void Workspace::OnMiddleDown(wxMouseEvent& event)
615 {
616  // Set to drag mode.
617  switch(m_mode) {
618  case MODE_INSERT: {
619  m_mode = MODE_DRAG_INSERT;
620  } break;
621  case MODE_INSERT_TEXT: {
622  m_mode = MODE_DRAG_INSERT_TEXT;
623  } break;
624  case MODE_PASTE: {
625  m_mode = MODE_DRAG_PASTE;
626  } break;
627  default: {
628  m_mode = MODE_DRAG;
629  } break;
630  }
631  m_camera->StartTranslation(m_camera->ScreenToWorld(event.GetPosition()));
632  UpdateStatusBar();
633  event.Skip();
634 }
635 
636 void Workspace::OnMiddleUp(wxMouseEvent& event)
637 {
638  switch(m_mode) {
639  case MODE_DRAG_INSERT: {
640  m_mode = MODE_INSERT;
641  } break;
642  case MODE_DRAG_INSERT_TEXT: {
643  m_mode = MODE_INSERT_TEXT;
644  } break;
645  case MODE_DRAG_PASTE: {
646  m_mode = MODE_PASTE;
647  } break;
648  case MODE_INSERT:
649  case MODE_INSERT_TEXT:
650  case MODE_PASTE: {
651  // Does nothing.
652  } break;
653  default: {
654  m_mode = MODE_EDIT;
655  } break;
656  }
657  UpdateStatusBar();
658  event.Skip();
659 }
660 
661 void Workspace::OnScroll(wxMouseEvent& event)
662 {
663  if(event.GetWheelRotation() > 0)
664  m_camera->SetScale(event.GetPosition(), +0.05);
665  else
666  m_camera->SetScale(event.GetPosition(), -0.05);
667 
668  UpdateStatusBar();
669  Redraw();
670 }
671 
672 void Workspace::OnKeyDown(wxKeyEvent& event)
673 {
674  bool insertingElement = false;
675  if(m_mode == MODE_INSERT || m_mode == MODE_INSERT_TEXT) insertingElement = true;
676 
677  char key = event.GetUnicodeKey();
678  if(key != WXK_NONE) {
679  switch(key) {
680  case WXK_ESCAPE: // Cancel operations.
681  {
682  if(m_mode == MODE_INSERT) {
683  m_elementList.pop_back(); // Removes the last element being inserted.
684  m_mode = MODE_EDIT;
685  Redraw();
686  } else if(m_mode == MODE_INSERT_TEXT) {
687  m_textList.pop_back();
688  m_mode = MODE_EDIT;
689  Redraw();
690  }
691  } break;
692  case WXK_DELETE: // Delete selected elements
693  {
694  DeleteSelectedElements();
695  } break;
696  case 'A': {
697  if(!insertingElement) {
698  Text* newBus = new Text(m_camera->ScreenToWorld(event.GetPosition()));
699  m_textList.push_back(newBus);
700  m_mode = MODE_INSERT_TEXT;
701  m_statusBar->SetStatusText(_("Insert Text: Click to insert, ESC to cancel."));
702  Redraw();
703  }
704  } break;
705  case 'F': {
706  if(event.GetModifiers() == wxMOD_SHIFT) {
707  Fit();
708  }
709  } break;
710  case 'R': // Rotate the selected elements.
711  {
712  RotateSelectedElements(event.GetModifiers() != wxMOD_SHIFT);
713  } break;
714  case 'B': // Insert a bus.
715  {
716  if(!insertingElement) {
717  Bus* newBus = new Bus(m_camera->ScreenToWorld(event.GetPosition()),
718  wxString::Format(_("Bus %d"), GetElementNumber(ID_BUS)));
719  IncrementElementNumber(ID_BUS);
720  m_elementList.push_back(newBus);
721  m_mode = MODE_INSERT;
722  m_statusBar->SetStatusText(_("Insert Bus: Click to insert, ESC to cancel."));
723  Redraw();
724  }
725  } break;
726  case 'L': {
727  if(!insertingElement) {
728  if(!event.ControlDown() && event.ShiftDown()) { // Insert a load.
729  Load* newLoad = new Load(wxString::Format(_("Load %d"), GetElementNumber(ID_LOAD)));
730  IncrementElementNumber(ID_LOAD);
731  m_elementList.push_back(newLoad);
732  m_mode = MODE_INSERT;
733  m_statusBar->SetStatusText(_("Insert Load: Click on a buses, ESC to cancel."));
734  } else if(!event.ControlDown() && !event.ShiftDown()) { // Insert a power line.
735  Line* newLine = new Line(wxString::Format(_("Line %d"), GetElementNumber(ID_LINE)));
736  IncrementElementNumber(ID_LINE);
737  m_elementList.push_back(newLine);
738  m_mode = MODE_INSERT;
739  m_statusBar->SetStatusText(_("Insert Line: Click on two buses, ESC to cancel."));
740  }
741  Redraw();
742  }
743  // Tests - Ctrl + Shift + L
744  if(event.ControlDown() && event.ShiftDown()) {
745  // Nothing...
746  }
747  } break;
748  case 'T': // Insert a transformer.
749  {
750  if(!insertingElement) {
751  Transformer* newTransformer =
752  new Transformer(wxString::Format(_("Transformer %d"), GetElementNumber(ID_TRANSFORMER)));
753  IncrementElementNumber(ID_TRANSFORMER);
754  m_elementList.push_back(newTransformer);
755  m_mode = MODE_INSERT;
756  m_statusBar->SetStatusText(_("Insert Transformer: Click on two buses, ESC to cancel."));
757  Redraw();
758  }
759  } break;
760  case 'G': // Insert a generator.
761  {
762  if(!insertingElement) {
763  SyncGenerator* newGenerator =
764  new SyncGenerator(wxString::Format(_("Generator %d"), GetElementNumber(ID_SYNCGENERATOR)));
765  IncrementElementNumber(ID_SYNCGENERATOR);
766  m_elementList.push_back(newGenerator);
767  m_mode = MODE_INSERT;
768  m_statusBar->SetStatusText(_("Insert Generator: Click on a buses, ESC to cancel."));
769  Redraw();
770  }
771  } break;
772  case 'I': {
773  if(!insertingElement) {
774  if(event.GetModifiers() == wxMOD_SHIFT) { // Insert an inductor.
775  Inductor* newInductor =
776  new Inductor(wxString::Format(_("Inductor %d"), GetElementNumber(ID_INDUCTOR)));
777  IncrementElementNumber(ID_INDUCTOR);
778  m_elementList.push_back(newInductor);
779  m_mode = MODE_INSERT;
780  m_statusBar->SetStatusText(_("Insert Inductor: Click on a buses, ESC to cancel."));
781  } else // Insert an induction motor.
782  {
783  IndMotor* newIndMotor =
784  new IndMotor(wxString::Format(_("Induction motor %d"), GetElementNumber(ID_INDMOTOR)));
785  IncrementElementNumber(ID_INDMOTOR);
786  m_elementList.push_back(newIndMotor);
787  m_mode = MODE_INSERT;
788  m_statusBar->SetStatusText(_("Insert Induction Motor: Click on a buses, ESC to cancel."));
789  }
790  Redraw();
791  }
792  } break;
793  case 'K': // Insert a synchronous condenser.
794  {
795  if(!insertingElement) {
796  SyncMotor* newSyncCondenser =
797  new SyncMotor(wxString::Format(_("Synchronous condenser %d"), GetElementNumber(ID_SYNCMOTOR)));
798  IncrementElementNumber(ID_SYNCMOTOR);
799  m_elementList.push_back(newSyncCondenser);
800  m_mode = MODE_INSERT;
801  m_statusBar->SetStatusText(_("Insert Synchronous Condenser: Click on a buses, ESC to cancel."));
802  Redraw();
803  }
804  } break;
805  case 'C': {
806  if(!insertingElement) {
807  if(event.GetModifiers() == wxMOD_SHIFT) { // Insert a capacitor.
808  Capacitor* newCapacitor =
809  new Capacitor(wxString::Format(_("Capacitor %d"), GetElementNumber(ID_CAPACITOR)));
810  IncrementElementNumber(ID_CAPACITOR);
811  m_elementList.push_back(newCapacitor);
812  m_mode = MODE_INSERT;
813  m_statusBar->SetStatusText(_("Insert Capacitor: Click on a buses, ESC to cancel."));
814  Redraw();
815  } else if(event.GetModifiers() == wxMOD_CONTROL) { // Copy.
816  CopySelection();
817  }
818  }
819  } break;
820  case 'V': {
821  if(!insertingElement) {
822  if(event.GetModifiers() == wxMOD_CONTROL) {
823  Paste();
824  }
825  }
826  } break;
827  default:
828  break;
829  }
830  }
831 
832  UpdateStatusBar();
833  event.Skip();
834 }
835 
836 void Workspace::UpdateStatusBar()
837 {
838  switch(m_mode) {
839  case MODE_DRAG: {
840  m_statusBar->SetStatusText(_("MODE: DRAG"), 1);
841  } break;
842 
843  case MODE_PASTE:
844  case MODE_DRAG_PASTE: {
845  m_statusBar->SetStatusText(_("MODE: PASTE"), 1);
846  }
847 
848  case MODE_INSERT:
849  case MODE_INSERT_TEXT:
850  case MODE_DRAG_INSERT:
851  case MODE_DRAG_INSERT_TEXT: {
852  m_statusBar->SetStatusText(_("MODE: INSERT"), 1);
853  } break;
854 
855  case MODE_MOVE_ELEMENT:
856  case MODE_MOVE_PICKBOX:
857  case MODE_MOVE_NODE:
858  case MODE_SELECTION_RECT:
859  case MODE_EDIT: {
860  m_statusBar->SetStatusText(wxT(""));
861  m_statusBar->SetStatusText(_("MODE: EDIT"), 1);
862  } break;
863  }
864 
865  m_statusBar->SetStatusText(wxString::Format(_("ZOOM: %d%%"), (int)(m_camera->GetScale() * 100.0)), 2);
866  m_statusBar->SetStatusText(
867  wxString::Format(wxT("X: %.1f Y: %.1f"), m_camera->GetMousePosition().m_x, m_camera->GetMousePosition().m_y),
868  3);
869 }
870 
871 void Workspace::OnPopupClick(wxCommandEvent& event)
872 {
873  wxMenu* menu = static_cast<wxMenu*>(event.GetEventObject());
874  Element* element = static_cast<Element*>(menu->GetClientData());
875  switch(event.GetId()) {
876  case ID_EDIT_ELEMENT: {
877  if(element->ShowForm(this, element)) UpdateTextElements();
878  } break;
879  case ID_LINE_ADD_NODE: {
880  Line* line = static_cast<Line*>(element);
881  line->AddNode(m_camera->GetMousePosition());
882  Redraw();
883  } break;
884  case ID_LINE_REMOVE_NODE: {
885  Line* line = static_cast<Line*>(element);
886  line->RemoveNode(m_camera->GetMousePosition());
887  Redraw();
888  } break;
889  case ID_ROTATE_CLOCK: {
890  element->Rotate();
891  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
892  Element* iElement = *it;
893  // Parent's element rotating...
894  for(int i = 0; i < (int)iElement->GetParentList().size(); i++) {
895  Element* parent = iElement->GetParentList()[i];
896  if(parent == element) {
897  iElement->RotateNode(parent);
898  }
899  }
900  }
901  Redraw();
902  } break;
903  case ID_ROTATE_COUNTERCLOCK: {
904  element->Rotate(false);
905  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
906  Element* iElement = *it;
907  // Parent's element rotating...
908  for(int i = 0; i < (int)iElement->GetParentList().size(); i++) {
909  Element* parent = iElement->GetParentList()[i];
910  if(parent == element) {
911  iElement->RotateNode(parent, false);
912  }
913  }
914  }
915  Redraw();
916  } break;
917  case ID_DELETE: {
918  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
919  Element* iElement = *it;
920 
921  if(element == iElement) {
922  // Remove child/parent.
923  std::vector<Element*> childList = element->GetChildList();
924  for(auto itc = childList.begin(), itEnd = childList.end(); itc != itEnd; ++itc) {
925  Element* child = *itc;
926  if(child) {
927  child->RemoveParent(element);
928  element->RemoveChild(child);
929  }
930  }
931  std::vector<Element*> parentList = element->GetParentList();
932  for(auto itp = parentList.begin(), itEnd = parentList.end(); itp != itEnd; ++itp) {
933  Element* parent = *itp;
934  if(parent) {
935  parent->RemoveChild(element);
936  }
937  }
938 
939  for(auto itt = m_textList.begin(); itt != m_textList.end(); ++itt) {
940  Text* text = *itt;
941  if(text->GetElement() == element) {
942  m_textList.erase(itt--);
943  if(text) delete text;
944  }
945  }
946 
947  m_elementList.erase(it);
948  if(element) delete element;
949  menu->SetClientData(NULL);
950  break;
951  }
952  }
953  } break;
954  }
955 }
956 
957 void Workspace::RotateSelectedElements(bool clockwise)
958 {
959  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
960  Element* element = *it;
961  // Parent's element rotating...
962  for(int i = 0; i < (int)element->GetParentList().size(); i++) {
963  Element* parent = element->GetParentList()[i];
964  if(parent) { // Check if parent is not null
965  if(parent->IsSelected()) {
966  element->RotateNode(parent, clockwise);
967  // Update the positions used on motion action, the element will not be necessarily
968  // moved.
969  element->StartMove(m_camera->GetMousePosition());
970  }
971  }
972  }
973  if(element->IsSelected()) {
974  element->Rotate(clockwise);
975  element->StartMove(m_camera->GetMousePosition());
976  }
977  }
978 
979  // Rotate text element
980  for(auto it = m_textList.begin(); it != m_textList.end(); it++) {
981  Text* text = *it;
982  if(text->IsSelected()) {
983  text->Rotate(clockwise);
984  text->StartMove(m_camera->GetMousePosition());
985  }
986  }
987  Redraw();
988 }
989 
990 void Workspace::DeleteSelectedElements()
991 {
992  // Don't set the end of the list at the loop's begin.
993  for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) {
994  Element* element = *it;
995 
996  if(element->IsSelected()) {
997  // Remove child/parent.
998  std::vector<Element*> childList = element->GetChildList();
999  for(auto itc = childList.begin(), itEnd = childList.end(); itc != itEnd; ++itc) {
1000  Element* child = *itc;
1001  if(child) {
1002  child->RemoveParent(element);
1003  element->RemoveChild(child);
1004  }
1005  }
1006  std::vector<Element*> parentList = element->GetParentList();
1007  for(auto itp = parentList.begin(), itEnd = parentList.end(); itp != itEnd; ++itp) {
1008  Element* parent = *itp;
1009  if(parent) {
1010  parent->RemoveChild(element);
1011  }
1012  }
1013 
1014  for(auto itt = m_textList.begin(); itt != m_textList.end(); ++itt) {
1015  Text* text = *itt;
1016  if(text->GetElement() == element) {
1017  m_textList.erase(itt--);
1018  if(text) delete text;
1019  }
1020  }
1021 
1022  m_elementList.erase(it--);
1023  if(element) delete element;
1024  }
1025  }
1026 
1027  for(auto it = m_textList.begin(); it != m_textList.end(); ++it) {
1028  Text* text = *it;
1029  if(text->IsSelected()) {
1030  m_textList.erase(it--);
1031  if(text) delete text;
1032  }
1033  }
1034 
1035  Redraw();
1036 }
1037 
1038 bool Workspace::GetElementsCorners(wxPoint2DDouble& leftUpCorner,
1039  wxPoint2DDouble& rightDownCorner,
1040  std::vector<Element*> elementList)
1041 {
1042  if(elementList.size() == 0) return false;
1043 
1044  elementList[0]->CalculateBoundaries(leftUpCorner, rightDownCorner);
1045 
1046  for(auto it = elementList.begin() + 1, itEnd = elementList.end(); it != itEnd; it++) {
1047  Element* element = *it;
1048  wxPoint2DDouble leftUp;
1049  wxPoint2DDouble rightDown;
1050  element->CalculateBoundaries(leftUp, rightDown);
1051  if(leftUp.m_x < leftUpCorner.m_x) leftUpCorner.m_x = leftUp.m_x;
1052  if(leftUp.m_y < leftUpCorner.m_y) leftUpCorner.m_y = leftUp.m_y;
1053  if(rightDown.m_x > rightDownCorner.m_x) rightDownCorner.m_x = rightDown.m_x;
1054  if(rightDown.m_y > rightDownCorner.m_y) rightDownCorner.m_y = rightDown.m_y;
1055  }
1056  return true;
1057 }
1058 
1059 void Workspace::Fit()
1060 {
1061  wxPoint2DDouble leftUpCorner(0, 0);
1062  wxPoint2DDouble rightDownCorner(0, 0);
1063  std::vector<Element*> elementList = GetElementList();
1064  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) {
1065  elementList.push_back(*it);
1066  }
1067 
1068  if(!GetElementsCorners(leftUpCorner, rightDownCorner, elementList)) return;
1069  wxPoint2DDouble middleCoords = (leftUpCorner + rightDownCorner) / 2.0;
1070 
1071  int width = 0.0;
1072  int height = 0.0;
1073  GetSize(&width, &height);
1074 
1075  double scaleX = double(width) / (rightDownCorner.m_x - leftUpCorner.m_x);
1076  double scaleY = double(height) / (rightDownCorner.m_y - leftUpCorner.m_y);
1077 
1078  double scale = scaleX < scaleY ? scaleX : scaleY;
1079  if(scale > m_camera->GetZoomMax()) scale = m_camera->GetZoomMax();
1080  if(scale < m_camera->GetZoomMin()) scale = m_camera->GetZoomMin();
1081 
1082  m_camera->SetScale(scale);
1083 
1084  m_camera->StartTranslation(middleCoords);
1085  m_camera->SetTranslation(wxPoint2DDouble(width / 2, height / 2));
1086  Redraw();
1087 }
1088 
1089 void Workspace::ValidateBusesVoltages(Element* initialBus)
1090 {
1091  double nominalVoltage = static_cast<Bus*>(initialBus)->GetElectricalData().nominalVoltage;
1092  ElectricalUnit nominalVoltageUnit = static_cast<Bus*>(initialBus)->GetElectricalData().nominalVoltageUnit;
1093 
1094  for(auto it = m_elementList.begin(); it != m_elementList.end(); it++) {
1095  Element* child = *it;
1096 
1097  if(typeid(*child) == typeid(Line)) {
1098  if(child->GetParentList()[0] && child->GetParentList()[1]) {
1099  BusElectricalData data1 = static_cast<Bus*>(child->GetParentList()[0])->GetElectricalData();
1100  BusElectricalData data2 = static_cast<Bus*>(child->GetParentList()[1])->GetElectricalData();
1101 
1102  if(data1.nominalVoltage != data2.nominalVoltage ||
1103  data1.nominalVoltageUnit != data2.nominalVoltageUnit) {
1104  data1.nominalVoltage = nominalVoltage;
1105  data2.nominalVoltage = nominalVoltage;
1106  data1.nominalVoltageUnit = nominalVoltageUnit;
1107  data2.nominalVoltageUnit = nominalVoltageUnit;
1108 
1109  static_cast<Bus*>(child->GetParentList()[0])->SetElectricalData(data1);
1110  static_cast<Bus*>(child->GetParentList()[1])->SetElectricalData(data2);
1111 
1112  it = m_elementList.begin(); // Restart search.
1113  }
1114  }
1115  }
1116  }
1117 
1118  // ValidateElementsVoltages();
1119 }
1120 
1121 void Workspace::ValidateElementsVoltages()
1122 {
1123  for(auto it = m_elementList.begin(); it != m_elementList.end(); it++) {
1124  PowerElement* child = *it;
1125 
1126  std::vector<double> nominalVoltage;
1127  std::vector<ElectricalUnit> nominalVoltageUnit;
1128  for(int i = 0; i < (int)child->GetParentList().size(); i++) {
1129  Bus* parent = static_cast<Bus*>(child->GetParentList()[i]);
1130  if(parent) {
1131  nominalVoltage.push_back(parent->GetElectricalData().nominalVoltage);
1132  nominalVoltageUnit.push_back(parent->GetElectricalData().nominalVoltageUnit);
1133  }
1134  }
1135  child->SetNominalVoltage(nominalVoltage, nominalVoltageUnit);
1136  }
1137 }
1138 
1139 bool Workspace::RunPowerFlow()
1140 {
1141  PowerFlow pf(GetElementList());
1142  bool result = pf.RunGaussSeidel();
1143  if(!result) {
1144  wxMessageDialog msgDialog(this, pf.GetErrorMessage(), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
1145  msgDialog.ShowModal();
1146  }
1147 
1148  UpdateTextElements();
1149  Redraw();
1150 
1151  return result;
1152 }
1153 
1154 void Workspace::UpdateTextElements()
1155 {
1156  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) {
1157  Text* text = *it;
1158  text->UpdateText(m_properties->GetSimulationPropertiesData().basePower);
1159  }
1160 }
1161 
1162 void Workspace::CopySelection()
1163 {
1164  UpdateElementsID();
1165  std::vector<Element*> selectedElements;
1166  // The buses need to be numerated to associate the child's parents to the copies.
1167  int busNumber = 0;
1168  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
1169  Element* element = *it;
1170  if(typeid(*element) == typeid(Bus)) {
1171  Bus* bus = static_cast<Bus*>(element);
1172  auto data = bus->GetElectricalData();
1173  data.number = busNumber;
1174  bus->SetElectricalData(data);
1175  busNumber++;
1176  }
1177  if(element->IsSelected()) {
1178  selectedElements.push_back(element);
1179  }
1180  }
1181  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) {
1182  Text* text = *it;
1183  if(text->IsSelected()) {
1184  selectedElements.push_back(text);
1185  }
1186  }
1187  ElementDataObject* dataObject = new ElementDataObject(selectedElements);
1188  wxTheClipboard->SetData(dataObject);
1189  wxTheClipboard->Close();
1190 }
1191 
1192 bool Workspace::Paste()
1193 {
1194  if(wxTheClipboard->Open()) {
1195  ElementDataObject dataObject;
1196 
1197  if(wxTheClipboard->IsSupported(wxDataFormat("PSPCopy"))) {
1198  if(!wxTheClipboard->GetData(dataObject)) {
1199  wxMessageDialog dialog(this, _("It was not possible to paste from clipboard."), _("Error"),
1200  wxOK | wxCENTER | wxICON_ERROR, wxDefaultPosition);
1201  dialog.ShowModal();
1202  wxTheClipboard->Close();
1203  return false;
1204  }
1205  } else {
1206  wxTheClipboard->Close();
1207  return false;
1208  }
1209  wxTheClipboard->Close();
1210 
1211  UnselectAll();
1212 
1213  std::vector<Element*> pastedElements;
1214  ElementsLists* elementsLists = dataObject.GetElementsLists();
1215 
1216  // Paste buses (parents).
1217  auto parentList = elementsLists->parentList;
1218  std::vector<Bus*> pastedBusList; // To set new parents;
1219  for(auto it = parentList.begin(), itEnd = parentList.end(); it != itEnd; ++it) {
1220  Element* copy = (*it)->GetCopy();
1221  if(copy) {
1222  pastedElements.push_back(copy);
1223  pastedBusList.push_back(static_cast<Bus*>(copy));
1224  m_elementList.push_back(static_cast<PowerElement*>(copy));
1225  }
1226  }
1227 
1228  // Paste other elements.
1229  auto elementLists = elementsLists->elementList;
1230  for(auto it = elementLists.begin(), itEnd = elementLists.end(); it != itEnd; ++it) {
1231  Element* copy = (*it)->GetCopy();
1232  if(copy) {
1233  // Check if is text element
1234  if(Text* text = dynamic_cast<Text*>(copy)) {
1235  // Check if element associated with the text exists.
1236  bool elementExist = false;
1237  for(int i = 0; i < (int)m_elementList.size(); i++) {
1238  if(text->GetElement() == m_elementList[i]) {
1239  elementExist = true;
1240  break;
1241  }
1242  }
1243  if(elementExist) {
1244  pastedElements.push_back(copy);
1245  m_textList.push_back(text);
1246  }
1247  } else {
1248  // Change the parent if copied, otherwise remove it.
1249  for(int j = 0; j < (int)copy->GetParentList().size(); j++) {
1250  Bus* currentParent = static_cast<Bus*>(copy->GetParentList()[j]);
1251  if(currentParent) {
1252  int parentID = currentParent->GetID();
1253  bool parentCopied = false;
1254  for(int k = 0; k < (int)pastedBusList.size(); k++) {
1255  Bus* newParent = pastedBusList[k];
1256  if(parentID == newParent->GetID()) {
1257  parentCopied = true;
1258  copy->ReplaceParent(currentParent, newParent);
1259  break;
1260  }
1261  }
1262  if(!parentCopied) copy->RemoveParent(currentParent);
1263  }
1264  }
1265 
1266  pastedElements.push_back(copy);
1267  m_elementList.push_back(static_cast<PowerElement*>(copy));
1268  }
1269  }
1270  }
1271 
1272  // Update buses childs
1273  for(auto it = pastedBusList.begin(), itEnd = pastedBusList.end(); it != itEnd; ++it) {
1274  Bus* bus = *it;
1275  std::vector<Element*> childList = bus->GetChildList();
1276  for(auto it = childList.begin(), itEnd = childList.end(); it != itEnd; ++it) {
1277  Element* currentChild = *it;
1278  int childID = currentChild->GetID();
1279  bool childCopied = false;
1280  for(int i = 0; i < (int)pastedElements.size(); i++) {
1281  Element* newChild = pastedElements[i];
1282  if(childID == newChild->GetID()) {
1283  childCopied = true;
1284  bus->ReplaceChild(currentChild, newChild);
1285  break;
1286  }
1287  }
1288  if(!childCopied) bus->RemoveChild(currentChild);
1289  }
1290  }
1291 
1292  // Move elements (and nodes) to the mouse position.
1293  // The start position it's the center of the pasted objects.
1294  wxPoint2DDouble leftUpCorner, rightDownCorner;
1295  GetElementsCorners(leftUpCorner, rightDownCorner, pastedElements);
1296  wxPoint2DDouble startPosition = (leftUpCorner + rightDownCorner) / 2.0;
1297  for(auto it = pastedElements.begin(), itEnd = pastedElements.end(); it != itEnd; ++it) {
1298  Element* element = *it;
1299  element->StartMove(startPosition);
1300  element->Move(m_camera->GetMousePosition());
1301  for(int i = 0; i < (int)element->GetParentList().size(); i++) {
1302  Element* parent = element->GetParentList()[i];
1303  element->MoveNode(parent, m_camera->GetMousePosition());
1304  }
1305  }
1306  } else {
1307  wxMessageDialog dialog(this, _("It was not possible to paste from clipboard."), _("Error"),
1308  wxOK | wxCENTER | wxICON_ERROR, wxDefaultPosition);
1309  dialog.ShowModal();
1310  return false;
1311  }
1312 
1313  UpdateElementsID();
1314  m_mode = MODE_PASTE;
1315  m_statusBar->SetStatusText(_("Click to paste."));
1316  UpdateStatusBar();
1317  Redraw();
1318  return true;
1319 }
1320 
1321 void Workspace::UnselectAll()
1322 {
1323  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; it++) {
1324  Element* element = *it;
1325  element->SetSelected(false);
1326  }
1327  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; it++) {
1328  Text* text = *it;
1329  text->SetSelected(false);
1330  }
1331 }
1332 
1333 void Workspace::UpdateElementsID()
1334 {
1335  int id = 0;
1336  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
1337  Element* element = *it;
1338  element->SetID(id);
1339  id++;
1340  }
1341  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) {
1342  Text* text = *it;
1343  text->SetID(id);
1344  id++;
1345  }
1346 }
1347 void Workspace::OnTimer(wxTimerEvent& event)
1348 {
1349  if(m_tipWindow) {
1350  m_tipWindow->Close();
1351  m_tipWindow = NULL;
1352  }
1353  if(m_mode == MODE_EDIT) {
1354  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
1355  Element* element = *it;
1356  if(element->Contains(m_camera->GetMousePosition())) {
1357  wxString tipText = element->GetTipText();
1358  if(!tipText.IsEmpty()) {
1359  m_tipWindow = new wxTipWindow(this, tipText, 10000, &m_tipWindow);
1360  // Creates a very tiny bounding rect to remove the tip on any mouse movement.
1361  m_tipWindow->SetBoundingRect(wxRect(wxGetMousePosition(), wxSize(1, 1)));
1362  break;
1363  }
1364  }
1365  }
1366  }
1367 
1368  m_timer->Stop();
1369 }
1370 
1371 void Workspace::SetTextList(std::vector<Text*> textList)
1372 {
1373  m_textList.clear();
1374  for(auto it = textList.begin(), itEnd = textList.end(); it != itEnd; ++it) m_textList.push_back(*it);
1375 
1376  UpdateTextElements();
1377 }
1378 
1379 void Workspace::SetElementList(std::vector<Element*> elementList)
1380 {
1381  m_elementList.clear();
1382  for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it)
1383  m_elementList.push_back(static_cast<PowerElement*>(*it));
1384 }
1385 
1386 void Workspace::OnIdle(wxIdleEvent& event)
1387 {
1388  // TODO: Find other solution to text displayed wrong on opened file.
1389  if(m_justOpened) {
1390  m_justOpened = false;
1391  UpdateTextElements();
1392  Redraw();
1393  }
1394 }
1395 
1396 std::vector<Element*> Workspace::GetAllElements() const
1397 {
1398  std::vector<Element*> allElements;
1399 
1400  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) allElements.push_back(*it);
1401  for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) allElements.push_back(*it);
1402 
1403  return allElements;
1404 }
1405 
1406 bool Workspace::RunFault()
1407 {
1408  Fault fault(GetElementList());
1409  bool result = fault.RunFaultCalculation(100e6);
1410  if(!result) {
1411  wxMessageDialog msgDialog(this, fault.GetErrorMessage(), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
1412  msgDialog.ShowModal();
1413  }
1414 
1415  UpdateTextElements();
1416  Redraw();
1417 
1418  return result;
1419 }
1420 
1421 std::vector<Element*> Workspace::GetElementList() const
1422 {
1423  std::vector<Element*> elementList;
1424  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) elementList.push_back(*it);
1425  return elementList;
1426 }
1427 
1428 bool Workspace::RunSCPower()
1429 {
1430  Fault fault(GetElementList());
1431  bool result = fault.RunSCPowerCalcutation(100e6);
1432  if(!result) {
1433  wxMessageDialog msgDialog(this, fault.GetErrorMessage(), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
1434  msgDialog.ShowModal();
1435  }
1436 
1437  UpdateTextElements();
1438  Redraw();
1439 
1440  return result;
1441 }
1442 
1443 bool Workspace::RunStability()
1444 {
1445  // Run power flow before stability.
1446  RunPowerFlow();
1447 
1448  Electromechanical stability(this, GetElementList(), m_properties->GetSimulationPropertiesData());
1449  bool result = stability.RunStabilityCalculation();
1450  if(!result) {
1451  wxMessageDialog msgDialog(this, stability.GetErrorMessage(), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
1452  msgDialog.ShowModal();
1453  }
1454  m_stabilityTimeVector.clear();
1455  m_stabilityTimeVector = stability.GetTimeVector();
1456 
1457  // Run power flow after stability.
1458  RunPowerFlow();
1459 
1460  wxMessageDialog msgDialog(this, _("Do you wish to open the stability graphics?"), _("Question"),
1461  wxYES_NO | wxCENTRE | wxICON_QUESTION);
1462  if(msgDialog.ShowModal() == wxID_YES) {
1463  std::vector<ElementPlotData> plotDataList;
1464  for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) {
1465  PowerElement* element = *it;
1466  ElementPlotData plotData;
1467  if(element->GetPlotData(plotData)) plotDataList.push_back(plotData);
1468  }
1469  ElementPlotData tests(_("Error"), ElementPlotData::CT_TEST);
1470  tests.AddData(stability.m_wErrorVector, _("Speed error"));
1471  tests.AddData(stability.m_sdCVector, _("Sd"));
1472  tests.AddData(stability.m_sqCVector, _("Sq"));
1473  tests.AddData(stability.m_numItVector, _("Number iterations"));
1474  plotDataList.push_back(tests);
1475 
1476  ChartView* cView = new ChartView(this, plotDataList, m_stabilityTimeVector);
1477  cView->Show();
1478  }
1479 
1480  return result;
1481 }
1482 void Workspace::OnMiddleDoubleClick(wxMouseEvent& event)
1483 {
1484  Fit();
1485  event.Skip();
1486 }
1487 
1488 bool Workspace::RunStaticStudies()
1489 {
1490  bool pfStatus, faultStatus, scStatus;
1491  pfStatus = faultStatus = scStatus = false;
1492 
1493  pfStatus = RunPowerFlow();
1494 
1495  if(m_properties->GetSimulationPropertiesData().faultAfterPowerFlow) {
1496  if(pfStatus) faultStatus = RunFault();
1497  } else {
1498  faultStatus = true;
1499  }
1500 
1501  if(m_properties->GetSimulationPropertiesData().scPowerAfterPowerFlow) {
1502  if(pfStatus) scStatus = RunSCPower();
1503  } else {
1504  scStatus = true;
1505  }
1506 
1507  if(pfStatus && faultStatus && scStatus) return true;
1508 
1509  return false;
1510 }
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition: Text.cpp:47
+
Definition: Text.h:65
+
void ShowPickbox(bool showPickbox=true)
Set if the pickbox is shown.
Definition: Element.h:161
+ +
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition: Element.cpp:123
+
virtual void AddPoint(wxPoint2DDouble point)
Add point to the list of points that connect the element to the bus.
Definition: Element.h:318
+ + +
void SetSelected(bool selected=true)
Set element selection.
Definition: Element.h:146
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Text.cpp:162
+
virtual std::vector< Element * > GetParentList() const
Get the parent list.
Definition: Element.h:506
+ +
Calculates the electromechanical transient based on disturbances (e.g. system fault).
+
virtual std::vector< Element * > GetChildList() const
Get the Child list.
Definition: Element.h:511
+
virtual void ResetPickboxes()
Remove the pickboxes.
Definition: Element.h:393
+ +
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement...
Definition: Element.h:343
+
bool SetOnline(bool online=true)
Set if the element is online or offline.
Definition: Element.cpp:235
+
virtual bool PickboxContains(wxPoint2DDouble position)
Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be c...
Definition: Element.h:379
+
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition: Element.h:347
+
virtual void SetNominalVoltage(std::vector< double > nominalVoltage, std::vector< ElectricalUnit > nominalVoltageUnit)
Set nominal voltage of the element.
+ + +
virtual void RemoveChild(Element *child)
Remove a child from the list.
Definition: Element.cpp:354
+ +
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element&#39;s rect intersects other rect.
Definition: Text.cpp:92
+
virtual bool Intersects(wxRect2DDouble rect) const =0
Check if the element&#39;s rect intersects other rect.
-
virtual void MoveNode(Element *parent, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Element.h:341
-
Definition: Camera.h:6
-
ElectricalUnit
Electrical units.
Definition: PowerElement.h:11
-
virtual void CalculateBoundaries(wxPoint2DDouble &leftUp, wxPoint2DDouble &rightBottom) const
Calculate the element boundaries.
Definition: Element.cpp:243
-
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Element.h:234
- +
virtual void MoveNode(Element *parent, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition: Element.h:337
+
Class responsible for the correct visualization of the elements on screen.
Definition: Camera.h:30
+
ElectricalUnit
Electrical units.
Definition: PowerElement.h:28
+
virtual void CalculateBoundaries(wxPoint2DDouble &leftUp, wxPoint2DDouble &rightBottom) const
Calculate the element boundaries.
Definition: Element.cpp:263
+
virtual bool AddParent(Element *parent, wxPoint2DDouble position)
Add a parent to the element. This method must be used on power elements that connect to a bus...
Definition: Element.h:240
+
Class to manage color of OpenGL.
- -
virtual void ReplaceChild(Element *oldChild, Element *newChild)
Replace a child from the list.
Definition: Element.cpp:343
+ +
virtual void ReplaceChild(Element *oldChild, Element *newChild)
Replace a child from the list.
Definition: Element.cpp:362
-
Definition: Bus.h:45
+
Definition: Bus.h:62
virtual void Draw(wxPoint2DDouble translation, double scale) const
Draw the element.
Definition: Element.h:302
-
virtual bool GetPlotData(ElementPlotData &plotData)
Fill the plot data.
Definition: PowerElement.h:181
-
bool IsPickboxShown() const
Checks if the pickbox is shown.
Definition: Element.h:213
-
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:219
- -
virtual wxString GetTipText() const
Get the tip text.
Definition: Element.h:295
- -
void SetPosition(const wxPoint2DDouble position)
Set the element position and update the rectangle.
Definition: Element.cpp:10
-
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Element.h:308
- +
virtual bool GetPlotData(ElementPlotData &plotData)
Fill the plot data.
Definition: PowerElement.h:198
+
bool IsPickboxShown() const
Checks if the pickbox is shown.
Definition: Element.h:222
+
bool IsOnline() const
Checks if the element is online or offline.
Definition: Element.h:227
+ +
virtual wxString GetTipText() const
Get the tip text.
Definition: Element.h:296
+ +
void SetPosition(const wxPoint2DDouble position)
Set the element position and update the rectangle.
Definition: Element.cpp:25
+
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition: Element.h:307
+
Calculate the fault of the system and update the elements data.
-
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:333
-
Definition: Line.h:35
- -
Definition: Load.h:23
-
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Element.h:315
- -
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Element.h:547
-
virtual void MovePickbox(wxPoint2DDouble position)
Move the pickbox.
Definition: Element.h:395
- - - -
virtual wxCursor GetBestPickboxCursor() const
Get the best cursor to shown to the user when the mouse is above a pickbox.
Definition: Element.h:401
-
Definition: Fault.h:13
- -
bool IsSelected() const
Checks if the element is selected.
Definition: Element.h:189
-
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Element.h:381
-
virtual void SetID(int id)
Set the element ID.
Definition: Element.h:264
-
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Element.h:361
-
virtual bool SwitchesContains(wxPoint2DDouble position) const
Check if switch contains position.
-
virtual int GetID() const
Get the element ID.
Definition: Element.h:270
-
virtual void ReplaceParent(Element *oldParent, Element *newParent)
Replace a parent.
Definition: Element.cpp:326
-
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Element.h:367
- +
virtual void AddChild(Element *child)
Add a child to the child list.
Definition: Element.cpp:353
+
Definition: Line.h:52
+ +
Definition: Load.h:35
+
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition: Element.h:313
+
This class is responsible to manage the charts generated in the transient electromechanical studies...
Definition: ChartView.h:40
+
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition: Element.h:534
+
virtual void MovePickbox(wxPoint2DDouble position)
Move the pickbox.
Definition: Element.h:384
+ + + +
virtual wxCursor GetBestPickboxCursor() const
Get the best cursor to shown to the user when the mouse is above a pickbox.
Definition: Element.h:389
+
Definition: Fault.h:30
+ +
bool IsSelected() const
Checks if the element is selected.
Definition: Element.h:202
+
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition: Element.h:372
+
virtual void SetID(int id)
Set the element ID.
Definition: Element.h:267
+
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition: Element.h:354
+
virtual bool SwitchesContains(wxPoint2DDouble position) const
Check if switch contains position.
+ +
virtual int GetID() const
Get the element ID.
Definition: Element.h:272
+
virtual void ReplaceParent(Element *oldParent, Element *newParent)
Replace a parent.
Definition: Element.cpp:346
+
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition: Element.h:359
+
virtual bool Contains(wxPoint2DDouble position) const =0
Checks if the element contains a position.
-
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Element.cpp:101
- - -
virtual void ResetNodes()
Remove the active nodes.
Definition: Element.h:411
-
virtual Element * GetCopy()
Get a the element copy.
Definition: Element.h:258
- +
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition: Element.cpp:117
+ + +
virtual void ResetNodes()
Remove the active nodes.
Definition: Element.h:397
+
virtual Element * GetCopy()
Get a the element copy.
Definition: Element.h:262
+
diff --git a/docs/doxygen/html/_workspace_8h.html b/docs/doxygen/html/_workspace_8h.html new file mode 100644 index 0000000..f80d426 --- /dev/null +++ b/docs/doxygen/html/_workspace_8h.html @@ -0,0 +1,145 @@ + + + + + + + + + +Project/Workspace.h File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
Workspace.h File Reference
+
+
+
#include <GL/gl.h>
+#include <GL/glu.h>
+#include <wx/dcclient.h>
+#include <wx/msgdlg.h>
+#include <wx/statusbr.h>
+#include <wx/clipbrd.h>
+#include <wx/tipwin.h>
+#include "WorkspaceBase.h"
+#include "Bus.h"
+#include "ControlEditor.h"
+
+

Go to the source code of this file.

+ + + + + +

+Classes

class  Workspace
 This class manages the graphical and power elements. It is responsible for handling the user's interaction with the elements. More...
 
+ + + +

+Enumerations

enum  ElementID {
+  ID_BUS = 0, +ID_LINE, +ID_TRANSFORMER, +ID_SYNCGENERATOR, +
+  ID_INDMOTOR, +ID_SYNCMOTOR, +ID_LOAD, +ID_CAPACITOR, +
+  ID_INDUCTOR, +ID_TEXT, +NUM_ELEMENTS +
+ }
 
+
+
+ + + + diff --git a/docs/doxygen/html/_workspace_8h.js b/docs/doxygen/html/_workspace_8h.js new file mode 100644 index 0000000..19fe701 --- /dev/null +++ b/docs/doxygen/html/_workspace_8h.js @@ -0,0 +1,17 @@ +var _workspace_8h = +[ + [ "Workspace", "class_workspace.html", "class_workspace" ], + [ "ElementID", "_workspace_8h.html#a8f434816783a791128b48a39ae663f15", [ + [ "ID_BUS", "_workspace_8h.html#a8f434816783a791128b48a39ae663f15a1ef615af10b75825208fe612934cd993", null ], + [ "ID_LINE", "_workspace_8h.html#a8f434816783a791128b48a39ae663f15a7ce9843fb67511c2e4b20c707ad590d8", null ], + [ "ID_TRANSFORMER", "_workspace_8h.html#a8f434816783a791128b48a39ae663f15aec53219b0d127b0c7c48bce6bc6618bb", null ], + [ "ID_SYNCGENERATOR", "_workspace_8h.html#a8f434816783a791128b48a39ae663f15a85788d6fc58afde943ce8bb130461ac1", null ], + [ "ID_INDMOTOR", "_workspace_8h.html#a8f434816783a791128b48a39ae663f15adc8df3f3cd5a626ee5c327423dd7d825", null ], + [ "ID_SYNCMOTOR", "_workspace_8h.html#a8f434816783a791128b48a39ae663f15a7088a60d72d0730404f0965f10dd0786", null ], + [ "ID_LOAD", "_workspace_8h.html#a8f434816783a791128b48a39ae663f15ac3e3dcfd8b3450a32dd2665d542695f2", null ], + [ "ID_CAPACITOR", "_workspace_8h.html#a8f434816783a791128b48a39ae663f15a89ae894b55baca13320fdc0f71345795", null ], + [ "ID_INDUCTOR", "_workspace_8h.html#a8f434816783a791128b48a39ae663f15ad22104a7215f22fd9bcca5d8b56889ef", null ], + [ "ID_TEXT", "_workspace_8h.html#a8f434816783a791128b48a39ae663f15a0b19c55f1dfecc32f6572a67d37e8cc2", null ], + [ "NUM_ELEMENTS", "_workspace_8h.html#a8f434816783a791128b48a39ae663f15a51add6c28e024f17f0d0dde52e23f466", null ] + ] ] +]; \ No newline at end of file diff --git a/docs/doxygen/html/_workspace_8h_source.html b/docs/doxygen/html/_workspace_8h_source.html index bdb439d..2b1e648 100644 --- a/docs/doxygen/html/_workspace_8h_source.html +++ b/docs/doxygen/html/_workspace_8h_source.html @@ -21,6 +21,12 @@ + @@ -82,32 +88,33 @@ $(document).ready(function(){initNavTree('_workspace_8h_source.html','');});
Workspace.h
-
1 #ifndef WORKSPACE_H
2 #define WORKSPACE_H
3 
4 #include <GL/gl.h>
5 #include <GL/glu.h>
6 #include <wx/dcclient.h>
7 #include <wx/msgdlg.h>
8 #include <wx/statusbr.h>
9 #include <wx/clipbrd.h>
10 #include <wx/tipwin.h>
11 
12 #include "WorkspaceBase.h"
13 #include "Bus.h"
14 
15 #include "ControlEditor.h"
16 
17 class Camera;
18 class Element;
19 // class Bus;
20 class Line;
21 class Transformer;
22 class SyncGenerator;
23 class IndMotor;
24 class SyncMotor;
25 class Load;
26 class Inductor;
27 class Capacitor;
28 class ElementDataObject;
29 
30 class Text;
31 
32 class PowerFlow;
33 class Fault;
34 class Electromechanical;
35 
36 class ElementPlotData;
37 class ChartView;
38 
39 class PropertiesData;
40 
41 enum ElementID {
42  ID_BUS = 0,
43  ID_LINE,
44  ID_TRANSFORMER,
45  ID_SYNCGENERATOR,
46  ID_INDMOTOR,
47  ID_SYNCMOTOR,
48  ID_LOAD,
49  ID_CAPACITOR,
50  ID_INDUCTOR,
51  ID_TEXT,
52 
53  NUM_ELEMENTS
54 };
55 
56 class Workspace : public WorkspaceBase
57 {
58 public:
59  enum WorkspaceMode {
60  MODE_EDIT = 0,
61  MODE_MOVE_ELEMENT,
62  MODE_MOVE_PICKBOX,
63  MODE_MOVE_NODE,
64  MODE_DRAG,
65  MODE_DRAG_INSERT,
66  MODE_DRAG_INSERT_TEXT,
67  MODE_INSERT,
68  MODE_INSERT_TEXT,
69  MODE_SELECTION_RECT,
70  MODE_PASTE,
71  MODE_DRAG_PASTE
72  };
73 
74  Workspace();
75  Workspace(wxWindow* parent, wxString name = wxEmptyString, wxStatusBar* statusBar = NULL);
76  ~Workspace();
77 
78  wxString GetName() const { return m_name; }
79  std::vector<Element*> GetElementList() const;
80  std::vector<Text*> GetTextList() const { return m_textList; }
81  std::vector<Element*> GetAllElements() const;
82  WorkspaceMode GetWorkspaceMode() const { return m_mode; }
83  Camera* GetCamera() const { return m_camera; }
84 
85  void CopySelection();
86  bool Paste();
87 
88  wxFileName GetSavedPath() const { return m_savedPath; }
89 
90  void SetName(wxString name) { m_name = name; }
91  void SetElementList(std::vector<Element*> elementList);
92  void SetTextList(std::vector<Text*> textList);
93  void SetStatusBarText(wxString text) { m_statusBar->SetStatusText(text); }
94  void SetWorkspaceMode(WorkspaceMode mode) { m_mode = mode; }
95  void SetSavedPath(wxFileName savedPath) { m_savedPath = savedPath; }
96  void SetJustOpened(bool justOpened) { m_justOpened = justOpened; }
97 
98  void Redraw() { m_glCanvas->Refresh(); }
99  void RotateSelectedElements(bool clockwise = true);
100  void DeleteSelectedElements();
101  bool GetElementsCorners(wxPoint2DDouble& leftUpCorner,
102  wxPoint2DDouble& rightDownCorner,
103  std::vector<Element*> elementList);
104  void Fit();
105  void UnselectAll();
106 
107  void ValidateBusesVoltages(Element* initialBus);
108  void ValidateElementsVoltages();
109 
110  void UpdateElementsID();
111  void UpdateTextElements();
112 
113  int GetElementNumber(ElementID elementID) { return m_elementNumber[elementID]; }
114  void IncrementElementNumber(ElementID elementID) { m_elementNumber[elementID]++; }
115 
116  PropertiesData* GetProperties() const { return m_properties; }
117 
118  std::vector<double> GetStabilityTimeVector() const { return m_stabilityTimeVector; }
119 
120  bool IsContinuousCalculationActive() const { return m_continuousCalc; }
121  void SetContinuousCalculationActive(bool value = true) { m_continuousCalc = value; }
122 
123  bool RunPowerFlow();
124  bool RunFault();
125  bool RunSCPower();
126  bool RunStaticStudies();
127  bool RunStability();
128 
129 protected:
130  virtual void OnMiddleDoubleClick(wxMouseEvent& event);
131  virtual void OnIdle(wxIdleEvent& event);
132  virtual void OnTimer(wxTimerEvent& event);
133  virtual void OnLeftDoubleClick(wxMouseEvent& event);
134  virtual void OnRightClickDown(wxMouseEvent& event);
135  virtual void OnLeftClickUp(wxMouseEvent& event);
136  virtual void OnScroll(wxMouseEvent& event);
137  virtual void OnMiddleDown(wxMouseEvent& event);
138  virtual void OnMiddleUp(wxMouseEvent& event);
139  virtual void OnMouseMotion(wxMouseEvent& event);
140  virtual void OnKeyDown(wxKeyEvent& event);
141  virtual void OnLeftClickDown(wxMouseEvent& event);
142  virtual void OnPaint(wxPaintEvent& event);
143  virtual void OnPopupClick(wxCommandEvent& event);
144 
145  void SetViewport();
146  void UpdateStatusBar();
147 
148  wxGLContext* m_glContext = NULL;
149  wxStatusBar* m_statusBar = NULL;
150  Camera* m_camera = NULL;
151  wxTipWindow* m_tipWindow = NULL;
152  wxString m_name;
153 
154  WorkspaceMode m_mode = MODE_EDIT;
155 
156  std::vector<PowerElement*> m_elementList;
157  int m_elementNumber[NUM_ELEMENTS];
158 
159  std::vector<Text*> m_textList;
160 
161  wxFileName m_savedPath;
162 
163  wxRect2DDouble m_selectionRect;
164  wxPoint2DDouble m_startSelRect;
165 
166  PropertiesData* m_properties = NULL;
167 
168  std::vector<double> m_stabilityTimeVector;
169 
170  bool m_continuousCalc = false;
171  bool m_disconnectedElement = false;
172  bool m_justOpened = false;
173 };
174 
175 #endif // WORKSPACE_H
Definition: Text.h:48
- - - - -
Definition: Camera.h:6
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef WORKSPACE_H
19 #define WORKSPACE_H
20 
21 #include <GL/gl.h>
22 #include <GL/glu.h>
23 #include <wx/dcclient.h>
24 #include <wx/msgdlg.h>
25 #include <wx/statusbr.h>
26 #include <wx/clipbrd.h>
27 #include <wx/tipwin.h>
28 
29 #include "WorkspaceBase.h"
30 #include "Bus.h"
31 
32 #include "ControlEditor.h"
33 
34 class Camera;
35 class Element;
36 // class Bus;
37 class Line;
38 class Transformer;
39 class SyncGenerator;
40 class IndMotor;
41 class SyncMotor;
42 class Load;
43 class Inductor;
44 class Capacitor;
45 class ElementDataObject;
46 
47 class Text;
48 
49 class PowerFlow;
50 class Fault;
51 class Electromechanical;
52 
53 class ElementPlotData;
54 class ChartView;
55 
56 class PropertiesData;
57 
58 enum ElementID {
59  ID_BUS = 0,
60  ID_LINE,
61  ID_TRANSFORMER,
62  ID_SYNCGENERATOR,
63  ID_INDMOTOR,
64  ID_SYNCMOTOR,
65  ID_LOAD,
66  ID_CAPACITOR,
67  ID_INDUCTOR,
68  ID_TEXT,
69 
70  NUM_ELEMENTS
71 };
72 
81 class Workspace : public WorkspaceBase
82 {
83  public:
84  enum WorkspaceMode {
85  MODE_EDIT = 0,
86  MODE_MOVE_ELEMENT,
87  MODE_MOVE_PICKBOX,
88  MODE_MOVE_NODE,
89  MODE_DRAG,
90  MODE_DRAG_INSERT,
91  MODE_DRAG_INSERT_TEXT,
92  MODE_INSERT,
93  MODE_INSERT_TEXT,
94  MODE_SELECTION_RECT,
95  MODE_PASTE,
96  MODE_DRAG_PASTE
97  };
98 
99  Workspace();
100  Workspace(wxWindow* parent, wxString name = wxEmptyString, wxStatusBar* statusBar = NULL);
101  ~Workspace();
102 
103  wxString GetName() const { return m_name; }
104  std::vector<Element*> GetElementList() const;
105  std::vector<Text*> GetTextList() const { return m_textList; }
106  std::vector<Element*> GetAllElements() const;
107  WorkspaceMode GetWorkspaceMode() const { return m_mode; }
108  Camera* GetCamera() const { return m_camera; }
109  void CopySelection();
110  bool Paste();
111 
112  wxFileName GetSavedPath() const { return m_savedPath; }
113  void SetName(wxString name) { m_name = name; }
114  void SetElementList(std::vector<Element*> elementList);
115  void SetTextList(std::vector<Text*> textList);
116  void SetStatusBarText(wxString text) { m_statusBar->SetStatusText(text); }
117  void SetWorkspaceMode(WorkspaceMode mode) { m_mode = mode; }
118  void SetSavedPath(wxFileName savedPath) { m_savedPath = savedPath; }
119  void SetJustOpened(bool justOpened) { m_justOpened = justOpened; }
120  void Redraw() { m_glCanvas->Refresh(); }
121  void RotateSelectedElements(bool clockwise = true);
122  void DeleteSelectedElements();
123  bool GetElementsCorners(wxPoint2DDouble& leftUpCorner,
124  wxPoint2DDouble& rightDownCorner,
125  std::vector<Element*> elementList);
126  void Fit();
127  void UnselectAll();
128 
129  void ValidateBusesVoltages(Element* initialBus);
130  void ValidateElementsVoltages();
131 
132  void UpdateElementsID();
133  void UpdateTextElements();
134 
135  int GetElementNumber(ElementID elementID) { return m_elementNumber[elementID]; }
136  void IncrementElementNumber(ElementID elementID) { m_elementNumber[elementID]++; }
137  PropertiesData* GetProperties() const { return m_properties; }
138  std::vector<double> GetStabilityTimeVector() const { return m_stabilityTimeVector; }
139  bool IsContinuousCalculationActive() const { return m_continuousCalc; }
140  void SetContinuousCalculationActive(bool value = true) { m_continuousCalc = value; }
141  bool RunPowerFlow();
142  bool RunFault();
143  bool RunSCPower();
144  bool RunStaticStudies();
145  bool RunStability();
146 
147  protected:
148  virtual void OnMiddleDoubleClick(wxMouseEvent& event);
149  virtual void OnIdle(wxIdleEvent& event);
150  virtual void OnTimer(wxTimerEvent& event);
151  virtual void OnLeftDoubleClick(wxMouseEvent& event);
152  virtual void OnRightClickDown(wxMouseEvent& event);
153  virtual void OnLeftClickUp(wxMouseEvent& event);
154  virtual void OnScroll(wxMouseEvent& event);
155  virtual void OnMiddleDown(wxMouseEvent& event);
156  virtual void OnMiddleUp(wxMouseEvent& event);
157  virtual void OnMouseMotion(wxMouseEvent& event);
158  virtual void OnKeyDown(wxKeyEvent& event);
159  virtual void OnLeftClickDown(wxMouseEvent& event);
160  virtual void OnPaint(wxPaintEvent& event);
161  virtual void OnPopupClick(wxCommandEvent& event);
162 
163  void SetViewport();
164  void UpdateStatusBar();
165 
166  wxGLContext* m_glContext = NULL;
167  wxStatusBar* m_statusBar = NULL;
168  Camera* m_camera = NULL;
169  wxTipWindow* m_tipWindow = NULL;
170  wxString m_name;
171 
172  WorkspaceMode m_mode = MODE_EDIT;
173 
174  std::vector<PowerElement*> m_elementList;
175  int m_elementNumber[NUM_ELEMENTS];
176 
177  std::vector<Text*> m_textList;
178 
179  wxFileName m_savedPath;
180 
181  wxRect2DDouble m_selectionRect;
182  wxPoint2DDouble m_startSelRect;
183 
184  PropertiesData* m_properties = NULL;
185 
186  std::vector<double> m_stabilityTimeVector;
187 
188  bool m_continuousCalc = false;
189  bool m_disconnectedElement = false;
190  bool m_justOpened = false;
191 };
192 
193 #endif // WORKSPACE_H
Definition: Text.h:65
+ + + + +
Class responsible for the correct visualization of the elements on screen.
Definition: Camera.h:30
+ - - -
Definition: Line.h:35
- -
Definition: Load.h:23
- - -
Definition: Fault.h:13
- - - - - + + +
Definition: Line.h:52
+ +
Definition: Load.h:35
+
This class is responsible to manage the charts generated in the transient electromechanical studies...
Definition: ChartView.h:40
+ +
Definition: Fault.h:30
+ + + +
This class manages the graphical and power elements. It is responsible for handling the user&#39;s intera...
Definition: Workspace.h:81
+
+ +

Form to show some informations. + More...

+ +

#include <AboutForm.h>

Inheritance diagram for AboutForm:
@@ -192,8 +203,11 @@ wxButton * m_buttonOK<  

Detailed Description

-
-

Definition at line 7 of file AboutForm.h.

+

Form to show some informations.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
05/10/2017
+ +

Definition at line 32 of file AboutForm.h.


The documentation for this class was generated from the following files:
  • Project/AboutForm.h
  • Project/AboutForm.cpp
  • diff --git a/docs/doxygen/html/class_about_form_base-members.html b/docs/doxygen/html/class_about_form_base-members.html index 6f8ef15..57bf4db 100644 --- a/docs/doxygen/html/class_about_form_base-members.html +++ b/docs/doxygen/html/class_about_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_about_form_base.html b/docs/doxygen/html/class_about_form_base.html index 2e5688f..cb07e5a 100644 --- a/docs/doxygen/html/class_about_form_base.html +++ b/docs/doxygen/html/class_about_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for AboutFormBase:
-AboutForm +AboutForm
diff --git a/docs/doxygen/html/class_branch-members.html b/docs/doxygen/html/class_branch-members.html index 1bec124..50e5da0 100644 --- a/docs/doxygen/html/class_branch-members.html +++ b/docs/doxygen/html/class_branch-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_branch.html b/docs/doxygen/html/class_branch.html index faaa9bf..7fe4ac0 100644 --- a/docs/doxygen/html/class_branch.html +++ b/docs/doxygen/html/class_branch.html @@ -21,6 +21,12 @@ + @@ -503,7 +509,7 @@ Additional Inherited Members

Detailed Description

-

Definition at line 7 of file Branch.h.

+

Definition at line 24 of file Branch.h.

Member Function Documentation

◆ AddPoint()

@@ -541,7 +547,7 @@ Additional Inherited Members

Reimplemented in Line.

-

Definition at line 27 of file Branch.h.

+

Definition at line 44 of file Branch.h.

@@ -581,7 +587,7 @@ Additional Inherited Members

Reimplemented in Transformer, and Line.

-

Definition at line 13 of file Branch.h.

+

Definition at line 30 of file Branch.h.

@@ -632,7 +638,7 @@ Additional Inherited Members

Reimplemented in Transformer, and Line.

-

Definition at line 14 of file Branch.h.

+

Definition at line 31 of file Branch.h.

@@ -666,7 +672,7 @@ Additional Inherited Members

Reimplemented in Line.

-

Definition at line 22 of file Branch.h.

+

Definition at line 39 of file Branch.h.

@@ -707,7 +713,7 @@ Additional Inherited Members

Reimplemented in Transformer, and Line.

-

Definition at line 28 of file Branch.h.

+

Definition at line 45 of file Branch.h.

@@ -747,7 +753,7 @@ Additional Inherited Members

Reimplemented in Transformer, and Line.

-

Definition at line 23 of file Branch.h.

+

Definition at line 40 of file Branch.h.

@@ -787,7 +793,7 @@ Additional Inherited Members

Reimplemented in Transformer, and Line.

-

Definition at line 15 of file Branch.h.

+

Definition at line 32 of file Branch.h.

@@ -828,7 +834,7 @@ Additional Inherited Members

Move a node. StartMove(wxPoint2DDouble position) before start moving.

Parameters
- +
parentNode's parent.
parentNode's parent.
positionNew node position.
@@ -838,7 +844,7 @@ Additional Inherited Members

Reimplemented in Transformer, and Line.

-

Definition at line 17 of file Branch.h.

+

Definition at line 34 of file Branch.h.

@@ -878,7 +884,7 @@ Additional Inherited Members

Reimplemented in Line.

-

Definition at line 24 of file Branch.h.

+

Definition at line 41 of file Branch.h.

@@ -917,7 +923,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 8 of file Branch.cpp.

+

Definition at line 22 of file Branch.cpp.

@@ -958,7 +964,7 @@ Additional Inherited Members

Reimplemented in Line.

-

Definition at line 25 of file Branch.h.

+

Definition at line 42 of file Branch.h.

@@ -996,7 +1002,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 90 of file Branch.cpp.

+

Definition at line 105 of file Branch.cpp.

@@ -1037,7 +1043,7 @@ Additional Inherited Members

Rotate a node.

Parameters
- +
parentNode's parent.
parentNode's parent.
clockwiseTrue to rotate clockwise, false to rotate counter-clockwise.
@@ -1047,7 +1053,7 @@ Additional Inherited Members

Reimplemented in Transformer, and Line.

-

Definition at line 128 of file Branch.cpp.

+

Definition at line 143 of file Branch.cpp.

@@ -1078,7 +1084,7 @@ Additional Inherited Members

Set a perent to the node. If all conditions are met, a new parent are added to the element and the points related to the nodes will be calculated.

Parameters
- +
parentNode parent.
parentNode parent.
@@ -1088,7 +1094,7 @@ Additional Inherited Members

Reimplemented in Transformer, and Line.

-

Definition at line 28 of file Branch.cpp.

+

Definition at line 43 of file Branch.cpp.

@@ -1128,7 +1134,7 @@ Additional Inherited Members

Reimplemented in Transformer, and Line.

-

Definition at line 16 of file Branch.h.

+

Definition at line 33 of file Branch.h.

diff --git a/docs/doxygen/html/class_bus-members.html b/docs/doxygen/html/class_bus-members.html index 0564bde..351efbc 100644 --- a/docs/doxygen/html/class_bus-members.html +++ b/docs/doxygen/html/class_bus-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_bus.html b/docs/doxygen/html/class_bus.html index 80caefa..0c3edc9 100644 --- a/docs/doxygen/html/class_bus.html +++ b/docs/doxygen/html/class_bus.html @@ -21,6 +21,12 @@ + @@ -510,7 +516,7 @@ Additional Inherited Members

Detailed Description

-

Definition at line 45 of file Bus.h.

+

Definition at line 62 of file Bus.h.

Member Function Documentation

◆ AddParent()

@@ -550,14 +556,14 @@ Additional Inherited Members
Parameters
- +
parentElement parent.
positionNode position in the parent.
positionNode position in the parent.

Reimplemented from Element.

-

Definition at line 53 of file Bus.h.

+

Definition at line 70 of file Bus.h.

@@ -595,7 +601,7 @@ Additional Inherited Members

Implements Element.

-

Definition at line 87 of file Bus.cpp.

+

Definition at line 104 of file Bus.cpp.

@@ -644,7 +650,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 24 of file Bus.cpp.

+

Definition at line 41 of file Bus.cpp.

@@ -676,7 +682,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 124 of file Bus.cpp.

+

Definition at line 141 of file Bus.cpp.

@@ -715,7 +721,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 176 of file Bus.cpp.

+

Definition at line 193 of file Bus.cpp.

@@ -747,7 +753,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 195 of file Bus.cpp.

+

Definition at line 212 of file Bus.cpp.

@@ -786,7 +792,7 @@ Additional Inherited Members

Reimplemented from PowerElement.

-

Definition at line 229 of file Bus.cpp.

+

Definition at line 246 of file Bus.cpp.

@@ -818,7 +824,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 201 of file Bus.cpp.

+

Definition at line 218 of file Bus.cpp.

@@ -856,7 +862,7 @@ Additional Inherited Members

Implements Element.

-

Definition at line 93 of file Bus.cpp.

+

Definition at line 110 of file Bus.cpp.

@@ -894,7 +900,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 141 of file Bus.cpp.

+

Definition at line 158 of file Bus.cpp.

@@ -933,7 +939,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 100 of file Bus.cpp.

+

Definition at line 117 of file Bus.cpp.

@@ -971,7 +977,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 167 of file Bus.cpp.

+

Definition at line 184 of file Bus.cpp.

@@ -1021,7 +1027,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 183 of file Bus.cpp.

+

Definition at line 200 of file Bus.cpp.

diff --git a/docs/doxygen/html/class_bus_form-members.html b/docs/doxygen/html/class_bus_form-members.html index dc5cab5..3818b01 100644 --- a/docs/doxygen/html/class_bus_form-members.html +++ b/docs/doxygen/html/class_bus_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_bus_form.html b/docs/doxygen/html/class_bus_form.html index bf3d4ed..4d0099f 100644 --- a/docs/doxygen/html/class_bus_form.html +++ b/docs/doxygen/html/class_bus_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_bus_form.html','');});
BusForm Class Reference
+ +

Form to edit the bus power data. + More...

+ +

#include <BusForm.h>

Inheritance diagram for BusForm:
@@ -394,8 +405,11 @@ wxButton * m_ButtonCancel<  

Detailed Description

-
-

Definition at line 7 of file BusForm.h.

+

Form to edit the bus power data.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
05/10/2017
+ +

Definition at line 31 of file BusForm.h.


The documentation for this class was generated from the following files:
  • Project/BusForm.h
  • Project/BusForm.cpp
  • diff --git a/docs/doxygen/html/class_bus_form_base-members.html b/docs/doxygen/html/class_bus_form_base-members.html index 14bfc84..654f60c 100644 --- a/docs/doxygen/html/class_bus_form_base-members.html +++ b/docs/doxygen/html/class_bus_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_bus_form_base.html b/docs/doxygen/html/class_bus_form_base.html index 4545239..6ac6ad6 100644 --- a/docs/doxygen/html/class_bus_form_base.html +++ b/docs/doxygen/html/class_bus_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for BusFormBase:
-BusForm +BusForm
diff --git a/docs/doxygen/html/class_camera-members.html b/docs/doxygen/html/class_camera-members.html index d984e94..6576f53 100644 --- a/docs/doxygen/html/class_camera-members.html +++ b/docs/doxygen/html/class_camera-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_camera.html b/docs/doxygen/html/class_camera.html index 3540ffe..44bca8c 100644 --- a/docs/doxygen/html/class_camera.html +++ b/docs/doxygen/html/class_camera.html @@ -21,6 +21,12 @@ + @@ -86,6 +92,11 @@ $(document).ready(function(){initNavTree('class_camera.html','');});
Camera Class Reference
+ +

Class responsible for the correct visualization of the elements on screen. + More...

+ +

#include <Camera.h>

@@ -145,8 +156,11 @@ double 

Public Member Functions

m_zoomMax = 3.0
 

Detailed Description

-
-

Definition at line 6 of file Camera.h.

+

Class responsible for the correct visualization of the elements on screen.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
05/10/2017
+ +

Definition at line 30 of file Camera.h.


The documentation for this class was generated from the following files:
  • Project/Camera.h
  • Project/Camera.cpp
  • diff --git a/docs/doxygen/html/class_capacitor-members.html b/docs/doxygen/html/class_capacitor-members.html index ee1ec82..9fe0a90 100644 --- a/docs/doxygen/html/class_capacitor-members.html +++ b/docs/doxygen/html/class_capacitor-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_capacitor.html b/docs/doxygen/html/class_capacitor.html index d4f6f84..12e844a 100644 --- a/docs/doxygen/html/class_capacitor.html +++ b/docs/doxygen/html/class_capacitor.html @@ -21,6 +21,12 @@ + @@ -526,7 +532,7 @@ void DrawGround (wxPoi

    Detailed Description

    -

    Definition at line 14 of file Capacitor.h.

    +

    Definition at line 31 of file Capacitor.h.

    Member Function Documentation

    ◆ AddParent()

    @@ -566,14 +572,14 @@ void DrawGround (wxPoi
    Parameters
    - +
    parentElement parent.
    positionNode position in the parent.
    positionNode position in the parent.

    Reimplemented from Element.

    -

    Definition at line 7 of file Capacitor.cpp.

    +

    Definition at line 24 of file Capacitor.cpp.

@@ -611,7 +617,7 @@ void DrawGround (wxPoi

Reimplemented from Shunt.

-

Definition at line 117 of file Capacitor.cpp.

+

Definition at line 134 of file Capacitor.cpp.

@@ -660,7 +666,7 @@ void DrawGround (wxPoi

Reimplemented from Element.

-

Definition at line 38 of file Capacitor.cpp.

+

Definition at line 55 of file Capacitor.cpp.

@@ -699,7 +705,7 @@ void DrawGround (wxPoi

Reimplemented from Element.

-

Definition at line 110 of file Capacitor.cpp.

+

Definition at line 127 of file Capacitor.cpp.

@@ -731,7 +737,7 @@ void DrawGround (wxPoi

Reimplemented from Element.

-

Definition at line 163 of file Capacitor.cpp.

+

Definition at line 180 of file Capacitor.cpp.

@@ -763,7 +769,7 @@ void DrawGround (wxPoi

Reimplemented from Element.

-

Definition at line 170 of file Capacitor.cpp.

+

Definition at line 187 of file Capacitor.cpp.

@@ -801,7 +807,7 @@ void DrawGround (wxPoi

Reimplemented from Shunt.

-

Definition at line 123 of file Capacitor.cpp.

+

Definition at line 140 of file Capacitor.cpp.

@@ -839,7 +845,7 @@ void DrawGround (wxPoi

Reimplemented from Element.

-

Definition at line 98 of file Capacitor.cpp.

+

Definition at line 115 of file Capacitor.cpp.

@@ -889,7 +895,7 @@ void DrawGround (wxPoi

Reimplemented from Element.

-

Definition at line 128 of file Capacitor.cpp.

+

Definition at line 145 of file Capacitor.cpp.

diff --git a/docs/doxygen/html/class_chart_view-members.html b/docs/doxygen/html/class_chart_view-members.html index db4c4f8..102d504 100644 --- a/docs/doxygen/html/class_chart_view-members.html +++ b/docs/doxygen/html/class_chart_view-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_chart_view.html b/docs/doxygen/html/class_chart_view.html index 8b656ea..99d195f 100644 --- a/docs/doxygen/html/class_chart_view.html +++ b/docs/doxygen/html/class_chart_view.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_chart_view.html','');});
ChartView Class Reference
+ +

This class is responsible to manage the charts generated in the transient electromechanical studies. + More...

+ +

#include <ChartView.h>

Inheritance diagram for ChartView:
@@ -346,8 +357,11 @@ wxPGProperty * m_pgPropYMa  

Detailed Description

-
-

Definition at line 16 of file ChartView.h.

+

This class is responsible to manage the charts generated in the transient electromechanical studies.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
05/10/2017
+ +

Definition at line 40 of file ChartView.h.


The documentation for this class was generated from the following files:
  • Project/ChartView.h
  • Project/ChartView.cpp
  • diff --git a/docs/doxygen/html/class_chart_view_base-members.html b/docs/doxygen/html/class_chart_view_base-members.html index 2b30901..9708ca4 100644 --- a/docs/doxygen/html/class_chart_view_base-members.html +++ b/docs/doxygen/html/class_chart_view_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_chart_view_base.html b/docs/doxygen/html/class_chart_view_base.html index 6d2b528..7f631eb 100644 --- a/docs/doxygen/html/class_chart_view_base.html +++ b/docs/doxygen/html/class_chart_view_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for ChartViewBase:
-ChartView +ChartView
diff --git a/docs/doxygen/html/class_connection_line-members.html b/docs/doxygen/html/class_connection_line-members.html index 02dbc4d..3beed78 100644 --- a/docs/doxygen/html/class_connection_line-members.html +++ b/docs/doxygen/html/class_connection_line-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_connection_line.html b/docs/doxygen/html/class_connection_line.html index c986c39..1818ccc 100644 --- a/docs/doxygen/html/class_connection_line.html +++ b/docs/doxygen/html/class_connection_line.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_connection_line.html','');});
ConnectionLine Class Reference
+ +

Connection between two control elements or other connection line and an element. + More...

+ +

#include <ConnectionLine.h>

Inheritance diagram for ConnectionLine:
@@ -518,8 +529,11 @@ Additional Inherited Members
 

Detailed Description

-
-

Definition at line 6 of file ConnectionLine.h.

+

Connection between two control elements or other connection line and an element.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
05/10/2017
+ +

Definition at line 30 of file ConnectionLine.h.

Member Function Documentation

◆ Contains()

@@ -555,7 +569,7 @@ Additional Inherited Members

Implements Element.

-

Definition at line 41 of file ConnectionLine.cpp.

+

Definition at line 53 of file ConnectionLine.cpp.

@@ -604,7 +618,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 21 of file ConnectionLine.cpp.

+

Definition at line 33 of file ConnectionLine.cpp.

@@ -636,7 +650,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 188 of file ConnectionLine.cpp.

+

Definition at line 199 of file ConnectionLine.cpp.

@@ -674,7 +688,7 @@ Additional Inherited Members

Implements Element.

-

Definition at line 49 of file ConnectionLine.cpp.

+

Definition at line 61 of file ConnectionLine.cpp.

@@ -712,7 +726,7 @@ Additional Inherited Members

Reimplemented from ControlElement.

-

Definition at line 146 of file ConnectionLine.cpp.

+

Definition at line 158 of file ConnectionLine.cpp.

@@ -750,7 +764,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 180 of file ConnectionLine.cpp.

+

Definition at line 191 of file ConnectionLine.cpp.

@@ -788,7 +802,7 @@ Additional Inherited Members

Reimplemented from ControlElement.

-

Definition at line 152 of file ConnectionLine.cpp.

+

Definition at line 164 of file ConnectionLine.cpp.

diff --git a/docs/doxygen/html/class_constant-members.html b/docs/doxygen/html/class_constant-members.html index 4abf2fe..9b9d463 100644 --- a/docs/doxygen/html/class_constant-members.html +++ b/docs/doxygen/html/class_constant-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_constant.html b/docs/doxygen/html/class_constant.html index cfc57a3..b14b5c9 100644 --- a/docs/doxygen/html/class_constant.html +++ b/docs/doxygen/html/class_constant.html @@ -21,6 +21,12 @@ + @@ -86,6 +92,11 @@ $(document).ready(function(){initNavTree('class_constant.html','');});
Constant Class Reference
+ +

A control element that provides a constant value. + More...

+ +

#include <Constant.h>

Inheritance diagram for Constant:
@@ -468,8 +479,11 @@ Additional Inherited Members  

Detailed Description

-
-

Definition at line 11 of file Constant.h.

+

A control element that provides a constant value.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
05/10/2017
+ +

Definition at line 35 of file Constant.h.

Member Function Documentation

◆ Contains()

@@ -505,7 +519,7 @@ Additional Inherited Members

Implements Element.

-

Definition at line 18 of file Constant.h.

+

Definition at line 42 of file Constant.h.

@@ -554,7 +568,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 15 of file Constant.cpp.

+

Definition at line 32 of file Constant.cpp.

@@ -586,7 +600,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 106 of file Constant.cpp.

+

Definition at line 123 of file Constant.cpp.

@@ -624,7 +638,7 @@ Additional Inherited Members

Implements Element.

-

Definition at line 19 of file Constant.h.

+

Definition at line 43 of file Constant.h.

@@ -662,7 +676,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 50 of file Constant.cpp.

+

Definition at line 67 of file Constant.cpp.

@@ -712,7 +726,7 @@ Additional Inherited Members

Reimplemented from Element.

-

Definition at line 39 of file Constant.cpp.

+

Definition at line 56 of file Constant.cpp.

diff --git a/docs/doxygen/html/class_constant_form-members.html b/docs/doxygen/html/class_constant_form-members.html index b54c4f0..f1dd5aa 100644 --- a/docs/doxygen/html/class_constant_form-members.html +++ b/docs/doxygen/html/class_constant_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_constant_form.html b/docs/doxygen/html/class_constant_form.html index f68d3c6..8907813 100644 --- a/docs/doxygen/html/class_constant_form.html +++ b/docs/doxygen/html/class_constant_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_constant_form.html','');});
ConstantForm Class Reference
+ +

Form to edit the constant control data. + More...

+ +

#include <ConstantForm.h>

Inheritance diagram for ConstantForm:
@@ -166,8 +177,11 @@ wxButton * m_buttonCancel<  

Detailed Description

-
-

Definition at line 7 of file ConstantForm.h.

+

Form to edit the constant control data.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
05/10/2017
+ +

Definition at line 31 of file ConstantForm.h.


The documentation for this class was generated from the following files:
  • Project/ConstantForm.h
  • Project/ConstantForm.cpp
  • diff --git a/docs/doxygen/html/class_constant_form_base-members.html b/docs/doxygen/html/class_constant_form_base-members.html index d4455aa..cba1071 100644 --- a/docs/doxygen/html/class_constant_form_base-members.html +++ b/docs/doxygen/html/class_constant_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_constant_form_base.html b/docs/doxygen/html/class_constant_form_base.html index d4457dd..e29a6fd 100644 --- a/docs/doxygen/html/class_constant_form_base.html +++ b/docs/doxygen/html/class_constant_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for ConstantFormBase:
-ConstantForm +ConstantForm
diff --git a/docs/doxygen/html/class_control_editor-members.html b/docs/doxygen/html/class_control_editor-members.html index 0697cb9..e29b33f 100644 --- a/docs/doxygen/html/class_control_editor-members.html +++ b/docs/doxygen/html/class_control_editor-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_control_editor.html b/docs/doxygen/html/class_control_editor.html index e8772d1..9bb3b26 100644 --- a/docs/doxygen/html/class_control_editor.html +++ b/docs/doxygen/html/class_control_editor.html @@ -21,6 +21,12 @@ + @@ -330,7 +336,7 @@ wxButton * 
m_buttonOK<

Detailed Description

-

Definition at line 67 of file ControlEditor.h.

+

Definition at line 91 of file ControlEditor.h.


The documentation for this class was generated from the following files:
  • Project/ControlEditor.h
  • Project/ControlEditor.cpp
  • diff --git a/docs/doxygen/html/class_control_editor_base-members.html b/docs/doxygen/html/class_control_editor_base-members.html index 3ce209e..a9c5495 100644 --- a/docs/doxygen/html/class_control_editor_base-members.html +++ b/docs/doxygen/html/class_control_editor_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_control_editor_base.html b/docs/doxygen/html/class_control_editor_base.html index 18ea296..445260b 100644 --- a/docs/doxygen/html/class_control_editor_base.html +++ b/docs/doxygen/html/class_control_editor_base.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_control_element-members.html b/docs/doxygen/html/class_control_element-members.html index a2f9245..28f4a92 100644 --- a/docs/doxygen/html/class_control_element-members.html +++ b/docs/doxygen/html/class_control_element-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_control_element.html b/docs/doxygen/html/class_control_element.html index c42f417..bf511f1 100644 --- a/docs/doxygen/html/class_control_element.html +++ b/docs/doxygen/html/class_control_element.html @@ -21,6 +21,12 @@ + @@ -86,6 +92,8 @@ $(document).ready(function(){initNavTree('class_control_element.html','');});
    ControlElement Class Reference
+ +

#include <ControlElement.h>

Inheritance diagram for ControlElement:
@@ -93,14 +101,14 @@ Inheritance diagram for ControlElement:
Element -ConnectionLine -Constant -Exponential -Gain -IOControl -Limiter -Multiplier -RateLimiter +ConnectionLine +Constant +Exponential +Gain +IOControl +Limiter +Multiplier +RateLimiter Sum TransferFunction @@ -454,8 +462,10 @@ Additional Inherited Members  

Detailed Description

-
-

Definition at line 53 of file ControlElement.h.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
05/10/2017
+ +

Definition at line 84 of file ControlElement.h.

Member Function Documentation

◆ Move()

@@ -493,7 +503,7 @@ Additional Inherited Members

Reimplemented in Gain, and ConnectionLine.

-

Definition at line 109 of file ControlElement.cpp.

+

Definition at line 126 of file ControlElement.cpp.

@@ -533,7 +543,7 @@ Additional Inherited Members

Reimplemented in ConnectionLine.

-

Definition at line 100 of file ControlElement.cpp.

+

Definition at line 117 of file ControlElement.cpp.

diff --git a/docs/doxygen/html/class_control_element_button-members.html b/docs/doxygen/html/class_control_element_button-members.html index 44a370f..e72d876 100644 --- a/docs/doxygen/html/class_control_element_button-members.html +++ b/docs/doxygen/html/class_control_element_button-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_control_element_button.html b/docs/doxygen/html/class_control_element_button.html index 535fa66..c1028ce 100644 --- a/docs/doxygen/html/class_control_element_button.html +++ b/docs/doxygen/html/class_control_element_button.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_control_element_button.html','')
ControlElementButton Class Reference
+ +

This class is responsible to handle the user interaction with control elements. + More...

+ +

#include <ControlEditor.h>

Inheritance diagram for ControlElementButton:
@@ -154,8 +165,11 @@ wxSize m_buttonSize 

Detailed Description

-
-

Definition at line 39 of file ControlEditor.h.

+

This class is responsible to handle the user interaction with control elements.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
05/10/2017
+ +

Definition at line 63 of file ControlEditor.h.


The documentation for this class was generated from the following files:
  • Project/ControlEditor.h
  • Project/ControlEditor.cpp
  • diff --git a/docs/doxygen/html/class_control_element_container-members.html b/docs/doxygen/html/class_control_element_container-members.html index 7e8f9dd..5d6ca53 100644 --- a/docs/doxygen/html/class_control_element_container-members.html +++ b/docs/doxygen/html/class_control_element_container-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_control_element_container.html b/docs/doxygen/html/class_control_element_container.html index 46f07e7..8958872 100644 --- a/docs/doxygen/html/class_control_element_container.html +++ b/docs/doxygen/html/class_control_element_container.html @@ -21,6 +21,12 @@ + @@ -86,6 +92,11 @@ $(document).ready(function(){initNavTree('class_control_element_container.html',
    ControlElementContainer Class Reference
+ +

Class that can contain all control elements. Can identify (using RTTI) the elements from a generic list and store them separately. + More...

+ +

#include <ControlElementContainer.h>

@@ -172,8 +183,11 @@ std::vector< TransferFuncti

Public Member Functions

 

Detailed Description

-
-

Definition at line 20 of file ControlElementContainer.h.

+

Class that can contain all control elements. Can identify (using RTTI) the elements from a generic list and store them separately.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
05/10/2017
+ +

Definition at line 45 of file ControlElementContainer.h.


The documentation for this class was generated from the following files:
  • Project/ControlElementContainer.h
  • Project/ControlElementContainer.cpp
  • diff --git a/docs/doxygen/html/class_control_element_solver-members.html b/docs/doxygen/html/class_control_element_solver-members.html index d1c9bfa..5b38734 100644 --- a/docs/doxygen/html/class_control_element_solver-members.html +++ b/docs/doxygen/html/class_control_element_solver-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_control_element_solver.html b/docs/doxygen/html/class_control_element_solver.html index 4628d9b..cf89dff 100644 --- a/docs/doxygen/html/class_control_element_solver.html +++ b/docs/doxygen/html/class_control_element_solver.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_control_element_solver.html','')
    ControlElementSolver Class Reference
+ +

Solves in the time the control system. Can solve the control system directly from a ControlEditor or from a ControlEditorElement. + More...

+ +

#include <ControlElementSolver.h>

@@ -149,8 +160,11 @@ bool 

Public Member Functions

m_isOK = false 

Detailed Description

-
-

Definition at line 20 of file ControlElementSolver.h.

+

Solves in the time the control system. Can solve the control system directly from a ControlEditor or from a ControlEditorElement.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
05/10/2017
+ +

Definition at line 45 of file ControlElementSolver.h.


The documentation for this class was generated from the following files:
  • Project/ControlElementSolver.h
  • Project/ControlElementSolver.cpp
  • diff --git a/docs/doxygen/html/class_control_system_test-members.html b/docs/doxygen/html/class_control_system_test-members.html index f5c4174..ae73bb9 100644 --- a/docs/doxygen/html/class_control_system_test-members.html +++ b/docs/doxygen/html/class_control_system_test-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_control_system_test.html b/docs/doxygen/html/class_control_system_test.html index 36ee7a5..cb9fecc 100644 --- a/docs/doxygen/html/class_control_system_test.html +++ b/docs/doxygen/html/class_control_system_test.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_control_system_test.html','');})
    ControlSystemTest Class Reference
+ +

Form to edit properties to test the control system created. + More...

+ +

#include <ControlSystemTest.h>

Inheritance diagram for ControlSystemTest:
@@ -232,8 +243,11 @@ wxButton * m_buttonCancel<  

Detailed Description

-
-

Definition at line 8 of file ControlSystemTest.h.

+

Form to edit properties to test the control system created.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
05/10/2017
+ +

Definition at line 32 of file ControlSystemTest.h.


The documentation for this class was generated from the following files:
  • Project/ControlSystemTest.h
  • Project/ControlSystemTest.cpp
  • diff --git a/docs/doxygen/html/class_control_system_test_base-members.html b/docs/doxygen/html/class_control_system_test_base-members.html index 1c2be6f..785bda9 100644 --- a/docs/doxygen/html/class_control_system_test_base-members.html +++ b/docs/doxygen/html/class_control_system_test_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_control_system_test_base.html b/docs/doxygen/html/class_control_system_test_base.html index 227789c..fada4da 100644 --- a/docs/doxygen/html/class_control_system_test_base.html +++ b/docs/doxygen/html/class_control_system_test_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for ControlSystemTestBase:
-ControlSystemTest +ControlSystemTest
diff --git a/docs/doxygen/html/class_data_report-members.html b/docs/doxygen/html/class_data_report-members.html index adaf79b..8df3f52 100644 --- a/docs/doxygen/html/class_data_report-members.html +++ b/docs/doxygen/html/class_data_report-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_data_report.html b/docs/doxygen/html/class_data_report.html index 558f3d8..886d50f 100644 --- a/docs/doxygen/html/class_data_report.html +++ b/docs/doxygen/html/class_data_report.html @@ -21,6 +21,12 @@ + @@ -88,6 +94,11 @@ $(document).ready(function(){initNavTree('class_data_report.html','');});
DataReport Class Reference
+ +

Form that shows the results of power flow and fault calculations. + More...

+ +

#include <DataReport.h>

Inheritance diagram for DataReport:
@@ -318,8 +329,11 @@ wxGrid * 
m_gridFaultGenera
 

Detailed Description

-
-

Definition at line 9 of file DataReport.h.

+

Form that shows the results of power flow and fault calculations.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
05/10/2017
+ +

Definition at line 33 of file DataReport.h.


The documentation for this class was generated from the following files:
  • Project/DataReport.h
  • Project/DataReport.cpp
  • diff --git a/docs/doxygen/html/class_data_report_base-members.html b/docs/doxygen/html/class_data_report_base-members.html index 380546d..15ecdc2 100644 --- a/docs/doxygen/html/class_data_report_base-members.html +++ b/docs/doxygen/html/class_data_report_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_data_report_base.html b/docs/doxygen/html/class_data_report_base.html index a7790da..5990702 100644 --- a/docs/doxygen/html/class_data_report_base.html +++ b/docs/doxygen/html/class_data_report_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for DataReportBase:
-DataReport +DataReport
diff --git a/docs/doxygen/html/class_electric_calculation-members.html b/docs/doxygen/html/class_electric_calculation-members.html index 4aa0a25..e1a7179 100644 --- a/docs/doxygen/html/class_electric_calculation-members.html +++ b/docs/doxygen/html/class_electric_calculation-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_electric_calculation.html b/docs/doxygen/html/class_electric_calculation.html index 938fbd5..ccd0b4e 100644 --- a/docs/doxygen/html/class_electric_calculation.html +++ b/docs/doxygen/html/class_electric_calculation.html @@ -21,6 +21,12 @@ + @@ -208,7 +214,7 @@ std::vector< Transformer * &g
Author
Thales Lima Oliveira
Date
09/01/2017
-

Definition at line 49 of file ElectricCalculation.h.

+

Definition at line 66 of file ElectricCalculation.h.

Member Function Documentation

◆ GetBusList()

@@ -236,7 +242,7 @@ std::vector< Transformer * &g

Get the buses of the system (use GetElementsFromList first).

Returns
A list of bus elements.
-

Definition at line 128 of file ElectricCalculation.h.

+

Definition at line 145 of file ElectricCalculation.h.

@@ -266,7 +272,7 @@ std::vector< Transformer * &g

Get the capacitors of the system (use GetElementsFromList first).

Returns
A list of capacitor elements.
-

Definition at line 133 of file ElectricCalculation.h.

+

Definition at line 150 of file ElectricCalculation.h.

@@ -302,7 +308,7 @@ std::vector< Transformer * &g -

Definition at line 8 of file ElectricCalculation.cpp.

+

Definition at line 25 of file ElectricCalculation.cpp.

@@ -332,7 +338,7 @@ std::vector< Transformer * &g

Get the induction motors of the system (use GetElementsFromList first).

Returns
A list of induction motor elements.
-

Definition at line 138 of file ElectricCalculation.h.

+

Definition at line 155 of file ElectricCalculation.h.

@@ -362,7 +368,7 @@ std::vector< Transformer * &g

Get the inductors of the system (use GetElementsFromList first).

Returns
A list of inductor elements.
-

Definition at line 143 of file ElectricCalculation.h.

+

Definition at line 160 of file ElectricCalculation.h.

@@ -392,7 +398,7 @@ std::vector< Transformer * &g

Get the lines of the system (use GetElementsFromList first).

Returns
A list of line elements.
-

Definition at line 148 of file ElectricCalculation.h.

+

Definition at line 165 of file ElectricCalculation.h.

@@ -422,7 +428,7 @@ std::vector< Transformer * &g

Get the loads of the system (use GetElementsFromList first).

Returns
A list of load elements.
-

Definition at line 153 of file ElectricCalculation.h.

+

Definition at line 170 of file ElectricCalculation.h.

@@ -452,7 +458,7 @@ std::vector< Transformer * &g

Get the synchronous generators of the system (use GetElementsFromList first).

Returns
A list of synchronous generator elements.
-

Definition at line 158 of file ElectricCalculation.h.

+

Definition at line 175 of file ElectricCalculation.h.

@@ -482,7 +488,7 @@ std::vector< Transformer * &g

Get the synchronous motors of the system (use GetElementsFromList first).

Returns
A list of synchronous motor elements.
-

Definition at line 163 of file ElectricCalculation.h.

+

Definition at line 180 of file ElectricCalculation.h.

@@ -512,7 +518,7 @@ std::vector< Transformer * &g

Get the transformers of the system (use GetElementsFromList first).

Returns
A list of transformer elements.
-

Definition at line 168 of file ElectricCalculation.h.

+

Definition at line 185 of file ElectricCalculation.h.

@@ -580,7 +586,7 @@ std::vector< Transformer * &g
Returns
Return true if was possible to build the admittance matrix.
-

Definition at line 56 of file ElectricCalculation.cpp.

+

Definition at line 73 of file ElectricCalculation.cpp.

@@ -628,7 +634,7 @@ std::vector< Transformer * &g
Returns
Return true if was possible to invert the matrix.
-

Definition at line 572 of file ElectricCalculation.cpp.

+

Definition at line 589 of file ElectricCalculation.cpp.

@@ -696,7 +702,7 @@ std::vector< Transformer * &g -

Definition at line 287 of file ElectricCalculation.cpp.

+

Definition at line 304 of file ElectricCalculation.cpp.

diff --git a/docs/doxygen/html/class_electromechanical-members.html b/docs/doxygen/html/class_electromechanical-members.html index 8883087..c3ce5b6 100644 --- a/docs/doxygen/html/class_electromechanical-members.html +++ b/docs/doxygen/html/class_electromechanical-members.html @@ -21,6 +21,12 @@ + @@ -89,57 +95,63 @@ $(document).ready(function(){initNavTree('class_electromechanical.html','');}); - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/doxygen/html/class_electromechanical.html b/docs/doxygen/html/class_electromechanical.html index e7e158d..1cc28de 100644 --- a/docs/doxygen/html/class_electromechanical.html +++ b/docs/doxygen/html/class_electromechanical.html @@ -21,6 +21,12 @@ + @@ -88,6 +94,8 @@ $(document).ready(function(){initNavTree('class_electromechanical.html','');});
Electromechanical Class Reference
+ +

#include <Electromechanical.h>

Inheritance diagram for Electromechanical:
@@ -199,6 +207,12 @@ std::vector< double > 
+ + + +
CalculateIntegrationConstants(SyncGenerator *syncGenerator, double id, double iq, double k=1.0) (defined in Electromechanical)Electromechanicalprotected
CalculateMachinesCurrents() (defined in Electromechanical)Electromechanicalprotected
CalculateReferenceSpeed() (defined in Electromechanical)Electromechanicalprotected
CalculateSyncMachineIntVariables(SyncGenerator *syncGenerator, double id, double iq, double pe, double k=1.0) (defined in Electromechanical)Electromechanicalprotected
CalculateSyncMachineNonIntVariables(SyncGenerator *syncGenerator, double &id, double &iq, double &pe, double k=1.0) (defined in Electromechanical)Electromechanicalprotected
ComplexMatrixTimesVector(std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::complex< double > > vector) (defined in ElectricCalculation)ElectricCalculation
DQ0toABC(double dValue, double qValue, double angle, std::complex< double > &complexValue) (defined in ElectricCalculation)ElectricCalculation
ElectricCalculation()ElectricCalculation
Electromechanical(wxWindow *parent, std::vector< Element *> elementList, SimulationData data) (defined in Electromechanical)Electromechanical
EventTrigger(double eventTime, double currentTime) (defined in Electromechanical)Electromechanicalinlineprotected
GaussianElimination(std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::complex< double > > array) (defined in ElectricCalculation)ElectricCalculation
GetBusList() constElectricCalculationinline
GetCapacitorList() constElectricCalculationinline
GetElementsFromList(std::vector< Element *> elementList)ElectricCalculationvirtual
GetErrorMessage() const (defined in Electromechanical)Electromechanicalinline
GetIndMotorList() constElectricCalculationinline
GetInductorList() constElectricCalculationinline
GetLineList() constElectricCalculationinline
GetLoadList() constElectricCalculationinline
GetLUDecomposition(std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::vector< std::complex< double > > > &matrixL, std::vector< std::vector< std::complex< double > > > &matrixU) (defined in ElectricCalculation)ElectricCalculation
GetMachineModel(SyncGenerator *generator) (defined in ElectricCalculation)ElectricCalculation
GetPowerValue(double value, ElectricalUnit unit) (defined in Electromechanical)Electromechanicalprotected
CalculateSyncMachineIntVariables(SyncGenerator *syncGenerator, double id, double iq, double sd, double sq, double pe, double k=1.0) (defined in Electromechanical)Electromechanicalprotected
CalculateSyncMachineNonIntVariables(SyncGenerator *syncGenerator, double &id, double &iq, double &sd, double &sq, double &pe, double k=1.0) (defined in Electromechanical)Electromechanicalprotected
CalculateSyncMachineSaturation(SyncGenerator *syncMachine, double &id, double &iq, double &sd, double &sq, bool updateCurrents=true, double k=1.0) (defined in Electromechanical)Electromechanicalprotected
ComplexMatrixTimesVector(std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::complex< double > > vector) (defined in ElectricCalculation)ElectricCalculation
DQ0toABC(double dValue, double qValue, double angle, std::complex< double > &complexValue) (defined in ElectricCalculation)ElectricCalculation
ElectricCalculation()ElectricCalculation
Electromechanical(wxWindow *parent, std::vector< Element *> elementList, SimulationData data) (defined in Electromechanical)Electromechanical
EventTrigger(double eventTime, double currentTime) (defined in Electromechanical)Electromechanicalinlineprotected
GaussianElimination(std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::complex< double > > array) (defined in ElectricCalculation)ElectricCalculation
GetBusList() constElectricCalculationinline
GetCapacitorList() constElectricCalculationinline
GetElementsFromList(std::vector< Element *> elementList)ElectricCalculationvirtual
GetErrorMessage() const (defined in Electromechanical)Electromechanicalinline
GetIndMotorList() constElectricCalculationinline
GetInductorList() constElectricCalculationinline
GetLineList() constElectricCalculationinline
GetLoadList() constElectricCalculationinline
GetLUDecomposition(std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::vector< std::complex< double > > > &matrixL, std::vector< std::vector< std::complex< double > > > &matrixU) (defined in ElectricCalculation)ElectricCalculation
GetMachineModel(SyncGenerator *generator) (defined in ElectricCalculation)ElectricCalculation
GetSyncGeneratorList() constElectricCalculationinline
GetSyncMachineAdmittance(SyncGenerator *generator) (defined in Electromechanical)Electromechanicalprotected
GetSyncMotorList() constElectricCalculationinline
GetTimeVector() const (defined in Electromechanical)Electromechanicalinline
GetTransformerList() constElectricCalculationinline
GetYBus(std::vector< std::vector< std::complex< double > > > &yBus, double systemPowerBase, YBusSequence sequence=POSITIVE_SEQ, bool includeSyncMachines=false, bool allLoadsAsImpedances=false)ElectricCalculationvirtual
HasEvent(double currentTime) (defined in Electromechanical)Electromechanicalprotected
InitializeDynamicElements() (defined in Electromechanical)Electromechanicalprotected
InsertSyncMachinesOnYBus() (defined in Electromechanical)Electromechanicalprotected
InvertMatrix(std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::vector< std::complex< double > > > &inverse)ElectricCalculationvirtual
LUEvaluate(std::vector< std::vector< std::complex< double > > > u, std::vector< std::vector< std::complex< double > > > l, std::vector< std::complex< double > > b) (defined in ElectricCalculation)ElectricCalculation
m_busList (defined in ElectricCalculation)ElectricCalculationprotected
m_capacitorList (defined in ElectricCalculation)ElectricCalculationprotected
m_ctrlTimeStepMultiplier (defined in Electromechanical)Electromechanicalprotected
m_deltaErrorVector (defined in Electromechanical)Electromechanical
m_errorMsg (defined in Electromechanical)Electromechanicalprotected
m_eventOccurrenceList (defined in Electromechanical)Electromechanicalprotected
m_eventTimeList (defined in Electromechanical)Electromechanicalprotected
m_iBus (defined in Electromechanical)Electromechanicalprotected
m_indMotorList (defined in ElectricCalculation)ElectricCalculationprotected
m_inductorList (defined in ElectricCalculation)ElectricCalculationprotected
m_lineList (defined in ElectricCalculation)ElectricCalculationprotected
m_loadList (defined in ElectricCalculation)ElectricCalculationprotected
m_maxIterations (defined in Electromechanical)Electromechanicalprotected
m_numIt (defined in Electromechanical)Electromechanicalprotected
m_numItVector (defined in Electromechanical)Electromechanical
m_parent (defined in Electromechanical)Electromechanicalprotected
m_plotTime (defined in Electromechanical)Electromechanicalprotected
m_powerElementList (defined in ElectricCalculation)ElectricCalculationprotected
m_powerSystemBase (defined in Electromechanical)Electromechanicalprotected
m_refSpeed (defined in Electromechanical)Electromechanicalprotected
GetSyncMachineModelData(SyncGenerator *syncMachine) (defined in Electromechanical)Electromechanicalprotected
GetSyncMotorList() constElectricCalculationinline
GetTimeVector() const (defined in Electromechanical)Electromechanicalinline
GetTransformerList() constElectricCalculationinline
GetYBus(std::vector< std::vector< std::complex< double > > > &yBus, double systemPowerBase, YBusSequence sequence=POSITIVE_SEQ, bool includeSyncMachines=false, bool allLoadsAsImpedances=false)ElectricCalculationvirtual
HasEvent(double currentTime) (defined in Electromechanical)Electromechanicalprotected
InitializeDynamicElements() (defined in Electromechanical)Electromechanicalprotected
InsertSyncMachinesOnYBus() (defined in Electromechanical)Electromechanicalprotected
InvertMatrix(std::vector< std::vector< std::complex< double > > > matrix, std::vector< std::vector< std::complex< double > > > &inverse)ElectricCalculationvirtual
LUEvaluate(std::vector< std::vector< std::complex< double > > > u, std::vector< std::vector< std::complex< double > > > l, std::vector< std::complex< double > > b) (defined in ElectricCalculation)ElectricCalculation
m_busList (defined in ElectricCalculation)ElectricCalculationprotected
m_capacitorList (defined in ElectricCalculation)ElectricCalculationprotected
m_ctrlTimeStepMultiplier (defined in Electromechanical)Electromechanicalprotected
m_deltaErrorVector (defined in Electromechanical)Electromechanical
m_errorMsg (defined in Electromechanical)Electromechanicalprotected
m_eventOccurrenceList (defined in Electromechanical)Electromechanicalprotected
m_eventTimeList (defined in Electromechanical)Electromechanicalprotected
m_iBus (defined in Electromechanical)Electromechanicalprotected
m_indMotorList (defined in ElectricCalculation)ElectricCalculationprotected
m_inductorList (defined in ElectricCalculation)ElectricCalculationprotected
m_lineList (defined in ElectricCalculation)ElectricCalculationprotected
m_loadList (defined in ElectricCalculation)ElectricCalculationprotected
m_maxIterations (defined in Electromechanical)Electromechanicalprotected
m_numIt (defined in Electromechanical)Electromechanicalprotected
m_numItVector (defined in Electromechanical)Electromechanical
m_parent (defined in Electromechanical)Electromechanicalprotected
m_plotTime (defined in Electromechanical)Electromechanicalprotected
m_powerElementList (defined in ElectricCalculation)ElectricCalculationprotected
m_powerSystemBase (defined in Electromechanical)Electromechanicalprotected
m_refSpeed (defined in Electromechanical)Electromechanicalprotected
m_saturationTolerance (defined in Electromechanical)Electromechanicalprotected
m_sdC (defined in Electromechanical)Electromechanicalprotected
m_sdCVector (defined in Electromechanical)Electromechanical
m_simTime (defined in Electromechanical)Electromechanicalprotected
m_sqC (defined in Electromechanical)Electromechanicalprotected
m_sqCVector (defined in Electromechanical)Electromechanical
m_syncGeneratorList (defined in ElectricCalculation)ElectricCalculationprotected
m_syncMotorList (defined in ElectricCalculation)ElectricCalculationprotected
m_systemFreq (defined in Electromechanical)Electromechanicalprotected
<
std::vector< double > m_numItVector
 
+std::vector< double > m_sdCVector
 
+std::vector< double > m_sqCVector
 
@@ -214,9 +228,6 @@ void  - - @@ -226,9 +237,9 @@ std::complex< double >  - - + + @@ -238,15 +249,21 @@ bool  - - - - + + + + + + + + @@ -304,6 +321,9 @@ double  + + @@ -316,6 +336,12 @@ std::vector< double >  + + + + @@ -352,8 +378,10 @@ std::vector< Transformer * &g

Protected Member Functions

SetEvent (double
bool EventTrigger (double eventTime, double currentTime)
 
-double GetPowerValue (double value, ElectricalUnit unit)
 
void InsertSyncMachinesOnYBus ()
 
bool InitializeDynamicElements ()
 
-void CalculateMachinesCurrents ()
 
+bool CalculateMachinesCurrents ()
 
void CalculateIntegrationConstants (SyncGenerator *syncGenerator, double id, double iq, double k=1.0)
 
SolveSynchronousMachi
void SetSyncMachinesModel ()
 
-double CalculateSyncMachineIntVariables (SyncGenerator *syncGenerator, double id, double iq, double pe, double k=1.0)
 
-void CalculateSyncMachineNonIntVariables (SyncGenerator *syncGenerator, double &id, double &iq, double &pe, double k=1.0)
 
+SyncMachineModelData GetSyncMachineModelData (SyncGenerator *syncMachine)
 
+double CalculateSyncMachineIntVariables (SyncGenerator *syncGenerator, double id, double iq, double sd, double sq, double pe, double k=1.0)
 
+bool CalculateSyncMachineNonIntVariables (SyncGenerator *syncGenerator, double &id, double &iq, double &sd, double &sq, double &pe, double k=1.0)
 
void CalculateReferenceSpeed ()
 
+bool CalculateSyncMachineSaturation (SyncGenerator *syncMachine, double &id, double &iq, double &sd, double &sq, bool updateCurrents=true, double k=1.0)
 
void SaveData ()
 
m_tolerance = 1
int m_maxIterations = 100
 
+double m_saturationTolerance = 1e-8
 
std::vector< double > m_eventTimeList
 
<
double m_wError = 0.0
 
+double m_sdC = 1.0
 
+double m_sqC = 1.0
 
double m_numIt = 0
 
 

Detailed Description

-
-

Definition at line 10 of file Electromechanical.h.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
23/09/2017
+ +

Definition at line 51 of file Electromechanical.h.


The documentation for this class was generated from the following files:
  • Project/Electromechanical.h
  • Project/Electromechanical.cpp
  • diff --git a/docs/doxygen/html/class_electromechanical.js b/docs/doxygen/html/class_electromechanical.js index d6cd3d5..2aa1aa9 100644 --- a/docs/doxygen/html/class_electromechanical.js +++ b/docs/doxygen/html/class_electromechanical.js @@ -3,14 +3,15 @@ var class_electromechanical = [ "Electromechanical", "class_electromechanical.html#a30ecddf5249f545e73b2aaaf19cbec50", null ], [ "~Electromechanical", "class_electromechanical.html#a001abfe3809e6425f7f0bd67adaf28f4", null ], [ "CalculateIntegrationConstants", "class_electromechanical.html#a488985a77171f915145ecc5d891db04f", null ], - [ "CalculateMachinesCurrents", "class_electromechanical.html#a4e3c1766ff06883a681f39d536a41136", null ], + [ "CalculateMachinesCurrents", "class_electromechanical.html#aa59f55e739c674f4ede073eadbb79ac0", null ], [ "CalculateReferenceSpeed", "class_electromechanical.html#af02c1382b8a7d3085831d3a1e89526f6", null ], - [ "CalculateSyncMachineIntVariables", "class_electromechanical.html#a82b5c5c2aeefd49706199d0ba140d300", null ], - [ "CalculateSyncMachineNonIntVariables", "class_electromechanical.html#a10b7ceb1a8066461c5369d210cff48d5", null ], + [ "CalculateSyncMachineIntVariables", "class_electromechanical.html#ac185e65f3073319fc4ac4ec11c328337", null ], + [ "CalculateSyncMachineNonIntVariables", "class_electromechanical.html#a8ca8ab15ead93ee615277698bf0b3867", null ], + [ "CalculateSyncMachineSaturation", "class_electromechanical.html#a900832be747b8b3e41e901235012bf87", null ], [ "EventTrigger", "class_electromechanical.html#a9b076237d26ff011552ed624a5d9bbe2", null ], [ "GetErrorMessage", "class_electromechanical.html#a7972213c6043ca7c890b9f15d3e4162f", null ], - [ "GetPowerValue", "class_electromechanical.html#aad655c165bc53cce5d5fdd8ae9339ba2", null ], [ "GetSyncMachineAdmittance", "class_electromechanical.html#a6192a9b4152353c983b623048b1da460", null ], + [ "GetSyncMachineModelData", "class_electromechanical.html#aa191e34b2a6cbfd0d89c78da14f1d7f7", null ], [ "GetTimeVector", "class_electromechanical.html#ab0d7d031ccc501d5101fabc7b48eb70e", null ], [ "HasEvent", "class_electromechanical.html#a8fc1d8f7b697f8383681e3d3e7d66c72", null ], [ "InitializeDynamicElements", "class_electromechanical.html#a4ccf60ce21c83ff757e1a7de99a00704", null ], @@ -34,7 +35,12 @@ var class_electromechanical = [ "m_plotTime", "class_electromechanical.html#a6c016a1470a0d910e4522b6027f3b95c", null ], [ "m_powerSystemBase", "class_electromechanical.html#a18e698b73396100928175811236eebf4", null ], [ "m_refSpeed", "class_electromechanical.html#aa00d6b356a74649a12fbdd06d44b1d28", null ], + [ "m_saturationTolerance", "class_electromechanical.html#a4029ebc888d91ec49b9bdf9f7cdf2631", null ], + [ "m_sdC", "class_electromechanical.html#a3a7d7043e936b7649a741cf9d39e01b9", null ], + [ "m_sdCVector", "class_electromechanical.html#a4c82ed8fc748149bb116ee532e6ee978", null ], [ "m_simTime", "class_electromechanical.html#a827e9862cf10ebdc65c50f7542b67020", null ], + [ "m_sqC", "class_electromechanical.html#ac684393f47d36a6038d562e92df56ab6", null ], + [ "m_sqCVector", "class_electromechanical.html#a237471acf9a372a9b1cd1481803571d5", null ], [ "m_systemFreq", "class_electromechanical.html#a110cd09af0070718c95d5300adcf754f", null ], [ "m_timeStep", "class_electromechanical.html#a1070faed7544316f653e1a09fcccf475", null ], [ "m_timeVector", "class_electromechanical.html#a3e7a7dfe02d9277957552f5a46f96dd1", null ], diff --git a/docs/doxygen/html/class_element-members.html b/docs/doxygen/html/class_element-members.html index 5b82a3a..2f1fc10 100644 --- a/docs/doxygen/html/class_element-members.html +++ b/docs/doxygen/html/class_element-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_element.html b/docs/doxygen/html/class_element.html index 8f8a29a..e22ec4d 100644 --- a/docs/doxygen/html/class_element.html +++ b/docs/doxygen/html/class_element.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,8 @@ $(document).ready(function(){initNavTree('class_element.html','');});
    Element Class Referenceabstract
+ +

#include <Element.h>

Inheritance diagram for Element:
@@ -96,14 +104,14 @@ Inheritance diagram for Element:
ControlElement GraphicalElement PowerElement -ConnectionLine -Constant -Exponential -Gain -IOControl -Limiter -Multiplier -RateLimiter +ConnectionLine +Constant +Exponential +Gain +IOControl +Limiter +Multiplier +RateLimiter Sum TransferFunction Text @@ -417,8 +425,10 @@ bool m_online = true 

Detailed Description

-
-

Definition at line 88 of file Element.h.

+
Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
+
Date
19/09/2017
+ +

Definition at line 113 of file Element.h.

Member Function Documentation

◆ AddChild()

@@ -452,7 +462,7 @@ bool m_online = true
-

Definition at line 333 of file Element.cpp.

+

Definition at line 353 of file Element.cpp.

@@ -494,14 +504,14 @@ bool m_online = true
Parameters
- +
parentElement parent.
positionNode position in the parent.
positionNode position in the parent.

Reimplemented in Transformer, Text, Bus, Line, Load, Capacitor, Inductor, and Machines.

-

Definition at line 234 of file Element.h.

+

Definition at line 240 of file Element.h.

@@ -537,7 +547,7 @@ bool m_online = true -

Definition at line 240 of file Element.h.

+

Definition at line 245 of file Element.h.

@@ -575,7 +585,7 @@ bool m_online = trueReimplemented in Line, and Branch.

-

Definition at line 321 of file Element.h.

+

Definition at line 318 of file Element.h.

@@ -624,7 +634,7 @@ bool m_online = trueReimplemented in Line.

-

Definition at line 243 of file Element.cpp.

+

Definition at line 263 of file Element.cpp.

@@ -660,7 +670,7 @@ bool m_online = true -

Implemented in Transformer, Text, Bus, Line, IOControl, TransferFunction, Capacitor, Inductor, Constant, Gain, Machines, Sum, ConnectionLine, Exponential, Limiter, Multiplier, RateLimiter, Branch, and Shunt.

+

Implemented in Transformer, Text, Bus, Line, IOControl, Gain, Constant, TransferFunction, Capacitor, Inductor, Exponential, ConnectionLine, Limiter, Multiplier, RateLimiter, Machines, Sum, Branch, and Shunt.

@@ -721,7 +731,7 @@ bool m_online = true -

Definition at line 272 of file Element.cpp.

+

Definition at line 292 of file Element.cpp.

@@ -768,7 +778,7 @@ bool m_online = true -

Reimplemented in Transformer, Bus, Line, Load, IOControl, TransferFunction, Capacitor, Inductor, Machines, Constant, Gain, Sum, Branch, ConnectionLine, Exponential, Limiter, Multiplier, and RateLimiter.

+

Reimplemented in Transformer, Bus, Line, IOControl, Load, Gain, Constant, TransferFunction, Capacitor, Inductor, Exponential, ConnectionLine, Limiter, Multiplier, RateLimiter, Machines, Sum, and Branch.

Definition at line 302 of file Element.h.

@@ -831,7 +841,7 @@ bool m_online = true -

Definition at line 17 of file Element.cpp.

+

Definition at line 33 of file Element.cpp.

@@ -878,7 +888,7 @@ bool m_online = true -

Definition at line 73 of file Element.cpp.

+

Definition at line 89 of file Element.cpp.

@@ -914,7 +924,7 @@ bool m_online = true -

Definition at line 82 of file Element.cpp.

+

Definition at line 98 of file Element.cpp.

@@ -961,7 +971,7 @@ bool m_online = true -

Definition at line 124 of file Element.cpp.

+

Definition at line 139 of file Element.cpp.

@@ -1022,7 +1032,7 @@ bool m_online = true -

Definition at line 53 of file Element.cpp.

+

Definition at line 69 of file Element.cpp.

@@ -1069,7 +1079,7 @@ bool m_online = true -

Definition at line 63 of file Element.cpp.

+

Definition at line 79 of file Element.cpp.

@@ -1116,7 +1126,7 @@ bool m_online = true -

Definition at line 44 of file Element.cpp.

+

Definition at line 60 of file Element.cpp.

@@ -1152,7 +1162,7 @@ bool m_online = true -

Definition at line 228 of file Element.cpp.

+

Definition at line 245 of file Element.cpp.

@@ -1182,7 +1192,7 @@ bool m_online = trueGet the element angle.

Returns
Angle value.
-

Definition at line 201 of file Element.h.

+

Definition at line 212 of file Element.h.

@@ -1214,7 +1224,7 @@ bool m_online = trueReimplemented in Bus, Line, and Branch.

-

Definition at line 401 of file Element.h.

+

Definition at line 389 of file Element.h.

@@ -1244,7 +1254,7 @@ bool m_online = trueGet the Child list.

Returns
Child List.
-

Definition at line 523 of file Element.h.

+

Definition at line 511 of file Element.h.

@@ -1283,7 +1293,7 @@ bool m_online = trueReimplemented in SyncGenerator, SyncMotor, Transformer, Bus, Line, Load, Branch, Capacitor, Inductor, and IndMotor.

-

Definition at line 315 of file Element.h.

+

Definition at line 313 of file Element.h.

@@ -1313,9 +1323,9 @@ bool m_online = trueGet a the element copy.

Returns
Copy of the element.
-

Reimplemented in SyncGenerator, SyncMotor, Transformer, Text, Bus, Line, IOControl, TransferFunction, ConnectionLine, Sum, Gain, Load, Limiter, RateLimiter, Constant, Exponential, IndMotor, Multiplier, Capacitor, and Inductor.

+

Reimplemented in SyncGenerator, SyncMotor, Transformer, Text, Bus, RateLimiter, Line, IOControl, ConnectionLine, TransferFunction, Gain, Exponential, Constant, Limiter, Multiplier, Sum, Load, IndMotor, Capacitor, and Inductor.

-

Definition at line 258 of file Element.h.

+

Definition at line 262 of file Element.h.

@@ -1345,7 +1355,7 @@ bool m_online = trueGet the element height.

Returns
Element height.
-

Definition at line 183 of file Element.h.

+

Definition at line 197 of file Element.h.

@@ -1375,7 +1385,7 @@ bool m_online = trueGet the element ID.

Returns
Element ID.
-

Definition at line 270 of file Element.h.

+

Definition at line 272 of file Element.h.

@@ -1405,7 +1415,7 @@ bool m_online = trueGet the parent list.

Returns
Parent list.
-

Definition at line 517 of file Element.h.

+

Definition at line 506 of file Element.h.

@@ -1435,7 +1445,7 @@ bool m_online = trueGet the list of points that connect the element to bus.

Returns
List of points.
-

Definition at line 225 of file Element.h.

+

Definition at line 232 of file Element.h.

@@ -1465,7 +1475,7 @@ bool m_online = trueGet the element position.

Returns
Element position.
-

Definition at line 171 of file Element.h.

+

Definition at line 187 of file Element.h.

@@ -1495,7 +1505,7 @@ bool m_online = trueGet the element rectangle.

Returns
Element rectangle.
-

Definition at line 165 of file Element.h.

+

Definition at line 182 of file Element.h.

@@ -1525,7 +1535,7 @@ bool m_online = trueGet the angle of rotation.

Returns
Rotation angle.
-

Definition at line 207 of file Element.h.

+

Definition at line 217 of file Element.h.

@@ -1557,7 +1567,7 @@ bool m_online = trueReimplemented in SyncGenerator, SyncMotor, Transformer, Bus, Line, Load, Capacitor, Inductor, and IndMotor.

-

Definition at line 295 of file Element.h.

+

Definition at line 296 of file Element.h.

@@ -1587,7 +1597,7 @@ bool m_online = trueGet the element width.

Returns
Element width.
-

Definition at line 195 of file Element.h.

+

Definition at line 207 of file Element.h.

@@ -1623,7 +1633,7 @@ bool m_online = true -

Implemented in Transformer, Text, Bus, Line, IOControl, TransferFunction, Capacitor, Inductor, Branch, Machines, Constant, Gain, Sum, ConnectionLine, Exponential, Limiter, Multiplier, RateLimiter, and Shunt.

+

Implemented in Transformer, Text, Bus, Line, IOControl, Gain, Constant, TransferFunction, Capacitor, Inductor, Exponential, Branch, ConnectionLine, Limiter, Multiplier, RateLimiter, Machines, Sum, and Shunt.

@@ -1684,7 +1694,7 @@ bool m_online = true -

Definition at line 286 of file Element.cpp.

+

Definition at line 306 of file Element.cpp.

@@ -1714,7 +1724,7 @@ bool m_online = trueChecks if the element is being dragged.

Returns
True if is being dragged, false otherwise.
-

Definition at line 177 of file Element.h.

+

Definition at line 192 of file Element.h.

@@ -1744,7 +1754,7 @@ bool m_online = trueChecks if the element is online or offline.

Returns
True if online, false if offline.
-

Definition at line 219 of file Element.h.

+

Definition at line 227 of file Element.h.

@@ -1774,7 +1784,7 @@ bool m_online = trueChecks if the pickbox is shown.

Returns
True if the pickbox is show, false otherwise.
-

Definition at line 213 of file Element.h.

+

Definition at line 222 of file Element.h.

@@ -1804,7 +1814,7 @@ bool m_online = trueChecks if the element is selected.

Returns
True if selected, false otherwise.
-

Definition at line 189 of file Element.h.

+

Definition at line 202 of file Element.h.

@@ -1840,9 +1850,9 @@ bool m_online = true -

Reimplemented in Transformer, ControlElement, Line, Gain, Machines, ConnectionLine, Branch, and Shunt.

+

Reimplemented in ControlElement, Transformer, Line, Gain, ConnectionLine, Machines, Branch, and Shunt.

-

Definition at line 107 of file Element.cpp.

+

Definition at line 123 of file Element.cpp.

@@ -1883,7 +1893,7 @@ bool m_online = trueMove a node. StartMove(wxPoint2DDouble position) before start moving.

Parameters
- +
parentNode's parent.
parentNode's parent.
positionNew node position.
@@ -1891,7 +1901,7 @@ bool m_online = trueReimplemented in Transformer, Line, Machines, Branch, and Shunt.

-

Definition at line 341 of file Element.h.

+

Definition at line 337 of file Element.h.

@@ -1929,7 +1939,7 @@ bool m_online = trueReimplemented in Bus, Line, and Branch.

-

Definition at line 395 of file Element.h.

+

Definition at line 384 of file Element.h.

@@ -1968,7 +1978,7 @@ bool m_online = trueReimplemented in Machines, Shunt, and Branch.

-

Definition at line 348 of file Element.h.

+

Definition at line 343 of file Element.h.

@@ -2007,7 +2017,7 @@ bool m_online = trueReimplemented in Bus, Line, and Branch.

-

Definition at line 389 of file Element.h.

+

Definition at line 379 of file Element.h.

@@ -2055,7 +2065,7 @@ bool m_online = true
Returns
The distance between the point and the line.
-

Definition at line 365 of file Element.cpp.

+

Definition at line 383 of file Element.cpp.

@@ -2091,7 +2101,7 @@ bool m_online = true
-

Definition at line 335 of file Element.cpp.

+

Definition at line 354 of file Element.cpp.

@@ -2127,9 +2137,9 @@ bool m_online = true -

Reimplemented in Machines, Branch, Shunt, and ConnectionLine.

+

Reimplemented in Machines, ConnectionLine, Branch, and Shunt.

-

Definition at line 367 of file Element.h.

+

Definition at line 359 of file Element.h.

@@ -2176,7 +2186,7 @@ bool m_online = true -

Definition at line 343 of file Element.cpp.

+

Definition at line 362 of file Element.cpp.

@@ -2223,7 +2233,7 @@ bool m_online = true -

Definition at line 326 of file Element.cpp.

+

Definition at line 346 of file Element.cpp.

@@ -2259,9 +2269,9 @@ bool m_online = true -

Reimplemented in Transformer, Text, Bus, Load, IOControl, Machines, TransferFunction, Capacitor, Inductor, Constant, Gain, Sum, Exponential, Limiter, Multiplier, and RateLimiter.

+

Reimplemented in Transformer, Text, Bus, IOControl, Gain, Machines, Constant, Load, TransferFunction, Capacitor, Exponential, Inductor, Limiter, Multiplier, RateLimiter, and Sum.

-

Definition at line 308 of file Element.h.

+

Definition at line 307 of file Element.h.

@@ -2315,7 +2325,7 @@ bool m_online = true -

Definition at line 91 of file Element.cpp.

+

Definition at line 107 of file Element.cpp.

@@ -2376,7 +2386,7 @@ bool m_online = true -

Definition at line 132 of file Element.cpp.

+

Definition at line 147 of file Element.cpp.

@@ -2417,7 +2427,7 @@ bool m_online = trueRotate a node.

Parameters
- +
parentNode's parent.
parentNode's parent.
clockwiseTrue to rotate clockwise, false to rotate counter-clockwise.
@@ -2425,7 +2435,7 @@ bool m_online = trueReimplemented in Transformer, Line, Branch, Machines, and Shunt.

-

Definition at line 381 of file Element.h.

+

Definition at line 372 of file Element.h.

@@ -2461,7 +2471,7 @@ bool m_online = true
-

Definition at line 135 of file Element.h.

+

Definition at line 156 of file Element.h.

@@ -2497,7 +2507,7 @@ bool m_online = true -

Definition at line 147 of file Element.h.

+

Definition at line 166 of file Element.h.

@@ -2533,7 +2543,7 @@ bool m_online = true -

Definition at line 105 of file Element.h.

+

Definition at line 130 of file Element.h.

@@ -2569,7 +2579,7 @@ bool m_online = true -

Definition at line 111 of file Element.h.

+

Definition at line 135 of file Element.h.

@@ -2605,7 +2615,7 @@ bool m_online = true -

Definition at line 264 of file Element.h.

+

Definition at line 267 of file Element.h.

@@ -2636,7 +2646,7 @@ bool m_online = trueSet a perent to the node. If all conditions are met, a new parent are added to the element and the points related to the nodes will be calculated.

Parameters
- +
parentNode parent.
parentNode parent.
@@ -2644,7 +2654,7 @@ bool m_online = trueReimplemented in Transformer, Line, Machines, Shunt, and Branch.

-

Definition at line 361 of file Element.h.

+

Definition at line 354 of file Element.h.

@@ -2672,7 +2682,7 @@ bool m_online = true -

Definition at line 218 of file Element.cpp.

+

Definition at line 235 of file Element.cpp.

@@ -2710,7 +2720,7 @@ bool m_online = trueReimplemented in Line.

-

Definition at line 159 of file Element.h.

+

Definition at line 177 of file Element.h.

@@ -2738,7 +2748,7 @@ bool m_online = true -

Definition at line 10 of file Element.cpp.

+

Definition at line 25 of file Element.cpp.

@@ -2774,7 +2784,7 @@ bool m_online = true -

Definition at line 123 of file Element.h.

+

Definition at line 146 of file Element.h.

@@ -2810,7 +2820,7 @@ bool m_online = true -

Definition at line 129 of file Element.h.

+

Definition at line 151 of file Element.h.

@@ -2858,9 +2868,9 @@ bool m_online = true
Returns
True if the form is shown, false otherwise.
-

Reimplemented in SyncMotor, SyncGenerator, Transformer, Bus, Line, Load, Capacitor, Inductor, IOControl, IndMotor, TransferFunction, Constant, Gain, Sum, Exponential, Limiter, Multiplier, and RateLimiter.

+

Reimplemented in SyncGenerator, SyncMotor, Transformer, Bus, Line, IOControl, Load, Capacitor, Inductor, Gain, Constant, IndMotor, TransferFunction, Exponential, Limiter, Multiplier, RateLimiter, and Sum.

-

Definition at line 547 of file Element.h.

+

Definition at line 534 of file Element.h.

@@ -2896,7 +2906,7 @@ bool m_online = true -

Definition at line 141 of file Element.h.

+

Definition at line 161 of file Element.h.

@@ -2932,9 +2942,9 @@ bool m_online = true -

Reimplemented in Transformer, ControlElement, Line, Machines, ConnectionLine, Shunt, and Branch.

+

Reimplemented in ControlElement, Transformer, Line, ConnectionLine, Machines, Shunt, and Branch.

-

Definition at line 101 of file Element.cpp.

+

Definition at line 117 of file Element.cpp.

@@ -2981,7 +2991,7 @@ bool m_online = true -

Definition at line 300 of file Element.cpp.

+

Definition at line 320 of file Element.cpp.

@@ -3042,7 +3052,7 @@ bool m_online = true -

Definition at line 109 of file Element.cpp.

+

Definition at line 124 of file Element.cpp.

@@ -3110,7 +3120,7 @@ bool m_online = true -

Definition at line 115 of file Element.cpp.

+

Definition at line 130 of file Element.cpp.

diff --git a/docs/doxygen/html/class_element_data_object-members.html b/docs/doxygen/html/class_element_data_object-members.html index 7bebc8c..5c95471 100644 --- a/docs/doxygen/html/class_element_data_object-members.html +++ b/docs/doxygen/html/class_element_data_object-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_element_data_object.html b/docs/doxygen/html/class_element_data_object.html index a9283b0..f8fc6b8 100644 --- a/docs/doxygen/html/class_element_data_object.html +++ b/docs/doxygen/html/class_element_data_object.html @@ -21,6 +21,12 @@ + @@ -121,7 +127,7 @@ Protected Attributes

Detailed Description

-

Definition at line 12 of file ElementDataObject.h.

+

Definition at line 29 of file ElementDataObject.h.


The documentation for this class was generated from the following files:
  • Project/ElementDataObject.h
  • Project/ElementDataObject.cpp
  • diff --git a/docs/doxygen/html/class_element_plot_data-members.html b/docs/doxygen/html/class_element_plot_data-members.html index 7812211..ff2c7c3 100644 --- a/docs/doxygen/html/class_element_plot_data-members.html +++ b/docs/doxygen/html/class_element_plot_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_element_plot_data.html b/docs/doxygen/html/class_element_plot_data.html index 4436e06..49e37fa 100644 --- a/docs/doxygen/html/class_element_plot_data.html +++ b/docs/doxygen/html/class_element_plot_data.html @@ -21,6 +21,12 @@ + @@ -189,7 +195,7 @@ std::vector< PlotData * >

    Detailed Description

    -

    Definition at line 39 of file ElementPlotData.h.

    +

    Definition at line 56 of file ElementPlotData.h.


    The documentation for this class was generated from the following files:
    • Project/ElementPlotData.h
    • Project/ElementPlotData.cpp
    • diff --git a/docs/doxygen/html/class_exponential-members.html b/docs/doxygen/html/class_exponential-members.html index 67d1db9..dea5915 100644 --- a/docs/doxygen/html/class_exponential-members.html +++ b/docs/doxygen/html/class_exponential-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_exponential.html b/docs/doxygen/html/class_exponential.html index 833e923..c5a7707 100644 --- a/docs/doxygen/html/class_exponential.html +++ b/docs/doxygen/html/class_exponential.html @@ -21,6 +21,12 @@ + @@ -86,6 +92,11 @@ $(document).ready(function(){initNavTree('class_exponential.html','');});
      Exponential Class Reference
      + +

      Generates an output following an exponential function. \( output = A\cdot e^{B\cdot input} \). + More...

      + +

      #include <Exponential.h>

      Inheritance diagram for Exponential:
      @@ -465,8 +476,11 @@ Additional Inherited Members  

      Detailed Description

      -
      -

      Definition at line 8 of file Exponential.h.

      +

      Generates an output following an exponential function. \( output = A\cdot e^{B\cdot input} \).

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 33 of file Exponential.h.

      Member Function Documentation

      ◆ Contains()

      @@ -502,7 +516,7 @@ Additional Inherited Members

      Implements Element.

      -

      Definition at line 15 of file Exponential.h.

      +

      Definition at line 40 of file Exponential.h.

      @@ -551,7 +565,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 17 of file Exponential.cpp.

      +

      Definition at line 34 of file Exponential.cpp.

      @@ -583,7 +597,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 121 of file Exponential.cpp.

      +

      Definition at line 138 of file Exponential.cpp.

      @@ -621,7 +635,7 @@ Additional Inherited Members

      Implements Element.

      -

      Definition at line 16 of file Exponential.h.

      +

      Definition at line 41 of file Exponential.h.

      @@ -659,7 +673,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 67 of file Exponential.cpp.

      +

      Definition at line 84 of file Exponential.cpp.

      @@ -709,7 +723,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 56 of file Exponential.cpp.

      +

      Definition at line 73 of file Exponential.cpp.

      diff --git a/docs/doxygen/html/class_exponential_form-members.html b/docs/doxygen/html/class_exponential_form-members.html index 51cd6d3..8289206 100644 --- a/docs/doxygen/html/class_exponential_form-members.html +++ b/docs/doxygen/html/class_exponential_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_exponential_form.html b/docs/doxygen/html/class_exponential_form.html index d080e79..a8e5e9b 100644 --- a/docs/doxygen/html/class_exponential_form.html +++ b/docs/doxygen/html/class_exponential_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_exponential_form.html','');});
      ExponentialForm Class Reference
      + +

      Form to edit the exponential control data. + More...

      + +

      #include <ExponentialForm.h>

      Inheritance diagram for ExponentialForm:
      @@ -184,8 +195,11 @@ wxButton * m_buttonCancel<  

      Detailed Description

      -
      -

      Definition at line 7 of file ExponentialForm.h.

      +

      Form to edit the exponential control data.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 31 of file ExponentialForm.h.


      The documentation for this class was generated from the following files:
      • Project/ExponentialForm.h
      • Project/ExponentialForm.cpp
      • diff --git a/docs/doxygen/html/class_exponential_form_base-members.html b/docs/doxygen/html/class_exponential_form_base-members.html index de38276..359511e 100644 --- a/docs/doxygen/html/class_exponential_form_base-members.html +++ b/docs/doxygen/html/class_exponential_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_exponential_form_base.html b/docs/doxygen/html/class_exponential_form_base.html index e7ffc5f..17bc4b5 100644 --- a/docs/doxygen/html/class_exponential_form_base.html +++ b/docs/doxygen/html/class_exponential_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for ExponentialFormBase:
      -ExponentialForm +ExponentialForm
      diff --git a/docs/doxygen/html/class_fault-members.html b/docs/doxygen/html/class_fault-members.html index 8ab2b89..843046f 100644 --- a/docs/doxygen/html/class_fault-members.html +++ b/docs/doxygen/html/class_fault-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_fault.html b/docs/doxygen/html/class_fault.html index 1abe6d0..bfc3d5d 100644 --- a/docs/doxygen/html/class_fault.html +++ b/docs/doxygen/html/class_fault.html @@ -21,6 +21,12 @@ + @@ -273,7 +279,7 @@ std::vector< Transformer * &g
      Author
      Thales Lima Oliveira
      Date
      10/01/2017
      -

      Definition at line 13 of file Fault.h.

      +

      Definition at line 30 of file Fault.h.

      Constructor & Destructor Documentation

      ◆ Fault()

      @@ -299,7 +305,7 @@ std::vector< Transformer * &g -

      Definition at line 7 of file Fault.cpp.

      +

      Definition at line 24 of file Fault.cpp.

      @@ -330,7 +336,7 @@ std::vector< Transformer * &g

      Get the error message generated in RunFaultCalculation(double systemPowerBase).

      Returns
      Error message.
      -

      Definition at line 54 of file Fault.h.

      +

      Definition at line 71 of file Fault.h.

      @@ -366,7 +372,7 @@ std::vector< Transformer * &g -

      Definition at line 9 of file Fault.cpp.

      +

      Definition at line 26 of file Fault.cpp.

      @@ -402,7 +408,7 @@ std::vector< Transformer * &g -

      Definition at line 382 of file Fault.cpp.

      +

      Definition at line 399 of file Fault.cpp.

      @@ -438,7 +444,7 @@ std::vector< Transformer * &g -

      Definition at line 176 of file Fault.cpp.

      +

      Definition at line 193 of file Fault.cpp.

      diff --git a/docs/doxygen/html/class_file_handing-members.html b/docs/doxygen/html/class_file_handing-members.html index 96b7eee..aa442aa 100644 --- a/docs/doxygen/html/class_file_handing-members.html +++ b/docs/doxygen/html/class_file_handing-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_file_handing.html b/docs/doxygen/html/class_file_handing.html index 9d9bb64..dc4a87b 100644 --- a/docs/doxygen/html/class_file_handing.html +++ b/docs/doxygen/html/class_file_handing.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_file_handing.html','');});
      FileHanding Class Reference
      + +

      Save and opens the projects created on disk. + More...

      + +

      #include <FileHanding.h>

      @@ -176,8 +187,11 @@ Protected Attributes

      Public Member Functions

       

      Detailed Description

      -
      -

      Definition at line 19 of file FileHanding.h.

      +

      Save and opens the projects created on disk.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 43 of file FileHanding.h.


      The documentation for this class was generated from the following files:
      • Project/FileHanding.h
      • Project/FileHanding.cpp
      • diff --git a/docs/doxygen/html/class_gain-members.html b/docs/doxygen/html/class_gain-members.html index 6845354..347d9b2 100644 --- a/docs/doxygen/html/class_gain-members.html +++ b/docs/doxygen/html/class_gain-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_gain.html b/docs/doxygen/html/class_gain.html index 8c502b5..4dd5e4f 100644 --- a/docs/doxygen/html/class_gain.html +++ b/docs/doxygen/html/class_gain.html @@ -21,6 +21,12 @@ + @@ -86,6 +92,11 @@ $(document).ready(function(){initNavTree('class_gain.html','');});
        Gain Class Reference
      + +

      Provide an output multiplying the input by a constant. \( output = K \cdot input \). + More...

      + +

      #include <Gain.h>

      Inheritance diagram for Gain:
      @@ -471,8 +482,11 @@ Additional Inherited Members  

      Detailed Description

      -
      -

      Definition at line 11 of file Gain.h.

      +

      Provide an output multiplying the input by a constant. \( output = K \cdot input \).

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 36 of file Gain.h.

      Member Function Documentation

      ◆ Contains()

      @@ -508,7 +522,7 @@ Additional Inherited Members

      Implements Element.

      -

      Definition at line 18 of file Gain.h.

      +

      Definition at line 43 of file Gain.h.

      @@ -557,7 +571,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 18 of file Gain.cpp.

      +

      Definition at line 35 of file Gain.cpp.

      @@ -589,7 +603,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 177 of file Gain.cpp.

      +

      Definition at line 194 of file Gain.cpp.

      @@ -627,7 +641,7 @@ Additional Inherited Members

      Implements Element.

      -

      Definition at line 19 of file Gain.h.

      +

      Definition at line 44 of file Gain.h.

      @@ -665,7 +679,7 @@ Additional Inherited Members

      Reimplemented from ControlElement.

      -

      Definition at line 165 of file Gain.cpp.

      +

      Definition at line 182 of file Gain.cpp.

      @@ -703,7 +717,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 82 of file Gain.cpp.

      +

      Definition at line 99 of file Gain.cpp.

      @@ -753,7 +767,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 71 of file Gain.cpp.

      +

      Definition at line 88 of file Gain.cpp.

      diff --git a/docs/doxygen/html/class_gain_form-members.html b/docs/doxygen/html/class_gain_form-members.html index cb8d49a..685ba32 100644 --- a/docs/doxygen/html/class_gain_form-members.html +++ b/docs/doxygen/html/class_gain_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_gain_form.html b/docs/doxygen/html/class_gain_form.html index 8cc242c..e7bad86 100644 --- a/docs/doxygen/html/class_gain_form.html +++ b/docs/doxygen/html/class_gain_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_gain_form.html','');});
      GainForm Class Reference
      + +

      Form to edit the gain control data. + More...

      + +

      #include <GainForm.h>

      Inheritance diagram for GainForm:
      @@ -166,8 +177,11 @@ wxButton * m_buttonCancel<  

      Detailed Description

      -
      -

      Definition at line 7 of file GainForm.h.

      +

      Form to edit the gain control data.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 31 of file GainForm.h.


      The documentation for this class was generated from the following files:
      • Project/GainForm.h
      • Project/GainForm.cpp
      • diff --git a/docs/doxygen/html/class_gain_form_base-members.html b/docs/doxygen/html/class_gain_form_base-members.html index cb6774a..a3ffbf9 100644 --- a/docs/doxygen/html/class_gain_form_base-members.html +++ b/docs/doxygen/html/class_gain_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_gain_form_base.html b/docs/doxygen/html/class_gain_form_base.html index 316e708..002a162 100644 --- a/docs/doxygen/html/class_gain_form_base.html +++ b/docs/doxygen/html/class_gain_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for GainFormBase:
      -GainForm +GainForm
      diff --git a/docs/doxygen/html/class_general_properties_form-members.html b/docs/doxygen/html/class_general_properties_form-members.html index afcb9f1..5318c57 100644 --- a/docs/doxygen/html/class_general_properties_form-members.html +++ b/docs/doxygen/html/class_general_properties_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_general_properties_form.html b/docs/doxygen/html/class_general_properties_form.html index 8a54a3b..bbf1322 100644 --- a/docs/doxygen/html/class_general_properties_form.html +++ b/docs/doxygen/html/class_general_properties_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_general_properties_form.html',''
      GeneralPropertiesForm Class Reference
      + +

      Form to edit the software's general data. + More...

      + +

      #include <GeneralPropertiesForm.h>

      Inheritance diagram for GeneralPropertiesForm:
      @@ -175,8 +186,11 @@ wxButton * 
      m_buttonCancel<
       

      Detailed Description

      -
      -

      Definition at line 11 of file GeneralPropertiesForm.h.

      +

      Form to edit the software's general data.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 35 of file GeneralPropertiesForm.h.


      The documentation for this class was generated from the following files:
      • Project/GeneralPropertiesForm.h
      • Project/GeneralPropertiesForm.cpp
      • diff --git a/docs/doxygen/html/class_general_properties_form_base-members.html b/docs/doxygen/html/class_general_properties_form_base-members.html index dccb945..8f87bdb 100644 --- a/docs/doxygen/html/class_general_properties_form_base-members.html +++ b/docs/doxygen/html/class_general_properties_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_general_properties_form_base.html b/docs/doxygen/html/class_general_properties_form_base.html index 14752da..c94c938 100644 --- a/docs/doxygen/html/class_general_properties_form_base.html +++ b/docs/doxygen/html/class_general_properties_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for GeneralPropertiesFormBase:
      -GeneralPropertiesForm +GeneralPropertiesForm
      diff --git a/docs/doxygen/html/class_generator_stab_form-members.html b/docs/doxygen/html/class_generator_stab_form-members.html index b004079..f839113 100644 --- a/docs/doxygen/html/class_generator_stab_form-members.html +++ b/docs/doxygen/html/class_generator_stab_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_generator_stab_form.html b/docs/doxygen/html/class_generator_stab_form.html index 25fcd1a..e44bdc3 100644 --- a/docs/doxygen/html/class_generator_stab_form.html +++ b/docs/doxygen/html/class_generator_stab_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_generator_stab_form.html','');})
      GeneratorStabForm Class Reference
      + +

      Form to edit the synchronous generator data for electromechanical studies. + More...

      + +

      #include <GeneratorStabForm.h>

      Inheritance diagram for GeneratorStabForm:
      @@ -469,8 +480,11 @@ wxButton * 
      m_ButtonCancel<
       

      Detailed Description

      -
      -

      Definition at line 11 of file GeneratorStabForm.h.

      +

      Form to edit the synchronous generator data for electromechanical studies.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 35 of file GeneratorStabForm.h.


      The documentation for this class was generated from the following files:
      • Project/GeneratorStabForm.h
      • Project/GeneratorStabForm.cpp
      • diff --git a/docs/doxygen/html/class_generator_stab_form_base-members.html b/docs/doxygen/html/class_generator_stab_form_base-members.html index a45fb99..24497f2 100644 --- a/docs/doxygen/html/class_generator_stab_form_base-members.html +++ b/docs/doxygen/html/class_generator_stab_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_generator_stab_form_base.html b/docs/doxygen/html/class_generator_stab_form_base.html index fc89cfc..51cbeb5 100644 --- a/docs/doxygen/html/class_generator_stab_form_base.html +++ b/docs/doxygen/html/class_generator_stab_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for GeneratorStabFormBase:
      -GeneratorStabForm +GeneratorStabForm
      diff --git a/docs/doxygen/html/class_graphical_element-members.html b/docs/doxygen/html/class_graphical_element-members.html index 9305fd8..710354b 100644 --- a/docs/doxygen/html/class_graphical_element-members.html +++ b/docs/doxygen/html/class_graphical_element-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_graphical_element.html b/docs/doxygen/html/class_graphical_element.html index c7ef84b..119dc75 100644 --- a/docs/doxygen/html/class_graphical_element.html +++ b/docs/doxygen/html/class_graphical_element.html @@ -21,6 +21,12 @@ + @@ -396,7 +402,7 @@ bool 
      m_online = true

      Detailed Description

      -

      Definition at line 6 of file GraphicalElement.h.

      +

      Definition at line 23 of file GraphicalElement.h.


      The documentation for this class was generated from the following files:
      • Project/GraphicalElement.h
      • Project/GraphicalElement.cpp
      • diff --git a/docs/doxygen/html/class_i_o_control-members.html b/docs/doxygen/html/class_i_o_control-members.html index 955ee6b..3cd401a 100644 --- a/docs/doxygen/html/class_i_o_control-members.html +++ b/docs/doxygen/html/class_i_o_control-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_i_o_control.html b/docs/doxygen/html/class_i_o_control.html index c8a0e9e..e2ebe66 100644 --- a/docs/doxygen/html/class_i_o_control.html +++ b/docs/doxygen/html/class_i_o_control.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_i_o_control.html','');});
        IOControl Class Reference
        + +

        Provides the communication with the power element. + More...

        + +

        #include <IOControl.h>

        Inheritance diagram for IOControl:
        @@ -498,8 +509,11 @@ Additional Inherited Members
       

      Detailed Description

      -
      -

      Definition at line 11 of file IOControl.h.

      +

      Provides the communication with the power element.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 35 of file IOControl.h.

      Member Function Documentation

      ◆ Contains()

      @@ -535,7 +549,7 @@ Additional Inherited Members

      Implements Element.

      -

      Definition at line 27 of file IOControl.h.

      +

      Definition at line 51 of file IOControl.h.

      @@ -584,7 +598,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 19 of file IOControl.cpp.

      +

      Definition at line 36 of file IOControl.cpp.

      @@ -616,7 +630,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 226 of file IOControl.cpp.

      +

      Definition at line 243 of file IOControl.cpp.

      @@ -654,7 +668,7 @@ Additional Inherited Members

      Implements Element.

      -

      Definition at line 28 of file IOControl.h.

      +

      Definition at line 52 of file IOControl.h.

      @@ -692,7 +706,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 116 of file IOControl.cpp.

      +

      Definition at line 133 of file IOControl.cpp.

      @@ -742,7 +756,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 105 of file IOControl.cpp.

      +

      Definition at line 122 of file IOControl.cpp.

      diff --git a/docs/doxygen/html/class_i_o_control_form-members.html b/docs/doxygen/html/class_i_o_control_form-members.html index 55c0c8f..74bad93 100644 --- a/docs/doxygen/html/class_i_o_control_form-members.html +++ b/docs/doxygen/html/class_i_o_control_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_i_o_control_form.html b/docs/doxygen/html/class_i_o_control_form.html index 70aee61..dc6a93d 100644 --- a/docs/doxygen/html/class_i_o_control_form.html +++ b/docs/doxygen/html/class_i_o_control_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_i_o_control_form.html','');});
      IOControlForm Class Reference
      + +

      Form to edit the input/output control data. + More...

      + +

      #include <IOControlForm.h>

      Inheritance diagram for IOControlForm:
      @@ -190,8 +201,11 @@ wxButton * m_ButtonCancel<  

      Detailed Description

      -
      -

      Definition at line 7 of file IOControlForm.h.

      +

      Form to edit the input/output control data.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 31 of file IOControlForm.h.


      The documentation for this class was generated from the following files:
      • Project/IOControlForm.h
      • Project/IOControlForm.cpp
      • diff --git a/docs/doxygen/html/class_i_o_control_form_base-members.html b/docs/doxygen/html/class_i_o_control_form_base-members.html index 7573535..7e8bdad 100644 --- a/docs/doxygen/html/class_i_o_control_form_base-members.html +++ b/docs/doxygen/html/class_i_o_control_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_i_o_control_form_base.html b/docs/doxygen/html/class_i_o_control_form_base.html index 07be9ec..10e1934 100644 --- a/docs/doxygen/html/class_i_o_control_form_base.html +++ b/docs/doxygen/html/class_i_o_control_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for IOControlFormBase:
      -IOControlForm +IOControlForm
      diff --git a/docs/doxygen/html/class_ind_motor-members.html b/docs/doxygen/html/class_ind_motor-members.html index 21de1cf..ed184f3 100644 --- a/docs/doxygen/html/class_ind_motor-members.html +++ b/docs/doxygen/html/class_ind_motor-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_ind_motor.html b/docs/doxygen/html/class_ind_motor.html index 2685a0c..0d80395 100644 --- a/docs/doxygen/html/class_ind_motor.html +++ b/docs/doxygen/html/class_ind_motor.html @@ -21,6 +21,12 @@ + @@ -537,7 +543,7 @@ void 
      UpdatePowerFlowArrows

      Detailed Description

      -

      Definition at line 17 of file IndMotor.h.

      +

      Definition at line 33 of file IndMotor.h.

      Member Function Documentation

      ◆ GetContextMenu()

      @@ -574,7 +580,7 @@ void UpdatePowerFlowArrows

      Reimplemented from Element.

      -

      Definition at line 25 of file IndMotor.cpp.

      +

      Definition at line 35 of file IndMotor.cpp.

      @@ -606,7 +612,7 @@ void UpdatePowerFlowArrows

      Reimplemented from Element.

      -

      Definition at line 83 of file IndMotor.cpp.

      +

      Definition at line 93 of file IndMotor.cpp.

      @@ -638,7 +644,7 @@ void UpdatePowerFlowArrows

      Reimplemented from Element.

      -

      Definition at line 90 of file IndMotor.cpp.

      +

      Definition at line 100 of file IndMotor.cpp.

      @@ -688,7 +694,7 @@ void UpdatePowerFlowArrows

      Reimplemented from Element.

      -

      Definition at line 32 of file IndMotor.cpp.

      +

      Definition at line 42 of file IndMotor.cpp.

      diff --git a/docs/doxygen/html/class_ind_motor_form-members.html b/docs/doxygen/html/class_ind_motor_form-members.html index 82385d8..40230c2 100644 --- a/docs/doxygen/html/class_ind_motor_form-members.html +++ b/docs/doxygen/html/class_ind_motor_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_ind_motor_form.html b/docs/doxygen/html/class_ind_motor_form.html index ac6498b..24b4a09 100644 --- a/docs/doxygen/html/class_ind_motor_form.html +++ b/docs/doxygen/html/class_ind_motor_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_ind_motor_form.html','');});
      IndMotorForm Class Reference
      + +

      Form to edit the induction motor power data. + More...

      + +

      #include <IndMotorForm.h>

      Inheritance diagram for IndMotorForm:
      @@ -211,8 +222,11 @@ wxButton * m_ButtonCancel<  

      Detailed Description

      -
      -

      Definition at line 7 of file IndMotorForm.h.

      +

      Form to edit the induction motor power data.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 31 of file IndMotorForm.h.


      The documentation for this class was generated from the following files:
      • Project/IndMotorForm.h
      • Project/IndMotorForm.cpp
      • diff --git a/docs/doxygen/html/class_ind_motor_form_base-members.html b/docs/doxygen/html/class_ind_motor_form_base-members.html index 511915d..7e5d02b 100644 --- a/docs/doxygen/html/class_ind_motor_form_base-members.html +++ b/docs/doxygen/html/class_ind_motor_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_ind_motor_form_base.html b/docs/doxygen/html/class_ind_motor_form_base.html index 0dab4d6..e96ebee 100644 --- a/docs/doxygen/html/class_ind_motor_form_base.html +++ b/docs/doxygen/html/class_ind_motor_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for IndMotorFormBase:
      -IndMotorForm +IndMotorForm
      diff --git a/docs/doxygen/html/class_inductor-members.html b/docs/doxygen/html/class_inductor-members.html index 51287a9..d91e97d 100644 --- a/docs/doxygen/html/class_inductor-members.html +++ b/docs/doxygen/html/class_inductor-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_inductor.html b/docs/doxygen/html/class_inductor.html index 0a3fbd0..f80de12 100644 --- a/docs/doxygen/html/class_inductor.html +++ b/docs/doxygen/html/class_inductor.html @@ -21,6 +21,12 @@ + @@ -526,7 +532,7 @@ void 
      DrawGround (wxPoi

      Detailed Description

      -

      Definition at line 14 of file Inductor.h.

      +

      Definition at line 31 of file Inductor.h.

      Member Function Documentation

      ◆ AddParent()

      @@ -566,14 +572,14 @@ void DrawGround (wxPoi
      Parameters
      - +
      parentElement parent.
      positionNode position in the parent.
      positionNode position in the parent.

      Reimplemented from Element.

      -

      Definition at line 7 of file Inductor.cpp.

      +

      Definition at line 24 of file Inductor.cpp.

      @@ -611,7 +617,7 @@ void DrawGround (wxPoi

      Reimplemented from Shunt.

      -

      Definition at line 115 of file Inductor.cpp.

      +

      Definition at line 132 of file Inductor.cpp.

      @@ -660,7 +666,7 @@ void DrawGround (wxPoi

      Reimplemented from Element.

      -

      Definition at line 38 of file Inductor.cpp.

      +

      Definition at line 55 of file Inductor.cpp.

      @@ -699,7 +705,7 @@ void DrawGround (wxPoi

      Reimplemented from Element.

      -

      Definition at line 108 of file Inductor.cpp.

      +

      Definition at line 125 of file Inductor.cpp.

      @@ -731,7 +737,7 @@ void DrawGround (wxPoi

      Reimplemented from Element.

      -

      Definition at line 157 of file Inductor.cpp.

      +

      Definition at line 174 of file Inductor.cpp.

      @@ -763,7 +769,7 @@ void DrawGround (wxPoi

      Reimplemented from Element.

      -

      Definition at line 164 of file Inductor.cpp.

      +

      Definition at line 181 of file Inductor.cpp.

      @@ -801,7 +807,7 @@ void DrawGround (wxPoi

      Reimplemented from Shunt.

      -

      Definition at line 121 of file Inductor.cpp.

      +

      Definition at line 138 of file Inductor.cpp.

      @@ -839,7 +845,7 @@ void DrawGround (wxPoi

      Reimplemented from Element.

      -

      Definition at line 96 of file Inductor.cpp.

      +

      Definition at line 113 of file Inductor.cpp.

      @@ -889,7 +895,7 @@ void DrawGround (wxPoi

      Reimplemented from Element.

      -

      Definition at line 122 of file Inductor.cpp.

      +

      Definition at line 139 of file Inductor.cpp.

      diff --git a/docs/doxygen/html/class_limiter-members.html b/docs/doxygen/html/class_limiter-members.html index a535a0d..a3e392e 100644 --- a/docs/doxygen/html/class_limiter-members.html +++ b/docs/doxygen/html/class_limiter-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_limiter.html b/docs/doxygen/html/class_limiter.html index 024dbd6..ab00761 100644 --- a/docs/doxygen/html/class_limiter.html +++ b/docs/doxygen/html/class_limiter.html @@ -21,6 +21,12 @@ + @@ -86,6 +92,11 @@ $(document).ready(function(){initNavTree('class_limiter.html','');});
      Limiter Class Reference
      + +

      Limits the input value by superior and inferior values. + More...

      + +

      #include <Limiter.h>

      Inheritance diagram for Limiter:
      @@ -471,8 +482,11 @@ Additional Inherited Members  

      Detailed Description

      -
      -

      Definition at line 8 of file Limiter.h.

      +

      Limits the input value by superior and inferior values.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 32 of file Limiter.h.

      Member Function Documentation

      ◆ Contains()

      @@ -508,7 +522,7 @@ Additional Inherited Members

      Implements Element.

      -

      Definition at line 15 of file Limiter.h.

      +

      Definition at line 39 of file Limiter.h.

      @@ -557,7 +571,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 17 of file Limiter.cpp.

      +

      Definition at line 34 of file Limiter.cpp.

      @@ -589,7 +603,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 100 of file Limiter.cpp.

      +

      Definition at line 119 of file Limiter.cpp.

      @@ -627,7 +641,7 @@ Additional Inherited Members

      Implements Element.

      -

      Definition at line 16 of file Limiter.h.

      +

      Definition at line 40 of file Limiter.h.

      @@ -665,7 +679,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 55 of file Limiter.cpp.

      +

      Definition at line 72 of file Limiter.cpp.

      @@ -715,7 +729,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 44 of file Limiter.cpp.

      +

      Definition at line 61 of file Limiter.cpp.

      diff --git a/docs/doxygen/html/class_limiter_form-members.html b/docs/doxygen/html/class_limiter_form-members.html index e84277e..01419d9 100644 --- a/docs/doxygen/html/class_limiter_form-members.html +++ b/docs/doxygen/html/class_limiter_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_limiter_form.html b/docs/doxygen/html/class_limiter_form.html index 89591fe..935e8de 100644 --- a/docs/doxygen/html/class_limiter_form.html +++ b/docs/doxygen/html/class_limiter_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_limiter_form.html','');});
      LimiterForm Class Reference
      + +

      Form to edit the limit control data. + More...

      + +

      #include <LimiterForm.h>

      Inheritance diagram for LimiterForm:
      @@ -178,8 +189,11 @@ wxButton * m_ButtonCancel<  

      Detailed Description

      -
      -

      Definition at line 7 of file LimiterForm.h.

      +

      Form to edit the limit control data.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 31 of file LimiterForm.h.


      The documentation for this class was generated from the following files:
      • Project/LimiterForm.h
      • Project/LimiterForm.cpp
      • diff --git a/docs/doxygen/html/class_limiter_form_base-members.html b/docs/doxygen/html/class_limiter_form_base-members.html index 9baab18..ceb2b77 100644 --- a/docs/doxygen/html/class_limiter_form_base-members.html +++ b/docs/doxygen/html/class_limiter_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_limiter_form_base.html b/docs/doxygen/html/class_limiter_form_base.html index 79c6648..b835d4b 100644 --- a/docs/doxygen/html/class_limiter_form_base.html +++ b/docs/doxygen/html/class_limiter_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for LimiterFormBase:
      -LimiterForm +LimiterForm
      diff --git a/docs/doxygen/html/class_line-members.html b/docs/doxygen/html/class_line-members.html index 98a79a4..5258159 100644 --- a/docs/doxygen/html/class_line-members.html +++ b/docs/doxygen/html/class_line-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_line.html b/docs/doxygen/html/class_line.html index 75049f5..f389522 100644 --- a/docs/doxygen/html/class_line.html +++ b/docs/doxygen/html/class_line.html @@ -21,6 +21,12 @@ + @@ -532,7 +538,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 35 of file Line.h.

      +

      Definition at line 52 of file Line.h.

      Member Function Documentation

      ◆ AddParent()

      @@ -572,14 +578,14 @@ Additional Inherited Members
      Parameters
      - +
      parentElement parent.
      positionNode position in the parent.
      positionNode position in the parent.

      Reimplemented from Element.

      -

      Definition at line 119 of file Line.cpp.

      +

      Definition at line 136 of file Line.cpp.

      @@ -617,7 +623,7 @@ Additional Inherited Members

      Reimplemented from Branch.

      -

      Definition at line 217 of file Line.cpp.

      +

      Definition at line 234 of file Line.cpp.

      @@ -666,7 +672,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 315 of file Line.cpp.

      +

      Definition at line 335 of file Line.cpp.

      @@ -704,7 +710,7 @@ Additional Inherited Members

      Reimplemented from Branch.

      -

      Definition at line 22 of file Line.cpp.

      +

      Definition at line 39 of file Line.cpp.

      @@ -753,7 +759,7 @@ Additional Inherited Members

      Reimplemented from Branch.

      -

      Definition at line 30 of file Line.cpp.

      +

      Definition at line 47 of file Line.cpp.

      @@ -785,7 +791,7 @@ Additional Inherited Members

      Reimplemented from Branch.

      -

      Definition at line 47 of file Line.h.

      +

      Definition at line 64 of file Line.h.

      @@ -824,7 +830,7 @@ Additional Inherited Members

      Reimplemented from Branch.

      -

      Definition at line 272 of file Line.cpp.

      +

      Definition at line 289 of file Line.cpp.

      @@ -856,7 +862,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 479 of file Line.cpp.

      +

      Definition at line 499 of file Line.cpp.

      @@ -888,7 +894,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 486 of file Line.cpp.

      +

      Definition at line 506 of file Line.cpp.

      @@ -926,7 +932,7 @@ Additional Inherited Members

      Reimplemented from Branch.

      -

      Definition at line 186 of file Line.cpp.

      +

      Definition at line 203 of file Line.cpp.

      @@ -964,7 +970,7 @@ Additional Inherited Members

      Reimplemented from Branch.

      -

      Definition at line 99 of file Line.cpp.

      +

      Definition at line 116 of file Line.cpp.

      @@ -1005,7 +1011,7 @@ Additional Inherited Members

      Move a node. StartMove(wxPoint2DDouble position) before start moving.

      Parameters
      - +
      parentNode's parent.
      parentNode's parent.
      positionNew node position.
      @@ -1013,7 +1019,7 @@ Additional Inherited Members

      Reimplemented from Branch.

      -

      Definition at line 230 of file Line.cpp.

      +

      Definition at line 247 of file Line.cpp.

      @@ -1051,7 +1057,7 @@ Additional Inherited Members

      Reimplemented from Branch.

      -

      Definition at line 193 of file Line.cpp.

      +

      Definition at line 210 of file Line.cpp.

      @@ -1090,7 +1096,7 @@ Additional Inherited Members

      Reimplemented from Branch.

      -

      Definition at line 205 of file Line.cpp.

      +

      Definition at line 222 of file Line.cpp.

      @@ -1131,7 +1137,7 @@ Additional Inherited Members

      Rotate a node.

      Parameters
      - +
      parentNode's parent.
      parentNode's parent.
      clockwiseTrue to rotate clockwise, false to rotate counter-clockwise.
      @@ -1139,7 +1145,7 @@ Additional Inherited Members

      Reimplemented from Branch.

      -

      Definition at line 458 of file Line.cpp.

      +

      Definition at line 478 of file Line.cpp.

      @@ -1170,7 +1176,7 @@ Additional Inherited Members

      Set a perent to the node. If all conditions are met, a new parent are added to the element and the points related to the nodes will be calculated.

      Parameters
      - +
      parentNode parent.
      parentNode parent.
      @@ -1178,7 +1184,7 @@ Additional Inherited Members

      Reimplemented from Branch.

      -

      Definition at line 349 of file Line.cpp.

      +

      Definition at line 369 of file Line.cpp.

      @@ -1227,7 +1233,7 @@ Additional Inherited Members

      Reimplemented from PowerElement.

      -

      Definition at line 341 of file Line.cpp.

      +

      Definition at line 361 of file Line.cpp.

      @@ -1265,7 +1271,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 472 of file Line.cpp.

      +

      Definition at line 492 of file Line.cpp.

      @@ -1303,7 +1309,7 @@ Additional Inherited Members

      Reimplemented from PowerElement.

      -

      Definition at line 429 of file Line.cpp.

      +

      Definition at line 449 of file Line.cpp.

      @@ -1353,7 +1359,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 330 of file Line.cpp.

      +

      Definition at line 350 of file Line.cpp.

      @@ -1391,7 +1397,7 @@ Additional Inherited Members

      Reimplemented from Branch.

      -

      Definition at line 224 of file Line.cpp.

      +

      Definition at line 241 of file Line.cpp.

      diff --git a/docs/doxygen/html/class_line_form-members.html b/docs/doxygen/html/class_line_form-members.html index 108ff58..969a833 100644 --- a/docs/doxygen/html/class_line_form-members.html +++ b/docs/doxygen/html/class_line_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_line_form.html b/docs/doxygen/html/class_line_form.html index f0b3678..fece702 100644 --- a/docs/doxygen/html/class_line_form.html +++ b/docs/doxygen/html/class_line_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_line_form.html','');});
      LineForm Class Reference
      + +

      Form to edit the line power data. + More...

      + +

      #include <LineForm.h>

      Inheritance diagram for LineForm:
      @@ -328,8 +339,11 @@ wxButton * m_buttonCancel<  

      Detailed Description

      -
      -

      Definition at line 8 of file LineForm.h.

      +

      Form to edit the line power data.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 32 of file LineForm.h.


      The documentation for this class was generated from the following files:
      • Project/LineForm.h
      • Project/LineForm.cpp
      • diff --git a/docs/doxygen/html/class_line_form_base-members.html b/docs/doxygen/html/class_line_form_base-members.html index 7f242fe..7951696 100644 --- a/docs/doxygen/html/class_line_form_base-members.html +++ b/docs/doxygen/html/class_line_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_line_form_base.html b/docs/doxygen/html/class_line_form_base.html index af41940..d83e65f 100644 --- a/docs/doxygen/html/class_line_form_base.html +++ b/docs/doxygen/html/class_line_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for LineFormBase:
      -LineForm +LineForm
      diff --git a/docs/doxygen/html/class_load-members.html b/docs/doxygen/html/class_load-members.html index c5738f5..9e58351 100644 --- a/docs/doxygen/html/class_load-members.html +++ b/docs/doxygen/html/class_load-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_load.html b/docs/doxygen/html/class_load.html index 13dcb2b..9c5c62d 100644 --- a/docs/doxygen/html/class_load.html +++ b/docs/doxygen/html/class_load.html @@ -21,6 +21,12 @@ + @@ -529,7 +535,7 @@ void 
      DrawGround (wxPoi

      Detailed Description

      -

      Definition at line 23 of file Load.h.

      +

      Definition at line 35 of file Load.h.

      Member Function Documentation

      ◆ AddParent()

      @@ -569,14 +575,14 @@ void DrawGround (wxPoi
      Parameters
      - +
      parentElement parent.
      positionNode position in the parent.
      positionNode position in the parent.

      Reimplemented from Element.

      -

      Definition at line 6 of file Load.cpp.

      +

      Definition at line 23 of file Load.cpp.

      @@ -625,7 +631,7 @@ void DrawGround (wxPoi

      Reimplemented from Element.

      -

      Definition at line 42 of file Load.cpp.

      +

      Definition at line 59 of file Load.cpp.

      @@ -664,7 +670,7 @@ void DrawGround (wxPoi

      Reimplemented from Element.

      -

      Definition at line 117 of file Load.cpp.

      +

      Definition at line 134 of file Load.cpp.

      @@ -696,7 +702,7 @@ void DrawGround (wxPoi

      Reimplemented from Element.

      -

      Definition at line 174 of file Load.cpp.

      +

      Definition at line 191 of file Load.cpp.

      @@ -728,7 +734,7 @@ void DrawGround (wxPoi

      Reimplemented from Element.

      -

      Definition at line 181 of file Load.cpp.

      +

      Definition at line 198 of file Load.cpp.

      @@ -766,7 +772,7 @@ void DrawGround (wxPoi

      Reimplemented from Element.

      -

      Definition at line 104 of file Load.cpp.

      +

      Definition at line 121 of file Load.cpp.

      @@ -816,7 +822,7 @@ void DrawGround (wxPoi

      Reimplemented from Element.

      -

      Definition at line 124 of file Load.cpp.

      +

      Definition at line 141 of file Load.cpp.

      diff --git a/docs/doxygen/html/class_load_form-members.html b/docs/doxygen/html/class_load_form-members.html index fd5055f..342ac84 100644 --- a/docs/doxygen/html/class_load_form-members.html +++ b/docs/doxygen/html/class_load_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_load_form.html b/docs/doxygen/html/class_load_form.html index 60fa295..536f637 100644 --- a/docs/doxygen/html/class_load_form.html +++ b/docs/doxygen/html/class_load_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_load_form.html','');});
      LoadForm Class Reference
      + +

      Form to edit the load power data. + More...

      + +

      #include <LoadForm.h>

      Inheritance diagram for LoadForm:
      @@ -223,8 +234,11 @@ wxButton * m_ButtonCancel<  

      Detailed Description

      -
      -

      Definition at line 8 of file LoadForm.h.

      +

      Form to edit the load power data.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 32 of file LoadForm.h.


      The documentation for this class was generated from the following files:
      • Project/LoadForm.h
      • Project/LoadForm.cpp
      • diff --git a/docs/doxygen/html/class_load_form_base-members.html b/docs/doxygen/html/class_load_form_base-members.html index 235029c..084386b 100644 --- a/docs/doxygen/html/class_load_form_base-members.html +++ b/docs/doxygen/html/class_load_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_load_form_base.html b/docs/doxygen/html/class_load_form_base.html index 217e812..d83caa5 100644 --- a/docs/doxygen/html/class_load_form_base.html +++ b/docs/doxygen/html/class_load_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for LoadFormBase:
      -LoadForm +LoadForm
      diff --git a/docs/doxygen/html/class_machines-members.html b/docs/doxygen/html/class_machines-members.html index b1245be..23d779a 100644 --- a/docs/doxygen/html/class_machines-members.html +++ b/docs/doxygen/html/class_machines-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_machines.html b/docs/doxygen/html/class_machines.html index 90e706a..fca9c4c 100644 --- a/docs/doxygen/html/class_machines.html +++ b/docs/doxygen/html/class_machines.html @@ -21,6 +21,12 @@ + @@ -528,7 +534,7 @@ Additional Inherited Members

      Detailed Description

      -

      Definition at line 9 of file Machines.h.

      +

      Definition at line 26 of file Machines.h.

      Member Function Documentation

      ◆ AddParent()

      @@ -568,14 +574,14 @@ Additional Inherited Members
      Parameters
      - +
      parentElement parent.
      positionNode position in the parent.
      positionNode position in the parent.

      Reimplemented from Element.

      -

      Definition at line 8 of file Machines.cpp.

      +

      Definition at line 25 of file Machines.cpp.

      @@ -613,7 +619,7 @@ Additional Inherited Members

      Implements Element.

      -

      Definition at line 18 of file Machines.h.

      +

      Definition at line 35 of file Machines.h.

      @@ -662,7 +668,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 37 of file Machines.cpp.

      +

      Definition at line 54 of file Machines.cpp.

      @@ -700,7 +706,7 @@ Additional Inherited Members

      Implements Element.

      -

      Definition at line 20 of file Machines.h.

      +

      Definition at line 37 of file Machines.h.

      @@ -738,7 +744,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 94 of file Machines.cpp.

      +

      Definition at line 111 of file Machines.cpp.

      @@ -779,7 +785,7 @@ Additional Inherited Members

      Move a node. StartMove(wxPoint2DDouble position) before start moving.

      Parameters
      - +
      parentNode's parent.
      parentNode's parent.
      positionNew node position.
      @@ -787,7 +793,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 107 of file Machines.cpp.

      +

      Definition at line 124 of file Machines.cpp.

      @@ -826,7 +832,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 158 of file Machines.cpp.

      +

      Definition at line 175 of file Machines.cpp.

      @@ -864,7 +870,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 148 of file Machines.cpp.

      +

      Definition at line 165 of file Machines.cpp.

      @@ -902,7 +908,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 215 of file Machines.cpp.

      +

      Definition at line 232 of file Machines.cpp.

      @@ -943,7 +949,7 @@ Additional Inherited Members

      Rotate a node.

      Parameters
      - +
      parentNode's parent.
      parentNode's parent.
      clockwiseTrue to rotate clockwise, false to rotate counter-clockwise.
      @@ -951,7 +957,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 136 of file Machines.cpp.

      +

      Definition at line 153 of file Machines.cpp.

      @@ -982,7 +988,7 @@ Additional Inherited Members

      Set a perent to the node. If all conditions are met, a new parent are added to the element and the points related to the nodes will be calculated.

      Parameters
      - +
      parentNode parent.
      parentNode parent.
      @@ -990,7 +996,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 172 of file Machines.cpp.

      +

      Definition at line 189 of file Machines.cpp.

      @@ -1028,7 +1034,7 @@ Additional Inherited Members

      Reimplemented from PowerElement.

      -

      Definition at line 250 of file Machines.cpp.

      +

      Definition at line 267 of file Machines.cpp.

      @@ -1066,7 +1072,7 @@ Additional Inherited Members

      Reimplemented from Element.

      -

      Definition at line 129 of file Machines.cpp.

      +

      Definition at line 146 of file Machines.cpp.

      diff --git a/docs/doxygen/html/class_main_app-members.html b/docs/doxygen/html/class_main_app-members.html index a9c986b..bf25d4a 100644 --- a/docs/doxygen/html/class_main_app-members.html +++ b/docs/doxygen/html/class_main_app-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_main_app.html b/docs/doxygen/html/class_main_app.html index a223ed1..935803c 100644 --- a/docs/doxygen/html/class_main_app.html +++ b/docs/doxygen/html/class_main_app.html @@ -21,6 +21,12 @@ + @@ -108,7 +114,7 @@ virtual bool OnInit ()

      Detailed Description

      -

      Definition at line 11 of file main.cpp.

      +

      Definition at line 12 of file main.cpp.


      The documentation for this class was generated from the following file: diff --git a/docs/doxygen/html/class_main_frame-members.html b/docs/doxygen/html/class_main_frame-members.html index eb4863d..868b7e4 100644 --- a/docs/doxygen/html/class_main_frame-members.html +++ b/docs/doxygen/html/class_main_frame-members.html @@ -21,6 +21,12 @@ + @@ -151,8 +157,8 @@ $(document).ready(function(){initNavTree('class_main_frame.html','');}); m_ribbonPanelSimulations (defined in MainFrameBase)MainFrameBaseprotected m_statusBar (defined in MainFrameBase)MainFrameBaseprotected m_workspaceList (defined in MainFrame)MainFrameprotected - MainFrame() (defined in MainFrame)MainFrame - MainFrame(wxWindow *parent, wxLocale *locale, PropertiesData *initProperties) (defined in MainFrame)MainFrame + MainFrame()MainFrame + MainFrame(wxWindow *parent, wxLocale *locale, PropertiesData *initProperties, wxString openPath="")MainFrame MainFrameBase(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("PSP-UFU"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(800, 600), long style=wxCAPTION|wxRESIZE_BORDER|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxSYSTEM_MENU|wxCLOSE_BOX) (defined in MainFrameBase)MainFrameBase NotebookPageClosed(wxAuiNotebookEvent &event) (defined in MainFrame)MainFrameprotectedvirtual NotebookPageClosing(wxAuiNotebookEvent &event) (defined in MainFrame)MainFrameprotectedvirtual @@ -189,7 +195,7 @@ $(document).ready(function(){initNavTree('class_main_frame.html','');}); OnSimulationSettingsClick(wxRibbonButtonBarEvent &event) (defined in MainFrame)MainFrameprotectedvirtual OnSnapshotClick(wxRibbonButtonBarEvent &event) (defined in MainFrame)MainFrameprotectedvirtual OnUndoClick(wxRibbonButtonBarEvent &event) (defined in MainFrame)MainFrameprotectedvirtual - ~MainFrame() (defined in MainFrame)MainFrame + ~MainFrame()MainFrame ~MainFrameBase() (defined in MainFrameBase)MainFrameBasevirtual diff --git a/docs/doxygen/html/class_main_frame.html b/docs/doxygen/html/class_main_frame.html index d49d4e4..2a3b364 100644 --- a/docs/doxygen/html/class_main_frame.html +++ b/docs/doxygen/html/class_main_frame.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_main_frame.html','');});
      MainFrame Class Reference
      + +

      Main frame of the program. This class manage the ribbon menu and the notebook behavior. + More...

      + +

      #include <MainFrame.h>

      Inheritance diagram for MainFrame:
      @@ -99,9 +110,17 @@ Inheritance diagram for MainFrame:
      - - + + + + + + + + + @@ -369,9 +388,65 @@ Additional Inherited Members

      Public Member Functions

      MainFrame (wxWindow *parent, wxLocale *locale, PropertiesData *initProperties)
       
      MainFrame ()
       Default constructor.
       
       MainFrame (wxWindow *parent, wxLocale *locale, PropertiesData *initProperties, wxString openPath="")
       Main frame contructor. More...
       
      ~MainFrame ()
       Default destructor.
       
      - Public Member Functions inherited from MainFrameBase
      wxRibbonBar * GetRibbonBar ()
       

      Detailed Description

      -
      -

      Definition at line 33 of file MainFrame.h.

      -

      The documentation for this class was generated from the following files:
        +

        Main frame of the program. This class manage the ribbon menu and the notebook behavior.

        +
        Author
        Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
        +
        Date
        19/09/2017
        + +

        Definition at line 57 of file MainFrame.h.

        +

        Constructor & Destructor Documentation

        + +

        ◆ MainFrame()

        + +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        MainFrame::MainFrame (wxWindow * parent,
        wxLocale * locale,
        PropertiesDatainitProperties,
        wxString openPath = "" 
        )
        +
        + +

        Main frame contructor.

        +
        Parameters
        + + + + +
        parentParent window.
        localeLocale settings.
        initPropertiesInitial properties.
        +
        +
        + +

        Definition at line 39 of file MainFrame.cpp.

        + +
        +
        +
        The documentation for this class was generated from the following files: diff --git a/docs/doxygen/html/class_main_frame.js b/docs/doxygen/html/class_main_frame.js index 39a53f6..d45f170 100644 --- a/docs/doxygen/html/class_main_frame.js +++ b/docs/doxygen/html/class_main_frame.js @@ -1,7 +1,7 @@ var class_main_frame = [ [ "MainFrame", "class_main_frame.html#a667b44053cae174a361cfd21124ef995", null ], - [ "MainFrame", "class_main_frame.html#ac5d3dc03594f76ed6e5fd1ccecfc5b0b", null ], + [ "MainFrame", "class_main_frame.html#ac3288e93c5b8682863574bc47c9e9ff8", null ], [ "~MainFrame", "class_main_frame.html#a0cfd88ece4836e0ea5430bd55370bf11", null ], [ "CreateAddElementsMenu", "class_main_frame.html#aade761601af16dadcbf24cd2a4e8d289", null ], [ "EnableCurrentProjectRibbon", "class_main_frame.html#ad1475f1bb8a05169b3d3d462008c887b", null ], diff --git a/docs/doxygen/html/class_main_frame_base-members.html b/docs/doxygen/html/class_main_frame_base-members.html index fae7e86..6c00475 100644 --- a/docs/doxygen/html/class_main_frame_base-members.html +++ b/docs/doxygen/html/class_main_frame_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_main_frame_base.html b/docs/doxygen/html/class_main_frame_base.html index a838e09..f2897bb 100644 --- a/docs/doxygen/html/class_main_frame_base.html +++ b/docs/doxygen/html/class_main_frame_base.html @@ -21,6 +21,12 @@ + @@ -94,7 +100,7 @@ Inheritance diagram for MainFrameBase:
      -MainFrame +MainFrame
      diff --git a/docs/doxygen/html/class_multiplier-members.html b/docs/doxygen/html/class_multiplier-members.html index 4e21455..3763cbb 100644 --- a/docs/doxygen/html/class_multiplier-members.html +++ b/docs/doxygen/html/class_multiplier-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_multiplier.html b/docs/doxygen/html/class_multiplier.html index a444a0c..2aa50e8 100644 --- a/docs/doxygen/html/class_multiplier.html +++ b/docs/doxygen/html/class_multiplier.html @@ -21,6 +21,12 @@ + @@ -85,6 +91,11 @@ $(document).ready(function(){initNavTree('class_multiplier.html','');});
      Multiplier Class Reference
      + +

      Multiplies two inputs. + More...

      + +

      #include <Multiplier.h>

      Inheritance diagram for Multiplier:
      @@ -449,8 +460,11 @@ bool 
      m_online = true 

      Detailed Description

      -
      -

      Definition at line 8 of file Multiplier.h.

      +

      Multiplies two inputs.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 32 of file Multiplier.h.

      Member Function Documentation

      ◆ Contains()

      @@ -486,7 +500,7 @@ bool m_online = trueImplements Element.

      -

      Definition at line 15 of file Multiplier.h.

      +

      Definition at line 39 of file Multiplier.h.

      @@ -535,7 +549,7 @@ bool m_online = trueReimplemented from Element.

      -

      Definition at line 20 of file Multiplier.cpp.

      +

      Definition at line 37 of file Multiplier.cpp.

      @@ -567,7 +581,7 @@ bool m_online = trueReimplemented from Element.

      -

      Definition at line 119 of file Multiplier.cpp.

      +

      Definition at line 136 of file Multiplier.cpp.

      @@ -605,7 +619,7 @@ bool m_online = trueImplements Element.

      -

      Definition at line 16 of file Multiplier.h.

      +

      Definition at line 40 of file Multiplier.h.

      @@ -643,7 +657,7 @@ bool m_online = trueReimplemented from Element.

      -

      Definition at line 47 of file Multiplier.cpp.

      +

      Definition at line 64 of file Multiplier.cpp.

      @@ -693,7 +707,7 @@ bool m_online = trueReimplemented from Element.

      -

      Definition at line 17 of file Multiplier.h.

      +

      Definition at line 41 of file Multiplier.h.

      diff --git a/docs/doxygen/html/class_node-members.html b/docs/doxygen/html/class_node-members.html index 91d338f..6b70c73 100644 --- a/docs/doxygen/html/class_node-members.html +++ b/docs/doxygen/html/class_node-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_node.html b/docs/doxygen/html/class_node.html index 9fab95c..c6cdda8 100644 --- a/docs/doxygen/html/class_node.html +++ b/docs/doxygen/html/class_node.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_node.html','');});
      Node Class Reference
      + +

      Node of a control element. This class manages the user interaction with the connection and control elements. + More...

      + +

      #include <ControlElement.h>

      @@ -189,8 +200,11 @@ double 

      Public Types

      m_angle = 0.0 

      Detailed Description

      -
      -

      Definition at line 6 of file ControlElement.h.

      +

      Node of a control element. This class manages the user interaction with the connection and control elements.

      +
      Author
      Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
      +
      Date
      05/10/2017
      + +

      Definition at line 30 of file ControlElement.h.


      The documentation for this class was generated from the following files:
      • Project/ControlElement.h
      • Project/ControlElement.cpp
      • diff --git a/docs/doxygen/html/class_open_g_l_colour-members.html b/docs/doxygen/html/class_open_g_l_colour-members.html index f97d480..2f9d5db 100644 --- a/docs/doxygen/html/class_open_g_l_colour-members.html +++ b/docs/doxygen/html/class_open_g_l_colour-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_open_g_l_colour.html b/docs/doxygen/html/class_open_g_l_colour.html index 02cc58e..33d35bd 100644 --- a/docs/doxygen/html/class_open_g_l_colour.html +++ b/docs/doxygen/html/class_open_g_l_colour.html @@ -21,6 +21,12 @@ + @@ -119,7 +125,7 @@ GLdouble rgba [4]
        Author
        Thales Lima Oliveira
        Date
        18/01/2017
        -

        Definition at line 48 of file Element.h.

        +

        Definition at line 67 of file Element.h.

        Constructor & Destructor Documentation

        ◆ OpenGLColour()

        @@ -170,7 +176,7 @@ GLdouble rgba [4]
      -

      Definition at line 360 of file Element.cpp.

      +

      Definition at line 378 of file Element.cpp.

      @@ -201,7 +207,7 @@ GLdouble rgba [4]

      Get colour in RGBA.

      Returns
      RGBA colour.
      -

      Definition at line 83 of file Element.h.

      +

      Definition at line 101 of file Element.h.

      @@ -254,7 +260,7 @@ GLdouble rgba [4]
      -

      Definition at line 350 of file Element.cpp.

      +

      Definition at line 369 of file Element.cpp.

      diff --git a/docs/doxygen/html/class_plot_data-members.html b/docs/doxygen/html/class_plot_data-members.html index ef96235..0024fa6 100644 --- a/docs/doxygen/html/class_plot_data-members.html +++ b/docs/doxygen/html/class_plot_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_plot_data.html b/docs/doxygen/html/class_plot_data.html index 9978ba0..adfb181 100644 --- a/docs/doxygen/html/class_plot_data.html +++ b/docs/doxygen/html/class_plot_data.html @@ -21,6 +21,12 @@ + @@ -166,7 +172,7 @@ int m_axis

      Detailed Description

      -

      Definition at line 10 of file ElementPlotData.h.

      +

      Definition at line 27 of file ElementPlotData.h.


      The documentation for this class was generated from the following file: diff --git a/docs/doxygen/html/class_power_element-members.html b/docs/doxygen/html/class_power_element-members.html index 1fc7283..ca24191 100644 --- a/docs/doxygen/html/class_power_element-members.html +++ b/docs/doxygen/html/class_power_element-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_power_element.html b/docs/doxygen/html/class_power_element.html index 1a8d117..2a3d755 100644 --- a/docs/doxygen/html/class_power_element.html +++ b/docs/doxygen/html/class_power_element.html @@ -21,6 +21,12 @@ + @@ -508,7 +514,7 @@ Additional Inherited Members
      Author
      Thales Lima Oliveira
      Date
      18/01/2017
      -

      Definition at line 100 of file PowerElement.h.

      +

      Definition at line 117 of file PowerElement.h.

      Member Function Documentation

      ◆ CalculatePowerFlowPts()

      @@ -542,7 +548,7 @@ Additional Inherited Members
      -

      Definition at line 93 of file PowerElement.cpp.

      +

      Definition at line 110 of file PowerElement.cpp.

      @@ -581,7 +587,7 @@ Additional Inherited Members

      Reimplemented in SyncGenerator, and Bus.

      -

      Definition at line 181 of file PowerElement.h.

      +

      Definition at line 198 of file PowerElement.h.

      @@ -611,7 +617,7 @@ Additional Inherited Members

      Return the direction of the power flow.

      Returns
      Power flow direction.
      -

      Definition at line 175 of file PowerElement.h.

      +

      Definition at line 192 of file PowerElement.h.

      @@ -641,7 +647,7 @@ Additional Inherited Members

      Returns the switching data of the element.

      Returns
      Element switching data.
      -

      Definition at line 165 of file PowerElement.h.

      +

      Definition at line 182 of file PowerElement.h.

      @@ -695,7 +701,7 @@ Additional Inherited Members
      -

      Definition at line 22 of file PowerElement.cpp.

      +

      Definition at line 39 of file PowerElement.cpp.

      @@ -725,7 +731,7 @@ Additional Inherited Members

      Check if the power element have dynamic event.

      Returns
      true if the element have dynamic an event, false otherwise.
      -

      Definition at line 186 of file PowerElement.h.

      +

      Definition at line 203 of file PowerElement.h.

      @@ -761,7 +767,7 @@ Additional Inherited Members -

      Definition at line 191 of file PowerElement.h.

      +

      Definition at line 208 of file PowerElement.h.

      @@ -810,7 +816,7 @@ Additional Inherited Members

      Reimplemented in SyncGenerator, SyncMotor, Transformer, and Line.

      -

      Definition at line 18 of file PowerElement.cpp.

      +

      Definition at line 35 of file PowerElement.cpp.

      @@ -848,7 +854,7 @@ Additional Inherited Members

      Reimplemented in Transformer, Line, and Machines.

      -

      Definition at line 170 of file PowerElement.h.

      +

      Definition at line 187 of file PowerElement.h.

      @@ -884,7 +890,7 @@ Additional Inherited Members -

      Definition at line 160 of file PowerElement.h.

      +

      Definition at line 177 of file PowerElement.h.

      @@ -920,7 +926,7 @@ Additional Inherited Members -

      Definition at line 46 of file PowerElement.cpp.

      +

      Definition at line 63 of file PowerElement.cpp.

      diff --git a/docs/doxygen/html/class_power_flow-members.html b/docs/doxygen/html/class_power_flow-members.html index 148f3a7..28fc616 100644 --- a/docs/doxygen/html/class_power_flow-members.html +++ b/docs/doxygen/html/class_power_flow-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_power_flow.html b/docs/doxygen/html/class_power_flow.html index f4d0fbf..768aee7 100644 --- a/docs/doxygen/html/class_power_flow.html +++ b/docs/doxygen/html/class_power_flow.html @@ -21,6 +21,12 @@ + @@ -219,7 +225,7 @@ std::vector< Transformer * &g

      Detailed Description

      -

      Definition at line 9 of file PowerFlow.h.

      +

      Definition at line 26 of file PowerFlow.h.


      The documentation for this class was generated from the following files:
      • Project/PowerFlow.h
      • Project/PowerFlow.cpp
      • diff --git a/docs/doxygen/html/class_properties_data-members.html b/docs/doxygen/html/class_properties_data-members.html index f54f6cb..2271c0a 100644 --- a/docs/doxygen/html/class_properties_data-members.html +++ b/docs/doxygen/html/class_properties_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_properties_data.html b/docs/doxygen/html/class_properties_data.html index 9ee0144..9b79392 100644 --- a/docs/doxygen/html/class_properties_data.html +++ b/docs/doxygen/html/class_properties_data.html @@ -21,6 +21,12 @@ + @@ -113,7 +119,7 @@ Protected Attributes

        Detailed Description

        -

        Definition at line 40 of file PropertiesData.h.

        +

        Definition at line 57 of file PropertiesData.h.


        The documentation for this class was generated from the following files:
        • Project/PropertiesData.h
        • Project/PropertiesData.cpp
        • diff --git a/docs/doxygen/html/class_rate_limiter-members.html b/docs/doxygen/html/class_rate_limiter-members.html index 0cab65f..6297241 100644 --- a/docs/doxygen/html/class_rate_limiter-members.html +++ b/docs/doxygen/html/class_rate_limiter-members.html @@ -21,6 +21,12 @@ + @@ -194,7 +200,7 @@ $(document).ready(function(){initNavTree('class_rate_limiter.html','');}); SetWidth(double width)Elementinline ShowForm(wxWindow *parent, Element *element)RateLimitervirtual ShowPickbox(bool showPickbox=true)Elementinline - Solve(double input, double timeStep) (defined in RateLimiter)RateLimitervirtual + Solve(double input, double timeStep)RateLimitervirtual StartMove(wxPoint2DDouble position)ControlElementvirtual StringFromDouble(double value, int minDecimal=1)Elementstatic UpdateNodes()Elementinlinevirtual diff --git a/docs/doxygen/html/class_rate_limiter.html b/docs/doxygen/html/class_rate_limiter.html index 826d091..5811c2e 100644 --- a/docs/doxygen/html/class_rate_limiter.html +++ b/docs/doxygen/html/class_rate_limiter.html @@ -21,6 +21,12 @@ + @@ -86,6 +92,12 @@ $(document).ready(function(){initNavTree('class_rate_limiter.html','');});
          RateLimiter Class Reference
          + +

          Limits the rising and/or falling rate.
          + + More...

          + +

          #include <RateLimiter.h>

          Inheritance diagram for RateLimiter:
          @@ -132,8 +144,24 @@ void SetUpLimit (doubl void SetLowLimit (double lowLimit)   - -virtual bool Solve (double input, double timeStep) +virtual bool Solve (double input, double timeStep) + Calculate the rate and limits it if exceeds.
          + The rate is calculated by:
          +
          + \( rate = \frac{x(i) - y(i-1)}{\Delta t} \)
          +
          + \( x(i) \) is the current input and \( y(i-1) \) is the previous output.
          + If the \(rate\) is greater than rising rate ( \( R \)), the output will be:
          +
          + \( output = \Delta t \cdot R + y(i-1)\)
          +
          + If the \(rate\) is lower than falling rate ( \( F \)), the output will be:
          +
          + \( output = \Delta t \cdot L + y(i-1) \)
          +
          + Otherwise:
          +
          + \( output = input \). More...
            virtual ElementGetCopy ()  Get a the element copy. More...
          @@ -471,8 +499,12 @@ Additional Inherited Members  

          Detailed Description

          -
          -

          Definition at line 8 of file RateLimiter.h.

          +

          Limits the rising and/or falling rate.
          +

          +
          Author
          Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
          +
          Date
          05/10/2017
          + +

          Definition at line 32 of file RateLimiter.h.

          Member Function Documentation

          ◆ Contains()

          @@ -508,7 +540,7 @@ Additional Inherited Members

          Implements Element.

          -

          Definition at line 15 of file RateLimiter.h.

          +

          Definition at line 39 of file RateLimiter.h.

          @@ -557,7 +589,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 17 of file RateLimiter.cpp.

          +

          Definition at line 34 of file RateLimiter.cpp.

          @@ -589,7 +621,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 116 of file RateLimiter.cpp.

          +

          Definition at line 133 of file RateLimiter.cpp.

          @@ -627,7 +659,7 @@ Additional Inherited Members

          Implements Element.

          -

          Definition at line 16 of file RateLimiter.h.

          +

          Definition at line 40 of file RateLimiter.h.

          @@ -665,7 +697,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 60 of file RateLimiter.cpp.

          +

          Definition at line 77 of file RateLimiter.cpp.

          @@ -715,7 +747,73 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 49 of file RateLimiter.cpp.

          +

          Definition at line 66 of file RateLimiter.cpp.

          + + + + +

          ◆ Solve()

          + +
          +
          + + + + + +
          + + + + + + + + + + + + + + + + + + +
          bool RateLimiter::Solve (double input,
          double timeStep 
          )
          +
          +virtual
          +
          + +

          Calculate the rate and limits it if exceeds.
          + The rate is calculated by:
          +
          + \( rate = \frac{x(i) - y(i-1)}{\Delta t} \)
          +
          + \( x(i) \) is the current input and \( y(i-1) \) is the previous output.
          + If the \(rate\) is greater than rising rate ( \( R \)), the output will be:
          +
          + \( output = \Delta t \cdot R + y(i-1)\)
          +
          + If the \(rate\) is lower than falling rate ( \( F \)), the output will be:
          +
          + \( output = \Delta t \cdot L + y(i-1) \)
          +
          + Otherwise:
          +
          + \( output = input \).

          +
          Parameters
          + + + +
          inputinput value.
          timeStepTime step.
          +
          +
          +
          Returns
          Always true.
          + +

          Reimplemented from ControlElement.

          + +

          Definition at line 113 of file RateLimiter.cpp.

          diff --git a/docs/doxygen/html/class_rate_limiter_form-members.html b/docs/doxygen/html/class_rate_limiter_form-members.html index 0903e20..89c2c8a 100644 --- a/docs/doxygen/html/class_rate_limiter_form-members.html +++ b/docs/doxygen/html/class_rate_limiter_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_rate_limiter_form.html b/docs/doxygen/html/class_rate_limiter_form.html index 73419f1..5b04bd3 100644 --- a/docs/doxygen/html/class_rate_limiter_form.html +++ b/docs/doxygen/html/class_rate_limiter_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_rate_limiter_form.html','');});
          RateLimiterForm Class Reference
          + +

          Form to edit the rate limit control data. + More...

          + +

          #include <RateLimiterForm.h>

          Inheritance diagram for RateLimiterForm:
          @@ -178,8 +189,11 @@ wxButton * m_ButtonCancel<  

          Detailed Description

          -
          -

          Definition at line 7 of file RateLimiterForm.h.

          +

          Form to edit the rate limit control data.

          +
          Author
          Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
          +
          Date
          05/10/2017
          + +

          Definition at line 31 of file RateLimiterForm.h.


          The documentation for this class was generated from the following files:
          • Project/RateLimiterForm.h
          • Project/RateLimiterForm.cpp
          • diff --git a/docs/doxygen/html/class_rate_limiter_form_base-members.html b/docs/doxygen/html/class_rate_limiter_form_base-members.html index c6281fd..d8e0de4 100644 --- a/docs/doxygen/html/class_rate_limiter_form_base-members.html +++ b/docs/doxygen/html/class_rate_limiter_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_rate_limiter_form_base.html b/docs/doxygen/html/class_rate_limiter_form_base.html index 334ed81..12511fd 100644 --- a/docs/doxygen/html/class_rate_limiter_form_base.html +++ b/docs/doxygen/html/class_rate_limiter_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for RateLimiterFormBase:
          -RateLimiterForm +RateLimiterForm
          diff --git a/docs/doxygen/html/class_reactive_shunt_element_form-members.html b/docs/doxygen/html/class_reactive_shunt_element_form-members.html index 2c1089d..2589859 100644 --- a/docs/doxygen/html/class_reactive_shunt_element_form-members.html +++ b/docs/doxygen/html/class_reactive_shunt_element_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_reactive_shunt_element_form.html b/docs/doxygen/html/class_reactive_shunt_element_form.html index cf83849..8dbb017 100644 --- a/docs/doxygen/html/class_reactive_shunt_element_form.html +++ b/docs/doxygen/html/class_reactive_shunt_element_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_reactive_shunt_element_form.html
          ReactiveShuntElementForm Class Reference
          + +

          Form to edit the reactive shunt element power data. + More...

          + +

          #include <ReactiveShuntElementForm.h>

          Inheritance diagram for ReactiveShuntElementForm:
          @@ -199,8 +210,11 @@ wxButton * 
          m_buttonCancel<
           

          Detailed Description

          -
          -

          Definition at line 10 of file ReactiveShuntElementForm.h.

          +

          Form to edit the reactive shunt element power data.

          +
          Author
          Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
          +
          Date
          05/10/2017
          + +

          Definition at line 34 of file ReactiveShuntElementForm.h.


          The documentation for this class was generated from the following files:
          • Project/ReactiveShuntElementForm.h
          • Project/ReactiveShuntElementForm.cpp
          • diff --git a/docs/doxygen/html/class_reactive_shunt_element_form_base-members.html b/docs/doxygen/html/class_reactive_shunt_element_form_base-members.html index 9b3a3a1..d9bc768 100644 --- a/docs/doxygen/html/class_reactive_shunt_element_form_base-members.html +++ b/docs/doxygen/html/class_reactive_shunt_element_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_reactive_shunt_element_form_base.html b/docs/doxygen/html/class_reactive_shunt_element_form_base.html index 6ccfdde..ae72812 100644 --- a/docs/doxygen/html/class_reactive_shunt_element_form_base.html +++ b/docs/doxygen/html/class_reactive_shunt_element_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for ReactiveShuntElementFormBase:
          -ReactiveShuntElementForm +ReactiveShuntElementForm
          diff --git a/docs/doxygen/html/class_shunt-members.html b/docs/doxygen/html/class_shunt-members.html index 9da574b..fe99bd8 100644 --- a/docs/doxygen/html/class_shunt-members.html +++ b/docs/doxygen/html/class_shunt-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_shunt.html b/docs/doxygen/html/class_shunt.html index ff7db81..65074b3 100644 --- a/docs/doxygen/html/class_shunt.html +++ b/docs/doxygen/html/class_shunt.html @@ -21,6 +21,12 @@ + @@ -514,7 +520,7 @@ Additional Inherited Members

          Detailed Description

          -

          Definition at line 7 of file Shunt.h.

          +

          Definition at line 24 of file Shunt.h.

          Member Function Documentation

          ◆ Contains()

          @@ -552,7 +558,7 @@ Additional Inherited Members

          Reimplemented in Capacitor, and Inductor.

          -

          Definition at line 13 of file Shunt.h.

          +

          Definition at line 30 of file Shunt.h.

          @@ -592,7 +598,7 @@ Additional Inherited Members

          Reimplemented in Capacitor, and Inductor.

          -

          Definition at line 14 of file Shunt.h.

          +

          Definition at line 31 of file Shunt.h.

          @@ -630,7 +636,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 15 of file Shunt.cpp.

          +

          Definition at line 32 of file Shunt.cpp.

          @@ -671,7 +677,7 @@ Additional Inherited Members

          Move a node. StartMove(wxPoint2DDouble position) before start moving.

          Parameters
          - +
          parentNode's parent.
          parentNode's parent.
          positionNew node position.
          @@ -679,7 +685,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 28 of file Shunt.cpp.

          +

          Definition at line 45 of file Shunt.cpp.

          @@ -718,7 +724,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 67 of file Shunt.cpp.

          +

          Definition at line 84 of file Shunt.cpp.

          @@ -756,7 +762,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 57 of file Shunt.cpp.

          +

          Definition at line 74 of file Shunt.cpp.

          @@ -797,7 +803,7 @@ Additional Inherited Members

          Rotate a node.

          Parameters
          - +
          parentNode's parent.
          parentNode's parent.
          clockwiseTrue to rotate clockwise, false to rotate counter-clockwise.
          @@ -805,7 +811,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 124 of file Shunt.cpp.

          +

          Definition at line 141 of file Shunt.cpp.

          @@ -836,7 +842,7 @@ Additional Inherited Members

          Set a perent to the node. If all conditions are met, a new parent are added to the element and the points related to the nodes will be calculated.

          Parameters
          - +
          parentNode parent.
          parentNode parent.
          @@ -844,7 +850,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 81 of file Shunt.cpp.

          +

          Definition at line 98 of file Shunt.cpp.

          @@ -882,7 +888,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 50 of file Shunt.cpp.

          +

          Definition at line 67 of file Shunt.cpp.

          diff --git a/docs/doxygen/html/class_simulations_settings_form-members.html b/docs/doxygen/html/class_simulations_settings_form-members.html index 3a6528c..3bc9015 100644 --- a/docs/doxygen/html/class_simulations_settings_form-members.html +++ b/docs/doxygen/html/class_simulations_settings_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_simulations_settings_form.html b/docs/doxygen/html/class_simulations_settings_form.html index daa2942..d0ffd5f 100644 --- a/docs/doxygen/html/class_simulations_settings_form.html +++ b/docs/doxygen/html/class_simulations_settings_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_simulations_settings_form.html',
          SimulationsSettingsForm Class Reference
          + +

          Form to edit the simulation data. + More...

          + +

          #include <SimulationsSettingsForm.h>

          Inheritance diagram for SimulationsSettingsForm:
          @@ -358,8 +369,11 @@ wxButton * m_buttonCancel<  

          Detailed Description

          -
          -

          Definition at line 8 of file SimulationsSettingsForm.h.

          +

          Form to edit the simulation data.

          +
          Author
          Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
          +
          Date
          05/10/2017
          + +

          Definition at line 32 of file SimulationsSettingsForm.h.


          The documentation for this class was generated from the following files:
          • Project/SimulationsSettingsForm.h
          • Project/SimulationsSettingsForm.cpp
          • diff --git a/docs/doxygen/html/class_simulations_settings_form_base-members.html b/docs/doxygen/html/class_simulations_settings_form_base-members.html index 4d9145d..389d830 100644 --- a/docs/doxygen/html/class_simulations_settings_form_base-members.html +++ b/docs/doxygen/html/class_simulations_settings_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_simulations_settings_form_base.html b/docs/doxygen/html/class_simulations_settings_form_base.html index 7df6a32..ec3da0c 100644 --- a/docs/doxygen/html/class_simulations_settings_form_base.html +++ b/docs/doxygen/html/class_simulations_settings_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for SimulationsSettingsFormBase:
          -SimulationsSettingsForm +SimulationsSettingsForm
          diff --git a/docs/doxygen/html/class_sum-members.html b/docs/doxygen/html/class_sum-members.html index 9c0ef15..539be17 100644 --- a/docs/doxygen/html/class_sum-members.html +++ b/docs/doxygen/html/class_sum-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_sum.html b/docs/doxygen/html/class_sum.html index c34b36e..61ae547 100644 --- a/docs/doxygen/html/class_sum.html +++ b/docs/doxygen/html/class_sum.html @@ -21,6 +21,12 @@ + @@ -477,7 +483,7 @@ Additional Inherited Members

          Detailed Description

          -

          Definition at line 9 of file Sum.h.

          +

          Definition at line 26 of file Sum.h.

          Member Function Documentation

          ◆ Contains()

          @@ -513,7 +519,7 @@ Additional Inherited Members

          Implements Element.

          -

          Definition at line 17 of file Sum.h.

          +

          Definition at line 34 of file Sum.h.

          @@ -562,7 +568,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 26 of file Sum.cpp.

          +

          Definition at line 43 of file Sum.cpp.

          @@ -594,7 +600,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 221 of file Sum.cpp.

          +

          Definition at line 238 of file Sum.cpp.

          @@ -632,7 +638,7 @@ Additional Inherited Members

          Implements Element.

          -

          Definition at line 18 of file Sum.h.

          +

          Definition at line 35 of file Sum.h.

          @@ -670,7 +676,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 166 of file Sum.cpp.

          +

          Definition at line 183 of file Sum.cpp.

          @@ -720,7 +726,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 95 of file Sum.cpp.

          +

          Definition at line 112 of file Sum.cpp.

          diff --git a/docs/doxygen/html/class_sum_form-members.html b/docs/doxygen/html/class_sum_form-members.html index 755a486..d5ba395 100644 --- a/docs/doxygen/html/class_sum_form-members.html +++ b/docs/doxygen/html/class_sum_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_sum_form.html b/docs/doxygen/html/class_sum_form.html index 8a07abd..69fac3e 100644 --- a/docs/doxygen/html/class_sum_form.html +++ b/docs/doxygen/html/class_sum_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_sum_form.html','');});
          SumForm Class Reference
          + +

          Form to edit the sum control data. + More...

          + +

          #include <SumForm.h>

          Inheritance diagram for SumForm:
          @@ -166,8 +177,11 @@ wxButton * m_ButtonCancel<  

          Detailed Description

          -
          -

          Definition at line 8 of file SumForm.h.

          +

          Form to edit the sum control data.

          +
          Author
          Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
          +
          Date
          05/10/2017
          + +

          Definition at line 32 of file SumForm.h.


          The documentation for this class was generated from the following files:
          • Project/SumForm.h
          • Project/SumForm.cpp
          • diff --git a/docs/doxygen/html/class_sum_form_base-members.html b/docs/doxygen/html/class_sum_form_base-members.html index 1d44fc8..cda5c99 100644 --- a/docs/doxygen/html/class_sum_form_base-members.html +++ b/docs/doxygen/html/class_sum_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_sum_form_base.html b/docs/doxygen/html/class_sum_form_base.html index f267892..3eccbbb 100644 --- a/docs/doxygen/html/class_sum_form_base.html +++ b/docs/doxygen/html/class_sum_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for SumFormBase:
          -SumForm +SumForm
          diff --git a/docs/doxygen/html/class_switching_form-members.html b/docs/doxygen/html/class_switching_form-members.html index b815b4d..c07ef20 100644 --- a/docs/doxygen/html/class_switching_form-members.html +++ b/docs/doxygen/html/class_switching_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_switching_form.html b/docs/doxygen/html/class_switching_form.html index 37f2646..1b08f06 100644 --- a/docs/doxygen/html/class_switching_form.html +++ b/docs/doxygen/html/class_switching_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_switching_form.html','');});
          SwitchingForm Class Reference
          + +

          Form to edit the switching data of power elements for electromechanical transient studies. + More...

          + +

          #include <SwitchingForm.h>

          Inheritance diagram for SwitchingForm:
          @@ -211,8 +222,11 @@ wxButton * 
          m_buttonCancel<
           

          Detailed Description

          -
          -

          Definition at line 8 of file SwitchingForm.h.

          +

          Form to edit the switching data of power elements for electromechanical transient studies.

          +
          Author
          Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
          +
          Date
          05/10/2017
          + +

          Definition at line 32 of file SwitchingForm.h.


          The documentation for this class was generated from the following files:
          • Project/SwitchingForm.h
          • Project/SwitchingForm.cpp
          • diff --git a/docs/doxygen/html/class_switching_form_base-members.html b/docs/doxygen/html/class_switching_form_base-members.html index e904d1f..d96c7f2 100644 --- a/docs/doxygen/html/class_switching_form_base-members.html +++ b/docs/doxygen/html/class_switching_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_switching_form_base.html b/docs/doxygen/html/class_switching_form_base.html index d0cd430..0beffb9 100644 --- a/docs/doxygen/html/class_switching_form_base.html +++ b/docs/doxygen/html/class_switching_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for SwitchingFormBase:
          -SwitchingForm +SwitchingForm
          diff --git a/docs/doxygen/html/class_sync_generator-members.html b/docs/doxygen/html/class_sync_generator-members.html index d919f41..06c70dd 100644 --- a/docs/doxygen/html/class_sync_generator-members.html +++ b/docs/doxygen/html/class_sync_generator-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_sync_generator.html b/docs/doxygen/html/class_sync_generator.html index b177bfd..944f21a 100644 --- a/docs/doxygen/html/class_sync_generator.html +++ b/docs/doxygen/html/class_sync_generator.html @@ -21,6 +21,12 @@ + @@ -543,7 +549,7 @@ void 
          UpdatePowerFlowArrows

          Detailed Description

          -

          Definition at line 110 of file SyncGenerator.h.

          +

          Definition at line 133 of file SyncGenerator.h.

          Member Function Documentation

          ◆ GetContextMenu()

          @@ -580,7 +586,7 @@ void UpdatePowerFlowArrows

          Reimplemented from Element.

          -

          Definition at line 39 of file SyncGenerator.cpp.

          +

          Definition at line 56 of file SyncGenerator.cpp.

          @@ -612,7 +618,7 @@ void UpdatePowerFlowArrows

          Reimplemented from Element.

          -

          Definition at line 139 of file SyncGenerator.cpp.

          +

          Definition at line 156 of file SyncGenerator.cpp.

          @@ -651,7 +657,7 @@ void UpdatePowerFlowArrows

          Reimplemented from PowerElement.

          -

          Definition at line 213 of file SyncGenerator.cpp.

          +

          Definition at line 230 of file SyncGenerator.cpp.

          @@ -683,7 +689,7 @@ void UpdatePowerFlowArrows

          Reimplemented from Element.

          -

          Definition at line 167 of file SyncGenerator.cpp.

          +

          Definition at line 184 of file SyncGenerator.cpp.

          @@ -732,7 +738,7 @@ void UpdatePowerFlowArrows

          Reimplemented from PowerElement.

          -

          Definition at line 130 of file SyncGenerator.cpp.

          +

          Definition at line 147 of file SyncGenerator.cpp.

          @@ -782,7 +788,7 @@ void UpdatePowerFlowArrows

          Reimplemented from Element.

          -

          Definition at line 46 of file SyncGenerator.cpp.

          +

          Definition at line 63 of file SyncGenerator.cpp.

          diff --git a/docs/doxygen/html/class_sync_machine_form-members.html b/docs/doxygen/html/class_sync_machine_form-members.html index b7c901c..2e21c61 100644 --- a/docs/doxygen/html/class_sync_machine_form-members.html +++ b/docs/doxygen/html/class_sync_machine_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_sync_machine_form.html b/docs/doxygen/html/class_sync_machine_form.html index d06b6f8..c28af84 100644 --- a/docs/doxygen/html/class_sync_machine_form.html +++ b/docs/doxygen/html/class_sync_machine_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_sync_machine_form.html','');});
          SyncMachineForm Class Reference
          + +

          Form to edit the synchronous machine power data. + More...

          + +

          #include <SyncMachineForm.h>

          Inheritance diagram for SyncMachineForm:
          @@ -394,8 +405,11 @@ wxButton * m_ButtonCancel<  

          Detailed Description

          -
          -

          Definition at line 10 of file SyncMachineForm.h.

          +

          Form to edit the synchronous machine power data.

          +
          Author
          Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
          +
          Date
          05/10/2017
          + +

          Definition at line 34 of file SyncMachineForm.h.


          The documentation for this class was generated from the following files:
          • Project/SyncMachineForm.h
          • Project/SyncMachineForm.cpp
          • diff --git a/docs/doxygen/html/class_sync_machine_form_base-members.html b/docs/doxygen/html/class_sync_machine_form_base-members.html index 7edaded..13f837f 100644 --- a/docs/doxygen/html/class_sync_machine_form_base-members.html +++ b/docs/doxygen/html/class_sync_machine_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_sync_machine_form_base.html b/docs/doxygen/html/class_sync_machine_form_base.html index 68797e8..9e4d640 100644 --- a/docs/doxygen/html/class_sync_machine_form_base.html +++ b/docs/doxygen/html/class_sync_machine_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for SyncMachineFormBase:
          -SyncMachineForm +SyncMachineForm
          diff --git a/docs/doxygen/html/class_sync_motor-members.html b/docs/doxygen/html/class_sync_motor-members.html index 7c3220f..b3bab3a 100644 --- a/docs/doxygen/html/class_sync_motor-members.html +++ b/docs/doxygen/html/class_sync_motor-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_sync_motor.html b/docs/doxygen/html/class_sync_motor.html index 04cf51c..09d23a7 100644 --- a/docs/doxygen/html/class_sync_motor.html +++ b/docs/doxygen/html/class_sync_motor.html @@ -21,6 +21,12 @@ + @@ -537,7 +543,7 @@ void 
          UpdatePowerFlowArrows

          Detailed Description

          -

          Definition at line 110 of file SyncMotor.h.

          +

          Definition at line 127 of file SyncMotor.h.

          Member Function Documentation

          ◆ GetContextMenu()

          @@ -574,7 +580,7 @@ void UpdatePowerFlowArrows

          Reimplemented from Element.

          -

          Definition at line 8 of file SyncMotor.cpp.

          +

          Definition at line 25 of file SyncMotor.cpp.

          @@ -606,7 +612,7 @@ void UpdatePowerFlowArrows

          Reimplemented from Element.

          -

          Definition at line 108 of file SyncMotor.cpp.

          +

          Definition at line 125 of file SyncMotor.cpp.

          @@ -638,7 +644,7 @@ void UpdatePowerFlowArrows

          Reimplemented from Element.

          -

          Definition at line 115 of file SyncMotor.cpp.

          +

          Definition at line 132 of file SyncMotor.cpp.

          @@ -687,7 +693,7 @@ void UpdatePowerFlowArrows

          Reimplemented from PowerElement.

          -

          Definition at line 100 of file SyncMotor.cpp.

          +

          Definition at line 117 of file SyncMotor.cpp.

          @@ -737,7 +743,7 @@ void UpdatePowerFlowArrows

          Reimplemented from Element.

          -

          Definition at line 16 of file SyncMotor.cpp.

          +

          Definition at line 33 of file SyncMotor.cpp.

          diff --git a/docs/doxygen/html/class_text-members.html b/docs/doxygen/html/class_text-members.html index ad59b62..8fd37cd 100644 --- a/docs/doxygen/html/class_text-members.html +++ b/docs/doxygen/html/class_text-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_text.html b/docs/doxygen/html/class_text.html index 0489e35..8ed6bb4 100644 --- a/docs/doxygen/html/class_text.html +++ b/docs/doxygen/html/class_text.html @@ -21,6 +21,12 @@ + @@ -509,7 +515,7 @@ Additional Inherited Members

          Detailed Description

          -

          Definition at line 48 of file Text.h.

          +

          Definition at line 65 of file Text.h.

          Member Function Documentation

          ◆ AddParent()

          @@ -549,14 +555,14 @@ Additional Inherited Members
          Parameters
          - +
          parentElement parent.
          positionNode position in the parent.
          positionNode position in the parent.

          Reimplemented from Element.

          -

          Definition at line 56 of file Text.h.

          +

          Definition at line 73 of file Text.h.

          @@ -594,7 +600,7 @@ Additional Inherited Members

          Implements Element.

          -

          Definition at line 30 of file Text.cpp.

          +

          Definition at line 47 of file Text.cpp.

          @@ -626,7 +632,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 950 of file Text.cpp.

          +

          Definition at line 967 of file Text.cpp.

          @@ -664,7 +670,7 @@ Additional Inherited Members

          Implements Element.

          -

          Definition at line 75 of file Text.cpp.

          +

          Definition at line 92 of file Text.cpp.

          @@ -702,7 +708,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 145 of file Text.cpp.

          +

          Definition at line 162 of file Text.cpp.

          diff --git a/docs/doxygen/html/class_text_form-members.html b/docs/doxygen/html/class_text_form-members.html index ad47a5d..aac7f47 100644 --- a/docs/doxygen/html/class_text_form-members.html +++ b/docs/doxygen/html/class_text_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_text_form.html b/docs/doxygen/html/class_text_form.html index 5db0495..9a8c3ea 100644 --- a/docs/doxygen/html/class_text_form.html +++ b/docs/doxygen/html/class_text_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_text_form.html','');});
          TextForm Class Reference
          + +

          Form to edit the text graphical data. + More...

          + +

          #include <TextForm.h>

          Inheritance diagram for TextForm:
          @@ -298,8 +309,11 @@ wxButton * m_ButtonCancel<  

          Detailed Description

          -
          -

          Definition at line 8 of file TextForm.h.

          +

          Form to edit the text graphical data.

          +
          Author
          Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
          +
          Date
          05/10/2017
          + +

          Definition at line 32 of file TextForm.h.


          The documentation for this class was generated from the following files:
          • Project/TextForm.h
          • Project/TextForm.cpp
          • diff --git a/docs/doxygen/html/class_text_form_base-members.html b/docs/doxygen/html/class_text_form_base-members.html index dce7917..4187755 100644 --- a/docs/doxygen/html/class_text_form_base-members.html +++ b/docs/doxygen/html/class_text_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_text_form_base.html b/docs/doxygen/html/class_text_form_base.html index 251d438..9a7a2e2 100644 --- a/docs/doxygen/html/class_text_form_base.html +++ b/docs/doxygen/html/class_text_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for TextFormBase:
          -TextForm +TextForm
          diff --git a/docs/doxygen/html/class_text_g_l_drawable-members.html b/docs/doxygen/html/class_text_g_l_drawable-members.html index 159733e..028c01c 100644 --- a/docs/doxygen/html/class_text_g_l_drawable-members.html +++ b/docs/doxygen/html/class_text_g_l_drawable-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_text_g_l_drawable.html b/docs/doxygen/html/class_text_g_l_drawable.html index 3a0d3da..6874f12 100644 --- a/docs/doxygen/html/class_text_g_l_drawable.html +++ b/docs/doxygen/html/class_text_g_l_drawable.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_text_texture-members.html b/docs/doxygen/html/class_text_texture-members.html index 5e1a556..57c6314 100644 --- a/docs/doxygen/html/class_text_texture-members.html +++ b/docs/doxygen/html/class_text_texture-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_text_texture.html b/docs/doxygen/html/class_text_texture.html index 6ce4a53..f7458eb 100644 --- a/docs/doxygen/html/class_text_texture.html +++ b/docs/doxygen/html/class_text_texture.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_transfer_function-members.html b/docs/doxygen/html/class_transfer_function-members.html index 0bb91a6..175cdc4 100644 --- a/docs/doxygen/html/class_transfer_function-members.html +++ b/docs/doxygen/html/class_transfer_function-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_transfer_function.html b/docs/doxygen/html/class_transfer_function.html index 724432e..396cb07 100644 --- a/docs/doxygen/html/class_transfer_function.html +++ b/docs/doxygen/html/class_transfer_function.html @@ -21,6 +21,12 @@ + @@ -524,7 +530,7 @@ Additional Inherited Members

          Detailed Description

          -

          Definition at line 11 of file TransferFunction.h.

          +

          Definition at line 28 of file TransferFunction.h.

          Member Function Documentation

          ◆ Contains()

          @@ -560,7 +566,7 @@ Additional Inherited Members

          Implements Element.

          -

          Definition at line 25 of file TransferFunction.h.

          +

          Definition at line 42 of file TransferFunction.h.

          @@ -609,7 +615,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 35 of file TransferFunction.cpp.

          +

          Definition at line 52 of file TransferFunction.cpp.

          @@ -641,7 +647,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 359 of file TransferFunction.cpp.

          +

          Definition at line 376 of file TransferFunction.cpp.

          @@ -679,7 +685,7 @@ Additional Inherited Members

          Implements Element.

          -

          Definition at line 26 of file TransferFunction.h.

          +

          Definition at line 43 of file TransferFunction.h.

          @@ -717,7 +723,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 220 of file TransferFunction.cpp.

          +

          Definition at line 237 of file TransferFunction.cpp.

          @@ -767,7 +773,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 209 of file TransferFunction.cpp.

          +

          Definition at line 226 of file TransferFunction.cpp.

          diff --git a/docs/doxygen/html/class_transfer_function_form-members.html b/docs/doxygen/html/class_transfer_function_form-members.html index 7d6d0f0..8523d5d 100644 --- a/docs/doxygen/html/class_transfer_function_form-members.html +++ b/docs/doxygen/html/class_transfer_function_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_transfer_function_form.html b/docs/doxygen/html/class_transfer_function_form.html index c7ab425..c0aa57c 100644 --- a/docs/doxygen/html/class_transfer_function_form.html +++ b/docs/doxygen/html/class_transfer_function_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_transfer_function_form.html','')
          TransferFunctionForm Class Reference
          + +

          Form to edit the transfer function control data. + More...

          + +

          #include <TransferFunctionForm.h>

          Inheritance diagram for TransferFunctionForm:
          @@ -181,8 +192,11 @@ wxButton * m_ButtonCancel<  

          Detailed Description

          -
          -

          Definition at line 8 of file TransferFunctionForm.h.

          +

          Form to edit the transfer function control data.

          +
          Author
          Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
          +
          Date
          05/10/2017
          + +

          Definition at line 32 of file TransferFunctionForm.h.


          The documentation for this class was generated from the following files:
          • Project/TransferFunctionForm.h
          • Project/TransferFunctionForm.cpp
          • diff --git a/docs/doxygen/html/class_transfer_function_form_base-members.html b/docs/doxygen/html/class_transfer_function_form_base-members.html index bf724ff..dba1754 100644 --- a/docs/doxygen/html/class_transfer_function_form_base-members.html +++ b/docs/doxygen/html/class_transfer_function_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_transfer_function_form_base.html b/docs/doxygen/html/class_transfer_function_form_base.html index 508ebcf..6b87cb7 100644 --- a/docs/doxygen/html/class_transfer_function_form_base.html +++ b/docs/doxygen/html/class_transfer_function_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for TransferFunctionFormBase:
          -TransferFunctionForm +TransferFunctionForm
          diff --git a/docs/doxygen/html/class_transformer-members.html b/docs/doxygen/html/class_transformer-members.html index 7f9e223..13b5787 100644 --- a/docs/doxygen/html/class_transformer-members.html +++ b/docs/doxygen/html/class_transformer-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_transformer.html b/docs/doxygen/html/class_transformer.html index 3ebe873..12236de 100644 --- a/docs/doxygen/html/class_transformer.html +++ b/docs/doxygen/html/class_transformer.html @@ -21,6 +21,12 @@ + @@ -526,7 +532,7 @@ Additional Inherited Members

          Detailed Description

          -

          Definition at line 54 of file Transformer.h.

          +

          Definition at line 71 of file Transformer.h.

          Member Function Documentation

          ◆ AddParent()

          @@ -566,14 +572,14 @@ Additional Inherited Members
          Parameters
          - +
          parentElement parent.
          positionNode position in the parent.
          positionNode position in the parent.

          Reimplemented from Element.

          -

          Definition at line 22 of file Transformer.cpp.

          +

          Definition at line 39 of file Transformer.cpp.

          @@ -611,7 +617,7 @@ Additional Inherited Members

          Reimplemented from Branch.

          -

          Definition at line 88 of file Transformer.cpp.

          +

          Definition at line 105 of file Transformer.cpp.

          @@ -660,7 +666,7 @@ Additional Inherited Members

          Reimplemented from Branch.

          -

          Definition at line 94 of file Transformer.cpp.

          +

          Definition at line 111 of file Transformer.cpp.

          @@ -699,7 +705,7 @@ Additional Inherited Members

          Reimplemented from Branch.

          -

          Definition at line 256 of file Transformer.cpp.

          +

          Definition at line 273 of file Transformer.cpp.

          @@ -731,7 +737,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 394 of file Transformer.cpp.

          +

          Definition at line 411 of file Transformer.cpp.

          @@ -763,7 +769,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 401 of file Transformer.cpp.

          +

          Definition at line 418 of file Transformer.cpp.

          @@ -801,7 +807,7 @@ Additional Inherited Members

          Reimplemented from Branch.

          -

          Definition at line 173 of file Transformer.cpp.

          +

          Definition at line 190 of file Transformer.cpp.

          @@ -839,7 +845,7 @@ Additional Inherited Members

          Reimplemented from Branch.

          -

          Definition at line 195 of file Transformer.cpp.

          +

          Definition at line 212 of file Transformer.cpp.

          @@ -880,7 +886,7 @@ Additional Inherited Members

          Move a node. StartMove(wxPoint2DDouble position) before start moving.

          Parameters
          - +
          parentNode's parent.
          parentNode's parent.
          positionNew node position.
          @@ -888,7 +894,7 @@ Additional Inherited Members

          Reimplemented from Branch.

          -

          Definition at line 215 of file Transformer.cpp.

          +

          Definition at line 232 of file Transformer.cpp.

          @@ -926,7 +932,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 179 of file Transformer.cpp.

          +

          Definition at line 196 of file Transformer.cpp.

          @@ -967,7 +973,7 @@ Additional Inherited Members

          Rotate a node.

          Parameters
          - +
          parentNode's parent.
          parentNode's parent.
          clockwiseTrue to rotate clockwise, false to rotate counter-clockwise.
          @@ -975,7 +981,7 @@ Additional Inherited Members

          Reimplemented from Branch.

          -

          Definition at line 310 of file Transformer.cpp.

          +

          Definition at line 327 of file Transformer.cpp.

          @@ -1006,7 +1012,7 @@ Additional Inherited Members

          Set a perent to the node. If all conditions are met, a new parent are added to the element and the points related to the nodes will be calculated.

          Parameters
          - +
          parentNode parent.
          parentNode parent.
          @@ -1014,7 +1020,7 @@ Additional Inherited Members

          Reimplemented from Branch.

          -

          Definition at line 324 of file Transformer.cpp.

          +

          Definition at line 341 of file Transformer.cpp.

          @@ -1063,7 +1069,7 @@ Additional Inherited Members

          Reimplemented from PowerElement.

          -

          Definition at line 274 of file Transformer.cpp.

          +

          Definition at line 291 of file Transformer.cpp.

          @@ -1101,7 +1107,7 @@ Additional Inherited Members

          Reimplemented from PowerElement.

          -

          Definition at line 388 of file Transformer.cpp.

          +

          Definition at line 405 of file Transformer.cpp.

          @@ -1151,7 +1157,7 @@ Additional Inherited Members

          Reimplemented from Element.

          -

          Definition at line 263 of file Transformer.cpp.

          +

          Definition at line 280 of file Transformer.cpp.

          @@ -1189,7 +1195,7 @@ Additional Inherited Members

          Reimplemented from Branch.

          -

          Definition at line 249 of file Transformer.cpp.

          +

          Definition at line 266 of file Transformer.cpp.

          diff --git a/docs/doxygen/html/class_transformer_form-members.html b/docs/doxygen/html/class_transformer_form-members.html index e9d669e..a0d1a0a 100644 --- a/docs/doxygen/html/class_transformer_form-members.html +++ b/docs/doxygen/html/class_transformer_form-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_transformer_form.html b/docs/doxygen/html/class_transformer_form.html index a72534e..5520bad 100644 --- a/docs/doxygen/html/class_transformer_form.html +++ b/docs/doxygen/html/class_transformer_form.html @@ -21,6 +21,12 @@ + @@ -87,6 +93,11 @@ $(document).ready(function(){initNavTree('class_transformer_form.html','');});
          TransformerForm Class Reference
          + +

          Form to edit the transformer power data. + More...

          + +

          #include <TransformerForm.h>

          Inheritance diagram for TransformerForm:
          @@ -385,8 +396,11 @@ wxButton * m_buttonCancel<  

          Detailed Description

          -
          -

          Definition at line 9 of file TransformerForm.h.

          +

          Form to edit the transformer power data.

          +
          Author
          Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
          +
          Date
          05/10/2017
          + +

          Definition at line 33 of file TransformerForm.h.


          The documentation for this class was generated from the following files:
          • Project/TransformerForm.h
          • Project/TransformerForm.cpp
          • diff --git a/docs/doxygen/html/class_transformer_form_base-members.html b/docs/doxygen/html/class_transformer_form_base-members.html index d24d8ea..a7adb41 100644 --- a/docs/doxygen/html/class_transformer_form_base-members.html +++ b/docs/doxygen/html/class_transformer_form_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_transformer_form_base.html b/docs/doxygen/html/class_transformer_form_base.html index 9c3ff46..e0799a3 100644 --- a/docs/doxygen/html/class_transformer_form_base.html +++ b/docs/doxygen/html/class_transformer_form_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for TransformerFormBase:
          -TransformerForm +TransformerForm
          diff --git a/docs/doxygen/html/class_workspace-members.html b/docs/doxygen/html/class_workspace-members.html index e133fec..59efc3c 100644 --- a/docs/doxygen/html/class_workspace-members.html +++ b/docs/doxygen/html/class_workspace-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_workspace.html b/docs/doxygen/html/class_workspace.html index 0e6eea2..cd9d6e0 100644 --- a/docs/doxygen/html/class_workspace.html +++ b/docs/doxygen/html/class_workspace.html @@ -21,6 +21,12 @@ + @@ -88,6 +94,11 @@ $(document).ready(function(){initNavTree('class_workspace.html','');});
          Workspace Class Reference
          + +

          This class manages the graphical and power elements. It is responsible for handling the user's interaction with the elements. + More...

          + +

          #include <Workspace.h>

          Inheritance diagram for Workspace:
          @@ -359,8 +370,11 @@ wxTimer * 
          m_timer
           

          Detailed Description

          -
          -

          Definition at line 56 of file Workspace.h.

          +

          This class manages the graphical and power elements. It is responsible for handling the user's interaction with the elements.

          +
          Author
          Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
          +
          Date
          19/09/2017
          + +

          Definition at line 81 of file Workspace.h.


          The documentation for this class was generated from the following files:
          • Project/Workspace.h
          • Project/Workspace.cpp
          • diff --git a/docs/doxygen/html/class_workspace_base-members.html b/docs/doxygen/html/class_workspace_base-members.html index 0ec8e27..7dfb42f 100644 --- a/docs/doxygen/html/class_workspace_base-members.html +++ b/docs/doxygen/html/class_workspace_base-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/class_workspace_base.html b/docs/doxygen/html/class_workspace_base.html index d6c6ae4..4a309f6 100644 --- a/docs/doxygen/html/class_workspace_base.html +++ b/docs/doxygen/html/class_workspace_base.html @@ -21,6 +21,12 @@ + @@ -93,7 +99,7 @@ Inheritance diagram for WorkspaceBase:
          -Workspace +Workspace
          diff --git a/docs/doxygen/html/classes.html b/docs/doxygen/html/classes.html index 6abb09f..918de89 100644 --- a/docs/doxygen/html/classes.html +++ b/docs/doxygen/html/classes.html @@ -21,6 +21,12 @@ + @@ -91,42 +97,42 @@ $(document).ready(function(){initNavTree('classes.html','');}); + - + + - - + + - + + + - - - + + + + + - - + + + - - - - - - + + + + + + + diff --git a/docs/doxygen/html/classwx_g_l_number_renderer-members.html b/docs/doxygen/html/classwx_g_l_number_renderer-members.html index 35f716a..83ee202 100644 --- a/docs/doxygen/html/classwx_g_l_number_renderer-members.html +++ b/docs/doxygen/html/classwx_g_l_number_renderer-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/classwx_g_l_number_renderer.html b/docs/doxygen/html/classwx_g_l_number_renderer.html index 2aecb95..bb3b8d8 100644 --- a/docs/doxygen/html/classwx_g_l_number_renderer.html +++ b/docs/doxygen/html/classwx_g_l_number_renderer.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/classwx_g_l_string-members.html b/docs/doxygen/html/classwx_g_l_string-members.html index 29b4296..8460eea 100644 --- a/docs/doxygen/html/classwx_g_l_string-members.html +++ b/docs/doxygen/html/classwx_g_l_string-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/classwx_g_l_string.html b/docs/doxygen/html/classwx_g_l_string.html index 50f103e..3b01817 100644 --- a/docs/doxygen/html/classwx_g_l_string.html +++ b/docs/doxygen/html/classwx_g_l_string.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/classwx_g_l_string_array-members.html b/docs/doxygen/html/classwx_g_l_string_array-members.html index 2471063..6c2b122 100644 --- a/docs/doxygen/html/classwx_g_l_string_array-members.html +++ b/docs/doxygen/html/classwx_g_l_string_array-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/classwx_g_l_string_array.html b/docs/doxygen/html/classwx_g_l_string_array.html index 58ba530..15335b3 100644 --- a/docs/doxygen/html/classwx_g_l_string_array.html +++ b/docs/doxygen/html/classwx_g_l_string_array.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/classwx_ribbon_metro_art_provider-members.html b/docs/doxygen/html/classwx_ribbon_metro_art_provider-members.html index 1d4cd26..a874837 100644 --- a/docs/doxygen/html/classwx_ribbon_metro_art_provider-members.html +++ b/docs/doxygen/html/classwx_ribbon_metro_art_provider-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/classwx_ribbon_metro_art_provider.html b/docs/doxygen/html/classwx_ribbon_metro_art_provider.html index 2fbf462..8019df1 100644 --- a/docs/doxygen/html/classwx_ribbon_metro_art_provider.html +++ b/docs/doxygen/html/classwx_ribbon_metro_art_provider.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/dir_ffd1f789ec7bd0a45fc6ad92579c5070.html b/docs/doxygen/html/dir_ffd1f789ec7bd0a45fc6ad92579c5070.html index a19b9a9..5a7d08d 100644 --- a/docs/doxygen/html/dir_ffd1f789ec7bd0a45fc6ad92579c5070.html +++ b/docs/doxygen/html/dir_ffd1f789ec7bd0a45fc6ad92579c5070.html @@ -21,6 +21,12 @@ + @@ -85,18 +91,102 @@ $(document).ready(function(){initNavTree('dir_ffd1f789ec7bd0a45fc6ad92579c5070.h
          IndMotorFormBase   SyncMachineForm   
          AboutForm   Inductor   OpenGLColour   SyncMachineFormBase   
          AboutFormBase   ElectricCalculation   InductorElectricalData   
            p  
          -
          SyncMotor   
          SyncMachineModelData   
            b  
          -
          Electromechanical   IntegrationConstant   SyncMotorElectricalData   
          Element   IOControl   PlotData   
            t  
          +
          Electromechanical   IntegrationConstant   SyncMotor   
          Element   IOControl   PlotData   SyncMotorElectricalData   
          Branch   ElementDataObject   IOControlForm   PowerElement   
            t  
          Branch   ElementDataObject   IOControlForm   PowerElement   
          Bus   ElementPlotData   IOControlFormBase   PowerFlow   Text   
          Bus   ElementPlotData   IOControlFormBase   PowerFlow   
          BusElectricalData   ElementsLists   
            l  
          -
          PropertiesData   TextForm   
          PropertiesData   Text   
          BusForm   Exponential   
            r  
          -
          TextFormBase   
          BusFormBase   ExponentialForm   Limiter   TextGLDrawable   
          TextForm   
          BusFormBase   ExponentialForm   Limiter   TextFormBase   
            c  
          -
          ExponentialFormBase   LimiterForm   RateLimiter   TextTexture   
          ExponentialFormBase   LimiterForm   RateLimiter   TextGLDrawable   
            f  
          -
          LimiterFormBase   RateLimiterForm   TransferFunction   
          Camera   Line   RateLimiterFormBase   TransferFunctionForm   
          Capacitor   Fault   LineElectricalData   ReactiveLimits   TransferFunctionFormBase   
          CapacitorElectricalData   FileHanding   LineForm   ReactiveShuntElementForm   Transformer   
          LimiterFormBase   RateLimiterForm   TextTexture   
          Camera   Line   RateLimiterFormBase   TransferFunction   
          Capacitor   Fault   LineElectricalData   ReactiveLimits   TransferFunctionForm   
          CapacitorElectricalData   FileHanding   LineForm   ReactiveShuntElementForm   TransferFunctionFormBase   
          ChartView   
            g  
          -
          LineFormBase   ReactiveShuntElementFormBase   TransformerElectricalData   
          LineFormBase   ReactiveShuntElementFormBase   Transformer   
          ChartViewBase   Load   
            s  
          -
          TransformerForm   
          ConnectionLine   Gain   LoadElectricalData   TransformerFormBase   
          Constant   GainForm   LoadForm   Shunt   
            w  
          +
          TransformerElectricalData   
          ConnectionLine   Gain   LoadElectricalData   TransformerForm   
          Constant   GainForm   LoadForm   Shunt   TransformerFormBase   
          ConstantForm   GainFormBase   LoadFormBase   SimulationData   
            w  
          ConstantForm   GainFormBase   LoadFormBase   SimulationData   
          ConstantFormBase   GeneralData   
            m  
          -
          SimulationsSettingsForm   Workspace   
          ControlEditor   GeneralPropertiesForm   SimulationsSettingsFormBase   WorkspaceBase   
          ControlEditorBase   GeneralPropertiesFormBase   Machines   TransferFunction::SpaceState   wxGLNumberRenderer   
          ControlElement   GeneratorStabForm   MainApp   Sum   wxGLString   
          ControlElementButton   GeneratorStabFormBase   MainFrame   SumForm   wxGLStringArray   
          ControlElementContainer   GraphicalElement   MainFrameBase   SumFormBase   wxRibbonMetroArtProvider   
          SimulationsSettingsForm   
          ControlEditor   GeneralPropertiesForm   SimulationsSettingsFormBase   Workspace   
          ControlEditorBase   GeneralPropertiesFormBase   Machines   TransferFunction::SpaceState   WorkspaceBase   
          ControlElement   GeneratorStabForm   MainApp   Sum   wxGLNumberRenderer   
          ControlElementButton   GeneratorStabFormBase   MainFrame   SumForm   wxGLString   
          ControlElementContainer   GraphicalElement   MainFrameBase   SumFormBase   wxGLStringArray   
          ControlElementSolver   
            i  
          -
          Multiplier   SwitchingData   
          Multiplier   SwitchingData   wxRibbonMetroArtProvider   
          ControlSystemTest   
            n  
          SwitchingForm   
          ControlSystemTestBase   IndMotor   SwitchingFormBase   
          + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

          Files

          file  AboutForm.h [code]
           
          file  BusForm.h [code]
           
          file  Camera.h [code]
           
          file  ChartView.h [code]
           
          file  ConnectionLine.h [code]
           
          file  Constant.h [code]
           
          file  ConstantForm.h [code]
           
          file  ControlEditor.h [code]
           
          file  ControlElement.h [code]
           Base class of a control element. Provide general methods to other control classes.
           
          file  ControlElementContainer.h [code]
           
          file  ControlElementSolver.h [code]
           
          file  ControlSystemTest.h [code]
           
          file  DataReport.h [code]
           
          file  ElectricCalculation.h [code]
           Base class of electric calculations, with general methods.
           
          file  Electromechanical.h [code]
           Calculates the electromechanical transient based on disturbances (e.g. system fault).
           
          file  Element.h [code]
           Class to manage color of OpenGL.
           
          file  Exponential.h [code]
           
          file  ExponentialForm.h [code]
           
          file  Fault.h [code]
           Calculate the fault of the system and update the elements data.
           
          file  FileHanding.h [code]
           
          file  Gain.h [code]
           
          file  GainForm.h [code]
           
          file  GeneralPropertiesForm.h [code]
           
          file  GeneratorStabForm.h [code]
           
          file  IndMotorForm.h [code]
           
          file  IOControl.h [code]
           
          file  IOControlForm.h [code]
           
          file  Limiter.h [code]
           
          file  LimiterForm.h [code]
           
          file  LineForm.h [code]
           
          file  LoadForm.h [code]
           
          file  MainFrame.h [code]
           
          file  Multiplier.h [code]
           
          file  PowerElement.h [code]
           Switching data of power elements.
           
          file  RateLimiter.h [code]
           
          file  RateLimiterForm.h [code]
           
          file  ReactiveShuntElementForm.h [code]
           
          file  SimulationsSettingsForm.h [code]
           
          file  SumForm.h [code]
           
          file  SwitchingForm.h [code]
           
          file  SyncMachineForm.h [code]
           
          file  TextForm.h [code]
           
          file  TransferFunctionForm.h [code]
           
          file  TransformerForm.h [code]
           
          file  Workspace.h [code]
           
          diff --git a/docs/doxygen/html/dir_ffd1f789ec7bd0a45fc6ad92579c5070.js b/docs/doxygen/html/dir_ffd1f789ec7bd0a45fc6ad92579c5070.js index 89bbc0b..241c27d 100644 --- a/docs/doxygen/html/dir_ffd1f789ec7bd0a45fc6ad92579c5070.js +++ b/docs/doxygen/html/dir_ffd1f789ec7bd0a45fc6ad92579c5070.js @@ -1,7 +1,9 @@ var dir_ffd1f789ec7bd0a45fc6ad92579c5070 = [ [ "AboutForm.cpp", "_about_form_8cpp_source.html", null ], - [ "AboutForm.h", "_about_form_8h_source.html", null ], + [ "AboutForm.h", "_about_form_8h.html", [ + [ "AboutForm", "class_about_form.html", "class_about_form" ] + ] ], [ "ArtMetro.cpp", "_art_metro_8cpp_source.html", null ], [ "ArtMetro.h", "_art_metro_8h_source.html", null ], [ "Branch.cpp", "_branch_8cpp_source.html", null ], @@ -9,38 +11,61 @@ var dir_ffd1f789ec7bd0a45fc6ad92579c5070 = [ "Bus.cpp", "_bus_8cpp_source.html", null ], [ "Bus.h", "_bus_8h_source.html", null ], [ "BusForm.cpp", "_bus_form_8cpp_source.html", null ], - [ "BusForm.h", "_bus_form_8h_source.html", null ], + [ "BusForm.h", "_bus_form_8h.html", [ + [ "BusForm", "class_bus_form.html", "class_bus_form" ] + ] ], [ "BusFormBitmaps.cpp", "_bus_form_bitmaps_8cpp_source.html", null ], [ "Camera.cpp", "_camera_8cpp_source.html", null ], - [ "Camera.h", "_camera_8h_source.html", null ], + [ "Camera.h", "_camera_8h.html", [ + [ "Camera", "class_camera.html", "class_camera" ] + ] ], [ "Capacitor.cpp", "_capacitor_8cpp_source.html", null ], [ "Capacitor.h", "_capacitor_8h_source.html", null ], [ "ChartView.cpp", "_chart_view_8cpp_source.html", null ], - [ "ChartView.h", "_chart_view_8h_source.html", null ], + [ "ChartView.h", "_chart_view_8h.html", [ + [ "ChartView", "class_chart_view.html", "class_chart_view" ] + ] ], [ "ChartViewBase.cpp", "_chart_view_base_8cpp_source.html", null ], [ "ChartViewBase.h", "_chart_view_base_8h_source.html", null ], [ "ChartViewBitmaps.cpp", "_chart_view_bitmaps_8cpp_source.html", null ], [ "ConnectionLine.cpp", "_connection_line_8cpp_source.html", null ], - [ "ConnectionLine.h", "_connection_line_8h_source.html", null ], + [ "ConnectionLine.h", "_connection_line_8h.html", [ + [ "ConnectionLine", "class_connection_line.html", "class_connection_line" ] + ] ], [ "Constant.cpp", "_constant_8cpp_source.html", null ], - [ "Constant.h", "_constant_8h_source.html", null ], + [ "Constant.h", "_constant_8h.html", [ + [ "Constant", "class_constant.html", "class_constant" ] + ] ], [ "ConstantForm.cpp", "_constant_form_8cpp_source.html", null ], - [ "ConstantForm.h", "_constant_form_8h_source.html", null ], + [ "ConstantForm.h", "_constant_form_8h.html", [ + [ "ConstantForm", "class_constant_form.html", "class_constant_form" ] + ] ], [ "ControlEditor.cpp", "_control_editor_8cpp_source.html", null ], - [ "ControlEditor.h", "_control_editor_8h_source.html", null ], + [ "ControlEditor.h", "_control_editor_8h.html", "_control_editor_8h" ], [ "ControlEditorBase.cpp", "_control_editor_base_8cpp_source.html", null ], [ "ControlEditorBase.h", "_control_editor_base_8h_source.html", null ], [ "ControlEditorBitmaps.cpp", "_control_editor_bitmaps_8cpp_source.html", null ], [ "ControlElement.cpp", "_control_element_8cpp_source.html", null ], - [ "ControlElement.h", "_control_element_8h_source.html", null ], + [ "ControlElement.h", "_control_element_8h.html", [ + [ "Node", "class_node.html", "class_node" ], + [ "ControlElement", "class_control_element.html", "class_control_element" ] + ] ], [ "ControlElementContainer.cpp", "_control_element_container_8cpp_source.html", null ], - [ "ControlElementContainer.h", "_control_element_container_8h_source.html", null ], + [ "ControlElementContainer.h", "_control_element_container_8h.html", [ + [ "ControlElementContainer", "class_control_element_container.html", "class_control_element_container" ] + ] ], [ "ControlElementSolver.cpp", "_control_element_solver_8cpp_source.html", null ], - [ "ControlElementSolver.h", "_control_element_solver_8h_source.html", null ], + [ "ControlElementSolver.h", "_control_element_solver_8h.html", [ + [ "ControlElementSolver", "class_control_element_solver.html", "class_control_element_solver" ] + ] ], [ "ControlSystemTest.cpp", "_control_system_test_8cpp_source.html", null ], - [ "ControlSystemTest.h", "_control_system_test_8h_source.html", null ], + [ "ControlSystemTest.h", "_control_system_test_8h.html", [ + [ "ControlSystemTest", "class_control_system_test.html", "class_control_system_test" ] + ] ], [ "DataReport.cpp", "_data_report_8cpp_source.html", null ], - [ "DataReport.h", "_data_report_8h_source.html", null ], + [ "DataReport.h", "_data_report_8h.html", [ + [ "DataReport", "class_data_report.html", "class_data_report" ] + ] ], [ "DataReportBase.cpp", "_data_report_base_8cpp_source.html", null ], [ "DataReportBase.h", "_data_report_base_8h_source.html", null ], [ "DataReportBitmaps.cpp", "_data_report_bitmaps_8cpp_source.html", null ], @@ -48,7 +73,10 @@ var dir_ffd1f789ec7bd0a45fc6ad92579c5070 = [ "ElectricCalculation.cpp", "_electric_calculation_8cpp_source.html", null ], [ "ElectricCalculation.h", "_electric_calculation_8h.html", "_electric_calculation_8h" ], [ "Electromechanical.cpp", "_electromechanical_8cpp_source.html", null ], - [ "Electromechanical.h", "_electromechanical_8h_source.html", null ], + [ "Electromechanical.h", "_electromechanical_8h.html", [ + [ "SyncMachineModelData", "struct_sync_machine_model_data.html", "struct_sync_machine_model_data" ], + [ "Electromechanical", "class_electromechanical.html", "class_electromechanical" ] + ] ], [ "Element.cpp", "_element_8cpp_source.html", null ], [ "Element.h", "_element_8h.html", "_element_8h" ], [ "ElementDataObject.cpp", "_element_data_object_8cpp_source.html", null ], @@ -59,57 +87,87 @@ var dir_ffd1f789ec7bd0a45fc6ad92579c5070 = [ "ElementPlotData.cpp", "_element_plot_data_8cpp_source.html", null ], [ "ElementPlotData.h", "_element_plot_data_8h_source.html", null ], [ "Exponential.cpp", "_exponential_8cpp_source.html", null ], - [ "Exponential.h", "_exponential_8h_source.html", null ], + [ "Exponential.h", "_exponential_8h.html", [ + [ "Exponential", "class_exponential.html", "class_exponential" ] + ] ], [ "ExponentialForm.cpp", "_exponential_form_8cpp_source.html", null ], - [ "ExponentialForm.h", "_exponential_form_8h_source.html", null ], + [ "ExponentialForm.h", "_exponential_form_8h.html", [ + [ "ExponentialForm", "class_exponential_form.html", "class_exponential_form" ] + ] ], [ "Fault.cpp", "_fault_8cpp_source.html", null ], [ "Fault.h", "_fault_8h.html", [ [ "Fault", "class_fault.html", "class_fault" ] ] ], [ "FileHanding.cpp", "_file_handing_8cpp_source.html", null ], - [ "FileHanding.h", "_file_handing_8h_source.html", null ], + [ "FileHanding.h", "_file_handing_8h.html", [ + [ "FileHanding", "class_file_handing.html", "class_file_handing" ] + ] ], [ "Gain.cpp", "_gain_8cpp_source.html", null ], - [ "Gain.h", "_gain_8h_source.html", null ], + [ "Gain.h", "_gain_8h.html", [ + [ "Gain", "class_gain.html", "class_gain" ] + ] ], [ "GainForm.cpp", "_gain_form_8cpp_source.html", null ], - [ "GainForm.h", "_gain_form_8h_source.html", null ], + [ "GainForm.h", "_gain_form_8h.html", [ + [ "GainForm", "class_gain_form.html", "class_gain_form" ] + ] ], [ "GeneralPropertiesForm.cpp", "_general_properties_form_8cpp_source.html", null ], - [ "GeneralPropertiesForm.h", "_general_properties_form_8h_source.html", null ], + [ "GeneralPropertiesForm.h", "_general_properties_form_8h.html", [ + [ "GeneralPropertiesForm", "class_general_properties_form.html", "class_general_properties_form" ] + ] ], [ "GeneratorStabForm.cpp", "_generator_stab_form_8cpp_source.html", null ], - [ "GeneratorStabForm.h", "_generator_stab_form_8h_source.html", null ], + [ "GeneratorStabForm.h", "_generator_stab_form_8h.html", [ + [ "GeneratorStabForm", "class_generator_stab_form.html", "class_generator_stab_form" ] + ] ], [ "GraphicalElement.cpp", "_graphical_element_8cpp_source.html", null ], [ "GraphicalElement.h", "_graphical_element_8h_source.html", null ], [ "IndMotor.cpp", "_ind_motor_8cpp_source.html", null ], [ "IndMotor.h", "_ind_motor_8h_source.html", null ], [ "IndMotorForm.cpp", "_ind_motor_form_8cpp_source.html", null ], - [ "IndMotorForm.h", "_ind_motor_form_8h_source.html", null ], + [ "IndMotorForm.h", "_ind_motor_form_8h.html", [ + [ "IndMotorForm", "class_ind_motor_form.html", "class_ind_motor_form" ] + ] ], [ "Inductor.cpp", "_inductor_8cpp_source.html", null ], [ "Inductor.h", "_inductor_8h_source.html", null ], [ "IOControl.cpp", "_i_o_control_8cpp_source.html", null ], - [ "IOControl.h", "_i_o_control_8h_source.html", null ], + [ "IOControl.h", "_i_o_control_8h.html", [ + [ "IOControl", "class_i_o_control.html", "class_i_o_control" ] + ] ], [ "IOControlForm.cpp", "_i_o_control_form_8cpp_source.html", null ], - [ "IOControlForm.h", "_i_o_control_form_8h_source.html", null ], + [ "IOControlForm.h", "_i_o_control_form_8h.html", [ + [ "IOControlForm", "class_i_o_control_form.html", "class_i_o_control_form" ] + ] ], [ "Limiter.cpp", "_limiter_8cpp_source.html", null ], - [ "Limiter.h", "_limiter_8h_source.html", null ], + [ "Limiter.h", "_limiter_8h.html", [ + [ "Limiter", "class_limiter.html", "class_limiter" ] + ] ], [ "LimiterForm.cpp", "_limiter_form_8cpp_source.html", null ], - [ "LimiterForm.h", "_limiter_form_8h_source.html", null ], + [ "LimiterForm.h", "_limiter_form_8h.html", [ + [ "LimiterForm", "class_limiter_form.html", "class_limiter_form" ] + ] ], [ "Line.cpp", "_line_8cpp_source.html", null ], [ "Line.h", "_line_8h_source.html", null ], [ "LineForm.cpp", "_line_form_8cpp_source.html", null ], - [ "LineForm.h", "_line_form_8h_source.html", null ], + [ "LineForm.h", "_line_form_8h.html", [ + [ "LineForm", "class_line_form.html", "class_line_form" ] + ] ], [ "Load.cpp", "_load_8cpp_source.html", null ], [ "Load.h", "_load_8h_source.html", null ], [ "LoadForm.cpp", "_load_form_8cpp_source.html", null ], - [ "LoadForm.h", "_load_form_8h_source.html", null ], + [ "LoadForm.h", "_load_form_8h.html", [ + [ "LoadForm", "class_load_form.html", "class_load_form" ] + ] ], [ "Machines.cpp", "_machines_8cpp_source.html", null ], [ "Machines.h", "_machines_8h_source.html", null ], [ "main.cpp", "main_8cpp_source.html", null ], [ "MainFrame.cpp", "_main_frame_8cpp_source.html", null ], - [ "MainFrame.h", "_main_frame_8h_source.html", null ], + [ "MainFrame.h", "_main_frame_8h.html", "_main_frame_8h" ], [ "MainFrameBase.cpp", "_main_frame_base_8cpp_source.html", null ], [ "MainFrameBase.h", "_main_frame_base_8h_source.html", null ], [ "MainFrameBitmaps.cpp", "_main_frame_bitmaps_8cpp_source.html", null ], [ "Multiplier.cpp", "_multiplier_8cpp_source.html", null ], - [ "Multiplier.h", "_multiplier_8h_source.html", null ], + [ "Multiplier.h", "_multiplier_8h.html", [ + [ "Multiplier", "class_multiplier.html", "class_multiplier" ] + ] ], [ "PowerElement.cpp", "_power_element_8cpp_source.html", null ], [ "PowerElement.h", "_power_element_8h.html", "_power_element_8h" ], [ "PowerFlow.cpp", "_power_flow_8cpp_source.html", null ], @@ -120,41 +178,61 @@ var dir_ffd1f789ec7bd0a45fc6ad92579c5070 = [ "PropertiesForm.h", "_properties_form_8h_source.html", null ], [ "PropertiesFormBitmaps.cpp", "_properties_form_bitmaps_8cpp_source.html", null ], [ "RateLimiter.cpp", "_rate_limiter_8cpp_source.html", null ], - [ "RateLimiter.h", "_rate_limiter_8h_source.html", null ], + [ "RateLimiter.h", "_rate_limiter_8h.html", [ + [ "RateLimiter", "class_rate_limiter.html", "class_rate_limiter" ] + ] ], [ "RateLimiterForm.cpp", "_rate_limiter_form_8cpp_source.html", null ], - [ "RateLimiterForm.h", "_rate_limiter_form_8h_source.html", null ], + [ "RateLimiterForm.h", "_rate_limiter_form_8h.html", [ + [ "RateLimiterForm", "class_rate_limiter_form.html", "class_rate_limiter_form" ] + ] ], [ "ReactiveShuntElementForm.cpp", "_reactive_shunt_element_form_8cpp_source.html", null ], - [ "ReactiveShuntElementForm.h", "_reactive_shunt_element_form_8h_source.html", null ], + [ "ReactiveShuntElementForm.h", "_reactive_shunt_element_form_8h.html", [ + [ "ReactiveShuntElementForm", "class_reactive_shunt_element_form.html", "class_reactive_shunt_element_form" ] + ] ], [ "Shunt.cpp", "_shunt_8cpp_source.html", null ], [ "Shunt.h", "_shunt_8h_source.html", null ], [ "SimulationsSettingsForm.cpp", "_simulations_settings_form_8cpp_source.html", null ], - [ "SimulationsSettingsForm.h", "_simulations_settings_form_8h_source.html", null ], + [ "SimulationsSettingsForm.h", "_simulations_settings_form_8h.html", [ + [ "SimulationsSettingsForm", "class_simulations_settings_form.html", "class_simulations_settings_form" ] + ] ], [ "Sum.cpp", "_sum_8cpp_source.html", null ], [ "Sum.h", "_sum_8h_source.html", null ], [ "SumForm.cpp", "_sum_form_8cpp_source.html", null ], - [ "SumForm.h", "_sum_form_8h_source.html", null ], + [ "SumForm.h", "_sum_form_8h.html", [ + [ "SumForm", "class_sum_form.html", "class_sum_form" ] + ] ], [ "SwitchingForm.cpp", "_switching_form_8cpp_source.html", null ], - [ "SwitchingForm.h", "_switching_form_8h_source.html", null ], + [ "SwitchingForm.h", "_switching_form_8h.html", [ + [ "SwitchingForm", "class_switching_form.html", "class_switching_form" ] + ] ], [ "SyncGenerator.cpp", "_sync_generator_8cpp_source.html", null ], [ "SyncGenerator.h", "_sync_generator_8h_source.html", null ], [ "SyncMachineForm.cpp", "_sync_machine_form_8cpp_source.html", null ], - [ "SyncMachineForm.h", "_sync_machine_form_8h_source.html", null ], + [ "SyncMachineForm.h", "_sync_machine_form_8h.html", [ + [ "SyncMachineForm", "class_sync_machine_form.html", "class_sync_machine_form" ] + ] ], [ "SyncMotor.cpp", "_sync_motor_8cpp_source.html", null ], [ "SyncMotor.h", "_sync_motor_8h_source.html", null ], [ "Text.cpp", "_text_8cpp_source.html", null ], [ "Text.h", "_text_8h_source.html", null ], [ "TextForm.cpp", "_text_form_8cpp_source.html", null ], - [ "TextForm.h", "_text_form_8h_source.html", null ], + [ "TextForm.h", "_text_form_8h.html", [ + [ "TextForm", "class_text_form.html", "class_text_form" ] + ] ], [ "TransferFunction.cpp", "_transfer_function_8cpp_source.html", null ], [ "TransferFunction.h", "_transfer_function_8h_source.html", null ], [ "TransferFunctionForm.cpp", "_transfer_function_form_8cpp_source.html", null ], - [ "TransferFunctionForm.h", "_transfer_function_form_8h_source.html", null ], + [ "TransferFunctionForm.h", "_transfer_function_form_8h.html", [ + [ "TransferFunctionForm", "class_transfer_function_form.html", "class_transfer_function_form" ] + ] ], [ "Transformer.cpp", "_transformer_8cpp_source.html", null ], [ "Transformer.h", "_transformer_8h_source.html", null ], [ "TransformerForm.cpp", "_transformer_form_8cpp_source.html", null ], - [ "TransformerForm.h", "_transformer_form_8h_source.html", null ], + [ "TransformerForm.h", "_transformer_form_8h.html", [ + [ "TransformerForm", "class_transformer_form.html", "class_transformer_form" ] + ] ], [ "Workspace.cpp", "_workspace_8cpp_source.html", null ], - [ "Workspace.h", "_workspace_8h_source.html", null ], + [ "Workspace.h", "_workspace_8h.html", "_workspace_8h" ], [ "WorkspaceBase.cpp", "_workspace_base_8cpp_source.html", null ], [ "WorkspaceBase.h", "_workspace_base_8h_source.html", null ], [ "WorkspaceBitmaps.cpp", "_workspace_bitmaps_8cpp_source.html", null ], diff --git a/docs/doxygen/html/files.html b/docs/doxygen/html/files.html index d9a8eb6..f045c65 100644 --- a/docs/doxygen/html/files.html +++ b/docs/doxygen/html/files.html @@ -21,6 +21,12 @@ + @@ -86,7 +92,7 @@ $(document).ready(function(){initNavTree('files.html','');});
          [detail level 12]
          - + @@ -94,38 +100,38 @@ $(document).ready(function(){initNavTree('files.html','');}); - + - + - + - + - + - + - + - + - + - + - + - + @@ -133,7 +139,7 @@ $(document).ready(function(){initNavTree('files.html','');}); - + @@ -144,55 +150,55 @@ $(document).ready(function(){initNavTree('files.html','');}); - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -203,41 +209,41 @@ $(document).ready(function(){initNavTree('files.html','');}); - + - + - + - + - + - + - + - + - + - + - + diff --git a/docs/doxygen/html/functions.html b/docs/doxygen/html/functions.html index 87942d3..d88ea1f 100644 --- a/docs/doxygen/html/functions.html +++ b/docs/doxygen/html/functions.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_0x7e.html b/docs/doxygen/html/functions_0x7e.html index 3b57d24..039d464 100644 --- a/docs/doxygen/html/functions_0x7e.html +++ b/docs/doxygen/html/functions_0x7e.html @@ -21,6 +21,12 @@ + @@ -90,6 +96,9 @@ $(document).ready(function(){initNavTree('functions_0x7e.html','');});
        • ~Fault() : Fault
        • +
        • ~MainFrame() +: MainFrame +
        • ~OpenGLColour() : OpenGLColour
        • diff --git a/docs/doxygen/html/functions_b.html b/docs/doxygen/html/functions_b.html index 5a50ef8..37a86ac 100644 --- a/docs/doxygen/html/functions_b.html +++ b/docs/doxygen/html/functions_b.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_c.html b/docs/doxygen/html/functions_c.html index ac040a0..9313eeb 100644 --- a/docs/doxygen/html/functions_c.html +++ b/docs/doxygen/html/functions_c.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_d.html b/docs/doxygen/html/functions_d.html index c5d1285..22efd8e 100644 --- a/docs/doxygen/html/functions_d.html +++ b/docs/doxygen/html/functions_d.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_dup.js b/docs/doxygen/html/functions_dup.js index fbb7b94..0478871 100644 --- a/docs/doxygen/html/functions_dup.js +++ b/docs/doxygen/html/functions_dup.js @@ -17,5 +17,6 @@ var functions_dup = [ "s", "functions_s.html", null ], [ "u", "functions_u.html", null ], [ "w", "functions_w.html", null ], + [ "x", "functions_x.html", null ], [ "~", "functions_0x7e.html", null ] ]; \ No newline at end of file diff --git a/docs/doxygen/html/functions_e.html b/docs/doxygen/html/functions_e.html index 2190b7b..2f9eccf 100644 --- a/docs/doxygen/html/functions_e.html +++ b/docs/doxygen/html/functions_e.html @@ -21,6 +21,12 @@ + @@ -81,12 +87,18 @@ $(document).ready(function(){initNavTree('functions_e.html','');});
          Here is a list of all documented class members with links to the class documentation for each member:

          - e -

          diff --git a/docs/doxygen/html/functions_f.html b/docs/doxygen/html/functions_f.html index e02fa0a..abaf0b0 100644 --- a/docs/doxygen/html/functions_f.html +++ b/docs/doxygen/html/functions_f.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func.html b/docs/doxygen/html/functions_func.html index 43ec58f..47ba1b5 100644 --- a/docs/doxygen/html/functions_func.html +++ b/docs/doxygen/html/functions_func.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_0x7e.html b/docs/doxygen/html/functions_func_0x7e.html index ec04ab7..32db6a2 100644 --- a/docs/doxygen/html/functions_func_0x7e.html +++ b/docs/doxygen/html/functions_func_0x7e.html @@ -21,6 +21,12 @@ + @@ -90,6 +96,9 @@ $(document).ready(function(){initNavTree('functions_func_0x7e.html','');});
        • ~Fault() : Fault
        • +
        • ~MainFrame() +: MainFrame +
        • ~OpenGLColour() : OpenGLColour
        • diff --git a/docs/doxygen/html/functions_func_b.html b/docs/doxygen/html/functions_func_b.html index eac5c8a..c756e0d 100644 --- a/docs/doxygen/html/functions_func_b.html +++ b/docs/doxygen/html/functions_func_b.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_c.html b/docs/doxygen/html/functions_func_c.html index 5e24983..9663c8b 100644 --- a/docs/doxygen/html/functions_func_c.html +++ b/docs/doxygen/html/functions_func_c.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_d.html b/docs/doxygen/html/functions_func_d.html index 55cf683..0c8d85f 100644 --- a/docs/doxygen/html/functions_func_d.html +++ b/docs/doxygen/html/functions_func_d.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_e.html b/docs/doxygen/html/functions_func_e.html index 354dfde..9629404 100644 --- a/docs/doxygen/html/functions_func_e.html +++ b/docs/doxygen/html/functions_func_e.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_f.html b/docs/doxygen/html/functions_func_f.html index 200f223..9e5d825 100644 --- a/docs/doxygen/html/functions_func_f.html +++ b/docs/doxygen/html/functions_func_f.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_g.html b/docs/doxygen/html/functions_func_g.html index 3c6571b..9990e70 100644 --- a/docs/doxygen/html/functions_func_g.html +++ b/docs/doxygen/html/functions_func_g.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_h.html b/docs/doxygen/html/functions_func_h.html index 97d8a98..fb6ab85 100644 --- a/docs/doxygen/html/functions_func_h.html +++ b/docs/doxygen/html/functions_func_h.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_i.html b/docs/doxygen/html/functions_func_i.html index e65ea25..994ffa1 100644 --- a/docs/doxygen/html/functions_func_i.html +++ b/docs/doxygen/html/functions_func_i.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_m.html b/docs/doxygen/html/functions_func_m.html index 7f25004..059247f 100644 --- a/docs/doxygen/html/functions_func_m.html +++ b/docs/doxygen/html/functions_func_m.html @@ -21,6 +21,12 @@ + @@ -81,6 +87,9 @@ $(document).ready(function(){initNavTree('functions_func_m.html','');});  

          - m -

            +
          • MainFrame() +: MainFrame +
          • Move() : Branch , ConnectionLine diff --git a/docs/doxygen/html/functions_func_n.html b/docs/doxygen/html/functions_func_n.html index 68647c1..0092d43 100644 --- a/docs/doxygen/html/functions_func_n.html +++ b/docs/doxygen/html/functions_func_n.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_o.html b/docs/doxygen/html/functions_func_o.html index 6562f3f..cbc1792 100644 --- a/docs/doxygen/html/functions_func_o.html +++ b/docs/doxygen/html/functions_func_o.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_p.html b/docs/doxygen/html/functions_func_p.html index ea93c75..1fc08c0 100644 --- a/docs/doxygen/html/functions_func_p.html +++ b/docs/doxygen/html/functions_func_p.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_r.html b/docs/doxygen/html/functions_func_r.html index 63a3e70..5e4cecb 100644 --- a/docs/doxygen/html/functions_func_r.html +++ b/docs/doxygen/html/functions_func_r.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_s.html b/docs/doxygen/html/functions_func_s.html index 5d1cb9f..2de3bc7 100644 --- a/docs/doxygen/html/functions_func_s.html +++ b/docs/doxygen/html/functions_func_s.html @@ -21,6 +21,12 @@ + @@ -176,6 +182,9 @@ $(document).ready(function(){initNavTree('functions_func_s.html','');});
          • ShowPickbox() : Element
          • +
          • Solve() +: RateLimiter +
          • StartMove() : Branch , ConnectionLine diff --git a/docs/doxygen/html/functions_func_u.html b/docs/doxygen/html/functions_func_u.html index 00adefe..78e4a3f 100644 --- a/docs/doxygen/html/functions_func_u.html +++ b/docs/doxygen/html/functions_func_u.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_func_w.html b/docs/doxygen/html/functions_func_w.html index 3f86c30..b9ae11f 100644 --- a/docs/doxygen/html/functions_func_w.html +++ b/docs/doxygen/html/functions_func_w.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_g.html b/docs/doxygen/html/functions_g.html index 196387f..5ea6bb4 100644 --- a/docs/doxygen/html/functions_g.html +++ b/docs/doxygen/html/functions_g.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_h.html b/docs/doxygen/html/functions_h.html index 578f5d1..a89a4ae 100644 --- a/docs/doxygen/html/functions_h.html +++ b/docs/doxygen/html/functions_h.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_i.html b/docs/doxygen/html/functions_i.html index 275eca4..62654ab 100644 --- a/docs/doxygen/html/functions_i.html +++ b/docs/doxygen/html/functions_i.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_m.html b/docs/doxygen/html/functions_m.html index 22b0427..2287903 100644 --- a/docs/doxygen/html/functions_m.html +++ b/docs/doxygen/html/functions_m.html @@ -21,6 +21,12 @@ + @@ -84,6 +90,9 @@ $(document).ready(function(){initNavTree('functions_m.html','');});
          • m : IntegrationConstant
          • +
          • MainFrame() +: MainFrame +
          • Move() : Branch , ConnectionLine diff --git a/docs/doxygen/html/functions_n.html b/docs/doxygen/html/functions_n.html index 4ef753d..d184509 100644 --- a/docs/doxygen/html/functions_n.html +++ b/docs/doxygen/html/functions_n.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_o.html b/docs/doxygen/html/functions_o.html index 8d61f81..00eb930 100644 --- a/docs/doxygen/html/functions_o.html +++ b/docs/doxygen/html/functions_o.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_p.html b/docs/doxygen/html/functions_p.html index 336cb9d..7344a84 100644 --- a/docs/doxygen/html/functions_p.html +++ b/docs/doxygen/html/functions_p.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_r.html b/docs/doxygen/html/functions_r.html index bb33999..83e1ddf 100644 --- a/docs/doxygen/html/functions_r.html +++ b/docs/doxygen/html/functions_r.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_s.html b/docs/doxygen/html/functions_s.html index 4ff8fc5..0a6ad94 100644 --- a/docs/doxygen/html/functions_s.html +++ b/docs/doxygen/html/functions_s.html @@ -21,6 +21,12 @@ + @@ -176,6 +182,9 @@ $(document).ready(function(){initNavTree('functions_s.html','');});
          • ShowPickbox() : Element
          • +
          • Solve() +: RateLimiter +
          • StartMove() : Branch , ConnectionLine diff --git a/docs/doxygen/html/functions_u.html b/docs/doxygen/html/functions_u.html index e94d380..1cbccf5 100644 --- a/docs/doxygen/html/functions_u.html +++ b/docs/doxygen/html/functions_u.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_vars.html b/docs/doxygen/html/functions_vars.html index 9192693..dad8f11 100644 --- a/docs/doxygen/html/functions_vars.html +++ b/docs/doxygen/html/functions_vars.html @@ -21,6 +21,12 @@ + @@ -82,6 +88,12 @@ $(document).ready(function(){initNavTree('functions_vars.html','');});
          • c : IntegrationConstant
          • +
          • ed +: SyncMachineModelData +
          • +
          • eq +: SyncMachineModelData +
          • m : IntegrationConstant
          • @@ -91,6 +103,12 @@ $(document).ready(function(){initNavTree('functions_vars.html','');});
          • swType : SwitchingData
          • +
          • xd +: SyncMachineModelData +
          • +
          • xq +: SyncMachineModelData +
          diff --git a/docs/doxygen/html/functions_w.html b/docs/doxygen/html/functions_w.html index 7cb51ad..4fcee61 100644 --- a/docs/doxygen/html/functions_w.html +++ b/docs/doxygen/html/functions_w.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/functions_x.html b/docs/doxygen/html/functions_x.html new file mode 100644 index 0000000..7782f52 --- /dev/null +++ b/docs/doxygen/html/functions_x.html @@ -0,0 +1,108 @@ + + + + + + + + + +Class Members + + + + + + + + + + + + + + + +
          +
          +
            Project
          + + + + + +
          + + + + + + + + + +
          + +
          +
          +
          + +
          + +
          +
          + + +
          + +
          + +
          +
          Here is a list of all documented class members with links to the class documentation for each member:
          + +

          - x -

          +
          +
          + + + + diff --git a/docs/doxygen/html/globals.html b/docs/doxygen/html/globals.html index 19ade4d..43a7bc4 100644 --- a/docs/doxygen/html/globals.html +++ b/docs/doxygen/html/globals.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/globals_enum.html b/docs/doxygen/html/globals_enum.html index 85e484a..ffbca27 100644 --- a/docs/doxygen/html/globals_enum.html +++ b/docs/doxygen/html/globals_enum.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/globals_eval.html b/docs/doxygen/html/globals_eval.html index ea8fc6e..c7a65f8 100644 --- a/docs/doxygen/html/globals_eval.html +++ b/docs/doxygen/html/globals_eval.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/hierarchy.html b/docs/doxygen/html/hierarchy.html index 762b63c..8d0d95e 100644 --- a/docs/doxygen/html/hierarchy.html +++ b/docs/doxygen/html/hierarchy.html @@ -21,6 +21,12 @@ + @@ -85,24 +91,25 @@ $(document).ready(function(){initNavTree('hierarchy.html','');});
          This inheritance list is sorted roughly, but not completely, alphabetically:
          [detail level 1234]
          - + - - + + - - - - - - - - + + + + + + + + @@ -122,14 +129,14 @@ $(document).ready(function(){initNavTree('hierarchy.html','');}); - + - + @@ -137,82 +144,83 @@ $(document).ready(function(){initNavTree('hierarchy.html','');}); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
           CBusElectricalData
           CCamera
           CCameraClass responsible for the correct visualization of the elements on screen
           CCapacitorElectricalData
           CControlElementContainer
           CControlElementSolver
           CControlElementContainerClass that can contain all control elements. Can identify (using RTTI) the elements from a generic list and store them separately
           CControlElementSolverSolves in the time the control system. Can solve the control system directly from a ControlEditor or from a ControlEditorElement
           CElectricCalculation
           CElectromechanical
           CFault
           CPowerFlow
           CElement
           CControlElement
           CGraphicalElement
           CElementPlotData
           CElementsLists
           CFileHanding
           CFileHandingSave and opens the projects created on disk
           CGeneralData
           CIndMotorElectricalData
           CInductorElectricalData
           CIntegrationConstant
           CLineElectricalData
           CLoadElectricalData
           CNode
           CNodeNode of a control element. This class manages the user interaction with the connection and control elements
           COpenGLColour
           CPropertiesData
           CReactiveLimits
           CTransferFunction::SpaceState
           CSwitchingData
           CSyncGeneratorElectricalData
           CSyncMotorElectricalData
           CTextGLDrawable
           CwxGLString
           CTextTexture
           CTransformerElectricalData
           CwxApp
           CMainApp
           CwxDataObjectSimple
           CElementDataObject
           CwxDialog
           CAboutFormBase
           CBusFormBase
           CConstantFormBase
           CControlSystemTestBase
           CExponentialFormBase
           CGainFormBase
           CGeneralPropertiesFormBase
           CGeneratorStabFormBase
           CIndMotorFormBase
           CIOControlFormBase
           CLimiterFormBase
           CLineFormBase
           CLoadFormBase
           CRateLimiterFormBase
           CReactiveShuntElementFormBase
           CSimulationsSettingsFormBase
           CSumFormBase
           CSwitchingFormBase
           CSyncMachineFormBase
           CTextFormBase
           CTransferFunctionFormBase
           CTransformerFormBase
           CwxFrame
           CChartViewBase
           CControlEditorBase
           CDataReportBase
           CMainFrameBase
           CwxGLStringArray
           CwxPanel
           CWorkspaceBase
           CwxRibbonMSWArtProvider
           CwxRibbonMetroArtProvider
           CwxString
           CwxGLString
           CwxTreeItemData
           CPlotData
           CwxWindow
           CControlElementButton
           CSyncMachineModelDataSynchronous machine data for different models
           CSyncMotorElectricalData
           CTextGLDrawable
           CwxGLString
           CTextTexture
           CTransformerElectricalData
           CwxApp
           CMainApp
           CwxDataObjectSimple
           CElementDataObject
           CwxDialog
           CAboutFormBase
           CBusFormBase
           CConstantFormBase
           CControlSystemTestBase
           CExponentialFormBase
           CGainFormBase
           CGeneralPropertiesFormBase
           CGeneratorStabFormBase
           CIndMotorFormBase
           CIOControlFormBase
           CLimiterFormBase
           CLineFormBase
           CLoadFormBase
           CRateLimiterFormBase
           CReactiveShuntElementFormBase
           CSimulationsSettingsFormBase
           CSumFormBase
           CSwitchingFormBase
           CSyncMachineFormBase
           CTextFormBase
           CTransferFunctionFormBase
           CTransformerFormBase
           CwxFrame
           CChartViewBase
           CControlEditorBase
           CDataReportBase
           CMainFrameBase
           CwxGLStringArray
           CwxPanel
           CWorkspaceBase
           CwxRibbonMSWArtProvider
           CwxRibbonMetroArtProvider
           CwxString
           CwxGLString
           CwxTreeItemData
           CPlotData
           CwxWindow
           CControlElementButtonThis class is responsible to handle the user interaction with control elements
          diff --git a/docs/doxygen/html/hierarchy.js b/docs/doxygen/html/hierarchy.js index 78ffac8..8746d59 100644 --- a/docs/doxygen/html/hierarchy.js +++ b/docs/doxygen/html/hierarchy.js @@ -61,6 +61,7 @@ var hierarchy = [ "TransferFunction::SpaceState", "struct_transfer_function_1_1_space_state.html", null ], [ "SwitchingData", "struct_switching_data.html", null ], [ "SyncGeneratorElectricalData", "struct_sync_generator_electrical_data.html", null ], + [ "SyncMachineModelData", "struct_sync_machine_model_data.html", null ], [ "SyncMotorElectricalData", "struct_sync_motor_electrical_data.html", null ], [ "TextGLDrawable", "class_text_g_l_drawable.html", [ [ "wxGLString", "classwx_g_l_string.html", [ diff --git a/docs/doxygen/html/index.html b/docs/doxygen/html/index.html index 3c9baea..0c4eb86 100644 --- a/docs/doxygen/html/index.html +++ b/docs/doxygen/html/index.html @@ -21,6 +21,12 @@ + @@ -84,8 +90,8 @@ $(document).ready(function(){initNavTree('index.html','');});

          Developers

          Date

          September 14, 2017

          diff --git a/docs/doxygen/html/main_8cpp_source.html b/docs/doxygen/html/main_8cpp_source.html index 039e008..b9759c9 100644 --- a/docs/doxygen/html/main_8cpp_source.html +++ b/docs/doxygen/html/main_8cpp_source.html @@ -21,6 +21,12 @@ + @@ -82,9 +88,10 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html','');});
          main.cpp
          -
          1 #include <wx/app.h>
          2 #include <wx/event.h>
          3 #include <wx/image.h>
          4 #include <wx/stdpaths.h>
          5 #include <wx/textfile.h>
          6 
          7 #include "MainFrame.h"
          8 #include "PropertiesData.h"
          9 
          10 // Define the MainApp
          11 class MainApp : public wxApp
          12 {
          13  public:
          14  MainApp() {}
          15  virtual ~MainApp() {}
          16  bool LoadInitFile(PropertiesData* propertiesData)
          17  {
          18  wxTextFile file("config.ini");
          19  auto data = propertiesData->GetGeneralPropertiesData();
          20 
          21  if(!file.Create()) {
          22  if(!file.Open()) return false;
          23 
          24  wxString line;
          25  for(line = file.GetFirstLine(); !file.Eof(); line = file.GetNextLine()) {
          26  wxString tag = "";
          27  wxString tagValue = "";
          28  bool parseValue = false;
          29  for(unsigned int i = 0; i < line.Len(); ++i) {
          30  if(line[i] == '=') {
          31  parseValue = true;
          32  } else {
          33  if(parseValue)
          34  tagValue += line[i];
          35  else
          36  tag += line[i];
          37  }
          38  }
          39  // Language
          40  if(tag == "lang") {
          41  if(tagValue == "pt-br" || tagValue == "pt") {
          42  data.language = wxLANGUAGE_PORTUGUESE_BRAZILIAN;
          43  } else if(tagValue == "en" || tagValue == "en-us" || tagValue == "en-uk") {
          44  data.language = wxLANGUAGE_ENGLISH;
          45  }
          46  }
          47  if(tag == "theme") {
          48  if(tagValue == "light") {
          49  data.theme = THEME_LIGHT;
          50  } else if(tagValue == "dark") {
          51  data.theme = THEME_DARK;
          52  }
          53  }
          54  }
          55  file.Close();
          56  } else { // Create default init file.
          57  if(!file.Open()) return false;
          58 
          59  // Default parameters.
          60  file.AddLine("lang=en");
          61  file.AddLine("theme=light");
          62 
          63  file.Write();
          64  file.Close();
          65 
          66  data.language = wxLANGUAGE_ENGLISH;
          67  data.theme = THEME_LIGHT;
          68  propertiesData->SetGeneralPropertiesData(data);
          69  }
          70 
          71  propertiesData->SetGeneralPropertiesData(data);
          72  return true;
          73  }
          74 
          75  void LoadCatalogs(wxLocale* locale, PropertiesData* propertiesData)
          76  {
          77  locale->Init(propertiesData->GetGeneralPropertiesData().language, wxLOCALE_DONT_LOAD_DEFAULT);
          78 
          79  wxFileName fn(wxStandardPaths::Get().GetExecutablePath());
          80  wxString langPath = fn.GetPath() + "\\..\\data\\lang";
          81  locale->AddCatalogLookupPathPrefix(langPath);
          82  // Load translation catalogs.
          83  locale->AddCatalog(wxT("pt_BR"), wxLANGUAGE_PORTUGUESE_BRAZILIAN);
          84  }
          85 
          86  virtual bool OnInit()
          87  {
          88  // Add image handlers
          89  wxImage::AddHandler(new wxPNGHandler);
          90  wxImage::AddHandler(new wxJPEGHandler);
          91 
          92  PropertiesData* propertiesData = new PropertiesData();
          93  LoadInitFile(propertiesData);
          94 
          95  wxLocale* locale = new wxLocale();
          96  LoadCatalogs(locale, propertiesData);
          97 
          98  MainFrame* mainFrame = new MainFrame(NULL, locale, propertiesData);
          99  mainFrame->SetIcon(wxICON(aaaaprogicon));
          100  SetTopWindow(mainFrame);
          101  return GetTopWindow()->Show();
          102  }
          103 };
          104 
          105 DECLARE_APP(MainApp)
          106 IMPLEMENT_APP(MainApp)
          - -
          Definition: main.cpp:11
          +
          1 #include <wx/app.h>
          2 #include <wx/event.h>
          3 #include <wx/image.h>
          4 #include <wx/stdpaths.h>
          5 #include <wx/textfile.h>
          6 #include <wx/cmdline.h>
          7 
          8 #include "MainFrame.h"
          9 #include "PropertiesData.h"
          10 
          11 // Define the MainApp
          12 class MainApp : public wxApp
          13 {
          14  public:
          15  MainApp() {}
          16  virtual ~MainApp() {}
          17  bool LoadInitFile(PropertiesData* propertiesData)
          18  {
          19  wxFileName fn(wxStandardPaths::Get().GetExecutablePath());
          20  wxTextFile file(fn.GetPath() + "\\config.ini");
          21  auto data = propertiesData->GetGeneralPropertiesData();
          22 
          23  if(!file.Create()) {
          24  if(!file.Open()) return false;
          25 
          26  wxString line;
          27  for(line = file.GetFirstLine(); !file.Eof(); line = file.GetNextLine()) {
          28  wxString tag = "";
          29  wxString tagValue = "";
          30  bool parseValue = false;
          31  for(unsigned int i = 0; i < line.Len(); ++i) {
          32  if(line[i] == '=') {
          33  parseValue = true;
          34  } else {
          35  if(parseValue)
          36  tagValue += line[i];
          37  else
          38  tag += line[i];
          39  }
          40  }
          41  // Language
          42  if(tag == "lang") {
          43  if(tagValue == "pt-br" || tagValue == "pt") {
          44  data.language = wxLANGUAGE_PORTUGUESE_BRAZILIAN;
          45  } else if(tagValue == "en" || tagValue == "en-us" || tagValue == "en-uk") {
          46  data.language = wxLANGUAGE_ENGLISH;
          47  }
          48  }
          49  if(tag == "theme") {
          50  if(tagValue == "light") {
          51  data.theme = THEME_LIGHT;
          52  } else if(tagValue == "dark") {
          53  data.theme = THEME_DARK;
          54  }
          55  }
          56  }
          57  file.Close();
          58  } else { // Create default init file.
          59  if(!file.Open()) return false;
          60 
          61  // Default parameters.
          62  file.AddLine("lang=en");
          63  file.AddLine("theme=light");
          64 
          65  file.Write();
          66  file.Close();
          67 
          68  data.language = wxLANGUAGE_ENGLISH;
          69  data.theme = THEME_LIGHT;
          70  propertiesData->SetGeneralPropertiesData(data);
          71  }
          72 
          73  propertiesData->SetGeneralPropertiesData(data);
          74  return true;
          75  }
          76 
          77  void LoadCatalogs(wxLocale* locale, PropertiesData* propertiesData)
          78  {
          79  locale->Init(propertiesData->GetGeneralPropertiesData().language, wxLOCALE_DONT_LOAD_DEFAULT);
          80 
          81  wxFileName fn(wxStandardPaths::Get().GetExecutablePath());
          82  wxString langPath = fn.GetPath() + "\\..\\data\\lang";
          83  locale->AddCatalogLookupPathPrefix(langPath);
          84  // Load translation catalogs.
          85  locale->AddCatalog(wxT("pt_BR"), wxLANGUAGE_PORTUGUESE_BRAZILIAN);
          86  }
          87 
          88  virtual bool OnInit()
          89  {
          90  // Add image handlers
          91  wxImage::AddHandler(new wxPNGHandler);
          92  wxImage::AddHandler(new wxJPEGHandler);
          93 
          94  PropertiesData* propertiesData = new PropertiesData();
          95  LoadInitFile(propertiesData);
          96 
          97  wxLocale* locale = new wxLocale();
          98  LoadCatalogs(locale, propertiesData);
          99 
          100  wxString openFilePath = "";
          101 
          102  wxCmdLineParser cmdLineParser(wxApp::argc, wxApp::argv);
          103  cmdLineParser.AddParam("", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
          104  if(cmdLineParser.Parse() == 0) {
          105  wxCmdLineArgs args = cmdLineParser.GetArguments();
          106  for(auto it = args.begin(), itEnd = args.end(); it != itEnd; ++it) {
          107  if(it->GetKind() == wxCMD_LINE_PARAM) {
          108  openFilePath = it->GetStrVal();
          109  }
          110  }
          111  }
          112  MainFrame* mainFrame = new MainFrame(NULL, locale, propertiesData, openFilePath);
          113  mainFrame->SetIcon(wxICON(aaaaprogicon));
          114  SetTopWindow(mainFrame);
          115  return GetTopWindow()->Show();
          116  }
          117 };
          118 
          119 DECLARE_APP(MainApp)
          120 IMPLEMENT_APP(MainApp)
          + +
          Main frame of the program. This class manage the ribbon menu and the notebook behavior.
          Definition: MainFrame.h:57
          +
          Definition: main.cpp:12
          diff --git a/docs/doxygen/html/menudata.js b/docs/doxygen/html/menudata.js index a35c4c6..d712cee 100644 --- a/docs/doxygen/html/menudata.js +++ b/docs/doxygen/html/menudata.js @@ -23,6 +23,7 @@ var menudata={children:[ {text:"s",url:"functions_s.html#index_s"}, {text:"u",url:"functions_u.html#index_u"}, {text:"w",url:"functions_w.html#index_w"}, +{text:"x",url:"functions_x.html#index_x"}, {text:"~",url:"functions_0x7e.html#index_0x7e"}]}, {text:"Functions",url:"functions_func.html",children:[ {text:"a",url:"functions_func.html#index_a"}, diff --git a/docs/doxygen/html/navtreedata.js b/docs/doxygen/html/navtreedata.js index 9d2bfe1..f3c89b9 100644 --- a/docs/doxygen/html/navtreedata.js +++ b/docs/doxygen/html/navtreedata.js @@ -25,19 +25,19 @@ var NAVTREE = var NAVTREEINDEX = [ "_about_form_8cpp_source.html", -"class_about_form_base.html#a74341fb9c17f6320745444ea4eb76df8", -"class_chart_view_base.html#a4083de6c29b7ab0997217c32e246ee0b", -"class_control_element_container.html", -"class_electromechanical.html#ac51fdb6f0ae13514b6986f99a782532a", -"class_file_handing.html#ae85e5c9173a850b8165939fef18c8c88", -"class_i_o_control_form_base.html#a0e3c563e83daad1b146c3145a1f344dc", -"class_load.html", -"class_node.html#a16217ea768b7bad76285e779bdc819c7", -"class_simulations_settings_form_base.html#a76d9c02a5e8293274ff5ca30da5f3875", -"class_sync_machine_form_base.html#aedf1ffdbc6b3cec7614126d733a12f4a", -"class_transformer.html#a328c419af15701734168c8db62eefa36", -"classwx_g_l_string_array.html#a6923a709d67ada5b713549bc706bdddd", -"struct_sync_generator_electrical_data.html#aef18b7163c5e2b9e6e2c671b3939480d" +"_simulations_settings_form_8h_source.html", +"class_camera.html#aefeb0e4d35db499c1049173f1c0be1c2", +"class_control_editor_base.html", +"class_data_report_base.html#af7230eab205cf660e465b5a4ed36f41c", +"class_exponential_form.html#a3c0b865be48a390d39b42a552afdd711", +"class_generator_stab_form_base.html#ab83eed913a74588eeaec593e777d6903", +"class_line_form.html#a3896cd6a6cc5500fe1935aa9b16d37ce", +"class_main_frame_base.html#a869092abc9913bb995eb36ec69db0405", +"class_reactive_shunt_element_form_base.html#a2eabee46e0b04d92086a0d0f21e3b10e", +"class_sync_machine_form_base.html#a0580ac7326c742ffe05d7791d83a52d7", +"class_text_texture.html#a028855c450db4925652071c212cce8c7", +"class_workspace.html#a8b7645ec6641e9eff52f9d6b8e12b84e", +"struct_simulation_data.html#af0ca3cdcc810fcba377e5c6e2bcd71b5" ]; var SYNCONMSG = 'click to disable panel synchronisation'; diff --git a/docs/doxygen/html/navtreeindex0.js b/docs/doxygen/html/navtreeindex0.js index ebe2a90..baa673c 100644 --- a/docs/doxygen/html/navtreeindex0.js +++ b/docs/doxygen/html/navtreeindex0.js @@ -1,6 +1,7 @@ var NAVTREEINDEX0 = { "_about_form_8cpp_source.html":[1,0,0,0], +"_about_form_8h.html":[1,0,0,1], "_about_form_8h_source.html":[1,0,0,1], "_art_metro_8cpp_source.html":[1,0,0,2], "_art_metro_8h_source.html":[1,0,0,3], @@ -9,37 +10,59 @@ var NAVTREEINDEX0 = "_bus_8cpp_source.html":[1,0,0,6], "_bus_8h_source.html":[1,0,0,7], "_bus_form_8cpp_source.html":[1,0,0,8], +"_bus_form_8h.html":[1,0,0,9], "_bus_form_8h_source.html":[1,0,0,9], "_bus_form_bitmaps_8cpp_source.html":[1,0,0,10], "_camera_8cpp_source.html":[1,0,0,11], +"_camera_8h.html":[1,0,0,12], "_camera_8h_source.html":[1,0,0,12], "_capacitor_8cpp_source.html":[1,0,0,13], "_capacitor_8h_source.html":[1,0,0,14], "_chart_view_8cpp_source.html":[1,0,0,15], +"_chart_view_8h.html":[1,0,0,16], "_chart_view_8h_source.html":[1,0,0,16], "_chart_view_base_8cpp_source.html":[1,0,0,17], "_chart_view_base_8h_source.html":[1,0,0,18], "_chart_view_bitmaps_8cpp_source.html":[1,0,0,19], "_connection_line_8cpp_source.html":[1,0,0,20], +"_connection_line_8h.html":[1,0,0,21], "_connection_line_8h_source.html":[1,0,0,21], "_constant_8cpp_source.html":[1,0,0,22], +"_constant_8h.html":[1,0,0,23], "_constant_8h_source.html":[1,0,0,23], "_constant_form_8cpp_source.html":[1,0,0,24], +"_constant_form_8h.html":[1,0,0,25], "_constant_form_8h_source.html":[1,0,0,25], "_control_editor_8cpp_source.html":[1,0,0,26], +"_control_editor_8h.html":[1,0,0,27], +"_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076":[1,0,0,27,2], +"_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076a007742cc97c341c08b014bc2e0385c40":[1,0,0,27,2,4], +"_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076a39af4bb4f8a6a60d53796dc24c7ef52e":[1,0,0,27,2,3], +"_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076a4db14943629d93315bc091b2d7e8ac1b":[1,0,0,27,2,6], +"_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076a82d160d51a00e0512485fb0afff4a09a":[1,0,0,27,2,0], +"_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076a9f541dfe8890f2636816ed2d7f8d07d7":[1,0,0,27,2,7], +"_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076aa141db7d0f650ecdc828cb8f36fe6ac8":[1,0,0,27,2,1], +"_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076abc8cc51c937d00684cb6967548dbbe12":[1,0,0,27,2,5], +"_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076ac09b0c2232a1d94b9cf4caeeff65a959":[1,0,0,27,2,2], +"_control_editor_8h.html#a8b2fbb4494abb95ea860e1b6b3cb7076aec5fbed678b51ff6e1b215cb36ac9bfa":[1,0,0,27,2,8], "_control_editor_8h_source.html":[1,0,0,27], "_control_editor_base_8cpp_source.html":[1,0,0,28], "_control_editor_base_8h_source.html":[1,0,0,29], "_control_editor_bitmaps_8cpp_source.html":[1,0,0,30], "_control_element_8cpp_source.html":[1,0,0,31], +"_control_element_8h.html":[1,0,0,32], "_control_element_8h_source.html":[1,0,0,32], "_control_element_container_8cpp_source.html":[1,0,0,33], +"_control_element_container_8h.html":[1,0,0,34], "_control_element_container_8h_source.html":[1,0,0,34], "_control_element_solver_8cpp_source.html":[1,0,0,35], +"_control_element_solver_8h.html":[1,0,0,36], "_control_element_solver_8h_source.html":[1,0,0,36], "_control_system_test_8cpp_source.html":[1,0,0,37], +"_control_system_test_8h.html":[1,0,0,38], "_control_system_test_8h_source.html":[1,0,0,38], "_data_report_8cpp_source.html":[1,0,0,39], +"_data_report_8h.html":[1,0,0,40], "_data_report_8h_source.html":[1,0,0,40], "_data_report_base_8cpp_source.html":[1,0,0,41], "_data_report_base_8h_source.html":[1,0,0,42], @@ -64,6 +87,7 @@ var NAVTREEINDEX0 = "_electric_calculation_8h.html#aa48d3d150889a89c491c9792ca3bc8a5afe82ead3835d251dfa6f0e453465caec":[1,0,0,46,3,2], "_electric_calculation_8h_source.html":[1,0,0,46], "_electromechanical_8cpp_source.html":[1,0,0,47], +"_electromechanical_8h.html":[1,0,0,48], "_electromechanical_8h_source.html":[1,0,0,48], "_element_8cpp_source.html":[1,0,0,49], "_element_8h.html":[1,0,0,50], @@ -91,54 +115,79 @@ var NAVTREEINDEX0 = "_element_plot_data_8cpp_source.html":[1,0,0,56], "_element_plot_data_8h_source.html":[1,0,0,57], "_exponential_8cpp_source.html":[1,0,0,58], +"_exponential_8h.html":[1,0,0,59], "_exponential_8h_source.html":[1,0,0,59], "_exponential_form_8cpp_source.html":[1,0,0,60], +"_exponential_form_8h.html":[1,0,0,61], "_exponential_form_8h_source.html":[1,0,0,61], "_fault_8cpp_source.html":[1,0,0,62], "_fault_8h.html":[1,0,0,63], "_fault_8h_source.html":[1,0,0,63], "_file_handing_8cpp_source.html":[1,0,0,64], +"_file_handing_8h.html":[1,0,0,65], "_file_handing_8h_source.html":[1,0,0,65], "_gain_8cpp_source.html":[1,0,0,66], +"_gain_8h.html":[1,0,0,67], "_gain_8h_source.html":[1,0,0,67], "_gain_form_8cpp_source.html":[1,0,0,68], +"_gain_form_8h.html":[1,0,0,69], "_gain_form_8h_source.html":[1,0,0,69], "_general_properties_form_8cpp_source.html":[1,0,0,70], +"_general_properties_form_8h.html":[1,0,0,71], "_general_properties_form_8h_source.html":[1,0,0,71], "_generator_stab_form_8cpp_source.html":[1,0,0,72], +"_generator_stab_form_8h.html":[1,0,0,73], "_generator_stab_form_8h_source.html":[1,0,0,73], "_graphical_element_8cpp_source.html":[1,0,0,74], "_graphical_element_8h_source.html":[1,0,0,75], "_i_o_control_8cpp_source.html":[1,0,0,82], +"_i_o_control_8h.html":[1,0,0,83], "_i_o_control_8h_source.html":[1,0,0,83], "_i_o_control_form_8cpp_source.html":[1,0,0,84], +"_i_o_control_form_8h.html":[1,0,0,85], "_i_o_control_form_8h_source.html":[1,0,0,85], "_ind_motor_8cpp_source.html":[1,0,0,76], "_ind_motor_8h_source.html":[1,0,0,77], "_ind_motor_form_8cpp_source.html":[1,0,0,78], +"_ind_motor_form_8h.html":[1,0,0,79], "_ind_motor_form_8h_source.html":[1,0,0,79], "_inductor_8cpp_source.html":[1,0,0,80], "_inductor_8h_source.html":[1,0,0,81], "_limiter_8cpp_source.html":[1,0,0,86], +"_limiter_8h.html":[1,0,0,87], "_limiter_8h_source.html":[1,0,0,87], "_limiter_form_8cpp_source.html":[1,0,0,88], +"_limiter_form_8h.html":[1,0,0,89], "_limiter_form_8h_source.html":[1,0,0,89], "_line_8cpp_source.html":[1,0,0,90], "_line_8h_source.html":[1,0,0,91], "_line_form_8cpp_source.html":[1,0,0,92], +"_line_form_8h.html":[1,0,0,93], "_line_form_8h_source.html":[1,0,0,93], "_load_8cpp_source.html":[1,0,0,94], "_load_8h_source.html":[1,0,0,95], "_load_form_8cpp_source.html":[1,0,0,96], +"_load_form_8h.html":[1,0,0,97], "_load_form_8h_source.html":[1,0,0,97], "_machines_8cpp_source.html":[1,0,0,98], "_machines_8h_source.html":[1,0,0,99], "_main_frame_8cpp_source.html":[1,0,0,101], +"_main_frame_8h.html":[1,0,0,102], +"_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a0448f71ade0850cce41f666113d61646":[1,0,0,102,5], +"_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a19b41804a810ff58604d9a2e98a12d9b":[1,0,0,102,6], +"_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a713348ad9d91573d5729b0a8b8e66e04":[1,0,0,102,9], +"_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a78ef6f7d5925a2d3f66fb4b985cde4c8":[1,0,0,102,4], +"_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a88478f64002d3686cd141ab42431c654":[1,0,0,102,8], +"_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a8f622d047e7be05ca22e68cf3c495891":[1,0,0,102,2], +"_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7a972a4490c2c106d50fad31bf61c954ee":[1,0,0,102,1], +"_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7ac723eda89da3d08df66556102f04fb3f":[1,0,0,102,3], +"_main_frame_8h.html#adf764cbdea00d65edcd07bb9953ad2b7ae8447bb338d69f233187fa7ecddb269b":[1,0,0,102,7], "_main_frame_8h_source.html":[1,0,0,102], "_main_frame_base_8cpp_source.html":[1,0,0,103], "_main_frame_base_8h_source.html":[1,0,0,104], "_main_frame_bitmaps_8cpp_source.html":[1,0,0,105], "_multiplier_8cpp_source.html":[1,0,0,106], +"_multiplier_8h.html":[1,0,0,107], "_multiplier_8h_source.html":[1,0,0,107], "_power_element_8cpp_source.html":[1,0,0,108], "_power_element_8h.html":[1,0,0,109], @@ -189,65 +238,16 @@ var NAVTREEINDEX0 = "_properties_form_8h_source.html":[1,0,0,115], "_properties_form_bitmaps_8cpp_source.html":[1,0,0,116], "_rate_limiter_8cpp_source.html":[1,0,0,117], +"_rate_limiter_8h.html":[1,0,0,118], "_rate_limiter_8h_source.html":[1,0,0,118], "_rate_limiter_form_8cpp_source.html":[1,0,0,119], +"_rate_limiter_form_8h.html":[1,0,0,120], "_rate_limiter_form_8h_source.html":[1,0,0,120], "_reactive_shunt_element_form_8cpp_source.html":[1,0,0,121], +"_reactive_shunt_element_form_8h.html":[1,0,0,122], "_reactive_shunt_element_form_8h_source.html":[1,0,0,122], "_shunt_8cpp_source.html":[1,0,0,123], "_shunt_8h_source.html":[1,0,0,124], "_simulations_settings_form_8cpp_source.html":[1,0,0,125], -"_simulations_settings_form_8h_source.html":[1,0,0,126], -"_sum_8cpp_source.html":[1,0,0,127], -"_sum_8h_source.html":[1,0,0,128], -"_sum_form_8cpp_source.html":[1,0,0,129], -"_sum_form_8h_source.html":[1,0,0,130], -"_switching_form_8cpp_source.html":[1,0,0,131], -"_switching_form_8h_source.html":[1,0,0,132], -"_sync_generator_8cpp_source.html":[1,0,0,133], -"_sync_generator_8h_source.html":[1,0,0,134], -"_sync_machine_form_8cpp_source.html":[1,0,0,135], -"_sync_machine_form_8h_source.html":[1,0,0,136], -"_sync_motor_8cpp_source.html":[1,0,0,137], -"_sync_motor_8h_source.html":[1,0,0,138], -"_text_8cpp_source.html":[1,0,0,139], -"_text_8h_source.html":[1,0,0,140], -"_text_form_8cpp_source.html":[1,0,0,141], -"_text_form_8h_source.html":[1,0,0,142], -"_transfer_function_8cpp_source.html":[1,0,0,143], -"_transfer_function_8h_source.html":[1,0,0,144], -"_transfer_function_form_8cpp_source.html":[1,0,0,145], -"_transfer_function_form_8h_source.html":[1,0,0,146], -"_transformer_8cpp_source.html":[1,0,0,147], -"_transformer_8h_source.html":[1,0,0,148], -"_transformer_form_8cpp_source.html":[1,0,0,149], -"_transformer_form_8h_source.html":[1,0,0,150], -"_workspace_8cpp_source.html":[1,0,0,151], -"_workspace_8h_source.html":[1,0,0,152], -"_workspace_base_8cpp_source.html":[1,0,0,153], -"_workspace_base_8h_source.html":[1,0,0,154], -"_workspace_bitmaps_8cpp_source.html":[1,0,0,155], -"annotated.html":[0,0], -"class_about_form.html":[0,0,0], -"class_about_form.html#a30a97b3857200c4cd50364b26d4cd3bb":[0,0,0,3], -"class_about_form.html#a7c793ce416f184e009c72a198af116da":[0,0,0,2], -"class_about_form.html#a856a64c4b8545cf8c8fa1b6f23080341":[0,0,0,0], -"class_about_form.html#a87f1730d731ee0c7529d4af84fac92fc":[0,0,0,1], -"class_about_form_base.html":[0,0,1], -"class_about_form_base.html#a01a0cbc42c52e7eb69fa1337f756af7d":[0,0,1,18], -"class_about_form_base.html#a02da06240394048e693c6ae3e2a69282":[0,0,1,16], -"class_about_form_base.html#a1fae6815dc4f49df45f05f3893a332c7":[0,0,1,13], -"class_about_form_base.html#a306c84f41395aee3200b887ec71ff11a":[0,0,1,21], -"class_about_form_base.html#a34d37030073f1e71cc233a8d0d4a27dc":[0,0,1,19], -"class_about_form_base.html#a37e22612779e67b33b66f6a3a7bb60c1":[0,0,1,11], -"class_about_form_base.html#a3dbb1a9739786e22307f7ae4fb0617f1":[0,0,1,20], -"class_about_form_base.html#a428f630068bebd4e0fdd258c0b8cd2ac":[0,0,1,7], -"class_about_form_base.html#a4438eded1319f84ed19cf0350d819efb":[0,0,1,8], -"class_about_form_base.html#a4470b5bcf193376d3a8849bdcba2acd4":[0,0,1,24], -"class_about_form_base.html#a490a133019381aa2569ca04f517829ea":[0,0,1,9], -"class_about_form_base.html#a5a2bb84e1eb7fc3b92d82a68fc93858a":[0,0,1,4], -"class_about_form_base.html#a64ea9b42b326b773067de6d1b4f649f4":[0,0,1,14], -"class_about_form_base.html#a6a33f787646eea29e95441b05c0409df":[0,0,1,26], -"class_about_form_base.html#a6d243c886c28b231279798dd3cca6df4":[0,0,1,22], -"class_about_form_base.html#a6fcacff0bfb56d11923d0f80e5560f70":[0,0,1,17] +"_simulations_settings_form_8h.html":[1,0,0,126] }; diff --git a/docs/doxygen/html/navtreeindex1.js b/docs/doxygen/html/navtreeindex1.js index efac229..5ec91ef 100644 --- a/docs/doxygen/html/navtreeindex1.js +++ b/docs/doxygen/html/navtreeindex1.js @@ -1,5 +1,77 @@ var NAVTREEINDEX1 = { +"_simulations_settings_form_8h_source.html":[1,0,0,126], +"_sum_8cpp_source.html":[1,0,0,127], +"_sum_8h_source.html":[1,0,0,128], +"_sum_form_8cpp_source.html":[1,0,0,129], +"_sum_form_8h.html":[1,0,0,130], +"_sum_form_8h_source.html":[1,0,0,130], +"_switching_form_8cpp_source.html":[1,0,0,131], +"_switching_form_8h.html":[1,0,0,132], +"_switching_form_8h_source.html":[1,0,0,132], +"_sync_generator_8cpp_source.html":[1,0,0,133], +"_sync_generator_8h_source.html":[1,0,0,134], +"_sync_machine_form_8cpp_source.html":[1,0,0,135], +"_sync_machine_form_8h.html":[1,0,0,136], +"_sync_machine_form_8h_source.html":[1,0,0,136], +"_sync_motor_8cpp_source.html":[1,0,0,137], +"_sync_motor_8h_source.html":[1,0,0,138], +"_text_8cpp_source.html":[1,0,0,139], +"_text_8h_source.html":[1,0,0,140], +"_text_form_8cpp_source.html":[1,0,0,141], +"_text_form_8h.html":[1,0,0,142], +"_text_form_8h_source.html":[1,0,0,142], +"_transfer_function_8cpp_source.html":[1,0,0,143], +"_transfer_function_8h_source.html":[1,0,0,144], +"_transfer_function_form_8cpp_source.html":[1,0,0,145], +"_transfer_function_form_8h.html":[1,0,0,146], +"_transfer_function_form_8h_source.html":[1,0,0,146], +"_transformer_8cpp_source.html":[1,0,0,147], +"_transformer_8h_source.html":[1,0,0,148], +"_transformer_form_8cpp_source.html":[1,0,0,149], +"_transformer_form_8h.html":[1,0,0,150], +"_transformer_form_8h_source.html":[1,0,0,150], +"_workspace_8cpp_source.html":[1,0,0,151], +"_workspace_8h.html":[1,0,0,152], +"_workspace_8h.html#a8f434816783a791128b48a39ae663f15":[1,0,0,152,1], +"_workspace_8h.html#a8f434816783a791128b48a39ae663f15a0b19c55f1dfecc32f6572a67d37e8cc2":[1,0,0,152,1,9], +"_workspace_8h.html#a8f434816783a791128b48a39ae663f15a1ef615af10b75825208fe612934cd993":[1,0,0,152,1,0], +"_workspace_8h.html#a8f434816783a791128b48a39ae663f15a51add6c28e024f17f0d0dde52e23f466":[1,0,0,152,1,10], +"_workspace_8h.html#a8f434816783a791128b48a39ae663f15a7088a60d72d0730404f0965f10dd0786":[1,0,0,152,1,5], +"_workspace_8h.html#a8f434816783a791128b48a39ae663f15a7ce9843fb67511c2e4b20c707ad590d8":[1,0,0,152,1,1], +"_workspace_8h.html#a8f434816783a791128b48a39ae663f15a85788d6fc58afde943ce8bb130461ac1":[1,0,0,152,1,3], +"_workspace_8h.html#a8f434816783a791128b48a39ae663f15a89ae894b55baca13320fdc0f71345795":[1,0,0,152,1,7], +"_workspace_8h.html#a8f434816783a791128b48a39ae663f15ac3e3dcfd8b3450a32dd2665d542695f2":[1,0,0,152,1,6], +"_workspace_8h.html#a8f434816783a791128b48a39ae663f15ad22104a7215f22fd9bcca5d8b56889ef":[1,0,0,152,1,8], +"_workspace_8h.html#a8f434816783a791128b48a39ae663f15adc8df3f3cd5a626ee5c327423dd7d825":[1,0,0,152,1,4], +"_workspace_8h.html#a8f434816783a791128b48a39ae663f15aec53219b0d127b0c7c48bce6bc6618bb":[1,0,0,152,1,2], +"_workspace_8h_source.html":[1,0,0,152], +"_workspace_base_8cpp_source.html":[1,0,0,153], +"_workspace_base_8h_source.html":[1,0,0,154], +"_workspace_bitmaps_8cpp_source.html":[1,0,0,155], +"annotated.html":[0,0], +"class_about_form.html":[0,0,0], +"class_about_form.html#a30a97b3857200c4cd50364b26d4cd3bb":[0,0,0,3], +"class_about_form.html#a7c793ce416f184e009c72a198af116da":[0,0,0,2], +"class_about_form.html#a856a64c4b8545cf8c8fa1b6f23080341":[0,0,0,0], +"class_about_form.html#a87f1730d731ee0c7529d4af84fac92fc":[0,0,0,1], +"class_about_form_base.html":[0,0,1], +"class_about_form_base.html#a01a0cbc42c52e7eb69fa1337f756af7d":[0,0,1,18], +"class_about_form_base.html#a02da06240394048e693c6ae3e2a69282":[0,0,1,16], +"class_about_form_base.html#a1fae6815dc4f49df45f05f3893a332c7":[0,0,1,13], +"class_about_form_base.html#a306c84f41395aee3200b887ec71ff11a":[0,0,1,21], +"class_about_form_base.html#a34d37030073f1e71cc233a8d0d4a27dc":[0,0,1,19], +"class_about_form_base.html#a37e22612779e67b33b66f6a3a7bb60c1":[0,0,1,11], +"class_about_form_base.html#a3dbb1a9739786e22307f7ae4fb0617f1":[0,0,1,20], +"class_about_form_base.html#a428f630068bebd4e0fdd258c0b8cd2ac":[0,0,1,7], +"class_about_form_base.html#a4438eded1319f84ed19cf0350d819efb":[0,0,1,8], +"class_about_form_base.html#a4470b5bcf193376d3a8849bdcba2acd4":[0,0,1,24], +"class_about_form_base.html#a490a133019381aa2569ca04f517829ea":[0,0,1,9], +"class_about_form_base.html#a5a2bb84e1eb7fc3b92d82a68fc93858a":[0,0,1,4], +"class_about_form_base.html#a64ea9b42b326b773067de6d1b4f649f4":[0,0,1,14], +"class_about_form_base.html#a6a33f787646eea29e95441b05c0409df":[0,0,1,26], +"class_about_form_base.html#a6d243c886c28b231279798dd3cca6df4":[0,0,1,22], +"class_about_form_base.html#a6fcacff0bfb56d11923d0f80e5560f70":[0,0,1,17], "class_about_form_base.html#a74341fb9c17f6320745444ea4eb76df8":[0,0,1,10], "class_about_form_base.html#a8d70d38cc7eb8f41bd833f18aafeaf30":[0,0,1,2], "class_about_form_base.html#aa52e54457b4cf595f1714a0320458e6c":[0,0,1,0], @@ -177,77 +249,5 @@ var NAVTREEINDEX1 = "class_camera.html#abac6929baae257d9fb55e894371b140b":[0,0,7,10], "class_camera.html#ad092fd057fb12a1d73214ecd81f8cde3":[0,0,7,4], "class_camera.html#ad1897942d0ccf91052386388a497349f":[0,0,7,1], -"class_camera.html#aeb4eb52f0f05f5641cd71e4b8505e50a":[0,0,7,18], -"class_camera.html#aefeb0e4d35db499c1049173f1c0be1c2":[0,0,7,15], -"class_camera.html#aefeec0ff0adf22ed4e26b0e3f0c7fb38":[0,0,7,9], -"class_capacitor.html":[0,0,8], -"class_capacitor.html#a00e808708e16b87c80fc650e5710b84e":[0,0,8,10], -"class_capacitor.html#a05d5517b64dd8a8888817ca28b72294d":[0,0,8,6], -"class_capacitor.html#a2c3f0949c2b791c6a0b69866e9aaff7a":[0,0,8,12], -"class_capacitor.html#a422e353b594ac6e4ef34e1f613f7d580":[0,0,8,7], -"class_capacitor.html#a459b1bbdb153bb9720176661e2960ea6":[0,0,8,14], -"class_capacitor.html#a503100032b983414ef469907e4f3fd6a":[0,0,8,8], -"class_capacitor.html#a581f07c0fa802bbdd0f35a70cc79d3b4":[0,0,8,15], -"class_capacitor.html#a6b06adb1ef3545b220e0b94ee6210b7a":[0,0,8,11], -"class_capacitor.html#a94d378c922467214b394931ec0eb01c8":[0,0,8,5], -"class_capacitor.html#a994039e59a8ae0ec3fe7cf7f5b66e4e5":[0,0,8,4], -"class_capacitor.html#ab2c5403403c3f8b4ee1ae737ece4e1cc":[0,0,8,13], -"class_capacitor.html#ab7047062b5e731e86815fe5b61e622da":[0,0,8,1], -"class_capacitor.html#ac5e08b3cca7884bb5f26a8ffcf8fcccf":[0,0,8,2], -"class_capacitor.html#ace755e5bc3cc72b491ce31c24c54a5cf":[0,0,8,3], -"class_capacitor.html#aeba70b8c4a1ed3609481b46c5ace8c6c":[0,0,8,0], -"class_capacitor.html#aef6926699c93145d4b3c62efd942b269":[0,0,8,9], -"class_chart_view.html":[0,0,10], -"class_chart_view.html#a06514137ceea55c0fe387978ea13e214":[0,0,10,20], -"class_chart_view.html#a0fe6be1c5bf29fd058787f1a47325c1a":[0,0,10,10], -"class_chart_view.html#a143b7ffc99d2dbcc82ad4cf4b96d5db2":[0,0,10,22], -"class_chart_view.html#a1e92dd6533c5ebcf6875cb9e517b7b4e":[0,0,10,19], -"class_chart_view.html#a1fe1991c6239632b4af01186b05e062f":[0,0,10,35], -"class_chart_view.html#a201c868954eb1c79dda37ffdcc2a0eeb":[0,0,10,36], -"class_chart_view.html#a231d6a0f6298df0c764f0dcc601e9f9f":[0,0,10,28], -"class_chart_view.html#a28da38ba24dad74b833b7bc5652358ed":[0,0,10,16], -"class_chart_view.html#a293128b4b91a4a838a792076f87cde0a":[0,0,10,17], -"class_chart_view.html#a2b74fcf37a33a8654c3c06008f4e9278":[0,0,10,37], -"class_chart_view.html#a38699e754304878e9a589f730c027dec":[0,0,10,14], -"class_chart_view.html#a4957f22dfe582cd2557b005a010cf2d2":[0,0,10,1], -"class_chart_view.html#a4a2abddb77a734eeb7992ca8434bb358":[0,0,10,7], -"class_chart_view.html#a4b43a87338084b4d163b1a2f002ff9d7":[0,0,10,15], -"class_chart_view.html#a5111d9293952ca916aecd5ff7f597950":[0,0,10,21], -"class_chart_view.html#a5666f8aedecd943ad19d72fc533dcfd9":[0,0,10,6], -"class_chart_view.html#a597a1cde3693f14427a898b61bdc05a9":[0,0,10,9], -"class_chart_view.html#a598645b015715cdc22d08d3875a0a5bb":[0,0,10,31], -"class_chart_view.html#a6034bc00b41785d6003e499778a6a69f":[0,0,10,5], -"class_chart_view.html#a621ebe0264d241f54cf4b65efe705618":[0,0,10,0], -"class_chart_view.html#a6aacbc6267d7c01cc5b3f78fc4ba50fe":[0,0,10,40], -"class_chart_view.html#a6e29b198271efa3c6d5ca9d5ae3ae773":[0,0,10,24], -"class_chart_view.html#a70200389b94906b89d2454b27ac2469c":[0,0,10,30], -"class_chart_view.html#a7e069208db024a903a90f72f9057b951":[0,0,10,29], -"class_chart_view.html#a7f7e1d962ab76be37b89f05e6b97cfc0":[0,0,10,34], -"class_chart_view.html#a877c14527e957c85037b7705d196733d":[0,0,10,18], -"class_chart_view.html#a88dfb946342df7c344bd3578d207dcd9":[0,0,10,23], -"class_chart_view.html#a89e198037f79887a33ce21c949021455":[0,0,10,32], -"class_chart_view.html#a8a374b2c62da0ef13a7d292482abb845":[0,0,10,12], -"class_chart_view.html#a8abb35d06074a8370b222fafae8db028":[0,0,10,8], -"class_chart_view.html#a8f57c26ce982fcf91626e8121b625f70":[0,0,10,13], -"class_chart_view.html#a91cae14a0b48e5755cb44f05e1d9c0b0":[0,0,10,27], -"class_chart_view.html#a95e9181dd41eeff08964054746be305b":[0,0,10,26], -"class_chart_view.html#a9b4099d6352e09be545265a7168860f2":[0,0,10,2], -"class_chart_view.html#ac72c20e03443d91fca200305fc6bbad1":[0,0,10,4], -"class_chart_view.html#ad174b0057b89c6dd4b6aed93a467acd1":[0,0,10,33], -"class_chart_view.html#ad3a0740630473e266d6406a561053ef4":[0,0,10,3], -"class_chart_view.html#ae6593489cbd815282f77f5a073c34e55":[0,0,10,25], -"class_chart_view.html#aec5e3605401ad966f03113a60f05fe1c":[0,0,10,38], -"class_chart_view.html#af9953c97ae04ccb534ee8d8f772330a4":[0,0,10,11], -"class_chart_view.html#affb3ae7ee1147240f5180926a07425b5":[0,0,10,39], -"class_chart_view_base.html":[0,0,11], -"class_chart_view_base.html#a0ab362bd15f37bf94201b6e40d0ba3fa":[0,0,11,15], -"class_chart_view_base.html#a0d66080c5a61b4a544111cd829cd88b8":[0,0,11,50], -"class_chart_view_base.html#a237d5355111659d84fa4e61569deeecc":[0,0,11,30], -"class_chart_view_base.html#a23f74f17c47b4352def0919e9efd3afa":[0,0,11,13], -"class_chart_view_base.html#a250a4f7292e38ffadf609f07dbbc0323":[0,0,11,27], -"class_chart_view_base.html#a27408a2fa4cc3c63a7655ddc6bca7412":[0,0,11,8], -"class_chart_view_base.html#a27f1cf05d785e4f230b3093ab807972c":[0,0,11,26], -"class_chart_view_base.html#a321240363d83ca86670fb4934f1d67f7":[0,0,11,5], -"class_chart_view_base.html#a34f689775bc42f1f11a7b84067a98808":[0,0,11,37], -"class_chart_view_base.html#a407b4fc3b5f891ff37cd8475f0f6ab19":[0,0,11,20] +"class_camera.html#aeb4eb52f0f05f5641cd71e4b8505e50a":[0,0,7,18] }; diff --git a/docs/doxygen/html/navtreeindex10.js b/docs/doxygen/html/navtreeindex10.js index e50d7f2..012d319 100644 --- a/docs/doxygen/html/navtreeindex10.js +++ b/docs/doxygen/html/navtreeindex10.js @@ -1,5 +1,83 @@ var NAVTREEINDEX10 = { +"class_sync_machine_form_base.html#a0580ac7326c742ffe05d7791d83a52d7":[0,0,97,83], +"class_sync_machine_form_base.html#a05cfcbb0cfa2e3e4ec07a7fba1bdf5d6":[0,0,97,61], +"class_sync_machine_form_base.html#a0c385577ff27d8d9ed1a87a22fce73fd":[0,0,97,63], +"class_sync_machine_form_base.html#a0dbd47d991d7750b3368d84b06d3c361":[0,0,97,0], +"class_sync_machine_form_base.html#a102368df6855d5ba275a49ffae593168":[0,0,97,15], +"class_sync_machine_form_base.html#a11249eb9f833be5b91c3f684477be7aa":[0,0,97,12], +"class_sync_machine_form_base.html#a138fa57d3582962bae07d035e63b586d":[0,0,97,74], +"class_sync_machine_form_base.html#a15b9a853d75e1e59084cf84130bfbbc2":[0,0,97,78], +"class_sync_machine_form_base.html#a1c9124d5e5449d28ae8b0af31a651a25":[0,0,97,28], +"class_sync_machine_form_base.html#a1ed492083cd0abec88ace3965553308b":[0,0,97,56], +"class_sync_machine_form_base.html#a21dbc2fc03aef37e45e1cf3a63da9551":[0,0,97,55], +"class_sync_machine_form_base.html#a230d01b1c29375bdfd3063d9097f9f88":[0,0,97,8], +"class_sync_machine_form_base.html#a24d1c0a769de296404d9697ff6bba278":[0,0,97,9], +"class_sync_machine_form_base.html#a25dfe7fcf1465ef808fd652a5cd6b2e1":[0,0,97,64], +"class_sync_machine_form_base.html#a2d7690b252b2b22d5b950d04b9757bb4":[0,0,97,21], +"class_sync_machine_form_base.html#a2f22b959d0d97b7ad3ee6de5557ad976":[0,0,97,52], +"class_sync_machine_form_base.html#a38a81a205d2112a58084b2d6cc13380a":[0,0,97,24], +"class_sync_machine_form_base.html#a3aa2c493b7430078bc17a34bb8cc476b":[0,0,97,43], +"class_sync_machine_form_base.html#a3db4e4cfd2fd42f9ce6ab3f72952f6ba":[0,0,97,44], +"class_sync_machine_form_base.html#a3f1c8401a39935ef1f589d68af2be97a":[0,0,97,40], +"class_sync_machine_form_base.html#a4112b3c631d0ceec0178fc05ea1b120c":[0,0,97,2], +"class_sync_machine_form_base.html#a4496bfac69450fe5a10baa9dbc4888a6":[0,0,97,80], +"class_sync_machine_form_base.html#a45f5bf24827dfcda99e71f83cfb3fa5b":[0,0,97,29], +"class_sync_machine_form_base.html#a46fe41a58c06bedeab99cd190921e545":[0,0,97,4], +"class_sync_machine_form_base.html#a4ba97e9dc30c24a0daf0ad3771823df0":[0,0,97,77], +"class_sync_machine_form_base.html#a4fca8015f54006f8b79faf8bb6d3eb09":[0,0,97,26], +"class_sync_machine_form_base.html#a5133c66f455c7a5597e72b9b367e0fc8":[0,0,97,47], +"class_sync_machine_form_base.html#a5735d89d9451e76734467e14779a7ab0":[0,0,97,49], +"class_sync_machine_form_base.html#a5a091446eebeeb3c5116fa87aeda535b":[0,0,97,79], +"class_sync_machine_form_base.html#a5dcc03c3e17f06e0914f3209120a6329":[0,0,97,35], +"class_sync_machine_form_base.html#a5fd0741a7ac3e8613cc01a28933b4ea8":[0,0,97,11], +"class_sync_machine_form_base.html#a681513dcfa84f4aab5803299fd8ae766":[0,0,97,37], +"class_sync_machine_form_base.html#a6b3830705a2208493714c1abdb8fa0b8":[0,0,97,70], +"class_sync_machine_form_base.html#a6c2c10dd63d1ace53d882b477d037d75":[0,0,97,30], +"class_sync_machine_form_base.html#a6dba8c557f3e20f9982c084e5e5a74e3":[0,0,97,59], +"class_sync_machine_form_base.html#a6fedceb84c293f69fbcb6290ea529798":[0,0,97,84], +"class_sync_machine_form_base.html#a717b5ba1d7ed6b4026b527ce12b2bf41":[0,0,97,72], +"class_sync_machine_form_base.html#a7367ed87a446dc08067af218b8bb2215":[0,0,97,31], +"class_sync_machine_form_base.html#a7530a37ed44f0732758708aabf7f748c":[0,0,97,19], +"class_sync_machine_form_base.html#a76040f3058374ee765d4baa6b1b07df7":[0,0,97,7], +"class_sync_machine_form_base.html#a7849d5f397e132e164b0c1952ddaa0a3":[0,0,97,82], +"class_sync_machine_form_base.html#a79579458c023bf56d0df6f0356e58c9b":[0,0,97,53], +"class_sync_machine_form_base.html#a7a035fe2031ab6eae1513f73adabd0c3":[0,0,97,32], +"class_sync_machine_form_base.html#a7c6a05f65b77bdad43f7f92c2b184077":[0,0,97,50], +"class_sync_machine_form_base.html#a909b922a1f157d6013a7baaf22796d24":[0,0,97,86], +"class_sync_machine_form_base.html#a93fd03ae353875c5e04ccdb57800f821":[0,0,97,58], +"class_sync_machine_form_base.html#a959fea39df34cb124ab6a0ad78d78712":[0,0,97,3], +"class_sync_machine_form_base.html#a97509be24b2add48e9d23d5b7020b076":[0,0,97,48], +"class_sync_machine_form_base.html#a9c402618cc9ae56ca3780d7420bf5722":[0,0,97,69], +"class_sync_machine_form_base.html#a9d4d3f8b66519903eaac859b0a5314e9":[0,0,97,6], +"class_sync_machine_form_base.html#a9e63594f861d223182734011b24030dc":[0,0,97,14], +"class_sync_machine_form_base.html#a9fd3b15e35d1753059759886bf918130":[0,0,97,81], +"class_sync_machine_form_base.html#aa2a774f00e17cfec0ef2efccc086b990":[0,0,97,25], +"class_sync_machine_form_base.html#aa53388881170a5aceb737b0c58315351":[0,0,97,16], +"class_sync_machine_form_base.html#aab2926cd0e56d2cb283fc74e5aa20f5d":[0,0,97,10], +"class_sync_machine_form_base.html#aacac6cfe475bf4176dcf746417cdd432":[0,0,97,88], +"class_sync_machine_form_base.html#aaff0a6a0030e1d0928f6a69f27bb1180":[0,0,97,46], +"class_sync_machine_form_base.html#ab221b3b73b231252dfe605efa5268f59":[0,0,97,39], +"class_sync_machine_form_base.html#ab922478387b0a89d0d5a4ab0d1500a4a":[0,0,97,27], +"class_sync_machine_form_base.html#aba28c35b0281a75f7ed7b57e6ceed52c":[0,0,97,5], +"class_sync_machine_form_base.html#ac195ae144957568ef98e5e3f9ba31388":[0,0,97,76], +"class_sync_machine_form_base.html#ac3d26a423d2fd7243c9361d360b0e6d3":[0,0,97,42], +"class_sync_machine_form_base.html#ac4a8ed68ffba04940adbf6e3070291a4":[0,0,97,65], +"class_sync_machine_form_base.html#ac71f3c270c8c796dd427ee6bd32f1c60":[0,0,97,38], +"class_sync_machine_form_base.html#acc82ce4087f0fcde8e42e2b7f111cfcc":[0,0,97,57], +"class_sync_machine_form_base.html#acef45c78c5bbaf1dee5b3abc895e8baf":[0,0,97,17], +"class_sync_machine_form_base.html#ad3b5932a14988843670c516861029517":[0,0,97,33], +"class_sync_machine_form_base.html#ad3dab6cd719a3464b4bca0e92063b20c":[0,0,97,23], +"class_sync_machine_form_base.html#ad4789258aa31c9d3c699013ce6f3406f":[0,0,97,66], +"class_sync_machine_form_base.html#ad47c151f396bbad83787de190055ea65":[0,0,97,20], +"class_sync_machine_form_base.html#ad6e4bc150fc34819eaa2333d1d4cb2b8":[0,0,97,13], +"class_sync_machine_form_base.html#ad720f87582570c72919f9094987bda08":[0,0,97,67], +"class_sync_machine_form_base.html#ade8616fc5502cc760867821d52b2a697":[0,0,97,75], +"class_sync_machine_form_base.html#ae0b5c587ae39b5e558bb298eb1f180b0":[0,0,97,41], +"class_sync_machine_form_base.html#ae2aa2eb6ad549c8b918389df69b6af36":[0,0,97,18], +"class_sync_machine_form_base.html#ae4c8099099059b6e5b8d4791991929c5":[0,0,97,51], +"class_sync_machine_form_base.html#ae69f427b9931e920bcb615a15e74484e":[0,0,97,68], +"class_sync_machine_form_base.html#aec2123bb23ad47344e000bf2e460117e":[0,0,97,45], "class_sync_machine_form_base.html#aedf1ffdbc6b3cec7614126d733a12f4a":[0,0,97,36], "class_sync_machine_form_base.html#aeebf10df4806932d008ed063fcbb9730":[0,0,97,1], "class_sync_machine_form_base.html#af0a0b3141b006a8578e841ce3c124c70":[0,0,97,73], @@ -8,246 +86,168 @@ var NAVTREEINDEX10 = "class_sync_machine_form_base.html#af6cadcca8459ce7d9e63a43fa739534c":[0,0,97,54], "class_sync_machine_form_base.html#af83e4364f1f073fcfd96abc6ff38c70e":[0,0,97,85], "class_sync_machine_form_base.html#affe47bc4b7b233dcf04ba9241d2d399f":[0,0,97,71], -"class_sync_motor.html":[0,0,98], -"class_sync_motor.html#a035b63a3dfd356daff0bf1cee9672313":[0,0,98,5], -"class_sync_motor.html#a038162c828595f58782fe97dea2c864d":[0,0,98,10], -"class_sync_motor.html#a0fedd06ef0833ce4d17869343b0810cb":[0,0,98,6], -"class_sync_motor.html#a12ac76afa871fc58cc0f27332723fc38":[0,0,98,12], -"class_sync_motor.html#a222d998e274674a0e0ce4a1ed53e8654":[0,0,98,0], -"class_sync_motor.html#a2ab8e43d5452f5d7f9ac375566a65210":[0,0,98,8], -"class_sync_motor.html#a3201b22e0271517f5ed3df85da6cee6f":[0,0,98,11], -"class_sync_motor.html#a435a9cfd24d182d8ab76a856fa4d0bb7":[0,0,98,2], -"class_sync_motor.html#a6068c7d22470a3996df2efda54c24972":[0,0,98,1], -"class_sync_motor.html#a7b3102220ea5f7e19690af045a6c8278":[0,0,98,4], -"class_sync_motor.html#a9b42283370ea4d4707b78b97e8c6d864":[0,0,98,3], -"class_sync_motor.html#aca41191da8383d577e3717d3e38cdf2b":[0,0,98,9], -"class_sync_motor.html#ae04da3b89a530e1457ff490b22b9f028":[0,0,98,7], -"class_text.html":[0,0,100], -"class_text.html#a03c67acf11b90374ded2a8cb8ec1088f":[0,0,100,8], -"class_text.html#a06e740065c875633e458c0d8f860c43e":[0,0,100,6], -"class_text.html#a0d0629dec49cece668f41d2a85062f39":[0,0,100,40], -"class_text.html#a0d37b9c067e62e10ebd1f0f74dbb5e66":[0,0,100,24], -"class_text.html#a15e4192a98a95baa22fd7a423efb5df9":[0,0,100,9], -"class_text.html#a255ba9b693f614b16986ac238c28f66e":[0,0,100,25], -"class_text.html#a2d07db0c15bdbd9d7056ac794f524f57":[0,0,100,36], -"class_text.html#a2d49e5c280e205125b149f7777ae30c7":[0,0,100,2], -"class_text.html#a2f40cb8ed553f1680bf402f9c8e2b541":[0,0,100,35], -"class_text.html#a340b00ac7a17cd9a1f37f63275715638":[0,0,100,11], -"class_text.html#a3b050d27140840eadcdce567df42d1e2":[0,0,100,7], -"class_text.html#a3f58eb1736e822f96882ded57938dbbd":[0,0,100,13], -"class_text.html#a41eabb28f45124d5da3ec2d703ce9018":[0,0,100,15], -"class_text.html#a4d1b7f1b53288297dfc8f77be4c37ac4":[0,0,100,38], -"class_text.html#a4f273ea7008c72533327c25caff2e917":[0,0,100,3], -"class_text.html#a51c55b9272f653cfc3cdafe665d5dde0":[0,0,100,4], -"class_text.html#a5eb67f2bf595a78858733c96a5bc05d6":[0,0,100,26], -"class_text.html#a6743a08fc0d1d8b96db99eab48eadb8f":[0,0,100,19], -"class_text.html#a7010e26ac225166d3a7f23118bf45f74":[0,0,100,32], -"class_text.html#a7e88aef941ba0b3dba303c4370b0bb7a":[0,0,100,29], -"class_text.html#a80916b96c94d30abd8d76dcbf01d580d":[0,0,100,12], -"class_text.html#a8bab7377ac548d1883dcbbe2489c5ff1":[0,0,100,33], -"class_text.html#a9836ec9395fdd3e0ce1f1914219fe360":[0,0,100,37], -"class_text.html#a9923c820cd77b411257ba48beceafeaa":[0,0,100,16], -"class_text.html#a9f05c1520fe691515ee15a0b63ca9b28":[0,0,100,14], -"class_text.html#aa32f9156fbbe783fab5d90072667e2c3":[0,0,100,23], -"class_text.html#aa722e4df566518900e4f2cc1f1af2f9c":[0,0,100,28], -"class_text.html#ab3e26143fccc52699bcc5149cae852bc":[0,0,100,0], -"class_text.html#ab3f1487162842f26d6d50b298bb3142d":[0,0,100,18], -"class_text.html#abe911e27cd723c0ab51f63d8f27683d1":[0,0,100,20], -"class_text.html#ac045b28b3621a5fddb3e5ac86889bfca":[0,0,100,39], -"class_text.html#ac0ab42a8d5145cd1d780f695d0e6e64f":[0,0,100,34], -"class_text.html#ac19aa2e04d68965adadee0c67daca99e":[0,0,100,41], -"class_text.html#ac6383f5f8e424f3c8cf6f37ac9371dcf":[0,0,100,27], -"class_text.html#ac8107fb05d19dbaf681af76a91ea739b":[0,0,100,1], -"class_text.html#ad251de30122437e2a311aa60e8ed390a":[0,0,100,31], -"class_text.html#ad696293ace753aba46568c76b1adff4e":[0,0,100,21], -"class_text.html#aea6772b57e5129e87926b6a35d90f74e":[0,0,100,10], -"class_text.html#aef377b465f00fe9aec996e122c1bb23a":[0,0,100,22], -"class_text.html#af025bbbb8d5619929df7817f98e23597":[0,0,100,5], -"class_text.html#afcd995d8a0b3921cd33dd305b586e3f7":[0,0,100,30], -"class_text.html#afe1f86a497f34cee4809cbd7fda24dc3":[0,0,100,17], -"class_text_form.html":[0,0,101], -"class_text_form.html#a05f71762d18640d7ee7b85cf8cfde0ee":[0,0,101,15], -"class_text_form.html#a098066e96da254f13b5cd2b0e8977e43":[0,0,101,7], -"class_text_form.html#a1268fce1f817bd9ff0626a24c0aabda7":[0,0,101,21], -"class_text_form.html#a14ccad2b03e8017c02eb632fbe02df2a":[0,0,101,0], -"class_text_form.html#a21a3fa61ce11a198e4a0cf086a85e61b":[0,0,101,10], -"class_text_form.html#a2946f7590a66a55d3ae63a6def86a8f3":[0,0,101,8], -"class_text_form.html#a29a135685c4f5f6801abc50ab48d97f9":[0,0,101,11], -"class_text_form.html#a3b32cfbb221700c5cde1146dd9ba0ac3":[0,0,101,12], -"class_text_form.html#a4bbd73071ce20cf1c805139af58d2e77":[0,0,101,5], -"class_text_form.html#a4e3ecb63b41fe8e1592ba1bdb57cf89f":[0,0,101,18], -"class_text_form.html#a53d385f26fb4bf90e52db6e4c1d3b49a":[0,0,101,14], -"class_text_form.html#a55358259e75a1e262aa6f2f58dc70c80":[0,0,101,16], -"class_text_form.html#a553bf0b435f0d59d4c86ea7a004aab60":[0,0,101,17], -"class_text_form.html#a644cc688a5f54e202c451f403174a725":[0,0,101,13], -"class_text_form.html#a7cb43566e1ec8bb5d7be0e3ed86f1876":[0,0,101,2], -"class_text_form.html#aa15c4be9ce71f50b6ebdbabf1ddb26bb":[0,0,101,1], -"class_text_form.html#aad06ea6fcaec43465ea4e0aa7bd3b61d":[0,0,101,22], -"class_text_form.html#aae058177645a7b974003cf7ba3957e62":[0,0,101,9], -"class_text_form.html#ab9cad6d1dc2ea1406ca6f9b44ecd46c3":[0,0,101,6], -"class_text_form.html#ad11e9224ce96616ccc1fae802a65738e":[0,0,101,3], -"class_text_form.html#adc28fed9ecb5fb32957737af4e7827dc":[0,0,101,20], -"class_text_form.html#ae46074db075dacd127c78b16b0417c3a":[0,0,101,4], -"class_text_form.html#af96c830fe67da49fac36a7df58f0728b":[0,0,101,19], -"class_text_form_base.html":[0,0,102], -"class_text_form_base.html#a06b80e25d042052ef8b5ebbcf39a82e6":[0,0,102,11], -"class_text_form_base.html#a0df65c65bf9926eaa20792d803762fd2":[0,0,102,22], -"class_text_form_base.html#a0f854e9b93a101684308930464799a3c":[0,0,102,24], -"class_text_form_base.html#a0ff115ed58de4b9f83e8ac18fc1c11cc":[0,0,102,25], -"class_text_form_base.html#a1822a077536adfdfdbf7ba7853e2917c":[0,0,102,20], -"class_text_form_base.html#a20e495f9fe62e0eaee49ea2cfb7661fa":[0,0,102,27], -"class_text_form_base.html#a279db3897b91ff97ebdd410169b8c13d":[0,0,102,10], -"class_text_form_base.html#a28448ef3a106719e2863660bd9230bdc":[0,0,102,39], -"class_text_form_base.html#a29c62763df7c88f78a1fb8b4c65e0383":[0,0,102,14], -"class_text_form_base.html#a39677cde5e236fd32257a86543e8a3f5":[0,0,102,48], -"class_text_form_base.html#a3dad92d1a04122535626e259c24391ec":[0,0,102,17], -"class_text_form_base.html#a3eb125e5242692bcff954c0706634833":[0,0,102,30], -"class_text_form_base.html#a4300bcea7b6ffc6c8c0e278908c9bf5a":[0,0,102,40], -"class_text_form_base.html#a47a05d0cd3b24d516d7cd73e6f1801b6":[0,0,102,16], -"class_text_form_base.html#a4c72fb0574b2bd9214140df806848f02":[0,0,102,43], -"class_text_form_base.html#a4ca5f55e86ab0456c04e521094857369":[0,0,102,37], -"class_text_form_base.html#a4def79e764545dc050b355da45b091d1":[0,0,102,44], -"class_text_form_base.html#a6610d9f72f598b3f4e8f86aad7980c74":[0,0,102,4], -"class_text_form_base.html#a6ac5da788492cc037aec6b6a9dcbd4a8":[0,0,102,41], -"class_text_form_base.html#a6e8c2c55fcac20adba14d0ee92ee6560":[0,0,102,7], -"class_text_form_base.html#a6f796e5b87ec48aa812a401262a9fe93":[0,0,102,23], -"class_text_form_base.html#a7334788ba4af44ccb01547c348d2310c":[0,0,102,21], -"class_text_form_base.html#a73e92b286d13f68c697335df49c33b40":[0,0,102,29], -"class_text_form_base.html#a7464a3fc135d9a85ecb75c42f50bef0e":[0,0,102,38], -"class_text_form_base.html#a7edc22afae66bc4e91461584668a7d64":[0,0,102,42], -"class_text_form_base.html#a87c7b2df984b9fa32c99bc18b6207342":[0,0,102,6], -"class_text_form_base.html#a8d9c9eadf9e724d7c7c1fc9a6b5e09d6":[0,0,102,49], -"class_text_form_base.html#a97e9f9088c396c51645763f65f1fcae9":[0,0,102,34], -"class_text_form_base.html#a98382c1f1b903db868557cc3ab305143":[0,0,102,47], -"class_text_form_base.html#a9a2f9ad1a172ffed751944231cf26332":[0,0,102,5], -"class_text_form_base.html#a9e96d1d31cfb24ddb39ff24e366cbb1a":[0,0,102,26], -"class_text_form_base.html#a9f865ba5241dc9ba607e514a4b5a0e0d":[0,0,102,32], -"class_text_form_base.html#aa7bce0b447d510e11c52344e26019417":[0,0,102,0], -"class_text_form_base.html#aadf4ac576b11c235b43359df5e298942":[0,0,102,3], -"class_text_form_base.html#aaf38921dfe3bee5a769e906dbc6843f1":[0,0,102,19], -"class_text_form_base.html#ab4220dcb19935bebb8aefb2c486378ef":[0,0,102,31], -"class_text_form_base.html#ab486d5c675ebde25f89c763378b19f60":[0,0,102,2], -"class_text_form_base.html#abcde3d462cfa4632198b2dd0f5835041":[0,0,102,50], -"class_text_form_base.html#ac7dc780d44ca9c55d10a0d1012a1f8ba":[0,0,102,18], -"class_text_form_base.html#ac88b09dd08a5b01b69c04e644d25163a":[0,0,102,46], -"class_text_form_base.html#aca2e5f72c0d399f1e48f35f129b94b29":[0,0,102,1], -"class_text_form_base.html#acc40a994d976ea04f66dbb6790b5d7a5":[0,0,102,12], -"class_text_form_base.html#ad1edec95968fef33c94f96a2fe76e2e5":[0,0,102,33], -"class_text_form_base.html#addfe9749ca7aa07c2d14bbddbe8417c5":[0,0,102,13], -"class_text_form_base.html#adf2b35e57ba91096b1de72f761e95fa0":[0,0,102,28], -"class_text_form_base.html#ae70c96bb398576eff2ad8d151833c179":[0,0,102,8], -"class_text_form_base.html#ae723a4d74db7989a63ccd46eedc44bff":[0,0,102,45], -"class_text_form_base.html#ae9e39d45b4754ff1df2c1e0e552dd982":[0,0,102,35], -"class_text_form_base.html#af3457265fe6266b0ef61d30790fb33eb":[0,0,102,9], -"class_text_form_base.html#af34bc2311411715448bd41378f8a6895":[0,0,102,36], -"class_text_form_base.html#afc1a68f987a02df5df3c927351020450":[0,0,102,15], -"class_text_g_l_drawable.html":[0,0,103], -"class_text_g_l_drawable.html#a002950e57ddee2b366a428cf166d265a":[0,0,103,28], -"class_text_g_l_drawable.html#a12875f8cc1cdb675353c6b12112d05fe":[0,0,103,18], -"class_text_g_l_drawable.html#a25d765828a9ecd9629ff9ccd4a66fc43":[0,0,103,9], -"class_text_g_l_drawable.html#a2a8aa1255ae9546618d8a30051882c18":[0,0,103,4], -"class_text_g_l_drawable.html#a2df771de3dd7c16f1a88540ac6620ab4":[0,0,103,0], -"class_text_g_l_drawable.html#a30803a43c1f1ee4ae35900bc4f6a5a3c":[0,0,103,16], -"class_text_g_l_drawable.html#a30a8a416b10b04e877a0ae10528150d0":[0,0,103,26], -"class_text_g_l_drawable.html#a328d55b4c8e3684a1093872cad1d41bb":[0,0,103,5], -"class_text_g_l_drawable.html#a3694676b20848e16dedf11569639216c":[0,0,103,19], -"class_text_g_l_drawable.html#a385db5bcf159982ba006a8dd97ee1383":[0,0,103,7], -"class_text_g_l_drawable.html#a44b1a0129b8da33b2be9a1745415de93":[0,0,103,24], -"class_text_g_l_drawable.html#a4894c656b1c7016c8c8176cff2f8c66f":[0,0,103,15], -"class_text_g_l_drawable.html#a4a20344804fa6b34c02a7fd55ad96314":[0,0,103,10], -"class_text_g_l_drawable.html#a51bdeb52e839fc941ed3803f557f7911":[0,0,103,1], -"class_text_g_l_drawable.html#a61de4c6cec06534405b7ecc292b9bd28":[0,0,103,11], -"class_text_g_l_drawable.html#a7beff45d550827ce4e2f3335585a4f42":[0,0,103,6], -"class_text_g_l_drawable.html#a816623b682408889fa6893b41782453b":[0,0,103,14], -"class_text_g_l_drawable.html#a847984364f55bfd063419a359d9acc91":[0,0,103,20], -"class_text_g_l_drawable.html#a85eb711312c444322767319bd23a7795":[0,0,103,23], -"class_text_g_l_drawable.html#a8894b391174ffe37d1d372b8c4a31fe7":[0,0,103,12], -"class_text_g_l_drawable.html#a93b56ed45e3097129d4682c735a23fcf":[0,0,103,8], -"class_text_g_l_drawable.html#a965ac9bf245f1979a080193986874f18":[0,0,103,2], -"class_text_g_l_drawable.html#a9b461935514f4da4805889fdcff48be6":[0,0,103,25], -"class_text_g_l_drawable.html#ab1b363afde75d9f53aedea103c24f287":[0,0,103,22], -"class_text_g_l_drawable.html#acba312735b20ed532c80992e4777f262":[0,0,103,27], -"class_text_g_l_drawable.html#ad84933ea0f396ee9c18d463d22e4c3f8":[0,0,103,21], -"class_text_g_l_drawable.html#ae05f3bb671317d687421226c41277553":[0,0,103,13], -"class_text_g_l_drawable.html#af24996577c26268a514f2ee43e72ff4d":[0,0,103,17], -"class_text_g_l_drawable.html#af9bcd8c0e163302429ca8a17f587e8ec":[0,0,103,3], -"class_text_texture.html":[0,0,104], -"class_text_texture.html#a028855c450db4925652071c212cce8c7":[0,0,104,0], -"class_text_texture.html#a13d64c6afe292be4ccca8294dd501f0f":[0,0,104,1], -"class_text_texture.html#a4a20344804fa6b34c02a7fd55ad96314":[0,0,104,5], -"class_text_texture.html#a5819c3917f7be6e1fdd1f5d1b617dd2a":[0,0,104,2], -"class_text_texture.html#a61de4c6cec06534405b7ecc292b9bd28":[0,0,104,6], -"class_text_texture.html#a8894b391174ffe37d1d372b8c4a31fe7":[0,0,104,7], -"class_text_texture.html#aa7ab43a57d9767d92ee60933977d66ac":[0,0,104,3], -"class_text_texture.html#ac663a01462a341a279cc4cdf0c500fba":[0,0,104,4], -"class_transfer_function.html":[0,0,105], -"class_transfer_function.html#a0bc542d565e75938699d5e03f3a5e6f0":[0,0,105,15], -"class_transfer_function.html#a0cd1dec850117741abb04b608c7b3f1e":[0,0,105,5], -"class_transfer_function.html#a0cd48b67fbcc1afc400bdf6cadb824b4":[0,0,105,23], -"class_transfer_function.html#a0d4b3da271ecef4ec764a9f26b1ee488":[0,0,105,28], -"class_transfer_function.html#a3312f7e9499aa99742093d3b60547862":[0,0,105,6], -"class_transfer_function.html#a39e20dc5b20657d882fb820ee1178eee":[0,0,105,8], -"class_transfer_function.html#a39ec7eda2cc3737a1502af8bdf2a9bf5":[0,0,105,22], -"class_transfer_function.html#a4d3e5afb04d7196647814339cd15bc3a":[0,0,105,24], -"class_transfer_function.html#a5f09dd8e5c016a90c69a8e38ef302c8a":[0,0,105,3], -"class_transfer_function.html#a630099b92667aa3e4b455fba234d4eda":[0,0,105,10], -"class_transfer_function.html#a6325dec72c7b85178f490c5cf85229bd":[0,0,105,12], -"class_transfer_function.html#a6a4415d2cf0af290494ea30d586cc187":[0,0,105,4], -"class_transfer_function.html#a6b66df900c86cfb848d2e08591a4a0c9":[0,0,105,25], -"class_transfer_function.html#a70e6b38f9b4a45a29b3b2eb4947e8e2f":[0,0,105,7], -"class_transfer_function.html#a966c99fbd03b89662e0a340b7cffe717":[0,0,105,27], -"class_transfer_function.html#a96c6acddec588288c5883416ec926abe":[0,0,105,31], -"class_transfer_function.html#aa16c1f3e18149c153d78e0627a5e9972":[0,0,105,21], -"class_transfer_function.html#ab23ed101f7d4e953e4df0d4d480d9798":[0,0,105,18], -"class_transfer_function.html#ab736fb79486407e626364e1410c263f3":[0,0,105,1], -"class_transfer_function.html#aba60b46f243b3b0c8e9ccdeb391cba27":[0,0,105,2], -"class_transfer_function.html#ac6755bf723a1dfa90ee8254471136429":[0,0,105,29], -"class_transfer_function.html#ad10adb7a94ebc62349cca7b56b7cadb9":[0,0,105,19], -"class_transfer_function.html#ad5e7f4e17ce8ca7d3ab4a2ea2b688438":[0,0,105,14], -"class_transfer_function.html#ad708802d32428ddb20d33910bf348b55":[0,0,105,26], -"class_transfer_function.html#ae145b86db1450a19a3ed32084ee60423":[0,0,105,13], -"class_transfer_function.html#ae1ea0f8351796e932609e1c9494b5e76":[0,0,105,16], -"class_transfer_function.html#aec2d0676d112ccf849c0d3d6f3fee461":[0,0,105,11], -"class_transfer_function.html#aee524d83c25209202ba2b1e8a600ef21":[0,0,105,30], -"class_transfer_function.html#aee6c1440c4f527b7a839e07474a381f0":[0,0,105,9], -"class_transfer_function.html#af8c3f06742a7ffc9dabc0d4f5dbc98c3":[0,0,105,20], -"class_transfer_function.html#afe15de93ab4f93032560a6139091ef10":[0,0,105,17], -"class_transfer_function_form.html":[0,0,106], -"class_transfer_function_form.html#a1c565e92a52dd6e710db7ecf92083f37":[0,0,106,3], -"class_transfer_function_form.html#a27c6a37b520b4e3043ae492d9112a9df":[0,0,106,4], -"class_transfer_function_form.html#a38f692bf981cfb865a6d8d2528aa3b56":[0,0,106,6], -"class_transfer_function_form.html#a45b34337d0dbef9df6e4b35f169ccf98":[0,0,106,1], -"class_transfer_function_form.html#a546e732b865a8054231432df595246c2":[0,0,106,5], -"class_transfer_function_form.html#a681698673fea3d716ee383ae3d9d28eb":[0,0,106,2], -"class_transfer_function_form.html#a87648ffa2b1d88ff18135f1dce46ac97":[0,0,106,7], -"class_transfer_function_form.html#ab3973fc6d0585be5570682674041d21d":[0,0,106,0], -"class_transfer_function_form_base.html":[0,0,107], -"class_transfer_function_form_base.html#a0016c5144bc331f6348bea935bb8cc55":[0,0,107,16], -"class_transfer_function_form_base.html#a008be2fa5d9b01b841ae8689606d9b5b":[0,0,107,4], -"class_transfer_function_form_base.html#a049b09e73946dcca6306d72770e097fd":[0,0,107,18], -"class_transfer_function_form_base.html#a1be29f1cc2a4ecd64b5d368cb7a9dd8c":[0,0,107,14], -"class_transfer_function_form_base.html#a1d5de82c329970e967c75de0f99778ef":[0,0,107,19], -"class_transfer_function_form_base.html#a2be269d1b27821fd3bda48c34d2382be":[0,0,107,15], -"class_transfer_function_form_base.html#a2f8ad120d19ede3c79a2dbee404927d7":[0,0,107,5], -"class_transfer_function_form_base.html#a3dfe2400369e1ca1416b26f265f0ae4b":[0,0,107,3], -"class_transfer_function_form_base.html#a47346c56b626d41c6ddec9fc26060f6d":[0,0,107,13], -"class_transfer_function_form_base.html#a4ce3369a8557eced7b42b878016c9331":[0,0,107,0], -"class_transfer_function_form_base.html#a7f5da321a6297086cc6f5c3ea85be7f0":[0,0,107,1], -"class_transfer_function_form_base.html#a8618a2b5585ac0b665b8fdc3c9ceeae3":[0,0,107,6], -"class_transfer_function_form_base.html#a93731803bc32f17be6ae889182ab5bee":[0,0,107,11], -"class_transfer_function_form_base.html#aa4603a3f49179e61205862faa962ef4b":[0,0,107,8], -"class_transfer_function_form_base.html#aa8839934e71bf16b63a5cff34679be4b":[0,0,107,10], -"class_transfer_function_form_base.html#ab70bd59a35d2c588291e0fd65b7b043c":[0,0,107,9], -"class_transfer_function_form_base.html#ae1a557b170a2966b73a87d6ffd6eaf0e":[0,0,107,12], -"class_transfer_function_form_base.html#ae208b4b2e42f9d9e021e1db483b3c481":[0,0,107,2], -"class_transfer_function_form_base.html#afba56679122dbb55dce1ebf34482e519":[0,0,107,7], -"class_transfer_function_form_base.html#afca69d20a9b8f361e074ab5553f016b0":[0,0,107,17], -"class_transformer.html":[0,0,108], -"class_transformer.html#a0395a11dc8173e511a0596ac96bf05e5":[0,0,108,21], -"class_transformer.html#a169064f996341f8f8b6881c6a3909f0b":[0,0,108,10], -"class_transformer.html#a1e9e9ba48aa76bdd2ff2e973014ad422":[0,0,108,5], -"class_transformer.html#a286bcc94f7202a6ff81b66707424a9bd":[0,0,108,7], -"class_transformer.html#a312583e28394926c746f133137345c9d":[0,0,108,1], -"class_transformer.html#a31a3dc18c483d67b4a03038563ecce38":[0,0,108,16], -"class_transformer.html#a327ff3cf9194c18049e4feac6761ebc0":[0,0,108,4] +"class_sync_motor.html":[0,0,99], +"class_sync_motor.html#a035b63a3dfd356daff0bf1cee9672313":[0,0,99,5], +"class_sync_motor.html#a038162c828595f58782fe97dea2c864d":[0,0,99,10], +"class_sync_motor.html#a0fedd06ef0833ce4d17869343b0810cb":[0,0,99,6], +"class_sync_motor.html#a12ac76afa871fc58cc0f27332723fc38":[0,0,99,12], +"class_sync_motor.html#a222d998e274674a0e0ce4a1ed53e8654":[0,0,99,0], +"class_sync_motor.html#a2ab8e43d5452f5d7f9ac375566a65210":[0,0,99,8], +"class_sync_motor.html#a3201b22e0271517f5ed3df85da6cee6f":[0,0,99,11], +"class_sync_motor.html#a435a9cfd24d182d8ab76a856fa4d0bb7":[0,0,99,2], +"class_sync_motor.html#a6068c7d22470a3996df2efda54c24972":[0,0,99,1], +"class_sync_motor.html#a7b3102220ea5f7e19690af045a6c8278":[0,0,99,4], +"class_sync_motor.html#a9b42283370ea4d4707b78b97e8c6d864":[0,0,99,3], +"class_sync_motor.html#aca41191da8383d577e3717d3e38cdf2b":[0,0,99,9], +"class_sync_motor.html#ae04da3b89a530e1457ff490b22b9f028":[0,0,99,7], +"class_text.html":[0,0,101], +"class_text.html#a03c67acf11b90374ded2a8cb8ec1088f":[0,0,101,8], +"class_text.html#a06e740065c875633e458c0d8f860c43e":[0,0,101,6], +"class_text.html#a0d0629dec49cece668f41d2a85062f39":[0,0,101,40], +"class_text.html#a0d37b9c067e62e10ebd1f0f74dbb5e66":[0,0,101,24], +"class_text.html#a15e4192a98a95baa22fd7a423efb5df9":[0,0,101,9], +"class_text.html#a255ba9b693f614b16986ac238c28f66e":[0,0,101,25], +"class_text.html#a2d07db0c15bdbd9d7056ac794f524f57":[0,0,101,36], +"class_text.html#a2d49e5c280e205125b149f7777ae30c7":[0,0,101,2], +"class_text.html#a2f40cb8ed553f1680bf402f9c8e2b541":[0,0,101,35], +"class_text.html#a340b00ac7a17cd9a1f37f63275715638":[0,0,101,11], +"class_text.html#a3b050d27140840eadcdce567df42d1e2":[0,0,101,7], +"class_text.html#a3f58eb1736e822f96882ded57938dbbd":[0,0,101,13], +"class_text.html#a41eabb28f45124d5da3ec2d703ce9018":[0,0,101,15], +"class_text.html#a4d1b7f1b53288297dfc8f77be4c37ac4":[0,0,101,38], +"class_text.html#a4f273ea7008c72533327c25caff2e917":[0,0,101,3], +"class_text.html#a51c55b9272f653cfc3cdafe665d5dde0":[0,0,101,4], +"class_text.html#a5eb67f2bf595a78858733c96a5bc05d6":[0,0,101,26], +"class_text.html#a6743a08fc0d1d8b96db99eab48eadb8f":[0,0,101,19], +"class_text.html#a7010e26ac225166d3a7f23118bf45f74":[0,0,101,32], +"class_text.html#a7e88aef941ba0b3dba303c4370b0bb7a":[0,0,101,29], +"class_text.html#a80916b96c94d30abd8d76dcbf01d580d":[0,0,101,12], +"class_text.html#a8bab7377ac548d1883dcbbe2489c5ff1":[0,0,101,33], +"class_text.html#a9836ec9395fdd3e0ce1f1914219fe360":[0,0,101,37], +"class_text.html#a9923c820cd77b411257ba48beceafeaa":[0,0,101,16], +"class_text.html#a9f05c1520fe691515ee15a0b63ca9b28":[0,0,101,14], +"class_text.html#aa32f9156fbbe783fab5d90072667e2c3":[0,0,101,23], +"class_text.html#aa722e4df566518900e4f2cc1f1af2f9c":[0,0,101,28], +"class_text.html#ab3e26143fccc52699bcc5149cae852bc":[0,0,101,0], +"class_text.html#ab3f1487162842f26d6d50b298bb3142d":[0,0,101,18], +"class_text.html#abe911e27cd723c0ab51f63d8f27683d1":[0,0,101,20], +"class_text.html#ac045b28b3621a5fddb3e5ac86889bfca":[0,0,101,39], +"class_text.html#ac0ab42a8d5145cd1d780f695d0e6e64f":[0,0,101,34], +"class_text.html#ac19aa2e04d68965adadee0c67daca99e":[0,0,101,41], +"class_text.html#ac6383f5f8e424f3c8cf6f37ac9371dcf":[0,0,101,27], +"class_text.html#ac8107fb05d19dbaf681af76a91ea739b":[0,0,101,1], +"class_text.html#ad251de30122437e2a311aa60e8ed390a":[0,0,101,31], +"class_text.html#ad696293ace753aba46568c76b1adff4e":[0,0,101,21], +"class_text.html#aea6772b57e5129e87926b6a35d90f74e":[0,0,101,10], +"class_text.html#aef377b465f00fe9aec996e122c1bb23a":[0,0,101,22], +"class_text.html#af025bbbb8d5619929df7817f98e23597":[0,0,101,5], +"class_text.html#afcd995d8a0b3921cd33dd305b586e3f7":[0,0,101,30], +"class_text.html#afe1f86a497f34cee4809cbd7fda24dc3":[0,0,101,17], +"class_text_form.html":[0,0,102], +"class_text_form.html#a05f71762d18640d7ee7b85cf8cfde0ee":[0,0,102,15], +"class_text_form.html#a098066e96da254f13b5cd2b0e8977e43":[0,0,102,7], +"class_text_form.html#a1268fce1f817bd9ff0626a24c0aabda7":[0,0,102,21], +"class_text_form.html#a14ccad2b03e8017c02eb632fbe02df2a":[0,0,102,0], +"class_text_form.html#a21a3fa61ce11a198e4a0cf086a85e61b":[0,0,102,10], +"class_text_form.html#a2946f7590a66a55d3ae63a6def86a8f3":[0,0,102,8], +"class_text_form.html#a29a135685c4f5f6801abc50ab48d97f9":[0,0,102,11], +"class_text_form.html#a3b32cfbb221700c5cde1146dd9ba0ac3":[0,0,102,12], +"class_text_form.html#a4bbd73071ce20cf1c805139af58d2e77":[0,0,102,5], +"class_text_form.html#a4e3ecb63b41fe8e1592ba1bdb57cf89f":[0,0,102,18], +"class_text_form.html#a53d385f26fb4bf90e52db6e4c1d3b49a":[0,0,102,14], +"class_text_form.html#a55358259e75a1e262aa6f2f58dc70c80":[0,0,102,16], +"class_text_form.html#a553bf0b435f0d59d4c86ea7a004aab60":[0,0,102,17], +"class_text_form.html#a644cc688a5f54e202c451f403174a725":[0,0,102,13], +"class_text_form.html#a7cb43566e1ec8bb5d7be0e3ed86f1876":[0,0,102,2], +"class_text_form.html#aa15c4be9ce71f50b6ebdbabf1ddb26bb":[0,0,102,1], +"class_text_form.html#aad06ea6fcaec43465ea4e0aa7bd3b61d":[0,0,102,22], +"class_text_form.html#aae058177645a7b974003cf7ba3957e62":[0,0,102,9], +"class_text_form.html#ab9cad6d1dc2ea1406ca6f9b44ecd46c3":[0,0,102,6], +"class_text_form.html#ad11e9224ce96616ccc1fae802a65738e":[0,0,102,3], +"class_text_form.html#adc28fed9ecb5fb32957737af4e7827dc":[0,0,102,20], +"class_text_form.html#ae46074db075dacd127c78b16b0417c3a":[0,0,102,4], +"class_text_form.html#af96c830fe67da49fac36a7df58f0728b":[0,0,102,19], +"class_text_form_base.html":[0,0,103], +"class_text_form_base.html#a06b80e25d042052ef8b5ebbcf39a82e6":[0,0,103,11], +"class_text_form_base.html#a0df65c65bf9926eaa20792d803762fd2":[0,0,103,22], +"class_text_form_base.html#a0f854e9b93a101684308930464799a3c":[0,0,103,24], +"class_text_form_base.html#a0ff115ed58de4b9f83e8ac18fc1c11cc":[0,0,103,25], +"class_text_form_base.html#a1822a077536adfdfdbf7ba7853e2917c":[0,0,103,20], +"class_text_form_base.html#a20e495f9fe62e0eaee49ea2cfb7661fa":[0,0,103,27], +"class_text_form_base.html#a279db3897b91ff97ebdd410169b8c13d":[0,0,103,10], +"class_text_form_base.html#a28448ef3a106719e2863660bd9230bdc":[0,0,103,39], +"class_text_form_base.html#a29c62763df7c88f78a1fb8b4c65e0383":[0,0,103,14], +"class_text_form_base.html#a39677cde5e236fd32257a86543e8a3f5":[0,0,103,48], +"class_text_form_base.html#a3dad92d1a04122535626e259c24391ec":[0,0,103,17], +"class_text_form_base.html#a3eb125e5242692bcff954c0706634833":[0,0,103,30], +"class_text_form_base.html#a4300bcea7b6ffc6c8c0e278908c9bf5a":[0,0,103,40], +"class_text_form_base.html#a47a05d0cd3b24d516d7cd73e6f1801b6":[0,0,103,16], +"class_text_form_base.html#a4c72fb0574b2bd9214140df806848f02":[0,0,103,43], +"class_text_form_base.html#a4ca5f55e86ab0456c04e521094857369":[0,0,103,37], +"class_text_form_base.html#a4def79e764545dc050b355da45b091d1":[0,0,103,44], +"class_text_form_base.html#a6610d9f72f598b3f4e8f86aad7980c74":[0,0,103,4], +"class_text_form_base.html#a6ac5da788492cc037aec6b6a9dcbd4a8":[0,0,103,41], +"class_text_form_base.html#a6e8c2c55fcac20adba14d0ee92ee6560":[0,0,103,7], +"class_text_form_base.html#a6f796e5b87ec48aa812a401262a9fe93":[0,0,103,23], +"class_text_form_base.html#a7334788ba4af44ccb01547c348d2310c":[0,0,103,21], +"class_text_form_base.html#a73e92b286d13f68c697335df49c33b40":[0,0,103,29], +"class_text_form_base.html#a7464a3fc135d9a85ecb75c42f50bef0e":[0,0,103,38], +"class_text_form_base.html#a7edc22afae66bc4e91461584668a7d64":[0,0,103,42], +"class_text_form_base.html#a87c7b2df984b9fa32c99bc18b6207342":[0,0,103,6], +"class_text_form_base.html#a8d9c9eadf9e724d7c7c1fc9a6b5e09d6":[0,0,103,49], +"class_text_form_base.html#a97e9f9088c396c51645763f65f1fcae9":[0,0,103,34], +"class_text_form_base.html#a98382c1f1b903db868557cc3ab305143":[0,0,103,47], +"class_text_form_base.html#a9a2f9ad1a172ffed751944231cf26332":[0,0,103,5], +"class_text_form_base.html#a9e96d1d31cfb24ddb39ff24e366cbb1a":[0,0,103,26], +"class_text_form_base.html#a9f865ba5241dc9ba607e514a4b5a0e0d":[0,0,103,32], +"class_text_form_base.html#aa7bce0b447d510e11c52344e26019417":[0,0,103,0], +"class_text_form_base.html#aadf4ac576b11c235b43359df5e298942":[0,0,103,3], +"class_text_form_base.html#aaf38921dfe3bee5a769e906dbc6843f1":[0,0,103,19], +"class_text_form_base.html#ab4220dcb19935bebb8aefb2c486378ef":[0,0,103,31], +"class_text_form_base.html#ab486d5c675ebde25f89c763378b19f60":[0,0,103,2], +"class_text_form_base.html#abcde3d462cfa4632198b2dd0f5835041":[0,0,103,50], +"class_text_form_base.html#ac7dc780d44ca9c55d10a0d1012a1f8ba":[0,0,103,18], +"class_text_form_base.html#ac88b09dd08a5b01b69c04e644d25163a":[0,0,103,46], +"class_text_form_base.html#aca2e5f72c0d399f1e48f35f129b94b29":[0,0,103,1], +"class_text_form_base.html#acc40a994d976ea04f66dbb6790b5d7a5":[0,0,103,12], +"class_text_form_base.html#ad1edec95968fef33c94f96a2fe76e2e5":[0,0,103,33], +"class_text_form_base.html#addfe9749ca7aa07c2d14bbddbe8417c5":[0,0,103,13], +"class_text_form_base.html#adf2b35e57ba91096b1de72f761e95fa0":[0,0,103,28], +"class_text_form_base.html#ae70c96bb398576eff2ad8d151833c179":[0,0,103,8], +"class_text_form_base.html#ae723a4d74db7989a63ccd46eedc44bff":[0,0,103,45], +"class_text_form_base.html#ae9e39d45b4754ff1df2c1e0e552dd982":[0,0,103,35], +"class_text_form_base.html#af3457265fe6266b0ef61d30790fb33eb":[0,0,103,9], +"class_text_form_base.html#af34bc2311411715448bd41378f8a6895":[0,0,103,36], +"class_text_form_base.html#afc1a68f987a02df5df3c927351020450":[0,0,103,15], +"class_text_g_l_drawable.html":[0,0,104], +"class_text_g_l_drawable.html#a002950e57ddee2b366a428cf166d265a":[0,0,104,28], +"class_text_g_l_drawable.html#a12875f8cc1cdb675353c6b12112d05fe":[0,0,104,18], +"class_text_g_l_drawable.html#a25d765828a9ecd9629ff9ccd4a66fc43":[0,0,104,9], +"class_text_g_l_drawable.html#a2a8aa1255ae9546618d8a30051882c18":[0,0,104,4], +"class_text_g_l_drawable.html#a2df771de3dd7c16f1a88540ac6620ab4":[0,0,104,0], +"class_text_g_l_drawable.html#a30803a43c1f1ee4ae35900bc4f6a5a3c":[0,0,104,16], +"class_text_g_l_drawable.html#a30a8a416b10b04e877a0ae10528150d0":[0,0,104,26], +"class_text_g_l_drawable.html#a328d55b4c8e3684a1093872cad1d41bb":[0,0,104,5], +"class_text_g_l_drawable.html#a3694676b20848e16dedf11569639216c":[0,0,104,19], +"class_text_g_l_drawable.html#a385db5bcf159982ba006a8dd97ee1383":[0,0,104,7], +"class_text_g_l_drawable.html#a44b1a0129b8da33b2be9a1745415de93":[0,0,104,24], +"class_text_g_l_drawable.html#a4894c656b1c7016c8c8176cff2f8c66f":[0,0,104,15], +"class_text_g_l_drawable.html#a4a20344804fa6b34c02a7fd55ad96314":[0,0,104,10], +"class_text_g_l_drawable.html#a51bdeb52e839fc941ed3803f557f7911":[0,0,104,1], +"class_text_g_l_drawable.html#a61de4c6cec06534405b7ecc292b9bd28":[0,0,104,11], +"class_text_g_l_drawable.html#a7beff45d550827ce4e2f3335585a4f42":[0,0,104,6], +"class_text_g_l_drawable.html#a816623b682408889fa6893b41782453b":[0,0,104,14], +"class_text_g_l_drawable.html#a847984364f55bfd063419a359d9acc91":[0,0,104,20], +"class_text_g_l_drawable.html#a85eb711312c444322767319bd23a7795":[0,0,104,23], +"class_text_g_l_drawable.html#a8894b391174ffe37d1d372b8c4a31fe7":[0,0,104,12], +"class_text_g_l_drawable.html#a93b56ed45e3097129d4682c735a23fcf":[0,0,104,8], +"class_text_g_l_drawable.html#a965ac9bf245f1979a080193986874f18":[0,0,104,2], +"class_text_g_l_drawable.html#a9b461935514f4da4805889fdcff48be6":[0,0,104,25], +"class_text_g_l_drawable.html#ab1b363afde75d9f53aedea103c24f287":[0,0,104,22], +"class_text_g_l_drawable.html#acba312735b20ed532c80992e4777f262":[0,0,104,27], +"class_text_g_l_drawable.html#ad84933ea0f396ee9c18d463d22e4c3f8":[0,0,104,21], +"class_text_g_l_drawable.html#ae05f3bb671317d687421226c41277553":[0,0,104,13], +"class_text_g_l_drawable.html#af24996577c26268a514f2ee43e72ff4d":[0,0,104,17], +"class_text_g_l_drawable.html#af9bcd8c0e163302429ca8a17f587e8ec":[0,0,104,3], +"class_text_texture.html":[0,0,105] }; diff --git a/docs/doxygen/html/navtreeindex11.js b/docs/doxygen/html/navtreeindex11.js index badc9c5..76dbe47 100644 --- a/docs/doxygen/html/navtreeindex11.js +++ b/docs/doxygen/html/navtreeindex11.js @@ -1,253 +1,253 @@ var NAVTREEINDEX11 = { -"class_transformer.html#a328c419af15701734168c8db62eefa36":[0,0,108,19], -"class_transformer.html#a39b58fcf230970601c5d77c088559731":[0,0,108,11], -"class_transformer.html#a4e70f875967e60d8202fb6e3c6e3f79a":[0,0,108,9], -"class_transformer.html#a4f9137e6190fb630167f671a0da51ab6":[0,0,108,17], -"class_transformer.html#a504e72295ea190d9956c5055645a96d1":[0,0,108,8], -"class_transformer.html#a67f1e2686932700fe8a83fdc232ea1e8":[0,0,108,12], -"class_transformer.html#a7d56456dadf3aa0bc60f59e7e7eda7a2":[0,0,108,0], -"class_transformer.html#a7e3cd54e20d795ab9b0b8533ce03b728":[0,0,108,18], -"class_transformer.html#a9652232a076cca0fe3753477ec88f63a":[0,0,108,13], -"class_transformer.html#aa1f87f24c062258b1437be648032bb6e":[0,0,108,22], -"class_transformer.html#aaa6cc999eb77a94dafaec5debb4db3de":[0,0,108,14], -"class_transformer.html#acb55f182a7f6d7af0feb6a94cb62af4f":[0,0,108,20], -"class_transformer.html#ad2f2bcd287bd3bb3221ab584f2c2fc90":[0,0,108,23], -"class_transformer.html#adf0b20286f3de359346b8877d65c1996":[0,0,108,15], -"class_transformer.html#adfe51a2198cfc10e1095af9c034681bd":[0,0,108,6], -"class_transformer.html#ae2f7b06be0f585ab586ee501ad59285c":[0,0,108,2], -"class_transformer.html#aea52a4562ec5b4a79bf82b8ede32ecc6":[0,0,108,3], -"class_transformer_form.html":[0,0,110], -"class_transformer_form.html#a10f5f72d1fc3882d229a54ba4522154a":[0,0,110,5], -"class_transformer_form.html#a71966865b6a286c22034ef50849513ab":[0,0,110,4], -"class_transformer_form.html#a72d54f5a59363d33b02e9467833c0b6b":[0,0,110,3], -"class_transformer_form.html#a737b66275ba708412a06dd764510a968":[0,0,110,2], -"class_transformer_form.html#a8cac1e9fdb77f140db36c4efe2e0555c":[0,0,110,0], -"class_transformer_form.html#ac1db49bd821dd82b25737686ae394103":[0,0,110,6], -"class_transformer_form.html#ad227425d57a1a8b8b6209cd55ebdbd80":[0,0,110,7], -"class_transformer_form.html#af9ab8a52f336a931e5e690ad8f0fc903":[0,0,110,1], -"class_transformer_form_base.html":[0,0,111], -"class_transformer_form_base.html#a022d3748ff4c570aea35538a463b6773":[0,0,111,43], -"class_transformer_form_base.html#a0284032d1298fb2ad4ac2eb427077914":[0,0,111,36], -"class_transformer_form_base.html#a03bf43a865e368c51afeabd81bd5d8ee":[0,0,111,86], -"class_transformer_form_base.html#a045b70a953da5049d4f5d853a9ec8ed4":[0,0,111,52], -"class_transformer_form_base.html#a04c92b7d29cd3375a1415764aa536406":[0,0,111,51], -"class_transformer_form_base.html#a0d466ffb4b1f4c1bd026c5f3f46a4c79":[0,0,111,21], -"class_transformer_form_base.html#a0dd7a20e78c4effd68da4764109bb4f1":[0,0,111,29], -"class_transformer_form_base.html#a113edf034a7f07f84bedf62bda482ddc":[0,0,111,24], -"class_transformer_form_base.html#a13f64e73b1906163fd4faea4c76dda20":[0,0,111,5], -"class_transformer_form_base.html#a1a021847167a55f2050d974fbe6529ae":[0,0,111,3], -"class_transformer_form_base.html#a1b799c8717841772b84dbd4268b5d33f":[0,0,111,83], -"class_transformer_form_base.html#a24caf79933c5ce7224e7787b9887ff80":[0,0,111,85], -"class_transformer_form_base.html#a253fe9d0a6aac89813e38304a27e239f":[0,0,111,87], -"class_transformer_form_base.html#a270bc4d0bbedcd942902757783643fe4":[0,0,111,76], -"class_transformer_form_base.html#a2cc878c4779f0ba73d5deb700759ecb0":[0,0,111,1], -"class_transformer_form_base.html#a2fde91e5014982d570274e407362dae4":[0,0,111,50], -"class_transformer_form_base.html#a38c21aed3d1fd4fd4e1ba41f3a138d3e":[0,0,111,10], -"class_transformer_form_base.html#a3f434986c270c39b3b68f359b0e9ee9a":[0,0,111,82], -"class_transformer_form_base.html#a4487a3bc92e5539f19fd42c0d5506e3d":[0,0,111,58], -"class_transformer_form_base.html#a49c8239313228c0843d089ef5d63dd55":[0,0,111,37], -"class_transformer_form_base.html#a4d2e10a6c0358a578deb65acf6295b9d":[0,0,111,9], -"class_transformer_form_base.html#a4f8d3c5594371b78264cbc159de95fbc":[0,0,111,62], -"class_transformer_form_base.html#a50fc4ce1b4dda224a1a0f711bfc9f26c":[0,0,111,18], -"class_transformer_form_base.html#a531e49e6a056144e2f5047286e8a16da":[0,0,111,32], -"class_transformer_form_base.html#a55e86e376d766493f443fef08ff58fd8":[0,0,111,17], -"class_transformer_form_base.html#a5706999e17e2932b972187736419d505":[0,0,111,57], -"class_transformer_form_base.html#a5a687a0a567cc31b15b0adc96460079e":[0,0,111,66], -"class_transformer_form_base.html#a5c748e72231caaa693337347a343ee64":[0,0,111,30], -"class_transformer_form_base.html#a610937e52d3ca590618a992d33a0eeb6":[0,0,111,71], -"class_transformer_form_base.html#a640f38342e6d516d172eef982e952a7f":[0,0,111,60], -"class_transformer_form_base.html#a69e14483db595799ff4baf5cf1e23e59":[0,0,111,72], -"class_transformer_form_base.html#a6b826cda74882238c54280b1b727fa5d":[0,0,111,46], -"class_transformer_form_base.html#a6dbb4bd37b20982632dd728ff855b870":[0,0,111,27], -"class_transformer_form_base.html#a70c25076ba3a28f31822cb2f1273fbb6":[0,0,111,2], -"class_transformer_form_base.html#a714a3a0d023771c3dcee367b709a297e":[0,0,111,26], -"class_transformer_form_base.html#a7870d1ac8852c45cc58fbd290a6acef3":[0,0,111,13], -"class_transformer_form_base.html#a7bdcbe2ed487ba2da498d7a6c7ac8e7a":[0,0,111,14], -"class_transformer_form_base.html#a7d718aac8c90366c98d7ee94f382d62f":[0,0,111,53], -"class_transformer_form_base.html#a7e8def6859b1e38fd3c91bfe6288bb73":[0,0,111,56], -"class_transformer_form_base.html#a7fe977bdfe8780749bc3ee987a7729b7":[0,0,111,40], -"class_transformer_form_base.html#a807fc537dbf283a9b7ff6cbef2dbcc00":[0,0,111,34], -"class_transformer_form_base.html#a811b577ff9fd83c437379455d7e52c53":[0,0,111,63], -"class_transformer_form_base.html#a844597ca569fe6b06d77284c2f06b279":[0,0,111,61], -"class_transformer_form_base.html#a85a92227216e9ce953b121c97f96c5f2":[0,0,111,42], -"class_transformer_form_base.html#a88bd7d74f839e3cec36b15ebd7651948":[0,0,111,55], -"class_transformer_form_base.html#a8df8a1bcbf215b3e466595beb30f68d8":[0,0,111,59], -"class_transformer_form_base.html#a8e4d2a3046c69b01bd705ae652bdea86":[0,0,111,67], -"class_transformer_form_base.html#a8ec2523003aa34d4f84a81de3cbbbdd5":[0,0,111,23], -"class_transformer_form_base.html#a9307de748d184dc5f00bdaaa9a09fb6c":[0,0,111,48], -"class_transformer_form_base.html#a9357f82f40ce6a73eb4bff990d5ccead":[0,0,111,88], -"class_transformer_form_base.html#a96c25a55ea50c18e14022f2ff00a5051":[0,0,111,80], -"class_transformer_form_base.html#a98efcfc4d7455dad70c87c9de30a26d0":[0,0,111,20], -"class_transformer_form_base.html#a99f0a3d39c149d1d8ae1b478bb1ecce2":[0,0,111,22], -"class_transformer_form_base.html#aa1c6bbea49f60eb9962b07146757da64":[0,0,111,65], -"class_transformer_form_base.html#aa1e990df75f9e6025ed38b601851b914":[0,0,111,49], -"class_transformer_form_base.html#aa665859e3b696bef4b146f1efbab0eca":[0,0,111,81], -"class_transformer_form_base.html#aa69ec87ce83152dbf30ca86ef9a431c6":[0,0,111,8], -"class_transformer_form_base.html#aabdd5f43e5379ecd03f6a01086fa8e98":[0,0,111,15], -"class_transformer_form_base.html#ab31a2c526cb74f229e4340e01ab0e71e":[0,0,111,84], -"class_transformer_form_base.html#ab3290af329387311274652c78e978512":[0,0,111,74], -"class_transformer_form_base.html#ab3ab36d5d0be6e5cd6cd41b88616f8b4":[0,0,111,79], -"class_transformer_form_base.html#ab88da886634ae9d6d0f010c80053d457":[0,0,111,31], -"class_transformer_form_base.html#ac1cf3e353c40d74eeef6c3822a1c2c03":[0,0,111,11], -"class_transformer_form_base.html#ac38779c0e258f370854243eb6b31986f":[0,0,111,6], -"class_transformer_form_base.html#ac3d86f996ce77b7855b925c85c3f7317":[0,0,111,35], -"class_transformer_form_base.html#ac506972ad5a38969111a0e23357fdfde":[0,0,111,16], -"class_transformer_form_base.html#ac7e3d90ed49d3343237c7f170429e743":[0,0,111,28], -"class_transformer_form_base.html#ac88dea58cbb0dd8a93f2e2e6040ec823":[0,0,111,4], -"class_transformer_form_base.html#ac9880a1a9c0b6be177714b95396108de":[0,0,111,70], -"class_transformer_form_base.html#acdd32c513f7d4a1eb23ac55ab3d28995":[0,0,111,45], -"class_transformer_form_base.html#acfcddec0baebd8c6885c26224bbfa280":[0,0,111,12], -"class_transformer_form_base.html#ad1425a7f7ab1862cafb87f08f364ba8e":[0,0,111,75], -"class_transformer_form_base.html#ad1624c0498b54b5b0beb3f77d85f687d":[0,0,111,41], -"class_transformer_form_base.html#ad3c02626ca03e34914137d1b41f530e6":[0,0,111,73], -"class_transformer_form_base.html#ad3c3cfd26566f06a0c0fe9d116648e37":[0,0,111,68], -"class_transformer_form_base.html#ad62929ebbf445d52d283f863a77ccd1b":[0,0,111,77], -"class_transformer_form_base.html#ad96d875c08ef54e86ebccbf0c326598d":[0,0,111,33], -"class_transformer_form_base.html#adc8d387589bb5acdd75d4bbd985ad243":[0,0,111,69], -"class_transformer_form_base.html#ade4e3e90c5c0f4f0abe278ffba2443a0":[0,0,111,44], -"class_transformer_form_base.html#ade72da576a6bcd2182798e449f8ce8d5":[0,0,111,38], -"class_transformer_form_base.html#ae0c2fbf9475ee1e780896fa89c14b878":[0,0,111,0], -"class_transformer_form_base.html#ae2196cf62a3c277247a112d7971872b0":[0,0,111,78], -"class_transformer_form_base.html#ae7a24e53da32b8caf67fc5ef39618743":[0,0,111,54], -"class_transformer_form_base.html#aee0b43085f009f2517994967d080b794":[0,0,111,7], -"class_transformer_form_base.html#aee7759b13cf93e4722e7514f4ddcfa8f":[0,0,111,39], -"class_transformer_form_base.html#af01e4be05d790d0a2236846899418b53":[0,0,111,19], -"class_transformer_form_base.html#af088bc27c75828d7829f18c4c4a5d7df":[0,0,111,64], -"class_transformer_form_base.html#af1394f18900292398f9f317341f1e727":[0,0,111,25], -"class_transformer_form_base.html#af65e4801b524b44b075a6218777777f0":[0,0,111,47], -"class_workspace.html":[0,0,112], -"class_workspace.html#a013bdfced9e47c0a11d378409cda1376":[0,0,112,62], -"class_workspace.html#a057257829453518249ebc0fc971c2a68":[0,0,112,47], -"class_workspace.html#a0f25d318ff7310d11e510239953b92fc":[0,0,112,8], -"class_workspace.html#a10c751ef894a1ce02ca401a0a60b3333":[0,0,112,3], -"class_workspace.html#a16047d114ac4c9708eccf87ddc93c57f":[0,0,112,59], -"class_workspace.html#a16b55585d4fa51fc3a565df2ce16997e":[0,0,112,69], -"class_workspace.html#a239e2b579a4c1b640b4f5e2640c61044":[0,0,112,70], -"class_workspace.html#a259249b912ae1caae1c166eb2f9f4123":[0,0,112,25], -"class_workspace.html#a26add99100a783d857b52fe497d5a209":[0,0,112,71], -"class_workspace.html#a29e232a2810f36222f0b1ba2f775f606":[0,0,112,5], -"class_workspace.html#a2c1f915ba189d1dc3b9088fd79b2f31a":[0,0,112,54], -"class_workspace.html#a38a886655d99aae4dbaeec88e7f855ce":[0,0,112,19], -"class_workspace.html#a3ffd9682e5898f467b54748c5277e239":[0,0,112,2], -"class_workspace.html#a444c05695fd50548fa025a97567e8a55":[0,0,112,73], -"class_workspace.html#a47405d47dd54d98cd0b5e323a5cf9071":[0,0,112,43], -"class_workspace.html#a49bec4c0ddb83d1bcfe4bb6cdf688864":[0,0,112,21], -"class_workspace.html#a4fa9ee617ed7da22b84eced403bb512e":[0,0,112,48], -"class_workspace.html#a52b015440855fbab2ae1ba7a229a36c7":[0,0,112,31], -"class_workspace.html#a5347e4a880ed744ef20da988aaac534f":[0,0,112,72], -"class_workspace.html#a58e7526fe48d3fbff16c7bf7ac607b0c":[0,0,112,35], -"class_workspace.html#a5b71e0ec48f1d9ae1ce9e01b546c01b1":[0,0,112,18], -"class_workspace.html#a5bc77206269e7abdd75085b90385e934":[0,0,112,27], -"class_workspace.html#a5c7dcb5b022b37bce0647aab42bc764a":[0,0,112,57], -"class_workspace.html#a61dd47c1c36cab51f67f6652e560b635":[0,0,112,36], -"class_workspace.html#a6658ab0800105042a29b6fea1102f873":[0,0,112,50], -"class_workspace.html#a691c80813f2f2f15bfb79db5edddf22a":[0,0,112,42], -"class_workspace.html#a69ed8a7449993602944683f9a9584fe1":[0,0,112,45], -"class_workspace.html#a6c024a0381b8515287ff82a0c135a285":[0,0,112,14], -"class_workspace.html#a6c46f1e54734c198b47134fa829f5914":[0,0,112,0], -"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a094a29399033e02e51fd013eac5f8bc3":[0,0,112,0,3], -"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a253dcdbf5c54e7de2489b54098e29161":[0,0,112,0,5], -"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a32cb1102be505f27ae0255d9e3834acc":[0,0,112,0,4], -"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a36270dbb58538c00a5b009916dda4748":[0,0,112,0,9], -"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a3e1fead750fbde2a9bf75f457f387e1c":[0,0,112,0,1], -"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a3f2c5b345a9ac7d8dfcd2b51a6becc2c":[0,0,112,0,0], -"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a48963bc6da69eeee46985e57383a6831":[0,0,112,0,10], -"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a92c16301deb027b1bad37c54f7432482":[0,0,112,0,6], -"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a94ed0030aad40a766af3d97b8cbb55df":[0,0,112,0,7], -"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a990ae713f0e72eab71de6b77c3bf412f":[0,0,112,0,11], -"class_workspace.html#a6c46f1e54734c198b47134fa829f5914ae98c91e3a672a7b48020d41234f65056":[0,0,112,0,2], -"class_workspace.html#a6c46f1e54734c198b47134fa829f5914aff456a8f97d89f415295642cfc4e7411":[0,0,112,0,8], -"class_workspace.html#a6d84b8d85526f1194667606429a3a315":[0,0,112,56], -"class_workspace.html#a6e1788b16636c60be5bf0b0bbc0a3a26":[0,0,112,33], -"class_workspace.html#a6e5a3440a86e3afc1336740aac1efbe1":[0,0,112,22], -"class_workspace.html#a6f2dcf924f95cb2b2216057a0fc53f41":[0,0,112,10], -"class_workspace.html#a709ba1bac8061b82a91e225effd22621":[0,0,112,15], -"class_workspace.html#a735b10c59c133a6c81be7432a8978e8b":[0,0,112,13], -"class_workspace.html#a758abd23ac6f327899e9761da653b40e":[0,0,112,17], -"class_workspace.html#a773f2c59738a7b546e032509822aaba4":[0,0,112,61], -"class_workspace.html#a7a940cc3edfa6da2ecc4f3555eb2259b":[0,0,112,46], -"class_workspace.html#a810b16fadd522ab40335c7533e051d6f":[0,0,112,28], -"class_workspace.html#a82d91c594e8ae5d2dc72ea4384abe24f":[0,0,112,12], -"class_workspace.html#a8372edc7102baabc9170836c40548084":[0,0,112,38], -"class_workspace.html#a8677426ffcd80c3fa76ba2f8d6c402d5":[0,0,112,11], -"class_workspace.html#a8af383b55580f7b02eea83df03d125b9":[0,0,112,39], -"class_workspace.html#a8b7645ec6641e9eff52f9d6b8e12b84e":[0,0,112,65], -"class_workspace.html#a8cce4d1259bccce5f7b19ac3284be60e":[0,0,112,4], -"class_workspace.html#a916173d5babcda8af782015e80e3e2ae":[0,0,112,51], -"class_workspace.html#a92ddb55af7ffa45f050f46becb3f520b":[0,0,112,6], -"class_workspace.html#a94db01244419924778d7578332415a97":[0,0,112,1], -"class_workspace.html#a953a0a155f3363ea4834cd471287f7ec":[0,0,112,7], -"class_workspace.html#a96e2691b76f78ca4f63013a299a2338a":[0,0,112,23], -"class_workspace.html#aa072c180c3feee54ee84c13ce4ca9410":[0,0,112,55], -"class_workspace.html#aa8a761564e7ba7820911373ea1990b88":[0,0,112,20], -"class_workspace.html#aaef2ac88b0cb8e204c3bd59fd96eba32":[0,0,112,52], -"class_workspace.html#ab0773cafa9c7127d8985256f0e3a394e":[0,0,112,40], -"class_workspace.html#ab2e997f328f88889b3712bcd3d5d7310":[0,0,112,67], -"class_workspace.html#abe29ae978b1c93569bf60e4d45f0050f":[0,0,112,29], -"class_workspace.html#abf538431670cc5aa24d60393d259b48a":[0,0,112,24], -"class_workspace.html#ac59319d3776983ae607a602d7588a0b9":[0,0,112,68], -"class_workspace.html#acbc1a9429407f3e86da419639c974dc6":[0,0,112,66], -"class_workspace.html#accb1b98baf52125dbc989784aac69074":[0,0,112,58], -"class_workspace.html#acf4e1d561abc0667214619753789ba1c":[0,0,112,53], -"class_workspace.html#acf9d7e1a32e3ba2714aad00558561164":[0,0,112,9], -"class_workspace.html#ad966b16ef1d8216c69c577f17bad4361":[0,0,112,63], -"class_workspace.html#adeefec5df5f908bed2b3c19b1fcd6f95":[0,0,112,41], -"class_workspace.html#ae6537cdff1e5cfb7fea9b096fc8b2cb4":[0,0,112,16], -"class_workspace.html#ae72fd97fa7abdce3615318b8dd5db122":[0,0,112,64], -"class_workspace.html#ae88b97cdf57d4f078fa4c3da4321721f":[0,0,112,32], -"class_workspace.html#aefd3e77c34bf4cd9c937f803c9bee813":[0,0,112,30], -"class_workspace.html#af19b02bb34f824af0c0e736f95a96e51":[0,0,112,37], -"class_workspace.html#af3d21e7fe9eb683b2b4e2c38ab8b1c66":[0,0,112,26], -"class_workspace.html#af7692e86ad24285a8bf7865646e3b3e7":[0,0,112,34], -"class_workspace.html#af7b9721a871221f9c534e7a5af482b8a":[0,0,112,60], -"class_workspace.html#af7cf65a1be2daa086b74e152094a8da8":[0,0,112,44], -"class_workspace.html#afa900c2ba854a6922ad2a28d5e28c4ac":[0,0,112,49], -"class_workspace_base.html":[0,0,113], -"class_workspace_base.html#a10f274f51010decd8dfd872880300c80":[0,0,113,10], -"class_workspace_base.html#a43c2bddd523784d1373f4cfa3d232023":[0,0,113,3], -"class_workspace_base.html#a44f48b6d1f1a412f397fda1cf500ef2f":[0,0,113,5], -"class_workspace_base.html#a514bd173615bc2af5cce766a78c90678":[0,0,113,16], -"class_workspace_base.html#a664285c92d2e58cffd2e0706f36a779c":[0,0,113,15], -"class_workspace_base.html#a70d926c1f83f7510f487f9f1f474083f":[0,0,113,18], -"class_workspace_base.html#a8b2d918751866735d2f8c957c85d5f8a":[0,0,113,11], -"class_workspace_base.html#a8b4c940f21dfd8b6cf20ff6aa05604b3":[0,0,113,13], -"class_workspace_base.html#a9001ad5fa6ab8fbc56efcdd4a79cdc5e":[0,0,113,6], -"class_workspace_base.html#a90d56828276491b843e0da41a7103ce2":[0,0,113,9], -"class_workspace_base.html#a99ad7de77199406140c440afeeb55901":[0,0,113,17], -"class_workspace_base.html#aa7a7fdfc3469fbe895963d956baf7810":[0,0,113,1], -"class_workspace_base.html#aae6d969022b9f998dbf8cb5c50e2ec20":[0,0,113,2], -"class_workspace_base.html#ab025deb21418482cbe2555b1a06bb1a0":[0,0,113,0], -"class_workspace_base.html#abb90fc90faa3b8570a90cc20ee6d1e91":[0,0,113,4], -"class_workspace_base.html#abcf950107b3473a127bd50436529c500":[0,0,113,7], -"class_workspace_base.html#acdab5799f4d3992f0039c39896d2f295":[0,0,113,14], -"class_workspace_base.html#ae004b4c7aa73429ff04be1957c1d4f3d":[0,0,113,12], -"class_workspace_base.html#ae5633aaebc0fcfefb8c404a0747cff73":[0,0,113,8], -"classes.html":[0,1], -"classwx_g_l_number_renderer.html":[0,0,114], -"classwx_g_l_number_renderer.html#a2273ecc04f77d076df5352d2bdb4c3a8":[0,0,114,4], -"classwx_g_l_number_renderer.html#a6ea7d396fd2f435a889ee05d8da67532":[0,0,114,0], -"classwx_g_l_number_renderer.html#a857e30cb8a78f1e6197957110fc339d6":[0,0,114,5], -"classwx_g_l_number_renderer.html#a9de7eec569a559adea04ab66b671ac62":[0,0,114,3], -"classwx_g_l_number_renderer.html#aa79114bda6e5e4c3db4b8aeeb5f272c4":[0,0,114,2], -"classwx_g_l_number_renderer.html#af2a56e95687d52b3f59a27783eb049ec":[0,0,114,1], -"classwx_g_l_string.html":[0,0,115], -"classwx_g_l_string.html#a19e05beb1f5cbf905f4e1cdf5b566303":[0,0,115,0], -"classwx_g_l_string.html#a54a67012ceb50ee50696c0c1fa0a7b55":[0,0,115,5], -"classwx_g_l_string.html#a5845eab608e6a8732ec33a5213eb8015":[0,0,115,8], -"classwx_g_l_string.html#a61de4c6cec06534405b7ecc292b9bd28":[0,0,115,10], -"classwx_g_l_string.html#a6dbedbac054d8835ff98e02b7a2c1801":[0,0,115,1], -"classwx_g_l_string.html#a84cd1aef5211cb85405e7d96d6f2cd36":[0,0,115,11], -"classwx_g_l_string.html#a8d08f71da3521f0a88b8625c348962b7":[0,0,115,4], -"classwx_g_l_string.html#a99128628906c57841225e92b8a77b6dd":[0,0,115,7], -"classwx_g_l_string.html#a9c3779f981d87d2b0707882057ba30c2":[0,0,115,12], -"classwx_g_l_string.html#ab31442170832123f5a0afa2b15fb024a":[0,0,115,3], -"classwx_g_l_string.html#ab7b55ee1f80a1ce7e74805225e747dab":[0,0,115,2], -"classwx_g_l_string.html#ab923a7884ed7652bf0c89f7688671aa4":[0,0,115,6], -"classwx_g_l_string.html#ac2b03c6b32121611472baf33e84fac24":[0,0,115,9], -"classwx_g_l_string_array.html":[0,0,116], -"classwx_g_l_string_array.html#a0c466a4b8f3d5ca954749f8440b5fa0f":[0,0,116,1], -"classwx_g_l_string_array.html#a23176b0de1c1faf839cb9ea539cc1c06":[0,0,116,2], -"classwx_g_l_string_array.html#a2aaa7b340ee571ca6405bbec28715430":[0,0,116,5], -"classwx_g_l_string_array.html#a2ae0c1cffb2f54b66a170d1698ad62e0":[0,0,116,6] +"class_text_texture.html#a028855c450db4925652071c212cce8c7":[0,0,105,0], +"class_text_texture.html#a13d64c6afe292be4ccca8294dd501f0f":[0,0,105,1], +"class_text_texture.html#a4a20344804fa6b34c02a7fd55ad96314":[0,0,105,5], +"class_text_texture.html#a5819c3917f7be6e1fdd1f5d1b617dd2a":[0,0,105,2], +"class_text_texture.html#a61de4c6cec06534405b7ecc292b9bd28":[0,0,105,6], +"class_text_texture.html#a8894b391174ffe37d1d372b8c4a31fe7":[0,0,105,7], +"class_text_texture.html#aa7ab43a57d9767d92ee60933977d66ac":[0,0,105,3], +"class_text_texture.html#ac663a01462a341a279cc4cdf0c500fba":[0,0,105,4], +"class_transfer_function.html":[0,0,106], +"class_transfer_function.html#a0bc542d565e75938699d5e03f3a5e6f0":[0,0,106,15], +"class_transfer_function.html#a0cd1dec850117741abb04b608c7b3f1e":[0,0,106,5], +"class_transfer_function.html#a0cd48b67fbcc1afc400bdf6cadb824b4":[0,0,106,23], +"class_transfer_function.html#a0d4b3da271ecef4ec764a9f26b1ee488":[0,0,106,28], +"class_transfer_function.html#a3312f7e9499aa99742093d3b60547862":[0,0,106,6], +"class_transfer_function.html#a39e20dc5b20657d882fb820ee1178eee":[0,0,106,8], +"class_transfer_function.html#a39ec7eda2cc3737a1502af8bdf2a9bf5":[0,0,106,22], +"class_transfer_function.html#a4d3e5afb04d7196647814339cd15bc3a":[0,0,106,24], +"class_transfer_function.html#a5f09dd8e5c016a90c69a8e38ef302c8a":[0,0,106,3], +"class_transfer_function.html#a630099b92667aa3e4b455fba234d4eda":[0,0,106,10], +"class_transfer_function.html#a6325dec72c7b85178f490c5cf85229bd":[0,0,106,12], +"class_transfer_function.html#a6a4415d2cf0af290494ea30d586cc187":[0,0,106,4], +"class_transfer_function.html#a6b66df900c86cfb848d2e08591a4a0c9":[0,0,106,25], +"class_transfer_function.html#a70e6b38f9b4a45a29b3b2eb4947e8e2f":[0,0,106,7], +"class_transfer_function.html#a966c99fbd03b89662e0a340b7cffe717":[0,0,106,27], +"class_transfer_function.html#a96c6acddec588288c5883416ec926abe":[0,0,106,31], +"class_transfer_function.html#aa16c1f3e18149c153d78e0627a5e9972":[0,0,106,21], +"class_transfer_function.html#ab23ed101f7d4e953e4df0d4d480d9798":[0,0,106,18], +"class_transfer_function.html#ab736fb79486407e626364e1410c263f3":[0,0,106,1], +"class_transfer_function.html#aba60b46f243b3b0c8e9ccdeb391cba27":[0,0,106,2], +"class_transfer_function.html#ac6755bf723a1dfa90ee8254471136429":[0,0,106,29], +"class_transfer_function.html#ad10adb7a94ebc62349cca7b56b7cadb9":[0,0,106,19], +"class_transfer_function.html#ad5e7f4e17ce8ca7d3ab4a2ea2b688438":[0,0,106,14], +"class_transfer_function.html#ad708802d32428ddb20d33910bf348b55":[0,0,106,26], +"class_transfer_function.html#ae145b86db1450a19a3ed32084ee60423":[0,0,106,13], +"class_transfer_function.html#ae1ea0f8351796e932609e1c9494b5e76":[0,0,106,16], +"class_transfer_function.html#aec2d0676d112ccf849c0d3d6f3fee461":[0,0,106,11], +"class_transfer_function.html#aee524d83c25209202ba2b1e8a600ef21":[0,0,106,30], +"class_transfer_function.html#aee6c1440c4f527b7a839e07474a381f0":[0,0,106,9], +"class_transfer_function.html#af8c3f06742a7ffc9dabc0d4f5dbc98c3":[0,0,106,20], +"class_transfer_function.html#afe15de93ab4f93032560a6139091ef10":[0,0,106,17], +"class_transfer_function_form.html":[0,0,107], +"class_transfer_function_form.html#a1c565e92a52dd6e710db7ecf92083f37":[0,0,107,3], +"class_transfer_function_form.html#a27c6a37b520b4e3043ae492d9112a9df":[0,0,107,4], +"class_transfer_function_form.html#a38f692bf981cfb865a6d8d2528aa3b56":[0,0,107,6], +"class_transfer_function_form.html#a45b34337d0dbef9df6e4b35f169ccf98":[0,0,107,1], +"class_transfer_function_form.html#a546e732b865a8054231432df595246c2":[0,0,107,5], +"class_transfer_function_form.html#a681698673fea3d716ee383ae3d9d28eb":[0,0,107,2], +"class_transfer_function_form.html#a87648ffa2b1d88ff18135f1dce46ac97":[0,0,107,7], +"class_transfer_function_form.html#ab3973fc6d0585be5570682674041d21d":[0,0,107,0], +"class_transfer_function_form_base.html":[0,0,108], +"class_transfer_function_form_base.html#a0016c5144bc331f6348bea935bb8cc55":[0,0,108,16], +"class_transfer_function_form_base.html#a008be2fa5d9b01b841ae8689606d9b5b":[0,0,108,4], +"class_transfer_function_form_base.html#a049b09e73946dcca6306d72770e097fd":[0,0,108,18], +"class_transfer_function_form_base.html#a1be29f1cc2a4ecd64b5d368cb7a9dd8c":[0,0,108,14], +"class_transfer_function_form_base.html#a1d5de82c329970e967c75de0f99778ef":[0,0,108,19], +"class_transfer_function_form_base.html#a2be269d1b27821fd3bda48c34d2382be":[0,0,108,15], +"class_transfer_function_form_base.html#a2f8ad120d19ede3c79a2dbee404927d7":[0,0,108,5], +"class_transfer_function_form_base.html#a3dfe2400369e1ca1416b26f265f0ae4b":[0,0,108,3], +"class_transfer_function_form_base.html#a47346c56b626d41c6ddec9fc26060f6d":[0,0,108,13], +"class_transfer_function_form_base.html#a4ce3369a8557eced7b42b878016c9331":[0,0,108,0], +"class_transfer_function_form_base.html#a7f5da321a6297086cc6f5c3ea85be7f0":[0,0,108,1], +"class_transfer_function_form_base.html#a8618a2b5585ac0b665b8fdc3c9ceeae3":[0,0,108,6], +"class_transfer_function_form_base.html#a93731803bc32f17be6ae889182ab5bee":[0,0,108,11], +"class_transfer_function_form_base.html#aa4603a3f49179e61205862faa962ef4b":[0,0,108,8], +"class_transfer_function_form_base.html#aa8839934e71bf16b63a5cff34679be4b":[0,0,108,10], +"class_transfer_function_form_base.html#ab70bd59a35d2c588291e0fd65b7b043c":[0,0,108,9], +"class_transfer_function_form_base.html#ae1a557b170a2966b73a87d6ffd6eaf0e":[0,0,108,12], +"class_transfer_function_form_base.html#ae208b4b2e42f9d9e021e1db483b3c481":[0,0,108,2], +"class_transfer_function_form_base.html#afba56679122dbb55dce1ebf34482e519":[0,0,108,7], +"class_transfer_function_form_base.html#afca69d20a9b8f361e074ab5553f016b0":[0,0,108,17], +"class_transformer.html":[0,0,109], +"class_transformer.html#a0395a11dc8173e511a0596ac96bf05e5":[0,0,109,21], +"class_transformer.html#a169064f996341f8f8b6881c6a3909f0b":[0,0,109,10], +"class_transformer.html#a1e9e9ba48aa76bdd2ff2e973014ad422":[0,0,109,5], +"class_transformer.html#a286bcc94f7202a6ff81b66707424a9bd":[0,0,109,7], +"class_transformer.html#a312583e28394926c746f133137345c9d":[0,0,109,1], +"class_transformer.html#a31a3dc18c483d67b4a03038563ecce38":[0,0,109,16], +"class_transformer.html#a327ff3cf9194c18049e4feac6761ebc0":[0,0,109,4], +"class_transformer.html#a328c419af15701734168c8db62eefa36":[0,0,109,19], +"class_transformer.html#a39b58fcf230970601c5d77c088559731":[0,0,109,11], +"class_transformer.html#a4e70f875967e60d8202fb6e3c6e3f79a":[0,0,109,9], +"class_transformer.html#a4f9137e6190fb630167f671a0da51ab6":[0,0,109,17], +"class_transformer.html#a504e72295ea190d9956c5055645a96d1":[0,0,109,8], +"class_transformer.html#a67f1e2686932700fe8a83fdc232ea1e8":[0,0,109,12], +"class_transformer.html#a7d56456dadf3aa0bc60f59e7e7eda7a2":[0,0,109,0], +"class_transformer.html#a7e3cd54e20d795ab9b0b8533ce03b728":[0,0,109,18], +"class_transformer.html#a9652232a076cca0fe3753477ec88f63a":[0,0,109,13], +"class_transformer.html#aa1f87f24c062258b1437be648032bb6e":[0,0,109,22], +"class_transformer.html#aaa6cc999eb77a94dafaec5debb4db3de":[0,0,109,14], +"class_transformer.html#acb55f182a7f6d7af0feb6a94cb62af4f":[0,0,109,20], +"class_transformer.html#ad2f2bcd287bd3bb3221ab584f2c2fc90":[0,0,109,23], +"class_transformer.html#adf0b20286f3de359346b8877d65c1996":[0,0,109,15], +"class_transformer.html#adfe51a2198cfc10e1095af9c034681bd":[0,0,109,6], +"class_transformer.html#ae2f7b06be0f585ab586ee501ad59285c":[0,0,109,2], +"class_transformer.html#aea52a4562ec5b4a79bf82b8ede32ecc6":[0,0,109,3], +"class_transformer_form.html":[0,0,111], +"class_transformer_form.html#a10f5f72d1fc3882d229a54ba4522154a":[0,0,111,5], +"class_transformer_form.html#a71966865b6a286c22034ef50849513ab":[0,0,111,4], +"class_transformer_form.html#a72d54f5a59363d33b02e9467833c0b6b":[0,0,111,3], +"class_transformer_form.html#a737b66275ba708412a06dd764510a968":[0,0,111,2], +"class_transformer_form.html#a8cac1e9fdb77f140db36c4efe2e0555c":[0,0,111,0], +"class_transformer_form.html#ac1db49bd821dd82b25737686ae394103":[0,0,111,6], +"class_transformer_form.html#ad227425d57a1a8b8b6209cd55ebdbd80":[0,0,111,7], +"class_transformer_form.html#af9ab8a52f336a931e5e690ad8f0fc903":[0,0,111,1], +"class_transformer_form_base.html":[0,0,112], +"class_transformer_form_base.html#a022d3748ff4c570aea35538a463b6773":[0,0,112,43], +"class_transformer_form_base.html#a0284032d1298fb2ad4ac2eb427077914":[0,0,112,36], +"class_transformer_form_base.html#a03bf43a865e368c51afeabd81bd5d8ee":[0,0,112,86], +"class_transformer_form_base.html#a045b70a953da5049d4f5d853a9ec8ed4":[0,0,112,52], +"class_transformer_form_base.html#a04c92b7d29cd3375a1415764aa536406":[0,0,112,51], +"class_transformer_form_base.html#a0d466ffb4b1f4c1bd026c5f3f46a4c79":[0,0,112,21], +"class_transformer_form_base.html#a0dd7a20e78c4effd68da4764109bb4f1":[0,0,112,29], +"class_transformer_form_base.html#a113edf034a7f07f84bedf62bda482ddc":[0,0,112,24], +"class_transformer_form_base.html#a13f64e73b1906163fd4faea4c76dda20":[0,0,112,5], +"class_transformer_form_base.html#a1a021847167a55f2050d974fbe6529ae":[0,0,112,3], +"class_transformer_form_base.html#a1b799c8717841772b84dbd4268b5d33f":[0,0,112,83], +"class_transformer_form_base.html#a24caf79933c5ce7224e7787b9887ff80":[0,0,112,85], +"class_transformer_form_base.html#a253fe9d0a6aac89813e38304a27e239f":[0,0,112,87], +"class_transformer_form_base.html#a270bc4d0bbedcd942902757783643fe4":[0,0,112,76], +"class_transformer_form_base.html#a2cc878c4779f0ba73d5deb700759ecb0":[0,0,112,1], +"class_transformer_form_base.html#a2fde91e5014982d570274e407362dae4":[0,0,112,50], +"class_transformer_form_base.html#a38c21aed3d1fd4fd4e1ba41f3a138d3e":[0,0,112,10], +"class_transformer_form_base.html#a3f434986c270c39b3b68f359b0e9ee9a":[0,0,112,82], +"class_transformer_form_base.html#a4487a3bc92e5539f19fd42c0d5506e3d":[0,0,112,58], +"class_transformer_form_base.html#a49c8239313228c0843d089ef5d63dd55":[0,0,112,37], +"class_transformer_form_base.html#a4d2e10a6c0358a578deb65acf6295b9d":[0,0,112,9], +"class_transformer_form_base.html#a4f8d3c5594371b78264cbc159de95fbc":[0,0,112,62], +"class_transformer_form_base.html#a50fc4ce1b4dda224a1a0f711bfc9f26c":[0,0,112,18], +"class_transformer_form_base.html#a531e49e6a056144e2f5047286e8a16da":[0,0,112,32], +"class_transformer_form_base.html#a55e86e376d766493f443fef08ff58fd8":[0,0,112,17], +"class_transformer_form_base.html#a5706999e17e2932b972187736419d505":[0,0,112,57], +"class_transformer_form_base.html#a5a687a0a567cc31b15b0adc96460079e":[0,0,112,66], +"class_transformer_form_base.html#a5c748e72231caaa693337347a343ee64":[0,0,112,30], +"class_transformer_form_base.html#a610937e52d3ca590618a992d33a0eeb6":[0,0,112,71], +"class_transformer_form_base.html#a640f38342e6d516d172eef982e952a7f":[0,0,112,60], +"class_transformer_form_base.html#a69e14483db595799ff4baf5cf1e23e59":[0,0,112,72], +"class_transformer_form_base.html#a6b826cda74882238c54280b1b727fa5d":[0,0,112,46], +"class_transformer_form_base.html#a6dbb4bd37b20982632dd728ff855b870":[0,0,112,27], +"class_transformer_form_base.html#a70c25076ba3a28f31822cb2f1273fbb6":[0,0,112,2], +"class_transformer_form_base.html#a714a3a0d023771c3dcee367b709a297e":[0,0,112,26], +"class_transformer_form_base.html#a7870d1ac8852c45cc58fbd290a6acef3":[0,0,112,13], +"class_transformer_form_base.html#a7bdcbe2ed487ba2da498d7a6c7ac8e7a":[0,0,112,14], +"class_transformer_form_base.html#a7d718aac8c90366c98d7ee94f382d62f":[0,0,112,53], +"class_transformer_form_base.html#a7e8def6859b1e38fd3c91bfe6288bb73":[0,0,112,56], +"class_transformer_form_base.html#a7fe977bdfe8780749bc3ee987a7729b7":[0,0,112,40], +"class_transformer_form_base.html#a807fc537dbf283a9b7ff6cbef2dbcc00":[0,0,112,34], +"class_transformer_form_base.html#a811b577ff9fd83c437379455d7e52c53":[0,0,112,63], +"class_transformer_form_base.html#a844597ca569fe6b06d77284c2f06b279":[0,0,112,61], +"class_transformer_form_base.html#a85a92227216e9ce953b121c97f96c5f2":[0,0,112,42], +"class_transformer_form_base.html#a88bd7d74f839e3cec36b15ebd7651948":[0,0,112,55], +"class_transformer_form_base.html#a8df8a1bcbf215b3e466595beb30f68d8":[0,0,112,59], +"class_transformer_form_base.html#a8e4d2a3046c69b01bd705ae652bdea86":[0,0,112,67], +"class_transformer_form_base.html#a8ec2523003aa34d4f84a81de3cbbbdd5":[0,0,112,23], +"class_transformer_form_base.html#a9307de748d184dc5f00bdaaa9a09fb6c":[0,0,112,48], +"class_transformer_form_base.html#a9357f82f40ce6a73eb4bff990d5ccead":[0,0,112,88], +"class_transformer_form_base.html#a96c25a55ea50c18e14022f2ff00a5051":[0,0,112,80], +"class_transformer_form_base.html#a98efcfc4d7455dad70c87c9de30a26d0":[0,0,112,20], +"class_transformer_form_base.html#a99f0a3d39c149d1d8ae1b478bb1ecce2":[0,0,112,22], +"class_transformer_form_base.html#aa1c6bbea49f60eb9962b07146757da64":[0,0,112,65], +"class_transformer_form_base.html#aa1e990df75f9e6025ed38b601851b914":[0,0,112,49], +"class_transformer_form_base.html#aa665859e3b696bef4b146f1efbab0eca":[0,0,112,81], +"class_transformer_form_base.html#aa69ec87ce83152dbf30ca86ef9a431c6":[0,0,112,8], +"class_transformer_form_base.html#aabdd5f43e5379ecd03f6a01086fa8e98":[0,0,112,15], +"class_transformer_form_base.html#ab31a2c526cb74f229e4340e01ab0e71e":[0,0,112,84], +"class_transformer_form_base.html#ab3290af329387311274652c78e978512":[0,0,112,74], +"class_transformer_form_base.html#ab3ab36d5d0be6e5cd6cd41b88616f8b4":[0,0,112,79], +"class_transformer_form_base.html#ab88da886634ae9d6d0f010c80053d457":[0,0,112,31], +"class_transformer_form_base.html#ac1cf3e353c40d74eeef6c3822a1c2c03":[0,0,112,11], +"class_transformer_form_base.html#ac38779c0e258f370854243eb6b31986f":[0,0,112,6], +"class_transformer_form_base.html#ac3d86f996ce77b7855b925c85c3f7317":[0,0,112,35], +"class_transformer_form_base.html#ac506972ad5a38969111a0e23357fdfde":[0,0,112,16], +"class_transformer_form_base.html#ac7e3d90ed49d3343237c7f170429e743":[0,0,112,28], +"class_transformer_form_base.html#ac88dea58cbb0dd8a93f2e2e6040ec823":[0,0,112,4], +"class_transformer_form_base.html#ac9880a1a9c0b6be177714b95396108de":[0,0,112,70], +"class_transformer_form_base.html#acdd32c513f7d4a1eb23ac55ab3d28995":[0,0,112,45], +"class_transformer_form_base.html#acfcddec0baebd8c6885c26224bbfa280":[0,0,112,12], +"class_transformer_form_base.html#ad1425a7f7ab1862cafb87f08f364ba8e":[0,0,112,75], +"class_transformer_form_base.html#ad1624c0498b54b5b0beb3f77d85f687d":[0,0,112,41], +"class_transformer_form_base.html#ad3c02626ca03e34914137d1b41f530e6":[0,0,112,73], +"class_transformer_form_base.html#ad3c3cfd26566f06a0c0fe9d116648e37":[0,0,112,68], +"class_transformer_form_base.html#ad62929ebbf445d52d283f863a77ccd1b":[0,0,112,77], +"class_transformer_form_base.html#ad96d875c08ef54e86ebccbf0c326598d":[0,0,112,33], +"class_transformer_form_base.html#adc8d387589bb5acdd75d4bbd985ad243":[0,0,112,69], +"class_transformer_form_base.html#ade4e3e90c5c0f4f0abe278ffba2443a0":[0,0,112,44], +"class_transformer_form_base.html#ade72da576a6bcd2182798e449f8ce8d5":[0,0,112,38], +"class_transformer_form_base.html#ae0c2fbf9475ee1e780896fa89c14b878":[0,0,112,0], +"class_transformer_form_base.html#ae2196cf62a3c277247a112d7971872b0":[0,0,112,78], +"class_transformer_form_base.html#ae7a24e53da32b8caf67fc5ef39618743":[0,0,112,54], +"class_transformer_form_base.html#aee0b43085f009f2517994967d080b794":[0,0,112,7], +"class_transformer_form_base.html#aee7759b13cf93e4722e7514f4ddcfa8f":[0,0,112,39], +"class_transformer_form_base.html#af01e4be05d790d0a2236846899418b53":[0,0,112,19], +"class_transformer_form_base.html#af088bc27c75828d7829f18c4c4a5d7df":[0,0,112,64], +"class_transformer_form_base.html#af1394f18900292398f9f317341f1e727":[0,0,112,25], +"class_transformer_form_base.html#af65e4801b524b44b075a6218777777f0":[0,0,112,47], +"class_workspace.html":[0,0,113], +"class_workspace.html#a013bdfced9e47c0a11d378409cda1376":[0,0,113,62], +"class_workspace.html#a057257829453518249ebc0fc971c2a68":[0,0,113,47], +"class_workspace.html#a0f25d318ff7310d11e510239953b92fc":[0,0,113,8], +"class_workspace.html#a10c751ef894a1ce02ca401a0a60b3333":[0,0,113,3], +"class_workspace.html#a16047d114ac4c9708eccf87ddc93c57f":[0,0,113,59], +"class_workspace.html#a16b55585d4fa51fc3a565df2ce16997e":[0,0,113,69], +"class_workspace.html#a239e2b579a4c1b640b4f5e2640c61044":[0,0,113,70], +"class_workspace.html#a259249b912ae1caae1c166eb2f9f4123":[0,0,113,25], +"class_workspace.html#a26add99100a783d857b52fe497d5a209":[0,0,113,71], +"class_workspace.html#a29e232a2810f36222f0b1ba2f775f606":[0,0,113,5], +"class_workspace.html#a2c1f915ba189d1dc3b9088fd79b2f31a":[0,0,113,54], +"class_workspace.html#a38a886655d99aae4dbaeec88e7f855ce":[0,0,113,19], +"class_workspace.html#a3ffd9682e5898f467b54748c5277e239":[0,0,113,2], +"class_workspace.html#a444c05695fd50548fa025a97567e8a55":[0,0,113,73], +"class_workspace.html#a47405d47dd54d98cd0b5e323a5cf9071":[0,0,113,43], +"class_workspace.html#a49bec4c0ddb83d1bcfe4bb6cdf688864":[0,0,113,21], +"class_workspace.html#a4fa9ee617ed7da22b84eced403bb512e":[0,0,113,48], +"class_workspace.html#a52b015440855fbab2ae1ba7a229a36c7":[0,0,113,31], +"class_workspace.html#a5347e4a880ed744ef20da988aaac534f":[0,0,113,72], +"class_workspace.html#a58e7526fe48d3fbff16c7bf7ac607b0c":[0,0,113,35], +"class_workspace.html#a5b71e0ec48f1d9ae1ce9e01b546c01b1":[0,0,113,18], +"class_workspace.html#a5bc77206269e7abdd75085b90385e934":[0,0,113,27], +"class_workspace.html#a5c7dcb5b022b37bce0647aab42bc764a":[0,0,113,57], +"class_workspace.html#a61dd47c1c36cab51f67f6652e560b635":[0,0,113,36], +"class_workspace.html#a6658ab0800105042a29b6fea1102f873":[0,0,113,50], +"class_workspace.html#a691c80813f2f2f15bfb79db5edddf22a":[0,0,113,42], +"class_workspace.html#a69ed8a7449993602944683f9a9584fe1":[0,0,113,45], +"class_workspace.html#a6c024a0381b8515287ff82a0c135a285":[0,0,113,14], +"class_workspace.html#a6c46f1e54734c198b47134fa829f5914":[0,0,113,0], +"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a094a29399033e02e51fd013eac5f8bc3":[0,0,113,0,3], +"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a253dcdbf5c54e7de2489b54098e29161":[0,0,113,0,5], +"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a32cb1102be505f27ae0255d9e3834acc":[0,0,113,0,4], +"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a36270dbb58538c00a5b009916dda4748":[0,0,113,0,9], +"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a3e1fead750fbde2a9bf75f457f387e1c":[0,0,113,0,1], +"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a3f2c5b345a9ac7d8dfcd2b51a6becc2c":[0,0,113,0,0], +"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a48963bc6da69eeee46985e57383a6831":[0,0,113,0,10], +"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a92c16301deb027b1bad37c54f7432482":[0,0,113,0,6], +"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a94ed0030aad40a766af3d97b8cbb55df":[0,0,113,0,7], +"class_workspace.html#a6c46f1e54734c198b47134fa829f5914a990ae713f0e72eab71de6b77c3bf412f":[0,0,113,0,11], +"class_workspace.html#a6c46f1e54734c198b47134fa829f5914ae98c91e3a672a7b48020d41234f65056":[0,0,113,0,2], +"class_workspace.html#a6c46f1e54734c198b47134fa829f5914aff456a8f97d89f415295642cfc4e7411":[0,0,113,0,8], +"class_workspace.html#a6d84b8d85526f1194667606429a3a315":[0,0,113,56], +"class_workspace.html#a6e1788b16636c60be5bf0b0bbc0a3a26":[0,0,113,33], +"class_workspace.html#a6e5a3440a86e3afc1336740aac1efbe1":[0,0,113,22], +"class_workspace.html#a6f2dcf924f95cb2b2216057a0fc53f41":[0,0,113,10], +"class_workspace.html#a709ba1bac8061b82a91e225effd22621":[0,0,113,15], +"class_workspace.html#a735b10c59c133a6c81be7432a8978e8b":[0,0,113,13], +"class_workspace.html#a758abd23ac6f327899e9761da653b40e":[0,0,113,17], +"class_workspace.html#a773f2c59738a7b546e032509822aaba4":[0,0,113,61], +"class_workspace.html#a7a940cc3edfa6da2ecc4f3555eb2259b":[0,0,113,46], +"class_workspace.html#a810b16fadd522ab40335c7533e051d6f":[0,0,113,28], +"class_workspace.html#a82d91c594e8ae5d2dc72ea4384abe24f":[0,0,113,12], +"class_workspace.html#a8372edc7102baabc9170836c40548084":[0,0,113,38], +"class_workspace.html#a8677426ffcd80c3fa76ba2f8d6c402d5":[0,0,113,11], +"class_workspace.html#a8af383b55580f7b02eea83df03d125b9":[0,0,113,39] }; diff --git a/docs/doxygen/html/navtreeindex12.js b/docs/doxygen/html/navtreeindex12.js index 709bee7..59df8ab 100644 --- a/docs/doxygen/html/navtreeindex12.js +++ b/docs/doxygen/html/navtreeindex12.js @@ -1,42 +1,120 @@ var NAVTREEINDEX12 = { -"classwx_g_l_string_array.html#a6923a709d67ada5b713549bc706bdddd":[0,0,116,7], -"classwx_g_l_string_array.html#a692adb887740de68eaf6ca5f2e16e1f6":[0,0,116,4], -"classwx_g_l_string_array.html#a9d0ea419b455d761b87c8d4262f84296":[0,0,116,0], -"classwx_g_l_string_array.html#aad1fd8d228a9a09bd1e66734323a4ae9":[0,0,116,3], -"classwx_ribbon_metro_art_provider.html":[0,0,117], -"classwx_ribbon_metro_art_provider.html#a0250fb1979f81476371fc886b8755256":[0,0,117,12], -"classwx_ribbon_metro_art_provider.html#a21c0087bfaeb96c12ce79a525ae28720":[0,0,117,6], -"classwx_ribbon_metro_art_provider.html#a332747bb53451624c0dc43c52f841a63":[0,0,117,8], -"classwx_ribbon_metro_art_provider.html#a345e45b2b6c57daf85bd76a239030a6f":[0,0,117,17], -"classwx_ribbon_metro_art_provider.html#a34d74c8db77b5816d4abcc6ed5d59af1":[0,0,117,14], -"classwx_ribbon_metro_art_provider.html#a35a27a5153c93e06e72bf9fdc04c6f1a":[0,0,117,19], -"classwx_ribbon_metro_art_provider.html#a35ac28082f0511e0b64b25c40bd0afb0":[0,0,117,13], -"classwx_ribbon_metro_art_provider.html#a4c387b3273a285e2b71870116b8c3f03":[0,0,117,11], -"classwx_ribbon_metro_art_provider.html#a533d512aee4deca9811473b10a7323bb":[0,0,117,15], -"classwx_ribbon_metro_art_provider.html#a574ce6f88f78c2e410d46092472d2a19":[0,0,117,0], -"classwx_ribbon_metro_art_provider.html#a5e448d44cf6d30306a41af61b0ae274f":[0,0,117,2], -"classwx_ribbon_metro_art_provider.html#a64892cbeb4809a944158eeeb64521992":[0,0,117,3], -"classwx_ribbon_metro_art_provider.html#a759a02e3e441488c219d596ddb4c8786":[0,0,117,4], -"classwx_ribbon_metro_art_provider.html#a7e53b3b4a62c47038101884810e596af":[0,0,117,18], -"classwx_ribbon_metro_art_provider.html#a81144b6e0b02420483f278b00cfbe7b0":[0,0,117,16], -"classwx_ribbon_metro_art_provider.html#a855f255d269011d9be59a13c564215a5":[0,0,117,5], -"classwx_ribbon_metro_art_provider.html#a9cbceb0409721d370a292916bb402a9d":[0,0,117,9], -"classwx_ribbon_metro_art_provider.html#a9f9d8ec71db1a8bbfab5a88b2ae16c76":[0,0,117,7], -"classwx_ribbon_metro_art_provider.html#aa57e1377a49cca4b87f1673b2b70a371":[0,0,117,1], -"classwx_ribbon_metro_art_provider.html#aa6e300b7a5419c7d429a26beed0c95a8":[0,0,117,10], +"class_workspace.html#a8b7645ec6641e9eff52f9d6b8e12b84e":[0,0,113,65], +"class_workspace.html#a8cce4d1259bccce5f7b19ac3284be60e":[0,0,113,4], +"class_workspace.html#a916173d5babcda8af782015e80e3e2ae":[0,0,113,51], +"class_workspace.html#a92ddb55af7ffa45f050f46becb3f520b":[0,0,113,6], +"class_workspace.html#a94db01244419924778d7578332415a97":[0,0,113,1], +"class_workspace.html#a953a0a155f3363ea4834cd471287f7ec":[0,0,113,7], +"class_workspace.html#a96e2691b76f78ca4f63013a299a2338a":[0,0,113,23], +"class_workspace.html#aa072c180c3feee54ee84c13ce4ca9410":[0,0,113,55], +"class_workspace.html#aa8a761564e7ba7820911373ea1990b88":[0,0,113,20], +"class_workspace.html#aaef2ac88b0cb8e204c3bd59fd96eba32":[0,0,113,52], +"class_workspace.html#ab0773cafa9c7127d8985256f0e3a394e":[0,0,113,40], +"class_workspace.html#ab2e997f328f88889b3712bcd3d5d7310":[0,0,113,67], +"class_workspace.html#abe29ae978b1c93569bf60e4d45f0050f":[0,0,113,29], +"class_workspace.html#abf538431670cc5aa24d60393d259b48a":[0,0,113,24], +"class_workspace.html#ac59319d3776983ae607a602d7588a0b9":[0,0,113,68], +"class_workspace.html#acbc1a9429407f3e86da419639c974dc6":[0,0,113,66], +"class_workspace.html#accb1b98baf52125dbc989784aac69074":[0,0,113,58], +"class_workspace.html#acf4e1d561abc0667214619753789ba1c":[0,0,113,53], +"class_workspace.html#acf9d7e1a32e3ba2714aad00558561164":[0,0,113,9], +"class_workspace.html#ad966b16ef1d8216c69c577f17bad4361":[0,0,113,63], +"class_workspace.html#adeefec5df5f908bed2b3c19b1fcd6f95":[0,0,113,41], +"class_workspace.html#ae6537cdff1e5cfb7fea9b096fc8b2cb4":[0,0,113,16], +"class_workspace.html#ae72fd97fa7abdce3615318b8dd5db122":[0,0,113,64], +"class_workspace.html#ae88b97cdf57d4f078fa4c3da4321721f":[0,0,113,32], +"class_workspace.html#aefd3e77c34bf4cd9c937f803c9bee813":[0,0,113,30], +"class_workspace.html#af19b02bb34f824af0c0e736f95a96e51":[0,0,113,37], +"class_workspace.html#af3d21e7fe9eb683b2b4e2c38ab8b1c66":[0,0,113,26], +"class_workspace.html#af7692e86ad24285a8bf7865646e3b3e7":[0,0,113,34], +"class_workspace.html#af7b9721a871221f9c534e7a5af482b8a":[0,0,113,60], +"class_workspace.html#af7cf65a1be2daa086b74e152094a8da8":[0,0,113,44], +"class_workspace.html#afa900c2ba854a6922ad2a28d5e28c4ac":[0,0,113,49], +"class_workspace_base.html":[0,0,114], +"class_workspace_base.html#a10f274f51010decd8dfd872880300c80":[0,0,114,10], +"class_workspace_base.html#a43c2bddd523784d1373f4cfa3d232023":[0,0,114,3], +"class_workspace_base.html#a44f48b6d1f1a412f397fda1cf500ef2f":[0,0,114,5], +"class_workspace_base.html#a514bd173615bc2af5cce766a78c90678":[0,0,114,16], +"class_workspace_base.html#a664285c92d2e58cffd2e0706f36a779c":[0,0,114,15], +"class_workspace_base.html#a70d926c1f83f7510f487f9f1f474083f":[0,0,114,18], +"class_workspace_base.html#a8b2d918751866735d2f8c957c85d5f8a":[0,0,114,11], +"class_workspace_base.html#a8b4c940f21dfd8b6cf20ff6aa05604b3":[0,0,114,13], +"class_workspace_base.html#a9001ad5fa6ab8fbc56efcdd4a79cdc5e":[0,0,114,6], +"class_workspace_base.html#a90d56828276491b843e0da41a7103ce2":[0,0,114,9], +"class_workspace_base.html#a99ad7de77199406140c440afeeb55901":[0,0,114,17], +"class_workspace_base.html#aa7a7fdfc3469fbe895963d956baf7810":[0,0,114,1], +"class_workspace_base.html#aae6d969022b9f998dbf8cb5c50e2ec20":[0,0,114,2], +"class_workspace_base.html#ab025deb21418482cbe2555b1a06bb1a0":[0,0,114,0], +"class_workspace_base.html#abb90fc90faa3b8570a90cc20ee6d1e91":[0,0,114,4], +"class_workspace_base.html#abcf950107b3473a127bd50436529c500":[0,0,114,7], +"class_workspace_base.html#acdab5799f4d3992f0039c39896d2f295":[0,0,114,14], +"class_workspace_base.html#ae004b4c7aa73429ff04be1957c1d4f3d":[0,0,114,12], +"class_workspace_base.html#ae5633aaebc0fcfefb8c404a0747cff73":[0,0,114,8], +"classes.html":[0,1], +"classwx_g_l_number_renderer.html":[0,0,115], +"classwx_g_l_number_renderer.html#a2273ecc04f77d076df5352d2bdb4c3a8":[0,0,115,4], +"classwx_g_l_number_renderer.html#a6ea7d396fd2f435a889ee05d8da67532":[0,0,115,0], +"classwx_g_l_number_renderer.html#a857e30cb8a78f1e6197957110fc339d6":[0,0,115,5], +"classwx_g_l_number_renderer.html#a9de7eec569a559adea04ab66b671ac62":[0,0,115,3], +"classwx_g_l_number_renderer.html#aa79114bda6e5e4c3db4b8aeeb5f272c4":[0,0,115,2], +"classwx_g_l_number_renderer.html#af2a56e95687d52b3f59a27783eb049ec":[0,0,115,1], +"classwx_g_l_string.html":[0,0,116], +"classwx_g_l_string.html#a19e05beb1f5cbf905f4e1cdf5b566303":[0,0,116,0], +"classwx_g_l_string.html#a54a67012ceb50ee50696c0c1fa0a7b55":[0,0,116,5], +"classwx_g_l_string.html#a5845eab608e6a8732ec33a5213eb8015":[0,0,116,8], +"classwx_g_l_string.html#a61de4c6cec06534405b7ecc292b9bd28":[0,0,116,10], +"classwx_g_l_string.html#a6dbedbac054d8835ff98e02b7a2c1801":[0,0,116,1], +"classwx_g_l_string.html#a84cd1aef5211cb85405e7d96d6f2cd36":[0,0,116,11], +"classwx_g_l_string.html#a8d08f71da3521f0a88b8625c348962b7":[0,0,116,4], +"classwx_g_l_string.html#a99128628906c57841225e92b8a77b6dd":[0,0,116,7], +"classwx_g_l_string.html#a9c3779f981d87d2b0707882057ba30c2":[0,0,116,12], +"classwx_g_l_string.html#ab31442170832123f5a0afa2b15fb024a":[0,0,116,3], +"classwx_g_l_string.html#ab7b55ee1f80a1ce7e74805225e747dab":[0,0,116,2], +"classwx_g_l_string.html#ab923a7884ed7652bf0c89f7688671aa4":[0,0,116,6], +"classwx_g_l_string.html#ac2b03c6b32121611472baf33e84fac24":[0,0,116,9], +"classwx_g_l_string_array.html":[0,0,117], +"classwx_g_l_string_array.html#a0c466a4b8f3d5ca954749f8440b5fa0f":[0,0,117,1], +"classwx_g_l_string_array.html#a23176b0de1c1faf839cb9ea539cc1c06":[0,0,117,2], +"classwx_g_l_string_array.html#a2aaa7b340ee571ca6405bbec28715430":[0,0,117,5], +"classwx_g_l_string_array.html#a2ae0c1cffb2f54b66a170d1698ad62e0":[0,0,117,6], +"classwx_g_l_string_array.html#a6923a709d67ada5b713549bc706bdddd":[0,0,117,7], +"classwx_g_l_string_array.html#a692adb887740de68eaf6ca5f2e16e1f6":[0,0,117,4], +"classwx_g_l_string_array.html#a9d0ea419b455d761b87c8d4262f84296":[0,0,117,0], +"classwx_g_l_string_array.html#aad1fd8d228a9a09bd1e66734323a4ae9":[0,0,117,3], +"classwx_ribbon_metro_art_provider.html":[0,0,118], +"classwx_ribbon_metro_art_provider.html#a0250fb1979f81476371fc886b8755256":[0,0,118,12], +"classwx_ribbon_metro_art_provider.html#a21c0087bfaeb96c12ce79a525ae28720":[0,0,118,6], +"classwx_ribbon_metro_art_provider.html#a332747bb53451624c0dc43c52f841a63":[0,0,118,8], +"classwx_ribbon_metro_art_provider.html#a345e45b2b6c57daf85bd76a239030a6f":[0,0,118,17], +"classwx_ribbon_metro_art_provider.html#a34d74c8db77b5816d4abcc6ed5d59af1":[0,0,118,14], +"classwx_ribbon_metro_art_provider.html#a35a27a5153c93e06e72bf9fdc04c6f1a":[0,0,118,19], +"classwx_ribbon_metro_art_provider.html#a35ac28082f0511e0b64b25c40bd0afb0":[0,0,118,13], +"classwx_ribbon_metro_art_provider.html#a4c387b3273a285e2b71870116b8c3f03":[0,0,118,11], +"classwx_ribbon_metro_art_provider.html#a533d512aee4deca9811473b10a7323bb":[0,0,118,15], +"classwx_ribbon_metro_art_provider.html#a574ce6f88f78c2e410d46092472d2a19":[0,0,118,0], +"classwx_ribbon_metro_art_provider.html#a5e448d44cf6d30306a41af61b0ae274f":[0,0,118,2], +"classwx_ribbon_metro_art_provider.html#a64892cbeb4809a944158eeeb64521992":[0,0,118,3], +"classwx_ribbon_metro_art_provider.html#a759a02e3e441488c219d596ddb4c8786":[0,0,118,4], +"classwx_ribbon_metro_art_provider.html#a7e53b3b4a62c47038101884810e596af":[0,0,118,18], +"classwx_ribbon_metro_art_provider.html#a81144b6e0b02420483f278b00cfbe7b0":[0,0,118,16], +"classwx_ribbon_metro_art_provider.html#a855f255d269011d9be59a13c564215a5":[0,0,118,5], +"classwx_ribbon_metro_art_provider.html#a9cbceb0409721d370a292916bb402a9d":[0,0,118,9], +"classwx_ribbon_metro_art_provider.html#a9f9d8ec71db1a8bbfab5a88b2ae16c76":[0,0,118,7], +"classwx_ribbon_metro_art_provider.html#aa57e1377a49cca4b87f1673b2b70a371":[0,0,118,1], +"classwx_ribbon_metro_art_provider.html#aa6e300b7a5419c7d429a26beed0c95a8":[0,0,118,10], "dir_ffd1f789ec7bd0a45fc6ad92579c5070.html":[1,0,0], "files.html":[1,0], -"functions.html":[0,3,0,0], "functions.html":[0,3,0], -"functions_0x7e.html":[0,3,0,17], +"functions.html":[0,3,0,0], +"functions_0x7e.html":[0,3,0,18], "functions_b.html":[0,3,0,1], "functions_c.html":[0,3,0,2], "functions_d.html":[0,3,0,3], "functions_e.html":[0,3,0,4], "functions_f.html":[0,3,0,5], -"functions_func.html":[0,3,1,0], "functions_func.html":[0,3,1], +"functions_func.html":[0,3,1,0], "functions_func_0x7e.html":[0,3,1,17], "functions_func_b.html":[0,3,1,1], "functions_func_c.html":[0,3,1,2], @@ -66,6 +144,7 @@ var NAVTREEINDEX12 = "functions_u.html":[0,3,0,15], "functions_vars.html":[0,3,2], "functions_w.html":[0,3,0,16], +"functions_x.html":[0,3,0,17], "globals.html":[1,1,0], "globals_enum.html":[1,1,1], "globals_eval.html":[1,1,2], @@ -170,84 +249,5 @@ var NAVTREEINDEX12 = "struct_simulation_data.html#ab8e32dc510771960d6d6612e80ddbae6":[0,0,85,7], "struct_simulation_data.html#ac8073342d75faf98fb15ff5100fdc711":[0,0,85,13], "struct_simulation_data.html#ac9bad1814e79451a2fd2f6afcee7016b":[0,0,85,12], -"struct_simulation_data.html#adf9aa7a02213374ac15439e8929f0179":[0,0,85,6], -"struct_simulation_data.html#af0ca3cdcc810fcba377e5c6e2bcd71b5":[0,0,85,14], -"struct_simulation_data.html#af5b66ffff262e5d7c49835c1fb57b302":[0,0,85,3], -"struct_switching_data.html":[0,0,91], -"struct_switching_data.html#a3323745bf0a3f6461fbc19bc76a189df":[0,0,91,0], -"struct_switching_data.html#af78fb958137a0532ea2a584810708574":[0,0,91,1], -"struct_sync_generator_electrical_data.html":[0,0,95], -"struct_sync_generator_electrical_data.html#a02ea43b57770200f43686b21d6f5bee7":[0,0,95,4], -"struct_sync_generator_electrical_data.html#a039151f15d01a6b70c13674894034350":[0,0,95,14], -"struct_sync_generator_electrical_data.html#a120f89adf2d52ae106e3d99fa7453a0d":[0,0,95,62], -"struct_sync_generator_electrical_data.html#a124840d7c73161bb4187aa5215969647":[0,0,95,41], -"struct_sync_generator_electrical_data.html#a13371480bdeca2be90140e3c168ee9a7":[0,0,95,21], -"struct_sync_generator_electrical_data.html#a1405e96b81978e44e60dc535fbe08f47":[0,0,95,38], -"struct_sync_generator_electrical_data.html#a16117d43dd668998854692abaf289c5f":[0,0,95,36], -"struct_sync_generator_electrical_data.html#a19511b88d17a0046dcd5e94aa748a966":[0,0,95,34], -"struct_sync_generator_electrical_data.html#a1a1224d8d980c1aa408acd0c731e73c1":[0,0,95,22], -"struct_sync_generator_electrical_data.html#a1c21e18774280d7dc7378e39eeba04ff":[0,0,95,53], -"struct_sync_generator_electrical_data.html#a20b583f81933f0f077fb78851b92e7f5":[0,0,95,10], -"struct_sync_generator_electrical_data.html#a210c90fcf0cb602453758550f12fc625":[0,0,95,30], -"struct_sync_generator_electrical_data.html#a235b1f71ead84082b1fce66bfd7a17fc":[0,0,95,66], -"struct_sync_generator_electrical_data.html#a278df0fd573717f280a99a6e1ac5f688":[0,0,95,69], -"struct_sync_generator_electrical_data.html#a2a21d204b68e1896bd2aae87ef9e6ec3":[0,0,95,28], -"struct_sync_generator_electrical_data.html#a2a228ce1cc8ac26705da097326921e0f":[0,0,95,13], -"struct_sync_generator_electrical_data.html#a32a4709d2efaa85914e1757077fa4b21":[0,0,95,9], -"struct_sync_generator_electrical_data.html#a39a8fd0c1e59355cf72f4fbf274c1863":[0,0,95,1], -"struct_sync_generator_electrical_data.html#a3fe501f6261730e18c4601cfdb7db680":[0,0,95,5], -"struct_sync_generator_electrical_data.html#a452fd337c002c0872ee2f22f8eefeb14":[0,0,95,26], -"struct_sync_generator_electrical_data.html#a4726eca1a20265688e6145f4f95885aa":[0,0,95,65], -"struct_sync_generator_electrical_data.html#a539062122f9f437a40c4e50e17bb2a87":[0,0,95,8], -"struct_sync_generator_electrical_data.html#a53edeaeb3361da40e3939bfffa401e6c":[0,0,95,45], -"struct_sync_generator_electrical_data.html#a565358e9818ff25a4e96d50cade77be4":[0,0,95,11], -"struct_sync_generator_electrical_data.html#a58c50a8e615dadef9353046329b829f9":[0,0,95,0], -"struct_sync_generator_electrical_data.html#a58d893dcf9933cf73be0bb12d3472ac6":[0,0,95,29], -"struct_sync_generator_electrical_data.html#a599699b6b55ca35dfec13f0a1d58dc37":[0,0,95,24], -"struct_sync_generator_electrical_data.html#a5bfbef7dc02c36f5673ebd6c25f9a7a9":[0,0,95,52], -"struct_sync_generator_electrical_data.html#a64003e1947c801662450bb04723e1696":[0,0,95,55], -"struct_sync_generator_electrical_data.html#a6bd4994b89c6a338c7d51e875490a31f":[0,0,95,18], -"struct_sync_generator_electrical_data.html#a73980536ff6e4485d4d71bf5407d9d8c":[0,0,95,47], -"struct_sync_generator_electrical_data.html#a73b9df7db4f2d984fb5f976003122131":[0,0,95,57], -"struct_sync_generator_electrical_data.html#a787696951a05eb8000c0495b018246e4":[0,0,95,50], -"struct_sync_generator_electrical_data.html#a78ce2b0f1cb61c3e1d56796ffe7d2d11":[0,0,95,46], -"struct_sync_generator_electrical_data.html#a78dbbb159874e5e4f3f889881fd50408":[0,0,95,16], -"struct_sync_generator_electrical_data.html#a79529c49e1337863a2aca63b9c57c821":[0,0,95,48], -"struct_sync_generator_electrical_data.html#a7c4224d05447c55c895fe164d09e0a8c":[0,0,95,54], -"struct_sync_generator_electrical_data.html#a7d388c89ca828391d47df50172cd9da1":[0,0,95,61], -"struct_sync_generator_electrical_data.html#a7f78dad336b743be9627377e015bff26":[0,0,95,63], -"struct_sync_generator_electrical_data.html#a808dac6e3f783331633990b4ad18831a":[0,0,95,67], -"struct_sync_generator_electrical_data.html#a80cc5ac62cbe7932c1f96be3843d0f38":[0,0,95,72], -"struct_sync_generator_electrical_data.html#a82bc75dc1c81776dc2998803e0f62890":[0,0,95,49], -"struct_sync_generator_electrical_data.html#a842fa25b7c6051b5b93cfc8fe28867d2":[0,0,95,2], -"struct_sync_generator_electrical_data.html#a854269759e28f1bf4782fa23dcbbe811":[0,0,95,75], -"struct_sync_generator_electrical_data.html#a89ccce917e842d4ad6f2f7c076a38a47":[0,0,95,15], -"struct_sync_generator_electrical_data.html#a8f0d820f77f5cfd6f8ef2c53570422c7":[0,0,95,70], -"struct_sync_generator_electrical_data.html#a930a0681c0c9cabd3d0a363e3bfae4d9":[0,0,95,58], -"struct_sync_generator_electrical_data.html#a97c98fba9f73a7b70ac84e6e4dc7bd2f":[0,0,95,32], -"struct_sync_generator_electrical_data.html#a9a534e4c50aba0e6a2cc6b5dbc2d2c03":[0,0,95,23], -"struct_sync_generator_electrical_data.html#a9e97d6c96ba58cfb8dcc1d1293867ef1":[0,0,95,6], -"struct_sync_generator_electrical_data.html#a9f351e057a8249ae2fcfdf7e102e4633":[0,0,95,68], -"struct_sync_generator_electrical_data.html#ab261eec61032be2722ff2c6f7b2c7506":[0,0,95,60], -"struct_sync_generator_electrical_data.html#ab4c9a79a39406b6e744ab4fb92e94750":[0,0,95,56], -"struct_sync_generator_electrical_data.html#ab7faade6dd8c40554a82ade6e84730b3":[0,0,95,19], -"struct_sync_generator_electrical_data.html#abb4e828c8091dd69e2535d72b51fc6e7":[0,0,95,44], -"struct_sync_generator_electrical_data.html#abe8b5c90c1b330c2c340def3973694c6":[0,0,95,12], -"struct_sync_generator_electrical_data.html#abe9f0c1ea9349fe319fefe804cfcf0bd":[0,0,95,7], -"struct_sync_generator_electrical_data.html#abec98d3227f7c93d1caf05c3a885b097":[0,0,95,25], -"struct_sync_generator_electrical_data.html#ac092cb3ba2be5fca9881fbaaa6d13ff1":[0,0,95,20], -"struct_sync_generator_electrical_data.html#ac2b9ca7fa928dcc7c9ad5b3d90360784":[0,0,95,37], -"struct_sync_generator_electrical_data.html#ac32b752bc6bc51a6adaf66e8a7cea895":[0,0,95,33], -"struct_sync_generator_electrical_data.html#ac49316b6415fcb531df9f5ae5467ca20":[0,0,95,64], -"struct_sync_generator_electrical_data.html#ac53d1a5127d7dcd5f8b94d2ca0cae4b7":[0,0,95,51], -"struct_sync_generator_electrical_data.html#ac97b40c21bf8d411d2971c835d186a4a":[0,0,95,74], -"struct_sync_generator_electrical_data.html#ad0217ad35b1964abffab864b0454717c":[0,0,95,31], -"struct_sync_generator_electrical_data.html#ad5935c784af5f03f7c9cdba7df88f1de":[0,0,95,42], -"struct_sync_generator_electrical_data.html#ad6cc9505241ac17f3ab1f6011aace0b8":[0,0,95,40], -"struct_sync_generator_electrical_data.html#adc91d39da384d4caf81f50bc7bd56207":[0,0,95,59], -"struct_sync_generator_electrical_data.html#ade7d762b92727bcc58821d3bf9a743ca":[0,0,95,43], -"struct_sync_generator_electrical_data.html#adffc8e7c793c2f23dfd5b573a14aba24":[0,0,95,27], -"struct_sync_generator_electrical_data.html#ae554e8863b29bf58119bad4e9b4eee52":[0,0,95,35], -"struct_sync_generator_electrical_data.html#aeb8cc5e98f68e4a14febaa7436813f63":[0,0,95,17], -"struct_sync_generator_electrical_data.html#aec21ca1955d3c33aa2d1fd4665f83261":[0,0,95,73] +"struct_simulation_data.html#adf9aa7a02213374ac15439e8929f0179":[0,0,85,6] }; diff --git a/docs/doxygen/html/navtreeindex13.js b/docs/doxygen/html/navtreeindex13.js index 048b951..a7e0ef2 100644 --- a/docs/doxygen/html/navtreeindex13.js +++ b/docs/doxygen/html/navtreeindex13.js @@ -1,116 +1,206 @@ var NAVTREEINDEX13 = { -"struct_sync_generator_electrical_data.html#aef18b7163c5e2b9e6e2c671b3939480d":[0,0,95,39], +"struct_simulation_data.html#af0ca3cdcc810fcba377e5c6e2bcd71b5":[0,0,85,14], +"struct_simulation_data.html#af5b66ffff262e5d7c49835c1fb57b302":[0,0,85,3], +"struct_switching_data.html":[0,0,91], +"struct_switching_data.html#a3323745bf0a3f6461fbc19bc76a189df":[0,0,91,0], +"struct_switching_data.html#af78fb958137a0532ea2a584810708574":[0,0,91,1], +"struct_sync_generator_electrical_data.html":[0,0,95], +"struct_sync_generator_electrical_data.html#a02ea43b57770200f43686b21d6f5bee7":[0,0,95,4], +"struct_sync_generator_electrical_data.html#a039151f15d01a6b70c13674894034350":[0,0,95,14], +"struct_sync_generator_electrical_data.html#a120f89adf2d52ae106e3d99fa7453a0d":[0,0,95,68], +"struct_sync_generator_electrical_data.html#a124840d7c73161bb4187aa5215969647":[0,0,95,43], +"struct_sync_generator_electrical_data.html#a13371480bdeca2be90140e3c168ee9a7":[0,0,95,21], +"struct_sync_generator_electrical_data.html#a1405e96b81978e44e60dc535fbe08f47":[0,0,95,40], +"struct_sync_generator_electrical_data.html#a16117d43dd668998854692abaf289c5f":[0,0,95,38], +"struct_sync_generator_electrical_data.html#a19511b88d17a0046dcd5e94aa748a966":[0,0,95,36], +"struct_sync_generator_electrical_data.html#a1a1224d8d980c1aa408acd0c731e73c1":[0,0,95,22], +"struct_sync_generator_electrical_data.html#a1c21e18774280d7dc7378e39eeba04ff":[0,0,95,58], +"struct_sync_generator_electrical_data.html#a1d80742377fac4d719085c967d831608":[0,0,95,25], +"struct_sync_generator_electrical_data.html#a20b583f81933f0f077fb78851b92e7f5":[0,0,95,10], +"struct_sync_generator_electrical_data.html#a210c90fcf0cb602453758550f12fc625":[0,0,95,32], +"struct_sync_generator_electrical_data.html#a235b1f71ead84082b1fce66bfd7a17fc":[0,0,95,72], +"struct_sync_generator_electrical_data.html#a278df0fd573717f280a99a6e1ac5f688":[0,0,95,75], +"struct_sync_generator_electrical_data.html#a2a21d204b68e1896bd2aae87ef9e6ec3":[0,0,95,30], +"struct_sync_generator_electrical_data.html#a2a228ce1cc8ac26705da097326921e0f":[0,0,95,13], +"struct_sync_generator_electrical_data.html#a32a4709d2efaa85914e1757077fa4b21":[0,0,95,9], +"struct_sync_generator_electrical_data.html#a39a8fd0c1e59355cf72f4fbf274c1863":[0,0,95,1], +"struct_sync_generator_electrical_data.html#a3fe501f6261730e18c4601cfdb7db680":[0,0,95,5], +"struct_sync_generator_electrical_data.html#a452fd337c002c0872ee2f22f8eefeb14":[0,0,95,27], +"struct_sync_generator_electrical_data.html#a4726eca1a20265688e6145f4f95885aa":[0,0,95,71], +"struct_sync_generator_electrical_data.html#a539062122f9f437a40c4e50e17bb2a87":[0,0,95,8], +"struct_sync_generator_electrical_data.html#a53edeaeb3361da40e3939bfffa401e6c":[0,0,95,49], +"struct_sync_generator_electrical_data.html#a565358e9818ff25a4e96d50cade77be4":[0,0,95,11], +"struct_sync_generator_electrical_data.html#a58c50a8e615dadef9353046329b829f9":[0,0,95,0], +"struct_sync_generator_electrical_data.html#a58d893dcf9933cf73be0bb12d3472ac6":[0,0,95,31], +"struct_sync_generator_electrical_data.html#a599699b6b55ca35dfec13f0a1d58dc37":[0,0,95,24], +"struct_sync_generator_electrical_data.html#a5bfbef7dc02c36f5673ebd6c25f9a7a9":[0,0,95,57], +"struct_sync_generator_electrical_data.html#a64003e1947c801662450bb04723e1696":[0,0,95,61], +"struct_sync_generator_electrical_data.html#a6bd4994b89c6a338c7d51e875490a31f":[0,0,95,18], +"struct_sync_generator_electrical_data.html#a73980536ff6e4485d4d71bf5407d9d8c":[0,0,95,51], +"struct_sync_generator_electrical_data.html#a73b9df7db4f2d984fb5f976003122131":[0,0,95,63], +"struct_sync_generator_electrical_data.html#a750898c7ac2b2612a3db657d5459626d":[0,0,95,45], +"struct_sync_generator_electrical_data.html#a787696951a05eb8000c0495b018246e4":[0,0,95,54], +"struct_sync_generator_electrical_data.html#a78ce2b0f1cb61c3e1d56796ffe7d2d11":[0,0,95,50], +"struct_sync_generator_electrical_data.html#a78dbbb159874e5e4f3f889881fd50408":[0,0,95,16], +"struct_sync_generator_electrical_data.html#a79529c49e1337863a2aca63b9c57c821":[0,0,95,52], +"struct_sync_generator_electrical_data.html#a7c4224d05447c55c895fe164d09e0a8c":[0,0,95,59], +"struct_sync_generator_electrical_data.html#a7d388c89ca828391d47df50172cd9da1":[0,0,95,67], +"struct_sync_generator_electrical_data.html#a7f78dad336b743be9627377e015bff26":[0,0,95,69], +"struct_sync_generator_electrical_data.html#a808dac6e3f783331633990b4ad18831a":[0,0,95,73], +"struct_sync_generator_electrical_data.html#a80cc5ac62cbe7932c1f96be3843d0f38":[0,0,95,78], +"struct_sync_generator_electrical_data.html#a82bc75dc1c81776dc2998803e0f62890":[0,0,95,53], +"struct_sync_generator_electrical_data.html#a842fa25b7c6051b5b93cfc8fe28867d2":[0,0,95,2], +"struct_sync_generator_electrical_data.html#a854269759e28f1bf4782fa23dcbbe811":[0,0,95,81], +"struct_sync_generator_electrical_data.html#a8827b25efb3bb80e511412fcf2e63f42":[0,0,95,56], +"struct_sync_generator_electrical_data.html#a89ccce917e842d4ad6f2f7c076a38a47":[0,0,95,15], +"struct_sync_generator_electrical_data.html#a8f0d820f77f5cfd6f8ef2c53570422c7":[0,0,95,76], +"struct_sync_generator_electrical_data.html#a930a0681c0c9cabd3d0a363e3bfae4d9":[0,0,95,64], +"struct_sync_generator_electrical_data.html#a96752298c088dea20ecc690644ea3a86":[0,0,95,46], +"struct_sync_generator_electrical_data.html#a97c98fba9f73a7b70ac84e6e4dc7bd2f":[0,0,95,34], +"struct_sync_generator_electrical_data.html#a9a534e4c50aba0e6a2cc6b5dbc2d2c03":[0,0,95,23], +"struct_sync_generator_electrical_data.html#a9e97d6c96ba58cfb8dcc1d1293867ef1":[0,0,95,6], +"struct_sync_generator_electrical_data.html#a9f351e057a8249ae2fcfdf7e102e4633":[0,0,95,74], +"struct_sync_generator_electrical_data.html#ab261eec61032be2722ff2c6f7b2c7506":[0,0,95,66], +"struct_sync_generator_electrical_data.html#ab4c9a79a39406b6e744ab4fb92e94750":[0,0,95,62], +"struct_sync_generator_electrical_data.html#ab7faade6dd8c40554a82ade6e84730b3":[0,0,95,19], +"struct_sync_generator_electrical_data.html#abb4e828c8091dd69e2535d72b51fc6e7":[0,0,95,48], +"struct_sync_generator_electrical_data.html#abe8b5c90c1b330c2c340def3973694c6":[0,0,95,12], +"struct_sync_generator_electrical_data.html#abe9f0c1ea9349fe319fefe804cfcf0bd":[0,0,95,7], +"struct_sync_generator_electrical_data.html#abec98d3227f7c93d1caf05c3a885b097":[0,0,95,26], +"struct_sync_generator_electrical_data.html#ac092cb3ba2be5fca9881fbaaa6d13ff1":[0,0,95,20], +"struct_sync_generator_electrical_data.html#ac2b9ca7fa928dcc7c9ad5b3d90360784":[0,0,95,39], +"struct_sync_generator_electrical_data.html#ac32b752bc6bc51a6adaf66e8a7cea895":[0,0,95,35], +"struct_sync_generator_electrical_data.html#ac49316b6415fcb531df9f5ae5467ca20":[0,0,95,70], +"struct_sync_generator_electrical_data.html#ac53d1a5127d7dcd5f8b94d2ca0cae4b7":[0,0,95,55], +"struct_sync_generator_electrical_data.html#ac97b40c21bf8d411d2971c835d186a4a":[0,0,95,80], +"struct_sync_generator_electrical_data.html#ad0217ad35b1964abffab864b0454717c":[0,0,95,33], +"struct_sync_generator_electrical_data.html#ad5935c784af5f03f7c9cdba7df88f1de":[0,0,95,44], +"struct_sync_generator_electrical_data.html#ad6cc9505241ac17f3ab1f6011aace0b8":[0,0,95,42], +"struct_sync_generator_electrical_data.html#adc91d39da384d4caf81f50bc7bd56207":[0,0,95,65], +"struct_sync_generator_electrical_data.html#ade7d762b92727bcc58821d3bf9a743ca":[0,0,95,47], +"struct_sync_generator_electrical_data.html#adffc8e7c793c2f23dfd5b573a14aba24":[0,0,95,29], +"struct_sync_generator_electrical_data.html#ae06d59efebe1956a310dbc43e4780abe":[0,0,95,28], +"struct_sync_generator_electrical_data.html#ae554e8863b29bf58119bad4e9b4eee52":[0,0,95,37], +"struct_sync_generator_electrical_data.html#aeb8cc5e98f68e4a14febaa7436813f63":[0,0,95,17], +"struct_sync_generator_electrical_data.html#aec21ca1955d3c33aa2d1fd4665f83261":[0,0,95,79], +"struct_sync_generator_electrical_data.html#aef18b7163c5e2b9e6e2c671b3939480d":[0,0,95,41], "struct_sync_generator_electrical_data.html#af0b3c5e37645d44e40add8fcf4bec7ea":[0,0,95,3], -"struct_sync_generator_electrical_data.html#af659153561dff178ed4d3b87d79d05a0":[0,0,95,71], -"struct_sync_motor_electrical_data.html":[0,0,99], -"struct_sync_motor_electrical_data.html#a051aadc933064e1da5dbd9f74b81d170":[0,0,99,35], -"struct_sync_motor_electrical_data.html#a063a404b21e2127a02648fcaf45a5262":[0,0,99,36], -"struct_sync_motor_electrical_data.html#a0869e5e1534c10bd2d8b9597a6787a24":[0,0,99,7], -"struct_sync_motor_electrical_data.html#a0b3104f4dd9e45e92205f2ae18498c5c":[0,0,99,22], -"struct_sync_motor_electrical_data.html#a0f602e8d66656209e5ec223ba000ca55":[0,0,99,1], -"struct_sync_motor_electrical_data.html#a0fbea6750a832909452d464b6ce5476a":[0,0,99,14], -"struct_sync_motor_electrical_data.html#a1240daaa5654ca3a81e9351ece1be28c":[0,0,99,9], -"struct_sync_motor_electrical_data.html#a12bf4ce083ab090ac9b34f948bf01d73":[0,0,99,72], -"struct_sync_motor_electrical_data.html#a182463eaae4af8c639cff095ead39763":[0,0,99,51], -"struct_sync_motor_electrical_data.html#a1909f35de18bc3ef4692b6b897e06fdb":[0,0,99,31], -"struct_sync_motor_electrical_data.html#a1a1431ec9cbc6d7d443b2888cf21fe26":[0,0,99,15], -"struct_sync_motor_electrical_data.html#a2002371fc5d5e83e8cd4f7ce24db430a":[0,0,99,73], -"struct_sync_motor_electrical_data.html#a21533238587fde91b8655dd75f9d322c":[0,0,99,54], -"struct_sync_motor_electrical_data.html#a2714d6f631dd24a1dd79a6dae0b3fe01":[0,0,99,43], -"struct_sync_motor_electrical_data.html#a2a01010ebcc937abb94f936e0db1b295":[0,0,99,61], -"struct_sync_motor_electrical_data.html#a3372b8b20483ca99d8b1a9c227b2f034":[0,0,99,27], -"struct_sync_motor_electrical_data.html#a36a4cbab101c5fe573eafd75794d0cf3":[0,0,99,57], -"struct_sync_motor_electrical_data.html#a3cac2eb4410c37e488a9359ef39c3b3b":[0,0,99,30], -"struct_sync_motor_electrical_data.html#a4467a494945cd3da378d0f97039de94f":[0,0,99,70], -"struct_sync_motor_electrical_data.html#a46c3e4a04013c37e4d77497bdcca2d7b":[0,0,99,13], -"struct_sync_motor_electrical_data.html#a48e826b8bfaaea8391a67374349724dc":[0,0,99,34], -"struct_sync_motor_electrical_data.html#a4c5361a270446607dabb2929a8854653":[0,0,99,6], -"struct_sync_motor_electrical_data.html#a513c4e37f2f062ee8e5086a1d2fdf57a":[0,0,99,56], -"struct_sync_motor_electrical_data.html#a540046b2272b75675181979dad8ccc8b":[0,0,99,52], -"struct_sync_motor_electrical_data.html#a56b504d00007e15f0271c0702bfcf6cd":[0,0,99,17], -"struct_sync_motor_electrical_data.html#a5bbc9459ac89c28089792ed76a2c01e5":[0,0,99,66], -"struct_sync_motor_electrical_data.html#a64fe0337aa51aab1d0b11b72d6bb79c3":[0,0,99,46], -"struct_sync_motor_electrical_data.html#a669d499150a715ad3ab2a1186fc2a22c":[0,0,99,4], -"struct_sync_motor_electrical_data.html#a68a50d74cbe840e6f5ddde4d6568551e":[0,0,99,5], -"struct_sync_motor_electrical_data.html#a6fd87a55210b48a4cdbb99a1a9a05ff2":[0,0,99,12], -"struct_sync_motor_electrical_data.html#a71dfd4556a62431ab7657af1173cb29b":[0,0,99,58], -"struct_sync_motor_electrical_data.html#a72a4c00574d24476341ce64b178b0917":[0,0,99,53], -"struct_sync_motor_electrical_data.html#a72bca6a6528590d3a53ac0ff8557d9d0":[0,0,99,2], -"struct_sync_motor_electrical_data.html#a732b333a510ef770abb9ae89003f2f60":[0,0,99,74], -"struct_sync_motor_electrical_data.html#a7447305e5858f66fd7cab718e09cb5d0":[0,0,99,55], -"struct_sync_motor_electrical_data.html#a8182fa185ba94200df9c76f27a7aa950":[0,0,99,32], -"struct_sync_motor_electrical_data.html#a85ae173b59ea2f380786c36ec534743b":[0,0,99,38], -"struct_sync_motor_electrical_data.html#a85bf9e6428f0cef5b3a4d6412185746b":[0,0,99,19], -"struct_sync_motor_electrical_data.html#a8685294c4133ec612d4a3d3615240336":[0,0,99,59], -"struct_sync_motor_electrical_data.html#a891dc4f1f52a9db079b3cf91707afca9":[0,0,99,49], -"struct_sync_motor_electrical_data.html#a8f3571e353fe1d0678754fc2f203c1e7":[0,0,99,62], -"struct_sync_motor_electrical_data.html#a90b20df7d8b2b09d95641c2574176153":[0,0,99,33], -"struct_sync_motor_electrical_data.html#a94540978a1fdc557aaab60c2fc8c9a5d":[0,0,99,28], -"struct_sync_motor_electrical_data.html#a98301a458887ef7cde8bab0095652ba4":[0,0,99,23], -"struct_sync_motor_electrical_data.html#a9b953c627d870073f16595d6a0270f31":[0,0,99,44], -"struct_sync_motor_electrical_data.html#a9e9e4e4687dbc2f4a0cc38ca5177079c":[0,0,99,75], -"struct_sync_motor_electrical_data.html#aa734d7a7da312566c7ff3c224d932d72":[0,0,99,71], -"struct_sync_motor_electrical_data.html#ab244f2e6f4149d7f4c85efb286e174ce":[0,0,99,39], -"struct_sync_motor_electrical_data.html#ab5b8932c7b973cb7241acd0078276559":[0,0,99,50], -"struct_sync_motor_electrical_data.html#ab807e7528d0ba01024ade3f5da560e56":[0,0,99,8], -"struct_sync_motor_electrical_data.html#ab818b0778da594bf026c1c5f9f028444":[0,0,99,37], -"struct_sync_motor_electrical_data.html#ac1984f28f4c9987bc9578150985c7d06":[0,0,99,47], -"struct_sync_motor_electrical_data.html#ac2b1fd857d3fbd43d13c4f03d4998b0a":[0,0,99,42], -"struct_sync_motor_electrical_data.html#ac2fd73dbd4897f7a47a13361022ee8b7":[0,0,99,48], -"struct_sync_motor_electrical_data.html#ac570dda882a0360ba00bdac26666e1b6":[0,0,99,3], -"struct_sync_motor_electrical_data.html#ac5dd2b71485b5ac3a515bfffe8660086":[0,0,99,40], -"struct_sync_motor_electrical_data.html#ac6eec343f36f933a2d2c2858fb89f1e4":[0,0,99,24], -"struct_sync_motor_electrical_data.html#acdf36a814a5dbc049a49d6a8a4a5dbf8":[0,0,99,69], -"struct_sync_motor_electrical_data.html#ad1095e977927999800fa57a7251a9d50":[0,0,99,63], -"struct_sync_motor_electrical_data.html#ad5be10659aa046767021eee8f17bc5f3":[0,0,99,26], -"struct_sync_motor_electrical_data.html#ad63d9f8a9b8e87d3167e7110ba50ecdd":[0,0,99,67], -"struct_sync_motor_electrical_data.html#ad7257fa4d7fd7e9b104a4d7076fde2fe":[0,0,99,21], -"struct_sync_motor_electrical_data.html#adaadd65c21f57320599da2e87fd148f7":[0,0,99,0], -"struct_sync_motor_electrical_data.html#add530e37d8821f30ec873a10c24d8c41":[0,0,99,68], -"struct_sync_motor_electrical_data.html#ade1a3889071ddf1d02e7d21bc31e4566":[0,0,99,11], -"struct_sync_motor_electrical_data.html#ae21827f6456277ca9b3b659dc1cc5181":[0,0,99,41], -"struct_sync_motor_electrical_data.html#ae81cf3bd42b466d6450fa1de1896d5a0":[0,0,99,45], -"struct_sync_motor_electrical_data.html#ae95f80f05a6f818ee15e04412223fcd7":[0,0,99,60], -"struct_sync_motor_electrical_data.html#ae97bcbb0f856bd793315d2319572bdd4":[0,0,99,10], -"struct_sync_motor_electrical_data.html#aed62412a84b5beefe7419b6441ce51a7":[0,0,99,16], -"struct_sync_motor_electrical_data.html#aefbe9eb66cf3626fc03c4ffe6579ef34":[0,0,99,29], -"struct_sync_motor_electrical_data.html#af01b0c7e5b48c4f6cef9775b627d98f2":[0,0,99,20], -"struct_sync_motor_electrical_data.html#af96a383a7dfd859d9b2c6525a70ab96e":[0,0,99,25], -"struct_sync_motor_electrical_data.html#afd1714dee3344dd0601dcfc074536da9":[0,0,99,18], -"struct_sync_motor_electrical_data.html#afe07e31feeeea93e1df89feafd8ab791":[0,0,99,64], -"struct_sync_motor_electrical_data.html#afe938f6d3c0b24d7881f6ec1f9d3bf87":[0,0,99,65], -"struct_transfer_function_1_1_space_state.html":[0,0,105,0], -"struct_transfer_function_1_1_space_state.html#a3e3bc8524eb751a1f243ee08a6eb7646":[0,0,105,0,0], -"struct_transfer_function_1_1_space_state.html#a4c0bf33dd7a387aed5fd4f4919f15b85":[0,0,105,0,1], -"struct_transfer_function_1_1_space_state.html#a4fc70fb0845c4541742ebd123373d4c7":[0,0,105,0,3], -"struct_transfer_function_1_1_space_state.html#afda97fae8560f595948c810a8ae47202":[0,0,105,0,2], -"struct_transformer_electrical_data.html":[0,0,109], -"struct_transformer_electrical_data.html#a03331e5c4e0ad04c851fffabcc9936ec":[0,0,109,19], -"struct_transformer_electrical_data.html#a1513d2efe2ee080359a6bb9f3177d7ee":[0,0,109,8], -"struct_transformer_electrical_data.html#a21d613ccca353784d8adfd0bfdaca0ff":[0,0,109,22], -"struct_transformer_electrical_data.html#a2d2883e680df2522b8517235b1345512":[0,0,109,1], -"struct_transformer_electrical_data.html#a3101afa7a1e145675819742f05422e90":[0,0,109,13], -"struct_transformer_electrical_data.html#a343366e4142013e724874e6bf79acc67":[0,0,109,10], -"struct_transformer_electrical_data.html#a40158cfd130b05ab26e624395f32018b":[0,0,109,14], -"struct_transformer_electrical_data.html#a469a24e58338613b620de352ea06c13d":[0,0,109,4], -"struct_transformer_electrical_data.html#a520014be18decacdfec876f3a23b68ae":[0,0,109,18], -"struct_transformer_electrical_data.html#a55492dae7b4489903bb5a45b4d3b093a":[0,0,109,12], -"struct_transformer_electrical_data.html#a7cb4f1fbe494fa905c56d324a05a7b32":[0,0,109,5], -"struct_transformer_electrical_data.html#a8a90bbbcefecfe59505d86003354afdc":[0,0,109,16], -"struct_transformer_electrical_data.html#a900c1dfc24ebcca169fae8dfd4a3e6bd":[0,0,109,15], -"struct_transformer_electrical_data.html#a913f0ad1ba90018a13d7930670438a89":[0,0,109,21], -"struct_transformer_electrical_data.html#a9da8363e7eb19e805650db36d87fca93":[0,0,109,7], -"struct_transformer_electrical_data.html#aa450538f0a29571bef6e2785d3544bb2":[0,0,109,6], -"struct_transformer_electrical_data.html#aabe6d597ed902640f5c87f2cd2550364":[0,0,109,0], -"struct_transformer_electrical_data.html#ab6606d2f93aa369b7a3173e61d44c8f3":[0,0,109,24], -"struct_transformer_electrical_data.html#abae77eeb48d1a56cb10302f2b9aea38c":[0,0,109,17], -"struct_transformer_electrical_data.html#ac954927451779be66154613475143dc9":[0,0,109,11], -"struct_transformer_electrical_data.html#ad1a62e6b3f896f6a9d794f6b9e02f599":[0,0,109,9], -"struct_transformer_electrical_data.html#add161341c5cdd9c9ce93c34f9ace2c08":[0,0,109,20], -"struct_transformer_electrical_data.html#af19976dfba78777187211ab79581396e":[0,0,109,2], -"struct_transformer_electrical_data.html#af4454c28f422632359573496c40b70e4":[0,0,109,3], -"struct_transformer_electrical_data.html#afb45c8a86048551b51c399a1b72ff949":[0,0,109,23], +"struct_sync_generator_electrical_data.html#af4177bcbee0f968986860e9294f70129":[0,0,95,60], +"struct_sync_generator_electrical_data.html#af659153561dff178ed4d3b87d79d05a0":[0,0,95,77], +"struct_sync_machine_model_data.html":[0,0,98], +"struct_sync_machine_model_data.html#a810b9e3250ebb8f3d4176f6e5a2b1076":[0,0,98,1], +"struct_sync_machine_model_data.html#ad2bda1ac696b664571e33f657f4a81b6":[0,0,98,0], +"struct_sync_machine_model_data.html#af75546805bf92eb7a8a7280f7964b330":[0,0,98,2], +"struct_sync_machine_model_data.html#af81596945918e86e56f5822a0ba97fbc":[0,0,98,3], +"struct_sync_motor_electrical_data.html":[0,0,100], +"struct_sync_motor_electrical_data.html#a051aadc933064e1da5dbd9f74b81d170":[0,0,100,35], +"struct_sync_motor_electrical_data.html#a063a404b21e2127a02648fcaf45a5262":[0,0,100,36], +"struct_sync_motor_electrical_data.html#a0869e5e1534c10bd2d8b9597a6787a24":[0,0,100,7], +"struct_sync_motor_electrical_data.html#a0b3104f4dd9e45e92205f2ae18498c5c":[0,0,100,22], +"struct_sync_motor_electrical_data.html#a0f602e8d66656209e5ec223ba000ca55":[0,0,100,1], +"struct_sync_motor_electrical_data.html#a0fbea6750a832909452d464b6ce5476a":[0,0,100,14], +"struct_sync_motor_electrical_data.html#a1240daaa5654ca3a81e9351ece1be28c":[0,0,100,9], +"struct_sync_motor_electrical_data.html#a12bf4ce083ab090ac9b34f948bf01d73":[0,0,100,72], +"struct_sync_motor_electrical_data.html#a182463eaae4af8c639cff095ead39763":[0,0,100,51], +"struct_sync_motor_electrical_data.html#a1909f35de18bc3ef4692b6b897e06fdb":[0,0,100,31], +"struct_sync_motor_electrical_data.html#a1a1431ec9cbc6d7d443b2888cf21fe26":[0,0,100,15], +"struct_sync_motor_electrical_data.html#a2002371fc5d5e83e8cd4f7ce24db430a":[0,0,100,73], +"struct_sync_motor_electrical_data.html#a21533238587fde91b8655dd75f9d322c":[0,0,100,54], +"struct_sync_motor_electrical_data.html#a2714d6f631dd24a1dd79a6dae0b3fe01":[0,0,100,43], +"struct_sync_motor_electrical_data.html#a2a01010ebcc937abb94f936e0db1b295":[0,0,100,61], +"struct_sync_motor_electrical_data.html#a3372b8b20483ca99d8b1a9c227b2f034":[0,0,100,27], +"struct_sync_motor_electrical_data.html#a36a4cbab101c5fe573eafd75794d0cf3":[0,0,100,57], +"struct_sync_motor_electrical_data.html#a3cac2eb4410c37e488a9359ef39c3b3b":[0,0,100,30], +"struct_sync_motor_electrical_data.html#a4467a494945cd3da378d0f97039de94f":[0,0,100,70], +"struct_sync_motor_electrical_data.html#a46c3e4a04013c37e4d77497bdcca2d7b":[0,0,100,13], +"struct_sync_motor_electrical_data.html#a48e826b8bfaaea8391a67374349724dc":[0,0,100,34], +"struct_sync_motor_electrical_data.html#a4c5361a270446607dabb2929a8854653":[0,0,100,6], +"struct_sync_motor_electrical_data.html#a513c4e37f2f062ee8e5086a1d2fdf57a":[0,0,100,56], +"struct_sync_motor_electrical_data.html#a540046b2272b75675181979dad8ccc8b":[0,0,100,52], +"struct_sync_motor_electrical_data.html#a56b504d00007e15f0271c0702bfcf6cd":[0,0,100,17], +"struct_sync_motor_electrical_data.html#a5bbc9459ac89c28089792ed76a2c01e5":[0,0,100,66], +"struct_sync_motor_electrical_data.html#a64fe0337aa51aab1d0b11b72d6bb79c3":[0,0,100,46], +"struct_sync_motor_electrical_data.html#a669d499150a715ad3ab2a1186fc2a22c":[0,0,100,4], +"struct_sync_motor_electrical_data.html#a68a50d74cbe840e6f5ddde4d6568551e":[0,0,100,5], +"struct_sync_motor_electrical_data.html#a6fd87a55210b48a4cdbb99a1a9a05ff2":[0,0,100,12], +"struct_sync_motor_electrical_data.html#a71dfd4556a62431ab7657af1173cb29b":[0,0,100,58], +"struct_sync_motor_electrical_data.html#a72a4c00574d24476341ce64b178b0917":[0,0,100,53], +"struct_sync_motor_electrical_data.html#a72bca6a6528590d3a53ac0ff8557d9d0":[0,0,100,2], +"struct_sync_motor_electrical_data.html#a732b333a510ef770abb9ae89003f2f60":[0,0,100,74], +"struct_sync_motor_electrical_data.html#a7447305e5858f66fd7cab718e09cb5d0":[0,0,100,55], +"struct_sync_motor_electrical_data.html#a8182fa185ba94200df9c76f27a7aa950":[0,0,100,32], +"struct_sync_motor_electrical_data.html#a85ae173b59ea2f380786c36ec534743b":[0,0,100,38], +"struct_sync_motor_electrical_data.html#a85bf9e6428f0cef5b3a4d6412185746b":[0,0,100,19], +"struct_sync_motor_electrical_data.html#a8685294c4133ec612d4a3d3615240336":[0,0,100,59], +"struct_sync_motor_electrical_data.html#a891dc4f1f52a9db079b3cf91707afca9":[0,0,100,49], +"struct_sync_motor_electrical_data.html#a8f3571e353fe1d0678754fc2f203c1e7":[0,0,100,62], +"struct_sync_motor_electrical_data.html#a90b20df7d8b2b09d95641c2574176153":[0,0,100,33], +"struct_sync_motor_electrical_data.html#a94540978a1fdc557aaab60c2fc8c9a5d":[0,0,100,28], +"struct_sync_motor_electrical_data.html#a98301a458887ef7cde8bab0095652ba4":[0,0,100,23], +"struct_sync_motor_electrical_data.html#a9b953c627d870073f16595d6a0270f31":[0,0,100,44], +"struct_sync_motor_electrical_data.html#a9e9e4e4687dbc2f4a0cc38ca5177079c":[0,0,100,75], +"struct_sync_motor_electrical_data.html#aa734d7a7da312566c7ff3c224d932d72":[0,0,100,71], +"struct_sync_motor_electrical_data.html#ab244f2e6f4149d7f4c85efb286e174ce":[0,0,100,39], +"struct_sync_motor_electrical_data.html#ab5b8932c7b973cb7241acd0078276559":[0,0,100,50], +"struct_sync_motor_electrical_data.html#ab807e7528d0ba01024ade3f5da560e56":[0,0,100,8], +"struct_sync_motor_electrical_data.html#ab818b0778da594bf026c1c5f9f028444":[0,0,100,37], +"struct_sync_motor_electrical_data.html#ac1984f28f4c9987bc9578150985c7d06":[0,0,100,47], +"struct_sync_motor_electrical_data.html#ac2b1fd857d3fbd43d13c4f03d4998b0a":[0,0,100,42], +"struct_sync_motor_electrical_data.html#ac2fd73dbd4897f7a47a13361022ee8b7":[0,0,100,48], +"struct_sync_motor_electrical_data.html#ac570dda882a0360ba00bdac26666e1b6":[0,0,100,3], +"struct_sync_motor_electrical_data.html#ac5dd2b71485b5ac3a515bfffe8660086":[0,0,100,40], +"struct_sync_motor_electrical_data.html#ac6eec343f36f933a2d2c2858fb89f1e4":[0,0,100,24], +"struct_sync_motor_electrical_data.html#acdf36a814a5dbc049a49d6a8a4a5dbf8":[0,0,100,69], +"struct_sync_motor_electrical_data.html#ad1095e977927999800fa57a7251a9d50":[0,0,100,63], +"struct_sync_motor_electrical_data.html#ad5be10659aa046767021eee8f17bc5f3":[0,0,100,26], +"struct_sync_motor_electrical_data.html#ad63d9f8a9b8e87d3167e7110ba50ecdd":[0,0,100,67], +"struct_sync_motor_electrical_data.html#ad7257fa4d7fd7e9b104a4d7076fde2fe":[0,0,100,21], +"struct_sync_motor_electrical_data.html#adaadd65c21f57320599da2e87fd148f7":[0,0,100,0], +"struct_sync_motor_electrical_data.html#add530e37d8821f30ec873a10c24d8c41":[0,0,100,68], +"struct_sync_motor_electrical_data.html#ade1a3889071ddf1d02e7d21bc31e4566":[0,0,100,11], +"struct_sync_motor_electrical_data.html#ae21827f6456277ca9b3b659dc1cc5181":[0,0,100,41], +"struct_sync_motor_electrical_data.html#ae81cf3bd42b466d6450fa1de1896d5a0":[0,0,100,45], +"struct_sync_motor_electrical_data.html#ae95f80f05a6f818ee15e04412223fcd7":[0,0,100,60], +"struct_sync_motor_electrical_data.html#ae97bcbb0f856bd793315d2319572bdd4":[0,0,100,10], +"struct_sync_motor_electrical_data.html#aed62412a84b5beefe7419b6441ce51a7":[0,0,100,16], +"struct_sync_motor_electrical_data.html#aefbe9eb66cf3626fc03c4ffe6579ef34":[0,0,100,29], +"struct_sync_motor_electrical_data.html#af01b0c7e5b48c4f6cef9775b627d98f2":[0,0,100,20], +"struct_sync_motor_electrical_data.html#af96a383a7dfd859d9b2c6525a70ab96e":[0,0,100,25], +"struct_sync_motor_electrical_data.html#afd1714dee3344dd0601dcfc074536da9":[0,0,100,18], +"struct_sync_motor_electrical_data.html#afe07e31feeeea93e1df89feafd8ab791":[0,0,100,64], +"struct_sync_motor_electrical_data.html#afe938f6d3c0b24d7881f6ec1f9d3bf87":[0,0,100,65], +"struct_transfer_function_1_1_space_state.html":[0,0,106,0], +"struct_transfer_function_1_1_space_state.html#a3e3bc8524eb751a1f243ee08a6eb7646":[0,0,106,0,0], +"struct_transfer_function_1_1_space_state.html#a4c0bf33dd7a387aed5fd4f4919f15b85":[0,0,106,0,1], +"struct_transfer_function_1_1_space_state.html#a4fc70fb0845c4541742ebd123373d4c7":[0,0,106,0,3], +"struct_transfer_function_1_1_space_state.html#afda97fae8560f595948c810a8ae47202":[0,0,106,0,2], +"struct_transformer_electrical_data.html":[0,0,110], +"struct_transformer_electrical_data.html#a03331e5c4e0ad04c851fffabcc9936ec":[0,0,110,19], +"struct_transformer_electrical_data.html#a1513d2efe2ee080359a6bb9f3177d7ee":[0,0,110,8], +"struct_transformer_electrical_data.html#a21d613ccca353784d8adfd0bfdaca0ff":[0,0,110,22], +"struct_transformer_electrical_data.html#a2d2883e680df2522b8517235b1345512":[0,0,110,1], +"struct_transformer_electrical_data.html#a3101afa7a1e145675819742f05422e90":[0,0,110,13], +"struct_transformer_electrical_data.html#a343366e4142013e724874e6bf79acc67":[0,0,110,10], +"struct_transformer_electrical_data.html#a40158cfd130b05ab26e624395f32018b":[0,0,110,14], +"struct_transformer_electrical_data.html#a469a24e58338613b620de352ea06c13d":[0,0,110,4], +"struct_transformer_electrical_data.html#a520014be18decacdfec876f3a23b68ae":[0,0,110,18], +"struct_transformer_electrical_data.html#a55492dae7b4489903bb5a45b4d3b093a":[0,0,110,12], +"struct_transformer_electrical_data.html#a7cb4f1fbe494fa905c56d324a05a7b32":[0,0,110,5], +"struct_transformer_electrical_data.html#a8a90bbbcefecfe59505d86003354afdc":[0,0,110,16], +"struct_transformer_electrical_data.html#a900c1dfc24ebcca169fae8dfd4a3e6bd":[0,0,110,15], +"struct_transformer_electrical_data.html#a913f0ad1ba90018a13d7930670438a89":[0,0,110,21], +"struct_transformer_electrical_data.html#a9da8363e7eb19e805650db36d87fca93":[0,0,110,7], +"struct_transformer_electrical_data.html#aa450538f0a29571bef6e2785d3544bb2":[0,0,110,6], +"struct_transformer_electrical_data.html#aabe6d597ed902640f5c87f2cd2550364":[0,0,110,0], +"struct_transformer_electrical_data.html#ab6606d2f93aa369b7a3173e61d44c8f3":[0,0,110,24], +"struct_transformer_electrical_data.html#abae77eeb48d1a56cb10302f2b9aea38c":[0,0,110,17], +"struct_transformer_electrical_data.html#ac954927451779be66154613475143dc9":[0,0,110,11], +"struct_transformer_electrical_data.html#ad1a62e6b3f896f6a9d794f6b9e02f599":[0,0,110,9], +"struct_transformer_electrical_data.html#add161341c5cdd9c9ce93c34f9ace2c08":[0,0,110,20], +"struct_transformer_electrical_data.html#af19976dfba78777187211ab79581396e":[0,0,110,2], +"struct_transformer_electrical_data.html#af4454c28f422632359573496c40b70e4":[0,0,110,3], +"struct_transformer_electrical_data.html#afb45c8a86048551b51c399a1b72ff949":[0,0,110,23], "wx_g_l_string_8cpp_source.html":[1,0,0,156], "wx_g_l_string_8h_source.html":[1,0,0,157] }; diff --git a/docs/doxygen/html/navtreeindex2.js b/docs/doxygen/html/navtreeindex2.js index 188b224..302c449 100644 --- a/docs/doxygen/html/navtreeindex2.js +++ b/docs/doxygen/html/navtreeindex2.js @@ -1,5 +1,77 @@ var NAVTREEINDEX2 = { +"class_camera.html#aefeb0e4d35db499c1049173f1c0be1c2":[0,0,7,15], +"class_camera.html#aefeec0ff0adf22ed4e26b0e3f0c7fb38":[0,0,7,9], +"class_capacitor.html":[0,0,8], +"class_capacitor.html#a00e808708e16b87c80fc650e5710b84e":[0,0,8,10], +"class_capacitor.html#a05d5517b64dd8a8888817ca28b72294d":[0,0,8,6], +"class_capacitor.html#a2c3f0949c2b791c6a0b69866e9aaff7a":[0,0,8,12], +"class_capacitor.html#a422e353b594ac6e4ef34e1f613f7d580":[0,0,8,7], +"class_capacitor.html#a459b1bbdb153bb9720176661e2960ea6":[0,0,8,14], +"class_capacitor.html#a503100032b983414ef469907e4f3fd6a":[0,0,8,8], +"class_capacitor.html#a581f07c0fa802bbdd0f35a70cc79d3b4":[0,0,8,15], +"class_capacitor.html#a6b06adb1ef3545b220e0b94ee6210b7a":[0,0,8,11], +"class_capacitor.html#a94d378c922467214b394931ec0eb01c8":[0,0,8,5], +"class_capacitor.html#a994039e59a8ae0ec3fe7cf7f5b66e4e5":[0,0,8,4], +"class_capacitor.html#ab2c5403403c3f8b4ee1ae737ece4e1cc":[0,0,8,13], +"class_capacitor.html#ab7047062b5e731e86815fe5b61e622da":[0,0,8,1], +"class_capacitor.html#ac5e08b3cca7884bb5f26a8ffcf8fcccf":[0,0,8,2], +"class_capacitor.html#ace755e5bc3cc72b491ce31c24c54a5cf":[0,0,8,3], +"class_capacitor.html#aeba70b8c4a1ed3609481b46c5ace8c6c":[0,0,8,0], +"class_capacitor.html#aef6926699c93145d4b3c62efd942b269":[0,0,8,9], +"class_chart_view.html":[0,0,10], +"class_chart_view.html#a06514137ceea55c0fe387978ea13e214":[0,0,10,20], +"class_chart_view.html#a0fe6be1c5bf29fd058787f1a47325c1a":[0,0,10,10], +"class_chart_view.html#a143b7ffc99d2dbcc82ad4cf4b96d5db2":[0,0,10,22], +"class_chart_view.html#a1e92dd6533c5ebcf6875cb9e517b7b4e":[0,0,10,19], +"class_chart_view.html#a1fe1991c6239632b4af01186b05e062f":[0,0,10,35], +"class_chart_view.html#a201c868954eb1c79dda37ffdcc2a0eeb":[0,0,10,36], +"class_chart_view.html#a231d6a0f6298df0c764f0dcc601e9f9f":[0,0,10,28], +"class_chart_view.html#a28da38ba24dad74b833b7bc5652358ed":[0,0,10,16], +"class_chart_view.html#a293128b4b91a4a838a792076f87cde0a":[0,0,10,17], +"class_chart_view.html#a2b74fcf37a33a8654c3c06008f4e9278":[0,0,10,37], +"class_chart_view.html#a38699e754304878e9a589f730c027dec":[0,0,10,14], +"class_chart_view.html#a4957f22dfe582cd2557b005a010cf2d2":[0,0,10,1], +"class_chart_view.html#a4a2abddb77a734eeb7992ca8434bb358":[0,0,10,7], +"class_chart_view.html#a4b43a87338084b4d163b1a2f002ff9d7":[0,0,10,15], +"class_chart_view.html#a5111d9293952ca916aecd5ff7f597950":[0,0,10,21], +"class_chart_view.html#a5666f8aedecd943ad19d72fc533dcfd9":[0,0,10,6], +"class_chart_view.html#a597a1cde3693f14427a898b61bdc05a9":[0,0,10,9], +"class_chart_view.html#a598645b015715cdc22d08d3875a0a5bb":[0,0,10,31], +"class_chart_view.html#a6034bc00b41785d6003e499778a6a69f":[0,0,10,5], +"class_chart_view.html#a621ebe0264d241f54cf4b65efe705618":[0,0,10,0], +"class_chart_view.html#a6aacbc6267d7c01cc5b3f78fc4ba50fe":[0,0,10,40], +"class_chart_view.html#a6e29b198271efa3c6d5ca9d5ae3ae773":[0,0,10,24], +"class_chart_view.html#a70200389b94906b89d2454b27ac2469c":[0,0,10,30], +"class_chart_view.html#a7e069208db024a903a90f72f9057b951":[0,0,10,29], +"class_chart_view.html#a7f7e1d962ab76be37b89f05e6b97cfc0":[0,0,10,34], +"class_chart_view.html#a877c14527e957c85037b7705d196733d":[0,0,10,18], +"class_chart_view.html#a88dfb946342df7c344bd3578d207dcd9":[0,0,10,23], +"class_chart_view.html#a89e198037f79887a33ce21c949021455":[0,0,10,32], +"class_chart_view.html#a8a374b2c62da0ef13a7d292482abb845":[0,0,10,12], +"class_chart_view.html#a8abb35d06074a8370b222fafae8db028":[0,0,10,8], +"class_chart_view.html#a8f57c26ce982fcf91626e8121b625f70":[0,0,10,13], +"class_chart_view.html#a91cae14a0b48e5755cb44f05e1d9c0b0":[0,0,10,27], +"class_chart_view.html#a95e9181dd41eeff08964054746be305b":[0,0,10,26], +"class_chart_view.html#a9b4099d6352e09be545265a7168860f2":[0,0,10,2], +"class_chart_view.html#ac72c20e03443d91fca200305fc6bbad1":[0,0,10,4], +"class_chart_view.html#ad174b0057b89c6dd4b6aed93a467acd1":[0,0,10,33], +"class_chart_view.html#ad3a0740630473e266d6406a561053ef4":[0,0,10,3], +"class_chart_view.html#ae6593489cbd815282f77f5a073c34e55":[0,0,10,25], +"class_chart_view.html#aec5e3605401ad966f03113a60f05fe1c":[0,0,10,38], +"class_chart_view.html#af9953c97ae04ccb534ee8d8f772330a4":[0,0,10,11], +"class_chart_view.html#affb3ae7ee1147240f5180926a07425b5":[0,0,10,39], +"class_chart_view_base.html":[0,0,11], +"class_chart_view_base.html#a0ab362bd15f37bf94201b6e40d0ba3fa":[0,0,11,15], +"class_chart_view_base.html#a0d66080c5a61b4a544111cd829cd88b8":[0,0,11,50], +"class_chart_view_base.html#a237d5355111659d84fa4e61569deeecc":[0,0,11,30], +"class_chart_view_base.html#a23f74f17c47b4352def0919e9efd3afa":[0,0,11,13], +"class_chart_view_base.html#a250a4f7292e38ffadf609f07dbbc0323":[0,0,11,27], +"class_chart_view_base.html#a27408a2fa4cc3c63a7655ddc6bca7412":[0,0,11,8], +"class_chart_view_base.html#a27f1cf05d785e4f230b3093ab807972c":[0,0,11,26], +"class_chart_view_base.html#a321240363d83ca86670fb4934f1d67f7":[0,0,11,5], +"class_chart_view_base.html#a34f689775bc42f1f11a7b84067a98808":[0,0,11,37], +"class_chart_view_base.html#a407b4fc3b5f891ff37cd8475f0f6ab19":[0,0,11,20], "class_chart_view_base.html#a4083de6c29b7ab0997217c32e246ee0b":[0,0,11,34], "class_chart_view_base.html#a43e25960f37484e564f8043b273760cd":[0,0,11,49], "class_chart_view_base.html#a491fa99972b27860b94e78c6e1745216":[0,0,11,0], @@ -177,77 +249,5 @@ var NAVTREEINDEX2 = "class_control_editor.html#ae3dacc5ee13ae3f550c91fe6fae628b8af573caddb989c1933e55550dd547a832":[0,0,16,0,9], "class_control_editor.html#ae4b1d8d1b470336cce4183a1bbd5d068":[0,0,16,7], "class_control_editor.html#aea00a18800e7da75aecc926a9d0db3be":[0,0,16,43], -"class_control_editor.html#aede55dc44f1bcc87ffd3e004dcb902be":[0,0,16,40], -"class_control_editor_base.html":[0,0,17], -"class_control_editor_base.html#a0cb93fb185a758f8da7419ac5d79aef3":[0,0,17,7], -"class_control_editor_base.html#a123e5eb632e5fdb92962ab6d8fa6534d":[0,0,17,25], -"class_control_editor_base.html#a167986f923077001a235f6dd57d25c62":[0,0,17,23], -"class_control_editor_base.html#a175f41bf34d4b7a355b9e45b58863b3f":[0,0,17,16], -"class_control_editor_base.html#a1ad8acf35865a65e9da27f72eb40f863":[0,0,17,12], -"class_control_editor_base.html#a2597f41925fa2d560fd7edaa0f8b544f":[0,0,17,11], -"class_control_editor_base.html#a322149e110f763fcbed7b58af8b1c605":[0,0,17,24], -"class_control_editor_base.html#a3430458d81963a8fa14e7380bb1cb7cb":[0,0,17,20], -"class_control_editor_base.html#a42c08a6003eb3953a7494d3e61290787":[0,0,17,22], -"class_control_editor_base.html#a54eb878457bf24962a00e0b895f7ca1f":[0,0,17,26], -"class_control_editor_base.html#a5cad91a2f77417d0a19e2c4585966ce2":[0,0,17,33], -"class_control_editor_base.html#a6c7f0ed4ebe6afb448e3713afcd39078":[0,0,17,19], -"class_control_editor_base.html#a7b19542b569c036a6bef179d918dfb5b":[0,0,17,4], -"class_control_editor_base.html#a8b1a2dfef423479578fdc3eb086f2f4f":[0,0,17,10], -"class_control_editor_base.html#a9078a25ee05b6eec3e874e4bf375aba7":[0,0,17,17], -"class_control_editor_base.html#a93f2731c7c21cda28648bd561f4a1d2c":[0,0,17,21], -"class_control_editor_base.html#a9988f3cd363ab1c4da96b3ccefa164a5":[0,0,17,29], -"class_control_editor_base.html#aa2b2fe5ea81a3eb8c28ee9064773be93":[0,0,17,2], -"class_control_editor_base.html#aa99174f98107c89bd6026579ec2f4343":[0,0,17,15], -"class_control_editor_base.html#aac008c284d2bc841ed52bfaca84ee85a":[0,0,17,18], -"class_control_editor_base.html#aac385a40c76a8036b07b6a7f08aeb062a5666c9d2fa9c12a8ba29af0534fcd9d5":[0,0,17,0], -"class_control_editor_base.html#aac385a40c76a8036b07b6a7f08aeb062abdc9b82b5a3ad6189dc3437bc07cc0e3":[0,0,17,1], -"class_control_editor_base.html#abc78a2b37d5ce3dda133a1a1243e7d0d":[0,0,17,5], -"class_control_editor_base.html#abeeae17fcf7de0fd5a15377c3db05f34":[0,0,17,9], -"class_control_editor_base.html#ac16f79d8c489e0d64a0ba2f8635c413a":[0,0,17,31], -"class_control_editor_base.html#ac358a5750676e8204d1ad7a899195636":[0,0,17,34], -"class_control_editor_base.html#ac5edc2aea7c9e063f1d36c06442792f4":[0,0,17,8], -"class_control_editor_base.html#acdc078affdcc3daac68d8b83c630bfaf":[0,0,17,3], -"class_control_editor_base.html#ad1f69087303790b7eedd86022cac6da4":[0,0,17,30], -"class_control_editor_base.html#ad639d4afcd7f3b9eac6cd8a9f8a20ce6":[0,0,17,28], -"class_control_editor_base.html#ae506926ab0a4f91dddb22e0e9fca4900":[0,0,17,27], -"class_control_editor_base.html#aea5060f214daa10dbd7742f8169f97df":[0,0,17,6], -"class_control_editor_base.html#af41c63751f51341e35a71ea5048244a4":[0,0,17,14], -"class_control_editor_base.html#af8715ecc176911865823d2bc777e8501":[0,0,17,13], -"class_control_editor_base.html#afeb914b18f305b1dedd01aae96c9a4d8":[0,0,17,32], -"class_control_element.html":[0,0,18], -"class_control_element.html#a038e940fc33ac3e443502169104d7ebd":[0,0,18,4], -"class_control_element.html#a375be1f070c19579c27d381be2b09e4b":[0,0,18,8], -"class_control_element.html#a559fa662c390b9257c2e23fabdfd1801":[0,0,18,9], -"class_control_element.html#a61440a392d438de163bfe9ffb8e9efec":[0,0,18,12], -"class_control_element.html#a802885ecd7464b6ae085da276be4d06c":[0,0,18,13], -"class_control_element.html#a8958776ec4e32bc0b23f90f4ee9ea2e3":[0,0,18,5], -"class_control_element.html#a899b994168cf0c98695e82a4f3e7c98b":[0,0,18,10], -"class_control_element.html#a8f817b751c7766f070cee27d094a5499":[0,0,18,7], -"class_control_element.html#aa03ed482f0f726e8b4724e815b1cdfb1":[0,0,18,0], -"class_control_element.html#aac3aa20b1c5f9eb7e188298dda34600f":[0,0,18,3], -"class_control_element.html#ab77716614985cab1c7f098af1603c2f1":[0,0,18,2], -"class_control_element.html#abcd5f56c2c771a58b0f1ea80eb8c6a86":[0,0,18,16], -"class_control_element.html#ac8bd52ddb8eed51a217fecb2eed65708":[0,0,18,6], -"class_control_element.html#aeb164b935f9bdb0646b988782e979758":[0,0,18,1], -"class_control_element.html#aeee4f373f0ebca4589b9ef77fe40c291":[0,0,18,11], -"class_control_element.html#af1813931d9b51f5def437ba3c31e8aba":[0,0,18,14], -"class_control_element.html#af669ba711650e3befaad4ed70d2776ab":[0,0,18,15], -"class_control_element_button.html":[0,0,19], -"class_control_element_button.html#a018b99c1b086125e7b728c2cc25b5ff5":[0,0,19,4], -"class_control_element_button.html#a4ad1738a01a24c58cf0b21d8f3195da8":[0,0,19,11], -"class_control_element_button.html#a4b1d55323d02bca75732b5e32878b1d0":[0,0,19,12], -"class_control_element_button.html#a679fe222f172d35dc1a7e157a42a7dbf":[0,0,19,1], -"class_control_element_button.html#a81773f33a05c2b976bef693604a3ca4b":[0,0,19,8], -"class_control_element_button.html#a831ba4a73c4a8c281edb072f3f68eff8":[0,0,19,14], -"class_control_element_button.html#a90252ea5c337a0836292a1154fc2fd8d":[0,0,19,15], -"class_control_element_button.html#aa0d011f5dc84d644c10709116c82d8bf":[0,0,19,13], -"class_control_element_button.html#ab53fa1072a78f8f2e81548bdb7edde4f":[0,0,19,3], -"class_control_element_button.html#ab87a13cd01a3ac7222a1df2e5252a2ac":[0,0,19,10], -"class_control_element_button.html#ac711aa61fe25de7f632a3f2f75fe4fae":[0,0,19,9], -"class_control_element_button.html#ad45b776fd9046f11fe147e8145474478":[0,0,19,0], -"class_control_element_button.html#ade13a62ffdb211d3851f653f2b3dd004":[0,0,19,5], -"class_control_element_button.html#aea4e242359ba70bb26cd29b2bab7d7c8":[0,0,19,7], -"class_control_element_button.html#aef6c1c0b63d71a9e1a99601946d6e0ff":[0,0,19,2], -"class_control_element_button.html#af3ea4e284321f86aa12b98ac23ea2026":[0,0,19,16], -"class_control_element_button.html#afa6effe38a6b8a4070d36dc09dfcd429":[0,0,19,6] +"class_control_editor.html#aede55dc44f1bcc87ffd3e004dcb902be":[0,0,16,40] }; diff --git a/docs/doxygen/html/navtreeindex3.js b/docs/doxygen/html/navtreeindex3.js index 134254e..641564a 100644 --- a/docs/doxygen/html/navtreeindex3.js +++ b/docs/doxygen/html/navtreeindex3.js @@ -1,5 +1,77 @@ var NAVTREEINDEX3 = { +"class_control_editor_base.html":[0,0,17], +"class_control_editor_base.html#a0cb93fb185a758f8da7419ac5d79aef3":[0,0,17,7], +"class_control_editor_base.html#a123e5eb632e5fdb92962ab6d8fa6534d":[0,0,17,25], +"class_control_editor_base.html#a167986f923077001a235f6dd57d25c62":[0,0,17,23], +"class_control_editor_base.html#a175f41bf34d4b7a355b9e45b58863b3f":[0,0,17,16], +"class_control_editor_base.html#a1ad8acf35865a65e9da27f72eb40f863":[0,0,17,12], +"class_control_editor_base.html#a2597f41925fa2d560fd7edaa0f8b544f":[0,0,17,11], +"class_control_editor_base.html#a322149e110f763fcbed7b58af8b1c605":[0,0,17,24], +"class_control_editor_base.html#a3430458d81963a8fa14e7380bb1cb7cb":[0,0,17,20], +"class_control_editor_base.html#a42c08a6003eb3953a7494d3e61290787":[0,0,17,22], +"class_control_editor_base.html#a54eb878457bf24962a00e0b895f7ca1f":[0,0,17,26], +"class_control_editor_base.html#a5cad91a2f77417d0a19e2c4585966ce2":[0,0,17,33], +"class_control_editor_base.html#a6c7f0ed4ebe6afb448e3713afcd39078":[0,0,17,19], +"class_control_editor_base.html#a7b19542b569c036a6bef179d918dfb5b":[0,0,17,4], +"class_control_editor_base.html#a8b1a2dfef423479578fdc3eb086f2f4f":[0,0,17,10], +"class_control_editor_base.html#a9078a25ee05b6eec3e874e4bf375aba7":[0,0,17,17], +"class_control_editor_base.html#a93f2731c7c21cda28648bd561f4a1d2c":[0,0,17,21], +"class_control_editor_base.html#a9988f3cd363ab1c4da96b3ccefa164a5":[0,0,17,29], +"class_control_editor_base.html#aa2b2fe5ea81a3eb8c28ee9064773be93":[0,0,17,2], +"class_control_editor_base.html#aa99174f98107c89bd6026579ec2f4343":[0,0,17,15], +"class_control_editor_base.html#aac008c284d2bc841ed52bfaca84ee85a":[0,0,17,18], +"class_control_editor_base.html#aac385a40c76a8036b07b6a7f08aeb062a5666c9d2fa9c12a8ba29af0534fcd9d5":[0,0,17,0], +"class_control_editor_base.html#aac385a40c76a8036b07b6a7f08aeb062abdc9b82b5a3ad6189dc3437bc07cc0e3":[0,0,17,1], +"class_control_editor_base.html#abc78a2b37d5ce3dda133a1a1243e7d0d":[0,0,17,5], +"class_control_editor_base.html#abeeae17fcf7de0fd5a15377c3db05f34":[0,0,17,9], +"class_control_editor_base.html#ac16f79d8c489e0d64a0ba2f8635c413a":[0,0,17,31], +"class_control_editor_base.html#ac358a5750676e8204d1ad7a899195636":[0,0,17,34], +"class_control_editor_base.html#ac5edc2aea7c9e063f1d36c06442792f4":[0,0,17,8], +"class_control_editor_base.html#acdc078affdcc3daac68d8b83c630bfaf":[0,0,17,3], +"class_control_editor_base.html#ad1f69087303790b7eedd86022cac6da4":[0,0,17,30], +"class_control_editor_base.html#ad639d4afcd7f3b9eac6cd8a9f8a20ce6":[0,0,17,28], +"class_control_editor_base.html#ae506926ab0a4f91dddb22e0e9fca4900":[0,0,17,27], +"class_control_editor_base.html#aea5060f214daa10dbd7742f8169f97df":[0,0,17,6], +"class_control_editor_base.html#af41c63751f51341e35a71ea5048244a4":[0,0,17,14], +"class_control_editor_base.html#af8715ecc176911865823d2bc777e8501":[0,0,17,13], +"class_control_editor_base.html#afeb914b18f305b1dedd01aae96c9a4d8":[0,0,17,32], +"class_control_element.html":[0,0,18], +"class_control_element.html#a038e940fc33ac3e443502169104d7ebd":[0,0,18,4], +"class_control_element.html#a375be1f070c19579c27d381be2b09e4b":[0,0,18,8], +"class_control_element.html#a559fa662c390b9257c2e23fabdfd1801":[0,0,18,9], +"class_control_element.html#a61440a392d438de163bfe9ffb8e9efec":[0,0,18,12], +"class_control_element.html#a802885ecd7464b6ae085da276be4d06c":[0,0,18,13], +"class_control_element.html#a8958776ec4e32bc0b23f90f4ee9ea2e3":[0,0,18,5], +"class_control_element.html#a899b994168cf0c98695e82a4f3e7c98b":[0,0,18,10], +"class_control_element.html#a8f817b751c7766f070cee27d094a5499":[0,0,18,7], +"class_control_element.html#aa03ed482f0f726e8b4724e815b1cdfb1":[0,0,18,0], +"class_control_element.html#aac3aa20b1c5f9eb7e188298dda34600f":[0,0,18,3], +"class_control_element.html#ab77716614985cab1c7f098af1603c2f1":[0,0,18,2], +"class_control_element.html#abcd5f56c2c771a58b0f1ea80eb8c6a86":[0,0,18,16], +"class_control_element.html#ac8bd52ddb8eed51a217fecb2eed65708":[0,0,18,6], +"class_control_element.html#aeb164b935f9bdb0646b988782e979758":[0,0,18,1], +"class_control_element.html#aeee4f373f0ebca4589b9ef77fe40c291":[0,0,18,11], +"class_control_element.html#af1813931d9b51f5def437ba3c31e8aba":[0,0,18,14], +"class_control_element.html#af669ba711650e3befaad4ed70d2776ab":[0,0,18,15], +"class_control_element_button.html":[0,0,19], +"class_control_element_button.html#a018b99c1b086125e7b728c2cc25b5ff5":[0,0,19,4], +"class_control_element_button.html#a4ad1738a01a24c58cf0b21d8f3195da8":[0,0,19,11], +"class_control_element_button.html#a4b1d55323d02bca75732b5e32878b1d0":[0,0,19,12], +"class_control_element_button.html#a679fe222f172d35dc1a7e157a42a7dbf":[0,0,19,1], +"class_control_element_button.html#a81773f33a05c2b976bef693604a3ca4b":[0,0,19,8], +"class_control_element_button.html#a831ba4a73c4a8c281edb072f3f68eff8":[0,0,19,14], +"class_control_element_button.html#a90252ea5c337a0836292a1154fc2fd8d":[0,0,19,15], +"class_control_element_button.html#aa0d011f5dc84d644c10709116c82d8bf":[0,0,19,13], +"class_control_element_button.html#ab53fa1072a78f8f2e81548bdb7edde4f":[0,0,19,3], +"class_control_element_button.html#ab87a13cd01a3ac7222a1df2e5252a2ac":[0,0,19,10], +"class_control_element_button.html#ac711aa61fe25de7f632a3f2f75fe4fae":[0,0,19,9], +"class_control_element_button.html#ad45b776fd9046f11fe147e8145474478":[0,0,19,0], +"class_control_element_button.html#ade13a62ffdb211d3851f653f2b3dd004":[0,0,19,5], +"class_control_element_button.html#aea4e242359ba70bb26cd29b2bab7d7c8":[0,0,19,7], +"class_control_element_button.html#aef6c1c0b63d71a9e1a99601946d6e0ff":[0,0,19,2], +"class_control_element_button.html#af3ea4e284321f86aa12b98ac23ea2026":[0,0,19,16], +"class_control_element_button.html#afa6effe38a6b8a4070d36dc09dfcd429":[0,0,19,6], "class_control_element_container.html":[0,0,20], "class_control_element_container.html#a0471ac31855189485313268d0b3a53db":[0,0,20,4], "class_control_element_container.html#a0bb9367530c05a868d51ca8ad73ad023":[0,0,20,13], @@ -177,77 +249,5 @@ var NAVTREEINDEX3 = "class_data_report_base.html#adf8b55cd980934b9d5f6582493b688a0":[0,0,25,36], "class_data_report_base.html#aee8021cec2e859cca2318801449222ea":[0,0,25,46], "class_data_report_base.html#aeffec8eaed4992ba98bb3edd40a684d8":[0,0,25,42], -"class_data_report_base.html#af14bc6a653ffa84a301d6a2ceb4a9d04":[0,0,25,3], -"class_data_report_base.html#af7230eab205cf660e465b5a4ed36f41c":[0,0,25,7], -"class_data_report_base.html#affdc5a9cd95a50e6438becb1d13015ed":[0,0,25,12], -"class_electric_calculation.html":[0,0,26], -"class_electric_calculation.html#a044a85b589d5eee879de3348248fc612":[0,0,26,3], -"class_electric_calculation.html#a06ce7fe37ee6cc2c786573f094493659":[0,0,26,26], -"class_electric_calculation.html#a0c88feb4f01309795e8a0cf5064a7d90":[0,0,26,28], -"class_electric_calculation.html#a0eeb4b5afc082617247351857af26c22":[0,0,26,22], -"class_electric_calculation.html#a1d417da6eeb8c12f7be6501fff6f7049":[0,0,26,21], -"class_electric_calculation.html#a1e70291bfa9a0850d9ffcbee44daa2f7":[0,0,26,1], -"class_electric_calculation.html#a370884bcb0b406d8c9151ed064620a86":[0,0,26,27], -"class_electric_calculation.html#a3b89149e5fb56253c0629c9d260b3b7e":[0,0,26,17], -"class_electric_calculation.html#a458ecbb5afd86d9049ed3508256d8fe1":[0,0,26,2], -"class_electric_calculation.html#a4bf7c82e4e8bc87a4e42ad9b124ea9e5":[0,0,26,23], -"class_electric_calculation.html#a4ddabc6210146ae1ccae5f6911095bfd":[0,0,26,7], -"class_electric_calculation.html#a55cd49ca9c2771533e6e2f16bb9ec1fc":[0,0,26,20], -"class_electric_calculation.html#a6663e7a20e96ee975bd0f7d54b8a6f70":[0,0,26,0], -"class_electric_calculation.html#a689622805bdea60428e6eea19795dff9":[0,0,26,24], -"class_electric_calculation.html#a6cca6be3c0b79741a49b1631e38fc3be":[0,0,26,31], -"class_electric_calculation.html#a72386789cd0ff595e937d70e18cad697":[0,0,26,29], -"class_electric_calculation.html#a7c01b0f6b2f656db999ff4933d86d19d":[0,0,26,5], -"class_electric_calculation.html#a8709a452d684d4224d32591c281ae0ed":[0,0,26,10], -"class_electric_calculation.html#a8dcbf4f2468a5b55680ba4c17d909102":[0,0,26,30], -"class_electric_calculation.html#a906ce639a5d6c5d7946fe8824f1b4f1b":[0,0,26,9], -"class_electric_calculation.html#a939e6e75b5e0cb555a82b2f9ef59c59d":[0,0,26,18], -"class_electric_calculation.html#aa5e278a1c5ba1b6159c21ae2ff2b23b4":[0,0,26,12], -"class_electric_calculation.html#aca3381e8f6663394e4d257a54e4e2a24":[0,0,26,6], -"class_electric_calculation.html#ad7bfee2d7cba726ff6aa7605a969d49a":[0,0,26,25], -"class_electric_calculation.html#ad8719b10c3c4b85b316d3daa71064840":[0,0,26,15], -"class_electric_calculation.html#ade330c7267088dcbdd7c8e7f8c302da3":[0,0,26,14], -"class_electric_calculation.html#ae721d26e05b66887bfb7125f76ec9e9c":[0,0,26,13], -"class_electric_calculation.html#ae9b5e9b51615141e88de0a0f99a7741e":[0,0,26,16], -"class_electric_calculation.html#aed4e5f37f8a06d0ad305334d2847cd7f":[0,0,26,4], -"class_electric_calculation.html#af00a6599f2b0b4e35bf0f8c70195447c":[0,0,26,19], -"class_electric_calculation.html#af8eff271de83898c536deda1aab22d48":[0,0,26,11], -"class_electric_calculation.html#aff1a62936d87e61764b13f3b0212cf92":[0,0,26,8], -"class_electromechanical.html":[0,0,27], -"class_electromechanical.html#a000d1cd6ac54aa864c9de3ee9015a17a":[0,0,27,21], -"class_electromechanical.html#a001abfe3809e6425f7f0bd67adaf28f4":[0,0,27,1], -"class_electromechanical.html#a03939bf250c99309cdf90c3bda4911d4":[0,0,27,23], -"class_electromechanical.html#a1070faed7544316f653e1a09fcccf475":[0,0,27,36], -"class_electromechanical.html#a10b7ceb1a8066461c5369d210cff48d5":[0,0,27,6], -"class_electromechanical.html#a110cd09af0070718c95d5300adcf754f":[0,0,27,35], -"class_electromechanical.html#a159776bb812bc74d94c8abe5bb8b3e10":[0,0,27,39], -"class_electromechanical.html#a18e698b73396100928175811236eebf4":[0,0,27,32], -"class_electromechanical.html#a1e7fff4570b7a983f79a22aafed2112d":[0,0,27,29], -"class_electromechanical.html#a23d720e7a18a781b808cc7ca0f130ceb":[0,0,27,43], -"class_electromechanical.html#a28873d1ce6c1bbee57a07dabc5053423":[0,0,27,44], -"class_electromechanical.html#a30ecddf5249f545e73b2aaaf19cbec50":[0,0,27,0], -"class_electromechanical.html#a3e7a7dfe02d9277957552f5a46f96dd1":[0,0,27,37], -"class_electromechanical.html#a488985a77171f915145ecc5d891db04f":[0,0,27,2], -"class_electromechanical.html#a4ccf60ce21c83ff757e1a7de99a00704":[0,0,27,13], -"class_electromechanical.html#a4e3c1766ff06883a681f39d536a41136":[0,0,27,3], -"class_electromechanical.html#a4eacb39ac3ab6b4fd3e0cf963f030ce2":[0,0,27,40], -"class_electromechanical.html#a4fe6bcd83ae05c0cf6827eed9d0eb029":[0,0,27,28], -"class_electromechanical.html#a6192a9b4152353c983b623048b1da460":[0,0,27,10], -"class_electromechanical.html#a69b4bec62476de94bf823714972edd68":[0,0,27,20], -"class_electromechanical.html#a6c016a1470a0d910e4522b6027f3b95c":[0,0,27,31], -"class_electromechanical.html#a790c142f8d9db534c7e368711e84f61e":[0,0,27,14], -"class_electromechanical.html#a7972213c6043ca7c890b9f15d3e4162f":[0,0,27,8], -"class_electromechanical.html#a7cce38fb26c4e1e6a70bd605285848e8":[0,0,27,19], -"class_electromechanical.html#a827e9862cf10ebdc65c50f7542b67020":[0,0,27,34], -"class_electromechanical.html#a82b5c5c2aeefd49706199d0ba140d300":[0,0,27,5], -"class_electromechanical.html#a8668c1b2881d2f2a173d15c46c8efb9d":[0,0,27,18], -"class_electromechanical.html#a8fc1d8f7b697f8383681e3d3e7d66c72":[0,0,27,12], -"class_electromechanical.html#a9b076237d26ff011552ed624a5d9bbe2":[0,0,27,7], -"class_electromechanical.html#a9d030ba42b2f8f2ba129797c061d71cb":[0,0,27,15], -"class_electromechanical.html#aa00d6b356a74649a12fbdd06d44b1d28":[0,0,27,33], -"class_electromechanical.html#aad655c165bc53cce5d5fdd8ae9339ba2":[0,0,27,9], -"class_electromechanical.html#ab0d7d031ccc501d5101fabc7b48eb70e":[0,0,27,11], -"class_electromechanical.html#abedf14a8b4d2c9914c972d9bdf3463c6":[0,0,27,24], -"class_electromechanical.html#ac0dfbab6529f02705d1c66bda5cac704":[0,0,27,41], -"class_electromechanical.html#ac1d6b85d886abd344d8b12d6d8665f1f":[0,0,27,22] +"class_data_report_base.html#af14bc6a653ffa84a301d6a2ceb4a9d04":[0,0,25,3] }; diff --git a/docs/doxygen/html/navtreeindex4.js b/docs/doxygen/html/navtreeindex4.js index 09640ed..37ad3ff 100644 --- a/docs/doxygen/html/navtreeindex4.js +++ b/docs/doxygen/html/navtreeindex4.js @@ -1,17 +1,95 @@ var NAVTREEINDEX4 = { -"class_electromechanical.html#ac51fdb6f0ae13514b6986f99a782532a":[0,0,27,45], -"class_electromechanical.html#ac627a99f958656bb2385fef5f7101018":[0,0,27,38], -"class_electromechanical.html#aceaa86ce0dfc1842420568db7037fb12":[0,0,27,42], -"class_electromechanical.html#ad78da79b4af8651eae3e4d8800f57d2b":[0,0,27,47], -"class_electromechanical.html#ad963e529cd06cf42a9eef98dbbf04edb":[0,0,27,27], -"class_electromechanical.html#adb77fe8bf93882f3cd039c126ab79f7d":[0,0,27,25], -"class_electromechanical.html#ade07879f964c541bbf92970d1fcd090a":[0,0,27,26], -"class_electromechanical.html#ae359ee1a06f1bcefbf03e3d0f4f7d10a":[0,0,27,30], -"class_electromechanical.html#ae5f5162b53e8969fd933af2ef80d1b67":[0,0,27,16], -"class_electromechanical.html#ae8bf375c5f8bf38a66e57eee3b7e46ca":[0,0,27,46], +"class_data_report_base.html#af7230eab205cf660e465b5a4ed36f41c":[0,0,25,7], +"class_data_report_base.html#affdc5a9cd95a50e6438becb1d13015ed":[0,0,25,12], +"class_electric_calculation.html":[0,0,26], +"class_electric_calculation.html#a044a85b589d5eee879de3348248fc612":[0,0,26,3], +"class_electric_calculation.html#a06ce7fe37ee6cc2c786573f094493659":[0,0,26,26], +"class_electric_calculation.html#a0c88feb4f01309795e8a0cf5064a7d90":[0,0,26,28], +"class_electric_calculation.html#a0eeb4b5afc082617247351857af26c22":[0,0,26,22], +"class_electric_calculation.html#a1d417da6eeb8c12f7be6501fff6f7049":[0,0,26,21], +"class_electric_calculation.html#a1e70291bfa9a0850d9ffcbee44daa2f7":[0,0,26,1], +"class_electric_calculation.html#a370884bcb0b406d8c9151ed064620a86":[0,0,26,27], +"class_electric_calculation.html#a3b89149e5fb56253c0629c9d260b3b7e":[0,0,26,17], +"class_electric_calculation.html#a458ecbb5afd86d9049ed3508256d8fe1":[0,0,26,2], +"class_electric_calculation.html#a4bf7c82e4e8bc87a4e42ad9b124ea9e5":[0,0,26,23], +"class_electric_calculation.html#a4ddabc6210146ae1ccae5f6911095bfd":[0,0,26,7], +"class_electric_calculation.html#a55cd49ca9c2771533e6e2f16bb9ec1fc":[0,0,26,20], +"class_electric_calculation.html#a6663e7a20e96ee975bd0f7d54b8a6f70":[0,0,26,0], +"class_electric_calculation.html#a689622805bdea60428e6eea19795dff9":[0,0,26,24], +"class_electric_calculation.html#a6cca6be3c0b79741a49b1631e38fc3be":[0,0,26,31], +"class_electric_calculation.html#a72386789cd0ff595e937d70e18cad697":[0,0,26,29], +"class_electric_calculation.html#a7c01b0f6b2f656db999ff4933d86d19d":[0,0,26,5], +"class_electric_calculation.html#a8709a452d684d4224d32591c281ae0ed":[0,0,26,10], +"class_electric_calculation.html#a8dcbf4f2468a5b55680ba4c17d909102":[0,0,26,30], +"class_electric_calculation.html#a906ce639a5d6c5d7946fe8824f1b4f1b":[0,0,26,9], +"class_electric_calculation.html#a939e6e75b5e0cb555a82b2f9ef59c59d":[0,0,26,18], +"class_electric_calculation.html#aa5e278a1c5ba1b6159c21ae2ff2b23b4":[0,0,26,12], +"class_electric_calculation.html#aca3381e8f6663394e4d257a54e4e2a24":[0,0,26,6], +"class_electric_calculation.html#ad7bfee2d7cba726ff6aa7605a969d49a":[0,0,26,25], +"class_electric_calculation.html#ad8719b10c3c4b85b316d3daa71064840":[0,0,26,15], +"class_electric_calculation.html#ade330c7267088dcbdd7c8e7f8c302da3":[0,0,26,14], +"class_electric_calculation.html#ae721d26e05b66887bfb7125f76ec9e9c":[0,0,26,13], +"class_electric_calculation.html#ae9b5e9b51615141e88de0a0f99a7741e":[0,0,26,16], +"class_electric_calculation.html#aed4e5f37f8a06d0ad305334d2847cd7f":[0,0,26,4], +"class_electric_calculation.html#af00a6599f2b0b4e35bf0f8c70195447c":[0,0,26,19], +"class_electric_calculation.html#af8eff271de83898c536deda1aab22d48":[0,0,26,11], +"class_electric_calculation.html#aff1a62936d87e61764b13f3b0212cf92":[0,0,26,8], +"class_electromechanical.html":[0,0,27], +"class_electromechanical.html#a000d1cd6ac54aa864c9de3ee9015a17a":[0,0,27,22], +"class_electromechanical.html#a001abfe3809e6425f7f0bd67adaf28f4":[0,0,27,1], +"class_electromechanical.html#a03939bf250c99309cdf90c3bda4911d4":[0,0,27,24], +"class_electromechanical.html#a1070faed7544316f653e1a09fcccf475":[0,0,27,42], +"class_electromechanical.html#a110cd09af0070718c95d5300adcf754f":[0,0,27,41], +"class_electromechanical.html#a159776bb812bc74d94c8abe5bb8b3e10":[0,0,27,45], +"class_electromechanical.html#a18e698b73396100928175811236eebf4":[0,0,27,33], +"class_electromechanical.html#a1e7fff4570b7a983f79a22aafed2112d":[0,0,27,30], +"class_electromechanical.html#a237471acf9a372a9b1cd1481803571d5":[0,0,27,40], +"class_electromechanical.html#a23d720e7a18a781b808cc7ca0f130ceb":[0,0,27,49], +"class_electromechanical.html#a28873d1ce6c1bbee57a07dabc5053423":[0,0,27,50], +"class_electromechanical.html#a30ecddf5249f545e73b2aaaf19cbec50":[0,0,27,0], +"class_electromechanical.html#a3a7d7043e936b7649a741cf9d39e01b9":[0,0,27,36], +"class_electromechanical.html#a3e7a7dfe02d9277957552f5a46f96dd1":[0,0,27,43], +"class_electromechanical.html#a4029ebc888d91ec49b9bdf9f7cdf2631":[0,0,27,35], +"class_electromechanical.html#a488985a77171f915145ecc5d891db04f":[0,0,27,2], +"class_electromechanical.html#a4c82ed8fc748149bb116ee532e6ee978":[0,0,27,37], +"class_electromechanical.html#a4ccf60ce21c83ff757e1a7de99a00704":[0,0,27,14], +"class_electromechanical.html#a4eacb39ac3ab6b4fd3e0cf963f030ce2":[0,0,27,46], +"class_electromechanical.html#a4fe6bcd83ae05c0cf6827eed9d0eb029":[0,0,27,29], +"class_electromechanical.html#a6192a9b4152353c983b623048b1da460":[0,0,27,10], +"class_electromechanical.html#a69b4bec62476de94bf823714972edd68":[0,0,27,21], +"class_electromechanical.html#a6c016a1470a0d910e4522b6027f3b95c":[0,0,27,32], +"class_electromechanical.html#a790c142f8d9db534c7e368711e84f61e":[0,0,27,15], +"class_electromechanical.html#a7972213c6043ca7c890b9f15d3e4162f":[0,0,27,9], +"class_electromechanical.html#a7cce38fb26c4e1e6a70bd605285848e8":[0,0,27,20], +"class_electromechanical.html#a827e9862cf10ebdc65c50f7542b67020":[0,0,27,38], +"class_electromechanical.html#a8668c1b2881d2f2a173d15c46c8efb9d":[0,0,27,19], +"class_electromechanical.html#a8ca8ab15ead93ee615277698bf0b3867":[0,0,27,6], +"class_electromechanical.html#a8fc1d8f7b697f8383681e3d3e7d66c72":[0,0,27,13], +"class_electromechanical.html#a900832be747b8b3e41e901235012bf87":[0,0,27,7], +"class_electromechanical.html#a9b076237d26ff011552ed624a5d9bbe2":[0,0,27,8], +"class_electromechanical.html#a9d030ba42b2f8f2ba129797c061d71cb":[0,0,27,16], +"class_electromechanical.html#aa00d6b356a74649a12fbdd06d44b1d28":[0,0,27,34], +"class_electromechanical.html#aa191e34b2a6cbfd0d89c78da14f1d7f7":[0,0,27,11], +"class_electromechanical.html#aa59f55e739c674f4ede073eadbb79ac0":[0,0,27,3], +"class_electromechanical.html#ab0d7d031ccc501d5101fabc7b48eb70e":[0,0,27,12], +"class_electromechanical.html#abedf14a8b4d2c9914c972d9bdf3463c6":[0,0,27,25], +"class_electromechanical.html#ac0dfbab6529f02705d1c66bda5cac704":[0,0,27,47], +"class_electromechanical.html#ac185e65f3073319fc4ac4ec11c328337":[0,0,27,5], +"class_electromechanical.html#ac1d6b85d886abd344d8b12d6d8665f1f":[0,0,27,23], +"class_electromechanical.html#ac51fdb6f0ae13514b6986f99a782532a":[0,0,27,51], +"class_electromechanical.html#ac627a99f958656bb2385fef5f7101018":[0,0,27,44], +"class_electromechanical.html#ac684393f47d36a6038d562e92df56ab6":[0,0,27,39], +"class_electromechanical.html#aceaa86ce0dfc1842420568db7037fb12":[0,0,27,48], +"class_electromechanical.html#ad78da79b4af8651eae3e4d8800f57d2b":[0,0,27,53], +"class_electromechanical.html#ad963e529cd06cf42a9eef98dbbf04edb":[0,0,27,28], +"class_electromechanical.html#adb77fe8bf93882f3cd039c126ab79f7d":[0,0,27,26], +"class_electromechanical.html#ade07879f964c541bbf92970d1fcd090a":[0,0,27,27], +"class_electromechanical.html#ae359ee1a06f1bcefbf03e3d0f4f7d10a":[0,0,27,31], +"class_electromechanical.html#ae5f5162b53e8969fd933af2ef80d1b67":[0,0,27,17], +"class_electromechanical.html#ae8bf375c5f8bf38a66e57eee3b7e46ca":[0,0,27,52], "class_electromechanical.html#af02c1382b8a7d3085831d3a1e89526f6":[0,0,27,4], -"class_electromechanical.html#affca5cc58794d76c6f195f74406d2214":[0,0,27,17], +"class_electromechanical.html#affca5cc58794d76c6f195f74406d2214":[0,0,27,18], "class_element.html":[0,0,28], "class_element.html#a01563b5b2fed2860132f4dd1593f9eea":[0,0,28,51], "class_element.html#a038dfd8452fe48ab04bc4e47820c148e":[0,0,28,32], @@ -171,83 +249,5 @@ var NAVTREEINDEX4 = "class_exponential.html#ae8e635b32b5d6a8226a3654aa639094f":[0,0,32,10], "class_exponential.html#af5f172e2f7ae7df0fc79b44b55355339":[0,0,32,3], "class_exponential_form.html":[0,0,33], -"class_exponential_form.html#a04ab824bc029df387aa38ca8b379206f":[0,0,33,5], -"class_exponential_form.html#a3c0b865be48a390d39b42a552afdd711":[0,0,33,1], -"class_exponential_form.html#a4c3cd70d6128d58f330a0f992a91da1a":[0,0,33,0], -"class_exponential_form.html#a8d3175dc7543f5612dcb04acf5e8fa0c":[0,0,33,3], -"class_exponential_form.html#ac4f9664d3e884b5ff8f18fddea362b63":[0,0,33,6], -"class_exponential_form.html#ae59514a694933a77cd7d7a1a9096b713":[0,0,33,4], -"class_exponential_form.html#af741be36de488170a80c88df01e17667":[0,0,33,2], -"class_exponential_form_base.html":[0,0,34], -"class_exponential_form_base.html#a01c6236bffb9620ff2ef2a0afcbc7408":[0,0,34,0], -"class_exponential_form_base.html#a13c869c29285c1e04def44db6aa4e364":[0,0,34,21], -"class_exponential_form_base.html#a2973b411828496b3c07bcc465f11cfb1":[0,0,34,11], -"class_exponential_form_base.html#a2b4013cf5e588a510eee19de6a63812d":[0,0,34,6], -"class_exponential_form_base.html#a44197d79b2c8138b56820eeb5407876b":[0,0,34,17], -"class_exponential_form_base.html#a6ea718012d6396390e94d9423edc2ae1":[0,0,34,4], -"class_exponential_form_base.html#a6eb4ee27335ee6f5b43da075cf5d1c5f":[0,0,34,7], -"class_exponential_form_base.html#a709bad49cc8e8bc61b36757c6b9d612b":[0,0,34,10], -"class_exponential_form_base.html#a70ec52bb9f74b69d138b76393f231478":[0,0,34,19], -"class_exponential_form_base.html#a753ef8e6ee247a215c523442f51db2a0":[0,0,34,8], -"class_exponential_form_base.html#a754e757add7b6b599be289087b833d01":[0,0,34,14], -"class_exponential_form_base.html#a7aac97383b6d0af90199ead7c3ec1fdc":[0,0,34,3], -"class_exponential_form_base.html#a7d56bcf4a7fda1e40b0eb2f08ba751ab":[0,0,34,18], -"class_exponential_form_base.html#a7d6e9e849659fc66e4c6ec3031570032":[0,0,34,13], -"class_exponential_form_base.html#a99b0bf1a17ef2680ee09fac4dca01ccf":[0,0,34,20], -"class_exponential_form_base.html#a9b0573a2065f0bbaf8048e2f78618a36":[0,0,34,1], -"class_exponential_form_base.html#a9b1312da21b4d6ec8f2d79ae64c31d57":[0,0,34,2], -"class_exponential_form_base.html#a9e2feaac372a2e3ecf69ea8c46f32c52":[0,0,34,12], -"class_exponential_form_base.html#ac0f0130cf92f784b7ff098e42c84005e":[0,0,34,5], -"class_exponential_form_base.html#ae0a60ea98d18aa91e5388fee9131eaeb":[0,0,34,9], -"class_exponential_form_base.html#ae4e8752bf0bb718b4aabc54400e997c7":[0,0,34,15], -"class_exponential_form_base.html#ae8659fd109e33fbea9627ed4c885d6d8":[0,0,34,16], -"class_fault.html":[0,0,35], -"class_fault.html#a100c6aac1a159eade54dfdab15717018":[0,0,35,14], -"class_fault.html#a293915690d60c4fea81038d535866d1c":[0,0,35,18], -"class_fault.html#a2beb820c91f139c64bac413520540f8b":[0,0,35,13], -"class_fault.html#a2f9c9605c49dd7761a9b8470913f6eea":[0,0,35,11], -"class_fault.html#a3bbbe363bbda4ab262cf9ff9ef8d283e":[0,0,35,8], -"class_fault.html#a3c2f14cd1da46cb88109fdb172d959b0":[0,0,35,3], -"class_fault.html#a4120f861b073783b4fb82385171fbd0f":[0,0,35,4], -"class_fault.html#a42019654142cd8187b314e43d70262eb":[0,0,35,2], -"class_fault.html#a6f0ad59005f42db46899c54bd0bb2451":[0,0,35,9], -"class_fault.html#a77baeae2c3388de3f7bbeabf52c99bef":[0,0,35,1], -"class_fault.html#a8ec9ef08820a9e0b6ef64c6a11f17214":[0,0,35,20], -"class_fault.html#a8fbe3ce9f7288c4f8261db2d9a89adbb":[0,0,35,0], -"class_fault.html#a900ca28916f6b5d1920916da364792ac":[0,0,35,7], -"class_fault.html#aa42a2ef6e0de6a0afd7b90e5f5d71d7f":[0,0,35,12], -"class_fault.html#aaf57534c2f6f2f1105ef5b8fab1c7af5":[0,0,35,10], -"class_fault.html#ab273c91b6be44a546faf8dac1c5a548c":[0,0,35,15], -"class_fault.html#ac7942a558f3ecdb8c06ddb49567c487a":[0,0,35,5], -"class_fault.html#ae280475abbb392e1db237feaacf3c8a7":[0,0,35,16], -"class_fault.html#ae5875b1e3ee6ea4a4748759a996ad37f":[0,0,35,19], -"class_fault.html#aec2ca2d73097eab3dc3f368bf656602c":[0,0,35,17], -"class_fault.html#af1bb91359dfe8df0251a2031957d3ddf":[0,0,35,6], -"class_file_handing.html":[0,0,36], -"class_file_handing.html#a16130b13435ef1cc90268599c4e9cc5a":[0,0,36,3], -"class_file_handing.html#a29d0af971b7a6810224c504ac072903a":[0,0,36,13], -"class_file_handing.html#a2d7ad3fb6f8f920aa6f0c720cc4852f1":[0,0,36,23], -"class_file_handing.html#a315b88e9e9bd75cb45794bf9f52a7925":[0,0,36,4], -"class_file_handing.html#a34539e10caa48ede6a3e9ac64b89e0d5":[0,0,36,15], -"class_file_handing.html#a3ca9be771b02e58e554dc7a45a11e510":[0,0,36,6], -"class_file_handing.html#a4444e602d96ed6817e9ad2838e4d57a5":[0,0,36,25], -"class_file_handing.html#a46142226e6ce37032008523a3095bba8":[0,0,36,26], -"class_file_handing.html#a54d666757710bc163141674c9efb576e":[0,0,36,17], -"class_file_handing.html#a561b1bc5807aeb4424f0047b003b9238":[0,0,36,11], -"class_file_handing.html#a6b5b47dd26a56ee2f8f2ac74f25d6811":[0,0,36,27], -"class_file_handing.html#a7b5ac3287c11ee33c0e802dd60e07e68":[0,0,36,24], -"class_file_handing.html#a815fb97269b3755ac1a00cb196ee226c":[0,0,36,22], -"class_file_handing.html#a8948e014c857b698b3ae204fd7bd8d1a":[0,0,36,14], -"class_file_handing.html#a8951c02ab38f7922e96de8024189a2b0":[0,0,36,19], -"class_file_handing.html#a96c5ba440caa8b0ab44a01e2bfd63f51":[0,0,36,12], -"class_file_handing.html#aa3719ae58a4b0072667a3b42c8d4d50d":[0,0,36,1], -"class_file_handing.html#aa3c18af0d859b78bf7d117c85e85a628":[0,0,36,10], -"class_file_handing.html#ab4f68fcd9986188a476cad92a9238d30":[0,0,36,0], -"class_file_handing.html#abe3af403418c668035bb38e6e6428f04":[0,0,36,20], -"class_file_handing.html#aca642a587c19e07a16cf65cb06f78950":[0,0,36,21], -"class_file_handing.html#ad334c006a4d5ae7ef15dd6b426bcbfa8":[0,0,36,2], -"class_file_handing.html#ad3880248f7fa8c93c765a4408ca33893":[0,0,36,9], -"class_file_handing.html#ad880af02d674437811fec077a84a7909":[0,0,36,5], -"class_file_handing.html#adde631f17207ec5744c0dbdfe79d45d3":[0,0,36,8], -"class_file_handing.html#ae3d0597f99b08eb29188f9565e036060":[0,0,36,18] +"class_exponential_form.html#a04ab824bc029df387aa38ca8b379206f":[0,0,33,5] }; diff --git a/docs/doxygen/html/navtreeindex5.js b/docs/doxygen/html/navtreeindex5.js index a027e14..d4cde96 100644 --- a/docs/doxygen/html/navtreeindex5.js +++ b/docs/doxygen/html/navtreeindex5.js @@ -1,5 +1,83 @@ var NAVTREEINDEX5 = { +"class_exponential_form.html#a3c0b865be48a390d39b42a552afdd711":[0,0,33,1], +"class_exponential_form.html#a4c3cd70d6128d58f330a0f992a91da1a":[0,0,33,0], +"class_exponential_form.html#a8d3175dc7543f5612dcb04acf5e8fa0c":[0,0,33,3], +"class_exponential_form.html#ac4f9664d3e884b5ff8f18fddea362b63":[0,0,33,6], +"class_exponential_form.html#ae59514a694933a77cd7d7a1a9096b713":[0,0,33,4], +"class_exponential_form.html#af741be36de488170a80c88df01e17667":[0,0,33,2], +"class_exponential_form_base.html":[0,0,34], +"class_exponential_form_base.html#a01c6236bffb9620ff2ef2a0afcbc7408":[0,0,34,0], +"class_exponential_form_base.html#a13c869c29285c1e04def44db6aa4e364":[0,0,34,21], +"class_exponential_form_base.html#a2973b411828496b3c07bcc465f11cfb1":[0,0,34,11], +"class_exponential_form_base.html#a2b4013cf5e588a510eee19de6a63812d":[0,0,34,6], +"class_exponential_form_base.html#a44197d79b2c8138b56820eeb5407876b":[0,0,34,17], +"class_exponential_form_base.html#a6ea718012d6396390e94d9423edc2ae1":[0,0,34,4], +"class_exponential_form_base.html#a6eb4ee27335ee6f5b43da075cf5d1c5f":[0,0,34,7], +"class_exponential_form_base.html#a709bad49cc8e8bc61b36757c6b9d612b":[0,0,34,10], +"class_exponential_form_base.html#a70ec52bb9f74b69d138b76393f231478":[0,0,34,19], +"class_exponential_form_base.html#a753ef8e6ee247a215c523442f51db2a0":[0,0,34,8], +"class_exponential_form_base.html#a754e757add7b6b599be289087b833d01":[0,0,34,14], +"class_exponential_form_base.html#a7aac97383b6d0af90199ead7c3ec1fdc":[0,0,34,3], +"class_exponential_form_base.html#a7d56bcf4a7fda1e40b0eb2f08ba751ab":[0,0,34,18], +"class_exponential_form_base.html#a7d6e9e849659fc66e4c6ec3031570032":[0,0,34,13], +"class_exponential_form_base.html#a99b0bf1a17ef2680ee09fac4dca01ccf":[0,0,34,20], +"class_exponential_form_base.html#a9b0573a2065f0bbaf8048e2f78618a36":[0,0,34,1], +"class_exponential_form_base.html#a9b1312da21b4d6ec8f2d79ae64c31d57":[0,0,34,2], +"class_exponential_form_base.html#a9e2feaac372a2e3ecf69ea8c46f32c52":[0,0,34,12], +"class_exponential_form_base.html#ac0f0130cf92f784b7ff098e42c84005e":[0,0,34,5], +"class_exponential_form_base.html#ae0a60ea98d18aa91e5388fee9131eaeb":[0,0,34,9], +"class_exponential_form_base.html#ae4e8752bf0bb718b4aabc54400e997c7":[0,0,34,15], +"class_exponential_form_base.html#ae8659fd109e33fbea9627ed4c885d6d8":[0,0,34,16], +"class_fault.html":[0,0,35], +"class_fault.html#a100c6aac1a159eade54dfdab15717018":[0,0,35,14], +"class_fault.html#a293915690d60c4fea81038d535866d1c":[0,0,35,18], +"class_fault.html#a2beb820c91f139c64bac413520540f8b":[0,0,35,13], +"class_fault.html#a2f9c9605c49dd7761a9b8470913f6eea":[0,0,35,11], +"class_fault.html#a3bbbe363bbda4ab262cf9ff9ef8d283e":[0,0,35,8], +"class_fault.html#a3c2f14cd1da46cb88109fdb172d959b0":[0,0,35,3], +"class_fault.html#a4120f861b073783b4fb82385171fbd0f":[0,0,35,4], +"class_fault.html#a42019654142cd8187b314e43d70262eb":[0,0,35,2], +"class_fault.html#a6f0ad59005f42db46899c54bd0bb2451":[0,0,35,9], +"class_fault.html#a77baeae2c3388de3f7bbeabf52c99bef":[0,0,35,1], +"class_fault.html#a8ec9ef08820a9e0b6ef64c6a11f17214":[0,0,35,20], +"class_fault.html#a8fbe3ce9f7288c4f8261db2d9a89adbb":[0,0,35,0], +"class_fault.html#a900ca28916f6b5d1920916da364792ac":[0,0,35,7], +"class_fault.html#aa42a2ef6e0de6a0afd7b90e5f5d71d7f":[0,0,35,12], +"class_fault.html#aaf57534c2f6f2f1105ef5b8fab1c7af5":[0,0,35,10], +"class_fault.html#ab273c91b6be44a546faf8dac1c5a548c":[0,0,35,15], +"class_fault.html#ac7942a558f3ecdb8c06ddb49567c487a":[0,0,35,5], +"class_fault.html#ae280475abbb392e1db237feaacf3c8a7":[0,0,35,16], +"class_fault.html#ae5875b1e3ee6ea4a4748759a996ad37f":[0,0,35,19], +"class_fault.html#aec2ca2d73097eab3dc3f368bf656602c":[0,0,35,17], +"class_fault.html#af1bb91359dfe8df0251a2031957d3ddf":[0,0,35,6], +"class_file_handing.html":[0,0,36], +"class_file_handing.html#a16130b13435ef1cc90268599c4e9cc5a":[0,0,36,3], +"class_file_handing.html#a29d0af971b7a6810224c504ac072903a":[0,0,36,13], +"class_file_handing.html#a2d7ad3fb6f8f920aa6f0c720cc4852f1":[0,0,36,23], +"class_file_handing.html#a315b88e9e9bd75cb45794bf9f52a7925":[0,0,36,4], +"class_file_handing.html#a34539e10caa48ede6a3e9ac64b89e0d5":[0,0,36,15], +"class_file_handing.html#a3ca9be771b02e58e554dc7a45a11e510":[0,0,36,6], +"class_file_handing.html#a4444e602d96ed6817e9ad2838e4d57a5":[0,0,36,25], +"class_file_handing.html#a46142226e6ce37032008523a3095bba8":[0,0,36,26], +"class_file_handing.html#a54d666757710bc163141674c9efb576e":[0,0,36,17], +"class_file_handing.html#a561b1bc5807aeb4424f0047b003b9238":[0,0,36,11], +"class_file_handing.html#a6b5b47dd26a56ee2f8f2ac74f25d6811":[0,0,36,27], +"class_file_handing.html#a7b5ac3287c11ee33c0e802dd60e07e68":[0,0,36,24], +"class_file_handing.html#a815fb97269b3755ac1a00cb196ee226c":[0,0,36,22], +"class_file_handing.html#a8948e014c857b698b3ae204fd7bd8d1a":[0,0,36,14], +"class_file_handing.html#a8951c02ab38f7922e96de8024189a2b0":[0,0,36,19], +"class_file_handing.html#a96c5ba440caa8b0ab44a01e2bfd63f51":[0,0,36,12], +"class_file_handing.html#aa3719ae58a4b0072667a3b42c8d4d50d":[0,0,36,1], +"class_file_handing.html#aa3c18af0d859b78bf7d117c85e85a628":[0,0,36,10], +"class_file_handing.html#ab4f68fcd9986188a476cad92a9238d30":[0,0,36,0], +"class_file_handing.html#abe3af403418c668035bb38e6e6428f04":[0,0,36,20], +"class_file_handing.html#aca642a587c19e07a16cf65cb06f78950":[0,0,36,21], +"class_file_handing.html#ad334c006a4d5ae7ef15dd6b426bcbfa8":[0,0,36,2], +"class_file_handing.html#ad3880248f7fa8c93c765a4408ca33893":[0,0,36,9], +"class_file_handing.html#ad880af02d674437811fec077a84a7909":[0,0,36,5], +"class_file_handing.html#adde631f17207ec5744c0dbdfe79d45d3":[0,0,36,8], +"class_file_handing.html#ae3d0597f99b08eb29188f9565e036060":[0,0,36,18], "class_file_handing.html#ae85e5c9173a850b8165939fef18c8c88":[0,0,36,16], "class_file_handing.html#afd02764e9227133832464b2a7cb10952":[0,0,36,7], "class_gain.html":[0,0,37], @@ -171,83 +249,5 @@ var NAVTREEINDEX5 = "class_generator_stab_form_base.html#aad04072958142f172f665606f1ea7852":[0,0,44,116], "class_generator_stab_form_base.html#aade642097ee0b63eedda4e551d69cbf8":[0,0,44,26], "class_generator_stab_form_base.html#ab173aad50e838ed3a62be75fedb60e92":[0,0,44,81], -"class_generator_stab_form_base.html#ab176d40b9540799cd1e8fce5320fe1f1":[0,0,44,108], -"class_generator_stab_form_base.html#ab83eed913a74588eeaec593e777d6903":[0,0,44,33], -"class_generator_stab_form_base.html#ab95b366c7aa4649cea574ff416de5c7b":[0,0,44,4], -"class_generator_stab_form_base.html#ab97d99294656418a22473bc428010df5":[0,0,44,57], -"class_generator_stab_form_base.html#abb8626324d185a50ea1afb531acc7556":[0,0,44,51], -"class_generator_stab_form_base.html#abc3ac82c1793612e706ad8570d2485e2":[0,0,44,99], -"class_generator_stab_form_base.html#abc69d8331bc4a67f474dcd8d784e67b0":[0,0,44,80], -"class_generator_stab_form_base.html#abc75b52265409993c5961b05c72c0dbd":[0,0,44,15], -"class_generator_stab_form_base.html#abcd9ca2e90630de68c36a80fc94e84d7":[0,0,44,54], -"class_generator_stab_form_base.html#abd8d9528a7bb1a0e42cb4e410f96a8da":[0,0,44,34], -"class_generator_stab_form_base.html#abe5a2f8a8699b436ebde263613da9e41":[0,0,44,65], -"class_generator_stab_form_base.html#abec18f9a5bf99c4e94dc1b416eb527cd":[0,0,44,7], -"class_generator_stab_form_base.html#abf75abd9efd94f6df0d98583cd54011a":[0,0,44,1], -"class_generator_stab_form_base.html#ac124e324cb4a4a5f2c9d6e8b8ac9219d":[0,0,44,85], -"class_generator_stab_form_base.html#ac3e60ba5d2b4d80889805ca6a74ddacc":[0,0,44,89], -"class_generator_stab_form_base.html#ac819e946ed8c89f7be8af3d8659f0215":[0,0,44,20], -"class_generator_stab_form_base.html#aca6bebda04654a89a1ab9b0eb99cb297":[0,0,44,96], -"class_generator_stab_form_base.html#acb429d36652f171301f8006a00db8697":[0,0,44,112], -"class_generator_stab_form_base.html#ad16f4c2ac4f8e579a807d87f9d2727af":[0,0,44,82], -"class_generator_stab_form_base.html#adaa265bc1d9756eb75628c983107adec":[0,0,44,101], -"class_generator_stab_form_base.html#add9da345bd8c5a3a84c7e54aba9c0aff":[0,0,44,53], -"class_generator_stab_form_base.html#ade55f7fcf88393571e23342a6e3640c2":[0,0,44,27], -"class_generator_stab_form_base.html#adf24eaddce5f2a357ad80a9776b12d3e":[0,0,44,84], -"class_generator_stab_form_base.html#ae34a23fbe6b549cee19cc4095c5d94c7":[0,0,44,107], -"class_generator_stab_form_base.html#ae6bd7cfd4d167b5e1bc474d426ca8a30":[0,0,44,6], -"class_generator_stab_form_base.html#ae85799c9d8bb89c92029f2da7678c1f7":[0,0,44,50], -"class_generator_stab_form_base.html#aed066d5bfa8dcfada7d2ed21aa567b8a":[0,0,44,45], -"class_generator_stab_form_base.html#af03772fb1570ab9d80f1690acc52e102":[0,0,44,58], -"class_generator_stab_form_base.html#af07424f07933b3dfd9ddcf49786655ae":[0,0,44,52], -"class_generator_stab_form_base.html#af330bc8f2bd282323a32a2a86c914d15":[0,0,44,110], -"class_generator_stab_form_base.html#af57074a4e2f1c071619da1511af5a580":[0,0,44,75], -"class_generator_stab_form_base.html#af76e11df631da956e8bbb8c981bd919b":[0,0,44,76], -"class_generator_stab_form_base.html#af9582a84717c6e87d16842825093eb34":[0,0,44,8], -"class_generator_stab_form_base.html#afb924c441142358b2a1a4aacb0182d5c":[0,0,44,86], -"class_graphical_element.html":[0,0,45], -"class_graphical_element.html#a8fde5fe6410268701fc76a7b7b623053":[0,0,45,1], -"class_graphical_element.html#a9f116ee2cd16dd099c2579864415d7b8":[0,0,45,0], -"class_i_o_control.html":[0,0,53], -"class_i_o_control.html#a0e5e4b97d0e36099db3d6bf39eaa5dd1":[0,0,53,17], -"class_i_o_control.html#a0f80c4e9c3c87cd91a77c9dd781338ac":[0,0,53,8], -"class_i_o_control.html#a1a3b4a8f356a5d1ab95fdc729b9e758d":[0,0,53,1], -"class_i_o_control.html#a277d748a0aaaf3d31a64c293755ad807":[0,0,53,18], -"class_i_o_control.html#a41afef16a922a517d7362470ba252466":[0,0,53,2], -"class_i_o_control.html#a42a87f4ece6f842271e0044038c4da90":[0,0,53,9], -"class_i_o_control.html#a47a5633ed68ef0648623b9733dc5dab9":[0,0,53,11], -"class_i_o_control.html#a4ab76d7f7634b1ed80459f1f17ce37c6":[0,0,53,19], -"class_i_o_control.html#a4ed6c7e0b25b5f8678e2d8375ffd5735":[0,0,53,14], -"class_i_o_control.html#a595b6b926353d28d63fefee0f92f7719":[0,0,53,20], -"class_i_o_control.html#a5f860d3375c22819b9b238a2bd1e5b69":[0,0,53,7], -"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091":[0,0,53,0], -"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091a3276150d286d747d428297abbe52d313":[0,0,53,0,5], -"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091a3a942ff0ef0f3d8d5db72dce5c3c9fae":[0,0,53,0,2], -"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091a53af2ff6991d89e1c2e8847e35d92789":[0,0,53,0,1], -"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091a5d7ea66bd1f25fa23472c0dd00c4175f":[0,0,53,0,4], -"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091a93d85bb8a7e63b57b618a1c255e4c61f":[0,0,53,0,3], -"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091a97ce70af6aa8df66257643be841f2eff":[0,0,53,0,0], -"class_i_o_control.html#a973ae81e5d2d3df3b9088834d1950d32":[0,0,53,16], -"class_i_o_control.html#a99303b5e9bd32affaed8f4e4084fc9f7":[0,0,53,6], -"class_i_o_control.html#a9f79a55442d00a0d88cd688d74ba271c":[0,0,53,5], -"class_i_o_control.html#aa064c5d70e562334e2b374f919f42ef1":[0,0,53,3], -"class_i_o_control.html#aa6aab56f8936a87f099241d9bad9fee4":[0,0,53,4], -"class_i_o_control.html#ab76679a7c7c0b83e0f3a7e562e07803f":[0,0,53,12], -"class_i_o_control.html#abbd3054700825f9c4ac1b7c813f7b439":[0,0,53,13], -"class_i_o_control.html#adebd59a32fd699ba4dff4dff44dfbf90":[0,0,53,10], -"class_i_o_control.html#af99b84798978d530f1c3a8181cac2f54":[0,0,53,15], -"class_i_o_control_form.html":[0,0,54], -"class_i_o_control_form.html#a294cdff0d3167173fcf48f87ad552026":[0,0,54,2], -"class_i_o_control_form.html#a4a2f08453c254defd17b3e30ea43e359":[0,0,54,1], -"class_i_o_control_form.html#a5344ace55f9eb367ac15bfc9810a20b0":[0,0,54,5], -"class_i_o_control_form.html#a5d80b1908b0b1f93b98fe1068d3a53c2":[0,0,54,10], -"class_i_o_control_form.html#a6372a4868cd88d074c4f959f5e05dd17":[0,0,54,0], -"class_i_o_control_form.html#a6c7f6adabce0fe4cc2bbfe7bb121a853":[0,0,54,4], -"class_i_o_control_form.html#a9f7a52e5af434674b671703a4a96b148":[0,0,54,9], -"class_i_o_control_form.html#aa36bb4956ef77beb07f530362214777f":[0,0,54,6], -"class_i_o_control_form.html#abc73fa231942471aa93d66fd26aeb9ef":[0,0,54,8], -"class_i_o_control_form.html#abdb682d2ae87ab03a77c967a95661671":[0,0,54,7], -"class_i_o_control_form.html#aedeb2e81b04afc066c9be7830f1db76d":[0,0,54,3], -"class_i_o_control_form_base.html":[0,0,55], -"class_i_o_control_form_base.html#a04ad72346ba61a658e7600be4b3dd3b7":[0,0,55,15] +"class_generator_stab_form_base.html#ab176d40b9540799cd1e8fce5320fe1f1":[0,0,44,108] }; diff --git a/docs/doxygen/html/navtreeindex6.js b/docs/doxygen/html/navtreeindex6.js index 8ed231d..e87ef3c 100644 --- a/docs/doxygen/html/navtreeindex6.js +++ b/docs/doxygen/html/navtreeindex6.js @@ -1,5 +1,83 @@ var NAVTREEINDEX6 = { +"class_generator_stab_form_base.html#ab83eed913a74588eeaec593e777d6903":[0,0,44,33], +"class_generator_stab_form_base.html#ab95b366c7aa4649cea574ff416de5c7b":[0,0,44,4], +"class_generator_stab_form_base.html#ab97d99294656418a22473bc428010df5":[0,0,44,57], +"class_generator_stab_form_base.html#abb8626324d185a50ea1afb531acc7556":[0,0,44,51], +"class_generator_stab_form_base.html#abc3ac82c1793612e706ad8570d2485e2":[0,0,44,99], +"class_generator_stab_form_base.html#abc69d8331bc4a67f474dcd8d784e67b0":[0,0,44,80], +"class_generator_stab_form_base.html#abc75b52265409993c5961b05c72c0dbd":[0,0,44,15], +"class_generator_stab_form_base.html#abcd9ca2e90630de68c36a80fc94e84d7":[0,0,44,54], +"class_generator_stab_form_base.html#abd8d9528a7bb1a0e42cb4e410f96a8da":[0,0,44,34], +"class_generator_stab_form_base.html#abe5a2f8a8699b436ebde263613da9e41":[0,0,44,65], +"class_generator_stab_form_base.html#abec18f9a5bf99c4e94dc1b416eb527cd":[0,0,44,7], +"class_generator_stab_form_base.html#abf75abd9efd94f6df0d98583cd54011a":[0,0,44,1], +"class_generator_stab_form_base.html#ac124e324cb4a4a5f2c9d6e8b8ac9219d":[0,0,44,85], +"class_generator_stab_form_base.html#ac3e60ba5d2b4d80889805ca6a74ddacc":[0,0,44,89], +"class_generator_stab_form_base.html#ac819e946ed8c89f7be8af3d8659f0215":[0,0,44,20], +"class_generator_stab_form_base.html#aca6bebda04654a89a1ab9b0eb99cb297":[0,0,44,96], +"class_generator_stab_form_base.html#acb429d36652f171301f8006a00db8697":[0,0,44,112], +"class_generator_stab_form_base.html#ad16f4c2ac4f8e579a807d87f9d2727af":[0,0,44,82], +"class_generator_stab_form_base.html#adaa265bc1d9756eb75628c983107adec":[0,0,44,101], +"class_generator_stab_form_base.html#add9da345bd8c5a3a84c7e54aba9c0aff":[0,0,44,53], +"class_generator_stab_form_base.html#ade55f7fcf88393571e23342a6e3640c2":[0,0,44,27], +"class_generator_stab_form_base.html#adf24eaddce5f2a357ad80a9776b12d3e":[0,0,44,84], +"class_generator_stab_form_base.html#ae34a23fbe6b549cee19cc4095c5d94c7":[0,0,44,107], +"class_generator_stab_form_base.html#ae6bd7cfd4d167b5e1bc474d426ca8a30":[0,0,44,6], +"class_generator_stab_form_base.html#ae85799c9d8bb89c92029f2da7678c1f7":[0,0,44,50], +"class_generator_stab_form_base.html#aed066d5bfa8dcfada7d2ed21aa567b8a":[0,0,44,45], +"class_generator_stab_form_base.html#af03772fb1570ab9d80f1690acc52e102":[0,0,44,58], +"class_generator_stab_form_base.html#af07424f07933b3dfd9ddcf49786655ae":[0,0,44,52], +"class_generator_stab_form_base.html#af330bc8f2bd282323a32a2a86c914d15":[0,0,44,110], +"class_generator_stab_form_base.html#af57074a4e2f1c071619da1511af5a580":[0,0,44,75], +"class_generator_stab_form_base.html#af76e11df631da956e8bbb8c981bd919b":[0,0,44,76], +"class_generator_stab_form_base.html#af9582a84717c6e87d16842825093eb34":[0,0,44,8], +"class_generator_stab_form_base.html#afb924c441142358b2a1a4aacb0182d5c":[0,0,44,86], +"class_graphical_element.html":[0,0,45], +"class_graphical_element.html#a8fde5fe6410268701fc76a7b7b623053":[0,0,45,1], +"class_graphical_element.html#a9f116ee2cd16dd099c2579864415d7b8":[0,0,45,0], +"class_i_o_control.html":[0,0,53], +"class_i_o_control.html#a0e5e4b97d0e36099db3d6bf39eaa5dd1":[0,0,53,17], +"class_i_o_control.html#a0f80c4e9c3c87cd91a77c9dd781338ac":[0,0,53,8], +"class_i_o_control.html#a1a3b4a8f356a5d1ab95fdc729b9e758d":[0,0,53,1], +"class_i_o_control.html#a277d748a0aaaf3d31a64c293755ad807":[0,0,53,18], +"class_i_o_control.html#a41afef16a922a517d7362470ba252466":[0,0,53,2], +"class_i_o_control.html#a42a87f4ece6f842271e0044038c4da90":[0,0,53,9], +"class_i_o_control.html#a47a5633ed68ef0648623b9733dc5dab9":[0,0,53,11], +"class_i_o_control.html#a4ab76d7f7634b1ed80459f1f17ce37c6":[0,0,53,19], +"class_i_o_control.html#a4ed6c7e0b25b5f8678e2d8375ffd5735":[0,0,53,14], +"class_i_o_control.html#a595b6b926353d28d63fefee0f92f7719":[0,0,53,20], +"class_i_o_control.html#a5f860d3375c22819b9b238a2bd1e5b69":[0,0,53,7], +"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091":[0,0,53,0], +"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091a3276150d286d747d428297abbe52d313":[0,0,53,0,5], +"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091a3a942ff0ef0f3d8d5db72dce5c3c9fae":[0,0,53,0,2], +"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091a53af2ff6991d89e1c2e8847e35d92789":[0,0,53,0,1], +"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091a5d7ea66bd1f25fa23472c0dd00c4175f":[0,0,53,0,4], +"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091a93d85bb8a7e63b57b618a1c255e4c61f":[0,0,53,0,3], +"class_i_o_control.html#a84a11e53cc306b8f9f82e577923d4091a97ce70af6aa8df66257643be841f2eff":[0,0,53,0,0], +"class_i_o_control.html#a973ae81e5d2d3df3b9088834d1950d32":[0,0,53,16], +"class_i_o_control.html#a99303b5e9bd32affaed8f4e4084fc9f7":[0,0,53,6], +"class_i_o_control.html#a9f79a55442d00a0d88cd688d74ba271c":[0,0,53,5], +"class_i_o_control.html#aa064c5d70e562334e2b374f919f42ef1":[0,0,53,3], +"class_i_o_control.html#aa6aab56f8936a87f099241d9bad9fee4":[0,0,53,4], +"class_i_o_control.html#ab76679a7c7c0b83e0f3a7e562e07803f":[0,0,53,12], +"class_i_o_control.html#abbd3054700825f9c4ac1b7c813f7b439":[0,0,53,13], +"class_i_o_control.html#adebd59a32fd699ba4dff4dff44dfbf90":[0,0,53,10], +"class_i_o_control.html#af99b84798978d530f1c3a8181cac2f54":[0,0,53,15], +"class_i_o_control_form.html":[0,0,54], +"class_i_o_control_form.html#a294cdff0d3167173fcf48f87ad552026":[0,0,54,2], +"class_i_o_control_form.html#a4a2f08453c254defd17b3e30ea43e359":[0,0,54,1], +"class_i_o_control_form.html#a5344ace55f9eb367ac15bfc9810a20b0":[0,0,54,5], +"class_i_o_control_form.html#a5d80b1908b0b1f93b98fe1068d3a53c2":[0,0,54,10], +"class_i_o_control_form.html#a6372a4868cd88d074c4f959f5e05dd17":[0,0,54,0], +"class_i_o_control_form.html#a6c7f6adabce0fe4cc2bbfe7bb121a853":[0,0,54,4], +"class_i_o_control_form.html#a9f7a52e5af434674b671703a4a96b148":[0,0,54,9], +"class_i_o_control_form.html#aa36bb4956ef77beb07f530362214777f":[0,0,54,6], +"class_i_o_control_form.html#abc73fa231942471aa93d66fd26aeb9ef":[0,0,54,8], +"class_i_o_control_form.html#abdb682d2ae87ab03a77c967a95661671":[0,0,54,7], +"class_i_o_control_form.html#aedeb2e81b04afc066c9be7830f1db76d":[0,0,54,3], +"class_i_o_control_form_base.html":[0,0,55], +"class_i_o_control_form_base.html#a04ad72346ba61a658e7600be4b3dd3b7":[0,0,55,15], "class_i_o_control_form_base.html#a0e3c563e83daad1b146c3145a1f344dc":[0,0,55,0], "class_i_o_control_form_base.html#a102076f74743f9fdbc198cd2bed3b116":[0,0,55,5], "class_i_o_control_form_base.html#a3f98f87e15ed807cb3aa745729509e12":[0,0,55,2], @@ -171,83 +249,5 @@ var NAVTREEINDEX6 = "class_line.html#afa67498961416e645e0aa5358959ef1d":[0,0,59,18], "class_line.html#afc4916268d2a32014e4ab0f8308165a1":[0,0,59,11], "class_line_form.html":[0,0,61], -"class_line_form.html#a2d4f4eb4b8943b09c9dca207fb585bfd":[0,0,61,1], -"class_line_form.html#a3896cd6a6cc5500fe1935aa9b16d37ce":[0,0,61,0], -"class_line_form.html#a40650c8cf031e57ad58b3c2b22dad0a1":[0,0,61,5], -"class_line_form.html#a4b5d7e7696f936260c542dcd60810d38":[0,0,61,3], -"class_line_form.html#a5b9f183abdea533d0473e59d04cbf431":[0,0,61,6], -"class_line_form.html#a610f77d5591f5dfbed0f24b301f781c3":[0,0,61,8], -"class_line_form.html#a7e580cfea0c4b1075941e92e6596161d":[0,0,61,4], -"class_line_form.html#a892fad419fc3b15a770c7d25a272f570":[0,0,61,2], -"class_line_form.html#af72bc026476d186fa8e289e388e9b48b":[0,0,61,7], -"class_line_form_base.html":[0,0,62], -"class_line_form_base.html#a00214bd206b78fd3a8fa0121e5ebe82e":[0,0,62,17], -"class_line_form_base.html#a09802bd88add44ae786242f5294f2609":[0,0,62,1], -"class_line_form_base.html#a099de8044e2d8ac8c2a0678e568f7b03":[0,0,62,38], -"class_line_form_base.html#a09c4f16f3fcd1388cf004c1fc33517eb":[0,0,62,35], -"class_line_form_base.html#a0a7e39a334c79efe3e56a35a4338b6c4":[0,0,62,23], -"class_line_form_base.html#a1218578bfc90029991fe5c661129a3e5":[0,0,62,3], -"class_line_form_base.html#a18e5c02351619bbde01361457e0f924d":[0,0,62,25], -"class_line_form_base.html#a1cd88fb45c3d56e135e3776f0578670b":[0,0,62,39], -"class_line_form_base.html#a1d2d9b874ce50f33594c0eb4e169efb0":[0,0,62,9], -"class_line_form_base.html#a203522b4c5faed9829f1c1ef5bb7d856":[0,0,62,41], -"class_line_form_base.html#a237b7bb9470374b859b241284560af19":[0,0,62,29], -"class_line_form_base.html#a256475d66a5afe9ee22d8f7a47aa1652":[0,0,62,2], -"class_line_form_base.html#a2cf2cf9916228e7422349d082cd2b897":[0,0,62,37], -"class_line_form_base.html#a2ec10dc7d10b73e27074de8741472ffc":[0,0,62,57], -"class_line_form_base.html#a30d2ceb62b13a69797078c5a1046fdf3":[0,0,62,26], -"class_line_form_base.html#a30db42733e74c95a5ac8fb33a6a5b309":[0,0,62,53], -"class_line_form_base.html#a346fa89ba532796d25822d4a3b99d0bf":[0,0,62,8], -"class_line_form_base.html#a3cacfa3ac4e54b23b9ea4b4295bb5869":[0,0,62,21], -"class_line_form_base.html#a3cdb32d9490fa7c931222b82c8d76f06":[0,0,62,30], -"class_line_form_base.html#a3f6971139d91cf7ea3ca530cfc5abe60":[0,0,62,31], -"class_line_form_base.html#a4a177ba61b789ee9746b6a6300938481":[0,0,62,36], -"class_line_form_base.html#a4b5dd697cee618b60e93a3b20639de69":[0,0,62,46], -"class_line_form_base.html#a4d757ee09be0bc3064ce011571f5dade":[0,0,62,48], -"class_line_form_base.html#a4e5cec6ae74e8921d68c02971aba2ce6":[0,0,62,12], -"class_line_form_base.html#a4eff427e33bd710c2c2698131fcab982":[0,0,62,58], -"class_line_form_base.html#a4ffe2719ab5877bb014cfd301a8251f8":[0,0,62,65], -"class_line_form_base.html#a5037f0ab0ff17c8fef9eb6a8eda8c7f3":[0,0,62,67], -"class_line_form_base.html#a5fa8d503cfc9276f7bab0c9a360826c3":[0,0,62,13], -"class_line_form_base.html#a63900c58a03059f026f21f2d17694a50":[0,0,62,18], -"class_line_form_base.html#a670ab48361b388378afa7265065d2772":[0,0,62,11], -"class_line_form_base.html#a71e0449ead49724187175c9b4cd49442":[0,0,62,55], -"class_line_form_base.html#a735e9def88fc646947d21e54f4f1c6db":[0,0,62,50], -"class_line_form_base.html#a74ecdc51dfde2f1423679e924827db2f":[0,0,62,14], -"class_line_form_base.html#a76b591279f0a28d0d2ea71070d951074":[0,0,62,60], -"class_line_form_base.html#a7f69ee53d6c444da7c7092b2ca005c2f":[0,0,62,51], -"class_line_form_base.html#a8849449fd48e7ed19bd1386cfc22b39a":[0,0,62,22], -"class_line_form_base.html#a965925e6eda9bb2550238c634a380a01":[0,0,62,45], -"class_line_form_base.html#a99c440454d44272034bdb633306b927e":[0,0,62,62], -"class_line_form_base.html#a9a47d570f346a28550b55878b9b60b8b":[0,0,62,33], -"class_line_form_base.html#a9eb76fc567f8309675aea668b33076c1":[0,0,62,19], -"class_line_form_base.html#aa6b5722ddc3c5769bbd17b7e61ca934f":[0,0,62,32], -"class_line_form_base.html#aaab121a2c968b45e1cadc1fa4d9b2908":[0,0,62,10], -"class_line_form_base.html#aae898a9d1cb5c021125dff4a1eac059d":[0,0,62,66], -"class_line_form_base.html#aaeac2ae5aa2a609802014928a1de5861":[0,0,62,42], -"class_line_form_base.html#aaec474f0cb50cbf2369912888981cf57":[0,0,62,4], -"class_line_form_base.html#ab03dd2f3fe79f1e25ff08e62dfcad5c6":[0,0,62,44], -"class_line_form_base.html#ab53a8775afea108736dfd518cafd0257":[0,0,62,7], -"class_line_form_base.html#ab67bdd26e51d22e35b3981c7f0ccb934":[0,0,62,6], -"class_line_form_base.html#abbdd5e5c0c949953b1c62f87f405d23b":[0,0,62,20], -"class_line_form_base.html#abd05440f261ada2fb7636c9a6ccc6e21":[0,0,62,68], -"class_line_form_base.html#abfeffc76a7851af380c076f0527da914":[0,0,62,61], -"class_line_form_base.html#ac524da001d800cc641e693ca852c33b2":[0,0,62,56], -"class_line_form_base.html#aca66b41f60b423ae026887c98b8e3b49":[0,0,62,47], -"class_line_form_base.html#acafcc53a4fcb2a9af482fab636e2e0f1":[0,0,62,40], -"class_line_form_base.html#ad35c9e501520ab9f20f538343989a05a":[0,0,62,54], -"class_line_form_base.html#ad98d8271f8efbbaff028fc6fbee23c6c":[0,0,62,64], -"class_line_form_base.html#ade61566890ec5faa3a4b213cde2966c5":[0,0,62,15], -"class_line_form_base.html#ae1d403904af22ccf0ff2d1ac0a9d13ae":[0,0,62,16], -"class_line_form_base.html#ae1f84ede0a8aaea8215065add0a65ac3":[0,0,62,27], -"class_line_form_base.html#ae20df51563b5ec99459080f88da22ca4":[0,0,62,49], -"class_line_form_base.html#ae36429133dcb0433b18786a9d6d2d157":[0,0,62,52], -"class_line_form_base.html#aed5639eb90045433cae4bc7f38f5223a":[0,0,62,63], -"class_line_form_base.html#aed775c5b411a7b08117895137ad36f03":[0,0,62,59], -"class_line_form_base.html#af2b552fd7b4b58a71e91c498d31e53d8":[0,0,62,5], -"class_line_form_base.html#af368b73e629369a6d75232bfb49b67b2":[0,0,62,28], -"class_line_form_base.html#af99e84f70407445abd2d50b9ea9227b1":[0,0,62,0], -"class_line_form_base.html#afa2dabfbc8d41d852ae2636de1f474c6":[0,0,62,34], -"class_line_form_base.html#afc764ff277749947f23d9f7926ca304b":[0,0,62,43], -"class_line_form_base.html#aff93aefe098db7eab3f92ec0f2f70b3f":[0,0,62,24] +"class_line_form.html#a2d4f4eb4b8943b09c9dca207fb585bfd":[0,0,61,1] }; diff --git a/docs/doxygen/html/navtreeindex7.js b/docs/doxygen/html/navtreeindex7.js index 5a77c0a..a50619e 100644 --- a/docs/doxygen/html/navtreeindex7.js +++ b/docs/doxygen/html/navtreeindex7.js @@ -1,5 +1,83 @@ var NAVTREEINDEX7 = { +"class_line_form.html#a3896cd6a6cc5500fe1935aa9b16d37ce":[0,0,61,0], +"class_line_form.html#a40650c8cf031e57ad58b3c2b22dad0a1":[0,0,61,5], +"class_line_form.html#a4b5d7e7696f936260c542dcd60810d38":[0,0,61,3], +"class_line_form.html#a5b9f183abdea533d0473e59d04cbf431":[0,0,61,6], +"class_line_form.html#a610f77d5591f5dfbed0f24b301f781c3":[0,0,61,8], +"class_line_form.html#a7e580cfea0c4b1075941e92e6596161d":[0,0,61,4], +"class_line_form.html#a892fad419fc3b15a770c7d25a272f570":[0,0,61,2], +"class_line_form.html#af72bc026476d186fa8e289e388e9b48b":[0,0,61,7], +"class_line_form_base.html":[0,0,62], +"class_line_form_base.html#a00214bd206b78fd3a8fa0121e5ebe82e":[0,0,62,17], +"class_line_form_base.html#a09802bd88add44ae786242f5294f2609":[0,0,62,1], +"class_line_form_base.html#a099de8044e2d8ac8c2a0678e568f7b03":[0,0,62,38], +"class_line_form_base.html#a09c4f16f3fcd1388cf004c1fc33517eb":[0,0,62,35], +"class_line_form_base.html#a0a7e39a334c79efe3e56a35a4338b6c4":[0,0,62,23], +"class_line_form_base.html#a1218578bfc90029991fe5c661129a3e5":[0,0,62,3], +"class_line_form_base.html#a18e5c02351619bbde01361457e0f924d":[0,0,62,25], +"class_line_form_base.html#a1cd88fb45c3d56e135e3776f0578670b":[0,0,62,39], +"class_line_form_base.html#a1d2d9b874ce50f33594c0eb4e169efb0":[0,0,62,9], +"class_line_form_base.html#a203522b4c5faed9829f1c1ef5bb7d856":[0,0,62,41], +"class_line_form_base.html#a237b7bb9470374b859b241284560af19":[0,0,62,29], +"class_line_form_base.html#a256475d66a5afe9ee22d8f7a47aa1652":[0,0,62,2], +"class_line_form_base.html#a2cf2cf9916228e7422349d082cd2b897":[0,0,62,37], +"class_line_form_base.html#a2ec10dc7d10b73e27074de8741472ffc":[0,0,62,57], +"class_line_form_base.html#a30d2ceb62b13a69797078c5a1046fdf3":[0,0,62,26], +"class_line_form_base.html#a30db42733e74c95a5ac8fb33a6a5b309":[0,0,62,53], +"class_line_form_base.html#a346fa89ba532796d25822d4a3b99d0bf":[0,0,62,8], +"class_line_form_base.html#a3cacfa3ac4e54b23b9ea4b4295bb5869":[0,0,62,21], +"class_line_form_base.html#a3cdb32d9490fa7c931222b82c8d76f06":[0,0,62,30], +"class_line_form_base.html#a3f6971139d91cf7ea3ca530cfc5abe60":[0,0,62,31], +"class_line_form_base.html#a4a177ba61b789ee9746b6a6300938481":[0,0,62,36], +"class_line_form_base.html#a4b5dd697cee618b60e93a3b20639de69":[0,0,62,46], +"class_line_form_base.html#a4d757ee09be0bc3064ce011571f5dade":[0,0,62,48], +"class_line_form_base.html#a4e5cec6ae74e8921d68c02971aba2ce6":[0,0,62,12], +"class_line_form_base.html#a4eff427e33bd710c2c2698131fcab982":[0,0,62,58], +"class_line_form_base.html#a4ffe2719ab5877bb014cfd301a8251f8":[0,0,62,65], +"class_line_form_base.html#a5037f0ab0ff17c8fef9eb6a8eda8c7f3":[0,0,62,67], +"class_line_form_base.html#a5fa8d503cfc9276f7bab0c9a360826c3":[0,0,62,13], +"class_line_form_base.html#a63900c58a03059f026f21f2d17694a50":[0,0,62,18], +"class_line_form_base.html#a670ab48361b388378afa7265065d2772":[0,0,62,11], +"class_line_form_base.html#a71e0449ead49724187175c9b4cd49442":[0,0,62,55], +"class_line_form_base.html#a735e9def88fc646947d21e54f4f1c6db":[0,0,62,50], +"class_line_form_base.html#a74ecdc51dfde2f1423679e924827db2f":[0,0,62,14], +"class_line_form_base.html#a76b591279f0a28d0d2ea71070d951074":[0,0,62,60], +"class_line_form_base.html#a7f69ee53d6c444da7c7092b2ca005c2f":[0,0,62,51], +"class_line_form_base.html#a8849449fd48e7ed19bd1386cfc22b39a":[0,0,62,22], +"class_line_form_base.html#a965925e6eda9bb2550238c634a380a01":[0,0,62,45], +"class_line_form_base.html#a99c440454d44272034bdb633306b927e":[0,0,62,62], +"class_line_form_base.html#a9a47d570f346a28550b55878b9b60b8b":[0,0,62,33], +"class_line_form_base.html#a9eb76fc567f8309675aea668b33076c1":[0,0,62,19], +"class_line_form_base.html#aa6b5722ddc3c5769bbd17b7e61ca934f":[0,0,62,32], +"class_line_form_base.html#aaab121a2c968b45e1cadc1fa4d9b2908":[0,0,62,10], +"class_line_form_base.html#aae898a9d1cb5c021125dff4a1eac059d":[0,0,62,66], +"class_line_form_base.html#aaeac2ae5aa2a609802014928a1de5861":[0,0,62,42], +"class_line_form_base.html#aaec474f0cb50cbf2369912888981cf57":[0,0,62,4], +"class_line_form_base.html#ab03dd2f3fe79f1e25ff08e62dfcad5c6":[0,0,62,44], +"class_line_form_base.html#ab53a8775afea108736dfd518cafd0257":[0,0,62,7], +"class_line_form_base.html#ab67bdd26e51d22e35b3981c7f0ccb934":[0,0,62,6], +"class_line_form_base.html#abbdd5e5c0c949953b1c62f87f405d23b":[0,0,62,20], +"class_line_form_base.html#abd05440f261ada2fb7636c9a6ccc6e21":[0,0,62,68], +"class_line_form_base.html#abfeffc76a7851af380c076f0527da914":[0,0,62,61], +"class_line_form_base.html#ac524da001d800cc641e693ca852c33b2":[0,0,62,56], +"class_line_form_base.html#aca66b41f60b423ae026887c98b8e3b49":[0,0,62,47], +"class_line_form_base.html#acafcc53a4fcb2a9af482fab636e2e0f1":[0,0,62,40], +"class_line_form_base.html#ad35c9e501520ab9f20f538343989a05a":[0,0,62,54], +"class_line_form_base.html#ad98d8271f8efbbaff028fc6fbee23c6c":[0,0,62,64], +"class_line_form_base.html#ade61566890ec5faa3a4b213cde2966c5":[0,0,62,15], +"class_line_form_base.html#ae1d403904af22ccf0ff2d1ac0a9d13ae":[0,0,62,16], +"class_line_form_base.html#ae1f84ede0a8aaea8215065add0a65ac3":[0,0,62,27], +"class_line_form_base.html#ae20df51563b5ec99459080f88da22ca4":[0,0,62,49], +"class_line_form_base.html#ae36429133dcb0433b18786a9d6d2d157":[0,0,62,52], +"class_line_form_base.html#aed5639eb90045433cae4bc7f38f5223a":[0,0,62,63], +"class_line_form_base.html#aed775c5b411a7b08117895137ad36f03":[0,0,62,59], +"class_line_form_base.html#af2b552fd7b4b58a71e91c498d31e53d8":[0,0,62,5], +"class_line_form_base.html#af368b73e629369a6d75232bfb49b67b2":[0,0,62,28], +"class_line_form_base.html#af99e84f70407445abd2d50b9ea9227b1":[0,0,62,0], +"class_line_form_base.html#afa2dabfbc8d41d852ae2636de1f474c6":[0,0,62,34], +"class_line_form_base.html#afc764ff277749947f23d9f7926ca304b":[0,0,62,43], +"class_line_form_base.html#aff93aefe098db7eab3f92ec0f2f70b3f":[0,0,62,24], "class_load.html":[0,0,63], "class_load.html#a00acfbf7dc907e5de79ceb4803632279":[0,0,63,9], "class_load.html#a00ef3c6ae69dbd45e96f696dfb76f013":[0,0,63,8], @@ -128,7 +206,7 @@ var NAVTREEINDEX7 = "class_main_frame.html#aade761601af16dadcbf24cd2a4e8d289":[0,0,69,3], "class_main_frame.html#abe97a8d22d4604390a83664fac5f4c79":[0,0,69,5], "class_main_frame.html#ac2616c3c46dcfe32c91e4ac35efc7710":[0,0,69,24], -"class_main_frame.html#ac5d3dc03594f76ed6e5fd1ccecfc5b0b":[0,0,69,1], +"class_main_frame.html#ac3288e93c5b8682863574bc47c9e9ff8":[0,0,69,1], "class_main_frame.html#ad1475f1bb8a05169b3d3d462008c887b":[0,0,69,4], "class_main_frame.html#ad15ed016f2af7c23737cabb12eee172d":[0,0,69,28], "class_main_frame.html#adfba2e2bca63d8ee779a0e4cf00a6de0":[0,0,69,26], @@ -171,83 +249,5 @@ var NAVTREEINDEX7 = "class_main_frame_base.html#a7ac299975c041187b3be925d8423ee55":[0,0,70,50], "class_main_frame_base.html#a7f28bf5e906cb1258bac365d4f92cd0b":[0,0,70,86], "class_main_frame_base.html#a80b0b22053a0a0e3baad864237d32654":[0,0,70,48], -"class_main_frame_base.html#a81f31e1f089b59ad4e6c996d4f45294e":[0,0,70,75], -"class_main_frame_base.html#a869092abc9913bb995eb36ec69db0405":[0,0,70,76], -"class_main_frame_base.html#a8d11fbafd4b593c96595f6f72e8dbe3c":[0,0,70,63], -"class_main_frame_base.html#a8ee60616644d83057b7d064045a21b3a":[0,0,70,46], -"class_main_frame_base.html#a916973a33e034aa089f3fc3eaccb2b0f":[0,0,70,68], -"class_main_frame_base.html#a92a63880d952773d06a513980831eee1":[0,0,70,73], -"class_main_frame_base.html#a98499bbee4f7e956a801bbdc64da44d4":[0,0,70,37], -"class_main_frame_base.html#a997c8c6b5a5bf8f8272aa7c3def76b24":[0,0,70,59], -"class_main_frame_base.html#a9aebadcb48bb76c12718c6b6dc6b6eb5":[0,0,70,84], -"class_main_frame_base.html#aa0c7c14ec4183086cf42fe19af0bb2eb":[0,0,70,89], -"class_main_frame_base.html#aa142c5d3d679147e0d63f00e1d2ca2e1":[0,0,70,36], -"class_main_frame_base.html#aa3055bf5e73ba3ef53428ec5a97d727b":[0,0,70,74], -"class_main_frame_base.html#aa7749e41daf7e49439364126b631b234":[0,0,70,87], -"class_main_frame_base.html#aa797493c5fec22bd6c4c01a145956df2":[0,0,70,52], -"class_main_frame_base.html#aab2e491a8e460ef817f89c2fda8969d4":[0,0,70,43], -"class_main_frame_base.html#aac3e83244b862fe153b33e9d5622b98b":[0,0,70,80], -"class_main_frame_base.html#ab7bf6daa1451eb32101dc414b0e69a0a":[0,0,70,69], -"class_main_frame_base.html#abec097ede52d8293f39a18d362b02ae0":[0,0,70,54], -"class_main_frame_base.html#ac35167f59ba693d78eb899f2edd11d86":[0,0,70,42], -"class_main_frame_base.html#ac57d27795bc713ac686f9e87e6d98387":[0,0,70,72], -"class_main_frame_base.html#ace56e2062582f17fc3c971405bd59337":[0,0,70,39], -"class_main_frame_base.html#ad054e4149f42d383bc1c402f6a54501c":[0,0,70,49], -"class_main_frame_base.html#ad37f3f62f657f2e034200d45e855a948":[0,0,70,33], -"class_main_frame_base.html#ad9b953037729ab0529f9dc5338729315":[0,0,70,41], -"class_main_frame_base.html#ae279f9d64fb6bcf671f565a2e71b2e94":[0,0,70,47], -"class_main_frame_base.html#ae32925edbbd4ab14b2ce775b733b7c50":[0,0,70,35], -"class_main_frame_base.html#ae5b3009fc106d75e157836a6641f63a1":[0,0,70,58], -"class_main_frame_base.html#ae5e2dafad6a4f61d11a33ec190cef57c":[0,0,70,60], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a05e92cb2567285f28c79eb500215b7da":[0,0,70,14], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a12f9d6b6da5ab7daef64309af56eb254":[0,0,70,27], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a14d1f40da5fe6d2885f81edc7bb34a5b":[0,0,70,4], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a17d8645af74374ed37cc377454903efe":[0,0,70,11], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a1a8745483f979ee20127462baef529b8":[0,0,70,9], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a22b195931c8f14f839544d5c76519e96":[0,0,70,28], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a274e87b2f0e70ab82e39438670e075d9":[0,0,70,26], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a2cedd9fbdc0111a82258040845814f4e":[0,0,70,1], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a2f9639a5f09ac7227dda3b1cbe0b83c4":[0,0,70,24], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a5bbe17a7648dedf17da9d9b246dd8948":[0,0,70,22], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a74900bf0113caf1fb845fe88711e29cd":[0,0,70,29], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a763d06068082580a6aa29c8e7d850462":[0,0,70,18], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a7d26b27353b73836e009a8fb63ea64f0":[0,0,70,6], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a7ddcce5a0fc3fd28e5a143d74d44e22b":[0,0,70,0], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a828cbb4fbfb1dbdc492ec4c6057e047d":[0,0,70,30], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a8ba61bef22ba14e5d33ff6152a52032c":[0,0,70,2], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a9bb260567cffe56b9db58274e4bac47c":[0,0,70,16], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a9f01085677ac59c45a00f38ba012b606":[0,0,70,7], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9aa6376080d848cfd62d01395cb541bfb1":[0,0,70,23], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9aac83b781c09c5abd012c0f5b7c06f87e":[0,0,70,25], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ab63bbde4ed29da3598c017b6cfd25c75":[0,0,70,13], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ab742a9cc46431af12db375ec8b443729":[0,0,70,15], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ab80637a65b2e8941cd24044495ac674f":[0,0,70,21], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ac853a9f30f75ebfb6065a99771b6fa27":[0,0,70,3], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ad219a0870575cfe02af28cec88f11a79":[0,0,70,5], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9adc4cdd714264b181007029985e72285a":[0,0,70,20], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ae2192305b1be1c090a4db25a341a8aa2":[0,0,70,8], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ae67852eba853e7a9889a21dfc6bca52b":[0,0,70,12], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9aeb2127b1fd05627a82050c372e0d3164":[0,0,70,31], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9aed3da5b755508446a072304c74b46988":[0,0,70,19], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9afbc8518ac655f8467de20390453c2fe7":[0,0,70,17], -"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9afef2cc3e901fde0607cafcd6d9ebaac6":[0,0,70,10], -"class_main_frame_base.html#aea62e96627cad518bdcea6002f4827a1":[0,0,70,71], -"class_main_frame_base.html#aea7b22f0aacbc7a2da7788eb2f1aef5c":[0,0,70,90], -"class_main_frame_base.html#af1e52e93085b8b51e2a4d4f3bf882f91":[0,0,70,88], -"class_main_frame_base.html#af5030bc2b188dccb90a48ebfecd37366":[0,0,70,32], -"class_multiplier.html":[0,0,71], -"class_multiplier.html#a3b8da713f480cb1ed6b829f4d5a584d3":[0,0,71,1], -"class_multiplier.html#a43398a07b130b819c229e1512066456c":[0,0,71,9], -"class_multiplier.html#a48166896d667216da146a0b25766f867":[0,0,71,0], -"class_multiplier.html#a4fa1206b47c626930db753a70e01680d":[0,0,71,7], -"class_multiplier.html#a9d6101ab83aa92316efdb4d26b715d4c":[0,0,71,8], -"class_multiplier.html#ab487232a96ed3c3f3a7c3628ddaa4c77":[0,0,71,4], -"class_multiplier.html#aba53ef763812fbff891cdf0b89c7fcca":[0,0,71,5], -"class_multiplier.html#acee6216a03b550f3a9cad2bef3963a18":[0,0,71,2], -"class_multiplier.html#ae01f155ed56925cb87d71a860882a3a1":[0,0,71,6], -"class_multiplier.html#ae854fd981a98aca93b286081cc9c19f3":[0,0,71,3], -"class_node.html":[0,0,72], -"class_node.html#a00ac0295e2572c4cca473e92860c6f66":[0,0,72,18], -"class_node.html#a087c2fddbbedfc748fbfbb35ad8b235b":[0,0,72,5], -"class_node.html#a0a9fcf01abc356e34d686aa753e43b8d":[0,0,72,10] +"class_main_frame_base.html#a81f31e1f089b59ad4e6c996d4f45294e":[0,0,70,75] }; diff --git a/docs/doxygen/html/navtreeindex8.js b/docs/doxygen/html/navtreeindex8.js index 9543256..ec6c051 100644 --- a/docs/doxygen/html/navtreeindex8.js +++ b/docs/doxygen/html/navtreeindex8.js @@ -1,5 +1,83 @@ var NAVTREEINDEX8 = { +"class_main_frame_base.html#a869092abc9913bb995eb36ec69db0405":[0,0,70,76], +"class_main_frame_base.html#a8d11fbafd4b593c96595f6f72e8dbe3c":[0,0,70,63], +"class_main_frame_base.html#a8ee60616644d83057b7d064045a21b3a":[0,0,70,46], +"class_main_frame_base.html#a916973a33e034aa089f3fc3eaccb2b0f":[0,0,70,68], +"class_main_frame_base.html#a92a63880d952773d06a513980831eee1":[0,0,70,73], +"class_main_frame_base.html#a98499bbee4f7e956a801bbdc64da44d4":[0,0,70,37], +"class_main_frame_base.html#a997c8c6b5a5bf8f8272aa7c3def76b24":[0,0,70,59], +"class_main_frame_base.html#a9aebadcb48bb76c12718c6b6dc6b6eb5":[0,0,70,84], +"class_main_frame_base.html#aa0c7c14ec4183086cf42fe19af0bb2eb":[0,0,70,89], +"class_main_frame_base.html#aa142c5d3d679147e0d63f00e1d2ca2e1":[0,0,70,36], +"class_main_frame_base.html#aa3055bf5e73ba3ef53428ec5a97d727b":[0,0,70,74], +"class_main_frame_base.html#aa7749e41daf7e49439364126b631b234":[0,0,70,87], +"class_main_frame_base.html#aa797493c5fec22bd6c4c01a145956df2":[0,0,70,52], +"class_main_frame_base.html#aab2e491a8e460ef817f89c2fda8969d4":[0,0,70,43], +"class_main_frame_base.html#aac3e83244b862fe153b33e9d5622b98b":[0,0,70,80], +"class_main_frame_base.html#ab7bf6daa1451eb32101dc414b0e69a0a":[0,0,70,69], +"class_main_frame_base.html#abec097ede52d8293f39a18d362b02ae0":[0,0,70,54], +"class_main_frame_base.html#ac35167f59ba693d78eb899f2edd11d86":[0,0,70,42], +"class_main_frame_base.html#ac57d27795bc713ac686f9e87e6d98387":[0,0,70,72], +"class_main_frame_base.html#ace56e2062582f17fc3c971405bd59337":[0,0,70,39], +"class_main_frame_base.html#ad054e4149f42d383bc1c402f6a54501c":[0,0,70,49], +"class_main_frame_base.html#ad37f3f62f657f2e034200d45e855a948":[0,0,70,33], +"class_main_frame_base.html#ad9b953037729ab0529f9dc5338729315":[0,0,70,41], +"class_main_frame_base.html#ae279f9d64fb6bcf671f565a2e71b2e94":[0,0,70,47], +"class_main_frame_base.html#ae32925edbbd4ab14b2ce775b733b7c50":[0,0,70,35], +"class_main_frame_base.html#ae5b3009fc106d75e157836a6641f63a1":[0,0,70,58], +"class_main_frame_base.html#ae5e2dafad6a4f61d11a33ec190cef57c":[0,0,70,60], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a05e92cb2567285f28c79eb500215b7da":[0,0,70,14], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a12f9d6b6da5ab7daef64309af56eb254":[0,0,70,27], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a14d1f40da5fe6d2885f81edc7bb34a5b":[0,0,70,4], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a17d8645af74374ed37cc377454903efe":[0,0,70,11], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a1a8745483f979ee20127462baef529b8":[0,0,70,9], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a22b195931c8f14f839544d5c76519e96":[0,0,70,28], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a274e87b2f0e70ab82e39438670e075d9":[0,0,70,26], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a2cedd9fbdc0111a82258040845814f4e":[0,0,70,1], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a2f9639a5f09ac7227dda3b1cbe0b83c4":[0,0,70,24], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a5bbe17a7648dedf17da9d9b246dd8948":[0,0,70,22], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a74900bf0113caf1fb845fe88711e29cd":[0,0,70,29], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a763d06068082580a6aa29c8e7d850462":[0,0,70,18], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a7d26b27353b73836e009a8fb63ea64f0":[0,0,70,6], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a7ddcce5a0fc3fd28e5a143d74d44e22b":[0,0,70,0], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a828cbb4fbfb1dbdc492ec4c6057e047d":[0,0,70,30], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a8ba61bef22ba14e5d33ff6152a52032c":[0,0,70,2], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a9bb260567cffe56b9db58274e4bac47c":[0,0,70,16], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9a9f01085677ac59c45a00f38ba012b606":[0,0,70,7], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9aa6376080d848cfd62d01395cb541bfb1":[0,0,70,23], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9aac83b781c09c5abd012c0f5b7c06f87e":[0,0,70,25], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ab63bbde4ed29da3598c017b6cfd25c75":[0,0,70,13], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ab742a9cc46431af12db375ec8b443729":[0,0,70,15], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ab80637a65b2e8941cd24044495ac674f":[0,0,70,21], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ac853a9f30f75ebfb6065a99771b6fa27":[0,0,70,3], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ad219a0870575cfe02af28cec88f11a79":[0,0,70,5], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9adc4cdd714264b181007029985e72285a":[0,0,70,20], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ae2192305b1be1c090a4db25a341a8aa2":[0,0,70,8], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9ae67852eba853e7a9889a21dfc6bca52b":[0,0,70,12], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9aeb2127b1fd05627a82050c372e0d3164":[0,0,70,31], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9aed3da5b755508446a072304c74b46988":[0,0,70,19], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9afbc8518ac655f8467de20390453c2fe7":[0,0,70,17], +"class_main_frame_base.html#ae7e11ee827b7ec42dbd94f90891d15c9afef2cc3e901fde0607cafcd6d9ebaac6":[0,0,70,10], +"class_main_frame_base.html#aea62e96627cad518bdcea6002f4827a1":[0,0,70,71], +"class_main_frame_base.html#aea7b22f0aacbc7a2da7788eb2f1aef5c":[0,0,70,90], +"class_main_frame_base.html#af1e52e93085b8b51e2a4d4f3bf882f91":[0,0,70,88], +"class_main_frame_base.html#af5030bc2b188dccb90a48ebfecd37366":[0,0,70,32], +"class_multiplier.html":[0,0,71], +"class_multiplier.html#a3b8da713f480cb1ed6b829f4d5a584d3":[0,0,71,1], +"class_multiplier.html#a43398a07b130b819c229e1512066456c":[0,0,71,9], +"class_multiplier.html#a48166896d667216da146a0b25766f867":[0,0,71,0], +"class_multiplier.html#a4fa1206b47c626930db753a70e01680d":[0,0,71,7], +"class_multiplier.html#a9d6101ab83aa92316efdb4d26b715d4c":[0,0,71,8], +"class_multiplier.html#ab487232a96ed3c3f3a7c3628ddaa4c77":[0,0,71,4], +"class_multiplier.html#aba53ef763812fbff891cdf0b89c7fcca":[0,0,71,5], +"class_multiplier.html#acee6216a03b550f3a9cad2bef3963a18":[0,0,71,2], +"class_multiplier.html#ae01f155ed56925cb87d71a860882a3a1":[0,0,71,6], +"class_multiplier.html#ae854fd981a98aca93b286081cc9c19f3":[0,0,71,3], +"class_node.html":[0,0,72], +"class_node.html#a00ac0295e2572c4cca473e92860c6f66":[0,0,72,18], +"class_node.html#a087c2fddbbedfc748fbfbb35ad8b235b":[0,0,72,5], +"class_node.html#a0a9fcf01abc356e34d686aa753e43b8d":[0,0,72,10], "class_node.html#a16217ea768b7bad76285e779bdc819c7":[0,0,72,7], "class_node.html#a179b73258e92a485a2f52c504fdcd96f":[0,0,72,27], "class_node.html#a1a41ea6942b8ae52f483dc5766dfdb62":[0,0,72,23], @@ -171,83 +249,5 @@ var NAVTREEINDEX8 = "class_reactive_shunt_element_form_base.html#a2554b773c193f87e3ac85fc14d3e63c7":[0,0,83,20], "class_reactive_shunt_element_form_base.html#a27c200b1beef702fec0e5d5a94165269":[0,0,83,23], "class_reactive_shunt_element_form_base.html#a2ca7cece107e7d4057f5c9ee5b98c305":[0,0,83,22], -"class_reactive_shunt_element_form_base.html#a2e2c10853585884ad3a2802764b756c7":[0,0,83,17], -"class_reactive_shunt_element_form_base.html#a2eabee46e0b04d92086a0d0f21e3b10e":[0,0,83,12], -"class_reactive_shunt_element_form_base.html#a3295f1d61c6249cb5ec8994a86b66d41":[0,0,83,6], -"class_reactive_shunt_element_form_base.html#a39f95da41f55cae7829b9bd777dfef4d":[0,0,83,2], -"class_reactive_shunt_element_form_base.html#a3a61222247b8bf0d0dc0a74f002f9f54":[0,0,83,4], -"class_reactive_shunt_element_form_base.html#a41f1a2d4df3cc1c7506b975d5ecde71b":[0,0,83,9], -"class_reactive_shunt_element_form_base.html#a45c87f3d26fefb6701e3ce84445d3b2a":[0,0,83,10], -"class_reactive_shunt_element_form_base.html#a4b0ca8c2ccb39a0f305bcc2fe95c820e":[0,0,83,13], -"class_reactive_shunt_element_form_base.html#a5ae249950ace35e5b19124f1fa49946b":[0,0,83,5], -"class_reactive_shunt_element_form_base.html#a653e5033a3d9834d3a3e1f3442d3d1e5":[0,0,83,18], -"class_reactive_shunt_element_form_base.html#a783c3c5b73e8386a96c51e22d0730d78":[0,0,83,1], -"class_reactive_shunt_element_form_base.html#a92f31dfb84b855ff5a36ab9f5257e381":[0,0,83,7], -"class_reactive_shunt_element_form_base.html#a93655501f77f68824420ef640ade219f":[0,0,83,0], -"class_reactive_shunt_element_form_base.html#aab4647a9961226fd3b6934b539539535":[0,0,83,8], -"class_reactive_shunt_element_form_base.html#aacf7ec5dec20fef61f3b190a950a0528":[0,0,83,24], -"class_reactive_shunt_element_form_base.html#ad927d95189e470a8f9268df8e16f81df":[0,0,83,3], -"class_reactive_shunt_element_form_base.html#aee2a26f08d25bb9989a03e8228dd1e69":[0,0,83,15], -"class_reactive_shunt_element_form_base.html#afb6b4c5f665e515a466d8fd31353829e":[0,0,83,11], -"class_reactive_shunt_element_form_base.html#aff864c79e7dae7fd22200efcdba27eb3":[0,0,83,14], -"class_shunt.html":[0,0,84], -"class_shunt.html#a0e19acef958e6153dc1d7386c82de780":[0,0,84,0], -"class_shunt.html#a23d2fed4e9b6a69bc4527b4345bd5bbd":[0,0,84,6], -"class_shunt.html#a33a6bcf6612d4cf8c4de8e9f916a22e8":[0,0,84,14], -"class_shunt.html#a449431a2044b838d35cbb991aa1de658":[0,0,84,2], -"class_shunt.html#a56d6136d647f64cf490dd9d7720f6865":[0,0,84,11], -"class_shunt.html#a665d9a8c291d427e666567c6df34321b":[0,0,84,8], -"class_shunt.html#a7a732f1fb5f54b89e33957194fefd703":[0,0,84,9], -"class_shunt.html#a902525eebbb4bf3ecaab0e1e60b6f017":[0,0,84,3], -"class_shunt.html#a98e8f5798d17f613dfc0964e5007cd91":[0,0,84,13], -"class_shunt.html#a9b52cb496663c75be79cb507d5961a8b":[0,0,84,1], -"class_shunt.html#aa98b8a2f097fc02fee1ea874e19480f3":[0,0,84,5], -"class_shunt.html#aacb9fdd05533a8322596b130c70774ef":[0,0,84,10], -"class_shunt.html#abe01dcdf8bc0ba6fc97d41673889fb8e":[0,0,84,12], -"class_shunt.html#abfc091da79ec7b87548d11dc8568b3cb":[0,0,84,15], -"class_shunt.html#ae325a441a44c2a78c08289292fa00979":[0,0,84,7], -"class_shunt.html#afdbf0c51f9630589937298329bb041fe":[0,0,84,4], -"class_simulations_settings_form.html":[0,0,86], -"class_simulations_settings_form.html#a0391607c5a1c9d9bc819ff76fbfe4ac9":[0,0,86,0], -"class_simulations_settings_form.html#a0b45be7dd91f8ed322dfe6be9f09b519":[0,0,86,4], -"class_simulations_settings_form.html#a33fd689685a661ba869285e70005b25c":[0,0,86,5], -"class_simulations_settings_form.html#a4a12f6479437b57c0f60da303e9ae8a4":[0,0,86,2], -"class_simulations_settings_form.html#a6afac8fd633a317058c3755c3b9ad531":[0,0,86,6], -"class_simulations_settings_form.html#a84907a8c877741a310bbd04a10661713":[0,0,86,1], -"class_simulations_settings_form.html#aac571bfc12367c787a34f04b1c6daf0e":[0,0,86,3], -"class_simulations_settings_form_base.html":[0,0,87], -"class_simulations_settings_form_base.html#a00162ab3f5fc280dc753440314a7e1ba":[0,0,87,36], -"class_simulations_settings_form_base.html#a00caec0bf8cdb39f16856a49b478596e":[0,0,87,22], -"class_simulations_settings_form_base.html#a01ca85120c1c072ff30df0949a57809b":[0,0,87,6], -"class_simulations_settings_form_base.html#a035a663ed0e32f8e1b5ad799e19d3ede":[0,0,87,30], -"class_simulations_settings_form_base.html#a094a39982209ed4298e1914bb6a01841":[0,0,87,28], -"class_simulations_settings_form_base.html#a09b4f2e8531838473197ef0e0ec148a8":[0,0,87,17], -"class_simulations_settings_form_base.html#a0e0fe5100d343148e774da127a5f13cd":[0,0,87,41], -"class_simulations_settings_form_base.html#a0e92dc8f5bc6f21b564ed7f0473f5c12":[0,0,87,37], -"class_simulations_settings_form_base.html#a0fe2f8372ca7856be82306d3b8197ba0":[0,0,87,33], -"class_simulations_settings_form_base.html#a109ea7e508f6494508d35a62237b661a":[0,0,87,67], -"class_simulations_settings_form_base.html#a1ac75d31b112a2febebf4bc9702f2308":[0,0,87,53], -"class_simulations_settings_form_base.html#a2123722e9d7846170793743eb2301c36":[0,0,87,8], -"class_simulations_settings_form_base.html#a213a37c4ec8adfe9193858c730809760":[0,0,87,29], -"class_simulations_settings_form_base.html#a26a06b8a618d7bb2e244f15cbbb218a0":[0,0,87,55], -"class_simulations_settings_form_base.html#a273b0fa706d897f285611b96b3274d11":[0,0,87,79], -"class_simulations_settings_form_base.html#a2931101c1dfb81b3ae70b208f2f21d9f":[0,0,87,26], -"class_simulations_settings_form_base.html#a2deb701c33edf6c39db842c6c78516c7":[0,0,87,51], -"class_simulations_settings_form_base.html#a317cc6c7b9a2a2bc849db7404bdca9f5":[0,0,87,75], -"class_simulations_settings_form_base.html#a3b70f10ddf978db633923109adf2eec8":[0,0,87,3], -"class_simulations_settings_form_base.html#a3f77e2f06060be18695b9e479569e750":[0,0,87,39], -"class_simulations_settings_form_base.html#a4529d8c7e6fd72067ea23d1dcddb8fda":[0,0,87,72], -"class_simulations_settings_form_base.html#a4536b745d3b4ec8f24e8f4e513d85631":[0,0,87,78], -"class_simulations_settings_form_base.html#a46cf61f4852659c6e16cf922c2a375e7":[0,0,87,50], -"class_simulations_settings_form_base.html#a4ed212050fcf484d787a25798da3dbba":[0,0,87,74], -"class_simulations_settings_form_base.html#a518aaef569ff7157901c2ddede7ad170":[0,0,87,73], -"class_simulations_settings_form_base.html#a524aa037a3fde6b45fe5dc28c44bee7e":[0,0,87,24], -"class_simulations_settings_form_base.html#a53776e57a1941d582b7e249baf991715":[0,0,87,38], -"class_simulations_settings_form_base.html#a55b6815057a04579c46f66a55152bfa8":[0,0,87,25], -"class_simulations_settings_form_base.html#a58a3cba8a8e3aeb7ad04d9c09322accb":[0,0,87,13], -"class_simulations_settings_form_base.html#a5f35f20f83aab77c9412a647c7cc4d81":[0,0,87,21], -"class_simulations_settings_form_base.html#a6dd10f55aef407622408e49647034411":[0,0,87,58], -"class_simulations_settings_form_base.html#a7042594f1537d6f29e548b2a2bdacbe9":[0,0,87,10], -"class_simulations_settings_form_base.html#a737cdb464ec33b674fb0b663244380be":[0,0,87,49], -"class_simulations_settings_form_base.html#a7534d53a23d3e4059f7d9f63cee3ddee":[0,0,87,70] +"class_reactive_shunt_element_form_base.html#a2e2c10853585884ad3a2802764b756c7":[0,0,83,17] }; diff --git a/docs/doxygen/html/navtreeindex9.js b/docs/doxygen/html/navtreeindex9.js index d7b2798..5837634 100644 --- a/docs/doxygen/html/navtreeindex9.js +++ b/docs/doxygen/html/navtreeindex9.js @@ -1,5 +1,83 @@ var NAVTREEINDEX9 = { +"class_reactive_shunt_element_form_base.html#a2eabee46e0b04d92086a0d0f21e3b10e":[0,0,83,12], +"class_reactive_shunt_element_form_base.html#a3295f1d61c6249cb5ec8994a86b66d41":[0,0,83,6], +"class_reactive_shunt_element_form_base.html#a39f95da41f55cae7829b9bd777dfef4d":[0,0,83,2], +"class_reactive_shunt_element_form_base.html#a3a61222247b8bf0d0dc0a74f002f9f54":[0,0,83,4], +"class_reactive_shunt_element_form_base.html#a41f1a2d4df3cc1c7506b975d5ecde71b":[0,0,83,9], +"class_reactive_shunt_element_form_base.html#a45c87f3d26fefb6701e3ce84445d3b2a":[0,0,83,10], +"class_reactive_shunt_element_form_base.html#a4b0ca8c2ccb39a0f305bcc2fe95c820e":[0,0,83,13], +"class_reactive_shunt_element_form_base.html#a5ae249950ace35e5b19124f1fa49946b":[0,0,83,5], +"class_reactive_shunt_element_form_base.html#a653e5033a3d9834d3a3e1f3442d3d1e5":[0,0,83,18], +"class_reactive_shunt_element_form_base.html#a783c3c5b73e8386a96c51e22d0730d78":[0,0,83,1], +"class_reactive_shunt_element_form_base.html#a92f31dfb84b855ff5a36ab9f5257e381":[0,0,83,7], +"class_reactive_shunt_element_form_base.html#a93655501f77f68824420ef640ade219f":[0,0,83,0], +"class_reactive_shunt_element_form_base.html#aab4647a9961226fd3b6934b539539535":[0,0,83,8], +"class_reactive_shunt_element_form_base.html#aacf7ec5dec20fef61f3b190a950a0528":[0,0,83,24], +"class_reactive_shunt_element_form_base.html#ad927d95189e470a8f9268df8e16f81df":[0,0,83,3], +"class_reactive_shunt_element_form_base.html#aee2a26f08d25bb9989a03e8228dd1e69":[0,0,83,15], +"class_reactive_shunt_element_form_base.html#afb6b4c5f665e515a466d8fd31353829e":[0,0,83,11], +"class_reactive_shunt_element_form_base.html#aff864c79e7dae7fd22200efcdba27eb3":[0,0,83,14], +"class_shunt.html":[0,0,84], +"class_shunt.html#a0e19acef958e6153dc1d7386c82de780":[0,0,84,0], +"class_shunt.html#a23d2fed4e9b6a69bc4527b4345bd5bbd":[0,0,84,6], +"class_shunt.html#a33a6bcf6612d4cf8c4de8e9f916a22e8":[0,0,84,14], +"class_shunt.html#a449431a2044b838d35cbb991aa1de658":[0,0,84,2], +"class_shunt.html#a56d6136d647f64cf490dd9d7720f6865":[0,0,84,11], +"class_shunt.html#a665d9a8c291d427e666567c6df34321b":[0,0,84,8], +"class_shunt.html#a7a732f1fb5f54b89e33957194fefd703":[0,0,84,9], +"class_shunt.html#a902525eebbb4bf3ecaab0e1e60b6f017":[0,0,84,3], +"class_shunt.html#a98e8f5798d17f613dfc0964e5007cd91":[0,0,84,13], +"class_shunt.html#a9b52cb496663c75be79cb507d5961a8b":[0,0,84,1], +"class_shunt.html#aa98b8a2f097fc02fee1ea874e19480f3":[0,0,84,5], +"class_shunt.html#aacb9fdd05533a8322596b130c70774ef":[0,0,84,10], +"class_shunt.html#abe01dcdf8bc0ba6fc97d41673889fb8e":[0,0,84,12], +"class_shunt.html#abfc091da79ec7b87548d11dc8568b3cb":[0,0,84,15], +"class_shunt.html#ae325a441a44c2a78c08289292fa00979":[0,0,84,7], +"class_shunt.html#afdbf0c51f9630589937298329bb041fe":[0,0,84,4], +"class_simulations_settings_form.html":[0,0,86], +"class_simulations_settings_form.html#a0391607c5a1c9d9bc819ff76fbfe4ac9":[0,0,86,0], +"class_simulations_settings_form.html#a0b45be7dd91f8ed322dfe6be9f09b519":[0,0,86,4], +"class_simulations_settings_form.html#a33fd689685a661ba869285e70005b25c":[0,0,86,5], +"class_simulations_settings_form.html#a4a12f6479437b57c0f60da303e9ae8a4":[0,0,86,2], +"class_simulations_settings_form.html#a6afac8fd633a317058c3755c3b9ad531":[0,0,86,6], +"class_simulations_settings_form.html#a84907a8c877741a310bbd04a10661713":[0,0,86,1], +"class_simulations_settings_form.html#aac571bfc12367c787a34f04b1c6daf0e":[0,0,86,3], +"class_simulations_settings_form_base.html":[0,0,87], +"class_simulations_settings_form_base.html#a00162ab3f5fc280dc753440314a7e1ba":[0,0,87,36], +"class_simulations_settings_form_base.html#a00caec0bf8cdb39f16856a49b478596e":[0,0,87,22], +"class_simulations_settings_form_base.html#a01ca85120c1c072ff30df0949a57809b":[0,0,87,6], +"class_simulations_settings_form_base.html#a035a663ed0e32f8e1b5ad799e19d3ede":[0,0,87,30], +"class_simulations_settings_form_base.html#a094a39982209ed4298e1914bb6a01841":[0,0,87,28], +"class_simulations_settings_form_base.html#a09b4f2e8531838473197ef0e0ec148a8":[0,0,87,17], +"class_simulations_settings_form_base.html#a0e0fe5100d343148e774da127a5f13cd":[0,0,87,41], +"class_simulations_settings_form_base.html#a0e92dc8f5bc6f21b564ed7f0473f5c12":[0,0,87,37], +"class_simulations_settings_form_base.html#a0fe2f8372ca7856be82306d3b8197ba0":[0,0,87,33], +"class_simulations_settings_form_base.html#a109ea7e508f6494508d35a62237b661a":[0,0,87,67], +"class_simulations_settings_form_base.html#a1ac75d31b112a2febebf4bc9702f2308":[0,0,87,53], +"class_simulations_settings_form_base.html#a2123722e9d7846170793743eb2301c36":[0,0,87,8], +"class_simulations_settings_form_base.html#a213a37c4ec8adfe9193858c730809760":[0,0,87,29], +"class_simulations_settings_form_base.html#a26a06b8a618d7bb2e244f15cbbb218a0":[0,0,87,55], +"class_simulations_settings_form_base.html#a273b0fa706d897f285611b96b3274d11":[0,0,87,79], +"class_simulations_settings_form_base.html#a2931101c1dfb81b3ae70b208f2f21d9f":[0,0,87,26], +"class_simulations_settings_form_base.html#a2deb701c33edf6c39db842c6c78516c7":[0,0,87,51], +"class_simulations_settings_form_base.html#a317cc6c7b9a2a2bc849db7404bdca9f5":[0,0,87,75], +"class_simulations_settings_form_base.html#a3b70f10ddf978db633923109adf2eec8":[0,0,87,3], +"class_simulations_settings_form_base.html#a3f77e2f06060be18695b9e479569e750":[0,0,87,39], +"class_simulations_settings_form_base.html#a4529d8c7e6fd72067ea23d1dcddb8fda":[0,0,87,72], +"class_simulations_settings_form_base.html#a4536b745d3b4ec8f24e8f4e513d85631":[0,0,87,78], +"class_simulations_settings_form_base.html#a46cf61f4852659c6e16cf922c2a375e7":[0,0,87,50], +"class_simulations_settings_form_base.html#a4ed212050fcf484d787a25798da3dbba":[0,0,87,74], +"class_simulations_settings_form_base.html#a518aaef569ff7157901c2ddede7ad170":[0,0,87,73], +"class_simulations_settings_form_base.html#a524aa037a3fde6b45fe5dc28c44bee7e":[0,0,87,24], +"class_simulations_settings_form_base.html#a53776e57a1941d582b7e249baf991715":[0,0,87,38], +"class_simulations_settings_form_base.html#a55b6815057a04579c46f66a55152bfa8":[0,0,87,25], +"class_simulations_settings_form_base.html#a58a3cba8a8e3aeb7ad04d9c09322accb":[0,0,87,13], +"class_simulations_settings_form_base.html#a5f35f20f83aab77c9412a647c7cc4d81":[0,0,87,21], +"class_simulations_settings_form_base.html#a6dd10f55aef407622408e49647034411":[0,0,87,58], +"class_simulations_settings_form_base.html#a7042594f1537d6f29e548b2a2bdacbe9":[0,0,87,10], +"class_simulations_settings_form_base.html#a737cdb464ec33b674fb0b663244380be":[0,0,87,49], +"class_simulations_settings_form_base.html#a7534d53a23d3e4059f7d9f63cee3ddee":[0,0,87,70], "class_simulations_settings_form_base.html#a76d9c02a5e8293274ff5ca30da5f3875":[0,0,87,4], "class_simulations_settings_form_base.html#a848776479beac8acd3b12cac44db650b":[0,0,87,54], "class_simulations_settings_form_base.html#a8d8e9a8f2d048dede1d4c1499874d583":[0,0,87,71], @@ -171,83 +249,5 @@ var NAVTREEINDEX9 = "class_sync_machine_form_base.html":[0,0,97], "class_sync_machine_form_base.html#a0045396673e3acd9fb6a21982b7d7596":[0,0,97,22], "class_sync_machine_form_base.html#a0063a2e8df81e75b32e0fac571c921ae":[0,0,97,34], -"class_sync_machine_form_base.html#a05439a30d63c78be06d1d046c0cc59d8":[0,0,97,87], -"class_sync_machine_form_base.html#a0580ac7326c742ffe05d7791d83a52d7":[0,0,97,83], -"class_sync_machine_form_base.html#a05cfcbb0cfa2e3e4ec07a7fba1bdf5d6":[0,0,97,61], -"class_sync_machine_form_base.html#a0c385577ff27d8d9ed1a87a22fce73fd":[0,0,97,63], -"class_sync_machine_form_base.html#a0dbd47d991d7750b3368d84b06d3c361":[0,0,97,0], -"class_sync_machine_form_base.html#a102368df6855d5ba275a49ffae593168":[0,0,97,15], -"class_sync_machine_form_base.html#a11249eb9f833be5b91c3f684477be7aa":[0,0,97,12], -"class_sync_machine_form_base.html#a138fa57d3582962bae07d035e63b586d":[0,0,97,74], -"class_sync_machine_form_base.html#a15b9a853d75e1e59084cf84130bfbbc2":[0,0,97,78], -"class_sync_machine_form_base.html#a1c9124d5e5449d28ae8b0af31a651a25":[0,0,97,28], -"class_sync_machine_form_base.html#a1ed492083cd0abec88ace3965553308b":[0,0,97,56], -"class_sync_machine_form_base.html#a21dbc2fc03aef37e45e1cf3a63da9551":[0,0,97,55], -"class_sync_machine_form_base.html#a230d01b1c29375bdfd3063d9097f9f88":[0,0,97,8], -"class_sync_machine_form_base.html#a24d1c0a769de296404d9697ff6bba278":[0,0,97,9], -"class_sync_machine_form_base.html#a25dfe7fcf1465ef808fd652a5cd6b2e1":[0,0,97,64], -"class_sync_machine_form_base.html#a2d7690b252b2b22d5b950d04b9757bb4":[0,0,97,21], -"class_sync_machine_form_base.html#a2f22b959d0d97b7ad3ee6de5557ad976":[0,0,97,52], -"class_sync_machine_form_base.html#a38a81a205d2112a58084b2d6cc13380a":[0,0,97,24], -"class_sync_machine_form_base.html#a3aa2c493b7430078bc17a34bb8cc476b":[0,0,97,43], -"class_sync_machine_form_base.html#a3db4e4cfd2fd42f9ce6ab3f72952f6ba":[0,0,97,44], -"class_sync_machine_form_base.html#a3f1c8401a39935ef1f589d68af2be97a":[0,0,97,40], -"class_sync_machine_form_base.html#a4112b3c631d0ceec0178fc05ea1b120c":[0,0,97,2], -"class_sync_machine_form_base.html#a4496bfac69450fe5a10baa9dbc4888a6":[0,0,97,80], -"class_sync_machine_form_base.html#a45f5bf24827dfcda99e71f83cfb3fa5b":[0,0,97,29], -"class_sync_machine_form_base.html#a46fe41a58c06bedeab99cd190921e545":[0,0,97,4], -"class_sync_machine_form_base.html#a4ba97e9dc30c24a0daf0ad3771823df0":[0,0,97,77], -"class_sync_machine_form_base.html#a4fca8015f54006f8b79faf8bb6d3eb09":[0,0,97,26], -"class_sync_machine_form_base.html#a5133c66f455c7a5597e72b9b367e0fc8":[0,0,97,47], -"class_sync_machine_form_base.html#a5735d89d9451e76734467e14779a7ab0":[0,0,97,49], -"class_sync_machine_form_base.html#a5a091446eebeeb3c5116fa87aeda535b":[0,0,97,79], -"class_sync_machine_form_base.html#a5dcc03c3e17f06e0914f3209120a6329":[0,0,97,35], -"class_sync_machine_form_base.html#a5fd0741a7ac3e8613cc01a28933b4ea8":[0,0,97,11], -"class_sync_machine_form_base.html#a681513dcfa84f4aab5803299fd8ae766":[0,0,97,37], -"class_sync_machine_form_base.html#a6b3830705a2208493714c1abdb8fa0b8":[0,0,97,70], -"class_sync_machine_form_base.html#a6c2c10dd63d1ace53d882b477d037d75":[0,0,97,30], -"class_sync_machine_form_base.html#a6dba8c557f3e20f9982c084e5e5a74e3":[0,0,97,59], -"class_sync_machine_form_base.html#a6fedceb84c293f69fbcb6290ea529798":[0,0,97,84], -"class_sync_machine_form_base.html#a717b5ba1d7ed6b4026b527ce12b2bf41":[0,0,97,72], -"class_sync_machine_form_base.html#a7367ed87a446dc08067af218b8bb2215":[0,0,97,31], -"class_sync_machine_form_base.html#a7530a37ed44f0732758708aabf7f748c":[0,0,97,19], -"class_sync_machine_form_base.html#a76040f3058374ee765d4baa6b1b07df7":[0,0,97,7], -"class_sync_machine_form_base.html#a7849d5f397e132e164b0c1952ddaa0a3":[0,0,97,82], -"class_sync_machine_form_base.html#a79579458c023bf56d0df6f0356e58c9b":[0,0,97,53], -"class_sync_machine_form_base.html#a7a035fe2031ab6eae1513f73adabd0c3":[0,0,97,32], -"class_sync_machine_form_base.html#a7c6a05f65b77bdad43f7f92c2b184077":[0,0,97,50], -"class_sync_machine_form_base.html#a909b922a1f157d6013a7baaf22796d24":[0,0,97,86], -"class_sync_machine_form_base.html#a93fd03ae353875c5e04ccdb57800f821":[0,0,97,58], -"class_sync_machine_form_base.html#a959fea39df34cb124ab6a0ad78d78712":[0,0,97,3], -"class_sync_machine_form_base.html#a97509be24b2add48e9d23d5b7020b076":[0,0,97,48], -"class_sync_machine_form_base.html#a9c402618cc9ae56ca3780d7420bf5722":[0,0,97,69], -"class_sync_machine_form_base.html#a9d4d3f8b66519903eaac859b0a5314e9":[0,0,97,6], -"class_sync_machine_form_base.html#a9e63594f861d223182734011b24030dc":[0,0,97,14], -"class_sync_machine_form_base.html#a9fd3b15e35d1753059759886bf918130":[0,0,97,81], -"class_sync_machine_form_base.html#aa2a774f00e17cfec0ef2efccc086b990":[0,0,97,25], -"class_sync_machine_form_base.html#aa53388881170a5aceb737b0c58315351":[0,0,97,16], -"class_sync_machine_form_base.html#aab2926cd0e56d2cb283fc74e5aa20f5d":[0,0,97,10], -"class_sync_machine_form_base.html#aacac6cfe475bf4176dcf746417cdd432":[0,0,97,88], -"class_sync_machine_form_base.html#aaff0a6a0030e1d0928f6a69f27bb1180":[0,0,97,46], -"class_sync_machine_form_base.html#ab221b3b73b231252dfe605efa5268f59":[0,0,97,39], -"class_sync_machine_form_base.html#ab922478387b0a89d0d5a4ab0d1500a4a":[0,0,97,27], -"class_sync_machine_form_base.html#aba28c35b0281a75f7ed7b57e6ceed52c":[0,0,97,5], -"class_sync_machine_form_base.html#ac195ae144957568ef98e5e3f9ba31388":[0,0,97,76], -"class_sync_machine_form_base.html#ac3d26a423d2fd7243c9361d360b0e6d3":[0,0,97,42], -"class_sync_machine_form_base.html#ac4a8ed68ffba04940adbf6e3070291a4":[0,0,97,65], -"class_sync_machine_form_base.html#ac71f3c270c8c796dd427ee6bd32f1c60":[0,0,97,38], -"class_sync_machine_form_base.html#acc82ce4087f0fcde8e42e2b7f111cfcc":[0,0,97,57], -"class_sync_machine_form_base.html#acef45c78c5bbaf1dee5b3abc895e8baf":[0,0,97,17], -"class_sync_machine_form_base.html#ad3b5932a14988843670c516861029517":[0,0,97,33], -"class_sync_machine_form_base.html#ad3dab6cd719a3464b4bca0e92063b20c":[0,0,97,23], -"class_sync_machine_form_base.html#ad4789258aa31c9d3c699013ce6f3406f":[0,0,97,66], -"class_sync_machine_form_base.html#ad47c151f396bbad83787de190055ea65":[0,0,97,20], -"class_sync_machine_form_base.html#ad6e4bc150fc34819eaa2333d1d4cb2b8":[0,0,97,13], -"class_sync_machine_form_base.html#ad720f87582570c72919f9094987bda08":[0,0,97,67], -"class_sync_machine_form_base.html#ade8616fc5502cc760867821d52b2a697":[0,0,97,75], -"class_sync_machine_form_base.html#ae0b5c587ae39b5e558bb298eb1f180b0":[0,0,97,41], -"class_sync_machine_form_base.html#ae2aa2eb6ad549c8b918389df69b6af36":[0,0,97,18], -"class_sync_machine_form_base.html#ae4c8099099059b6e5b8d4791991929c5":[0,0,97,51], -"class_sync_machine_form_base.html#ae69f427b9931e920bcb615a15e74484e":[0,0,97,68], -"class_sync_machine_form_base.html#aec2123bb23ad47344e000bf2e460117e":[0,0,97,45] +"class_sync_machine_form_base.html#a05439a30d63c78be06d1d046c0cc59d8":[0,0,97,87] }; diff --git a/docs/doxygen/html/search/all_0.js b/docs/doxygen/html/search/all_0.js index 0a0141b..89e0e5e 100644 --- a/docs/doxygen/html/search/all_0.js +++ b/docs/doxygen/html/search/all_0.js @@ -1,6 +1,7 @@ var searchData= [ ['aboutform',['AboutForm',['../class_about_form.html',1,'']]], + ['aboutform_2eh',['AboutForm.h',['../_about_form_8h.html',1,'']]], ['aboutformbase',['AboutFormBase',['../class_about_form_base.html',1,'']]], ['addchild',['AddChild',['../class_element.html#ac38d6707d08cb5c057032aa94b511a62',1,'Element']]], ['addparent',['AddParent',['../class_bus.html#ab046baebe4bfe0a52905148d78f44681',1,'Bus::AddParent()'],['../class_capacitor.html#ace755e5bc3cc72b491ce31c24c54a5cf',1,'Capacitor::AddParent()'],['../class_element.html#a569178e9138490a981511a644536c0f9',1,'Element::AddParent(Element *parent, wxPoint2DDouble position)'],['../class_element.html#ad1f153a87797633ab310d07e1d06eba9',1,'Element::AddParent(Element *parent)'],['../class_inductor.html#a4e404c6e15f206fe0f5de06fc19dedf5',1,'Inductor::AddParent()'],['../class_line.html#a26c69f7f703dca718edc28d5093934a3',1,'Line::AddParent()'],['../class_load.html#ac9f449be9b919b36924a844324bf37ee',1,'Load::AddParent()'],['../class_machines.html#aaaf1b86dcbfd8f4a4c082a77d72b1fe3',1,'Machines::AddParent()'],['../class_text.html#a4f273ea7008c72533327c25caff2e917',1,'Text::AddParent()'],['../class_transformer.html#aea52a4562ec5b4a79bf82b8ede32ecc6',1,'Transformer::AddParent()']]], diff --git a/docs/doxygen/html/search/all_1.js b/docs/doxygen/html/search/all_1.js index bf9a3cd..45fc30c 100644 --- a/docs/doxygen/html/search/all_1.js +++ b/docs/doxygen/html/search/all_1.js @@ -5,5 +5,6 @@ var searchData= ['bus',['Bus',['../class_bus.html',1,'']]], ['buselectricaldata',['BusElectricalData',['../struct_bus_electrical_data.html',1,'']]], ['busform',['BusForm',['../class_bus_form.html',1,'']]], + ['busform_2eh',['BusForm.h',['../_bus_form_8h.html',1,'']]], ['busformbase',['BusFormBase',['../class_bus_form_base.html',1,'']]] ]; diff --git a/docs/doxygen/html/search/all_10.js b/docs/doxygen/html/search/all_10.js index 9b8e3a9..77f9de3 100644 --- a/docs/doxygen/html/search/all_10.js +++ b/docs/doxygen/html/search/all_10.js @@ -2,14 +2,17 @@ var searchData= [ ['text',['Text',['../class_text.html',1,'']]], ['textform',['TextForm',['../class_text_form.html',1,'']]], + ['textform_2eh',['TextForm.h',['../_text_form_8h.html',1,'']]], ['textformbase',['TextFormBase',['../class_text_form_base.html',1,'']]], ['textgldrawable',['TextGLDrawable',['../class_text_g_l_drawable.html',1,'']]], ['texttexture',['TextTexture',['../class_text_texture.html',1,'']]], ['transferfunction',['TransferFunction',['../class_transfer_function.html',1,'']]], ['transferfunctionform',['TransferFunctionForm',['../class_transfer_function_form.html',1,'']]], + ['transferfunctionform_2eh',['TransferFunctionForm.h',['../_transfer_function_form_8h.html',1,'']]], ['transferfunctionformbase',['TransferFunctionFormBase',['../class_transfer_function_form_base.html',1,'']]], ['transformer',['Transformer',['../class_transformer.html',1,'']]], ['transformerelectricaldata',['TransformerElectricalData',['../struct_transformer_electrical_data.html',1,'']]], ['transformerform',['TransformerForm',['../class_transformer_form.html',1,'']]], + ['transformerform_2eh',['TransformerForm.h',['../_transformer_form_8h.html',1,'']]], ['transformerformbase',['TransformerFormBase',['../class_transformer_form_base.html',1,'']]] ]; diff --git a/docs/doxygen/html/search/all_12.js b/docs/doxygen/html/search/all_12.js index c7b045e..245184a 100644 --- a/docs/doxygen/html/search/all_12.js +++ b/docs/doxygen/html/search/all_12.js @@ -1,6 +1,7 @@ var searchData= [ ['workspace',['Workspace',['../class_workspace.html',1,'']]], + ['workspace_2eh',['Workspace.h',['../_workspace_8h.html',1,'']]], ['workspacebase',['WorkspaceBase',['../class_workspace_base.html',1,'']]], ['worldtoscreen',['WorldToScreen',['../class_element.html#abfee7ea88f4689c2a6eb4d39452f84d8',1,'Element::WorldToScreen(wxPoint2DDouble translation, double scale, double offsetX=0.0, double offsetY=0.0) const'],['../class_element.html#a147dd55d902171b212168ffde7262343',1,'Element::WorldToScreen(wxPoint2DDouble position, wxPoint2DDouble translation, double scale, double offsetX=0.0, double offsetY=0.0) const']]], ['wxglnumberrenderer',['wxGLNumberRenderer',['../classwx_g_l_number_renderer.html',1,'']]], diff --git a/docs/doxygen/html/search/all_13.js b/docs/doxygen/html/search/all_13.js index 91c4129..890e89e 100644 --- a/docs/doxygen/html/search/all_13.js +++ b/docs/doxygen/html/search/all_13.js @@ -1,8 +1,5 @@ var searchData= [ - ['_7eelectriccalculation',['~ElectricCalculation',['../class_electric_calculation.html#a1e70291bfa9a0850d9ffcbee44daa2f7',1,'ElectricCalculation']]], - ['_7eelement',['~Element',['../class_element.html#a13d54ba9c08b6bec651402f1c2bb002c',1,'Element']]], - ['_7efault',['~Fault',['../class_fault.html#a42019654142cd8187b314e43d70262eb',1,'Fault']]], - ['_7eopenglcolour',['~OpenGLColour',['../class_open_g_l_colour.html#a4b9a726773b4c82935f15add648ed2a0',1,'OpenGLColour']]], - ['_7epowerelement',['~PowerElement',['../class_power_element.html#a39be7c8e3bdb96b16c26ea7f7d6e6cbf',1,'PowerElement']]] + ['xd',['xd',['../struct_sync_machine_model_data.html#af75546805bf92eb7a8a7280f7964b330',1,'SyncMachineModelData']]], + ['xq',['xq',['../struct_sync_machine_model_data.html#af81596945918e86e56f5822a0ba97fbc',1,'SyncMachineModelData']]] ]; diff --git a/docs/doxygen/html/search/all_14.html b/docs/doxygen/html/search/all_14.html new file mode 100644 index 0000000..fb4d0ec --- /dev/null +++ b/docs/doxygen/html/search/all_14.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/all_14.js b/docs/doxygen/html/search/all_14.js new file mode 100644 index 0000000..9783142 --- /dev/null +++ b/docs/doxygen/html/search/all_14.js @@ -0,0 +1,9 @@ +var searchData= +[ + ['_7eelectriccalculation',['~ElectricCalculation',['../class_electric_calculation.html#a1e70291bfa9a0850d9ffcbee44daa2f7',1,'ElectricCalculation']]], + ['_7eelement',['~Element',['../class_element.html#a13d54ba9c08b6bec651402f1c2bb002c',1,'Element']]], + ['_7efault',['~Fault',['../class_fault.html#a42019654142cd8187b314e43d70262eb',1,'Fault']]], + ['_7emainframe',['~MainFrame',['../class_main_frame.html#a0cfd88ece4836e0ea5430bd55370bf11',1,'MainFrame']]], + ['_7eopenglcolour',['~OpenGLColour',['../class_open_g_l_colour.html#a4b9a726773b4c82935f15add648ed2a0',1,'OpenGLColour']]], + ['_7epowerelement',['~PowerElement',['../class_power_element.html#a39be7c8e3bdb96b16c26ea7f7d6e6cbf',1,'PowerElement']]] +]; diff --git a/docs/doxygen/html/search/all_2.js b/docs/doxygen/html/search/all_2.js index 3117bc8..81e2eeb 100644 --- a/docs/doxygen/html/search/all_2.js +++ b/docs/doxygen/html/search/all_2.js @@ -4,23 +4,33 @@ var searchData= ['calculateboundaries',['CalculateBoundaries',['../class_element.html#a57f5771fd003020fef3866a1d1dc7487',1,'Element::CalculateBoundaries()'],['../class_line.html#aa146d6b0c7f3b74204f2c88dcbd7f4b0',1,'Line::CalculateBoundaries()']]], ['calculatepowerflowpts',['CalculatePowerFlowPts',['../class_power_element.html#a6c656ef223d36e96b19b0a9ec2115e9e',1,'PowerElement']]], ['camera',['Camera',['../class_camera.html',1,'']]], + ['camera_2eh',['Camera.h',['../_camera_8h.html',1,'']]], ['capacitor',['Capacitor',['../class_capacitor.html',1,'']]], ['capacitorelectricaldata',['CapacitorElectricalData',['../struct_capacitor_electrical_data.html',1,'']]], ['chartview',['ChartView',['../class_chart_view.html',1,'']]], + ['chartview_2eh',['ChartView.h',['../_chart_view_8h.html',1,'']]], ['chartviewbase',['ChartViewBase',['../class_chart_view_base.html',1,'']]], ['connectionline',['ConnectionLine',['../class_connection_line.html',1,'']]], + ['connectionline_2eh',['ConnectionLine.h',['../_connection_line_8h.html',1,'']]], ['consolidate',['consolidate',['../classwx_g_l_string.html#a54a67012ceb50ee50696c0c1fa0a7b55',1,'wxGLString::consolidate()'],['../classwx_g_l_number_renderer.html#aa79114bda6e5e4c3db4b8aeeb5f272c4',1,'wxGLNumberRenderer::consolidate()'],['../classwx_g_l_string_array.html#a2aaa7b340ee571ca6405bbec28715430',1,'wxGLStringArray::consolidate()']]], ['constant',['Constant',['../class_constant.html',1,'']]], + ['constant_2eh',['Constant.h',['../_constant_8h.html',1,'']]], ['constantform',['ConstantForm',['../class_constant_form.html',1,'']]], + ['constantform_2eh',['ConstantForm.h',['../_constant_form_8h.html',1,'']]], ['constantformbase',['ConstantFormBase',['../class_constant_form_base.html',1,'']]], ['contains',['Contains',['../class_branch.html#a691f94c3cd2abe1274e870d2882634d8',1,'Branch::Contains()'],['../class_bus.html#ad2b960058be6e990463b53d79c74c7a3',1,'Bus::Contains()'],['../class_capacitor.html#a994039e59a8ae0ec3fe7cf7f5b66e4e5',1,'Capacitor::Contains()'],['../class_connection_line.html#a65c6d7139587c973a92dd1009909597f',1,'ConnectionLine::Contains()'],['../class_constant.html#ae091eb79633beb158dc06880424f7ce6',1,'Constant::Contains()'],['../class_element.html#abf6c4949733debca55b2f56d8e9b7372',1,'Element::Contains()'],['../class_exponential.html#a79eabfca357002f160b082a6df9f6f2b',1,'Exponential::Contains()'],['../class_gain.html#a9d80d49f5123cf4859bf15a251e3923f',1,'Gain::Contains()'],['../class_inductor.html#ac3ba7de94a328b20ff86e968a6228f60',1,'Inductor::Contains()'],['../class_i_o_control.html#aa064c5d70e562334e2b374f919f42ef1',1,'IOControl::Contains()'],['../class_limiter.html#ac6506d59da4ea682d9e556564ec3ad11',1,'Limiter::Contains()'],['../class_line.html#a05eb3761f198a058045f85d6e685ca97',1,'Line::Contains()'],['../class_machines.html#acda27b0ea8a7b0fb00d647d8744f346e',1,'Machines::Contains()'],['../class_multiplier.html#acee6216a03b550f3a9cad2bef3963a18',1,'Multiplier::Contains()'],['../class_rate_limiter.html#addf0eef395781b8584063a9061be59dc',1,'RateLimiter::Contains()'],['../class_shunt.html#a449431a2044b838d35cbb991aa1de658',1,'Shunt::Contains()'],['../class_sum.html#a1d1b52ca1b9a81d53c0a9cf140546987',1,'Sum::Contains()'],['../class_text.html#a51c55b9272f653cfc3cdafe665d5dde0',1,'Text::Contains()'],['../class_transfer_function.html#a6a4415d2cf0af290494ea30d586cc187',1,'TransferFunction::Contains()'],['../class_transformer.html#a327ff3cf9194c18049e4feac6761ebc0',1,'Transformer::Contains()']]], ['contextmenuid',['ContextMenuID',['../_element_8h.html#a0a9284bee7d4ad748c4a740fdeb3f049',1,'Element.h']]], ['controleditor',['ControlEditor',['../class_control_editor.html',1,'']]], + ['controleditor_2eh',['ControlEditor.h',['../_control_editor_8h.html',1,'']]], ['controleditorbase',['ControlEditorBase',['../class_control_editor_base.html',1,'']]], ['controlelement',['ControlElement',['../class_control_element.html',1,'']]], + ['controlelement_2eh',['ControlElement.h',['../_control_element_8h.html',1,'']]], ['controlelementbutton',['ControlElementButton',['../class_control_element_button.html',1,'']]], ['controlelementcontainer',['ControlElementContainer',['../class_control_element_container.html',1,'']]], + ['controlelementcontainer_2eh',['ControlElementContainer.h',['../_control_element_container_8h.html',1,'']]], ['controlelementsolver',['ControlElementSolver',['../class_control_element_solver.html',1,'']]], + ['controlelementsolver_2eh',['ControlElementSolver.h',['../_control_element_solver_8h.html',1,'']]], ['controlsystemtest',['ControlSystemTest',['../class_control_system_test.html',1,'']]], + ['controlsystemtest_2eh',['ControlSystemTest.h',['../_control_system_test_8h.html',1,'']]], ['controlsystemtestbase',['ControlSystemTestBase',['../class_control_system_test_base.html',1,'']]] ]; diff --git a/docs/doxygen/html/search/all_3.js b/docs/doxygen/html/search/all_3.js index dcd29cd..d8257de 100644 --- a/docs/doxygen/html/search/all_3.js +++ b/docs/doxygen/html/search/all_3.js @@ -1,6 +1,7 @@ var searchData= [ ['datareport',['DataReport',['../class_data_report.html',1,'']]], + ['datareport_2eh',['DataReport.h',['../_data_report_8h.html',1,'']]], ['datareportbase',['DataReportBase',['../class_data_report_base.html',1,'']]], ['doublefromstring',['DoubleFromString',['../class_element.html#acfd2c0fe1af5a8ad6da393fb711fd69a',1,'Element']]], ['draw',['Draw',['../class_branch.html#a7037f496f9b9c9e64c74eb638debe278',1,'Branch::Draw()'],['../class_bus.html#ae9022ca29399377d2fe0082bb762107c',1,'Bus::Draw()'],['../class_capacitor.html#a94d378c922467214b394931ec0eb01c8',1,'Capacitor::Draw()'],['../class_connection_line.html#a71cb3502dd098e1d1ef541668789586e',1,'ConnectionLine::Draw()'],['../class_constant.html#afc4d8739980ae1b57e9c5058c2e05591',1,'Constant::Draw()'],['../class_element.html#a551ed1eeab446b5366d56c2ee9dec187',1,'Element::Draw()'],['../class_exponential.html#af5f172e2f7ae7df0fc79b44b55355339',1,'Exponential::Draw()'],['../class_gain.html#a42f48bfdfb3d6f593fcc599504dd2264',1,'Gain::Draw()'],['../class_inductor.html#a97761292fac4f0da7ae3dc6ca4b4de54',1,'Inductor::Draw()'],['../class_i_o_control.html#aa6aab56f8936a87f099241d9bad9fee4',1,'IOControl::Draw()'],['../class_limiter.html#a2e2960936ebfcc6589181b7948fba242',1,'Limiter::Draw()'],['../class_line.html#a297e12aa8ff0be5d344e245732487bdd',1,'Line::Draw()'],['../class_load.html#aaef52b18cc53fa2db996fb9cad5db181',1,'Load::Draw()'],['../class_machines.html#af3279663c82de88e12f0487bfc633f7c',1,'Machines::Draw()'],['../class_multiplier.html#ae854fd981a98aca93b286081cc9c19f3',1,'Multiplier::Draw()'],['../class_rate_limiter.html#a6afc319e3a165776b8a429b9bbe38580',1,'RateLimiter::Draw()'],['../class_sum.html#a31dbb6867b17188b4a8cc650983da57b',1,'Sum::Draw()'],['../class_transfer_function.html#a0cd1dec850117741abb04b608c7b3f1e',1,'TransferFunction::Draw()'],['../class_transformer.html#a1e9e9ba48aa76bdd2ff2e973014ad422',1,'Transformer::Draw()']]], diff --git a/docs/doxygen/html/search/all_4.js b/docs/doxygen/html/search/all_4.js index 5b8026c..4e9ef48 100644 --- a/docs/doxygen/html/search/all_4.js +++ b/docs/doxygen/html/search/all_4.js @@ -1,15 +1,20 @@ var searchData= [ + ['ed',['ed',['../struct_sync_machine_model_data.html#ad2bda1ac696b664571e33f657f4a81b6',1,'SyncMachineModelData']]], ['electricalunit',['ElectricalUnit',['../_power_element_8h.html#a398e3da742a726a8f2bacd8149220cca',1,'PowerElement.h']]], ['electriccalculation',['ElectricCalculation',['../class_electric_calculation.html',1,'ElectricCalculation'],['../class_electric_calculation.html#a6663e7a20e96ee975bd0f7d54b8a6f70',1,'ElectricCalculation::ElectricCalculation()']]], ['electriccalculation_2eh',['ElectricCalculation.h',['../_electric_calculation_8h.html',1,'']]], ['electromechanical',['Electromechanical',['../class_electromechanical.html',1,'']]], + ['electromechanical_2eh',['Electromechanical.h',['../_electromechanical_8h.html',1,'']]], ['element',['Element',['../class_element.html',1,'Element'],['../class_element.html#ab0d0e20be9a36ae676202db753faeec9',1,'Element::Element()']]], ['element_2eh',['Element.h',['../_element_8h.html',1,'']]], ['elementdataobject',['ElementDataObject',['../class_element_data_object.html',1,'']]], ['elementplotdata',['ElementPlotData',['../class_element_plot_data.html',1,'']]], ['elementslists',['ElementsLists',['../struct_elements_lists.html',1,'']]], + ['eq',['eq',['../struct_sync_machine_model_data.html#a810b9e3250ebb8f3d4176f6e5a2b1076',1,'SyncMachineModelData']]], ['exponential',['Exponential',['../class_exponential.html',1,'']]], + ['exponential_2eh',['Exponential.h',['../_exponential_8h.html',1,'']]], ['exponentialform',['ExponentialForm',['../class_exponential_form.html',1,'']]], + ['exponentialform_2eh',['ExponentialForm.h',['../_exponential_form_8h.html',1,'']]], ['exponentialformbase',['ExponentialFormBase',['../class_exponential_form_base.html',1,'']]] ]; diff --git a/docs/doxygen/html/search/all_5.js b/docs/doxygen/html/search/all_5.js index 9a4c639..0d4a3a9 100644 --- a/docs/doxygen/html/search/all_5.js +++ b/docs/doxygen/html/search/all_5.js @@ -10,5 +10,6 @@ var searchData= ['fault_5fline_5fground',['FAULT_LINE_GROUND',['../_power_element_8h.html#a41a50717b1a7ef4caa3c499c164fc2cbaa8b6335aeec4befa68e4642a94026d0d',1,'PowerElement.h']]], ['fault_5fthreephase',['FAULT_THREEPHASE',['../_power_element_8h.html#a41a50717b1a7ef4caa3c499c164fc2cbac670e819e6d824b60cee62ca39ddc8d0',1,'PowerElement.h']]], ['faultdata',['FaultData',['../_power_element_8h.html#a41a50717b1a7ef4caa3c499c164fc2cb',1,'PowerElement.h']]], - ['filehanding',['FileHanding',['../class_file_handing.html',1,'']]] + ['filehanding',['FileHanding',['../class_file_handing.html',1,'']]], + ['filehanding_2eh',['FileHanding.h',['../_file_handing_8h.html',1,'']]] ]; diff --git a/docs/doxygen/html/search/all_6.js b/docs/doxygen/html/search/all_6.js index 449b5e6..623714a 100644 --- a/docs/doxygen/html/search/all_6.js +++ b/docs/doxygen/html/search/all_6.js @@ -1,13 +1,17 @@ var searchData= [ ['gain',['Gain',['../class_gain.html',1,'']]], + ['gain_2eh',['Gain.h',['../_gain_8h.html',1,'']]], ['gainform',['GainForm',['../class_gain_form.html',1,'']]], + ['gainform_2eh',['GainForm.h',['../_gain_form_8h.html',1,'']]], ['gainformbase',['GainFormBase',['../class_gain_form_base.html',1,'']]], ['generaldata',['GeneralData',['../struct_general_data.html',1,'']]], ['generalmenuitens',['GeneralMenuItens',['../class_element.html#a35f55626a29d5256f8dc07cf92655e64',1,'Element']]], ['generalpropertiesform',['GeneralPropertiesForm',['../class_general_properties_form.html',1,'']]], + ['generalpropertiesform_2eh',['GeneralPropertiesForm.h',['../_general_properties_form_8h.html',1,'']]], ['generalpropertiesformbase',['GeneralPropertiesFormBase',['../class_general_properties_form_base.html',1,'']]], ['generatorstabform',['GeneratorStabForm',['../class_generator_stab_form.html',1,'']]], + ['generatorstabform_2eh',['GeneratorStabForm.h',['../_generator_stab_form_8h.html',1,'']]], ['generatorstabformbase',['GeneratorStabFormBase',['../class_generator_stab_form_base.html',1,'']]], ['get',['get',['../classwx_g_l_string_array.html#a2ae0c1cffb2f54b66a170d1698ad62e0',1,'wxGLStringArray']]], ['getangle',['GetAngle',['../class_element.html#a5c75d8a6e28326dd568104a4d9d3473f',1,'Element']]], diff --git a/docs/doxygen/html/search/all_8.js b/docs/doxygen/html/search/all_8.js index 92d5ced..5f9cb01 100644 --- a/docs/doxygen/html/search/all_8.js +++ b/docs/doxygen/html/search/all_8.js @@ -16,6 +16,7 @@ var searchData= ['indmotor',['IndMotor',['../class_ind_motor.html',1,'']]], ['indmotorelectricaldata',['IndMotorElectricalData',['../struct_ind_motor_electrical_data.html',1,'']]], ['indmotorform',['IndMotorForm',['../class_ind_motor_form.html',1,'']]], + ['indmotorform_2eh',['IndMotorForm.h',['../_ind_motor_form_8h.html',1,'']]], ['indmotorformbase',['IndMotorFormBase',['../class_ind_motor_form_base.html',1,'']]], ['inductor',['Inductor',['../class_inductor.html',1,'']]], ['inductorelectricaldata',['InductorElectricalData',['../struct_inductor_electrical_data.html',1,'']]], @@ -24,7 +25,9 @@ var searchData= ['intfromstring',['IntFromString',['../class_element.html#a4c93a9e20ed0ca0c376cf412b4347159',1,'Element']]], ['invertmatrix',['InvertMatrix',['../class_electric_calculation.html#af00a6599f2b0b4e35bf0f8c70195447c',1,'ElectricCalculation']]], ['iocontrol',['IOControl',['../class_i_o_control.html',1,'']]], + ['iocontrol_2eh',['IOControl.h',['../_i_o_control_8h.html',1,'']]], ['iocontrolform',['IOControlForm',['../class_i_o_control_form.html',1,'']]], + ['iocontrolform_2eh',['IOControlForm.h',['../_i_o_control_form_8h.html',1,'']]], ['iocontrolformbase',['IOControlFormBase',['../class_i_o_control_form_base.html',1,'']]], ['isdragging',['IsDragging',['../class_element.html#a2f78fae8a5869ff53e87ecfdc6fc33b9',1,'Element']]], ['isonline',['IsOnline',['../class_element.html#a57c84a8e6eb80f0fea6e23cdd439d5aa',1,'Element']]], diff --git a/docs/doxygen/html/search/all_9.js b/docs/doxygen/html/search/all_9.js index f0ca242..e8f799e 100644 --- a/docs/doxygen/html/search/all_9.js +++ b/docs/doxygen/html/search/all_9.js @@ -1,14 +1,18 @@ var searchData= [ ['limiter',['Limiter',['../class_limiter.html',1,'']]], + ['limiter_2eh',['Limiter.h',['../_limiter_8h.html',1,'']]], ['limiterform',['LimiterForm',['../class_limiter_form.html',1,'']]], + ['limiterform_2eh',['LimiterForm.h',['../_limiter_form_8h.html',1,'']]], ['limiterformbase',['LimiterFormBase',['../class_limiter_form_base.html',1,'']]], ['line',['Line',['../class_line.html',1,'']]], ['lineelectricaldata',['LineElectricalData',['../struct_line_electrical_data.html',1,'']]], ['lineform',['LineForm',['../class_line_form.html',1,'']]], + ['lineform_2eh',['LineForm.h',['../_line_form_8h.html',1,'']]], ['lineformbase',['LineFormBase',['../class_line_form_base.html',1,'']]], ['load',['Load',['../class_load.html',1,'']]], ['loadelectricaldata',['LoadElectricalData',['../struct_load_electrical_data.html',1,'']]], ['loadform',['LoadForm',['../class_load_form.html',1,'']]], + ['loadform_2eh',['LoadForm.h',['../_load_form_8h.html',1,'']]], ['loadformbase',['LoadFormBase',['../class_load_form_base.html',1,'']]] ]; diff --git a/docs/doxygen/html/search/all_a.js b/docs/doxygen/html/search/all_a.js index 32e36d8..8f1137c 100644 --- a/docs/doxygen/html/search/all_a.js +++ b/docs/doxygen/html/search/all_a.js @@ -3,10 +3,12 @@ var searchData= ['m',['m',['../struct_integration_constant.html#adafabd0d37a52d4ed054a800cbce3d65',1,'IntegrationConstant']]], ['machines',['Machines',['../class_machines.html',1,'']]], ['mainapp',['MainApp',['../class_main_app.html',1,'']]], - ['mainframe',['MainFrame',['../class_main_frame.html',1,'']]], + ['mainframe',['MainFrame',['../class_main_frame.html',1,'MainFrame'],['../class_main_frame.html#a667b44053cae174a361cfd21124ef995',1,'MainFrame::MainFrame()'],['../class_main_frame.html#ac3288e93c5b8682863574bc47c9e9ff8',1,'MainFrame::MainFrame(wxWindow *parent, wxLocale *locale, PropertiesData *initProperties, wxString openPath="")']]], + ['mainframe_2eh',['MainFrame.h',['../_main_frame_8h.html',1,'']]], ['mainframebase',['MainFrameBase',['../class_main_frame_base.html',1,'']]], ['move',['Move',['../class_branch.html#a7cf4b117f43f49bb76cce3df5521fb70',1,'Branch::Move()'],['../class_connection_line.html#a49300d04c6dd4bcc6f4569c0c47780c7',1,'ConnectionLine::Move()'],['../class_control_element.html#ac8bd52ddb8eed51a217fecb2eed65708',1,'ControlElement::Move()'],['../class_element.html#abe884d99d12d5252e18956162115b025',1,'Element::Move()'],['../class_gain.html#aa303bcc736ac5fad1f89c6cc87e859db',1,'Gain::Move()'],['../class_line.html#a3eabf6de2af4ee71f72ce4f091c69978',1,'Line::Move()'],['../class_machines.html#a2f7450283dd36f4fc0847dfd50385c44',1,'Machines::Move()'],['../class_shunt.html#aa98b8a2f097fc02fee1ea874e19480f3',1,'Shunt::Move()'],['../class_transformer.html#a67f1e2686932700fe8a83fdc232ea1e8',1,'Transformer::Move()']]], ['movenode',['MoveNode',['../class_branch.html#aef2ffe79c9b239fb5a1ad175555a9f5a',1,'Branch::MoveNode()'],['../class_element.html#a870e266e0457bacbc3f7ef1fb70c6fdd',1,'Element::MoveNode()'],['../class_line.html#ac8be7d7136d86830c262280f51b79ea4',1,'Line::MoveNode()'],['../class_machines.html#aeab8436c33f74a10e252b418028ec491',1,'Machines::MoveNode()'],['../class_shunt.html#a23d2fed4e9b6a69bc4527b4345bd5bbd',1,'Shunt::MoveNode()'],['../class_transformer.html#a9652232a076cca0fe3753477ec88f63a',1,'Transformer::MoveNode()']]], ['movepickbox',['MovePickbox',['../class_branch.html#af7879ee138170b1421f745f1c942ea05',1,'Branch::MovePickbox()'],['../class_bus.html#ad569e2192bf95efe668d401583382a04',1,'Bus::MovePickbox()'],['../class_element.html#a6f071b6dfd64721ca673bfbe1ca2d525',1,'Element::MovePickbox()'],['../class_line.html#afa67498961416e645e0aa5358959ef1d',1,'Line::MovePickbox()']]], - ['multiplier',['Multiplier',['../class_multiplier.html',1,'']]] + ['multiplier',['Multiplier',['../class_multiplier.html',1,'']]], + ['multiplier_2eh',['Multiplier.h',['../_multiplier_8h.html',1,'']]] ]; diff --git a/docs/doxygen/html/search/all_e.js b/docs/doxygen/html/search/all_e.js index 7123aec..8fa9b09 100644 --- a/docs/doxygen/html/search/all_e.js +++ b/docs/doxygen/html/search/all_e.js @@ -1,10 +1,13 @@ var searchData= [ ['ratelimiter',['RateLimiter',['../class_rate_limiter.html',1,'']]], + ['ratelimiter_2eh',['RateLimiter.h',['../_rate_limiter_8h.html',1,'']]], ['ratelimiterform',['RateLimiterForm',['../class_rate_limiter_form.html',1,'']]], + ['ratelimiterform_2eh',['RateLimiterForm.h',['../_rate_limiter_form_8h.html',1,'']]], ['ratelimiterformbase',['RateLimiterFormBase',['../class_rate_limiter_form_base.html',1,'']]], ['reactivelimits',['ReactiveLimits',['../struct_reactive_limits.html',1,'']]], ['reactiveshuntelementform',['ReactiveShuntElementForm',['../class_reactive_shunt_element_form.html',1,'']]], + ['reactiveshuntelementform_2eh',['ReactiveShuntElementForm.h',['../_reactive_shunt_element_form_8h.html',1,'']]], ['reactiveshuntelementformbase',['ReactiveShuntElementFormBase',['../class_reactive_shunt_element_form_base.html',1,'']]], ['removechild',['RemoveChild',['../class_element.html#a6be881ba60674b289a91e498d3d8fc09',1,'Element']]], ['removeparent',['RemoveParent',['../class_branch.html#aa0328a743090b2b7b3f33d57a867b6dc',1,'Branch::RemoveParent()'],['../class_connection_line.html#a3f5584348b86e665161b033d4ce8d702',1,'ConnectionLine::RemoveParent()'],['../class_element.html#a9504437b60faf2c5a27584de8a24810c',1,'Element::RemoveParent()'],['../class_machines.html#a002d852ddd0d73502a6bd819b5545026',1,'Machines::RemoveParent()'],['../class_shunt.html#a665d9a8c291d427e666567c6df34321b',1,'Shunt::RemoveParent()']]], diff --git a/docs/doxygen/html/search/all_f.js b/docs/doxygen/html/search/all_f.js index 9ed2dd1..0084ece 100644 --- a/docs/doxygen/html/search/all_f.js +++ b/docs/doxygen/html/search/all_f.js @@ -24,18 +24,22 @@ var searchData= ['shunt',['Shunt',['../class_shunt.html',1,'']]], ['simulationdata',['SimulationData',['../struct_simulation_data.html',1,'']]], ['simulationssettingsform',['SimulationsSettingsForm',['../class_simulations_settings_form.html',1,'']]], + ['simulationssettingsform_2eh',['SimulationsSettingsForm.h',['../_simulations_settings_form_8h.html',1,'']]], ['simulationssettingsformbase',['SimulationsSettingsFormBase',['../class_simulations_settings_form_base.html',1,'']]], + ['solve',['Solve',['../class_rate_limiter.html#a2697e0f56b574739651fa2126b315e29',1,'RateLimiter']]], ['spacestate',['SpaceState',['../struct_transfer_function_1_1_space_state.html',1,'TransferFunction']]], ['startmove',['StartMove',['../class_branch.html#a947cec45fcdc78d01eaabe19d23daf64',1,'Branch::StartMove()'],['../class_connection_line.html#a292d284d6f30b209995c2a9877f9fe36',1,'ConnectionLine::StartMove()'],['../class_control_element.html#a61440a392d438de163bfe9ffb8e9efec',1,'ControlElement::StartMove()'],['../class_element.html#a846a2a51780a99363b4d4b1812ca16b4',1,'Element::StartMove()'],['../class_line.html#abb812387508a9971570bfa1d38e41041',1,'Line::StartMove()'],['../class_machines.html#acbefe76cd5161b5684a27205b155e797',1,'Machines::StartMove()'],['../class_shunt.html#a56d6136d647f64cf490dd9d7720f6865',1,'Shunt::StartMove()'],['../class_transformer.html#a0395a11dc8173e511a0596ac96bf05e5',1,'Transformer::StartMove()']]], ['stringfromdouble',['StringFromDouble',['../class_element.html#abb2e253ec1e86353cd7160209c96553c',1,'Element']]], ['sum',['Sum',['../class_sum.html',1,'']]], ['sumform',['SumForm',['../class_sum_form.html',1,'']]], + ['sumform_2eh',['SumForm.h',['../_sum_form_8h.html',1,'']]], ['sumformbase',['SumFormBase',['../class_sum_form_base.html',1,'']]], ['sw_5finsert',['SW_INSERT',['../_power_element_8h.html#ae98a0d9ac1aab1d3a057854f5ebdca1bafd08c03e8d1218eaa3c5e8f69bb98ea7',1,'PowerElement.h']]], ['sw_5fremove',['SW_REMOVE',['../_power_element_8h.html#ae98a0d9ac1aab1d3a057854f5ebdca1baa0c70909536e1b1a2f638e13a7f7b776',1,'PowerElement.h']]], ['switchescontains',['SwitchesContains',['../class_power_element.html#a789105cc7c170330e7daf2a0453fde6d',1,'PowerElement']]], ['switchingdata',['SwitchingData',['../struct_switching_data.html',1,'']]], ['switchingform',['SwitchingForm',['../class_switching_form.html',1,'']]], + ['switchingform_2eh',['SwitchingForm.h',['../_switching_form_8h.html',1,'']]], ['switchingformbase',['SwitchingFormBase',['../class_switching_form_base.html',1,'']]], ['switchingtype',['SwitchingType',['../_power_element_8h.html#ae98a0d9ac1aab1d3a057854f5ebdca1b',1,'PowerElement.h']]], ['swtime',['swTime',['../struct_switching_data.html#a3323745bf0a3f6461fbc19bc76a189df',1,'SwitchingData']]], @@ -43,7 +47,9 @@ var searchData= ['syncgenerator',['SyncGenerator',['../class_sync_generator.html',1,'']]], ['syncgeneratorelectricaldata',['SyncGeneratorElectricalData',['../struct_sync_generator_electrical_data.html',1,'']]], ['syncmachineform',['SyncMachineForm',['../class_sync_machine_form.html',1,'']]], + ['syncmachineform_2eh',['SyncMachineForm.h',['../_sync_machine_form_8h.html',1,'']]], ['syncmachineformbase',['SyncMachineFormBase',['../class_sync_machine_form_base.html',1,'']]], + ['syncmachinemodeldata',['SyncMachineModelData',['../struct_sync_machine_model_data.html',1,'']]], ['syncmotor',['SyncMotor',['../class_sync_motor.html',1,'']]], ['syncmotorelectricaldata',['SyncMotorElectricalData',['../struct_sync_motor_electrical_data.html',1,'']]] ]; diff --git a/docs/doxygen/html/search/classes_e.js b/docs/doxygen/html/search/classes_e.js index ba84663..3f9dd56 100644 --- a/docs/doxygen/html/search/classes_e.js +++ b/docs/doxygen/html/search/classes_e.js @@ -15,6 +15,7 @@ var searchData= ['syncgeneratorelectricaldata',['SyncGeneratorElectricalData',['../struct_sync_generator_electrical_data.html',1,'']]], ['syncmachineform',['SyncMachineForm',['../class_sync_machine_form.html',1,'']]], ['syncmachineformbase',['SyncMachineFormBase',['../class_sync_machine_form_base.html',1,'']]], + ['syncmachinemodeldata',['SyncMachineModelData',['../struct_sync_machine_model_data.html',1,'']]], ['syncmotor',['SyncMotor',['../class_sync_motor.html',1,'']]], ['syncmotorelectricaldata',['SyncMotorElectricalData',['../struct_sync_motor_electrical_data.html',1,'']]] ]; diff --git a/docs/doxygen/html/search/files_0.js b/docs/doxygen/html/search/files_0.js index 47a0ae7..1111caf 100644 --- a/docs/doxygen/html/search/files_0.js +++ b/docs/doxygen/html/search/files_0.js @@ -1,5 +1,4 @@ var searchData= [ - ['electriccalculation_2eh',['ElectricCalculation.h',['../_electric_calculation_8h.html',1,'']]], - ['element_2eh',['Element.h',['../_element_8h.html',1,'']]] + ['aboutform_2eh',['AboutForm.h',['../_about_form_8h.html',1,'']]] ]; diff --git a/docs/doxygen/html/search/files_1.js b/docs/doxygen/html/search/files_1.js index dc739ff..b0afef0 100644 --- a/docs/doxygen/html/search/files_1.js +++ b/docs/doxygen/html/search/files_1.js @@ -1,4 +1,4 @@ var searchData= [ - ['fault_2eh',['Fault.h',['../_fault_8h.html',1,'']]] + ['busform_2eh',['BusForm.h',['../_bus_form_8h.html',1,'']]] ]; diff --git a/docs/doxygen/html/search/files_2.js b/docs/doxygen/html/search/files_2.js index 00a21bf..2779e61 100644 --- a/docs/doxygen/html/search/files_2.js +++ b/docs/doxygen/html/search/files_2.js @@ -1,4 +1,13 @@ var searchData= [ - ['powerelement_2eh',['PowerElement.h',['../_power_element_8h.html',1,'']]] + ['camera_2eh',['Camera.h',['../_camera_8h.html',1,'']]], + ['chartview_2eh',['ChartView.h',['../_chart_view_8h.html',1,'']]], + ['connectionline_2eh',['ConnectionLine.h',['../_connection_line_8h.html',1,'']]], + ['constant_2eh',['Constant.h',['../_constant_8h.html',1,'']]], + ['constantform_2eh',['ConstantForm.h',['../_constant_form_8h.html',1,'']]], + ['controleditor_2eh',['ControlEditor.h',['../_control_editor_8h.html',1,'']]], + ['controlelement_2eh',['ControlElement.h',['../_control_element_8h.html',1,'']]], + ['controlelementcontainer_2eh',['ControlElementContainer.h',['../_control_element_container_8h.html',1,'']]], + ['controlelementsolver_2eh',['ControlElementSolver.h',['../_control_element_solver_8h.html',1,'']]], + ['controlsystemtest_2eh',['ControlSystemTest.h',['../_control_system_test_8h.html',1,'']]] ]; diff --git a/docs/doxygen/html/search/files_3.html b/docs/doxygen/html/search/files_3.html new file mode 100644 index 0000000..d5a9528 --- /dev/null +++ b/docs/doxygen/html/search/files_3.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/files_3.js b/docs/doxygen/html/search/files_3.js new file mode 100644 index 0000000..000db6c --- /dev/null +++ b/docs/doxygen/html/search/files_3.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['datareport_2eh',['DataReport.h',['../_data_report_8h.html',1,'']]] +]; diff --git a/docs/doxygen/html/search/files_4.html b/docs/doxygen/html/search/files_4.html new file mode 100644 index 0000000..7b4c42a --- /dev/null +++ b/docs/doxygen/html/search/files_4.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/files_4.js b/docs/doxygen/html/search/files_4.js new file mode 100644 index 0000000..fddb2d9 --- /dev/null +++ b/docs/doxygen/html/search/files_4.js @@ -0,0 +1,8 @@ +var searchData= +[ + ['electriccalculation_2eh',['ElectricCalculation.h',['../_electric_calculation_8h.html',1,'']]], + ['electromechanical_2eh',['Electromechanical.h',['../_electromechanical_8h.html',1,'']]], + ['element_2eh',['Element.h',['../_element_8h.html',1,'']]], + ['exponential_2eh',['Exponential.h',['../_exponential_8h.html',1,'']]], + ['exponentialform_2eh',['ExponentialForm.h',['../_exponential_form_8h.html',1,'']]] +]; diff --git a/docs/doxygen/html/search/files_5.html b/docs/doxygen/html/search/files_5.html new file mode 100644 index 0000000..1f77bb1 --- /dev/null +++ b/docs/doxygen/html/search/files_5.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/files_5.js b/docs/doxygen/html/search/files_5.js new file mode 100644 index 0000000..48d132c --- /dev/null +++ b/docs/doxygen/html/search/files_5.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['fault_2eh',['Fault.h',['../_fault_8h.html',1,'']]], + ['filehanding_2eh',['FileHanding.h',['../_file_handing_8h.html',1,'']]] +]; diff --git a/docs/doxygen/html/search/files_6.html b/docs/doxygen/html/search/files_6.html new file mode 100644 index 0000000..7573254 --- /dev/null +++ b/docs/doxygen/html/search/files_6.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/files_6.js b/docs/doxygen/html/search/files_6.js new file mode 100644 index 0000000..ca1c931 --- /dev/null +++ b/docs/doxygen/html/search/files_6.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['gain_2eh',['Gain.h',['../_gain_8h.html',1,'']]], + ['gainform_2eh',['GainForm.h',['../_gain_form_8h.html',1,'']]], + ['generalpropertiesform_2eh',['GeneralPropertiesForm.h',['../_general_properties_form_8h.html',1,'']]], + ['generatorstabform_2eh',['GeneratorStabForm.h',['../_generator_stab_form_8h.html',1,'']]] +]; diff --git a/docs/doxygen/html/search/files_7.html b/docs/doxygen/html/search/files_7.html new file mode 100644 index 0000000..214b329 --- /dev/null +++ b/docs/doxygen/html/search/files_7.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/files_7.js b/docs/doxygen/html/search/files_7.js new file mode 100644 index 0000000..dd12521 --- /dev/null +++ b/docs/doxygen/html/search/files_7.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['indmotorform_2eh',['IndMotorForm.h',['../_ind_motor_form_8h.html',1,'']]], + ['iocontrol_2eh',['IOControl.h',['../_i_o_control_8h.html',1,'']]], + ['iocontrolform_2eh',['IOControlForm.h',['../_i_o_control_form_8h.html',1,'']]] +]; diff --git a/docs/doxygen/html/search/files_8.html b/docs/doxygen/html/search/files_8.html new file mode 100644 index 0000000..6720c7c --- /dev/null +++ b/docs/doxygen/html/search/files_8.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/files_8.js b/docs/doxygen/html/search/files_8.js new file mode 100644 index 0000000..24534c5 --- /dev/null +++ b/docs/doxygen/html/search/files_8.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['limiter_2eh',['Limiter.h',['../_limiter_8h.html',1,'']]], + ['limiterform_2eh',['LimiterForm.h',['../_limiter_form_8h.html',1,'']]], + ['lineform_2eh',['LineForm.h',['../_line_form_8h.html',1,'']]], + ['loadform_2eh',['LoadForm.h',['../_load_form_8h.html',1,'']]] +]; diff --git a/docs/doxygen/html/search/files_9.html b/docs/doxygen/html/search/files_9.html new file mode 100644 index 0000000..fc95877 --- /dev/null +++ b/docs/doxygen/html/search/files_9.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/files_9.js b/docs/doxygen/html/search/files_9.js new file mode 100644 index 0000000..4722604 --- /dev/null +++ b/docs/doxygen/html/search/files_9.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['mainframe_2eh',['MainFrame.h',['../_main_frame_8h.html',1,'']]], + ['multiplier_2eh',['Multiplier.h',['../_multiplier_8h.html',1,'']]] +]; diff --git a/docs/doxygen/html/search/files_a.html b/docs/doxygen/html/search/files_a.html new file mode 100644 index 0000000..ffe3e9d --- /dev/null +++ b/docs/doxygen/html/search/files_a.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/files_a.js b/docs/doxygen/html/search/files_a.js new file mode 100644 index 0000000..00a21bf --- /dev/null +++ b/docs/doxygen/html/search/files_a.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['powerelement_2eh',['PowerElement.h',['../_power_element_8h.html',1,'']]] +]; diff --git a/docs/doxygen/html/search/files_b.html b/docs/doxygen/html/search/files_b.html new file mode 100644 index 0000000..32cd2be --- /dev/null +++ b/docs/doxygen/html/search/files_b.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/files_b.js b/docs/doxygen/html/search/files_b.js new file mode 100644 index 0000000..c7164b0 --- /dev/null +++ b/docs/doxygen/html/search/files_b.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['ratelimiter_2eh',['RateLimiter.h',['../_rate_limiter_8h.html',1,'']]], + ['ratelimiterform_2eh',['RateLimiterForm.h',['../_rate_limiter_form_8h.html',1,'']]], + ['reactiveshuntelementform_2eh',['ReactiveShuntElementForm.h',['../_reactive_shunt_element_form_8h.html',1,'']]] +]; diff --git a/docs/doxygen/html/search/files_c.html b/docs/doxygen/html/search/files_c.html new file mode 100644 index 0000000..bb83608 --- /dev/null +++ b/docs/doxygen/html/search/files_c.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/files_c.js b/docs/doxygen/html/search/files_c.js new file mode 100644 index 0000000..a248cb1 --- /dev/null +++ b/docs/doxygen/html/search/files_c.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['simulationssettingsform_2eh',['SimulationsSettingsForm.h',['../_simulations_settings_form_8h.html',1,'']]], + ['sumform_2eh',['SumForm.h',['../_sum_form_8h.html',1,'']]], + ['switchingform_2eh',['SwitchingForm.h',['../_switching_form_8h.html',1,'']]], + ['syncmachineform_2eh',['SyncMachineForm.h',['../_sync_machine_form_8h.html',1,'']]] +]; diff --git a/docs/doxygen/html/search/files_d.html b/docs/doxygen/html/search/files_d.html new file mode 100644 index 0000000..38bf2b3 --- /dev/null +++ b/docs/doxygen/html/search/files_d.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/files_d.js b/docs/doxygen/html/search/files_d.js new file mode 100644 index 0000000..6324938 --- /dev/null +++ b/docs/doxygen/html/search/files_d.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['textform_2eh',['TextForm.h',['../_text_form_8h.html',1,'']]], + ['transferfunctionform_2eh',['TransferFunctionForm.h',['../_transfer_function_form_8h.html',1,'']]], + ['transformerform_2eh',['TransformerForm.h',['../_transformer_form_8h.html',1,'']]] +]; diff --git a/docs/doxygen/html/search/files_e.html b/docs/doxygen/html/search/files_e.html new file mode 100644 index 0000000..6f84762 --- /dev/null +++ b/docs/doxygen/html/search/files_e.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/files_e.js b/docs/doxygen/html/search/files_e.js new file mode 100644 index 0000000..fa01c6a --- /dev/null +++ b/docs/doxygen/html/search/files_e.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['workspace_2eh',['Workspace.h',['../_workspace_8h.html',1,'']]] +]; diff --git a/docs/doxygen/html/search/functions_11.js b/docs/doxygen/html/search/functions_11.js index 91c4129..9783142 100644 --- a/docs/doxygen/html/search/functions_11.js +++ b/docs/doxygen/html/search/functions_11.js @@ -3,6 +3,7 @@ var searchData= ['_7eelectriccalculation',['~ElectricCalculation',['../class_electric_calculation.html#a1e70291bfa9a0850d9ffcbee44daa2f7',1,'ElectricCalculation']]], ['_7eelement',['~Element',['../class_element.html#a13d54ba9c08b6bec651402f1c2bb002c',1,'Element']]], ['_7efault',['~Fault',['../class_fault.html#a42019654142cd8187b314e43d70262eb',1,'Fault']]], + ['_7emainframe',['~MainFrame',['../class_main_frame.html#a0cfd88ece4836e0ea5430bd55370bf11',1,'MainFrame']]], ['_7eopenglcolour',['~OpenGLColour',['../class_open_g_l_colour.html#a4b9a726773b4c82935f15add648ed2a0',1,'OpenGLColour']]], ['_7epowerelement',['~PowerElement',['../class_power_element.html#a39be7c8e3bdb96b16c26ea7f7d6e6cbf',1,'PowerElement']]] ]; diff --git a/docs/doxygen/html/search/functions_9.js b/docs/doxygen/html/search/functions_9.js index aa08d12..1b13503 100644 --- a/docs/doxygen/html/search/functions_9.js +++ b/docs/doxygen/html/search/functions_9.js @@ -1,5 +1,6 @@ var searchData= [ + ['mainframe',['MainFrame',['../class_main_frame.html#a667b44053cae174a361cfd21124ef995',1,'MainFrame::MainFrame()'],['../class_main_frame.html#ac3288e93c5b8682863574bc47c9e9ff8',1,'MainFrame::MainFrame(wxWindow *parent, wxLocale *locale, PropertiesData *initProperties, wxString openPath="")']]], ['move',['Move',['../class_branch.html#a7cf4b117f43f49bb76cce3df5521fb70',1,'Branch::Move()'],['../class_connection_line.html#a49300d04c6dd4bcc6f4569c0c47780c7',1,'ConnectionLine::Move()'],['../class_control_element.html#ac8bd52ddb8eed51a217fecb2eed65708',1,'ControlElement::Move()'],['../class_element.html#abe884d99d12d5252e18956162115b025',1,'Element::Move()'],['../class_gain.html#aa303bcc736ac5fad1f89c6cc87e859db',1,'Gain::Move()'],['../class_line.html#a3eabf6de2af4ee71f72ce4f091c69978',1,'Line::Move()'],['../class_machines.html#a2f7450283dd36f4fc0847dfd50385c44',1,'Machines::Move()'],['../class_shunt.html#aa98b8a2f097fc02fee1ea874e19480f3',1,'Shunt::Move()'],['../class_transformer.html#a67f1e2686932700fe8a83fdc232ea1e8',1,'Transformer::Move()']]], ['movenode',['MoveNode',['../class_branch.html#aef2ffe79c9b239fb5a1ad175555a9f5a',1,'Branch::MoveNode()'],['../class_element.html#a870e266e0457bacbc3f7ef1fb70c6fdd',1,'Element::MoveNode()'],['../class_line.html#ac8be7d7136d86830c262280f51b79ea4',1,'Line::MoveNode()'],['../class_machines.html#aeab8436c33f74a10e252b418028ec491',1,'Machines::MoveNode()'],['../class_shunt.html#a23d2fed4e9b6a69bc4527b4345bd5bbd',1,'Shunt::MoveNode()'],['../class_transformer.html#a9652232a076cca0fe3753477ec88f63a',1,'Transformer::MoveNode()']]], ['movepickbox',['MovePickbox',['../class_branch.html#af7879ee138170b1421f745f1c942ea05',1,'Branch::MovePickbox()'],['../class_bus.html#ad569e2192bf95efe668d401583382a04',1,'Bus::MovePickbox()'],['../class_element.html#a6f071b6dfd64721ca673bfbe1ca2d525',1,'Element::MovePickbox()'],['../class_line.html#afa67498961416e645e0aa5358959ef1d',1,'Line::MovePickbox()']]] diff --git a/docs/doxygen/html/search/functions_e.js b/docs/doxygen/html/search/functions_e.js index c3bdfae..acf8b7a 100644 --- a/docs/doxygen/html/search/functions_e.js +++ b/docs/doxygen/html/search/functions_e.js @@ -21,6 +21,7 @@ var searchData= ['setwidth',['SetWidth',['../class_element.html#a5da121470a0c26c6b5c57a7c4eeac48b',1,'Element']]], ['showform',['ShowForm',['../class_bus.html#a93dbd8f80b11123395093f561d5241d0',1,'Bus::ShowForm()'],['../class_capacitor.html#a459b1bbdb153bb9720176661e2960ea6',1,'Capacitor::ShowForm()'],['../class_constant.html#af6bded0e01717303bb71da9e45c2b061',1,'Constant::ShowForm()'],['../class_element.html#ae1652eded3ccbd241a783691117418b2',1,'Element::ShowForm()'],['../class_exponential.html#abdf1c3c1d8e7839fc2a8fc914acff68d',1,'Exponential::ShowForm()'],['../class_gain.html#a6b98027cbf545302867ad75f7ab84b93',1,'Gain::ShowForm()'],['../class_ind_motor.html#add48c9a03d197a6279ca2e33af0fe286',1,'IndMotor::ShowForm()'],['../class_inductor.html#abfaf28fc70a71f3f85940eef7d1551c9',1,'Inductor::ShowForm()'],['../class_i_o_control.html#abbd3054700825f9c4ac1b7c813f7b439',1,'IOControl::ShowForm()'],['../class_limiter.html#a31fd227e010e7d39f1435a70709b14e3',1,'Limiter::ShowForm()'],['../class_line.html#a24c6a659148f063c78e080a18f4517a1',1,'Line::ShowForm()'],['../class_load.html#a792367f35c97324328816fee156e5ecf',1,'Load::ShowForm()'],['../class_multiplier.html#a4fa1206b47c626930db753a70e01680d',1,'Multiplier::ShowForm()'],['../class_rate_limiter.html#a7d16df402b56e0025bab076aa071be60',1,'RateLimiter::ShowForm()'],['../class_sum.html#a8c4bfb1dc965d8ac246de59d1f10888b',1,'Sum::ShowForm()'],['../class_sync_generator.html#a4a9dd07d901f26cc8304399fe241afec',1,'SyncGenerator::ShowForm()'],['../class_sync_motor.html#a3201b22e0271517f5ed3df85da6cee6f',1,'SyncMotor::ShowForm()'],['../class_transfer_function.html#afe15de93ab4f93032560a6139091ef10',1,'TransferFunction::ShowForm()'],['../class_transformer.html#acb55f182a7f6d7af0feb6a94cb62af4f',1,'Transformer::ShowForm()']]], ['showpickbox',['ShowPickbox',['../class_element.html#ab8bf35b4a205fa58772402cea7fad89c',1,'Element']]], + ['solve',['Solve',['../class_rate_limiter.html#a2697e0f56b574739651fa2126b315e29',1,'RateLimiter']]], ['startmove',['StartMove',['../class_branch.html#a947cec45fcdc78d01eaabe19d23daf64',1,'Branch::StartMove()'],['../class_connection_line.html#a292d284d6f30b209995c2a9877f9fe36',1,'ConnectionLine::StartMove()'],['../class_control_element.html#a61440a392d438de163bfe9ffb8e9efec',1,'ControlElement::StartMove()'],['../class_element.html#a846a2a51780a99363b4d4b1812ca16b4',1,'Element::StartMove()'],['../class_line.html#abb812387508a9971570bfa1d38e41041',1,'Line::StartMove()'],['../class_machines.html#acbefe76cd5161b5684a27205b155e797',1,'Machines::StartMove()'],['../class_shunt.html#a56d6136d647f64cf490dd9d7720f6865',1,'Shunt::StartMove()'],['../class_transformer.html#a0395a11dc8173e511a0596ac96bf05e5',1,'Transformer::StartMove()']]], ['stringfromdouble',['StringFromDouble',['../class_element.html#abb2e253ec1e86353cd7160209c96553c',1,'Element']]], ['switchescontains',['SwitchesContains',['../class_power_element.html#a789105cc7c170330e7daf2a0453fde6d',1,'PowerElement']]] diff --git a/docs/doxygen/html/search/searchdata.js b/docs/doxygen/html/search/searchdata.js index 3b1b25b..f3691ff 100644 --- a/docs/doxygen/html/search/searchdata.js +++ b/docs/doxygen/html/search/searchdata.js @@ -1,10 +1,10 @@ var indexSectionsWithContent = { - 0: "abcdefghilmnoprstuw~", + 0: "abcdefghilmnoprstuwx~", 1: "abcdefgilmnoprstw", - 2: "efp", + 2: "abcdefgilmprstw", 3: "abcdefghimnoprsuw~", - 4: "cms", + 4: "cemsx", 5: "cefps", 6: "fipsu", 7: "p" diff --git a/docs/doxygen/html/search/variables_1.js b/docs/doxygen/html/search/variables_1.js index 51cdb68..94a4e17 100644 --- a/docs/doxygen/html/search/variables_1.js +++ b/docs/doxygen/html/search/variables_1.js @@ -1,4 +1,5 @@ var searchData= [ - ['m',['m',['../struct_integration_constant.html#adafabd0d37a52d4ed054a800cbce3d65',1,'IntegrationConstant']]] + ['ed',['ed',['../struct_sync_machine_model_data.html#ad2bda1ac696b664571e33f657f4a81b6',1,'SyncMachineModelData']]], + ['eq',['eq',['../struct_sync_machine_model_data.html#a810b9e3250ebb8f3d4176f6e5a2b1076',1,'SyncMachineModelData']]] ]; diff --git a/docs/doxygen/html/search/variables_2.js b/docs/doxygen/html/search/variables_2.js index 29e91ca..51cdb68 100644 --- a/docs/doxygen/html/search/variables_2.js +++ b/docs/doxygen/html/search/variables_2.js @@ -1,5 +1,4 @@ var searchData= [ - ['swtime',['swTime',['../struct_switching_data.html#a3323745bf0a3f6461fbc19bc76a189df',1,'SwitchingData']]], - ['swtype',['swType',['../struct_switching_data.html#af78fb958137a0532ea2a584810708574',1,'SwitchingData']]] + ['m',['m',['../struct_integration_constant.html#adafabd0d37a52d4ed054a800cbce3d65',1,'IntegrationConstant']]] ]; diff --git a/docs/doxygen/html/search/variables_3.html b/docs/doxygen/html/search/variables_3.html new file mode 100644 index 0000000..f95e34c --- /dev/null +++ b/docs/doxygen/html/search/variables_3.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/variables_3.js b/docs/doxygen/html/search/variables_3.js new file mode 100644 index 0000000..29e91ca --- /dev/null +++ b/docs/doxygen/html/search/variables_3.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['swtime',['swTime',['../struct_switching_data.html#a3323745bf0a3f6461fbc19bc76a189df',1,'SwitchingData']]], + ['swtype',['swType',['../struct_switching_data.html#af78fb958137a0532ea2a584810708574',1,'SwitchingData']]] +]; diff --git a/docs/doxygen/html/search/variables_4.html b/docs/doxygen/html/search/variables_4.html new file mode 100644 index 0000000..d7db285 --- /dev/null +++ b/docs/doxygen/html/search/variables_4.html @@ -0,0 +1,26 @@ + + + + + + + + + +
          +
          Loading...
          +
          + +
          Searching...
          +
          No Matches
          + +
          + + diff --git a/docs/doxygen/html/search/variables_4.js b/docs/doxygen/html/search/variables_4.js new file mode 100644 index 0000000..890e89e --- /dev/null +++ b/docs/doxygen/html/search/variables_4.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['xd',['xd',['../struct_sync_machine_model_data.html#af75546805bf92eb7a8a7280f7964b330',1,'SyncMachineModelData']]], + ['xq',['xq',['../struct_sync_machine_model_data.html#af81596945918e86e56f5822a0ba97fbc',1,'SyncMachineModelData']]] +]; diff --git a/docs/doxygen/html/struct_bus_electrical_data-members.html b/docs/doxygen/html/struct_bus_electrical_data-members.html index 2bba844..766f301 100644 --- a/docs/doxygen/html/struct_bus_electrical_data-members.html +++ b/docs/doxygen/html/struct_bus_electrical_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_bus_electrical_data.html b/docs/doxygen/html/struct_bus_electrical_data.html index 2a0a984..a3b2417 100644 --- a/docs/doxygen/html/struct_bus_electrical_data.html +++ b/docs/doxygen/html/struct_bus_electrical_data.html @@ -21,6 +21,12 @@ + @@ -167,7 +173,7 @@ std::vector< std::complex< double > > 

          Detailed Description

          -

          Definition at line 7 of file Bus.h.

          +

          Definition at line 24 of file Bus.h.

          Member Data Documentation

          ◆ faultCurrent

          @@ -181,7 +187,7 @@ std::vector< std::complex< double > >  Initial value:
          = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
          std::complex<double>(0.0, 0.0)}
          -

          Definition at line 29 of file Bus.h.

          +

          Definition at line 46 of file Bus.h.

          @@ -197,7 +203,7 @@ std::vector< std::complex< double > >  Initial value:
          = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
          std::complex<double>(0.0, 0.0)}
          -

          Definition at line 31 of file Bus.h.

          +

          Definition at line 48 of file Bus.h.

          diff --git a/docs/doxygen/html/struct_capacitor_electrical_data-members.html b/docs/doxygen/html/struct_capacitor_electrical_data-members.html index 50f6760..a590102 100644 --- a/docs/doxygen/html/struct_capacitor_electrical_data-members.html +++ b/docs/doxygen/html/struct_capacitor_electrical_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_capacitor_electrical_data.html b/docs/doxygen/html/struct_capacitor_electrical_data.html index e5665ee..c477257 100644 --- a/docs/doxygen/html/struct_capacitor_electrical_data.html +++ b/docs/doxygen/html/struct_capacitor_electrical_data.html @@ -21,6 +21,12 @@ + @@ -100,7 +106,7 @@ double reactivePower =

          Detailed Description

          -

          Definition at line 8 of file Capacitor.h.

          +

          Definition at line 25 of file Capacitor.h.


          The documentation for this struct was generated from the following file: diff --git a/docs/doxygen/html/struct_elements_lists-members.html b/docs/doxygen/html/struct_elements_lists-members.html index ca0a133..27284b3 100644 --- a/docs/doxygen/html/struct_elements_lists-members.html +++ b/docs/doxygen/html/struct_elements_lists-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_elements_lists.html b/docs/doxygen/html/struct_elements_lists.html index e8241c0..ea962ec 100644 --- a/docs/doxygen/html/struct_elements_lists.html +++ b/docs/doxygen/html/struct_elements_lists.html @@ -21,6 +21,12 @@ + @@ -97,7 +103,7 @@ std::vector< Bus * > 

          Detailed Description

          -

          Definition at line 7 of file ElementDataObject.h.

          +

          Definition at line 24 of file ElementDataObject.h.


          The documentation for this struct was generated from the following file: diff --git a/docs/doxygen/html/struct_general_data-members.html b/docs/doxygen/html/struct_general_data-members.html index afbfc23..b4478e3 100644 --- a/docs/doxygen/html/struct_general_data-members.html +++ b/docs/doxygen/html/struct_general_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_general_data.html b/docs/doxygen/html/struct_general_data.html index 46e0ada..eeed094 100644 --- a/docs/doxygen/html/struct_general_data.html +++ b/docs/doxygen/html/struct_general_data.html @@ -21,6 +21,12 @@ + @@ -97,7 +103,7 @@ GUITheme theme = THEME

          Detailed Description

          -

          Definition at line 35 of file PropertiesData.h.

          +

          Definition at line 52 of file PropertiesData.h.


          The documentation for this struct was generated from the following file: diff --git a/docs/doxygen/html/struct_ind_motor_electrical_data-members.html b/docs/doxygen/html/struct_ind_motor_electrical_data-members.html index ee08501..c2d0874 100644 --- a/docs/doxygen/html/struct_ind_motor_electrical_data-members.html +++ b/docs/doxygen/html/struct_ind_motor_electrical_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_ind_motor_electrical_data.html b/docs/doxygen/html/struct_ind_motor_electrical_data.html index 8fc36d7..8986f32 100644 --- a/docs/doxygen/html/struct_ind_motor_electrical_data.html +++ b/docs/doxygen/html/struct_ind_motor_electrical_data.html @@ -21,6 +21,12 @@ + @@ -106,7 +112,7 @@ double reactivePower =

          Detailed Description

          -

          Definition at line 8 of file IndMotor.h.

          +

          Definition at line 25 of file IndMotor.h.


          The documentation for this struct was generated from the following file: diff --git a/docs/doxygen/html/struct_inductor_electrical_data-members.html b/docs/doxygen/html/struct_inductor_electrical_data-members.html index d654a19..30499cd 100644 --- a/docs/doxygen/html/struct_inductor_electrical_data-members.html +++ b/docs/doxygen/html/struct_inductor_electrical_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_inductor_electrical_data.html b/docs/doxygen/html/struct_inductor_electrical_data.html index b7856e6..82acfff 100644 --- a/docs/doxygen/html/struct_inductor_electrical_data.html +++ b/docs/doxygen/html/struct_inductor_electrical_data.html @@ -21,6 +21,12 @@ + @@ -100,7 +106,7 @@ double reactivePower =

          Detailed Description

          -

          Definition at line 8 of file Inductor.h.

          +

          Definition at line 25 of file Inductor.h.


          The documentation for this struct was generated from the following file: diff --git a/docs/doxygen/html/struct_integration_constant-members.html b/docs/doxygen/html/struct_integration_constant-members.html index df4fd6f..9aa8eb7 100644 --- a/docs/doxygen/html/struct_integration_constant-members.html +++ b/docs/doxygen/html/struct_integration_constant-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_integration_constant.html b/docs/doxygen/html/struct_integration_constant.html index 0b7d0e2..1974f0b 100644 --- a/docs/doxygen/html/struct_integration_constant.html +++ b/docs/doxygen/html/struct_integration_constant.html @@ -21,6 +21,12 @@ + @@ -99,7 +105,7 @@ Public Attributes
          Author
          Thales Lima Oliveira
          Date
          24/05/2017
          -

          Definition at line 88 of file PowerElement.h.

          +

          Definition at line 105 of file PowerElement.h.

          Member Data Documentation

          ◆ c

          @@ -114,7 +120,7 @@ Public Attributes

          C value

          -

          Definition at line 89 of file PowerElement.h.

          +

          Definition at line 106 of file PowerElement.h.

          @@ -131,7 +137,7 @@ Public Attributes

          M value

          -

          Definition at line 90 of file PowerElement.h.

          +

          Definition at line 107 of file PowerElement.h.

          diff --git a/docs/doxygen/html/struct_line_electrical_data-members.html b/docs/doxygen/html/struct_line_electrical_data-members.html index 085cf66..455a58e 100644 --- a/docs/doxygen/html/struct_line_electrical_data-members.html +++ b/docs/doxygen/html/struct_line_electrical_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_line_electrical_data.html b/docs/doxygen/html/struct_line_electrical_data.html index da0f98e..945b056 100644 --- a/docs/doxygen/html/struct_line_electrical_data.html +++ b/docs/doxygen/html/struct_line_electrical_data.html @@ -21,6 +21,12 @@ + @@ -148,7 +154,7 @@ std::complex< double > 

          Detailed Description

          -

          Definition at line 7 of file Line.h.

          +

          Definition at line 24 of file Line.h.


          The documentation for this struct was generated from the following file: diff --git a/docs/doxygen/html/struct_load_electrical_data-members.html b/docs/doxygen/html/struct_load_electrical_data-members.html index ed287c6..51d64a1 100644 --- a/docs/doxygen/html/struct_load_electrical_data-members.html +++ b/docs/doxygen/html/struct_load_electrical_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_load_electrical_data.html b/docs/doxygen/html/struct_load_electrical_data.html index d26161a..94a51b4 100644 --- a/docs/doxygen/html/struct_load_electrical_data.html +++ b/docs/doxygen/html/struct_load_electrical_data.html @@ -21,6 +21,12 @@ + @@ -109,7 +115,7 @@ LoadType loadType = CO

          Detailed Description

          -

          Definition at line 13 of file Load.h.

          +

          Definition at line 26 of file Load.h.


          The documentation for this struct was generated from the following file: diff --git a/docs/doxygen/html/struct_reactive_limits-members.html b/docs/doxygen/html/struct_reactive_limits-members.html index 8dfb4c9..84f1b0e 100644 --- a/docs/doxygen/html/struct_reactive_limits-members.html +++ b/docs/doxygen/html/struct_reactive_limits-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_reactive_limits.html b/docs/doxygen/html/struct_reactive_limits.html index 6ed9284..896e17f 100644 --- a/docs/doxygen/html/struct_reactive_limits.html +++ b/docs/doxygen/html/struct_reactive_limits.html @@ -21,6 +21,12 @@ + @@ -106,7 +112,7 @@ ReactiveLimitsType limitRe

          Detailed Description

          -

          Definition at line 34 of file ElectricCalculation.h.

          +

          Definition at line 51 of file ElectricCalculation.h.


          The documentation for this struct was generated from the following file: diff --git a/docs/doxygen/html/struct_simulation_data-members.html b/docs/doxygen/html/struct_simulation_data-members.html index 8b95abd..f6fc800 100644 --- a/docs/doxygen/html/struct_simulation_data-members.html +++ b/docs/doxygen/html/struct_simulation_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_simulation_data.html b/docs/doxygen/html/struct_simulation_data.html index 1e95c3e..934f897 100644 --- a/docs/doxygen/html/struct_simulation_data.html +++ b/docs/doxygen/html/struct_simulation_data.html @@ -21,6 +21,12 @@ + @@ -139,7 +145,7 @@ bool useCOI = true

          Detailed Description

          -

          Definition at line 11 of file PropertiesData.h.

          +

          Definition at line 28 of file PropertiesData.h.


          The documentation for this struct was generated from the following file: diff --git a/docs/doxygen/html/struct_switching_data-members.html b/docs/doxygen/html/struct_switching_data-members.html index 6644eae..1e2b624 100644 --- a/docs/doxygen/html/struct_switching_data-members.html +++ b/docs/doxygen/html/struct_switching_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_switching_data.html b/docs/doxygen/html/struct_switching_data.html index faba3f6..9d82a97 100644 --- a/docs/doxygen/html/struct_switching_data.html +++ b/docs/doxygen/html/struct_switching_data.html @@ -21,6 +21,12 @@ + @@ -99,7 +105,7 @@ Public Attributes
          Author
          Thales Lima Oliveira
          Date
          18/01/2017
          -

          Definition at line 76 of file PowerElement.h.

          +

          Definition at line 93 of file PowerElement.h.

          Member Data Documentation

          ◆ swTime

          @@ -114,7 +120,7 @@ Public Attributes

          Time of switching

          -

          Definition at line 78 of file PowerElement.h.

          +

          Definition at line 95 of file PowerElement.h.

          @@ -131,7 +137,7 @@ Public Attributes

          Type of switching

          -

          Definition at line 77 of file PowerElement.h.

          +

          Definition at line 94 of file PowerElement.h.

          diff --git a/docs/doxygen/html/struct_sync_generator_electrical_data-members.html b/docs/doxygen/html/struct_sync_generator_electrical_data-members.html index b9a55df..85adf6d 100644 --- a/docs/doxygen/html/struct_sync_generator_electrical_data-members.html +++ b/docs/doxygen/html/struct_sync_generator_electrical_data-members.html @@ -21,6 +21,12 @@ + @@ -110,8 +116,10 @@ $(document).ready(function(){initNavTree('struct_sync_generator_electrical_data. icSubEq (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData icTranEd (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData icTranEq (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData - inertia (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData - initialFieldVoltage (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData + id (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData + inertia (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData + initialFieldVoltage (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData + iq (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData maxReactive (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData maxReactiveUnit (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData mechanicalPowerVector (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData @@ -128,6 +136,8 @@ $(document).ready(function(){initNavTree('struct_sync_generator_electrical_data. oldId (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData oldIq (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData oldPe (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData + oldSd (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData + oldSq (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData pe (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData plotSyncMachine (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData pm (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData @@ -137,9 +147,11 @@ $(document).ready(function(){initNavTree('struct_sync_generator_electrical_data. reactivePower (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData reactivePowerUnit (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData satFactor (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData - speed (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData - speedGov (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData - speedGovSolver (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData + sd (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData + speed (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData + speedGov (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData + speedGovSolver (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData + sq (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData subEd (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData subEq (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData subTd0 (defined in SyncGeneratorElectricalData)SyncGeneratorElectricalData diff --git a/docs/doxygen/html/struct_sync_generator_electrical_data.html b/docs/doxygen/html/struct_sync_generator_electrical_data.html index b9e1484..18b2b3f 100644 --- a/docs/doxygen/html/struct_sync_generator_electrical_data.html +++ b/docs/doxygen/html/struct_sync_generator_electrical_data.html @@ -21,6 +21,12 @@ + @@ -273,6 +279,18 @@ double subEd double pe   + +double id +  + +double iq +  + +double sd +  + +double sq double oldId   @@ -282,6 +300,12 @@ double oldIq double oldPe   + +double oldSd +  + +double oldSq IntegrationConstant icSpeed   @@ -318,7 +342,7 @@ Machines::SyncMachineModel 

          Detailed Description

          -

          Definition at line 8 of file SyncGenerator.h.

          +

          Definition at line 25 of file SyncGenerator.h.

          Member Data Documentation

          ◆ faultCurrent

          @@ -332,7 +356,7 @@ Machines::SyncMachineModel 
          Initial value:
          = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
          std::complex<double>(0.0, 0.0)}
          -

          Definition at line 38 of file SyncGenerator.h.

          +

          Definition at line 55 of file SyncGenerator.h.

          diff --git a/docs/doxygen/html/struct_sync_generator_electrical_data.js b/docs/doxygen/html/struct_sync_generator_electrical_data.js index 6427da8..90c661c 100644 --- a/docs/doxygen/html/struct_sync_generator_electrical_data.js +++ b/docs/doxygen/html/struct_sync_generator_electrical_data.js @@ -25,8 +25,10 @@ var struct_sync_generator_electrical_data = [ "icSubEq", "struct_sync_generator_electrical_data.html#a1a1224d8d980c1aa408acd0c731e73c1", null ], [ "icTranEd", "struct_sync_generator_electrical_data.html#a9a534e4c50aba0e6a2cc6b5dbc2d2c03", null ], [ "icTranEq", "struct_sync_generator_electrical_data.html#a599699b6b55ca35dfec13f0a1d58dc37", null ], + [ "id", "struct_sync_generator_electrical_data.html#a1d80742377fac4d719085c967d831608", null ], [ "inertia", "struct_sync_generator_electrical_data.html#abec98d3227f7c93d1caf05c3a885b097", null ], [ "initialFieldVoltage", "struct_sync_generator_electrical_data.html#a452fd337c002c0872ee2f22f8eefeb14", null ], + [ "iq", "struct_sync_generator_electrical_data.html#ae06d59efebe1956a310dbc43e4780abe", null ], [ "maxReactive", "struct_sync_generator_electrical_data.html#adffc8e7c793c2f23dfd5b573a14aba24", null ], [ "maxReactiveUnit", "struct_sync_generator_electrical_data.html#a2a21d204b68e1896bd2aae87ef9e6ec3", null ], [ "mechanicalPowerVector", "struct_sync_generator_electrical_data.html#a58d893dcf9933cf73be0bb12d3472ac6", null ], @@ -43,6 +45,8 @@ var struct_sync_generator_electrical_data = [ "oldId", "struct_sync_generator_electrical_data.html#ad6cc9505241ac17f3ab1f6011aace0b8", null ], [ "oldIq", "struct_sync_generator_electrical_data.html#a124840d7c73161bb4187aa5215969647", null ], [ "oldPe", "struct_sync_generator_electrical_data.html#ad5935c784af5f03f7c9cdba7df88f1de", null ], + [ "oldSd", "struct_sync_generator_electrical_data.html#a750898c7ac2b2612a3db657d5459626d", null ], + [ "oldSq", "struct_sync_generator_electrical_data.html#a96752298c088dea20ecc690644ea3a86", null ], [ "pe", "struct_sync_generator_electrical_data.html#ade7d762b92727bcc58821d3bf9a743ca", null ], [ "plotSyncMachine", "struct_sync_generator_electrical_data.html#abb4e828c8091dd69e2535d72b51fc6e7", null ], [ "pm", "struct_sync_generator_electrical_data.html#a53edeaeb3361da40e3939bfffa401e6c", null ], @@ -52,9 +56,11 @@ var struct_sync_generator_electrical_data = [ "reactivePower", "struct_sync_generator_electrical_data.html#a82bc75dc1c81776dc2998803e0f62890", null ], [ "reactivePowerUnit", "struct_sync_generator_electrical_data.html#a787696951a05eb8000c0495b018246e4", null ], [ "satFactor", "struct_sync_generator_electrical_data.html#ac53d1a5127d7dcd5f8b94d2ca0cae4b7", null ], + [ "sd", "struct_sync_generator_electrical_data.html#a8827b25efb3bb80e511412fcf2e63f42", null ], [ "speed", "struct_sync_generator_electrical_data.html#a5bfbef7dc02c36f5673ebd6c25f9a7a9", null ], [ "speedGov", "struct_sync_generator_electrical_data.html#a1c21e18774280d7dc7378e39eeba04ff", null ], [ "speedGovSolver", "struct_sync_generator_electrical_data.html#a7c4224d05447c55c895fe164d09e0a8c", null ], + [ "sq", "struct_sync_generator_electrical_data.html#af4177bcbee0f968986860e9294f70129", null ], [ "subEd", "struct_sync_generator_electrical_data.html#a64003e1947c801662450bb04723e1696", null ], [ "subEq", "struct_sync_generator_electrical_data.html#ab4c9a79a39406b6e744ab4fb92e94750", null ], [ "subTd0", "struct_sync_generator_electrical_data.html#a73b9df7db4f2d984fb5f976003122131", null ], diff --git a/docs/doxygen/html/struct_sync_machine_model_data-members.html b/docs/doxygen/html/struct_sync_machine_model_data-members.html new file mode 100644 index 0000000..1db2862 --- /dev/null +++ b/docs/doxygen/html/struct_sync_machine_model_data-members.html @@ -0,0 +1,109 @@ + + + + + + + + + +Member List + + + + + + + + + + + + + + + +
          +
          + + + + + + +
          +
          + + + + + + + +
          +
          + +
          +
          +
          + +
          + +
          +
          + + +
          + +
          + +
          +
          +
          SyncMachineModelData Member List
          +
          +
          + +

          This is the complete list of members for SyncMachineModelData, including all inherited members.

          + + + + + +
          edSyncMachineModelData
          eqSyncMachineModelData
          xdSyncMachineModelData
          xqSyncMachineModelData
          +
          + + + + diff --git a/docs/doxygen/html/struct_sync_machine_model_data.html b/docs/doxygen/html/struct_sync_machine_model_data.html new file mode 100644 index 0000000..83caf36 --- /dev/null +++ b/docs/doxygen/html/struct_sync_machine_model_data.html @@ -0,0 +1,200 @@ + + + + + + + + + +SyncMachineModelData Struct Reference + + + + + + + + + + + + + + + +
          +
          + + + + + + +
          +
          + + + + + + + +
          +
          + +
          +
          +
          + +
          + +
          +
          + + +
          + +
          + +
          + +
          +
          SyncMachineModelData Struct Reference
          +
          +
          + +

          Synchronous machine data for different models. + More...

          + +

          #include <Electromechanical.h>

          + + + + + + + + + + +

          +Public Attributes

          double xd
           
          double xq
           
          double ed
           
          double eq
           
          +

          Detailed Description

          +

          Synchronous machine data for different models.

          +

          This struct have the parameters and calculated data that depends on each machine model.

          + +

          Definition at line 33 of file Electromechanical.h.

          +

          Member Data Documentation

          + +

          ◆ ed

          + +
          +
          + + + + +
          double SyncMachineModelData::ed
          +
          +

          Direct-axis internal voltage (transient for models 1, 2 and 3; subtransient for models 4 and 5)

          + +

          Definition at line 39 of file Electromechanical.h.

          + +
          +
          + +

          ◆ eq

          + +
          +
          + + + + +
          double SyncMachineModelData::eq
          +
          +

          Quadrature-axis internal voltage (transient for models 1, 2 and 3; subtransient for models 4 and 5)

          + +

          Definition at line 41 of file Electromechanical.h.

          + +
          +
          + +

          ◆ xd

          + +
          +
          + + + + +
          double SyncMachineModelData::xd
          +
          +

          Direct-axis reactance (transient for models 1, 2 and 3; subtransient for models 4 and 5)

          + +

          Definition at line 35 of file Electromechanical.h.

          + +
          +
          + +

          ◆ xq

          + +
          +
          + + + + +
          double SyncMachineModelData::xq
          +
          +

          Quadrature-axis reactance (transient for models 1, 2 and 3; subtransient for models 4 and 5)

          + +

          Definition at line 37 of file Electromechanical.h.

          + +
          +
          +
          The documentation for this struct was generated from the following file: +
          +
          + + + + diff --git a/docs/doxygen/html/struct_sync_machine_model_data.js b/docs/doxygen/html/struct_sync_machine_model_data.js new file mode 100644 index 0000000..148839a --- /dev/null +++ b/docs/doxygen/html/struct_sync_machine_model_data.js @@ -0,0 +1,7 @@ +var struct_sync_machine_model_data = +[ + [ "ed", "struct_sync_machine_model_data.html#ad2bda1ac696b664571e33f657f4a81b6", null ], + [ "eq", "struct_sync_machine_model_data.html#a810b9e3250ebb8f3d4176f6e5a2b1076", null ], + [ "xd", "struct_sync_machine_model_data.html#af75546805bf92eb7a8a7280f7964b330", null ], + [ "xq", "struct_sync_machine_model_data.html#af81596945918e86e56f5822a0ba97fbc", null ] +]; \ No newline at end of file diff --git a/docs/doxygen/html/struct_sync_motor_electrical_data-members.html b/docs/doxygen/html/struct_sync_motor_electrical_data-members.html index 3d1ad0e..db32473 100644 --- a/docs/doxygen/html/struct_sync_motor_electrical_data-members.html +++ b/docs/doxygen/html/struct_sync_motor_electrical_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_sync_motor_electrical_data.html b/docs/doxygen/html/struct_sync_motor_electrical_data.html index 339aeb6..b036156 100644 --- a/docs/doxygen/html/struct_sync_motor_electrical_data.html +++ b/docs/doxygen/html/struct_sync_motor_electrical_data.html @@ -21,6 +21,12 @@ + @@ -318,7 +324,7 @@ Machines::SyncMachineModel 

          Detailed Description

          -

          Definition at line 8 of file SyncMotor.h.

          +

          Definition at line 25 of file SyncMotor.h.

          Member Data Documentation

          ◆ faultCurrent

          @@ -332,7 +338,7 @@ Machines::SyncMachineModel 
          Initial value:
          = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0),
          std::complex<double>(0.0, 0.0)}
          -

          Definition at line 38 of file SyncMotor.h.

          +

          Definition at line 55 of file SyncMotor.h.

          diff --git a/docs/doxygen/html/struct_transfer_function_1_1_space_state-members.html b/docs/doxygen/html/struct_transfer_function_1_1_space_state-members.html index 84e0bd5..64a4af2 100644 --- a/docs/doxygen/html/struct_transfer_function_1_1_space_state-members.html +++ b/docs/doxygen/html/struct_transfer_function_1_1_space_state-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_transfer_function_1_1_space_state.html b/docs/doxygen/html/struct_transfer_function_1_1_space_state.html index 02dd918..aea4d0b 100644 --- a/docs/doxygen/html/struct_transfer_function_1_1_space_state.html +++ b/docs/doxygen/html/struct_transfer_function_1_1_space_state.html @@ -21,6 +21,12 @@ + @@ -103,7 +109,7 @@ double D

          Detailed Description

          -

          Definition at line 14 of file TransferFunction.h.

          +

          Definition at line 31 of file TransferFunction.h.


          The documentation for this struct was generated from the following file: diff --git a/docs/doxygen/html/struct_transformer_electrical_data-members.html b/docs/doxygen/html/struct_transformer_electrical_data-members.html index 51925b3..8b12a58 100644 --- a/docs/doxygen/html/struct_transformer_electrical_data-members.html +++ b/docs/doxygen/html/struct_transformer_electrical_data-members.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/struct_transformer_electrical_data.html b/docs/doxygen/html/struct_transformer_electrical_data.html index 1cd42a4..a26f1fb 100644 --- a/docs/doxygen/html/struct_transformer_electrical_data.html +++ b/docs/doxygen/html/struct_transformer_electrical_data.html @@ -21,6 +21,12 @@ + @@ -137,10 +143,10 @@ double phaseShift = 0. bool useTransformerPower = false   -std::complex< double > current [2] = { std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0) } +std::complex< double > current [2] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0)}   -std::complex< double > powerFlow [2] = { std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0) } +std::complex< double > powerFlow [2] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0)}   double zeroResistance = 0.0 @@ -166,7 +172,7 @@ std::complex< double > 

          Detailed Description

          -

          Definition at line 20 of file Transformer.h.

          +

          Definition at line 37 of file Transformer.h.


          The documentation for this struct was generated from the following file: diff --git a/docs/doxygen/html/wx_g_l_string_8cpp_source.html b/docs/doxygen/html/wx_g_l_string_8cpp_source.html index 822d9f7..2e21bde 100644 --- a/docs/doxygen/html/wx_g_l_string_8cpp_source.html +++ b/docs/doxygen/html/wx_g_l_string_8cpp_source.html @@ -21,6 +21,12 @@ + diff --git a/docs/doxygen/html/wx_g_l_string_8h_source.html b/docs/doxygen/html/wx_g_l_string_8h_source.html index 338c026..8b47fa5 100644 --- a/docs/doxygen/html/wx_g_l_string_8h_source.html +++ b/docs/doxygen/html/wx_g_l_string_8h_source.html @@ -21,6 +21,12 @@ + -- cgit