| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace VehicleControlSystem.ControlLayer.Serial.DataModel
- {
- public enum eDataKind
- {
- Voltage = 0, //V
- Current, //A
- BatteryState,
- ChargeCompleteTime, //Min
- DisChargeCompleteTime, //Min
- SOC, //%
- SOH, //%
- ResidualCapacity,//Ah
- ResidualEnergy,//Wh
- Temperature,//C
- }
- public enum eBatteryState
- {
- OverVolte,
- LowVolte,
- OverChargeCurrent,
- OverDisChargeCurrent,
- HightTemperature,
- LowTemperature,
- BMUError,
- }
-
- public class ReceivedData
- {
- public eDataKind DataKind { get; set; } = eDataKind.BatteryState;
- public eBatteryState BatteryState { get; set; }
- public string OrgVule { get; set; }
- public double? Value {
- get
- {
- if ( this.DataKind != eDataKind.BatteryState )
- {
- double dOrg = 0d;
- double.TryParse( this.OrgVule , out dOrg );
- return dOrg;
- }
- else
- {
- return null;
- }
- }
- set
- {
- if(Value != (double)value)
- {
- this.OrgVule = value.ToString();
- this.IsChanged = true;
- }
- }
- }
- //public double Value
- //{
- // get { return Value; }
- //}
- public string OrgValue { get; set; } = "0";
- public double Scale { get; set; }
- public string Unit { get; set; } //단위를 붙이기 위해
- public bool IsChanged { get; set; }
- public ReceivedData(eDataKind kind)
- {
- this.DataKind = kind;
- }
- //public override string ToString()
- //{
- // return this.Value.ToString() + " " + this.Unit;
- //}
- public ReceivedData Clone( )
- {
- return ( ReceivedData )MemberwiseClone();
- }
- }
- }
|