## page was renamed from LCGT/subgroup/ifo/digital/RTPC/Notes_on_getting_the_CDS_Realtime_Code_Generator_working [[Anchor(TOP)]] [[TableOfContents(2)]] ---- == Obtaining the sources == . '''1)''' Check out the source from the svn. The repository is {{{https://redoubt.ligo-wa.caltech.edu/svn/advLigoRTS/trunk}}} . '''2)''' Change the approriate makefile in {{{cds/advLigo/config/Makefile}}}. . {i} In the original installiation on megatron, we had to correct the epics root. I.e. on megatron, installed in {{{/opt/}}} is {{{epics-3.14.7-linux}}}, . so we changed EPICS_ROOT to: {{{EPICS_ROOT=/opt/epics-3.14.7-linux}}} ---- == Constructing the model in Matlab == . '''1)''' Change to the editing directory . {{{ cd /opt/rtcds/caltech/c1/core/advLigoRTS/src/epics/simLink}}} . '''2)''' Start matlab and add the lib directory to the matlab path . {{{ matlab & }}} . In MATLAB . {{{ addpath lib}}} . '''3)''' Open {{{CDS_PARTS.mdl}}} and then open or create a .mdl file you want to work with. . {{{ open CDS_PARTS.mdl open c1sys.mdl }}} . where "sys" is the last 3 letters of the mdl file name identifying the system (i.e. c1sus for suspensions). . '''4)''' Read Rolf's document on what various parts do [https://dcc.ligo.org/cgi-bin/private/DocDB/ShowDocument?docid=1033 here]. . '''5)''' Gotchas! . /!\ The model '''must''' have at least 2 filter modules. . /!\ The cdsParameters block must have specific_cpu set to something other than 0 or 1 and it must have adcSlave set to 1. . /!\ Make sure the DCUID number is '''NOT''' overlaped with any other models by referencing: ["Electronics/Existing RCG DCUID and gds ids"] . /!\ Do not use the word "DUMMY" or "DEFAULT_NAME" in naming pieces. ---- == Updating/Creating the IPC file == === IPC file === . A file, starting with the site location, like C1.ipc or G1.ipc, lives in {{{/opt/rtcds/caltech/c1/chans/ipc/}}}. . This file relates a given name used in a model file, like C1:SUS-ETMY_COIL_UL to a memory location, like 0x20afc. . The memory location is actually a offset in memory plus a constant (64*8*2 I think) times its ipcNum listed in its entry. To use the naming feature of shared memory locations, this file must be updated with the correct information about a channel. === Updating IPC file === . The feCodeGen.pl script (called when you use the make c1SYS command in the /advLigoRTS directory) is now smart enough to update the ipc file itself. . However, it only adds to the ipc if the "sending" side of the communication is in the currently being compiled model. "Receiver" side connections which don't exist in the IPC file will cause an exit from the code with a message stating the IPC file is missing certain entries. . With 2 or more way communications between front ends, each front end model needs to be tried to made once (i.e. "make c1SYS"), before any of them will actually successfully build the model. ---- == Building the realtime executable == '''1)''' Log in to a realtime linux, otherwise some of the following commands doesn't properly run. . {{{ ssh -X megatron}}} '''2)''' Once the SYS.mdl file is finished, change your current directory to the advLigo directory . {{{ cd /opt/rtcds/caltech/c1/core/advLigoRTS }}} '''3)''' Run: . {{{ make uninstall-daq-SYS make clean-SYS make SYS make install-SYS make install-daq-SYS make install-screens-SYS }}} where SYS is the 3 letter name of the mdl file. . /!\ '''Note1: SYS.mdl must be one which directly saved from !SimuLink''' because "The RCG code does not work unless the name of the mdl file (simulink model) matches to the model name". This means that just copying the mdl file does not work for the new system. . /!\ '''Note2: '''Check you have '''at least two testpoints''' registered using '''daqconfig'''. Note a fresh install of daqconfig may require editing to point at the correct location. Change line 346 in the daqconfig script in /opt/rtcds/caltech/c1/scripts from set dir "/opt/rtcds/${site_name}/chans/daq" to set dir "/opt/rtcds/${site_name}/c1/chans/daq" . /!\ '''Note3: '''{{{make install-daq-SYS}}} doesn't seem to replace the previous {{{C1SYS.ini}}} file in {{{/cvs/cds/caltech/chans/daq}}} or {{{/opt/rtcds/caltech/c1/chans/daq}}}. If you modified the model significantly, you need to cleaning the previous {{{C1SYS.ini}}}, such that your testpoints are properly registered. . /!\ '''Note4: '' ---- == Running the realtime executable == '''1)''' start IOP process which controls the ADC inputs and the DAC outputs . {{{ cd /opt/rtcds/caltech/c1/scripts startIOP }}} '''2)''' To start the realtime process, run . {{{ cd /opt/rtcds/caltech/c1/scripts startSYS }}} '''3)''' Open medm screens to see if it's working. Particularly, the associated C1SYS_GDS_TP.adl screen is useful. The screens are usually in the {{{/opt/rtcds/caltech/c1/medm/SYS}}} directory. . {{{ medm -x /opt/rtcds/caltech/c1/medm/SYS/C1SYS_GDS_TP.adl & }}} . /!\ If its not running, try setting "BURT Restore" to 1 (lower left of the screen). . /!\ If you are using shared memory, you will have to '''modify the {{{/etc/rc.d/rc.local}}}''' file and add the part to the line that looks like: . {{{ /usr/bin/setup_shmem.rtl SY1 SY2 SY3 & }}} where SY1, SY2, etc are the 3 letter names of the system. This will take care of things at boot time. However, to immediately get it working,: * Kill the current copy of setup_shmem (as root, type {{{ps -ef | grep * setup_shmem}}} and then kill the process). * Then as root run {{{/usr/bin/setup_shmem.rtl SY1 SY2 SY3}}} etc, with the * appropriate module names. ---- == Frame Builder issues == === Status === . 1. The frame builder is running on the fb machine, and is currently automatically started (and restarted if necessary) by the init process. . 2. To restart this process, after changes to framebuilder configuration files, such as the master file, simply use "telnet fb 8088" and then "shutdown". . 3. To check if the needed processes are still running, "ssh fb", then "ps -ef | grep daqd" and "ps -ef | grep nds" === Making Changes === . 1. '''If you have added a new model then you need to modify the /opt/rtcds/caltech/c1/target/fb/master file''' . 2. open it in your editor of choice (on any machine) . 3. add a line like: /opt/rtcds/caltech/c1/chans/daq/C1SYS.ini, where SYS is the model name in caps. . 4. add a line like: /opt/rtcds/caltech/c1/target/gds/param/tpchn_c1sys.par, where sys is the model name in lower case. . 5. save . 6. If you have not already done so, go update the DAQ channel files for the new model in the /opt/rtcds/caltech/c1/chans/daq/ directory. . 6. Restart the framebuilder as indicated above. . 7. Confirm you see the channels in dataviewer. ---- == Starting the testpoint manager == . /!\ In {{{/opt/rtcds/caltech/c1/target/gds/param/}}} there is a {{{testpoint.par}}} file. Inside it has something like: . {{{ [C-node0] hostname=192.168.1.2 system=tst }}} . The number after "C-node" must be 1 less than the gds_node_id number in the model (tst.mdl in this case). This because the simulink code starts counting at 1, while the other codes start at 0. ---- == Getting AWG working == . /!\ In {{{/opt/rtcds/caltech/c1/target/gds/param/}}} there is a {{{awg.par}}} file. Inside it has something like: . {{{ [C1-awg0] hostname=192.168.1.2 prognum=0x31001002 }}} . The number after "C1-awg" must be 1 less than the gds_node_id number in the model (tst.mdl in this case). This because the simulink code starts counting at 1, while the other codes start at 0. . The prognum must be 1 more than the prognum for the associated C-node entry in the testpoint.par file. ---- == Useful directories == aaa is the system name (e.g. oms, tst, ...) || ''''' description ''''' || ''''' directory ''''' || ''''' notes ''''' || || ''' for model ''' || {{{/opt/rtcds/caltech/c1/core/advLigoRTS/src/epics/simLink}}} || || || ''' to build ''' || {{{/opt/rtcds/caltech/c1/core/advLigoRTS}}} || || || ''' startup script ''' || {{{/opt/rtcds/caltech/c1/scripts}}} || || || ''' medm screens ''' || {{{/opt/rtcds/caltech/c1/medm/aaa}}} || || || ''' realtime code log ''' || {{{/opt/rtcds/caltech/c1/target/aaa/logs}}} || || || ''' ioc log ''' ||{{{/opt/rtcds/caltech/c1/target/c1x00/c1x00epics/iocC1.log}}} || || || '''daqd / daqdrc / master ''' ||{{{/opt/rtcds/caltech/c1/target/fb}}} || || || ''' filter coeffs ''' || {{{/opt/rtcds/caltech/c1/caltech/chans}}} || || || ''' daq settings '''|| {{{/opt/rtcds/caltech/c1/chans/daq}}} || which are to be configured by {{{daqconfig}}} || || ''' autoburt snapshots ''' || {{{/tmp/}}} || probably should be changed to a better place - currently set in the starttst script|| || ''' start script directories as well as params for gds ''' || {{{/opt/rtcds/caltech/c1/target/gds}}} || || [[BR]] [[BR]] == Links == . [#TOP back to page top ] . [:Upgrade_09/CDS: new CDS for upgrade 2009-2010] . [:Computers_and_Scripts: Computers and SCripts] . [:Electronics/Existing_RCG_DCUID_and_gds_ids: RCG DCUID Table]