0% found this document useful (0 votes)
72 views

AppNote Run MyVirtual Machine Open en

Uploaded by

Mickaleto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

AppNote Run MyVirtual Machine Open en

Uploaded by

Mickaleto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

Open API

Create/Run MyVirtual
Machine V1.3
Siemens
Create/Run MyVirtual Machine V1.3 / Open API Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/109817568 Support
Legal information

Legal information
Use of application examples
Application examples illustrate the solution of automation tasks through an interaction of several components in
the form of text, graphics and/or software modules. The application examples are a free service by Siemens AG
and/or a subsidiary of Siemens AG ("Siemens"). They are non-binding and make no claim to completeness or
functionality regarding configuration and equipment. The application examples merely offer help with typical
tasks; they do not constitute customer-specific solutions. You yourself are responsible for the proper and safe
operation of the products in accordance with applicable regulations and must also check the function of the
respective application example and customize it for your system.
Siemens grants you the non-exclusive, non-sublicensable and non-transferable right to have the application
examples used by technically trained personnel. Any change to the application examples is your responsibility.
Sharing the application examples with third parties or copying the application examples or excerpts thereof is
permitted only in combination with your own products. The application examples are not required to undergo the
customary tests and quality inspections of a chargeable product; they may have functional and performance
defects as well as errors. It is your responsibility to use them in such a manner that any malfunctions that may
occur do not result in property damage or injury to persons.

Disclaimer of liability
Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation, liability for
the usability, availability, completeness and freedom from defects of the application examples as well as for
related information, configuration and performance data and any damage caused thereby. This shall not apply in
cases of mandatory liability, for example under the German Product Liability Act, or in cases of intent, gross
negligence, or culpable loss of life, bodily injury or damage to health, non-compliance with a guarantee,
fraudulent non-disclosure of a defect, or culpable breach of material contractual obligations. Claims for damages
arising from a breach of material contractual obligations shall however be limited to the foreseeable damage
typical of the type of agreement, unless liability arises from intent or gross negligence or is based on loss of life,
bodily injury or damage to health. The foregoing provisions do not imply any change in the burden of proof to
ã Siemens AG Copyright year All rights reserved

your detriment. You shall indemnify Siemens against existing or future claims of third parties in this connection
except where Siemens is mandatorily liable.
By using the application examples you acknowledge that Siemens cannot be held liable for any damage beyond
the liability provisions described.

Other information
Siemens reserves the right to make changes to the application examples at any time without notice. In case of
discrepancies between the suggestions in the application examples and other Siemens publications such as
catalogs, the content of the other documentation shall have precedence.
The Siemens terms of use (https://support.industry.siemens.com) shall also apply.

Security information
Siemens provides products and solutions with industrial security functions that support the secure operation of
plants, systems, machines and networks.
In order to protect plants, systems, machines and networks against cyber threats, it is necessary to implement –
and continuously maintain – a holistic, state-of-the-art industrial security concept. Siemens’ products and
solutions constitute one element of such a concept.
Customers are responsible for preventing unauthorized access to their plants, systems, machines and networks.
Such systems, machines and components should only be connected to an enterprise network or the internet if
and to the extent such a connection is necessary and only when appropriate security measures (e.g. firewalls
and/or network segmentation) are in place.
For additional information on industrial security measures that may be implemented, please visit
https://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more secure. Siemens strongly
recommends that product updates are applied as soon as they are available and that the latest product versions
are used. Use of product versions that are no longer supported, and failure to apply the latest updates may
increase customer’s exposure to cyber threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed under
https://www.siemens.com/cert.

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 2
Table of contents

Table of contents
Legal information............................................................................................................................. 2
1 Introduction............................................................................................................................ 5
1.1 Overview .................................................................................................................. 5
1.2 Preconditions ........................................................................................................... 5
2 Basic Architecture ................................................................................................................. 6
2.1 Basic API Design Principles ..................................................................................... 7
2.2 Restrictions .............................................................................................................. 7
2.3 Comparison to SINUMERIK 840Dsl simulation systems ......................................... 8
2.3.1 SinuTrain for SINUMERIK Operate .......................................................................... 8
2.3.2 Run MyVNCK ........................................................................................................... 8
2.4 Event-based Synchronization .................................................................................. 9
2.5 Data Access ........................................................................................................... 10
3 First Step Guide ................................................................................................................... 11
3.1 Creating the first C# Project ................................................................................... 11
4 Implementation Examples .................................................................................................. 14
ã Siemens AG Copyright year All rights reserved

4.1 Getting Started ....................................................................................................... 14


4.1.1 Start Application ..................................................................................................... 14
4.1.2 Connect at Runtime ............................................................................................... 16
4.1.3 Black Box mode Forms .......................................................................................... 18
4.1.4 Black Box Mode WPF ............................................................................................ 21
4.2 Synchronized Simulation ........................................................................................ 23
4.2.1 Synchronized IPO and OB1 Events ....................................................................... 23
4.2.2 Virtual Time ............................................................................................................ 25
4.3 Axis and Channel Configuration ............................................................................. 27
4.3.1 Read Configuration ................................................................................................ 27
4.4 Program Data ......................................................................................................... 28
4.4.1 Program Stack ....................................................................................................... 28
4.5 Motion Data ............................................................................................................ 29
4.5.1 Axis Position ........................................................................................................... 29
4.5.2 New Motion Events ................................................................................................ 31
4.5.3 New Motion and Axis Positions in IPO/OB1 cycle ................................................. 32
4.5.4 LengthSlice ............................................................................................................ 33
4.5.5 AngleSlice .............................................................................................................. 35
4.5.6 OrientationSlice ...................................................................................................... 35
4.6 Domain Functions .................................................................................................. 36
4.6.1 Handle Part Programs ............................................................................................ 36
4.6.2 Part Program Explorer ........................................................................................... 38
4.6.3 Offset and Tool Data .............................................................................................. 41
4.7 PLC Data Exchange ............................................................................................... 43
4.7.1 Mini MCP Absolute ................................................................................................. 43
4.7.2 Mini MCP Symbolic ................................................................................................ 43
4.8 NCK System Variables ........................................................................................... 45
4.8.1 Read NCK Variable ................................................................................................ 45
4.9 Watch Variables ..................................................................................................... 46
4.9.1 Mini MCP Watch .................................................................................................... 46
4.10 Measuring and Drive-To-Fixed-Stop ...................................................................... 48
4.10.1 Measuring .............................................................................................................. 48
Open API for Create/Run MyVirtual Machine
Entry-ID: 109817568, V1.3, 02/2023 3
Table of contents

4.10.2 Drive-To-Fixed-Stop ............................................................................................... 49


5 Appendix .............................................................................................................................. 50
5.1 Service and support ............................................................................................... 50
5.2 Links and literature ................................................................................................. 51
5.3 Change documentation .......................................................................................... 51
ã Siemens AG Copyright year All rights reserved

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 4
1 Introduction

1 Introduction
1.1 Overview
The Open Interface of Create MyVirtual Machine allows external applications to control the
Create MyVirtual Machine system and to communicate at runtime. Possible applications of the
Open Interfaces are:
• Remote control of Create MyVirtual Machine. An external application starts, operates and
exits Create MyVirtual Machine.
• Operation of Create MyVirtual Machine in an external simulation product.
• Connecting to an external peripheral simulation.
For a selection of standard cases, you will find example applications and a brief description in
this documentation.

1.2 Preconditions
This application example has been created with the following hardware and software
components:
• Installed application Create MyVirtual Machine or Run MyVirtual Machine
ã Siemens AG Copyright year All rights reserved

• Installed CNC SW version compatible with Create MyVirtual Machine or Run MyVirtual
Machine version
• Activated FlexLM license for Create MyVirtual Machine /Operate and Create MyVirtual
Machine /Open or Run MyVirtual Machine /Operate and Run MyVirtual Machine /Open
• Example programs have been created with Microsoft Visual Studio Professional 2017
The /Open interface can be developed and tested with Create MyVirtual Machine and Run
MyVirtual Machine. In the documented examples, Create MyVirtual Machine is mentioned as a
representative of Run MyVirtual Machine.

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 5
2 Basic Architecture

2 Basic Architecture
The following picture shows the overall architecture of the Create MyVirtual Machine or Run MyVirtual
Machine product suite:

Core Components:
• Virtual CNC-SW package
ã Siemens AG Copyright year All rights reserved

• For each released SINUMERIK ONE version a matching virtual CNC-SW package is
released (major releases, service packs, hotfixes)
• Virtual CNC-SW packages can be installed side-by-side
• Major elements in a CNC-SW package are
§ simNCK: simulation version of NCK based on original code
§ PLCSimAdv: simulation version of PLC based on original code
§ simDrive: emulated DRV component based on a simplified drive model
§ Operate: HMI software based on original code
• Frontend applications
• Create MyVirtual Machine: application for machine vendors dedicated for Virtual
Commissioning of machine tools
• Run MyVirtual Machine: application for machine users dedicated for Virtual Run-In of part
programs
• xMVM Middleware (x represents both Create and Run MyVirtual Machine)
• Mediation layer between frontend applications and CNC-SW packages
• Connector to external simulation applications via /Open API
• /Open Client
• External simulation application
• Uses /Open API to communicate with xMVM Middleware component
• The /Open API provides an interface to control the xMVM software and to access simulation
relevant data
• SIMIT + /SIMIT Connector
• Optional connection to the SIMIT simulation system
• With SIMIT it is possible to simulate fieldbus devices, which are controlled by the virtual PLC

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 6
2 Basic Architecture

• TIA Portal / Create MyConfig


• Engineering applications, which are used by machine vendors
• With TIA Portal the PLC project is developed and loaded to the simulated PLC instance.
• With Create MyConfig serial machine archives can be created and loaded to the simulated
SINUMERIK ONE controller.

2.1 Basic API Design Principles

• The /Open API is provided as a standard C interface to provide flexibility for the client applications
implementation language.
• By default, a C# wrapper is delivered with the Create MyVirtual Machine or Run MyVirtual Machine
product suite, but other wrapper layers can be implemented on client’s side.
• The /Open API is available as 32bit and 64bit version to support 32/64bit simulation clients. The
Create MyVirtual Machine or Run MyVirtual Machine software however is implemented as 32bit
application.
• The /Open API is designed to provide a long-time stable interface, which is especially independent of
the simulated CNC-SW package.
• The interface functions of the /Open API are implemented as synchronous function calls.
ã Siemens AG Copyright year All rights reserved

2.2 Restrictions

• It is expected that the client application is executed in the same PC environment as the Create
MyVirtual Machine or Run MyVirtual Machine software. Extensions to communicate to other PCs
need to be implemented on client side.
• Only one client can access the Create MyVirtual Machine or Run MyVirtual Machine software via
/Open API. If more than one client requires access, this needs to be implemented on client side.

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 7
2 Basic Architecture

2.3 Comparison to SINUMERIK 840Dsl simulation systems

Together with the new SINUMERIK ONE hardware controller generation the digital twin was introduced,
which includes several aspects of modifications to the world of machine simulation:
• With each released SINUMERIK ONE software version also a virtual SINUMERIK ONE version is
released. This means for each major/minor version, service pack and hotfix a virtual SINUMERIK
ONE controller version will be available.
• The digital twin of a SINUMERIK ONE controller includes NCK, PLC, Drive and HMI software.
• The architecture of the existing 840Dsl based simulation systems Run MyVNCK and SinuTrain for
SINUMERIK Operate was reviewed, combined and innovated to serve the needs of the new
SINUMERIK ONE digital twin approach.

2.3.1 SinuTrain for SINUMERIK Operate

The successor of training system SinuTrain for SINUMERIK Operate is Run MyVirtual Machine /Operate.
Major differences are:
• Run MyVirtual Machine includes simulated PLC and drive.
• Based on the optional \Open package a connection to external simulation applications can be
ã Siemens AG Copyright year All rights reserved

established.

2.3.2 Run MyVNCK

The Create or Run MyVirtual Machine /Open API represents a similar use case as Run MyVNCK
(connectivity of 3rd party components), but uses a different way of interface.
Major differences of the simulated SINUMERIK controller are:
• Create MyVirtual Machine and Run MyVirtual Machine include simulated PLC and Drive.
• Create MyVirtual Machine and Run MyVirtual Machine include an integrated machine control panel.

Major differences of the simulation interface are:


• The /Open interface provides a version independent API to communicate with the simulated
SINUMERIK ONE controller.
• The /Open interface can be used to communicate with both Create MyVirtual Machine and Run
MyVirtual Machine.
• The /Open interface can be used to attach a simulation client to an already running Create or Run
MyVirtual Machine instance

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 8
2 Basic Architecture

2.4 Event-based Synchronization

External simulation applications can be executed synchronized with Create MyVirtual Machine or Run
MyVirtual Machine by using event-based synchronization.
There is a defined number of simulation events available in Create MyVirtual Machine or Run MyVirtual
Machine like
• OPEN_EVENT_NCK_IPO
Interpolation cycle in NCK finished
• OPEN_EVENT_PLC_OB1
OB1 cycle in PLC finished

An /Open client is able to register for one or more of the offered events using the functions
• registerForEvents
hand over a list of events the /Open client wants to register for
• unregisterEvents
unregister from all events

The synchronization itself is executed by the function calls


• waitForEvents
The call returns as soon as one or more of the registered events appeared. At that time the
ã Siemens AG Copyright year All rights reserved

simulation loop in Create MyVirtual Machine or Run MyVirtual Machine is interrupted. The /Open
client is now able to exchange data with Create MyVirtual Machine or Run MyVirtual Machine. After
data exchange the simulation loop in Create MyVirtual Machine or Run MyVirtual Machine can be
continued by calling continueSimulation.
• readNextEvent
If more than one event was registered, it is possible to iterate through the actual events by using this
function.
• continueSimulation
This call continues the simulation loop in Create MyVirtual Machine or Run MyVirtual Machine.

Attention

The duration between return of waitForEvents and call of continueSimulation has direct influence on
the overall simulation performance of Create MyVirtual Machine or Run MyVirtual Machine.
Hence this time should be kept as small as possible and be restricted to data exchange only. The
interpretation of this data (like updating a 3D simulation view or calculate collisions etc.) should be
done only after the call of continueSimulation.

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 9
2 Basic Architecture

2.5 Data Access

Create MyVirtual Machine or Run MyVirtual Machine provides a defined set of simulation relevant data at
runtime.
To access data items an access ID needs to be requested, based on which the data itself can be accessed.
The following functions are relevant:
• getDictionaryId
delivers an access ID to a specific data element (also called catalogue item)
• getDictionaryElementType
delivers the type of the catalogue item based on its access ID
• getNumArrayElements
in case of array types this functions returns the number of array elements of the catalogue item

The access to catalogue items is only allowed, if the simulation is interrupted, which means in the time
between waitForEvents has returned and continueSimulation is called (see also chapter 2.4). Only in this
state Create MyVirtual Machine or Run MyVirtual Machine can provide consistent data.

Additionally specific data packages must only be read at matching simulation interrupts. For example NCK
related data must only be read at simulation events triggered by NCK (e.g. OPEN_EVENT_NCK_IPO), PLC
related data at events triggered by the PLC (typically OPEN_EVENT_PLC_OB1).

Attention
ã Siemens AG Copyright year All rights reserved

An access ID is only valid for one simulation session.

The validity of an access ID ends,

• if the /Open client disconnects from the /Open interface


• if the SINUMERIK ONE controller is shut down or the project is closed
In these cases, the access IDs to catalogue items need to be requested again.

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 10
3 First Step Guide

3 First Step Guide


In the following examples, both Create MyVirtual Machine and Run MyVirtual Machine can be used.
Therefore, only the term Create MyVirtual Machine is used.

By selecting a startup profile, the user determines which components of the Create MyVirtual Machine
system is to be used during a session. The information is stored in a xml file.
Example startup profile:

Create MyVirtual Machine is delivered with an Open Client example. Sample startup profiles are in the
"config" directory of the Open Client example:
ã Siemens AG Copyright year All rights reserved

3.1 Creating the first C# Project

① Create a C# Project for example a "Windows Forms-App (.NET Framework)"

② Create MyVirtual Machine is delivered with the C # sample project “OpenClientSample”.

Copy the C# "OpenApiWrapper.cs" into your project.

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 11
3 First Step Guide

and add the "OpenApiWrapper.cs" to the project


ã Siemens AG Copyright year All rights reserved

③Create the project for "Debug" and "Release"

④ Copy the Open-DLLs from "OpenClientSample" into the Debug and Release directory of your project

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 12
3 First Step Guide
ã Siemens AG Copyright year All rights reserved

⑤ Add an “using” statement for the namespace of the C # wrapper.

Then the definitions and functions of the wrapper can be used

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 13
4 Implementation Examples

4 Implementation Examples

4.1 Getting Started

4.1.1 Start Application

This example demonstrates the basic functionality of the Open API interface by starting, performing simple
communication operations and closing the virtual controller Create MyVirtual Machine. To simplify the
communication and control process with Create MyVirtual Machine a predefined code package
(OpenApiWraper) will be used in the following examples. The OpenApiWraper is part of product delivery.

2
ã Siemens AG Copyright year All rights reserved

4
5

9
10

11

12

① Start Application: Windows application Create MyVirtual Machine will be executed

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 14
4 Implementation Examples

② Connect: connectivity to Create MyVirtual Machine is established

③ Select Project … : own executable project file for Create MyVirtual Machine (.vcp) can be selected from
Windows Explorer and loaded into the virtual controller. If no own projects available a Virtual Commissioning
Projects (.vcp) from the template machine can be used as shown below.

④ Open Project: The selected project file (.vcp) will opened in Create MyVirtual Machine
ã Siemens AG Copyright year All rights reserved

⑤ Boot Controller: Booting process is executed and all components of Create MyVirtual Machine (NCU,
simDrive, PLCSimAdd, HMI, etc.) will be loaded

⑥ Reset Controller: reset command in Create MyVirtual Machine is performed and all components are
reloaded

⑦ Shutdown Controller: All components of Create MyVirtual Machine are shut down

⑧ Save Project: Changes in the projects is savedin the current project file (.vcp)

⑨ Close Project: The project file is closed

⑩ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated
or

⑪ Stop Application: Create MyVirtual Machine application is closed and all related processes are terminated

⑫ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 15
4 Implementation Examples

4.1.2 Connect at Runtime

This example demonstrates the possibility to connect an external application to an already running Create
MyVirtual Machine application and get various information about the virtual controller state. Furthermore, the
virtual controller can be manipulated by an external application. The list of all available signals and
commands of the open interface can be find in opendatacatalog.h.

① Connect: connectivity to Create MyVirtual Machine is established

② The current simulation speed is acquired (read) from Create MyVirtual Machine and displayed in the
corresponding field of external application.
ã Siemens AG Copyright year All rights reserved

③ The simulation speed of Create MyVirtual Machine is adopted to 100% by external application (write)

④ The maximum simulation speed of Create MyVirtual Machine is set (write)

⑤ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 16
4 Implementation Examples

⑥ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)
ã Siemens AG Copyright year All rights reserved

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 17
4 Implementation Examples

4.1.3 Black Box mode Forms

This example demonstrates the possibility of running the Create MyVirtual Machine application in black box
mode. This means that all necessary virtual CNC processes run in the background, but the user interface is
not visible for the operator. This might be useful to exchange data with the virtual CNC and a simulation
system without having to operate the Create MyVirtual Machine application.

Information

• In following example, the main thread is blocked by booting process of the controller, which
blocks the HMI visualization. To display HMI and boot controller in parallel an asynchronous
programming must be used
• For demonstration purposes the following example is realized in VisualStudio with Forms as well
as with WPF approach
• Using the Forms approach a special app.manifest (dpiAwareness) must be used to freeze the
HMI in the appropriate Forms window. Otherwise, a part program execution within the HMI will
be opened in separate/ second window
ã Siemens AG Copyright year All rights reserved

1
2
3

4
5

7
8

9
10
11

12

① Start Application: Windows application Create MyVirtual Machine is executed in black box mode. The
user interface of Create MyVirtual Machine will not appear.

② Connect: connectivity to Create MyVirtual Machine is established

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 18
4 Implementation Examples

③ Select Project … : own executable project file for Create MyVirtual Machine (.vcp) can be selected from
Windows Explorer and loaded into the virtual controller. If no own projects available a template machine
project file (.vcp) can be used as shown below.

④ Open Project: The selected project file (.vcp) is opened in Create MyVirtual Machine
⑤ Boot Controller: Booting process is executed and all components of Create MyVirtual Machine (NCU,
simDrive, PLCSimAdd, HMI, etc.) will be loaded. For improved usability the HMI (SINUMERIK Operate)
appears in a Forms window. The application Create MyVirtual Machine remains invisible (black box mode).
ã Siemens AG Copyright year All rights reserved

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 19
4 Implementation Examples

Note

Due to the black box mode the Machine Control Panel of Create MyVirtual Machine cannot be reached with
the /Open interface. Therefore, an Emergency Stop signal which has to be acknowledged after booting the
machine cannot be performed.

⑥ Reset Controller: reset process of Create MyVirtual Machine is performed and all components are
reloaded

⑦ Shutdown Controller: All components of Create MyVirtual Machine are shut down

⑧ Save Project: Changes in the projects are saved in the selected project file (.vcp)

⑨ Close Project: The project file is closed


ã Siemens AG Copyright year All rights reserved

⑩ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

or

⑪ Stop Application: Create MyVirtual Machine application is closed and all related processes are terminated

⑫ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 20
4 Implementation Examples

4.1.4 Black Box Mode WPF

This example demonstrates the possibility of running the Create MyVirtual Machine application in black box
mode. This means that all necessary virtual CNC processes run in the background, but the user interface is
not visible for the operator. This might be useful to exchange data with the virtual CNC and a simulation
system without having to operate the Create MyVirtual Machine application.

Information

• In following example, the main thread is blocked by booting process of the controller, which
blocks the HMI visualization. To display HMI and boot controller in parallel an asynchronous
programming must be used
• For demonstration purposes the following example is realized in VisualStudio with Forms as well
as with WPF approach

1
2
3
4
5

6
ã Siemens AG Copyright year All rights reserved

7
8
9
10
11

12

① Start Application: Windows application Create MyVirtual Machine will be executed in black box mode.
The user interface of Create MyVirtual Machine will not appear.

② Connect: connectivity to Create MyVirtual Machine is established

③ Select Project … : own executable project file for Create MyVirtual Machine (.vcp) can be selected from
Windows Explorer and loaded into the virtual controller. If no own projects available a template machine
project file (.vcp) can be used as shown below.

④ Open Project: The selected project file (.vcp) will opened in Create MyVirtual Machine

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 21
4 Implementation Examples

⑤ Boot Controller: Booting process is executed and all components of Create MyVirtual Machine (NCU,
simDrive, PLCSimAdd, HMI, etc.) will be loaded. For improved usability the HMI (SINUMERIK Operate)
appears in WPF window. The application Create MyVirtual Machine remains invisible (black box mode).

Note

Due to the black box mode the Machine Control Panel of Create MyVirtual Machine cannot be reached with
ã Siemens AG Copyright year All rights reserved

the /Open interface. Therefore, an Emergency Stop signal which has to be acknowledged after booting the
machine cannot be performed.

⑥ Reset Controller: reset process of Create MyVirtual Machine is performed and all components reloaded

⑦ Shutdown Controller: All components of Create MyVirtual Machine are shut down

⑧ Save Project: Changes in the projects is saved in the selected project file (.vcp)

⑨ Close Project: The project file is closed

⑩ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated
or

⑪ Stop Application: Create MyVirtual Machine application is closedand all related processes are terminated

⑫ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 22
4 Implementation Examples

4.2 Synchronized Simulation

4.2.1 Synchronized IPO and OB1 Events

This example demonstrates the possibility to synchronize with an already running Create MyVirtual Machine
application and count the IPO and OB1 cycles.

① Connect: connectivity to Create MyVirtual Machine is established


ã Siemens AG Copyright year All rights reserved

② Synchronization with Create MyVirtual Machine is established and the counter for IPO and OB1 run from
the beginning.

In this example, four IPO cycles are run during one OB1 cycle (OB1: 16ms, IPO: 4ms)

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 23
4 Implementation Examples
ã Siemens AG Copyright year All rights reserved

③ The synchronization is stopped. Restarting the synchronization starts counting from the beginning

④ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

⑤ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 24
4 Implementation Examples

4.2.2 Virtual Time

This example demonstrates the possibility to synchronize with an already running Create MyVirtual Machine
application and to return the virtual time and wall clock time.

5
6

7
5

① Connect: connectivity to Create MyVirtual Machine is established


ã Siemens AG Copyright year All rights reserved

② Synchronization with Create MyVirtual Machine is established and the counter for IPO and OB1 run from
the beginning.

③ Interpolation cycle of the NCU running with 4ms sampling. IPO Counter: number of IPO cycles

④ OB1 cycle running 4x slower as the NCU IPO cycle with 16ms sampling. OB1 Counter: number of OB1
cycles

⑤ The virtual time describing the time a manufacturing process on a real machine would need.

⑥ Wall clock time is the time that a “clock on the wall” would show between the start and the end of the
manufacturing process.
The displayed simulation speed (197% in the screenshot) is the relation between virtual time and the wall
clock time.

• Values bigger than 100% mean, the calculation time on the simulation computer is faster than the
machining process on a real machine

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 25
4 Implementation Examples

• Values less than 100% mean, the calculation time takes longer than the machining process on a real
machine

⑦ The synchronization is stopped. Restarting the synchronization starts counting from the beginning

⑧ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

⑨ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)
ã Siemens AG Copyright year All rights reserved

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 26
4 Implementation Examples

4.3 Axis and Channel Configuration

4.3.1 Read Configuration

This example demonstrates the possibility of acquiring axes configuration of a running virtual machine in
Create MyVirtual Machine application. Following information are visualized in the Forms window:
• Axis name
• Axis type (e.g. linear, spindle, etc.)
• Channels with assigned axes

1
2
ã Siemens AG Copyright year All rights reserved

3
4

① Connect: connectivity to Create MyVirtual Machine is established

② Axes configuration of the running project in the virtual controller is acquired

③ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

④ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 27
4 Implementation Examples

4.4 Program Data

4.4.1 Program Stack

Outlook: new sample for xMVM upcoming releases


ã Siemens AG Copyright year All rights reserved

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 28
4 Implementation Examples

4.5 Motion Data


A typical task for external simulation applications is to visualize motions executed by the simulated
SINUMERIK system. Major aspects in the context of visualization are:
• Show the current shape of workpieces
• Calculate collisions between workpiece, clamping device, tool and machine components

Related to these visualization aspects are the major quality criteria like:
• Performance
• Precision

The /Open API offers different mechanisms to support external simulation systems to meet their simulation
tasks:
• Motion data based on axis positions
o With every IPO cycle a new set of axis values is accessible
o Delivers the highest reachable precision
o Lowest reachable performance
o Example see chapter 4.5.1
• Motion data based on executed NC blocks
o With every programmed NC block a set of motion information is provided
o A NC block can be a complete linear or circular movement
o The execution of such a motion might take several (even a lot of) IPO cycles
o The reachable precision is still high for begin and end of a motion, but during the motion
ã Siemens AG Copyright year All rights reserved

execution no additional information is handed over


o Reachable performance
§ Typical 2½D programs with long linear and circular motion blocks can be simulated
with very high performance
§ When simulating typical 3ax or 5ax programs with very short motion blocks the
advantage is less
o Example see chapter 4.5.2
• Motion data based on e.g. length slice information
o NC blocks with long motion distances can be split using e.g. a defined length slice
o As soon as the defined length slice value is exceeded during the execution of a motion an
event is raised
o As for the reachable precision and performance this approach is located between position
and NC block based approaches described above
o Example see chapter 4.5.3
• It is also possible to combine the offered approaches
o Chapter 0 describes a combination of motion data and axis position based simulation

4.5.1 Axis Position

This example demonstrates the synchronization of axis positions between the virtual controller in Create
MyVirtual Machine application and open example in real time.

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 29
4 Implementation Examples

① Connect: connectivity to Create MyVirtual Machine is established

② The current axis positions from the running controller are acquired in real time and displayed in Forms
window
ã Siemens AG Copyright year All rights reserved

③ Status Box: status of synchronization

④ Continuous synchronization of axis positions is terminated

⑤ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

⑥ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 30
4 Implementation Examples

4.5.2 New Motion Events

This example demonstrates the visualization of toolpaths retrieved from the virtual controller. To keep this
example simple the visualization of toolpaths is limited to two axes X and Y and is shown in a 2D diagram.

This example includes a dedicated Create MyVirtual Machine project file (.vcp).

2
3

6
ã Siemens AG Copyright year All rights reserved

① Connect: connectivity to Create MyVirtual Machine is established

② Synchronization with Create MyVirtual Machine is established

③ Each new movement (direction) for each axis is counted in “NewMotion Counter” and visualized in the
diagram as a line with different colors. Red represents G0, green G1 and blue G2/G3 motion.

④ If the "Automatically Fit View" checkbox is unchecked, the "Fit View" button can be used to scale the
sizes of all visualized toolpaths to the full size of the diagram. “Clear View” is a reset button removes all
toolpath in the diagram

⑤ The synchronization is stopped. Restarting the synchronization starts counting from the beginning

⑥ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 31
4 Implementation Examples

⑦ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)

4.5.3 New Motion and Axis Positions in IPO/OB1 cycle

This example demonstrates the visualization of toolpaths and counting the number of new motion events as
well as positions points of the toolpath in IPO cycle retrieved from the virtual controller. To keep this example
simple the visualization of toolpaths is limited to two axes X and Y and is shown in a 2D diagram.

This example includes a dedicated Create MyVirtual Machine project file (.vcp).

4
ã Siemens AG Copyright year All rights reserved

6
7
8

① Connect: connectivity to Create MyVirtual Machine is established

② Synchronization with Create MyVirtual Machine is established

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 32
4 Implementation Examples

③ If the "Automatically Fit View" checkbox is unchecked, the "Fit View" button can be used to scale the sizes of all
visualized toolpaths to the full size of the diagram. “Clear View” reset button removes all toolpath in the diagram

④ Each new movement (direction) for each axis is counted in “NewMotion Counter” and visualized in the diagram as
a line with different colors. Red represents G0, green G1 and blue G2/G3 motion.

⑤ Each new position point of the toolpath is counted in IPO cycle (“Position Points”) and visualized in the diagram as
a cross sign.

⑥ The synchronization is stopped. Restarting the synchronization starts counting from the beginning

⑦ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

⑧ Status Box: after executing the respective operation explained above, a status value for the user is returned (e.g.
“Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)
ã Siemens AG Copyright year All rights reserved

4.5.4 LengthSlice

This example demonstrates the visualization of toolpaths and counting the number of new motion events as
well as position points of the toolpath based on the set length retrieved from the virtual controller. The
LengthSlice event captures the position points based on the selected length in mm. One position point within
the selected length is retrieved from Create MyVirtual Machine. If the selected length is too long, the contour
accuracy may be insufficient and the length must be reduced. If the length is too short, it can affect
simulation performance because too much information is retrieved. An approximation to a balanced value is
required.
Open API for Create/Run MyVirtual Machine
Entry-ID: 109817568, V1.3, 02/2023 33
4 Implementation Examples

To keep this example simple the visualization of toolpaths is limited to two axes X and Y and is shown in a
2D diagram.

This example includes a Create MyVirtual Machine project file (.vcp).

7
8

9
ã Siemens AG Copyright year All rights reserved

① Connect: connectivity to Create MyVirtual Machine is established

② Synchronization with Create MyVirtual Machine is established

③ If the "Automatically Fit View" checkbox is unchecked, the "Fit View" button can be used to scale the sizes of all
visualized toolpaths to the full size of the diagram. “Clear View” reset button removes all toolpath in the diagram

④ Each new movement (direction) for each axis is counted in “NewMotion Counter” and visualized in the diagram as
a line with different colors. Red represents G0, green G1 and blue G2/G3 motion.

⑤ Each new position point of the toolpath is counted in IPO cycle (“Position Points”) and visualized in the diagram as
a cross sign.

⑥ The LengthSlice value can be selected and acknowledged by OK button. The length represents the distance (mm)
of one position point retrieved from Create MyVirtual Machine.

⑦ The synchronization is stopped. Restarting the synchronization starts counting from the beginning

⑧ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated
Open API for Create/Run MyVirtual Machine
Entry-ID: 109817568, V1.3, 02/2023 34
4 Implementation Examples

⑨ Status Box: after executing the respective operation explained above, a status value for the user is returned (e.g.
“Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)

4.5.5 AngleSlice

Outlook: new sample for xMVM upcoming releases

4.5.6 OrientationSlice

Outlook: new sample for xMVM upcoming releases


ã Siemens AG Copyright year All rights reserved

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 35
4 Implementation Examples

4.6 Domain Functions

4.6.1 Handle Part Programs

The example demonstrates the transfer of a part program from the local hard disk to the NC file system of
Create MyVirtual Machine and the selection of the part program for processing.

Information

Domain Path
A domain path is structured as follows:
DomainPath = DomainTag, [Separator, Path];
Path = {FolderPath}, Name;
FolderPfad = Name, Separator;
DomainTag = „<“, DomainName, „>“;
Separator = „/“ | „\“;
The following domains are accessible via the Open interface:
ã Siemens AG Copyright year All rights reserved

Domain-Name Description
CF CF card directory
MPF NC-Partprograms
SPF NC-Subprograms
WKS NC-Workpieces
NC NC active file system
The CF card directory is a normal Windows directory that can be accessed with normal Windows functions.
Examples of partial paths and how they are interpreted by the Open Interface:
• „<MPF>/ABC.MPF“ := „_N_MPF_DIR/_N_ABC_MPF“
• „<MPF>\SUB\DEF.MPF“ := „_N_MPF_DIR/_N_SUB_DIR/_N_DEF_MPF“
• „<SPF>\SUB“ := „_N_SPF_DIR/_N_SUB_DIR“

① Connect: connectivity to Create MyVirtual Machine is established

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 36
4 Implementation Examples

② Select…: select a part program from the local hard drive

③ Target Folder: select a target in the NC file system of Create MyVirtual Machine
ã Siemens AG Copyright year All rights reserved

④ Download Program: The part program is transferred from the local hard disk to the NC file system

⑤ Channel Name: A valid NC channel name must be specified to select the part program.

⑥ Select Program: Select the part program for processing in Create MyVirtual Machine

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 37
4 Implementation Examples

⑦ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

⑧ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)
ã Siemens AG Copyright year All rights reserved

4.6.2 Part Program Explorer

The example demonstrates reading the content of NC directories and displays them in a tree structure.
The content of the directory is supplied by Create MyVirtual Machine in an XML file.

Information

The example uses the "listDirectory" method of the /Open Interface:


listDirectory(ListDir, FilePath)
Writes the directory content of “ListDir” to a XML file
ListDir – must be a domain path
– the directory must exist
FilePath – must be a local path
– the file must not exist
Example:
listDirectory(„<WKS>“, „C:\users\..\ListDirectoryContent.xml“)

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 38
4 Implementation Examples

Returns the following XML file

1
ã Siemens AG Copyright year All rights reserved

① Connect: connectivity to Create MyVirtual Machine is established

② TreeView: Deletes an existing tree and creates a new tree consisting only of the root directories.

③ In this area, the content of the NC directories is displayed in a tree structure.

“+” expands the subtree


“-“ collapses the subtree

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 39
4 Implementation Examples

④ Shows the structure of the listDirectory method

⑤ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

⑥ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)
ã Siemens AG Copyright year All rights reserved

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 40
4 Implementation Examples

4.6.3 Offset and Tool Data

The example demonstrates the reading and writing of zero points offsets and tool data. Reading and writing
is done via files that contain the data in $ notation.
This example includes a dedicated Create MyVirtual Machine project file (.vcp) and one file each with work
offsets, tool data and magazine data.

Information

The example uses the "GetFile" and “PutFile” method of the /Open Interface:
GetFile(DomainName, TargetFile)
PutFile(SourceFile, DomainName)

Structure of DomainName: <NC>/Area.DataBlock


Possible Areas:
Area Description
initial all
complete all
nc nc global-specific
ch, ch<C> channel-specific, channel<C>-specific
ax, ax<A> axis-specific, axis<A>-specific
to, to<T> tool-specific, tool area<T>-specific
ã Siemens AG Copyright year All rights reserved

Possible DataBlocks:
DataBlock Description
ini all Data
tea machine data
sea setting data
opt option data
gud user data
gd<G> user data gud<G>
toa tool data
tma magazine data
pro protection areas
rpa R parameter
ufr zero point offsets
cec interpolated compensation data
qec quadrant error compensation data
eec lead screw compensation data

Examples of DomainNames:
• „<NC>/ch1.tea“ := channel 1 machine data
• „<NC>/to.toa“ := all tool data
• „<NC>/ch1.rpa“ := channel 1 R parameter
• „<NC>/nc.ufr“ := all nc global zero point offsets

Note

Whether all data or only the non-standard data is read depends on:
MD11210 UPLOAD_MD_CHANGES_ONLY
MD11212 UPLOAD_CHANGES_ONLY

Note

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 41
4 Implementation Examples

The accessibility to the data stored in uploaded/downloaded files depends on their individual access levels
and the activated access level within Create MyVirtual Machine.

4 5

① Connect: connectivity to Create MyVirtual Machine is established

② The data type can be selected in the combo box. The associated domain name is displayed in the output
field on the right.
ã Siemens AG Copyright year All rights reserved

③ Read Data Item: The values corresponding to the selected data type are read using the GetFile method.
The content of the file is displayed in the text field.

④ Write Data Item: The content of the text field is saved in a file. The file is transferred to Create MyVirtual
Machine with the selected data type via the PutFile method.

⑤ The text field shows the data read or the data to be written.

⑥ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

⑦ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 42
4 Implementation Examples

4.7 PLC Data Exchange

4.7.1 Mini MCP Absolute

The following example shows some selected functionalities of a Machine Control Panel (MCP) and thus
represents a "mini" MCP. The example retrieves the absolute addresses of the virtual PLC.

Note

PLC allows different types of programming, with absolute or symbolic addresses of inputs and outputs. With
absolute addressing, the address (e.g. input E 1.0) is specified directly. In this case no symbol table is
required.
With symbolic addressing, symbols (e.g. "Output_on") are used instead of absolute addresses. The
availability of symbols depends on the actual PLC project (specific to the programming style of the machine
vendor). The symbols for inputs and outputs are stored in the symbol table.

1
ã Siemens AG Copyright year All rights reserved

① Connect: connectivity to Create MyVirtual Machine is established

② Synchronization with Create MyVirtual Machine is established

③ In the IPO cycle, the PLC signals (absolute addresses) are retrieved from the virtual controller and in this
example display the operating mode that the user has selected on the machine control panel (JOG, MDA,
AUTO)

④ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

⑤ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)

4.7.2 Mini MCP Symbolic

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 43
4 Implementation Examples

The following example shows some selected functionalities of a Machine Control Panel (MCP) and thus
represents a "mini" MCP. The example retrieves the symbolic addresses of the virtual PLC.

Note

PLC allows different types of programming, with absolute or symbolic addresses of inputs and outputs. With
absolute addressing, the address (e.g. input E 1.0) is specified directly. In this case no symbol table is
required.
With symbolic addressing, symbols (e.g. "Output_on") are used instead of absolute addresses. The
availability of symbols depends on the actual PLC project (specific to the programming style of the machine
vendor). The symbols for inputs and outputs are stored in the symbol table.

5
ã Siemens AG Copyright year All rights reserved

① Connect: connectivity to Create MyVirtual Machine is established

② Synchronization with Create MyVirtual Machine is established

③ In the IPO cycle, the PLC signals (symbolic addresses) are retrieved from the virtual controller and in this
example display the operating mode that the user has selected on the machine control panel (JOG, MDA,
AUTO)

④ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

⑤ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 44
4 Implementation Examples

4.8 NCK System Variables


4.8.1 Read NCK Variable

This example demonstrates how to read NCK variables from Create MyVirtual Machine.

4
5

① Connect: connectivity to Create MyVirtual Machine is established

② Input field for desired NCK variable

③ The value of the entered NCK variable is returned

④ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated
ã Siemens AG Copyright year All rights reserved

⑤ Status Box: after executing the respective operation explained above, a status value for the user is returned (e.g.
“Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)

2 3

2
3

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 45
4 Implementation Examples

4.9 Watch Variables


4.9.1 Mini MCP Watch

The following example shows some selected functionalities of a Machine Control Panel (MCP) and thus
represents a "mini" MCP. The example retrieves the absolute addresses of the virtual PLC. Other than in
example Mini MCP Absolute the LED output of the PLC is not polled, but watch events are used to update
the LEDs of the MCP.

Note

PLC allows different types of programming, with absolute or symbolic addresses of inputs and outputs. With
absolute addressing, the address (e.g. input E 1.0) is specified directly. In this case no symbol table is
required.
With symbolic addressing, symbols (e.g. "Output_on") are used instead of absolute addresses. The
availability of symbols depends on the actual PLC project (specific to the programming style of the machine
vendor). The symbols for inputs and outputs are stored in the symbol table.

1
ã Siemens AG Copyright year All rights reserved

① Connect: connectivity to Create MyVirtual Machine is established

② Synchronization with Create MyVirtual Machine is established

③ The PLC signals (absolute addresses) are retrieved from the virtual controller instantly (no waiting for a
cycle) and in this example display the operating mode that the user has selected on the machine control
panel (JOG, MDA, AUTO)

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 46
4 Implementation Examples

④ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

⑤ Status Box: after executing the respective operation explained above, a status value for the user is
returned (e.g. “Start Application: Ok”, “Save Project returned: ErrorNoConnection”, etc.)
ã Siemens AG Copyright year All rights reserved

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 47
4 Implementation Examples

4.10 Measuring and Drive-To-Fixed-Stop

4.10.1 Measuring

This example demonstrates how to retrieve the measuring signals and trigger the touch point of a probe tool
in Create MyVirtual Machine.

This example includes a dedicted Create MyVirtual Machine project file (.vcp).

1
2

3 4

5
6
ã Siemens AG Copyright year All rights reserved

① Connect: connectivity to Create MyVirtual Machine is established

② Synchronization with Create MyVirtual Machine is established

③ The visual element displays the state of the probe tool. active means a measuring NC block was programmed and
feedback from the probing tool is expected.

④ The checkbox simulates a touch of the probe tool and transmits the signal to Create MyVirtual Machine

⑤ The synchronization is stopped. Restarting the synchronization starts counting from the beginning

⑥ Disconnect: Connectivity of the open interface and Create MyVirtual Machine is terminated

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 48
4 Implementation Examples

4.10.2 Drive-To-Fixed-Stop

Outlook: new sample for xMVM upcoming releases


ã Siemens AG Copyright year All rights reserved

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 49
5 Appendix

5 Appendix
5.1 Service and support
Industry Online Support
Do you have any questions or need assistance?
Siemens Industry Online Support offers round the clock access to our entire service and support
know-how and portfolio.
The Industry Online Support is the central address for information about our products, solutions
and services.
Product information, manuals, downloads, FAQs, application examples and videos – all
information is accessible with just a few mouse clicks:
support.industry.siemens.com

Technical Support
The Technical Support of Siemens Industry provides you fast and competent support regarding
all technical queries with numerous tailor-made offers
– ranging from basic support to individual support contracts. Please send queries to Technical
Support via Web form:
ã Siemens AG Copyright year All rights reserved

siemens.com/SupportRequest

SITRAIN – Digital Industry Academy


We support you with our globally available training courses for industry with practical
experience, innovative learning methods and a concept that’s tailored to the customer’s specific
needs.
For more information on our offered trainings and courses, as well as their locations and dates,
refer to our web page:
siemens.com/sitrain

Service offer
Our range of services includes the following:
• Plant data services
• Spare parts services
• Repair services
• On-site and maintenance services
• Retrofitting and modernization services
• Service programs and contracts
You can find detailed information on our range of services in the service catalog web page:
support.industry.siemens.com/cs/sc

Industry Online Support app


You will receive optimum support wherever you are with the "Siemens Industry Online Support"
app. The app is available for iOS and Android:
support.industry.siemens.com/cs/ww/en/sc/2067

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 50
5 Appendix

5.2 Links and literature


Table 5-1
Nr. Thema
\1\ Siemens Industry Online Support
https://support.industry.siemens.com
\2\ Link to this entry page of this application example
https://support.industry.siemens.com/cs/ww/en/view/109817568
\3\

5.3 Change documentation


Table 5-2
Version Date Modifications
V1.3 02/2023 First version
ã Siemens AG Copyright year All rights reserved

Open API for Create/Run MyVirtual Machine


Entry-ID: 109817568, V1.3, 02/2023 51

You might also like