0
votes

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.

2
Please try to create a diagram as much as you can. That would make it easier for us to point out what it should be. I think it's good to have a lifeline for each sensor. The controller reads the state of each sensor. You could model that by a 'read' message from the controller to the sensor.www.admiraalit.nl
Your solution sounds reasonable. Many sensors operate in poll mode, so the controller sends a message and awaits an answer (possible with timeout). Other sensor just send unsolicited messages to a bus where the controller reads them. So it depends on the sensor's protocoll.qwerty_so

2 Answers

0
votes

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

0
votes

I think you might be looking for something like this: enter image description here

It is generated by ZenUML. Just put the following code into the editor to generate the above diagram:

@Starter(AutomaticController)
MechanicalOpener.tryOpen(door) {
  stoped = Sensor1.isTrainStopped()
  aligned = Sensor2.alignedAtPlatform()
  closed = Sensor3.isDoorClosed()

  if (stopped_and_aligned_and_closed) {
    open(door)
  }
}