All pastes #2065044 Raw Edit

Anonymous

public text v1 · immutable
#2065044 ·published 2011-05-19 21:36 UTC
rendered paste body
/*zakladne nastavenie*/
directories
end_directories;

settings
  operation_mode = real_time;
  startup_options
    call_procedures = false;
    activate_receivers = true;
    output_action = set_local;
  end_startup_options;
end_settings;
/*nacitanie driveru pre adam*/
driver
  ADAM4000 {driver = 'adam2.dll'; map_file = 'Adam4000.dmf'; parameter_file = 'Adam4000.par'};
end_driver;
/*programova cast*/
data
/*kanal pre vstupy*/
  channel Vstupy;
    teplota1 : real {driver = ADAM4000; driver_index = 100; direction = input; comment = 'teplota1'}; //1. snimac
    teplota2 : real {driver = ADAM4000; driver_index = 101; direction = input; comment = 'teplota1'}; //2. snimac
  end_channel;
/*kanal pre vystupy*/
  channel Vystupy;
    Ventilator : boolean {driver = ADAM4000; driver_index = 300; direction = output}; //Chladic
    Ziarovka1 : boolean {driver = ADAM4000; driver_index = 301; direction = output}; //1. Spirala
    Ziarovka2 : boolean {driver = ADAM4000; driver_index = 302; direction = output}; //2. Spirala
  end_channel;
/*nastavenie pociatocnej maximalnej teploty (nedolezite, po inicializacii prvku pre jej zadavanie sa prepise)*/
  var
    max_teplota : real {init_value = 55};
  end_var;

end_data;

instrument
/*hlavne okno*/
  panel backpane;
    rem = 'hlavní panel aplikace';
    gui
      owner = background;
      position = 23, 41, 727, 324;
      visibility = false;
      window
        type = normal;
        title = 'ADAM4000_Demo';
        disable = zoom;
      end_window;
    end_gui;

    procedure OnStartup();
    begin
      MoveTo( WorkX + WorkW / 2 - ( 640 + NoZoomWinReduceW ) / 2, WorkY + WorkD / 2 - ( 480 + NoZoomWinReduceD ) / 2 );
      Show();
      Select();
    end_procedure;

  end_panel;
/*vstupne pole pre zadanie maximalnej teploty*/
  control control_6;
    activity
      period = 1;
    end_activity;
    gui
      owner = backpane;
      position = 147, 229, 60, 18;
    end_gui;
    output = max_teplota;
    mode = edit_box;
    init_value = 40; //pociatocna teplota
  end_control;
/*text pre tlacidlo s digitalnym zobrazovadlom teploty 2. snimaca*/
  label label_5;
    gui
      owner = backpane;
      position = 162, 194;
      window
        disable = zoom, maximize;
      end_window;
    end_gui;
    text_list
      text = 'Teplota2';
    end_text_list;
  end_label;
/*text pre tlacidlo s digitalnym zobrazovadlom teploty 1. snimaca*/
  label label_4;
    gui
      owner = backpane;
      position = 142, 144;
      window
        disable = zoom, maximize;
      end_window;
    end_gui;
    text_list
      text = 'Teplota1';
    end_text_list;
  end_label;
/*digitalny merak teploty 1. snimaca*/
  meter meter_3;
    activity
      period = 1;
    end_activity;
    gui
      owner = backpane;
      position = 82, 104, 135, 35;
    end_gui;
    expression = Vstupy.teplota1;
    mode = digital;
    colors
      paper = black;
    end_colors;
  end_meter;
/*digitalny merak teploty 2. snimaca*/
  meter meter_2;
    activity
      period = 1;
    end_activity;
    gui
      owner = backpane;
      position = 92, 164, 125, 30;
    end_gui;
    expression = Vstupy.teplota2;
    mode = digital;
    colors
      paper = black;
    end_colors;
  end_meter;
/*graf*/
  chart chart_1;
    activity
      period = 1;
    end_activity;
    gui
      owner = backpane;
      position = 237, 134, 325, 120;
    end_gui;
    item
      expression = Vstupy.teplota1;
    end_item;
    item
      expression = Vstupy.teplota2;
      color = lyellow;
    end_item;
    colors
      paper = black;
      low_limit = lblue;
    end_colors;
/* pri kazdej obnove grafu skontroluje ci teplota nepresiahla limit */
    procedure OnActivate();
    begin
         if (Vstupy.teplota1>max_teplota) or (Vstupy.teplota2>max_teplota) then //ak jedna z teplot presiahla limit aktivuje chladic a deaktivuje spiraly
         Vystupy.Ventilator=true;
         Vystupy.Ziarovka1=false;
         Vystupy.Ziarovka2=false;
         end
    end_procedure;

  end_chart;
/*text pre input s max. teplotou*/
  label label_2;
    gui
      owner = backpane;
      position = 142, 209;
      window
        disable = zoom, maximize;
      end_window;
    end_gui;
    text_list
      font = 'Tahoma (Central European)', 8, bold;
      text = 'Max. teplota';
    end_text_list;
  end_label;
/*text pre tlacidlo s nudzovou stopkou*/
  label label_2;
    gui
      owner = backpane;
      position = 487, 54;
      window
        disable = zoom, maximize;
      end_window;
    end_gui;
    text_list
      font = 'Tahoma (Central European)', 8, bold;
      text = 'STOP';
    end_text_list;
  end_label;
/*text pre tlacidlo na zapnutie 2. spiraly*/
  label label_2;
    gui
      owner = backpane;
      position = 397, 54;
      window
        disable = zoom, maximize;
      end_window;
    end_gui;
    text_list
      font = 'Tahoma (Central European)', 8, bold;
      text = 'Špirála 2';
    end_text_list;
  end_label;
/*text pre tlacidlo na zapnutie 1. spiraly*/
  label label_2;
    gui
      owner = backpane;
      position = 332, 54;
      window
        disable = zoom, maximize;
      end_window;
    end_gui;
    text_list
      font = 'Tahoma (Central European)', 8, bold;
      text = 'Špirála 1';
    end_text_list;
  end_label;
/*nudzove STOP tlacidlo*/
  gl_button gl_button_11;
    gui
      owner = backpane;
      position = 477, 9, 50, 40;
    end_gui;
    material
      item
        name = 'false_body';
        ambient = 1.000, 0.000, 0.000, 1.000;
        diffuse = 1.000, 1.000, 1.000, 1.000;
        specular = 1.000, 1.000, 1.000, 1.000;
        emissive = 0.000, 0.000, 0.000, 1.000;
        shininess = 0.508;
        image_format = rgb;
        texture_filter = linear;
        blending_mode = all_components;
        transparency_gamma = 1.000;
        glow = false;
      end_item;
    end_material;

    procedure OnActivate();
    begin
    Vystupy.Ziarovka1=false;
    Vystupy.Ziarovka2=false;
    Vystupy.Ventilator=false;
    end_procedure;
/*po klepnuti na tlacidlo vsetky zariadenia vypne*/
    procedure OnMouseClick( LeftButton, MiddleButton, RightButton : boolean );
    begin
    Vystupy.Ziarovka1=false;
    Vystupy.Ziarovka2=false;
    Vystupy.Ventilator=false;
    end_procedure;

  end_gl_button;
/*tlacidlo pre aktivovanie 2. spiraly*/
  gl_led gl_led_9;
    activity
      period = 0;
    end_activity;
    gui
      owner = backpane;
      position = 407, 74, 40, 40;
    end_gui;
    material
      item
        name = 'led_on';
        ambient = 1.000, 0.900, 0.700, 1.000;
        diffuse = 1.000, 0.500, 0.500, 1.000;
        specular = 0.000, 0.000, 0.000, 1.000;
        emissive = 0.000, 0.000, 0.000, 1.000;
        shininess = 0.508;
        image_format = rgb;
        texture_filter = linear;
        blending_mode = all_components;
        transparency_gamma = 1.000;
        glow = false;
      end_item;
    end_material;
    expression = Vystupy.Ziarovka2;
  end_gl_led;
/*indikator aktivity 1. spiraly*/
  gl_led gl_led_8;
    activity
      period = 0;
    end_activity;
    gui
      owner = backpane;
      position = 342, 74, 40, 40;
    end_gui;
    expression = Vystupy.Ziarovka1;
  end_gl_led;
/*indikator aktivity chladica*/
  engine engine;
    activity
      period = 0;
    end_activity;
    gui
      owner = backpane;
      position = 247, 74, 45, 45;
    end_gui;
    expression = Vystupy.Ventilator;
  end_engine;
/*indikator aktivity 2. spiraly*/
  gl_button btnZiarovka1;
    gui
      owner = backpane;
      position = 402, 9, 40, 40;
    end_gui;
    output = Vystupy.Ziarovka2;
  end_gl_button;
/*tlacidlo pre aktivovanie 1. spiraly*/
  gl_button btnZiarovka1;
    gui
      owner = backpane;
      position = 337, 9, 40, 40;
    end_gui;
    output = Vystupy.Ziarovka1;
  end_gl_button;
/*tlacidlo pre aktivovanie chladica*/
  gl_button btnVentilator;
    rem = 'kihkjh';
    gui
      owner = backpane;
      position = 237, 9, 65, 40;
      window
        title = 'Ventilátor';
      end_window;
    end_gui;
    output = Vystupy.Ventilator;
  end_gl_button;
/*text pre tlacidlo na zapnutie chladica*/
  label label_2;
    gui
      owner = backpane;
      position = 247, 54;
      window
        disable = zoom, maximize;
      end_window;
    end_gui;
    text_list
      font = 'Tahoma (Central European)', 8, bold;
      text = 'Chladič';
    end_text_list;
  end_label;

end_instrument;