hynet.visual.capability package¶
Submodules¶
hynet.visual.capability.settings module¶
Settings view to edit parameters in the capability region visualizer.
-
class
hynet.visual.capability.settings.DescriptiveEntry(master=None, name='Label', alignment='horizontal', value=0.0)[source]¶ Bases:
tkinter.ttk.FrameContainer that bundles a label with an input field.
-
VALIDATION_REGEX= re.compile('^[+-]?([0-9]*[.])?[0-9]+$')¶
-
error_state(old_value=None)[source]¶ Set the foreground to red and return the callback to undo this change.
Parameters: old_value (float) – If this value is set, then the value of the input component is set to this value when this callback is called. Returns: Callback to undo this change (set the foreground back to black). Return type: function
-
reset_to_normal_state(old_value=None)[source]¶ Reset the element to the normal state (black font on white background).
Parameters: old_value (float) – If this value is set, then the value of the input component is set to this value when this callback is called.
-
-
class
hynet.visual.capability.settings.PowerFactorView(master=None)[source]¶ Bases:
tkinter.ttk.FrameView for setting the power factor limit.
-
class
hynet.visual.capability.settings.SettingsView(master=None, cap_region=[0.0,0.0]x[0.0,0.0])[source]¶ Bases:
tkinter.ttk.FrameSettings view to edit parameters in the capability region visualizer.
-
deactivate_all_halfspaces()[source]¶ Deactivate all checkboxes and, therewith, remove all half-spaces.
-
-
class
hynet.visual.capability.settings.ValueView(master=None, name='Unnamed ValueView', right_value_name='Slope:', left_value_name='Offset:', initial_value_tuple=(0, 0), checkbox_state=None)[source]¶ Bases:
tkinter.ttk.FrameContainer view for two descriptive entries.
Furthermore, the value view handles the update of the associated half-space (if provided) as well as the error and update callbacks.
-
callback= None¶
-
hynet.visual.capability.utilities module¶
This module contains various classes to provide interchangable data types between the view classes
-
class
hynet.visual.capability.utilities.AutoValue[source]¶ Bases:
enum.EnumThis class provides a base class for enum that have a predefined, readable string representation.
-
class
hynet.visual.capability.utilities.Axis[source]¶ Bases:
hynet.visual.capability.utilities.AutoValueThis enum represents the two axes.
-
ACTIVE_POWER= 1¶
-
REACTIVE_POWER= 2¶
-
-
class
hynet.visual.capability.utilities.Bound[source]¶ Bases:
hynet.visual.capability.utilities.AutoValueThis enum represents the two bounds of the reactive and active limits of a capability region.
-
MAX= 2¶
-
MIN= 1¶
-
-
class
hynet.visual.capability.utilities.LinearFunction(halfspace, limits)[source]¶ Bases:
objectHelper class to simplify the handling of the PWLs
-
f(p)[source]¶ - This function computes the PWL function for the input value p.
Parameters: p (float) – The active power value for this linear function Returns: $ ext{self.slope}*p + ext{self.t}$ Return type: The result of the linear curve equation for the input value
-
f_1(q)[source]¶ This function computes the inverse PWL function for the input value q.
Parameters: q (float) – The reactive power value for this linear function. Returns: $ (q - ext{self.t}) / ext{self.slope}$ Return type: The result of the linear curve equation for the input value
-
intersect_with(other)[source]¶ This function computes the intersection of this LinearFunction with the LinearFunction other.
Parameters: other (LinearFunction) – The other LinearFunction we want to compute the intersection with. Returns: - Either None or a Point that represents the intersection of the two
- instances of LinearFunction
-
-
class
hynet.visual.capability.utilities.Orientation[source]¶ Bases:
hynet.visual.capability.utilities.AutoValueThis enum represents the four possibilities for halfspaces. These should only appear in pairs of two: {RIGHT, LEFT} x {TOP, BOTTOM}.
-
BOTTOM= 4¶
-
LEFT= 2¶
-
RIGHT= 1¶
-
TOP= 3¶
-
-
class
hynet.visual.capability.utilities.Point[source]¶ Bases:
hynet.visual.capability.utilities.PointRepresentation of a point in the P/Q-plane
hynet.visual.capability.visualizer module¶
Visualization of a capability region.
-
class
hynet.visual.capability.visualizer.Window(master=None, capability_region=[0.0,0.0]x[0.0,0.0], edit=True)[source]¶ Bases:
tkinter.ttk.FrameThis class creates a window that visualizes a capability region.
-
CAPABILITY_REGION_COLOR= '#BBBBBB'¶
-
HALFSPACES_COLOR= '#777777'¶
-
POLYGON_EDGE_COLOR= '#777777'¶
-
POLYGON_FILL_COLOR= '#BAEBAC'¶
-
SCALING_FACTOR= 1¶
-
static
compute_polygon_vertices(cap_region)[source]¶ Compute the vertices of the capability region polygon.
This function computes the intersections of the four lines that delimit the capability region. The algorithm starts with the left-top half space and continues clock-wise with the other half-spaces.
The algorithm assumes that
p_max != p_minandq_max != q_min. Furthermore, the assumptions on the slopes and offsets must be satisfied as well. If the preconditions are met, the function returns a list of all vertices that specify the polygon, in a clock-wise ordering.Parameters: cap_region (CapRegion) – The capability region that shall be drawn. Returns: List of polygon vertices. Return type: list[tuple(p,q)]
-
display_operating_point(point)[source]¶ Display an operating point in the P/Q-plane of the capability region.
Parameters: point (tuple(p,q)) – This tuple represents the operating point as a (p,q)-tuple of floats.
-
static
show(capability_region, edit=True, operating_point=None)[source]¶ Create and show a capability region visualizer window.
Parameters: - capability_region (CapRegion) –
- edit (bool, optional) – If True (default), editing of the specified capability region is enabled.
- operating_point (tuple(p,q), optional) – If provided, this operating point is shown by a marker in the P/Q-plane.
-