After declaration of all different types of tables, the HDIs and SVX tables are inserted. Then the Interface boards, Sequencers and VRBs (and their channels, etc) are added. At this time a 1 to 1 mapping is still used in the database.
The Interface channels are connected to dummy HDIs which are deleted after the proper HDI is associated with the interface channel which belongs to it. Eventually, the interface channels are associated with the right Sequencer channels, which in their place are then assigned to certain VRB channels.
All these different steps consist of large amounts of SQL commands. The SQL commands belonging to each different step or part of the DAQ chain are saved in different files, to make it easier to modify single parts of it.
When extracting onl_smtcalib from CVS, the /onl_smtcalib/oracle/ directory will have the following file structure:
drwxr-xr-x 2 fblekman D0 57 Feb 7 18:32 CVS
-rw-r--r-- 1 fblekman D0 25980 Feb 7 19:00 createDb.sql
drwxr-xr-x 3 fblekman D0 4096 Feb 7 19:00 VBmodule
-> contains the Visual Basic Module
drwxr-xr-x 7 fblekman D0 4096 Feb 7 19:00 filesFromExcel
-> files created in excel
-rw-r--r-- 1 fblekman D0 537 Feb 7 19:00 setupWholeSMT.sql
drwxr-xr-x 3 fblekman D0 51 Feb 7 19:00 setupSMT
-> setupSMT.py
The files and directories used by setupWholeSMT.sql are underlined.
Run this script to create all SQL files needed for the setup of the database with the oracle account of your choice. One can also set the script to connect to the fblekman@d0on ORACLE account itself (by setting one of the variables at the top of the script), but at the moment it is more convenient to write to separate files first. If this script is not ran first, the setupWholeSMT.sql macro won't have all the files it needs. After running setupSMT.py python script, the setupSMT directory will contain a collection of SQL files.
This macro runs all different sql macros in the right order.
Look what's in there to get an idea of how it works. Essentially it first runs SetupDb.sql and then installs the HDIs, SVX chips, Crates, VRB and SEQ Controllers, Interface Boards, Sequencers and VRBs and their respective channels.
After setting up the basic framework, the connections between the different components are set, using the files created by the visual basic macro in excel. Eventually, this leads to the same connection between the components as in the real SMT.
The Visual Basic code for the Excel sheet is set up to ensure that the ingoing exceed worksheet can be changed fairly easily without having to completely re-write the VB code. To modify the VB code, open excel, select the SQL_Commands worksheet and right-click on the desired macro button. Then Choose "Assign Macro" to open a window and view the VB code. One of the choices there is "Edit", this opens the Microsoft Visual Basic Editor. (which can also be opened via the task bar.) The variables that can be modified easily are situated at the top of the VB script:
After changing any of these values the VB code should be recompiled. This can be done in the "debug" menu in the taskbar. Forgetting to recompile the code can leave you with no visual basic module at all belonging to the excel sheet. It is essential to compile the module before saving the excel file.
The visual basic module can also be imported (if you're getting a fresh module from CVS) or exported (if you want to save your module and then ftp it to one of the unix machines to update the version in CVS). These options can be found in the "file" menu in the taskbar.
Open the macro that saves the SQL commands in Excel. (see 6.) The filenames are defined at the top of the subroutine. Don’t forget to recompile and save the macro before closing excel.