You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 25 Next »

This page contains information about using EPICS with MATLAB and Java in the LCLS Development and Production environments.


Attention:

All scripts in this page are assuming that your current shell is Bash.

  • If you are using some other shell such as tcsh, you can switch to bash in your current session by typing "bash" in your terminal.
  • If you wish to switch permanently to Bash as your default shell here are some instructions:

In order to change your default shell at login from tcsh (or any other shell) to Bash, please execute the following command on a Linux server on the AFS network, such as a rhel6-64* node. (You will be prompted for your password during this process):

ypchsh -s /bin/bash

After that, close the terminal and open a new one. You will be using Bash as the default shell. 

You can check if all went well with the following command in a new Terminal window:

echo $SHELL

matpva

  • matpva is a powerful extension that provides seamless integration between MATLAB and EPICS 7 through the Python P4P module.


How to use matpva

matpva: Integrate EPICS7 into MATLAB using PVAccess for Python (P4P) module


How to test matpva

How to test matpva in DEV and PROD (lcls and facet)


Java

At the time of this writing, the latest version of Java available in Development and Production is 1.8.0_181 (64-bit). In order to use this Java version, source the following scripts depending on your environment:

  • Development
    /afs/slac/g/lcls/physics/setup/javaSetup-R1.8.0_181.bash
  • Production
    /usr/local/lcls/physics/setup/javaSetup-R1.8.0_181.bash

For Oracle compatibility, the Oracle client used must also be compiled for 64-bit. In order to use the supported 64-bit Oracle client, source the following scripts depending on your environment:

  • Development
    /afs/slac/g/lcls/tools/oracle/oracleSetup-R11.2.0.4.bash
  • Production
    /usr/local/lcls/tools/oracle/oracleSetup-R11.2.0.4.bash

EPICS Java APIs

The EPICS Java APIs are located at:

  • Development
    /afs/slac/g/lcls/epics/java
  • Production
    /usr/local/lcls/epics/java

At these locations you will be able to find the following libraries:

  • epicsCoreJava
    Includes EPICS 7 (pvaccess, ntypes, pvdata) and JCA libraries
  • pvaClientJava
    Includes pvaClientJava library developed by Marty Kraimer
  • phoebus
    This repository contains the whole phoebus code (replacement for the CS-Studio backend) but it also contains the new pva client library developed by Kay Kasemir.

  • exampleJava
    Includes a set of examples of client and server code for PVAcess.

MATLAB

Click the version name of MATLAB shown below to move to the detailed instructions for each version.

MATLAB R2012a

MATLAB R2019a

MATLAB R2020a

MATLAB R2022b

Installation

For MATLAB admins (epicsmgr group members) only:

  • New versions (versions later than 2012a) of MATLAB should be installed in the 3rd-party software package area under the matlab folder:
    - Development: /afs/slac/g/lcls/package/matlab
    - Production: /usr/local/lcls/package/matlab
  • Inside the matlab directory, versions should be installed in folders that correspond to their MATLAB version, e.g. 2012a, 2019a, 2020a, 2022b, etc.

At the time of this writing, the latest version of MATLAB deployed for LCLS Development and Production is 2022b.

Individual AFS user accounts in the LCLS Development environment default to set up and use MATLAB 2020a unless overridden.

The default MATLAB versions for shared login accounts in Production are as follows:

AccountDefault MATLAB version
physics2012a
softegr2019a
laci2012a


License servers for Matlab network licenses

In order to support the latest version of Matlab, the network license service had to be migrated to a newer operating system.  The new service is running on servers license701, license702, and license703 (replacing license1, license2, and license3). 

Linux users using bash or similar shells should update their environment with the command:

export MLM_LICENSE_FILE=27010@license701,27010@license702,27010@license703


If you are using csh or tcsh, the equivalent command is:

setenv MLM_LICENSE_FILE "27010@license701,27010@license702,27010@license703"

https://slacprod.servicenowservices.com/kb_view.do?sysparm_article=KB0011921


Running MATLAB

To use one of the supported versions of MATLAB, you need to set up your environment following the appropriate procedures.

Configuring MATLAB

For the Development and Production environments, a set of working configuration files is already provided for users and invoked upon login. Users can override the usage of these files by having their own custom files in the folder where they launch MATLAB (see: Creating A Custom MATLAB Environment).

MATLAB is non-standard Unix software and does not adhere to values set by PATH, LD_LIBRARY_PATH, CLASSPATH, and other global environment variables that are used by most other Unix software. Instead, MATLAB uses the following configuration files to set its environment:

  • Parameters for the Java JVM that runs inside of MATLAB are configured via a java.opts file
  • The classpath is configured via a classpath.txt file
  • The library search path is configured via a librarypath.txt file

For questions on the installation and deployment of MATLAB in Development or Production, please contact:

java.opts

Description: This file is used to pass variables and configurations to the Java JVM used by MATLAB.
Location:
<matlabroot>/bin/<architecture>/java.opts
e.g., in Development environment: /afs/slac/g/lcls/package/matlab/2019a/bin/glnxa64/java.opts

classpath.txt

Description: This file is used to augment the Java classpath used by MATLAB.
Location:
<matlabroot>/toolbox/local/classpath.txt
e.g., in Development environment: /afs/slac/g/lcls/package/matlab/2019a/toolbox/local/classpath.txt

librarypath.txt

Description: This file is used to augment the library search path used by MATLAB.

Location:
<matlabroot>/toolbox/local/librarypath.txt

e.g., in Development environment: /afs/slac/g/lcls/package/matlab/2019a/toolbox/local/librarypath.txt


Creating A Custom MATLAB Environment

If you need to use a MATLAB environment configuration that does not match the default environment provided in Development or Production, you will need to create your own java.opts, classpath.txt or librarypath.txt files in your working directory prior to launching MATLAB.

It is strongly recommended to only override the files needed in your local workspace, since MATLAB will inspect your current working directory before looking at the global configuration files.

If you need to connect to a different set of EPICS servers, copy the java.opts file from one of the locations above to your local working directory and modify it according to your needs.

If you need to test a new JAR file, copy the classpath.txt file from one of the locations above to your local working directory and modify it according to your needs.

If you need to test a new library to add to the library path, copy the librarypath.txt file from one of the locations above to your local working directory and modify it according to your needs.

Never try to modify the existing global configuration files. If you need changes made to the global configuration files, consult the MATLAB admins for LCLS Development and Production (TID-ACS and EED Systems Group). Any changes to the global MATLAB configuration must be approved and implemented by those groups.


Known issues

1. When MATLAB 2022b starts, you will see the following error message: Warning: X does not support locale en_US.UTF-8

This is a known issue in MATLAB R2022b Update 5. The bug that triggers the warning when starting up MATLAB will be resolved in the upcoming update.

https://www.mathworks.com/matlabcentral/answers/1929870-why-do-i-get-warning-on-startup-x-does-not-support-locale-en_us-utf-8-when-startup-matlab-with-r2?s_tid=answers_rc1-2_p2_MLT




  • No labels