‘activex’ ca server (… and client) oct. 2000 kay-uwe kasemir, lanl

21
‘ActiveX’ CA Server (… and Client) Oct. 2000 Kay-Uwe Kasemir, LANL

Upload: loreen-daniels

Post on 01-Jan-2016

221 views

Category:

Documents


3 download

TRANSCRIPT

‘ActiveX’ CA Server (… and Client)

Oct. 2000

Kay-Uwe Kasemir, LANL

Epics CA Servers and Clients

Channel Access Network

ArchiveEngine

CA

IOC

EPICS Db

CA

CA Server

MEDM

CA

CA Client

IOC

EPICS Db

CA

CAS & CAC

• CA Server:owns, creates, provides Channel

• Client: can read/write

CA

CA Server

<Your Data>

<Your C++>

CA

CA Server

Win32 Prog.

ActiveX CAS

Purpose• Provide ChannelAccess Server (and Client)

capability for Win32 Programs that’s– easier to use than raw CAC/CAS libraries

– appeals to non-C/C++ programmers

– Win32: MS Windows 98, NT, 2000

• Initial Motivation at LANL:– LabVIEW:

• Existing, working subsystems needed remote display, archiving, ...

• Suitable for not-too-big new projects,especially when drivers are included

Integrate via CA Server

ActiveX, “Automation Server”• COM (Component Object Model)

– Win32 Inter-Process-Communication API

– Similar to Sun RPC, but for classes, not individual functions

– COM ‘Classes’ expose ‘Interfaces’(similar: Java interfaces, C++ pure virtual base classes)

• OLE, ActiveX Control /Automation Server, ...– Numerous protocols, i.e. agreements to expose specific interfaces

EpicsCAClient

CA.DLL

EpicsCAServer

CAS.DLL

IDispatchIProcessVariable

IDispatchIProcessVariable

EpicsCAServer.ProcessVariable• Properties

• name: Has to be set to create the PV for ChannelAccess• units, precision, alarm_low, ...: Common EPICS properties• deadband: Only changes >= deadband will trigger monitors• enum_string(0,1,…)

• Methods• SetLongValue (new_value as Long)• SetDoubleValue (newValue as Double)• SetEnumValue (new_value as Long):

Check if corresponding enum_string exists

• SetValue (new_value as Variant)– allowed: Scalar and Array (!) short, int, long, float, double, string

• Events• Changed: Received for ChannelAccess ‘put’

Visual Basic Example:

• Required:– Set ‘name’

– call ‘Set*Value’

Dim PV As New EpicsCAServer.ProcessVariable

PV.name = “Pi”

PV.SetValue 3.14

Visual Basic: EventsDim WithEvents PV As EpicsCAServer.ProcessVariable

Private Sub Form_Load()

Set PV = New EpicsCAServer.ProcessVariable

PV.Name = "MyTestPV"

PV.units = "Quirks"

PV.SetDoubleValue 3.15

End Sub

Private Sub PV_Changed(ByVal value_received As Variant)

MsgBox ”Received " & value_received & " !"

End Sub

Excel Example: React to CA ‘Put’

VB: Enumerated Types

Time• PC clock Time stamps for CA Server

• Synchronization: “Tardis” Shareware Programhttp://www.kaska.demon.co.uk(S)NTP, time or daytime protocol– SNTP (RFC 2030): 1..50ms,

timehost.lanl.gov: 10ms (30min updates)

• Beware:Inter-IOC protocol doesn’t match any standard.– Assert Master Timing IOC uses same NTP server as PCs

LabVIEW as a CA Server• LabVIEW 5.1 has basic ActiveX support:

Open ActiveX reference, Set Parameter, Wait for Event, …

• New ‘Virtual Instruments’:PV Init, Config, Set, Close,...

LabVIEW: Simple Server

LabVIEW: React to CA ‘put’• CA ‘put <new value>’

ActiveX Event is sent with <new value>

• The PV’s value will not change automatically!

It’s up to you to– check for values

– test them andeventually

– reflect the changeby setting a new value!

LabVIEW: Enumerated Types• EPICS: enumerated types have

– an unsigned value 0, 1, 2, ….– a list of strings that describe each state

• LabVIEW:– PVInitEnum.vi,

create PV with a list of state strings– PVSetEnum.vi

set the numeric state, checking if state OK– PVSetBool.vi for boolean values

(Should be generated as a two-state enum)

EpicsCAClient

• Similar:– EpicsCAClient.ProcessVariable,– Properties: name, is_connected, value, units, …– Event: NewValue

• LabVIEW support:– PVOpen.vi, …– About to be used at LANL, but VIs might

change when more experience is gathered

Example: Web Pages

• LabVIEW 5.1– can be used as simple

but “pretty” CA client– has HTTPD built-in

• With CA Client:CA Data on the web

(HTML page includes <IMG> link to LabVIEW’s HTTPD)

LabVIEW Problems• ActiveX Events don’t work without patch from National Instruments’

web site

• Ax Event leaves memory leak in LabVIEW 5.1. Version 6.0 is supposed to solve this.

• LabVIEW sometimescrashes during setup ofActiveX connection(runs fine once this succeeds)

• Deadband check,already handledin EpicsCAServer,doubled in LabVIEWfor better performance:

00.05

0.10.15

0.20.25

0.30.35

Time [ms]

in LabVIEW in Server

Deadband Test Where?

Performance of "PVSet (double)"

New Value

Within Deadband

Performance• Set new (double) value to be served: ~0.3ms

(450Mhz Pentium II)

Set Array Values to be Served

0

510

15

20

10 100 500 1000 2000 4000 10000

Array Size

Tim

e (m

s)

Performance...

(10 PVs @ 10, 100, 500 Hz on 450Mhz Pentium II)

CPU Load

0%

20%

40%

60%

100 1000 5000

Values Served per Second

Lo

ad No Monitors

10 Monitors

Conclusion

Win32-Program with data worth serving,

e.g. LabVIEW

‘EPICS’ data

+ ActiveX CA Server