feat: 优化电缆规格显示和更新项目配置

- GUI电缆规格表格新增'是否为可选'列,支持显示可选电缆标识
- 修复信息容器初始化问题,确保提示文本正确显示
- 更新使用说明文档,修正适用对象和技术支持信息
- 添加项目配置文件(.gitignore, .python-version, pyproject.toml, uv.lock)
- 添加版本管理脚本(make_version.py)
- 添加Excel数据文件和使用说明PDF文档
This commit is contained in:
dmy
2026-01-06 10:01:11 +08:00
parent 67b1f55b92
commit db6114ef57
10 changed files with 2347 additions and 6 deletions

14
.gitignore vendored Normal file
View File

@@ -0,0 +1,14 @@
# Python-generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info
# Virtual environments
.venv
# Build artifacts
version_info.txt
version.py

1
.python-version Normal file
View File

@@ -0,0 +1 @@
cpython-3.12.12-windows-x86_64-none

14
gui.py
View File

@@ -164,6 +164,12 @@ def index():
"field": "cost", "field": "cost",
"align": "center", "align": "center",
}, },
{
"name": "is_optional",
"label": "是否为可选",
"field": "is_optional",
"align": "center",
},
] ]
rows = [] rows = []
for spec in state["cable_specs"]: for spec in state["cable_specs"]:
@@ -174,6 +180,7 @@ def index():
"capacity": spec[1], "capacity": spec[1],
"resistance": spec[2], "resistance": spec[2],
"cost": spec[3], "cost": spec[3],
"is_optional": "Y" if len(spec) > 4 and spec[4] else "",
} }
) )
ui.table(columns=columns, rows=rows).classes("w-full").props( ui.table(columns=columns, rows=rows).classes("w-full").props(
@@ -914,9 +921,10 @@ def index():
.style("max-height: 400px; overflow-y: auto;") .style("max-height: 400px; overflow-y: auto;")
): ):
refs["info_container"] = ui.column().classes("w-full") refs["info_container"] = ui.column().classes("w-full")
ui.label("请上传 Excel 文件以查看系统参数和电缆规格...").classes( with refs["info_container"]:
"text-gray-500 italic" ui.label("请上传 Excel 文件以查看系统参数和电缆规格...").classes(
) "text-gray-500 italic"
)
with ui.card().classes("w-full p-4 shadow-md"): with ui.card().classes("w-full p-4 shadow-md"):
ui.label("方案对比结果 (点击行查看拓扑详情)").classes( ui.label("方案对比结果 (点击行查看拓扑详情)").classes(

55
make_version.py Normal file
View File

@@ -0,0 +1,55 @@
# make_version.py
import datetime
import os
def create_version_file():
# 1. 生成版本号 (示例:使用 年.月.日.0)
today = datetime.date.today()
# 格式:(2026, 1, 5, 0)
ver_tuple = (today.year, today.month, today.day, 0)
ver_str = f"{today.year}.{today.month}.{today.day}.0"
# 2. 定义版本信息结构 (PyInstaller 格式)
# 语言代码 2052 = 简体中文, 字符集 1200 = Unicode
content = f"""# UTF-8
VSVersionInfo(
ffi=FixedFileInfo(
filevers={ver_tuple},
prodvers={ver_tuple},
mask=0x3f,
flags=0x0,
OS=0x40004,
fileType=0x1,
subtype=0x0,
date=(0, 0)
),
kids=[
StringFileInfo(
[
StringTable(
u'080404b0',
[StringStruct(u'CompanyName', u'中能建西北院海上能源业务开发部'),
StringStruct(u'FileDescription', u'海上风电场集电线路设计优化系统'),
StringStruct(u'FileVersion', u'{ver_str}'),
StringStruct(u'InternalName', u'WindFarmOptimizer'),
StringStruct(u'LegalCopyright', u'Copyright (c) {today.year}'),
StringStruct(u'OriginalFilename', u'海上风电场集电线路设计优化系统.exe'),
StringStruct(u'ProductName', u'海上风电场集电线路设计优化系统'),
StringStruct(u'ProductVersion', u'{ver_str}')])
]),
VarFileInfo([VarStruct(u'Translation', [2052, 1200])])
]
)
"""
with open("version_info.txt", "w", encoding="utf-8") as f:
f.write(content)
# 3. 同时生成一个 python 文件供 gui.py 调用
with open("version.py", "w", encoding="utf-8") as f:
f.write(f'VERSION = "v{ver_str}"\n')
print(f"已生成版本信息文件: version_info.txt 和 version.py (版本: v{ver_str})")
if __name__ == "__main__":
create_version_file()

23
pyproject.toml Normal file
View File

@@ -0,0 +1,23 @@
[project]
name = "windfarm"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"ezdxf>=1.4.3",
"matplotlib>=3.10.8",
"networkx>=3.6.1",
"nicegui>=3.4.1",
"numpy>=2.4.0",
"openpyxl>=3.1.5",
"pandas>=2.3.3",
"pywebview>=6.1",
"scikit-learn>=1.8.0",
"scipy>=1.16.3",
]
[dependency-groups]
dev = [
"pyinstaller>=6.17.0",
]

2240
uv.lock generated Normal file

File diff suppressed because it is too large Load Diff

0
使用说明/pandoc Normal file
View File

View File

@@ -1,7 +1,7 @@
# 海上风电场集电线路设计优化软件 - 操作手册 # 海上风电场集电线路设计优化软件 - 操作手册
**文档版本:** v1.0 **文档版本:** v1.0
**适用对象:** 海上能源业务开发部 - 电气专业 **适用对象:** 海上能源业务开发部 - 电气专业
**编制日期:** 2026年1月5日 **编制日期:** 2026年1月5日
--- ---
@@ -10,7 +10,7 @@
海上风电集电线路作为风电机组与海上升压站的关键连接纽带,其优化设计对提升风电场全生命周期经济性及降低环境影响具有核心意义,不仅能通过拓扑与路由优化减少建设运维成本、降低线路损耗,还能为深远海、大容量风电场开发提供技术支撑。该优化工作面临拓扑与载流量多约束耦合的技术瓶颈,需综合运用数字化技术、先进优化算法进行应对。 海上风电集电线路作为风电机组与海上升压站的关键连接纽带,其优化设计对提升风电场全生命周期经济性及降低环境影响具有核心意义,不仅能通过拓扑与路由优化减少建设运维成本、降低线路损耗,还能为深远海、大容量风电场开发提供技术支撑。该优化工作面临拓扑与载流量多约束耦合的技术瓶颈,需综合运用数字化技术、先进优化算法进行应对。
本软件专为海上风电场内集电系统35kV/66kV/110kV设计旨在通过多种先进的拓扑优化算法如Esau-Williams、MST、旋转扫描法辅助电气工程师快速完成集电线路的路径规划与经济性比选。 本软件专为海上风电场内集电系统35kV/66kV/110kV设计旨在通过多种先进的拓扑优化算法如Esau-Williams、MST、旋转扫描法辅助电气专业快速完成集电线路的路径规划与经济性比选。
软件能够根据风机坐标、海缆载流量及造价数据,自动计算并生成线损最小、投资最优的接线方案,并支持一键导出 CAD 图纸和海缆长度。 软件能够根据风机坐标、海缆载流量及造价数据,自动计算并生成线损最小、投资最优的接线方案,并支持一键导出 CAD 图纸和海缆长度。
@@ -162,4 +162,4 @@ A: 软件算法以不超过额定载流量为约束条件(默认允许 100%
A: 请双击鼠标滚轮Zoom Extents全屏显示。由于风机坐标通常是大地坐标数值很大如果 CAD 当前视口在 (0,0) 附近,可能会找不到图形。 A: 请双击鼠标滚轮Zoom Extents全屏显示。由于风机坐标通常是大地坐标数值很大如果 CAD 当前视口在 (0,0) 附近,可能会找不到图形。
--- ---
**技术支持:** 海上能源业务开发部 - 数字化小组 **技术支持:** 海上能源业务开发部 - 杜孟远

Binary file not shown.