public ModbusRequest(byte[] data, ModbusTCPServer server)
 {
     TransactionId = UnpackUInt16(data, 0);
     ProtocolId    = UnpackUInt16(data, 2);
     Length        = UnpackUInt16(data, 4);
     UnitId        = data[6];
     FunctionCode  = (EModbusFunctionCode)data[7];
     this.server   = server;
 }
Beispiel #2
0
 public Simulator()
 {
     modbusServer = new ModbusTCPServer();
     modbusServer.Subscribe(this);
     stopSignal = new ManualResetEvent(false);
     analogs    = new Dictionary <long, Analog>();
     discretes  = new Dictionary <long, Discrete>();
     readWriteMeasurementAddresses = new HashSet <int>();
     commands        = new ConcurrentQueue <CommandParams>();
     modelLock       = new ReaderWriterLockSlim();
     client          = new DuplexClient <ISubscribing, IPubSubClient>("callbackEndpoint", this);
     reclosers       = new List <Tuple <Recloser, long, long, int> >();
     loadProfiles    = DailyLoadProfile.LoadFromXML("Daily_load_profiles.xml");
     energyConsumers = new Dictionary <long, EnergyConsumer>();
 }
 public ReadInputRegistersRequest(byte[] data, ModbusTCPServer server) : base(data, server)
 {
     Address  = UnpackUInt16(data, 8);
     Quantity = UnpackUInt16(data, 10);
 }
Beispiel #4
0
 public WriteSingleRegisterRequest(byte[] data, ModbusTCPServer server) : base(data, server)
 {
     Address = UnpackUInt16(data, 8);
     Value   = UnpackUInt16(data, 10);
 }