APEX Software Training Introduction or APECS from 10.000 ft above the ground Reinhold Schaaf for the Max-Planck-Institut für Radioastronomie Bonn Main packages TICS 2005/04/23 APECS 0.8 APEX specific part of control system Servers ObsClients ABM1 Components: ANTMOUNT TRAJECTORY CLOCK ... TICS Simulator MonClients CORBA objects for •Antenna control •Astronomical coordinate systems •Observing patterns ACS 2.01 Patterns, services and libraries for control systems MACI Manager Activator VERTEX BACI Config DB Notification Channel Logging Syste m ??? CORBA Communication in distributed, heterogeneous, multilanguage software systems IDL Services: Naming Logging Notify IR ORBs: TAO (C++) ORBAcus (Java) ominiORB (Python) Basic control of antenna hardware CORBA Well established middleware technology Facilitates communication among pieces of software in – distributed – heterogeneous – multilanguage environments Specification issued by the OMG - no implementation per se, but Various implementations of (parts of) the standard exist (e.g. TAO, omniORB, Orbacus) Two CORBA Acronyms Common Object Request Broker Architecture Object Management Group An open membership, not-forprofit consortium that produces and maintains computer industry specifications for interoperable enterprise applications. A basic CORBA concept Object: „An identifiable, encapsulated entity that provides one or more services that can be requested by a client.“ Example: A running instance of the FitsWriter program is an object that provides two methods (services): - start - stop Another basic CORBA concept Interface Definition Language (IDL): „The language used to describe the interfaces that client objects call and object implementations provide“ Example: Interface description of FitsWriter (Python!) in /soft/apex/APEX/idl/apexFW.idl: module apexFW { interface FitsWriter { long start(in long scanNum, in long obsNum, in string pickledScan); long stop(in string status); }; }; CORBA Services Used in APECS: Naming Service Allows location of objects Notification Service Distribution of events Logging Service Distribution of logging events Interface Repository Management of interface definitions CORBA Naming Service Example for the power of CORBA: Bring me the FitsWriter, wherever it is! FitsWriter registers itself at Naming Service: ObsEngine uses Naming Service to get FitsWriter: ... myFW = onlineFitsWriter() myFWS = myFW._this() ... ns = acsCORBA.nameService() name = [(CosNaming.NameComponent(\ „Online APEX FitsWriter“, „“)] ns = acsCORBA.nameService() name = [(CosNaming.NameComponent(\ „Online APEX FitsWriter“, „“)] ns.bind(name, myFWS) ... fw = ns.resolve(name) fw.start(…) ... ORB Object Request Broker Responsible for the communication of requests across OS and languange borders ACS Packages C++ container Management and Access Control Interface Basic Access Control Interface Notification channels BACI Basic Access Control Interface Implementation of C++ components according to Distributed Objects (DO) pattern Each DO represents a piece of controlable hardware to CORBA/ACS side of the system DOs are the interface between CORBA side and non-CORBA side of system Synonyms for DO: Component, COB BACI – DO pattern Example: «ROProperty» integrationTime NamedComponent «DO» APEX:FFTS «RWProperty» cmdIntegrationTime 1 * * DO Property «ROProperty» numSpecChan «DO» APEX:FFTS:BAND2 0..1 «RWProperty» cmdNumSpecChan ROProperty RWProperty «ROProperty» numSpecChan Similar to Composition Design Pattern «DO» APEX:FFTS:BAND1 «RWProperty» cmdNumSpecChan COBs in APECS Two general types of COBs: CAN COBs – Part of TICS: Translation of CORBA requests to CAN commands – CAN used for communication with VERTEX software SCPI COBs – Translation of CORBA requests to SCPI commands (UDP) – Used for communication with all non-Vertex hardware controllers – Automatic code generation from IDL CAN CAN - Controller Area Network Is a high-integrity serial data communications bus for real-time applications Operates at data rates of up to 1 Megabits per second Has excellent error detection and confinement capabilities Was originally developed by Bosch for use in cars Is now being used in many other industrial automation and control applications Is an international standard: ISO 11898 SCPI SCPI - Standard Commands for Programmable Instrumentation Common interface language between computers and test instruments Syntax is ASCII text Can be used with any computer language, such as Python, C, LabVIEW SCPI strings can be sent over any instrument interface, such as GPIB, RS232 or LAN networks Is issued by the SCPI consortium Example: Request: APEX:FFTS:BAND1:CMDNUMSPECCHAN 1024 Reply: APEX:FFTS:BAND1:CMDNUMSPECCHAN 1024 2005-11-07T12:17:38.310+000 In case of error: APEX:FFTS:BAND1:CMDNUMSPECCHAN ERROR HARDWARE-FAILURE 2005-11-07T12:17:38.310+000 CAN COBs VERTEX ABM CONTROL CAN TRAJECTORY::COB ACU CAN apexObsEngine CAN CORBA ANTMOUNT::COB Diagnostic tool: Python module apexObsUtils telescope hardware CAN PTC Diagnostic tool: CAN logger subreflector hardware SCPI COBs INSTRUMENTS CONTROL Ethernet / RS232 SCPI / UDP WEATHERSTATION::COB apexWeatherStation weatherstation hardware apexObsEngine CORBA FFTS::COB FFTS:BAND1::COB SCPI / UDP FFTS:BAND2::COB FFTS FFTS Control Program Diagnostic tool: Python module apexObsUtils Diagnostic tool: udp-telnet GPIB ? FFTS hardware Activators - Containers Components reside in Containers, which manage various technical aspects (connection to CDB, life cycle) and provide runtime environment for components group together related components SCPI COBs INSTRUMENTS CONTROL Ethernet / RS232 SCPI / UDP WEATHERSTATION::COB apexWeatherStation weatherstation hardware apexObsEngine CORBA FFTS::COB FFTS:BAND1::COB SCPI / UDP FFTS:BAND2::COB FFTS FFTS Control Program GPIB ? FFTS hardware SCPI COBs with Containers INSTRUMENTS environ Container CONTROL Ethernet / RS232 SCPI / UDP WEATHERSTATION::COB apexWeatherStation weatherstation hardware apexObsEngine CORBA febe Container FFTS::COB FFTS:BAND1::COB SCPI / UDP FFTS:BAND2::COB FFTS FFTS Control Program GPIB ? FFTS hardware Containers in APECS abm0: Simulation mode abm1: Real antenna abm0 / abm1 – – – – – APEX:CALUNITS APEX:IF … APEX:LABOCA APEX:MACS … opt – – APEX:HET345 APEX:CONDOR … febe2 – – – aux – – – APEX:WEATHERSTAION APEX:RADIOMETER … febe – – – environ – – – ABM1:ANTMOUNT ABM0:ANTMOUNT ABM1:POINTMODEL ABM1:WOBBLER … OPT:CLOCK OPT:OPTPOINT opttel – APEX:OPTTEL infra – – – APEX:RACKCHILLER APEX:DOORS … The abm1 container runs on ABM; all other containers on INSTRUMENTS MACI Management and Access Control Interface Implements the Containers (Activators) Knows about all DOs Central service: MACI Manager, acquainted with all DOs, CDB, and CORBA services Notification Channels A Notification Channel is an object that allows broadcasting notifications The ACS Notification Channels are based on the CORBA Notification Service Notifications are sent in the form of ACS structured events Notifications are sent in a many-to-many relationship by publishers to subscribers (listeners) Notifications are allways pushed (not pulled) NCs in APECS Archiving Data Sampling rate defined in CDB TACORA ABM abm1 Container TRAJECTORY::COB apexStatusDisplay CONTROL ANTMOUNT::COB Notification Service ACS structured events APEXDEV «Notication Channel» Archive INSTRUMENTS timonarchiver «Notication Channel» Positions febe Container FFTS::COB ACS structured events ACS structured events FFTS:BAND1::COB DISPLAY apexOnlineFitsWriter Positional Data Sampled every 48 ms FFTS:BAND2::COB NCs in APECS ABM abm1 Container TACORA TRAJECTORY::COB apexStatusDisplay CONTROL ANTMOUNT::COB Notification Service ACS structured events APEXDEV «Notication Channel» Archive INSTRUMENTS timonarchiver «Notication Channel» Positions febe Container FFTS::COB ACS structured events ACS structured events FFTS:BAND1::COB DISPLAY FFTS:BAND2::COB apexOnlineFitsWriter FFTS TCP data stream FFTS Control Program APECS – Top level overview MonClients APECS Deployment ObsClients More to come: •ObsLogger Client •Calibrator Client Servers APECS Software Training VMWare Images Walk through startAPECSSim, observe log messages and processes created Look into CDB (not covered in this introduction) to retrieve infos about the setup of the system Try out diagnosis of SCPI communication with udp-telnet Try out other things (e.g. behaviour with two apecs Clients) APECS Software Training APEX system Simulated mode: Walk through startAPECSServers, startAPECSMonClients, and startAPECSObsClients to explore deployment and understand processes on each machine Explore aspects not contained in VMWare image (e.g. DB2) Experience real-world problems and solve them Full mode: Try out CAN bus logger