精华内容
下载资源
问答
  • ThingWorx
    千次阅读
    2021-01-06 10:41:14

    ThingWorx是快速的,基于模型的应用程序开发平台。通过采用建模而非编码,内容开发人员能够专注于敏捷性和应用程序组合,而非调试、维护和更新代码。模型构建成为一组可重用的构建块来汇编新的应用程序。

    在建立完模型之后,可以通过拖放混搭构建器将模型的数据、服务和功能汇入Web应用程序中。


    1. IoT编程

    编程规则和事务逻辑

    在物联网(IoT)中,规则和事务逻辑的编程不同于使用SQL和数据库查询的传统过程编程模型/程序从头到尾遍历代码,同时将逻辑控制转移到应用程序的其他部分。所设计的系统可支持如下过程:

    1. 将数据存储到数据库中;
    2. 每晚针对新数据运行查询并应用事务逻辑;
    3. 将批处理操作的输出转储到数据库中;
    4. 运行记录所发生状况的报告

    此过程并不适用IoT。“存储再查询”方法不够灵活且及时性差。您必须对事件做出实时反应。


    分析需要

    当将分析引擎用于IoT解决方案时,不仅可以获得历史日志,还可以更具历史记录介绍的模型对未来进行预测。

    事务模型将资产上下文添加到分析中,其允许使用者根据模型中定义的设备类型来训练分析引擎。它提供了一个语义界面,可根据近实时数据分析生成资产警报或问题。


    以事物为中心的语义层

    ThingWorx在其模型中提供了一个语义层,但这并不意味着要以传统的编程方式对其进行使用。您需要考虑您事物和您的解决方案所需要的事物的特征。通过使用面向对象的ThingWorx模型,您可以将常用功能分解为更高级别的对象,将事物逻辑和功能封装在基本对象中,并在您的数字事物中继承这些基本对象。此过程创建了一个语义层(可帮助最终用户通过常见术语(如产品、客户或收入)自主访问数据的数据事物表示),从而允许您提出问题,如“Thing123,您最近两个小时的温度和位置历史记录是什么?”


    可视化应用程序构建器

    可视化应用程序构建器为使用以事物为中心的语义模型的结果提供了最终部分,并可用于快速应用程序开发。市场上有多种类型的用户界面 (UI) 呈现器。为了最大限度地提高构建 IoT 解决方案的速度和灵活性,您必须使用能够理解数据模型语义层并随数据模型的变化而随时调整的解决方案。

    要快速利用模型的强大功能,您可以使用 ThingWorx Mashup Builder,为 Edge、云和事物模型提供层。其提供了专为 IoT 设计的可预先连接到事物模型的可视化小组件。通过 ThingWorx Mashup Builder,您可以使用拖放来创建用户界面页面而无需编码。快速应用程序开发 (RAD) 环境允许您更加快速地在用户界面上进行迭代。ThingWorx Platform 的独特价值在于其使用 属性服务事件的语义层快速直观地为桌面和移动设备创建现代应用程序。ThingWorx 的强大功能使您能够处理数十亿台连接设备所需的数亿个应用程序。


    1.1 以事物为中心的查询方法与传统查询方法

    在关系数据库中,物理资产记录在表格中。该表具有多个子表,其中包含关于资产的不同数据和可用于返回到资产表的外关键字。可以有多个层次的层次结构和关系。应用程序开发人员可针对数据库构建查询,使用标准 SQL 语法和各种 JOIN 和 WHERE 子句提问。

    然后,您可以编写代码来处理来自查询的结果集。重复此过程便可构建属于您的解决方案。

    构建模型时,ThingWorx 会动态展开 REST API 层以访问这些功能和函数。API 模式相对简单。如果您想要获得一份事物列表,则可询问:

    https:<server>/Thingworx/Things
    

    然后您便可得到一份可访问模型中所含事物的列表。如果键入:

    https:<Server>/Thingworx/Things/<thingName>
    

    则您将获得指定事物的属性、服务和其他功能的列表。您可以深入查看此列表,因为它是可浏览的名称空间。


    1.2 模型试图控制器(MVC)

    通过使用ThingWorx,您可充分利用模型视图控制器 (MVC) 模式。您可以为您的设备构建独立于其用户界面的逻辑模型。然后,您可以使用应用程序构建器构建一个视图。最后,连接 (或绑定) 模型和视图以生成控制器逻辑。


    1.3 ThingWorx 事物模型的可视表示

    详细内容


    1.4 使用事物模型

    事物模型中的关系

    事物形态事物模板共享常用的交互模式以分类、搜索和查找 事物。您可通过交互模型获取按类型或分类排列的资产列表。例如,您可以通过使用某实体的 QueryImplementingThings 服务来请求事物形态或事物模板,从而获取所有相同类型资产 (例如洗碗机型号) 的列表。如果使用 QueryImplementingThingsWithData,您将获取资产与资产列表的属性。还可以通过添加查询参数来提出更多您所感兴趣的问题。例如,您可能想要了解在距离波士顿 50 英里的范围内您的 Acme 经济型割草机所处的位置 (由事物模板定义)。您可能想要了解哪些割草机的引擎运行时大于 400 小时,因为该组割草机可能需要维修。“事物模型”通过内置的搜索功能启用了这些类型的查询。


    搜索模型

    搜索是ThingWorx 内的固有功能,可以执行以下操作:

    • 根据模型名称、模型说明以及任何类型为 TEXT 的数据字段进行全文搜索

    • 搜索模型中的关系 (如上文所述)

    • 使用语义 标记搜索模型和运行时数据

    词汇实体类型可用于定义语义标记。词汇可以有一个或多个标记。词汇由模型标记或数据标记定义,因为这些项可以单独存储。标记就如同可以使用搜索来检查模型和数据的附加索引。

    词汇可以是动态的 (例如,使用不断扩展的工作过程代码标记机器数据) 或静态的 (例如工作订单的状态列表,该列表是描述预定义工作订单工作流的集合)。您可能希望设备中的全部停机事件都有一组特定的原因代码。您可以使用静态词汇作为一组预定义的原因。您可以根据原因代码对停机事件进行查询和计数。

    模型标记可用于对实体定义进行分组。实体可以具有多个与其关联的标记。例如,您可以搜索属于指定应用程序的所有实体。

    数据标记用于搜索运行时数据和操作。例如,您可能正在生产手机。每部手机都具有一个序列号,您可以通过该序列号追踪手机。当您在生产和装配环境中运行手机时,您将从工厂的机器和过程中收集数据。当手机移动到新的机器或工作中心时,在工作中心收集的数据可以用序列号进行标记。因此,您可以在整个过程中追踪手机的过程数据和状态。如果您稍后收到缺陷报告,则可以确定在新操作员操作的机器上处理的每部手机都具有相同的缺陷模式。标记将通过此方法使搜索数据变得更容易。

    您还可以使用标记对资产进行逻辑分组,例如筛选地区服务中心负责的资产列表。

    在 ThingWorx 中,搜索以多种方式呈现。您可以创建第三方信息库的索引,并将这些搜索包括在原生 ThingWorx 搜索中。您可以允许服务技术人员通过运行时搜索来搜索原因代码、产品手册等内容。


    使用模型

    由于模型的面向对象这一特性,您可以根据事物形态或事物模板创建用户界面,并根据用户交互在运行时传入资产。这种抽象是可能的,因为事物形态或事物模板的元数据与事物实例匹配。通过不同的方法来查询模型,您可以将一组资产传递到网页以供用户选择,或者传递给第三方应用程序进行使用。ThingWorx 中所有可用于 ThingWorx Mashup Builder 的 API 也可用于其他应用程序,并根据请求返回 JSON、XML、CSV 或 HTML

    由于 ThingWorx 的 API 是强类型化的,您可以在 Mashup Builder 中通过拖放来开发丰富的用户界面。


    2. 在 ThingWorx 中导入和导出


    2.1 导入和导出数据、实体和扩展

    在 ThingWorx 中有多种选项可用于导入和导出数据和实体。根据您的起点,将包含数据和实体的扩展导入 ThingWorx 可能是您的流程中的第一步。流、值流、数据表、博客和 wiki (行条目、博客帖子、wiki 页面) 中的信息即为数据。仅可导入扩展。虽然 “导入/导出” 菜单 仅对管理员用户可见,但数据和实体可以由非管理员手动导入和导出。

    对于较小的导入和导出,您可以使用**“自文件”导入并使用“至文件”**导出,原因在于您要导入或导出特定文件。

    对于较大的导入和导出,您可以**“自 ThingWorx 存储”导入并导出“至 ThingWorx 存储”**。它们允许您从 ThingworxStorage/exports 文件夹异步导入或导出所有实体和数据。

    有关 ThingWorx 中可用的所有导入和导出选项的更多信息,请参阅详细信息


    2.2 导入扩展

    扩展是由扩展文件和元数据文件组成的 zip 存档。要将扩展内容安装到 ThingWorx,您需要导入 zip 文件。通过将所有扩展 zip 文件打包一起导入一个 zip 文件夹中,您可以同时导入多个扩展。

    详细过程


    2.3 手动导入和导出

    详细信息


    2.4 导出和导入跟踪

    详细信息


    3. Composer中的菜单

    本部分介绍ThingWorx中的系统菜单

    3.1 管理菜单

    管理菜单包括信息库和扩展管理。

    信息库

    查看内容并管理文件信息库事物。可以执行以下操作:

    • 创建、查看、上载、重命名、下载文件和文件夹并从信息库中将其删除;

    • 将文件从本地位置上载到信息库

    扩展

    在此显示所有已安装扩展包的详细信息。也可以删除扩展。


    3.2 管理文件信息库

    可以在 Composer 的 管理菜单中查看并管理文件信息库。可以在 ThingWorx 中使用文件信息库上载和下载文件。

    详细介绍


    3.3 “监控菜单”

    “监控”菜单仅拥有管理员权限的用户可见。此菜单提供了有关 ThingWorx 中所发生情况的详细信息

    日志
    状况
    警报

    详细介绍


    3.4 Analytics 菜单

    可通过Analytics菜单轻松访问ThingWorx中的扩展分析功能。此扩展功能包括Analytics BuilderAnalytics Manager 两个 ThingWorx Analytics Extension 元件。

    此菜单仅对已将 ThingWorx Analytics Extension 导入到 ThingWorx 的用户可见。
    

    详细介绍


    3.5 用户菜单

    首选项

    更改密码

    注销

    详细介绍

    3.5.1 新Composer
    3.5.2 用户菜单
    更多相关内容
  • thingworx8.5 官方安装文档
  • Thingworx获取Restful接口的方法;详细的代码使用案列,对初入Thingworx平台的朋友一定有帮助
  • Thingworx手册_Thingworx物联网平台的学习操作步骤,还不错的哟.
  • thingworx如何安装,thingworx安装教程,安装文档,物联网thingworx
  • docker-thingworx 用于对 Thingworx 平台进行 dockerize 的 dockerfile 使用 TW v5 和 v6 进行测试。为什么 ? Thingworx 是一个专门用于设计和运行 IoT/M2M 应用程序的平台。 请参阅 TW 是未获得许可的软件,您需要...
  • 介绍一个项目模板,允许在TypeScript IDE(如Visual Studio Code)中开发Thingworx模型。它是给谁的该模板主要针对Thingworx开发人员,他们已经非常熟悉作曲家,但也习惯于在常规IDE中工作。 为了成功使用此功能,您...
  • docker-thingworx 用于thingworx的简单开发设置。
  • ThingWorx 技术体系.pdf

    2021-06-29 18:15:50
    ThingWorx
  • Thingworx Training Guide.pdf

    2021-07-22 10:57:19
    Thingworx 初级培训
  • 导出ThingWorx项目以进行源代码控制 该项目的目的是自动将用于源代码控制的ThingWorx实体导出到ThingWorx FileRepository。 从那里可以使用git自动提交更改。 该项目包含: 文件存储库实体 帮手的事 一个计时器 ...
  • Thingworx系统框架介绍

    2017-07-03 18:06:34
    非常详细的关于Thingworx系统框架介绍!
  • 2021-04-22创建初始发行版本
  • 高级用法—Expression&Eventsrouter Widget,文档含有详细的使用说明;对初入Thingworx平台的朋友具有很好的指导作用
  • thingworx Foundation Composer 使用方法.docx
  • 详细描述了PTC的Thingworx平台的基础使用方法和流程,基于平台可以快速的构建和设计基于物联网的应用程序。
  • ThingWorx 物联网平台概述—.pptx
  • thingworx产品简介
  • PTC-ThingWorx 物联网平台概述-Jason.pptx
  • somethingworxJavascript 表达式和脚本
  • thingworx下载方法,包括java,tomcat,h2和sql的安装方法
  • ThingWorx体验报告,使用示例,包括ThingWorx基本体验和操作流程,优缺点分析
  • At an extremely high level, ThingWorx divides mass data into roughly two categories: Time-Series - The Timestamp of the data is one of the most important elements. Non-Time-Series - The Timestamp of ...

    Methods for Data Storage

    Overview

    Explore the Value Stream, Stream, Data Table, and Info Table storage methods.

    GUIDE CONCEPT

    This guide will introduce Values Streams, Streams, Data Tables, and Info Tables.

    Value Streams and Streams are methods of storage for time-series data, while Data Tables and Info Tables are methods of storage for non-time-series data.

    You will learn how to create and utilize these mass data storage methods.

    本指南将介绍值流、流、数据表和信息表。
    Value Streams和Streams是时间序列数据的存储方法,而Data Tables和Info Tables是非时间序列数据的存储方法。
    您将学习如何创建和利用这些海量数据存储方法。

    data-storage-methods

    Step 1: Choosing Storage

    If your data is largely composed of current values of remote IoT devices (and historical values are unimportant), then the simplest solution is most likely to store them as Properties of Things.

    如果您的数据主要由远程 IoT 设备的当前值组成(并且历史值并不重要),那么最简单的解决方案很可能将它们存储为事物的属性。

    However, as opposed to instantaneous current values, there is also “mass data”. Mass data can include large datasets composed of historical records or spreadsheet-like grids.

    然而,与瞬时值相反,还有“大量数据”。海量数据可以包括由历史记录或类似电子表格的网格组成的大型数据集。

    Properties (at least by themselves) aren’t really appropriate in that case, as they typically only store the most recent value.

    When it comes to mass data, different storage methods are good for different types.

    在这种情况下,属性(至少本身)并不合适,因为它们通常只存储最近的值。
    当涉及到海量数据时,不同的存储方法适用于不同的类型。

    At an extremely high level, ThingWorx divides mass data into roughly two categories:

    • Time-Series - The Timestamp of the data is one of the most important elements.
    • Non-Time-Series - The Timestamp of data changes is relatively insignificant.

    在极高的层面上,ThingWorx 将海量数据大致分为两类:

    • 时间序列 - 数据的时间戳是最重要的元素之一。
    • 非时间序列 - 数据更改的时间戳相对而言无关紧要。

    In addition, ThingWorx also subdivides these two categories into either 1) tied to a Thing or 2) independent of any one Thing. Mass data storage that is tied to a Thing will logically only accept information from that one Thing, while independent storage may be used to aggregate information from many Things into a single location.

    此外,ThingWorx 还将这两个类别细分为 1) 与事物相关联或 2) 独立于任何事物。与 Thing 相关联的海量数据存储在逻辑上仅接受来自该 Thing 的信息,而独立存储可用于将来自多个 Things 的信息聚合到一个位置。

    Storage SolutionTime-Series/时间序列Tied to a single Thing/绑定到一个单一事务
    Value StreamsYESYES
    StreamsYESNO
    Data TablesNONO
    Info TablesNOYES

    The following pages will address these storage types in-depth.

    以下将深入介绍这些存储类型。

    Step 2: Value Streams

    In this step, we’ll create a Value Stream to be used as a storage location.

    Value Streams by themselves do nothing. Instead, they must be tied to a Thing.

    在这一步中,我们将创建一个用作存储位置的Value Stream
    Value Stream本身什么都不做。但它们必须与事物相关联。

    Create Value Stream

    1. On the ThingWorx Composer Browse tab, click Data Storage > Value Streams, + New.
      value-streams

    2. In the Choose Template pop-up, select ValueSteam and click OK.
      value-stream-popup

    3. In the Name field, enter Test_Value_Stream.
      在这里插入图片描述

    4. If Project is not already set, search for and select PTCDefaultProject.

    5. At the top, click Save.

    Create Thing

    Since Value Streams must be tied to a Thing, we’ll create one now and then attach the previously-created Value Stream.

    由于Value Streams必须与事物相关联,我们现在将创建一个,然后附加先前创建的Value Streams。

    1. On the ThingWorx Composer Browse tab, click MODELING > Things, + New.
      things
    2. In the Name field, enter Value_Stream_Test_Thing.
    3. If Project is not already set, search for and select PTCDefaultProject.
    4. In the Thing Template field, search for and select GenericThing.
    5. In the Value Stream field, search for and select Test_Value_Stream.
      01-mfds-new-thing
    6. At the top, click Save.

    Create Property

    Now that we have a Thing with an attached Value Stream, we’ll create a Property of that Thing and set it to be Logged.

    If a Value Stream is attached to a Thing, value-changes of all Logged Properties will get automatically recorded along with a timestamp.

    现在我们有一个带有附加Value Stream的事物,我们将创建该事物的属性并将其设置为记录。
    如果Value Stream附加到事物,所有记录属性的值变化将与时间戳一起自动记录。

    1. At the top, click Properties and Alerts.
      value-stream-properties

    2. Click + Add.

    3. In the Name field, enter Value_Property.

    4. Change the Base Type to Number.

    5. Check the Persistent checkbox.

      • This causes the value of the Property to persist through system reboots.
      • 这会导致该属性的值在系统重新启动后保持不变。
    6. Check the Logged checkbox.

      • This causes all value changes to be logged to the attached Value Stream.
      • 这会导致所有值更改都记录到附加的Value Stream中。

      在这里插入图片描述

    7. At the top-right, click the “Check” button for Done.

    8. At the top, click Save.

    Set Property Values

    In a real-world application, Property value changes would likely occur through a connection to a remote IoT device.

    For simplicity, we’ll instead manually change the values.

    Because the Property is Logged and there is a connected Value Stream, each change will be recorded and timestamped.

    在现实的应用程序中,属性值的更改可能会通过与远程 IoT 设备的连接发生。
    为简单起见,我们将改为手动更改值。
    由于该属性已记录并且存在连接的Value Stream,因此将记录每个更改并添加时间戳。

    1. Under the Value column for Value_Property, click the “pencil icon” for Set value of property.
      01-mdsv92-set-value
    2. At the top-right in the Set value of property field, enter 1.
      02-mdsv92-value-1
    3. At the top-right, click the “Check” button for Done.
    4. Again, click the “pencil icon” for Set value of property.
    5. At the top-right in the Set value of property field, enter 2.
      03-mdsv92-value-2
    6. At the top-right, click the “Check” button for Done.
    7. Again, click the “pencil icon” for Set value of property.
    8. At the top-right in the Set value of property field, enter 3.
      04-mdsv92-value-3
    9. At the top-right, click the “Check” button for Done.
    10. At the top, click Save.

    Retrieve Logged Values

    One of the most common ways to retrieve time-series information is with the built-in QueryPropertyHistory Service.

    QueryPropertyHistory may be used to retrieve logged value-changes for usage in a different, custom Service which could manipulate the data, as well as in Mashups for Widgets like a Grid or Line Chart.

    检索时间序列信息的最常用方法之一是使用内置的 QueryPropertyHistory 服务。
    QueryPropertyHistory 可用于检索记录的值更改,以便在可以操作数据的不同自定义服务以及网格或折线图等小部件的混搭中使用。

    1. At the top, click Services.
      value-stream-services

    2. Expand the Generic section.
      05-mdsv92-expand-generic

    3. Scroll down and find the QueryPropertyHistory Service.
      06-mdsv92-queryprophis

    4. Click the “Play” button for Execute service.
      07-mdsv92-execserv

    5. In the bottom-right of the Execute Service: QueryPropertyHistory pop-up, click Execute.

      • Note the previously entered values of 1, 2, and 3, as well as their associated timestamps.

      08-mdsv92-execresults

    6. At the bottom-right, click Done.

    A Value Stream is a simple and easy way to record all time-series changes of a particular Thing Property’s values.

    The QueryPropertyHistory built-in Service may be used both in a custom Service to extract the value changes and Timestamps from a Value Stream, as well as in a Mashup to display how values change over time (in a Line Chart, for instance).

    Value Stream是一种记录特定事物属性值的所有时间序列变化的简单方法。
    QueryPropertyHistory 内置服务既可用于自定义服务以从Value Stream中提取值更改和时间戳,也可用于 Mashup 以显示值如何随时间变化(例如在折线图中)。

    Step 3: Streams

    Mass data is typically stored in a structure functionally similar to a spreadsheet.

    海量数据通常存储在功能类似于电子表格的结构中。

    Each separate column of the spreadsheet is exclusively one type of data (with each field directly beneath it holding different entries of that same type), while the rows determine the specific entry.

    电子表格的每个单独列都是一种类型的数据(其正下方的每个字段都包含相同类型的不同条目),而行确定特定条目。

    Combine a column’s “type” with the row’s “index”, and you have the particular piece of data about which you care.

    将列的“类型”与行的“索引”结合起来,您就拥有了您关心的特定数据。

    ThingWorx mass data storage functions in roughly the same way. However, ThingWorx does have one differentiation from many spreadsheet implementations.

    ThingWorx 海量数据存储的功能大致相同。但是,ThingWorx 确实与许多电子表格实现有一个区别。

    In ThingWorx, the type that defines each column is not held internally to the data structure itself. Instead, it is abstracted out as a Data Shape.

    在 ThingWorx 中,定义每一列的类型并不保存在数据结构本身内部。相反,它被抽象为Data Shape。

    A Data Shape is the definition of what each column contains.

    A Stream requires a Data Shape in order to define its structure.

    数据形状是每列包含的内容的定义。
    一个流需要一个数据形状来定义它的结构。

    Create Data Shape

    1. On the ThingWorx Composer Browse tab, click Modeling -> Data Shapes, + New.
      data-shapes

    2. In the Name field, enter Test_Data_Shape.
      data-shape-name

    3. If Project is not already set, search for and select PTCDefaultProject.

    4. At the top, click Field Definitions.
      data-shape-field-defs

    5. Click + Add.

    6. On the right in the Name field, enter Index_Field.

    7. Change the Base Type to INTEGER.

    8. Check the Is Primary Key checkbox.

      • All Data Shapes must have a Primary Key, and Index_Field is an appropriate choice, as it will keep track of the number of entries.

      09-mdsv92-index-field

    9. At the top-right, click the “Check with a +” button for Done and Add.

    10. In the Name field, enter Value_Field.

    11. Change the Base Type to NUMBER.
      10-mdsv92-value-field

    12. At the top-right, click the “Check” button for Done.

    13. At the top, click Save.

      11-mdsv92-data-shape-save

    Once again, the Data Shape does nothing by itself.

    It simply defines that some other mass data structure (such as a Stream) follows the particular format of the Data Shape.

    So a Stream assigned the Test_Data_Shape above would have two fields per entry, i.e. an Index and a Value.

    再次提醒,数据形状本身什么都不做。
    它只是定义了一些其他海量数据结构(例如流)遵循数据形状的特定格式。
    因此,上面分配了 Test_Data_Shape 的流每个条目将有两个字段,即索引和值。

    Create Stream

    Streams are a mass data storage option optimized for Time-Series data.

    They are utilized in much the same way as Value Streams, but possess additional functionality.

    For one, Streams do not have to be tied to Things in the way that Value Streams are. They can be entirely independent, or even accept inputs from multiple different Things.

    This can be useful when you want to have a master list of what every similar Thing was doing at particular points throughout some timeframe.

    Streams是针对时间序列数据优化的海量数据存储选项。
    它们的使用方式与Value Streams大致相同,但具有额外的功能。
    一方面,Streams不必像Value Streams那样与事物联系在一起。它们可以完全独立,甚至可以接受来自多个不同事物的输入。
    当您想要在某个时间范围内的特定时间点拥有每个类似事物在做什么的主列表时,这可能很有用。

    1. On the ThingWorx Composer Browse tab, click DATA STORAGE -> Streams, + New.
      streams

    2. On the Choose Template pop-up, select Stream and click OK.
      02-mfds-stream-popup

    3. In the Name field, enter Test_Stream.
      stream-name

    4. If Project is not already set, search for and select PTCDefaultProject.

    5. In the Data Shape field, search for and select Test_Data_Shape.

    6. At the top, click Save.

      12-mdsv92-test-stream-save

    Create Thing

    Now that the Stream is created, you’ll create a Thing from which you can log some Properties.

    现在创建了 Stream,您将创建一个 Thing,您可以从中记录一些属性。

    1. On the ThingWorx Composer Browse tab, click MODELING -> Things, + New.
      stream-thing
    2. In the Name field, enter Stream_Test_Thing.
    3. If Project is not already set, search for and select PTCDefaultProject.
    4. In the Thing Template field, search for and select GenericThing.
      04-mfds-new-stream-thing
    5. At the top, click Properties and Alerts.
      stream-thing-properties
    6. Click + Add.
    7. In the Name field, enter Index_Property.
    8. Change the Base Type to Integer.
    9. Check the Persistent checkbox.
      13-mdsv92-index-prop
    10. At the top-right, click the “Check with a +” button for Done and Add.
    11. In the Name field, enter Value_Property.
    12. Change the Base Type to Number.
    13. Check the Persistent checkbox.
      14-mdsv92-value-prop
    14. At the top-right, click the “Check” button for Done.

    Add Service

    Since you now have both a Thing and a Stream, we can write a Service which logs the Properties’ values when the Service is executed.

    由于您现在拥有一个事物和一个Stream,我们可以编写一个服务,在服务执行时记录属性的值。

    1. At the top, click Services.
      15-mdsv92-services

    2. At the top, click + Add.

    3. In the Name field, enter Add_Stream_Entry_Service.
      16-mdsv92-add-stream-entry-service

    4. On the left under New Service, click the Snippets tab.
      17-mdsv92-snippets

    5. In the Filter field, type add str.
      18-mdsv92-filter-add-str

    6. Expand the Stream, Blog, Data Table section to reveal the Add Stream Entry Snippet.
      service_add_stream_entry

    7. Click the right arrow beside Add Stream Entry.

      • An Add Stream Entry pop-up will open.

      add_stream_entry_popup

    8. In the Search Streams field, enter test.
      popup_search_test

    9. Select Test_Stream.
      popup_insert_code_snippet

    10. Click the Insert Code Snippet button.

      • Note that a section of Javascript code has now been added to the Script window.

      19-mdsv92-insert-snippet

    Modify Snippet

    The inserted Javascript Snippet has already done most of the work of creating a custom Service for us.

    All which you need to do now is modify the code Snippet to store the particular Property values from your Thing.

    插入的 Javascript Snippet 已经完成了为我们创建自定义 Service 的大部分工作。
    您现在需要做的就是修改代码 Snippet 以存储 Thing 中的特定属性值。

    1. On the 10th line of code, double-click undefined to select it.
      20-mdsv92-highlight-undefined-1

    2. On the left, click the Me/Entities tab.
      21-mdsv92-me-entities

    3. Under the Me/Entities tab, expand Properties.

      • Note that this is not the Properties and Alerts at the top of Composer.

      22-mdsv92-expand-prop

    4. Click the right arrow beside Value_Property.

      • Note that undefined has been replaced by me.Value_Property.

      23-mdsv92-value-prop

    5. On the 11th line of code, double-click the remaining undefined to select it.
      24-mdsv92-other-undefined

    6. Click the right arrow beside Index_Property.

      • Note that the second “undefined” has been replaced by “me.Index_Property”.

      25-mdsv92-index-prop

    7. At the top, click Done to close the Add_Stream_Entry_Service editing window.
      26-mdsv92-service-done

    8. At the top, click Save.

    Store to Stream

    Now that the Stream, the Thing (and its Properties), and the Thing’s Service are all in place, we can execute the Service (along with some Property changes) to demonstrate that the values are getting archived externally to the Stream.

    现在 Stream、Thing(及其属性)和 Thing 的服务都已准备就绪,我们可以执行服务(以及一些属性更改)以证明这些值正在外部存档到 Stream。

    1. At the top, click Properties and Alerts.

      • Note the previously-created Index_Property and Value_Property.

      stream-properties

    2. For Index_Property’s Value column, click the “pencil” icon for Set value of property.
      27-mdsv92-index-set-value

    3. In the slide-out on the right, enter 1.
      28-mdsv92-index-set-1

    4. At the top-right, click the “Check” button for Set.

    5. For Value Property, click the “Pencil” icon for Set value of property.
      29-mdsv92-value-set-prop

    6. In the slide-out on the right, enter 10.
      30-dsv92-value-set-10

    7. At the top-right, click the “Check” button for Set.

    8. At the top, click Save.

      31-mdsv92-stream-test-thing-save

    With the Thing’s Properties set to new values, you can now call your custom Service to store those values to the external Stream (along with an auto-generated timestamp).

    将事物的属性设置为新值后,您现在可以调用自定义服务将这些值存储到外部流(以及自动生成的时间戳)。

    1. At the top, click Services.
      08-mfds-services-add-stream-entry
    2. On the Add_Stream_Entry_Service line, click the “Play” button for Execute Service.
      32-mdsv92-execute-service
    3. At the bottom-right of the pop-up, click the Execute button.execute_popup
    4. At the bottom-right, click the Done button.execute_results

    Retrieve from Stream

    To confirm that our Thing’s custom Service is correctly logging our Property values, we’ll now use a built-in Service of the Stream to retrieve the stored values.

    This same QueryStreamEntriesWithData Service could alternately be used to populate various Mashup Widgets to view the data in a more convenient format.

    为了确认我们 Thing 的自定义服务正确记录了我们的属性值,我们现在将使用流的内置服务来检索存储的值。
    这个相同的 QueryStreamEntriesWithData 服务可以交替地用于填充各种 Mashup Widget,以更方便的格式查看数据。

    1. Return to the Test_Stream Entity.
      return-test-stream

    2. On the top, click Services.
      33-mdsv92-services

    3. Scroll down and locate the QueryStreamEntriesWithData Service’s Execute service button.
      34-mdsv92-querystreamentrieswithdata

    4. At the bottom-right of the pop-up, click Execute.

      • Note that you should see a single entry, showing the Index_Field at 1, the Value_Field at 10, and a timestamp of when the information was pushed to the Stream.

      query_result

    5. At the bottom-right, click Done.

    To further confirm external storage to the Stream, you may repeat the previous steps to confirm additional Property Value Storage with timestamping.

    Furthermore, you could create a Mashup utilizing either the Time-Series Chart or a Grid to display the data stored within the Stream.

    要进一步确认流的外部存储,您可以重复前面的步骤以确认带有时间戳的附加属性值存储。
    此外,您可以创建一个 Mashup 使用时间序列图表或网格来显示存储在流中的数据。

    Step 4: Data Tables

    Just like with Streams, you also need a Data Shape to format a Data Table.

    In this example, we’ll actually use the exact same Data Shape we previously created for the Stream.

    就像使用 Streams 一样,您还需要一个 Data Shape 来格式化数据表。
    在这个例子中,我们实际上将使用我们之前为流创建的完全相同的数据形状。

    Create Data Table

    Both Data Tables and Info Tables may be appropriate for your non-time-series mass data storage needs.

    However, a Data Table is not tied to a Thing as an Info Table Property would be.

    If your non-time-series information is coming from multiple different sources, then it would generally be appropriate to use a Data Table.

    数据表和信息表都可能适合您的非时间序列海量数据存储需求。
    但是,数据表并不像信息表属性那样与事物相关联。
    如果您的非时间序列信息来自多个不同的来源,那么使用数据表通常是合适的。

    1. On the ThingWorx Composer Browse tab, click Data Storage > Data Tables, + New.data-tables

    2. On the Choose Template pop-up, select DataTable, and click OK.
      datatable_popup

    3. In the Name field, enter Test_Data_Table.
      data-table-name

    4. If Project is not already set, search for and select PTCDefaultProject.

    5. In the Data Shape field, search for and select Test_Data_Shape.

      • This is the same Data Shape we previously created for the Stream. We’re just reusing it for formatting the Data Table.
    6. At the top, click Save.

      05-mfds-data-table-save

    Create Thing

    Now that we have a Data Table, let’s create a Thing with some Properties that we’ll eventually log to the external Data Table.

    现在我们有一个数据表,让我们创建一个带有一些属性的事物,我们最终将记录到外部数据表。

    1. On the ThingWorx Composer Browse tab, click MODELING -> Things, + New.things
    2. In the Name field, enter Data_Table_Test_Thing.
    3. If Project is not already set, search for and select PTCDefaultProject.
    4. In the Thing Template field, search for and select GenericThing.
      06-mfds-data-table-thing
    5. At the top, click Properties and Alerts.
      data-table-thing-properties
    6. Click + Add.
    7. In the Name field, enter Index_Property.
    8. Change the Base Type to Integer.
    9. Check the Persistent checkbox.
      35-mdsv92-thing-property
    10. At the top, click the “Check with a +” button for Done and Add.
    11. In the Name field, enter Value_Property.
    12. Change the Base Type to Number.
    13. Check the Persistent checkbox.
      36-mdsv92-second-property
    14. At the top-right, click the “Check” button for Done.

    Create Service

    We now have both a Data Table and a Thing with Properties that we want logged.

    Now we need to create a Service which does the logging.

    我们现在有一个数据表和一个我们想要记录的带有属性的事物。
    现在我们需要创建一个进行日志记录的服务。

    1. At the top, click Services.
      data-table-thing-services

    2. Click + Add.

    3. In the Name field, enter Add_Data_Table_Entry_Service.
      37-mdsv92-add-service

    4. Under New Service on the left, click the Snippets tab.
      38-mdsv92-snippets

    5. In the Filter field, type data table.
      39-mdsv92-filter-data-table

    6. Expand the Stream, Blog, Data Table section.
      40-mdsv92-expand-stream

    7. Beside Add/Update Data Table, click the right arrow.

      • A pop-up will open.

      snippet_popup

    8. In the Search Data Tables field, type test.
      snippet_etst_search

    9. Select Test_Data_Table.
      insert_code_snippet

    10. Click the green Insert Code Snippet button.

      • Note that a section of Javascript code has now been added to the Script window.

      41-mdsv92-insert-code-snippet

    Modify Snippet

    1. On the 6th line of code, double-click undefined to select it.

    2. On the left, expand the Me/Entities tab.

    3. Under the Me/Entities tab, expand Properties.

      • Note that this is not the Properties and Alerts at the top of Composer

      42-mdsv92-expand-prop

    4. Click the right arrow beside Value_Property.

      • Note that undefined has been replaced by me.Value_Property.

      在这里插入图片描述

    5. On the 7th line of code, double-click the remaining undefined to select it.

    6. Click the right arrow beside Index_Property.

      • Note that the second undefined has been replaced by me.Index_Property.

      44-mdsv92-replace-index-prop

    7. Click Done to stop editing the custom Service.
      data-table-service-done

    8. At the top, click Save.
      data-table-thing-save

    Set Properties

    We now have the Thing with Properties that we want logged, the Service to do said logging, and the Data Table to where the values will be stored.

    我们现在有了我们想要记录的带有属性的事物,进行所述记录的服务,以及将存储值的数据表。

    1. At the top, click Properties and Alerts.

      • Note Data_Table_Test_Thing’s Index_Property and Value_Property.

      data-table-thing-properties

    2. On the Index_Property line under the Value column, click the “Pencil” icon for Set value of property.
      data-table-set-property

    3. In the slide-out on the right, enter 1.
      45-mdsv92-set-index-1

    4. At the top-right, click the “Check” button for Set.

    5. On the Value_Property line under the Value column, click the “Pencil” icon for Set value of property.

    6. In the slide-out on the right, enter 10.
      46-mdsv92-set-value-10

    7. At the top-right, click the “Check” button for Set.

    8. At the top, click Save.
      data-table-thing-save

    Store to Data Table

    1. At the top, click Services.
      data-table-thing-services

    2. On the Add_Data_Table_Entry_Service line under the Execute column, click the “Play” icon for Execute service.

      • A pop-up will open.

      execute_service_popup

    3. At the bottom-right, click Execute.service_executed

    4. At the bottom-right, click Done.

    Retrieve from Data Table

    1. Return to Test_Data_Table.
      test-data-table

    2. At the top, click Services.

    3. Scroll down and locate the QueryDataTableEntries built-in Service.
      querydatatableentries

    4. On the QueryDataTableEntries line, click the “Play” icon for Execute service.

      • A pop-up will open.
    5. On the bottom-right of the pop-up, click Execute.

      • Note that you should see a single entry, showing the Index_Field at 1 and the the Value_Field at 10

      query_executed

    6. On the bottom-right, click Done.

    If so desired, you may repeat the previous steps to add additional entries to the Data Table. You will note that the Index and Value fields of the Data Table continue to change in each entry to whatever you have set.

    Utilizing the functionality of the QueryDataTableEntries built-in Service was just a way to show that the Index and Value items had been correctly logged to the external Data Table.

    If you wanted to visualize the Data Tables in a grid, it would be as simple as utilizing the Grid Widget and tying Test_Data_Table -> QueryDataTableEntries -> All Data to said Grid.

    如果需要,您可以重复前面的步骤以向数据表添加其他条目。您会注意到数据表的索引和值字段在每个条目中继续更改为您设置的任何内容。
    利用 QueryDataTableEntries 内置服务的功能只是显示索引和值项目已正确记录到外部数据表的一种方式。
    如果您想在网格中可视化数据表,就像使用网格小部件并将 Test_Data_Table -> QueryDataTableEntries -> 所有数据绑定到所述网格一样简单。

    Step 5: Info Tables

    Just like with Streams and Data Tables, an Info Table requires a Data Shape to format it.

    In this example, we’ll actually use the exact same Data Shape we previously created for the Stream.

    就像流和数据表一样,信息表需要一个数据形状来格式化它。
    在这个例子中,我们实际上将使用我们之前为流创建的完全相同的数据形状。

    Create Thing

    Info Tables are another way to perform non-time-series data storage within the ThingWorx platform.

    Info Tables used for storage are tied directly to a particular Thing. As such, they are somewhat non-optimal for situations where you’re wanting to aggregate data across multiple Things.

    Info Tables are a Property Base Type in ThingWorx, in the same manner as a Number, Integer, or String.

    信息表是另一种在 ThingWorx 平台内执行非时间序列数据存储的方法。
    用于存储的信息表直接与特定事物相关联。因此,对于您希望跨多个事物聚合数据的情况,它们有些非最佳。
    信息表是 ThingWorx 中的属性基本类型,与数字、整数或字符串的方式相同。

    1. On the ThingWorx Composer Browse tab, click Modeling > Things, + New.things
    2. In the Name field, enter Test_Info_Table_Thing.
    3. If Project is not already set, search for and select PTCDefaultProject.
    4. In the Thing Template field, search for and select GenericThing.
      07-mfds-info-table-thing
    5. At the top, click Properties and Alerts.
    6. Click + Add.
    7. In the Name field, enter Info_Table_Property.
    8. Change the Base Type to INFOTABLE.
    9. In the Data Shape field, search for and select Test_Data_Shape.
      • This is the same Data Shape we previously created for the Stream. We’re just reusing it for formatting the Info Table.
    10. Check the Persistent checkbox.
      47-mdsv92-info-table-thing-prop
    11. At the top-right, click the “Check” button for Done.
    12. At the top, click Save.
      info-table-thing-save

    Set First Value

    Now that we have a Thing with an Info Table Property (formatted by our Data Shape), you can set some values for later display in a Mashup.

    1. On the new Info_Table_Property line under the Value column, click the “Pencil” button for Set value of property.
      info-table-set-value
    2. On the new pop-up, click the + Add button.
      setvalue_popup
    3. In the Index_Field, enter 1.
    4. In the Value_Field, enter 11.
      set_first_entry
    5. At the bottom-right of the pop-up, click Add.

    Set Second Value

    1. On the pop-up, click the + Add button.
    2. In the Index_Field, enter 2.
    3. In the Value_Field, enter 22.
      set_second_value
    4. At the bottom-right of the pop-up, click Add.

    Set Third Value

    1. On the pop-up, click the + Add button.
    2. In the Index_Field, enter 3.
    3. In the Value_Field, enter 33.
      set_third_value
    4. At the bottom-right of the pop-up, click Add.
      all_values_set
    5. At the bottom-right of the pop-up, click Save.
    6. At the top, click Save.
      info-table-thing-save

    Create Mashup

    Now that we have a Thing with an InfoTable Property and some value-entries in said InfoTable, let’s create a Mashup to display those values by using the Grid Widget.

    现在我们有了一个带有 InfoTable 属性的 Thing 和 InfoTable 中的一些值条目,让我们创建一个 Mashup 来使用 Grid Widget 来显示这些值。

    1. On the ThingWorx Composer Browse tab, click VISUALIZATION > Mashups, + New.
      mashups
    2. On the New Mashup pop-up, leave the defaults, and click OK.
      new-mashup-popup
    3. In the Name field, enter Test_Info_Table_Mashup.
    4. If Project is not already set, search for and select PTCDefaultProject.
    5. At the top, click Save.
      mashup-saved
    6. At the top, click Design.
    7. With the Widgets tab selected in the top-left, drag-and-drop a Grid Advanced Widget onto the central Canvas area.grid-advanced

    Bind Data

    1. On the far-right, ensure that the Data tab is selected.

      • Note that you may have to expand this area from the far-right.

      data-tab

    2. Click the + icon.

      • The Add Data pop-up will appear.

      add-data

    3. In the Entity Filter field, search for and select Test_Info_Table_Thing.

    4. In the Services Filter field, enter getprop.

    5. Click the right arrow beside the GetPropertyValues Service.

    6. On the right under Selected Services, check the Execute on Load checkbox.
      getprop

    7. At the bottom-right of the pop-up, click Done.

      • Note that Test_Info_Thing -> GetPropertyValues is now available under the Data tab at the far-right.
    8. Expand GetPropertyValues > Returned Data > All Data.
      48-mdsv92-expand-getpropval

    9. Drag-and-drop GetPropertyValues > Returned Data > All Data > Info_Table_Property onto the Grid Advanced Widget in the central Canvas area.bind-data

    10. On the Select Binding Target pop-up, select Data.
      data-bound

    11. At the top, click Save.

    12. At the top, click View Mashup.
      view-mashup

    The new Mashup displays all of the Index and Value fields you had previously entered.

    If you were to add additional entries to the Info Table Property and then refreshed the Mashup, you would see those additional entries as well.

    新混搭显示您之前输入的所有索引和值字段。
    如果您将附加条目添加到信息表属性,然后刷新混搭,您也会看到这些附加条目。

    Step 6: Next Steps

    Congratulations!

    In this guide, you’ve learned how to:

    • Differentiate between data storage methods
    • Create a Data Shape to format a Stream, Data Table, and Info Table
    • Create a Value Stream and Stream to store Time-Series Data
    • Create a Data Table and Info Table to store non-Time-Series Data
    • Use built-in methods to log data to a Value Stream or Info Table
    • Create custom Services which log data to a Stream or Data Table
    • Confirm data storage value changes via a built-in Service or Grid Widget

    Learn More

    We recommend the following resources to continue your learning experience:

    CapabilityGuide
    BuildImplement Services, Events, and Subscriptions

    Additional Resources

    If you have questions, issues, or need additional information, refer to:

    ResourceLink
    CommunityDeveloper Community Forum
    SupportData Storage Help Center
    展开全文
  • ThingWorx产品功能描述

    2017-07-08 15:48:09
    ThingWorx产品功能描述
  • Thingworx Foundation产品简介,美国PTC物联网平台Thingworx
  • Android Things ThingWorx演示此示例演示如何使用DHT11 + Arduino UNO + Raspberry Pi 3 + Thingworx平台将Android Things与Thingworx连接。准备具有Android Things的Raspberry Pi 3 Android Studio 2.2以上版本以下...
  • PTC---Thingworx介绍

    2017-07-25 11:55:32
    PTC - Thingworx介绍_互联网_IT/计算机_专业资料。ThingWorx APAC Business Development 1 PTC公司介绍 总部位于美国马萨诸塞州的Needham 全球6000余名员工 支持智能.....
  • Thingworx入门简单教程

    2022-08-08 18:40:40
    主要是讲述Thingworx平台的入门使用方式,包括如果建立物模型,怎么将设备数据绑定到物模型上,包括数据处理还有混搭的使用方式,通过将物模型的数据导入到混搭,快速构建需要的图表和数据分析展示
  • ThingWorx是美国ptc公司开发的物联网平台,能够稳定连接工业设备,是IIOT方面,目前最好的物联网平台。
  • 本文档是针对THingworx物联网平台与OPC DA软件之间的集成配置指南

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 650
精华内容 260
关键字:

ThingWorx