跳转至

5.get_tag_value

函数声明

C
    double py_get_tag_value(const char *tag_name);
  • 描述

    根据测点名称取出测点的实时值,请勿传入错误的测点名称,这将导致函数返回0。

  • 参数

    tag_name:测点的名称。

  • 返回值

    返回测点的实时值。

  • 示例

Python
    # 在脚本中导入c4py库
    import c4py
    # 使用c4py库
    c4py.py_load_so()
    c4py.global_init()
    for i in range(0,11):
        tagN = "YC" + str(i)
        tagV = c4py.get_tag_value(tagN.encode())
        tagD = c4py.get_tag_desc(tagN.encode()).decode()
        c4py.clog_info("tag n:{},d:{},v:{}".format(tagN,tagD,tagV).encode())
    c4py.global_release()