Other DSL

par

This utility is provided to support running multiple tasks in parallel. A call to par returns when all the submitted tasks complete.

The following example demonstrates sending commands in parallel to multiple HCD’s.

Kotlin
sourceval prefix = "OCS.IRIS_darkMode"
val hcd1 = Hcd(IRIS, "filter.wheel1", Duration.minutes(10))
val hcd2 = Hcd(IRIS, "filter.wheel2", Duration.minutes(10))
val hcd3 = Hcd(IRIS, "filter.wheel3", Duration.minutes(10))

onSetup("setup-iris-hcds") {
    // send 3 setup commands to 3 HCD's in parallel
    val responses: List<SubmitResponse> =
        par(
            { hcd1.submitAndWait(Setup(prefix, "move-10")) },
            { hcd2.submitAndWait(Setup(prefix, "move-10")) },
            { hcd3.submitAndWait(Setup(prefix, "move-10")) }
        )
}

isOnline

A flag called isOnline is provided, which is true when sequencer is Online and false when sequencer is Offline. This dsl is accessible in all the scopes.

Kotlin
sourceonDiagnosticMode { _, _ ->
    loopAsync(Duration.milliseconds(100)) {
        if (isOnline)
            publishEvent(SystemEvent("TCS.filter.wheel", "online-diag-data"))
        else
            publishEvent(SystemEvent("TCS.filter.wheel", "offline-diag-data"))
    }

}

prefix

Prefix of the current sequencer is made available in all scopes by this dsl.

Kotlin
sourceval downstreamCommand: Setup = Setup(prefix, "move")

Source code for examples