コード例 #1
0
 public ConsolidationDevice(DeviceControl.DeviceManagerBase deviceManager, DeviceManagerDeviceSettings settings, PeriodType periodType = PeriodType.Day)
     : base(deviceManager, settings)
 {
     Manufacturer = settings.Manufacturer;
     Model = settings.Model;
     //DeviceIdentifier = settings.SerialNo;
     SourceDevices = new List<DeviceLink>();
     PeriodType = periodType;
 }
コード例 #2
0
        public ActiveDevice_Generic(DeviceControl.DeviceManager_ActiveController<Device.ActiveDevice_Generic> deviceManager, DeviceManagerDeviceSettings deviceSettings)
            : base(deviceManager, deviceSettings, new InverterAlgorithm(deviceSettings, deviceManager.Protocol, deviceManager.ErrorLogger))
        {
            DeviceParams.DeviceType = deviceSettings.DeviceType;
            DeviceParams.QueryInterval = deviceSettings.QueryIntervalInt;
            DeviceParams.RecordingInterval = deviceSettings.DBIntervalInt;

            UseEnergyTotal = true;
            UseEnergyTotalSet = false;

            HasStartOfDayEnergyDefect = DeviceSettings.HasStartOfDayEnergyDefect;
            EstEnergy = new Device.EstimateEnergy(this);

            ResetDevice();
        }
コード例 #3
0
        public DeviceAlgorithm(DeviceManagerDeviceSettings deviceSettings, Protocol protocol, ErrorLogger errorLogger)
        {
            //DeviceManager = deviceManager;
            Protocol = protocol;
            AlgorithmParams aParams;
            aParams.EndianConverter16Bit = protocol.EndianConverter16Bit;
            aParams.EndianConverter32Bit = protocol.EndianConverter32Bit;
            aParams.Protocol = Protocol;
            aParams.AlgorithmList = deviceSettings.DeviceSettings.AlgorithmList;
            aParams.BlockList = deviceSettings.DeviceSettings.BlockList;
            aParams.DeviceName = deviceSettings.Name;
            aParams.ErrorLogger = errorLogger;

            DoInitialise(aParams);
        }
コード例 #4
0
 public ActiveDevice_Growatt(DeviceControl.DeviceManager_ActiveController<Device.ActiveDevice_Generic> deviceManager, DeviceManagerDeviceSettings deviceSettings)
     : base(deviceManager, deviceSettings)
 {
 }
コード例 #5
0
        public EnergyConsolidationDevice(DeviceControl.DeviceManagerBase deviceManager, DeviceManagerDeviceSettings settings, PeriodType periodType = PeriodType.Day)
            : base(deviceManager, settings, periodType)
        {
            int interval;
            if (settings.ConsolidationType == ConsolidationType.PVOutput)
            {
                PvOutputSiteSettings pvo = GlobalSettings.ApplicationSettings.FindPVOutputBySystemId(settings.PVOutputSystem);
                if (pvo == null)
                    throw new Exception("EnergyConsolidationDevice - Cannot find PVOutput system - " + settings.PVOutputSystem);
                interval = pvo.DataIntervalSeconds;
            }
            else
                interval = settings.DBIntervalInt;

            DeviceParams = new EnergyConsolidationParams(interval);
        }
コード例 #6
0
 public InverterAlgorithm(DeviceManagerDeviceSettings deviceSettings, Protocol protocol, ErrorLogger errorLogger)
     : base(deviceSettings, protocol, errorLogger)
 {
     EnergyMargin = 0.01;
     HaveErrorRegisters = false;
 }
コード例 #7
0
        private void LoadDetails()
        {
            LoadSerialPort();
            XmlElement devices = GetElement("devices");
            if (devices == null)
                devices = AddElement(settings, "devices");

            deviceList = new ObservableCollection<DeviceManagerDeviceSettings>();

            foreach (XmlElement e in devices.ChildNodes)
            {
                if (e.Name == "device")
                {
                    DeviceManagerDeviceSettings device = new DeviceManagerDeviceSettings(ApplicationSettings, e, this);
                    deviceList.Add(device);
                }
            }
        }
コード例 #8
0
        public void DeleteDevice(DeviceManagerDeviceSettings delDev)
        {
            deviceList.Remove(delDev);

            XmlElement devices = GetElement("devices");
            if (devices == null || delDev == null)
                return;

            foreach (XmlNode child in devices.ChildNodes)
            {
                if (child.Name == "device")
                {
                    if (ElementHasChild(child, "address", delDev.Address.ToString())
                        && ElementHasChild(child, "id", delDev.Id.ToString()))
                    {
                        devices.RemoveChild(child);
                        ApplicationSettings.RefreshAllDevices();
                        SettingChangedEventHandler("");
                        return;
                    }
                }
            }
        }
コード例 #9
0
        public DeviceManagerDeviceSettings AddDevice()
        {
            XmlElement inverters = GetElement("devices");
            if (inverters == null)
                return null;
            XmlElement e = AddElement(inverters, "device");
            DeviceManagerDeviceSettings dev = new DeviceManagerDeviceSettings(ApplicationSettings, e, this);
            dev.Address = 0;
            dev.Name = "";
            dev.Id = DeviceListItems[0].Id;
            deviceList.Add(dev);
            ApplicationSettings.RefreshAllDevices();

            return dev;
        }
コード例 #10
0
 public ConsolidateDeviceSettings(ApplicationSettings root, XmlElement element, DeviceManagerDeviceSettings fromDevice)
     : base(root, element)
 {
     ApplicationSettings = root;
     ConsolidateFromDevice = fromDevice;
 }
コード例 #11
0
 public DeviceEventSettings(ApplicationSettings root, XmlElement element, DeviceManagerDeviceSettings device)
     : base(root, element)
 {
     ApplicationSettings = root;
     Device = device;
     if (_EventTypeList == null)
     {
         LoadEventTypeNameLists();
         DoPropertyChanged("EventTypeList");
     }
 }
コード例 #12
0
        internal bool CheckDeviceRecursion(DeviceManagerDeviceSettings device)
        {
            if (device == null)
                return false;
            if (device.Name == Name)
                return true;

            foreach (ConsolidateDeviceSettings consolSettings in device.ConsolidateToDevices)
            {
                DeviceManagerDeviceSettings listDevice = consolSettings.ConsolidateFromDevice;
                if (listDevice != null && listDevice.CheckDeviceRecursion(listDevice))
                    return true;
            }

            return false;
        }