idaes.ui package¶
Submodules¶
idaes.ui.flowsheet module¶
DrawFlowsheet.py
- Widget to display/edit the flowsheet
John Eslick, 2017
-
class
idaes.ui.flowsheet.
DrawFlowsheet
(parent=None, ui_setup=None)[source]¶ Bases:
PyQt5.QtWidgets.QGraphicsView
This is the a QGraphicsView widget for viewing and editing a flowsheet most of the important stuff is in the accosicated scene object
-
createScene
()[source]¶ Put items in the scene, these items have refences back to the original Pyomo components for editing and displaying and such
-
-
class
idaes.ui.flowsheet.
FlowsheetScene
(parent=None, ui_setup=None)[source]¶ Bases:
PyQt5.QtWidgets.QGraphicsScene
QGraphicsScene class for viewing and editing a Pyomo model block stucture
-
ITEM_EDGE
= 2¶
-
ITEM_NODE
= 1¶
-
ITEM_NONE
= 0¶
-
MODE_ADDEDGE
= 3¶
-
MODE_ADDNODE
= 2¶
-
MODE_SELECT
= 1¶
-
addTextCenteredOn
(x=0, y=0, text='None')[source]¶ Add text vertically and horizontally centered on (x, y)
Parameters: - x – x coordinate of text center
- y – y coordinate of text center
- text – text to draw
-
drawEdge
(x1, y1, x2, y2, index, curve=0)[source]¶ Draw an edge from x1, y1 to x2, y2. (should connect two blocks)
Parameters: - index – the edge index
- curve – positive or negitive bow in edge (to prevent overlap)
- tear – if True draw in tear edge style
-
draw_node
(x, y, o=None)[source]¶ Draw a node centered at x,y. Text lines are centered under the node for the node name and node type
Parameters: - x – x coordinate of node
- y – y coordinate of node
- o – subclass of Pyomo Block
-
mouseMoveEvent
(evnt)[source]¶ Mouse move event handler. If mouse button is down move selected nodes
Parameters: evnt – event
-
mousePressEvent
(evnt, dbg_evnt={})[source]¶ This handles a mouse press event on the flowsheet scene. The dbg_ arguments allow you to simulate a mouse press event. This could be handy for testing and scripting.
Parameters: - evnt – Qt mouse press event
- dbg_evnt – simulated press information dict keys: x, y, mod…
-
idaes.ui.log_monitor module¶
Simple flask log viewer. This is just a very prliminary start on a logging viewer that can be used along side a jupyter notebook so that you can see what’s going on in your web browser without junking up the jupyter notbook with a bunch of log messages. This could use a lot of work, but it’s something.
idaes.ui.model_browser module¶
A simple GUI viewer for Pyomo models.
-
class
idaes.ui.model_browser.
ComponentDataItem
(parent, o, ui_setup)[source]¶ Bases:
object
This is a container for a Pyomo component to be displayed in a model tree view.
-
class
idaes.ui.model_browser.
ComponentDataModel
(parent, ui_setup, columns=['name', 'value'], components=(<class 'pyomo.core.base.var.Var'>,), editable=[])[source]¶ Bases:
PyQt5.QtCore.QAbstractItemModel
This is a data model to provide the tree structure and information to the tree viewer
idaes.ui.report module¶
-
idaes.ui.report.
active_equalities
(blk)[source]¶ Generator returning active equality constraints in a model.
Parameters: blk – a Pyomo block in which to look for variables.
-
idaes.ui.report.
active_equality_set
(blk)[source]¶ Generator returning active equality constraints in a model.
Parameters: blk – a Pyomo block in which to look for variables.
-
idaes.ui.report.
connections
(blk)[source]¶ Returns a list of connected blocks at the level under blk, this only goes one level deep, used for displaying a flowsheet.
-
idaes.ui.report.
count_free_variables
(blk)[source]¶ Count free variables that are in active equality constraints. Ignore inequalities, because this is used in the degrees of freedom calculations
-
idaes.ui.report.
fixed_variables
(blk)[source]¶ Generator returning fixed variables in a model.
Parameters: blk – a Pyomo block in which to look for variables.
-
idaes.ui.report.
free_variables
(blk)[source]¶ Generator returning free variables in a model. same as unfixed
Parameters: blk – a Pyomo block in which to look for variables.
-
idaes.ui.report.
free_variables_in_active_equalities_set
(blk)[source]¶ Return a set of variables that are contined in active equalities.
-
idaes.ui.report.
large_residuals
(blk, tol=1e-05)[source]¶ Generator return active Pyomo constraints with residuals greater than tol.
Parameters: - blk – a Pyomo block in which to look for constraints
- tol – show constraints with residuals greated than tol
-
idaes.ui.report.
stale_variables
(blk)[source]¶ Generator returning stale variables in a model.
Parameters: blk – a Pyomo block in which to look for variables.
idaes.ui.solve module¶
This is a solver options dialog box. It should provide a comprehensive list of solvers and solver options and allow assigning default solvers for different purposes.
-
class
idaes.ui.solve.
SolveDialog
(parent=None, solver_options=None)[source]¶ Bases:
idaes.ui.solve._Solver
,idaes.ui.solve._SolverUI
-
model_str
= 'model'¶
-
-
class
idaes.ui.solve.
SolveOptionDataModel
(parent, solver_options={})[source]¶ Bases:
PyQt5.QtCore.QAbstractItemModel
-
class
idaes.ui.solve.
SolverOptionSet
[source]¶ Bases:
object
This contains a dictionary that has (will have) a comprehensive list of solvers and their options, documentation, and validation information. This make it easy to put together a solver option tree view, and provides an easy way to store solver settings for later use.
idaes.ui.ui module¶
A simple GUI viewer for Pyomo models.
-
class
idaes.ui.ui.
MainWindow
(*args, **kwargs)[source]¶ Bases:
idaes.ui.ui._MainWindow
,idaes.ui.ui._MainWindowUI
-
model_information
()[source]¶ Put some useful model information into a message box
Displays: * number of active equality constraints * number of free variables in equality constraints * degrees of freedom
Other things that could be added * number of deactivated equalities * number of active inequlaity constraints * number of deactivated inequality constratins * number of free variables not appearing in active constraints * number of fixed variables not appearing in active constraints * number of free variables not appearing in any constraints * number of fixed variables not appearing in any constraints * number of fixed variables appearing in constraints
-
refresh_on_execute
()[source]¶ This is the call back function that happens when code is executed in the ipython kernel. The main purpose of this right now it to refresh the UI display so that it matches the current state of the model.
-
-
class
idaes.ui.ui.
UISetup
(model=None, model_str='model')[source]¶ Bases:
PyQt5.QtCore.QObject
-
begin_update
()[source]¶ Lets the model setup be changed without emitting the updated signal until the end_update function is called.
-
end_update
(noemit=False)[source]¶ Start automatically emitting update signal again when properties are changed and emit update for changes made between begin_update and end_update
-
model
¶
-
model_str
¶
-
updated
¶
-
idaes.ui.util module¶
Simple GUI utility functions