Critical-Infrastructure-Systems-Lab / DHALSIM

Digital Twin for Water Distribution Systems. A work by the SUTD Critical Infrastructure Systems Lab, TU Delft, CISPA, and iTrust
MIT License
46 stars 22 forks source link

Issues running the provided examples #51

Open JeroenLam opened 4 weeks ago

JeroenLam commented 4 weeks ago

Hi, I have tried to run DHALSIM for 3 of the provided examples (WADI, Anytown and Ky3) and I have run into problem with the WNTR simulation not converging after 2999 iterations or with issues by requesting dynamic properties from an unsolved network.

Question

Why is this the case? Are the examples incorrect or do you think there is a problem with my installation?

Installation and machine configuration

I used the provided ./install.sh script and installed DHALSIM and its dependencies on a VM running Ubuntu 20.04.1. The VM has 2 cores and 4GB of RAM.

Changes to the default configuration

The only changes I made to the default config files was enabling debug logging.

Running DHALSIM

Run using sudo dhalsim <config_name>.yaml inside the examples folder.

WADI

Simulation never converges.

Pasted image 20240812082531

Ky3

Simulation stops converging at iteration 89. (I did 2 runs on separate days and both times this occurred at iteration 89. Pasted image 20240814084445

Anytown

Problem with requesting dynamic properties from an unsolved network. Pasted image 20240812082745

afmurillo commented 4 weeks ago

Hello,

Thank you for your question,

I don't think there is an issue with your installation. Did you install on Ubuntu 20.04?. We mostly use C-Town for all our experiments, so probably something broke up after an update. Could you try running a small experiment on C-Town? Say, 288 iterations (one day with a timestep of 300 seconds).

JeroenLam commented 4 weeks ago

Thank you for the quick response, If I run the ctown example with 288 iterations I still get the following errors:

...
*** Cleanup complete.
tcpdump: listening on plc3attac-eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
/usr/local/lib/python3.8/dist-packages/epynet/baseobject.py:63: UserWarning: requesting dynamic properties from an unsolved network
  warnings.warn("requesting dynamic properties from an unsolved network")
 [Elapsed Time: 0:00:00 - 0 of 288] |                       | [ETA:  --:--:--]
/usr/local/lib/python3.8/dist-packages/epynet/baseobject.py:63: UserWarning: requesting dynamic properties from an unsolved network
  warnings.warn("requesting dynamic properties from an unsolved network")
 [Elapsed Time: 0:00:24 - 1 of 288] |                       | [ETA:   1:56:03]
/usr/local/lib/python3.8/dist-packages/epynet/baseobject.py:63: UserWarning: requesting dynamic properties from an unsolved network
  warnings.warn("requesting dynamic properties from an unsolved network")
 [Elapsed Time: 0:01:05 - 2 of 288] |                       | [ETA:   2:36:02]
/usr/local/lib/python3.8/dist-packages/epynet/baseobject.py:63: UserWarning: requesting dynamic properties from an unsolved network
  warnings.warn("requesting dynamic properties from an unsolved network")
 [Elapsed Time: 0:01:44 - 3 of 288] |                       | [ETA:   2:45:14]
/usr/local/lib/python3.8/dist-packages/epynet/baseobject.py:63: UserWarning: requesting dynamic properties from an unsolved network
  warnings.warn("requesting dynamic properties from an unsolved network")
 [Elapsed Time: 0:02:17 - 4 of 288] |                       | [ETA:   2:42:42]

If I change the log_level to debug I can also see a lot of Python Exceptions being thrown: image These exceptions are not visible in the normal info loggin_level.

Below I have also added the config file for completeness.

inp_file: ctown_map.inp
#iterations: 2880
iterations: 288
#iterations: 70
network_topology_type: complex
plcs: !include ctown_plcs.yaml

log_level: debug
simulator: epynet
demand: pdd
attacks: !include ctown_unconstrained_blackbox_concealment_mitm.yaml
#attacks: !include ctown_concealment_mitm_value.yaml
#attacks: !include ctown_payload_replay_conceal.yaml
#ma attacks: !include ctown_network_replay_conceal.yaml

Below is the output of uname -a:

Linux VDesktop 5.15.0-117-generic #127~20.04.1-Ubuntu SMP Thu Jul 11 15:36:12 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
afmurillo commented 4 weeks ago

Hello,

Thank you for runningthe example, did the simulartion finished executing? Those errors are printed when one of the PLC/SCADA are unable to receive one message, but the emulation and the commuication keeps going, this is just a message showing you that there was a connection error and the node will retry to get it, you can check this behaviour in: https://github.com/Critical-Infrastructure-Systems-Lab/DHALSIM/blob/master/dhalsim/python2/generic_plc.py Line 277.

If the simulation finished, then probably there is an issue with the other examples and DHALSIM code, I could try finding sometime in the coming weeks to launch experiments with those topologies and check what might be the issue.

JeroenLam commented 3 weeks ago

Hey,

After running ctown for 288 iterations it seems to have completed successfully. At this time I have only looked at the ground_truth values and te SCADA pcap, which seem promising. Soon I will try running the full 2880 iterations.

Thank you for your help.

I also had a second question. Have you seen the work done in IPAL and have you considered extending the CIP support of their transcriber to also (officially) support DHALSIM?

afmurillo commented 2 weeks ago

Hello,

Thank you for your response. I will try to book some time in the coming weeks to check any issues with the other example topologies. Thanks for the information regarding IPAL and their transcriber, I have not looked into them. Since July 2023 I am no longer working with the lab that developed DHALSIM, but I try to still provide support in my free time whenever I can. It might be worth pinging the team at https://github.com/scy-phy (The original developers of MiniCPS) as they might have some interest in extending/upgrading MiniCPS with a more reliable library for CIP.