예제 #1
0
 def __init__(self):
     self.__model = iec61850.IedModel_create('testmodel')
     lDevice1 = iec61850.LogicalDevice_create('SENSORS', self.__model)
     lln0 = iec61850.LogicalNode_create('LLN0', lDevice1)
     ttmp1 = iec61850.LogicalNode_create('TTMP1', lDevice1)
     iec61850.CDC_SAV_create('TmpSv',  iec61850.toModelNode(ttmp1), 0, False)
     iec61850.CDC_ASG_create('TmpSp',  iec61850.toModelNode(ttmp1), 0, False)
     self.__iedServer = iec61850.IedServer_create(self.__model)
     iec61850.IedServer_start(self.__iedServer, tcpPort)
     if not(iec61850.IedServer_isRunning(self.__iedServer)):
         print('Starting server failed! Exit.\n')
         iec61850.IedServer_destroy(self.__iedServer)
         sys.exit(-1)
예제 #2
0
 def __init__(self):
     self.__model = iec61850.IedModel_create("testmodel")
     lDevice1 = iec61850.LogicalDevice_create("SENSORS", self.__model)
     lln0 = iec61850.LogicalNode_create("LLN0", lDevice1)
     ttmp1 = iec61850.LogicalNode_create("TTMP1", lDevice1)
     iec61850.CDC_SAV_create("TmpSv", iec61850.toModelNode(ttmp1), 0, False)
     iec61850.CDC_ASG_create("TmpSp", iec61850.toModelNode(ttmp1), 0, False)
     self.__iedServer = iec61850.IedServer_create(self.__model)
     iec61850.IedServer_start(self.__iedServer, tcpPort)
     if not (iec61850.IedServer_isRunning(self.__iedServer)):
         print("Starting server failed! Exit.\n")
         iec61850.IedServer_destroy(self.__iedServer)
         sys.exit(-1)
예제 #3
0
 def stop(self):
     iec61850.IedServer_stop(self.__iedServer)
     iec61850.IedServer_destroy(self.__iedServer)
     iec61850.IedModel_destroy(self.__model)
예제 #4
0
        iec61850.toModelNode(do1),
        iec61850.IEC61850_VISIBLE_STRING_255,
        iec61850.IEC61850_FC_DC,
        0,
        0,
        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"