Opened 8 years ago

Closed 3 years ago

Last modified 3 years ago

#3637 closed defect (fixed)

Modelica.Utilities.Files.exist doesn't work

Reported by: 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 casella 8 years ago.
Test model

Download all attachments as: .zip

Change History (13)

Changed 8 years ago by casella

Test model

comment:1 Changed 8 years ago by casella

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 Changed 8 years ago by casella

Can we implement the simple heuristics proposed here?

comment:3 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4 to 1.9.5

Milestone pushed to 1.9.5

comment:4 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.5 to 1.10.0

Milestone renamed

comment:5 Changed 7 years ago by sjoelund.se

  • Milestone changed from 1.10.0 to 1.11.0

Ticket retargeted after milestone closed

comment:6 Changed 7 years ago by sjoelund.se

  • Milestone changed from 1.11.0 to 1.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:7 Changed 6 years ago by casella

  • Milestone changed from 1.12.0 to 1.13.0

Milestone moved to 1.13.0 due to 1.12.0 already being released.

comment:8 Changed 5 years ago by casella

  • Milestone changed from 1.13.0 to 1.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:9 Changed 5 years ago by casella

  • Milestone changed from 1.14.0 to 1.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 Changed 3 years ago by casella

  • Milestone changed from 1.16.0 to 1.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:11 Changed 3 years ago by perost

  • Component changed from Run-time to New Instantiation
  • Milestone changed from 1.17.0 to 1.16.0
  • Resolution set to fixed
  • Status changed from new to closed

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 Changed 3 years ago by casella

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.