110 likes | 240 Views
Source Controller software. Ianos Schmidt The University of Iowa. System. HE+. HO0. HE-. HO+1,+2. HO –1,-2. HB+. HB-. HF+. HF-. Services: Air drivers Electric drivers. Total 10 16. 2 3?. 2 3?. 0 2. 3 3. 0 0?. 0 0?. 0 0?. 3 3. 0 2.
E N D
Source Controller software Ianos Schmidt The University of Iowa
System HE+ HO0 HE- HO+1,+2 HO –1,-2 HB+ HB- HF+ HF- Services: Air drivers Electric drivers Total 10 16 2 3? 2 3? 0 2 3 3 0 0? 0 0? 0 0? 3 3 0 2 Air supply pressure switches Crate of controller boards Crate of controller boards DIM Client(s) Power supplies 5V,18V,24V Local control laptop DIM Server RS-485 links RS-232 directly to individual boards.
Software diagram Tools for testing, configuration and programming of controllers.+ Controller source code. Laptop Run Control Control PC RS-232 DIM Server RS-485 DIM clients DIM clients DIM client Database ? Controller boards Local disk Local tools for configuration, testing, and compiling code • Config. info • Tube maps • Source code Config. info Tube maps Source code Controller code and settings in flash memory
Controller software Each controller board contains a Philips 89C51RB2 microcontroller. The code for these is written in the native “8051 compatible” assembly language. The Assembly code is complied using ASM51, and the controllers are programmed using either WINISP or Flash Magic programming tools. All of these tools are free, and operate under Windows. The programming interface is non-proprietary and fully documented allowing the option to implement a custom programmer on any platform in the future if necessary. This code provides all functionality to operate the Purdue wire source drivers, and to provide a standard interface, regardless of driver type, via RS-232 or RS-485 to the DIM server. Information that describes the specific hardware and related behaviors is stored in a block of flash memory which is transferred to RAM at boot up. These values can be modified and resaved, or default values can be restored via the serial interface. Generally speaking these parameters will only need to be changed if the driver hardware or control electronics are changed.
DIM Server The DIM server communicates with the controller boards via RS-485, and produces a set of DIM services and commands specific to each controller board. There is one additional information service that consists of the status words from each of the drivers. Each controller is uniquely identified by its address and associated with information stored in either a file or a local database. This data set consists of the following information for each driver: • Driver name • Driver type (Electric Driver, Air Driver, Monitor, None). • Default tube map. • Port number • State (locked, Enabled,…) Board addresses are determined by the slot numbers in the crates. Each slot also holds the connector from a specific source driver control cable, thus the controller address is associated with specific driver locations on the experiment.
DIM Service information COMMAND SERVICES • Command name Format Parameter1 Parameter2 1. "CMS/HCAL/RSRC[_ServerSubname]/{DEV}/INIT I:2 Index Reel 2. "CMS/HCAL/RSRC[_ServerSubname]/{DEV}/GO" I:2 Index Reel 3. "CMS/HCAL/RSRC[_ServerSubname]/{DEV}/SCAN" I:2 Index_from Index_to 4. "CMS/HCAL/RSRC[_ServerSubname]/{DEV}/STOP" 5. "CMS/HCAL/RSRC[_ServerSubname]/DEBUG" I:2 Device(0 means all) level(0-3) Information services. -------------------- 1. "CMS/HCAL/RSRC[_ServerSubname]/STATUS" I:16 Contains status words (see lower) for all the 16 drivers 2. "CMS/HCAL/RSRC[_ServerSubname]/{DEV}/STATUS" I Service sends the structure SrcInfo: typedef struct { int message_counter; timeval time_stamp_1; //{int seconds; int mkseconds;} int status; int index_counter; int reel_counter; int motor_current; int speed; // not implemented yet in the driver timeval time_stamp_2; (int 0; int 0;} will be filled in the Event Builder }SrcInfo; * Does not include services for configuration information and tube maps.
Server log file The DIM server writes a local log file for each driver which contains an entry for each change in status. For changes in controller status an entry consists of all controller state information. Sample from log file: 10:03:00 254 160 0000 0010 884 2 0 107 0000 0000 0000 0000 0000 0000 10:03:04 254 160 0000 0011 583 2 48 107 0000 0000 0000 0000 0000 0000 10:03:05 254 160 0000 0010 634 2 56 107 0000 0000 0000 0000 0000 0000 10:03:15 254 160 0000 0000 5 2 0 24 0000 0000 0000 0000 0000 0000 10:04:44 Command SCAN recived with parameters: 7 7 10:04:44 254 160 0000 0110 6 2 5 78 0000 0000 0000 0000 0000 0000 10:04:45 254 160 0000 0000 0 2 0 78 0000 0000 0000 0000 0000 0000 10:04:45 254 160 0000 0010 0 2 0 105 0000 0000 0000 0000 0000 0000 10:04:46 254 160 0000 0000 0 2 0 107 0000 0000 0000 0000 0000 0000 10:04:46 254 160 0000 0101 0 2 37 80 0000 0000 0000 0000 0000 0000 10:04:47 254 160 0000 0000 0 3 0 78 0000 0000 0000 0000 0000 0000 10:04:47 254 160 0000 0101 0 3 47 78 0000 0000 0000 0000 0000 0000 10:04:49 254 160 0000 0000 0 4 0 78 0000 0000 0000 0000 0000 0000 10:04:49 254 160 0000 0101 0 4 53 78 0000 0000 0000 0000 0000 0000 10:04:50 254 160 0000 0000 0 5 0 78 0000 0000 0000 0000 0000 0000 Mon Jul 19 add comm status reel ind I V Errors0 Errors1 Warnings 10:04:50 254 160 0000 0101 0 5 36 78 0000 0000 0000 0000 0000 0000 10:04:51 254 160 0000 0000 0 6 0 78 0000 0000 0000 0000 0000 0000 10:04:52 254 160 0000 0101 0 6 42 78 0000 0000 0000 0000 0000 0000 10:04:53 254 160 0000 0000 0 7 1 78 0000 0000 0000 0000 0000 0000 10:05:03 254 160 0000 0001 3 7 44 105 0000 0000 0000 0000 0000 0000 10:06:18 254 160 0100 0001 6534 7 0 107 0000 0000 0000 0000 0000 0100
Tube maps Tube maps from files or a database will be used to provide specific information about the tubes that are connected to the drivers. Which map to use can be specified from a DIM client, otherwise the default specified in the configuration data will be used. Each entry is associated with the index number from the related driver. A tube map contains the following information: Global: • Map title • Driver type • First and last tube number • Optional default settings for the driver (parameter overrides) Tube specific: • Tube number. • Tube name (ie. “HE+1, sector 2, slice 1, layer 5”) • Tube status (skip, ok, warn, test) • Maximum length • Start of detector/area of interest • (Optional settings such as motor voltage/speed for extend/retract, in/out of detector)
DIM clients A Visual source controller client is under development using Borland tools. This provides an easy to use graphical interface that allows use all the available DIM services and commands. Ultimately this will be implemented in PVSS. Run control contains a client for merging the source controller data with DAQ data. Run control also provides sequence files to automate the sending of DIM commands. The run control DIM interface will have to be updated to use tube map and configuration information.
Miscellaneous Other software • Controller test program for sending raw serial commands to a controller card. This is to be used while the laptop is directly connected to the RS-232 connector on the front of a controller card. When connected in this way the controller is automatically dropped from the RS-485 buss allowing maintenance and testing of individual cards while the other cards are in operation, or for testing cards individually outside of the crate. • Tool for setting controller parameters and saving them to flash memory. Although this will rarely need to be done it is tedious to do using the raw serial commands. • DID (Dim display) Tool part of the DIM package for testing DIM servers. • Borland BCB for building code.
Status Controller code: • First version of Air driver code has been written and basic functionality tested. More work is needed before it is ready for use. • Electric driver controller code version 1 was completed last fall but needs to be modified to reflect changes made in the air driver code. • Geiger counter, speed readout, and possibly speed control have yet to be implemented. DIM server: • Recently ported to work with Borland tools. The Server can work on both windows and Linux platforms, and can be complied in both Microsoft Visual C++ and Borland. DIM server code is presently operational but use of the configuration and tube map information has yet to be implemented. DIM clients: • Visual client under development. Work with PVSS needs to be started. • Run control interface needs to be reviewed and modified to use tube maps. Database: • Need to establish interface to CMS databases if necessary. Work not yet started.