-
Notifications
You must be signed in to change notification settings - Fork 7
services
Josef edited this page Apr 24, 2023
·
7 revisions
These code examples explain the application of services from the AMLEngine. The topic contains the following examples:
using Aml.Engine.CAEX;
using Aml.Engine.Services;
using Aml.Engine.AmlObjects;
// Create a new document.
var document = CAEXDocument.New_CAEXDocument ();
// Add the standard AutomationML InterfaceClass library to this document.
AutomationMLInterfaceClassLibType.InterfaceClassLib(document);
// Locate a specific interface class from that library using the default query service.
var interfaceClass = document.FindByPath (AutomationMLInterfaceClassLib.InterlockingVariableInterface);
// Use the Lookup service, which is an alternative query service, for the same query
LookupService.Register();
// After registration of the Lookup service, all queries are automatically
// transferred to the Lookup service.
// There is no need to change any method calls. The Lookup service performs faster but needs additional
// memory space to maintain the lookup tables. The tables are updated automatically, whenever the content
// of the document changes.
var interfaceClass = document.FindByPath (AutomationMLInterfaceClassLib.InterlockingVariableInterface);
Reference
Schema Transformation are performed using a service that allows to upgrade an AutomationML document, which is based on the CAEX Schema version 2.15 to version 3.0. A downgrade from CAEX version 3.0 to version 2.15 is also possible. Upgrades are performed without losing any information whereas a downgrade cannot always take place without loss of information.
using Aml.Engine.CAEX;
using Aml.Engine.Services;
// load your AML file based on AutomationML 2.0 and CAEX 2.15
var document = CAEXDocument.LoadFromFile ("myAutomationML20.aml", true);
// register the transformation service. After registration of the service, the AMLEngine
// communicates with the transformation service via event notification.
var transformer = CAEXSchemaTransformer.Register();
// transform the document to AutomationML 2.10 and CAEX 3.0
var newDocV3 = transformer.TransformTo(document, CAEXDocument.CAEXSchema.CAEX3_0);
// unregister the transformation service. The communication channel between the AMLEngine and
// the transformation service is closed.
CAEXSchemaTransformer.UnRegister();
// validate the document according to the assigned CAEX version
if (newDocV3.Validate (out var message))
Console.Writeline ("Transformation success!");
else
Console.Writeline ("Transformation failed! See the returned message for details.");
Reference
Home | Installation | API | Solutions
Getting Started
- Install
- First Steps with CAEX
- Working with CAEX Libraries
- Working with CAEX Relations
- Managing Inheritance
- Attribut Values
- Document Versions
Extended Examples
API Reference Guide