Thank you for your response. I tried record/structure to define a composite object,
Node. Below is the part of the specification. Is it the right and the only way to specify such composite object?
------------------------------------------ MODULE Node ------------------------------------------
\* Node is composite object
\*where a node can be a Sensor Node, Actuator Node, or a Gateway Node.
\* depending on the type of Node it may sense or keep monitoring the environment, gateway relay the received infomation to the actuators. Actuator nodes are sleeping and get activicated after receiving the information.
\* A node regardless of whether it is sensor, actuator or a gateway has some common fields like NodeID, NodeType, ConnectStatus
EXTENDS Naturals, Sequences, TLC
CONSTANT N
ASSUME N \in 1..10
NodeTypes == {"Sensor", "Gateway", "Actuator"}
EquInfoSensor == {"Sensed", "Monitoring"}
ModeActuator == {"Sleep", "Active"}
EquInfoGateway == {"Received", "Transmitted"}
Node(n) ==
[ NodeID : N,
NodeType : CHOOSE type \in NodeTypes: TRUE,
ConnectStatus : CHOOSE conn \in {TRUE, FALSE}: TRUE,
Attributes : IF NodeTypes = "Sensor"
THEN [ EquInfo |-> CHOOSE e \in EquInfoSensor: TRUE ]
ELSE IF NodeTypes = "Actuator"
THEN [ Mode |-> CHOOSE m \in ModeActuator: TRUE ]
ELSE [ EquInfo |-> CHOOSE e \in EquInfoGateway: TRUE ]
]
VARIABLES nodes
Init ==
/\ nodes = { Node(n) : n \in 1..10 }
Next==
===============