Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with Ada.Real_Time; use Ada.Real_Time;
- with System; use System;
- with baseDatos; use baseDatos;
- with Control; use Control;
- with Datos; use Datos;
- with Ada.Float_Text_IO; use Ada.Float_Text_IO;
- with Ada.Text_IO; use Ada.Text_IO;
- with STR_Tasking; use STR_Tasking;
- procedure instalacionPrioridad is
- T : Time; -- Controlar el tiempo
- ST1: Temperatura := 60.00;
- ST2: Temperatura := 85.00;
- SC1: Caudal := 0.00;
- SC2: Caudal := 0.00;
- SD1: Caudal := 25.00;
- A : System.Priority := 3;
- B : System.Priority := 2;
- C : System.Priority := 1;
- -- Definimos la tarea de la pantalla
- task Pantalla is
- entry Mostrar(C:Caudal);
- entry Mostrar(T:Temperatura);
- entry Mostrar(R:Radiacion);
- end Pantalla;
- task body Pantalla is
- begin
- loop
- select
- accept Mostrar(C:Caudal) do
- Put_Line("El valor del caudal es: "&Float(C)'Img);
- end Mostrar;
- or
- accept Mostrar(T:Temperatura) do
- Put_Line("El valor de la temperatura es: "&Float(T)'Img);
- end Mostrar;
- or
- accept Mostrar(R:Radiacion) do
- Put_Line("El valor de la radiacion es: "&Integer(R)'Img);
- end Mostrar;
- end select;
- end loop;
- end Pantalla;
- -- Definimos la tarea del sistema de seguridad
- task seguridad is
- pragma Priority(A);
- end seguridad;
- task body seguridad is
- SC1, SC2 : Caudal;
- ST2 : Temperatura;
- Periodo : Time_Span := Milliseconds(50); -- Definimos el periodo
- begin
- T := Clock;
- loop
- T := T + Periodo;
- Delay until (T);
- -- Tiempo_Computo(tmin => 0, tmax => 20, id=>1);
- baseDatos.recursoCompartido.LecturaT(ST2);
- SistemaSeguridad(ST2, SC1, SC2);
- if (SC1 = 0.00) then
- baseDatos.recursoCompartido.EscrituraC(SC1);
- Pantalla.Mostrar(SC1);
- elsif (SC2 = 0.00) then
- baseDatos.recursoCompartido.EscrituraC(SC2);
- Pantalla.Mostrar(SC2);
- end if;
- end loop;
- end seguridad;
- -- Definimos la tarea del campo solar
- task campoSolar is
- pragma Priority(B);
- end campoSolar;
- task body campoSolar is
- ST2 : Temperatura;
- SC1 : Caudal;
- Periodo : Time_Span := Milliseconds(100);-- Definimos el periodo
- begin
- T := Clock;
- loop
- T := T + Periodo;
- Delay until (T);
- -- Tiempo_Computo(tmin => 0, tmax => 10, id=>2);
- baseDatos.recursoCompartido.LecturaT(ST2);
- ControlST2(ST2, SC1);
- baseDatos.recursoCompartido.EscrituraC(SC1);
- Pantalla.Mostrar(SC1);
- end loop;
- end campoSolar;
- -- Definimos la tarea del campo solar
- task moduloMD is
- pragma Priority(C);
- end moduloMD;
- task body moduloMD is
- SD1 : Radiacion;
- SC2 : Caudal;
- Periodo : Time_Span := Milliseconds(200);-- Definimos el periodo
- begin
- T := Clock;
- loop
- T := T + Periodo;
- Delay until (T);
- -- Tiempo_Computo(tmin => 0, tmax => 10, id=>3);
- baseDatos.recursoCompartido.LecturaR(SD1);
- ControlSD1(SD1, SC2);
- baseDatos.recursoCompartido.EscrituraC(SC2);
- Pantalla.Mostrar(SC2);
- end loop;
- end moduloMD;
- begin
- null;
- end instalacionPrioridad;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement