Ejemplo n.º 1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            //Load Config
            DAQConfiguration _daqConfig = (DAQConfiguration)ConfigHandler.LoadConfig(ConfigType.DAQConfig, "DAQConfig.json");
            TransmitterArrayConfiguration _transmitterArrayConfig = (TransmitterArrayConfiguration)ConfigHandler.LoadConfig(ConfigType.TransmitterConfig, "TransmitterConfig.json");

            //DAQ
            IDaq _daq = new CommonDAQ(_daqConfig);

            //transmitter array
            TransmitterArray _transmitterArray = new TransmitterArray(_transmitterArrayConfig, _daq);

            //or poller
            Poller _poller = new Poller(_transmitterArray);

            _poller.SetSamplingRate(1000);

            _poller.Start();

            _poller.OnDataUpdated += _poller_OnDataUpdated1;

            while (true)
            {
                //Tuple<DateTime, List<TransmitterData>> dataPacket = _transmitterArray.PollAll();
                //Console.WriteLine( "Data: " + dataPacket.Item1.ToString( "yyyy-mm-dd HH:mm:ffff" ) );

                //foreach( TransmitterData a in dataPacket.Item2 )
                //{
                //  Console.WriteLine( a.ID + " " + a.Value );
                //}

                Console.ReadLine();
            }
        }
Ejemplo n.º 2
0
        private double[] retVal; //= new double[NUM_OF_CHANNEL];

        public CommonDAQ(DAQConfiguration config)
        {
            _config = config;
            _modbus = new Modbus();
            values  = new short[_config.NumberOfChannel + _config.StartAddress];
            retVal  = new double[_config.NumberOfChannel];
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            DAQConfiguration _daqConfig = new DAQConfiguration();

            _daqConfig.BaudRate = 100;
            TransmitterArrayConfiguration _transmitterConfig = new TransmitterArrayConfiguration();

            _transmitterConfig.Transmitters.Add(new TransmitterConfiguration()
            {
                ChannelAddress = 1, EngineeringUnit = "celcius", Name = "tempSensor", Equation = "10*X"
            });
            _transmitterConfig.Transmitters.Add(new TransmitterConfiguration()
            {
                ChannelAddress = 2, EngineeringUnit = "bar", Name = "pressSensor", Equation = "12*X"
            });

            ConfigHandler.SaveConfig(_transmitterConfig, "testconfigSensor.json");
        }