综合平台编程器项目的远程存储
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

54 lines
1.6 KiB

  1. #pragma once
  2. #include "alarm_model.h"
  3. #include "control_logic_model.h"
  4. #include "hmi_model.h"
  5. #include <string>
  6. #include <vector>
  7. // 工程级 M/D 注释,只描述地址含义,不保存实时值
  8. struct RegisterComment
  9. {
  10. RegisterAddress address{RegisterArea::M, 0};
  11. std::string text;
  12. // 校验地址有效性和 UTF-8 文本长度
  13. bool validate(std::string *error = nullptr) const;
  14. };
  15. // 描述工程的基本身份和文件格式信息
  16. struct ProjectMetadata
  17. {
  18. // 工程唯一标识
  19. std::string id;
  20. // 工程显示名称
  21. std::string name;
  22. // 工程文件格式版本
  23. std::string formatVersion = "1.0";
  24. };
  25. // 聚合工程中的 HMI 页面、报警、寄存器注释和控制逻辑
  26. struct Project
  27. {
  28. // 工程基本信息
  29. ProjectMetadata metadata;
  30. // 工程包含的 HMI 页面集合
  31. std::vector<HmiPage> hmiPages;
  32. // 进入运行态时显示的初始 HMI 页面
  33. std::string initialHmiPageId;
  34. // 工程统一管理的报警定义
  35. std::vector<AlarmDefinition> alarmDefinitions;
  36. // 工程级 M/D 地址注释,不包含当前值和引用位置
  37. std::vector<RegisterComment> registerComments;
  38. // 工程包含的控制逻辑集合
  39. std::vector<ControlLogic> controlLogics;
  40. // 按地址查找工程注释,找不到时返回 nullptr
  41. const RegisterComment *findRegisterComment(const RegisterAddress &address) const;
  42. // 编辑态校验:允许尚未绑定完成的草稿
  43. bool validate(std::string *error = nullptr) const;
  44. // 运行态校验:额外要求所有运行所需对象都已配置
  45. bool validateForRunning(std::string *error = nullptr) const;
  46. };