using AutomaticApp.Common; using AutomaticApp.Model; using AutomaticApp.Models; using AutomaticApp.TestModels; using Google.Protobuf.WellKnownTypes; using LiveCharts; using LiveCharts.Wpf.Charts.Base; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Reflection.Emit; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Documents; namespace AutomaticApp.ViewModels { /// /// 浮标端数据交互站点1 /// public class BuoystationModel : NotifyBase { public BuoyEnvironmentModel buoyEnvironmentModel { get; set; } = new BuoyEnvironmentModel(); public WeatherSensorModel weatherSensorModel { get; set; } = new WeatherSensorModel(); public Special_Posture[] SP { set; get; } = new Special_Posture[60]; #region 实体类 /// /// 环境状态列表数据1 /// private List buoyEvironment1 = new List { new KeypaiValueModel { Header = "浮标温度(℃)" }, new KeypaiValueModel { Header = "浮标湿度(% RH)" }, new KeypaiValueModel { Header = "烟雾(mg/m³)" }, new KeypaiValueModel { Header = "浮标姿态X轴(°)" }, new KeypaiValueModel { Header = "浮标姿态Y轴(°)" }, new KeypaiValueModel { Header = "浮标姿态Z轴(°)" }, new KeypaiValueModel { Header = "纬度(°)" }, new KeypaiValueModel { Header = "经度(°)" }, new KeypaiValueModel { Header = "浮标漏水" }, new KeypaiValueModel { Header = "舱门状态" }, new KeypaiValueModel { Header = "平均风速(m/s)" }, new KeypaiValueModel { Header = "平均风向(°)" }, }; public List BuoyEvironment1 { get { return buoyEvironment1; } set { buoyEvironment1 = value; this.DoNotify(); } } /// /// 环境状态列表数据2 /// private List buoyEvironment2 = new List { new KeypaiValueModel { Header = "蓄电池充电电压(V)" }, new KeypaiValueModel { Header = "蓄电池充电电流(A)" }, new KeypaiValueModel { Header = "蓄电池电压(V)" }, new KeypaiValueModel { Header = "剩余电量(Wh)" }, new KeypaiValueModel { Header = "负载电压(V)" }, new KeypaiValueModel { Header = "负载电流(A)" }, new KeypaiValueModel { Header = "卫通天线电压(V)" }, new KeypaiValueModel { Header = "北斗指挥机电压(V)" }, new KeypaiValueModel { Header = "AIS电压(V)" }, new KeypaiValueModel { Header = "十分钟极大风速(m/s)" }, new KeypaiValueModel { Header = "十分钟极大风向(°)" } }; public List BuoyEvironment2 { get { return buoyEvironment2; } set { buoyEvironment2 = value; this.DoNotify(); } } /// /// 告警信息 /// private List alarmList = new List(); public List AlarmList { get { return alarmList; } set { alarmList = value; this.DoNotify(); } } #endregion public BuoystationModel() { DoFresh(); } public void DoFresh() { #region 初始化浮标1#1环境参数 并赋值 //赋值 BuoyEvironment1[0].Value = buoyEnvironmentModel.FB_Tem.ToString("0.00"); BuoyEvironment1[1].Value = buoyEnvironmentModel.FB_Hum.ToString("0.00"); BuoyEvironment1[2].Value = buoyEnvironmentModel.FB_Smoke.ToString("0.00"); BuoyEvironment1[3].Value = buoyEnvironmentModel.FB_Attitude_x.ToString("0.00"); BuoyEvironment1[4].Value = buoyEnvironmentModel.FB_Attitude_y.ToString("0.00"); BuoyEvironment1[5].Value = buoyEnvironmentModel.FB_Attitude_z.ToString("0.00"); BuoyEvironment1[6].Value = buoyEnvironmentModel.WD.ToString("0.0000"); BuoyEvironment1[7].Value = buoyEnvironmentModel.JD.ToString("0.0000"); BuoyEvironment1[8].Value = Convert.ToBoolean(buoyEnvironmentModel.FB_Leak1) ? "否" : "是"; BuoyEvironment1[9].Value = Convert.ToBoolean(buoyEnvironmentModel.Hatch_Status) ? "否" : "是"; BuoyEvironment1[10].Value = weatherSensorModel.Air_Speed.ToString("0.00"); BuoyEvironment1[11].Value = weatherSensorModel.Air_Wind_Dir.ToString("0.00"); #endregion //#region 初始化浮标1#2环境参数 并赋值 //赋值 BuoyEvironment2[0].Value = buoyEnvironmentModel.Battery_Vol.ToString("0.00"); BuoyEvironment2[1].Value = buoyEnvironmentModel.Charging_Cur.ToString("0.00"); BuoyEvironment2[2].Value = buoyEnvironmentModel.Battery_Vol.ToString("0.00"); BuoyEvironment2[3].Value = buoyEnvironmentModel.Remaining_Power.ToString("0.00"); BuoyEvironment2[4].Value = buoyEnvironmentModel.Load_Vol.ToString("0.00"); BuoyEvironment2[5].Value = buoyEnvironmentModel.Load_Cur.ToString("0.00"); BuoyEvironment2[6].Value = buoyEnvironmentModel.Antenna_Vol.ToString("0.00"); BuoyEvironment2[7].Value = buoyEnvironmentModel.BD_Vol.ToString("0.00"); BuoyEvironment2[8].Value = buoyEnvironmentModel.AIS_Vol.ToString("0.00"); BuoyEvironment2[9].Value = weatherSensorModel.Air_Speed_Max.ToString("0.00"); BuoyEvironment2[10].Value = weatherSensorModel.Air_Wind_Dir_Max.ToString("0.00"); #region 初始化消息列表 //AlarmList = new List(); //AlarmList.Add(new AlarmItemModel { Num = "01", Message = "你的名字是", Time = "2022-07-05 20:00:00", Duration = 5 }); //AlarmList.Add(new AlarmItemModel { Num = "02", Message = "你的名字是", Time = "2022-07-05 20:00:00", Duration = 5 }); //AlarmList.Add(new AlarmItemModel { Num = "03", Message = "你的名字是", Time = "2022-07-05 20:00:00", Duration = 5 }); #endregion } } }