开放数字孪生接口(Open Digital Twin Interface)

ℹ️

本文档是连接外部 CAD系统的草案文档。

在设计和仿真工具之间交换数据并不总是容易的。即使我们处于工业4.0(Industrie4.0)时代,从 CAD系统到各种仿真工具的数据交换主要基于 Step。所有关于运动学(设计结构通常不是面向运动学的)、传感器和执行器的附加信息都丢失了。

开放数字孪生接口(Open Digital Twin Interface)的理念是让任何外部系统都能相对容易地在 realvirtual.io 之间发送超出设计的扩展数据。其他系统也受邀使用这个开放标准。目标是通过在 CAD系统内进行一些宏编程,可以轻松创建导出器。

开放数字孪生接口(Open Digital Twin Interface)的数据结构由一个相对简单且可读的 JSON(JSON(JavaScript Object Notation))组成,它向3D数据传输附加信息。3D数据可以设计为 JT、Step、OBJ 或 FBX。因此,从 CAD系统导出相对简单,因为通常 CAD系统已经可以编写其中一种格式。JSON(JSON(JavaScript Object Notation))中的数据引用 CAD数据中包含的元素,从而用有关驱动、运动学和传感器的附加信息来补充它们。

如果需要,可以将额外的个体属性附加到 JSON(JSON(JavaScript Object Notation))对象上,但它们的解释必须单独实现。Realvirtual.io Professional 实现了此处描述的标准。

OpenDigitalTwin接口是 ITEA 项目 AITOC(https://aitoc.eu)的成果。

这是我们的示例模型,从中生成了以下 JSON(JSON(JavaScript Object Notation))数据:

此机器人可以使用 Open Digital Twin Interface 生成和导出

为什么不是 AutomationML 或资产管理壳(Asset Administration Shell)?

您可能会反对说这正是 AutomationML资产管理壳(Asset Administration Shell) 的用途。从我们的角度,AutomationML 过于复杂,无法从 CAD系统编写导出器。XML结构非常难以理解,导出器几乎不可用,甚至从 CAD系统导出 Collada 也是极高的工作量。

另一方面,资产管理壳(Asset Administration Shell)试图用数据术语描述数字孪生的所有方面,运动学、传感器和执行器方面对于仿真环境仅起到次要作用。而且格式相对复杂。

因此,我们正在寻找一个"每个人"都可以实现的简单解决方案。不是涵盖所有内容的东西,而是简单且提供最重要内容的东西。

支持的用例

开放数字孪生接口(Open Digital Twin Interface)支持以下用例

  • 从其他系统(例如设计系统)离线(基于文件)导出3D和运动学数据
  • 与 CAD系统的"实时链接",即数据在后台传输,例如通过 TCP-IP(TCP/IP),并在场景中自动更新
  • 在 Unity编辑器模式下创建信号
  • 在仿真模式下设置信号(类似于其他 realvirtual.io 自动化接口)
  • 在仿真模式下读取信号
  • 将信号连接到对象上的组件(例如将 PLCOutputSignal 连接到 Motors 行为模型及其属性 DestinationSpeed
  • 在数字孪生模型中实例化新对象
  • 在数字孪生模型中设置组件上的属性

可选属性

许多属性是可选的,不需要传输。例如,如果您只想在 realvirtual.io 之间读写信号值,您可以创建 OpenDigitalTwin 类,在此类中您可以只设置 Signals 属性和 Signals 数组本身,而 OpenDigitalTwin 类的其他属性(partsassemblykinematicassembly 等)保持为 null。或者,如果您只想将3D数据和 Part 层次结构传输到 realvirtual.io,您可以仅实例化 Parts 类。

基本概念

分离的装配和运动学结构

CAD设计大多不是面向运动学结构的。因此,KinematicAssembly 可选地构建一个并行的运动学结构。设计结构中的每个部件可以分配给 KinematicAssembly 中的一个 Kinematic 元素。驱动和传感器可以附加到 Assembly 以及 Kinematic 结构上。

分离的装配和运动学结构

变换(Transforms)(位置和旋转)

变换包含位置和旋转,始终相对于 AssemblyKinematicAssembly 零点的全局坐标系。AssemblyKinematicAssembly 必须与导出的3D数据具有相同的原点。驱动和传感器的方向始终参照分配给它们的本地坐标系。

引用3D数据

装配结构中的每个部件可以引用导出的3D数据文件(partfilepartcomponent)中的构造元素。如果 partcomponent 为空或 null,则整个3D数据分配给装配中的 part。因此,可以一次性将所有3D数据导出,例如作为 Step,然后在装配结构中引用它们,或者每个装配级别导出一个3D文件(partfile)。

对象、组件和属性

整个数字孪生由对象的层次结构构建。每个对象可以有多个子对象。每个对象只有一个父对象。通过导入 Part Assemblies 或 Kinematic Assembly,包括层次结构在内的对象可以被导入到数字孪生中。因此,Kinematic 和 Part 都是层次结构中的对象。每个对象本身可以有多个不同的组件。组件可以是例如驱动、传感器或行为模型。组件(本身)有不同的属性,这些属性定义了组件的行为。组件的一个非常特殊的属性是 Signal。可以将信号列表中的信号与对象上的行为模型(组件)连接起来。

在模型中创建对象的另一种方法是通过基于所谓的 Prefabs 实例化新对象。Prefabs 是简单或复杂对象的蓝图。通过开放数字孪生接口(Open Digital Twin Interface),您可以在某些位置创建新对象,然后设置这些组件的属性。

许可、使用

我们以 MIT 许可证发布开放数字孪生接口(Open Digital Twin Interface)。realvirtual.io Professional 本身的导入和导出功能受 realvirtual.io 许可证条款约束。每位用户和 CAD制造商都受邀使用开放数字孪生接口(Open Digital Twin Interface)。如果您想成为官方支持者,您将免费获得用于测试和开发目的的 realvirtual.io 许可证以及来自我们的支持。如果您感兴趣,请发送邮件至

realvirtual.io 中开放数字孪生接口(Open Digital Twin Interface)的传输层

realvirtual.io 为导入和导出 OpenDigitalTwin 数据实现了三种不同的传输层。

这些层是基于文件的(JSON(JSON(JavaScript Object Notation))和 CAD数据)、TCP-IP(realvirtual.io 将作为 TCP-IP(TCP/IP)服务器)和 MQTT。所有接口将在 Unity编辑器模式和播放模式下运行。

接口目前正在开发中。更多信息即将推出。

C# 类

以下 C# 类结构可用于以 OpenDigitalTwin 格式序列化 JSON(JSON(JavaScript Object Notation)),或从 JSON(JSON(JavaScript Object Notation))转换回类结构。我们已在源代码中解释了最必要的内容,更多解释即将在此发布。


///  OpenDigitalTwin class definition version 1
///  Copyright (c) 2022 realvirtual.io - In2sight GmbH
//   MIT License
//   Permission is hereby granted, free of charge, to any person obtaining a copy of this source code, to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//   The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

namespace OpenDigitalTwin
{
    public class OpenDigitalTwin  // the frame classs, all components are optional, e.g. it is possible to import, read and write only signals without sending or receiving the other properties
    {
        public Header header;
        public Assembly assembly;
        public KinematicAssembly kinematicassembly;
        public Signals signals;
    }

    public class Assembly // The cad Assembly of parts - the structure the designer used in the cad system - very often not kinematic structured
    {
        public List<Part> parts;
    }
    
    public class Part // the part inside an Assembly which has a global position and rotation in relation to Assembly origin point, referencing to a part fild
    {
        public string id = "";
        public string partname="";
        public string occurenceid ="";
        public string partfile =""; // can be collada, jt, step, obj
        public string partcomponent =""; // can be a valid path /assembly1/subassembly/part if only a part of the partfile is a representation of the part (if just one file is exported) or keep it empty if the partfile ia a full representation of the part
        public string lastchange="";
        public string parentid="";
        public string kinematicreference=""; // optional -references this part into a structural level in the kinematics hierarchy, multiple parts can be assigned to the same kinematic reference (kinematic reference does not needs to be unique in the part structure)
        public List<string> materials; //optional - if not defined standard materials of partfile import are used
        public Transform transform;
        public Drive drive; //optional - Drive might be also attached in kinematic chain
        public Sensor sensor; //optional - Sensor might be also attached in  kinematic chain
        public string behaviormodel=""; // optional - might be used for attaching automatically for example FMUs
    }
    
    public class KinematicAssembly // a kinematic Assembly, parts can be linked to single compontents in kinematic chain
    {
        public List<Kinematic> kinematics;
    }

    public class Kinematic // a single kinematic component in the kinematic chain
    {
        public string id=""; // might be referenced by a part
        public string kinematicname = "kinematic"; // name of the structural component in the kinematic chain - is NOT unique and not referenced - just for information
        public string kinematicreference=""; // the kinematic referance of this kinematic component - needs to be unique in the kinematic chain 
        public string parentid=""; // the parent kinematic component
        public Transform transform;
        public Drive drive; // optional
        public Sensor sensor; // optional
    }

    public class Header // the header info for Assembly and kinematic Assembly  
    {
        public string reference = ""; // a reference for the digitaltwin interface 
        public int odtversion = 1; // version of odf file definition, currently 1
        public string lastchange=""; // optional
        public string cadystem=""; // optional 
        public string csys=""; // lefthanded / righthanded
    }

    public class Signals  // a list of all automation signals
    {
        public List<Signal> signals;
    }
    
    public class Transform // the global position and rotation in relation to Assembly origin point
    {
        public float posx;
        public float posy;
        public float posz;
        public float rotx;
        public float roty;
        public float rotz;
    }
    
    public class Drive // Drives can be connected to assemly hierarchy or kinematic hierarchy
    {
        public string type=""; // "linear, rotational,linearsurface,rotationsurface"
        public string direction="x"; // "x,y,z" in local coordinate system
        public float maxspeed=0; // optional
        public float maxacceleration=0; // optional
        public float lowerlimit=0; // optional
        public float upperlimit=0; // optional
        public string behaviormodel = ""; // optional e.g. for defining FMUs or realvirtual behavior models
    }
    
    public class Sensor  // a sensor which can be connected to assembly or kinematic hierarchy
    {
        public string direction = "x"; // "x,y,z" in local coordinate system
        public float length; // the length of detection, a sensor is a straight line (raycast) from the origin point of the part or kinematic transform
        public string behaviormodel = ""; // optional e.g. for defining FMUs or realvirtual behavior models
    }
    
    public class Signal  // a signal for reading and writing signals, if a signal list is send on edit mode the signals are created if not existing
    {
        public string signalname = "";   // signalname needs to be unique
        public string internalname = ""; // optional, if internalname empty than it equals signalname, for some interfaces (e.g. SiemensS7) internal name needs follow certain conditions to be a hardware adress
        public string folder = ""; // optional, if given certain hierarchy / folder path or organizing the signals
        public string direction = "input"; // input,output
        public string type = "bool";  //bool,int,float,text
        public string comment ="";
        public string value;
    }
}#

示例 JSON(JSON(JavaScript Object Notation))

这是生成的 JSON(JSON(JavaScript Object Notation))的一部分示例。

完整的 json 可在此处找到:

Open Digital Twin 示例 JSON(JSON(JavaScript Object Notation))

{% endfile %}

变更说明

16.10.2022 - 添加了用于连接(将信号连接到组件)、实例化(在特定位置创建准备好的对象)和对象属性(读写对象值)的可选类