Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  17 Dec 2020, Amy Roberts, Suggestion, Improving variable functionality in Sequencer? 
    Reply  05 Jan 2021, Amy Roberts, Suggestion, Improving variable functionality in Sequencer? 
       Reply  06 Jan 2021, Stefan Ritt, Suggestion, Improving variable functionality in Sequencer? laser.msl
Message ID: 2067     Entry time: 06 Jan 2021     In reply to: 2065
Author: Stefan Ritt 
Topic: Suggestion 
Subject: Improving variable functionality in Sequencer? 
I guess you use a wrong pattern here. There is no need to copy ODB values to local variables, 
then change them, then write them back. You can rather directly write values to the ODB. We run 
all our experiments in that way and we can do what we want. So most of our scripts have sections 
like

 ODBSUBDIR "/Equipment/Laser/Variables"
   ODBSET "Setting[*]", 0, 0
   ODBSET "Output[1]", 0, 0
   ODBSET "Output[2]", 1, 0
   ODBSET "Output[3]", 0, 0
   ODBSET "Output[4]", 1, 1
 ENDODBSUBDIR

Note that both the path and the indices can contain wild cards, making this pattern more 
flexible. Wildcards are however not (yet) supported for local variables, that's why we use 
directly the ODBSET directive.

I attach a larger example from the MEG experiment here for your reference.

Stefan
Attachment 1: laser.msl  5 kB  | Hide | Hide all
COMMENT "TC laser run"
# include XEC setting script
INCLUDE xec_settings


  RUNDESCRIPTION "TC laser run"

  SET Nrun, 1
  SET Freq, 1200

  ODBSET "/Experiment/Run Parameters/SQL/SPX/SPXConfId", 79, 0

  ODBGET "/Sequencer/Variables/Freq", Freq
  ODBSET "/Sequencer/Variables/Freq", 1200, 1

  SET Power, 12
  SET Temp, 15
  SET LaserFreq, 40
  SET Nevent, 3000

  ODBGET "/Sequencer/Variables/Nevent", Nevent
  ODBSET "/Sequencer/Variables/Nevent", 3000, 1

  SET Gain, 100
  SET PzcLevel, 7

  # Reset XEC setting
  CALL setup_ADC, 0
  CALL setup_DRS, 0


  ODBSUBDIR "/Equipment/Trigger/Settings/WaveDAQ/"
  ODBSET "AUXCrate/AUX-13/SamplingFrequency", $Freq, 0
  ODBSET "AUXCrate/AUX-13/FrontendPzcLevel", 3, 0
  ODBSET "AUXCrate/AUX-13/FrontendGain[14]", 1, 0
  ODBSET "AUXCrate/AUX-13/FrontendPzc[14]", n, 0
  ODBSET "AUXCrate/AUX-13/FrontendGain[15]", 1, 0
  ODBSET "AUXCrate/AUX-13/FrontendPzc[15]", y, 0
  ODBSET "AUXCrate/AUX-13/DRSChannelTxEnable", 0x3FFFFx,0
  ODBSET "AUXCrate/AUX-13/ZeroSuppressionEnable", n, 0

  ODBSET "TCUS1Crate/TU1-*/SamplingFrequency", $Freq, 0
  ODBSET "TCUS1Crate/TU1-*/FrontendPzcLevel", $PzcLevel, 0
  ODBSET "TCUS1Crate/TU1-*/FrontendPzc[*]", y, 0
  ODBSET "TCUS1Crate/TU1-*/DRSChannelTxEnable", 0x3FFFF,0
  ODBSET "TCUS1Crate/TU1-*/ZeroSuppressionEnable", n, 0

  ODBSET "TCUS1Crate/TU1-*/FrontendGain[*]", $Gain, 0
  ODBSET "TCUS1Crate/TU1-6/FrontendGain[*]", 50, 0
  ODBSET "TCUS1Crate/TU1-*/TDCChannelTxEnable", 0,0

  ENDODBSUBDIR


  ODBSUBDIR "/Equipment/Trigger/Settings/WaveDAQ"
  ODBSET "Trigger/MASTER/TriggerPrescaling[*]", 0, 0
  ODBSET "Trigger/MASTER/TriggerEnable[*]", n, 0
  ODBSET "Trigger/MASTER/TriggerPrescaling[63]", 1, 0
  ODBSET "Trigger/MASTER/TriggerEnable[63]", y, 0
  ODBSET "Trigger/MASTER/Write TRGC", y, 0 
  ODBSET "Trigger/MASTER/Write TGEN", y, 0  
  ODBSET "Trigger/MASTER/Write XEC", n, 0 
  ODBSet "Trigger/TC/Write SPX", n, 0
  ENDODBSUBDIR

  ODBSUBDIR ""
  ENDODBSUBDIR

  ODBSET "/Equipment/Trigger/Settings/Reload all", y, 1

  WAIT ODBValue, "/Equipment/Trigger/Variables/Config busy", ==, 0
  WAIT seconds, 2

  ODBSUBDIR "/Equipment/Trigger/Settings/WaveDAQ"
  ODBSET "Trigger/MASTER/TriggerPrescaling[*]", 0, 0
  ODBSET "Trigger/MASTER/TriggerEnable[*]", n, 0
  ODBSET "Trigger/MASTER/TriggerPrescaling[63]", 100, 0
  ODBSET "Trigger/MASTER/TriggerEnable[63]", y, 1
  ENDODBSUBDIR

  ODBSUBDIR ""
  ENDODBSUBDIR

  CAT description, "TC pedestal"
  ODBSET "/Experiment/Run Parameters/Run description", $description, 1

   LOOP $Nrun
      TRANSITION start
      WAIT events, 1000
      TRANSITION stop
   ENDLOOP


  ODBSUBDIR "/Equipment/Trigger/Settings/WaveDAQ"
  ODBSET "Trigger/MASTER/TriggerPrescaling[*]", 0, 0
  ODBSET "Trigger/MASTER/TriggerEnable[*]", n, 0
  ODBSET "Trigger/MASTER/TriggerPrescaling[23]", 1, 0
  ODBSET "Trigger/MASTER/TriggerEnable[23]", y, 1
  ENDODBSUBDIR



  ODBSUBDIR "/Equipment/Laser/Variables/"
  ODBSET "Output[0]", $LaserFreq, 0
  ODBSET "Output[1]", 1, 0
  ODBSET "Output[2]", 1, 0
  ODBSET "Output[3]", 1, 0
  ODBSET "Output[4]", 0, 1
  ENDODBSUBDIR
  WAIT seconds, 10

  ODBSUBDIR ""
  ENDODBSUBDIR
  CAT description, "Laser run, sector: 4, frequency: ", $Freq, ", clock: square, power: ", $Power, ", attenuator: 0, temperature: ", $Temp
  ODBSET "/Experiment/Run Parameters/Run description", $description, 1

   LOOP $Nrun
      TRANSITION start
      WAIT events, $Nevent
      TRANSITION stop
   ENDLOOP



  ODBSUBDIR "/Equipment/Laser/Variables/"
  ODBSET "Output[1]", 1, 0
  ODBSET "Output[2]", 0, 0
  ODBSET "Output[3]", 0, 0
  ODBSET "Output[4]", 1, 1
  ENDODBSUBDIR
  WAIT seconds, 10

  ODBSUBDIR ""
  ENDODBSUBDIR
  CAT description, "Laser run, sector: 5, frequency: ", $Freq, ", clock: square, power: ", $Power, ", attenuator: 0, temperature: ", $Temp
  ODBSET "/Experiment/Run Parameters/Run description", $description, 1

   LOOP $Nrun
      TRANSITION start
      WAIT events, $Nevent
      TRANSITION stop
   ENDLOOP




  ODBSUBDIR "/Equipment/Laser/Variables"
  ODBSET "Output[1]", 0, 0
  ODBSET "Output[2]", 1, 0
  ODBSET "Output[3]", 0, 0
  ODBSET "Output[4]", 1, 1
  ENDODBSUBDIR
  WAIT seconds, 10

  ODBSUBDIR ""
  ENDODBSUBDIR
  CAT description, "Laser run, sector: 6, frequency: ", $Freq, ", clock: square, power: ", $Power, ", attenuator: 0, temperature: ", $Temp 
  ODBSET "/Experiment/Run Parameters/Run description", $description, 1

   LOOP $Nrun
      TRANSITION start
      WAIT events, $Nevent
      TRANSITION stop
   ENDLOOP

  ODBSUBDIR "/Equipment/Laser/Variables"
  ODBSET "Output[1]", 1, 0
  ODBSET "Output[2]", 1, 0
  ODBSET "Output[3]", 0, 0
  ODBSET "Output[4]", 1, 1
  ENDODBSUBDIR
  WAIT seconds, 10

  ODBSUBDIR ""
  ENDODBSUBDIR
  CAT description, "Laser run, sector: 7, frequency: ", $Freq, ", clock: square, power: ", $Power, ", attenuator: 0, temperature: ", $Temp
  ODBSET "/Experiment/Run Parameters/Run description", $description, 1

   LOOP $Nrun
      TRANSITION start
      WAIT events, $Nevent
      TRANSITION stop
   ENDLOOP

  ODBSUBDIR "/Equipment/Laser/Variables"
  ODBSET "Output[0]", 0, 0
  ODBSET "Output[1]", 1, 0
  ODBSET "Output[2]", 0, 0
  ODBSET "Output[3]", 0, 0
  ODBSET "Output[4]", 0, 1
  ENDODBSUBDIR

  ODBSUBDIR "/Equipment/Trigger/Settings/WaveDAQ"
  ODBSET "AUXCrate/AUX-13/SamplingFrequency", 1200, 0
  ODBSET "AUXCrate/AUX-13/FrontendPzcLevel", 7, 0
  ODBSET "AUXCrate/AUX-13/FrontendGain[14]", 1, 0
  ODBSET "AUXCrate/AUX-13/FrontendPzc[14]", n, 0
  ODBSET "AUXCrate/AUX-13/FrontendGain[15]", 1, 0
  ODBSET "AUXCrate/AUX-13/FrontendPzc[15]", n, 1
  ENDODBSUBDIR
ELOG V3.1.4-2e1708b5