Opened 9 years ago

Last modified 3 years ago

#3851 assigned defect

optimized zero crossings for cpp runtime

Reported by: Niklas Worschech Owned by: Willi Braun
Priority: high Milestone:
Component: Backend Version:
Keywords: zerocrossings, cpp runtime Cc: Volker Waurich, Lennart Ochel

Description

Thus the cpp runtime can use the optimized zero crossings, that are zero crossings which could arise from combined relations like

((h)<=0)&&(v<=0))

additional information in the backend is needed.
At the moment all relations have an index in the backend which is used in the cpp code generation to replace the relations with condition variables

if(h<=0) 

is replaced with

if(condition_[index]) 

To use the optimized zero crossings, expressions for lbinary and lunary also needs this index to replace e.g

if(h<=0 && v<=0)

with

if(condition_[index]) 

during code generation

Change History (13)

comment:1 by Lennart Ochel, 9 years ago

I guess it's the same for the c runtime. I see no good reason to handle zero-crossings different for both runtime systems.

comment:2 by Niklas Worschech, 9 years ago

The c runtime does not replace the relations in equations like the cpp runtime. Because of this the c runtime does not need this index.

comment:3 by Lennart Ochel, 9 years ago

Well, I still see no reason to generate different data structures depending on the selected runtime system at this point. We should have a discussion about the preferable approach and use it for both (all) runtime systems.

comment:4 by Niklas Worschech, 9 years ago

This is a simplified description of the cpp runtime approach for zero detection zero search and event handling.
If the solver detects a zero crossing the zero search method will start for the corresponding zero function. If the root of the zero function was found the condition is set to the value of the corresponding relation and the event iteration starts to handle all active events which conditions are true.
The system evaluation in each step only checks a condition it don't checks the relation. This is the case if the system is in a continuous mode.
During event iteration the system is in discrete mode which means the relations also are checked. The event iteration stops if no discrete variable and condition has changed.
Therefore we need the index for all relations, to replace the relations in the equations with condition variables.

comment:5 by Willi Braun, 8 years ago

Milestone: Future1.12.0
Status: newassigned

Yes, we have to encapsulate all zero crossings, to have more control on them, and be able to change them directly and use them also as inputs to algebraic system and also to jacobians. This is would also fix #2433 #2618 and #4254.

comment:6 by Lennart Ochel, 8 years ago

Cc: Lennart Ochel added

comment:7 by Francesco Casella, 7 years ago

Milestone: 1.12.0Future

The milestone of this ticket has been reassigned to "Future".

If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.

If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".

In both cases, a short informative comment would be welcome.

comment:8 by Christoph Buchner <buchner@…>, 7 years ago

Milestone: Future1.13.0

Since this seems connected (https://trac.openmodelica.org/OpenModelica/ticket/4254#comment:9) to #4254, it seems proper to put it on the same milestone.

comment:9 by Francesco Casella, 6 years ago

Milestone: 1.13.01.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:10 by Francesco Casella, 5 years ago

Milestone: 1.14.01.16.0

Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0

comment:11 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:12 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:13 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.