towards automatic state machine reconstruction from
play

Towards automatic state machine reconstruction from legacy PLC using - PowerPoint PPT Presentation

Towards automatic state machine reconstruction from legacy PLC using data collection Daniil Chivilikhin, Sandeep Patil, Anthony Cordonnier, Valeriy Vyatkin IEEE INDIN 2019, Helsinki, Finland 24 July 2019 Goal Legacy PLC IEC 61131-3 (black


  1. Towards automatic state machine reconstruction from legacy PLC using data collection Daniil Chivilikhin, Sandeep Patil, Anthony Cordonnier, Valeriy Vyatkin IEEE INDIN 2019, Helsinki, Finland 24 July 2019

  2. Goal Legacy PLC IEC 61131-3 (black box) IEC 61499 state machine 2

  3. Contributions 1. Hardware and software architecture for collecting behavioral data from legacy PLCs in production 2. Algorithm based on translation to Boolean satisfiability problem (SAT) for reconstructing controller logic in the form of a state machine from data collected from PLC 3. Demonstration of the proposed solution on an example of a laboratory scale model of a distribution station 3

  4. Overview of the proposed approach 4

  5. Data collection

  6. Hardware architecture for data collection ● Black-box PLC ● Data collection PLC running IEC 61499 app ● Reconstructed PLC 6

  7. Example system: Festo distribution station 7

  8. Data preprocessing (1/4) Raw data: Input=[01000101001001] Output=[10000010] Input=[01000101001001] Output=[10000010] Input=[01000101001001] Output=[10000010] Input=[01000101001001] Output=[10000010] Input=[11000101001001] Output=[00000010] Input=[11000101001001] Output=[00000010] Input=[11000101001001] Output=[00000010] Input=[11000101001001] Output=[00000010] 8

  9. Data preprocessing (2/4) Raw data: Input=[01000101001001] Output=[10000010] Input=[01000101001001] Output=[10000010] Input=[01000101001001] Output=[10000010] Input=[01000101001001] Output=[10000010] Input=[11000101001001] Output=[00000010] Input=[11000101001001] Output=[00000010] Input=[11000101001001] Output=[00000010] Input=[11000101001001] Output=[00000010] 9

  10. Data preprocessing (3/4) Input=[01000101001001] Output=[10000010] Input=[01000101001001] Output=[10000010] Input=[01000101001001] Output=[10000010] Input=[01000101001001] Output=[10000010] Input=[11000101001001] Output=[00000010] Input=[11000101001001] Output=[00000010] Input=[11000101001001] Output=[00000010] Input=[11000101001001] Output=[00000010] 10

  11. Data preprocessing (4/4) Input=[01000101001001] Output=[10000010] Input=[01000101001001] Output=[10000010] Input=[01000101001001] Output=[10000010] <REQ[01000101001001], CNF[10000010]>; <REQ[11000101001001], CNF[00000010]> Input=[11000101001001] Output=[00000010] Input=[11000101001001] Output=[00000010] Input=[11000101001001] Output=[00000010] 11

  12. Basic function block model Boolean input/output vars 12

  13. State machine reconstruction

  14. Background • Minimum deterministic finite automaton construction from labeled data is NP-complete [Gold, 1978] T + ={ab, b, ba, bbb} T ₋ ={abbb, baba} Heuristics, Metaheuristic, SAT-based e.g. state e.g. genetic merging, k-tails algorithms 14

  15. SAT-based state machine synthesis (1/3) Propositional Solution encoding reconstruction SAT-solver Data Solution ● Heule et al. Exact DFA Identification Using SAT Solvers [ICGI’10] ● ... ● Ulyantsev et al. Exact finite-state machine identification from scenarios and temporal properties [STTT’18] ● Chivilikhin et al. Function block finite-state model identification using SAT and CSP solvers [TII’19] 15 https://srlabs.de/bites/minisat-intro/

  16. SAT-based state machine synthesis (2/3) T + ={ab, b, ba, bbb} T ₋ ={abbb, baba} 16

  17. SAT-based state machine synthesis (3/3) Translation function f Traces T 〈 ... 〉 , ... , 〈 ... 〉 Values of Automaton 〈 ... 〉 , ... , 〈 ... 〉 variables Trace tree 〈 ... 〉 , ... , 〈 ... 〉 𝕎 Boolean SAT construction formula solver No Number of solution states N (UNSAT) N := N + 1 17

  18. Example i 2 i 3 i 4 i 1 o 0 o 1 o 1 o 2 o 2 i 2 i 2 i 1 i 3 o 0 o 1 o 1 o 2 o 2 18

  19. Example i 2 i 3 i 4 i 1 o 0 o 1 o 1 o 2 o 2 i 2 i 2 i 1 i 3 o 0 o 1 o 1 o 2 o 2 19

  20. Example i 2 i 3 i 4 i 1 o 0 o 1 o 1 o 2 o 2 i 2 i 2 i 1 i 3 o 1 o 1 o 2 o 2 20

  21. Example i 2 i 3 i 4 i 1 o 0 o 1 o 1 o 2 o 2 i 2 i 2 i 1 i 3 o 1 o 1 o 2 o 2 21

  22. Example i 2 i 3 i 4 i 1 o 0 o 1 o 1 o 2 o 2 i 2 i 2 i 3 o 1 o 2 o 2 22

  23. Example i 2 i 3 i 4 i 1 o 0 o 1 o 1 o 2 o 2 i 2 i 2 i 3 o 1 o 2 o 2 23

  24. Example i 2 i 3 i 4 i 1 o 0 o 1 o 1 o 2 o 2 i 2 i 3 o 2 o 2 24

  25. Example i 2 i 3 i 4 i 1 o 0 o 1 o 1 o 2 o 2 i 2 i 3 o 2 o 2 25

  26. Example i 2 i 3 i 4 i 1 o 0 o 1 o 1 o 2 o 2 i 2 i 3 o 2 o 2 i 2 i 2 i 1 o 0 o 1 o 1 o 4 26

  27. Example: fail! i 2 i 3 i 4 i 1 o 0 o 1 o 1 o 2 o 2 i 2 i 3 o 2 o 2 i 2 o 4 Difference in scan cycles of PLCs leads to inconsistent traces! 27

  28. Challenges & approach Challenges 1. Traces contain errors due to trace collection procedure 2. We do not know the ground truth Approach 1. Account for errors in the SAT reduction 2. Enumerate all possible solutions 28

  29. Trace tree → Trace graph 29

  30. Error model for trace graph Add multi-edges on the interface between different outputs ● Simple model, richer models are possible ○ Up to fully connected graph in the worst case 30

  31. Constraints... 31

  32. Color graph nodes in N colors = map graph nodes to automaton states 32

  33. Only one of the multi-edges may be used for each pair of nodes i 2 i 4 i 1 o 1 o 1 o 2 o 2 i 3 33

  34. Find all solutions with different alternative edge choices 34

  35. Find all solutions with different alternative edge choices Still, exponential number of solutions! 35

  36. Coping with exponential number of solutions ● Zakirzyanov et al. Efficient Symmetry Breaking for SAT-Based Minimum DFA Inference [LATA’19] ● Minimize parameters of state machine ○ N – number of states ○ K – outgoing degree of states ○ R – number of transitions 36

  37. Algorithm 37

  38. Experiment with distribution station • 12 inputs, 8 outputs • Six logs for different use cases with varying complexity and length of runs • Algorithm found 63 different state machines that satisfy the traces with respect to the error model • Launch simulation of use cases in NxtStudio • Only one (!) state machine was truly correct 38

  39. Generated state machine 39

  40. Conclusion & Future work • Developed hardware and software architecture for data collection from PLC • Developed algorithm for reconstructing state machine from (noisy) PLC traces Future work • Improve synthesis algorithm • Automate validation against legacy system (model) • Improve data collection, add time synchronization • Target distributed controller reconstruction • Move data storage and synthesis to the cloud 40

  41. Thank you! Daniil Chivilikhin, chivdan@itmo.ru

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend