Skip to content
Become a partner
Research · Digital twin

The TO-MODEL engine: a company described, played, and self-regulating.

An ERP records what has happened. TO-MODEL describes how the company works, plays it month after month into the future, and gives it control loops: a PID-family controller that brings a margin back to its setpoint, fuzzy-logic decisions that weigh several criteria. All in a text the manager can read and the AI can write.

The modelling system

The company is written the way you would explain it

A TO-MODEL model is a text made of sentences and tables, in the form of “Given, When, Then” test scenarios. Each step is either a calculation or a phrase from a closed list: the manager reads it as a procedure, the engine reads it without ambiguity, the AI writes and corrects it. The engine holds no hard-coded management rule: everything that makes the company is in the text.

What it owns

The entities and their tables (clients, contracts, loans), the parameters, the state: cash, receivables, debts, stock.

What changes

The flows, played every day or every month, and the money movements that become accounting entries.

What is decided

The levers, with their range, step and decision-maker: the manager, a written strategy, a control loop, or the AI.

What must stay true

The invariants, checked at every closing, and the scenarios that prove the model behaves as intended.

A complete model, in a few lines

A workshop that sells at the price it sets: demand depends on price, the margin is a quantity computed at any time, and an invariant forbids selling at a loss. The same text serves the manager, the engine and the AI assistant. The model is written with the English words of the language.

  1. 01Describe

    Entities, state, flows, levers.

  2. 02Feed

    Today's facts replace the assumptions.

  3. 03Play

    Month after month, with each scenario.

  4. 04Prove

    Invariants, scenarios, sweeps.

WorkshopTO-MODEL
# language: en
# to-model: 1.1
Model: Workshop
  Parameters:
    | name          | value |
    | purchase_cost | 60    |
    | target_margin | 0.40  |
    | gain          | 0.6   |
    | lag           | 2     |
  State:
    | name | start |
    | cash | 20000 |
  Levers:
    | name  | domain    | step | start | decided by | kind    |
    | price | 60 .. 200 | 1    | 100   | model      | setting |
  Quantities:
    | name   | expression                      |
    | margin | (price - purchase_cost) / price |
  Flow: Sales
    Every month
    Let volume = ROUND(1000 * (100 / price) ^ 1.2)
    Then cash += volume * (price - purchase_cost)
  Invariant: Never sell at a loss
    Then always price > purchase_cost
Dynamic control · PID family

A margin that returns to its setpoint on its own

Engineers tune an oven or a drone with a PID controller: measure, compare with the setpoint, correct a little, and start again. TO-MODEL applies the same mechanism to management. A Regulation block reads a measurement, compares it with a setpoint and acts on a lever, at each review, within bounds set by the manager.

Regulation: MarginTO-MODEL
Regulation: Margin
  Measurement  DELAY(margin, lag)
  Target       target_margin
  Acts on      price
  Mode         relative
  Gain         gain
  Integral     0.1
  Review       every quarter
  Change       + 5 % at most, - 2 % at most
  Band         0.005

At each review

e = setpoint − measurement (zero inside the dead band)

I = I + e (frozen while the lever is at a limit)

u = Kp · e + Ki · I, bounded by the allowed variation

price = price × (1 + u)

  • Proportional and integral. The gain corrects the current gap; the integral catches up with a gap that lasts. The derivative term of the PID family is left out: on monthly figures, the measurement is smoothed or delayed rather than differentiating noise.
  • A realistic measurement. DELAY(margin, 2): the margin you actually know, the one from two months ago. The model accounts for the accounting delay.
  • Management bounds. Never more than +5% or −2% per review, one review per quarter, a dead band so prices are not touched over half a point.
  • No runaway. While the price is at a limit, the integral stops accumulating (anti-windup): the correction does not overshoot when it leaves the limit.
  • The manager stays in charge. If the lever is decided by the manager or by the AI, the control loop changes nothing: it proposes a value, written to the log, which can be accepted or not.
  • Everything is readable. Gap, integral, correction and limit flag are exposed every month, and the log says “Margin: price 100 → 103 (gap 6 points)”.

Measured, not promised: stability depends on gain and delay

Reference bench: purchase cost 60, price 100, target margin 40%, a +10% shock on purchases in month six, 60 months played, proportional controller on the delayed margin.

Measurement delayGainOvershoot (points)Sign changesBack within 0.5 point
1 month1.0003 months
2 months0.30011 months
2 months0.60.4324 months
2 months1.44.521730 months
2 months1.829.4218never
3 months0.62.45716 months
3 months1.05.8110never
34 %Margin without control after the shock: €34,000 profit per month.
40 %Controlled, stable margin: price 110, €38,139 profit per month.
−€54,033Per month, with a gain of 1.8 and a two-month delay: the price swings down to 48.
1.67Computed limit gain for a two-month delay; 1.03 for three months. The trials bracket it.

A badly tuned control loop destroys value as surely as it protects it. That is why TO-MODEL never assumes a loop is stable: it proves it, on the real model, before letting it act.

Fuzzy-logic decision

Weighing several criteria without threshold effects

A crisp rule flips from one euro to the next: “if the workload exceeds 100%, hire”. Reality is gradual. A Decision block gives each criterion a degree of truth between 0 and 1, combines the rules and decides on a proportionate change.

Hire when the workload is full and cash allows it

The qualifiers say what “full workload” or “good coverage” means, with ramp or trapezoid shapes. The rules read in plain language: and takes the minimum of the degrees, or the maximum.

full 0.7normal 0.1lownormalfull0.20.81.21.8team workload
At 156% workload, the term “full” is true at 0.7 and “normal” at 0.1.
Decision: HiringTO-MODEL
Qualifiers:
  | quantity | term   | shape                                              |
  | coverage | weak   | from 1 (full) to 2 (zero)                           |
  | coverage | good   | from 1.5 (zero) to 3 (full)                         |
  | workload | low    | from 0.4 (full) to 0.8 (zero)                       |
  | workload | normal | zero before 0.6, full from 0.9 to 1.2, zero after 1.6 |
  | workload | full   | from 1 (zero) to 1.8 (full)                         |

Decision: Hiring
  Acts on headcount
  Review every quarter
  When workload is full and coverage is good
  Then increase by 1
  When workload is low or coverage is weak
  Then decrease by 1
  Else keep

Zero-order Sugeno inference

each rule has a weight w (its degree of truth) and a value v;

change = Σ(w · v) / Σw — “Else” weighs 1 − max(w)

Workload full 0.7, coverage good 0.5: rule 1 at 0.5 (+1), Else at 0.5 (0): +0.5 post.

  • The remainder is kept. Half a post cannot be hired: the part not applied is added to the next decision, so that a weak but lasting trend eventually acts.
  • The reason is written. “Hiring: headcount 3 → 4 (workload full 0.7; coverage good 0.5)”.
  • Complementary to PID. A fuzzy decision smooths out flips but has no memory; the control loop corrects a drift over time. A lever obeys only one of the two.
Prove before acting

Stability is demonstrated on the company's own model

The language does not promise that a loop is stable: it gives the means to check it. A scenario replays the model after a shock on purchases and asserts that the margin returns within its band in time, without oscillating. A sweep plays every combination of settings and returns a table: the gain is chosen knowingly, limits included.

And because a well-tuned loop on a poorly calibrated model steers confidently in the wrong direction, the model is first calibrated on actuals: its fidelity is measured on months it has not seen.

Scenario · SweepTO-MODEL
Scenario: The margin holds after a shock
  Given the model Workshop
  And purchase_cost = 66
  When 60 months pass
  Then margin returns within 0.005 of target_margin in 12 months at most after month 0
  And at most 2 alternations of Margin.gap
  And price is never at a limit for more than 3 months

Sweep: Margin tuning
  Let the model Workshop
  For gain from 0.2 to 2 by 0.2
  And   lag among 1, 2, 3
  When 60 months pass
  Measure return of margin within 0.005 of target_margin
  And     overshoot of margin over target_margin
What it changes

An ERP records the company. TO-MODEL makes it run.

ERPs were designed for people who enter facts into screens. The digital twin adds what they lack: a description of how the company works, its projection, and loops that keep it on course.

Classic ERPTO-MODEL engine
What it holdsPast facts: orders, invoices, entries.The facts, plus the mechanics that produce them: delays, seasons, elasticities, contracts.
The futureA separate forecast, in a spreadsheet linked to nothing.Played month after month from today's data, scenario by scenario.
Management rulesCoded by the vendor, invisible, configured through screens.Written in a text the manager reads and the AI edits, versioned.
Reacting to a driftIt is discovered at closing; someone decides, often too hard or too late.A control loop corrects at each review, within bounds, accounting for the measurement delay.
Weighing criteriaCrisp thresholds that flip from one euro to the next.A proportionate fuzzy decision, with its reason written to the log.
The role of AIIt reads screens or APIs and guesses the rest.It reads the model, acts on bounded levers, and its figures always come from the engine.
TrustYou trust the configuration.Invariants at every closing, scenarios, sweeps, fidelity measured on actuals.
AdaptingA project: specifications, development, acceptance testing.A line of text, checked by the engine before it is applied.

TO-MODEL 1.1: control loops, fuzzy decisions and control assertions are specified and measured on the reference bench; they go into service in the engines after calibration on actuals.

The digital twin in practice

Steer a real company with TO-MODEL?

The TO-MODEL engine is at the heart of FARO: FARO ERM holds the data that feeds it, FARO Finance plays it to analyse and forecast.