mhttpd task

previous.gif Utilities - Top - Data format next.gif

mhttpd is the Midas Web Server. It provides Midas DAQ control through the web using any web browser.

This daemon application has to run in order to allow the user to access from a Web browser any Midas experiment running on a given host. Full monitoring and "Almost" full control of a particular experiment can be achieved through this Midas Web server. The color coding is green for present/enabled, red for missing/disabled, yellow for inactive. It is important to note the refresh of the page is not "event driven" but is controlled by a timer (see Config- button). This mean the information at any given time may reflect the experiment state of up to n second in the paste, where n is the timer setting of the refresh parameter. Its basic functionality are:

Each section is further described below:


mhttpd requires as argument the TCP/IP port number in order to listen to the web based request.

-[Experiment/Date] Current Experiment, current date.

-[Action/Pages buttons] Run control button, Page switch button. At any web page level within the Midas Web page the main status page can be invoked with the <status> button.

[Version >= 1.8.3 Alias Hyperlink] This line will be present on the status page only if the ODB tree /Alias. The distinction for spawning a secondary frame with the link request is done by default. For forcing the link in the current frame, add the terminal charater "&" at the end of the link name.

Midas Web server
mhttp01.gif


Start page

Once the Start button is pressed, you will be prompt for experiment specific parameters before starting the run. The minimum set of parameter is the run number, it will be incremented by one relative to the last value from the status page. In the case you have defined the ODB tree /Experiment/Edit on Start all the parameters sitting in this directory will be displayed for possible modification. The Ok button will proceed to the start of the run. The Cancel will abort the start procedure and return you to the status page.

Start run request page. In this case the user has multiple run parameters defined under "/Experiment/Edit on Start"
mhstart.gif

The title of each field is taken from the ODB key name it self. In the case this label has a poor meaning and extra explanation is required, you can do so by creating a new ODB tree under experiment Parameter Comments/ . Then by creating a string entry named as the one in Edit on Start- you can place the extra information relative to that key (html tags accepted).

This "parameter comment" option is available and visible ONLY under the midas web page, the odbedit start command will not display this extra information.

[local:midas:S]/Experiment>ls -lr
Key name                        Type   #Val  Size  Last Opn Mode Value
---------------------------------------------------------------------------
Experiment                      DIR
    Name                        STRING  1     32    17s  0   RWD  midas
    Edit on Start               DIR
        Write data              BOOL    1     4     16m  0   RWD  y
        enable                  BOOL    1     4     16m  0   RWD  n
        nchannels               INT     1     4     16m  0   RWD  0
        dwelling time (ns)      INT     1     4     16m  0   RWD  0
    Parameter Comments          DIR
        Write Data              STRING  1     64    44m  0   RWD  Enable logging
        enable                  STRING  1     64    7m   0   RWD  Scaler for expt B1 only
        nchannels               STRING  1     64    14m  0   RWD  <i>maximum 1024</i>
        dwelling time (ns)      STRING  1     64    8m   0   RWD  <b>Check hardware now</b>

[local:midas:S]Edit on Start>ls -l
Key name                        Type   #Val  Size  Last Opn Mode Value
---------------------------------------------------------------------------
Write Data                      LINK    1     19    50m  0   RWD  /logger/Write data
enable                          LINK    1     12    22m  0   RWD  /sis/enable
number of channels              LINK    1     15    22m  0   RWD  /sis/nchannels
dwelling time (ns)              LINK    1     24    12m  0   RWD  /sis/dwelling time (ns)

Start run request page. Extra comment on the run condition is displayed below each entry.
mhstart2.gif


ODB page

The ODB page shows the ODB root tree at first. Clicking on the hyperlink will walk you to the requested ODB field. The Example below show the sequence for changing the variable "PA" under the /equipment/PA/Settings/Channels ODB directory. A possible shortcut

If the ODB is Write protected, a first window will request the web password.

ODB page access.
mhedit.gif


Equipment page

The equipment names are linked to their respective /Variables sub-tree. This permit to access as a shortcut the current values of the equipment. In the case the equipment is a slow control equipment, the parameters list may be hyperlinked for parameter modification. This option is possible only if the parameter names have a particular name syntax (see History system).

Slow control page.
mhsc.gif


CNAF page

If one of the active equipment is a CAMAC based data collector, it will be possible to remotely access CAMAC through this web based CAMAC page. The status of the connection is displayed in the top right hand side corner of the window.

CAMAC command pages.
mhcnaf.gif


Message page

This page display by block of 100 lines the content of the Midas System log file starting with the most recent messages. The Midas log file resides in the directory defined by the experiment.

Message page.
mhmes.gif


Elog page

The Electronic Log page show the most recent Log message recorded in the system. The top buttons allows you to either Create/Edit/Reply/Query/Show a message.

From version 1.9.0, this page contains extra parameters for time selection and Email forwarding. Please refer to the ODB structure for further information.

main Elog page.
mhelog.gif

The format of the message log can be written in HTML format.

HTML Elog message.
mheloghtml.gif

The runlog button display the content of the file runlog.txt which is expected to be in the data directory specified by the ODB key /Logger/Data Dir . Regardless of its content, it will be displayed in the web page. Its common uses is to append lines after every run. The task appending this run information can be any of the midas application. Example is available in the Example /experiment/analyzer.c which at each end-of-run (EOR) will write to the runlog.txt some statistical informations.

Elog page, Runlog display.
mhelogrun.gif

When composing a new entry into the Elog, several fields are available to specify the nature of the message i.e: Author, Type, System, Subject. Under Type and System a pulldown menu provides multiple category. These categories are user definable through the odb under the tree /Elog/Types, /Elog/Systems. The number of category is fixed to 20 maximum but any remaining field can be left empty.

Elog page, New Elog entry form.
mhelognew.gif


Program page

This page present the current active list of the task attached to the given experiment. On the right hand side a dedicated button allows to stop the program which is equivalent to the ODBedit command odbedit> sh <task name> .

The task name hyperlink pops a new window pointing to the ODB section related to that program. The ODB structure for each program permit to apply alarm on the task presence condition and automatic spawning at either the begining or the end of a run.

Program page.
mhprg.gif


History page

This page reflects the History system settings (CVS r1.271). It lists on the top of the page the possible group names containing a list of panels defined in the ODB. Next a serie of buttons defines the time scale of the graph with predefined time window, "<<","<" "+" "-" ">" ">>" buttons permit the shifting of the graph in the time direction. Other buttons will allow graph resizing, Elog attachment creation, configuration of the panel and custom time frame graph display. By default a single group is created "Default" containing the trigger rate for the "Trigger" equipment.

The configuration options for a given panel consists in:

History page.
history20.jpg

History channel selection Page.
historyselect.jpg


Alarm page

This page reflects the Alarm System settings. It presents the four type of alarms:


Custom page

The Custom page is available since version 1.8.3. It has been improved during version 1.9.5 (mhttpd.c CVS-1.288).

This custom web page provides to the user a mean of creating a secondary personal web page activated within the standard Midas web interface. This custom page can contain specific links to the ODB and therefore present in a more compact way the essential parameter of the controlled experiment. Two mode of operations are available:

The new External referenced HTML document. feature remove the html code size restriction and support multiple custom web page. In addition, to each html document, a dynamic ODB linked image extend the display presentation capability of the controlled experiment.

Internal HTML document.

This page reflects the html content of a given ODB key under the /Custom/ key. If keys are defined in the ODB under the /Custom/ the name of the key will appear in the main status page as the Alias keys. By clicking on the Custom page name, the content of the /Custom/<page> is interpreted as html content.

Custom web page with history graph.
mhcustom1.gif

The access to the ODB field is then possible using specific HTML tags:

ODB /Custom/ html field.
mhcustom2.gif

The insertion of a new Custom page requires the following steps:

External referenced HTML document.

In the case the custom web page is rather large and complex, it becomes easier to handle such file through normal html editor and skip the reloading of the file in the ODB. (import/export). This is now possible by providing an external reference of the web page in the /Custom directory of the ODB. In addition special ODB settings are available to allow GIF image insertion and ODB fields bars and fillup area superimposed on the image. This powerful new extention brings the mhttpd capability closer to other experiment web control similar to EPICS.

The HTML examples below should operate in conjunction of the standard demo midas example found in midas/examples/experiment. myexpt.html, xcumstom.odb and myexpt.gif can be found in the midas/examples/custom directory.

Using your favorite html editor, you can create a custom page including any of the options described in the Internal HTML document.. Once the mhttpd application is started and connected to a valid Midas experiment, you can activate this page as follow:

[local:Default:Stopped]/>pwd
/
[local:Default:Stopped]/>mkdir Custom
[local:Default:Stopped]/>cd Custom
[local:Default:Stopped]/Custom>create string Dewpoint&
String length [32]: 256
[local:Default:Stopped]/Custom>set Dewpoint& \doc\cooling\dewpoint.html

Note: This link refers to a local html document. In the case an external HTML is requires, the definition should be placed under /Alias (see also ODB /Alias Tree).

[local:Default:Stopped]/>mkdir Alias
[local:Default:Stopped]/>cd alias
[local:Default:Stopped]/alias>create string WebDewpoint&
String length [32]: 256
[local:Default:Stopped]/alias>set WebDewpoint& "http://www.decatur.de/javascript/dew/index.html"

After refreshing the Midas status web page, the link Dewpoint should be visible in the top area of the page. The "&" is to prevent a new frame to be displayed (see ODB /Alias Tree). Clicking on it will bring you to your custom html documentation. In the case you want to extend the flexibility of your page by including features such as:

Html document myexpt.html

<html>
 <head>
  <title>MyExperiment Demo Status</title>
  <meta http-equiv="Refresh" content="30">
 </head>
 <body>
   <form name="form1" method="Get" action="/CS/MyExpt&">
   <table border=3 cellpadding=2>
  <tr><th bgcolor="#A0A0FF">Demo Experiment<th bgcolor="#A0A0FF">Custom Monitor/Control</tr> 
  <tr><td> <b><font color="#ff0000">Actions: </font></b><input
      value="Status" name="cmd" type="submit"> <input type="submit"
      name="cmd" value="Start"><input type="submit" name="cmd" value="Stop">
  </td><td>
  <center> <a href="http://midas.triumf.ca/doc/html/index.html"> Help </a></center>
  </td></tr>
  <td>Current run #: <b><odb src="/Runinfo/run number"></b></td>
  <td>#events: <b><odb src="/Equipment/Trigger/Statistics/Events sent"></b></td>
  </tr><tr>
  <td>Event Rate [/sec]: <b><odb src="/Equipment/Trigger/Statistics/Events per sec."></b></td>
  <td>Data Rate [kB/s]: <b><odb src="/Equipment/Trigger/Statistics/kBytes per sec."></b></td>
  </tr><tr>
  <td>Cell Pressure: <b><odb src="/Equipment/NewEpics/Variables/CellPressure"></b></td>
  <td>FaradayCup   : <b><odb src="/Equipment/NewEpics/Variables/ChargeFaradayCup"></b></td>
  </tr><tr>
  <td>Q1 Setpoint: <b><odb src="/Equipment/NewEpics/Variables/EpicsVars[17]" edit=1></b></td>
  <td>Q2 Setpoint: <b><odb src="/Equipment/NewEpics/Variables/EpicsVars[19]" edit=1></b></td>
  </tr><tr>
  <th> <img src="http://localhost:8080/HS/Default/Trigger%20rate.gif?
                  exp=default&amp;scale=12h&amp;width=250">
  </th>
  <th> <img src="http://localhost:8080/HS/Default/Scaler%20rate.gif?
                  exp=default&amp;scale=10m&amp;width=250"></th>
  </tr>
  <tr><td colspan=2>
  <map name="myexpt.map">
     <area shape=rect coords="140,70, 420,170" 
     href="http://midas.triumf.ca/doc/html/index.html" title="Midas Doc">
     <area shape=rect coords="200,200,400,400"
     href="http://localhost:8080" title="Switch pump">
     <area shape=rect coords="230,515,325,600"
     href="http://localhost:8080" title="Logger in color level (using Fill)">
  <img src="myexpt.gif" border=1 usemap="#myexpt.map">
  </map>
  </td></tr>
   </table></form>
  </body>
</html>  

To activate this HTML document, it has to be defined in the ODB as follow:

[local:Default:Stopped]/>cd /Custom
[local:Default:Stopped]/Custom>create string Myexpt&
String length [32]: 256
[local:Default:Stopped]/Custom>set Myexpt& \midas\examples\custom\myexpt.html

After refresh, the ODB values will be displayed, the mapping is still not active. as no reference to the gif location has been given yet.

[local:Default:Stopped]/Custom>mkdir Images
[local:Default:Stopped]/Custom>cd Images/
[local:Default:Stopped]Images>mkdir myexpt.gif
[local:Default:Stopped]Images>cd myexpt.gif/
[local:Default:Stopped]myexpt.gif>create string Background
String length [32]: 256
[local:Default:Stopped]myexpt.gif>set Background \midas\examples\custom\myexpt.gif

After refresh, the file myexpt.gif should by visible. The mapping based on myexpt.map is active, hovering the mouse over the boxes will display the associated titles (Midas Doc, Switch pump, etc), By clicking on either box the browser will go to the defined html page specified by the map.

Custom web page with external reference to html document.
mhxcustom01.gif

In addition of these initial features, multiple ODB values can be superimposed at define location on the image. Each entry will have a ODB tree associated to it defining the ODB variable, X/Y position, color, etc...

[local:Default:Stopped]myexpt.gif>mkdir Labels
[local:Default:Stopped]myexpt.gif>cd labels
[local:Default:Stopped]Labels>mkdir Rate

>>>>>>>> Refresh web page <<<<<<<<

12:32:38 [mhttpd] [mhttpd.c:5508:show_custom_gif] Empty Src key for label "Rate"

Creating "Labels/<label name>" sub-directory under the gif file name, will automatically at the next web page refresh complete its filling with default value for the structure for that label.

[local:Default:Stopped]Labels>cd Rate/
[local:Default:Stopped]Rate>ls -l
Key name                        Type    #Val  Size  Last Opn Mode Value
---------------------------------------------------------------------------
Src                             STRING  1     256   2m   0   RWD
Format                          STRING  1     32    2m   0   RWD  %1.1f
Font                            STRING  1     32    2m   0   RWD  Medium
X                               INT     1     4     2m   0   RWD  0
Y                               INT     1     4     2m   0   RWD  0
Align                           INT     1     4     2m   0   RWD  0
FGColor                         STRING  1     8     2m   0   RWD  000000
BGColor                         STRING  1     8     2m   0   RWD  FFFFFF

The Src should point to a valid ODB Key variable. The X,Y fields position the top left corner of the label. The other fields associated to this label are self-explanatory.

[local:Default:Stopped]Rate>set src "/Equipment/Trigger/statistics/kbytes per sec."
[local:Default:Stopped]Rate>set x 330
[local:Default:Stopped]Rate>set y 250 
[local:Default:Stopped]Rate>set format "Rate:%1.1f kB/s"

Once the initial label is created, the simplest way to extent to multiple labels is to copy the existing label sub-tree and modify the label parameters.

[local:Default:Stopped]Labels>cd .. 
[local:Default:Stopped]Labels>copy Rate Event
[local:Default:Stopped]Labels>cd Events/
[local:Default:Stopped]Event>set src "/Equipment/Trigger/statistics/events per sec."
[local:Default:Stopped]Event>set Format "Rate:%1.1f evt/s"
[local:Default:Stopped]Event>set y 170
[local:Default:Stopped]Event>set x 250

In the same manner, you can create bars used for level representation. This code will setup two ODB values defined by the fields src.

[local:Default:Stopped]myexpt.gif>pwd
/Custom/Images/myexpt.gif
[local:Default:Stopped]myexpt.gif>mkdir Bars
[local:Default:Stopped]myexpt.gif>cd bars/
[local:Default:Stopped]Labels>mkdir Rate

>>>>>>>> Refresh web page <<<<<<<<

14:05:58 [mhttpd] [mhttpd.c:5508:show_custom_gif] Empty Src key for bars "Rate"
[local:Default:Stopped]Labels>cd Rate/
[local:Default:Stopped]Rate>set src "/Equipment/Trigger/statistics/kbytes per sec."
[local:Default:Stopped]Rate>set x 4640
[local:Default:Stopped]Rate>set y 210 
[local:Default:Stopped]Rate>set max 1e6 
[local:Default:Stopped]Labels>cd .. 
[local:Default:Stopped]Labels>copy Rate Events
[local:Default:Stopped]Labels>cd Events/
[local:Default:Stopped]Event>set src "/logger/channles/0/statistics/events written"
[local:Default:Stopped]Event>set direction 1
[local:Default:Stopped]Event>set y 240
[local:Default:Stopped]Event>set x 450
[local:Default:Stopped]Rate>set max 1e6 

Following the same principle as for the labels, by creating Bars/<bar name="">, the structure for the rate will be filled with a default setting after refreshing the custom midas page. The different parameters are self-explanatory.

The last option available is the Fills where an area can be filled with different colors depending on the given ODB value (src parameter). The color selection is mapped by correspondance of the index of the Limit array to the Fillcolor array. Presently the structure is not pre-defined and need to be entered by hand.

[/Custom/Images/myexpt.gif/Fills/Level]
Src = STRING : [256] /equipment/Trigger/statistics/events sent
X = INT : 250
Y = INT : 550
Limits = DOUBLE[4] :
[0] 0
[1] 10
[2] 10000
[3] 100000
Fillcolors = STRING[4] :
[8] 00FF00
[8] AAFF00
[8] AA0000
[8] FF0000

Custom web page with external reference to html document.
mhxcustom02.gif

previous.gif Utilities - Top - Data format next.gif


Midas DOC Version 1.9.3 ---- PSI Stefan Ritt ----
Contributions: Pierre-Andre Amaudruz - Suzannah Daviel - Doxygen - Peter Green - Greg Hackman - Gertjan Hofman - Paul Knowles - Rudi Meier - Glenn Moloney - Dave Morris - John M O'Donnell - Konstantin Olchanski - Renee Poutissou - Andreas Suter - Jan M.Wouters - Piotr Adam Zolnierczuk