void rqQueryHeatsinkTemperature_onValueReceived(object sender, MeasuredValuesEventArgs ev)
        {
            RQQueryHeatsinkTemperature query  = (RQQueryHeatsinkTemperature)sender;
            double Heatsink_Temperature_Left  = query.doubleValues[0];                                                                                                                                             // "Heatsink_Temperature_Left"
            double Heatsink_Temperature_Right = query.doubleValues[1];                                                                                                                                             // "Heatsink_Temperature_Right"

            if (Heatsink_Temperature_Left != prev_Heatsink_Temperature_Left || Heatsink_Temperature_Right != prev_Heatsink_Temperature_Right || (DateTime.Now - lastSentHeatsink_Temperature).TotalSeconds > 5.0d) // force send every 5 sec
            {
                //Tracer.Trace("Heatsink Temperature=" + Heatsink_Temperature_Left + "   " + Heatsink_Temperature_Right);
                prev_Heatsink_Temperature_Left  = Heatsink_Temperature_Left;
                prev_Heatsink_Temperature_Right = Heatsink_Temperature_Right;

                if (onValueReceived_HeatsinkTemperature != null)
                {
                    ev.timestamp = query.whenReceivedTicks;
                    ev.value1    = Heatsink_Temperature_Left;
                    ev.value2    = Heatsink_Temperature_Right;
                    onValueReceived_HeatsinkTemperature(this, ev);
                }
            }
        }
        private DateTime querySetLastSent = DateTime.MinValue; // when we last sent from m_querySet

        #endregion Fields

        #region Constructors

        public ControllerRQAX2850(string portName)
        {
            Tracer.Trace("ControllerRQAX2850(" + portName + ")");

            m_portName = portName;

            m_queues[0] = m_commandQueue = new RQInteractionQueue("command", 3);    // highest priority factor
            m_queues[1] = m_commandPowerLeftQueue = new RQMotorCommandQueue("commandPowerLeft");    // one-slot queue; must be "equalized" with the m_commandPowerRightQueue in terms of processing order. PriorityFactor = 2;
            m_queues[2] = m_commandPowerRightQueue = new RQMotorCommandQueue("commandPowerRight");
            m_queues[3] = m_queryQueue = new RQInteractionQueue("query", 1);        // lowest priority factor

            RQQuery rqQueryEncoderSpeed = new RQQueryEncoderSpeed(m_measuredValues);
            rqQueryEncoderSpeed.onValueReceived += new OnValueReceived(rqQueryEncoderSpeed_onValueReceived);
            m_querySet.Add(rqQueryEncoderSpeed);
            m_querySetShort.Add(rqQueryEncoderSpeed);

            RQQuery rqQueryEncoderLeftAbsolute = new RQQueryEncoderLeftAbsolute(m_measuredValues);
            rqQueryEncoderLeftAbsolute.onValueReceived += new OnValueReceived(rqQueryEncoderLeftAbsolute_onValueReceived);
            m_querySet.Add(rqQueryEncoderLeftAbsolute);
            m_querySetShort.Add(rqQueryEncoderLeftAbsolute);

            RQQuery rqQueryEncoderRightAbsolute = new RQQueryEncoderRightAbsolute(m_measuredValues);
            rqQueryEncoderRightAbsolute.onValueReceived += new OnValueReceived(rqQueryEncoderRightAbsolute_onValueReceived);
            m_querySet.Add(rqQueryEncoderRightAbsolute);
            m_querySetShort.Add(rqQueryEncoderRightAbsolute);

            RQQuery rqQueryAnalogInputs = new RQQueryAnalogInputs(m_measuredValues);
            rqQueryAnalogInputs.onValueReceived += new OnValueReceived(rqQueryAnalogInputs_onValueReceived);
            m_querySet.Add(rqQueryAnalogInputs);

            RQQuery rqQueryDigitalInputs = new RQQueryDigitalInputs(m_measuredValues);
            rqQueryDigitalInputs.onValueReceived += new OnValueReceived(rqQueryDigitalInputs_onValueReceived);
            m_querySet.Add(rqQueryDigitalInputs);
            m_querySetShort.Add(rqQueryDigitalInputs);  // whiskers are in priority queue

            RQQuery rqQueryHeatsinkTemperature = new RQQueryHeatsinkTemperature(m_measuredValues);
            rqQueryHeatsinkTemperature.onValueReceived += new OnValueReceived(rqQueryHeatsinkTemperature_onValueReceived);
            m_querySet.Add(rqQueryHeatsinkTemperature);

            RQQuery rqQueryMotorAmps = new RQQueryMotorAmps(m_measuredValues);
            rqQueryMotorAmps.onValueReceived += new OnValueReceived(rqQueryMotorAmps_onValueReceived);
            m_querySet.Add(rqQueryMotorAmps);

            RQQuery rqueryMotorPower = new RQQueryMotorPower(m_measuredValues);
            rqueryMotorPower.onValueReceived += new OnValueReceived(rqueryMotorPower_onValueReceived);
            m_querySet.Add(rqueryMotorPower);

            RQQuery rqQueryVoltage = new RQQueryVoltage(m_measuredValues);
            rqQueryVoltage.onValueReceived += new OnValueReceived(rqQueryVoltage_onValueReceived);
            m_querySet.Add(rqQueryVoltage);

            foreach (RQQuery query in m_querySet)
            {
                foreach(string vName in query.ValueNames)
                {
                    m_loggedValueNames.Add(vName);
                }
            }

            isUnknownState = true;
            isInError = false;

            //startMonitoringThread();
        }
        public ControllerRQAX2850(string portName)
        {
            Tracer.Trace("ControllerRQAX2850(" + portName + ")");

            m_portName = portName;

            m_queues[0] = m_commandQueue = new RQInteractionQueue("command", 3);                 // highest priority factor
            m_queues[1] = m_commandPowerLeftQueue = new RQMotorCommandQueue("commandPowerLeft"); // one-slot queue; must be "equalized" with the m_commandPowerRightQueue in terms of processing order. PriorityFactor = 2;
            m_queues[2] = m_commandPowerRightQueue = new RQMotorCommandQueue("commandPowerRight");
            m_queues[3] = m_queryQueue = new RQInteractionQueue("query", 1);                     // lowest priority factor

            RQQuery rqQueryEncoderSpeed = new RQQueryEncoderSpeed(m_measuredValues);

            rqQueryEncoderSpeed.onValueReceived += new OnValueReceived(rqQueryEncoderSpeed_onValueReceived);
            m_querySet.Add(rqQueryEncoderSpeed);
            m_querySetShort.Add(rqQueryEncoderSpeed);

            RQQuery rqQueryEncoderLeftAbsolute = new RQQueryEncoderLeftAbsolute(m_measuredValues);

            rqQueryEncoderLeftAbsolute.onValueReceived += new OnValueReceived(rqQueryEncoderLeftAbsolute_onValueReceived);
            m_querySet.Add(rqQueryEncoderLeftAbsolute);
            m_querySetShort.Add(rqQueryEncoderLeftAbsolute);

            RQQuery rqQueryEncoderRightAbsolute = new RQQueryEncoderRightAbsolute(m_measuredValues);

            rqQueryEncoderRightAbsolute.onValueReceived += new OnValueReceived(rqQueryEncoderRightAbsolute_onValueReceived);
            m_querySet.Add(rqQueryEncoderRightAbsolute);
            m_querySetShort.Add(rqQueryEncoderRightAbsolute);

            RQQuery rqQueryAnalogInputs = new RQQueryAnalogInputs(m_measuredValues);

            rqQueryAnalogInputs.onValueReceived += new OnValueReceived(rqQueryAnalogInputs_onValueReceived);
            m_querySet.Add(rqQueryAnalogInputs);

            RQQuery rqQueryDigitalInputs = new RQQueryDigitalInputs(m_measuredValues);

            rqQueryDigitalInputs.onValueReceived += new OnValueReceived(rqQueryDigitalInputs_onValueReceived);
            m_querySet.Add(rqQueryDigitalInputs);
            m_querySetShort.Add(rqQueryDigitalInputs);  // whiskers are in priority queue

            RQQuery rqQueryHeatsinkTemperature = new RQQueryHeatsinkTemperature(m_measuredValues);

            rqQueryHeatsinkTemperature.onValueReceived += new OnValueReceived(rqQueryHeatsinkTemperature_onValueReceived);
            m_querySet.Add(rqQueryHeatsinkTemperature);

            RQQuery rqQueryMotorAmps = new RQQueryMotorAmps(m_measuredValues);

            rqQueryMotorAmps.onValueReceived += new OnValueReceived(rqQueryMotorAmps_onValueReceived);
            m_querySet.Add(rqQueryMotorAmps);

            RQQuery rqueryMotorPower = new RQQueryMotorPower(m_measuredValues);

            rqueryMotorPower.onValueReceived += new OnValueReceived(rqueryMotorPower_onValueReceived);
            m_querySet.Add(rqueryMotorPower);

            RQQuery rqQueryVoltage = new RQQueryVoltage(m_measuredValues);

            rqQueryVoltage.onValueReceived += new OnValueReceived(rqQueryVoltage_onValueReceived);
            m_querySet.Add(rqQueryVoltage);

            foreach (RQQuery query in m_querySet)
            {
                foreach (string vName in query.ValueNames)
                {
                    m_loggedValueNames.Add(vName);
                }
            }

            isUnknownState = true;
            isInError      = false;

            //startMonitoringThread();
        }