Opened 12 years ago

Closed 12 years ago

#1913 closed defect (fixed)

Initial equation not working correctly

Reported by: julian.wyszynski Owned by: Lennart Ochel
Priority: high Milestone: 1.9.0
Component: Backend Version:
Keywords: Cc:

Description

If you have an equation "a/b" and you set b in the initial equation section, OpenModelica gives the Error "Devision by zero"

You can see the problem in the attached package.

Attachments (1)

InitialEquationError.mo (258 bytes ) - added by julian.wyszynski 12 years ago.

Download all attachments as: .zip

Change History (3)

by julian.wyszynski, 12 years ago

Attachment: InitialEquationError.mo added

comment:1 by anonymous, 12 years ago

Owner: changed from somebody to Lennart Ochel
Status: newassigned

comment:2 by Lennart Ochel, 12 years ago

Resolution: fixed
Status: assignedclosed

Yes, using the old numeric initialization gives this error message:

stdout            | warning | division by zero in partial equation: A[2] / A[1] because A[1] == 0: File: <interactive> Line: 8
stdout            | warning | at Time=0.000000

The reason is quite simple. During the initialization process using the numeric approach all variables starts with their start-values. In your model they are zero (default, because not given). Just provide start-values to fix the issue:

Real A[2](each start=1);

Anyway, you should try to use the (more or less) new initialization (symbolic-approach). This is the default approach since several months. Therewith you will not run into this problem.

Note: See TracTickets for help on using tickets.