mz-automation / lib60870

Official repository for lib60870 an implementation of the IEC 60870-5-101/104 protocol
https://www.mz-automation.de/communication-protocols/iec-60870-5-101-104-c-source-code-library/
GNU General Public License v3.0
430 stars 223 forks source link

hi, I want know the detail about using protocol 104 to write float and 32bits string。 #160

Open nanqiu123 opened 1 month ago

nanqiu123 commented 1 month ago

hi, I using thoese programs to writing data to 104 server, InformationObject sc = (InformationObject)SingleCommand_create(NULL, 10, false, false, 0); printf("Send control command C_SC_NA_1\n"); CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc); InformationObject_destroy(sc);

    sc = (InformationObject)SingleCommand_create(NULL, 10, true, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)DoubleCommand_create(NULL, 30, 0, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)DoubleCommand_create(NULL, 30, 1, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)DoubleCommand_create(NULL, 30, 2, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)DoubleCommand_create(NULL, 30, 3, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)StepCommand_create(NULL, 50, 2, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)StepCommand_create(NULL, 50, 3, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandNormalized_create(NULL, 70, -1, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandNormalized_create(NULL, 70, 0.1234, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandNormalized_create(NULL, 70, 1, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandScaled_create(NULL, 90, -32.768, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandScaled_create(NULL, 90, 0, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandScaled_create(NULL, 90, 32.767, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandShort_create(NULL, 110, 1.2347, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandShort_create(NULL, 110, 2.4567, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)Bitstring32Command_create(NULL, 120, 123456);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

but ,in last two page program, sc = (InformationObject)SetpointCommandShort_create(NULL, 110, 2.4567, false, 0); printf("Send control command C_SC_NA_1\n"); CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc); InformationObject_destroy(sc);

    sc = (InformationObject)Bitstring32Command_create(NULL, 120, 123456);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);`

I can‘t using the program to write data , the messages to server are listed below。 I find those message are not 32bits string message or float message but scaled num message, so it write fail, I want to know the reason about it please. image image image image

nanqiu123 commented 1 month ago

OH, there is not any help for me?

zzz9h commented 2 weeks ago

You must first send the selection command, and then send the execution command.

/**

like thise

sc = (InformationObject)SingleCommand_create(NULL, 10, true, true, 0); printf("Send control select command C_SC_NA_1\n"); CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc); InformationObject_destroy(sc);

sc = (InformationObject)SingleCommand_create(NULL, 10, true, false, 0); printf("Send control execute command C_SC_NA_1\n"); CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc); InformationObject_destroy(sc);