#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)
Change History (13)
by , 9 years ago
Attachment: | test_exist.mo added |
---|
comment:1 by , 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:6 by , 8 years ago
Milestone: | 1.11.0 → 1.12.0 |
---|
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:7 by , 7 years ago
Milestone: | 1.12.0 → 1.13.0 |
---|
Milestone moved to 1.13.0 due to 1.12.0 already being released.
comment:9 by , 5 years ago
Milestone: | 1.14.0 → 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:11 by , 4 years ago
Component: | Run-time → New Instantiation |
---|---|
Milestone: | 1.17.0 → 1.16.0 |
Resolution: | → fixed |
Status: | new → 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 by , 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.
Test model