scy-phy / minicps

MiniCPS: a framework for Cyber-Physical Systems real-time simulation, built on top of mininet
MIT License
166 stars 70 forks source link

plc1.py cannot reach the check for 'LL' in swat-s1 example #4

Closed vikram-gaur closed 7 years ago

vikram-gaur commented 7 years ago

In the file minicps/examples/swat-s1/plc1.c:

        elif lit101 <= LIT_101_M['L']:
            # OPEN mv101
            print "INFO PLC1 - lit101 under L -> open mv101."
            self.set(MV101, 1)
            self.send(MV101, 1, PLC1_ADDR)
        elif lit101 <= LIT_101_M['LL']:
            print "WARNING PLC1 - lit101 under LL: %.2f <= %.2f." % (
                lit101, LIT_101_M['LL'])

The last elif condition can never be reached since if second condition in this snippet is true then the first condition is also true.

francozappa commented 7 years ago

Hi @vikram-gaur ,

Thanks for spotting this bug.

Can you please open a PR with the two elif swapped?

francozappa commented 7 years ago

Fixed by #5