File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import
2+ "https://raw.githubusercontent.com/CollaborativeStateMachines/Cirrina/refs/heads/develop/src/main/resources/pkl/csm/csml.pkl"
3+
4+ import "events.pkl" as Events
5+ import "serviceTypes.pkl" as ServiceTypes
6+ import "variables.pkl" as Vars
7+
8+ monitorFSM = new csml .StateMachine {
9+ transient {
10+ ["nScans" ] = "0"
11+ ["nAssemblies" ] = "0"
12+ }
13+ states {
14+ ["monitoringState" ] = new csml .Initial {
15+ on {
16+ [Events.eScanned] {
17+ yields {
18+ new csml .Eval { expression = "nScans += 1" }
19+ new csml .Emit { event = new csml .Internal { topic = Events.eSendStatistics } }
20+ }
21+ }
22+ [Events.eAssemblyComplete] {
23+ yields {
24+ new csml .Eval { expression = "nAssemblies += 1" }
25+ new csml .Emit { event = new csml .Internal { topic = Events.eSendStatistics } }
26+ }
27+ }
28+ [Events.eSendStatistics] {
29+ yields {
30+ new csml .Invoke {
31+ type = ServiceTypes.stSendStatistics
32+ input {
33+ ["nScans" ] = "nScans"
34+ ["nAssemblies" ] = "nAssemblies"
35+ ["productsCompleted" ] = "\(Vars.vProductsCompleted) "
36+ ["jobDone" ] = "\(Vars.vIsJobDone) "
37+ }
38+ }
39+ }
40+ }
41+ [Events.eJobDone] {
42+ to = "jobDoneLogState"
43+ }
44+ }
45+ }
46+
47+ ["jobDoneLogState" ] {
48+ entry {
49+ new csml .Invoke {
50+ type = ServiceTypes.stSendStatistics
51+ input {
52+ ["nScans" ] = "nScans"
53+ ["nAssemblies" ] = "nAssemblies"
54+ ["productsCompleted" ] = "\(Vars.vProductsCompleted) "
55+ ["jobDone" ] = "\(Vars.vIsJobDone) "
56+ }
57+ emits {
58+ new csml .ConditionalEvent {
59+ event = new csml .Internal { topic = Events.eMonitorJobCompletionStatisticsLogged }
60+ }
61+ }
62+ }
63+ }
64+
65+ on {
66+ [Events.eMonitorJobCompletionStatisticsLogged] { to = "jobDoneState" }
67+ }
68+ }
69+
70+ ["jobDoneState" ] = new csml .Terminal {}
71+ }
72+ }
You can’t perform that action at this time.
0 commit comments