esi-simaticbatchbridge

Dependencies

library version inmation core library

dkjson

2.5.0

yes

socket

3.0.0

yes

esi-variables

1.0.0

yes

Available functions

All functions have to be called according to the ESI standard, using colons, e.g. lib:FUNCTIONNAME(params)

Documentation

CHAINBATCH2BATCH(params,credentials)

CHAINBATCH2BATCH chains a given batch to another batch.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

batch handle (string)

params.predecessor

predecessor batch handle (string)

params.chainonstart

chainmode (boolean)

params.gaptimeinsec

gaptime at a chained batch (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set successor batch handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- set predecessor batch handle
params.predecessor = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 222)"
params.chainonstart = false
params.gaptimeinsec = 10
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:CHAINBATCH2BATCH(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

COPYBATCH(params,credentials)

COPYBATCH creates a copy of a batch and inserts it with a new name.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

handle of the batch to be copied (string)

params.name

batch name (string)

params.desc

batch description (string)

params.optlock

optional lock (boolean)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

If the batch was copied successfully then the result contains the handle of the copy.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set handle of the batch to copy
params.hdl = "78/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
-- batch name
params.name = "MyBatch"
-- order description (optional)
params.desc = "Test batch"
-- if the "optlock" is set then newly created object will be locked and should be unlocked by the application after use
params.optlock = false
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:COPYBATCH(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

COPYFORMULA(params,credentials)

COPYFORMULA creates a copy of a formula and inserts it with a new name.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

handle of the formula to be copied (string)

params.version

formula version (string)

params.name

formula name (string)

params.desc

formula description (string)

params.optlock

optional lock (boolean)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

If the formula was copied successfully then the result contains the handle of the copy.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set handle of the formula to copy
params.hdl = "78/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
-- formula name
params.name = "MyFormula"
-- formula version
params.version = "v1"
-- formula description (optional)
params.desc = "description"
-- if the "optlock" is set then newly created object will be locked and should be unlocked by the application after use
params.optlock = false
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:COPYFORMULA(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

COPYORDER(params,credentials)

COPYORDER creates a copy of an order and inserts it with a new name.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

handle of the order to copy (string)

params.name

name of the new order (string)

params.desc

description of the new order (string)

params.optlock

optional lock (boolean)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

If the order was copied successfully then the result contains the handle of the copy.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set handle of the order to copy
params.hdl = "78/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
-- order name
params.name = "MyOrder"
-- order description (optional)
params.desc = "Test order"
-- if the "optlock" is set then newly created object will be locked and should be unlocked by the application after use
params.optlock = false
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:COPYORDER(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

COPYRECIPE(params,credentials)

COPYRECIPE creates a copy of a given recipe and inserts it with a new name.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

handle of the recipe to be copied (string)

params.usesubfolder

create in a subfolder (boolean)

params.subfolderhdl

subfolder handle (string)

params.name

recipe name (string)

params.desc

recipe description (string)

params.version

recipe version (string)

params.optlock

optional lock (boolean)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

If the recipe was copied successfully then the output contains the handle of the copy.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set handle of the recipe to copy
params.hdl = "/7/3/CG6_23227-613-21/(2:0-7#22, 110)"
--if set then subfolderhdl will be used
params.usesubfolder = true
-- set parent folder handle
params.subfolderhdl = "7/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
-- new name of the recipe
params.name = "MyRecipe"
-- version of the recipe
params.version = "v1"
-- order category description (optional)
params.desc = "My description"
-- if set then object will be locked
params.optlock = false
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:COPYRECIPE(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

CREATEBATCH(params,credentials)

CREATEBATCH creates a new batch in the given order.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

order handle (string)

params.startmode

start mode (number)

params.planstart

planned start of the batch (string)

params.planend

planned end of the batch (string)

params.formormrhdl

the handle of the recipe/formula (string)

params.size

batch size (number)

params.name

batch name (string)

params.desc

batch description (string)

params.optlock

optional lock (boolean)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

If the batch was created successfully then the result contains its handle.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set order handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
-- startmode parameter is optional
params.startmode = lib.StartMode.Manual
params.planstart = "2020-12-20T20:10:00.000Z"
params.planend = "2020-12-20T21:10:00.000Z"
-- batch name
params.name = "MyBatch"
-- batch size
params.size = 1
-- batch description (optional)
params.desc = "Test batch"
-- defines the handle of the recipe/formula
params.formormrhdl = "4/1/AF6_21137-613-22/(0:0-2805#5063, 320)"
-- if the "optlock" is set then newly created object will be locked and should be unlocked by the application after use
params.optlock = false
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:CREATEBATCH(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

CREATEFORMULA(params,credentials)

CREATEFORMULA creates a new formula in the given formula category.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

order category handle (string)

params.name

order category name (string)

params.version

formula version (string)

params.desc

formula description (string)

params.optlock

optional lock (boolean)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

If the formula was created successfully then the result contains its handle.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set order category handle
params.hdl = "78/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
-- formula name
params.name = "MyOrder"
-- formula version
params.version = "v1"
-- order description (optional)
params.desc = "Test order"
-- if the "optlock" is set then newly created object will be locked and should be unlocked by the application after use
params.optlock = false
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:CREATEFORMULA(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

CREATEFORMULACAT(params,credentials)

CREATEFORMULACAT creates a formula category.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.usesubfolder

create in a subfolder (boolean)

params.subfolderhdl

subfolder handle (string)

params.name

formula category name (string)

params.desc

formula category description (string)

params.optlock

optional lock (boolean)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

If the formula category was created successfully then the result contains its handle.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
--if set then subfolderhdl will be used
params.usesubfolder = true
-- set parent folder handle
params.subfolderhdl = "7/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
-- order category name
params.name = "MyOrderCat"
-- order category description (optional)
params.desc = "My description"
-- if set then object will be locked
params.optlock = false
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:CREATEFORMULACAT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

CREATEMATERIAL(params,credentials)

CREATEMATERIAL creates a material.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.usesubfolder

create in a subfolder (boolean)

params.subfolderhdl

subfolder handle (string)

params.name

material name (string)

params.desc

material description (string)

params.code

material code (string)

params.usage

material usage (number)

params.optlock

optional lock (boolean)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

If the material was created successfully then the result contains its handle.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
--if set then subfolderhdl will be used
params.usesubfolder = true
-- set parent folder handle
params.subfolderhdl = "7/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
-- material name
params.name = "MyOrderCat"
-- material description (optional)
params.desc = "My description"
-- set material code
params.code = "0815"
-- set material usage
params.usage = lib.MaterialUsage.Both
-- if set then object will be locked
params.optlock = false
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:CREATEMATERIAL(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

CREATEORDER(params,credentials)

CREATEORDER creates a new order in the given order category.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

order category handle (string)

params.earliest

earliest start time of an order (string)

params.latest

latest start time of an order (string)

params.size

order size (number)

params.name

order name (string)

params.desc

order description (string)

params.optlock

optional lock (boolean)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

If the order was created successfully then the result contains its handle.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set order category handle
params.hdl = "78/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
params.earliest = "2020-12-20T20:10:00.000Z"
params.latest = "2020-12-20T21:10:00.000Z"
-- order name
params.name = "MyOrder"
-- order size
params.size = 1
-- order description (optional)
params.desc = "Test order"
-- if the "optlock" is set then newly created object will be locked and should be unlocked by the application after use
params.optlock = false
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:CREATEORDER(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

CREATEORDERCAT(params,credentials)

CREATEORDERCAT creates an order category.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.usesubfolder

create in a subfolder (boolean)

params.subfolderhdl

subfolder handle (string)

params.name

order category name (string)

params.desc

order category description (string)

params.optlock

optional lock (boolean)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

If the order category was created successfully then the result contains its handle.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
--if set then subfolderhdl will be used
params.usesubfolder = true
-- set parent folder handle
params.subfolderhdl = "7/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
-- order category name
params.name = "MyOrderCat"
-- order category description (optional)
params.desc = "My description"
-- if set then object will be locked
params.optlock = false
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:CREATEORDERCAT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

CREATEQUALITY(params,credentials)

CREATEQUALITY creates a quality.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

handle of the material to create the quality for (string)

params.name

quality name (string)

params.code

quality code (number)

params.desc

quality description (string)

params.optlock

optional lock (boolean)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

If the quality was created successfully then the result contains its handle.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set material handle
params.hdl = "7/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
-- quality name
params.name = "MyOrderCat"
-- quality description
params.desc = "description"
-- quality code
params.code = 198
-- quality description (optional)
params.desc = "My description"
-- if the "optlock" is set then newly created object will be locked and should be unlocked by the application after use
params.optlock = false
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:CREATEQUALITY(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

CREATESUBFOLDER(params,credentials)

CREATESUBFOLDER creates a subfolder (available from version 7.12).

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

handle of the parent folder (string)

params.name

subfolder name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

If the subfolder was created successfully then the result contains its handle.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set parent folder handle
params.hdl = "18/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
-- subfolder name
params.name = "MySubfolder"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:CREATESUBFOLDER(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

DELETEBATCH(params,credentials)

DELETEBATCH deletes the given batch from the given order.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

batch handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set batch handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:DELETEBATCH(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

DELETEFORMULA(params,credentials)

DELETEFORMULA deletes a formula.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

formula handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set formula handle
params.hdl = "7/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:DELETEFORMULA(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

DELETEFORMULACAT(params,credentials)

DELETEFORMULACAT deletes a formula category.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

formula category handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set formula category handle
params.hdl = "7/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:DELETEFORMULACAT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

DELETEMATERIAL(params,credentials)

DELETEMATERIAL deletes a material.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

material handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set material handle
params.hdl = "18/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:DELETEMATERIAL(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

DELETEORDER(params,credentials)

DELETEORDER deletes the given order from the given order category.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

order handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set order handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:DELETEORDER(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

DELETEORDERCAT(params,credentials)

DELETEORDERCAT deletes an order category.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

order cat handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set order category handle
params.hdl = "7/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:DELETEORDERCAT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

DELETERECIPE(params,credentials)

DELETERECIPE deletes a recipe.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

recipe handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set recipe handle
params.hdl = "7/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:DELETERECIPE(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

DELETEQUALITY(params,credentials)

DELETEQUALITY deletes a quality.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

quality handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set quality handle
params.hdl = "18/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:DELETEQUALITY(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

DELETESUBFOLDER(params,credentials)

DELETESUBFOLDER deletes a subfolder (available from version 7.12).

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

subfolder handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set subfolder handle
params.hdl = "18/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:DELETESUBFOLDER(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLBATCHES4ORDER(params,credentials)

GETALLBATCHES4ORDER returns all batches for the given order.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

order handle (string)

params.outputbar

types of the attributes to be returned (number)

params.synctime

if set then only batches created or modified after the given time are returned (string)

params.hierarchy

if set then complete hierarchy will be returned (bool)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handles and selected attributes of all batches in the order.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set order handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
-- if the optional parameter "synctime" is set then only objects created or modified after the given time are returned
params.synctime = "02.09.2020 16:45:00"
params.hierarchy = false
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLBATCHES4ORDER(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLCHAINEDPREDECESSORS4BATCH(params,credentials)

GETALLCHAINEDPREDECESSORS4BATCH returns all predecessors of a chained batch..

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

batch handle (string)

params.outputbar

types of the attributes to be returned (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handles of all predecessors of the chained batch.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set batch handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLCHAINEDPREDECESSORS4BATCH(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLCHAINEDSUCCESSORS4BATCH(params,credentials)

GETALLCHAINEDSUCCESSORS4BATCH returns all successors of a given batch.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

batch handle (string)

params.outputbar

types of the attributes to be returned (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handles of all successors of the given batch.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set batch handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLCHAINEDSUCCESSORS4BATCH(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLCHAINROOTS4PCELL(params,credentials)

GETALLCHAINROOTS4PCELL returns all chain roots (all batches without any predecessor).

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.outputbar

types of the attributes to be returned (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handles of all chain roots.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLCHAINROOTS4PCELL(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLDATATYPES4PCELL(params,credentials)

GETALLDATATYPES4PCELL returns all data types and values for the given process cell.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains all data types and values for the given process cell.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLDATATYPES4PCELL(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLFORMULACATS4PCELL(params,credentials)

GETALLFORMULACATS4PCELL returns all formula categories for the given process cell.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.outputbar

types of the attributes to be returned (number)

params.synctime

if set then only batches created or modified after the given time are returned (string)

params.hierarchy

if set then complete hierarchy will be returned (bool)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

 — 

if the optional parameter "synctime" is set then only objects created or modified after the given time are returned.

Returns

The result contains the handles and selected attributes of all formula categories for the process cell.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
params.synctime = "02.09.2020 16:45:00"
params.hierarchy = false
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLFORMULACATS4PCELL(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLFORMULAS4FORMULACAT(params,credentials)

GETALLFORMULAS4FORMULACAT returns all formulas for the given formula category.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

formula category handle (string)

params.outputbar

types of the attributes to be returned (number)

params.synctime

if set then only batches created or modified after the given time are returned (string)

params.hierarchy

if set then complete hierarchy will be returned (bool)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

 — 

if the optional parameter "synctime" is set then only objects created or modified after the given time are returned.

Returns

The result contains the handles and selected attributes of all formulas in the formula category.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set formula category handle
params.hdl = "/13/4/BF6_44517-124-74/(0:0-2199#5132, 200)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
params.synctime = "02.09.2020 16:45:00"
params.hierarchy = false
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLFORMULAS4FORMULACAT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLFORMULAS4MR(params,credentials)

GETALLFORMULAS4MR return all formulas for the given recipe.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

recipe handle (string)

params.outputbar

types of the attributes to be returned (number)

params.synctime

if set then only batches created or modified after the given time are returned (string)

params.hierarchy

if set then complete hierarchy will be returned (bool)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handles and selected attributes of all formulas for the given recipe.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set recipe handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
--if the optional parameter "synctime" is set then only object created or modified after the given time are returned
params.synctime = "02.09.2020 16:45:00"
params.hierarchy = false
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLFORMULAS4MR(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLFORMULASORMR4CREATEBATCH(params,credentials)

GETALLFORMULASORMR4CREATEBATCH returns all recipes/formula suitable for creating a batch.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.outputbar

types of the attributes to be returned (number)

params.synctime

if set then only batches created or modified after the given time are returned (string)

params.hierarchy

if set then complete hierarchy will be returned (bool)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

 — 

if the optional parameter "synctime" is set then only objects created or modified after the given time are returned.

Returns

The result contains the handles and selected attributes of all formulas / recipes suitable for creating a batch.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
params.synctime = "02.09.2020 16:45:00"
params.hierarchy = false
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLFORMULASORMR4CREATEBATCH(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLLIB4PCELL(params,credentials)

GETALLLIB4PCELL returns all libraries for the given process cell (available from version 7.12).

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.outputbar

types of the attributes to be returned (number)

params.synctime

if set then only batches created or modified after the given time are returned (string)

params.hierarchy

if set then complete hierarchy will be returned (bool)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

 — 

if the optional parameter "synctime" is set then only objects created or modified after the given time are returned.

Returns

The result contains all libraries for the given process cell.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
params.synctime = "02.09.2020 16:45:00"
params.hierarchy = false
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLLIB4PCELL(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLMATERIALS4PCELL(params,credentials)

GETALLMATERIALS4PCELL returns all materials for the given process cell.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.outputbar

types of the attributes to be returned (number)

params.synctime

if set then only batches created or modified after the given time are returned (string)

params.hierarchy

if set then complete hierarchy will be returned (bool)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

 — 

if the optional parameter "synctime" is set then only objects created or modified after the given time are returned.

Returns

The result contains the handles and selected attributes of all materials for the process cell.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
params.synctime = "02.09.2020 16:45:00"
params.hierarchy = false
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLMATERIALS4PCELL(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLMR4PCELL(params,credentials)

GETALLMR4PCELL returns all recipes for the given process cell.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.outputbar

types of the attributes to be returned (number)

params.synctime

if set then only batches created or modified after the given time are returned (string)

params.hierarchy

if set then complete hierarchy will be returned (bool)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

 — 

if the optional parameter "synctime" is set then only objects created or modified after the given time are returned.

Returns

The result contains the handles and selected attributes of all recipes in the process cell.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
params.synctime = "02.09.2020 16:45:00"
params.hierarchy = false
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLMR4PCELL(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLORDERCATS4PCELL(params,credentials)

GETALLORDERCATS4PCELL returns all order categories for the given process cell.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.outputbar

types of the attributes to be returned (number)

params.synctime

if set then only batches created or modified after the given time are returned (string)

params.hierarchy

if set then complete hierarchy will be returned (bool)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

 — 

if the optional parameter "synctime" is set then only objects created or modified after the given time are returned.

Returns

The result contains the handles and selected attributes of all order categories for the process cell.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
params.synctime = "02.09.2020 16:45:00"
params.hierarchy = false
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLORDERCATS4PCELL(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLORDERS4ORDERCAT(params,credentials)

GETALLORDERS4ORDERCAT returns all orders for the given order category.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

order category handle (string)

params.outputbar

types of the attributes to be returned (number)

params.synctime

if set then only batches created or modified after the given time are returned (string)

params.hierarchy

if set then complete hierarchy will be returned (bool)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handles and selected attributes of all orders in the order category.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set order category handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
-- if the optional parameter "synctime" is set then only objects created or modified after the given time are returned
params.synctime = "02.09.2020 16:45:00"
params.hierarchy = false
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLORDERS4ORDERCAT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLPCELLS4PROJECT(params)

GETALLPCELLS4PROJECT returns all available process cells for the given project.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.outputbar

types of the attributes to be returned (number)

Returns

The result contains the handles and names of all process cells for the project.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
lib:SETCONNECTION({})
local result, exception = lib:GETALLPCELLS4PROJECT(params)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLPHYSICALUNITS4PCELL(params,credentials)

GETALLPHYSICALUNITS4PCELL returns all physical units for the given process cell.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains all physical units for the given process cell.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLPHYSICALUNITS4PCELL(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLPROJECTS(params)

GETALLPROJECTS returns all available SIMATIC BATCH projects.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.outputbar

types of the attributes to be returned (number)

Returns

The result contains the handles and names of all available projects.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
lib:SETCONNECTION({})
local result, exception = lib:GETALLPROJECTS(params)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLQUALITIES4MATERIAL(params,credentials)

GETALLQUALITIES4MATERIAL return all qualities for the given material.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

material handle (string)

params.outputbar

types of the attributes to be returned (number)

params.synctime

if set then only batches created or modified after the given time are returned (string)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

 — 

if the optional parameter "synctime" is set then only objects created or modified after the given time are returned.

Returns

The result contains the handles and selected attributes of all qualities for the material.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
set material handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
params.synctime = "02.09.2020 16:45:00"
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLQUALITIES4MATERIAL(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETALLSUBFOLDERS4PCELL(params,credentials)

GETALLSUBFOLDERS4PCELL returns all subfolders for the given process cell.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.outputbar

types of the attributes to be returned (number)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains all libraries for the given process cell.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETALLSUBFOLDERS4PCELL(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETATTRIBUTE4OBJECT(params,credentials)

GETATTRIBUTE4OBJECT returns attributes for a given object.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

object handle (string)

params.outputbar

types of the attributes to be returned (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

Returned are all data for the object, defined by outputbar.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set object handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETATTRIBUTE4OBJECT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETBATCHSIZE(params,credentials)

GETBATCHSIZE returns the batch size.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

batch handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains batch size.

Usage

local lib = require("esi-simaticbatchbridge")
local credentials = {}
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set batch handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETBATCHSIZE(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETBATCHSTATE(params,credentials)

GETBATCHSTATE returns the state, extended state and chaining info for a given batch.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

batch handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handle, the state, the extended state and the chaining info.

Usage

local lib = require("esi-simaticbatchbridge")
local credentials = {}
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set batch handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETBATCHSTATE(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETBATCHSTARTDATA(params,credentials)

GETBATCHSTARTDATA returns the state, extended state and chaining info for a given batch.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

batch handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The output contains the following batch data: planned start, estimated end, actual start, actual end, start modus.

Usage

local lib = require("esi-simaticbatchbridge")
local credentials = {}
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set batch handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETBATCHSTARTDATA(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETCHILDREN(params,credentials)

GETCHILDREN returns all children for a given object.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

object handle (string)

params.outputbar

types of the attributes to be returned (number)

params.synctime

if set then only batches created or modified after the given time are returned (string)

params.objecttype

target object type (numeric)

params.hierarchy

if set then complete hierarchy will be returned (bool)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handles and selected attributes of all children of the object.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set object handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
--if the optional parameter "synctime" is set then only object created or modified after the given time are returned
params.synctime = "02.09.2020 16:45:00"
params.objecttype = lib.ObjectType.Batch
params.hierarchy = false
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETCHILDREN(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETEVENTS(params)

GETEVENTS returns events collected for the given handle in the buffer since the last GETEVENTS() call.

Parameters

params

Table containing the following parameters.

params.handle

subscription handle (string)

Returns

The result contains error code, the list of events, the information if overflow occured since last GETEVENTS() call and if all events were returned.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set subscription handle (value returned from SUBSCRIBE() call)
params.handle = "CC8596BD-DF37-4F34-9EB4-0965C35FD739"
lib:SETCONNECTION({})
local result, exception = lib:GETEVENTS(params)
return (require "esi-string"):STRING({res=result,ex=exception})

GETERRORTEXT(errorcode)

GETERRORTEXT returns the text for an error code.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

errorcode

error code (numeric)

Returns

Returns text for an error code.

Usage

local lib = require("esi-simaticbatchbridge")
local errorcode = 26
lib:SETCONNECTION({})
local result, exception = lib:GETERRORTEXT(errorcode)
return (require "esi-string"):STRING({res=result,ex=exception})

GETFORMULACAT4MR(params,credentials)

GETFORMULACAT4MR returns the formula category for the given recipe.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

recipe handle (string)

params.outputbar

types of the attributes to be returned (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handle and selected attributes of the formula category referenced in the recipe.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set recipe handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETFORMULACAT4MR(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETMATERIALDATA(params,credentials)

GETMATERIALDATA returns material data for a given material.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

material handle (string)

params.outputbar

types of the attributes to be returned (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handle and selected attributes of the material.

Usage

local lib = require("esi-simaticbatchbridge")
local credentials = {}
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
set material handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
params.outputbar = true
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETMATERIALDATA(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETMR4FORMULA(params,credentials)

GETMR4FORMULA returns all referenced recipes for a given formula.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

formula handle (string)

params.outputbar

types of the attributes to be returned (number)

params.synctime

if set then only batches created or modified after the given time are returned (string)

params.hierarchy

if set then complete hierarchy will be returned (bool)

params.wildcardfilter4name

wildcard filer for name (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handles and selected attributes of all recipes referencing the formula.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set formula handle
params.hdl = "/13/4/BF6_44517-124-74/(0:0-2199#5132, 200)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
params.hierarchy = false
params.wildcardfilter4name = "A*"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETMR4FORMULA(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETOBJECTDATA(params,credentials)

GETOBJECTDATA returns a given object.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

object handle (string)

params.outputbar

types of the attributes to be returned (number)

params.useexttransform

use external xml transformation (boolean)

params.exttransform

external transformation (string)

params.archiveversion

archive version (numeric)

params.dataflags

flag for creating the external xml (numeric)

params.pcell

xml transformation with pcell (boolean)

params.default

if this parmater is set and archive version 3 is used then dataflags parameter is used (boolean)

params.extdata

xml transformation and give more datapackages (bool)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

Objects data is returned.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set object handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
params.useexttransform = false
params.exttransform = ""
-- archiveversion has value between 1 and 9
params.archiveversion = 9
params.dataflags = lib.DataFlags.PCell + lib.DataFlags.Charts
-- or
-- params.archiveversion = 3
-- params.default = false
-- params.pcell = true
-- or
-- params.archiveversion = 2
-- params.pcell = true
-- or
-- params.archiveversion = 1
-- params.extdata = false
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETOBJECTDATA(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETOBJECTHEADER(params,credentials)

GETOBJECTHEADER returns the header parameter block of objects. The function is implemented 4 batch, lib, mr, formula objects.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

object handle (string)

params.withactvalue

with actual value (boolean)

params.withparameter

switch the parameter on/off (boolean)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the header parameter block of object.

Usage

local lib = require("esi-simaticbatchbridge")
local credentials = {}
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
set object handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
params.withactvalue = true
params.withparameter = true
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETOBJECTHEADER(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETOBJECTSTATE(params,credentials)

GETOBJECTSTATE returns state and extended state for recipes, libraries, formulas or batches.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

object handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the state and extended state of the given object.

Usage

local lib = require("esi-simaticbatchbridge")
local credentials = {}
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
set object handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETOBJECTSTATE(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETPARAMETER(params,credentials)

GETPARAMETER returns the parameters for a given recipe, formula or batch.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

object handle (string)

params.outputbar

types of the attributes to be returned (number)

params.wildcardfilter4name

wildcard filer for name (string)

params.ignoredeferring
params.withactvalue

with actual value (boolean)

params.termid
params.contid
params.usage
credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the data of object parameters.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set object handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
-- all paramters which begin with "A"
params.wildcardfilter4name = "A*"
params.ignoredeferring = true
params.withactvalue = true
params.termid = 2
params.contid = 1
params.usage = lib.ParamUsage.Both
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETPARAMETER(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETPARENT(params,credentials)

GETPARENT returns the parent object of a given object.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

object handle (string)

params.outputbar

types of the attributes to be returned (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handles and selected attributes of the parent object.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set object handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETPARENT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETPRODUCTDATA4OBJECT(params,credentials)

GETPRODUCTDATA4OBJECT returns the Product data for a given object (available from version 7.12).

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

object handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the product data.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set object handle
params.hdl = "/13/4/BF6_44517-124-74/(0:0-2199#5132, 200)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETPRODUCTDATA4OBJECT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETQUALITYDATA(params,credentials)

GETQUALITYDATA returns quality data for a given quality.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

quality handle (string)

params.outputbar

types of the attributes to be returned (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handle and selected attributes of the quality.

Usage

local lib = require("esi-simaticbatchbridge")
local credentials = {}
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
set quality handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
params.outputbar = true
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:GETQUALITYDATA(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

GETSTATUS()

GETSTATUS returns information about Simatic Bridge service.

Returns

The result contains the information about configuration and environment of Simatic Bridge Service.

Usage

local lib = require("esi-simaticbatchbridge")
lib:SETCONNECTION({})
local res, err = lib:GETSTATUS()
return (require "esi-string"):STRING({res=res,err=err})

GETSUBSCRIPTIONSTATE()

GETSUBSCRIPTIONSTATE returns the state of the events subscription.

Returns

The result contains the project and pcell of the current subscription. Additionally it contains list of used handles, number of events in all buffers and number of buffers.

Usage

local lib = require("esi-simaticbatchbridge")
lib:SETCONNECTION({})
local result, exception = lib:GETSUBSCRIPTIONSTATE()
return (require "esi-string"):STRING({res=result,ex=exception})

ISMATERIALREFERENCED(params,credentials)

ISMATERIALREFERENCED returns all recipes, libraries or formulas referencing a given material.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

material handle (string)

params.outputbar

types of the attributes to be returned (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the handles of all objects with references to the given material.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set material handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- outputbar specifies the types of the attributes to be returned along with the handle
params.outputbar = lib.AttributeType.Name + lib.AttributeType.Version
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:ISMATERIALREFERENCED(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

LOCKOBJECT(params,credentials)

LOCKOBJECT sets a lock on a SIMATIC BATCH object.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

object handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains only error code.

Usage

local lib = require("esi-simaticbatchbridge")
local credentials = {}
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set object handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:LOCKOBJECT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SETATTRIBUTE4OBJECT(params,credentials)

SETATTRIBUTE4OBJECT sets attributes for a given object.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

object handle (string)

params.attributetype

attribute type (numeric)

params.value

attribute value (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set object handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- set attribute type
params.attributetype = lib.AttributeType.Desc
-- set attribute value
params.value = "Main instance"
local credentials = {}
params.username = "JOW"
params.usernamelong = "John Wood"
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SETATTRIBUTE4OBJECT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SETBATCHSIZE(params,credentials)

SETBATCHSIZE sets the batch size.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

batch handle (string)

params.size

batch size (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set batch handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
params.size = 100
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SETBATCHSIZE(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SETBATCHSTARTDATA(params,credentials)

SETBATCHSTARTDATA sets the start data for a given batch.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

batch handle (string)

params.startmode

start mode (numeric)

params.planstart

planned start (string)

params.planend

planned end (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set batch handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
params.startmode = lib.StartMode.Time
params.planstart = "2020-12-20T20:10:00.000Z"
params.planend = "2020-12-20T21:10:00.000Z"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SETBATCHSTARTDATA(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SETBATCHSTATE(params,credentials)

SETBATCHSTATE sets the state, extended state and continue flag for a batch.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

batch handle (string)

params.state

batch state (numeric)

params.exstate

batch extended state (numeric)

params.continue

continue flag for chaining (boolean)

params.stayincontimode

decides whether the plant’s equipment phase continues to run (boolean)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set batch handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
params.state = lib.BatchState.Released
params.exstate = lib.BatchExState.InitialValue
params.continue = true
params.stayincontimode = true
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SETBATCHSTATE(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SETCONNECTION(args)

SETCONNECTION configures TCP connection settings.

It should be called before any other Simatic Bridge function.

Parameters

args

table containing the following connection parameters.

args.host

string Simatic-Bridge hostname, default localhost

args.port

number Simatic-Bridge portnumber, default 7959

args.timeout

number Simatic-Bridge timeout in seconds, default 3

args.buffersize

number Simatic-Bridge TCP buffer size, default 2048

Usage

local lib = require("esi-simaticbatchbridge")
local connection = {}
connection.host = "127.0.0.1"
connection.port = 5959
connection.timeout = 3
connection.buffersize = 2048
lib:SETCONNECTION(connection)

SETFORMULACAT4MR(params,credentials)

SETFORMULACAT4MR sets a reference to the given formula category for the given recipe.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

recipe handle (string)

params.formcathdl

formula category handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set recipe handle
params.hdl = "7/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
-- set formula category handle
params.formcathdl = "6/4/CF6_88888_611-31/(0:0-2805#5063, 320)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SETFORMULACAT4MR(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SETMATERIALDATA(params,credentials)

SETMATERIALDATA sets material data for a given material.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

material handle (string)

params.name

material name (string)

params.desc

material description (string)

params.code

material code (string)

params.usage

material usage (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set material handle
params.hdl = "/77/3/CG6_21137-613-22/(2:0-7#22, 110)"
params.name = "MyMaterial"
-- material description (optional)
params.desc = "My description"
-- set material code
params.code = "0815"
-- set material usage
params.usage = lib.MaterialUsage.Both
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SETMATERIALDATA(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SETMR4FORMULA(params,credentials)

SETMR4FORMULA sets a recipe reference for the given formula.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

formula handle (string)

params.mrhdl

recipe handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set formula handle
params.hdl = "7/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
-- set recipe handle
params.mrhdl = "6/4/CF6_88888_611-31/(0:0-2805#5063, 320)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SETMR4FORMULA(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SETOBJECTSTATE(params,credentials)

SETOBJECTSTATE sets the state, extended state for an object.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

object handle (string)

params.state

object state (number)

params.exstate

object extended state (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set object handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
params.state = lib.BatchState.Released
params.exstate = lib.BatchExState.InitialValue
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SETOBJECTSTATE(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SETPARAMETER(params,credentials)

SETPARAMETER sets or changes parameters for a given batch or formula.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

handle of a given batch or formula (string)

params.ignoredeferring

set it to break the deferring chain if the parameter is deferred

params.withactvalue

with actual value (boolean)

params.parameters

List of objects containing following parameters.

params.parameters.usage
params.parameters.datatypeid
params.parameters.physicalunitid
params.parameters.id
params.parameters.materialhdl
params.parameters.value
params.parameters.valueid
params.parameters.amount
credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the results of validation for the parameters.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set object handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
params.ignoredeferring = true
params.withactvalue = true
params.parameters = {}
local p1 = {}
params.parameters[1] = p1
p1.usage = lib.ParamUsage.Both
p1.datatypeid = 6
p1.physicalunitid = 3
p1.id = 1
p1.materialhdl = "/10/4/SB6_3741141072619/(0:0-3764#12349, 219)"
p1.value = "13"
local p2 = {}
params.parameters[2] = p2
p2.usage = lib.ParamUsage.Input
p2.datatypeid = 24
p2.physicalunitid = 0
p2.id = 2
p2.value = "94"
local p3 = {}
params.parameters[3] = p3
p3.usage = lib.ParamUsage.Input
p3.datatypeid = 50
p3.id = 5
p3.valueid = 2
local p4 = {}
params.parameters[4] = p4
p4.usage = lib.ParamUsage.Both
p4.id = 1
p4.amount = 13
p4.materialhdl = "/10/4/SB6_3741141072619/(0:0-3795#12414, 219)"
p4.physicalunitid = 3
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SETPARAMETER(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SETPRODUCTDATA4OBJECT(params,credentials)

SETPRODUCTDATA4OBJECT gets the product data for a given object (MR/FORM/BATCH)..

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

object handle (string)

params.producthdl

product handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set object handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- set product handle
params.producthdl = "/60/4/CF6_14517-124-74/(0:0-2199#5632, 211)"
local credentials = {}
params.username = "JOW"
params.usernamelong = "John Wood"
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SETPRODUCTDATA4OBJECT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SETQUALITYDATA(params,credentials)

SETQUALITYDATA sets the quality data.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

quality handle (string)

params.name

quality name (string)

params.desc

quality description (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set quality handle
params.hdl = "/77/3/CG6_21137-613-22/(2:0-7#22, 110)"
-- quality name
params.name = "MyQuality"
-- quality description (optional)
params.desc = "My description"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SETQUALITYDATA(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SISCONNECT(params,credentials)

SISCONNECT creates connection to the SIS server.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.position4eventid

defines the position of the first event (number)

params.eventid

if params.position4eventid = lib.Position4EventId.Value then it contains the identifier of the first event (number)

params.adviseoptions

defines possible options for the advise in SIS-Interface (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
params.position4eventid = lib.Position4EventId.Actual
params.eventid = 0
params.adviseoptions = lib.AdviseOptions.Default
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SISCONNECT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SISDISCONNECT(credentials)

SISDISCONNECT ends connection to the SIS server.

Parameters

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
lib:SISCONNECT(params, credentials)
local result, exception = lib:SISDISCONNECT(credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SISGETALLEVENTDEFINITIONS(credentials)

SISGETALLEVENTDEFINITIONS returns all available event definitions.

Parameters

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains all event definitions.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
lib:SISCONNECT(params, credentials)
local result,exception = lib:SISGETALLEVENTDEFINITIONS(credentials)
-- at the end disconnect from SIS server
lib:SISDISCONNECT(credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SISGETALLSUBSCRIPTIONS(credentials)

SISGETALLSUBSCRIPTIONS returns all subscribed event definitions.

Parameters

params

Table containing the following parameters.

params.hdl

handle acquired during SISSUBSCRIBE (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains all subscribed event definitions.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
lib:SISCONNECT(params, credentials)
local result = lib:SISSUBSCRIBE()
local handle = result.handle
params = {}
-- set handle of the SIS event to subscribe
params.hdl = "29/4/SB6_XYZ/1-Batch"
lib:SISSUBSCRIBEEVENT(params, credentials)
params = {}
-- use the handle acquired during SISSUBSCRIBE
params.hdl = handle
-- from time to time query internal buffer to get events
local events, ex = lib:SISGETEVENTS(params)
-- retrieve subscribed event definition
local definitions = lib:SISGETALLSUBSCRIPTIONS(credentials)
params = {}
-- set handle of the SIS event to unsubscribe
params.hdl = "29/4/SB6_XYZ/1-Batch"
-- stop receive notifications for particular event
lib:SISUNSUBSCRIBEEVENT(params, credentials)
-- at the end disconnect from SIS server
lib:SISDISCONNECT(credentials)

SISGETBATCHHISTORICALEVENTSBYID(params,credentials)

SISGETBATCHHISTORICALEVENTSBYID retrieves eventdata from batch using event identifiers.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

batch handle (string)

params.starteventid

identifier of the first event to retrieve (number)

params.endeventid

identifier of the last event to retrieve (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the list of eventdata.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set batch handle
params.hdl = "78/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
params.starteventid = 0
params.endeventid = 999
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SISGETBATCHHISTORICALEVENTSBYID(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SISGETBATCHHISTORICALEVENTSBYTIME(params,credentials)

SISGETBATCHHISTORICALEVENTSBYTIME retrieves eventdata from batch using time.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

batch handle (string)

params.starttime

timestamp of the first event to retrieve (string)

params.endtime

timestamp of the last event to retrieve (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the list of eventdata.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set batch handle
params.hdl = "78/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
params.starttime = "2020-01-01T01:00:00.000Z"
params.endtime = "2021-10-01T01:00:00.000Z"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SISGETBATCHHISTORICALEVENTSBYTIME(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SISGETCHANGEDBATCHES(params,credentials)

SISGETCHANGEDBATCHES retrieves batches which have been active in a given time interval.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.starttime

timestamp of the interval begin (string)

params.endtime

timestamp of the interval end (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the list of changed batches.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
params.starttime = "2020-01-01T01:00:00.000Z"
params.endtime = "2021-10-01T01:00:00.000Z"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SISGETCHANGEDBATCHES(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SISGETEVENTS(params)

SISGETEVENTS queries internal buffer to get SIS events.

Parameters

params

Table containing the following parameters.

params.hdl

handle acquired during SISSUBSCRIBE (string)

Returns

The result contains error code and list of event notifications.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
lib:SISCONNECT(params, credentials)
local result = lib:SISSUBSCRIBE()
local handle = result.handle
params = {}
-- set handle of the SIS event to subscribe
params.hdl = "29/4/SB6_XYZ/1-Batch"
lib:SISSUBSCRIBEEVENT(params, credentials)
params = {}
-- use the handle acquired during SISSUBSCRIBE
params.hdl = handle
-- from time to time query internal buffer to get events
local events,exception = lib:SISGETEVENTS(params)
params = {}
-- set handle of the SIS event to unsubscribe
params.hdl = "29/4/SB6_XYZ/1-Batch"
-- stop receive notificationsstop receive notifications for particular event
lib:SISUNSUBSCRIBEEVENT(params, credentials)
-- at the end disconnect from SIS server
lib:SISDISCONNECT(credentials)
return (require "esi-string"):STRING({res=events,ex=exception})

SISGETSUBSCRIPTIONSTATE()

SISGETSUBSCRIPTIONSTATE returns the state of the SIS events subscription.

Returns

The result contains the project and pcell of the current SIS subscription. Additionally it contains list of used handles, number of events in all buffers and number of buffers.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
lib:SISCONNECT(params, credentials)
local result = lib:SISSUBSCRIBE()
local handle = result.handle
lib:SISSUBSCRIBEALLBASICEVENTS(credentials)
local state, exeption = lib:SISGETSUBSCRIPTIONSTATE()
-- free all handles acquired during SISSUBSCRIBE
lib:SISUNSUBSCRIBEALL()
return (require "esi-string"):STRING({res=state,ex=exception})

SISGETUNITHISTORICALEVENTSBYID(params,credentials)

SISGETUNITHISTORICALEVENTSBYID retrieves eventdata from unit using event identifiers.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

unit handle (string)

params.starteventid

identifier of the first event to retrieve (number)

params.endeventid

identifier of the last event to retrieve (number)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the list of eventdata.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set unit handle
params.hdl = "78/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
params.starteventid = 0
params.endeventid = 999
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SISGETUNITHISTORICALEVENTSBYID(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SISGETUNITHISTORICALEVENTSBYTIME(params,credentials)

SISGETUNITHISTORICALEVENTSBYTIME retrieves eventdata from unit using time.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

unit handle (string)

params.starttime

timestamp of the first event to retrieve (string)

params.endtime

timestamp of the last event to retrieve (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains the list of eventdata.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set unit handle
params.hdl = "78/4/CF6_23447-613-22/(0:0-2805#5063, 320)"
params.starttime = "2020-01-01T01:00:00.000Z"
params.endtime = "2021-10-01T01:00:00.000Z"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:SISGETUNITHISTORICALEVENTSBYTIME(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

SISSUBSCRIBE()

SISSUBSCRIBE prepares Simatic Batch Bridge server for accepting SIS notifications. Can be called multiple times from different scripts.

Returns

The result contains error code and subscription handle.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
lib:SISCONNECT(params, credentials)
local result = lib:SISSUBSCRIBE()
local handle = result.handle
lib:SISSUBSCRIBEALLBASICEVENTS(credentials)
params = {}
-- use the handle acquired during SISSUBSCRIBE
params.hdl = handle
-- from time to time query internal buffer to get events
local events,ex = lib:SISGETEVENTS(params)
-- call this one and no more events are collected
lib:SISUNSUBSCRIBEALL()
-- at the end disconnect from SIS server
lib:SISDISCONNECT(credentials)

SISSUBSCRIBEALLBASICEVENTS(credentials)

SISSUBSCRIBEALLBASICEVENTS subscribes for all types of basic SIS events with one call.

Parameters

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
lib:SISCONNECT(params, credentials)
local result = lib:SISSUBSCRIBE()
local handle = result.handle
lib:SISSUBSCRIBEALLBASICEVENTS(credentials)
params = {}
-- use the handle acquired during SISSUBSCRIBE
params.hdl = handle
-- from time to time query internal buffer to get events
local events,ex = lib:SISGETEVENTS(params)
-- call this one and no more events are collected
lib:SISUNSUBSCRIBEALL()
-- at the end disconnect from SIS server
lib:SISDISCONNECT(credentials)

SISSUBSCRIBEEVENT(params,credentials)

SISSUBSCRIBEEVENT subscribes for a single event definitions.

Parameters

params

Table containing the following parameters.

params.hdl

an event definition handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
lib:SISCONNECT(params, credentials)
local result = lib:SISSUBSCRIBE()
local handle = result.handle
params = {}
-- set handle of the SIS event to subscribe
params.hdl = "29/4/SB6_XYZ/1-Batch"
lib:SISSUBSCRIBEEVENT(params, credentials)
params = {}
-- use the handle acquired during SISSUBSCRIBE
params.hdl = handle
-- from time to time query internal buffer to get events
local events, ex = lib:SISGETEVENTS(params)
params = {}
-- set handle of the SIS event to unsubscribe
params.hdl = "29/4/SB6_XYZ/1-Batch"
-- stop receive notifications for particular event
lib:SISUNSUBSCRIBEEVENT(params, credentials)
-- at the end disconnect from SIS server
lib:SISDISCONNECT(credentials)

SISUNSUBSCRIBE(params)

SISUNSUBSCRIBE frees handle acquired during SISSUBSCRIBE.

Parameters

params

Table containing the following parameters.

params.hdl

handle acquired during SISSUBSCRIBE (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
lib:SISCONNECT(params, credentials)
local result = lib:SISSUBSCRIBE()
local handle = result.handle
lib:SISSUBSCRIBEALLBASICEVENTS(credentials)
params = {}
-- use the handle acquired during SISSUBSCRIBE
params.hdl = handle
-- from time to time query internal buffer to get events
local events,ex = lib:SISGETEVENTS(params)
params = {}
-- use the handle acquired during SISSUBSCRIBE
params.hdl = handle
-- free handle acquired during SISSUBSCRIBE
lib:SISUNSUBSCRIBE(params)

SISUNSUBSCRIBEALL()

SISUNSUBSCRIBEALL frees all handles acquired during SISSUBSCRIBE.

Parameters

params

Table containing the following parameters.

params.hdl

handle acquired during SISSUBSCRIBE (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
lib:SISCONNECT(params, credentials)
local result = lib:SISSUBSCRIBE()
local handle = result.handle
lib:SISSUBSCRIBEALLBASICEVENTS(credentials)
params = {}
-- use the handle acquired during SISSUBSCRIBE
params.hdl = handle
-- from time to time query internal buffer to get events
local events,ex = lib:SISGETEVENTS(params)
-- free all handles acquired during SISSUBSCRIBE
lib:SISUNSUBSCRIBEALL()

SISUNSUBSCRIBEEVENT(params,credentials)

SISUNSUBSCRIBEEVENT unsubscribes for single event definitions.

Parameters

params

Table containing the following parameters.

params.hdl

an event definition handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
lib:SISCONNECT(params, credentials)
local result = lib:SISSUBSCRIBE()
local handle = result.handle
params = {}
-- set handle of the SIS event to subscribe
params.hdl = "29/4/SB6_XYZ/1-Batch"
lib:SISSUBSCRIBEEVENT(params, credentials)
params = {}
-- use the handle acquired during SISSUBSCRIBE
params.hdl = handle
-- from time to time query internal buffer to get events
local events, ex = lib:SISGETEVENTS(params)
params = {}
-- set handle of the SIS event to unsubscribe
params.hdl = "29/4/SB6_XYZ/1-Batch"
-- stop receive notifications for particular event
lib:SISUNSUBSCRIBEEVENT(params, credentials)
-- at the end disconnect from SIS server
lib:SISDISCONNECT(credentials)

SUBSCRIBE(params)

SUBSCRIBE requests notifications to be sent to the bridge application.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.autoreadvise

auto readvise flag (boolean)

params.eventid

identifier of the first event (long)

params.notifytype

list of notification types that will be ignored (array of numbers)

params.objecttype

list of object types that will be ignored (array of numbers)

Returns

The result contains error code and subscription handle.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set the list of notification types that will be ignored
params.notifytype = {lib.NotifyType.UnLock, lib.NotifyType.Lock}
-- set the list of object types that will be ignored
params.objecttype = {lib.ObjectType.SubFolder, lib.ObjectType.Material}
local credentials = {}
lib:SETCONNECTION({})
local result, exception = lib:SUBSCRIBE(params)
return (require "esi-string"):STRING({res=result,ex=exception})

UNCHAINBATCHFROMBATCH(params,credentials)

UNCHAINBATCHFROMBATCH unchains a given batch from another batch.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

batch handle (string)

params.predecessor

predecessor batch handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set successor batch handle
params.hdl = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 211)"
-- set predecessor batch handle
params.predecessor = "/64/4/BF6_24517-324-74/(0:0-2199#5632, 222)"
local credentials = {}
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:UNCHAINBATCHFROMBATCH(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

UNSUBSCRIBE(params)

UNSUBSCRIBE requests that notifications will not be saved in the buffer assigned to the handle.

Parameters

params

Table containing the following parameters.

params.handle

subscription handle (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local params = {}
-- set subscription handle (value returned from SUBSCRIBE() call)
params.handle = "CC8596BD-DF37-4F34-9EB4-0965C35FD739"
lib:SETCONNECTION({})
local result, exception = lib:UNSUBSCRIBE(params)
return (require "esi-string"):STRING({res=result,ex=exception})

UNLOCKOBJECT(params,credentials)

UNLOCKOBJECT releases the lock from a SIMATIC BATCH object.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

object handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains only error code.

Usage

local lib = require("esi-simaticbatchbridge")
local credentials = {}
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set object handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:UNLOCKOBJECT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})

UNSUBSCRIBEALL()

UNSUBSCRIBEALL requests that notifications no longer will be sent to the bridge application.

Parameters

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The result contains error code.

Usage

local lib = require("esi-simaticbatchbridge")
local credentials = {}
lib:SETCONNECTION({})
local result, exception = lib:UNSUBSCRIBEALL()
return (require "esi-string"):STRING({res=result,ex=exception})

VALIDATEOBJECT(params,credentials)

VALIDATEOBJECT validates a given recipe, library or batch.

For detailed explanation see SIMATIC BATCH COM API documentation.

Parameters

params

Table containing the following parameters.

params.projecthdl

project handle (string)

params.pcellhdl

process cell handle (string)

params.hdl

objet handle (string)

credentials

Table containing user credentials as following parameters.

credentials.username

user login (string)

credentials.usernamelong

user description (string)

credentials.password

user password (string)

credentials.domain

network domain or login host, '.' for localhost (string)

Returns

The output contains a human readable validation summary and the error and warning totals.

Usage

local lib = require("esi-simaticbatchbridge")
local credentials = {}
local params = {}
-- set project handle
params.projecthdl = "1/DeProject9"
-- set process cell handle
params.pcellhdl = "/3/3/CF6_23337-613-22/(2:0-7#22, 110)"
-- set object handle
params.hdl = "128/4/CF6_23337-613-22/(0:0-2805#5063, 320)"
credentials.username = "JOW"
credentials.usernamelong = "John Wood"
credentials.password = "MyPassword"
credentials.domain = "MyDomain"
lib:SETCONNECTION({})
local result, exception = lib:VALIDATEOBJECT(params, credentials)
return (require "esi-string"):STRING({res=result,ex=exception})