示例#1
0
 def stop(self):
     iec61850.IedServer_stop(self.__iedServer)
     iec61850.IedServer_destroy(self.__iedServer)
     iec61850.IedModel_destroy(self.__model)
示例#2
0
    )

    # Create Server Connection
    iedServer = iec61850.IedServer_create(myModel)
    iec61850.IedServer_start(iedServer, 8102)
    print("Waiting for connection...\n")

    if not (iec61850.IedServer_isRunning(iedServer)):
        print("Starting server failed! Exit.\n")
        iec61850.IedServer_destroy(iedServer)
        sys.exit(-1)

    running = 1

    signal.signal(signal.SIGINT, signal_handler)

    # Main loop
    while running:
        # Get current datetime with random integer
        # Add the value to the specific Data Attribute
        random.seed()
        message = current_time + str(random.randint(1, 10))
        val1 = iec61850.IedServer_updateFloatAttributeValue(iedServer, fl, message)
        val2 = iec61850.IedServer_updateVisibleStringAttributeValue(
            iedServer, st, "This is"
        )
        time.sleep(1)

    iec61850.IedServer_stop(iedServer)
    iec61850.IedServer_destroy(iedServer)