Ticket #3637: test_exist.mo

File test_exist.mo, 641 bytes (added by Francesco Casella, 9 years ago)

Test model

Line 
1within ;
2model 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);
9equation
10 der(x) = 1 - x;
11algorithm
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")));
22end test_exist;