
Develop Distributed Event Builder Servers for Monitoring and Control
Learn how to develop event builder servers (eb01 to eb05) for monitoring machine quantities, changing states, and receiving commands using C, C++, or Python with DIM services. Implementing services like hello world, state, and commands for a distributed event builder setup.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
DAQ Exercise Session Simulation of the Monitoring and Control of a Distributed Event Builder Clara Gaspar, September 2021
Exercise Setup The setup: 5 machines in Lisbon, 1 at CERN (1 machine per team/zoom room) slow01.x.pt eb01 slow02.x.pt y.x.ch eb02 slow03.x.pt eb03 eb client slow04.x.pt eb04 slow05.x.pt eb05 2 Clara Gaspar, September 2021
Exercise aim and tools Your task: Develop the eb servers (eb01 to eb05) They should: (Monitor eb machine quantities) Provide their state Receive commands (and change state accordingly) You can use: C, C++ or python DIM: https://dim.web.cern.ch/ User Manual explaining the API: https://dim.web.cern.ch/dim_user.html C Server Example: https://dim.web.cern.ch/dimCdisExamples.html#heading_4.2 C++ Server Example: https://dim.web.cern.ch/cpp_doc/dim_cpp_examples.html Python Server Example: https://lhcbdoc.web.cern.ch/lhcbdoc/pydim/guide/tutorial.html 3 Clara Gaspar, September 2021
Exercise Implementation You should implement the following DIM Services/Commands: First step: An initial hello world service called: eb0n/hello providing a string (saying whatever you like) Note: The program needs to stay running after declaring the service, i.e. it needs a main loop with a sleep like in the examples. Second step (after we resynchronize): A state service called: eb0n/state providing a string, initially: NOT_READY Accept a command called: eb0n/command possible Commands: Configure -> Updates the state to READY Start -> Updates the state to RUNNING Stop -> Updates the state to READY Reset -> Updates the state to NOT_READY Recover -> Updates the state to NOT_READY (If you like you can simulate an ERROR at some point) Recoverx ERROR UNKNOWN NOT_READY Configure Reset READY Start Stop RUNNING 4 Clara Gaspar, September 2021
Exercise Technical Details Login to linux machine slow0n (where n = team number) From windows cmd prompt or mac terminal or linux shell: ssh students@slow0n.ncg.Ingrid.pt Write your C, C++ or Python program file The name of the source file or the executable is not important The DIM server name (required by one of the calls), is also not important The real important thing is the name and type of the DIM services Available tools: You can use the emacs editor http://web.physics.ucsb.edu/~pcs/apps/editors/emacs-basics.html For C or C++: you can use as template the makefile available in the login directory For Python (it s python2): You can just import pydim 5 Clara Gaspar, September 2021
FSM Exercise Third Step: See how the Finite State Machine works (synchronization/error recovery) And after studying the FSM logic Implement Automatic Error Recovery while RUNNING 6 Clara Gaspar, September 2021
DAQ Exercise Session Appendix Clara Gaspar, September 2021
Communications (example) DIM Distributed Information Management System Efficient and light weight data exchange across processes (and machines) Available for: C, C++, Java, Python Linux, Windows, etc. Client/Server (Publish/Subscribe) Services Set of data, any type or size Single items, arrays or structures Free name space But better use a naming convention Servers publish Services. Clients subscribe to Services. Once, at regular intervals or on change Clients can also send Commands to Servers Name Server Keeps the coordinates of available Services 8 Clara Gaspar, September 2021
Automation (example) SMI++ - State Management Interface A Tool for the Automation of large distributed control systems Method: Classes and Objects Allow the decomposition of a complex system into smaller manageable entities Finite State Machines Allow the modeling of the behavior of each entity and of the interaction between entities in terms of STATES and ACTIONS Rule-based reasoning React to asynchronous events (allow Automation and Error Recovery) Obj SMI Domain Obj Obj Obj ObjSMI Domain Obj Obj Obj Proxy Proxy Proxy Hardware Devices 9 Clara Gaspar, September 2021
SMI++ - The Language: SML Synchronization and Sequencing The user can also wait until actions finish before sending the next one. Asynchronous Rules Actions can be triggered by logical conditions on the state of other objects. Finite State Logic Objects are described as FSMs their main attribute is a STATE Parallelism Actions can be sent in parallel to several objects. class: DAQ state: NOT_READY /initial_state action: GET_READY (do Configure all_in Electronics) do Configure all_in EBS if (all_in EBS in_state READY) then move_to READY endif move_to ERROR state: READY when ( any_in EBS in_state ERROR ) do RECOVER when ( any_in EBS not_in_state READY ) move_to NOT_READY action: RECOVER do Recover all_in EBS state: ERROR object: SubDetDAQ is_of_class DAQ class: EventBuilder /associated state: UNKNOWN /dead_state state: NOT_READY action : Configure state: READY action : Start action : Reset state: RUNNING action : Stop state: ERROR action : Recover object: EB1 is_of_class EventBuilder object: EB2 is_of_class EventBuilder object: EB3 is_of_class EventBuilder objectset: EBS {EB1, EB2, EB3, } class: TopControl state: STANDBY when ( LHC in_state PHYSICS ) do STARTUP action: STARTUP (do GET_READY all_in SubDetDCS) do GET_READY all_in SubDetDAQ object: BigBrother is_of_class TopControl 10 Clara Gaspar, September 2021