Graphical User Interface GUI
Interfargos home window
This section will show how to create an HMI using graphical programming tool "Interfargos" This application is based on FLTK Fluid, and is being rewritten to be used as a programming interface and SCADA configuration for the Argos. The variable components to animate graphics are those that were configured in the previous sections, through XML files.
Start the application Interfargos
#> Interfargos
The image shows that the tool has:
Menu options.
Palettes controls or components, one with basic elements and the other controls which can represent argos information from acquisition systems.
Edit window, which displays the source code generated by the application and which will then be compiled to show the HMI runtime.
Creating a Window:
Function / Method
Select from the menu -> New -> Code -> Function / Method, (menú -> Nuevo -> Código -> Función / Métodoa) window in which you must remove the text for the application to generate automatically the main function to be executed, if you place the name of a function code primary function will not be generated, thus may be used as a module to link to another application.
Add a new type Arg_Window window, this has all the basic features of a window, but also properties are added that allow the connection to the data acquisition services, the Arg_Window is selected through the Control palette or argos menu -> New -> Argos -> Arg_Window, (menú -> Nuevo -> Argos -> Arg_Window) this window will serve as a container for all other controls whether basic or argos components.
Resize the window to size and access the properties by double clicking on the Arg_Window, the properties window shows all the attributes of the object can be modified.
In the animation tab of properties window (fields tags and alarms) must indicate the name of the database of real-time tag and alarms that have previously been defined in the data acquisition services, with which the Arg_Window establish the necessary references.
To place a background image that needs to be animated, you can use a Box-type component in the menu -> New -> Other -> Box, (menú -> Nuevo -> Otros -> Box) then click the Properties -> visual (propiedades -> visual) image in the field is written the directory and file name to be loaded
Arg_Window
Add a Arg_Label to display the value of a process variable
Select from the menu -> New -> Argos -> Arg_Label (menú -> Nuevo -> Argos -> Arg_Label)
Open the properties window of the component and choose
Animation tab update frequency Arg_Label (Slow, Normal, Fast)
Assign the expression to evaluate the component to generate the value to be deployed for example: $ganch_aux_Freno_Mecanico_Elev + 15,, where the $ symbol indicates that it refers to a tag system, which must be registered in the acquisition system.
After adding all the components necessary to complete the HMI, you must tell Interfargos that generates the source code of the application, and then to compile it.
Select from the menu -> File -> Write Code (menú -> Archivo -> Escribir Código)
Assign a name for the source file, eg miPrimerHMI
This will generate two files miPrimerHMI.h miPrimerHMI.cxx and must be compiled with GNU / GCC
miPrimerHMI.h
#ifndef miPrimerHMI_h
#define miPrimerHMI_h
#include <FL/Fl.H>
#include "Arg_Window.h"
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Box.H>
#include "Arg_Label.h"
#include "Arg_Image.h"
using namespace infarg;
#endif
miPrimerHMI.cxx
#include "miPrimerHMI.h"
#include <FL/Fl_Image.H>
static unsigned char idata_compresor[] = { ........ };
static Fl_RGB_Image image_compresor(idata_compresor, 800, 600, 3, 0);
int main(int argc, char **argv) {
Fl_Double_Window* w;
fl_register_images();
{ Fl_Double_Window* o = new Arg_Window(810, 605, "escaner/tags","escaner/alarmas");
w = o;
{ Fl_Box* o = new Fl_Box(5, 0, 805, 600);
o->image(image_compresor);
} // Fl_Box* o
{ Arg_Label* o = new Arg_Label(545, 60, 170, 80, "Temperatura");
o->color(FL_FOREGROUND_COLOR);
o->labelsize(20);
o->labelcolor(FL_BACKGROUND2_COLOR);
o->align(FL_ALIGN_TOP_LEFT);
((Arg_Label *)o)->asignar_expresion("$ganch_aux_Freno_Mecanico_Elev + 15");
((Arg_Window *)o->window())->registrar_timer_lento( (Arg_Label *)(o) );
} // Arg_Label* o
o->end();
} // Fl_Double_Window* o
w->show(argc, argv);
return Fl::run();
}
To compile the application generated by Interfargos
#> g++ miPrimerHMI.cxx -I /usr/include/muParser/ -I /usr/include/FL -Os -Wall -Wunused -Wno-format-y2k
-fexceptions -fno-strict-aliasing -I /usr/local/include/argos -lfltk -lfltk_images -las-interfargos
-las-thtag -las-thalarma -lmuparser -lrt -L /usr/local/lib/ -o miPrimerHMI
Arg_Label
If compilation is without problems, you can run the HMI
#>. / MiPrimerHMI