#!/usr/bin/python3
# This file was automatically generated from drawio2cbd with the command:
#   /home/red/git/DrawioConvert/__main__.py -F CBD -e Oscilator -E delta=0.1 -t 1000 Oscilator.drawio -f

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

DELTA_T = 0.1

class Oscilator(CBD):
    def __init__(self, block_name):
        CBD.__init__(self, block_name, input_ports=[], output_ports=['y'])

        # Create the Blocks
        self.addBlock(TimeBlock("time"))
        self.addBlock(GenericBlock("sin1", block_operator=("sin")))
        self.addBlock(GenericBlock("sin2", block_operator=("sin")))
        self.addBlock(GenericBlock("cos1", block_operator=("cos")))
        self.addBlock(GenericBlock("cos2", block_operator=("cos")))
        self.addBlock(ProductBlock("prod1"))
        self.addBlock(ProductBlock("prod2"))
        self.addBlock(AdderBlock("sum"))

        # Create the Connections
        self.addConnection("time", "cos1", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("time", "prod1", output_port_name='OUT1', input_port_name='IN2')
        self.addConnection("time", "sin1", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("time", "prod2", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("cos1", "prod1", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("prod1", "sin2", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("sin1", "prod2", output_port_name='OUT1', input_port_name='IN2')
        self.addConnection("prod2", "cos2", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("sin2", "sum", output_port_name='OUT1', input_port_name='IN1')
        self.addConnection("cos2", "sum", output_port_name='OUT1', input_port_name='IN2')
        self.addConnection("sum", "y", output_port_name='OUT1')


