Dynamic reconfiguration [message #1842120] |
Wed, 09 June 2021 11:44  |
Eclipse User |
|
|
|
I am trying to manipulate a running programme via dynamic reconfiguration. I am using the following setup:
Linux VM (Debian)
forte
Blinky program (as fboot file)
Here is the fboot file:
1 ;<Request ID="1" Action="CREATE"><FB Name="EMB_RES" Type="EMB_RES" /></Request>
2 EMB_RES;<Request ID="2" Action="CREATE"><FB Name="E_CYCLE" Type="E_CYCLE" /></Request>
3 EMB_RES;<Request ID="3" Action="WRITE"><Connection Source="T#1s" Destination="E_CYCLE.DT" /></Request>
4 EMB_RES;<Request ID="4" Action="CREATE"><FB Name="E_SWITCH" Type="E_SWITCH" /></Request>
5 EMB_RES;<Request ID="5" Action="CREATE"><FB Name="OUT_ANY_CONSOLE" Type="OUT_ANY_CONSOLE" /></Request>
6 EMB_RES;<Request ID="6" Action="WRITE"><Connection Source="TRUE" Destination="OUT_ANY_CONSOLE.QI" /></Request>
7 EMB_RES;<Request ID="7" Action="WRITE"><Connection Source="BlinkyState" Destination="OUT_ANY_CONSOLE.LABEL" /></Request>
8 EMB_RES;<Request ID="8" Action="CREATE"><FB Name="E_RESTART" Type="E_RESTART" /></Request>
9 EMB_RES;<Request ID="9" Action="CREATE"><FB Name="E_SR" Type="E_SR" /></Request>
10 EMB_RES;<Request ID="10" Action="CREATE"><Connection Source="E_CYCLE.EO" Destination="E_SWITCH.EI" /></Request>
11 EMB_RES;<Request ID="11" Action="CREATE"><Connection Source="E_RESTART.COLD" Destination="E_CYCLE.START" /></Request>
12 EMB_RES;<Request ID="12" Action="CREATE"><Connection Source="E_RESTART.WARM" Destination="E_CYCLE.START" /></Request>
13 EMB_RES;<Request ID="13" Action="CREATE"><Connection Source="E_SWITCH.EO0" Destination="E_SR.S" /></Request>
14 EMB_RES;<Request ID="14" Action="CREATE"><Connection Source="E_SWITCH.EO1" Destination="E_SR.R" /></Request>
15 EMB_RES;<Request ID="15" Action="CREATE"><Connection Source="E_SR.EO" Destination="OUT_ANY_CONSOLE.REQ" /></Request>
16 EMB_RES;<Request ID="16" Action="CREATE"><Connection Source="E_SR.Q" Destination="E_SWITCH.G" /></Request>
17 EMB_RES;<Request ID="17" Action="CREATE"><Connection Source="E_SR.Q" Destination="OUT_ANY_CONSOLE.IN" /></Request>
18 EMB_RES;<Request ID="18" Action="START"/>
In line 3 you can see the interval at which "blinking" takes place (1 second).
Blinky has been extended by a console output function block (lines 6 and 7).
Output of the running programme:
INFO: T#95533468618104: 'BlinkyState' = TRUE
INFO: T#95534467256892: 'BlinkyState' = FALSE
INFO: T#95535467614421: 'BlinkyState' = TRUE
INFO: T#95536468628995: 'BlinkyState' = FALSE
INFO: T#95537468852740: 'BlinkyState' = TRUE
INFO: T#95538467402065: 'BlinkyState' = FALSE
(Note: it can be observed that the output is every second, as the interval was set in line 3).
Now I would like to adjust the value of the interval while the programme is running. In the following I describe my approach to this.
To find out what data is sent to the forte I used Wireshark to analyse the packets. I was able to find one packet where the value of the interval was set. Here is a screenshot from Wireshark:
0000 00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00 ..............E.
0010 00 9f 08 48 40 00 40 06 34 0f 7f 00 00 01 7f 00 ...H@.@.4.......
0020 00 01 9b 1e f0 3b 88 c1 8b 85 3c 22 6e 4e 80 18 ....ð;.Á..<"nN..
0030 01 56 fe 93 00 00 01 01 08 0a 01 5a 30 d4 01 5a .Vþ........Z0Ô.Z
0040 30 d4 50 00 07 45 4d 42 5f 52 45 53 50 00 5e 3c 0ÔP..EMB_RESP.^<
0050 52 65 71 75 65 73 74 20 49 44 3d 22 33 22 20 41 Request ID="3" A
0060 63 74 69 6f 6e 3d 22 57 52 49 54 45 22 3e 3c 43 ction="WRITE"><C
0070 6f 6e 6e 65 63 74 69 6f 6e 20 53 6f 75 72 63 65 onnection Source
0080 3d 22 54 23 31 73 22 20 44 65 73 74 69 6e 61 74 ="T#1s" Destinat
0090 69 6f 6e 3d 22 45 5f 43 59 43 4c 45 2e 44 54 22 ion="E_CYCLE.DT"
00a0 20 2f 3e 3c 2f 52 65 71 75 65 73 74 3e /></Request>
Now I tried to construct and send a similar packet. Based on the content from line 3 of the fboot file, I created a file with the following line:
EMB_RES;<Request ID="6" Action="WRITE"><Connection Source="T#5s" Destination="E_CYCLE.DT" /></Request>
(Note: my intention was to change the interval during runtime (5 seconds) and notice in the console output the corresponding delay).
Afterwards, I tried to send the content of the file (file.txt) to forte using the netcat application as an example:
netcat 127.0.0.1 61499 < file.txt
The connection to forte was established and the package was sent. Here is a screenshot of the console output of forte:
INFO: T#97058467935723: 'BlinkyState' = FALSE
INFO: T#97059467414453: 'BlinkyState' = TRUE
INFO: T#97059963716554: Connection established by client
INFO: T#97060467619018: 'BlinkyState' = FALSE
INFO: T#97061468027540: 'BlinkyState' = TRUE
INFO: T#97062467584270: 'BlinkyState' = FALSE
INFO: T#97063468171550: 'BlinkyState' = TRUE
INFO: T#97064469073946: 'BlinkyState' = FALSE
INFO: T#97064832750810: Connection closed by peer
INFO: T#97065468106067: 'BlinkyState' = TRUE
INFO: T#97066468283404: 'BlinkyState' = FALSE
INFO: T#97067468291003: 'BlinkyState' = TRUE
Unfortunately, this did not show the desired effect on the interval.
What am I doing wrong?
How can I change a forte application at runtime?
How to send data to a running forte application?
Is there a working example?
Best Regards, Stefan
|
|
|
|
Re: Dynamic reconfiguration [message #1842638 is a reply to message #1842120] |
Fri, 25 June 2021 21:20  |
Eclipse User |
|
|
|
Stefan Wellnitz wrote on Wed, 09 June 2021 15:44I am trying to manipulate a running programme via dynamic reconfiguration. I am using the following setup:
Linux VM (Debian)
forte
Blinky program (as fboot file)
Here is the fboot file:
1 ;<Request ID="1" Action="CREATE"><FB Name="EMB_RES" Type="EMB_RES" /></Request>
2 EMB_RES;<Request ID="2" Action="CREATE"><FB Name="E_CYCLE" Type="E_CYCLE" /></Request>
3 EMB_RES;<Request ID="3" Action="WRITE"><Connection Source="T#1s" Destination="E_CYCLE.DT" /></Request>
4 EMB_RES;<Request ID="4" Action="CREATE"><FB Name="E_SWITCH" Type="E_SWITCH" /></Request>
5 EMB_RES;<Request ID="5" Action="CREATE"><FB Name="OUT_ANY_CONSOLE" Type="OUT_ANY_CONSOLE" /></Request>
6 EMB_RES;<Request ID="6" Action="WRITE"><Connection Source="TRUE" Destination="OUT_ANY_CONSOLE.QI" /></Request>
7 EMB_RES;<Request ID="7" Action="WRITE"><Connection Source="BlinkyState" Destination="OUT_ANY_CONSOLE.LABEL" /></Request>
8 EMB_RES;<Request ID="8" Action="CREATE"><FB Name="E_RESTART" Type="E_RESTART" /></Request>
9 EMB_RES;<Request ID="9" Action="CREATE"><FB Name="E_SR" Type="E_SR" /></Request>
10 EMB_RES;<Request ID="10" Action="CREATE"><Connection Source="E_CYCLE.EO" Destination="E_SWITCH.EI" /></Request>
11 EMB_RES;<Request ID="11" Action="CREATE"><Connection Source="E_RESTART.COLD" Destination="E_CYCLE.START" /></Request>
12 EMB_RES;<Request ID="12" Action="CREATE"><Connection Source="E_RESTART.WARM" Destination="E_CYCLE.START" /></Request>
13 EMB_RES;<Request ID="13" Action="CREATE"><Connection Source="E_SWITCH.EO0" Destination="E_SR.S" /></Request>
14 EMB_RES;<Request ID="14" Action="CREATE"><Connection Source="E_SWITCH.EO1" Destination="E_SR.R" /></Request>
15 EMB_RES;<Request ID="15" Action="CREATE"><Connection Source="E_SR.EO" Destination="OUT_ANY_CONSOLE.REQ" /></Request>
16 EMB_RES;<Request ID="16" Action="CREATE"><Connection Source="E_SR.Q" Destination="E_SWITCH.G" /></Request>
17 EMB_RES;<Request ID="17" Action="CREATE"><Connection Source="E_SR.Q" Destination="OUT_ANY_CONSOLE.IN" /></Request>
18 EMB_RES;<Request ID="18" Action="START"/>
In line 3 you can see the interval at which "blinking" takes place (1 second).
Blinky has been extended by a console output function block (lines 6 and 7).
Output of the running programme:
INFO: T#95533468618104: 'BlinkyState' = TRUE
INFO: T#95534467256892: 'BlinkyState' = FALSE
INFO: T#95535467614421: 'BlinkyState' = TRUE
INFO: T#95536468628995: 'BlinkyState' = FALSE
INFO: T#95537468852740: 'BlinkyState' = TRUE
INFO: T#95538467402065: 'BlinkyState' = FALSE
(Note: it can be observed that the output is every second, as the interval was set in line 3).
Now I would like to adjust the value of the interval while the programme is running. In the following I describe my approach to this.
To find out what data is sent to the forte I used Wireshark to analyse the packets. I was able to find one packet where the value of the interval was set. Here is a screenshot from Wireshark:
0000 00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00 ..............E.
0010 00 9f 08 48 40 00 40 06 34 0f 7f 00 00 01 7f 00 ...H@.@.4.......
0020 00 01 9b 1e f0 3b 88 c1 8b 85 3c 22 6e 4e 80 18 ....ð;.Á..<"nN..
0030 01 56 fe 93 00 00 01 01 08 0a 01 5a 30 d4 01 5a .Vþ........Z0Ô.Z
0040 30 d4 50 00 07 45 4d 42 5f 52 45 53 50 00 5e 3c 0ÔP..EMB_RESP.^<
0050 52 65 71 75 65 73 74 20 49 44 3d 22 33 22 20 41 Request ID="3" A
0060 63 74 69 6f 6e 3d 22 57 52 49 54 45 22 3e 3c 43 ction="WRITE"><C
0070 6f 6e 6e 65 63 74 69 6f 6e 20 53 6f 75 72 63 65 onnection Source
0080 3d 22 54 23 31 73 22 20 44 65 73 74 69 6e 61 74 ="T#1s" Destinat
0090 69 6f 6e 3d 22 45 5f 43 59 43 4c 45 2e 44 54 22 ion="E_CYCLE.DT"
00a0 20 2f 3e 3c 2f 52 65 71 75 65 73 74 3e /></Request>
Now I tried to construct and send a similar packet. Based on the content from line 3 of the fboot file, I created a file with the following line:
EMB_RES;<Request ID="6" Action="WRITE"><Connection Source="T#5s" Destination="E_CYCLE.DT" /></Request>
(Note: my intention was to change the interval during runtime (5 seconds) and notice in the console output the corresponding delay).
Afterwards, I tried to send the content of the file (file.txt) to forte using the netcat application as an example:
netcat 127.0.0.1 61499 < file.txt
The connection to forte was established and the package was sent. Here is a screenshot of the console output of forte:
INFO: T#97058467935723: 'BlinkyState' = FALSE
INFO: T#97059467414453: 'BlinkyState' = TRUE
INFO: T#97059963716554: Connection established by client
INFO: T#97060467619018: 'BlinkyState' = FALSE
INFO: T#97061468027540: 'BlinkyState' = TRUE
INFO: T#97062467584270: 'BlinkyState' = FALSE
INFO: T#97063468171550: 'BlinkyState' = TRUE
INFO: T#97064469073946: 'BlinkyState' = FALSE
INFO: T#97064832750810: Connection closed by peer
INFO: T#97065468106067: 'BlinkyState' = TRUE
INFO: T#97066468283404: 'BlinkyState' = FALSE
INFO: T#97067468291003: 'BlinkyState' = TRUE
Unfortunately, this did not show the desired effect on the interval.
What am I doing wrong?
How can I change a forte application at runtime?
How to send data to a running forte application?
Is there a working example?
Best Regards, Stefan
Haven't tried all your steps. According to my experience, you need to re init the e_clcok to get the new interval work. Have you done that? Also, I attached a video demo to show the dynamic change of the fbn.
|
|
|
Powered by
FUDForum. Page generated in 0.49515 seconds