Skip to content

Creating Metrics ​

A metric is a quantitative query you pose to your model. Without metrics, the simulation calculates the internal state trajectory but provides no output answers. By declaring metrics, you define exactly which performance indicators to compute.


How to Declare a Metric ​

In the inspector panel on the right, locate the Metrics section and click +. Each metric requires two fields:

FieldMeaningExample
NameIdentifier displayed in tables, plots, and exportsthroughput, mean_response_time
ExpressionFormula evaluated by the simulation engineE{#InService} / SERVICE_TIME

Metric Expression Components ​

  1. Place token counts (#PlaceName): Represents the number of tokens in that place. When enclosed in E{ }, computes the time-average mean across the simulation.
  2. Model parameters: Identifiers like SERVICE_TIME and NUM_SERVERS. Always reference parameter names rather than literal numbers.
  3. Mathematical operators: Addition, subtraction, multiplication, division, parentheses, and conditional logic (detailed in Available Expressions).

Time Average E{ } vs. Probability P{ } ​

Jupiter provides two statistical accumulation operators:

E{ } — Expected Value / Time Average ​

Calculates the average number of tokens or the mean value of an expression integrated over the entire simulation horizon:

E{#Queue}                    Average customers waiting in the queue
E{#ActiveServers}            Average servers busy simultaneously
E{#Queue} + E{#InService}    Average total items present in the system

P{ } — Probability / Fraction of Time ​

Calculates the fraction of time (between 0 and 1) during which a specified boolean condition held true:

P{#Queue > 5}                Fraction of time the queue exceeded 5 items
P{#Slots = 0}                Fraction of time the system was at maximum capacity
P{#ActiveServers = 0}        Fraction of time servers remained completely idle

To display probabilities as percentages (0% to 100%), multiply by 100:

P{#Slots = 0} * 100

Practical Example: Machine with Maintenance ​

Consider an industrial machine that operates for an average of 3 minutes and then undergoes 1 minute of scheduled maintenance:

json
{
  "modelName": "Máquina com manutenção",
  "definitions": [],
  "places": [
    { "name": "Operando",      "initialMarking": 1, "stringMarking": "1", "initialStringMarking": "1" },
    { "name": "EmManutencao",  "initialMarking": 0, "stringMarking": "0", "initialStringMarking": "0" }
  ],
  "rewardMeasures": [
    { "name": "disponibilidade",     "expression": "E{#Operando}" },
    { "name": "parada_media",        "expression": "E{#EmManutencao}" },
    { "name": "tempo_em_manutencao", "expression": "P{#EmManutencao > 0}" },
    { "name": "divide_as_medias",    "expression": "E{#Operando} / (E{#EmManutencao} + 1)" },
    { "name": "media_das_divisoes",  "expression": "E{#Operando / (#EmManutencao + 1)}" }
  ],
  "transitions": [
    { "name": "Falha", "type": "TIMED", "firingPolicy": "SINGLE_SERVER",
      "raceType": "RACE_WITH_ENABLING_MEMORY", "priority": 1,
      "distribution": { "type": "exponential", "parameters": { "Mean delay": "3" } },
      "inputArcs":  [{ "type": "INPUT",  "place": "Operando",     "multiplicity": 1 }],
      "outputArcs": [{ "type": "OUTPUT", "place": "EmManutencao", "multiplicity": 1 }],
      "inhibitorArcs": [] },
    { "name": "Reparo", "type": "TIMED", "firingPolicy": "SINGLE_SERVER",
      "raceType": "RACE_WITH_ENABLING_MEMORY", "priority": 1,
      "distribution": { "type": "exponential", "parameters": { "Mean delay": "1" } },
      "inputArcs":  [{ "type": "INPUT",  "place": "EmManutencao", "multiplicity": 1 }],
      "outputArcs": [{ "type": "OUTPUT", "place": "Operando",     "multiplicity": 1 }],
      "inhibitorArcs": [] }
  ]
}

For every 4 minutes of simulation, the machine operates for 3 minutes and stays in maintenance for 1 minute:

MetricExpressionMeaningTheoreticalMeasured in Jupiter
availabilityE{#Operating}Average availability0.750.7499
maintenance_shareE{#InMaintenance}Mean maintenance level0.250.2501
time_in_maintenanceP{#InMaintenance > 0}Fraction of time in maintenance0.250.2501

Brace Placement Alters the Query ​

The Rule of Braces

The braces in E{ } define the aggregation scope. When you separate expressions into independent E{ } terms, each term has its mean computed first, and the division occurs between the final averages.

Using the same machine model, compare these two formulations:

SyntaxWhat is computedResult
E{#Operating} / (E{#InMaintenance} + 1)Divide the means: calculates the average of each place, then divides0.60
E{#Operating / (#InMaintenance + 1)}Mean of divisions: computes the ratio at each event, then averages0.75

In performance engineering and applications of Little's Law, the mathematically correct approach is almost always to divide the means.

Default Behavior Without Braces ​

If you write #Queue inside a metric formula without braces, the engine automatically treats it as E{#Queue}:

#Queue / SERVICE_TIME     is identical to     E{#Queue} / SERVICE_TIME

The Four Core Performance Metrics ​

System capacity analysis typically revolves around four core metrics:

  1. Throughput: items completed per unit time.
  2. Response Time: total time spent from arrival to departure.
  3. Utilization: percentage of time a resource is busy.
  4. Probability / Blocking: fraction of requests dropped due to buffer limits.

To review syntax rules and conditional functions, advance to Available Expressions.