Skip to content

intersystems-dach/MTConnect-ObjectScript

Repository files navigation


OwnObjectScriptExtensionLogo

MTConnect-ObjectScript

An InterSystems ObjectScript implementation, thats builds an ObjectScript Class based on a MTConnect probe file and adds data from a current file.



Installation

Installation via InterSystems Package Manager

zpm "install mtconnect-objectscript"

  • probe: Holds the data from the probe file.
  • probeFromFile: When enabled the probe property contains an absolute path to the probe file. When disabled the probe property contains the probe file as a string.
  • current: Holds the data from the current file.
  • currentToFile: When enabled the current property contains an absolute path to the current file. When disabled the current property contains the current file as a string.
  • recievedLine(optional): Holds a received string. (Used for cleardata)
  • className(will be set): The complete class name of the generated class.

A Business Operation, that builts an ObjectScript class based on a MTConnect probe file. After the class is successfully generated, the operation inserts data from a MTConnect current file.

Request

MTConnect.MSG.MTConnectRequest

Response

MTConnect.MSG.MTConnectResponse

Settings

MTConnect

  • PackageName: The package where the class will be generated in.
  • suffixClass: A suffix for the class name.
  • Kind: ID or Name. Sets from which attributes the class will be build.
  • ClearData: When enabled deletes all data, when a ***CL*** message is received.
  • SuperClasses: Define comma seperated superclasses for the class.

MTConnectDataTypes

  • GenerateDataTypes: When enabled the MTConnect Datatypes will be generated automatically.
  • DataTypesPackage: The package where the MTConnect datatypes exists or will be generated in.
  • GenerateIsValid: When enabled generates a IsValid Method for the datatypes
  • GenerateNormalize: When enabled generates a Normalize Method for the datatypes
  • GenerateLogicalToDisplay: When enabled generates a LogicalToDisplay Method for the datatypes
  • GenerateDisplayToLogical: When enabled generates a DisplayToLogical Method for the datatypes

LOG

  • Log: When enabled all changes will be written to a log file.
  • LogFile: An absolute path to the log file.

  • Name: The name of the datatype.
  • Unit: The unit to display the datatype with.
  • DataType: The underlying ObjectScript type (Currently only works with %String, %Integer and %Double).
  • AllowedStringValues: Comma separated list for the allowed values. If left empty all values will be allowed. (only used when DataType is %String)
  • AllowedNumericMaxValue: The maximum value that is allowed. If left empty all values will be allowed. (only used when DataType is %Double or %Integer)
  • AllowedNumericMinValue: The minimum value that is allowed. If left empty all values will be allowed. (only used when DataType is %Double or %Integer)

Builds MTConnect Datatypes based on a MTConnect.MSG.CreateDataTypeRequest.

Execute Method

  • pRequest: The MTConnect.MSG.CreateDataTypeRequest
  • pPackage: The package name to store the datatypes (Default is MTConnect.DataTypes)
  • pGenerateIsValid: If enabled generates the IsValid method for the datatype (enabled by default)
  • pGenerateNormalize: If enabled generates the Normalize method for the datatype (enabled by default)
  • pGenerateDisplayToLogical: If enabled generates the DisplayToLogical method for the datatype (enabled by default)
  • pGenerateLogicalToDisplay: If enabled generates the LogicalToDisplay method for the datatype (enabled by default)

A Business Operation to build MTConnect Datatypes based on a MTConnect.MSG.CreateDataTypeRequest.

Request

MTConnect.MSG.CreateDataTypeRequest

Response

Ens.StringResponse

Settings

DataType

  • Package: The package name to store the datatypes (Default is MTConnect.DataTypes)
  • IsValid: If enabled generates the IsValid method for the datatype
  • Normalize: If enabled generates the Normalize method for the datatype
  • DisplayToLogical: If enabled generates the DisplayToLogical method for the datatype
  • LogicalToDisplay: If enabled generates the LogicalToDisplay method for the datatype

Tip: Hava a look at MTConnect.DataTypes for some default MTConnect DataTypes.


A simple Production to show the usage of the DataTypesBuilder Operation and the ClassBuilder Operation.

How to open and start the Production:

  • In the InterSystems Management Portal navigate to Interoperabilty > Configure > Production > Go
  • Click on Production Settings
  • Navigate to Actions > Open
  • Choose MTConnect > ExampleProduction > Production > Go
  • Click on Start

DataTypes

An example for how to use the DataTypesBuilder Operation to create MTConnect DataTypes.

  • From the category dropdown menu choose DataTypes
  • Choose the DataTypes Process
  • Navigate to Actions > Test
  • From the Request Type dropdown menu choose Ens.StringRequest
    • Type in the StringValue field String to generate a String MTConnect DataType OR
    • Type in the StringValue field Double to generate a Double MTConnect DataType OR
    • Type in the StringValue field Inetger to generate a Integer MTConnect DataType
  • Click on Invoke Testing Service
  • You can follow the Visual Trace to see how the DataType was created
  • You will find the DataTypes under MTConnect.ExampleProduction.DataTypes

resources/ExampleProductionDataTypesDemo

Class Builder

An example for how to use the ClassBuilder Operation to create MTConnect Class from a MTConnect Probe and Current file.

  • From the category dropdown menu choose Class Builder
  • Choose the Class Builder Process
  • Navigate to Actions > Test
  • From the Request Type dropdown menu choose Ens.Request
  • Click on Invoke Testing Service
  • You can follow the Visual Trace to see how the MTConnect Class was created
  • You will find the MTConnect Class under MTConnect.ExampleProduction.BuiltClasses
  • The Operation will also generate MTConnect DataTypes based on the files. You can find them under MTConnect.ExampleProduction.DataTypes

resources/ExampleProductionClassBuilderDemo


Bugs

  • no known bugs

DOCKER Support

Prerequisites

Make sure you have git and Docker desktop installed.

Installation

Clone/git pull the repo into any local directory

$ git clone https://github.com/intersystems-dach/MTConnect-ObjectScript.git   

Open the terminal in this directory and run:

$ docker-compose build

Run IRIS container with your project:

$ docker-compose up -d

Test from docker console

$ docker-compose exec iris1 iris session iris
USER>

or using WebTerminal

http://localhost:42773/terminal/


View on InterSystems Open Exchange.

View the related article on InterSystems Developer Community.


by Jannis S. & Philipp B.