You are here: Foswiki>Applications Web>LsaTraining20180129 (01 Feb 2018, DavidOndreka)Edit Attach

Applications Group: LSA Basic Training, 01. Feb. 2018

0. Schedule

1. Technical setup

This section describes necessary steps to get a running development environment. If possible, please execute these steps before the workshop and contact us, if problems or questions arise.

1.1 Login

The development environment is the RedHat 7 Accelerator Development Cluster "ACC7". To gain access, you first need an accelerator cluster account. Typically, you should already have an existing account. If not, please apply for a new accelerator account by contacting J├╝rgen Weis.

Development machines: asl740.acc.gsi.de - asl744.acc.gsi.de

Please try to log into one of the four machines to verify, that your account works.

1.2 General Configuration

The APP group has defined some global definitions that are useful for developing Java projects. The easiest way is to include the following line into your ~.bashrc file (as last line):
. /common/usr/cscoap/etc/profile.d/ap_properties.sh

1.3 Eclipse

Eclipse cahn be launched by typing
eclipse-neon & 

For a more sophisticated startscript, i.e. if you want to work with multiple workspaces, see Launching Eclipse.

1.4 Eclipse Configuration

The most common configuration can be imported from here (right click -> save as) as follows:
  • File -> Import -> General -> Preferences
    • Choose the preference file
    • ensure "Import all" is checked

Always needed

  • Go to Window -> Preferences -> Java -> Installed JREs
    • Select JRE "java-11-openjdk..." , choose "Edit...."
    • Under "Default VM arguments", add: -Ddependencies.set.direct=true
  • Go to Window -> Preferences -> Maven -> Archetypes

  • Disable index files for Maven:
    • Go to Window -> Show View -> Other -> Maven repositories
    • In the Maven repository view right mouse click below the repositories and check "Disable Index Details"
      • maybe this view is a bit buggy, in my tests I was only able to check anything after opening the view without having any repository selected

  • Go to Window -> Preferences -> Java -> Code Style -> Code Templates
    • choose Comments -> Types -> Edit -> change ${user} to your full name (e.g. Max Mustermann)

  • Go to Window -> Preferences -> Java -> Editor -> Templates
    • choose "@author" -> Edit -> change ${user} to your full name (e.g. Max Mustermann)

This is the recommended minimum Eclipse configuration for the workshop. Further optional configuration of Eclipse and background information about Eclipse can be found here: Eclipse Configuration. At the time when you want to start providing applications ready to be released and used by others, please also install the recommended plugins, e.g. for code quality checking, described here: Recommended Plugins.

1.4 Subversion

For the training course, please switch to the SVN Perspective Window->Perspective->Open Perspective->Other->SVN Repository Exploring, click on the green "+" and add the following repositories:
https://www-acc.gsi.de/svn/playground
https://www-acc.gsi.de/svn/applications 

1.5 Maven

Maven is a build-system used at GSI. In order to configure Maven, please follow the instructions described here: Maven and Eclipse, please follow the description under the sections "Configuring the Maven instance used in Eclipse" and "Authentication".

2. LSA API Example

Run Configuration:

-Dlsa.mode=3 -Dcsco.default.property.config.url=https://websvcpro.acc.gsi.de/groups/cscoap/config/ -Dlog4j.configurationFile=/common/home/bel/jfitzek/lnx/dev/log4j2-dev.xml

Code:
package aco.playground.lsa.test;

import java.util.Map;

import cern.accsoft.commons.util.Nameds;
import cern.accsoft.commons.value.ValueFactory;
import cern.lsa.client.ContextService;
import cern.lsa.client.ParameterService;
import cern.lsa.client.Services;
import cern.lsa.client.SettingService;
import cern.lsa.client.TrimService;
import cern.lsa.domain.exploitation.DriveException;
import cern.lsa.domain.settings.BeamProcess;
import cern.lsa.domain.settings.ContextSettings;
import cern.lsa.domain.settings.Parameter;
import cern.lsa.domain.settings.ParameterSettings;
import cern.lsa.domain.settings.Pattern;
import cern.lsa.domain.settings.SettingPartEnum;
import cern.lsa.domain.settings.TrimException;
import cern.lsa.domain.settings.TrimResponse;
import cern.lsa.domain.settings.TrimResult;
import cern.lsa.domain.settings.factory.TrimRequestBuilder;

/**
 * @author Jutta Fitzek
 */
public class LsaTest {

    public static void main(final String[] args) {

        final ContextService contextService = Services.getContextService();
        final ParameterService parameterService = Services.getParameterService();
        final SettingService settingService = Services.getSettingsService();
        final TrimService trimService = Services.getTrimService();

        final Pattern pattern = contextService.findPattern("TEST_PATTERN_LSA_TRAINING");

        final Map<String, BeamProcess> allBeamProcesses = Nameds.mapByName(pattern.getBeamProcesses());
        final BeamProcess beamProcess = allBeamProcesses
                .get("TEST_PATTERN_LSA_TRAINING.C1.SIS18_TO_GTS1MU1.TRANSFER_EXTRACTION.1");

        // read parameter
        final Parameter parameter1 = parameterService.findParameterByName("GTE1KY1/KL");
        final Parameter parameter2 = parameterService.findParameterByName("GTE1QD11/KL");

        // read settings
        final ContextSettings contextSettings = settingService.findContextSettings(pattern);
        final ParameterSettings parameterSettings = contextSettings.getParameterSettings(parameter1);

        // perform a trim! (change of a setting)
        final TrimRequestBuilder builder = new TrimRequestBuilder();
        builder.setContext(pattern);
        builder.setSettingPart(SettingPartEnum.TARGET);
        builder.setDescription("LSA Traing Course Trim - J.Fitzek");
        builder.addValue(parameter1, beamProcess,
                ValueFactory.createConstantFunction(beamProcess.getLength(), -0.00091255));
        builder.addValue(parameter2, beamProcess,
                ValueFactory.createConstantFunction(beamProcess.getLength(), 0.24980137));
        TrimResponse trimResponse;
        try {
            trimResponse = trimService.trimSettings(builder.build());
        } catch (TrimException | DriveException e) {
            e.printStackTrace();
            return;
        }
        final TrimResult result = trimResponse.getTrimResult();
        System.out.println(result);
        // fillTrimRequest(builder, changedSettings);

    }

}

3. Presentation of LSA Basics (Jutta Fitzek)

20180201_LSA_Basics_Training_Course.odp: LSA Basics Presentation (J.Fitzek)

4. Presentation of Physics in LSA (David Ondreka)

20180201_LSA_Basics_Training_Course_Modeling.pdf: Introduction to FAIR accelerator modeling using LSA (D. Ondreka)

PresentationFxAppStructure_2018-01.odp: JavaFX Application Structure (A.Walter)

-- JuttaFitzek - 01 Feb 2018
Topic attachments
I Attachment Action Size Date Who Comment
20180201_LSA_Basics_Training_Course.odpodp 20180201_LSA_Basics_Training_Course.odp manage 4 MB 01 Feb 2018 - 09:47 JuttaFitzek LSA Basics Presentation (J.Fitzek)
20180201_LSA_Basics_Training_Course_Modeling.pdfpdf 20180201_LSA_Basics_Training_Course_Modeling.pdf manage 1 MB 01 Feb 2018 - 17:09 DavidOndreka Introduction to FAIR accelerator modeling using LSA
20180201_LSA_Basics_Training_Course_Schedule.odpodp 20180201_LSA_Basics_Training_Course_Schedule.odp manage 940 K 01 Feb 2018 - 09:46 JuttaFitzek Training Course Schedule
PresentationFxAppStructure_2018-01.odpodp PresentationFxAppStructure_2018-01.odp manage 846 K 01 Feb 2018 - 15:42 JuttaFitzek JavaFX Application Structure (A.Walter)
pom.xmlxml pom.xml manage 1 K 01 Feb 2018 - 09:52 JuttaFitzek pom.xml for the simple example project
Topic revision: r5 - 01 Feb 2018, DavidOndreka
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback