2023-12-02 10:53:31 +08:00
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
from sqlalchemy import *
|
|
|
|
|
from db.base import Base
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LOT_DATA(BaseModel):
|
2023-12-07 16:35:05 +08:00
|
|
|
|
device_name: str = Field(None, description='设备编号')
|
2023-12-02 10:53:31 +08:00
|
|
|
|
create_time: int = Field(None, description='创建时间(时间戳) ')
|
|
|
|
|
wind_speed: float = Field(None, description='风速:(0到30)m/s ')
|
|
|
|
|
wind_direction: float = Field(None, description='风向:0~360°')
|
|
|
|
|
ambient_temperature: float = Field(None, description='环境温度:℃')
|
|
|
|
|
ambient_humidity: float = Field(None, description='环境湿度:%RH')
|
|
|
|
|
carbon_dioxide: float = Field(None, description='二氧化碳:0~5000ppm')
|
|
|
|
|
ambient_air_pressure: float = Field(None, description='环境气压:0~120KPa')
|
|
|
|
|
rainfall: float = Field(None, description='雨量:mm')
|
|
|
|
|
ambient_lighting: float = Field(None, description='环境光照:0-65535Lux;0-20万Lux')
|
|
|
|
|
soil_temperature: float = Field(None, description='土壤温度:-40~80℃')
|
|
|
|
|
soil_moisture: float = Field(None, description='土壤湿度:0-100%RH')
|
|
|
|
|
soil_conductivity: float = Field(None, description='土壤电导率:0-20000μS/cm')
|
|
|
|
|
soil_PH: float = Field(None, description='土壤PH:3~9PH')
|
|
|
|
|
soil_potassium_phosphate_nitrogen: float = Field(None, description='土壤磷酸钾:氮的标准值在140-225mg/kg')
|
|
|
|
|
soil_potassium_phosphate_phosphorus: float = Field(None, description='土壤磷酸钾:磷的标准值在57-100mg/kg,')
|
|
|
|
|
soil_potassium_phosphate_potassium: float = Field(None, description='土壤磷酸钾:钾的标准值在106-150mg/kg')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LOT_DATA_MODEL(Base):
|
|
|
|
|
"""
|
|
|
|
|
物联网数据模型
|
|
|
|
|
"""
|
|
|
|
|
__tablename__ = 'LOT_DATA_MODEL'
|
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True, comment='ID')
|
2023-12-07 16:35:05 +08:00
|
|
|
|
device_name = Column(String(50), comment="设备编号")
|
2023-12-02 10:53:31 +08:00
|
|
|
|
create_time = Column(Integer, comment="创建时间")
|
|
|
|
|
wind_speed = Column(Float, comment='风速:(0到30)m/s ')
|
|
|
|
|
wind_direction = Column(Float, comment='风向:0~360°')
|
|
|
|
|
ambient_temperature = Column(Float, comment='环境温度:℃')
|
|
|
|
|
ambient_humidity = Column(Float, comment='环境湿度:%RH')
|
|
|
|
|
carbon_dioxide = Column(Float, comment='二氧化碳:0~5000ppm')
|
|
|
|
|
ambient_air_pressure = Column(Float, comment='环境气压:0~120KPa')
|
|
|
|
|
rainfall = Column(Float, comment='雨量:mm')
|
|
|
|
|
ambient_lighting = Column(Float, comment='环境光照:0-65535Lux;0-20万Lux')
|
|
|
|
|
soil_temperature = Column(Float, comment='土壤温度:-40~80℃')
|
|
|
|
|
soil_moisture = Column(Float, comment='土壤湿度:0-100%RH')
|
|
|
|
|
soil_conductivity = Column(Float, comment='土壤电导率:0-20000μS/cm')
|
|
|
|
|
soil_PH = Column(Float, comment='土壤PH:3~9PH')
|
|
|
|
|
soil_potassium_phosphate_nitrogen = Column(Float, comment='土壤磷酸钾:氮的标准值在140-225mg/kg')
|
|
|
|
|
soil_potassium_phosphate_phosphorus = Column(Float, comment='土壤磷酸钾:磷的标准值在57-100mg/kg,')
|
|
|
|
|
soil_potassium_phosphate_potassium = Column(Float, comment='土壤磷酸钾:钾的标准值在106-150mg/kg')
|
|
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
return f"LOT_DATA_MODEL(id={self.id}, wind_speed={self.wind_speed}, wind_direction={self.wind_direction}, ambient_temperature={self.ambient_temperature}, ambient_humidity={self.ambient_humidity}, carbon_dioxide={self.carbon_dioxide}, ambient_air_pressure={self.ambient_air_pressure}, rainfall={self.rainfall}, ambient_lighting={self.ambient_lighting}, soil_temperature={self.soil_temperature}, soil_moisture={self.soil_moisture}, soil_conductivity={self.soil_conductivity}, Soil_PH={self.soil_PH}, soil_potassium_phosphate_nitrogen={self.soil_potassium_phosphate_nitrogen}, soil_potassium_phosphate_phosphorus={self.soil_potassium_phosphate_phosphorus}, soil_potassium_phosphate_potassium={self.soil_potassium_phosphate_potassium})"
|