lingua-franca icon indicating copy to clipboard operation
lingua-franca copied to clipboard

Ports on the north or south side are not rotated in the diagram

Open cmnrd opened this issue 1 year ago • 6 comments

The following program

target Python
reactor Src {
    physical action a
    @side("north")
    output out1
    @side("east")
    output out2
    reaction(a) -> out1, out2 {==}
}

produced this diagram: ReactorEBA

This looks a bit odd, as I would expect the ports to point up or down.

cmnrd avatar Aug 15 '23 08:08 cmnrd

For some reason I cannot assign @soerendomroes, so I am pinging ;)

cmnrd avatar Aug 15 '23 08:08 cmnrd

This should be the case since KLighD defines the port rendering to look this way for output ports, which does not seem to consider NORTH or SOUTH ports.

@a-sr Could you point to the part in the synthesis where this is handled?

soerendomroes avatar Aug 15 '23 08:08 soerendomroes

I also just noticed that the layout looks suboptimal in the following example. It would be nice to draw the two reactors centered on top of each other in this case.

target Python
        
reactor Src {
    @side("south")
    output out
}

reactor Sink {
    @side("north")
    input inp
}

main reactor {
    src = new Src()
    sink = new Sink()
    src.out -> sink.inp
}

Main

cmnrd avatar Aug 15 '23 08:08 cmnrd

Yes, it would but this is not possible if the layout direction is RIGHT.

What exactly do you want to achieve? Maybe you could do a quick sketch what you want LF programs to look like and I could suggest layout options to achieve the desired layout?

I find it rather unproductive to comment on every small change you make regarding NORTH and SOUTH ports. I would rather show you the different available options and their consequences in a short meeting.

soerendomroes avatar Aug 15 '23 08:08 soerendomroes

I am trying to reproduce this figure (ignore the blue dashed errors, they represent asynchronous communication outside the reactor model and would need to be edited in later). eba

Generally, I am working on some figures for my dissertation and opened an issue whenever I found something that didn't work as expected. The issues have accumulated a bit, and yes perhaps it's best we have a short meeting. I'll ping you on zulip.

cmnrd avatar Aug 15 '23 09:08 cmnrd

While north and south works with the layout, I did not implement the orientation for the port figure in those cases because I did not expect that it will be used. You can find the code here: https://github.com/lf-lang/lingua-franca/blob/master/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java#L1648

a-sr avatar Aug 15 '23 11:08 a-sr