User:Mike
From ASCEND
Name: Tengda Han (韩腾达) (Mike)
University: ANU
Email: tengda.han@anu.edu.au
Summary: I did GSOC2016 for ASCEND. I optimized GUI of Canvas, fixed bugs, developed canvas models and improved canvas language.
- Browse my code here: mike:
- Check out my code using svn co http://svn.ascend4.org/branches/mike
Contents
- 1 Discussion notes of 12 May 2016
- 2 May 12 to May 22
- 3 Discussion notes of 23 May 2016
- 4 May 23 to May 29
- 5 Discussion notes of 30 May 2016
- 6 May 30 to June 5
- 7 Discussion notes of June 6 2016
- 8 June 6 to June 13
- 9 June 13 to June 28
- 10 June 29 to July 10
- 11 Discussion notes of July 11 2016
- 12 July 11 to July 20
- 13 Discussion notes for July 20 2016
- 14 July 21 to Aug 2
- 15 Discussion notes for August 3 2016
- 16 Aug 3 to Aug 9
- 17 Discussion notes for August 10
- 18 Aug 11 to Aug 18
- 19 Discussion notes for August 19
- 20 Aug 19 to Aug 22
- 21 Work after GSOC
- 22 Final Review
- 23 Screenshots
Discussion notes of 12 May 2016
To get the canvas GUI running in the trunk code, I used:
python ~/ascend/trunk/pygtk/canvas/canvas.py
May 12 to May 22
- Set development environment and play with canvas.
- Find a problem about module 'ascpy' in my branch, which cannot be found in canvas.py.
- But when I run canvas.py of main trunk, module 'ascpy' can be found, but another error is called:libascend.so.1: cannot open shared object file: No such file or directory
Discussion notes of 23 May 2016
- cannot find module 'ascpy' is because I need to compile by
scons -j4
- set paths properly before run canvas.py:
export LD_LIBRARY_PATH=~/Desktop/ascend_mike/mike/:$LD_LIBRARY_PATH export PYTHONPATH=~/Desktop/ascend_mike/mike/models/johnpye/fprops/python:$PYTHONPATH
- find a bug of Adrian's branch, which is, when run the solver, ascend kills the background terminal. Trying different ubuntu system may work.
May 23 to May 29
- Tested Adrian's branch on ubuntu 16.04 LTS. Previous bug doesn't exist (ascend kills the terminal)
- Try to understand Gaphas and libavoid.
- Link 'libavoid' on ASCEND wiki has 404 error.
- When 'scons' ASCEND in Ubuntu16.04, SWIG error comes. sulution here
Discussion notes of 30 May 2016
- When try to run canvas.py, should set PYTHONPATH to
ascend_trunk/trunk/model/johnpye/fprops/python
- For Adrian's version
- canvas.py doesn't work because of
Error: sys.path must be a list of directory names
- Reason: installed python-gaphas uses gtk2. But we require gtk3 branch of gaphas, Solution:
cd ~/desired directory git clone https://github.com/amolenaar/gaphas git checkout gtk3 git pull sudo python setup.py install
- However, after canvas.py pops up, TypeError: Couldn't find conversion for foreign struct 'cairo.Context' occurs when click on blank canvas
May 30 to June 5
- Solved TypeError: Couldn't find conversion for foreign struct 'cairo.Context' by
sudo apt-get python-gi-cairo
This package is a Python Cairo bindings for the GObject library
- If problems occur when installing gaphas by
sudo apt-get install python-gaphas
Check the universe repository before installation may help
- Undo button works (finishing the work of Adrian), redo haven't been implemented yet.
Discussion notes of June 6 2016
- Buttons now have labels. By adding tb.set_style(Gtk.ToolbarStyle.BOTH) after tb = Gtk.Toolbar()
- Delete unnecessary .svg image files in mike:pygtk/canvas only leave defaultblock.svg
- Block icons should be generated by strings, instead of load image. Example: mike:models/test/canvas/brayton_fprops_rachel.a4c
- Currently svn version is updated to changeset 3110
- I can improve blocks, firstly to make sure they can be properly solved in canvas.
June 6 to June 13
- models in mike:models/test/canvas/basic_electronics_model.a4c have been updated.
- Problems found: every time after using the model in canvas, a '.svg' file of that model will be generated.
June 13 to June 28
- Working on redo function. Implement redo function in mike:pygtk/canvas/undo.py
- Fix a bug that rankine_canvas.a4c in mike:models/test/canvas/ cannot run in canvas
- Fix a bug that rankine_stream.a4c in mike:models/test/canvas/ cannot run in canvas
- Fix a bug that rankine_stream_v2.a4c in mike:models/test/canvas/ cannot run in canvas
- Fix a bug that ammonia_synthesis_v2.a4c in mike:models/test/canvas/ cannot run in canvas
- GUI update: Load Library (Ctrl+L) is enabled from menu bar
- GUI update: Correct labels in Block Properties Dialog
June 29 to July 10
- Fix a bug when adjusting Error/Status Reporter Console
- Rotate(Ctrl+R) and Flip(Ctrl+F) operation is added to menu bar, and keyboard shortcuts of them are enabled.
- Correct current value (I) in running results from mike:models/test/canvas/basic_electronics_model.a4c library.
- Find a bug: In basic_electronics_model.a4c, when connect 2 ports of T-piece/Branch together and run, Canvas will quit.
- An Error occurs when load canvas files because blocks with same name exist. Solution: 1. add a checker before 'run' or 'save'. 2. avoid reduplicate names when generating blocks.
- Also, a warning 'CompareStatements called with unknown statement' always appears when load files, but seems don't affect the result.
- Add reporter for loading libraries and files.
- Errors including line number can be shown on canvas when loading is unsuccessful.
- Update information in 'Help' Menu
Discussion notes of July 11 2016
- Automatically generating .svg files when load libraries: save these images into ~/.ascend/tmp
- Preference of units should be improved: modify pygtk/preference.py
- Warning should be displayed when ports not connected
- Models with degree of freedom should not be solved. Warning should be displayed
- In 'Block Properties', equations of blocks should be displayed
July 11 to July 20
- Correct syntax error in some files
- Improving Block Properties to display equations, by editing relating python files and glade files.
- Warning Dialog added when load new libraries with canvas items existing.
- Warning Dialog added when exiting without saving canvas (still need improve).
Discussion notes for July 20 2016
- For equation display, some paths may be valuable to check: asclibrary - get module types - library.h - type.h - ismodel(); ascend/compiler - type.descio.h - writedefinition.
- Next Step: Create a library for piping system. Read Mechanics of Fluids. Be careful with flow network & over constrain issues.
July 21 to Aug 2
- Solve an issue that .svg image files will be generated in pygtk/canvas after load library: create directory 'pygtk/canvas/.temp' and save all the .svg files into that .temp directory. By modifying mike:models/test/canvas/blocktype.py
- Piping system library can be loaded now. But still working on equations.
Discussion notes for August 3 2016
- generate .svg files to ~/.cache/ascend, fix the permission issue by function os.path.expanduser(path).
- Combine Quit (Ctrl+Q) and close button together by assign 'dispensable' argument i.e. Event=None.
- Refresh the workflow for developing piping system model.
Aug 3 to Aug 9
- 'inout' port is partially implemented by adding similar 'inout' elements with previous 'input' and 'output' elements properly. However error occurs when right click and view 'block properties'.
- Piping system library can solve simple piping problems under fluid mechanics approximation.
Discussion notes for August 10
- Report current working status.
- General discussion about piping system library.
Aug 11 to Aug 18
- 'inout' port is fully implemented by checking glade file mike:pygtk/glade/bp.glade and match the variable names. Now, 'inout' port works properly for drawing feedback (can be connected with input/output/inout) and solving.
Discussion notes for August 19
- Report current working status.
- Schedule next meeting on Monday morning.
Aug 19 to Aug 22
- Potential connector and flow connector can be detected from library file via syntax 'potential:' and 'flow:', however it only has effects for one layer. E.g. library like this doesn't work:
MODEL electron_stream; V "potential:" IS_A voltage; I "flow:" IS_A current; END electron_stream; MODEL equipment; inlet "in:" IS_A electron_stream; outlet "out:" IS_A electron_stream; END equipment; MODEL something REFINES equipment; ... END something;
But library like this can work, but it doesn't help much for solving problems:
MODEL equipment; inlet "in:" IS_A electron_stream; outlet "out:" IS_A electron_stream; V "potential:" IS_A voltage; I "flow:" IS_A current; END equipment; MODEL something REFINES equipment; ... END something;
Therefore, further implement is required on this.
Work after GSOC
- Viewing block equations from right click - block properties is enabled, details in mike:pygtk/canvas/blockproperties.py
Final Review
- How to use 'inout' port: (see mike:models/test/canvas/basic_electronics_model.a4c for detail)
- The resistor_basic model has normal 'inlet' and 'outlet' port. But the Ground model only has 'inout' port, which can be connected with any kinds of ports in canvas. The definition of 'inout' port is exactly the same as 'inlet' or 'outlet' ports. Part of the code is shown below:
MODEL Ground; NOTES 'block' SELF {Ground} 'icon' SELF {ground.png} 'graphic' SELF {5,0-5,5 0,5-10,5 2,7-8,7 4,9-6,9} 'port_inout' SELF {inout:5,0} END NOTES; inout "inout:" IS_A electron_stream; inout.V = 0 {volt}; END Ground;
- Piping system introduction:
- See previous logs for setup environment of my branch.
- Contact me via u5612799@anu.edu.au if you encounter problems / have questions.
- TODO List from me:
- Implement redo function in mike:pygtk/canvas/undo.py
- Improve quit check (quit_confirm) function in mike:pygtk/canvas/blocklist.py
- Improve functions of mike:models/test/canvas/basic_electronics_model.a4c
- Improve functions of mike:models/test/canvas/piping_system.a4c
- Improve potential and flow connectors in various files from mike:pygtk/canvas