Opened 9 years ago

Closed 4 years ago

Last modified 4 years ago

#3637 closed defect (fixed)

Modelica.Utilities.Files.exist doesn't work

Reported by: Francesco Casella Owned by: somebody
Priority: high Milestone: 1.16.0
Component: New Instantiation Version:
Keywords: Cc: stefano.carli@…

Description

The function Modelica.Utilities.Files.exist always returns false.

The attached test model should fill the result.txt file with eleven lines and then terminate. Instead, it hangs at the first call of the Modelica.Utilities.Files.exist function. This happens both under Windows 7 and Linux Ubuntu.

Attachments (1)

test_exist.mo (641 bytes ) - added by Francesco Casella 9 years ago.
Test model

Download all attachments as: .zip

Change History (13)

by Francesco Casella, 9 years ago

Attachment: test_exist.mo added

Test model

comment:1 by Francesco Casella, 9 years ago

The function is pure and and constant, so it is evaluated only once at initialization. It should be marked as impure, but this is not possible in Modelica 3.2.

Anyway, we need to find a workaround until we get to MSL 3.3. See also

https://trac.modelica.org/Modelica/ticket/1886

which seems to have sparked quite a debate...

comment:2 by Francesco Casella, 9 years ago

Can we implement the simple heuristics proposed here?

comment:3 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

comment:4 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:5 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:6 by Martin Sjölund, 8 years ago

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:7 by Francesco Casella, 7 years ago

Milestone: 1.12.01.13.0

Milestone moved to 1.13.0 due to 1.12.0 already being released.

comment:8 by Francesco Casella, 6 years ago

Milestone: 1.13.01.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:9 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:10 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:11 by Per Östlund, 4 years ago

Component: Run-timeNew Instantiation
Milestone: 1.17.01.16.0
Resolution: fixed
Status: newclosed

The new frontend propagates impure between functions, i.e. a function calling an impure function is itself impure. So in this case all of the used functions end up as impure.

I don't know whether that fixes any issue in this case though since I can't replicate the original issue with neither of the frontends, so I guess that issue was fixed at some point.

comment:12 by Francesco Casella, 4 years ago

I confirm that the MWE works as expected. This was originated by an attempt to co-simulate a model with other simulation software, using files as a means of communication, which would have been a crude but effective means to do that.

Now I'd do the same thing using FMI.

Anyway, good that this now works as expected.

Note: See TracTickets for help on using tickets.