3 -- Grant of Unlimited Rights
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7 -- unlimited rights in the software and documentation contained herein.
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
9 -- this public release, the Government intends to confer upon all
10 -- recipients unlimited rights equal to those held by the Government.
11 -- These rights include rights to use, duplicate, release or disclose the
12 -- released technical data and computer software in whole or in part, in
13 -- any manner and for any purpose whatsoever, and to have or permit others
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
27 -- Check that the abortable part of an asynchronous select statement is
28 -- aborted if it does not complete before the triggering statement
29 -- completes, where the triggering statement is a call on a protected
30 -- entry which is queued.
33 -- A fraction of in-line code is simulated. A voltage deficiency causes
34 -- the routine to seek an alternate best-cost route on an electrical grid
37 -- An asynchronous select is used with the triggering alternative being a
38 -- call to a protected entry with a barrier. The abortable part is a
39 -- routine simulating the lengthy alternate path negotiation. The entry
40 -- barrier would be cleared if the voltage deficiency is rectified before
41 -- the alternate can be found thus nullifying the need for the alternate.
43 -- The test simulates a return to normal in the middle of the
44 -- negotiation. The barrier is cleared, the triggering alternative
45 -- completes first and the abortable part should be aborted.
49 -- 06 Dec 94 SAIC ACVC 2.0
59 subtype Grid_Path
is string(1..21);
60 subtype Deficiency
is integer range 100..1_000
; -- in MWh
63 Dummy_Deficiency
: Deficiency
:= 520;
64 Path_Available
: Boolean := false;
66 TC_Terminate_Negotiation_Executed
: Boolean := false;
67 TC_Trigger_Completed
: Boolean := false;
68 TC_Negotiation_Completed
: Boolean := false;
70 protected Local_Deficit
is
71 procedure Set_Good_Voltage
;
72 procedure Bad_Voltage
;
73 entry Terminate_Negotiation
;
75 Good_Voltage
: Boolean := false; -- barrier
78 protected body Local_Deficit
is
80 procedure Set_Good_Voltage
is
85 procedure Bad_Voltage
is
87 Good_Voltage
:= false;
90 -- Trigger is queued on this entry with barrier condition
91 entry Terminate_Negotiation
when Good_Voltage
is
93 -- complete the triggering call thus terminating grid_path
95 null; --::: stub - signal main board
96 TC_Terminate_Negotiation_Executed
:= true; -- show path traversal
97 end Terminate_Negotiation
;
102 -- Routine to find the most cost effective grid path for this
103 -- particular deficiency at this particular time
105 procedure Path_Negotiation
(Requirement
: in Deficiency
;
106 Best_Path
: out Grid_Path
) is
108 Dummy_Path
: Grid_Path
:= "NYC.425_NY.227_NH.132";
109 Match
: Deficiency
:= Report
.Ident_Int
(Requirement
);
115 -- Simulate a lengthy path negotiation
117 delay ImpDef
.Minimum_Task_Switch
;
118 -- Part of the way through the negotiation simulate some external
119 -- event returning the voltage to acceptable level
121 Local_Deficit
.Set_Good_Voltage
; -- clear the barrier
125 Best_Path
:= Dummy_Path
;
126 TC_Negotiation_Completed
:= true;
128 end Path_Negotiation
;
134 Report
.Test
("C974012", "Asynchronous Select: Trigger is queued on a " &
135 "protected entry and completes before the " &
138 -- ::::::::: Fragment of code
140 Local_Deficit
.Bad_Voltage
; -- Set barrier condition
142 -- For the given voltage deficiency start negotiating the best grid
143 -- path. If voltage returns to acceptable level cancel the negotiation
146 -- Prepare to terminate the Path_Negotiation if voltage improves
147 Local_Deficit
.Terminate_Negotiation
;
148 TC_Trigger_Completed
:= true;
150 Path_Negotiation
(Dummy_Deficiency
, New_Path
) ;
151 Path_Available
:= true;
155 if not TC_Terminate_Negotiation_Executed
or else not
156 TC_Trigger_Completed
then
157 Report
.Failed
("Unexpected test path taken");
160 if Path_Available
or else TC_Negotiation_Completed
then
161 Report
.Failed
("Abortable part was not aborted");