Canvas Development
This page aims to document all the GSoC 2010 and current development carried out by Grivan Thapar. The goals and tasks for the GSoC period are additionally listed over here for a quick look. The concerns are right now at setting up better mechanisms for parameter handling and design enhancements like handling of stream objects, globals etc.
Use Cases
We want to be able to solve following descriptions from our Canvas Based Modeller. These would help us identify as to what things require our immediate attention. This will help identify the missing elements from our design, and how best these should be implemented.
TODO : Add more ideas, put a concrete solution overview to each Case.
Simple Rankine Cycle
A simple Rankine cycle has been modelled as a use case to see what all is missing.
- Global Model equations.
- Implementation: A 'Canvas Properties' pop-up allows for additions of extra declarations to the MODEL.
- Set up of extra components.
- Implementation: Pump, Turbine, Boiler, Condenser have been annotated to provide blocks with suitable parameters.
- Block rotation.
- It would be nice if blocks could be rotated, it makes the canvas look more tidy.
- Other Issues.
- Just specifying a value and not Fixing it. Should it be possible?
- How to make additions of equations to the MODEL more intuitive.
Regenerative Rankine Cycle
Rankine cycle is a thermodynamic process that converts heat energy into work. John Pye has already written an ASCEND language based model for this process here models/johnpye/rankine.a4c. We would want to develop a steady state model of regenerative Rankine cycle. This particular model would require from us to:
- Set up of extra components
- Implementation: Pump, Turbine, Boiler, Condenser, Feedwater Heater, TEE piece. In addition take care of the ALIASES keyword used in the text model. TODO
- Elimination of redundant equations in closed loop flows.
- Multiple loops present in the system.
- Implementation: Still needs to be discussed. TODO
- Specifications of flow streams.
- It should be possible to switch between stream components, water to CO2 to toluene for example.
- This however should not involve redrawing the whole model again.
- Implementation: Streams can be defined in the canvas by selecting the particular connections and specifying the stream component, the connections to these components at the ports must use the values of stream component provided. TODO
- Providing complex flow streams.
- A regenerative cycle requires to specify the fraction of steam extracted at the bled point, that is a TEE in our sense. Such a fraction must be supplied by the user while making such connections. Assuming an open feedwater scheme.
- Implementation: This should be easy as a simple TEE component must have a fixable variable 'fraction'.
- Present graphical models used to create the flowsheet in a more intuitive form. In styles of a PID or a PFD.
- Implementation: See #Support for user-customisable custom icon types.
Ammonia Synthesis Reactor
Ammonia is basically manufactured by chemical combination of nitrogen and hydrogen gases at high temperature and pressure in the presence of a catalyst. The reactor could be desirable complexity which has to be decided. In any case Ammonia synthesis requires complex flow streams.
- The simulation type needs to determined. What kind of reactor will be used for example plug flow or Gibbs.
- In this case connections may need to be manually specified in order to provide complex flows as required.
Non-Chemical Models
ASCEND is a powerful language, it is fairly general to support all kinds of mathematical models. For example take look at these:
Specification of flow streams should not make the modeller lose it generality. Other chemical process modellers make the modeller specific for use with chemical engineering models. However we would also want to have our modeller models of mechanical and electrical architecture. Basically maintain the ASCEND's general approach.
- Flow streams have to be mentioned such that it does not affect the type of system being modelled does not require specification of flow streams or it is obvious.
- For example, current and torque/energy/tension are obviously the streams in an electrical model and a particular mechanical model.
Dynamic Modelling of Servo Motor with backlash and PID control
- TODO : Add description
Update for Gaphas HEAD
The following section lists all the updating that needs to be done or has been done to work with latest gaphas head.
Aspects
One of the features that enhances the usability of the canvas is the dragging of ports to ports support to specify a stream. In reality these provides ARE_THE_SAME arguments when the ASCEND code is created.
- The Aspects of gaphas API define the 'how' and Tools the 'what'.
- Specific handlers now have to be created to handle events like line disconnection on either of the ports, re-connection etc.
- This should be carefully designed to have no problems in the future as it is already an important component.
Line Connection
Line Connection now uses Aspects, it is quite stable.
GUI Usability Improvements
TODO : Keep adding details
Undo/Redo Support
An Undo/Redo support would enhance the Usability. The gaphas library provides a very low level access to changes in its classes in form of multiple actions those of which could be executed to perform an Undo action. What is being done is to segregate the Actions observed into user level Transactions which could be applied to perform one Undo or a Redo.
- A basic but working mechanism is present.
- The mechanism breaks at undoing Line Connections.
- Add support for Undoing after a model has been solved. Give an error message like 'Undoing will discard your currently solved model.'
- Enable Redo.
Bugs
Maybe this bug list could be useful for that.
Support for user-customisable custom icon types
We want to be able to generate icons for models by embedding some kind of user definable code inside the model and/or add a graphical file itself. We want to make the resizing of the blocks such that it just works. Say for example if a motor is to be circle, it has to remain a circle. Additionally it would require us to read the model code and identify the constraint codes and pass them to Gaphas. TODO : Add exact Implementation details
Improvements on the Solving Process
Since we have no Type informations the solving is done primarily by first generating a string representation of the complete MODEL and then exported to the solver. This can lead to problems while trying to solve complex models requiring a large time to solve, because each time a variable is changed the complete model has to solved again. In case of PyGTK GUI we have a more powerful interaction with the solver and thus can change parameters without discarding the already solved model. The basic problem here lies in the fact that we don't instantiate the model first and then solve it.
Specification of flow streams
To provide reusable modelling architecture for modelling systems with non-trivial flow streams, the flow streams should be manually specified. This provides and excellent way to have the same model provide simulation for any number of streams. Two implementations have to be taken care of to specify streams;
- GUI implementation:
- This would provide a suitable GUI to select the stream.
- Application level implementation
- This would add actual stream modifications to the block code.
The #Simple Rankine Cycle could be solved simply by connecting steam_port connectors. The models/johnpye/rankine.a4c uses Steam as the only modelling stream. This model needs to be evolved to use generic port types so that a better and more deep understanding is achieved in the problem of specifying flow streams.
TODO : Add implementation details
Type Information
While connecting two blocks together the type of input and output port of the connector must be matched, also if we can extract Type information on variables in our model both Unit checking and port checking should be fairly easy. Type checking isn't very easy right now.
- To have highlighting of connectible ports while connecting two ports we need to:
- Find all suitable (IN/OUT/BOTH) ports available for connection.
- Create a set their Types.
- Check connect-ability for each of those types.
- Highlight only the connectible ones.
- To give a set of units that can be selected from a drop down menu in block properties:
- Scan for the Type of the parameter.
- Get the dimensions of the type.
- Scan for the units available.
- Implementation
- Some testing has been done of the functions, see
test_type_info()function inside /compiler/test/test_basics.c - The test can be run on any file, using
scons test && test/test compiler_basics.type_info - From the observations, it is clear that the function
GetChildList()works as it should in case of all user generated foreseeable canvas models.
- Some testing has been done of the functions, see
Key Deliverables
To set a stone for the GSoC project following have to be implemented
- Canvas Model for a Regenerative Rankine cycle
- Ammonia synthesis reactor
- Support for user customisable icon-types for blocks
- Undo Support