Jump to: navigation, search

Arijit Chakraborty

Google Summer of Code 2009 Proposal: [1]

Subversion branch: arijit:

Detailed Plan

By mid-term review :

  • Include provision for viewing, fixing, editing of parameters of the blocks and allow making of adjustments to the system design by providing the user with a 'Block Properties' dialog box.
  • Provide a full-fledged menu-bar to the canvas window.
  • Solving the model and fetching the results.
  • Displaying the value of variables within the blocks, once they are solved for.
  • Assess possible solutions to the redundant equations problem in canvas-based modelling.

After mid-term review :

  • Enable saving/loading of canvas flowsheets in their current state including calculation results (see here for proposals on Saving and restoring model state as well as details about current implementation method).
  • Graphical identification of those model parts which failed to converge or which are out-of-bounds and prompting the user about it.
  • Generation of error message feedback, if something goes wrong during solving stage or during creation of linkages between blocks and solver-vars.
  • Implement support for a manual way of removing redundant equations. (can do it using custom METHOD)
  • Add some more models to the canvas pallete.

Stretch Goals :

  • Implement any remaining unimplemented menu/GUI items.
  • Customizing block appearance, so that a block appears/looks like what it actually represent.
  • Add drag and drop support, so that blocks can be dragged and dropped directly onto the canvas.
  • Enabling users to add custom-defined blocks to the palette.
  • Incorporate ability to print models or export to formats like SVG/PNG etc.
  • Improved handling of units of measurement in parameter input.
  • Carrying out of type-checking will also be needed so as to ensure that only compatible ports are connected before proceeding further.

Progress Report

Mid - Term Review

The Canvas modeler has now been provided with a block properties window, which will let the user fix and edit parameters of the block and also view solve results, once the model is solved.

The Block Properties Dialog window viewing results after a model was solved

Final Review

The canvas modeler is now able to report errors which it encounters while solving, through the "Error / Status Reporter Console". It now gives real time feedback to the user while the solver is solving, so that the user can know what the solver is doing. Also, after solving graphical feedback is provided to the user which lets him/her know whether everything went well or not. And in case, if the solver fails to solve the model, it also identifies the blocks where the solver got stuck while solving and reports them to the user.

A Tutorial is provided below. It should help you in getting started with the Canvas Modeler. The Canvas Modeler in its current state is not very enriched, so modeling of complex models might not be possible at present. But nevertheless, in its present condition the Canvas Modeler is capable enough to handle simple models comfortably.

All these limitations and glitches will be eliminated once we come out with the beta release of the Canvas Modeler.

Tutorial for Canvas Modeler

Presenting here is a very basic and simple tutorial which will demonstrate to you how to use the Canvas Modeler, in its current state. Please note that the Canvas Modeler is in its pre-alpha stages and development work is on, so there might be some discrepancies between what is mentioned here and what you may encounter while actually working with the canvas modeler. And just in case if you get stuck with something and need help, feel free to approach the ASCEND development community.

For this tutorial we will be taking up an example of reservoir(source) - pump - reservoir(sink) scenario. We will be calculating the flow rate of water in the system, taking into account various factors / parameters like pressure added by the pump etc, which affects the flow rate. Lets get started.

  • Select blocks like reservoir_source, reservoir_sink and pump_minimal_test from the palette and place them on the canvas and accordingly, interconnect their ports. You should end up with something like this :

  • The next step involves setting up the parameters of individual blocks. Right-clicking on the blocks will generate a context-menu, select " Properties " from that menu. Alternatively you could have also selected the Block Properties option under "Edit" menu. Either ways, a Block Properties dialog window containing few tabs like 'General','Parameters','Custom Method' will open up as shown.The General tab provides general information about the Block. The General page also lets you edit/change the block name. An alternate way of obtaining general information about a block and editing/changing the block name would be by clicking on the Info option and Rename option respectively, in the context-menu obtained by right-clicking a block.

  • Select the 'Parameters' tab. Please note that in some cases, reservoir_sink for example, the block may not be in need of parameters to be specified and in that case the 'Parameters' tab would be absent in the Block Properties dialog window. Provide appropriate value(s) for the parameter(s) along with units into their corresponding text-entry boxes. For eg. if you want to enter '5 meters' type in '5 m', or for 0.2 x 10^5 meter/second, just type in ' 0.2e5 m/s '. Here you can FIX / FREE parameters, although if you type in something or change any previous value, that parameter will automatically get FIXed. However it can be FREEed by clicking on the button displayed beside the parameter which now will be indicating that the parameter is locked i.e FIXed. If you do not provide values for certain parameters, the modeler will take up default values for them. Please note that in such cases, your model may diverge.

  • Now, your model is ready to be solved. You might like to view the automatically generated code for your model, by pressing the 'Preview' button from the Toolbar or by selecting 'Preview' from the 'Tools' menu. To execute the code, i.e to solve your model, press the 'Run' button on the Toolbar or select 'Run' from the 'Tools' menu. Upon pressing 'Run' your model code would be passed onto the Solver for solving. Whatever is going on in the background will be reported on the 'Error / Status Reporter Console' and a pop-window will be informing you about the overall amount of progress. If everything goes well and the model converges, you will be notified about that and the overall Canvas background will go green, as shown.
File:Sample canvas3.png
The canvas modeler reporting solver status and giving graphical feedback

  • You will now be able to view the solved results. For viewing the solved results open up the Block Properties dialog. Note here that the text 'No instance exists' displayed at the bottom portion of the 'General' tab page has changed to 'Instance exists'. Also note that the Block Properties dialog now contains an additional tab 'Instance'. Select this tab. It will be displaying the solved result in the form of a Tree View. You can explore and view the solved values of all the variables/parameters here.
File:Sample canvas4.png
The canvas modeler showing calculated results using the Block Properties Dialog window

  • And in case your model fails to converge or something goes wrong, you will be notified about that too. This time the screen would go light-red / pink. And those blocks where the solver got stuck while solving will go red. Corresponding information will also be displayed on the Error / Status Reporter Console. Now, with all these information you would be able to identify what went wrong, for example in the case demonstrated below, I entered an out-of-bound value for the 'dp' parameter of the 'pump_minimal_test' block. And as you can see, corresponding error messages were displayed in the console and the culprit blocks were also identified. Remove these error(s) and try solving your model again.
File:Sample canvas5.png
The canvas modeler reporting error and identifying those blocks where the solver got stuck while solving


Presenting here is a list of tasks that were proposed to be implemented during GSoC 2009 but could not be implemented in the end. I will be implementing these 'TO-DOs' after the GSoC 2009 period, so that the next ASCEND release can have a more robust and feature-rich canvas modeler.

  • Implement all unimplemented items in the menu bar, like 'undo', 'redo' etc as well as improve usability by providing support for things expected from a modern day software (sticking to GNOME/KDE HIGs)
  • Migrate to a more robust and less error prone file saving format like xml from the current sensitive and delicate 'pickle' format. Also improve upon the method of storing solved values of canvasmodel's parameters etc.
  • Implement a more powerful unit parser in block properties dialog.
  • Fix up the orientation and placement of child widgets in the main app window
  • Migrate to GLADE so that the canvas modeler gets in sync with the current PyGTK GUI and integration becomes seamless.
  • Add support for letting the user set Solver Parameters
  • Provide a more feature rich library(ies).
  • Customize block appearance by providing icons instead of drawing blocks.
  • Letting users create and add their own custom defined libraries by writing ASCEND codes for them.
  • Carrying out of type-checking so as to ensure that only compatible ports are connected before proceeding further.


Canvas-based modeller for ASCEND