-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSensor.fbt
72 lines (72 loc) · 4.35 KB
/
Sensor.fbt
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE FBType SYSTEM "http://www.holobloc.com/xml/LibraryElement.dtd">
<FBType Comment="Template for an empty basic function block" Name="Sensor">
<Identification Standard="61499-2"/>
<VersionInfo Author="Duc Do Tran" Date="2019-03-19" Organization="OFFIS e.V." Version="1.0"/>
<InterfaceList>
<EventInputs>
<Event Comment="" Name="Active" Type="Event">
<With Var="Direct"/>
<With Var="LimPos"/>
</Event>
<Event Comment="" Name="Request" Type="Event">
<With Var="Direct"/>
<With Var="LimPos"/>
<With Var="Position"/>
</Event>
<Event Comment="" Name="Reset" Type="Event"/>
</EventInputs>
<EventOutputs>
<Event Comment="" Name="Ready" Type="Event">
<With Var="OUT"/>
</Event>
<Event Comment="" Name="Response" Type="Event">
<With Var="OUT"/>
</Event>
</EventOutputs>
<InputVars>
<VarDeclaration Comment="" Name="Direct" Type="BOOL"/>
<VarDeclaration Comment="" InitialValue="180" Name="LimPos" Type="REAL"/>
<VarDeclaration Comment="" Name="Position" Type="REAL"/>
</InputVars>
<OutputVars>
<VarDeclaration Comment="" InitialValue="FALSE" Name="OUT" Type="BOOL"/>
</OutputVars>
</InterfaceList>
<BasicFB>
<InternalVars>
<VarDeclaration Comment="Internal Variable" InitialValue="" Name="trigger" Type="BOOL"/>
<VarDeclaration Comment="Internal Variable" InitialValue="0" Name="i" Type="USINT"/>
<VarDeclaration Comment="Internal Variable" InitialValue="" Name="change" Type="BOOL"/>
</InternalVars>
<ECC>
<ECState Comment="Initial State" Name="START" x="300.0" y="200.0"/>
<ECState Comment="" Name="State" x="3400.0" y="1100.0">
<ECAction Algorithm="ON_State" Output="Response"/>
</ECState>
<ECState Comment="" Name="State_2" x="3200.0" y="200.0">
<ECAction Algorithm="ALG"/>
</ECState>
<ECState Comment="" Name="INIT" x="1800.0" y="100.0">
<ECAction Algorithm="InitState" Output="Ready"/>
</ECState>
<ECState Comment="" Name="Wait4Req" x="1600.0" y="1300.0"/>
<ECTransition Comment="" Condition="[trigger=FALSE]" Destination="Wait4Req" Source="State_2" x="2700.0" y="980.0"/>
<ECTransition Comment="" Condition="[trigger=TRUE]" Destination="State" Source="State_2" x="3366.666666666667" y="840.0"/>
<ECTransition Comment="" Condition="Active" Destination="INIT" Source="START" x="920.0" y="213.33333333333334"/>
<ECTransition Comment="" Condition="Request" Destination="State_2" Source="Wait4Req" x="1960.0" y="466.6666666666667"/>
<ECTransition Comment="" Condition="1" Destination="Wait4Req" Source="State" x="2560.0" y="1366.6666666666667"/>
<ECTransition Comment="" Condition="Reset" Destination="START" Source="Wait4Req" x="1106.6666666666667" y="840.0"/>
<ECTransition Comment="" Condition="1" Destination="Wait4Req" Source="INIT" x="1653.3333333333335" y="560.0"/>
</ECC>
<Algorithm Comment="new algorithm" Name="ON_State">
<ST Text="OUT := TRUE; trigger := FALSE;"/>
</Algorithm>
<Algorithm Comment="new algorithm" Name="ALG">
<ST Text="IF (Direct = FALSE) THEN //Run to LS2 	IF (Position >= LimPos) THEN 		IF (change = FALSE) THEN 			change := TRUE; 			trigger := TRUE; 		END_IF; 	ELSE 		IF (change = TRUE) THEN 			change := FALSE; 			OUT := FALSE; 		END_IF; 		trigger := FALSE; 	END_IF; ELSE 	IF (Position <= LimPos) THEN 		IF (change = FALSE) THEN 			change := TRUE; 			trigger := TRUE; 		END_IF; 	ELSE 		IF (change = TRUE) THEN 			change := FALSE; 			OUT := FALSE; 		END_IF; 		trigger := FALSE; 	END_IF; END_IF;"/>
</Algorithm>
<Algorithm Comment="new algorithm" Name="InitState">
<ST Text="/*IF (Direct = TRUE) THEN 	OUT := FALSE; ELSE 	OUT :=TRUE; END_IF;*/ OUT := FALSE; trigger := FALSE; change := FALSE;"/>
</Algorithm>
</BasicFB>
</FBType>