Automated loading of PLC applications

logi.CAD 3 provides a tool for the automated loading of a PLC application onto the PLC (= the target system).
images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/warning.svg The automated loading of the application is not supported for PLCs with a communication via Gateway.

Good to know

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg The tool is intended for usage by an experienced user of logi.CAD 3.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg 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 logi.CAD 3.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg The output of the tool is in English only.

Preparation

  1. Make sure that logi.CAD 3 is installed. Have the following information prepared:

    • The path to the logi.CAD 3 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. If the optional parameter -checkEmptyWorkspace is used (see the description of this parameter below), the directory must be empty.

    • The path to the project that should be loaded
      The project must not contain any syntax errors. All settings (e.g. required compiler settings) must exist for the target system (as it is required when the application is loaded within the graphical user interface of logi.CAD 3).

    • The name of the →configuration to be used for the loading (can be found in the PLC-object of the project)
      The application for this configuration must already have been built – e.g. by a previous invocation of the automated build of a PLC application. Moreover, logi.CAD 3 must be able to establish a connection with the target system that will be addressed due to the specified configuration.

    • The path to the log configuration file (see below for more information)
      A sample configuration file is included in the installation of logi.CAD 3.

  2. Open a command line: e.g. cmd.exe under Windows and navigate to the logi.CAD 3 installation directory.

Invocation

logiCAD3c --launcher.ini logiCAD3.ini -application com.logicals.uploader.lc3uploader.application -noSplash -projectPath <PROJECTPATH> -configurationName <CONFIGURATIONNAME> -data <WORKSPACE> -checkEmptyWorkspace -vmargs -Dlog4j.configuration=file:<LOG-CONFIGURATION>

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/warning.svg Invoking the tool under Linux is not officially supported. However, if you want to try invoking the tool under Linux nevertheless, replace the part logiCAD3c --launcher.ini logiCAD3.ini -application of the above-mentioned invocation by logiCAD3 -application. The remaining part of the invocation is identical to the above-mentioned invocation.

Description of parameters:

Parameter

Description

Example

<PROJECTPATH>

absolute path to the project
If the project already exists within the workspace (e.g. because there was a previous automated import of the project ), it is also possible to specify the project name only.

C:\LC3Projects\MyProject

<CONFIGURATIONNAME>

name of the configuration

Usually, the application will be loaded to remote target systems only.
If you want to invoke the tool for LocalConfiguration (= the built-in PLC), best practice is to start logi.CAD 3 before the invocation. The start of logi.CAD 3 starts the built-in PLC as well. Hence, the connection to the built-in PLC is already established before the tool is invoked.

RemoteConfiguration

<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 logi.CAD 3 project.

  • The directory might have to be empty – depending on the optional parameter -checkEmptyWorkspace (see the description of this parameter below).

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

  • If the reference to the logi.CAD 3 project already exists in the specified workspace because of a previous import, the import will not be done again in order to improve the performance of the tool.

C:\temp\LC3Workspace

<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

  • The parameter -noSplash is optional. If it is not specified, the splashscreen of logi.CAD 3 is displayed after the invocation.

  • The parameter -checkEmptyWorkspace is also optional. Specify this parameter to check whether the specified workspace is empty. The logi.CAD 3 project will only be imported, if the workspace is empty.
    The default invocation (when this parameter is not specified) is that the logi.CAD 3 project is always imported into the workspace – regardless whether the workspace is empty or not. If the logi.CAD 3 project already exists within the workspace, the logi.CAD 3 project is imported anew.

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

Example 1 for invocation, with the check whether the workspace is empty
logiCAD3c --launcher.ini logiCAD3.ini -application com.logicals.uploader.lc3uploader.application -noSplash -projectPath C:\LC3Projects\MyProject -configurationName RemoteConfiguration -data C:\temp\LC3Workspace -checkEmptyWorkspace -vmargs -Dlog4j.configuration=file:C:\LC3LogConfig\log4j.xml
Example 2 for invocation, just specifying the project name because the project has already been imported into the workspace
logiCAD3c --launcher.ini logiCAD3.ini -application com.logicals.uploader.lc3uploader.application -noSplash -projectPath MyProject -configurationName RemoteConfiguration -data C:\temp\LC3Workspace -vmargs -Dlog4j.configuration=file:C:\LC3LogConfig\log4j.xml

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>

Troubleshooting

The file that is specified in the log configuration file contains information about the loading. If the loading has not been successful, fix the problem according to the following table.

Return code

Message on STDOUT or STDERR

Cause

Solution

0

Upload successful (0)



13

<no message>

wrong value specified for -application

Invoke the tool as specified above.

-1

Upload failed (Parameter Error, -1): Name

An argument or parameter is missing.

Invoke the tool as specified above.

-2

Upload failed (-2): Project not found

The specified project does not exist.

Specify an existing project. Or invoke the tool with the absolute path for the project.

-3

Upload failed (-3): Configuration "Name" not found

The specified configuration does not exist.

Specify an existing configuration.

-4

Upload failed (-4): Message

The code image could not be created.

See "Cannot build or load application".

-5

Upload failed (-5): Project contains errors

The project contains syntax errors.

Open the project in logi.CAD 3 and fix the errors displayed in the Problems view.

-6

Upload failed (-6): Workspace not empty

The workspace already contains data (e.g. one or more logi.CAD 3 projects).

Use an empty workspace or remove all existing data from the current one.
Alternate: Invoke the tool without the parameter -checkEmptyWorkspace.

-7

Upload failed (-7): Target not connected

logi.CAD 3 cannot establish a connection to the target system.

Make sure that the target system can be reached.

-8

Upload failed (-8): Timeout occurred

A timeout has occurred during the loading.

Make sure that the loading can be executed in the graphical user interface.

-9

One of the following messages:Upload failed (-9): Code image does not existUpload failed (-9): path\RTSCode.dll not found

The application has not been built yet.

Build the application.

-10

Upload failed (-10): Platform "Name" does not exist

The platform specified within the configuration does not exist.

Correct the platform that is specified within the PLC-object containing the configuration.

-11

One of the following messages:Upload failed (-11): Cannot connect to target system.
Upload failed (-11): Faulty PLC-object. The application for the PLC (platform toolkit "Name") cannot be created/loaded. ...
Upload failed (-11): There are no binary files to load. First build the application and then load the application anew.

Loading is not possible due to one of the reasons as specified in the message.

Fix the error cause. Try to load the application again.

-12

Upload failed (-12): message

An error with the platform toolkit has occurred.

Contact the supplier of the platform toolkit in order to check/correct the platform configuration (PTK).

-13

Upload failed (-13): Error when executing target command

An unexpected error has occurred.

Contact logi.cals.

-14

Upload failed (-14): Resource not found

A resource specified within the configuration does not exist.

Correct the resource that is specified within the PLC-object containing the configuration.

-127

Upload (Details: exception message)

An unexpected error has occurred.

Contact logi.cals.