def main():
    """main"""
    #create the object for getting CPU data
    data_collector = SystemDataCollector(5)
    #create the thread in charge of calling the data collector
    system_monitor = WorkerThread(data_collector.collect)

    #create the modbus TCP simulator and one slave
    #and one block of analog inputs
    simu = Simulator(TcpServer())
    slave = simu.server.add_slave(1)
    slave.add_block("Cpu", defines.ANALOG_INPUTS, 0, 10)

    try:
        LOGGER.info("'quit' for closing the server")

        #start the data collect
        system_monitor.start()

        #start the simulator! will block until quit command is received
        simu.start()

    except Exception as excpt:
        print excpt

    finally:
        #close the simulator
        simu.close()
        #stop the data collect
        system_monitor.stop()