Tema
Um modelo do começo ao fim
Até aqui os exemplos foram pequenos, para caber numa página. Este é um sistema real, com sete componentes, modelado a partir de medições — e com uma vantagem rara: os resultados foram publicados, então dá para conferir se o modelo está certo.
O sistema monitora incêndios florestais. Câmeras capturam imagens, um serviço de visão computacional detecta fogo, regras decidem o que fazer, e o resultado vai para um banco.
O caminho de um quadro
Cada imagem capturada percorre sete etapas:
- O produtor captura o quadro e guarda no armazenamento
- Avisa o distribuidor de mensagens que há trabalho novo
- O consumidor recebe o aviso
- Baixa a imagem do armazenamento
- Roda a detecção de fogo
- As regras processam o resultado
- O registrador grava no banco
Sete etapas, cada uma com um tempo medido no sistema real, e cada uma com um limite de quantos itens processa ao mesmo tempo.
Traduzindo para o modelo
O padrão se repete sete vezes, uma por etapa. Cada uma tem:
| Peça | Papel |
|---|---|
| um lugar de fila | itens esperando por essa etapa |
| um lugar de capacidade | quantos aquela etapa processa em paralelo |
| uma transição temporizada | o tempo que a etapa leva |
O item consome uma ficha de capacidade ao entrar na etapa e devolve ao sair — exatamente o padrão de Limitando capacidade. E como as capacidades representam trabalho em paralelo, todas as transições de serviço são de servidor infinito, conforme Quantos em paralelo.
json
{
"modelName": "SPN Fire Monitoring Sabino 2024",
"places": [
{
"name": "Pafp",
"initialMarking": 1,
"stringMarking": "1",
"initialStringMarking": "1",
"id": "p1",
"x": 201.0028419494629,
"y": 179.34091186523438
},
{
"name": "Paqfp",
"initialMarking": 0,
"stringMarking": "0",
"initialStringMarking": "0",
"id": "p2",
"x": 406.0028419494629,
"y": 185.34091186523438,
"labelX": 406.0028419494629,
"labelY": 225.34091186523438
},
{
"name": "PfpMI",
"initialMarking": 0,
"stringMarking": "0",
"initialStringMarking": "0",
"id": "p3",
"x": 675.5512382158005,
"y": 195.502203527524
},
{
"name": "Pfp",
"initialMarking": 0,
"stringMarking": "0",
"initialStringMarking": "0",
"id": "p4",
"x": 966.0028419494629,
"y": 190.34091186523438
},
{
"name": "Pmq1",
"initialMarking": 0,
"stringMarking": "0",
"initialStringMarking": "0",
"id": "p5",
"x": 1255.002841949463,
"y": 197.34091186523438,
"labelX": 1255.002841949463,
"labelY": 237.34091186523438
},
{
"name": "Pcmq1",
"initialMarking": 1,
"stringMarking": "CMQ",
"initialStringMarking": "CMQ",
"id": "p6",
"x": 1244.4544521434996,
"y": 101.46994704088726,
"labelX": 1244.4544521434996,
"labelY": 137.92156000365569
},
{
"name": "Pccap",
"initialMarking": 1,
"stringMarking": "CAP",
"initialStringMarking": "CAP",
"id": "p7",
"x": 687.9593376888156,
"y": 86.90041041628149,
"labelX": 687.9593376888156,
"labelY": 126.90041041628149
},
{
"name": "Pcfc",
"initialMarking": 1,
"stringMarking": "CFC",
"initialStringMarking": "CFC",
"id": "p8",
"x": 523.6337575777551,
"y": 352.7557665510285
},
{
"name": "PfcMI",
"initialMarking": 0,
"stringMarking": "0",
"initialStringMarking": "0",
"id": "p9",
"x": 515.959339019524,
"y": 466.5929751647899
},
{
"name": "PfcPM",
"initialMarking": 0,
"stringMarking": "0",
"initialStringMarking": "0",
"id": "p10",
"x": 758.982593363509,
"y": 476.8255332424314,
"labelX": 758.982593363509,
"labelY": 518.1046030021366
},
{
"name": "PfcF",
"initialMarking": 0,
"stringMarking": "0",
"initialStringMarking": "0",
"id": "p11",
"x": 1021.1918941030717,
"y": 479.38367276184175,
"labelX": 1021.1918941030717,
"labelY": 518.1046030021366
},
{
"name": "Pmq2",
"initialMarking": 0,
"stringMarking": "0",
"initialStringMarking": "0",
"id": "p12",
"x": 1229.6802649350168,
"y": 478.10460300213657
},
{
"name": "Pcmq2",
"initialMarking": 1,
"stringMarking": "CMQ",
"initialStringMarking": "CMQ",
"id": "p13",
"x": 1222.0058463767857,
"y": 365.54646414808036
},
{
"name": "Pcrm",
"initialMarking": 2,
"stringMarking": "CRM",
"initialStringMarking": "CRM",
"id": "p14",
"x": 512.1221297404084,
"y": 637.9883229652846,
"labelX": 512.1221297404084,
"labelY": 608.1496146275742
},
{
"name": "PrmAP",
"initialMarking": 0,
"stringMarking": "0",
"initialStringMarking": "0",
"id": "p15",
"x": 502.55123821580054,
"y": 794.3371590837155
},
{
"name": "PrmF",
"initialMarking": 0,
"stringMarking": "0",
"initialStringMarking": "0",
"id": "p16",
"x": 735.9593376888156,
"y": 804.2673917269585
},
{
"name": "Pmq3",
"initialMarking": 0,
"stringMarking": "0",
"initialStringMarking": "0",
"id": "p17",
"x": 1017.3546848239562,
"y": 811.9418102851896,
"labelX": 1017.3546848239562,
"labelY": 851.9418102851896
},
{
"name": "Pem",
"initialMarking": 0,
"stringMarking": "0",
"initialStringMarking": "0",
"id": "p18",
"x": 1234.7965439738375,
"y": 801.709252207548,
"labelX": 1234.7965439738375,
"labelY": 844.2673917269585
},
{
"name": "Pcem",
"initialMarking": 2,
"stringMarking": "CEM",
"initialStringMarking": "CEM",
"id": "p19",
"x": 1232.2384044544272,
"y": 696.825531911723,
"labelX": 1232.2384044544272,
"labelY": 736.825531911723
},
{
"name": "Pcmq3",
"initialMarking": 1,
"stringMarking": "CMQ",
"initialStringMarking": "CMQ",
"id": "p20",
"x": 1010.9593360254303,
"y": 704.4999504699541
}
],
"definitions": [
{
"name": "TAFP",
"type": "DOUBLE",
"value": "60",
"id": "def0"
},
{
"name": "T1",
"type": "DOUBLE",
"value": "0.4427",
"id": "def1"
},
{
"name": "T2",
"type": "DOUBLE",
"value": "0.0001",
"id": "def2"
},
{
"name": "T3",
"type": "DOUBLE",
"value": "0.0033",
"id": "def3"
},
{
"name": "T4",
"type": "DOUBLE",
"value": "0.0945",
"id": "def4"
},
{
"name": "T5",
"type": "DOUBLE",
"value": "0.643",
"id": "def5"
},
{
"name": "T6",
"type": "DOUBLE",
"value": "0.0001",
"id": "def6"
},
{
"name": "T7",
"type": "DOUBLE",
"value": "0.0027",
"id": "def7"
},
{
"name": "T8",
"type": "DOUBLE",
"value": "0.0015",
"id": "def8"
},
{
"name": "T9",
"type": "DOUBLE",
"value": "0.0052",
"id": "def9"
},
{
"name": "T10",
"type": "DOUBLE",
"value": "0.0001",
"id": "def10"
},
{
"name": "T11",
"type": "DOUBLE",
"value": "0.0084",
"id": "def11"
},
{
"name": "CAP",
"type": "INTEGER",
"value": "1",
"id": "def12"
},
{
"name": "CFC",
"type": "INTEGER",
"value": "1",
"id": "def13"
},
{
"name": "CRM",
"type": "INTEGER",
"value": "2",
"id": "def14"
},
{
"name": "CMQ",
"type": "INTEGER",
"value": "1",
"id": "def15"
},
{
"name": "CEM",
"type": "INTEGER",
"value": "2",
"id": "def16"
}
],
"rewardMeasures": [
{
"name": "TP",
"expression": "E{#Pem} / T11",
"id": "rm0"
},
{
"name": "MRT",
"expression": "IF E{#Pem} > 0 THEN ((E{#PfpMI} + E{#Pfp} + E{#Pmq1} + E{#PfcMI} + E{#PfcPM} + E{#PfcF} + E{#Pmq2} + E{#PrmAP} + E{#PrmF} + E{#Pmq3} + E{#Pem}) * T11) / E{#Pem} ELSE 0",
"id": "rm1"
},
{
"name": "DP",
"expression": "P{(#Pccap = 0) AND (#Paqfp > 0)} * 100",
"id": "rm2"
},
{
"name": "FC_U",
"expression": "((E{#PfcMI} + E{#PfcPM} + E{#PfcF}) / CFC) * 100",
"id": "rm3"
},
{
"name": "CMQ_U",
"expression": "((E{#Pmq1} + E{#Pmq2} + E{#Pmq3}) / CMQ) * 100",
"id": "rm4"
}
],
"transitions": [
{
"name": "Tafp",
"type": "TIMED",
"firingPolicy": "SINGLE_SERVER",
"raceType": "RACE_WITH_ENABLING_MEMORY",
"priority": 1,
"inputArcs": [
{
"type": "INPUT",
"place": "Pafp",
"multiplicity": 1,
"weight": 1
}
],
"outputArcs": [
{
"type": "OUTPUT",
"place": "Paqfp",
"multiplicity": 1,
"weight": 1
}
],
"inhibitorArcs": [],
"distribution": {
"type": "exponential",
"parameters": {
"Mean delay": "TAFP"
}
},
"id": "t1",
"x": 299.4544595267844,
"y": 185.34091186523438,
"labelX": 299.4544595267844,
"labelY": 225.34091186523438
},
{
"name": "T1",
"type": "TIMED",
"firingPolicy": "INFINITY_SERVER",
"raceType": "RACE_WITH_ENABLING_MEMORY",
"priority": 1,
"inputArcs": [
{
"type": "INPUT",
"place": "PfpMI",
"multiplicity": 1,
"weight": 1
}
],
"outputArcs": [
{
"type": "OUTPUT",
"place": "Pfp",
"multiplicity": 1,
"weight": 1
}
],
"inhibitorArcs": [],
"distribution": {
"type": "exponential",
"parameters": {
"Mean delay": "T1"
}
},
"id": "t2",
"x": 806.0996344821381,
"y": 197.34091186523438,
"labelX": 806.0996344821381,
"labelY": 236.34091186523438
},
{
"name": "T2",
"type": "TIMED",
"firingPolicy": "INFINITY_SERVER",
"raceType": "RACE_WITH_ENABLING_MEMORY",
"priority": 1,
"inputArcs": [
{
"type": "INPUT",
"place": "Pfp",
"multiplicity": 1,
"weight": 1
},
{
"type": "INPUT",
"place": "Pcmq1",
"multiplicity": 1,
"weight": 1
}
],
"outputArcs": [
{
"type": "OUTPUT",
"place": "Pmq1",
"multiplicity": 1,
"weight": 1
},
{
"type": "OUTPUT",
"place": "Pccap",
"multiplicity": 1,
"weight": 1
}
],
"inhibitorArcs": [],
"distribution": {
"type": "exponential",
"parameters": {
"Mean delay": "T2"
}
},
"id": "t3",
"x": 1122.4709631974226,
"y": 203.34091186523438
},
{
"name": "T3",
"type": "TIMED",
"firingPolicy": "INFINITY_SERVER",
"raceType": "RACE_WITH_ENABLING_MEMORY",
"priority": 1,
"inputArcs": [
{
"type": "INPUT",
"place": "Pmq1",
"multiplicity": 1,
"weight": 1
},
{
"type": "INPUT",
"place": "Pcfc",
"multiplicity": 1,
"weight": 1
}
],
"outputArcs": [
{
"type": "OUTPUT",
"place": "Pcmq1",
"multiplicity": 1,
"weight": 1
},
{
"type": "OUTPUT",
"place": "PfcMI",
"multiplicity": 1,
"weight": 1
}
],
"inhibitorArcs": [],
"distribution": {
"type": "exponential",
"parameters": {
"Mean delay": "T3"
}
},
"id": "t4",
"x": 1361.5512243721414,
"y": 207.92155815783448,
"labelX": 1381.4544521434996,
"labelY": 215.94481416520486
},
{
"name": "Ti1",
"type": "IMMEDIATE",
"firingPolicy": "SINGLE_SERVER",
"raceType": "RACE_WITH_ENABLING_MEMORY",
"priority": 1,
"inputArcs": [
{
"type": "INPUT",
"place": "Paqfp",
"multiplicity": 1,
"weight": 1
},
{
"type": "INPUT",
"place": "Pccap",
"multiplicity": 1,
"weight": 1
}
],
"outputArcs": [
{
"type": "OUTPUT",
"place": "PfpMI",
"multiplicity": 1,
"weight": 1
},
{
"type": "OUTPUT",
"place": "Pafp",
"multiplicity": 1,
"weight": 1
}
],
"inhibitorArcs": [],
"weight": 1,
"id": "t5",
"x": 536.5512382158005,
"y": 195.502203527524,
"labelX": 536.5512382158005,
"labelY": 237.34091186523438
},
{
"name": "T4",
"type": "TIMED",
"firingPolicy": "INFINITY_SERVER",
"raceType": "RACE_WITH_ENABLING_MEMORY",
"priority": 1,
"inputArcs": [
{
"type": "INPUT",
"place": "PfcMI",
"multiplicity": 1,
"weight": 1
}
],
"outputArcs": [
{
"type": "OUTPUT",
"place": "PfcPM",
"multiplicity": 1,
"weight": 1
}
],
"inhibitorArcs": [],
"distribution": {
"type": "exponential",
"parameters": {
"Mean delay": "T4"
}
},
"id": "t6",
"x": 627.2384081138749,
"y": 471.70925420361067,
"labelX": 627.2384081138749,
"labelY": 511.70925420361067
},
{
"name": "T5",
"type": "TIMED",
"firingPolicy": "INFINITY_SERVER",
"raceType": "RACE_WITH_ENABLING_MEMORY",
"priority": 1,
"inputArcs": [
{
"type": "INPUT",
"place": "PfcPM",
"multiplicity": 1,
"weight": 1
}
],
"outputArcs": [
{
"type": "OUTPUT",
"place": "PfcF",
"multiplicity": 1,
"weight": 1
}
],
"inhibitorArcs": [],
"distribution": {
"type": "exponential",
"parameters": {
"Mean delay": "T5"
}
},
"id": "t7",
"x": 883.0523600549118,
"y": 481.9418122812521,
"labelX": 883.0523600549118,
"labelY": 520.662742521547
},
{
"name": "T6",
"type": "TIMED",
"firingPolicy": "INFINITY_SERVER",
"raceType": "RACE_WITH_ENABLING_MEMORY",
"priority": 1,
"inputArcs": [
{
"type": "INPUT",
"place": "PfcF",
"multiplicity": 1,
"weight": 1
},
{
"type": "INPUT",
"place": "Pcmq2",
"multiplicity": 1,
"weight": 1
}
],
"outputArcs": [
{
"type": "OUTPUT",
"place": "Pmq2",
"multiplicity": 1,
"weight": 1
},
{
"type": "OUTPUT",
"place": "Pcfc",
"multiplicity": 1,
"weight": 1
}
],
"inhibitorArcs": [],
"distribution": {
"type": "exponential",
"parameters": {
"Mean delay": "T6"
}
},
"id": "t8",
"x": 1132.4709631974226,
"y": 479.38367276184175,
"labelX": 1133.7500329571278,
"labelY": 519.3836727618418
},
{
"name": "T7",
"type": "TIMED",
"firingPolicy": "INFINITY_SERVER",
"raceType": "RACE_WITH_ENABLING_MEMORY",
"priority": 1,
"inputArcs": [
{
"type": "INPUT",
"place": "Pmq2",
"multiplicity": 1,
"weight": 1
},
{
"type": "INPUT",
"place": "Pcrm",
"multiplicity": 1,
"weight": 1
}
],
"outputArcs": [
{
"type": "OUTPUT",
"place": "Pcmq2",
"multiplicity": 1,
"weight": 1
},
{
"type": "OUTPUT",
"place": "PrmAP",
"multiplicity": 1,
"weight": 1
}
],
"inhibitorArcs": [],
"distribution": {
"type": "exponential",
"parameters": {
"Mean delay": "T7"
}
},
"id": "t9",
"x": 1341.5512243721414,
"y": 481.9418122812521,
"labelX": 1364.5744800468347,
"labelY": 489.9650682886225
},
{
"name": "T8",
"type": "TIMED",
"firingPolicy": "INFINITY_SERVER",
"raceType": "RACE_WITH_ENABLING_MEMORY",
"priority": 1,
"inputArcs": [
{
"type": "INPUT",
"place": "PrmAP",
"multiplicity": 1,
"weight": 1
}
],
"outputArcs": [
{
"type": "OUTPUT",
"place": "PrmF",
"multiplicity": 1,
"weight": 1
}
],
"inhibitorArcs": [],
"distribution": {
"type": "exponential",
"parameters": {
"Mean delay": "T8"
}
},
"id": "t10",
"x": 617.0058500362335,
"y": 805.5464614866637
},
{
"name": "T9",
"type": "TIMED",
"firingPolicy": "INFINITY_SERVER",
"raceType": "RACE_WITH_ENABLING_MEMORY",
"priority": 1,
"inputArcs": [
{
"type": "INPUT",
"place": "PrmF",
"multiplicity": 1,
"weight": 1
},
{
"type": "INPUT",
"place": "Pcmq3",
"multiplicity": 1,
"weight": 1
}
],
"outputArcs": [
{
"type": "OUTPUT",
"place": "Pmq3",
"multiplicity": 1,
"weight": 1
},
{
"type": "OUTPUT",
"place": "Pcrm",
"multiplicity": 1,
"weight": 1
}
],
"inhibitorArcs": [],
"distribution": {
"type": "exponential",
"parameters": {
"Mean delay": "T9"
}
},
"id": "t11",
"x": 879.2151507757962,
"y": 814.4999498046,
"labelX": 879.2151507757962,
"labelY": 851.9418102851896
},
{
"name": "T10",
"type": "TIMED",
"firingPolicy": "INFINITY_SERVER",
"raceType": "RACE_WITH_ENABLING_MEMORY",
"priority": 1,
"inputArcs": [
{
"type": "INPUT",
"place": "Pmq3",
"multiplicity": 1,
"weight": 1
},
{
"type": "INPUT",
"place": "Pcem",
"multiplicity": 1,
"weight": 1
}
],
"outputArcs": [
{
"type": "OUTPUT",
"place": "Pem",
"multiplicity": 1,
"weight": 1
},
{
"type": "OUTPUT",
"place": "Pcmq3",
"multiplicity": 1,
"weight": 1
}
],
"inhibitorArcs": [],
"distribution": {
"type": "exponential",
"parameters": {
"Mean delay": "T10"
}
},
"id": "t12",
"x": 1132.4709631974226,
"y": 818.3371590837155
},
{
"name": "T11",
"type": "TIMED",
"firingPolicy": "INFINITY_SERVER",
"raceType": "RACE_WITH_ENABLING_MEMORY",
"priority": 1,
"inputArcs": [
{
"type": "INPUT",
"place": "Pem",
"multiplicity": 1,
"weight": 1
}
],
"outputArcs": [
{
"type": "OUTPUT",
"place": "Pcem",
"multiplicity": 1,
"weight": 1
}
],
"inhibitorArcs": [],
"distribution": {
"type": "exponential",
"parameters": {
"Mean delay": "T11"
}
},
"id": "t13",
"x": 1338.4011945099576,
"y": 814.4999498046,
"labelX": 1338.4011945099576,
"labelY": 851.9418102851896
}
],
"visualElements": [],
"arcs": [
{
"id": "a1",
"source": "p1",
"target": "t1",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 207.6896725021599,
"lineType": "straight"
},
{
"id": "a2",
"source": "t1",
"target": "p2",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 180,
"lineType": "straight"
},
{
"id": "a3",
"source": "p2",
"target": "t5",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 198.43494882292202,
"lineType": "straight"
},
{
"id": "a4",
"source": "t5",
"target": "p3",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 180,
"lineType": "straight"
},
{
"id": "a5",
"source": "p3",
"target": "t2",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 195.51590893364124,
"lineType": "straight"
},
{
"id": "a6",
"source": "t2",
"target": "p4",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 190.53088385739326,
"lineType": "straight"
},
{
"id": "a7",
"source": "p4",
"target": "t3",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 205.53489578153696,
"lineType": "straight"
},
{
"id": "a8",
"source": "t3",
"target": "p5",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 180,
"lineType": "straight"
},
{
"id": "a9",
"source": "p5",
"target": "t4",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 190.6591428975529,
"lineType": "straight"
},
{
"id": "a10",
"source": "t4",
"target": "p6",
"type": "normal",
"weight": "1",
"sourceAnchor": "top",
"targetAnchorAngle": 0,
"lineType": "straight"
},
{
"id": "a11",
"source": "p6",
"target": "t3",
"type": "normal",
"weight": "1",
"sourceAnchor": "left",
"targetAnchorAngle": 300.62864839637075,
"lineType": "straight"
},
{
"id": "a12",
"source": "t3",
"target": "p7",
"type": "normal",
"weight": "1",
"sourceAnchor": "top",
"targetAnchorAngle": 0,
"lineType": "right-angle"
},
{
"id": "a13",
"source": "p7",
"target": "t5",
"type": "normal",
"weight": "1",
"sourceAnchor": "left",
"targetAnchorAngle": 305.17313428053467,
"lineType": "right-angle",
"waypoints": [
{
"x": 539.5512382158005,
"y": 101.46994704088726
}
]
},
{
"id": "a14",
"source": "t5",
"target": "p1",
"type": "normal",
"weight": "1",
"sourceAnchor": "top",
"targetAnchorAngle": 292.91433571071684,
"lineType": "right-angle",
"waypoints": [
{
"x": 536.5512382158005,
"y": 85.96506895397667
},
{
"x": 201.0028419494629,
"y": 85.96506895397667
}
]
},
{
"id": "a15",
"source": "t4",
"target": "p9",
"type": "normal",
"weight": "1",
"sourceAnchor": "bottom",
"targetAnchorAngle": 180,
"lineType": "right-angle"
},
{
"id": "a17",
"source": "p8",
"target": "t4",
"type": "normal",
"weight": "1",
"sourceAnchor": "top",
"targetAnchorAngle": 90,
"lineType": "right-angle",
"waypoints": [
{
"x": 1361.5512243721414,
"y": 306.7557665510285
}
]
},
{
"id": "a19",
"source": "p9",
"target": "t6",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 194.93141717813768,
"lineType": "straight"
},
{
"id": "a20",
"source": "t6",
"target": "p10",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 166.75948008481282,
"lineType": "straight"
},
{
"id": "a21",
"source": "p10",
"target": "t7",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 206.56505117707798,
"lineType": "straight"
},
{
"id": "a22",
"source": "t7",
"target": "p11",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 150.64224645720878,
"lineType": "straight"
},
{
"id": "a23",
"source": "p11",
"target": "t8",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 180,
"lineType": "straight"
},
{
"id": "a24",
"source": "t8",
"target": "p12",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 180,
"lineType": "straight"
},
{
"id": "a25",
"source": "p12",
"target": "t9",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 191.88865803962798,
"lineType": "straight"
},
{
"id": "a26",
"source": "t9",
"target": "p13",
"type": "normal",
"weight": "1",
"sourceAnchor": "top",
"targetAnchorAngle": 0,
"lineType": "straight"
},
{
"id": "a16",
"source": "p13",
"target": "t8",
"type": "normal",
"weight": "1",
"sourceAnchor": "left",
"targetAnchorAngle": 270,
"lineType": "straight"
},
{
"id": "a18",
"source": "t8",
"target": "p8",
"type": "normal",
"weight": "1",
"sourceAnchor": "top",
"targetAnchorAngle": 14.036243467926624,
"lineType": "right-angle"
},
{
"id": "a27",
"source": "p14",
"target": "t9",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 90,
"lineType": "right-angle"
},
{
"id": "a28",
"source": "t9",
"target": "p15",
"type": "normal",
"weight": "1",
"sourceAnchor": "bottom",
"targetAnchorAngle": 180,
"lineType": "right-angle"
},
{
"id": "a30",
"source": "p15",
"target": "t10",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 180,
"lineType": "straight"
},
{
"id": "a31",
"source": "t10",
"target": "p16",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 180,
"lineType": "straight"
},
{
"id": "a32",
"source": "p16",
"target": "t11",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 180,
"lineType": "straight"
},
{
"id": "a33",
"source": "t11",
"target": "p17",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 180,
"lineType": "straight"
},
{
"id": "a34",
"source": "p17",
"target": "t12",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 196.69924423399362,
"lineType": "straight"
},
{
"id": "a35",
"source": "t12",
"target": "p18",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 180,
"lineType": "straight"
},
{
"id": "a36",
"source": "p18",
"target": "t13",
"type": "normal",
"weight": "1",
"sourceAnchor": "right",
"targetAnchorAngle": 180,
"lineType": "straight"
},
{
"id": "a37",
"source": "t13",
"target": "p19",
"type": "normal",
"weight": "1",
"sourceAnchor": "top",
"targetAnchorAngle": 0,
"lineType": "straight"
},
{
"id": "a38",
"source": "p19",
"target": "t12",
"type": "normal",
"weight": "1",
"sourceAnchor": "left",
"targetAnchorAngle": 261.86989764584405,
"lineType": "straight"
},
{
"id": "a39",
"source": "t12",
"target": "p20",
"type": "normal",
"weight": "1",
"sourceAnchor": "top",
"targetAnchorAngle": 344.05460409907715,
"lineType": "straight"
},
{
"id": "a40",
"source": "p20",
"target": "t11",
"type": "normal",
"weight": "1",
"sourceAnchor": "left",
"targetAnchorAngle": 270,
"lineType": "straight"
},
{
"id": "a41",
"source": "t11",
"target": "p14",
"type": "normal",
"weight": "1",
"sourceAnchor": "top",
"targetAnchorAngle": 90,
"lineType": "right-angle"
}
],
"chartSquare": false,
"executions": []
}Repetição é sinal de padrão
Perceber que a mesma estrutura se repete sete vezes ajuda a construir e a revisar. Monte uma etapa com cuidado, confira, e replique — em vez de desenhar 20 lugares e 13 transições de uma vez e depois caçar o arco que ficou faltando.
Os tempos
Todos vieram de medição no sistema real, em segundos. É a diferença entre um modelo que descreve alguma coisa e um exercício:
| Etapa | Tempo |
|---|---|
| Captura de um quadro | 60 s |
| Envio ao armazenamento | 0,4427 s |
| Aviso ao distribuidor | 0,0001 s |
| Entrega ao consumidor | 0,0033 s |
| Download da imagem | 0,0945 s |
| Detecção de fogo | 0,643 s |
| Processamento de regras | 0,0015 s |
| Gravação no banco | 0,0084 s |
Repare na diferença de escala: a detecção leva 0,643 s e o aviso ao distribuidor leva 0,0001 s — seis mil vezes menos. Modelos assim geram muitos eventos por unidade de tempo simulada, e é por isso que este exemplo pode esbarrar no limite de eventos. Veja Configurar a execução.
As métricas
As quatro de sempre:
| Métrica | O que responde |
|---|---|
| Tempo de resposta | quanto demora da captura até o registro |
| Vazão | quantos quadros por segundo o sistema conclui |
| Utilização | quais componentes estão mais carregados |
| Bloqueio | com que frequência o sistema fica sem capacidade |
Conferindo com a realidade
Aqui está o que torna este exemplo especial. O sistema real foi medido durante quase três dias, processando 3.755 quadros, e o tempo médio de resposta observado foi de 1,2016 segundo.
O modelo dá:
| Fonte | Tempo de resposta |
|---|---|
| Sistema real medido | 1,2016 s |
| Modelo publicado | 1,2013 s |
| Este modelo na ferramenta | 1,2114 s |
Menos de 1% de diferença.
De onde vem a diferença
Somando os oito tempos da tabela dá exatamente 1,2016 s — que é o tempo de um quadro que não espera em lugar nenhum.
O modelo dá um pouco mais porque captura algo que a soma não captura: de vez em quando um quadro chega enquanto o anterior ainda está sendo processado, e espera. É a mesma variabilidade que forma fila no primeiro modelo, aqui valendo menos de 1% porque a carga é baixa.
Respondendo a pergunta que motivou o modelo
Com o modelo conferido, ele passa a servir para o que não dá para medir: e se a carga aumentar?
Variando a taxa de captura e o número de detectores em paralelo:
| Detectores | Vazão máxima | Tempo de resposta sob carga alta |
|---|---|---|
| 1 | 1,24 quadros/s | 2,16 s |
| 2 | 1,89 | 1,44 s |
| 4 | 2,15 | 1,22 s |
Duas leituras:
Com um detector, o sistema satura em 1,24 quadros por segundo. É o gargalo — a detecção leva 0,643 s, muito mais que qualquer outra etapa.
Com quatro detectores, a saturação sobe para 2,15 e o tempo de resposta fica praticamente igual ao de carga baixa. Mas repare que quadruplicar os detectores não quadruplicou a vazão: passou de 1,24 para 2,15, não para 5. O gargalo mudou de lugar — agora é o envio ao armazenamento, de 0,4427 s.
É o comportamento descrito em Medir utilização: ao aliviar o gargalo, outro assume. Otimizar é uma sequência de rodadas.
O que este exemplo mostra
Medir e modelar se completam. As medições alimentaram o modelo; o modelo respondeu perguntas que a medição não alcançava, porque exigiriam colocar o sistema real sob carga que ele não recebeu.
Conferir contra a realidade é o que dá confiança. Um modelo que reproduz uma medição conhecida pode ser usado para prever o desconhecido. Sem essa conferência, ele é só uma opinião com números.
Se você não tem medição para conferir
Confira o que puder. Um caso extremo com resposta óbvia, um regime de carga baixa em que o tempo de resposta deve ser a soma das etapas, uma configuração em que o sistema claramente satura. Qualquer âncora é melhor que nenhuma.