lingua-franca
lingua-franca copied to clipboard
Direction of reactions in the diagrams
The adjustable port side feature implemented in https://github.com/lf-lang/lingua-franca/pull/1807 is a great addition to LF. However, I find it a bit challenging to use in conjunction with reactions. For instance, I would like to have the dataflow for requests to go from left to right, and the dataflow for responses to go from right to left in this reactor:
Would it be possible to add an annotation that changes the direction of reactions?
Can you please add a model to your ticket such that I can try out different layout algorithm with it?
Sure. Here is the code used to produce the diagram from above.
target Python
reactor ClientMethodTransactor {
@side("west")
input request
@side("west")
output response
physical action p
logical action l
@label("send request")
reaction(request) {==}
@label("receive response")
@side("west")
reaction(p) -> l {==}
@label("forward response")
reaction(l) -> response {==}
}
The manual adjustment of port sides was and is an experimental feature. Nothing else in the diagram synthesis was adjusted to account for ports disregarding the left-to-right direction. That means reactions still have fixed port sides and a respective shape. Yes, it would be possible to extend the synthesis to support both directions for the LF elements but this will require a bigger rework because some elements would only be turned around due to the layout and not an explicit annotation, and hence require a post-processing outside the synthesis.