128 lines
3.3 KiB
C#
128 lines
3.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Maser.Feanor.Model
|
|
{
|
|
|
|
public enum SensorType
|
|
{
|
|
NONE = 0,
|
|
Pt100 = 1,
|
|
ThermocoupleK = 2,
|
|
Voltage = 3,
|
|
PsychrometerRH = 4,
|
|
PressurecookerRH = 5,
|
|
Current = 6
|
|
}
|
|
|
|
|
|
|
|
public class Sensor
|
|
{
|
|
public Sensor() { }
|
|
|
|
|
|
public Sensor(int PK, int ID, int ChamberPK, string Description, SensorType Type, Boolean Active, Boolean ApplyCalibration)
|
|
{
|
|
_PK = PK;
|
|
_ID = ID;
|
|
_chamberPK = ChamberPK;
|
|
_Description = Description;
|
|
_Type = Type;
|
|
_Enabled = Active;
|
|
_ApplyCalibration = ApplyCalibration;
|
|
}
|
|
|
|
|
|
|
|
public Int32 PK { set { _PK = value; } get { return _PK; } }
|
|
private Int32 _PK = -1;
|
|
|
|
|
|
|
|
public Int32 ID { set { _ID = value; } get { return _ID; } }
|
|
private Int32 _ID = 0;
|
|
|
|
|
|
|
|
public Boolean ApplyCalibration { get { return _ApplyCalibration; } set { _ApplyCalibration = value; } }
|
|
private bool _ApplyCalibration = true;
|
|
|
|
|
|
public Int32 ChamberPK { set { _chamberPK = value; } get { return _chamberPK; } }
|
|
private Int32 _chamberPK = 0;
|
|
|
|
|
|
public String Description { set { _Description = value; } get { return _Description; } }
|
|
private String _Description = "";
|
|
|
|
|
|
public SensorType Type { set { _Type = value; } get { return _Type; } }
|
|
private SensorType _Type = SensorType.NONE;
|
|
|
|
public Boolean Enabled { set { _Enabled = value; } get { return _Enabled; } }
|
|
private Boolean _Enabled = false;
|
|
|
|
|
|
public String Units
|
|
{
|
|
get
|
|
{
|
|
switch (this.Type)
|
|
{
|
|
case SensorType.Pt100:
|
|
return "°C";
|
|
case SensorType.ThermocoupleK:
|
|
return "°C";
|
|
case SensorType.Voltage:
|
|
return "V";
|
|
case SensorType.PsychrometerRH:
|
|
return "%rh";
|
|
case SensorType.PressurecookerRH:
|
|
return "%rh";
|
|
case SensorType.Current:
|
|
return "A";
|
|
default:
|
|
return "";
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public String ListDescription = "";
|
|
|
|
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.Format("{0:00} {1}", _ID, _Description);
|
|
}
|
|
|
|
public string TypeToString()
|
|
{
|
|
switch (_Type)
|
|
{
|
|
case SensorType.Pt100:
|
|
return "Pt100";
|
|
case SensorType.ThermocoupleK:
|
|
return "Thermoucouple K";
|
|
case SensorType.PsychrometerRH:
|
|
return "RH with psychrometer";
|
|
case SensorType.PressurecookerRH:
|
|
return "RH in pressurecooker";
|
|
case SensorType.Voltage:
|
|
return "Voltage";
|
|
case SensorType.Current:
|
|
return "Current";
|
|
default:
|
|
return _Type.ToString();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|