Theme
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:
| Field | Meaning | Example |
|---|---|---|
| Name | Identifier displayed in tables, plots, and exports | throughput, mean_response_time |
| Expression | Formula evaluated by the simulation engine | E{#InService} / SERVICE_TIME |
Metric Expression Components
- Place token counts (
#PlaceName): Represents the number of tokens in that place. When enclosed inE{ }, computes the time-average mean across the simulation. - Model parameters: Identifiers like
SERVICE_TIMEandNUM_SERVERS. Always reference parameter names rather than literal numbers. - 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 systemP{ } — 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 idleTo display probabilities as percentages (0% to 100%), multiply by 100:
P{#Slots = 0} * 100Practical 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:
| Metric | Expression | Meaning | Theoretical | Measured in Jupiter |
|---|---|---|---|---|
availability | E{#Operating} | Average availability | 0.75 | 0.7499 |
maintenance_share | E{#InMaintenance} | Mean maintenance level | 0.25 | 0.2501 |
time_in_maintenance | P{#InMaintenance > 0} | Fraction of time in maintenance | 0.25 | 0.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:
| Syntax | What is computed | Result |
|---|---|---|
E{#Operating} / (E{#InMaintenance} + 1) | Divide the means: calculates the average of each place, then divides | 0.60 |
E{#Operating / (#InMaintenance + 1)} | Mean of divisions: computes the ratio at each event, then averages | 0.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_TIMEThe Four Core Performance Metrics
System capacity analysis typically revolves around four core metrics:
- Throughput: items completed per unit time.
- Response Time: total time spent from arrival to departure.
- Utilization: percentage of time a resource is busy.
- Probability / Blocking: fraction of requests dropped due to buffer limits.
To review syntax rules and conditional functions, advance to Available Expressions.