Software Installation

In these instructions replace [MIDASBASE] with the base of your software installation (default is /MIDAS).
Set the environment variable MIDASBASE to [MIDASBASE]

This note relates to Release 8.1 dated Feb 2022 of the MIDAS NewGen Data Acquisition System.
This software is based around a Web Browser for the GUI.

The MIDAS GUI is built around a Web interface. Hence the graphic control screen are accessed using a Web Browser.
FireFox is the browser recommended. Tab and JavaScript must be enabled.
Also some diagnostic screens need popups to be enabled for the data acquisition application.

This software release subset is for MIDAS FEBEX data acquisition using GSI FEBEX digitial acquisition modules.
The firmware used by the FEBEX modules has been developed for the MiniBall Data Acquisition by STFC Daresbury Nuclear Physics Group.

In the text which follows magenta text is used for startup script files and cyan text is used for typical output when that script is executed.

(1) It is assumed that you have a PC (provided by GSI) which has a Debian Linux OS and the PCI Express card and software needed for access to the FEBEX hardware reinstalled

Having connected the PC to the FEBEX crate you can test the installation.

(2) Next download and install the MIDAS software for FEBEX Data Acquisition.

There is a web page for the NewGen Data Acquisition software - see http://npg.dl.ac.uk/MIDAS/MIDASNewGenDataAcquisition/download.html

From here download the software for Release 8.1 "NewGen system core ...." & "NewGen addition for FEBEX package (FEBEX @ MiniBall ..."

There is also a copy of these instructions "Installation Notes for FEBEX installations" You will find that these installation and operation documents are also in /MIDAS after the software installation.

Many GUI pages have a button "How to use this page" or similar.

These are a complete archive of the MIDAS directory containing all the software needed. It is recommended that you create a directory which will be used for the software installation in the filespace of the ID to be used for running data acquisition. For example ~/Downloads/MIDASforFebex_8.1.
Make this directory your current directory (Linux command cd) and unpack the archives downloaded into this directory (tar -zxf)

You should also perform this software install using the selected ID. The software does not require any special permissions (unless noted) and you will avoid problems caused by file permissions.

Then create a symbolic link from /MIDAS to this directory. This does need to be performed by root. In the future when you wish to install an updated version of the software you can repeat this procedure and simply change the symbolic link. Then if needed it is easy to revert to the previous version.

If you follow these instructions you will have have an installation which can be run in the IPC Industrial PC (for data acquisition using the FEBEX hardware) and also can be installed in a standard Linux workstation and used (with simple options) to run the software without FEBEX hardware for test & development purposes.

(3) Customize the installation

The software uses the Linux system name [uname -n] in order that the installed software can be tailored for multiple applications.

(a) cd /MIDAS/config/TclHttpd

Here are a number of directories. Copy LIPC-1 create a custom directory named [uname -n].
You can also create a symbolic link connecting [uname -n] to LIPC-1.
This direrctory contains a file startup.tcl which will start the MIDAS session for the FEBEX GUI.

example LIPC-1/startup.tcl


   Setting BGColor "BlanchedAlmond"
   Setting TextColor "red"
   
   Setting ProjectName FEBEX

  Setting Option1Name STFC
  Setting Option1URL  "stfc.ac.uk"
  Setting Option1Image stfc.jpg


#    Install required services

    package require FEBEXAccessClient

    if {![namespace exists ::FEBEX]} {namespace eval ::FEBEX {puts "created namespace ::FEBEX"}}
    if {![namespace exists ::febexU]} {namespace eval ::febexU {puts "created namespace ::febexU"}}
    
    set ::FEBEX::TestMode 0
    set ::FEBEX::AccessTestMode 0
    
       set z [catch {source [file join $env(MIDASBASE) TclHttpd tcl Common febex.registerdefinitions]} m]
       if {$z != 0} {puts "febex.registerdefinitions > $m"}
    
    global SpectrumServerHost
    set SpectrumServerHost [exec uname -n]
    
namespace eval febexU {
      
      variable allcrates 0
      variable alllinks 0
      variable allboards 0
      variable allchannels 0
}
    
namespace eval DataAcquisition {
    variable PROJECT FEBEX
    variable ACQSERVERS 
    set ACQSERVERS [exec uname -n]
    variable ACQSERVER [first $ACQSERVERS]

   set ::DataAcquisition::EnableTape 1
}

    package require FEBEXAccessServer
    
    Setting DataBaseRoot "/MIDAS/DB"
    package require DataBaseAccessServer
    
    package require NetVarServer
    package require SigTaskServer
    
    package require MemSasServer
    
    package require TapeServer


namespace eval $::DataAcquisition::PROJECT {
    variable DBRootName [file join EXPERIMENTS FEBEX]
    variable DBNodeBase [exec uname -n]
    variable DBNodeBase 2021Feb27-16.07.11
}
   
    package require FEBEXRunControl


  Setting Option8Name "Server Software Home Page"
  Setting Option8URL  "http://npg.dl.ac.uk/MIDAS/download/WebServices.html"
  
(b)

Notes Lines starting with a # symbol are comments and are ignored by the software
  
Essential customisations.

    set ::FEBEX::TestMode 0
    set ::FEBEX::AccessTestMode 0
    
 These are mentioned in the operation notes and can be used for Test purposes (running the software without
 actual FEBEX hardware)

    set ::DataAcquisition::EnableTape 1 --  This is required only if you are writting data to the MIDAS Storage Server
            - if not change 1 to 0  or remove
    package require TapeServer            --   Can be omitted if the MIDAS Storage Server is not required
    
 set symbolic links in the /MIDAS/DB directory
    as previously use the system name [uname -n] 
 
   cd /MIDAS/DB/EXPERIMENTS/FEBEX
      ln -s LIPC-1 [uname -n]
      
   cd /MIDAS/DB/EXPERIMENTS/FEBEX/Options
      ln -s LIPC-1 [uname -n]
      
(4) Load the MIDAS TclHttpd software. This is a web server containing the MIDAS servers needed and provides the GUI.

Start using either /MIDAS/Linux/startup/HTTPD@8015 (recommended), /MIDAS/Linux/startup/HTTPD or /MIDAS/TclHttpd/Linux64/TclHttpd-server
The software is installed using a script from the directory /MIDAS/config/TclHttpd. This uses [uname -n] for customisation and selects an existing script.
The script used is confirmed in the startup monitor output.

/MIDAS/Linux/startup/HTTPD will remove any existing instance of the web server and then launch /MIDAS/TclHttpd/Linux64/TclHttpd-server which will select a startup script as noted above.
This is important since a second copy of the MIDAS Web server using the same TCP port will fail.

Use /MIDAS/Linux/startup/HTTPD or create a launcher Icon on your desktop (highly recommended)

Typical startup output is:




tidy up
init.tcl  /MIDAS/lib/tcl8.5
System identified is CPU x86_64; Platform is unix; OS is Linux and Version is 3.10.0-1062.18.1.el7.x86_64
Environment selected is CPU x64_64; Platform unix; OS Linux64 and Operating System Linux64
MIDASBASE = /MIDAS and MIDAS_LIBRARY = /MIDAS/TclHttpd/Linux64
PATH = /MIDAS/bin_Linux64:/MIDAS/TclHttpd/Linux64:/MIDAS/Linux/bin64:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
loading /MIDAS/tcl/pkgIndex.tcl
Setting up access for Common packages
extended auto_path /MIDAS/TclTkpackages/tcllib/1.11
packages base64=2.4 md5=2.0.7 1.4.4
Setting up access for MIDAS SOAP packages
Loading TclHttpd server packages
Setting up access for MIDAS packages
Computer Name = nnlxvpc7; Temp Directory = /tmp/tcl11101
package limit is not available: can't find package limit
Running with default file descriptor limit
package setuid is not available: can't find package setuid
Could not change to user 50 group 50: not owner
/debug user "debug" password "6=07p9 n5n94"
httpd started on port 8015

Cannot use /MIDAS/config/TclHttpd/nnlxvpc7@8015/startup.tcl
Custom startup from /MIDAS/config/TclHttpd/nnlxvpc7/startup.tcl
FEBEXAccessClient provided
created namespace ::FEBEX
created namespace ::febexU
loading registerdefinitions
ModuleMenu 0;  LinkMenu 0 1 2 3;   BoardMenu 0 1 2 3 4 5 6 7 8 9;  ChannelMenu 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
global -  module = 0; link = 0; board = 0; channel = 0
::FEBEX  -  module = 0; link = 0; board = 0; channel = 0
loaded registerdefinitions
FEBEX Access package 1.0
/FEBEXAccessServer
/DataBaseAccessServer
loading NetVarServer1.0
/NetVarService
/SigTaskService
Loaded MemSasAccess
/SpectrumService
/TapeServer
loading tcl/FEBEXRunControl.tcl for namespace ::
/DataAcquisitionControlServer
DefineMessage unknown
Run Control Server Implementation for FEBEX
RunControl loaded
loading Html/RunControl/implementation.tcl
FEBEX RunControl loaded
loading Html/FEBEX/RunControl/implementation.tcl for namespace ::
ReadRegister failed: Name=NetVar.EXEC.ID; Code= 0x10004; Info= Register name does not exist
Created UI registers
Created FEBEX UI registers
FEBEX RunControl loaded
Completed custom startup from /MIDAS/TclHttpd/Html/FEBEX/RunControl/stats.defn.tcl

(5) Starting the FEBEX acquisition program

use /MIDAS/Linux/startup/febex or create a launcher Icon on your desktop (highly recommended)

Again any existing copy of the DA program is removed.

Typical startup script is:


#!/bin/csh -f
#

    umask 0
 
  if (! $?MIDASBASE) setenv MIDASBASE /MIDAS

    echo tidy up

     killall ${MIDASBASE}/Data_Acq/bin/Linux64/FEBEXExecV1

setenv PATH ${MIDASBASE}/Linux/bin64:${MIDASBASE}/Linux/bin:${PATH}
setenv LD_LIBRARY_PATH ${MIDASBASE}/Linux/lib64:${MIDASBASE}/lib_Linux64

     setenv MIDAS_MEMSAS_PORT 0

#
#    define netints and access registers
#
    echo "Defining NetVars..."

  netint HasBeenConfigured 0

#    netstring TS_Server "lyserv"
     netstring TS_Server "localhost"

    netint Output_BufferSize 64
#     note TDR format
    netint Format_Option 4
#    netint Format_Option 3

    netint Xfer_Option 3

    netint Xfer_NoBlock 2
    netint Xfer_Overlap 0
    netint Xfer_Priority 0

    netint DACQ_TxInit 1
    netint DACQ_StatsTime 5
    netint DACQ_PushEnable 60
    netint DACQ_FlushEnable 60

    netint DACQ_PollTicks 10000
    
    netint FEBEX_PexorEnable 1
    netint FEBEX_Data_In_Enable 0
    netint FEBEX_Data_Out_Enable 0
    
    netstring FEBEX_DataBase    "/MIDAS/FEBEXData"
    netstring FEBEX_DataInFile   "f0.dat"
    netstring FEBEX_DataOutFile  "OutFeb08"
    
#    format = 0  =>  original MBS (HS) format
#    format = 1  =>  JL format
    netint FEBEX_DataFormat 0
    
    netint FEBEX_Do_DataRead 1
    netint FEBEX_Do_DataFormat 1

    echo "Loading data acquisition program..."
    nice ${MIDASBASE}/Data_Acq/bin/Linux64/FEBEXExecV1
#

#

sleep 100000000

Typical startup output is:


tidy up
/MIDAS/Data_Acq/bin/Linux64/FEBEXExecV1: no process found
Defining NetVars...
Loading data acquisition program...

FEBEX Data Acquisition Program Release 1 Build Feb 23 2022  16:27:53 starting

Built without pthreads

Creating NetVars
Output buffer length = 65504; format option = 4; transfer option = 3
EB transfer option = 3
NetVars created and initialised
Data Acquisition task has PID 798
Statistics thread created
Statistics thread starting
Stat/Rate creation thread created
Stat/Rate creation thread starting
Heartbeat thread created
Heartbeat thread starting
Installing signal handlers
Done
FEBEX_init
febex_init_connection  1 0 0 
FEBEX_DataFormat 0:
FEBEX_Do_DataRead 1:
FEBEX_Do_DataFormat 1:
FEBEX_DataBase /MIDAS/FEBEXData:
FEBEX_DataIn_File f0.dat:
FEBEX_DataOutFile OutFeb08:
0, SFP id: 0  slaves 0
0, SFP id: 1  slaves 1
0, SFP id: 2  slaves 0
0, SFP id: 3  slaves 0
mbspex: resetting pex device... done!
mbspex: initialize SFP chain 1 with 1 slaves...
Completed FEBEX_init_connection
Spectra table initialised
FEBEX Data Acquisition now all ready to start
SIGBUS, SIGSEGV and SIGPIPE traps setup

(6) Starting the Data Storage Server (if required) (TapeServer)


  Start using /MIDAS/Linux/startup/TapeServer
  

    
echo "Tidy up"
killall -s9 master
killall -s9 stats
killall -s9 driver
killall -s9 linkTCP

echo "Starting Tape Server"

  if (! $?MIDASBASE) setenv MIDASBASE /MIDAS
  if (! $?MIDASTSBASE)  setenv MIDASTSBASE ${MIDASBASE}/TapeServer/Linux64

setenv MIDASTSBASE ${MIDASBASE}/config/TS_10205

cd ${MIDASBASE}/TapeServer/Linux64
${MIDASBASE}/TapeServer/Linux64/master &

sleep 1000000

#
echo startup complete
#

 The Configuration file used is  /MIDAS/config/TS_10205/TS_configuration   
 (see environment variable MIDASTSBASE above)
  
#device configuration information
#    any line starting with a # is a comment and is ignored
stats  ./stats
#    devices available   -   list ends with a null line or line starting with a &
#    format       class_name     device_name    driver_task_path_name
#       class_name MUST be one of dlt, exabyte, scsitape, sink
#       driver_task_path_name normally is omitted
#dlt           /dev/nst0    ./driver
file          /dev/file/0  ./driver
sink          /dev/null/0  ./driver
&
#data link configuration information  - list end with a null line
#    format   link_task_path_name  
./linkTCP
&
#program options - list end with a null line
msg_reporting_level 0x0180fff8
#   use 0x0080fff8 to enable msg logging
msg_logging_level 0xfff8
tapeserver_options 0
#   use 0x0080fff8 to enable msg logging
#    default for following is 16Kbytes - both MUST be the same at present
data_buffer_size 64
tape_block_size 64
disc_file_size 2000
#
file_path_base /TapeData
&
#end of information 

Note that the option file_path_base should be tailored to your system.
/TapeData can be a NFS mount point to a location in a disc storage array

Note that this may not be run in the same Linux system as the previous 2 (HTTPD & febex)

Typical startup output is:


   
Tidy up
master(10424): Operation not permitted
MIDAS Tape Server: MIDAS Tape Server terminating.
MIDAS Tape Driver (18570): Received TERM signal; exiting.
MIDAS Tape Driver (18571): Received TERM signal; exiting.
MIDAS Data Link (18572): Received TERM signal; exiting.
Starting Tape Server
MIDAS Tape Server: Message logger not contacted.
MIDAS Tape Server: MIDAS Tape Server Build February 14 2014
MIDAS Tape Server: Unable to change scheduling priority - Permission denied
MIDAS Tape Server: Using default startup
MIDAS Tape Server: Configuration: UDP port = 10205, SHM key=10205.
MIDAS Tape Server: File mapped object /SHM_10205 of size 1331104 created
MIDAS Tape Server: Shared memory ID is 3
MIDAS Tape Server: Shared memory segment located at address 7f07b0893000.
MIDAS Tape Server: Configuration file used - /MIDAS/config/TS_10205/nnlxp1/TS_configuration
MIDAS Tape Server: Stats task ./stats
MIDAS Tape Server: Using device file /dev/file/0 ./driver
MIDAS Tape Server: Using device sink /dev/null/0 ./driver
MIDAS Tape Server: Data link ./linkTCP      
MIDAS Tape Server: Message reporting level = 0x180fff8
MIDAS Tape Server: Message logging level = 0xfff8
MIDAS Tape Server: Tape Server Options = 0x6
MIDAS Tape Server: File device path base = /TapeData
MIDAS Tape Server: Data buffer size = 65536
MIDAS Tape Server: Tape block size = 65536
MIDAS Tape Server: File mapped object /SHM_110205 of size 4195880 created
MIDAS Tape Server: Shared memory ID is 3
MIDAS Tape Server: Shared memory segment located at address 7f07b0492000.
MIDAS Tape Server: File mapped object /SHM_210205 of size 3100 created
MIDAS Tape Server: Shared memory ID is 3
MIDAS Tape Server: Shared memory segment located at address 7f07b09fc000.
MIDAS Tape Server: Capabilities restored.
MIDAS Tape Server: Master global area initialised.
MIDAS Tape Server: Stats task has pid 18581
MIDAS Tape Server: Driver process for /dev/file/0 has pid 18582
MIDAS Tape Server: Driver process for /dev/null/0 has pid 18583
MIDAS Tape Server: Link task 0 has pid 18584
MIDAS Tape Server: Starting the RPC interface
MIDAS Tape Server: Created RPC Program 28000205 Version 4 on UDP port 10205.
MIDAS Tape Server: Entering server loop
MIDAS Tape Server: MIDAS Tape Server now available on UDP port 10205.
MIDAS Tape Statistics: Message logger not contacted.
MIDAS Tape Statistics: MIDAS Tape Statistics Build February 14 2014
MIDAS Tape Statistics: Started with args 10205
MIDAS Tape Statistics: Configuration: SHM key=10205
MIDAS Tape Statistics: File mapped object /SHM_10205 of size 1331104 created
MIDAS Tape Statistics: Shared memory ID is 3
MIDAS Tape Statistics: Shared memory segment located at address 7fcd36275000.
MIDAS Tape Driver (18583): Message logger not contacted.
MIDAS Tape Driver (18583): MIDAS Tape Driver Build February 14 2014
MIDAS Tape Driver (18583): Started with args 1 10205
MIDAS Tape Driver (18583): Configuration: driver=1, key=10205.
MIDAS Tape Driver (18583): File mapped object /SHM_10205 of size 1331104 created
MIDAS Tape Driver (18583): Shared memory ID is 3
MIDAS Tape Driver (18583): Shared memory segment located at address 7f99ec449000.
MIDAS Tape Driver (18583): Using device /dev/null/0 of type sink.
MIDAS Data Link (18584): Message logger not contacted.
MIDAS Data Link (18584): MIDAS Tape Data Link Build February 14 2014
MIDAS Data Link (18584): Started with args 10205      
MIDAS Data Link (18584): Configuration: SHM key=10205, TCP port = 10305
MIDAS Data Link (18584): File mapped object /SHM_10205 of size 1331104 created
MIDAS Data Link (18584): Shared memory ID is 3
MIDAS Data Link (18584): Shared memory segment located at address 7f842ba91000.
MIDAS Data Link (18584): Starting the network interface
MIDAS Data Link (18584): TCP socket receive buffer was 87380 - now 249856
MIDAS Data Link (18584): TCP socket send buffer was 16384 - now 249856
MIDAS Tape Driver (18582): Message logger not contacted.
MIDAS Tape Driver (18582): MIDAS Tape Driver Build February 14 2014
MIDAS Data Link (18584): MIDAS Data Link thread 0 using TCP port 10305.
MIDAS Data Link (18584): Entering server loop
MIDAS Tape Driver (18582): Started with args 0 10205
MIDAS Data Link (18584): thread 0 listening on port 10305
MIDAS Tape Driver (18582): Configuration: driver=0, key=10205.
MIDAS Tape Driver (18582): File mapped object /SHM_10205 of size 1331104 created
MIDAS Tape Driver (18582): Shared memory ID is 3
MIDAS Tape Driver (18582): Shared memory segment located at address 7ffa7a39b000.
MIDAS Tape Driver (18582): Using device /dev/file/0 of type file.

Create the directory /TapeData and ensure it is writable by the data acquisition ID. The software is now ready to go.

(7) Using a Web Browser use a URL to LIPC-1:8015 (replace LIPC-1 by [uname -n])

V Pucknell; STFC; Daresbury Lab   updated March 2022