Search code examples
umlsequencediagramsequence-diagram

How to represent feedback from sensor in UML Sequence Diagram


I have a doubt to model my system using UML Sequence Diagrams (yes, I know the State Machine Diagram is simpler to do this, but I need a Sequence Diagram).

Consider a simple train door system, where there is (A) an automatic controller that issues a command to (B) a mechanical opener (an actuator) to open or close the door. The system has some (C) sensors - that send feedback informing if the train is stopped or not; if the train is aligned at platform or not; if there is an emergency or not; if the door is opened, closed or partially opened/closed and; if there is a person or object in doorway - and the (D) door itself.

The controller issues commands to open and close the door based on the feedback of sensors (e.g., if the train is stopped, aligned at platform and the door is closed, it is safe to open it). Therefore, I need to receive the feedback before send the command. How do I represent the sensors and its information in UML Sequence Diagram? Considering each sensor as an actor? Considering the feedback as an found message? I cannot represent this using the "pure UML" and need to use some extension for Real-time systems?

Thanks


SOLUTION: I represented each sensor as a lifeline. They send feedback to the controller within a loop, and based on the feedback I am able to issue a command. I am not sure if this is correct.


Solution

  • The sensor is a life line like any other object. It can send messages like any object. Most likely these will be asynchronous messages. But depending on the protocol this could as well be synchronous ones. If needed you can add timing constraints to the messages: https://www.uml-diagrams.org/sequence-diagrams.html