本页内容

API参考:模拟

模拟可让您在流程模型上运行假设场景。您可以配置处理时间、资源分配和到达率,以预测流程行为。

列出流程的模拟

端点: GET /v1/tenant/{tenantId}/processes/{processId}/simulations

**身份验证:**租户范围API密钥 · read范围

参数:

名称 类型 位置 必填 描述
tenantId string 路径 格式:uuid
processId string 路径 格式:uuid
limit integer 查询参数 返回的最大项目数
offset integer 查询参数 跳过的项目数

响应(200):

模拟列表

[
	{
		"id": "00000000-0000-0000-0000-000000000000",
		"displayName": "string",
		"datasetName": "string",
		"startTime": "2024-03-15T16:30:00Z",
		"endTime": "2024-03-15T16:30:00Z",
		"useWarmUp": true
	}
]

错误:

  • 400请求错误:例如筛选表达式无效、流程没有模型、上传类型不受支持或缺少必填字段
  • 401缺少、无效、已禁用或已过期的API密钥
  • 404未找到资源

创建模拟(提供ID时具有幂等性)

端点: POST /v1/tenant/{tenantId}/processes/{processId}/simulations

**身份验证:**租户范围API密钥 · write范围

参数:

名称 类型 位置 必填 描述
tenantId string 路径 格式:uuid
processId string 路径 格式:uuid

请求正文:

{
	"id": "00000000-0000-0000-0000-000000000000",
	"displayName": "string",
	"datasetName": "string",
	"startTime": "2024-03-15T16:30:00Z",
	"endTime": "2024-03-15T16:30:00Z",
	"useWarmUp": true
}
字段 类型 必填 描述
id string 用于幂等重试的可选ID(必须是UUID)
格式:uuid
displayName string 模拟名称
默认值:New Simulation
datasetName string 模拟运行所用数据集的名称
startTime string 模拟开始时间
格式:date-time
endTime string 模拟结束时间
格式:date-time
useWarmUp boolean 是否舍弃预热期
默认值:false

响应(201):

模拟已创建

{
	"simulation": {
		"id": "00000000-0000-0000-0000-000000000000",
		"displayName": "string"
	},
	"message": "string"
}
字段 类型 必填 描述
simulation object
message string

错误:

  • 400请求错误:例如筛选表达式无效、流程没有模型、上传类型不受支持或缺少必填字段
  • 401缺少、无效、已禁用或已过期的API密钥
  • 404未找到资源
  • 409请求与当前状态冲突(例如席位限制或重复使用ID)

获取包含元素设置、属性和资源的模拟

端点: GET /v1/tenant/{tenantId}/processes/{processId}/simulations/{simulationId}

**身份验证:**租户范围API密钥 · read范围

参数:

名称 类型 位置 必填 描述
tenantId string 路径 格式:uuid
processId string 路径 格式:uuid
simulationId string 路径 格式:uuid

响应(200):

模拟详情

{
	"simulation": {
		"id": "00000000-0000-0000-0000-000000000000",
		"displayName": "string",
		"datasetName": "string",
		"startTime": "2024-03-15T16:30:00Z",
		"endTime": "2024-03-15T16:30:00Z",
		"useWarmUp": true
	},
	"elementSettings": [
		{
			"simulationId": "00000000-0000-0000-0000-000000000000",
			"modelElementId": "00000000-0000-0000-0000-000000000000",
			"settings": {
				"processingTimeDistribution": [
					{
						"timeslot": {
							"periodicity": "Always"
						},
						"conditions": [
							{
								"type": "Values",
								"attribute": "string",
								"values": [
									"string"
								]
							}
						],
						"distribution": {
							"type": "Fixed",
							"value": 0
						},
						"timeUnit": "seconds",
						"rateUnit": "perTimeSlot"
					}
				],
				"processingTimeUnit": "seconds",
				"updateAttributeRules": [
					{
						"id": "string",
						"attributeId": "00000000-0000-0000-0000-000000000000",
						"timeslot": {
							"periodicity": "Always"
						},
						"conditions": [
							{
								"type": "Values",
								"attribute": "string",
								"values": [
									"string"
								]
							}
						],
						"newValue": "string",
						"isEnabled": true
					}
				],
				"requiredResources": [
					{
						"resourceId": "00000000-0000-0000-0000-000000000000",
						"amount": 0
					}
				],
				"caseStartsDistribution": [
					{
						"timeslot": {
							"periodicity": "Always"
						},
						"conditions": [
							{
								"type": "Values",
								"attribute": "string",
								"values": [
									"string"
								]
							}
						],
						"distribution": {
							"type": "Fixed",
							"value": 0
						},
						"timeUnit": "seconds",
						"rateUnit": "perTimeSlot"
					}
				],
				"caseStartsTimeUnit": "perTimeSlot",
				"capacityInterval": "perHour",
				"skipChanceDistribution": [
					{
						"timeslot": {
							"periodicity": "Always"
						},
						"conditions": [
							{
								"type": "Values",
								"attribute": "string",
								"values": [
									"string"
								]
							}
						],
						"distribution": {
							"type": "Fixed",
							"value": 0
						},
						"timeUnit": "seconds",
						"rateUnit": "perTimeSlot"
					}
				],
				"queueStrategy": "fifo",
				"chanceToTakeDistribution": [
					{
						"timeslot": {
							"periodicity": "Always"
						},
						"conditions": [
							{
								"type": "Values",
								"attribute": "string",
								"values": [
									"string"
								]
							}
						],
						"distribution": {
							"type": "Fixed",
							"value": 0
						},
						"timeUnit": "seconds",
						"rateUnit": "perTimeSlot"
					}
				]
			}
		}
	],
	"attributes": [
		{
			"id": "00000000-0000-0000-0000-000000000000",
			"simulationId": "00000000-0000-0000-0000-000000000000",
			"displayName": "string",
			"valueDistribution": {
				"type": "Number",
				"numberDistributions": [
					{
						"timeslot": {
							"periodicity": "Always"
						},
						"conditions": [
							{
								"type": "Values",
								"attribute": "string",
								"values": [
									"string"
								]
							}
						],
						"distribution": {
							"type": "Fixed",
							"value": 0
						},
						"timeUnit": "seconds",
						"rateUnit": "perTimeSlot",
						"id": "string",
						"isEnabled": true,
						"isDefault": true
					}
				],
				"textDistributions": [
					{
						"id": "string",
						"timeslot": {
							"periodicity": "Always"
						},
						"isEnabled": true,
						"isDefault": true,
						"mode": "list",
						"textValues": [
							{
								"id": "string",
								"value": "string",
								"chance": 0
							}
						]
					}
				]
			},
			"simulationAttributeType": "string"
		}
	],
	"resources": [
		{
			"id": "00000000-0000-0000-0000-000000000000",
			"simulationId": "00000000-0000-0000-0000-000000000000",
			"displayName": "string",
			"levelDistribution": [
				{
					"timeslot": {
						"periodicity": "Always"
					},
					"conditions": [
						{
							"type": "Values",
							"attribute": "string",
							"values": [
								"string"
							]
						}
					],
					"distribution": {
						"type": "Fixed",
						"value": 0
					},
					"timeUnit": "seconds",
					"rateUnit": "perTimeSlot"
				}
			],
			"attributeId": "00000000-0000-0000-0000-000000000000"
		}
	]
}
字段 类型 必填 描述
simulation object 模拟标头
elementSettings object[] 每个元素的模拟设置
attributes object[] 模拟属性
resources object[] 资源池

错误:

  • 400请求错误:例如筛选表达式无效、流程没有模型、上传类型不受支持或缺少必填字段
  • 401缺少、无效、已禁用或已过期的API密钥
  • 404未找到资源

更新模拟(字段和/或元素设置)

端点: PUT /v1/tenant/{tenantId}/processes/{processId}/simulations/{simulationId}

**身份验证:**租户范围API密钥 · write范围

参数:

名称 类型 位置 必填 描述
tenantId string 路径 格式:uuid
processId string 路径 格式:uuid
simulationId string 路径 格式:uuid

请求正文:

{
	"displayName": "string",
	"datasetName": "string",
	"startTime": "2024-03-15T16:30:00Z",
	"endTime": "2024-03-15T16:30:00Z",
	"useWarmUp": true,
	"elementSettings": [
		{
			"modelElementId": "00000000-0000-0000-0000-000000000000",
			"settings": {
				"caseStartsDistribution": [
					{
						"timeslot": {
							"periodicity": "Always"
						},
						"conditions": [
							{
								"type": "Values",
								"attribute": "string",
								"values": [
									"string"
								]
							}
						],
						"distribution": {
							"type": "Fixed",
							"value": 0
						},
						"timeUnit": "seconds",
						"rateUnit": "perTimeSlot"
					}
				],
				"processingTimeDistribution": [
					{
						"timeslot": {
							"periodicity": "Always"
						},
						"conditions": [
							{
								"type": "Values",
								"attribute": "string",
								"values": [
									"string"
								]
							}
						],
						"distribution": {
							"type": "Fixed",
							"value": 0
						},
						"timeUnit": "seconds",
						"rateUnit": "perTimeSlot"
					}
				]
			}
		}
	]
}
字段 类型 必填 描述
displayName string 模拟名称
datasetName string 模拟运行所用数据集的名称
startTime string 模拟开始时间
格式:date-time
endTime string 模拟结束时间
格式:date-time
useWarmUp boolean 是否舍弃预热期
elementSettings object[] 每个元素的设置覆盖值

响应(200):

模拟已更新

{
	"message": "string"
}
字段 类型 必填 描述
message string

错误:

  • 400请求无效,例如筛选表达式无效、流程没有模型、不支持的上传类型或缺少必填字段
  • 401缺少、无效、已禁用或已过期的API密钥
  • 404未找到资源

永久删除模拟

端点: DELETE /v1/tenant/{tenantId}/processes/{processId}/simulations/{simulationId}

**身份验证:**租户范围API密钥 · write作用域

参数:

名称 类型 位置 必填 描述
tenantId string 路径 格式:uuid
processId string 路径 格式:uuid
simulationId string 路径 格式:uuid

响应(200):

模拟已删除

{
	"message": "string"
}
字段 类型 必填 描述
message string

错误:

  • 400请求无效,例如筛选表达式无效、流程没有模型、不支持的上传类型或缺少必填字段
  • 401缺少、无效、已禁用或已过期的API密钥
  • 404未找到资源

这些端点会根据流程模型,使用AI自动生成模拟设置。

通过AI生成模拟设置(异步;轮询状态端点)

端点: POST /v1/tenant/{tenantId}/processes/{processId}/simulations/{simulationId}/generate-settings

**身份验证:**租户范围API密钥 · write作用域 · 速率限制2 req/s(突发4)

参数:

名称 类型 位置 必填 描述
tenantId string 路径 格式:uuid
processId string 路径 格式:uuid
simulationId string 路径 格式:uuid

请求正文:

{
	"processDescription": "string",
	"additionalContext": "string"
}
字段 类型 必填 描述
processDescription string
additionalContext string

响应(200):

生成已开始/结果

{
	"message": "string"
}
字段 类型 必填 描述
message string

错误:

  • 400请求无效,例如筛选表达式无效、流程没有模型、不支持的上传类型或缺少必填字段
  • 401缺少、无效、已禁用或已过期的API密钥
  • 404未找到资源

轮询模拟设置生成状态

端点: GET /v1/tenant/{tenantId}/processes/{processId}/simulations/{simulationId}/generate-settings/status

**身份验证:**租户范围API密钥 · write作用域

参数:

名称 类型 位置 必填 描述
tenantId string 路径 格式:uuid
processId string 路径 格式:uuid
simulationId string 路径 格式:uuid

响应(200):

生成状态

{
	"message": "string"
}
字段 类型 必填 描述
message string

错误:

  • 400请求无效,例如筛选表达式无效、流程没有模型、不支持的上传类型或缺少必填字段
  • 401缺少、无效、已禁用或已过期的API密钥
  • 404未找到资源

启动模拟运行(异步;结果写入流程数据表)

端点: POST /v1/tenant/{tenantId}/processes/{processId}/simulations/{simulationId}/run

**身份验证:**租户范围API密钥 · write作用域 · 速率限制5 req/s(突发10)

参数:

名称 类型 位置 必填 描述
tenantId string 路径 格式:uuid
processId string 路径 格式:uuid
simulationId string 路径 格式:uuid

响应(200):

模拟已启动

{
	"message": "string"
}
字段 类型 必填 描述
message string

错误:

  • 400请求无效,例如筛选表达式无效、流程没有模型、不支持的上传类型或缺少必填字段
  • 401缺少、无效、已禁用或已过期的API密钥
  • 404未找到资源

获取上次模拟运行的状态(根据输出数据表得出)

端点: GET /v1/tenant/{tenantId}/processes/{processId}/simulations/{simulationId}/run/status

**身份验证:**租户范围API密钥 · read作用域

参数:

名称 类型 位置 必填 描述
tenantId string 路径 格式:uuid
processId string 路径 格式:uuid
simulationId string 路径 格式:uuid

响应(200):

运行状态

{
	"state": "notStarted",
	"startedAt": "2024-03-15T16:30:00Z",
	"completedAt": "2024-03-15T16:30:00Z",
	"step": "string",
	"casesSimulated": 0,
	"targetCases": 0,
	"eventsGenerated": 0,
	"errorMessage": "string",
	"simulationId": "00000000-0000-0000-0000-000000000000"
}
字段 类型 必填 描述
state notStarted | running | processing | ready | error 允许值:notStartedrunningprocessingreadyerror
startedAt string 格式:date-time
completedAt string 格式:date-time
step string
casesSimulated number
targetCases number
eventsGenerated number
errorMessage string
simulationId string 格式:uuid

错误:

  • 400请求无效,例如筛选表达式无效、流程没有模型、不支持的上传类型或缺少必填字段
  • 401缺少、无效、已禁用或已过期的API密钥
  • 404未找到资源