EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers.

Using Logic Builder Shell with Microsoft Visual Studio and PTVS

Overview

With EcoStruxure Machine Expert and the LogicBuilderShell.exe, you can develop and debug Python scripts. To develop a EcoStruxure Machine Expert Python script, you can use the editors presented in the Introduction chapter.

It is a good practice to use an IDE from a third-party vendor such as Microsoft Visual Studio with installed extension Python Tools for Visual Studio (PTVS). Visual Studio is a product from Microsoft and is not part of the EcoStruxure Machine Expert delivery.

NOTE: Since Python Tools for Visual Studio (PTVS) (see https://pytools.codeplex.com/) are free and open source, it may be that not all versions are fully compatible with the EcoStruxure Machine Expert LogicBuilderShell.exe versions.

In the following figure, you can see the two tools that are working together with EcoStruxure Machine Expert LogicBuilderShell.exe.

G-SE-0073211.1.gif-high.gif

 

 

Procedure of Developing and Debugging

Step

Action

1

Create a Visual Studio solution.

2

Add a Python project.

3

Add a Python script.

4

Configure the project to use the LogicBuilderShell.exe as interpreter.

5

Develop your script and execute it in Visual Studio.

Result: Visual Studio performs the following tasks:

oLaunching the LogicBuilderShell.exe.

oEstablishing a TCP/IP connection between Visual Studio (+PTVS) and LogicBuilderShell.exe.

oSending the Python statements to the shell.

oGetting feedback of results.

Developing Scripts with Microsoft Visual Studio

Visual Studio allows you to set breakpoints in the script and debug with the debugger commands Run, Step Into, Step Over, and so on.

Visual Studio + PTVS allow you to develop your EcoStruxure Machine Expert Python script.

Visual Studio provides support for:

oVerification of the Python syntax while writing.

oIntellisense support.

oSyntax highlighting of Python script.

Syntax verification in Visual Studio of the Python script while writing:

G-SE-0046427.2.gif-high.gif

 

 

After you have clicked Start Debugging in Visual Studio, the LogicBuilderShell.exe is launched and the script execution starts. If you have set a breakpoint in the script and the breakpoint is hit, Visual Studio marks the current statement and you can use the debugger commands (Step-Into, Step-Over, Run, …). You can see the script output in the Logic Builder Shell that has been started.

Python script debugging with Visual Studio:

G-SE-0046423.2.gif-high.gif

 

1   Debugger commands

2   Configured Python environment to be used for debugging

3   LogicBuilderShell.exe started by Visual Studio

4   Breakpoint in Python script

System Requirements for Debugging Scripts

To debug EcoStruxure Machine Expert Python scripts, your system has to meet the following pre-conditions.

oEcoStruxure Machine Expert with Logic Builder Shell feature installed.

oVisual Studio installed.

oPython Tools for Visual Studio (PTVS) installed.

oLogic Builder Shell environment configured in Visual Studio (see next paragraph).

Configuring the Logic Builder Shell in Visual Studio

Step

Action

1

Start Visual Studio.

2

Execute the command Tools > Options > Python Tools > Environment Options.

Result: The Options dialog box is displayed.

3

In the Options dialog box, click the Add Environment button and create an environment, for example with the name LogicBuilderShell_V4.x.

4

Set the Logic Builder Shell as Default Environment.

5

Set the Path to your LogicBuilderShell.exe (for example, C:\Program Files (x86)\Schneider Electric\SoMachine Software\Vx.x\LogicBuilderShell.exe).

6

Set the Windows Path to your LogicBuilderShell.exe (for example, C:\Program Files (x86)\Schneider Electric\SoMachine Software\Vx.x\LogicBuilderShell.exe).

7

Set the Library Path to the ScriptLib folder (for example, C:\Program Files (x86)\Schneider Electric\SoMachine Software\Vx.x\LogicBuilder\ScriptLib\3.5.5.0).

8

Set the Architecture to x86.

9

Set the Language Version to 2.7.

G-SE-0046424.2.gif-high.gif

 

 

Configuring Visual Studio Solution and Python Projects

Step

Action

1

Start Visual Studio.

2

Create a new solution.

3

Create a new IronPython application.

4

Right-click your project in the solution and execute the command Properties from the context menu.

5

In the General tab, select your configured LogicBuilderShell_V4.x as Interpreter.

6

In the Debug tab, select IronPython (.NET) launcher as Launch mode.