HEADS-project / training

Training material to get started with the HEADS technologies
10 stars 16 forks source link

A Question about CEP example(heating control system) in the github #96

Closed FeltonXuAtECNU closed 8 years ago

FeltonXuAtECNU commented 8 years ago

Dear sir/madam,

In the presencePersonDector.thingml you offered as a "big" example to model the behavior of heat control system, you use the function like this:

function complexAlgo(temp : Integer, humidity: Integer, light: Integer) : Boolean do return temp == humidity and humidity == light end

That doesn't make much sense to me here, because of the fact you can't directly compare between temp and humidity or humidity and light. Could you give a detail explanation on that?

Also, I'm confused by the form like this a & b -> c, so does it mean the same thing as in classical logic? Thing likes: (also contains filter here) stream personPresenseDetector do from person : [ joinTH: rcvPort?cepJTH & light : rcvPort?light -> cepPersonIsPresent(complexAlgo(joinTH.temp,joinTH.humi,light.value)) ]::filter(filterPersonPresence(person)) select isPresent: person.v action sendPort!cepPersonIsPresent(isPresent) end

Basically, they're too difficult for me to understand what the semantic(or scenario you are modelling) behind that example? For me, I think it's filter value is evaluated to true and both message are received, then it will send a message of which the value is computed by complexAlgo.

I'm looking forward to someone's reply and thanks a lot in advance!

brice-morin commented 8 years ago

As for the first comment, you are of course free to adapt the examples to what makes sense to you (I agree it looked a bit strange...)

As for second comment, it is not directly classical/boolean logic, but somewhat similar. We use & for join (basically mean we should have a and b "at the same time" to produce c. We use | for the merge (basically mean we should have either a or b to produce c. So it is not exactly boolean logic, but maps pretty well to a and and a or, hence the notation.

For more information on what a join,merge`, etc is, please read the ReactiveX documentation

brice-morin commented 8 years ago

Also I would suggest you to go through the tutorial on CEP before going into this more complex example

FeltonXuAtECNU commented 8 years ago

I thought that's a real heating control system that could actually run on real environment. Could you adapt the examples for me to make more sense?

ffleurey commented 8 years ago

Let us know what logic (or CEP querry) you would like to see in an example and we can help you figure out how to do it. We have not implemented any real heating control system with ThingML so far. The example you refer to is just there to show how CEP queries are written, it does not do anything useful.

FeltonXuAtECNU commented 8 years ago

I'd like to see some improvement on that heating control system and turn the example into kinda real application that has the basic behavior to some degree. I mean the heating sensor and some other controller should show the OUTLINE of a process which could decide whether the windows should be open.

FeltonXuAtECNU commented 8 years ago

Is that possible to modify the existing one and also satisfy the basic requirement I mentioned above? I'd appreciate it if you could help me do that.

brice-morin commented 8 years ago

Really, this example is just artificial and is only there to show some of the CEP concepts, it is in no way a proper heating system. We can support you with any ThingML-related questions/issues, but are in no way expert in control theory and heating systems.

ffleurey commented 8 years ago

@FeltonXuAtECNU if you provide a description in English, pseudo-code or in another language of the example system you are trying to implement we can help you translate it to ThingML (using CEP or not depending on if it is needed).