control room accelerator physics channel access connection to hardware through epics n.
Skip this Video
Loading SlideShow in 5 Seconds..
Control Room Accelerator Physics Channel Access – Connection to Hardware Through EPICS PowerPoint Presentation
Download Presentation
Control Room Accelerator Physics Channel Access – Connection to Hardware Through EPICS

Control Room Accelerator Physics Channel Access – Connection to Hardware Through EPICS

94 Vues Download Presentation
Télécharger la présentation

Control Room Accelerator Physics Channel Access – Connection to Hardware Through EPICS

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. J-PARC Control Room Accelerator PhysicsChannel Access – Connection to Hardware Through EPICS Getting Information directly from the Control System

  2. USPAS Basic Steps • Channel Access is the protocol for communicating between the control system (EPICS) and higher level languages (C/C++/Java/FORTRAN/scripts) • • Environment Variables: for C, Java Properties for Java CA Client: EPICS_CA_ADDR_LIST EPICS_CA_AUTO_ADDR_LIST EPICS_CA_CONN_TMO EPICS_CA_BEACON_PERIOD EPICS_CA_REPEATER_PORT EPICS_CA_SERVER_PORT EPICS_CA_MAX_ARRAY_BYTES EPICS_TS_MIN_WEST

  3. Basic Steps for Using Channel Access Initialize Channel Access ca_task_initialize or ca_context_create Search ca_search_and_connect or ca_create_channel Do get or put ca_get or ca_put Monitor ca_add_event or ca_create_subscription Give Channel Access a chance to work ca_poll, ca_pend_io, ca_pend_event Clear a channel ca_clear_channel Close Channel Access ca_task_exit or ca_context_destroy

  4. Java Connections to EPICS Channel Access A wrapper to the usual C libraries (JNI) Requires the C-libraries, built for the hardware you are using A native Java interface to Channel Access Easier to use – no exteral C libraries needed Pure Java – portable Somewhat buggy – be careful with a real machine For XAL you can specify which one you want to use

  5. Java Channel Access (JCA) Third party packages maintained by Cosylab JCA/JNI Java API to native channel access through JNI Requires EPICS client libraries Used in production JCA/CAJ Pure Java implementation of JCA Doesn’t use or require EPICS client libraries Better monitor performance than JCA/JNI Issues with multiple connections Implicated in crashing some IOCs Not used in production

  6. Channel Access Example (Java) From library = JCALibrary.getInstance() ctxt = library.createContext( JCALibrary.JNI_THREAD_SAFE ) bpm_chan = ctxt.createChannel( "MEBT_Diag:BPM01:xAvg" ) corr_chan = ctxt.createChannel( "MEBT_Mag:DCH01:B" ) ctxt.pendIO( 5.0 ) bpm_chan.printInfo()

  7. Java Properties File for JCA / JNI Java Properties File # define the location of the epics shared libraries and caRepeater executable gov.aps.jca.jni.epics.cygwin-x86.library.path=e:/epics/base- gov.aps.jca.jni.epics.cygwin-x86.caRepeater.path=e:/epics/base- # Overwrite the default addr_list to point to a specific ca server gov.aps.jca.jni.JNIContext.repeater_port=5065 gov.aps.jca.jni.JNIContext.server_port=5064 # overwrite the default auto_addr_list so that network interfaces will not be automatically added to the addr_list. gov.aps.jca.jni.JNIContext.auto_addr_list=false # toto is going to use very large array, so we want to increase the maximum array size. gov.aps.jca.jni.JNIContext.max_array_size=32768 # define default values only for JNI_THREAD_SAFE context gov.aps.jca.jni.ThreadSafeContext.event_dispatcher=gov.aps.jca.event.QueuedEventDispatcher gov.aps.jca.jni.ThreadSafeContext.priority=1 # for CAJ com.cosylab.epics.caj.CAJContext.addr_list= com.cosylab.epics.caj.CAJContext.auto_addr_list=false com.cosylab.epics.caj.CAJContext.max_array_size=32768 com.cosylab.epics.caj.impl.reactor.lf.LeaderFollowersThreadPool.thread_pool_size=80 com.cosylab.epics.caj.CAJContext.beacon_period=15

  8. Channel Access in XAL package abstracts channel access provides some insulation from API changes to underlying access layer allows for both blocking and concurrent calls supports connection, get and put operations (with and without callbacks) and monitors gov.sns.jca implements XAL Channel support using JCA wraps Java Channel Access (JCA) calls can switch between JCA/JNI and JCA/CAJ See XAL_Setup_HOWTO.thtm in distribution JCA/JNI is recommended for production due to known, serious issues with JCA/CAJ

  9. XAL Channel Access Classes

  10. XAL Channel Access Examples Getting a value from the machine channel = ChannelFactory.defaultFactory().getChannel("MEBT_Diag:BPM01:xAvg") channel.connect() val = channel.getValDbl() print val Other Examples in

  11. Advanced Topics: Pitfalls of Large Connection Requests E.g.: get all the BPM readbacks in a beam-line, or all the magnet settings – could be 100’s of requests If you do this in a sequential loop using blocking requests, and you have a handful of requests that to not connect, you must pass through each timeout at a time People may call you in the middle of the night complaining the application is hung Sometimes you need to know when to ignore missing data Typically you should do this sort of task with a subscription method and do book-keeping in the call back See

  12. Advanced Channel Access Topics in XAL correlates channel monitor events from two or more channels compares time stamps of monitor events time window specifies maximum time allowed between events to be considered correlated allows us to have confidence that events come from the same pulse custom filtering of monitor events custom filtering of correlations supports nesting of correlators See