DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦77ba4c116⟧ Ada Source

    Length: 15360 (0x3c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Qualit_Environement_3, package body Qualit_Visual_System, seg_04c99b

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



with Slot;
with Qualit_Generic_Agent_3;
with System_Utilities;
with Time_Utilities;


package body Qualit_Environement_3 is

    use Slot;

    type The_Agent_Ids is (Agent1, Agent2);


    package Qualit_Visual_System is
        procedure Set_Position (The_Agent     : The_Agent_Ids;
                                The_Pos_Value : Slot.Object);
        function  Get_Position (The_Agent : The_Agent_Ids) return Slot.Object;  
        procedure Set_Position_Variation
                     (The_Agent : The_Agent_Ids; The_Variation : Slot.Object);
        procedure Terminated   (The_Agent : The_Agent_Ids);  
    end Qualit_Visual_System;


    package The_First_Agent is
       new Qualit_Generic_Agent_3
              (Agent_Ids              => The_Agent_Ids,
               Inc_Max                => Value (4), --cm/s
               Inc_Min                => Value (1),
               Dec_Max                => Value (4),
               Dec_Min                => Value (1),
               Max_Up_Value           => Value (20),
               Max_Down_Value         => Value (20),  
               Agent_Id               => Agent1,
               The_Other_Agent        => Agent2,
               Set_Position           => Qualit_Visual_System.Set_Position,
               Get_Position           => Qualit_Visual_System.Get_Position,
               Set_Position_Variation =>
                  Qualit_Visual_System.Set_Position_Variation,
               Job_Terminated         => Qualit_Visual_System.Terminated);

    package The_Second_Agent is
       new Qualit_Generic_Agent_3
              (Agent_Ids              => The_Agent_Ids,
               Inc_Max                => Value (2), -- cm/s
               Inc_Min                => Value (1),
               Dec_Max                => Value (2),
               Dec_Min                => Value (1),
               Max_Up_Value           => Value (15),
               Max_Down_Value         => Value (15),  
               Agent_Id               => Agent2,
               The_Other_Agent        => Agent1,
               Set_Position           => Qualit_Visual_System.Set_Position,
               Get_Position           => Qualit_Visual_System.Get_Position,
               Set_Position_Variation =>
                  Qualit_Visual_System.Set_Position_Variation,
               Job_Terminated         => Qualit_Visual_System.Terminated);



    package body Qualit_Visual_System is

        type Status is (Working, Terminated);

        Agent_Positions : array (The_Agent_Ids) of Slot.Object :=
           (others => Slot.Value (0));
        The_Pos_Variations : array (The_Agent_Ids) of Slot.Object :=
           (others => Slot.Value (1));
        Agent_Status : array (The_Agent_Ids) of Status := (others => Working);


        task Visual_System is  
            entry Set_Pos           (The_Agent_Id : The_Agent_Ids;
                                     The_Position : Slot.Object);  
            entry Get_Pos           (The_Agent_Id :     The_Agent_Ids;
                                     The_Position : out Slot.Object);
            entry Set_Pos_Variation (The_Agent_Id  : The_Agent_Ids;
                                     The_Variation : Slot.Object);
            entry Terminated        (The_Agent_Id : The_Agent_Ids);
        end Visual_System;



        procedure Update_Agent_Positions (The_Time : in out Duration) is  
            use Slot.Operators;
            Delta_Time   : Slot.Object;
            Current_Time : Duration;
            The_Interval : Time_Utilities.Interval;
            Int_Time     : Integer;
        begin  
            Current_Time := System_Utilities.Elapsed;
            The_Interval := Time_Utilities.Convert (Current_Time - The_Time);
            Int_Time     := Integer (The_Interval.Elapsed_Seconds);

            -- if delta_time is less than one second then time should not be modified
            if Int_Time > 0 then  
                Delta_Time := Slot.Value (Int_Time);  
                The_Time   := Current_Time;

                for The_Id in The_Agent_Ids'First .. The_Agent_Ids'Last loop  
                    Agent_Positions (The_Id) :=
                       Agent_Positions (The_Id) +
                          (The_Pos_Variations (The_Id) * (Delta_Time));  
                end loop;
            end if;
        end Update_Agent_Positions;


        function All_Agents_Terminated return Boolean is
            No_Agent_Working : Boolean := True;
            Id               : The_Agent_Ids;
        begin
            Id := The_Agent_Ids'First;  
            while (No_Agent_Working) loop
                if Agent_Status (Id) /= Terminated then
                    No_Agent_Working := False;
                end if;
                exit when Id = The_Agent_Ids'Last;
                Id := The_Agent_Ids'Succ (Id);
            end loop;
            return No_Agent_Working;
        end All_Agents_Terminated;


        task body Visual_System is
            use Slot;  
            The_Id           : The_Agent_Ids;
            The_Pos, The_Var : Slot.Object;
            Done             : Boolean := False;
            Time             : Duration;

        begin  
            The_Var := Null_Object;  
            Time    := System_Utilities.Elapsed;
            while (not Done) loop  
                select
                    accept Set_Pos (The_Agent_Id : The_Agent_Ids;
                                    The_Position : Slot.Object) do
                        Agent_Positions (The_Agent_Id) := The_Position;
                    end Set_Pos;

                or
                    accept Get_Pos (The_Agent_Id :     The_Agent_Ids;
                                    The_Position : out Slot.Object) do
                        The_Position := Agent_Positions (The_Agent_Id);
                    end Get_Pos;
                or
                    accept  
                       Set_Pos_Variation (The_Agent_Id  : The_Agent_Ids;
                                          The_Variation : Slot.Object) do
                        The_Id  := The_Agent_Id;
                        The_Var := The_Variation;
                    end Set_Pos_Variation;  
                    The_Pos_Variations (The_Id) := The_Var;
                or
                    accept Terminated (The_Agent_Id : The_Agent_Ids) do
                        The_Id := The_Agent_Id;
                    end Terminated;
                    Agent_Status (The_Id) := Terminated;

                    if All_Agents_Terminated then
                        Done := True;
                        The_First_Agent.Stop;
                        The_Second_Agent.Stop;
                    end if;
                else
                    Update_Agent_Positions (Time);
                end select;
            end loop;
        end Visual_System;



        procedure Set_Position (The_Agent     : The_Agent_Ids;
                                The_Pos_Value : Slot.Object) is
        begin
            Visual_System.Set_Pos (The_Agent, The_Pos_Value);
        end Set_Position;


        function Get_Position (The_Agent : The_Agent_Ids) return Slot.Object is
            The_Pos : Slot.Object;
        begin
            Visual_System.Get_Pos (The_Agent, The_Pos);  
            return The_Pos;
        end Get_Position;


        procedure Set_Position_Variation
                     (The_Agent : The_Agent_Ids; The_Variation : Slot.Object) is
        begin
            Visual_System.Set_Pos_Variation (The_Agent, The_Variation);
        end Set_Position_Variation;


        procedure Terminated (The_Agent : The_Agent_Ids) is
        begin
            Visual_System.Terminated (The_Agent);
        end Terminated;

    end Qualit_Visual_System;




    procedure Go (Position_To_Reach : Integer) is
    begin
        The_First_Agent.Go (Position_To_Reach);
        The_Second_Agent.Go (Position_To_Reach);
    end Go;


end Qualit_Environement_3;

E3 Meta Data

    nblk1=e
    nid=e
    hdr6=16
        [0x00] rec0=1f rec1=00 rec2=01 rec3=03c
        [0x01] rec0=13 rec1=00 rec2=04 rec3=038
        [0x02] rec0=18 rec1=00 rec2=05 rec3=038
        [0x03] rec0=0e rec1=00 rec2=09 rec3=03a
        [0x04] rec0=17 rec1=00 rec2=07 rec3=044
        [0x05] rec0=0a rec1=00 rec2=0d rec3=040
        [0x06] rec0=1a rec1=00 rec2=03 rec3=022
        [0x07] rec0=01 rec1=00 rec2=06 rec3=038
        [0x08] rec0=1a rec1=00 rec2=0c rec3=02c
        [0x09] rec0=22 rec1=00 rec2=08 rec3=010
        [0x0a] rec0=06 rec1=00 rec2=02 rec3=000
        [0x0b] rec0=21 rec1=00 rec2=02 rec3=000
        [0x0c] rec0=05 rec1=00 rec2=08 rec3=000
        [0x0d] rec0=05 rec1=00 rec2=08 rec3=000
    tail 0x21753833e870d6bff5190 0x42a00088462063c03
Free Block Chain:
  0xe: 0000  00 0a 00 19 80 01 74 01 00 12 20 20 20 20 20 20  ┆      t         ┆
  0xa: 0000  00 0b 00 04 80 01 20 01 00 23 20 20 20 20 20 20  ┆         #      ┆
  0xb: 0000  00 00 00 31 80 0a 4f 62 6a 65 63 74 29 20 64 6f  ┆   1  Object) do┆