Skip to content
Snippets Groups Projects
Commit ab4ca226 authored by Lize van den Heever's avatar Lize van den Heever
Browse files

Move skabase from lmc-lab to levpro

parent b1fa9304
No related branches found
No related tags found
No related merge requests found
Showing
with 2367 additions and 1 deletion
# levpro # levpro
## About
A shared repository for the LMC Base Classes Evolutionary Prototype (LEvPro) project that is done under the INDO-SA collaboration program. The output of this Prototype will be used to define a Software Development Kit for the Control System of the [Square Kilometre Array](http://skatelescope.org/) (SKA) radio telescope project. The Telescope Manager provides the Central Control System and each _Element_ provides a Local Control System that all work together as the Control System for the instrument. In the SKA case _Elements_ are subsystems such as the Central Signal Processor (CSP), Science Data Processor (SDP), Dishes (DSH), Low-Frequency Apperture Array (LFAA) etc. Control is implement using the distributed control system, [TANGO](http://www.tango-controls.org), which is accessed from Python using the [PyTango](https://github.com/tango-controls/pytango) package.
## Docs
SKA Control System guidelines: [Google docs folder](https://drive.google.com/drive/folders/0B8fhAW5QnZQWQ2ZlcjhVS0NmRms)
#!/usr/bin/env python
#from path_setter import *
from skabase.src.eltlogger import main
if __name__ == '__main__':
main()
#!/opt/aavs/python/bin/python
from path_setter import *
from skabase.src.eltmaster.eltmaster import main
if __name__ == '__main__':
main()
import sys
import os
# # import from package lmc_api
# sys.path.append('..')
# # pogo inheritance imports the class by name so we need to make the inheritance classes available in path
# sys.path.append('../lmc_api/servers/abstract')
print sys.argv
cwd = os.path.dirname(sys.argv[0])
if len(cwd):
os.chdir(cwd)
sys.path.append("..")
server_paths = ["../skabase/src/eltlogger",
"../skabase/src/eltmaster"]
sys.path.extend(["../skabase/src/core"])
sys.path.extend(server_paths)
#!/usr/bin/env bash
echo -e "\n==== Configuring ELT TANGO ====\n"
export SETUPDIR=$ELT_PATH/eltbase/setup
# Adding repositories to aptitude
PPA_TANGO="http://ppa.launchpad.net/tango-controls/core/ubuntu"
if ! grep -q $PPA_TANGO /etc/apt/sources.list /etc/apt/sources.list.d/* ; then
sudo add-apt-repository 'deb http://ppa.launchpad.net/tango-controls/core/ubuntu precise main'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A8780D2D6B2E9D50
sudo apt-key update
sudo apt-get -qq update
fi
# Setting parameters for packages which generate input prompts
sudo apt-get install -y debconf-utils
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password password"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password password"
sudo debconf-set-selections <<< "tango-common tango-common/tango-host string `echo $HOSTNAME:10000`"
sudo debconf-set-selections <<< "tango-db tango-db/mysql/admin-pass password password"
sudo debconf-set-selections <<< "tango-db tango-db/password-confirm password password"
sudo debconf-set-selections <<< "tango-db tango-db/app-password-confirm password password"
sudo debconf-set-selections <<< "tango-db tango-db/mysql/app-pass password password"
sudo debconf-set-selections <<< "tango-db tango-db/dbconfig-install boolean true"
# Installing required system packages
echo "Installing required system packages"
sudo apt-get -q install --force-yes --yes $(grep -vE "^\s*#" requirements.apt | tr "\n" " ")
# Installing tango
echo "Installing Tango"
sudo apt-get -q install --force-yes --yes tango-common tango-db tango-starter tango-test libtango8-dev libtango8-doc libtango-java
# Install required python packages
pushd python > /dev/null
pip install -r requirements.pip
popd > /dev/null
# Install PyTango
easy_install -U PyTango==8.1.8
# Setting up Ganglia configuration
# Copy configuration files to their destination
sudo cp setup/config/ganglia/gmetad.conf /etc/ganglia/gmetad.conf
sudo cp setup/config/ganglia/gmond.conf /etc/ganglia/gmond.conf
# Restart ganglia services
sudo service ganglia-monitor restart && sudo service gmetad restart
# Install Elettra Alarm database
echo "Setting up Elettra alarm database"
./setup/config/deploy/db.sh password
# Compile Elettra alarm and add it to device tree
if [ ! -f $ELT_PATH/eltbase/run/Alarm ]; then
echo "Compiling Elettra alarm database"
export ELETTRA_ALARM_SRC_DIR=$ELT_PATH/aavs-tango/3rdparty/alarm-server/src
sudo rm -rf -d $ELETTRA_ALARM_SRC_DIR/*.o
make -C $ELETTRA_ALARM_SRC_DIR
cp $ELETTRA_ALARM_SRC_DIR/Alarm $ELT_PATH/aavs-tango/python/run/Alarm
else
echo "Elettra alarm device exists, skipping compile"
fi
echo "Setting up Log directory"
sudo mkdir -p $ELT_LOG/tango
# Tango starter runs under user tango, so all device servers stared by it will be run as user tango
# so give ownership to the log directory to tango
sudo chown tango:tango $ELT_LOG/tango
echo "Setting up starter properties"
# Set the log directory and startup path properties in the TANGO starter device
sudo chmod +x ./setup/config/deploy/tango_starter_properties.py
./setup/config/deploy/tango_starter_properties.py $ELT_LOG $ELT_PATH
# Restart the TANGO starter for changes to take effect
sudo service tango-starter restart
echo "Wait for tango-starter restart"
sleep 5
echo "Setting up elt_ctl utility"
# Set up elt_sctl utility in $ELT_BIN
# elt_ctl utility used to configure, run, and get the status of device servers
./setup/config/deploy/elt_ctl.sh
echo "Setting up upstart job"
# Create upstart job to call "elt_ctl --run" on startup.
./setup/config/deploy/aavs-init-setup.sh
# Link default configuration file
if [ ! -f $ELT_CONFIG/tango_servers_config.py ]; then
ln -s $PWD/eltbase/config/servers_config.py $ELT_CONFIG/tango_servers_config.py
fi
#!/usr/bin/env python
import os
import sys
import platform
import argparse
import PyTango
import psutil
import json
import logging
from logging import config
from time import sleep
from PyTango import Database, DbDevInfo, DeviceProxy
sys.path.append('..')
from eltbase.config import config, CONFIG_FILE
LOGGING = {
'version': 1,
'formatters': {
'verbose': {
'format': '%(asctime)s [%(process)s] [%(levelname)s] [%(module)s] %(message)s',
'datefmt': "%Y-%m-%d %H:%M:%S"
},
'simple': {
'format': '%(message)s'
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
}
},
'loggers': {
'aavs.ctl': {
'handlers': ['console'],
'level': 'DEBUG',
},
'aavs.none': {
'handlers': [],
'level': 'DEBUG',
}
}
}
logging.config.dictConfig(LOGGING)
db = Database()
def setup_tango_config(loaded_config):
""" Set up tango configuration """
devices = loaded_config["devices"]
domain = loaded_config["domain"]
default_logging_target = loaded_config["default_logging_target"]
default_logging_level = loaded_config["default_logging_level"]
for group_name, instances in devices.iteritems():
for device_id, config in instances.iteritems():
device_class = config["class"]
full_device_name = "/".join([domain, group_name, device_id])
device_server_name = config.get("server", None)
device_server_id = config.get("server_id", domain)
db.put_device_property(full_device_name, {"logging_level": default_logging_level,
"logging_target": default_logging_target})
# Set up all properties, substituting the actual value of domain for {domain}
for property_name, property_value in config["properties"].iteritems():
if type(property_value) is list:
formatted_val = map(lambda x: x.format(domain=domain), property_value)
else:
try:
formatted_val = property_value.format(domain=domain)
except Exception as e:
formatted_val = property_value
db.put_device_property(full_device_name, {str(property_name): formatted_val})
if group_name == "rack" and config.get("components"):
db.put_device_property(full_device_name, {"rack_components": json.dumps(config["components"])})
if device_server_name is None:
print "No device server specified for %s" % device_class
exit()
dev_info = DbDevInfo()
dev_info._class = device_class
dev_info.server = '%s/%s' % (device_server_name, device_server_id)
dev_info.name = full_device_name
db.add_device(dev_info)
def _get_servers(loaded_config):
""" Get list of servers from configuration """
devices = loaded_config["devices"]
priorities = loaded_config["server_priorities"]
default_priority = max(priorities.itervalues()) + 1
servers = set()
server_names = set()
for group_name, instances in devices.iteritems():
for device_id, config in instances.iteritems():
device_server_name = config.get("server", None)
is_python_server = config.get("python_server", True)
priority = priorities.get(device_server_name, default_priority)
if device_server_name not in server_names:
servers.add((device_server_name, is_python_server, priority))
server_names.add(device_server_name)
sorted_servers = sorted(servers, key=lambda x: x[2])
return sorted_servers
def status(use_json=False):
""" Check server configuration """
hostname = platform.uname()[1]
starter = "tango/admin/" + hostname
starter_dp = DeviceProxy(starter)
log_file_location = starter_dp.get_property("LogFileHome")["LogFileHome"][0]
running_servers = set(starter_dp.DevGetRunningServers(True))
domain = config["domain"]
if servers.issubset(running_servers):
info = json.dumps({
"config_file": CONFIG_FILE,
"log_location": log_file_location,
"status": "OK",
"servers_configured": list(servers),
"servers_running": list(running_servers),
}, indent=4)
if use_json:
print info
else:
log.info(info)
else:
not_running = servers.difference(running_servers)
if use_json:
print json.dumps({
"config_file": CONFIG_FILE,
"log_location": log_file_location,
"servers_configured": list(servers),
"servers_running": list(running_servers),
"servers_not_running": list(not_running),
"status": "FAULT"
}, indent=4)
else:
for s in not_running:
log.info("Configured server {} is not running".format(s))
def kill_everything(starter_dp, servers):
""" Kill all running servers and remove from database """
# Get list of running servers and stop them
running_servers = starter_dp.DevGetRunningServers(True)
for server in running_servers:
starter_dp.DevStop(server)
# Wait for servers to stop
while starter_dp.DevGetRunningServers(True):
log.info("Waiting for servers to stop")
sleep(2)
# Get list of processes which are still running
existing_processes = [p for p in psutil.process_iter()
if len(p.cmdline()) > 1
and p.name() in {s[0] for s in servers}]
# Kill these processes
for p in existing_processes:
log.info("Process {} pid {} is not dead. Killing".format(" ".join(p.cmdline()), p.pid))
try:
p.kill()
except psutil.AccessDenied as ad:
log.info("Could not kill process {}. Try running as root".format(p.pid))
# Get list of device servers registered in database (and remove list of default tango servers)
servers = set(db.get_server_list().value_string) - {'DataBaseds/2', 'TangoAccessControl/1', 'TangoTest/test',
'Starter/%s' % platform.uname()[1]}
# Remove servers from database
for server in servers:
try:
db.delete_server(server)
except Exception as e:
print e.message
# Script entry point
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Bootstrap')
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--run', action="store_true", default=False, help="Stop all devices, reconfigure and run")
group.add_argument('--status', action="store_true", default=False, help="Print the status of the tango servers")
group.add_argument('--config', action="store_true", default=False, help="Stop all devices and reconfigure")
group.add_argument('--stop', action="store_true", default=False, help="Print the status of the tango servers")
parser.add_argument('--use_json', action="store_true", default=False, help="Return output as json")
args = parser.parse_args()
domain = config["domain"]
servers = _get_servers(config)
log = logging.getLogger('aavs.ctl')
if args.use_json:
log.disabled = True
# TODO move prints to logging, output to json for all branches
hostname = platform.uname()[1]
starter = "tango/admin/" + hostname
starter_dp = DeviceProxy(starter)
if args.status:
status(args.use_json)
exit()
elif args.stop:
kill_everything(starter_dp, servers)
exit()
elif args.config or args.run:
kill_everything(starter_dp, servers)
# Setup all configuration
setup_tango_config(config)
if args.use_json:
exit()
else:
log.info("Configured with {}".format(CONFIG_FILE))
if args.run:
db = PyTango.Database()
# Start all required device servers
for server, _, priority in servers:
server_name = server + "/" + domain
server_info = db.get_server_info(server_name)
server_info.level = priority
server_info.mode = 1
server_info.host = hostname
db.put_server_info(server_info)
try:
# Start device server
starter_dp.DevStart(server_name)
# Wait for server to finish loading
class_name = db.get_device_class_list(server_name).value_string[3]
sleep(0.5)
retries = 0
while len(db.get_device_exported_for_class(class_name).value_string) == 0 and retries < 20:
log.info("Waiting for {} to start".format(server_name))
retries += 1
sleep(1)
if retries == 20:
raise Exception("Could not load {}".format(server_name))
except Exception as e:
print e
else:
log.info("Started {}".format(server_name))
#!/usr/bin/env python
"""A utility script we can make use of to convert the xmi files to a simple csv file."""
import csv
import subprocess
from tango_simlib import sim_xmi_parser
# Find the xmi files in the repo and store their paths
output = subprocess.check_output(["kat-search.py -f *.xmi"], shell=True)
# Create a list of of all the file paths.
strings = output.split("\n")
# Remove the string "DEFAULT", which is always the first output of 'kat-search.py'.
strings.remove("DEFAULTS")
# Create a csv file object.
with open("csv_file.csv", 'wb') as myfile:
wr = csv.writer(myfile, quoting=csv.QUOTE_ALL)
print csv.QUOTE_ALL
for fiel in strings:
xmi_parser = sim_xmi_parser.XmiParser()
try:
xmi_parser.parse(fiel)
except AttributeError:
continue
print fiel
attr_info = xmi_parser.get_reformatted_device_attr_metadata()
#cmd_info = xmi_parser.get_reformatted_cmd_metadata()
#dev_props = xmi_parser.get_reformatted_properties_metadata('deviceProperties')
#class_props = xmi_parser.get_reformatted_properties_metadata('classProperties')
for attr_name, attr_props in attr_info.items():
print attr_props
break
del xmi_parser
break
from PyTango import Database, DbDevInfo
import os, signal
# A reference on the Database
db = Database()
# Kill running servers
# Get device info of Tile
try:
dev_info = db.get_device_info('test/tile/1')
if dev_info.pid != 0:
os.kill(dev_info.pid, signal.SIGTERM) #o r signal.SIGKILL
print "Killed PID: %s" % dev_info.pid
except Exception as ex:
print "No process to kill for test/tile/1"
#get device info of ObsConf
try:
dev_info = db.get_device_info('test/obsconf/1')
if dev_info.pid != 0:
os.kill(dev_info.pid, signal.SIGTERM) #o r signal.SIGKILL
print "Killed PID: %s" % dev_info.pid
except Exception as ex:
print "No process to kill for test/obsconf/1"
#get device info of TPM
try:
dev_info = db.get_device_info('test/tpm_board/1')
if dev_info.pid != 0:
os.kill(dev_info.pid, signal.SIGTERM)
print "Killed PID: %s" % dev_info.pid
except Exception as ex:
print "No process to kill for test/tpm_board/1"
#get device info of Tile
def tile_device_info(device_id):
device_name = 'test/tile/%s' % device_id
try:
dev_info = db.get_device_info(device_name)
except Exception as ex:
dev_info = None
if not dev_info is None:
print "Device <<%s>> found:" % device_name
print "Name: %s" % (dev_info.name)
print "Class Name: %s" % (dev_info.class_name)
print "Full Name: %s" % (dev_info.ds_full_name)
print "Exported: %s" % (dev_info.exported)
print "IOR: %s" % (dev_info.ior)
print "Version: %s" % (dev_info.version)
print "PID: %s" % (dev_info.pid)
print "Started Date: %s" % (dev_info.started_date)
print "Stopped Date: %s" % (dev_info.stopped_date)
else:
# Define Tile device name
new_device_name = device_name
# Define the Tango Class served by this DServer
dev_info = DbDevInfo()
dev_info._class = "Tile_DS"
dev_info.server = "Tile_DS/test"
# add the device
dev_info.name = new_device_name
print("Creating device: %s" % new_device_name)
db.add_device(dev_info)
#get device info of TPM
def tpm_device_info(device_id):
device_name = 'test/tpm_board/%s' % device_id
try:
dev_info = db.get_device_info(device_name)
except Exception as ex:
dev_info = None
if not dev_info is None:
print "Device <<%s>> found:" % device_name
print "Name: %s" % (dev_info.name)
print "Class Name: %s" % (dev_info.class_name)
print "Full Name: %s" % (dev_info.ds_full_name)
print "Exported: %s" % (dev_info.exported)
print "IOR: %s" % (dev_info.ior)
print "Version: %s" % (dev_info.version)
print "PID: %s" % (dev_info.pid)
print "Started Date: %s" % (dev_info.started_date)
print "Stopped Date: %s" % (dev_info.stopped_date)
else:
# Define device name
new_device_name = device_name
# Define the Tango Class served by this DServer
dev_info = DbDevInfo()
dev_info._class = "TPM_DS"
dev_info.server = "TPM_DS/test"
# add the device
dev_info.name = new_device_name
print("Creating device: %s" % new_device_name)
db.add_device(dev_info)
#get device info of ObsConf
def obsconf_device_info(device_id):
device_name = 'test/obsconf/%s' % device_id
try:
dev_info = db.get_device_info(device_name)
except Exception as ex:
dev_info = None
if not dev_info is None:
print "Device <<%s>> found:" % device_name
print "Name: %s" % (dev_info.name)
print "Class Name: %s" % (dev_info.class_name)
print "Full Name: %s" % (dev_info.ds_full_name)
print "Exported: %s" % (dev_info.exported)
print "IOR: %s" % (dev_info.ior)
print "Version: %s" % (dev_info.version)
print "PID: %s" % (dev_info.pid)
print "Started Date: %s" % (dev_info.started_date)
print "Stopped Date: %s" % (dev_info.stopped_date)
else:
# Define device name
new_device_name = device_name
# Define the Tango Class served by this DServer
dev_info = DbDevInfo()
dev_info._class = "ObservationConfiguration"
dev_info.server = "ObservationConfiguration/test"
# add the device
dev_info.name = new_device_name
print("Creating device: %s" % new_device_name)
db.add_device(dev_info)
obsconf_device_info('main')
tpm_device_info(1)
tile_device_info(1)
\ No newline at end of file
[nosetests]
verbosity=3
detailed-errors=1
with-xunit=1
setup.py 0 → 100644
#!/usr/bin/env python
###############################################################################
# SKA South Africa (http://ska.ac.za/) #
# Author: cam@ska.ac.za #
# Copyright @ 2013 SKA SA. All rights reserved. #
# #
# THIS SOFTWARE MAY NOT BE COPIED OR DISTRIBUTED IN ANY FORM WITHOUT THE #
# WRITTEN PERMISSION OF SKA SA. #
###############################################################################
from setuptools import setup, find_packages
setup(name="skabase",
description="Element Base Classes - Evolutionary Prototype",
author="MeerKAT CAM Team",
author_email="cam@ska.ac.za",
packages=find_packages(),
include_package_data=True,
scripts=["scripts/gen_csv_info.py",
"scripts/elt_ctl.py",
"run/eltlogger_DS",
"run/eltmaster_DS",
],
url='http://ska.ac.za/',
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: Other/Proprietary License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Scientific/Engineering :: Astronomy"],
platforms=["OS Independent"],
setup_requires=[],
install_requires=[
"enum34",
"argparse"
],
tests_require=[
"nose",
"coverage",
"nosexcover",
"unittest2"
],
keywords="elt lmc ska",
test_suite="nose.collector",
zip_safe=False)
<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<classes name="SKAMaster" pogoRevision="9.1">
<description description="A master test" title="" sourcePath="/Users/lvdheever/link-devl5/lmc-lab/eltbase/eltbase/servers/abstract" language="Python" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" hasMandatoryProperty="true" hasConcreteProperty="false" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<inheritances classname="SKAObsDevice" sourcePath=""/>
<identification contact="at ska.ac.za - cam" author="cam" emailDomain="ska.ac.za" classFamily="SkaCore" siteSpecific="" platform="All Platforms" bus="Not Applicable" manufacturer="none" reference=""/>
</description>
<deviceProperties name="ElementLoggerAddress" description="FQDN of the Element Logger DS">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true"/>
</deviceProperties>
<deviceProperties name="ElementAlarmsAddress" description="FQDN of the Element AlarmHandler DS">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true"/>
</deviceProperties>
<deviceProperties name="ElementTelStateAddress" description="FQDN of the Element TelState DS">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true"/>
</deviceProperties>
<deviceProperties name="ElementDatabaseAddress" description="FQDN of the Element Database DS">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true"/>
</deviceProperties>
<deviceProperties name="NrSubarrays" description="Nr of subarrays for this Element">
<type xsi:type="pogoDsl:ShortType"/>
<status abstract="false" inherited="false" concrete="true"/>
</deviceProperties>
</classes>
</pogoDsl:PogoSystem>
<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<classes name="SKAMaster" pogoRevision="9.1">
<description description="A master test" title="" sourcePath="/Users/lvdheever/link-devl5/lmc-lab/eltbase/eltbase/servers/abstract" language="Python" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" hasMandatoryProperty="true" hasConcreteProperty="false" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<inheritances classname="SKAObsDevice" sourcePath=""/>
<inheritances classname="SKAGroup" sourcePath=""/>
<identification contact="at ska.ac.za - cam" author="cam" emailDomain="ska.ac.za" classFamily="SkaCore" siteSpecific="" platform="All Platforms" bus="Not Applicable" manufacturer="none" reference=""/>
</description>
</classes>
</pogoDsl:PogoSystem>
<?xml version="1.0" encoding="ASCII"?>
<!ENTITY SKAGroup_api SYSTEM "SKAGroup_api.xml">
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<classes name="SKAMaster" pogoRevision="9.1">
<description description="A master test" title="" sourcePath="/Users/lvdheever/link-devl5/lmc-lab/eltbase/eltbase/servers/abstract" language="Python" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" hasMandatoryProperty="true" hasConcreteProperty="false" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<inheritances classname="SKAObsDevice" sourcePath=""/>
<identification contact="at ska.ac.za - cam" author="cam" emailDomain="ska.ac.za" classFamily="SkaCore" siteSpecific="" platform="All Platforms" bus="Not Applicable" manufacturer="none" reference=""/>
</description>
<!-- &SKAGroup_api; -->
</pogoDsl:PogoSystem>
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# ############################################################################
# license :
# ============================================================================
#
# File : SKABaseDevice.py
#
# Project : SKABASE
#
# This file is part of Tango device class.
#
# Tango is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Tango 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Tango. If not, see <http://www.gnu.org/licenses/>.
#
#
# $Author : cam$
#
# $Revision : $
#
# $Date : $
#
# $HeadUrl : $
# ============================================================================
# This file is generated by POGO
# (Program Obviously used to Generate tango Object)
# ############################################################################
__all__ = ["SKABaseDevice", "SKABaseDeviceClass", "main"]
__docformat__ = 'restructuredtext'
import PyTango
import sys
# Add additional import
#----- PROTECTED REGION ID(SKABaseDevice.additionnal_import) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.additionnal_import
# Device States Description
# ON :
# OFF :
# FAULT :
# INIT :
# ALARM :
# UNKNOWN :
# STANDBY : Equates to LOW-POWER mode.\nThis is the initial transition from INIT \nif the device supports a low-power mode.
class SKABaseDevice (PyTango.Device_4Impl):
"""A generic base device for SKA."""
# -------- Add you global variables here --------------------------
#----- PROTECTED REGION ID(SKABaseDevice.global_variables) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.global_variables
def __init__(self, cl, name):
PyTango.Device_4Impl.__init__(self,cl,name)
self.debug_stream("In __init__()")
SKABaseDevice.init_device(self)
#----- PROTECTED REGION ID(SKABaseDevice.__init__) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.__init__
def delete_device(self):
self.debug_stream("In delete_device()")
#----- PROTECTED REGION ID(SKABaseDevice.delete_device) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.delete_device
def init_device(self):
self.debug_stream("In init_device()")
self.get_device_properties(self.get_device_class())
self.attr_buildState_read = ""
self.attr_versionId_read = ""
self.attr_centralLoggingLevel_read = 0
self.attr_elementLoggingLevel_read = 0
self.attr_storageLoggingLevel_read = 0
self.attr_healthState_read = ''
self.attr_adminMode_read = ''
self.attr_controlMode_read = ''
self.attr_simulationMode_read = False
self.attr_testMode_read = ""
#----- PROTECTED REGION ID(SKABaseDevice.init_device) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.init_device
def always_executed_hook(self):
self.debug_stream("In always_excuted_hook()")
#----- PROTECTED REGION ID(SKABaseDevice.always_executed_hook) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.always_executed_hook
# -------------------------------------------------------------------------
# SKABaseDevice read/write attribute methods
# -------------------------------------------------------------------------
def read_buildState(self, attr):
self.debug_stream("In read_buildState()")
#----- PROTECTED REGION ID(SKABaseDevice.buildState_read) ENABLED START -----#
attr.set_value(self.attr_buildState_read)
#----- PROTECTED REGION END -----# // SKABaseDevice.buildState_read
def read_versionId(self, attr):
self.debug_stream("In read_versionId()")
#----- PROTECTED REGION ID(SKABaseDevice.versionId_read) ENABLED START -----#
attr.set_value(self.attr_versionId_read)
#----- PROTECTED REGION END -----# // SKABaseDevice.versionId_read
def read_centralLoggingLevel(self, attr):
self.debug_stream("In read_centralLoggingLevel()")
#----- PROTECTED REGION ID(SKABaseDevice.centralLoggingLevel_read) ENABLED START -----#
attr.set_value(self.attr_centralLoggingLevel_read)
#----- PROTECTED REGION END -----# // SKABaseDevice.centralLoggingLevel_read
def read_elementLoggingLevel(self, attr):
self.debug_stream("In read_elementLoggingLevel()")
#----- PROTECTED REGION ID(SKABaseDevice.elementLoggingLevel_read) ENABLED START -----#
attr.set_value(self.attr_elementLoggingLevel_read)
#----- PROTECTED REGION END -----# // SKABaseDevice.elementLoggingLevel_read
def read_storageLoggingLevel(self, attr):
self.debug_stream("In read_storageLoggingLevel()")
#----- PROTECTED REGION ID(SKABaseDevice.storageLoggingLevel_read) ENABLED START -----#
attr.set_value(self.attr_storageLoggingLevel_read)
#----- PROTECTED REGION END -----# // SKABaseDevice.storageLoggingLevel_read
def write_storageLoggingLevel(self, attr):
self.debug_stream("In write_storageLoggingLevel()")
data = attr.get_write_value()
#----- PROTECTED REGION ID(SKABaseDevice.storageLoggingLevel_write) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.storageLoggingLevel_write
def read_healthState(self, attr):
self.debug_stream("In read_healthState()")
#----- PROTECTED REGION ID(SKABaseDevice.healthState_read) ENABLED START -----#
attr.set_value(self.attr_healthState_read)
#----- PROTECTED REGION END -----# // SKABaseDevice.healthState_read
def read_adminMode(self, attr):
self.debug_stream("In read_adminMode()")
#----- PROTECTED REGION ID(SKABaseDevice.adminMode_read) ENABLED START -----#
attr.set_value(self.attr_adminMode_read)
#----- PROTECTED REGION END -----# // SKABaseDevice.adminMode_read
def write_adminMode(self, attr):
self.debug_stream("In write_adminMode()")
data = attr.get_write_value()
#----- PROTECTED REGION ID(SKABaseDevice.adminMode_write) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.adminMode_write
def read_controlMode(self, attr):
self.debug_stream("In read_controlMode()")
#----- PROTECTED REGION ID(SKABaseDevice.controlMode_read) ENABLED START -----#
attr.set_value(self.attr_controlMode_read)
#----- PROTECTED REGION END -----# // SKABaseDevice.controlMode_read
def write_controlMode(self, attr):
self.debug_stream("In write_controlMode()")
data = attr.get_write_value()
#----- PROTECTED REGION ID(SKABaseDevice.controlMode_write) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.controlMode_write
def read_simulationMode(self, attr):
self.debug_stream("In read_simulationMode()")
#----- PROTECTED REGION ID(SKABaseDevice.simulationMode_read) ENABLED START -----#
attr.set_value(self.attr_simulationMode_read)
#----- PROTECTED REGION END -----# // SKABaseDevice.simulationMode_read
def write_simulationMode(self, attr):
self.debug_stream("In write_simulationMode()")
data = attr.get_write_value()
#----- PROTECTED REGION ID(SKABaseDevice.simulationMode_write) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.simulationMode_write
def read_testMode(self, attr):
self.debug_stream("In read_testMode()")
#----- PROTECTED REGION ID(SKABaseDevice.testMode_read) ENABLED START -----#
attr.set_value(self.attr_testMode_read)
#----- PROTECTED REGION END -----# // SKABaseDevice.testMode_read
def write_testMode(self, attr):
self.debug_stream("In write_testMode()")
data = attr.get_write_value()
#----- PROTECTED REGION ID(SKABaseDevice.testMode_write) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.testMode_write
def read_attr_hardware(self, data):
self.debug_stream("In read_attr_hardware()")
#----- PROTECTED REGION ID(SKABaseDevice.read_attr_hardware) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.read_attr_hardware
# -------------------------------------------------------------------------
# SKABaseDevice command methods
# -------------------------------------------------------------------------
#----- PROTECTED REGION ID(SKABaseDevice.programmer_methods) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.programmer_methods
class SKABaseDeviceClass(PyTango.DeviceClass):
# -------- Add you global class variables here --------------------------
#----- PROTECTED REGION ID(SKABaseDevice.global_class_variables) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.global_class_variables
# Class Properties
class_property_list = {
}
# Device Properties
device_property_list = {
'SkaLevel':
[PyTango.DevShort,
"Indication of importance of the device in the SKA hierarchy \nto support drill-down navigation: 1..6, with 1 highest.\nDefault is 4, making provision for \nEltMaster, EltAlarms, EltTelState = 1\nSubEltMaster = 2\nSubarray, Capability = 2/3\nOthers = 4 (or 5 or 6)",
[4]],
'ManagedDevices':
[PyTango.DevVarStringArray,
"List of devices managed by a master. \nA proxy client will be opened for each of the managed devices.\nA group may be instantiated for the Managed Devices.\n(NOTE: Possible that SKAGroup may be used for this in future instead of \nputting the ManagedDevices here.)",
[] ],
'CentralLoggingTarget':
[PyTango.DevString,
"Pre-configured logging target CentralLogger DS",
[] ],
'ElementLoggingTarget':
[PyTango.DevString,
"Pre-configured logging target ElementLogger DS",
[] ],
'StorageLoggingTarget':
[PyTango.DevString,
"Pre-configured logging target for syslog",
["localhost"] ],
'CentralLoggingLevelDefault':
[PyTango.DevLong,
"Default logging level to Central logging target\n(0=OFF, 1=FATAL, 2=ERROR, 3=WARNING, 4=INFO, 5=DEBUG)\n\nDefault: 2",
[] ],
'ElementLoggingLevelDefault':
[PyTango.DevLong,
"Default logging level to Element logging target\n(0=OFF, 1=FATAL, 2=ERROR, 3=WARNING, 4=INFO, 5=DEBUG)\n\nDefault: 3",
[] ],
'StorageLoggingLevelStorage':
[PyTango.DevLong,
"Default logging level to Syslog logging target\n(0=OFF, 1=FATAL, 2=ERROR, 3=WARNING, 4=INFO, 5=DEBUG)\n\nDefault: 4",
[] ],
}
# Command definitions
cmd_list = {
}
# Attribute definitions
attr_list = {
'buildState':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ],
{
'description': "Build state of this device",
'Polling period': "60000",
} ],
'versionId':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ],
{
'description': "Build state of this device",
'Polling period': "60000",
} ],
'centralLoggingLevel':
[[PyTango.DevLong,
PyTango.SCALAR,
PyTango.READ],
{
'description': "Current logging level to Central logging target for this device - \ninitialises to CentralLoggingLevelDefault on startup",
} ],
'elementLoggingLevel':
[[PyTango.DevLong,
PyTango.SCALAR,
PyTango.READ],
{
'description': "Current logging level to Element logging target for this device - \ninitialises to ElementLoggingLevelDefault on startup",
} ],
'storageLoggingLevel':
[[PyTango.DevLong,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "Current logging level to Syslog for this device - \ninitialises from StorageLoggingLevelDefault on first execution of device.\nNeeds to be READ_WRITE To make it memorized - but writing this attribute should \ndo the same as command SetStorageLoggingLevel to ensure the targets and adjustments\nare made correctly",
'Memorized':"true_without_hard_applied"
} ],
'healthState':
[[,
PyTango.SCALAR,
PyTango.READ],
{
'description': "The health state reported for this device. It interprets the current device condition \nand condition of all managed devices to set this. Most possibly an aggregate attribute.",
} ],
'adminMode':
[[,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "The admin mode reported for this device. It may interpret the current device condition \nand condition of all managed devices to set this. Most possibly an aggregate attribute.",
'Memorized':"true_without_hard_applied"
} ],
'controlMode':
[[,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "The control mode of the device. REMOTE, LOCAL\nTANGO Device accepts only from a ‘local’ client and ignores commands and queries received from TM\nor any other ‘remote’ clients. The Local clients has to release LOCAL control before REMOTE clients\ncan take control again.",
'Memorized':"true_without_hard_applied"
} ],
'simulationMode':
[[PyTango.DevBoolean,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "Reports the simulation mode of the device. Some devices may implement both modes,\nwhile others will have simulators that set simulationMode to True while the real\ndevices always set simulationMode to False.",
'Memorized':"true_without_hard_applied"
} ],
'testMode':
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'description': "The test mode of the device. \nEither no test mode (empty string) or an indication of the test mode.",
'Memorized':"true_without_hard_applied"
} ],
}
def main():
try:
py = PyTango.Util(sys.argv)
py.add_class(SKABaseDeviceClass, SKABaseDevice, 'SKABaseDevice')
#----- PROTECTED REGION ID(SKABaseDevice.add_classes) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKABaseDevice.add_classes
U = PyTango.Util.instance()
U.server_init()
U.server_run()
except PyTango.DevFailed as e:
print ('-------> Received a DevFailed exception:', e)
except Exception as e:
print ('-------> An unforeseen exception occured....', e)
if __name__ == '__main__':
main()
<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<classes name="SKABaseDevice" pogoRevision="9.1">
<description description="A generic base device for SKA." title="SKABASE" sourcePath="/Users/lvdheever/svn/lmc-lab/skabase/skabase/core" language="Python" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" hasMandatoryProperty="true" hasConcreteProperty="true" hasAbstractCommand="true" hasAbstractAttribute="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<identification contact="at ska.ac.za - cam" author="cam" emailDomain="ska.ac.za" classFamily="OtherInstruments" siteSpecific="" platform="All Platforms" bus="Not Applicable" manufacturer="ISSA" reference="ISSA-SKABASE-SKABASE"/>
</description>
<deviceProperties name="SkaLevel" description="Indication of importance of the device in the SKA hierarchy &#xA;to support drill-down navigation: 1..6, with 1 highest.&#xA;Default is 4, making provision for &#xA;EltMaster, EltAlarms, EltTelState = 1&#xA;SubEltMaster = 2&#xA;Subarray, Capability = 2/3&#xA;Others = 4 (or 5 or 6)">
<type xsi:type="pogoDsl:ShortType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<DefaultPropValue>4</DefaultPropValue>
</deviceProperties>
<deviceProperties name="ManagedDevices" description="List of devices managed by a master. &#xA;A proxy client will be opened for each of the managed devices.&#xA;A group may be instantiated for the Managed Devices.&#xA;(NOTE: Possible that SKAGroup may be used for this in future instead of &#xA;putting the ManagedDevices here.)">
<type xsi:type="pogoDsl:StringVectorType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="CentralLoggingTarget" description="Pre-configured logging target CentralLogger DS">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="ElementLoggingTarget" description="Pre-configured logging target ElementLogger DS">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="StorageLoggingTarget" description="Pre-configured logging target for syslog">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<DefaultPropValue>localhost</DefaultPropValue>
</deviceProperties>
<deviceProperties name="CentralLoggingLevelDefault" mandatory="true" description="Default logging level to Central logging target&#xA;(0=OFF, 1=FATAL, 2=ERROR, 3=WARNING, 4=INFO, 5=DEBUG)&#xA;&#xA;Default: 2">
<type xsi:type="pogoDsl:IntType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="ElementLoggingLevelDefault" mandatory="true" description="Default logging level to Element logging target&#xA;(0=OFF, 1=FATAL, 2=ERROR, 3=WARNING, 4=INFO, 5=DEBUG)&#xA;&#xA;Default: 3">
<type xsi:type="pogoDsl:IntType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="StorageLoggingLevelStorage" mandatory="true" description="Default logging level to Syslog logging target&#xA;(0=OFF, 1=FATAL, 2=ERROR, 3=WARNING, 4=INFO, 5=DEBUG)&#xA;&#xA;Default: 4">
<type xsi:type="pogoDsl:IntType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<commands name="Reset" description="Reset device to its default state" execMethod="reset" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="true" inherited="false" concrete="false" concreteHere="false"/>
</commands>
<commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Device state">
<type xsi:type="pogoDsl:StateType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<commands name="Status" description="This command gets the device status (stored in its device_status data member) and returns it to the caller." execMethod="dev_status" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Device status">
<type xsi:type="pogoDsl:ConstStringType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<attributes name="buildState" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="60000" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="Build state of this device" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="versionId" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="60000" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="Build state of this device" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="centralLoggingLevel" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="false">
<dataType xsi:type="pogoDsl:IntType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="Current logging level to Central logging target for this device - &#xA;initialises to CentralLoggingLevelDefault on startup" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="elementLoggingLevel" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:IntType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="Current logging level to Element logging target for this device - &#xA;initialises to ElementLoggingLevelDefault on startup" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="storageLoggingLevel" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:IntType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="Current logging level to Syslog for this device - &#xA;initialises from StorageLoggingLevelDefault on first execution of device.&#xA;Needs to be READ_WRITE To make it memorized - but writing this attribute should &#xA;do the same as command SetStorageLoggingLevel to ensure the targets and adjustments&#xA;are made correctly" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="healthState" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:EnumType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The health state reported for this device. It interprets the current device condition &#xA;and condition of all managed devices to set this. Most possibly an aggregate attribute." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
<enumLabels>OK</enumLabels>
<enumLabels>DEGRADED</enumLabels>
<enumLabels>FAILED</enumLabels>
<enumLabels>UNKNOWN</enumLabels>
</attributes>
<attributes name="adminMode" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:EnumType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The admin mode reported for this device. It may interpret the current device condition &#xA;and condition of all managed devices to set this. Most possibly an aggregate attribute." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
<enumLabels>ON-LINE</enumLabels>
<enumLabels>OFF-LINE</enumLabels>
<enumLabels>MAINTENANCE</enumLabels>
<enumLabels>NOT-FITTED</enumLabels>
<enumLabels>RESERVED</enumLabels>
</attributes>
<attributes name="controlMode" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:EnumType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The control mode of the device. REMOTE, LOCAL&#xA;TANGO Device accepts only from a &#x2018;local&#x2019; client and ignores commands and queries received from TM&#xA;or any other &#x2018;remote&#x2019; clients. The Local clients has to release LOCAL control before REMOTE clients&#xA;can take control again." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
<enumLabels>REMOTE</enumLabels>
<enumLabels>LOCAL</enumLabels>
</attributes>
<attributes name="simulationMode" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:BooleanType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="Reports the simulation mode of the device. Some devices may implement both modes,&#xA;while others will have simulators that set simulationMode to True while the real&#xA;devices always set simulationMode to False." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="testMode" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The test mode of the device. &#xA;Either no test mode (empty string) or an indication of the test mode." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<states name="ON" description="">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
<states name="OFF" description="">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
<states name="FAULT" description="">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
<states name="INIT" description="">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
<states name="ALARM" description="">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
<states name="UNKNOWN" description="">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
<states name="STANDBY" description="Equates to LOW-POWER mode.&#xA;This is the initial transition from INIT &#xA;if the device supports a low-power mode.">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
<preferences docHome="./doc_html" makefileHome="$(TANGO_HOME)"/>
</classes>
</pogoDsl:PogoSystem>
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# ############################################################################
# license :
# ============================================================================
#
# File : SKACapability.py
#
# Project :
#
# This file is part of Tango device class.
#
# Tango is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Tango 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Tango. If not, see <http://www.gnu.org/licenses/>.
#
#
# $Author : cam$
#
# $Revision : $
#
# $Date : $
#
# $HeadUrl : $
# ============================================================================
# This file is generated by POGO
# (Program Obviously used to Generate tango Object)
# ############################################################################
__all__ = ["SKACapability", "SKACapabilityClass", "main"]
__docformat__ = 'restructuredtext'
import PyTango
import sys
# Add additional import
#----- PROTECTED REGION ID(SKACapability.additionnal_import) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKACapability.additionnal_import
# Device States Description
# No states for this device
class SKACapability (PyTango.Device_4Impl):
"""SubArray handling device"""
# -------- Add you global variables here --------------------------
#----- PROTECTED REGION ID(SKACapability.global_variables) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKACapability.global_variables
def __init__(self, cl, name):
PyTango.Device_4Impl.__init__(self,cl,name)
self.debug_stream("In __init__()")
SKACapability.init_device(self)
#----- PROTECTED REGION ID(SKACapability.__init__) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKACapability.__init__
def delete_device(self):
self.debug_stream("In delete_device()")
#----- PROTECTED REGION ID(SKACapability.delete_device) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKACapability.delete_device
def init_device(self):
self.debug_stream("In init_device()")
self.get_device_properties(self.get_device_class())
self.attr_subID_read = 0
self.attr_capID_read = ""
self.attr_maxInstances_read = 0
self.attr_availableInstances_read = 0
self.attr_activationTime_read = 0
#----- PROTECTED REGION ID(SKACapability.init_device) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKACapability.init_device
def always_executed_hook(self):
self.debug_stream("In always_excuted_hook()")
#----- PROTECTED REGION ID(SKACapability.always_executed_hook) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKACapability.always_executed_hook
# -------------------------------------------------------------------------
# SKACapability read/write attribute methods
# -------------------------------------------------------------------------
def read_attr_hardware(self, data):
self.debug_stream("In read_attr_hardware()")
#----- PROTECTED REGION ID(SKACapability.read_attr_hardware) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKACapability.read_attr_hardware
# -------------------------------------------------------------------------
# SKACapability command methods
# -------------------------------------------------------------------------
#----- PROTECTED REGION ID(SKACapability.programmer_methods) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKACapability.programmer_methods
class SKACapabilityClass(PyTango.DeviceClass):
# -------- Add you global class variables here --------------------------
#----- PROTECTED REGION ID(SKACapability.global_class_variables) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKACapability.global_class_variables
# Class Properties
class_property_list = {
}
# Device Properties
device_property_list = {
}
# Command definitions
cmd_list = {
}
# Attribute definitions
attr_list = {
}
def main():
try:
py = PyTango.Util(sys.argv)
py.add_class(SKACapabilityClass, SKACapability, 'SKACapability')
#----- PROTECTED REGION ID(SKACapability.add_classes) ENABLED START -----#
#----- PROTECTED REGION END -----# // SKACapability.add_classes
U = PyTango.Util.instance()
U.server_init()
U.server_run()
except PyTango.DevFailed as e:
print ('-------> Received a DevFailed exception:', e)
except Exception as e:
print ('-------> An unforeseen exception occured....', e)
if __name__ == '__main__':
main()
<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<classes name="SKACapability" pogoRevision="9.1">
<description description="SubArray handling device" title="" sourcePath="/Users/lvdheever/svn/lmc-lab/skabase/skabase/src/core" language="Python" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="" hasMandatoryProperty="false" hasConcreteProperty="false" hasAbstractCommand="false" hasAbstractAttribute="true">
<inheritances classname="Device_Impl" sourcePath=""/>
<identification contact="at ska.ac.za - cam" author="cam" emailDomain="ska.ac.za" classFamily="SkaCore" siteSpecific="" platform="All Platforms" bus="Not Applicable" manufacturer="none" reference=""/>
</description>
<commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Device state">
<type xsi:type="pogoDsl:StateType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<commands name="Status" description="This command gets the device status (stored in its device_status data member) and returns it to the caller." execMethod="dev_status" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Device status">
<type xsi:type="pogoDsl:ConstStringType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<attributes name="subID" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:UShortType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="true" inherited="false" concrete="false" concreteHere="false"/>
<properties description="The subarray this capability belongs to (e.g. sub01-sub16)." label="" unit="" standardUnit="" displayUnit="" format="%1d" maxValue="255" minValue="0" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="capID" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="true" inherited="false" concrete="false" concreteHere="false"/>
<properties description="The actual capability ID of this instance. The format is subIDCapType&#xA;e.g sub01PssBeams, or sub02VlbiBeams" label="" unit="" standardUnit="" displayUnit="" format="%1d" maxValue="255" minValue="0" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="maxInstances" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:UShortType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="true" inherited="false" concrete="false" concreteHere="false"/>
<properties description="Maximum nr of instances for this capability.&#xA;e.g. 4 for CSP-MID VlbiBeams" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="availableInstances" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:UShortType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="true" inherited="false" concrete="false" concreteHere="false"/>
<properties description="Nr of available instances for this capability." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="activationTime" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="256" maxY="" allocReadMember="false" isDynamic="false">
<dataType xsi:type="pogoDsl:UIntType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="true" inherited="false" concrete="false" concreteHere="false"/>
<properties description="Unix time of activation." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<preferences docHome="./doc_html" makefileHome="$(TANGO_HOME)"/>
</classes>
</pogoDsl:PogoSystem>
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment