//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2010, 2026 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// This program and the accompanying materials are made available
// under the terms of the MIT License which is available at
// https://opensource.org/licenses/MIT
//
// SPDX-License-Identifier: MIT
//////////////////////////////////////////////////////////////////////////////

include::../_part_attributes.asciidoc[]

indexterm:[event,controllability]
indexterm:[event,uncontrollable]
indexterm:[event,controllable]

:leveloffset: -2

[[lang-tut-synthesis-evtctrl]]
== Event controllability

<<lang-tut-synthesis-intro,Supervisory controller synthesis>> distinguishes two kinds of <<lang-tut-basics-automata-events,events>>: controllable events and uncontrollable events.

Uncontrollable events are events that a supervisor can not prohibit, and are usually related to sensors.
A typical example are events that indicate that a button has been pushed or released.
A button is essentially a sensor that is on if the user pushes the button, and off if the user doesn't push it.
The supervisor can not prevent a user from physically pushing or releasing a button, and can also not determine when the user pushes or releases it.
The supervisor thus also can not prevent the events from occurring.

Another example is an event that indicates that a moving part has reached its outer position (limit sensor turns on).
If the part reaches its outer position, the event will occur.
The supervisor can not control the sensor, as it is physically linked to the position of the moving part.

Controllable events may be restricted by a supervisor, and are usually related to actuators.
Typical examples are events used to turn a motor on or off, to turn a lamp on or off, or to change the direction of movement.

Even though a supervisor may not be able to control a limit sensor directly, and thus restrict the corresponding events, it may be able to influence it indirectly.
For instance, a motor may be available that makes it possible for the part to move.
That motor may then be controlled using controllable on and off events.
Stopping the motor then makes the part stop moving, ensuring that the part never reaches its outer position, indirectly preventing the limit sensor from turning on, and the corresponding event from happening.

Events and <<lang-tut-channels-chapter-intro,channels>> in CIF are declared using the `event` keyword.
For controllable events, the `event` keyword may be preceded or replaced by the `controllable` keyword.
Similarly, for uncontrollable events, the `event` keyword may be preceded or replaced by the `uncontrollable` keyword.
Similar to event declarations, for <<lang-tut-reuse2-aut-def-param-kinds-event,event parameters>> the `event` keyword may by preceded or replaced by the `controllable` or `uncontrollable` keyword, for controllable and uncontrollable event parameters respectively.

As a convention, controllable events are given names that start with `+c_+`, and uncontrollable events are given names that start with `+u_+`.
This allows them to be highlighted in different colors.

For instance, consider the following CIF specification:

[source, cif]
----
controllable c_on, c_off;
uncontrollable u_pushed, u_released;
----
