Create in the main project directory a file VendingMachine.component using File > New > File, with the VendingMachine project as parent. Insert the following text (you may copy the text below):

import "IUser/IUser.interface"
import "IService/IService.interface"
import "ICoinCheck/ICoinCheck.interface"

component VendingMachine

provided port IUser vmUserPort
provided port IService vmServicePort
required port ICoinCheck vmCoinPort

functional constraints

OperationalConstraintInsertCoin {
    /* InsertCoin Command of IUser returns NOT_OPERATIONAL
     * when IService is not in state Operational
     * Otherwise it returns ACCEPTED or NOT_ACCEPTED
     */
    use events
    vmUserPort::reply to command InsertCoin

    initial state CoinReply {
        vmUserPort::reply (*,CoinResult::NOT_OPERATIONAL) to command InsertCoin
             where NOT vmServicePort in Operational
        next state: CoinReply

        vmUserPort::reply (*,CoinResult::ACCEPTED) to command InsertCoin
             where vmServicePort in Operational
        next state: CoinReply

        vmUserPort::reply (*,CoinResult::NOT_ACCEPTED) to command InsertCoin
             where vmServicePort in Operational
        next state: CoinReply
    }
}

Improve the lay-out using <CTRL>-<SHIFT>-F.

This specification assumes that interface IService has a state called Operational to represent that the machine is on and not in an error. Replace it with the state name of your model.

The functional constraint restricts the reply to command InsertCoin as indicated in the use events part. The specification expresses that when a reply to InsertCoin occurs, one of the following cases should hold:

To monitor the component constraints, change the file VendingMachine.prj as follows:

Run monitoring and inspect the dashboard with the results in folder comma-gen.