SuperAPI AI 工具集

urban-calculator

设计与创作

查看项目

更新于 10-15 09:49

技能介绍

Urban Calculator 是 Urban Design Skills 技能中的一套 Python 计算工具,专注于城市设计指标的精确计算。每个脚本相互独立,通过命令行参数接收输入,并同时支持人类可读文本和结构化 JSON 两种输出形式。

一、主要能力(可用计算器)

  1. density_calculator.py:计算人口密度与住宅密度。关键输入包括场地面积、FAR、单元尺寸、效率、户均人数、住宅占比等;输出包括每公顷住宅单元数、每公顷人口数、总人口等。

  2. far_calculator.py:计算容积率与总建筑面积(GFA),可按用途拆分。关键输入包括场地面积、覆盖率、楼层、用途拆分等;输出包括 FAR、各用途 GFA 与总 GFA。支持经济适用房奖励 FAR,也支持按分区显式指定各层面积。

  3. walkability_scorer.py:基于设施距离与路口密度估算步行性评分。关键输入包括杂货店、餐厅、购物、咖啡、公园、学校等设施距离以及路口密度;输出为 0-100 的评分及类别。未指定的设施默认按 9999 米处理(即视为不存在)。

  4. parking_calculator.py:确定停车需求,支持公交与 TDM 折减。关键输入包括住宅单元数、办公面积、零售面积、公交折减、共享折减、车位类型等;输出包括总车位数与所需面积。支持地面停车等类型。

  5. green_space_analyzer.py:对照国际标准分析绿地供给。关键输入包括人口、公园列表(名称:面积:类型)与标准(如 who、un-habitat);输出包括人均绿地面积、服务覆盖率等。

  6. block_optimizer.py:为目标 FAR 寻找最优街区尺寸。关键输入包括目标 FAR、最大高度、建筑进深、最小庭院、日照角度、最大覆盖率等;输出为最优街区尺寸。

二、使用方式

所有脚本位于本技能相对的 scripts/ 子目录中,使用 Python 3 通过命令行运行。每个脚本都支持 --json 标志以输出结构化 JSON 而非格式化文本。示例命令(保留原文):

python scripts/density_calculator.py --site-area 20000 --far 2.5 --avg-unit-size 85 --efficiency 0.75 --household-size 2.5 --residential-pct 0.7 --streets-pct 0.30 python scripts/density_calculator.py --site-area 15000 --far 3.0 python scripts/density_calculator.py --site-area 20000 --far 2.5 --json python scripts/far_calculator.py --site-area 10000 --coverage 0.6 --floors 4,6,8 --use-split "res:60,com:25,civic:10,open:5" python scripts/far_calculator.py --site-area 10000 --coverage 0.6 --floors 6 --bonus-far 0.5 python scripts/far_calculator.py --site-area 10000 --floor-areas "2000,3000,1500" --floors "4,6,8" python scripts/walkability_scorer.py --grocery 200 --restaurants 150 --shopping 400 --coffee 100 --parks 300 --schools 500 --intersection-density 150 python scripts/walkability_scorer.py --grocery 300 --parks 200 python scripts/parking_calculator.py --residential-units 200 --office-area 5000 --retail-area 2000 --transit-reduction 0.2 --shared-reduction 0.1 --space-type structured python scripts/parking_calculator.py --residential-units 50 --space-type surface python scripts/green_space_analyzer.py --population 5000 --parks "Central Park:8000:neighborhood,Pocket Plaza:400:pocket,River Walk:2000:linear" --standard who python scripts/green_space_analyzer.py --population 12000 --parks "Main Park:15000:district,Local Green:1200:neighborhood" --standard un-habitat --json python scripts/block_optimizer.py --target-far 2.5 --max-height 6 --building-depth 14 --min-courtyard 21 --daylight-angle 25 python scripts/block_optimizer.py --target-far 4.0 --max-height 10 --max-coverage 0.7 --building-depth 16

三、公式参考

所有公式、算例、单位换算与标准假设记录在 references/formulas.md 中。核心公式包括:

FAR = Total GFA / Site Area Net Density (DU/ha) = Dwelling Units / Net Site Area (ha) Gross Density (DU/ha) = Dwelling Units / Gross Site Area including streets (ha) Population Density = Net Density x Household Size Walk Score = Weighted sum of distance-decay scores per amenity category, normalized to 0-100 Parking Spaces = Sum of (use area x ratio) x (1 - transit reduction) x (1 - shared reduction) x (1 - TDM reduction) Green Space Per Capita = Total Green Space Area / Population

四、与其他技能的集成方式

Urban Design Skills 中的其他技能可调用这些计算器获取精确数值,推荐的集成模式包括:设计技能在生成场地布局后,调用 density_calculator.py 与 far_calculator.py 校验指标;总体规划技能在布置街道网格前,使用 block_optimizer.py 确定街区尺寸;分析技能运行 walkability_scorer.py 与 green_space_analyzer.py 对照标准评估设计方案。链式计算时可使用 --json 标志在脚本间以编程方式传递输出,例如先计算密度得到人口,再用该人口检查绿地充足度: python scripts/density_calculator.py --site-area 50000 --far 2.5 --json > density_output.json python scripts/green_space_analyzer.py --population 3500 --parks "Park A:5000:neighborhood,Park B:800:pocket" --json

五、输出格式

所有脚本支持两种输出模式:默认的人类可读文本,以格式化表格与摘要呈现,含章节标题、对齐列与上下文注释,适合报告与演示;以及使用 --json 标志输出的结构化数据,适合程序化消费、脚本间管道传递与工具集成。JSON 中所有数值均为数字(非字符串),所有单位均已记录在 JSON 键名中。密度计算器的 JSON 输出结构示例(保留原文):

{ "inputs": { "site_area_m2": 20000, "far": 2.5, "avg_unit_size_m2": 85, "efficiency": 0.75, "household_size": 2.5, "residential_pct": 0.7, "streets_pct": 0.30 }, "results": { "total_gfa_m2": 50000, "residential_gfa_m2": 35000, "net_internal_area_m2": 26250, "dwelling_units": 308, "population": 771, "net_density_du_per_ha": 154.0, "gross_density_du_per_ha": 107.8, "population_density_persons_per_ha": 385.0 } }

六、适用场景与限制

适用场景:城市设计、总体规划与建筑方案的指标计算与校验,如密度、容积率、步行性、停车、绿地与街区尺寸优化,并可与设计、总体规划、分析类技能集成调用。

限制:资料未提供收费、价格、平台、效果或性能等信息;各脚本的具体参数约束、默认值细节以及标准清单未在提供的资料中完整列出,部分内容见 references/formulas.md(本资料未包含其全文)。