MIDAS
Loading...
Searching...
No Matches
mscb_fe.cxx
Go to the documentation of this file.
1/********************************************************************\
2
3 Name: mscb_fe.c
4 Created by: Stefan Ritt
5
6 Contents: Example Slow control frontend for the MSCB system
7
8 $Id: sc_fe.c 20457 2012-12-03 09:50:35Z ritt $
9
10\********************************************************************/
11
12#include <stdio.h>
13#include <string.h>
14#include <assert.h>
15#include <math.h>
16#include <pthread.h>
17#include "mscb.h"
18#include "midas.h"
19#include "odbxx.h"
20#include "msystem.h"
21#include "mfe.h"
22#include "mstrlcpy.h"
23#include "class/multi.h"
24#include "class/generic.h"
25#include "device/mscbdev.h"
26#include "device/mscbhvr.h"
27#include "device/mdevice.h"
28#include "device/mdevice_mscb.h"
29
30/*-- Globals -------------------------------------------------------*/
31
32/* The frontend name (client name) as seen by other MIDAS clients */
33const char *frontend_name = "SC Frontend";
34/* The frontend file name, don't change it */
36
37/*-- Equipment list ------------------------------------------------*/
38
40
42 {
43 "Environment", /* equipment name */
44 {10, 0, /* event ID, trigger mask */
45 "SYSTEM", /* event buffer */
46 EQ_SLOW, /* equipment type */
47 0, /* event source */
48 "MIDAS", /* format */
49 TRUE, /* enabled */
50 RO_ALWAYS, 60000, /* read full event every 60 sec */
51 100, /* read one value every 100 msec */
52 0, /* number of sub events */
53 1, /* log history every second */
54 "", "", ""},
55 cd_multi_read, /* readout routine */
56 cd_multi /* class driver main routine */
57 },
58
59 {""}
60};
61
62/*-- Error dispatcher causing communiction alarm -------------------*/
63
64void scfe_error(const char *error) {
65 char str[256];
66
67 mstrlcpy(str, error, sizeof(str));
68 cm_msg(MERROR, "scfe_error", "%s", str);
69 al_trigger_alarm("MSCB", str, "MSCB Alarm", "Communication Problem", AT_INTERNAL);
70}
71
72/*-- Frontend Init -------------------------------------------------*/
73
75 /* set error dispatcher for alarm functionality */
77
78 /* set maximal retry count */
80
81 /*---- set correct ODB device addresses ----*/
82
83 mdevice_mscb envIn("Environment", "Input", DF_INPUT, "mscbxxx.psi.ch");
84 envIn.define_var(1, 0, "Temperature 1", 0.1);
85 envIn.define_var(1, 1, "Temperature 2", 0.1);
86 envIn.define_history_panel("Temperatures", 0, 1);
87
88 mdevice_mscb envOut("Environment", "Output", DF_OUTPUT, "mscbxxx.psi.ch");
89 envOut.define_var(1, 8, "Heat control 1");
90 envOut.define_var(1, 9, "Heat control 2");
91 envIn.define_history_panel("Heat Control", 0, 1);
92
93 return CM_SUCCESS;
94}
INT al_trigger_alarm(const char *alarm_name, const char *alarm_message, const char *default_class, const char *cond_str, INT type)
Definition alarm.cxx:283
#define CM_SUCCESS
Definition midas.h:582
#define MERROR
Definition midas.h:559
#define RO_ALWAYS
Definition midas.h:436
#define EQ_SLOW
Definition midas.h:418
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
Definition midas.cxx:915
void mfe_set_error(void(*dispatcher)(const char *))
Definition mfe.cxx:2404
#define AT_INTERNAL
Definition midas.h:1442
DWORD BOOL
Definition midas.h:105
int INT
Definition midas.h:129
#define DF_OUTPUT
Definition midas.h:1051
#define TRUE
Definition midas.h:182
#define DF_INPUT
Definition midas.h:1050
const char * frontend_file_name
The frontend file name, don't change it.
Definition mscb_fe.cxx:35
INT frontend_init()
Frontend initialization.
Definition mscb_fe.cxx:74
BOOL equipment_common_overwrite
Definition mscb_fe.cxx:39
void scfe_error(const char *error)
Definition mscb_fe.cxx:64
EQUIPMENT equipment[]
Main structure for midas equipment.
Definition mscb_fe.cxx:41
const char * frontend_name
The frontend name (client name) as seen by other MIDAS clients.
Definition mscb_fe.cxx:33
char str[256]
Definition odbhist.cxx:33
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24