Added connect function to nnsim.py