This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

missing pulse detectar

i must have the code for detecting a missin g pulse?
do some one have some for me to see?

Parents
  • I stand corrected. Will try to redeem myself.

    // \note The following library is dependant on the current
    // geographical location (latitude + longitude +
    // distance from the mean earth radius) moon
    // location, speed and travel direction, and sensor
    // orientation, since the g pulse
    // detector is calibrated relative to the local
    // gravitational levels (and influences of coriolis
    // forces) at the sensor location.
    // \todo A laser gyro and GPS tracker should be integrated
    // for automatic adjustments of the reference limits
    // for the g pulse sensor, and to allow detect failures
    // to be reported in relation to the GPS reference time.
    // \note Calibration or orientation differences between
    // G and H pulse sensors will affect the reliability of
    // the error detector. The H pulse detector should normally
    // be calibrated with a higher detect level (percentage
    // depending on current security classification) to
    // make sure that a too sensitive H pulse sensor generates
    // alarms when the G pulses are just below the detection
    // levels.
    bool have_seen_g_pulse;
    bool any_g_missing;
    bool last_g_missing;
    unsigned detector_timeout;
    timestamp time_last_failure;
    timestamp time_first_failure;
    
    void init(void) {
        // Initialized to true even if no G pulse seen yet,
        // to make sure we don't get a false error in case
        // the supervision is started between a G and an H
        // pulse.
        have_seen_g_pulse = true;
        any_g_missing = false;
        last_g_missing = false;
        comm_failure = false;
        detector_timeout = get_now() + COM_FAILURE_TMO;
        clear_timestamp(time_first_failure);
        clear_timestamp(time_last_failure);
    }
    
    void report_g_pulse(void) {
        if (detector_timeout()) {
            if (!any_g_missing) {
                get_timestamp(time_first_g_missing);
            }
            get_timestamp(time_last_g_missing);
            last_g_msising = true;
            any_g_missing = true;
        }
        have_seen_g_pulse = true;
        last_g_missing = false;
        detector_timeout = get_now() + COM_FAILURE_TMO;
    }
    
    void report_h_pulse(void) {
        if (!have_seen_g_pulse || detector_timeout()) {
            // Since everyone knows that H always follows G,
            // a detect of H without a G implies a lost
            // G.
            if (!any_g_missing) {
                get_timestamp(time_first_g_missing);
            }
            get_timestamp(time_last_g_missing);
            last_g_msising = true;
            any_g_missing = true;
        }
        // Arm detector.
        have_seen_g_pulse = false;
        detector_timeout = get_now() + COM_FAILURE_TMO;
        comm_failure = false;
    }
    
    bool detector_timeout() {
        return get_now() > detector_timeout;
    }
    
    bool have_mmissed_last_g_pulse(timestamp* when) {
        if (last_g_missing) {
            if (when) *when = time_last_g_missing;
            return true;
        }
        if (detector_timeout()) {
            if (!any_g_missing) {
                get_timestamp(time_first_g_missing);
                any_g_missing = true;
            }
            get_timestamp(time_last_g_missing);
            last_g_missing = true;
            comm_failure = true;
            if (when) *when = time_last_g_missing;
            return true;
        }
        return false;
    }
    
    bool have_missed_any_g_pulse() {
        if (any_g_missing) {
            if (when) *when = time_last_g_missing;
            return true;
        }
        if (detector_timeout()) {
            if (!any_g_missing) {
                get_timestamp(time_first_g_missing);
                any_g_missing = true;
            }
            get_timestamp(time_last_g_missing);
            last_g_missing = true;
            comm_failure = true;
            if (when) *when = time_last_g_missing;
            return true;
        }
        return false;
    }
    

Reply
  • I stand corrected. Will try to redeem myself.

    // \note The following library is dependant on the current
    // geographical location (latitude + longitude +
    // distance from the mean earth radius) moon
    // location, speed and travel direction, and sensor
    // orientation, since the g pulse
    // detector is calibrated relative to the local
    // gravitational levels (and influences of coriolis
    // forces) at the sensor location.
    // \todo A laser gyro and GPS tracker should be integrated
    // for automatic adjustments of the reference limits
    // for the g pulse sensor, and to allow detect failures
    // to be reported in relation to the GPS reference time.
    // \note Calibration or orientation differences between
    // G and H pulse sensors will affect the reliability of
    // the error detector. The H pulse detector should normally
    // be calibrated with a higher detect level (percentage
    // depending on current security classification) to
    // make sure that a too sensitive H pulse sensor generates
    // alarms when the G pulses are just below the detection
    // levels.
    bool have_seen_g_pulse;
    bool any_g_missing;
    bool last_g_missing;
    unsigned detector_timeout;
    timestamp time_last_failure;
    timestamp time_first_failure;
    
    void init(void) {
        // Initialized to true even if no G pulse seen yet,
        // to make sure we don't get a false error in case
        // the supervision is started between a G and an H
        // pulse.
        have_seen_g_pulse = true;
        any_g_missing = false;
        last_g_missing = false;
        comm_failure = false;
        detector_timeout = get_now() + COM_FAILURE_TMO;
        clear_timestamp(time_first_failure);
        clear_timestamp(time_last_failure);
    }
    
    void report_g_pulse(void) {
        if (detector_timeout()) {
            if (!any_g_missing) {
                get_timestamp(time_first_g_missing);
            }
            get_timestamp(time_last_g_missing);
            last_g_msising = true;
            any_g_missing = true;
        }
        have_seen_g_pulse = true;
        last_g_missing = false;
        detector_timeout = get_now() + COM_FAILURE_TMO;
    }
    
    void report_h_pulse(void) {
        if (!have_seen_g_pulse || detector_timeout()) {
            // Since everyone knows that H always follows G,
            // a detect of H without a G implies a lost
            // G.
            if (!any_g_missing) {
                get_timestamp(time_first_g_missing);
            }
            get_timestamp(time_last_g_missing);
            last_g_msising = true;
            any_g_missing = true;
        }
        // Arm detector.
        have_seen_g_pulse = false;
        detector_timeout = get_now() + COM_FAILURE_TMO;
        comm_failure = false;
    }
    
    bool detector_timeout() {
        return get_now() > detector_timeout;
    }
    
    bool have_mmissed_last_g_pulse(timestamp* when) {
        if (last_g_missing) {
            if (when) *when = time_last_g_missing;
            return true;
        }
        if (detector_timeout()) {
            if (!any_g_missing) {
                get_timestamp(time_first_g_missing);
                any_g_missing = true;
            }
            get_timestamp(time_last_g_missing);
            last_g_missing = true;
            comm_failure = true;
            if (when) *when = time_last_g_missing;
            return true;
        }
        return false;
    }
    
    bool have_missed_any_g_pulse() {
        if (any_g_missing) {
            if (when) *when = time_last_g_missing;
            return true;
        }
        if (detector_timeout()) {
            if (!any_g_missing) {
                get_timestamp(time_first_g_missing);
                any_g_missing = true;
            }
            get_timestamp(time_last_g_missing);
            last_g_missing = true;
            comm_failure = true;
            if (when) *when = time_last_g_missing;
            return true;
        }
        return false;
    }
    

Children