#!/usr/bin/python3
# This file was automatically generated from drawio2cbd with the command:
#   C:\Users\randy\Documents\git\DrawioConvert\__main__.py -F CBD .\myCBD.drawio -e myCBD

from CBD.Core import *
from CBD.lib.std import *
from CBD.lib.endpoints import SignalCollectorBlock


class myCBD_old(CBD):
    def __init__(self, block_name):
        super().__init__(block_name, input_ports=[], output_ports=['OUT1'])

        # Create the Blocks
        self.addBlock(GenericBlock("sin", block_operator=("sin")))
        self.addBlock(GenericBlock("cos", block_operator=("cos")))
        self.addBlock(ConstantBlock("two", value=(2)))
        self.addBlock(ProductBlock("prod1"))
        self.addBlock(TimeBlock("time"))
        self.addBlock(ProductBlock("prod2"))
        self.addBlock(ConstantBlock("halve", value=(0.5)))
        self.addBlock(ProductBlock("prod3"))
        self.addBlock(SignalCollectorBlock("Op894edZgy93wgFImXR6-50"))

        # Create the Connections
        self.addConnection("time", "prod1", output_port_name='OUT1', input_port_name='IN2')
        self.addConnection("time", "prod2", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("two", "prod1", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("halve", "prod2", output_port_name='OUT1', input_port_name='IN2')
        self.addConnection("prod1", "cos", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("cos", "prod3", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("prod2", "prod3", output_port_name='OUT1', input_port_name='IN2')
        self.addConnection("prod3", "sin", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("sin", "Op894edZgy93wgFImXR6-50", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("sin", "OUT1", output_port_name='OUT1')


class myCBD(CBD):
    def __init__(self, block_name):
        super().__init__(block_name, input_ports=[], output_ports=['x'])

        # Create the Blocks
        self.addBlock(IntegratorBlock("int2"))
        self.addBlock(IntegratorBlock("int1"))
        self.addBlock(ConstantBlock("zero", value=(0)))
        self.addBlock(ConstantBlock("one", value=(1)))
        self.addBlock(NegatorBlock("UJFjKf67PxYEY0ecBBqN-19"))
        self.addBlock(ProductBlock("UJFjKf67PxYEY0ecBBqN-24"))
        self.addBlock(ConstantBlock("four", value=(4)))
        self.addBlock(SignalCollectorBlock("signal"))
        self.addBlock(GenericBlock("cos", block_operator=("cos")))

        # Create the Connections
        self.addConnection("zero", "int2", output_port_name='OUT1', input_port_name='IC')
        self.addConnection("one", "int1", output_port_name='OUT1', input_port_name='IC')
        self.addConnection("UJFjKf67PxYEY0ecBBqN-19", "int1", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("int1", "int2", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("int2", "x", output_port_name='OUT1')
        self.addConnection("int2", "UJFjKf67PxYEY0ecBBqN-24", output_port_name='OUT1', input_port_name='IN2')
        self.addConnection("int2", "UJFjKf67PxYEY0ecBBqN-19", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("four", "UJFjKf67PxYEY0ecBBqN-24", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("UJFjKf67PxYEY0ecBBqN-24", "cos", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("cos", "signal", output_port_name='OUT1', input_port_name='IN1')


