Automated PiL-test (incl. releasing of libraries)

Neuron Power Engineer provides a tool for the automated PiL-tests for POUs specified within a library incl. a tool for releasing a library in Neuron Power Engineer.

Good to know

(grey lightbulb) The tool is intended for usage by an experienced user of Neuron Power Engineer.

(grey lightbulb)A condition for the successful usage of the tool is the knowledge of the action to be executed as it would be executed in the graphical user interface of Neuron Power Engineer.

(grey lightbulb)The output of the tool is in English only.

In this article:

Preparation

  1. Make sure that a variant of Neuron Power Engineer is installed in which the test framework is provided. Have the following information prepared: 

    • The path to the Neuron Power Engineer installation directory 

    • The path to a directory that will be used as the workspace
      In case the directory does not exist, the tool creates it. 

    • The path to the project that should be imported (before the PiL-tests are executed)

    • The path to the log configuration file (see below for more information)
      A sample configuration file is included in the installation of Neuron Power Engineer

  2. If the JAVA JDK has not already been installed on your computer, install and unpack the JAVA JDK. In case of an installation, also enhance the environment variable PATH of the operating system by the folder to which the JAVA JDK has been installed/unpacked. In case of doubts, ask your administrator to support you in doing so. 

  3. Open a command line: e.g. cmd.exe under Windows and navigate to the Neuron Power Engineer installation directory.  

Invocation

@REM Commands to start the development environment
start cmd /c NeuronPowerEngineer.exe -data <WORKSPACE> -nosplash -vmargs -Dlicenseaccepted=1 -Dosgi.requiredJavaVersion=<X.Y> -DLC3useRTS3MetaData=true -Xms256m -Xmx6144m -Dlc3.serverport=50055 -Dlog4j.configuration=file:<LOG-CONFIGURATION> 
ping 127.0.0.1 -n 40  1>NUL
 
@REM Command to import project with the test suites
java -jar util\com.logicals.lc3.command.jar -port 50055 -import -projectPath <PROJECTPATH>
 
@REM Command to generate and load the library
java -jar util\com.logicals.lc3.command.jar -port 50055 -generateLibrary -projectName <PROJECT> -libraryDefinitionFile <PROJECT_REL_PATH\LIB_CONFIGURATION.lc3lib>
java -jar util\com.logicals.lc3.command.jar -port 50055 -uploadLibrary -projectName <PROJECT> -libraryDefinitionFile <PROJECT_REL_PATH\LIB_CONFIGURATION.lc3lib> -libraryName <LIBRARY> -deviceName <DEVICE>
 
@REM Command to execute the PiL-tests
java -jar util\com.logicals.lc3.command.jar -port 50055 -runPilTest -projectName <PROJECT> -libraryDefinitionFile <PROJECT_REL_PATH\LIB_CONFIGURATION.lc3lib> -libraryName <LIBRARY> -deviceName <DEVICE>
 
@REM Command to release the library
java -jar util\com.logicals.lc3.command.jar -port 50055 -releaseLibrary -projectName <PROJECT> -libraryDefinitionFile <PROJECT_REL_PATH\LIB_CONFIGURATION.lc3lib> -libraryName <LIBRARY>
 
@REM Command to exit the development environment
java -jar util\com.logicals.lc3.command.jar -port 50055 -shutdown

Description of parameters:

Parameter

Description

Example

<WORKSPACE>

absolute path to a workspace to which the project should be imported
Please note:

  • The directory of the workspace must not be located within a directory that is a Neuron Power Engineer project.

  • After the invocation, the workspace will contain a reference to the Neuron Power Engineer project. That means that the Neuron Power Engineer project is not copied into the workspace.
    This is the same behavior as within the graphical user interface of Neuron Power Engineer when you would use the command Import... and the import type Existing Projects into Workspace with the disabled option Copy projects into workspace.

C:\temp\LC3Workspace

<X.Y>

version number of the required Java version
Best practice to determine this version number: Open the file NeuronPowerEngineer.ini  that is located in the installation folder of Neuron Power Engineer. Search the line with the text -Dosgi.requiredJavaVersion=.  Use the specification behind = as the version number.

1.8

<LOG-CONFIGURATION>

path to the log configuration file
All messages of the tool will be output to the device as specified in the log configuration file.

C:\LC3LogConfig\log4j.xml

<PROJECTPATH>

absolute path to the project that should be imported

C:\LC3Projects\MyProject

<PROJECT>

name of the project containing the test suites

MyProject

<PROJECT_REL_PATH\LIB_CONFIGURATION.lc3lib>

name of the library configuration (with .lc3lib extension) incl. the project-relative path

src/MyLib01.lc3lib

<LIBRARY>

name of the generated library (incl. the version number)

MyLib01__0.0.1

<DEVICE>

name of the device to which the library should be loaded

MyDevice

  • The parameter -noSplash is optional. If it is not specified, the splashscreen of Neuron Power Engineer is displayed after the invocation. 

  • The parameter -Dlog4j.configuration is also optional. However, Neuron recommends to specify this parameter so that log events are output. 

  • All other parameters are mandatory. If they are not specified, an appropriate message will indicate that parameters are missing. 

  • When the PiL-test is executed successfully, Neuron Power Engineer generates the compressed library (containing the test report and logs) within the sub-folder target of the project.

Example for invocation
start cmd /c NeuronPowerEngineer.exe -data C:\temp\LC3Workspace -nosplash -vmargs -Dlicenseaccepted=1 -Dosgi.requiredJavaVersion=1.8 -DLC3useRTS3MetaData=true -Xms256m -Xmx6144m -Dlc3.serverport=50055 -Dlog4j.configuration=file:C:\LC3LogConfig\log4j.xml
ping 127.0.0.1 -n 40  1>NUL
 
java -jar util\com.logicals.lc3.command.jar -port 50055 -import -projectPath C:\LC3Projects\MyProject
 
java -jar util\com.logicals.lc3.command.jar -port 50055 -generateLibrary -projectName MyProject -libraryDefinitionFile src/MyLib01.lc3lib
java -jar util\com.logicals.lc3.command.jar -port 50055 -uploadLibrary -projectName MyProject -libraryDefinitionFile src/MyLib01.lc3lib -libraryName MyLib01__0.0.1 -deviceName MyDevice
 
java -jar util\com.logicals.lc3.command.jar -port 50055 -runPilTest -projectName MyProject -libraryDefinitionFile src/MyLib01.lc3lib -libraryName MyLib01__0.0.1 -deviceName MyDevice
 
java -jar util\com.logicals.lc3.command.jar -port 50055 -releaseLibrary -projectName MyProject -libraryDefinitionFile src/MyLib01.lc3lib -libraryName MyLib01__0.0.1
 
java -jar util\com.logicals.lc3.command.jar -port 50055 -shutdown

Log configuration file

This file is needed to configure the log4j logging mechanism. The file specifies how log events are output.

Sample log configuration file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="false" xmlns:log4j='http://jakarta.apache.org/log4j/'>
 
  <!-- This configuration logs to console. -->
  <appender name="console" class="org.apache.log4j.ConsoleAppender">
    <param name="target" value="System.out"/>
    <param name="immediateFlush" value="true"/>
    <param name="encoding" value="UTF-8"/>
    <param name="threshold" value="info"/>
    <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p:  %m%n" />
    </layout>
  </appender>
 
  <!-- This configuration logs to a file, with more information than for the console. -->
  <appender name="file" class="org.apache.log4j.DailyRollingFileAppender">
    <param name="file" value="C:\\temp\\logfile.log" />
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{HH:mm:ss} %-5p [THREAD ID=%t] [Method:%M] %c{1}:%L - %m%n" />
    </layout>
  </appender>
  <root>
    <level value="INFO" />
    <appender-ref ref="console" />
    <appender-ref ref="file" />
  </root>
</log4j:configuration>