Difference between revisions of "Low Voltage Vontrol Applications"

From GlueXWiki
Jump to: navigation, search
(SNMP Driver/Device Support from NCSL)
(SNMP Driver/Device Support from NCSL)
Line 137: Line 137:
 
        return S_dbLib_fieldNotFound;
 
        return S_dbLib_fieldNotFound;
 
</pre>
 
</pre>
 +
 +
 +
== First MPOD Chassis Application ==
 +
 +
In order to control our MPOD chassis using SNMP we need to create EPICS application utilizing an SNMP driver. I tried to use the SNMP driver which came with the VME/VXS power supply application, but somehow writing "ao" records failed with that SNMP driver. So I decided to use the NCSL SNMP driver at least to control MPOD chassis in Hall D.

Revision as of 17:25, 26 September 2011

MPOD Low Voltage Crate Control

Wiener MPOD Hardware Configuration

Fernando got a Wiener MPOD crate with a controller and one MPV.8008L card and one EHS F205p-F card. I obtained a IP address for this controller on 36 subnet. First I did not do any USB-based installations and in principle it worked on the network:

harpo:snmp> sudo /sbin/arping halldmpod1
ARPING 129.57.36.152 from 129.57.36.96 eth0
Unicast reply from 129.57.36.152 [00:50:C2:2D:CC:01]  1.862ms
Unicast reply from 129.57.36.152 [00:50:C2:2D:CC:01]  1.850ms
Sent 2 probes (1 broadcast(s))
Received 2 response(s)

There was some problem getting it on the network. When it boots, it seems to obtain the correct address via DHCP, which is evident from the IP number shown on the front-panel display. But does not respond to pings. When I manually put static IP address through the front panel, then it responds to pings. The MPOD controller has an Ethernet interface that provides an SNMP-based service. I quickly checked that the controller responds to SNMP commands. But I could not access the chassis using web browser. It might be related to a bug which Andreas Ruben told Fernando in an email. Therefore, I decided to update the firmware and setup the chassis again via USB port using the instructions in the MPOD Technical Manual .

To update the firmware I downloaded their software MUSEcontrol software, version 2.0.1491.0. I also downloaded their MPOD software bundle. The bundle also contained the MUSEcontrol program, but an older version, 2.0.1437.0, so I did not use it. I installed firmware version 2.1.1496.0 from the bundle. Version 2.0.1399.0 was installed in the controller. After firmware upgrade I setup the network via USB port using the MUSEcontrol software from Wiener, it is now using static IP address and seems to work right after power recycling without having to play with the front panel.

I see a mismatch between the nominal voltage reading on the LCD screen on the chassis and the browser on one hand, and the MUSEcontrol via USB on the other hand. If I change the nominal voltage setting on MUSEcontrol, then the measured values change on the browser, LCD and the MUSEcontrol, but the nominal voltage setting in the browser and the LCD screen do not change. If I change the nominal setting on the LCD screen with the rotating knobs, then I see the change in the browser and in the MUSEcontrol program. The same thing happens with the current limit nominal setting. This is something which might not be a big deal, but may be it can be fixed easily. I sent an email to Andreas Ruben regarding this issue.

We will use the SNMP over Ethernet to control the low and bias voltages on the MPOD boards.

SNMP Driver/Device Support from NCSL

I got a generic EPICS SNMP driver/device support from John A. Priler (priller@nscl.msu.edu) called snmp-nscl-0.9.8. It was their version of the SNMP driver which apparently they originally obtain from DESY. We probabhly could have used the one from DESY. But NCSL actually used this package for MPOD crate control, so I decided to use that instead. John also sent me an example of an EPICS database file which utilizes their SNMP device support.

I went ahead and un-tared the tar-ball in /group/halld/Online/controls/epics/support/ directory. Then I had to modify the configure/RELEASE file adding the following two lines to it:

EPICS_BASE=$(EPICS)/base
EPICS_EXTENSIONS=$(EPICS)/extensions

I was able to compile the snmp-nscl-0.9.8 for 32-bit RHEL5 Linux. But compilation of 64-bit Ubuntu 10.04 failed because of some syntax error:

make[3]: Entering directory `/group/halld/Online/controls/epics/support/snmp-nscl-0.9.8/snmpApp/src/O.linux-x86_64'
perl /group/halld/Online/controls/epics/base/bin/linux-x86_64/makeIncludeDbd.pl base.dbd devSnmp.dbd ../O.Common/snmpInclude.dbd
Expanding dbd
/group/halld/Online/controls/epics/base/bin/linux-x86_64/dbExpand  -I . -I .. -I ../../../dbd -I/group/halld/Online/controls/epics/base/dbd  -o ../O.Common/snmp.dbd ../O.Common/snmpInclude.dbd
Installing created dbd file ../../../dbd/snmp.dbd
/usr/bin/g++ -c  -D_POSIX_C_SOURCE=199506L -D_POSIX_THREADS -D_XOPEN_SOURCE=500           -D_X86_64_  -DUNIX  -D_BSD_SOURCE -Dlinux  -D_REENTRANT   -O3   -Wall      -m64     -g -fPIC -I. -I../O.Common -I. -I.. -I../../../include/os/Linux -I../../../include -I/group/halld/Online/controls/epics/base/include/os/Linux -I/group/halld/Online/controls/epics/base/include  -I/group/halld/Online/controls/epics/extensions/include        ../devSnmp.cpp 
../devSnmp.cpp: In constructor ‘devSnmp_device::devSnmp_device(devSnmp_manager*, devSnmp_group*, dbCommon*, link*, char*, bool*)’:
../devSnmp.cpp:2659: error: cannot convert ‘unsigned int*’ to ‘size_t*’ for argument ‘3’ to ‘int get_node(const char*, oid*, size_t*)’
../devSnmp.cpp:2660: error: cannot convert ‘unsigned int*’ to ‘size_t*’ for argument ‘3’ to ‘int read_objid(const char*, oid*, size_t*)’
make[3]: *** [devSnmp.o] Error 1
make[3]: Leaving directory `/group/halld/Online/controls/epics/support/snmp-nscl-0.9.8/snmpApp/src/O.linux-x86_64'
make[2]: *** [install.linux-x86_64] Error 2
make[2]: Leaving directory `/group/halld/Online/controls/epics/support/snmp-nscl-0.9.8/snmpApp/src'
make[1]: *** [src.install] Error 2
make[1]: Leaving directory `/group/halld/Online/controls/epics/support/snmp-nscl-0.9.8/snmpApp'
make: *** [snmpApp.install] Error 2

Note, that this package was not pure "support", but it also contains an IOC and an example database file for some router control. To avoid conflicts I commented out some lines in the src/Makefile which were building the IOC and were also compiling some registration functions. Instead, I moved the two source files snmpRegister.cpp and snmpSessShow.c into our application.


22,23c22,23
< #devSnmp_SRCS += snmpRegister.cpp
< #devSnmp_SRCS += snmpSessShow.c
---
> devSnmp_SRCS += snmpRegister.cpp
> devSnmp_SRCS += snmpSessShow.c
33c33
< #PROD_IOC = snmp
---
> PROD_IOC = snmp
35c35
< #DBD += snmp.dbd
---
> DBD += snmp.dbd
38c38
< #snmp_DBD += base.dbd
---
> snmp_DBD += base.dbd
40c40
< #snmp_DBD +=  devSnmp.dbd
---
> snmp_DBD +=  devSnmp.dbd
43,45c43,45
< #snmp_SRCS += snmp_registerRecordDeviceDriver.cpp
< #snmp_SRCS_DEFAULT += snmpMain.cpp
< #snmp_SRCS_vxWorks += -nil-
---
> snmp_SRCS += snmp_registerRecordDeviceDriver.cpp
> snmp_SRCS_DEFAULT += snmpMain.cpp
> snmp_SRCS_vxWorks += -nil-
51c51
< #snmp_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary
---
> snmp_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary
53c53
< #snmp_LIBS +=  devSnmp    #main devSnmp lib
---
> snmp_LIBS +=  devSnmp    #main devSnmp lib
60,63c60,63
< #    snmp_SNCFLAGS += +r
< #    snmp_DBD += sncExample.dbd
< #    snmp_SRCS += sncExample.stt
< #    snmp_LIBS += seq pv
---
>     snmp_SNCFLAGS += +r
>     snmp_DBD += sncExample.dbd
>     snmp_SRCS += sncExample.stt
>     snmp_LIBS += seq pv
66,70c66,70
< #    PROD_HOST += sncProgram
< #    sncProgram_SNCFLAGS += +m
< #    sncProgram_SRCS += sncProgram.st
< #    sncProgram_LIBS += seq pv
< #    sncProgram_LIBS += $(EPICS_BASE_HOST_LIBS)
---
>     PROD_HOST += sncProgram
>     sncProgram_SNCFLAGS += +m
>     sncProgram_SRCS += sncProgram.st
>     sncProgram_LIBS += seq pv
>     sncProgram_LIBS += $(EPICS_BASE_HOST_LIBS)
73c73
< #snmp_LIBS += $(EPICS_BASE_IOC_LIBS)
---
> snmp_LIBS += $(EPICS_BASE_IOC_LIBS)

This way I only crate the support part The library gets installed in nmp-nscl-0.9.8/lib/$EPICS_HOST_ARCH directory, similar to ether_ip support.

In order to be able to work with NCSL SNMP EPICS driver I had to modify src/dbStatic/dbStaticLib.c to increase the length of the links from 80 to 256. This was done following the recommendation by John Priller who provided me with the driver from NCSL. Seems to work.

    case DBF_FWDLINK: {
	    DBLINK	*plink;
	    char	string[256];
	    char	*pstr = string;
	    int		ind;

	    if (!pfield)
	        return S_dbLib_fieldNotFound;


First MPOD Chassis Application

In order to control our MPOD chassis using SNMP we need to create EPICS application utilizing an SNMP driver. I tried to use the SNMP driver which came with the VME/VXS power supply application, but somehow writing "ao" records failed with that SNMP driver. So I decided to use the NCSL SNMP driver at least to control MPOD chassis in Hall D.