-
Notifications
You must be signed in to change notification settings - Fork 0
/
LeaderEnvEnsemble.java
56 lines (45 loc) · 1.51 KB
/
LeaderEnvEnsemble.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package ACC;
import cz.cuni.mff.d3s.deeco.annotations.KnowledgeExchange;
import cz.cuni.mff.d3s.deeco.annotations.Membership;
import cz.cuni.mff.d3s.deeco.annotations.In;
import cz.cuni.mff.d3s.deeco.annotations.Out;
import cz.cuni.mff.d3s.deeco.annotations.PeriodicScheduling;
import cz.cuni.mff.d3s.deeco.ensemble.Ensemble;
import cz.cuni.mff.d3s.deeco.knowledge.OutWrapper;
public class LeaderEnvEnsemble extends Ensemble {
@Membership
public static boolean membership(
@In("coord.lGas") Double lGas,
@In("coord.lBrake") Double lBrake,
@In("coord.lPos") Double lPos,
@In("coord.lSpeed") Double lSpeed,
@In("coord.lCreationTime") Double lCreationTime,
@In("member.eLGas") Double eLGas,
@In("member.eLBrake") Double eLBrake,
@In("member.eLPos") Double eLPos,
@In("member.eLSpeed") Double eLSpeed,
@In("member.eLastTime") Double eLastTime
){
return true;
}
@KnowledgeExchange
@PeriodicScheduling(50)
public static void map(
@In("coord.lGas") Double lGas,
@In("coord.lBrake") Double lBrake,
@Out("coord.lPos") OutWrapper<Double> lPos,
@Out("coord.lSpeed") OutWrapper<Double> lSpeed,
@Out("coord.lCreationTime") OutWrapper<Double> lCreationTime,
@Out("member.eLGas") OutWrapper<Double> eLGas,
@Out("member.eLBrake") OutWrapper<Double> eLBrake,
@In("member.eLPos") Double eLPos,
@In("member.eLSpeed") Double eLSpeed,
@In("member.eLastTime") Double eLastTime
) {
eLGas.value = lGas;
eLBrake.value = lBrake;
lPos.value = eLPos;
lSpeed.value = eLSpeed;
lCreationTime.value = eLastTime;
}
}