예제 #1
0
def set_bms_heap_yaotiao(heap_sn, user_set_dict, visitor=None):
    host = get_datacenter_address()
    path = get_datacenter_root() + '/BMS数据块/%d/BMS遥调信息/' % (heap_sn)
    X = api.api_read(host, path)

    if X is None:
        return None

    # 将用户设置值写入数据中心
    for key, value in user_set_dict.items():
        if key not in X:
            continue

        if type(value) == type(''):
            u_value = int(value)
        else:
            u_value = value

        # 值相同则不写入
        if u_value == X[key]:
            continue

        u_path = path + key + '/'
        print(u_path)
        api.api_write(host, u_path, u_value, visitor)

    return True
예제 #2
0
def get_single_battery_V(heap_sn, group_sn, battery_count):
    host = get_datacenter_address()
    path = get_datacenter_root() + '/BMS数据块/%d/BCMU单体电池电压/%d/单体电池电压/' % (heap_sn, group_sn)
    X = api.api_read(host, path)
    if X is None:
        return [0.000] * battery_count

    return [(round(v/1000, 3)) for v in X]
예제 #3
0
def get_single_battery_SOH(heap_sn, group_sn, battery_count):
    host = get_datacenter_address()
    path = get_datacenter_root() + '/BMS数据块/%d/BCMU单体电池SOH/%d/单体电池SOH/' % (heap_sn, group_sn)
    X = api.api_read(host, path)
    if X is None:
        return [0] * battery_count

    return [v for v in X ]
예제 #4
0
def get_bms_group_yaoce(heap_sn, group_sn):
    host = get_datacenter_address()
    path = get_datacenter_root() + '/BMS数据块/%d/BCMU遥测信息/%d/' % (heap_sn, group_sn)
    X = api.api_read(host, path)

    if X is None:
        return {}

    return X
예제 #5
0
def get_bms_yaotiao(heap_sn):
    host = get_datacenter_address()
    path = get_datacenter_root() + '/BMS数据块/%d/BMS遥调信息/' % (heap_sn)
    X = api.api_read(host, path)

    if X is None:
        return {}

    return X
예제 #6
0
def set_bee_yaokong(name, value, visitor=None):
    host = get_datacenter_address()
    path = get_datacenter_root() + '/SCADA/%s/' % name
    X = api.api_read(host, path)

    if X is None:
        return None

    return api.api_write(host, path, value, visitor)
예제 #7
0
def get_bee_yaokong():
    host = get_datacenter_address()
    path = get_datacenter_root() + '/SCADA/'
    X = api.api_read(host, path)

    if X is None:
        return None

    return X
예제 #8
0
def get_sample_yc():
    host = get_datacenter_address()
    path = get_datacenter_root() + '/开关量协议盒数据块/开关量协议盒遥测信息/'
    X = api.api_read(host, path)

    if X is None:
        return None

    return X
예제 #9
0
def get_pcs_yaoce(pcs_sn):
    host = get_datacenter_address()
    path = get_datacenter_root() + '/PCS数据块/%d/PCS遥测信息/' % (pcs_sn)
    X = api.api_read(host, path)

    if X is None:
        return None

    return X
예제 #10
0
def set_pcs_yaokong(pcs_sn, name, value, visitor=None):
    host = get_datacenter_address()
    path = get_datacenter_root() + '/PCS数据块/%d/PCS遥控信息/%s/' % (pcs_sn, name)
    X = api.api_read(host, path)

    if X is None:
        return None

    return api.api_write(host, path, value, visitor)
예제 #11
0
def set_pcs_yaotiao(pcs_sn, user_set_dict, visitor=None):
    host = get_datacenter_address()
    path = get_datacenter_root() + '/PCS数据块/%d/PCS遥调信息/' % (pcs_sn)
    X = api.api_read(host, path)
    yaotiao = {
        "恒功率模式功率_AC": 10,
        "恒功率模式功率_DC": 10,
        "恒压模式限制电流": 10,
        "恒流模式电流": 10,
        "独立逆变频率": 10,
        "功率因数": 10,
        "无功功率": 10,
        "状态标志位": 10,
        "电池充电满恢复值": 10,
        "恒压模式电压": 10,
        "电池充电限制电流": 10,
        "电池放电空值": 10,
        "电池放电空恢复值": 10,
        "无功比例": 10,
        "电池充电满值": 10,
        "电池放电限制电流": 10,
        "独立逆变电压": 10
    }

    if X is None:
        return False

    try:
        # 将用户设置值写入数据中心
        for key, value in user_set_dict.items():
            if key in X:
                if type(value) == type(''):
                    if int(value) == X[key]:
                        continue
                    api.api_write(host, path + key, int(value), visitor)
                else:
                    api.api_write(host, path + key, value, visitor)
        return True
    except Exception as e:
        return False
예제 #12
0
def read(path):
    host = get_datacenter_address()
    path = get_datacenter_root() + path
    X = api.api_read(host, path)
    return None if X is None else X
예제 #13
0
def get_aircondition(aid):
    host = get_datacenter_address()
    path = get_datacenter_root() + '/空调数据块/%d/' % aid
    X = api.api_read(host, path)
    return {} if X is None else X
예제 #14
0
def get_version_blank():
    host = get_datacenter_address()
    path = get_datacenter_root() + '/软件版本数据块/'
    X = api.api_read(host, path)
    return X