User:LeonKwek: Difference between revisions

From ASCEND
Jump to navigation Jump to search
LeonKwek (talk | contribs)
No edit summary
LeonKwek (talk | contribs)
No edit summary
Line 29: Line 29:
Setting LRSlv to work is straightforward however there is the issue of setting the model parameters for the logical solution. For example, IDA may indicate a root at t = 3.99983 for the boundary t >= 4, in which case calling LRSlv immediately does not trigger a change in the appropriate boolean variable. I think IDA also returns a minimum step size used during the integration which could be used to 'bump' a variable over to the correct side of a boundary if the issue of increasing/decreasing roots described above can be resolved. What about bumping multi variable boundaries?
Setting LRSlv to work is straightforward however there is the issue of setting the model parameters for the logical solution. For example, IDA may indicate a root at t = 3.99983 for the boundary t >= 4, in which case calling LRSlv immediately does not trigger a change in the appropriate boolean variable. I think IDA also returns a minimum step size used during the integration which could be used to 'bump' a variable over to the correct side of a boundary if the issue of increasing/decreasing roots described above can be resolved. What about bumping multi variable boundaries?


Another thing to consider: boundaries that occur on the time samples of the integration loop are picked up twice by the rootfinding algorithm. If a root occurs on or very close to the next time step ''tnext'', upon restarting IDA will need to run to ''tnext +1'' before back to the top of the loop. Notes on handling conditional branches from the documentation of a similar modelling program <ref name=DNA> Elmegaard and Houbak, 2004, ''DNA – A General Energy System Simulation Tool'', Technical University of Denmark</ref> mention that boundaries that depend only on the independent variable are known ahead of time and hence can be simply dealt with by setting the integration timesteps such that one falls on said boundary.
Another thing to consider: boundaries that occur on the time samples of the integration loop are picked up twice by the rootfinding algorithm. If a root occurs on or very close to the next time step ''tnext'', upon restarting IDA will need to run to ''tnext +1'' before back to the top of the loop. Notes on handling conditional branches from the documentation of a similar modelling program<ref name=DNA> Elmegaard and Houbak, 2004, ''DNA – A General Energy System Simulation Tool'', Technical University of Denmark</ref> mention that boundaries that depend only on the independent variable have the bonus of being known ahead of time. In that case it is possible to handle the discontinuity by arranging for an integration time step to fall on the boundary and switching the model appropriately. However the need to control the time step probably adds more complexity than it saves (especially for nested components).





Revision as of 02:03, 23 February 2011

Leon Kwek is working on adding support for integration of conditional models to ASCEND via modification of the IDA solver to add boundary-crossing/DAE reinitialisation support.

Goals

Implement code that completes the support for boundary-crossing in DAE integration:

  • Check support for boundary detection is complete/robust.
  • Using LRSlv, solve the logical problem and determine if any logical states have changed
  • Determine if as a result any WHEN statements have changed state
  • If so, reconfigure the model: turn of disused equations, turn on new equations.
  • Determine strategy to solve the initialisation problem, possibly bearing in mind the variables/relations that have recently been added to/removed from the model.
  • Solve the initialisation problem either using IDA's built-in routine or else through direct use of QRSlv
  • Restart IDA and continue integration.

Test the resulting code on a set of sample models given by Jan Huckleheim (in the first instance)

If possible: write some new solar energy simulation models that make use of the new freature, eg thermostat controller for a hot water system.

Progress made

23rd Feb

boundary detection IDA's built-in root finding engine seems to do the job in the case of boundary crossings of independent, dependant, derivatives and combinations of the three. Existing code suggests that IDA will return a positive or negative flag for a respective increasing or decreasing root however I cant get this to work.

ideas for further testing: minimum separation of boundaries IDA will detect. Speed of the rootfinding.

Logical States Setting LRSlv to work is straightforward however there is the issue of setting the model parameters for the logical solution. For example, IDA may indicate a root at t = 3.99983 for the boundary t >= 4, in which case calling LRSlv immediately does not trigger a change in the appropriate boolean variable. I think IDA also returns a minimum step size used during the integration which could be used to 'bump' a variable over to the correct side of a boundary if the issue of increasing/decreasing roots described above can be resolved. What about bumping multi variable boundaries?

Another thing to consider: boundaries that occur on the time samples of the integration loop are picked up twice by the rootfinding algorithm. If a root occurs on or very close to the next time step tnext, upon restarting IDA will need to run to tnext +1 before back to the top of the loop. Notes on handling conditional branches from the documentation of a similar modelling program[1] mention that boundaries that depend only on the independent variable have the bonus of being known ahead of time. In that case it is possible to handle the discontinuity by arranging for an integration time step to fall on the boundary and switching the model appropriately. However the need to control the time step probably adds more complexity than it saves (especially for nested components).


WHEN statements have changed Will look next into how the WHEN conditions are handled.

References

  1. Elmegaard and Houbak, 2004, DNA – A General Energy System Simulation Tool, Technical University of Denmark