State Diagram: Concurrent States with Synchronization

+1 vote
asked May 16, 2021 in Question / help by HOANG

Hello.

I would like to ask how to draw some concurrent state areas with synchronization between them, like below:

or

or

I have tried many times but always faced this error: The state fork (or entryPt) has been created in a concurrent state: it cannot be used here.

Could anyone help me.

commented May 16, 2021 by albert (3,520 points)
When we would see some code we might be able to see where your error comes from.

Which version of plantuml are you using?
commented May 17, 2021 by duc_ttm (120 points)
edited May 18, 2021 by duc_ttm
Could anyone have an idea for this, or can it be considered as a bug to be fixed in future?

I used the online editor of plantuml so I think it is the latest.

My code is appended in the below comments.

Please help me, thanks in advance.

Hoang
commented May 17, 2021 by albert (3,520 points)

With the online editor you can also see which version is used, use the "program":

@startuml

version

@enduml
commented May 19, 2021 by duc_ttm (120 points)
edited May 19, 2021 by duc_ttm

The version is:

PlantUML version 1.2021.7beta2
Dot version: 2.38.0.

Could you check it for me. 

Waiting for your reply. Many thanks.

1 Answer

0 votes
answered May 16, 2021 by The-Lu (63,920 points)

Hello H.,

Without concurrent state (who it seems to must be independent), here is a proposal...:

@startuml
hide empty description

state Producer {
 state P1
 state fork1   <<fork>>
 state P2
 [*] --> P1
}

state choice1 <<choice>>

state Consumer {
 state C1
 state C2
 state fork2   <<fork>>
 [*] --> C1
}

P1 --> fork1
fork1 ----> P2
fork1 --> choice1
P2 -u---> P1

C1 ----> fork2
choice1 --> fork2
fork2 --> C2
C2 -u---> C1
@enduml


If that can help,
Regards,
Th.

commented May 16, 2021 by HOANG

Thank you for your fast replies.

But that is not what I want. I don't think that fork/join can be used without concurrent state context. That might not UML specification.

My code is something like below:

@startuml
[*] --> Active

state Active {
  state fork1 <<fork>>
  state join1 <<join>>

  [*] -> P1
  P1 -> fork1
  fork1 -> P2
  P2 -> P1
  --
  [*] -> C1
  C1 -> join1
  fork1 -> join1
  join1 -> C2
  C2 -> C1 
}
@enduml

Regards,

Hoang
commented May 16, 2021 by duc_ttm (120 points)
edited May 18, 2021 by duc_ttm
Thank you for your fast replies.

But that may not what I want. I don't think join/fork can be used outside concurrent state context. That might not be UML specification

My code is something like below:

---

@startuml
hide empty description

state Active {

state Producer {
 state P1
 state fork1   <<fork>>
 state P2
 [*] --> P1
}

state choice1 <<choice>>
--
state Consumer {
 state C1
 state C2
 state fork2   <<fork>>
 [*] --> C1
}

P1 --> fork1
fork1 ----> P2
fork1 --> choice1
P2 -u---> P1

C1 ----> fork2
choice1 --> fork2
fork2 --> C2
C2 -u---> C1

}
@enduml

---

Please help me,

Regards,

Hoang
commented May 17, 2021 by albert (3,520 points)
Which of your 2 comments represents what you (want to)  have?
commented May 17, 2021 by duc_ttm (120 points)
edited May 18, 2021 by duc_ttm
Any of them is also OK but for a decision, the latter is what I want to have.

Anyway, the version is

PlantUML version 1.2021.7beta2

Dot version: 2.38.0

Thank you in advance.
commented May 19, 2021 by The-Lu (63,920 points)

Hello all,

With that, it is now a clear wanted feature to request to PlantUML team:

  • Could PlantUML manage Concurrent States with Synchronization (or Dependent Concurrent States)?

As:

or:

Or other syntax...

Thanks,
Regards,
Th.

commented May 20, 2021 by duc_ttm (120 points)
Thank you very much.

I will post this content on to Wanted Features page.

Because this is one of crucial functions of Harel's state machine.

Regards,

Hoang
commented Apr 15, 2022 by lelezhangzhao (100 points)
Has this problem been solved
...