⟨/⟩ Ntr/55_Backend/Calc/CalcGraph.cs

169 строк · в начало

using Rugrid.Sdaid.Notation.Documents;

namespace Rugrid.Sdaid.Epas.Ntr.Backend.Calc
{
    /// <summary>
    /// Общий граф расчёта: секции разделов ТЭ, ЭЭ и свода с межсекционными связями.
    /// Граф ТЭ перенесён дословно из ntr-01/ntr-calc/ttr-calc-graph.md; узлы ЭЭ и свода
    /// достроены по секциям методик (решение CR 2026-08-28).
    /// </summary>
    public class DOC_CalcGraph : ISdaidDocument, IHasStructuralLinks, IFolder<NtrBackendFolder>
    {
        public SdaidLink[] Links => new[]
        {
            Rel.Uses<Rugrid.Sdaid.Epas.Ntr.Backend.Calc.DOC_TtrCalc>(),
            Rel.Uses<Rugrid.Sdaid.Epas.Ntr.Backend.Calc.DOC_EeCalc>(),
            Rel.Uses<Rugrid.Sdaid.Epas.Ntr.Backend.Calc.DOC_SummaryCalc>(),
        };

        public static string _refName = "Граф расчёта";

        public string Name => "Граф расчёта";

        public string Description => "Порядок и взаимосвязь функций расчёта. Узлы — секции методик по methodSectionId, дуги — передаваемые расчётные параметры.";

        public string Version => "1.0";
        public string Status => "accepted";
        public string[] Comments => new string[0];

        public static string Body = """"
Граф задаёт порядок и взаимосвязь функций.

Граф общий для всех разделов расчёта: узлы `te.*` — секции теплотехнического расчёта, `ee.*` —
расчёта по электричеству, `summary.*` — свода. Деление на разделы принадлежит реализации,
а не методике: связи между секциями пересекают границы разделов, и порядок расчёта задаётся
этим графом целиком.

```mermaid
flowchart LR
  %% Ветка площади окон A_окон по новой методике (листовая секция: te.windows_area_by_type_by_side):
  te.windows_area_by_type_by_side -->|"A_окон^{i,j}"| te.windows_area_by_type
  te.windows_area_by_type_by_side -->|"A_окон^{i,j}"| te.windows_area_by_side
  te.windows_area_by_type_by_side -->|"A_окон^{i,j}"| te.windows_area_by_type_by_direction
  te.windows_area_by_type -->|"A_окон^j"| te.windows_area_total
  te.windows_area_by_type_by_direction -->|"A_окон^{d,j}"| te.windows_area_by_direction
  %% Ветка площади ворот A_ворот по новой методике (листовая секция: te.doors_area_by_type_by_side):
  %% Для ворот секции по сторонам света не вычисляются.
  te.doors_area_by_type_by_side -->|"A_ворот^{i,j}"| te.doors_area_by_type
  te.doors_area_by_type_by_side -->|"A_ворот^{i,j}"| te.doors_area_by_side
  te.doors_area_by_type -->|"A_ворот^j"| te.doors_area_total
  %% Узлы по methodSectionId (ветка стен → периметр): te.number_of_corners → te.wall_thickness → te.inner_wall_perimeter_by_side → te.inner_wall_perimeter
  te.number_of_corners -->|"k_ext,k_int"| te.inner_wall_perimeter_by_side
  te.wall_thickness -->|"δ"| te.inner_wall_perimeter_by_side
  te.inner_wall_perimeter_by_side -->|"L_i^int"| te.inner_wall_perimeter
  te.inner_wall_perimeter -->|"p_ВП.Стен"| te.inner_wall_surface_area
  te.windows_area_total -->|"A_окон"| te.inner_wall_surface_area
  te.doors_area_total -->|"A_ворот"| te.inner_wall_surface_area
  te.inner_wall_surface_area -->|"A_ВП.Стен"| te.envelope_area
  te.windows_area_total -->|"A_окон"| te.envelope_area
  te.doors_area_total -->|"A_ворот"| te.envelope_area
  te.wall_thermal_resistance -->|"R_стен^пр"| te.envelope_thermal_resistance
  te.envelope_area -->|"A_НОК"| te.envelope_thermal_resistance
  te.inner_wall_surface_area -->|"A_ВП.Стен"| te.envelope_thermal_resistance
  te.windows_area_total -->|"A_окон"| te.envelope_thermal_resistance
  te.window_thermal_resistance -->|"R_окон^пр"| te.envelope_thermal_resistance
  te.doors_area_total -->|"A_ворот"| te.envelope_thermal_resistance
  te.door_thermal_resistance -->|"R_ворот^пр"| te.envelope_thermal_resistance
  te.upper_enclosures_area -->|"A_ВОК"| te.envelope_thermal_resistance
  te.upper_enclosures_thermal_resistance -->|"R_ВОК^пр"| te.envelope_thermal_resistance
  te.ground_contact_area -->|"A_ЗКГ"| te.envelope_thermal_resistance
  te.ground_contact_thermal_resistance -->|"R_ЗКГ^пр"| te.envelope_thermal_resistance
  %% Старая декомпозиция attic_wall_area (selectBranch + 6 веток) удалена:
  %% по новой методике это единая секция te.attic_wall_area с внутренним диспетчером по
  %% (HasAttic, RoofType, BuildingForm).
  te.inner_wall_perimeter -->|"p_стен^int"| te.attic_wall_area
  te.attic_wall_area -->|"A_НП.Черд"| te.upper_enclosures_area
  %% Старая декомпозиция roof_cover_area (selectBranch + 5 веток) удалена:
  %% по новой методике это единая секция te.roof_cover_area с внутренним диспетчером по
  %% (RoofType, BuildingForm).
  te.ground_floor_area -->|"A_осн^int"| te.roof_cover_area
  te.roof_cover_area -->|"A_ПК"| te.upper_enclosures_area
  te.upper_enclosures_area -->|"A_ВОК"| te.envelope_area
  %% Старая декомпозиция basement_wall_area / ground_floor_area / ground_contact_area
  %% (selectBranch + ветки по form/HasBasement) удалена: по новой методике это единые секции
  %% с внутренним диспетчером.
  te.inner_wall_perimeter -->|"p_стен^int"| te.basement_wall_area
  te.basement_wall_area -->|"A_СП"| te.ground_contact_area
  te.inner_wall_perimeter_by_side -->|"L_i^int"| te.ground_floor_area
  te.ground_floor_area -->|"A_осн^int"| te.ground_contact_area
  te.ground_contact_area -->|"A_ЗКГ"| te.envelope_area
  %% Старая декомпозиция вентиляционных диспетчеров (selectBranch + with/without_recuperator) удалена:
  %% по новой методике это единые секции te.vent_hours, te.recuperator_efficiency,
  %% te.infiltration_hours с внутренним switch по Ventilation.HasRecuperator.
  te.vent_amount -->|"L_вент"| te.spec_ventilation_char
  te.vent_hours -->|"n_вент"| te.spec_ventilation_char
  te.recuperator_efficiency -->|"k_эф"| te.spec_ventilation_char
  te.infiltration_hours -->|"n_инф"| te.spec_ventilation_char
  te.vent_amount -->|"L_вент"| te.air_exchange_rate
  te.vent_hours -->|"n_вент"| te.air_exchange_rate
  te.infiltration_hours -->|"n_инф"| te.air_exchange_rate
  te.infiltration_air_amount -->|"G^инф"| te.air_exchange_rate
  te.supply_air_density -->|"ρ_в^вент"| te.air_exchange_rate
  te.air_exchange_rate -->|"n_в"| te.heat_gain_utilization_factor
  te.envelope_area -->|"A_НОК"| te.spec_heat_protect_char
  te.envelope_thermal_resistance -->|"R_o^пр"| te.spec_heat_protect_char
  te.spec_ventilation_char -->|"k_вент"| te.calc_specific_characteristic
  te.spec_heat_protect_char -->|"k_об"| te.calc_specific_characteristic
  te.calc_specific_characteristic -->|"q_от^р"| te.deviation_percent
  te.deviation_percent -->|"δq"| te.class_by_deviation
  te.windows_area_total -->|"A_окон"| te.window_thermal_resistance
  te.doors_area_total -->|"A_ворот"| te.door_thermal_resistance
  te.upper_enclosures_area -->|"A_ВОК"| te.upper_enclosures_thermal_resistance
  te.ground_contact_area -->|"A_ЗКГ"| te.ground_contact_thermal_resistance
  te.ground_contact_zones_area -->|"A_ЗКГ^I..IV"| te.ground_contact_thermal_resistance
  te.air_specific_weight -->|"γ_н,γ_в"| te.pressure_difference
  te.pressure_difference -->|"Δp"| te.windows_air_permeability_resistance
  te.pressure_difference -->|"Δp"| te.doors_air_permeability_resistance
  te.pressure_difference -->|"Δp"| te.window_infiltration_air_amount
  te.pressure_difference -->|"Δp"| te.door_infiltration_air_amount
  te.windows_air_permeability_resistance -->|"R_возд.пр,j окон"| te.window_infiltration_air_amount
  te.doors_air_permeability_resistance -->|"R_возд.пр,j ворот"| te.door_infiltration_air_amount
  te.window_infiltration_air_amount -->|"G_окон^инф,j"| te.infiltration_air_amount
  te.door_infiltration_air_amount -->|"G_ворот^инф,j"| te.infiltration_air_amount
  te.infiltration_air_amount -->|"G^инф"| te.spec_ventilation_char
  %% Старая декомпозиция windows_area_by_direction (selectBranch + form_* + orient_*) удалена:
  %% в новой методике это единая секция te.windows_area_by_type_by_direction в два этапа.
  %% Старая декомпозиция doors_area_by_direction (selectBranch + form_* + orient_*) удалена:
  %% по новой методике для ворот секции по сторонам света не вычисляются.
  %% Старая декомпозиция ground_contact_zones_area (selectBranch + ветки по form) удалена:
  %% по новой методике это единая секция te.ground_contact_zones_area с внутренним диспетчером по форме.
  te.solar_radiation_by_direction -->|"I_рад^d"| te.solar_gain_energy_by_window_kind
  te.windows_area_by_type_by_direction -->|"A_окон^{d,j}"| te.solar_gain_energy_by_window_kind
  te.solar_gain_energy_by_window_kind -->|"Q_рад^j"| te.solar_gain_energy
  te.solar_gain_energy -->|"Q_рад"| te.spec_solar_gain_char
  te.heating_degree_days -->|"D_d"| te.spec_solar_gain_char
  te.internal_heat_gain_energy -->|"q_быт"| te.spec_internal_heat_gain_char
  te.spec_internal_heat_gain_char -->|"k_быт"| te.calc_specific_characteristic
  te.spec_solar_gain_char -->|"k_рад"| te.calc_specific_characteristic
  te.heat_gain_utilization_factor -->|"β_КПИ"| te.calc_specific_characteristic
  %% Финальная ветка потребления тепловой энергии: te.calc_specific_characteristic + te.heating_degree_days
  %% → te.te_consumption_kwh → te.te_consumption_gcal.
  te.calc_specific_characteristic -->|"q_от^р"| te.te_consumption_kwh
  te.heating_degree_days -->|"D_d"| te.te_consumption_kwh
  te.te_consumption_kwh -->|"Q_от^kWh"| te.te_consumption_gcal
  %% Старые узлы детализированного учёта потерь (compute*HeatLoss*, compute*HeatGains, compute*HeatEnergy*,
  %% computeCompensationPowerEnergy, computeLossesToSpecificCharacteristic, computeEquivalentAirPermeabilityResistance,
  %% computeOpeningsModelAggregation) удалены: текущая методика рассчитывает потребление через q_от^р
  %% напрямую (см. te.te_consumption_kwh), без промежуточного баланса теплопотерь/теплопоступлений.

  %% ── РАЗДЕЛ ЭЭ ──────────────────────────────────────────────────────────
  %% Мощность вида токоприёмников P_k — исходные данные, отдельной секции не имеет.
  ee.lighting_kind_power -->|"P_k"| ee.lighting_kind_consumption
  ee.lighting_kind_power -->|"P_k"| ee.lighting_model_totals
  ee.lighting_kind_consumption -->|"Q_k"| ee.lighting_model_totals
  ee.receiver_kind_consumption -->|"Q_k"| ee.receiver_model_totals
  ee.lighting_model_totals -->|"P_light,Q_light"| ee.ee_consumption_kwh
  %% Межразделовая дуга: удельные бытовые теплопоступления берут мощность освещения из раздела ЭЭ.
  ee.lighting_model_totals -->|"P_light"| te.internal_heat_gain_energy
  ee.receiver_model_totals -->|"P_rec,Q_rec"| ee.ee_consumption_kwh

  %% ── СВОД ───────────────────────────────────────────────────────────────
  te.te_consumption_kwh -->|"H_h^kWh"| summary.te_consumption_kwh
  summary.te_consumption_kwh -->|"H^kWh"| summary.te_consumption_gcal
  te.te_consumption_kwh -->|"E_h^kWh = H_h^kWh"| summary.ee_consumption_kwh
  ee.ee_consumption_kwh -->|"E_c^kWh"| summary.ee_consumption_kwh
```
"""";
    }
}