当前位置:   article > 正文

利用大语言模型(KIMI)构建智能产品的信息模型_如何使用kimi训练自己的私有模型

如何使用kimi训练自己的私有模型

          数字化的核心是数字化建模,为一个事物构建数字模型是一件非常繁杂和耗费人工的事情。利用大语言模型,能够轻松地生成设备的信息模型,我们的初步实验表明,只要提供足够的模板,就能够准确地生成设备的数字化模型。

        我们尝试了利用大预言模型生成OPCUA 和工业4.0 管理壳模型,实验中采用JSON 作为中间模型,构建了各种JSON 模板(template),得到了令人满意的结果。

笔者认为 大语言模型是生成产品信息模型的最佳工具。

产品信息模型与控制模型

        不同的应用场景,对事物的关注重点的不同的。例如,对于一个智能传感器而言,从商业的角度看,产品的信息模型中应该包括产品的类型,名称,制造商,技术规格,产品图片,3D模型,安全论证等信息。而对于应用工程师而言,关心的是产品的接口,协议和控制方法。产品的商业信息和使用信息是不同的。信息模型也不同。

   于是,产品的商业信息和使用信息采用的建模方式和标准也是不同的。产品信息主要标准包括GS-1,ETIM,ECL@SS。而控制模型包括OPC UA 和工业4.0 管理壳(AAS)。

  本文首先探讨在ETIM 模型的基础上扩展基于JSON 的控制信息模型。并且通过转换软件将JSON 控制模型转换成OPCUA 模型。采用JSON 的原因是JSON 更具有可读性。适合大语言模型构建产品模型。
      

智能产品信息模型   

  对于智能化技术产品而言,产品的信息包含下面几个方面:

  1. 产品的基本信息
  2. 产品的技术指标
  3. 产品的操作过程
  4. 产品的几何图形
  5. 产品的商务信息

   这些信息除了商务信息之外,通常包含在产品的数据表(DataSheet) 中,对于复杂的智能产品,为了帮助用户使用产品,还提供了辅助的技术文档。 商务信息在销售部门的报价单或者ERP 系统中。

           数字化的主要工作之一是构建生产过程中所有资产的数字化模型。产品的基本信息,技术指标和几何图形通常包含在产品分类目录中(例如ETIM,GS-1,ECL@SS)。产品的商务信息包含在电子商务平台信息模型中。而产品的操作过程包含在技术文档中。

  产品操作过程的模型

  在工业4.0 的相关标准中,数字资产的数字化模型被称为资产管理壳(AAS),其中包含了操作数据和服务,这是模型能够转换成自动控制系统中的信息模型,例如OPCUA 信息模型。

       资产管理壳和OPC UA 是相对比较复杂的形式化信息模型,构建这些信息模型要借助专业的设计工具,并且具备一定的AAS和OPCUA 背景知识,笔者关注的重点是使用更加便捷,高效的方法描述产品的信息模型。特别是ChatGPT 技术的出现。为使用自然语言描述信息模型带来了新的机会。在我看来,chatGPT 为代表的大语言模型最强大的能力是将人类自然语言的内容转换成为机器能够识别的形式化信息。

JSON LD 物模型

JSON -LD 的全称是(JSON linked data),是Google公司提出来的,W3C 发布 JSON-LD 1.1 正式推荐标准。

       JSON-LD 是一种轻量级链接数据格式。它 对人类来说很容易读写。它基于已经 成功的 JSON 格式,并提供了一种帮助 JSON 数据互操作的方法。

JSON-LD的初衷是提供了一种更简单的方法来从网站创建机器可读数据以提升搜索结果。

        具体来说,使用 <script type="application/ld+json"> 标签可以让网页中的元素被编码为一个 JSON-LD 对象,并将其嵌入到页面中。这个 JSON-LD 对象可以包含诸如实体名称、描述、图像、地址、联系方式等属性信息,让搜索引擎更好地理解网页的含义和结构。

        通过使用结构化数据,网站管理员可以帮助搜索引擎更好地了解他们网站的内容和结构,并且有助于提高网站在搜索引擎中的排名和可见度。另外,使用 JSON-LD 还可以使您的网站在 Google 的搜索结果中显示富媒体的搜索结果,例如公司地址、电话号码、评分等等。

在网页正文中嵌入结构化数据,例如描述组织、产品或事件的相关信息。以下是一个示例:
 

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script type="application/ld+json">
  5. {
  6. "@context": "https://schema.org/",
  7. "@type": "Organization",
  8. "name": "Example Company",
  9. "url": "https://www.example.com/",
  10. "logo": "https://www.example.com/logo.png"
  11. }
  12. </script>
  13. </head>
  14. <body>
  15. <h1>Welcome to Example Company</h1>
  16. <p>Visit our website at <a href="https://www.example.com/">www.example.com</a></p>
  17. </body>
  18. </html>

JSON-LD 被用于物联网(Web of thing )描述物模型,下面是一个例子:

  1. {
  2. "id": "urn:dev:wot:com:example:servient:lamp",
  3. "name": "MyLampThing",
  4. "securityDefinitions": {
  5. "basic_sc": {"scheme": "basic"}
  6. },
  7. "security": ["basic_sc"],
  8. "properties": {
  9. "status" : {
  10. "type": "string",
  11. "forms": [{"href": "https://mylamp.example.com/status"}]
  12. }
  13. },
  14. "actions": {
  15. "toggle" : {
  16. "forms": [{"href": "https://mylamp.example.com/toggle"}]
  17. }
  18. },
  19. "events":{
  20. "overheating":{
  21. "data": {"type": "string"},
  22. "forms": [{
  23. "href": "https://mylamp.example.com/oh",
  24. "subprotocol": "longpoll"
  25. }]
  26. }
  27. },
  28. "annotation": {
  29. "@context": {
  30. "@base": "http://example.org/data/",
  31. "vendor": "http://vendor.org/product/"
  32. }
  33. "@type": "vendor:color-light",
  34. "isAbstractionOf": "appartment/134#light-1"
  35. }
  36. }

 受到WoT 使用JSON LD 建模的启发,我们可以利用JSON构建控制过程的模型:

  • JSON 更适合人类阅读和书写
  • JSON 更适合LLM 生成

大语言模型生成产品模型的实验

        笔者曾经尝试使用LLM 直接生成产品信息模型,结果发现,LLM 的输出存在不一致的现象,在数字化建模中是无法接受的。而LLM是基于语言的实例来学习语言的语法。它目前无法学习schema 规范。因此,我放弃了直接生成产品模型的想法,而是为LLM 提供一个JSON 模型的模板,让LLM 完成模型的实例化.通过阅读产品的datasheet ,提取相关信息,填入预先定义的JSON 模型中,并且将JSON 模型中未定义的属性作为专用属性增补在后面。

构建产品信息模型

这是产品的控制模型: 

  1. {
  2. "name":"mydevice",
  3. "description":"description of mydevice",
  4. "group_id":"group id",
  5. "class_id":"class_id",
  6. "properties":[{
  7. "name":"status",
  8. "type":"string",
  9. "description":"the status of device"
  10. },
  11. {
  12. "name":"temperature",
  13. "type":"numeric",
  14. "description":"the temperature of device",
  15. "max":"max of value",
  16. "min":"min of value",
  17. "value":"the default value"
  18. }
  19. ],
  20. "actions":[{
  21. "name":"the name og action",
  22. "description":"the description of the action",
  23. "arguments":{
  24. "inputs":[],
  25. "output"[]
  26. }
  27. }],
  28. "events":[{
  29. "name":" the name of event",
  30. "description":"description of the event"
  31. }]
  32. }

输入产品控制模型的描述

使用word 编写了一个产品的简单描述:

  1. 这是产品的信息
  2. 名称 温度传感器
  3. 属性:
  4. 温度
  5. 最大值:180
  6. 最小值: -30
  7. 初始值:0
  8. 电流
  9. 初始值:0
  10. 电压
  11. 初始值:24
  12. 动作:
  13. 初始化
  14. 输入:
  15. 输入1:电流初始值
  16. 输出:无
  17. 读取温度:
  18. 输入:无
  19. 输出:
  20. 输出1当前温度
  21. 复位:
  22. 输入:无
  23. 输出:无

将产品模型和产品信息上传给kimi 大模型,结果为:

  1. {
  2. "name": "温度传感器",
  3. "properties": {
  4. "temperature": {
  5. "max": 180,
  6. "min": -30,
  7. "initial_value": 0
  8. },
  9. "current": {
  10. "initial_value": 0
  11. },
  12. "voltage": {
  13. "initial_value": 24
  14. }
  15. },
  16. "actions": [
  17. {
  18. "name": "initialize",
  19. "description": "初始化设备,设置电流的初始值",
  20. "arguments": {
  21. "inputs": [
  22. {
  23. "name": "current_initial_value",
  24. "description": "电流的初始值"
  25. }
  26. ],
  27. "outputs": []
  28. }
  29. },
  30. {
  31. "name": "read_temperature",
  32. "description": "读取设备当前的温度值",
  33. "arguments": {
  34. "inputs": [],
  35. "outputs": [
  36. {
  37. "name": "current_temperature",
  38. "description": "当前的温度值"
  39. }
  40. ]
  41. }
  42. },
  43. {
  44. "name": "reset",
  45. "description": "复位设备到初始状态",
  46. "arguments": {
  47. "inputs": [],
  48. "outputs": []
  49. }
  50. }
  51. ]
  52. }

构建工业4.0 管理壳信息模型

        同样地,我们根据《IDTA 02006-2-0 Digital Nameplate for Industrial Equipment》 规范构建了工业设备数字铭牌的JSON 模板,生成了一个锅炉的数字铭牌:

JSON 模板

  1. {
  2. "submodelId": "urn:company:submodel:nameplate",
  3. "submodelName": "namepalte",
  4. "description": "the name plate",
  5. "semanticId": "http://www.example.com/nameplate",
  6. "globalAssetId": "urn:company:asset:67890",
  7. "ManufacturerName": "legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation",
  8. "ManufacturerProductDesignation": "Short description of the product ",
  9. "ContactInformation": {
  10. "Street":"street name and house number",
  11. "Zipcode":"ZIP code of address",
  12. "CityTown":"town or city",
  13. "NationalCode":"code of a country",
  14. "Phone":{},
  15. "Fax":{},
  16. "Email":{},
  17. "IPCommunication":{}
  18. },
  19. "ManufacturerProductRoot": "Top level of a 3 level manufacturer specific product hierarchy",
  20. "ManufacturerProductType": "Characteristic to differentiate between different products of a product family or special variants",
  21. "OrderCodeOfManufacturer": "By manufactures issued unique combination of numbers and letters used to identify the device for ordering",
  22. "ProductArticleNumberOfManufacturer": "unique product identifier of the manufacturer",
  23. "SerialNumber": "unique combination of numbers and letters used to identify the device once it has been manufactured",
  24. "YearOfConstruction": "Date from which the production and / or development process is completed or from which a service is provided completely",
  25. "HardwareVersion": "Version of the hardware supplied with the device",
  26. "FirmwareVersion": "Version of the firmware supplied with the device",
  27. "SoftwareVersion": "Version of the software used by the device",
  28. "CountryOfOrigin": "Country where the product was manufactured",
  29. "CompanyLogo": "A graphic mark used to represent a company",
  30. "Markings": {
  31. "MarkingName":"common name of the marking",
  32. "DesignationOfCertificateOrApproval":"alphanumeric character sequence identifying a certificate or approva",
  33. "IssueDate":"Date, at which the specified certificate is issued",
  34. "ExpiryDate":"Date, at which the specified certificate expires ",
  35. "MarkingFile":"conformity symbol of the marking",
  36. "MarkingAdditionalText":"where applicable, additional information on the marking in plain text, e.g. the ID-number of the notified body involved in the conformity process",
  37. "ExplosionSafeties":{
  38. "ExplosionSafety":{
  39. "DesignationOfCertificateproval":"alphanumeric character sequence identifying a certificate or approval",
  40. "TypeOfApproval":"classification according to the standard or directive to which the approval applies",
  41. "ApprovalAgencyTestingAgency":"certificates and approvals pertaining to general usage and compliance with constructional standards and directives",
  42. "TypeOfProtection":"classification of an explosion protection according to the specific measures applied to avoid ignition of a surrounding explosive atmosphere",
  43. "RatedInsulationVoltage":"from the manufacturer for the capital assets limited isolation with given(indicated) operating conditions",
  44. "InstructionsControlDrawing":"designation used to uniquely identify a control/reference drawing stored in a file system",
  45. "SpecificConditionsForUse":"",
  46. "IncompleteDevice":"",
  47. "AmbientConditions":{
  48. "DeviceCategory":"category of device in accordance with directive",
  49. "EquipmentProtectionLeve":"part of a hazardous area classification system indicating the likelihood of the existence of a classified hazard",
  50. "RegionalSpecificMarking":"Marking used only in specific regions",
  51. "TypeOfProtection":"",
  52. "ExplosionGroup":"",
  53. "MinimumAmbientTemperature":"",
  54. "MaxAmbientTemperature":"",
  55. "MaxSurfaceTemperatureForDustProof":"",
  56. "TemperatureClass":""
  57. },
  58. "ProcessConditions":{
  59. "DeviceCategory":"",
  60. "EquipmentProtectionLeve":"",
  61. "RegionalSpecificMarking":"",
  62. "TypeOfProtection":"",
  63. "ExplosionGroup":"",
  64. "LowerLimitingValueOfProcessTemperature":"",
  65. "UpperLimitingValueOfProcessTemperature":"",
  66. "MaxSurfaceTemperatureForDustProof":"",
  67. "TemperatureClass":""
  68. },
  69. "ExternalElectricalCircuit":{
  70. "DesignationOfElectricalTerminal":"",
  71. "TypeOfProtection":"",
  72. "EquipmentProtectionLevel":"",
  73. "ExplosionGroup":"",
  74. "Characteristics":"",
  75. "Fisco":"",
  76. "TwoWISE":"",
  77. "SafetyRelatedPropertiesForPassiveBehaviour":{
  78. "MaxInputPower":"",
  79. "MaxInputVoltage":"",
  80. "MaxInputCurrent":"",
  81. "MaxInternalCapacitance":"",
  82. "MaxInternalInductance":"",
  83. },
  84. "SafetyRelatedPropertiesForActiveBehaviour":{
  85. "MaxOutputPower":"",
  86. "MaxOutputVoltage":"",
  87. "MaxOutputCurrent":"",
  88. "MaxExternalCapacitance":"",
  89. "MaxExternalInductance":"",
  90. "MaxExternalInductanceResistanceRatio":"",
  91. }
  92. }
  93. }
  94. }
  95. },
  96. "AssetSpecificProperties": "Group of properties that are listed on the asset's nameplate and are grouped based on guidelines",
  97. }

将该文件以PDF 格式上传给KIMI。然后开始对话 

KIMI 的会话

“你是一个工业4.0 专家,请构建一个锅炉的数字铭牌的子管理壳模型”

输出

  1. {
  2. "submodelId": "urn:company:submodel:nameplate:boiler",
  3. "submodelName": "Boiler Nameplate",
  4. "description": "Digital nameplate for industrial boiler",
  5. "semanticId": "http://www.example.com/boiler-nameplate",
  6. "globalAssetId": "urn:company:asset:boiler123",
  7. "ManufacturerName": "ABC Boiler Systems Ltd.",
  8. "ManufacturerProductDesignation": "Industrial Steam Boiler",
  9. "ContactInformation": {
  10. "Street": "123 Industrial Park Road",
  11. "Zipcode": "12345",
  12. "CityTown": "Metropolis City",
  13. "NationalCode": "US",
  14. "Phone": "555-1234",
  15. "Fax": "555-5678",
  16. "Email": "info@abcboiler.com",
  17. "IPCommunication": {
  18. "IP": "192.168.1.10",
  19. "Port": "80"
  20. }
  21. },
  22. "ManufacturerProductRoot": "Boilers",
  23. "ManufacturerProductType": "Steam Boiler",
  24. "OrderCodeOfManufacturer": "BTL-100-S",
  25. "ProductArticleNumberOfManufacturer": "BTL100S-001",
  26. "SerialNumber": "SN2023040123456",
  27. "YearOfConstruction": "2023",
  28. "HardwareVersion": "HW1.0",
  29. "FirmwareVersion": "FW1.0",
  30. "SoftwareVersion": "SW1.0",
  31. "CountryOfOrigin": "USA",
  32. "CompanyLogo": "http://www.abcboiler.com/logo.png",
  33. "Markings": {
  34. "MarkingName": "CE Mark",
  35. "DesignationOfCertificateOrApproval": "CE123456",
  36. "IssueDate": "2023-01-01",
  37. "ExpiryDate": "2026-01-01",
  38. "MarkingFile": "http://www.abcboiler.com/cert/CE123456.png",
  39. "MarkingAdditionalText": "Notified Body ID: NB789"
  40. },
  41. "ExplosionSafeties": {
  42. // 省略了详细内容,根据实际安全标准和认证进行填充
  43. },
  44. "AssetSpecificProperties": {
  45. "BoilerType": "Fire-Tube",
  46. "FuelType": "Natural Gas",
  47. "OutputCapacity": "1000 kg/h",
  48. "WorkingPressure": "15 bar",
  49. "SafetyValveRating": "16 bar",
  50. "Efficiency": "85%",
  51. "ControlSystem": "Automatic with Remote Monitoring"
  52. }
  53. }

实验-2 构建反应釜的数字铭牌

KIMI 会话

“你是一个工业4.0 专家,请构建一个反应釜的数字铭牌的子管理壳模型”

回答

  1. {
  2. "submodelId": "urn:company:submodel:nameplate:reactor",
  3. "submodelName": "Reactor Nameplate",
  4. "description": "Digital nameplate containing key information about the reactor",
  5. "semanticId": "http://www.example.com/nameplate#reactor",
  6. "globalAssetId": "urn:company:asset:reactor456",
  7. "ManufacturerName": "Chemical Processing Inc.",
  8. "ManufacturerProductDesignation": "Stainless Steel Reaction Vessel",
  9. "ContactInformation": {
  10. "Street": "200 Chemical Road",
  11. "Zipcode": "54321",
  12. "CityTown": "Industrial City",
  13. "NationalCode": "DE",
  14. "Phone": {
  15. "countryCode": "49",
  16. "areaCode": "69",
  17. "number": "123-456-789"
  18. },
  19. "Fax": {
  20. "countryCode": "49",
  21. "areaCode": "69",
  22. "number": "123-456-098"
  23. },
  24. "Email": "info@chemicalprocessing.com",
  25. "IPCommunication": {
  26. "IP": "192.168.1.20",
  27. "Protocol": "HTTPS"
  28. }
  29. },
  30. "ManufacturerProductRoot": "Reaction Vessels",
  31. "ManufacturerProductType": "Agitated Reactor",
  32. "OrderCodeOfManufacturer": "CPI-RXV-200",
  33. "ProductArticleNumberOfManufacturer": "ART-2002",
  34. "SerialNumber": "SN2023000567",
  35. "YearOfConstruction": "2023",
  36. "HardwareVersion": "HWv1.2",
  37. "FirmwareVersion": "FWv1.1",
  38. "SoftwareVersion": "SWv2.2",
  39. "CountryOfOrigin": "Germany",
  40. "CompanyLogo": "http://www.chemicalprocessing.com/logo.png",
  41. "Markings": {
  42. "MarkingName": "Pressure Vessel Certification",
  43. "DesignationOfCertificateOrApproval": "PVC-2023-789",
  44. "IssueDate": "2023-02-10",
  45. "ExpiryDate": "2026-02-10",
  46. "MarkingFile": "http://www.chemicalprocessing.com/cert/PVC-2023-789.png",
  47. "MarkingAdditionalText": "Certification Body: Pressure Vessel Certifiers Ltd."
  48. },
  49. "AssetSpecificProperties": {
  50. "VesselType": "Stainless Steel Reactor",
  51. "VolumeCapacity": "2000 Liters",
  52. "WorkingPressure": "10 bar",
  53. "TemperatureRange": "-20°C to 200°C",
  54. "AgitationSpeed": "0 to 500 RPM",
  55. "HeatingMethod": "Electric",
  56. "MaterialOfConstruction": "304 Stainless Steel",
  57. "DesignCode": "ASME Section VIII, Div. 1",
  58. "SafetyFeatures": "Pressure relief valve, temperature control system"
  59. }
  60. }

实验表明,我们可以根据标准和规范直接生成各种模型。 构建OPCUA 及其配套规范也是可行的。

结论

下一步我们的工作:

  • 依据OPC UA 和I4.0 AAS 规范构建更多的产品模型的模板
  • 收集产品的规格书(datasheet)

   根据产品的datasheet 直接生成产品信息模型,是LLM 擅长的工作。它将对开放自动化系统产生深远的影响。在这之前,仍然有许多基础工作需要完成。没有数据基础,贸然推广应用收到惊艳的 效果。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/煮酒与君饮/article/detail/1018676
推荐阅读
相关标签
  

闽ICP备14008679号