IWAA2004, CERN, Geneva, 4-7 October 2004 1 DatAlign IMPLEMENTATION OF THE NEW APS SURVEY AND ALIGNMENT DATABASE * Jaromir M. Penicka, Horst W. Friedsam Argonne National Laboratory, Argonne, Illinois, U.S.A. 1. INTRODUCTION The Advanced Photon Source (APS) at Argonne National Laboratory is a national 3rdgeneration synchrotron-radiation light source research facility located about twenty-five miles southwest of Chicago. The APS accelerator systems and X-ray beamlines are approximately six kilometers in length with more than four thousand precisely aligned components. The APS Survey and Alignment Group (SAG) is responsible for the correct positioning of beamline components for the APS accelerator systems. SAG fiducializes beamline components, aligns components in the accelerator tunnel and in the experiment hall, and maintains all necessary geodetic control networks to achieve required placement tolerances. All these tasks generate large amounts of data that have to be stored and readily accessible to the SAG members. As a result, the utilization of a database system is inevitable. During the 1990s, the SAG depended on Geonet software [1] for its data storage and management needs. Geonet was originally developed under the DOS environment at SLAC in the 1980s as an all-inclusive software package for the accelerator alignment community. After a decade of a reliable service, Geonet unavoidably became obsolete. First, some Geonet utilities, like data collection and data reduction programs, were phased out or replaced by new tools to keep up with advancements in survey and alignment technology. By the year 2002, a decision was made to also replace the database portion of Geonet with a new relational database. The conceptual design of the new APS Survey and Alignment Database [2] was completed in 2002. After a review of commercially available database management systems (DBMSs), Microsoft Access 2000 was chosen for the implementation of our database design. The implementation of the new database (DB), under the name DatAlign, commenced the following year. 2. DATABASE IMPLEMENTATION A database application, like DatAlign, that is developed in the Access environment consist of tables, queries, forms, reports, macros, and modules. In addition to these primary objects, the Access developer can also make use of several miscellaneous objects like relationships, command bars, database properties, and import/export specifications. With all these objects, each of which has its own special function, one can create a powerful, user-friendly, and integrated application. 2.1. Tables and Relationships of DatAlign Tables are the fundamental information building blocks and the starting point for the DB implementation. They are the depositories for the data of interest. Relationships tie the tables Work supported by U.S. DOE, Office of Basic Energy Sciences, under Contract No. W-31-109-ENG-38.
IWAA Workshop, CERN, Geneva, 9-11 October 2000 2 together, enable the construction of larger information objects, and help to maintain the data integrity. The DatAlign relationship window (Fig. 1) reveals the basic structure of the implemented database. The schema closely follows our normalized relational model that was presented in greater detail at the IWAA 2002 at Spring-8, Japan. Figure 1 DatAlign tables and relationships. The DatAlign database is built around eleven related tables. A brief review of the diagram discloses the rationale of each table. The LATTICE table contains three-dimensional geometric coordinates of the lattice points and the rotations for the beam components at these points. The purpose of the table SUBSYSTEM is to quickly identify the location of a lattice point in terms of the accelerator subsystem and sector. The table COMPONENT, with a serial number of a component as a key, holds the common information about a component. The objective of FIDUCIAL is to store the local component coordinates of a fiducial. The primary key is a composite of a fiducial ID and the serial number of the component to which the fiducial belongs. The ROLL table contains roll values associated with some components. The table IDEAL has a dual function. First, it serves as an association object to assign components and their fiducials to the specific lattice points. This assignment creates a unique primary key for IDEAL by using a combination of identifiers of the LATTICE and FIDUCIAL tables. Second, the IDEAL table stores the data that is dependent on this assignment the ideal geodetic coordinates of fiducial points. The table TARGET contains information related to the target used for point
IWAA2004, CERN, Geneva, 4-7 October 2004 3 measurements and defines the virtual point associated with the measurements or coordinates. The SURVEY_PT table maintains the common data for any measured point, while the SURVEY_PT_1D, SURVEY_PT_2D, and SURVEY_PT_3D tables collect measured point coordinates, measuring methods, and order of survey networks. In addition, they hold hyperlinks to source data files, which are stored in a hierarchical directory on a server. As can be expected for a normalized relational design, all relationships among the DatAlign tables are of type one-to-many. For example, the relationship between tables COMPONENT and FIDUCIAL allows a particular component to have many fiducials, but a specific fiducial belongs to only one component. Additionally, all DatAlign relationships are established with enforced referential integrity. In the example relationship above, this implies that a fiducial and its coordinates cannot be inserted in the database unless the component to which it belongs already exists in the database. Also, one is not allowed to delete a record from the COMPONENT table if corresponding records exist in the FIDUCIAL table. 2.2. Forms, queries, and reports Designing the table structure is the most important and difficult task in database development. This is not quite obvious when looking at the database from a user s perspective. For users, the purpose of a database application is to provide forms, reports, and queries so that they can record data and obtain the information they need about objects important to their work. Nevertheless, it is the well designed underlying table structure that makes the implementation of queries, forms, and reports possible. Select queries are probably the most frequently used objects of DatAlign and one of the main reasons why we decided to develop the DatAlign database. Select queries are stored questions about data saved in the tables that allow the user to view and retrieve desired data. They are also the foundation for most forms and reports in DatAlign. The typical use of a select query, as well as the navigation through the DatAlign application, is shown in Fig. 2. This example illustrates the steps taken by a user who wants to find all the elevation data for sector 37 of the storage ring. Starting from the main menu the user navigates through the windows by selecting APS COORDS Elevations to the Search by location sector query. The dialog box then prompts the user to select a location from a combo box and enter the sector number. After clicking on the Run Query command button, the query executes and displays 49 records that meet the given criteria. Furthermore, the user is given the opportunity to view the source of each elevation record. A click on the hyperlink opens a Notepad window displaying the least squares adjustment output file, where the elevation data originated. The query result can be saved as an Excel sheet for further processing, which is a powerful feature of the Access environment. As in the example above, majority of the select queries in DatAlign were designed as parameter queries, prompting the user for criteria at runtime. The actual queries were developed using the SQL code or the QBE tool provided by Access. The query example above also demonstrates two of the many utilizations of forms in DatAlign. All navigation switchboards, as well as the custom dialog box in Fig. 2, were developed as form objects. Although the most common use of forms is for data entry, DatAlign often makes use of forms for displaying the results of more complex queries. For example, a user searching DatAlign for detailed information about a specific survey point, will receive results
IWAA Workshop, CERN, Geneva, 9-11 October 2000 Figure 2 Example of navigation through DatAlign to execute a parameter query. 4
IWAA Workshop, CERN, Geneva, 9-11 October 2000 5 of his query presented in a form Survey Point Details (Fig. 3). This form displays all the information stored in the database concerning the point in question. It shows point location; description; all 1D, 2D, and 3D data available for the point; information about the target associated with the point; as well as the target s image. This form is actually four forms in one: one main form and three subforms. Underlying the Survey Point Details form are four queries drawing the data from five tables. Figure 3 again points out that an inquisitive user can further explore the hyperlinks to view the source of the data outside of the database. In this case, the Bundle Adjustment Output File generated the coordinates of the measured point. Figure 3 Survey point details displayed in a form.
IWAA Workshop, CERN, Geneva, 9-11 October 2000 6 Although forms can be printed directly, reports are more suitable objects for displaying information on a printout. Reports provide greater control over the layout of the information to be printed. Consequently, if one expects certain forms to be printed, it is practical to emulate them as reports. The Survey Point Detail Report (Fig. 4) emulates the Survey Point Details form. The report was produced with very little effort because it was based on the same queries as the form above. Figure 4 Survey Point Detail Report print.
IWAA Workshop, CERN, Geneva, 9-11 October 2000 7 The logic flow built into the DatAlign application is implemented using macros and by the Visual Basic for Applications (VBA) code. The VBA functions and subroutines are stored in modules and can be triggered from an event like a click on the command button or the loading of a form (event procedures). Modules specific to a form are created and stored in that form and triggered from events taking place within it. All VBA code is written in the Visual Basic Editor (VBE) which is consistent with other Microsoft Office products. 3. CONCLUSION The APS Survey and Alignment Group, with two staff and seven technicians, is small in size yet produces relatively large amounts of data. Making this data available in a user-friendly, easy-to-maintain database for every member of SAG was one of the main goals we set for ourselves in the fall of 2002. Although we have been developing a new database on a timepermitting basis, the first version of DatAlign was released for testing in November 2003. Currently, we have approximately seventy five percent of the original design developed and about ninety percent of the Geonet legacy data migrated to DatAlign. The undertaking of implementing a new database was worth the effort. DatAlign has eliminated redundancies and anomalies found in Geonet and improved the data integrity and security. DatAlign has allowed us to track additional information not previously possible, and it has significantly increased retrieval and update flexibility of all our data. 4. ACKNOWLEDGEMENTS We would like to acknowledge the APS survey and alignment technicians Kris Mietsner and Ron Dettling for their efforts in transferring the old information from Geonet to the new DatAlign tables. Ron spent many days pacing through accelerator tunnels painstakingly collecting the missing serial numbers of beamline components, while Kris was tirelessly editing and regrouping Geonet data and making it digestible to DatAlign. Special thanks also go out to Cathy Eyberger for the helpful suggestions while editing and refining this paper. References [1] GEONET, Stanford Linear Accelerator Center Survey and Alignment Workshop on Data Processing Using Geonet for Accelerator Alignment, SLAC-PUB-395, February 1992. [2] J. Penicka, H. Friedsam, New Database Design for the APS Survey and Alignment Data, Proceedings of the Seventh International Workshop on Accelerator Alignment, Spring-8, Japan, October 2002.