def main(): ''' Description of the run file. ''' # Parameters time_step = 0.1 ir_7040 = Cortix(splash=True) ir_7040.network = Network() ir_7040_net = ir_7040.network # DADOS module. dados = Dados() ir_7040_net.module(dados) dados.rs232_filename = 'ir-7040' dados.rs232_request_string = '\r\nP0001 01245689BCDMNVWYZaOdghin 55}' # DataPlot module. data_plot = DataPlot() data_plot.title = 'IR-7040 Data Acquisition' data_plot.dpi = 300 # Network connectivity ir_7040_net.connect( [dados,'rs-232'], [data_plot,'viz-data'] ) rs232_port.connect(plot_port) ir_7040_net.draw() # Run application ir_7040.run()
def test_cortix_add_module(): # Init the Cortix object c = Cortix() c.network = Network() num_modules = 100 module_list = list() # Add 100 modules to the Cortix object for i in range(num_modules): # Initialize the module m = DummyModule() c.network.add_module(m) # Get ports p1 = m.get_port('test1-{}'.format(i)) p2 = m.get_port('test2-{}'.format(i)) # Make sure we have the correct modules assert len(c.network.modules) == num_modules for mod in c.network.modules: assert isinstance(mod, Module) assert len(mod.ports) == 2