Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"join" and "size-window" #110

Open
omidkhodatars opened this issue Jun 15, 2016 · 3 comments
Open

"join" and "size-window" #110

omidkhodatars opened this issue Jun 15, 2016 · 3 comments

Comments

@omidkhodatars
Copy link

omidkhodatars commented Jun 15, 2016

I tried to combine the two feature "join" and "size-window" but it failed .
the code can be compiled with the previous version of thingml but the result is not correct

(** The new version still not working properly ver ThingML 0.7.0.201606071315 org.thingml.eclipse.feature.feature.group SINTEF-9012)

import "datatype.thingml"   
thing HighTemperatureDetection {
    // auto-generated message definition
    message joinCEP (temp : float, pressure : float);
    message temperatureSensor (id : integer, temp : float);
    message temperatureSensorCEP (id : integer, temp : float, msg : string);
    message PressureSensor (id : integer, pressure : float);
    //auto-generated port definition

    internal port eventPort {
    sends  joinCEP, temperatureSensor, temperatureSensorCEP, PressureSensor

    receives  joinCEP, temperatureSensor, temperatureSensorCEP, PressureSensor
    }
    //find stream query
    stream joinStream @TTL "250"
    from res : [ t : eventPort?temperatureSensor ::buffer 1 by 1 
     & p : eventPort?PressureSensor ::buffer 1 by 1 
     -> joinCEP (t.temp, p.pressure) ] 
    select  var ntemp:float = res.temp, var npressure:float = res.pressure
    produce eventPort!joinCEP(ntemp, npressure)
    //auto-generated statechart-------------------------------
    statechart CEPstatechart init Base {      
        state Base {
              on entry do
              //input events simulation 
              eventPort!temperatureSensor(10 , 51)
              eventPort!PressureSensor(10 , 51)
              eventPort!temperatureSensor(11 , 52)
              eventPort!PressureSensor(10 , 52)
              eventPort!temperatureSensor(12 , 15)
              eventPort!PressureSensor(10 , 15)
              eventPort!temperatureSensor(13 , 53)
              eventPort!PressureSensor(10 , 53) 
              end

              internal event jcep: eventPort?joinCEP
                action do
                print 
                "generated join- temp :"+jcep.temp+", pressure : "+jcep.pressure  + "\n "

                end                     
        }   
    }


} // End of thing
//auto-generated configuration 
configuration HighTemperatureDetectionCfg 
    {   
    instance my_instance: HighTemperatureDetection
    //connector my_instance.receivePort => my_instance.sendPort 
    }
@skorsky
Copy link

skorsky commented Jun 16, 2016

@brice-morin this does also not compile correctly when we omit the 'by 1' for both input streams.

@brice-morin
Copy link
Member

Hi,
I am not entirely sure we support buffers and windows within join and merge.
@AlexandreRio ?

@AlexandreRio
Copy link
Contributor

Hi,
What compiler are you using? For arduino maybe you should put the size-window on the join and not on the inputs, i.e:

from res : [ t : eventPort?temperatureSensor
 & p : eventPort?PressureSensor
 -> joinCEP (t.temp, p.pressure) ]::buffer 1 by 1

This should actually to the same thing.

The grammar authorizes lots of combinations, we maintain a list of tested ones here:

https://github.com/SINTEF-9012/ThingML/tree/master/testJar/src/main/resources/tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants