Пример #1
0
 public ModbusChannelImp(string name, ModbusChannelImp ch)
     : base(name, false, ch.plugin, ch.Type)
 {
     this.modbusStation      = ch.modbusStation;
     this.modbusDataAddress  = ch.modbusDataAddress;
     this.modbusDataType     = ch.modbusDataType;
     this.modbusInternalType = ch.modbusInternalType;
     this.slaveId            = ch.slaveId;
     this.deviceDataType     = ch.deviceDataType;
     this.deviceDataLen      = ch.deviceDataLen;
     this.conversionType     = ch.conversionType;
     this.modbusReadWrite    = ch.modbusReadWrite;
     if (modbusReadWrite == ModbusReadWrite.ReadOnly)
     {
         this.readOnly = true;
     }
     this.BitIndex = ch.BitIndex;
     this.K        = ch.K;
     this.D        = ch.D;
 }
Пример #2
0
 public ModbusChannelImp(string name, Plugin plugin, Type type, string modbusStation, ModbusDataTypeEx modbusType, ushort modbusAddress,
                         byte slaveId, ModbusDeviceDataType deviceDataType, ushort deviceDataLen, ModbusConversionType conversionType, ModbusReadWrite modbusReadWrite)
     : base(name, false, plugin, type)
 {
     this.modbusStation     = modbusStation;
     this.modbusDataAddress = modbusAddress;
     this.modbusDataType    = modbusType;
     if (type == typeof(int))
     {
         modbusInternalType = ModbusFs2InternalType.Int32;
     }
     else if (type == typeof(uint))
     {
         modbusInternalType = ModbusFs2InternalType.UInt32;
     }
     else if (type == typeof(double))
     {
         modbusInternalType = ModbusFs2InternalType.Double;
     }
     else if (type == typeof(bool))
     {
         modbusInternalType = ModbusFs2InternalType.Boolean;
     }
     else if (type == typeof(string))
     {
         modbusInternalType = ModbusFs2InternalType.String;
     }
     this.slaveId         = slaveId;
     this.deviceDataType  = deviceDataType;
     this.deviceDataLen   = deviceDataLen;
     this.conversionType  = conversionType;
     this.modbusReadWrite = modbusReadWrite;
     if (modbusReadWrite == ModbusReadWrite.ReadOnly)
     {
         this.readOnly = true;
     }
     this.BitIndex = 0;
     this.K        = 1.0;
     this.D        = 0.0;
 }