This template creates ST code that provides symbolic access to all technology objects of your TIA Portal project incl. interfaces for OOP (e.g. itfSpeedAxis) if you are using the Siemens.Simatic.S71500.MotionControl library.
Expand to view the motioncontrol template and the resulting ST code
**Example:** Imagine your TIA Portal project contains three technology objects:  Then the import would result in code similar to ...NAMESPACE TiaProject.Motioncontrol_TIAX
CLASS PLC_1
VAR PUBLIC
SpeedAxis_1 : itfSpeedAxis;
PositioningAxis_1 : itfPosAxis;
SynchronousAxis_1 : itfSyncAxisAdvanced;
END_VAR
METHOD PUBLIC Initialize : Bool
...
END_METHOD
END_CLASS
END_NAMESPACE
USING Siemens.Simatic.S71500.MotionControl;
USING TiaProject.Motioncontrol_TIAX; // import generated namespace
CLASS MyMotionApplication
VAR
plc_1_tos : PLC_1; // instantiate generated class containing TOs
END_VAR
METHOD Setup : BOOL
Setup := plc_1_tos.Initialize(); // attach all TOs
END_METHOD
METHOD ActivateAxes
// access TOs
plc_1_tos.SpeedAxis_1.PowerOn();
plc_1_tos.PositioningAxis_1.PowerOn();
plc_1_tos.SynchronousAxis_1.PowerOn();
END_METHOD
END_CLASS
{{#partials}}
TO_SpeedAxis : SpeedAxis
TO_PositioningAxis : PosAxis
TO_SynchronousAxis : SyncAxis{{#IsTechnologyCPU}}Advanced{{/IsTechnologyCPU}}
TO_Cam : Cam
TO_Cam_10k : Cam
TO_ExternalEncoder : ExtEncoder
TO_SpeedAxis+ref : SpeedAxis
TO_PositioningAxis+ref : PositioningAxis
TO_SynchronousAxis+ref : SynchronousAxis
TO_ExternalEncoder+ref : ExternalEncoder
TO_OutputCam+ref : OutputCam
TO_CamTrack+ref : CamTrack
TO_MeasuringInput+ref : MeasuringInput
TO_Cam+ref : Cam
TO_Cam_10k+ref : Cam_10k
TO_Kinematics+ref : Kinematics
TO_LeadingAxisProxy+ref : LeadingAxisProxy
TO_Interpreter+ref : Interpreter
TO_SpeedAxis+itf : itfSpeedAxis
TO_PositioningAxis+itf : itfPosAxis
TO_SynchronousAxis+itf : itfSyncAxis{{#IsTechnologyCPU}}Advanced{{/IsTechnologyCPU}}
TO_Cam+itf : itfCamBase
TO_Cam_10k+itf : itfCamBase
TO_ExternalEncoder+itf : itfExtEncoder
// prepend underscore if the name do not already start with a underscore.
PrivateName: {{^Name.IsMatch(^_)}}_{{/Name.IsMatch(^_)}}{{Name}}
{{/partials}}
USING Siemens.Simatic.S71500.MotionControl;
USING Siemens.Simatic.S71500.MotionControl.Native;
NAMESPACE TiaProject.{{Name}}
{{#PLCs}}
{{#Is1500}}
/// {{Name}}
/// {{TypeName}}
/// OrderNumber:{{OrderNumber}}
/// FwVersion:{{FirmwareVersion}}
/// Author: {{Author}}
/// InstallationDate: {{InstallationDate}}
CLASS {{Name}}
{{#Software.TechnologicalObjectGroup}}
VAR PRIVATE
// DB Numbers
{{#AllTechnologicalObjects}}
{{>PrivateName}}DbNumber : DB_ANY := UINT#{{Number}};
{{/AllTechnologicalObjects}}
// Instances to attach
{{#AllTechnologicalObjects.OfType(TO_SpeedAxis|TO_PositioningAxis|TO_SynchronousAxis|TO_Cam|TO_Cam_10k|TO_ExternalEncoder)}}
{{>PrivateName}}Instance : {{>*Type}};
{{/AllTechnologicalObjects.OfType(TO_SpeedAxis|TO_PositioningAxis|TO_SynchronousAxis|TO_Cam|TO_Cam_10k|TO_ExternalEncoder)}}
END_VAR
VAR PUBLIC
// Initialize state
IsInitialized : BOOL;
// References
{{#AllTechnologicalObjects}}
{{Name}}Reference : REF_TO {{Type}};
{{/AllTechnologicalObjects}}
// Interfaces
{{#AllTechnologicalObjects.OfType(TO_SpeedAxis|TO_PositioningAxis|TO_SynchronousAxis|TO_Cam|TO_Cam_10k|TO_ExternalEncoder)}}
{{Name}} : {{>*Type+itf}};
{{/AllTechnologicalObjects.OfType(TO_SpeedAxis|TO_PositioningAxis|TO_SynchronousAxis|TO_Cam|TO_Cam_10k|TO_ExternalEncoder)}}
END_VAR
/// To initialize all technological objects it must be called once.
/// After initialization they can be used via reference or interface.
/// Returns TRUE if initialization of all objects and references is completed successfully. Otherwise FALSE.
/// The state of initialization can also be checked later by the tag "IsInitialized".
METHOD PUBLIC Initialize : BOOL
// Check state of initialization
IF NOT IsInitialized THEN
// Initialize references
{{#AllTechnologicalObjects.ExceptType(TO_InterpreterMapping|TO_InterpreterProgram)}}
{{Name}}Reference := As{{>*Type+ref}}Ref({{>PrivateName}}DbNumber);
{{/AllTechnologicalObjects.ExceptType(TO_InterpreterMapping|TO_InterpreterProgram)}}
IF (TRUE {{#AllTechnologicalObjects.ExceptType(TO_InterpreterMapping|TO_InterpreterProgram)}}
AND NOT ({{Name}}Reference = NULL){{/AllTechnologicalObjects.ExceptType(TO_InterpreterMapping|TO_InterpreterProgram)}}
{{#AllTechnologicalObjects.OfType(TO_SpeedAxis|TO_PositioningAxis|TO_SynchronousAxis|TO_Cam|TO_Cam_10k|TO_ExternalEncoder)}}AND {{>PrivateName}}Instance.Attach({{>PrivateName}}DbNumber)
{{/AllTechnologicalObjects.OfType(TO_SpeedAxis|TO_PositioningAxis|TO_SynchronousAxis|TO_Cam|TO_Cam_10k|TO_ExternalEncoder)}})
THEN
{{#AllTechnologicalObjects.OfType(TO_SpeedAxis|TO_PositioningAxis|TO_SynchronousAxis|TO_Cam|TO_Cam_10k|TO_ExternalEncoder)}}
{{Name}} := {{>PrivateName}}Instance;
{{/AllTechnologicalObjects.OfType(TO_SpeedAxis|TO_PositioningAxis|TO_SynchronousAxis|TO_Cam|TO_Cam_10k|TO_ExternalEncoder)}}
IsInitialized := TRUE;
ELSE
IsInitialized := FALSE;
END_IF;
ELSE
Initialize := IsInitialized;
END_IF;
END_METHOD
END_CLASS
{{/Software.TechnologicalObjectGroup}}
{{/Is1500}}
{{/PLCs}}
END_NAMESPACE