Files
Mariano Sciacco 09fec19232 add lab3 exercises
2021-12-22 16:19:50 +01:00

47 lines
937 B
Plaintext

r_in_r := 30;
r_in_d := 10;
r_out := 15.7;
automaton lake
contr_var: x, t, c;
synclabs: lakelab;
loc dry:
while x >= 0 & c <= 0.75 wait
{ 0.7 * r_in_d - r_out <= x' <= r_in_d - r_out & t' == 1 & c' == 1}
when (c >= 0.75) sync lakelab goto rain;
loc rain:
while x >= 0 & c <= 1 wait
{ 0.7 * r_in_r - r_out <= x' <= r_in_r - r_out & t' == 1 & c' == 1}
when (c >= 1) sync lakelab do {c' == 0 & t' == t & x' == x} goto dry;
initially: dry & x == 25.7 & t == 0 & c == 0;
end
// Compute the reachable set
//
region=lake.reachable;
//
// Output to file
region.print("lake2_regions.txt", 0);
region.project_to(t, x);
region.print("lake2.txt", 2);
// Safety verification
forbidden = lake.{$ & x < 0};
reach_set = lake.is_reachable(forbidden);
reach_set.intersection_assign(forbidden);
echo "The intersection between the reachable set and the bad region is:";
reach_set.is_empty;