Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    BSEC library design seems to prohibit multiple instances within one process

    BSEC library design seems to prohibit multiple instances within one process

    mkaiser
    New Poster

    hi folks,

    I am not sure, if my approach is a good one, or if I simply do not fully understand how things work, yet. It would be great, if you could give me some hints to get it working 🙂


    In my use case I want to calculate the iAQ values of multiple BME680 sensors on a RaspberryPi or x86. The sensors are running on very low end Arduinos (328p) and send the raw data to the x86/RPi.

    For this, I created an array of multiple BSEC objects, which I feed whenever new raw data arrive from the sensors:

    My_BSEC bsec[2];      // Array of My_BSEC, a class wrapping and managing the bsec functions (e.g. bsec_set_configuration, bsec_update_subscription, bsec_sensor_control, bsec_do_steps, ...)
    
    bsec[bsecId].calculateData(input);   // one sensor is fed with new data


    With following input:

    bsec[0].calculateData(F105C79AB0000014279641C1DE6847DB23704231A17048); // sensor one is fed with new data
    bsec[1].calculateData(F105C79AB0000014279641C1DE6847DB23704231A17049); // sensor two is fed with slightly different data, but the same timestamp


    ... BSEC returns warning 4 

    // from bsec_datatypes.h: BSEC_W_DOSTEPS_TSINTRADIFFOUTOFRANGE = 4, /*!< Duplicate timestamps passed to bsec_do_steps() */)

     

    This indicates, that altough there are two separate instances of My_BSEC in my code, the same bsec data structures are used in the background/ external library. The BSEC library has only one context.

    Am I mistaken or is this wanted or expected behaviour?
    Some code is attached (sorry for using the Qt framwork, it is not really a minimal example)

    Best Regards,

    Martin

    3 REPLIES 3

    MightyNate
    Member

    I guess you are right with the assumption that there is only one underlying data instance.

    But simply feeding in the raw data of each sensor with a different unique timestamp should be an easy workaround.

    BSTRobin
    Community Moderator
    Community Moderator

    Hello MightyNate,

    Currently, BSEC algorithm only supported to analyse one sensor data. On SW driver side, you could read different sensors's data via I2C or SPI.
    The algorithm needs to continuously analyze the data, which takes some time. It is suggested that the same instances analyze the data of one sensor.

    hi, 

    thank you both for your replies. I guess I will stick to the one process one sensor approach / workaround 😕

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist