# -*- coding: utf-8 -*-
"""
配置文件
珠海燃气保税监管系统
"""

# 系统配置
SYSTEM = {
    'name': '珠海燃气保税业务监管系统',
    'debug': True,
    'secret_key': 'your-secret-key-change-in-production',
    'host': '0.0.0.0',
    'port': 5001
}

# OPC服务器配置
OPC = {
    'server_url': 'opc.tcp://192.168.1.100:4840',  # 需要改成现场实际地址
    'update_interval': 5,  # 数据更新间隔（秒）
    'enable': False  # 是否启用OPC采集，开发测试可以关，用模拟数据
}

# 罐体配置
# 珠海LNG接收站 8个储罐 - 侧视图，竖直排列
# 每个储罐：进液管从顶部进，出液管从底部出
TANKS = [
    {
        'id': 1,
        'name': 'LNG储罐1',
        'node_id': 'ns=1;s=Level1',        # 液位节点ID
        'density_node': 'ns=1;s=Density1',  # 密度节点ID
        'temp_node': 'ns=1;s=Temperature1', # 温度节点ID
        'flow_in_node': 'ns=1;s=FlowIn',    # 输入流量
        'flow_out_node': 'ns=1;s=FlowOut',  # 输出流量
        'x': 80,    # 中心X
        'y': 250,  # 中心Y
        'width': 60,  # 宽度
        'height': 160 # 高度
    },
    {
        'id': 2,
        'name': 'LNG储罐2',
        'node_id': 'ns=1;s=Level2',
        'density_node': 'ns=1;s=Density2',
        'temp_node': 'ns=1;s=Temperature2',
        'flow_in_node': 'ns=1;s=FlowIn2',
        'flow_out_node': 'ns=1;s=FlowOut2',
        'x': 180,
        'y': 250,
        'width': 60,
        'height': 160
    },
    {
        'id': 3,
        'name': 'LNG储罐3',
        'node_id': 'ns=1;s=Level3',
        'density_node': 'ns=1;s=Density3',
        'temp_node': 'ns=1;s=Temperature3',
        'flow_in_node': 'ns=1;s=FlowIn3',
        'flow_out_node': 'ns=1;s=FlowOut3',
        'x': 280,
        'y': 250,
        'width': 60,
        'height': 160
    },
    {
        'id': 4,
        'name': 'LNG储罐4',
        'node_id': 'ns=1;s=Level4',
        'density_node': 'ns=1;s=Density4',
        'temp_node': 'ns=1;s=Temperature4',
        'flow_in_node': 'ns=1;s=FlowIn4',
        'flow_out_node': 'ns=1;s=FlowOut4',
        'x': 380,
        'y': 250,
        'width': 60,
        'height': 160
    },
    {
        'id': 5,
        'name': 'LNG储罐5',
        'node_id': 'ns=1;s=Level5',
        'density_node': 'ns=1;s=Density5',
        'temp_node': 'ns=1;s=Temperature5',
        'flow_in_node': 'ns=1;s=FlowIn5',
        'flow_out_node': 'ns=1;s=FlowOut5',
        'x': 480,
        'y': 250,
        'width': 60,
        'height': 160
    },
    {
        'id': 6,
        'name': 'LNG储罐6',
        'node_id': 'ns=1;s=Level6',
        'density_node': 'ns=1;s=Density6',
        'temp_node': 'ns=1;s=Temperature6',
        'flow_in_node': 'ns=1;s=FlowIn6',
        'flow_out_node': 'ns=1;s=FlowOut6',
        'x': 540,
        'y': 250,
        'width': 60,
        'height': 160
    },
    {
        'id': 7,
        'name': 'LNG储罐7',
        'node_id': 'ns=1;s=Level7',
        'density_node': 'ns=1;s=Density7',
        'temp_node': 'ns=1;s=Temperature7',
        'flow_in_node': 'ns=1;s=FlowIn7',
        'flow_out_node': 'ns=1;s=FlowOut7',
        'x': 600,
        'y': 250,
        'width': 60,
        'height': 160
    },
    {
        'id': 8,
        'name': 'LNG储罐8',
        'node_id': 'ns=1;s=Level8',
        'density_node': 'ns=1;s=Density8',
        'temp_node': 'ns=1;s=Temperature8',
        'flow_in_node': 'ns=1;s=FlowIn8',
        'flow_out_node': 'ns=1;s=FlowOut8',
        'x': 660,
        'y': 250,
        'width': 60,
        'height': 160
    }
]

# 管道配置（坐标连线画流程图）
# 侧视图：顶部进料总管，底部出料总管
PIPES = [
    # 进料总管（顶部水平）
    {'from': {'x': 0, 'y': 100}, 'to': {'x': 700, 'y': 100}, 'direction': 'right'},
    # 出料总管（底部水平）
    {'from': {'x': 0, 'y': 400}, 'to': {'x': 700, 'y': 400}, 'direction': 'right'},
    # 每个储罐：顶部进料管从总管进储罐，底部出料管出储罐到总管
    {'from': {'x': 80, 'y': 100}, 'to': {'x': 80, 'y': 170}, 'direction': 'down'},
    {'from': {'x': 80, 'y': 330}, 'to': {'x': 80, 'y': 400}, 'direction': 'down'},
    {'from': {'x': 180, 'y': 100}, 'to': {'x': 180, 'y': 170}, 'direction': 'down'},
    {'from': {'x': 180, 'y': 330}, 'to': {'x': 180, 'y': 400}, 'direction': 'down'},
    {'from': {'x': 280, 'y': 100}, 'to': {'x': 280, 'y': 170}, 'direction': 'down'},
    {'from': {'x': 280, 'y': 330}, 'to': {'x': 280, 'y': 400}, 'direction': 'down'},
    {'from': {'x': 380, 'y': 100}, 'to': {'x': 380, 'y': 170}, 'direction': 'down'},
    {'from': {'x': 380, 'y': 330}, 'to': {'x': 380, 'y': 400}, 'direction': 'down'},
    {'from': {'x': 480, 'y': 100}, 'to': {'x': 480, 'y': 170}, 'direction': 'down'},
    {'from': {'x': 480, 'y': 330}, 'to': {'x': 480, 'y': 400}, 'direction': 'down'},
    {'from': {'x': 540, 'y': 100}, 'to': {'x': 540, 'y': 170}, 'direction': 'down'},
    {'from': {'x': 540, 'y': 330}, 'to': {'x': 540, 'y': 400}, 'direction': 'down'},
    {'from': {'x': 600, 'y': 100}, 'to': {'x': 600, 'y': 170}, 'direction': 'down'},
    {'from': {'x': 600, 'y': 330}, 'to': {'x': 600, 'y': 400}, 'direction': 'down'},
    {'from': {'x': 660, 'y': 100}, 'to': {'x': 660, 'y': 170}, 'direction': 'down'},
    {'from': {'x': 660, 'y': 330}, 'to': {'x': 660, 'y': 400}, 'direction': 'down'},
]

# 报警配置
ALERT = {
    'level_diff_threshold': 5.0,  # 液位差异阈值（单位根据现场调整）
    'alert_phone': '138xxxxxxxx',  # 报警手机号
    'enabled': True
}

# 阿里云短信配置（需要改成实际配置）
SMS = {
    'access_key_id': 'your-access-key-id',
    'access_key_secret': 'your-access-key-secret',
    'sign_name': '系统签名',
    'template_code': 'SMS_xxxxxxx'
}

# 数据库配置
DATABASE = {
    'url': 'sqlite:///gas_monitor.db'
}
