210 likes | 341 Views
‘ActiveX’ CA Server (… and Client). Oct. 2000 Kay-Uwe Kasemir, LANL. <Your Data>. Win32 Prog. IOC. IOC. ActiveX CAS. EPICS Db. EPICS Db. <Your C++>. CA Server. CA Server. CA Server. CAS & CAC. CA. CA. CA. CA. CA. CA. CA Client. Archive Engine. MEDM.
E N D
‘ActiveX’ CA Server (… and Client) Oct. 2000 Kay-Uwe Kasemir, LANL
<Your Data> Win32 Prog. IOC IOC ActiveX CAS EPICS Db EPICS Db <Your C++> CA Server CA Server CA Server CAS & CAC CA CA CA CA CA CA CA Client ArchiveEngine MEDM Epics CA Servers and Clients • CA Server:owns, creates, provides Channel • Client: can read/write Channel Access Network
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
IDispatch IProcessVariable IDispatch IProcessVariable 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 EpicsCAServer CA.DLL CAS.DLL
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: Events Dim 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
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: 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.viset 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:
Performance • Set new (double) value to be served: ~0.3ms (450Mhz Pentium II)
Performance... (10 PVs @ 10, 100, 500 Hz on 450Mhz Pentium II)
‘EPICS’ data Conclusion Win32-Program with data worth serving, e.g. LabVIEW + ActiveX CA Server