control
Look up the authority declaration and control.set_authority, which set the control authority of an Arc automation.
The authority declaration sets the control authority that an automation starts with.
control.set_authority changes it while the automation runs. For how Synnax decides
which writer controls a channel, see control authority.
authority
Sets the starting authority of the channels that the automation writes. authority is a
keyword, so it needs no import.
- Values are integers from 0 to 255. A higher value has priority.
- An automation without an
authoritydeclaration writes all channels at 255. - Declarations come after the imports and before all other top-level code, variables included.
- A program can have more than one declaration, but only one default value and one value for each channel.
Inside the parentheses, a new line or a space separates the entries:
authority (
200
press_vlv_cmd 100
vent_vlv_cmd 150
)
1 -> press_vlv_cmd
0 -> vent_vlv_cmdset_authority
Changes the authority of one write channel, or of all write channels, while the
automation runs. Import it with import control.
valueu8RequiredThe new authority, 0 to 255.
channelchan TThe write channel to change. Leave it out to change all write channels.
- Trigger -> optional. The value must be
u8, such as au8channel ortime.interval. Aboolvalue, such as a comparison, is an error. - Output -> none.
- Runs -> once each time its stage starts. Later trigger values have no effect until the
stage starts again. At the top level, it needs an upstream trigger, such as
start_cmd -> control.set_authority(value=200), and runs once, on the first trigger value. Without a trigger, a top-level call is a syntax error.
The change goes out before the writes of the same cycle. A value of 0 does not release the channel. The automation keeps control at authority 0 until a writer with a higher authority, or a writer with an equal authority that opened earlier, takes it.
As a step of its own in a sequence, it moves on to the next step after it runs.
import control
authority 100
sequence fill {
stage pressurize {
control.set_authority(value=220, channel=press_vlv_cmd)
1 -> press_vlv_cmd
tank_pt > 300 => next
}
stage hold {
control.set_authority(value=100)
0 -> press_vlv_cmd
}
}
start_cmd == 1 => fillOn a Driver, a known bug affects two or more set_authority calls that run in the same
cycle when one of them has no channel. The Driver sends a bad authority change, and
the automation stops writing. On a Driver, give every call a channel, or run only one
call in each cycle. The Core is not affected.