Commit b52db1d8 authored by Gino Tosti's avatar Gino Tosti
Browse files

updated files

parent b0b4dfa7
Loading
Loading
Loading
Loading

Script/ChangeLog

0 → 100644
+1 −0
Original line number Diff line number Diff line
"@(#) $Id$"

Script/src/Makefile

0 → 100644
+230 −0
Original line number Diff line number Diff line

#*******************************************************************************
# PPPPPPPP
#
# "@(#) $Id$"
#
# Makefile of ........
#
# who       when      what
# --------  --------  ----------------------------------------------
# astrisw  22/04/21  created
#

# ALMA - Atacama Large Millimeter Array
# Copyright (c) ESO - European Southern Observatory, 2014
# (in the framework of the ALMA collaboration).
# All rights reserved.
# 
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# 
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# 
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
#*******************************************************************************

#*******************************************************************************
# This Makefile follows ALMA/ACS Standards (see Makefile(5) for more).
#*******************************************************************************
# REMARKS
#    None
#------------------------------------------------------------------------

#
# user definable C-compilation flags
#USER_CFLAGS = 

#
# additional include and library search paths
#USER_INC = 
#USER_LIB = 

#
# MODULE CODE DESCRIPTION:
# ------------------------
# As a general rule:  public file are "cleaned" and "installed"  
#                     local (_L) are not "installed".

#
# C programs (public and local)
# -----------------------------
EXECUTABLES     =
EXECUTABLES_L   = 

#
# <brief description of xxxxx program>
xxxxx_OBJECTS   =	
xxxxx_LDFLAGS   =
xxxxx_LIBS      =

#
# special compilation flags for single c sources
#yyyyy_CFLAGS   = 

#
# Includes (.h) files (public only)
# ---------------------------------
INCLUDES        =

#
# Libraries (public and local)
# ----------------------------
LIBRARIES       =
LIBRARIES_L     =

#
# <brief description of lllll library>
lllll_OBJECTS   =

#
# Scripts (public and local)
# ----------------------------
SCRIPTS         =
SCRIPTS_L       =

#
# TCL scripts (public and local)
# ------------------------------
TCL_SCRIPTS     =
TCL_SCRIPTS_L   =

#
# Python stuff (public and local)
# ----------------------------
PY_SCRIPTS         =
PY_SCRIPTS_L       =

PY_MODULES         =
PY_MODULES_L       =

PY_PACKAGES        =
PY_PACKAGES_L      =
pppppp_MODULES	   =

#
# <brief description of tttttt tcl-script>
tttttt_OBJECTS  =
tttttt_TCLSH    = 
tttttt_LIBS     = 

#
# TCL libraries (public and local)
# ------------------------------
TCL_LIBRARIES   =
TCL_LIBRARIES_L =

#
# <brief description of tttlll library>
tttlll_OBJECTS  = 

#
# Configuration Database Files
# ----------------------------
CDB_SCHEMAS = 

# 
# IDL Files and flags
# 
IDL_FILES =
TAO_IDLFLAGS =
USER_IDL =
#
# Jarfiles and their directories
#
JARFILES= 
jjj_DIRS=
jjj_EXTRAS=
# For expressing dependencies between jarfiles (parallel builds)
jjj_JLIBS= 
#
# java sources in Jarfile on/off
DEBUG= 
#
# ACS XmlIdl generation on/off
#
XML_IDL= 
#
# Java Component Helper Classes generation on/off
#
COMPONENT_HELPERS=
#
# Java Entity Classes generation on/off
#
XSDBIND=
#
# Schema Config files for the above
#
XSDBIND_INCLUDE=
# man pages to be done
# --------------------
MANSECTIONS =
MAN1 =
MAN3 =
MAN5 =
MAN7 =
MAN8 =

#
# local man pages
# ---------------
MANl =

#
# ASCII file to be converted into Framemaker-MIF
# --------------------
ASCII_TO_MIF = 

#
# other files to be installed
#----------------------------
INSTALL_FILES =

#
# list of all possible C-sources (used to create automatic dependencies)
# ------------------------------
CSOURCENAMES = \
	$(foreach exe, $(EXECUTABLES) $(EXECUTABLES_L), $($(exe)_OBJECTS)) \
	$(foreach rtos, $(RTAI_MODULES) , $($(rtos)_OBJECTS)) \
	$(foreach lib, $(LIBRARIES) $(LIBRARIES_L), $($(lib)_OBJECTS))

#
#>>>>> END OF standard rules

#
# INCLUDE STANDARDS
# -----------------

MAKEDIRTMP := $(shell searchFile include/acsMakefile)
ifneq ($(MAKEDIRTMP),\#error\#)
   MAKEDIR := $(MAKEDIRTMP)/include
   include $(MAKEDIR)/acsMakefile
endif

#
# TARGETS
# -------
all:	do_all
	@echo " . . . 'all' done" 

clean : clean_all 
	@echo " . . . clean done"

clean_dist : clean_all clean_dist_all 
	@echo " . . . clean_dist done"

man   : do_man 
	@echo " . . . man page(s) done"

install : install_all
	@echo " . . . installation done"


#___oOo___
+114 −0
Original line number Diff line number Diff line
#!/usr/bin/env python
#
# ALMA - Atacama Large Millimeter Array
# (c) Associated Universities Inc., 2015
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA

from threading import Thread
import time
from Acspy.Clients.SimpleClient import PySimpleClient
from ACS import MasterComponent
from ACS import SUBSYSSTATE_AVAILABLE, SUBSYSSTATE_OFFLINE, SUBSYSSTATE_SHUTDOWN, SUBSYSSTATE_ONLINE, SUBSYSSTATE_OPERATIONAL, SUBSYSSTATE_PREINITIALIZED, SUBSYSSTATE_PRESHUTDOWN, SUBSYSSTATE_ERROR


class Startup_test():
    '''
    Utility class to handle subsystem states 
    '''

    def __init__(self, ):
        '''
        Specify which subsystems to start. 
        '''
        # Initialize subsystem master references
        self.client = PySimpleClient()
        self.cont_master = None

        # Initialize Control threads
        self.contStartThread = None
        self.contShuttThread = None

        # Initialize overall startup state
        self.startupState = False


    def startup(self):
        '''
        Start up all subsystems, unless already started by another client.
        '''
        if (not self.startupState):
            if ( self._startCont() ):
                self.startupState = True
            else:
                return False
        return True

    def shutdown(self):
        '''
        Shut down all subsystems.
        '''
        if (self.startupState):
            self._shutdownCont()
            self.startupState = False


### MAster Start ###
    def _startCont(self):
        self.cont_master = self.client.getComponent('TESTMASTERCOMP')
        self.contStartThread = None
        if (self.cont_master._get_componentState() =="UNKNOWN"):
            self.cont_master.startupPass1()
            self.contStartThread = Thread(target=self.cont_master.startupPass2, args=())
            self.controlStartThread.start()
            return True
    
    def _shutdownControl(self):
        if (self.cont_master is None): return

        cont_state = self.cont_master.getMasterState()
        if (cont_state == OPERATIONAL):
            self.conthuttThread = Thread(target=self.cont_master.shutdownPass1, args=())
            self.contShuttThread.start()
    
    def _joinShutdownControl(self):
        if (self.controlShuttThread is not None):
            self.controlShuttThread.join()
            self.controlShuttThread = None

            self.cont_master.shutdownPass2()
            self.client.releaseComponent(self.cont_master._get_name())
            self.cont_master = None

# **************************************************
# MAIN Program
# **************************************************
if __name__ == '__main__':
    '''
    Use this to startup manually, or as an example for your test script.
    '''
    # Get the handler
    stateHandler = Startup_test()
    
    # Startup
    if ( not stateHandler.startup() ):
        exit(1)
    
    # Wait for shutdown signal
    raw_input("Hit any key to shutdown")
    
    # Shutdown
    stateHandler.shutdown()

Script/src/testMC.py

0 → 100644
+106 −0
Original line number Diff line number Diff line
#!/usr/bin/env python
#
# ALMA - Atacama Large Millimeter Array
# (c) Associated Universities Inc., 2015
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA

from threading import Thread
import sys
import time
import ACSErr
from Acspy.Clients.SimpleClient import PySimpleClient
from ACS import MasterComponent
from ACS import SUBSYSSTATE_AVAILABLE, SUBSYSSTATE_OFFLINE, SUBSYSSTATE_SHUTDOWN, SUBSYSSTATE_ONLINE, SUBSYSSTATE_OPERATIONAL, SUBSYSSTATE_PREINITIALIZED, SUBSYSSTATE_PRESHUTDOWN, SUBSYSSTATE_ERROR, COMPSTATE_OPERATIONAL


class Startup_test():
    '''
    Utility class to handle subsystem states 
    '''

    def __init__(self, comp=None):
        '''
        Specify which subsystems to start. 
        '''
        # Initialize subsystem master references
        self.client = PySimpleClient()
        self.cont_master = None
        self.cont=False
        self.maste_name=comp

### MAster Start ###
    def getMaster(self):
        self.cont_master = self.client.getComponent(self.maste_name)
        print (self.cont_master._get_componentState())
        if(self.cont_master._get_componentState()==COMPSTATE_OPERATIONAL):
            print("Master Operational")
            self.cont=True
            time.sleep(3)
            return True
        return False
    def getState(self):
        if (self.cont):
          a=self.cont_master._get_currentStateHierarchy().get_sync()
          val=a[0]
          compl=a[1]
          print(val,"TimeStamp:",compl.timeStamp)

    def initPass1(self):
        if (self.cont):
          self.cont_master.doTransition(MasterComponent.SUBSYSEVENT_INITPASS1)
          self.getState()
    def initPass2(self):
        self.cont_master.doTransition(MasterComponent.SUBSYSEVENT_INITPASS2)
        self.getState()
    def shudownPass1(self):
        self.cont_master.doTransition(MasterComponent.SUBSYSEVENT_SHUTDOWNPASS1)
        self.getState()
    def shudownPass2(self):
        self.cont_master.doTransition(MasterComponent.SUBSYSEVENT_SHUTDOWNPASS2)
        self.getState()

    def releaseMaster(self):
        self.client.releaseComponent(self.cont_master._get_name())
        self.client.disconnect()
        self.cont_master = None

# **************************************************
# MAIN Program
# **************************************************
if __name__ == '__main__':
    '''
    Use this to startup manually, or as an example for your test script.
    '''
    # Get the handler
    TCSstateHandler = Startup_test('TESTMASTERCOMP')
    ret=TCSstateHandler.getMaster()
    TCSstateHandler.getState()
    time.sleep(3)	
    # Startup
    if ( not ret):
        exit(1)
    else:
        TCSstateHandler.initPass1()
        time.sleep(3)
        TCSstateHandler.initPass2()
    
    input("Hit return to shutdown")
    TCSstateHandler.shudownPass1()
    time.sleep(3)
    TCSstateHandler.shudownPass2()
    TCSstateHandler.releaseMaster()
    exit(0)

acs_tmcdb.sh

0 → 100644
+4 −0
Original line number Diff line number Diff line

export ENABLE_TMCDB=1

export TMCDB_CONFIGURATION_NAME=TEST 
Loading