forsyde / forsyde-io

ForSyDe's System-Level intermediate representation and supporting libraries.
https://forsyde.github.io/forsyde-io/
MIT License
2 stars 2 forks source link

Probably incorrect kgt format for SDF applications #20

Closed BeethovenKodar closed 7 months ago

BeethovenKodar commented 7 months ago

Bold of me to make an issue this early into the project, but I think there might be an issue actually B)

This is the simple code snippet I use

SystemGraph sGraph = new SystemGraph();

SDFActorViewer a = SDFActor.enforce(sGraph, sGraph.newVertex("Actor A"));
a.consumption(Map.of("s_in", 2));
a.production(Map.of("s1", 2));
a.addPorts("s_in", "s1");
Visualizable.enforce(a);

SDFActorViewer b = SDFActor.enforce(sGraph, sGraph.newVertex("Actor B"));
b.consumption(Map.of("s1", 3));
b.production(Map.of("s_out", 1));
b.addPorts("s1", "s_out");
Visualizable.enforce(b);

SDFChannelViewer ab_chan = SDFChannel.enforce(sGraph, sGraph.newVertex("Channel A-B"));
ab_chan.numInitialTokens(0);
sGraph.connect(
    a, 
    ab_chan,
    EdgeTraits.SDFNetworkEdge, 
    EdgeTraits.VisualConnection
);
sGraph.connect(
    ab_chan,
    b, 
    EdgeTraits.SDFNetworkEdge, 
    EdgeTraits.VisualConnection
);
Visualizable.enforce(ab_chan);

return sGraph;

This produces the following .kgt file which gives syntax errors in VSCode:

1  knode forsyde {
2     klabel "ForSyDe Model"
3     knode v_Channel A-B {
4       klabel "Channel A-B [SDFChannel, MoCEntity]"
5       kedge (  -> v_Actor_B)
6     }
7     knode v_Actor B {
8       klabel "Actor B [SDFActor, MoCEntity]"
9     }
10   knode v_Actor A {
11     klabel "Actor A [SDFActor, MoCEntity]"
12     kedge (  -> v_Channel_A-B)
13   }
14 }

There are two things that I believe have to be corrected.

Rojods commented 7 months ago

Well, bold you actually found an actual bug! This will have to be connected in the bridge to KGT because the common model AKA System graphs do have full support for spaces etc. I come back to this issue once it is fixed.

Rojods commented 7 months ago

@BeethovenKodar could you try out the same file now with release 0.7.18?

BeethovenKodar commented 7 months ago

It works nicely with the new version. The vertex (KGT node) name changes from Actor A to Actor_space_A and the KGT file can be viewed normally :) You can surely close this issue!