From 58097e4d129af684ce3ef2853132629b7b9c5b38 Mon Sep 17 00:00:00 2001 From: ringo Date: Thu, 21 May 2026 21:52:31 +0800 Subject: [PATCH] initial commit: schema-building.json and schema-energy.json --- .gitignore | 6 + README.md | 172 +++++++++++++++++++ schema-building.json | 388 +++++++++++++++++++++++++++++++++++++++++++ schema-energy.json | 201 ++++++++++++++++++++++ 4 files changed, 767 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 schema-building.json create mode 100644 schema-energy.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5a170dd --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +node_modules/ +dist/ +*.pyc +__pycache__/ +.DS_Store +*.egg-info/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..7478c1a --- /dev/null +++ b/README.md @@ -0,0 +1,172 @@ +# archgen-schema + +统一建筑数据模型(Unified Building Design Schema)。 + +## 仓库文件 + +| 文件 | 说明 | +|------|------| +| `schema-building.json` | 建筑几何 + 核心实体(Building, Floor, Room, Aperture, Boundary, Element, Shaft 等) | +| `schema-energy.json` | 能耗模拟领域(Material, Construction, RoomProgram, Schedule 等) | + +## Schema 规则 + +### 1. JSON 为唯一真理源 + +所有类型定义以 JSON 文件为准。TypeScript / Python 等语言的绑定代码均从 JSON 生成,不得手工维护。 + +### 2. 不保存派生数据 + +Schema 只保存**原始定义数据**,不包含任何可从已有字段计算得出的值。 + +``` +❌ area — 可由 region 计算 +❌ volume — 可由 region + height 计算 +❌ boundingBox — 可由子实体几何计算 +✅ region — 房间轮廓点集 +✅ height — 房间高度 +``` + +### 3. 字段命名 + +| 规则 | 示例 | +|------|------| +| 使用 camelCase | `siteBasePoint`, `sillHeight`, `openRatio` | +| 避免缩写(广为人知的除外) | `identifier` 而非 `id`, `displayName` 而非 `name` | +| 布尔值用正面语义 | `operable` 而非 `nonOperable` | +| 枚举值用 snake_case | `exterior_wall`, `curtain_wall` | + +### 4. 类型系统 + +**基础类型:** +- `string` — 字符串 +- `number` — 浮点数 +- `integer` — 整数 +- `boolean` — 布尔值 +- `object` — 任意对象 + +**复合类型:** +- `TypeName[]` — 数组,如 `Polyline3d` 的 `points` 字段类型为 `Point3d[]` +- `TypeName` — 引用自定义类型或实体 + +**自定义类型**定义在 `types` 段,描述纯数据结构,不是业务实体。例如 `Point3d`(三维点)、`Polyline3d`(多段线)、`TimePoint`(时刻点)。 + +### 5. 实体结构 + +```json +"EntityName": { + "description": "中文说明", + "tags": { "scale": ["building"], "simulation": ["energy"] }, + "attributes": { + "fieldName": { + "type": "string", + "required": true, + "unit": "m", + "default": 0, + "description": "字段说明", + "tags": { "scale": ["building"], "simulation": ["energy", "daylight"] } + } + }, + "children": { + "childName": { + "type": "ChildEntity", + "multiple": true, + "description": "子实体说明" + } + } +} +``` + +- `attributes` — 标量字段(string, number, boolean, enum, 自定义类型) +- `children` — 关联的子实体(1:1 或 1:N) +- `required: true` — 必填字段,序列化时必须存在 +- `default` — 缺省值(可选字段未提供时使用) +- `unit` — 单位标注(仅文档用途) + +### 6. 判别联合体(Discriminated Union) + +当一个实体存在多种形态时,使用 `variants` 表达: + +```json +"Room": { + "discriminator": "creationMethod", + "variants": { + "planar_extrude": { ... }, + "mass_slice": { ... }, + "manual": { ... } + } +} +``` + +不同变体可包含不同的必填字段。判别字段的值决定了使用哪个变体。当前使用判别联合体的实体: +- `Room` — 判别字段 `creationMethod`,变体:`planar_extrude`、`mass_slice`、`manual` +- `Aperture` — 判别字段 `sourceType`,变体:`hosted`、`declarative` + +### 7. 枚举 + +枚举定义在 `enums` 段,每个枚举列出所有允许值。 + +### 8. 尺度与模拟类型标签(tags) + +每个字段可标注两个维度的标签: + +**尺度(scale):** +| 标签 | 说明 | +|------|------| +| `building` | 建筑尺度 | +| `community` | 社区/街区尺度 | +| `urban` | 城市尺度 | + +**模拟类型(simulation):** +| 标签 | 说明 | +|------|------| +| `energy` | 能耗模拟 | +| `daylight` | 采光分析 | +| `solar` | 日照分析 | +| `thermal_comfort` | 热舒适分析 | +| `carbon` | 碳排放核算 | +| `wind` | 风环境模拟 | +| `general` | 通用(不特定于某种模拟) | + +标签用于快速筛选特定尺度或某类模拟分析所需的字段。例如: + +```json +"northAngle": { + "type": "number", + "tags": { "simulation": ["energy", "daylight", "solar", "thermal_comfort", "wind"] } +} +``` + +表示 `northAngle` 对能耗、采光、日照、热舒适、风环境模拟均有影响。 + +```json +"embodiedCarbon": { + "type": "number", + "tags": { "scale": ["building", "community", "urban"], "simulation": ["carbon"] } +} +``` + +表示 `embodiedCarbon` 适用于建筑/社区/城市三个尺度,仅用于碳排放核算。 + +### 9. 不绑定特定工具 + +Schema 中不出现特定软件、工具或 DSL 的名称(如 GSA、AML、BSS、ant-model)。Schema 只描述**建筑数据本身**,不描述数据的生成方式。 + +## 使用方式 + +各项目从 JSON schema 生成对应语言的类型代码: + +```bash +# TypeScript(示例) +python3 scripts/gen-ts.py schema-building.json > dist/building.d.ts + +# Python Pydantic(示例) +python3 scripts/gen-py.py schema-building.json > archgen_schema/building.py +``` + +具体生成器不在本仓库维护,由各消费项目自行管理。 + + +建筑/社区尺度最小化的字段需要确定一个规则。默认或者非默认需要有个判定。 可能有md/skill来规范化操作。 +影响性能的要素需要捋清楚 +什么是智能优化?形态优化,还是需要性能目标? \ No newline at end of file diff --git a/schema-building.json b/schema-building.json new file mode 100644 index 0000000..01323a9 --- /dev/null +++ b/schema-building.json @@ -0,0 +1,388 @@ +{ + "archgen": { + "version": "0.1.0", + "description": "ArchGen Schema — 建筑几何与核心实体", + "tags": { + "scale": { + "building": "建筑尺度", + "community": "社区/街区尺度", + "urban": "城市尺度" + }, + "simulation": { + "energy": "能耗模拟", + "daylight": "采光分析", + "solar": "日照分析", + "thermal_comfort": "热舒适分析", + "carbon": "碳排放核算", + "wind": "风环境模拟", + "general": "通用(不特定于某种模拟)" + } + } + }, + + "types": { + "Point3d": { + "description": "三维点坐标", + "fields": { + "x": { "type": "number", "default": 0 }, + "y": { "type": "number", "default": 0 }, + "z": { "type": "number", "default": 0 } + } + }, + "Polyline3d": { + "description": "三维多段线(点列表)", + "fields": { + "points": { "type": "Point3d[]", "default": [] } + } + }, + "Vector3d": { + "description": "三维向量", + "fields": { + "x": { "type": "number", "default": 0 }, + "y": { "type": "number", "default": 0 }, + "z": { "type": "number", "default": 0 } + } + }, + "Line3d": { + "description": "直线(起点+终点)", + "fields": { + "from": { "type": "Point3d" }, + "to": { "type": "Point3d" } + } + }, + "TimePoint": { + "description": "时刻点 [时, 分]", + "fields": { + "hour": { "type": "integer", "default": 0 }, + "minute": { "type": "integer", "default": 0 } + } + }, + "DatePoint": { + "description": "日期点 [月, 日]", + "fields": { + "month": { "type": "integer", "default": 1 }, + "day": { "type": "integer", "default": 1 } + } + }, + "Period": { + "description": "时间范围", + "fields": { + "start": { "type": "DatePoint" }, + "end": { "type": "DatePoint" } + } + }, + "UVRect": { + "description": "UV 矩形坐标 [u, v, 宽比, 高比]", + "fields": { + "u": { "type": "number" }, + "v": { "type": "number" }, + "widthRatio": { "type": "number" }, + "heightRatio": { "type": "number" } + } + } + }, + + "enums": { + "Direction": { + "description": "朝向", + "values": ["N", "NE", "E", "SE", "S", "SW", "W", "NW"] + }, + "BoundaryType": { + "description": "边界类型", + "values": [ + "exterior_wall", "interior_wall", "curtain_wall", + "roof", "floor", "slab", "foundation" + ] + }, + "ElementType": { + "description": "结构构件类型", + "values": [ + "column", "beam", "slab", "wall", + "foundation", "stair", "ramp" + ] + }, + "ApertureGeometryType": { + "description": "洞口几何类型", + "values": ["window", "door", "curtain_wall", "generic"] + }, + "ApertureContextType": { + "description": "洞口内外上下文", + "values": ["EXTERIOR", "INTERIOR"] + }, + "RoomCreationMethod": { + "description": "房间创建方式", + "values": ["planar_extrude", "mass_slice", "manual"] + }, + "RelationType": { + "description": "拓扑关系类型", + "values": ["adjacent", "contains", "crosses", "flows", "touches", "sight"] + } + }, + + "entities": { + "Building": { + "description": "建筑顶级实体", + "tags": { "scale": ["building", "community", "urban"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "description": "唯一标识符", "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "description": "显示名称", "tags": { "simulation": ["general"] } }, + "schemaVersion": { "type": "string", "required": true, "description": "archgen-schema 版本", "tags": { "simulation": ["general"] } }, + "siteBasePoint": { "type": "Point3d", "required": true, "description": "建筑基准点", "tags": { "simulation": ["general"] } }, + "northAngle": { "type": "number", "required": true, "default": 0, "description": "建筑正北角度", "tags": { "simulation": ["energy", "daylight", "solar", "thermal_comfort", "wind"] } }, + "globalSettings": { "type": "object", "description": "全局设置", "tags": { "simulation": ["general"] } }, + "metadata": { "type": "object", "description": "自定义元数据", "tags": { "simulation": ["general"] } } + }, + "children": { + "floors": { "type": "Floor", "multiple": true, "description": "楼层列表", "tags": { "scale": ["building", "community"], "simulation": ["general"] } }, + "masses": { "type": "MassEntity", "multiple": true, "description": "参数化体量", "tags": { "scale": ["building"], "simulation": ["general"] } }, + "shafts": { "type": "Shaft", "multiple": true, "description": "竖井", "tags": { "scale": ["building"], "simulation": ["general"] } }, + "shades": { "type": "Shade", "multiple": true, "description": "遮阳", "tags": { "scale": ["building", "community"], "simulation": ["energy", "daylight", "solar", "thermal_comfort"] } }, + "siteShades": { "type": "Shade", "multiple": true, "description": "外部遮阳(树木、邻楼)", "tags": { "scale": ["building", "community", "urban"], "simulation": ["energy", "daylight", "solar", "wind"] } }, + "gridSystem": { "type": "GridSystem", "description": "轴网系统", "tags": { "scale": ["building"], "simulation": ["general"] } }, + "relations": { "type": "Relation", "multiple": true, "description": "拓扑关系", "tags": { "scale": ["building", "community", "urban"], "simulation": ["general"] } } + } + }, + + "Floor": { + "description": "楼层", + "tags": { "scale": ["building", "community"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "description": "唯一标识符", "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "description": "显示名称", "tags": { "simulation": ["general"] } }, + "elevation": { "type": "number", "required": true, "description": "楼层标高 Z", "tags": { "simulation": ["general"] } }, + "height": { "type": "number", "required": true, "description": "层高", "unit": "m", "tags": { "simulation": ["energy", "daylight", "thermal_comfort", "carbon"] } }, + "story": { "type": "integer", "required": true, "description": "楼层序号", "tags": { "simulation": ["general"] } }, + "outline": { "type": "Polyline3d", "description": "楼板轮廓", "tags": { "simulation": ["general"] } }, + "metadata": { "type": "object", "tags": { "simulation": ["general"] } } + }, + "children": { + "rooms": { "type": "Room", "multiple": true, "description": "房间" }, + "apertures": { "type": "Aperture", "multiple": true, "description": "楼层级洞口", "tags": { "scale": ["building"], "simulation": ["energy", "daylight", "wind"] } }, + "elements": { "type": "Element", "multiple": true, "description": "结构构件", "tags": { "scale": ["building"], "simulation": ["general"] } } + } + }, + + "Room": { + "description": "房间", + "tags": { "scale": ["building", "community"] }, + "discriminator": "creationMethod", + "variants": { + "planar_extrude": { + "description": "平面轮廓拉伸创建", + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "tags": { "simulation": ["general"] } }, + "creationMethod": { "type": "RoomCreationMethod", "required": true, "default": "planar_extrude", "tags": { "simulation": ["general"] } }, + "programType": { "type": "string", "description": "房间功能类型", "tags": { "scale": ["building"], "simulation": ["energy", "thermal_comfort", "carbon"] } }, + "region": { "type": "Polyline3d", "required": true, "description": "房间轮廓", "tags": { "simulation": ["energy", "daylight", "solar", "wind", "thermal_comfort"] } }, + "height": { "type": "number", "required": true, "description": "房间高度", "tags": { "simulation": ["energy", "daylight", "thermal_comfort"] } }, + "elevation": { "type": "number", "description": "楼层内 Z 偏移", "tags": { "simulation": ["general"] } }, + "boundaries": { "type": "Boundary[]", "description": "房间边界/墙体", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "apertures": { "type": "string[]", "description": "关联洞口 ID 列表", "tags": { "scale": ["building"], "simulation": ["energy", "daylight", "wind"] } }, + "elements": { "type": "Element[]", "description": "房间内构件", "tags": { "scale": ["building"], "simulation": ["general"] } }, + "geometryDriver": { "type": "object", "description": "几何驱动参数", "tags": { "simulation": ["general"] } }, + "metadata": { "type": "object", "tags": { "simulation": ["general"] } } + } + }, + "mass_slice": { + "description": "体量切片创建", + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "tags": { "simulation": ["general"] } }, + "creationMethod": { "type": "RoomCreationMethod", "required": true, "default": "mass_slice", "tags": { "simulation": ["general"] } }, + "programType": { "type": "string", "tags": { "scale": ["building"], "simulation": ["energy", "thermal_comfort", "carbon"] } }, + "region": { "type": "Polyline3d", "required": true, "tags": { "simulation": ["energy", "daylight", "solar", "wind", "thermal_comfort"] } }, + "height": { "type": "number", "required": true, "tags": { "simulation": ["energy", "daylight", "thermal_comfort"] } }, + "elevation": { "type": "number", "tags": { "simulation": ["general"] } }, + "boundaries": { "type": "Boundary[]", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "apertures": { "type": "string[]", "tags": { "scale": ["building"], "simulation": ["energy", "daylight", "wind"] } }, + "elements": { "type": "Element[]", "tags": { "scale": ["building"], "simulation": ["general"] } }, + "driverRef": { + "type": "object", "required": true, "description": "体量引用", + "tags": { "simulation": ["general"] }, + "attributes": { + "massId": { "type": "string", "required": true }, + "sliceZ": { "type": "number", "required": true } + } + }, + "metadata": { "type": "object", "tags": { "simulation": ["general"] } } + } + }, + "manual": { + "description": "手动绘制", + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "tags": { "simulation": ["general"] } }, + "creationMethod": { "type": "RoomCreationMethod", "required": true, "default": "manual", "tags": { "simulation": ["general"] } }, + "programType": { "type": "string", "tags": { "scale": ["building"], "simulation": ["energy", "thermal_comfort", "carbon"] } }, + "region": { "type": "Polyline3d", "required": true, "tags": { "simulation": ["energy", "daylight", "solar", "wind", "thermal_comfort"] } }, + "height": { "type": "number", "required": true, "tags": { "simulation": ["energy", "daylight", "thermal_comfort"] } }, + "elevation": { "type": "number", "tags": { "simulation": ["general"] } }, + "boundaries": { "type": "Boundary[]", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "apertures": { "type": "string[]", "tags": { "scale": ["building"], "simulation": ["energy", "daylight", "wind"] } }, + "elements": { "type": "Element[]", "tags": { "scale": ["building"], "simulation": ["general"] } }, + "metadata": { "type": "object", "tags": { "simulation": ["general"] } } + } + } + } + }, + + "Aperture": { + "description": "建筑洞口", + "tags": { "scale": ["building"], "simulation": ["energy", "daylight", "solar", "wind"] }, + "discriminator": "sourceType", + "variants": { + "hosted": { + "description": "绑定到特定形体面", + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "tags": { "simulation": ["general"] } }, + "sourceType": { "type": "string", "required": true, "default": "hosted", "tags": { "simulation": ["general"] } }, + "geometryType": { "type": "ApertureGeometryType", "required": true, "tags": { "simulation": ["energy", "daylight", "solar", "wind"] } }, + "width": { "type": "number", "tags": { "simulation": ["energy", "daylight"] } }, + "height": { "type": "number", "tags": { "simulation": ["energy", "daylight"] } }, + "sillHeight": { "type": "number", "description": "窗台高", "tags": { "simulation": ["energy", "daylight"] } }, + "parent": { "type": "string", "description": "父实体 ID", "tags": { "simulation": ["general"] } }, + "rooms": { "type": "string[]", "description": "相邻房间 ID", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "openRatio": { "type": "number", "default": 0, "description": "开启比", "tags": { "simulation": ["energy", "wind", "thermal_comfort"] } }, + "operable": { "type": "boolean", "default": false, "tags": { "simulation": ["energy", "wind", "thermal_comfort"] } }, + "hosting": { + "type": "object", "required": true, "description": "宿主绑定信息", + "tags": { "simulation": ["general"] }, + "attributes": { + "hostId": { "type": "string", "required": true }, + "faceIndex": { "type": "integer", "required": true }, + "uvRect": { "type": "UVRect", "required": true }, + "context": { "type": "ApertureContextType", "required": true } + } + }, + "metadata": { "type": "object", "tags": { "simulation": ["general"] } } + } + }, + "declarative": { + "description": "声明式放置", + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "tags": { "simulation": ["general"] } }, + "sourceType": { "type": "string", "required": true, "default": "declarative", "tags": { "simulation": ["general"] } }, + "geometryType": { "type": "ApertureGeometryType", "required": true, "tags": { "simulation": ["energy", "daylight", "solar", "wind"] } }, + "width": { "type": "number", "tags": { "simulation": ["energy", "daylight"] } }, + "height": { "type": "number", "tags": { "simulation": ["energy", "daylight"] } }, + "sillHeight": { "type": "number", "tags": { "simulation": ["energy", "daylight"] } }, + "parent": { "type": "string", "tags": { "simulation": ["general"] } }, + "rooms": { "type": "string[]", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "openRatio": { "type": "number", "default": 0, "tags": { "simulation": ["energy", "wind", "thermal_comfort"] } }, + "operable": { "type": "boolean", "default": false, "tags": { "simulation": ["energy", "wind", "thermal_comfort"] } }, + "placement": { + "type": "object", "description": "放置描述", + "tags": { "simulation": ["general"] }, + "attributes": { + "boundaryId": { "type": "string" }, + "position": { "type": "string", "description": "center, start, end 或距离" }, + "orientation": { "type": "Direction" } + } + }, + "metadata": { "type": "object", "tags": { "simulation": ["general"] } } + } + } + } + }, + + "Boundary": { + "description": "空间边界/墙体", + "tags": { "scale": ["building", "community"], "simulation": ["energy", "thermal_comfort", "carbon"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "tags": { "simulation": ["general"] } }, + "type": { "type": "BoundaryType", "required": true, "tags": { "simulation": ["energy", "thermal_comfort", "carbon"] } }, + "region": { "type": "Polyline3d", "required": true, "description": "边界线段或多边形", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "thickness": { "type": "number", "description": "墙厚", "unit": "m", "tags": { "scale": ["building"], "simulation": ["energy", "thermal_comfort", "carbon"] } }, + "height": { "type": "number", "description": "墙高", "unit": "m", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "direction": { "type": "Direction", "description": "朝向", "tags": { "simulation": ["energy", "daylight", "solar"] } }, + "pitch": { "type": "number", "description": "倾斜角度", "unit": "deg", "tags": { "simulation": ["energy", "solar"] } }, + "hostRoomId": { "type": "string", "description": "所属房间 ID", "tags": { "simulation": ["general"] } }, + "constructionId": { "type": "string", "description": "构造 ID", "tags": { "simulation": ["energy", "thermal_comfort", "carbon"] } }, + "sharedBy": { "type": "string[]", "description": "共享此边界的房间 ID 列表", "tags": { "simulation": ["thermal_comfort"] } }, + "metadata": { "type": "object", "tags": { "simulation": ["general"] } } + } + }, + + "Element": { + "description": "结构构件", + "tags": { "scale": ["building"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "tags": { "simulation": ["general"] } }, + "type": { "type": "ElementType", "required": true, "tags": { "simulation": ["general"] } }, + "region": { "type": "Polyline3d", "description": "截面轮廓", "tags": { "simulation": ["general"] } }, + "height": { "type": "number", "unit": "m", "tags": { "simulation": ["general"] } }, + "materialId": { "type": "string", "description": "材料 ID", "tags": { "simulation": ["carbon"] } }, + "metadata": { "type": "object", "tags": { "simulation": ["general"] } } + } + }, + + "MassEntity": { + "description": "参数化体量", + "tags": { "scale": ["building"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "tags": { "simulation": ["general"] } }, + "region": { "type": "Polyline3d", "tags": { "simulation": ["general"] } }, + "height": { "type": "number", "unit": "m", "tags": { "simulation": ["general"] } }, + "metadata": { "type": "object", "tags": { "simulation": ["general"] } } + } + }, + + "Shaft": { + "description": "竖井(楼梯/电梯/管道)", + "tags": { "scale": ["building"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "tags": { "simulation": ["general"] } }, + "type": { "type": "string", "description": "stair/elevator/duct", "tags": { "simulation": ["general"] } }, + "spanLevels": { "type": "string[]", "description": "穿越的楼层 ID", "tags": { "simulation": ["general"] } }, + "region": { "type": "Polyline3d", "description": "竖井截面", "tags": { "simulation": ["general"] } }, + "metadata": { "type": "object", "tags": { "simulation": ["general"] } } + } + }, + + "Shade": { + "description": "遮阳构件", + "tags": { "scale": ["building", "community"], "simulation": ["energy", "daylight", "solar", "thermal_comfort"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "tags": { "simulation": ["general"] } }, + "region": { "type": "Polyline3d", "description": "遮阳轮廓", "tags": { "simulation": ["energy", "daylight", "solar", "thermal_comfort"] } }, + "height": { "type": "number", "unit": "m", "tags": { "simulation": ["energy", "daylight", "solar"] } }, + "transmittance": { "type": "number", "default": 0, "description": "透射率 0-1", "tags": { "simulation": ["energy", "daylight", "solar"] } }, + "metadata": { "type": "object", "tags": { "simulation": ["general"] } } + } + }, + + "GridSystem": { + "description": "轴网系统", + "tags": { "scale": ["building"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "tags": { "simulation": ["general"] } }, + "axisX": { "type": "string[]", "description": "X 向轴线名", "tags": { "simulation": ["general"] } }, + "axisY": { "type": "string[]", "description": "Y 向轴线名", "tags": { "simulation": ["general"] } }, + "spacingsX": { "type": "number[]", "description": "X 向跨距", "unit": "m", "tags": { "simulation": ["general"] } }, + "spacingsY": { "type": "number[]", "description": "Y 向跨距", "unit": "m", "tags": { "simulation": ["general"] } }, + "origin": { "type": "Point3d", "required": true, "description": "轴网原点", "tags": { "simulation": ["general"] } }, + "metadata": { "type": "object", "tags": { "simulation": ["general"] } } + } + }, + + "Relation": { + "description": "拓扑关系边", + "tags": { "scale": ["building", "community", "urban"] }, + "attributes": { + "type": { "type": "RelationType", "required": true, "tags": { "simulation": ["general"] } }, + "source": { "type": "string", "required": true, "description": "源实体 ID", "tags": { "simulation": ["general"] } }, + "target": { "type": "string", "required": true, "description": "目标实体 ID", "tags": { "simulation": ["general"] } }, + "metadata": { "type": "object", "tags": { "simulation": ["general"] } } + } + } + } +} diff --git a/schema-energy.json b/schema-energy.json new file mode 100644 index 0000000..baa6ab0 --- /dev/null +++ b/schema-energy.json @@ -0,0 +1,201 @@ +{ + "archgen": { + "version": "0.1.0", + "description": "ArchGen Schema — 能耗模拟领域", + "tags": { + "scale": { + "building": "建筑尺度", + "community": "社区/街区尺度", + "urban": "城市尺度" + }, + "simulation": { + "energy": "能耗模拟", + "daylight": "采光分析", + "solar": "日照分析", + "thermal_comfort": "热舒适分析", + "carbon": "碳排放核算", + "wind": "风环境模拟", + "general": "通用" + } + } + }, + + "types": { + "TimePoint": { + "description": "时刻点 [时, 分]", + "fields": { + "hour": { "type": "integer", "default": 0 }, + "minute": { "type": "integer", "default": 0 } + } + }, + "DatePoint": { + "description": "日期点 [月, 日]", + "fields": { + "month": { "type": "integer", "default": 1 }, + "day": { "type": "integer", "default": 1 } + } + }, + "Period": { + "description": "时间范围", + "fields": { + "start": { "type": "DatePoint" }, + "end": { "type": "DatePoint" } + } + } + }, + + "enums": { + "MaterialType": { + "description": "材料类型", + "values": ["EnergyMaterial", "EnergyMaterialNoMass", "EnergyWindowMaterialSimpleGlazSys"] + }, + "ConstructionType": { + "description": "构造类型", + "values": ["OpaqueConstruction", "WindowConstruction"] + }, + "Roughness": { + "description": "表面粗糙度", + "values": ["VeryRough", "Rough", "MediumRough", "MediumSmooth", "Smooth", "VerySmooth"] + } + }, + + "entities": { + "MaterialProps": { + "description": "材料热工物理属性", + "tags": { "scale": ["building", "community"], "simulation": ["energy", "thermal_comfort", "carbon"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "tags": { "simulation": ["general"] } }, + "type": { "type": "MaterialType", "default": "EnergyMaterial", "tags": { "simulation": ["energy", "carbon"] } }, + "conductivity": { "type": "number", "default": 1, "unit": "W/m·K", "description": "导热系数", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "specificHeat": { "type": "number", "default": 100, "unit": "J/kg·K", "description": "热容", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "density": { "type": "number", "default": 1000, "unit": "kg/m³", "description": "密度", "tags": { "simulation": ["energy", "carbon"] } }, + "thickness": { "type": "number", "default": 100, "unit": "mm", "description": "厚度", "tags": { "simulation": ["energy", "thermal_comfort", "carbon"] } }, + "roughness": { "type": "Roughness", "default": "MediumRough", "description": "表面粗糙度", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "thermalAbsorptance": { "type": "number", "default": 0.9, "description": "热吸收率", "tags": { "scale": ["building"], "simulation": ["energy", "thermal_comfort"] } }, + "solarAbsorptance": { "type": "number", "default": 0.9, "description": "太阳吸收率", "tags": { "simulation": ["energy", "daylight", "solar", "thermal_comfort"] } }, + "visibleAbsorptance": { "type": "number", "default": 0.9, "description": "可见光吸收率", "tags": { "scale": ["building"], "simulation": ["daylight"] } }, + "rValue": { "type": "number", "unit": "m²·K/W", "description": "热阻", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "uFactor": { "type": "number", "unit": "W/m²·K", "description": "传热系数", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "shgc": { "type": "number", "default": 0.6, "description": "太阳得热系数", "tags": { "simulation": ["energy", "daylight", "solar", "thermal_comfort"] } }, + "vt": { "type": "number", "default": 0.6, "description": "可见光透射比", "tags": { "simulation": ["daylight"] } }, + "embodiedCarbon": { "type": "number", "default": 0, "unit": "kgCO₂/m²", "description": "隐含碳排放", "tags": { "scale": ["building", "community", "urban"], "simulation": ["carbon"] } }, + "embodiedEnergy": { "type": "number", "default": 0, "unit": "MJ/m²", "description": "隐含能耗", "tags": { "scale": ["building", "community", "urban"], "simulation": ["carbon"] } } + } + }, + + "Construction": { + "description": "单一构造定义(包含多层材料)", + "tags": { "scale": ["building"], "simulation": ["energy", "thermal_comfort", "carbon"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "type": { "type": "ConstructionType", "default": "OpaqueConstruction", "tags": { "simulation": ["energy", "thermal_comfort", "carbon"] } } + }, + "children": { + "materials": { "type": "MaterialProps", "multiple": true, "description": "材料层列表(从外到内)", "tags": { "simulation": ["energy", "thermal_comfort", "carbon"] } } + } + }, + + "SubSet": { + "description": "特定部位的构造组合", + "tags": { "scale": ["building"], "simulation": ["energy", "thermal_comfort", "carbon"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "type": { "type": "string", "tags": { "simulation": ["general"] } }, + "exteriorConstruction": { "type": "Construction", "description": "外部构造", "tags": { "simulation": ["energy", "thermal_comfort", "carbon"] } }, + "interiorConstruction": { "type": "Construction", "description": "内部构造", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "groundConstruction": { "type": "Construction", "description": "地面构造", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "overheadConstruction": { "type": "Construction", "description": "顶棚构造", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "skylightConstruction": { "type": "Construction", "description": "天窗构造", "tags": { "simulation": ["energy", "daylight"] } }, + "operableConstruction": { "type": "Construction", "description": "可开启构造", "tags": { "simulation": ["energy", "wind"] } }, + "windowConstruction": { "type": "Construction", "description": "窗户构造", "tags": { "simulation": ["energy", "daylight", "solar"] } } + } + }, + + "ConstructionSet": { + "description": "全楼构造合集", + "tags": { "scale": ["building"], "simulation": ["energy", "thermal_comfort", "carbon"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "airBoundaryConstruction": { "type": "string", "description": "空气边界构造 ID", "tags": { "simulation": ["energy"] } }, + "shadeConstruction": { "type": "string", "description": "遮阳构造 ID", "tags": { "simulation": ["energy", "daylight", "solar"] } } + }, + "children": { + "wallSet": { "type": "SubSet", "description": "墙体构造", "tags": { "simulation": ["energy", "thermal_comfort", "carbon"] } }, + "floorSet": { "type": "SubSet", "description": "楼板构造", "tags": { "simulation": ["energy", "thermal_comfort", "carbon"] } }, + "roofCeilingSet": { "type": "SubSet", "description": "屋顶/顶棚构造", "tags": { "simulation": ["energy", "thermal_comfort", "carbon"] } }, + "doorSet": { "type": "SubSet", "description": "门构造", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "apertureSet": { "type": "SubSet", "description": "洞口构造", "tags": { "simulation": ["energy", "daylight", "solar"] } } + } + }, + + "RoomProgram": { + "description": "房间功能程序定义(人员、灯光、设备等热增益参数)", + "tags": { "scale": ["building"], "simulation": ["energy", "thermal_comfort", "carbon"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "peopleDensity": { "type": "number", "default": 0.0333, "unit": "people/m²", "description": "人员密度", "tags": { "simulation": ["energy", "thermal_comfort", "carbon"] } }, + "lightingDensity": { "type": "number", "default": 0, "unit": "W/m²", "description": "照明功率密度", "tags": { "simulation": ["energy", "daylight", "carbon"] } }, + "equipmentDensity": { "type": "number", "default": 0, "unit": "W/m²", "description": "设备功率密度", "tags": { "simulation": ["energy", "carbon"] } }, + "infiltrationCoefficient": { "type": "number", "default": 0.0003, "unit": "m³/s·m²", "description": "渗透风系数", "tags": { "simulation": ["energy", "wind", "thermal_comfort"] } }, + "heatingSetpoint": { "type": "number", "default": 18, "unit": "°C", "description": "采暖设定温度", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "coolingSetpoint": { "type": "number", "default": 26, "unit": "°C", "description": "制冷设定温度", "tags": { "simulation": ["energy", "thermal_comfort"] } } + }, + "children": { + "occupancySchedule": { "type": "ScheduleRuleset", "description": "人员在室率排程", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "lightingSchedule": { "type": "ScheduleRuleset", "description": "照明使用率排程", "tags": { "simulation": ["energy", "daylight"] } }, + "equipmentSchedule": { "type": "ScheduleRuleset", "description": "设备使用率排程", "tags": { "simulation": ["energy"] } }, + "infiltrationSchedule": { "type": "ScheduleRuleset", "description": "渗透风排程", "tags": { "simulation": ["energy", "wind"] } }, + "heatingSchedule": { "type": "ScheduleRuleset", "description": "采暖设定温度排程", "tags": { "simulation": ["energy", "thermal_comfort"] } }, + "coolingSchedule": { "type": "ScheduleRuleset", "description": "制冷设定温度排程", "tags": { "simulation": ["energy", "thermal_comfort"] } } + } + }, + + "ScheduleDay": { + "description": "单一全天时刻值序列定义", + "tags": { "simulation": ["general"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "times": { "type": "TimePoint[]", "description": "时刻点列表", "tags": { "simulation": ["general"] } }, + "values": { "type": "number[]", "description": "对应时刻的值列表", "tags": { "simulation": ["general"] } }, + "interpolate": { "type": "boolean", "default": false, "description": "是否插值", "tags": { "simulation": ["general"] } } + } + }, + + "ScheduleRule": { + "description": "基于日期范围与星期的排程应用规则", + "tags": { "simulation": ["general"] }, + "attributes": { + "startDate": { "type": "DatePoint", "required": true, "description": "规则开始日期", "tags": { "simulation": ["general"] } }, + "endDate": { "type": "DatePoint", "required": true, "description": "规则结束日期", "tags": { "simulation": ["general"] } }, + "applyMonday": { "type": "boolean", "default": true, "tags": { "simulation": ["general"] } }, + "applyTuesday": { "type": "boolean", "default": true, "tags": { "simulation": ["general"] } }, + "applyWednesday": { "type": "boolean", "default": true, "tags": { "simulation": ["general"] } }, + "applyThursday": { "type": "boolean", "default": true, "tags": { "simulation": ["general"] } }, + "applyFriday": { "type": "boolean", "default": true, "tags": { "simulation": ["general"] } }, + "applySaturday": { "type": "boolean", "default": true, "tags": { "simulation": ["general"] } }, + "applySunday": { "type": "boolean", "default": true, "tags": { "simulation": ["general"] } } + }, + "children": { + "scheduleDay": { "type": "ScheduleDay", "description": "关联的日排程", "tags": { "simulation": ["general"] } } + } + }, + + "ScheduleRuleset": { + "description": "排程规则集(包含默认值与特殊规则)", + "tags": { "simulation": ["general"] }, + "attributes": { + "identifier": { "type": "string", "required": true, "tags": { "simulation": ["general"] } }, + "displayName": { "type": "string", "tags": { "simulation": ["general"] } } + }, + "children": { + "defaultDaySchedule": { "type": "ScheduleDay", "description": "默认日排程", "tags": { "simulation": ["general"] } }, + "scheduleRules": { "type": "ScheduleRule", "multiple": true, "description": "特殊规则列表", "tags": { "simulation": ["general"] } }, + "daySchedules": { "type": "ScheduleDay", "multiple": true, "description": "所有日排程列表", "tags": { "simulation": ["general"] } } + } + } + } +}