add lab3 exercises
This commit is contained in:
47
lab3/exercise/ex1.2/lake2.pha
Normal file
47
lab3/exercise/ex1.2/lake2.pha
Normal file
@@ -0,0 +1,47 @@
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user