ComputerBlock.py 406 B

1234567891011121314151617181920
  1. from CBD.src.CBD import BaseBlock
  2. class ComputerBlock(BaseBlock):
  3. def __init__(self, block_name):
  4. super().__init__(block_name, ["IN1"], ["OUT1"])
  5. def compute(self, curIteration):
  6. time = self.getInputSignal(curIteration, "IN1").value
  7. if time < 10:
  8. res = 0
  9. elif time < 160:
  10. res = 10
  11. elif time < 200:
  12. res = 4
  13. elif time < 260:
  14. res = 14
  15. else:
  16. res = 6
  17. self.appendToSignal(res)