123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- using Aitex.Common.Util;
- using Aitex.Core.RT.Device;
- using Aitex.Core.Util;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.IOCore;
- using MECF.Framework.RT.Core.IoProviders;
- using System.Collections.Generic;
- using Aitex.Core.RT.SCCore;
- using JetVirgoPM.Devices;
- using JetVirgoPM.Devices.EPDs;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Pumps.EdwardsPump;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Pumps.SkyPump;
- namespace JetVirgoPM
- {
- public class JetVirgoPMDeviceManager : Singleton<JetVirgoPMDeviceManager>
- {
- private Dictionary<ModuleName, DeviceController> _controller = new Dictionary<ModuleName, DeviceController>();
- private Dictionary<ModuleName, DeviceManagerBase> _device = new Dictionary<ModuleName, DeviceManagerBase>();
- public JetVirgoPMDeviceManager()
- {
- }
- public void Initialize(ModuleName module)
- {
- var controller = new DeviceController();
- var device = new DeviceManagerBase(true);
- string ioProviderPathFile = PathManager.GetCfgDir() + "JetVirgoPM//IoProviderConfig.xml";
- IoProviderManager.Instance.Initialize(ioProviderPathFile, module.ToString(), "io", true);
- IoManager.Instance.Initialize(PathManager.GetCfgDir() + "JetVirgoPM//interlockPM.xml");
- device.Initialize(PathManager.GetCfgDir() + "JetVirgoPM//DeviceModelPM.xml", "JetVirgoPM", module,
- module.ToString());
- if (SC.GetValue<int>($"{module}.Rf1.CommunicationType") == (int)CommunicationType.RS232)
- {
- if (SC.GetValue<int>($"{module}.Rf1.MFG") == (int)GeneratorMFG.AdTec)
- {
- device.AddCustomModuleDevice(new AdTecGenerator(module, "Rf1"));
- }
- else if (SC.GetValue<int>($"{module}.Rf1.MFG") == (int)GeneratorMFG.Wattsine)
- {
- device.AddCustomModuleDevice(new MicrowareRF(module, "Rf1"));
- }
- }
- if (SC.GetValue<int>($"{module}.Rf2.CommunicationType") == (int)CommunicationType.RS232)
- {
- if (SC.GetValue<int>($"{module}.Rf2.MFG") == (int)GeneratorMFG.AdTec)
- {
- device.AddCustomModuleDevice(new AdTecGenerator(module, "Rf2"));
- }
- else if (SC.GetValue<int>($"{module}.Rf2.MFG") == (int)GeneratorMFG.Wattsine)
- {
- device.AddCustomModuleDevice(new MicrowareRF(module, "Rf2"));
- }
- }
- if (SC.GetValue<bool>($"{module}.BiasRf1.EnableBiasRF") &&
- SC.GetValue<int>($"{module}.BiasRf1.CommunicationType") == (int)CommunicationType.Ethernet &&
- SC.GetValue<int>($"{module}.BiasRf1.MFG") == (int)GeneratorMFG.Comet)
- {
- device.AddCustomModuleDevice(new CometRF(module, "BiasRf1", SC.GetStringValue($"{module}.BiasRf1.IPAddress")));
- }
- if (SC.GetValue<bool>($"{module}.BiasRf2.EnableBiasRF") &&
- SC.GetValue<int>($"{module}.BiasRf2.CommunicationType") == (int)CommunicationType.Ethernet &&
- SC.GetValue<int>($"{module}.BiasRf2.MFG") == (int)GeneratorMFG.Comet)
- {
- device.AddCustomModuleDevice(new CometRF(module, "BiasRf2", SC.GetStringValue($"{module}.BiasRf2.IPAddress")));
- }
- if (SC.GetValue<bool>($"{module}.BiasRf1.EnableBiasRF") &&
- SC.GetValue<int>($"{module}.BiasRf1.CommunicationType") == (int)CommunicationType.RS232 &&
- SC.GetValue<int>($"{module}.BiasRf1.MFG") == (int)GeneratorMFG.AdTec)
- {
- device.AddCustomModuleDevice(new AdTecGenerator(module, "BiasRf1"));
- }
- if (SC.GetValue<bool>($"{module}.BiasRf2.EnableBiasRF") &&
- SC.GetValue<int>($"{module}.BiasRf2.CommunicationType") == (int)CommunicationType.RS232 &&
- SC.GetValue<int>($"{module}.BiasRf2.MFG") == (int)GeneratorMFG.AdTec)
- {
- device.AddCustomModuleDevice(new AdTecGenerator(module, "BiasRf2"));
- }
- if (SC.GetValue<bool>($"{module}.Chiller1.EnableChiller") &&
- SC.GetValue<int>($"{module}.Chiller1.CommunicationType") == (int)CommunicationType.RS232)
- {
- if (SC.GetValue<int>($"{module}.Chiller1.MFG") == (int)ChillerMFG.SMC)
- {
- device.AddCustomModuleDevice(new SMCChiller(module, "Chiller1"));
- }
- else if (SC.GetValue<int>($"{module}.Chiller1.MFG") == (int)ChillerMFG.AIRSYS)
- {
- device.AddCustomModuleDevice(new AIRSYSChiller(module, "Chiller1"));
- }
- }
- if (SC.GetValue<bool>($"{module}.Chiller2.EnableChiller") &&
- SC.GetValue<int>($"{module}.Chiller2.CommunicationType") == (int)CommunicationType.RS232 &&
- SC.GetValue<int>($"System.SetUp.ChillerSetupOp.IsInstalled") == (int)ChillerSetupOp.NoShareSingleChiller)
- {
- if( SC.GetValue<int>($"{module}.Chiller2.MFG") == (int)ChillerMFG.SMC)
- {
- device.AddCustomModuleDevice(new SMCChiller(module, "Chiller2"));
- }
- else if (SC.GetValue<int>($"{module}.Chiller2.MFG") == (int)ChillerMFG.AIRSYS)
- {
- device.AddCustomModuleDevice(new AIRSYSChiller(module, "Chiller2"));
- }
- }
- if (SC.GetValue<bool>($"{module}.match1.EnableMatch") &&
- SC.GetValue<int>($"{module}.match1.CommunicationType") == (int)CommunicationType.RS232 &&
- SC.GetValue<int>($"{module}.match1.MFG") == (int)MatchMFG.AdTec)
- {
- device.AddCustomModuleDevice(new AdTecMatch(module, "match1"));
- }
- if (SC.GetValue<bool>($"{module}.match2.EnableMatch") &&
- SC.GetValue<int>($"{module}.match2.CommunicationType") == (int)CommunicationType.RS232 &&
- SC.GetValue<int>($"{module}.match2.MFG") == (int)MatchMFG.AdTec)
- {
- device.AddCustomModuleDevice(new AdTecMatch(module, "match2"));
- }
- if (SC.GetValue<bool>($"{module}.BiasRf1Match.EnableMatch") &&
- SC.GetValue<int>($"{module}.BiasRf1Match.CommunicationType") == (int)CommunicationType.RS232 &&
- SC.GetValue<int>($"{module}.BiasRf1Match.MFG") == (int)MatchMFG.AdTec)
- {
- device.AddCustomModuleDevice(new AdTecMatch(module, "BiasRf1Match"));
- }
- if (SC.GetValue<bool>($"{module}.BiasRf2Match.EnableMatch") &&
- SC.GetValue<int>($"{module}.BiasRf2Match.CommunicationType") == (int)CommunicationType.RS232 &&
- SC.GetValue<int>($"{module}.BiasRf2Match.MFG") == (int)MatchMFG.AdTec)
- {
- device.AddCustomModuleDevice(new AdTecMatch(module, "BiasRf2Match"));
- }
- if (SC.GetValue<int>($"{module}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
- {
- if (SC.GetValue<int>($"{module}.DryPump.MFG") == (int)DryPumpMFG.SKY)
- {
- device.AddCustomModuleDevice(new SkyPump(module, VirgoDevice.MainPump.ToString()));
- }
- else if (SC.GetValue<int>($"{module}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
- {
- device.AddCustomModuleDevice(new EdwardsPump(module, VirgoDevice.MainPump.ToString()));
- }
- }
- if (SC.GetValue<bool>($"{module}.EPD.IsEnabled") && SC.GetValue<bool>("System.SetUp.EPD.IsInstalled"))
- {
- device.AddCustomModuleDevice(new EPDDevice(module.ToString(), "EPD"));
- }
- device.AddCustomModuleDevice(new JetDualPM(module));
- controller.Start(device);
- _controller[module] = controller;
- _device[module] = device;
- }
- public void Reset(ModuleName module)
- {
- _controller[module].Reset();
- }
- public void Terminate(ModuleName module)
- {
- _controller[module].Terminate();
- DEVICE.GetDevice<JetDualPM>($"{module}.{module}").Terminate();
- }
- }
- }
|