1 | within ;
|
---|
2 | model test_exist
|
---|
3 | import Modelica.Utilities.Files.exist;
|
---|
4 | import Modelica.Utilities.Files.removeFile;
|
---|
5 | import Modelica.Utilities.Streams.print;
|
---|
6 | Real x;
|
---|
7 | Integer i;
|
---|
8 | Boolean file_exists(start = false, fixed = true);
|
---|
9 | equation
|
---|
10 | der(x) = 1 - x;
|
---|
11 | algorithm
|
---|
12 | when sample(0,0.7) then
|
---|
13 | print("I think therefore I am", "go.txt");
|
---|
14 | while not file_exists loop
|
---|
15 | file_exists :=exist("go.txt");
|
---|
16 | i := i+1;
|
---|
17 | end while;
|
---|
18 | print("Gone!, time = "+String(time)+", i = "+String(i), "result.txt");
|
---|
19 | removeFile("go.txt");
|
---|
20 | end when;
|
---|
21 | annotation (uses(Modelica(version="3.2.1")));
|
---|
22 | end test_exist;
|
---|