123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- using System;
- using System.Xml;
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.IOCore;
- using Aitex.Core.RT.Log;
- using Aitex.Core.Util;
- namespace VirgoRT.Devices
- {
- public class IoTemperatureCtrl : BaseDevice, IDevice
- {
- // Fields
- //
- private readonly AOAccessor _aoSubstrate;
- private readonly AIAccessor _aiCtrlTemp;
- private readonly AIAccessor _aiMonitorTemp;
- // Properties
- //
- public double SP
- {
- get { return null != _aoSubstrate ? _aoSubstrate.Value : 0; }
- set { if (null != _aoSubstrate) _aoSubstrate.Value = (short)value; }
- }
- public double CtrlTemp
- {
- get { return null != _aiCtrlTemp ? _aiCtrlTemp.Value : 0; }
- }
- public double MonitorTemp
- {
- get { return null != _aiMonitorTemp ? _aiMonitorTemp.Value : 0; }
- }
- // Constructor
- //
- public IoTemperatureCtrl(string module, XmlElement node, string ioModule = "")
- {
- base.Module = module;
- base.Name = node.GetAttribute("id");
- base.Display = node.GetAttribute("display");
- base.DeviceID = node.GetAttribute("schematicId");
- _aoSubstrate = ParseAoNode("aoSetpoint", node, ioModule);
- _aiCtrlTemp = ParseAiNode("aiCtrlFB", node, ioModule);
- _aiMonitorTemp = ParseAiNode("aiMonitorFB", node, ioModule);
- //_scEnableLeftTcAsControlTc = ParseScNodeBool("scEnalbeLeftTcAsControlTc", node);
- //_scMaxDifferenceTcValue = ParseScNodeDouble("scElectrodeTcDifferenceMaxValue", node);
- //_scManualProcessElectrodeCriticalTemperature = ParseScNodeDouble("scManualProcessElectrodeCriticalTemperature", node);
- //_leftTc = ParseDeviceNode<IoThermalCouple>("deviceLeftElectrodeTc", node);
- //_rightTc = ParseDeviceNode<IoThermalCouple>("deviceRightElectrodeTc", node);
- //_valveElectrodeWater = ParseDeviceNode<IoValve>("deviceElectrodeWaterValve", node);
- //_diLogicIsRfPoweringHeatupMode = ParseDiNode("diLogicIsRfPoweringHeatupMode", node);
- //_diLogicManualProcessRfPowering = ParseDiNode("diLogicManualProcessRfPowering", node);
- }
- public bool Initialize()
- {
- //DATA.Subscribe(string.Format("{0}.IoTemperatureCtrl.{1}.SubstrateTemperature", Module, Name),
- // () => MonitorTemp);
- DATA.Subscribe(string.Format("Device.{0}.{1}", Module, Name), () =>
- {
- AITHeaterData data = new AITHeaterData()
- {
- DeviceName = Name,
- DeviceSchematicId = DeviceID,
- DisplayName = Display,
- SetPoint = SP,
- FeedBack = CtrlTemp,
- MonitorTcFeedBack = MonitorTemp
- };
- return data;
- }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DEVICE.Register(string.Format("{0}.{1}", Name, AITHeaterOperation.SetTemperature),
- (out string reason, int time, object[] param) =>
- {
- reason = "";
- double target = Convert.ToDouble((string)param[0]);
- SP = target;
- return true;
- });
- return true;
- }
- public void SetTemperature(double val)
- {
- this.SP = val;
- LOG.Write("Temperature of substrate is set to " + val);
- }
- public void Terminate()
- {
- }
- public void Monitor()
- {
- }
- public void Reset()
- {
- }
- }
- }
|