<?xml version="1.0" encoding="UTF-8"?>
<!--
  ============================================================================================
  UNIVERSAL INFRASTRUCTURE SIZING FRAMEWORK v2.0
  ============================================================================================
  Назначение   : Единый файл-фреймворк для sizing любого серверного оборудования.
                 Покрывает все типы нагрузок, содержит дедуплицированные переиспользуемые
                 блоки расчётов, CAPEX/OPEX/ROI, риски отсутствия резервирования и
                 встроенный калькулятор резервного копирования (RTO/RPO/Backup-sizing).

  Совместимость: CycloneDX 1.7 HBOM | Odoo MRP BOM | SAP MM-BOM | Nutanix Sizer export
                 HPE ESP | Dell OpenManage | любой ERP XML BOM import

  ПЛЕЙСХОЛДЕРЫ : {{FIELD_NAME}} — заменить перед импортом
  ПЕРЕЧИСЛЕНИЯ : указаны в комментариях как ENUM: ...

  ============================================================================================
  АРХИТЕКТУРА ФАЙЛА
  ============================================================================================
  PART A — SHARED CALCULATION LIBRARY (дедуплицированные формулы)
    A1. Общие коэффициенты и константы
    A2. CPU-блок (один блок для всех типов нагрузок)
    A3. RAM-блок
    A4. Storage-блок
    A5. IOPS/Throughput-блок
    A6. Network-блок
    A7. GPU/AI-блок
    A8. Power & Cooling-блок
    A9. Redundancy Risk Matrix
    A10. Backup / DR / RTO-блок
    A11. CAPEX / OPEX / TCO / ROI-блок

  PART B — WORKLOAD PROFILES (конфигурации для каждого типа нагрузки)
    B1. General VM / Mixed Workload
    B2. VDI (Virtual Desktop Infrastructure)
    B3. Database (OLTP / OLAP / HTAP)
    B4. Web / Application Tier
    B5. SAP HANA / ERP-in-Memory
    B6. Exchange / Collaboration
    B7. AI Inference (vLLM / llama.cpp)
    B8. AI Training / Fine-Tuning
    B9. HPC / MPI Cluster
    B10. Edge / IoT Gateway

  PART C — COMPONENTS (BOM-строки под каждый профиль)
    C1. Server node
    C2. Switch (ToR/Leaf/Spine)
    C3. Storage array
    C4. Rack & PDU
    C5. OS License
    C6. Management SW
    C7. Backup Appliance / Agent

  PART D — ФИНАНСОВЫЙ БЛОК
    D1. CAPEX breakdown
    D2. OPEX breakdown (power, maintenance, licensing)
    D3. TCO 3/5-year model
    D4. ROI / Payback
    D5. Стоимость простоя без резервирования

  PART E — DEPENDENCY GRAPH & ANNOTATIONS
  ============================================================================================
-->

<sizing-framework version="2.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  project="{{PROJECT_NAME}}"
  customer="{{CUSTOMER_NAME}}"
  date="{{ISO8601_DATE}}"
  author="{{AUTHOR_NAME}}"
  revision="{{REVISION}}">

  <!-- ====================================================================================
       PART A — SHARED CALCULATION LIBRARY
       Все формулы определены ОДИН РАЗ здесь, PART B и далее только ссылаются на них.
       ==================================================================================== -->
  <calc-library>

    <!-- ─────────────────────────────────────────────────────────────────────────────────
         A1. ГЛОБАЛЬНЫЕ КОЭФФИЦИЕНТЫ
         Источники: Nutanix Sizer, HPE ESP, VMware vSizer, ProcessMaker Sizing Guide,
                    ECOSIRE ERP Sizer, Basebox AI VRAM Guide, vSAN Design Guide
         ───────────────────────────────────────────────────────────────────────────────── -->
    <constants id="A1" name="Global Sizing Constants">

      <!-- CPU overcommit ratios by workload type -->
      <const id="A1.cpu.vdi"        name="vCPU:pCPU ratio – VDI"          value="8"    unit="ratio"/>
      <const id="A1.cpu.general"    name="vCPU:pCPU ratio – General VM"   value="4"    unit="ratio"/>
      <const id="A1.cpu.web"        name="vCPU:pCPU ratio – Web/App tier" value="4"    unit="ratio"/>
      <const id="A1.cpu.db_nonprod" name="vCPU:pCPU ratio – DB non-prod"  value="2"    unit="ratio"/>
      <const id="A1.cpu.db_prod"    name="vCPU:pCPU ratio – DB prod"      value="1.5"  unit="ratio"/>
      <const id="A1.cpu.exchange"   name="vCPU:pCPU ratio – Exchange"     value="2"    unit="ratio"/>
      <const id="A1.cpu.sap_hana"   name="vCPU:pCPU ratio – SAP HANA"    value="1"    unit="ratio"/>
      <const id="A1.cpu.oracle"     name="vCPU:pCPU ratio – Oracle"       value="1"    unit="ratio"/>
      <const id="A1.cpu.ai_inf"     name="vCPU:pCPU ratio – AI Inference" value="1"    unit="ratio"/>
      <const id="A1.cpu.hpc"        name="vCPU:pCPU ratio – HPC"         value="1"    unit="ratio"/>

      <!-- Headroom / safety margins -->
      <const id="A1.hm.cpu"         name="CPU headroom factor"            value="1.20" unit="multiplier"/>
      <const id="A1.hm.ram"         name="RAM headroom factor"            value="1.25" unit="multiplier"/>
      <const id="A1.hm.storage"     name="Storage headroom factor"        value="1.20" unit="multiplier"/>
      <const id="A1.hm.gpu_vram"    name="GPU VRAM safety buffer"         value="1.20" unit="multiplier"/>
      <const id="A1.hm.peak_users"  name="Peak user spike buffer"         value="1.30" unit="multiplier"/>

      <!-- CVM (Controller VM) overhead per Nutanix node -->
      <const id="A1.cvm.ram_min"    name="Nutanix CVM RAM min per node"   value="32"   unit="GB"/>
      <const id="A1.cvm.ram_max"    name="Nutanix CVM RAM max per node"   value="64"   unit="GB"/>
      <const id="A1.cvm.vcpu"       name="Nutanix CVM vCPU per node"      value="8"    unit="vCPU"/>
      <const id="A1.cvm.os_overhead" name="OS/hypervisor RAM per host"    value="4"    unit="GB"/>

      <!-- Replication factors -->
      <const id="A1.rf.rf2"         name="Replication Factor 2 (N+1)"     value="2"    unit="multiplier"/>
      <const id="A1.rf.rf3"         name="Replication Factor 3 (N+2)"     value="3"    unit="multiplier"/>

      <!-- Dedup/Compress ratios by workload type -->
      <const id="A1.dc.vdi_dedup"   name="Dedup ratio – VDI"             value="4.0"  unit="ratio"/>
      <const id="A1.dc.vdi_comp"    name="Compress ratio – VDI inline"   value="2.0"  unit="ratio"/>
      <const id="A1.dc.db_dedup"    name="Dedup ratio – DB"              value="1.5"  unit="ratio"/>
      <const id="A1.dc.db_comp"     name="Compress ratio – DB"           value="1.8"  unit="ratio"/>
      <const id="A1.dc.general_dedup" name="Dedup ratio – General"       value="2.0"  unit="ratio"/>
      <const id="A1.dc.general_comp" name="Compress ratio – General"     value="1.5"  unit="ratio"/>
      <const id="A1.dc.video_dedup" name="Dedup ratio – Video/Object"    value="1.0"  unit="ratio"/>
      <const id="A1.dc.video_comp"  name="Compress ratio – Video"        value="1.0"  unit="ratio"/>
      <const id="A1.dc.backup_dedup" name="Dedup ratio – Backup target"  value="15.0" unit="ratio"/>
      <const id="A1.dc.backup_comp" name="Compress ratio – Backup target" value="3.0" unit="ratio"/>

      <!-- GPU precision bytes per parameter -->
      <const id="A1.gpu.fp32"       name="Bytes/param – FP32"            value="4"    unit="bytes"/>
      <const id="A1.gpu.bf16"       name="Bytes/param – BF16/FP16"       value="2"    unit="bytes"/>
      <const id="A1.gpu.int8"       name="Bytes/param – INT8"            value="1"    unit="bytes"/>
      <const id="A1.gpu.fp8"        name="Bytes/param – FP8"             value="1"    unit="bytes"/>
      <const id="A1.gpu.int4"       name="Bytes/param – INT4/GPTQ"       value="0.5"  unit="bytes"/>

      <!-- Concurrent user ratios by environment type -->
      <const id="A1.user.office"    name="Concurrent/total – Office"     value="0.20" unit="ratio"/>
      <const id="A1.user.mfg"       name="Concurrent/total – Mfg floor"  value="0.40" unit="ratio"/>
      <const id="A1.user.callctr"   name="Concurrent/total – Call center" value="0.70" unit="ratio"/>
      <const id="A1.user.research"  name="Concurrent/total – Research"   value="0.35" unit="ratio"/>

      <!-- Power constants -->
      <const id="A1.pwr.dimm_w"     name="Power per DIMM (estimate)"     value="3"    unit="W"/>
      <const id="A1.pwr.drive_w"    name="Power per HDD/SSD (estimate)"  value="8"    unit="W"/>
      <const id="A1.pwr.base_w"     name="Server baseboard overhead"     value="40"   unit="W"/>
      <const id="A1.pwr.btu_coeff"  name="W to BTU/h conversion"         value="3.412" unit="BTU/h per W"/>
      <const id="A1.pwr.pue_excellent" name="PUE – modern DC"            value="1.15" unit="ratio"/>
      <const id="A1.pwr.pue_typical"  name="PUE – typical DC"            value="1.50" unit="ratio"/>
      <const id="A1.pwr.pue_legacy"   name="PUE – legacy DC"             value="1.90" unit="ratio"/>

      <!-- Human factor constants (для расчёта RTO) -->
      <const id="A1.hf.triage_min"  name="Время диагностики инцидента L1"  value="30"  unit="minutes"/>
      <const id="A1.hf.escalate_min" name="Время эскалации L1 → L2"       value="15"  unit="minutes"/>
      <const id="A1.hf.l2_response_min" name="Время реакции L2 специалиста" value="45" unit="minutes"/>
      <const id="A1.hf.vendor_nbd_h" name="Время замены HW по NBD"        value="24"  unit="hours"/>
      <const id="A1.hf.vendor_4h"    name="Время замены HW 4h on-site"    value="4"   unit="hours"/>
      <const id="A1.hf.vendor_6h"    name="Время замены HW 6h on-site"    value="6"   unit="hours"/>

      <!-- Downtime cost defaults (переопределяются в PART D) -->
      <const id="A1.dt.revenue_hour_usd"  name="Потери выручки в час простоя"  value="{{DT_REVENUE_PER_HOUR_USD}}"/>
      <const id="A1.dt.staff_cost_hour"   name="Стоимость простоя персонала/ч" value="{{DT_STAFF_COST_PER_HOUR_USD}}"/>
      <const id="A1.dt.reputation_mult"   name="Репутационный мультипликатор"  value="1.50" unit="ratio"/>
      <!-- итого: total_downtime_cost/h = (revenue + staff) * reputation_mult -->
    </constants>

    <!-- ─────────────────────────────────────────────────────────────────────────────────
         A2. CPU SIZING BLOCK
         ───────────────────────────────────────────────────────────────────────────────── -->
    <formula-block id="A2" name="CPU Sizing">
      <description>
        Используется всеми профилями (B1-B10). Меняется только vcpu_pcpu_ratio (A1.cpu.*).
        Источники: Nutanix Sizer, HPE ESP Online Sizer, Cisco UCS Sizer, VMware vSizer
      </description>
      <formulas>
        <formula id="A2.1" name="Raw physical cores needed">
          pCores_raw = CEILING( total_vCPU / vcpu_pcpu_ratio )
          <!-- vcpu_pcpu_ratio: выбирается из A1.cpu.* по типу нагрузки -->
        </formula>
        <formula id="A2.2" name="Physical cores with headroom">
          pCores_headroom = pCores_raw * A1.hm.cpu
          <!-- A1.hm.cpu = 1.20 (20% резерв) -->
        </formula>
        <formula id="A2.3" name="Sockets required">
          sockets_needed = CEILING( pCores_headroom / cores_per_socket )
        </formula>
        <formula id="A2.4" name="Compute nodes by CPU">
          nodes_by_cpu = CEILING( sockets_needed / sockets_per_node )
        </formula>
        <formula id="A2.5" name="CPU for ERP / Web tier (concurrent user formula)">
          <!-- Источник: ECOSIRE ERP Sizer, ProcessMaker Sizing Guide -->
          concurrent_users = total_users * concurrency_ratio
          <!-- concurrency_ratio: из A1.user.* по типу среды -->
          cpu_per_server = CEILING( memory_per_server_GB / 4 )
          <!-- правило: 1 core per 4 GB RAM для web/ERP tier -->
        </formula>
      </formulas>
      <inputs>
        <input id="A2.in.vcpu"     name="Total vCPU required"     type="integer" placeholder="{{TOTAL_VCPU}}"/>
        <input id="A2.in.cps"      name="Cores per socket"        type="integer" placeholder="{{CORES_PER_SOCKET}}"/>
        <input id="A2.in.sps"      name="Sockets per node"        type="integer" placeholder="{{SOCKETS_PER_NODE}}"/>
        <input id="A2.in.workload" name="Workload type"           type="enum"    placeholder="{{WORKLOAD_TYPE}}"/>
        <!-- ENUM: vdi|general|web|db_nonprod|db_prod|exchange|sap_hana|oracle|ai_inf|hpc -->
      </inputs>
      <outputs>
        <output id="A2.out.pcores"     name="pCores with headroom"    formula="A2.2"/>
        <output id="A2.out.sockets"    name="Sockets needed"          formula="A2.3"/>
        <output id="A2.out.nodes_cpu"  name="Nodes needed by CPU"     formula="A2.4"/>
      </outputs>
    </formula-block>

    <!-- ─────────────────────────────────────────────────────────────────────────────────
         A3. RAM SIZING BLOCK
         ───────────────────────────────────────────────────────────────────────────────── -->
    <formula-block id="A3" name="RAM Sizing">
      <description>
        Источники: Nutanix Sizer (CVM overhead), ProcessMaker Sizing Guide (peak user formula),
                   ECOSIRE ERP Sizer (Odoo: 150 MB/concurrent user), VMware vSphere best practices
      </description>
      <formulas>
        <formula id="A3.1" name="Total VM RAM requirement">
          vm_ram_total_GB = SUM(vm_ram_per_workload_GB)
        </formula>
        <formula id="A3.2" name="CVM overhead (HCI only)">
          cvm_overhead_GB = cvm_ram_per_node_GB * estimated_nodes
          <!-- cvm_ram_per_node: A1.cvm.ram_min..A1.cvm.ram_max = 32..64 GB -->
          <!-- os_overhead: A1.cvm.os_overhead = 4 GB per node -->
        </formula>
        <formula id="A3.3" name="Total raw RAM needed">
          ram_raw_GB = vm_ram_total_GB + cvm_overhead_GB + (os_overhead_GB * estimated_nodes)
        </formula>
        <formula id="A3.4" name="RAM with headroom">
          ram_headroom_GB = ram_raw_GB * A1.hm.ram
          <!-- A1.hm.ram = 1.25 -->
        </formula>
        <formula id="A3.5" name="RAM per node (rounded to DIMM multiple)">
          ram_per_node_GB_raw = ram_headroom_GB / nodes_total
          ram_per_node_GB = CEILING(ram_per_node_GB_raw / dimm_GB) * dimm_GB
          <!-- round up to multiple of dimm_GB (e.g. 16, 32, 64, 128) -->
          <!-- prefer 1 DPC (1 DIMM per channel); 2 DPC reduces speed ~10-15% -->
        </formula>
        <formula id="A3.6" name="DIMM count per node">
          dimm_count = CEILING( ram_per_node_GB / dimm_capacity_GB )
          <!-- distribute symmetrically across memory channels -->
          <!-- channels_per_socket: 8 (Sapphire Rapids/Genoa) | 12 (Granite Rapids) -->
        </formula>
        <formula id="A3.7" name="User-based RAM formula (Web/ERP/ProcessMaker)">
          <!-- Источник: ProcessMaker Sizing Guide, ECOSIRE ERP Sizer -->
          tm = (peak_users * mb_per_user * A1.hm.peak_users) / 1024
          <!-- A1.hm.peak_users = 1.30; mb_per_user: PM=128, Odoo~150 -->
          sc = CEILING( (tm * redundancy_level) / max_ram_per_server_GB )
          ram_per_server_GB = CEILING( (tm * redundancy_level) / sc / 8 ) * 8
        </formula>
      </formulas>
      <inputs>
        <input id="A3.in.vm_ram"    name="Sum VM RAM (GB)"           placeholder="{{TOTAL_VM_RAM_GB}}"/>
        <input id="A3.in.dimm_cap"  name="DIMM capacity (GB)"        placeholder="{{DIMM_CAPACITY_GB}}"/>
        <input id="A3.in.nodes"     name="Expected node count"       placeholder="{{ESTIMATED_NODES}}"/>
        <input id="A3.in.peak_u"    name="Peak concurrent users"     placeholder="{{PEAK_USERS}}"/>
        <input id="A3.in.mb_u"      name="MB per active user"        placeholder="{{MB_PER_USER}}"/>
      </inputs>
      <outputs>
        <output id="A3.out.ram_raw"    name="Raw RAM needed (GB)"    formula="A3.3"/>
        <output id="A3.out.ram_hm"     name="RAM with headroom (GB)" formula="A3.4"/>
        <output id="A3.out.ram_node"   name="RAM per node (GB)"      formula="A3.5"/>
        <output id="A3.out.dimm_cnt"   name="DIMMs per node"         formula="A3.6"/>
        <output id="A3.out.nodes_ram"  name="Nodes needed by RAM"    formula="A3.5"/>
      </outputs>
    </formula-block>

    <!-- ─────────────────────────────────────────────────────────────────────────────────
         A4. STORAGE SIZING BLOCK
         ───────────────────────────────────────────────────────────────────────────────── -->
    <formula-block id="A4" name="Storage Sizing">
      <description>
        Источники: Nutanix Sizer, NetApp Sizing, Pure Storage Sizer, VMware vSAN Sizer,
                   HPE Nimble/Primera Sizer, ECOSIRE ERP (NVMe required 50+ users)
      </description>
      <formulas>
        <formula id="A4.1" name="Raw storage capacity needed">
          raw_capacity_TB = usable_TB * RF / (dedup_ratio * compress_ratio)
          <!-- RF: A1.rf.rf2=2 (N+1) | A1.rf.rf3=3 (N+2) -->
          <!-- dedup_ratio, compress_ratio: из A1.dc.* по типу нагрузки -->
        </formula>
        <formula id="A4.2" name="SSD hot tier (active working set)">
          ssd_hot_tier_TB = active_working_set_TB * 1.10
          <!-- active_working_set: delta между двумя последовательными бэкапами -->
        </formula>
        <formula id="A4.3" name="Storage nodes needed">
          nodes_by_storage = CEILING( raw_capacity_TB / raw_per_node_TB )
        </formula>
        <formula id="A4.4" name="Drive count per node">
          data_drives_per_node = CEILING( raw_per_node_TB / drive_capacity_TB )
        </formula>
        <formula id="A4.5" name="Storage growth projection">
          storage_future_TB = current_usable_TB * (1 + annual_growth_rate)^planning_years
          <!-- используется для определения расширяемости и замены на N-летнем горизонте -->
        </formula>
        <formula id="A4.6" name="ERP DB storage (ECOSIRE formula)">
          <!-- Источник: ECOSIRE ERP Sizer -->
          db_growth_GB_year = 1..5 * (active_users / 10)
          <!-- 1-5 GB/year per 10 active users depending on transaction volume -->
          total_db_GB = initial_db_GB + db_growth_GB_year * planning_years
          total_storage_GB = total_db_GB * 2.5
          <!-- x2.5: учитывает OS, логи, attachment storage, swap -->
        </formula>
      </formulas>
      <inputs>
        <input id="A4.in.usable_tb"    name="Usable storage needed (TB)"      placeholder="{{TOTAL_USABLE_TB}}"/>
        <input id="A4.in.rf"           name="Replication Factor"               placeholder="{{RF}}"/>
        <input id="A4.in.dedup"        name="Deduplification ratio"           placeholder="{{DEDUP_RATIO}}"/>
        <input id="A4.in.comp"         name="Compression ratio"               placeholder="{{COMPRESS_RATIO}}"/>
        <input id="A4.in.raw_node"     name="Raw TB per node (HCI)"           placeholder="{{RAW_TB_PER_NODE}}"/>
        <input id="A4.in.drive_cap"    name="Drive capacity (TB)"             placeholder="{{DRIVE_CAP_TB}}"/>
        <input id="A4.in.ws_tb"        name="Active working set (TB)"         placeholder="{{WORKING_SET_TB}}"/>
        <input id="A4.in.growth_pct"   name="Annual storage growth (%)"       placeholder="{{ANNUAL_GROWTH_PCT}}"/>
        <input id="A4.in.years"        name="Planning horizon (years)"        placeholder="{{PLANNING_YEARS}}"/>
      </inputs>
      <outputs>
        <output id="A4.out.raw_tb"     name="Raw capacity needed (TB)"    formula="A4.1"/>
        <output id="A4.out.hot_tier"   name="SSD hot tier (TB)"          formula="A4.2"/>
        <output id="A4.out.nodes_str"  name="Nodes needed by storage"    formula="A4.3"/>
        <output id="A4.out.drives"     name="Drives per node"            formula="A4.4"/>
        <output id="A4.out.future_tb"  name="Projected storage in N yrs" formula="A4.5"/>
      </outputs>
    </formula-block>

    <!-- ─────────────────────────────────────────────────────────────────────────────────
         A5. IOPS / THROUGHPUT BLOCK
         ───────────────────────────────────────────────────────────────────────────────── -->
    <formula-block id="A5" name="IOPS and Throughput">
      <description>
        Источники: NetApp Performance Sizing, VMware vSAN IOPS Model, HPE Nimble Sizing
      </description>
      <formulas>
        <formula id="A5.1" name="IOPS per drive (reference values)">
          <!-- NVMe PCIe 5.0 : 500,000 – 1,000,000 IOPS (4K random) -->
          <!-- NVMe PCIe 4.0 : 200,000 – 700,000 IOPS  -->
          <!-- SAS SSD        : 100,000 – 200,000 IOPS  -->
          <!-- SATA SSD       : 50,000  – 100,000 IOPS  -->
          <!-- SAS HDD 15K    : 150 IOPS                -->
          <!-- SATA HDD 7.2K  : 80–100 IOPS             -->
        </formula>
        <formula id="A5.2" name="Throughput">
          throughput_MBps = IOPS * block_size_KB / 1024
        </formula>
        <formula id="A5.3" name="vSAN effective IOPS">
          vsan_read_iops  = nodes * drives_per_node * drive_iops * read_pct
          vsan_write_iops = nodes * drives_per_node * drive_iops * write_pct / RF
          vsan_total_iops = vsan_read_iops + vsan_write_iops
        </formula>
        <formula id="A5.4" name="Minimum drives for IOPS constraint">
          min_drives_for_iops = CEILING( required_iops / drive_iops )
          <!-- Ограничение добавляет к A4.4: nodes_by_iops = CEILING(min_drives_for_iops / drives_per_node) -->
        </formula>
      </formulas>
    </formula-block>

    <!-- ─────────────────────────────────────────────────────────────────────────────────
         A6. NETWORK SIZING BLOCK
         ───────────────────────────────────────────────────────────────────────────────── -->
    <formula-block id="A6" name="Network Sizing">
      <description>
        Источники: Nutanix Sizer (replication traffic), ProcessMaker (gigabit LAN requirement),
                   NVIDIA DGX Configurator (InfiniBand для AI)
      </description>
      <formulas>
        <formula id="A6.1" name="VM network bandwidth total">
          vm_bw_total_Gbps = sum_vm_count * avg_bw_per_vm_Gbps
          uplinks_needed = CEILING( vm_bw_total_Gbps / nic_port_speed_Gbps )
        </formula>
        <formula id="A6.2" name="Storage replication traffic (HCI)">
          storage_bw_Gbps = write_iops * block_size_KB / 1024 / 125 * RF
          <!-- /125: KB/s -> Gbps conversion factor -->
        </formula>
        <formula id="A6.3" name="AI/GPU cluster interconnect">
          <!-- All-reduce bandwidth requirement for distributed training -->
          allreduce_bw_GBps = 2 * (gpu_count - 1) / gpu_count * model_params_B * 2
          <!-- *2 bytes for BF16; result in GB/s per GPU -->
          <!-- Minimum: 2x100GbE RoCEv2 для inference; NDR400 InfiniBand для training -->
        </formula>
        <formula id="A6.4" name="Backup replication bandwidth">
          backup_bw_Gbps = daily_changed_data_GB / (backup_window_hours * 3600) * 8
          <!-- result in Gbps; если > доступной полосы → увеличить окно или полосу -->
        </formula>
      </formulas>
    </formula-block>

    <!-- ─────────────────────────────────────────────────────────────────────────────────
         A7. GPU / AI SIZING BLOCK
         ───────────────────────────────────────────────────────────────────────────────── -->
    <formula-block id="A7" name="GPU and AI Sizing">
      <description>
        Источники: NVIDIA DGX Configurator, HuggingFace Model Memory Calculator,
                   Basebox AI VRAM Guide, vLLM docs, llama.cpp performance benchmarks
      </description>
      <formulas>
        <formula id="A7.1" name="VRAM requirement for model weights">
          vram_weights_GB = model_params_B * precision_bytes * A1.hm.gpu_vram
          <!-- precision_bytes: A1.gpu.* (FP32=4, BF16=2, INT8=1, INT4=0.5) -->
          <!-- A1.hm.gpu_vram = 1.20 (20% overhead for activations + framework) -->
        </formula>
        <formula id="A7.2" name="KV-Cache VRAM (inference)">
          kv_cache_GB = 2 * num_layers * num_heads * head_dim * max_seq_len * batch_size * precision_bytes / 1e9
          <!-- 2x: key + value; можно упростить до ~1-2 GB per GPU for batch_size=1 at 4096 ctx -->
        </formula>
        <formula id="A7.3" name="Total VRAM per GPU setup">
          vram_total_GB = vram_weights_GB + kv_cache_GB + activation_overhead_GB
          <!-- activation_overhead: ~10-15% от vram_weights для transformer моделей -->
        </formula>
        <formula id="A7.4" name="GPU count">
          gpu_count_min = CEILING( vram_total_GB / gpu_vram_GB )
          <!-- round up to power of 2 for NVLink topology: 1,2,4,8,16 -->
        </formula>
        <formula id="A7.5" name="Inference throughput">
          tokens_per_sec = gpu_count * gpu_mem_bw_GBs * 1e9 / (model_params_B * precision_bytes * 1e9)
          <!-- упрощённая формула; реальная зависит от batch size, flash attention etc. -->
        </formula>
        <formula id="A7.6" name="Concurrent user capacity for LLM">
          <!-- Источник: Basebox AI VRAM Guide -->
          concurrent_sessions = FLOOR( available_vram_GB / per_session_vram_GB )
          <!-- per_session_vram: kv_cache per session = f(seq_len, model_size) -->
        </formula>
        <formula id="A7.7" name="GPU server count">
          gpu_servers = CEILING( gpu_count_min / gpus_per_server )
          <!-- H100 SXM5: 8 per server | L40S: 8 per server | H200: 8 per server -->
        </formula>
      </formulas>
      <inputs>
        <input id="A7.in.params"     name="Model parameters (B)"          placeholder="{{MODEL_PARAMS_B}}"/>
        <input id="A7.in.prec"       name="Precision"                     placeholder="{{PRECISION}}"/>
        <!-- ENUM: fp32|bf16|fp16|int8|fp8|int4 -->
        <input id="A7.in.seq_len"    name="Max context length (tokens)"   placeholder="{{MAX_SEQ_LEN}}"/>
        <input id="A7.in.batch"      name="Batch size"                    placeholder="{{BATCH_SIZE}}"/>
        <input id="A7.in.gpu_vram"   name="GPU VRAM (GB)"                 placeholder="{{GPU_VRAM_GB}}"/>
        <input id="A7.in.gpu_bw"     name="GPU memory bandwidth (GB/s)"  placeholder="{{GPU_MEM_BW_GBS}}"/>
        <input id="A7.in.gpus_srv"   name="GPUs per server"               placeholder="{{GPUS_PER_SERVER}}"/>
      </inputs>
      <outputs>
        <output id="A7.out.vram_wts"  name="VRAM for weights (GB)"         formula="A7.1"/>
        <output id="A7.out.vram_kv"   name="VRAM for KV-Cache (GB)"        formula="A7.2"/>
        <output id="A7.out.vram_tot"  name="Total VRAM needed (GB)"        formula="A7.3"/>
        <output id="A7.out.gpu_cnt"   name="GPU count"                     formula="A7.4"/>
        <output id="A7.out.tps"       name="Tokens/sec throughput"         formula="A7.5"/>
        <output id="A7.out.sessions"  name="Concurrent sessions"           formula="A7.6"/>
        <output id="A7.out.srv_cnt"   name="GPU server count"              formula="A7.7"/>
      </outputs>
    </formula-block>

    <!-- ─────────────────────────────────────────────────────────────────────────────────
         A8. POWER & COOLING BLOCK
         ───────────────────────────────────────────────────────────────────────────────── -->
    <formula-block id="A8" name="Power and Cooling">
      <description>
        Источники: HPE Power Advisor, Dell EMC OpenManage Power Manager, ASHRAE TC 9.9
      </description>
      <formulas>
        <formula id="A8.1" name="Per-server TDP estimate">
          server_tdp_W = (cpu_tdp_W * sockets)
                       + (dimm_count * A1.pwr.dimm_w)
                       + (total_drives * A1.pwr.drive_w)
                       + nic_tdp_W
                       + gpu_tdp_W
                       + A1.pwr.base_w
          <!-- A1.pwr: dimm=3W, drive=8W, base=40W -->
        </formula>
        <formula id="A8.2" name="PSU capacity check">
          psu_capacity_W >= server_tdp_W * 1.20
          <!-- PSU should be sized at min 120% of TDP -->
        </formula>
        <formula id="A8.3" name="Rack total power">
          rack_power_W = SUM(server_tdp_W) + switch_power_W + pdu_losses_W
        </formula>
        <formula id="A8.4" name="Cooling requirement">
          cooling_BTU_h = rack_power_W * A1.pwr.btu_coeff
          <!-- A1.pwr.btu_coeff = 3.412 -->
        </formula>
        <formula id="A8.5" name="Facility total power with PUE">
          facility_W = rack_power_W * PUE_factor
          <!-- PUE: A1.pwr.pue_excellent=1.15 | pue_typical=1.50 | pue_legacy=1.90 -->
        </formula>
        <formula id="A8.6" name="Annual power cost">
          annual_kwh = facility_W / 1000 * 8760
          annual_power_cost = annual_kwh * electricity_rate_per_kwh
        </formula>
      </formulas>
    </formula-block>

    <!-- ─────────────────────────────────────────────────────────────────────────────────
         A9. REDUNDANCY RISK MATRIX
         Источники: CoreSite (downtime $1M–$5M/h), TierPoint Data Center Redundancy,
                    Fuji Electric N+1/2N/2(N+1) guide, C1S N+1 vs N+2 analysis
         ───────────────────────────────────────────────────────────────────────────────── -->
    <redundancy-matrix id="A9" name="Redundancy Risk and Cost Model">

      <level id="A9.N" name="N — No Redundancy">
        <description>
          Только необходимая мощность. Отказ любого компонента = немедленный простой.
          ЗАПРЕЩЁН для production без DR-плана.
        </description>
        <extra_cost_pct>0</extra_cost_pct>
        <uptime_pct>99.0</uptime_pct>       <!-- ~87.6 ч простоя в год -->
        <annual_downtime_h>87.6</annual_downtime_h>
        <mttr_target_h>{{MTTR_H_NO_REDUND}}</mttr_target_h>
        <risk>
          <scenario id="A9.N.r1">Отказ одного диска → потеря данных (без RAID/RF)</scenario>
          <scenario id="A9.N.r2">Отказ сервера → полный простой сервиса</scenario>
          <scenario id="A9.N.r3">Отказ питания → аварийное отключение</scenario>
        </risk>
        <downtime_cost_formula>
          annual_risk_cost = annual_downtime_h * downtime_cost_per_h * probability_factor
          <!-- downtime_cost_per_h: PART D, D5 -->
        </downtime_cost_formula>
      </level>

      <level id="A9.N1" name="N+1 — Single Component Redundancy">
        <description>
          Один запасной компонент на каждую критическую систему.
          Стандарт для Tier II/III. Допускает обслуживание без простоя.
        </description>
        <extra_cost_pct>20</extra_cost_pct>   <!-- +20% к capex -->
        <uptime_pct>99.9</uptime_pct>          <!-- ~8.7 ч/год -->
        <annual_downtime_h>8.7</annual_downtime_h>
        <applies_to>PSU | Fan | NIC | Uplink | HBA | Switch | Node (N+1 in cluster)</applies_to>
      </level>

      <level id="A9.2N" name="2N — Full Mirrored Redundancy">
        <description>
          Полная зеркальная копия каждой системы. Tier III/IV DC standard.
          Каждая система работает параллельно или в hot-standby.
        </description>
        <extra_cost_pct>80</extra_cost_pct>   <!-- ~80-100% к capex -->
        <uptime_pct>99.99</uptime_pct>         <!-- ~52 мин/год -->
        <annual_downtime_h>0.87</annual_downtime_h>
        <applies_to>Power paths | Cooling | Network paths | Storage controllers</applies_to>
      </level>

      <level id="A9.2N1" name="2(N+1) — Mission Critical">
        <description>
          Два независимых N+1 контура. Tier IV. Допускает одновременный отказ
          одного компонента в каждом контуре.
        </description>
        <extra_cost_pct>150</extra_cost_pct>
        <uptime_pct>99.999</uptime_pct>        <!-- ~5 мин/год -->
        <annual_downtime_h>0.09</annual_downtime_h>
        <applies_to>Mission-critical: финансовые системы, healthcare, telecom core</applies_to>
      </level>

      <!-- Финансовый расчёт риска без резервирования -->
      <risk-calc id="A9.risk" name="Annual Financial Risk of No Redundancy">
        <formula id="A9.risk.1">
          expected_annual_downtime_h = failure_probability_annual * avg_repair_time_h
          <!-- failure_probability: HDD≈0.013/yr (AFR 1.3%), server≈0.05/yr average -->
        </formula>
        <formula id="A9.risk.2">
          annual_risk_cost_USD = expected_annual_downtime_h
                                 * (A1.dt.revenue_hour_usd + A1.dt.staff_cost_hour)
                                 * A1.dt.reputation_mult
        </formula>
        <formula id="A9.risk.3">
          redundancy_roi_years = redundancy_capex_overhead_USD / annual_risk_cost_USD
          <!-- если < 2 лет — резервирование финансово оправдано -->
        </formula>
        <!-- Справка: стоимость простоя enterprise-DC: $1M–$5M/ч (CoreSite survey) -->
        <!-- SMB/mid-market: $10K–$100K/ч в зависимости от отрасли -->
      </risk-calc>
    </redundancy-matrix>

    <!-- ─────────────────────────────────────────────────────────────────────────────────
         A10. BACKUP / DR / RTO BLOCK
         Расчёт системы резервного копирования + время простоя с учётом
         скорости сети и человеческого фактора.
         Источники: Axcient RTO Calculator, Fidalia DR Calculator, Cloudian RTO Guide,
                    Datto RTO Calculator, Druva RPO Guide, Reddit r/sysadmin RTO thread
         ───────────────────────────────────────────────────────────────────────────────── -->
    <backup-block id="A10" name="Backup and DR Sizing with RTO Calculator">

      <!-- A10.1 — BACKUP SIZING -->
      <section id="A10.1" name="Backup Storage Sizing">
        <formula id="A10.1.1" name="Daily changed data (incremental source)">
          daily_changed_GB = protected_data_GB * daily_change_rate_pct / 100
          <!-- typical change rates: DB=5-15% | Files=1-3% | VM full=0.5-2% | Exchange=3-5% -->
        </formula>
        <formula id="A10.1.2" name="Backup repository raw size">
          backup_raw_GB = full_backup_GB
                        + (daily_changed_GB * incrementals_count)
                        + (full_backup_GB * full_copies_count)
          <!-- multiplied by RF if replicated backup -->
        </formula>
        <formula id="A10.1.3" name="Effective backup size after dedup/compress">
          backup_effective_GB = backup_raw_GB / (A1.dc.backup_dedup * A1.dc.backup_comp)
          <!-- backup_dedup=15x, backup_comp=3x → effective ratio ~45x -->
        </formula>
        <formula id="A10.1.4" name="Backup appliance capacity needed">
          backup_capacity_TB = backup_effective_GB * retention_weeks * 7 / 1024 * headroom_1.2
        </formula>
        <formula id="A10.1.5" name="Required backup window bandwidth">
          required_bw_Gbps = daily_changed_GB * 8 / (backup_window_hours * 3600)
          <!-- if required_bw_Gbps > available_bw → reduce window or add bandwidth -->
          <!-- Источник: Druva — source dedup transfers only unique changed blocks -->
        </formula>
      </section>

      <!-- A10.2 — RPO CALCULATION -->
      <section id="A10.2" name="RPO – Recovery Point Objective">
        <formula id="A10.2.1" name="Maximum data loss (RPO)">
          rpo_hours = MIN(mad_hours, backup_interval_hours)
          <!-- mad_hours: Maximum Allowable Downtime от BIA -->
          <!-- backup_interval: hourly=1 | daily=24 | weekly=168 -->
        </formula>
        <formula id="A10.2.2" name="Data loss in GB at RPO">
          data_loss_GB = daily_changed_GB * (backup_interval_hours / 24)
        </formula>
      </section>

      <!-- A10.3 — RTO CALCULATION: сетевое время + человеческий фактор -->
      <section id="A10.3" name="RTO – Recovery Time Objective with Human Factors">
        <description>
          Полное время восстановления складывается из технических задержек (сеть, диск)
          и человеческих факторов (диагностика, эскалация, вендор, верификация).
          Источник: Axcient RTO Calculator, Fidalia DR Time Calculator, Kelser RTO Tool
        </description>

        <formula id="A10.3.1" name="Network restore time (data transfer component)">
          t_network_hours = restore_data_GB / (restore_bw_Gbps * 125)
          <!-- restore_bw_Gbps * 125 = MB/s (1 Gbps = 125 MB/s) -->
          <!-- restore_bw: локальная сеть=1-10 Gbps | WAN/Cloud=0.1-1 Gbps -->
        </formula>

        <formula id="A10.3.2" name="Disk write time during restore">
          t_disk_write_hours = restore_data_GB / (disk_write_speed_MBps * 3.6)
          <!-- disk_write_speed: HDD=100-200 MB/s | SSD=400-600 MB/s | NVMe=2000-7000 MB/s -->
        </formula>

        <formula id="A10.3.3" name="Human factor delay stack">
          <!-- Все константы из A1.hf.* -->
          t_human_hours = (  A1.hf.triage_min          <!--  30 min: L1 диагностирует -->
                           + A1.hf.escalate_min         <!--  15 min: эскалирует L2 -->
                           + A1.hf.l2_response_min      <!--  45 min: L2 реагирует -->
                           + t_vendor_response_min      <!--  вариант: NBD=1440, 4h=240, 6h=360 -->
                           + t_parts_logistics_min      <!--  доставка запчастей (локальный склад=0..60) -->
                           + t_hw_replacement_min       <!--  физическая замена: 30-120 min -->
                           + t_os_reinstall_min         <!--  переустановка OS: 60-240 min если нет образа -->
                           + t_restore_verification_min <!--  тест корректности: 30-120 min -->
                          ) / 60
        </formula>

        <formula id="A10.3.4" name="Total RTO">
          rto_total_hours = t_network_hours
                          + t_disk_write_hours
                          + t_human_hours
                          + t_app_startup_hours
          <!-- t_app_startup: cold start DB/App: 5-60 min -->
        </formula>

        <formula id="A10.3.5" name="RTO with hot standby (failover scenario)">
          rto_failover_hours = t_human_hours * 0.3
          <!-- hot standby: нет передачи данных; только переключение + верификация -->
          <!-- реальный RTO: 5-30 мин при автоматическом failover (Pacemaker/Corosync/VRRP) -->
        </formula>

        <formula id="A10.3.6" name="Downtime cost at calculated RTO">
          rto_cost_USD = rto_total_hours
                        * (A1.dt.revenue_hour_usd + A1.dt.staff_cost_hour)
                        * A1.dt.reputation_mult
        </formula>
      </section>

      <!-- A10.4 — BACKUP TIER RECOMMENDATIONS -->
      <section id="A10.4" name="Backup Tier Selection by RTO Target">
        <tier id="A10.4.t1" rto_target="Less than 1 hour" name="Hot Standby / Active-Active">
          <solution>Veeam Instant Recovery | Zerto CJR | Active-Active cluster</solution>
          <storage_type>Same-site all-flash replica</storage_type>
          <network_req>10+ Gbps local, synchronous replication</network_req>
          <capex_mult>2.0x</capex_mult>  <!-- относительно no-HA baseline -->
          <notes>Автоматический failover; A10.3.5 применяется; DR test ежеквартально</notes>
        </tier>
        <tier id="A10.4.t2" rto_target="1–4 hours" name="Warm Standby / Near-CDP">
          <solution>Veeam SOBR + offsite | Nakivo | Acronis Cyber Backup</solution>
          <storage_type>Local fast disk + cloud or remote site</storage_type>
          <network_req>1+ Gbps, async replication interval ≤15 min</network_req>
          <capex_mult>1.4x</capex_mult>
          <notes>A10.3.1–A10.3.4 применяется; restore from local cache</notes>
        </tier>
        <tier id="A10.4.t3" rto_target="4–24 hours" name="Scheduled Backup + Restore">
          <solution>Veeam B&R | Bacula | Amanda | Restic | Duplicati</solution>
          <storage_type>Local NAS + tape or cloud (S3/glacier)</storage_type>
          <network_req>100+ Mbps; restore via WAN acceptable</network_req>
          <capex_mult>1.1x</capex_mult>
          <notes>Full RTO formula A10.3.4 применяется; требует выездного инженера при HW failure</notes>
        </tier>
        <tier id="A10.4.t4" rto_target="More than 24 hours" name="Cold Backup / Tape">
          <solution>Tape (LTO-9) | S3 Glacier | Disk-to-tape</solution>
          <storage_type>Tape library | Glacier Deep Archive</storage_type>
          <network_req>Minimal; restore может занимать 24-72h</network_req>
          <capex_mult>1.0x</capex_mult>
          <notes>Только для non-critical data; NBD vendor support достаточен</notes>
        </tier>
      </section>

      <!-- A10.5 — BACKUP SIZING INPUTS/OUTPUTS -->
      <inputs>
        <input id="A10.in.protected_gb"   name="Protected data total (GB)"        placeholder="{{PROTECTED_DATA_GB}}"/>
        <input id="A10.in.change_pct"     name="Daily change rate (%)"            placeholder="{{DAILY_CHANGE_PCT}}"/>
        <input id="A10.in.retention_days" name="Retention period (days)"          placeholder="{{RETENTION_DAYS}}"/>
        <input id="A10.in.full_freq"      name="Full backup frequency (days)"     placeholder="{{FULL_BACKUP_FREQ_DAYS}}"/>
        <input id="A10.in.bkp_window"     name="Backup window (hours)"            placeholder="{{BACKUP_WINDOW_H}}"/>
        <input id="A10.in.restore_bw"     name="Restore bandwidth (Gbps)"        placeholder="{{RESTORE_BW_GBPS}}"/>
        <input id="A10.in.disk_write"     name="Target disk write speed (MB/s)"  placeholder="{{DISK_WRITE_MBPS}}"/>
        <input id="A10.in.rto_target_h"   name="Target RTO (hours)"              placeholder="{{RTO_TARGET_H}}"/>
        <input id="A10.in.rpo_target_h"   name="Target RPO (hours)"              placeholder="{{RPO_TARGET_H}}"/>
        <input id="A10.in.vendor_sla"     name="Vendor hardware SLA"             placeholder="{{VENDOR_SLA}}"/>
        <!-- ENUM: NBD | 4h | 6h | spares-on-site | hot-standby -->
      </inputs>
      <outputs>
        <output id="A10.out.backup_tb"    name="Backup repo capacity needed (TB)" formula="A10.1.4"/>
        <output id="A10.out.req_bw"       name="Required backup bandwidth (Gbps)" formula="A10.1.5"/>
        <output id="A10.out.rpo_h"        name="Achievable RPO (hours)"          formula="A10.2.1"/>
        <output id="A10.out.rto_net_h"    name="RTO: network transfer (hours)"   formula="A10.3.1"/>
        <output id="A10.out.rto_disk_h"   name="RTO: disk write (hours)"         formula="A10.3.2"/>
        <output id="A10.out.rto_human_h"  name="RTO: human factor (hours)"       formula="A10.3.3"/>
        <output id="A10.out.rto_total_h"  name="Total RTO (hours)"               formula="A10.3.4"/>
        <output id="A10.out.rto_cost"     name="Downtime cost at RTO (USD)"      formula="A10.3.6"/>
        <output id="A10.out.tier"         name="Recommended backup tier"         ref="A10.4"/>
      </outputs>
    </backup-block>

    <!-- ─────────────────────────────────────────────────────────────────────────────────
         A11. CAPEX / OPEX / TCO / ROI BLOCK
         Источники: Brilyant TCO Guide, Infracost TCO Glossary, TierPoint Cloud TCO,
                    Cloudvara Cloud vs On-Premise Costs, envigilance CAPEX/OPEX Guide
         ───────────────────────────────────────────────────────────────────────────────── -->
    <financial-block id="A11" name="CAPEX OPEX TCO ROI">

      <section id="A11.1" name="CAPEX — Capital Expenditure">
        <formula id="A11.1.1" name="Hardware CAPEX">
          capex_hw_USD = SUM(unit_price_USD * quantity) for all hardware BOM items
        </formula>
        <formula id="A11.1.2" name="Software licenses (perpetual) CAPEX">
          capex_sw_USD = SUM(perpetual_license_price * license_count)
        </formula>
        <formula id="A11.1.3" name="Networking CAPEX">
          capex_net_USD = SUM(switch_price + cables + SFP_price)
        </formula>
        <formula id="A11.1.4" name="Rack and facility fit-out CAPEX">
          capex_facility_USD = rack_price + pdu_price + cabling + cooling_upgrade
        </formula>
        <formula id="A11.1.5" name="Implementation and migration CAPEX">
          capex_impl_USD = engineer_days * day_rate_USD + migration_tool_cost
        </formula>
        <formula id="A11.1.6" name="Total CAPEX">
          total_capex_USD = capex_hw + capex_sw + capex_net + capex_facility + capex_impl
        </formula>
        <formula id="A11.1.7" name="Redundancy overhead CAPEX">
          capex_redundancy_USD = total_capex_baseline * redundancy_overhead_pct / 100
          <!-- N+1: +20% | 2N: +80% | 2(N+1): +150% — из A9 -->
        </formula>
      </section>

      <section id="A11.2" name="OPEX — Operational Expenditure (annual)">
        <formula id="A11.2.1" name="Power cost (annual)">
          opex_power_USD = facility_W / 1000 * 8760 * electricity_rate_USD_per_kWh
          <!-- facility_W из A8.5; electricity_rate: RU~$0.05–$0.08 | EU~$0.15–$0.25 -->
        </formula>
        <formula id="A11.2.2" name="Software subscriptions (annual)">
          opex_sw_USD = SUM(annual_subscription_price * license_count)
        </formula>
        <formula id="A11.2.3" name="Hardware maintenance and support (annual)">
          opex_hw_maint_USD = total_capex_hw * maintenance_rate_pct / 100
          <!-- typical: 3–8% of HW CAPEX per year -->
        </formula>
        <formula id="A11.2.4" name="Staffing cost (annual)">
          opex_staff_USD = fte_count * avg_salary_USD * employer_overhead_mult
          <!-- employer_overhead: 1.3–1.5x salary (taxes, benefits) -->
        </formula>
        <formula id="A11.2.5" name="Colocation / rack rental (annual, if applicable)">
          opex_colo_USD = rack_count * monthly_rack_rent_USD * 12
        </formula>
        <formula id="A11.2.6" name="Total annual OPEX">
          total_opex_annual_USD = opex_power + opex_sw + opex_hw_maint + opex_staff + opex_colo
        </formula>
      </section>

      <section id="A11.3" name="TCO — Total Cost of Ownership (N-year)">
        <formula id="A11.3.1" name="TCO over N years">
          tco_USD = total_capex_USD + (total_opex_annual_USD * tco_years)
          <!-- standard: 3yr | 5yr -->
        </formula>
        <formula id="A11.3.2" name="Cost per VM per year">
          cost_per_vm_year = tco_USD / tco_years / total_vm_count
        </formula>
        <formula id="A11.3.3" name="Cost per vCPU per year">
          cost_per_vcpu_year = tco_USD / tco_years / total_vcpu
        </formula>
        <formula id="A11.3.4" name="Cost per usable TB per year">
          cost_per_tb_year = tco_USD / tco_years / total_usable_tb
        </formula>
      </section>

      <section id="A11.4" name="ROI — Return on Investment">
        <formula id="A11.4.1" name="Annual savings vs baseline (e.g. cloud or legacy)">
          annual_savings_USD = baseline_annual_cost_USD - total_opex_annual_USD
          <!-- baseline: cloud cost | legacy server cost | outsourcing cost -->
        </formula>
        <formula id="A11.4.2" name="ROI (%)">
          roi_pct = (annual_savings_USD * tco_years - total_capex_USD)
                    / total_capex_USD * 100
        </formula>
        <formula id="A11.4.3" name="Payback period (years)">
          payback_years = total_capex_USD / annual_savings_USD
        </formula>
        <formula id="A11.4.4" name="NPV at discount rate">
          npv_USD = SUM[ annual_savings_USD / (1 + discount_rate)^t for t in 1..N ]
                  - total_capex_USD
          <!-- discount_rate: 0.08–0.15 typical -->
        </formula>
        <formula id="A11.4.5" name="Redundancy ROI">
          redundancy_roi_years = capex_redundancy_USD / annual_risk_cost_USD
          <!-- из A9.risk.3; если < 2 лет — резервирование финансово обоснованно -->
        </formula>
      </section>

    </financial-block>

  </calc-library>

  <!-- ====================================================================================
       PART B — WORKLOAD PROFILES
       Каждый профиль ссылается на блоки Part A, переопределяя только специфические параметры.
       ==================================================================================== -->
  <workload-profiles>

    <!-- B1. GENERAL VM / MIXED WORKLOAD -->
    <profile id="B1" name="General VM / Mixed Workload">
      <inherits-calc>A2 A3 A4 A5 A6 A8 A9 A10 A11</inherits-calc>
      <overrides>
        <override calc="A2" param="vcpu_pcpu_ratio"  value-ref="A1.cpu.general"/>  <!-- 4:1 -->
        <override calc="A4" param="dedup_ratio"       value-ref="A1.dc.general_dedup"/>
        <override calc="A4" param="compress_ratio"    value-ref="A1.dc.general_comp"/>
        <override calc="A4" param="rf"                value-ref="A1.rf.rf2"/>
      </overrides>
      <inputs>
        <input name="Total vCPU"          placeholder="{{B1_TOTAL_VCPU}}"/>
        <input name="Total VM RAM (GB)"   placeholder="{{B1_TOTAL_VM_RAM_GB}}"/>
        <input name="Usable storage (TB)" placeholder="{{B1_USABLE_TB}}"/>
        <input name="VM count"            placeholder="{{B1_VM_COUNT}}"/>
      </inputs>
    </profile>

    <!-- B2. VDI -->
    <profile id="B2" name="VDI (Virtual Desktop Infrastructure)">
      <inherits-calc>A2 A3 A4 A5 A6 A8 A9 A10 A11</inherits-calc>
      <overrides>
        <override calc="A2" param="vcpu_pcpu_ratio"  value-ref="A1.cpu.vdi"/>      <!-- 8:1 -->
        <override calc="A4" param="dedup_ratio"       value-ref="A1.dc.vdi_dedup"/> <!-- 4x -->
        <override calc="A4" param="compress_ratio"    value-ref="A1.dc.vdi_comp"/>  <!-- 2x -->
      </overrides>
      <vdi-specific>
        <formula id="B2.1" name="VDI desktop sizing">
          desktop_vcpu = 2..4 per desktop (type: task|knowledge|power)
          desktop_ram_GB = 2..8 per desktop
          desktop_storage_GB = 20..80 per desktop (persistent) | 5..15 (non-persistent)
        </formula>
        <formula id="B2.2" name="Concurrent session ratio for VDI">
          concurrent_sessions = total_desktops * concurrency_ratio
          <!-- office=0.60 | shift-work=0.85 -->
        </formula>
      </vdi-specific>
      <inputs>
        <input name="Total desktops"        placeholder="{{B2_DESKTOP_COUNT}}"/>
        <input name="vCPU per desktop"      placeholder="{{B2_VCPU_PER_DESKTOP}}"/>
        <input name="RAM per desktop (GB)"  placeholder="{{B2_RAM_PER_DESKTOP_GB}}"/>
        <input name="Storage per desktop (GB)" placeholder="{{B2_STORAGE_GB}}"/>
        <input name="Concurrency ratio"     placeholder="{{B2_CONCURRENCY}}"/>
      </inputs>
    </profile>

    <!-- B3. DATABASE -->
    <profile id="B3" name="Database (OLTP / OLAP / HTAP)">
      <inherits-calc>A2 A3 A4 A5 A6 A8 A9 A10 A11</inherits-calc>
      <overrides>
        <override calc="A2" param="vcpu_pcpu_ratio"  value="1.5"/>  <!-- prod DB -->
        <override calc="A4" param="dedup_ratio"       value-ref="A1.dc.db_dedup"/>
        <override calc="A4" param="compress_ratio"    value-ref="A1.dc.db_comp"/>
        <override calc="A4" param="rf"                value-ref="A1.rf.rf3"/>       <!-- RF3 для prod DB -->
      </overrides>
      <db-specific>
        <formula id="B3.1" name="Buffer pool sizing (OLTP)">
          buffer_pool_GB = active_dataset_GB * 1.25
          <!-- Rule: горячие данные должны помещаться в память -->
        </formula>
        <formula id="B3.2" name="OLAP / DWH memory">
          olap_ram_GB = MAX( table_size_GB * 2, compressed_columnstore_GB * 3 )
        </formula>
        <formula id="B3.3" name="Log volume sizing">
          log_volume_GB = daily_transaction_GB * 3
          <!-- 3x: peak + peak*2 headroom for log shipping/mirroring -->
        </formula>
        <formula id="B3.4" name="IOPS for database">
          db_iops = tps * avg_io_per_transaction
          <!-- OLTP: 8K random read/write; OLAP: 64K-1M sequential -->
          <!-- Requirement: NVMe или SAS SSD для prod OLTP -->
        </formula>
      </db-specific>
    </profile>

    <!-- B4. WEB / APPLICATION TIER -->
    <profile id="B4" name="Web and Application Tier">
      <inherits-calc>A2 A3 A4 A5 A6 A8 A9 A10 A11</inherits-calc>
      <overrides>
        <override calc="A2" param="vcpu_pcpu_ratio"  value-ref="A1.cpu.web"/>
        <override calc="A3" param="user_formula"     ref="A3.7"/>
      </overrides>
      <web-specific>
        <formula id="B4.1" name="Web tier horizontal scaling">
          <!-- ProcessMaker / ECOSIRE formula -->
          server_count = CEILING( (tm * rl) / max_ram_per_server_GB )
          <!-- rl=redundancy level (min 2); tm=total memory; mps=max per server -->
          <!-- если sc=1 (single server) → нет HA → риск A9.N -->
        </formula>
        <formula id="B4.2" name="Redis/cache server sizing">
          redis_ram_GB = hot_data_GB * 1.5
          <!-- hot_data: 10-30% от общего объёма данных приложения -->
          <!-- При 30+ concurrent users → обязателен Redis / Memcached -->
          <!-- Источник: ECOSIRE ERP Sizer "At 30-50 concurrent users, add Redis" -->
        </formula>
      </web-specific>
    </profile>

    <!-- B5. SAP HANA / ERP-IN-MEMORY -->
    <profile id="B5" name="SAP HANA and ERP In-Memory">
      <inherits-calc>A2 A3 A4 A5 A6 A8 A9 A10 A11</inherits-calc>
      <overrides>
        <override calc="A2" param="vcpu_pcpu_ratio" value-ref="A1.cpu.sap_hana"/> <!-- 1:1 -->
      </overrides>
      <hana-specific>
        <formula id="B5.1" name="SAP HANA RAM sizing">
          hana_ram_GB = compressed_column_store_GB * 3
          <!-- HANA loads all data into memory; compression ratio ~3-7x -->
          <!-- + 50% overhead for query processing and peak headroom -->
          hana_total_ram_GB = hana_ram_GB * 1.5
        </formula>
        <formula id="B5.2" name="HANA persistence volume">
          hana_persist_GB = hana_ram_GB * 1.5
          <!-- log + data volumes; NVMe required for writes >500 MB/s -->
        </formula>
        <formula id="B5.3" name="HANA backup sizing">
          hana_backup_GB = hana_persist_GB * backup_copies * (1 / dedup_ratio)
          <!-- backint interface; Veeam for SAP HANA agent-based -->
        </formula>
      </hana-specific>
    </profile>

    <!-- B6. EXCHANGE / COLLABORATION -->
    <profile id="B6" name="Exchange and Collaboration">
      <inherits-calc>A2 A3 A4 A5 A6 A8 A9 A10 A11</inherits-calc>
      <overrides>
        <override calc="A2" param="vcpu_pcpu_ratio" value-ref="A1.cpu.exchange"/>  <!-- 2:1 -->
        <override calc="A10" param="daily_change_pct" value="5"/>  <!-- Exchange: 3-5% change rate -->
      </overrides>
      <exchange-specific>
        <formula id="B6.1" name="Exchange mailbox storage">
          mailbox_storage_GB = mailbox_count * mailbox_size_GB * 1.20
          <!-- +20%: дополнительные SMTP-очереди, логи, временные файлы -->
          exchange_db_overhead = mailbox_storage_GB * 1.10
          <!-- +10%: whitespace, ESE overhead -->
        </formula>
        <formula id="B6.2" name="DAG (Database Availability Group)">
          dag_copies = 2..4
          dag_storage_TB = exchange_db_GB * dag_copies / 1024
        </formula>
      </exchange-specific>
    </profile>

    <!-- B7. AI INFERENCE -->
    <profile id="B7" name="AI Inference (vLLM / llama.cpp / Triton)">
      <inherits-calc>A2 A7 A8 A9 A10 A11</inherits-calc>
      <overrides>
        <override calc="A7" param="all" use-full-block="true"/>
      </overrides>
      <inference-specific>
        <formula id="B7.1" name="SLA-driven GPU count">
          <!-- Target: latency-first vs throughput-first -->
          gpu_count_latency = CEILING( vram_total_GB / gpu_vram_GB )
          gpu_count_throughput = CEILING( target_rps * avg_latency_s / concurrent_slots )
          gpu_count_final = MAX( gpu_count_latency, gpu_count_throughput )
        </formula>
        <formula id="B7.2" name="vLLM tensor parallelism">
          tp_degree = gpu_count if NVLink else 1..2
          <!-- Рекомендация: TP внутри сервера (NVLink), PP между серверами -->
        </formula>
      </inference-specific>
    </profile>

    <!-- B8. AI TRAINING / FINE-TUNING -->
    <profile id="B8" name="AI Training and Fine-Tuning">
      <inherits-calc>A2 A7 A8 A9 A10 A11</inherits-calc>
      <training-specific>
        <formula id="B8.1" name="Full fine-tune VRAM (LoRA vs full)">
          vram_full_train_GB = model_params_B * 16
          <!-- 16 bytes per param FP32 training: weights(4) + gradients(4) + optimizer(8) -->
          vram_lora_GB = model_params_B * 2 + lora_rank * model_hidden_dim * num_layers * 4
          <!-- LoRA: только base weights BF16 + trainable adapters FP32 -->
          vram_qlora_GB = model_params_B * 0.5 + lora_overhead_GB
          <!-- QLoRA: INT4 base + FP16 adapters; практически самый экономный вариант -->
        </formula>
        <formula id="B8.2" name="Training throughput vs GPU memory">
          training_samples_per_sec = gpu_count * batch_size_per_gpu * gradient_accumulation
          effective_batch = batch_size_per_gpu * gpu_count * gradient_accumulation
          <!-- effective batch for LLM fine-tune: 64–512 -->
        </formula>
        <formula id="B8.3" name="InfiniBand requirement for multi-node training">
          <!-- All-reduce latency dominates for small models; bandwidth for large -->
          min_ib_bw_GBps = 2 * (N-1)/N * model_params_B * 2 / iteration_time_s
          <!-- Практически: NDR400 InfiniBand для >1 сервера с H100/H200 -->
        </formula>
      </training-specific>
    </profile>

    <!-- B9. HPC / MPI CLUSTER -->
    <profile id="B9" name="HPC and MPI Cluster">
      <inherits-calc>A2 A3 A4 A5 A6 A8 A9 A10 A11</inherits-calc>
      <hpc-specific>
        <formula id="B9.1" name="MPI parallel efficiency">
          node_count = CEILING( total_core_hours / (cores_per_node * job_wall_hours) )
          parallel_efficiency_pct = amdahl_speedup_factor * 100
          <!-- Закон Амдаля: S = 1 / (1 - P + P/N); P=параллельная часть -->
        </formula>
        <formula id="B9.2" name="Scratch storage for HPC">
          scratch_TB = peak_checkpoint_size_GB * simultaneous_jobs / 1024
          <!-- Parallel filesystem: Lustre, GPFS/Scale, BeeGFS -->
          <!-- Minimum: 10 Gbps per node; InfiniBand HDR/NDR для tightly-coupled -->
        </formula>
      </hpc-specific>
    </profile>

    <!-- B10. EDGE / IoT GATEWAY -->
    <profile id="B10" name="Edge and IoT Gateway">
      <inherits-calc>A2 A3 A4 A8 A9 A10 A11</inherits-calc>
      <edge-specific>
        <formula id="B10.1" name="Edge node sizing">
          edge_cpu_cores = concurrent_inference_streams * cores_per_stream
          edge_ram_GB = model_vram_GB + os_overhead_GB + buffer_GB
          edge_storage_GB = model_size_GB + data_buffer_days * daily_data_GB
        </formula>
        <formula id="B10.2" name="Edge HA (limited options)">
          <!-- Edge: typically N+1 at node level; no 2N due to cost/space -->
          local_fallback = heartbeat_based_failover OR manual_intervention
          sync_interval_min = acceptable_rpo_min
        </formula>
      </edge-specific>
    </profile>

  </workload-profiles>

  <!-- ====================================================================================
       PART C — COMPONENTS BOM (hardware и software строки)
       ==================================================================================== -->
  <components>

    <!-- C1. SERVER NODE (переиспользуется всеми профилями) -->
    <component id="C1" type="device" ref-profile="{{PROFILE_ID}}">
      <field name="vendor"                 placeholder="{{SERVER_VENDOR}}"/>
      <!-- ENUM: HPE|Dell|Cisco|Lenovo|Supermicro|Huawei|Inspur|ASUS -->
      <field name="model"                  placeholder="{{SERVER_MODEL}}"/>
      <field name="sku"                    placeholder="{{SERVER_SKU}}"/>
      <field name="quantity"               formula-ref="A2.out.nodes_cpu A3.out.nodes_ram A4.out.nodes_str" note="MAX of these + A9 ha_nodes"/>
      <field name="formfactor"             placeholder="{{FORM_FACTOR}}"/>
      <!-- ENUM: 1U|2U|4U|blade|tower|hci-node|gpu-server -->
      <field name="cpu_model"              placeholder="{{CPU_MODEL}}"/>
      <field name="cpu_sockets"            formula-ref="A2.out.sockets"/>
      <field name="cpu_cores_per_socket"   placeholder="{{CORES_PER_SOCKET}}"/>
      <field name="cpu_tdp_w"              placeholder="{{CPU_TDP_W}}"/>
      <field name="ram_total_gb"           formula-ref="A3.out.ram_node"/>
      <field name="dimm_capacity_gb"       placeholder="{{DIMM_CAPACITY_GB}}"/>
      <field name="dimm_count"             formula-ref="A3.out.dimm_cnt"/>
      <field name="dimm_type"              placeholder="{{DIMM_TYPE}}"/>
      <!-- ENUM: DDR4 RDIMM|DDR5 RDIMM|DDR5 LRDIMM|MRDIMM -->
      <field name="drive_type_data"        placeholder="{{DATA_DRIVE_TYPE}}"/>
      <!-- ENUM: NVMe PCIe 5.0|NVMe PCIe 4.0|SAS SSD|SATA SSD|SAS HDD|SATA HDD -->
      <field name="drive_count_data"       formula-ref="A4.out.drives"/>
      <field name="drive_capacity_tb"      placeholder="{{DATA_DRIVE_TB}}"/>
      <field name="nic_model"              placeholder="{{NIC_MODEL}}"/>
      <field name="nic_speed_gbps"         placeholder="{{NIC_SPEED_GBPS}}"/>
      <!-- ENUM: 1|10|25|40|100|200|400 -->
      <field name="nic_protocol"           placeholder="{{NIC_PROTOCOL}}"/>
      <!-- ENUM: Ethernet|InfiniBand HDR200|NDR400|RoCEv2|FC32G -->
      <field name="gpu_model"              placeholder="{{GPU_MODEL}}"/>
      <field name="gpu_count"              formula-ref="A7.out.gpu_cnt"/>
      <field name="gpu_vram_gb"            placeholder="{{GPU_VRAM_GB}}"/>
      <field name="psu_count"              placeholder="{{PSU_COUNT}}"/>
      <field name="psu_w"                  formula-ref="A8.2" note="PSU >= server_tdp * 1.20"/>
      <field name="psu_redundancy"         placeholder="{{PSU_REDUNDANCY}}"/>
      <!-- ENUM: 1+1|2+1|N+1 -->
      <field name="bmc"                    placeholder="{{BMC_MODEL}}"/>
      <!-- ENUM: iLO 6|iDRAC 10|XCC4|CIMC 4.0 -->
      <field name="unit_price_usd"         placeholder="{{UNIT_PRICE_USD}}"/>
      <field name="warranty"               placeholder="{{WARRANTY_TYPE}}"/>
      <!-- ENUM: NBD|4h|6h|Mission Critical -->
      <field name="hs_code"                placeholder="{{HS_CODE}}"/>
      <!-- e.g. 8471.50 -->
    </component>

    <!-- C2. SWITCH -->
    <component id="C2" type="device">
      <field name="vendor"                 placeholder="{{SWITCH_VENDOR}}"/>
      <field name="model"                  placeholder="{{SWITCH_MODEL}}"/>
      <field name="role"                   placeholder="{{SWITCH_ROLE}}"/>
      <!-- ENUM: ToR|Leaf|Spine|Core|OOB -->
      <field name="port_speed_gbps"        placeholder="{{SWITCH_PORT_SPEED_GBPS}}"/>
      <field name="port_count"             placeholder="{{SWITCH_PORT_COUNT}}"/>
      <field name="rdma_roce"              placeholder="{{RDMA_ROCE_SUPPORTED}}"/>
      <field name="quantity"               formula-ref="A6.out.uplinks" note="min 2 for N+1"/>
      <field name="unit_price_usd"         placeholder="{{SWITCH_PRICE_USD}}"/>
    </component>

    <!-- C3. STORAGE ARRAY (external, skip for HCI) -->
    <component id="C3" type="device" conditional="not_hci">
      <field name="vendor"                 placeholder="{{STORAGE_VENDOR}}"/>
      <field name="model"                  placeholder="{{STORAGE_MODEL}}"/>
      <field name="raw_capacity_tb"        formula-ref="A4.out.raw_tb"/>
      <field name="usable_capacity_tb"     placeholder="{{USABLE_TB}}"/>
      <field name="protocol"               placeholder="{{STORAGE_PROTOCOL}}"/>
      <!-- ENUM: FC 32G|iSCSI|NFS v4.1|NVMe/TCP|NVMe/FC|S3 -->
      <field name="max_iops"               formula-ref="A5.out.iops"/>
      <field name="unit_price_usd"         placeholder="{{STORAGE_PRICE_USD}}"/>
    </component>

    <!-- C4. RACK & PDU -->
    <component id="C4" type="device">
      <field name="height_u"               placeholder="{{RACK_HEIGHT_U}}"/>
      <!-- standard: 42U|47U|52U -->
      <field name="power_capacity_kw"      formula-ref="A8.3" note="rack_power_W / 1000"/>
      <field name="cooling_type"           placeholder="{{RACK_COOLING}}"/>
      <!-- ENUM: air|rear-door|in-row|direct-liquid|immersion -->
      <field name="pdu_type"               placeholder="{{PDU_TYPE}}"/>
      <!-- ENUM: basic|switched|metered|ATS dual|3-phase -->
      <field name="dc_tier"                placeholder="{{DC_TIER}}"/>
      <!-- ENUM: Tier I|Tier II|Tier III|Tier IV -->
      <field name="quantity"               placeholder="{{RACK_COUNT}}"/>
      <field name="unit_price_usd"         placeholder="{{RACK_PRICE_USD}}"/>
    </component>

    <!-- C5. OS LICENSE -->
    <component id="C5" type="software">
      <field name="name"                   placeholder="{{OS_NAME}}"/>
      <field name="version"                placeholder="{{OS_VERSION}}"/>
      <field name="license_model"          placeholder="{{OS_LICENSE_MODEL}}"/>
      <!-- ENUM: per-socket|per-core|per-node|per-VM|perpetual|subscription -->
      <field name="quantity"               formula-ref="C1.quantity" note="= server count"/>
      <field name="unit_price_usd"         placeholder="{{OS_UNIT_PRICE_USD}}"/>
      <field name="sub_years"              placeholder="{{OS_SUB_YEARS}}"/>
    </component>

    <!-- C6. MANAGEMENT SW -->
    <component id="C6" type="software">
      <field name="name"                   placeholder="{{MGMT_SW}}"/>
      <!-- e.g. Nutanix AOS|VMware vCenter|Prometheus+Grafana|Zabbix|Datadog -->
      <field name="license_model"          placeholder="{{MGMT_LICENSE_MODEL}}"/>
      <field name="quantity"               placeholder="{{MGMT_LICENSE_COUNT}}"/>
      <field name="unit_price_usd"         placeholder="{{MGMT_UNIT_PRICE_USD}}"/>
    </component>

    <!-- C7. BACKUP APPLIANCE / AGENT -->
    <component id="C7" type="device-software">
      <field name="backup_software"        placeholder="{{BACKUP_SW}}"/>
      <!-- ENUM: Veeam B&R|Acronis|Nakivo|Bacula|Restic|Commvault -->
      <field name="backup_repo_type"       placeholder="{{BACKUP_REPO_TYPE}}"/>
      <!-- ENUM: local-NAS|cloud-S3|tape-LTO9|cloud-glacier|dedup-appliance -->
      <field name="backup_capacity_tb"     formula-ref="A10.out.backup_tb"/>
      <field name="backup_bw_gbps_req"     formula-ref="A10.out.req_bw"/>
      <field name="rpo_hours"              formula-ref="A10.out.rpo_h"/>
      <field name="rto_hours_total"        formula-ref="A10.out.rto_total_h"/>
      <field name="rto_hours_network"      formula-ref="A10.out.rto_net_h"/>
      <field name="rto_hours_disk"         formula-ref="A10.out.rto_disk_h"/>
      <field name="rto_hours_human"        formula-ref="A10.out.rto_human_h"/>
      <field name="rto_cost_usd"           formula-ref="A10.out.rto_cost"/>
      <field name="recommended_tier"       formula-ref="A10.out.tier"/>
      <field name="vendor_hw_sla"          placeholder="{{VENDOR_HW_SLA}}"/>
      <!-- ENUM: NBD|4h|6h|spares-on-site|hot-standby -->
      <field name="unit_price_usd"         placeholder="{{BACKUP_PRICE_USD}}"/>
    </component>

  </components>

  <!-- ====================================================================================
       PART D — FINANCIAL SUMMARY
       ==================================================================================== -->
  <financial-summary>

    <capex id="D1">
      <item name="Server hardware"     formula-ref="A11.1.1" value="{{CAPEX_HW_USD}}"/>
      <item name="Networking"          formula-ref="A11.1.3" value="{{CAPEX_NET_USD}}"/>
      <item name="Storage (external)"  formula-ref="A11.1.1" value="{{CAPEX_STOR_USD}}"/>
      <item name="Rack and PDU"        formula-ref="A11.1.4" value="{{CAPEX_RACK_USD}}"/>
      <item name="Software licenses"   formula-ref="A11.1.2" value="{{CAPEX_SW_USD}}"/>
      <item name="Implementation"      formula-ref="A11.1.5" value="{{CAPEX_IMPL_USD}}"/>
      <item name="Redundancy overhead" formula-ref="A11.1.7" value="{{CAPEX_REDUND_USD}}"/>
      <item name="Backup system"       ref="C7"              value="{{CAPEX_BACKUP_USD}}"/>
      <total name="Total CAPEX"        formula-ref="A11.1.6" value="{{TOTAL_CAPEX_USD}}"/>
    </capex>

    <opex id="D2" period="annual">
      <item name="Power (electricity)" formula-ref="A11.2.1" value="{{OPEX_POWER_USD}}"/>
      <item name="SW subscriptions"    formula-ref="A11.2.2" value="{{OPEX_SW_USD}}"/>
      <item name="HW maintenance"      formula-ref="A11.2.3" value="{{OPEX_HW_MAINT_USD}}"/>
      <item name="Staffing"            formula-ref="A11.2.4" value="{{OPEX_STAFF_USD}}"/>
      <item name="Colocation"          formula-ref="A11.2.5" value="{{OPEX_COLO_USD}}"/>
      <total name="Total annual OPEX"  formula-ref="A11.2.6" value="{{TOTAL_OPEX_ANNUAL_USD}}"/>
    </opex>

    <tco id="D3">
      <years>{{TCO_YEARS}}</years>
      <total formula-ref="A11.3.1"    value="{{TCO_TOTAL_USD}}"/>
      <per_vm_year formula-ref="A11.3.2" value="{{TCO_PER_VM_YEAR_USD}}"/>
      <per_tb_year formula-ref="A11.3.4" value="{{TCO_PER_TB_YEAR_USD}}"/>
    </tco>

    <roi id="D4">
      <baseline_annual_cost              value="{{BASELINE_ANNUAL_COST_USD}}"/>
      <annual_savings formula-ref="A11.4.1" value="{{ANNUAL_SAVINGS_USD}}"/>
      <roi_pct        formula-ref="A11.4.2" value="{{ROI_PCT}}"/>
      <payback_years  formula-ref="A11.4.3" value="{{PAYBACK_YEARS}}"/>
      <npv_usd        formula-ref="A11.4.4" value="{{NPV_USD}}"/>
      <discount_rate                     value="{{DISCOUNT_RATE}}"/>
    </roi>

    <!-- D5. СТОИМОСТЬ ПРОСТОЯ БЕЗ РЕЗЕРВИРОВАНИЯ -->
    <no-redundancy-risk id="D5">
      <description>
        Финансовая оценка риска эксплуатации без резервирования (уровень A9.N).
        Используется для обоснования CAPEX на HA-компоненты.
        Справка: enterprise-DC $1M–$5M/ч (CoreSite); SMB $10K–$100K/ч.
      </description>
      <input name="Revenue per hour (USD)"       value="{{DT_REVENUE_PER_HOUR_USD}}"/>
      <input name="Staff cost per hour (USD)"    value="{{DT_STAFF_COST_PER_HOUR_USD}}"/>
      <input name="Reputation multiplier"        value-ref="A1.dt.reputation_mult"/>     <!-- 1.5x -->
      <input name="Annual failure probability"   value="{{FAILURE_PROB_ANNUAL}}"/>
      <!-- e.g. HDD AFR=0.013; server failure=0.05; switch failure=0.02 -->
      <input name="Avg repair time (hours)"      value="{{AVG_REPAIR_TIME_H}}"/>

      <output name="Expected downtime per year (h)" formula-ref="A9.risk.1" value="{{EXP_DT_H_YEAR}}"/>
      <output name="Annual risk cost (USD)"          formula-ref="A9.risk.2" value="{{ANNUAL_RISK_COST_USD}}"/>
      <output name="Redundancy ROI payback (years)"  formula-ref="A9.risk.3" value="{{REDUND_ROI_YEARS}}"/>
      <output name="Break-even: add redundancy if payback" condition="lt 2 years" note="Если меньше 2 лет — резервирование финансово выгодно"/>

      <redundancy-comparison>
        <option level="A9.N"   annual_downtime_h="87.6"  annual_risk_usd="{{RISK_N_USD}}"   capex_overhead="0%"/>
        <option level="A9.N1"  annual_downtime_h="8.7"   annual_risk_usd="{{RISK_N1_USD}}"  capex_overhead="20%"/>
        <option level="A9.2N"  annual_downtime_h="0.87"  annual_risk_usd="{{RISK_2N_USD}}"  capex_overhead="80%"/>
        <option level="A9.2N1" annual_downtime_h="0.09"  annual_risk_usd="{{RISK_2N1_USD}}" capex_overhead="150%"/>
      </redundancy-comparison>
    </no-redundancy-risk>

  </financial-summary>

  <!-- ====================================================================================
       PART E — DEPENDENCY GRAPH & PROJECT SIGN-OFF
       ==================================================================================== -->
  <dependencies>
    <node ref="C1" depends-on="C2 C3 C4 C5 C6 C7"/>
    <node ref="C2" depends-on="C4"/>
    <node ref="C3" depends-on="C2 C4"/>
    <node ref="C7" depends-on="C2 C4" note="backup network path must be dedicated or QoS-isolated"/>
  </dependencies>

  <sign-off>
    <sizing-assumptions>{{SIZING_ASSUMPTIONS_TEXT}}</sizing-assumptions>
    <validated-by>{{VALIDATED_BY}}</validated-by>
    <approved-by>{{APPROVED_BY}}</approved-by>
    <review-date>{{REVIEW_DATE}}</review-date>
    <next-review-date>{{NEXT_REVIEW_DATE}}</next-review-date>
    <notes>{{NOTES}}</notes>
  </sign-off>

</sizing-framework>
