IOC for upgrading BPM DAQsoftware
WANG,Jian Univ. of Sci. & Tech. of China

1

IOC on WinXP for Oscilloscope My work in China
Several control systems in physical experiments
Observatory Control System in large telescope
Centralized Control System(CCS) in Inertial
Confinement Fusion(ICF) experiments and try tointroduce EPICS to ICF experiments
 IOC on win32
Different technologies of win32
 IOC for upgrading BPM DAQ software2My work in China
 Observatory Control System in large telescope Large Area Multi-Object Fiber Spectroscopic Telescope (LAMOST)is under construction

 LAMOST software system consists of three levels
 The highest level is OCS (Observatory Control System ), thelowest level is the real-time system the middle level is subsystems of LAMOST(DHS,TCS,ICS) Deal with observational schedule through SSS (Sky SurveySystem)
 Goal of OCS is to automate the entire observational

process, and make the scientific observation more
efficiently

3

LAMOST Software SystemOCS

DHS
ICS
TCS

LAN

SSS
Env.

FIBER LAN

Q.A
DATA
PROCESS

CCD
SPECTROGR
AGH

FIBER
POSITION

TRACKDOME

4

Architecture DesignUserinteractOCSModel

Other Applications

UI/Controller

App1
UIC1

App nUICn

UIC2

OCS Application Framework
Application Module Components
Cmd Pipeline Generator

Cmd Pipeline Parser

Cmd Pipeline Executor

Log Recordor

Cmd Manager

Status Manager

Status Analyzer

Log analyzer

Status Info Receiver

Access Manager<<include>>Component Manager

Online Analyze and Handle

Intelligent Expert

System Service Components
OCS Observation DB

Component Name
Error Handler

Message Bus

Agent Components
TCS Agent

ICS Agent

TCS

ICS

SSS Agent

DHS Agent

SSSDHS

Info Exchanger5 command-driven model Commands Layers: Interfaced with the different roles,

the commands are divided to three levels
 In order to guarantee that commands can betransported and executed correctly, protocols between
OCS and subsystems are proposed Command Acceptance/Rejection Protocol
 Command Execution Feedback Protocol
 Status handling protocol

 architecture model designed and implemented as a set of cooperating,

distributed objects components that consist of objects
 many design patterns and architecture patterns wereused to resolve relevant problems
 MVC(Model/View/Controller) pattern, agent pattern, layeredpattern, message bus pattern a component-based unified message bus is introducedin OCS

6

Centralized Control System(CCS) in
ICF experiments
Central Control
System
Optical CCS

FCS

FCS

Power CCS

FCS

Target DiagnosesCCS

Laser CCS

Vacuum CCS

FCS

FCS

FCS

FCS

FCS

Try to introduce EPICS to lower layers of ICF

experiments

7

IOC on win32
 Different C/C++ compiler with different host platforms
 win32-x86: MS compiler
 win32-x86-borland: borland compiler
 win32-x86-cygwin:
 win32-x86-mingw:

 Install the MS Visual Studio and cygwin as the web page

described http://www.aps.anl.gov/epics/base/win32.php
 Different products used the different MS technologies

 ActiveX(ActiveDSO in wavePro oscilloscope), COM(XStream inwavePro oscilloscope, IVI-COM in Tektronix oscilloscope), TekVisa(Tektronix oscilloscope) For the efficiency of C language is higher than C++, C language isselected firstly if possible when development of IOC
 DLL could be used to integrated to IOC when writing a device support

8

IOC for upgrading BPM DAQsoftware test IOC based on IVI-COM and TekVisa
 Tek DPO 7104: Win XP
 EPICS IOC:base-3.14.8.2,VC2005,cygwin (make, perl) Two methods for IOC
 IVI-COM: seems memory did not released when one scan wasdone(with ITekScopeWaveformTransfer.FetchWaveform Method) TekVisa: as normal programming, add the tekvisa library to lib
path and add include file to include path in the makefile asfollows
 USR_INCLUDES += -I"C:\VXIpnp\WINNT\include“ xxxSupport_SYS_LIBS += visa32
9

IVI-COM
 IVI: Interchangeable Virtual Instruments
 Installed IVI TekScope Driver firstly
 In device support, C++ must be used forCOM technology
 Code like follows

::OleInitialize(NULL); //before create instance…

//reference IVI-COM sample
::OleUninitialize(); // when done10 Get waveform IOC running on OSC
 Medm remotely11 Compare IVI-COM and TekVisa
The IOC used IVI-COM running as scanperiodic
The memory will be exhausted and at last it will beended with an error
The fastest speed of acquisition is lower thanthat used TekVisa
 So IVI-COM is unselected12

Test IOC performance and common
win32 application
 Develop an IOC based on TekVisa
 Waveform acquisition only
 Vary the record length of waveform from 1000 to500,000 Vary the scan periodic cycle and scan passive
 The minimal scan period could be 0.01 second
 Add 0.01s,0.02s,0.05s to scan menu type

 Get the waveform continuously to get the average ofacquisition speed

 Amount of waveform acquisition >= 1000

 A tekVisa test program have developed using

VC++ 2005

13

Test IOC performance and common
win32 application
 Curve and curvestream Curvestream make OSC to continuously transfer

waveform data as fast as it is acquired. Also it puts
instrument to a talk-only mode and no response to otherclients and other commands.
 Need time to stop curvestream mode to place OSC backinto its normal talk/listen mode So if settings of OSC seldom are reconfigured and fast
performance is needed, curvestream is suitable If settings of OSC are needed to reconfigure quickly andfrequently, just as mode switch very quickly, curvestream
not suitable and curve is better
14

Scan passive,10GS/s350

329.52300

Ch4Ch3Ch2Ch1

DAQ Speed[Hz]250200150100500050100150200250300

350

Data length[k-points]

400

45050015

IOC (passive scan) and commom application
under same condition
178.64:175.86

123.91:122.84
180120160

IocCh4
CommonCH4140

IocCh2
CommonCh2

DAQ Speed [Hz]DAQ Speed[Hz]10012080100806060

40402020050

100150200250300350

Data length[k-points]

400

450

500

050

100

150200250300350400450

Data length[k-points]

16500

Scan periodic,10GS/s,
 Vary scan period(>=0.01s)
 Vary loop
number in readfunction indevice support
 pulse generator
 15M,400mv

333.258

CH4Ch3Ch2CH1300
250

DAQ Speed[Hz] Two cycle

350200150100500050

100150200250

300

350

Data length[k-points]

400450500

17Upgrading BPM DAQ software Now beams of linac are switched to KEKB

and PF twice a day Next switch frequency is several Hz(1~2Hz)
 Final switch frequency will be 50Hz
 So BPM system and Feedback system will
be upgraded to promote higher energy,
stability and quality of beam.
18

Monitor Station (Previous)
Monitor Station

Linac Network

Digital Oscilloscope (5GS/s)yVME/ OS9xGPIB

Cable Combiner Box
8ch-Combiner

8ch-Combiner*Klystron Gallery
Linac Tunnel* Delay Cable (7-ns)

BPM

VME + Oscilloscope (TectronixTDS680, 5-GSa/s, 8-bits)
VME  Oscilloscope via GPIB (GPIB is slower)

19

Software structure (Now)
Tcl/Tk, Python, Visual Basic......
UNIX
Windows/PC
Linux/PC
Touch-terminal

BPM
Application
Read

BPM
Application

BPM
Application

Write

Read

TCP protocol

UNIX server

Shared for #1
memoryfor #20for #20for #1

Write

PortingOS9, Tru64 (lib.)=> Windows

ReadrecvsendUDP protocol

VME#1

OS9Shared
memoryDAQ Software
send

recv

Read

Write

BPM Data (x,y,i, ...)

Oscillo. data(V-range,etc.)

VME#2

VME#20Windows XP
TekVisa
DPO 7104
Write

Remove the VME andGPIB, use ethernet

Read

Waveform read-out
Data processing Oscilloscopefrom oscilloscope
control

20

Tektronix DPO 7104
 10-GSa/s (4ch), 8-bits
 Windows XP based (P4 3.4-GHz)
 Gigabit-Ethernet

21

EPICS Based
Tcl/Tk, Python, Visual Basic......
UNIX
Windows/PC
Linux/PC
Touch-terminal

BPM
Application
Read

BPM
Application

BPM
Application

Write

Read

TCP protocol

UNIX server

Shared for #1
memoryfor #20for #20for #1

Write

Common Windows=>
EPICS based

Read

CA getCA putCA protocol

VME#1

DAQ Software (IOC)OS9Sharedmemory

sendrecv

Read

Write

BPM Data (x,y,i, ...)

Oscillo. data
(V-range,etc.)

VME#2

VME#20Windows XP
TekVisa
DPO 7104
Write

Read

Waveform read-out
Data processing Oscilloscopefrom oscilloscope
control

22

DAQ Software (IOC) VDCT to design the records

23 subArray: store the SP result (position and currentvalue) named $(user):SPDataSA, correspond tostruct sp_mon24

Device support
 Device Typedevice(waveform,INST_IO,devWfTekDPO,"TekDPOScope")device(ao,INST_IO,devAOTekDPO,"TekDPOScope")device(subArray,INST_IO,devSATekDPO,"TekDPOScope")device(stringout,INST_IO,devSOTekDPO,"TekDPOScope")
25

subArray device support process
Init function: open device using tek_open and readparemeter from file using cmprepare

Init_record function: init for record related. In SPData,
setup the OSC for acquisition firstly, such as channel
selection, vertical value, horizontal value, delay value,
waveform position, these setting also can be changed
by client if not curvestream mode

sa_read function: get waveform, sp measure andcalculate the sp data including position and current
26

CA Client in linux
 SP get clientUsing the ca basic procedure such as

ca_context_create, ca_create_channel, ca_get,ca_pend_io, ca_clear_channel,
ca_context_destroy
Get the SP Data and convert subarray to structsp_mon and store to share memory whenrunning client onceBased on the application “sprecv” and “shmsem”
library27

CA Client in linux
 SP monitor clientUsing the ca basic procedure such as

ca_context_create, ca_create_channel,
ca_create_subscription, ca_pend_event,ca_clear_channel, ca_context_destroy
Get the SP Data and convert subarray to structsp_mon and store to share memory when SP
Data is changed in IOC
Porting “sprecv” to “sp_monitor”
28

DAQ IOC Software Test
 50Mhz pulse genrator
 Some setting of OSC is 10Gs/s 100ps/pt ;DIS:WAVE OFF; ACQ:STOPAFTER RUNSTOP;DATA:SOURCE CH1,CH2; :HOR:RECO 20000
 Use curve command Scan periodic: max frequency = 81.54
 Scan passive: max frequency = 135.14

 Use curvestream command Scan periodic: max frequency = 195.31
 Scan passive: max frequency = 194.20
29

Summary Different technologies of win32 to develop

IOC for different oscilloscope and compare
performance of some
 Develop IOC for upgrading BPM DAQ
SoftwareDevelop ioc for waveform acquisition and test

performance with the common win32
application
Porting DAQ software to IOC EPICS based andtest its performance30Thank you!

31