Workflow Example
Sequence workflow example
{
"lights": [
{
"id": "Light1",
"channel": 0,
"description": "Ring light"
},
{
"id": "Light2",
"channel": 1,
"description": "Bar light 1"
},
{
"id": "Light3",
"channel": 2,
"description": "Bar light 2"
},
{
"id": "Light4",
"channel": 3,
"description": "Bar light 3"
}
],
"lightSettings": [
{
"id": "Light1 off",
"lightId": "Light1",
"lightLevel": 0
},
{
"id": "Light1 on",
"lightId": "Light1",
"lightLevel": 255
},
{
"id": "Light2 off",
"lightId": "Light2",
"lightLevel": 0
},
{
"id": "Light2 on",
"lightId": "Light2",
"lightLevel": 128
},
{
"id": "Light3 off",
"lightId": "Light3",
"lightLevel": 0
},
{
"id": "Light3 on",
"lightId": "Light3",
"lightLevel": 200
},
{
"id": "Light4 off",
"lightId": "Light4",
"lightLevel": 0
},
{
"id": "Light4 on",
"lightId": "Light4",
"lightLevel": 191
}
],
"scenes": [
{
"id": "Scene0",
"name": "Lights off",
"lightSettingsIds": [
"Light1 off",
"Light2 off",
"Light3 off",
"Light4 off"
]
},
{
"id": "Scene1",
"name": "Brightfield",
"lightSettingsIds": [
"Light1 on",
"Light2 off",
"Light3 off",
"Light4 off"
]
},
{
"id": "Scene2",
"name": "Darkfield 1",
"lightSettingsIds": [
"Light1 off",
"Light2 on",
"Light3 off",
"Light4 off"
]
},
{
"id": "Scene3",
"name": "Darkfield 2",
"lightSettingsIds": [
"Light1 off",
"Light2 off",
"Light3 on",
"Light4 off"
]
},
{
"id": "Scene4",
"name": "Darkfield 3",
"lightSettingsIds": [
"Light1 off",
"Light2 off",
"Light3 off",
"Light4 on"
]
}
],
"sequences": [
{
"id": "1",
"name": "vision sequence",
"steps": [
{
"name": "GetProductId",
"description": "Get product id from tag value",
"order": 0,
"activityType": "SetState",
"parameters": {
"tagName": "Factory1.Line1.ProductId"
},
"stepOnError": 16
},
{
"name": "SetBrightfieldScene",
"description": "Set top light on",
"order": 1,
"activityType": "SetScene",
"parameters": {
"sceneId": "Scene1"
},
"stepOnError": 16
},
{
"name": "GetBrightfieldImage",
"description": "Brightfield image acquire",
"order": 2,
"activityType": "CameraAcquireToFile",
"parameters": {
"filename": "img_bf_{Factory1.Line1.ProductId}.bmp",
"exposureUs": "15000"
},
"stepOnError": 16
},
{
"name": "SetDFLight1",
"description": "Set darkfield light 1 on",
"order": 3,
"activityType": "SetScene",
"parameters": {
"sceneId": "Scene2"
},
"stepOnError": 16
},
{
"name": "GetDarkfieldImage1",
"description": "Darkfield image 1",
"order": 4,
"activityType": "CameraAcquireToFile",
"parameters": {
"filename": "img_df1_{Factory1.Line1.ProductId}.bmp",
"exposureUs": "15000"
},
"stepOnError": 16
},
{
"name": "SetDFLight2",
"description": "Set darkfield light 2 on",
"order": 5,
"activityType": "SetScene",
"parameters": {
"sceneId": "Scene3"
},
"stepOnError": 16
},
{
"name": "GetDarkfieldImage2",
"description": "img3",
"order": 6,
"activityType": "CameraAcquireToFile",
"parameters": {
"filename": "img_df2_{Factory1.Line1.ProductId}.bmp",
"exposureUs": "15000"
},
"stepOnError": 16
},
{
"name": "SetDFLight3",
"description": "Set darkfield light 3 on",
"order": 7,
"activityType": "SetScene",
"parameters": {
"sceneId": "Scene4"
},
"stepOnError": 16
},
{
"name": "GetDarkfieldImage3",
"description": "img4",
"order": 8,
"activityType": "CameraAcquireToFile",
"parameters": {
"filename": "img_df3_{Factory1.Line1.ProductId}.bmp",
"exposureUs": "15000"
},
"stepOnError": 16
},
{
"name": "SetLightsOff",
"description": "Set lighting off",
"order": 9,
"activityType": "SetScene",
"parameters": {
"sceneId": "Scene0"
},
"stepOnError": 16
},
{
"name": "ExecuteVision",
"description": "Executing vision model",
"order": 10,
"activityType": "ExecuteModel",
"parameters": {
"modelName": "VisionModel"
},
"stepOnError": 16
},
{
"name": "SetResultPassFail",
"description": "Write vision pass fail tag value",
"order": 11,
"activityType": "PublishState",
"parameters": {
"tagName": "Factory1.Line1.PassFail"
},
"stepOnError": null
},
{
"name": "SetResultPassFailInfo",
"description": "Write vision pass fail info tag value",
"order": 12,
"activityType": "PublishState",
"parameters": {
"tagName": "Factory1.Line1.PassFailInfo"
},
"stepOnError": null
},
{
"name": "SetResultValidity",
"description": "Write vision validity tag value",
"order": 13,
"activityType": "PublishState",
"parameters": {
"tagName": "Factory1.Line1.Validity"
},
"stepOnError": null
},
{
"name": "WriteResultToFile",
"description": "Write vision output to file",
"order": 14,
"activityType": "WrapResult",
"parameters": {
"fileName": "result.json",
"template": "{\"id\": <state;workflowid>,\"payload\": <json;output.json>}"
},
"stepOnError": null
},
{
"name": "EndSuccessfully",
"description": "End workflow successfully",
"order": 15,
"activityType": "EndWorkflow",
"parameters": {
"success": "true"
},
"stepOnError": null
},
{
"name": "SetResultPassFail",
"description": "Publish vision pass fail tag value",
"order": 16,
"activityType": "PublishState",
"parameters": {
"tagName": "Factory1.Line1.PassFail",
"datatype": "analog",
"value": "0"
},
"stepOnError": null
},
{
"name": "SetResultPassFailInfo",
"description": "Publish vision pass fail info tag value",
"order": 17,
"activityType": "PublishState",
"parameters": {
"tagName": "Factory1.Line1.PassFailInfo",
"datatype": "analog",
"value": "0"
},
"stepOnError": null
},
{
"name": "SetResultValidity",
"description": "Publish vision validity tag value",
"order": 18,
"activityType": "PublishState",
"parameters": {
"tagName": "Factory1.Line1.Validity",
"datatype": "analog",
"value": "0"
},
"stepOnError": null
},
{
"name": "WriteErrorResultToFile",
"description": "Write error vision output to file",
"order": 19,
"activityType": "WrapResult",
"parameters": {
"fileName": "result.json",
"template": "{\"id\": <state;workflowid>,\"payload\": <json;output.json>}"
},
"stepOnError": null
},
{
"name": "EndWithFail",
"description": "End workflow with failure",
"order": 20,
"activityType": "EndWorkflow",
"parameters": {
"success": "false"
},
"stepOnError": null
}
],
"trigger": {
"type": "OnTagChange",
"parameters": "Factory1.Line1.Trigger"
}
}
]
}Last updated
Was this helpful?