/// <summary> /// Base class of Meter /// </summary> /// <param name="simulator">Simulator associated with meter</param> /// <param name="name">Name of device</param> /// <param name="portNumber">Port number of device</param> protected ModbusMeterBase(PACSimulator simulator, string name, Int32 portNumber, byte unitId) { this.Simulator = simulator; this.Sampler = new Sampler(this); this.Device = ModbusFactory.CreateNewDevice(portNumber, unitId); this.Name = name; }
/// <summary> /// Setting device from XML content /// </summary> /// <param name="element"> /// XML content based on which, meters parameters should be set /// </param> public virtual void SetFromXML(XElement element) { var name = element.Attribute("Name").Value; var portNumber = Convert.ToInt32(element.Attribute("PortNumber").Value); var unitId = Convert.ToByte(element.Attribute("UnitId").Value); this.Name = name; this.Device = ModbusFactory.CreateNewDevice(portNumber, unitId); }