|
@@ -1,13 +1,55 @@
|
|
import logging
|
|
import logging
|
|
|
|
+import random
|
|
|
|
+from datetime import datetime
|
|
from inputs.common import Input as Inp
|
|
from inputs.common import Input as Inp
|
|
|
|
|
|
|
|
+from structures.measurement import Measurement24v, Measurement480v
|
|
|
|
+from structures.plant import S7State, CompactLogixState
|
|
|
|
+
|
|
logger = logging.getLogger(__name__)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
+def f():
|
|
|
|
+ return random.random()
|
|
|
|
+
|
|
|
|
+def b():
|
|
|
|
+ return random.choice([True, False])
|
|
|
|
+
|
|
|
|
+def i(count=100):
|
|
|
|
+ return random.randint(0, count-1)
|
|
|
|
+
|
|
class Input(Inp):
|
|
class Input(Inp):
|
|
def __init__(self, message) -> None:
|
|
def __init__(self, message) -> None:
|
|
super().__init__(self.read_handler)
|
|
super().__init__(self.read_handler)
|
|
logger.debug(message)
|
|
logger.debug(message)
|
|
- self.interval = 1
|
|
|
|
|
|
+ self.interval = 0.01
|
|
|
|
|
|
def read_handler(self):
|
|
def read_handler(self):
|
|
- pass
|
|
|
|
|
|
+ self._q.put(Measurement24v(
|
|
|
|
+ datetime.now(),
|
|
|
|
+ "dummy",
|
|
|
|
+ (f(), f(), f(), f(), f(), f(), f(), f(), f(), f(), f(), f(), f(), f(), f(), f()),
|
|
|
|
+ (b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b()),
|
|
|
|
+ (b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b()),
|
|
|
|
+ (b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b()),
|
|
|
|
+ (b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b()),
|
|
|
|
+ (b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b(), b()),
|
|
|
|
+ f() + 23.5
|
|
|
|
+ ))
|
|
|
|
+ self._q.put(Measurement480v(
|
|
|
|
+ datetime.now(),
|
|
|
|
+ "dummy",
|
|
|
|
+ (f()+230, f()+230, f()+230),
|
|
|
|
+ (f(), f(), f()),
|
|
|
|
+ (i(360), i(360), i(360))
|
|
|
|
+ ))
|
|
|
|
+ self._q.put(CompactLogixState(
|
|
|
|
+ datetime.now(),
|
|
|
|
+ "dummy",
|
|
|
|
+ i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2),
|
|
|
|
+ i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2),
|
|
|
|
+ i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2),
|
|
|
|
+ i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2),
|
|
|
|
+ i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2),
|
|
|
|
+ i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2), i(2),
|
|
|
|
+ i(2), i(2)
|
|
|
|
+ ))
|