Skip to main content

SE APC external Python interface

Project description

Python SDK for Schneider Electric EcoStruxure Automation Expert Advanced Process Control

This package allows user Python installations to interact with Schneider Electric EcoStruxure Automation Expert Advanced Process Control (APC) as an external Python environment. This extends the functionality of the APC director environment native Python environments including the ability to import popular AI, optimization and analysis packages.

Installation with an internet connection

For machines with an internet connection run the following command from the machine hosting the Python environment to install this package and all dependencies.

pip install pyseapc

Installing without an internet connection

The process of installing pyseapc on machines without a direct internet connection requires three steps: Downloading the package and dependencies on a machine with internet, transferring the files to the target machine, and installing the package and dependencies on the target machine.

  1. Downloading the packages on an internet-connected machine This process must be done from a machine with the same operating system, Python version and CPU architecture as the target machine that will be running the external Python environment. This is because some of the dependencies have different installation files depending on the target machine configuration. Docker containers or virtual machines can be quite useful for this if finding an internet-connected machine with the specifications is difficult. On the internet-connected machine create a raw text file (.txt) name “requirements.txt” and paste the following contents into that file. Notepad or similar is useful for this. Do not use MS Word.
cffi==1.17.1
cryptography==45.0.5
grpcio==1.73.1
grpcio-tools==1.73.1
protobuf==6.31.1
pycparser==2.22
pyseapc==0.0.1
pyOpenSSL==25.1.0
setuptools==80.9.0
typing_extensions==4.14.1

Run the following command from the directory containing “requirements.txt”:

pip wheel -r requirements.txt --wheel-dir wheelhouse

This will create a directory named “wheelhouse” that contains the proper versions and architectures for all the necessary dependencies.

  1. Transferring the packages to the target machine

Copy requirements.txt and wheelhouse to the target machine using whatever secure method required.

  1. Installing the packages on the target machine

Run the following command on the target machine from the directory containing wheelhouse and requirements.txt.

pip install --no-index --find-links=./wheelhouse -r requirements.txt

Test running a Python script with import pyseapc. If this import succeeds, the offline installation was successful.

Examples

A sample Python script is given below:

import pyseapc
import numpy as np

def user_method(data):
    result = {
        'average': np.mean(data['values']),
        'stddev': np.std(data['values']),
        'min': np.min(data['values']),
        'max': np.max(data['values']),
    }
    return result

# New SSL keys can be generated and used
app = pyseapc.ApcExternalPythonEnvironment(user_method, generate_ssl_keys=True)
# Or existing ones can be loaded
# app = pyseapc.ApcExternalPythonEnvironment(user_method, private_key_path="path/to/file.pem", public_key_path="path/to/file.crt")
app.start(5001)

The corresponding Director code:

apcglobal(cvValues = [])
controllerName = "DRYER"
cvTags = GetTagList(controllerName, "ControlledVariable")
serverAddress = "https://localhost:5001"

cvValues.append(GetControllerAttributes(controllerName, "OutletAirTemp", "ControlledVariable", "ProcessValue"))

cert = '''-----BEGIN CERTIFICATE-----
Copy of the public certificate here as printed by the Python process or loaded from file
-----END CERTIFICATE-----'''

results = CallRemotePython({'values': cvValues}, serverAddress, cert)

# A specific timeout can also be set
# results = CallRemotePythonWithTimeout({'values': cvValues}, serverAddress, cert, 5)
print "Rolling Statistical Values:", results

Additional examples and documentation are available with the documentation distributed with APC.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyseapc-0.0.6.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyseapc-0.0.6-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file pyseapc-0.0.6.tar.gz.

File metadata

  • Download URL: pyseapc-0.0.6.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pyseapc-0.0.6.tar.gz
Algorithm Hash digest
SHA256 e85848d55d6eddebbcb43749d60ee12f738f2e28ccbc626b44248a2e19731aae
MD5 3e56577c85949bfb54b99a8d322f8034
BLAKE2b-256 ecc618d49711971595d3758844d15ab8a1143e7429769f050cacf4df2de32cdc

See more details on using hashes here.

File details

Details for the file pyseapc-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pyseapc-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pyseapc-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 71548a7b243157f22eccaad7f9421d6b8532cf7379d067be1279d1af55562a66
MD5 73e59438849757584150da0226015d66
BLAKE2b-256 efdcdd8a094a584597a38ec7ac1e5000f4c6baca05dd56fd38575f38691fa7fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page