Rufineer v0.43.0
Account
Browse the docs

Example 5 of 13

Mbira combined

Based on mbira-combined-model.xlsm

A portfolio view that puts the toll road and border post side by side and adds them up. The workbook holds 15 sheets: five output sheets for each project and five combined ones. Design example: written in the full v0.5 language. The compiler builds the working core today, so this one doesn't compile yet. Source: examples/design/combined/.

Workbook
15 sheets: Toll_*, Brdr_* and Cmbnd_* (Metrics, S&U, FS Qtr, FS Ann, Output)
Outputs
Project cost, project IRR, blended equity IRR, min and average DSCR, cost of debt, WAL, leverage
Rebuild shown
1 files, 29 lines

Where each sheet goes

Workbook sheetsRufineer
Toll_* and Brdr_* sheetsinclude with a sheet prefix
Cmbnd_Metricsmodule cmbnd
Cmbnd_S&U, Cmbnd_FS Qtr, Cmbnd_FS Annstatement sums
Combined Summary, Cmbnd_Outputdashboard with columns

Source 1 files shown, 29 lines

portfolio.rfn
portfolio "Mbira Combined" {
  include "../toll"    as toll     prefix "Toll_"
  include "../border"  as border   prefix "Brdr_"
  show    [metrics, sources_uses, fs_quarterly, fs_annual, output]
}

module cmbnd "Combined" {
  project_cash: USD = toll.metrics.project_cash + border.metrics.project_cash
  equity_cash:  USD = toll.metrics.equity_cash  + border.metrics.equity_cash

  /// IRRs come from the summed cash flows, never an average of the two IRRs
  project_irr   = xirr(project_cash)
  equity_irr    = xirr(equity_cash)

  cfads:        USD = toll.cash.cfads + border.cash.cfads
  debt_service: USD = toll.debt.debt_service + border.debt.debt_service
  dscr: x           = cfads / debt_service       | during toll.debt.repayment
}

// Statements with the same lines add line by line
statement sources_uses = toll.statements.sources_uses + border.statements.sources_uses
statement fs_quarterly = toll.statements.fs_quarterly + border.statements.fs_quarterly
statement fs_annual    = toll.statements.fs_annual    + border.statements.fs_annual

dashboard "Summary outputs" {
  columns  toll, border, cmbnd
  row "Total project cost"          sum(cons_cost.total)
  row "Project IRR"                 metrics.project_irr
  row "Blended equity IRR"          metrics.equity_irr
  row "Min DSCR"                    min(metrics.dscr)
  row "Average DSCR"                avg(metrics.dscr)
  row "Average cost of debt"        metrics.cost_of_debt
  row "Weighted average life"       metrics.wal
}

What this model needed from the language

  • Portfolios. include … as brings in whole models under a namespace, so toll.debt.debt_service is always clear.
  • Statement arithmetic. Two statements with the same lines can be added.
  • Column dashboards. One row definition is evaluated in each project and in the combined namespace.