VAM 30" datafield

Good morning, I ask if you can create a IQ data field named VAM 30" (for Fenix3 and epix) which, based on the barometric altimeter (no GPS) value, simply calculating the altitude difference between the current time and the recorded value of 30" before and multiply by 120. (this is different from the native "vertical speed datafield" which calculates the average vertical speed of a period of few seconds and it works "with steps" (returning the same value for some seconds): I need a result calculated every second.
I created an app very functional for my Suunto (Result = altitude tail [30 "] * 120) m / h, with a valid result for both uphill and downhill, but I'm not able to use the SDK language: anyone want to try? Thanks a lot!
  • based on the barometric altimeter (no GPS) value


    There is currently no way to disambiguate between altitude information from the GPS and that from the barometric altimeter. Other than that, it would not be difficult to implement this at all. I just want to make sure you understand the limitations.
  • Ok no problem I can test it and eventually disable continuos calibration on my F3.
    One idea, could be to use a formula which mediates some value for have a better stability of result: on Suunto, I used a formula which mediates between the last 20 seconds, 30 seconds and 40 seconds difference of altitude...(Result = (altitude difference [20"]*180 + altitude difference [30"]*120 + altitude difference [40]*90)/3 ); could you create a datafield like this for me?
    Thank you very mutch!
  • Yes, that would be pretty easy as well.
  • Just so I understand what you are asking for, it seems you are trying to get rate of climb over the last 30 seconds, but you want it extrapolated over an hour? e.g., if you climb 15m in 30s, you want it to display 1800m/h?

    I think it is also worth noting that that this proposed data field is still subject to the limitations of the environment. If the elevation data is only updated once every 5 seconds, that is what you get. There is nothing that can be done to increase the sampling rate.

    Travis
  • The following code seems to work well in the simulator. I haven't tried it on a device yet.

    using Toybox.WatchUi as Ui;

    class ClimbRateView extends Ui.SimpleDataField {

    hidden var mSamples;
    hidden var mSampleIdx;

    function initialize() {
    SimpleDataField.initialize();
    label = "VAM 30\"";
    }

    function compute(info) {

    if (info.altitude == null) {
    return "--";
    }

    if (mSamples == null) {
    mSamples = new [ 40 ];
    mSampleIdx = 0;

    for (var i = 0; i < mSamples.size(); ++i) {
    mSamples= info.altitude;
    }
    }

    // samples from 20, 30 and 40 seconds back
    var pos20s = (mSampleIdx + 20) % 40;
    var pos30s = (mSampleIdx + 10) % 40;
    var pos40s = (mSampleIdx + 0) % 40;

    var delta20s = (mSamples[pos20s] - info.altitude) * 180;
    var delta30s = (mSamples[pos30s] - info.altitude) * 120;
    var delta40s = (mSamples[pos40s] - info.altitude) * 90;

    // overwrite the oldest sample now that we've read it
    mSamples[mSampleIdx] = info.altitude;

    // update index for next write
    mSampleIdx = (mSampleIdx + 1) % mSamples.size();

    // average of the delta values
    return (delta20s + delta30s + delta40s) / 3.0;
    }
    }
    [/code]
  • Just so I understand what you are asking for, it seems you are trying to get rate of climb over the last 30 seconds, but you want it extrapolated over an hour? e.g., if you climb 15m in 30s, you want it to display 1800m/h?

    I think it is also worth noting that that this proposed data field is still subject to the limitations of the environment. If the elevation data is only updated once every 5 seconds, that is what you get. There is nothing that can be done to increase the sampling rate.

    Travis


    Yes perfect if I climb up/down 15 m in last 30s, I want to display +/- 1800m/h (this is the tipical and very useful VAM 30" datafield in forerunner 910xt)
    No problem if the result is update every 5sec, important is not to be updated every 15/20s like the vertical speed datafield of Fenix3 / Epix.

    I have read your algorithm: excellent, although for me it's like Arabic :confused: :o :D . If you send me the instructions and files to be installed on the Fenix 3 and on Epix, I could physically test it on both devices ...

    Thank you very mutch!
  • I think this one is closer to what you want. I'll PM you to get an e-mail address to test binaries.

    using Toybox.WatchUi as Ui;
    using Toybox.System as Sys;

    class ClimbRate
    {
    hidden var samples;
    hidden var sample_idx;

    hidden var sum_neg;
    hidden var sum_pos;

    function initialize(count) {
    samples = new [ count ];
    sample_idx = 0;
    for (var i = 0; i < samples.size(); ++i) {
    samples= 0.0;
    }

    sum_pos = 0.0;
    sum_neg = 0.0;
    }

    function add_sample(sample) {

    // store the sample
    samples[sample_idx] = sample;

    // calculate the positive/negative sums
    sum_pos = 0.0;
    sum_neg = 0.0;
    for (var i = 0; i < samples.size(); ++i) {
    if (samples< 0) {
    sum_neg += samples;
    }
    else {
    sum_pos += samples;
    }
    }

    // advance to the next storage location
    sample_idx = (sample_idx + 1) % samples.size();
    }

    function ascent() {
    return sum_pos;
    }

    function descent() {
    return sum_neg;
    }
    }

    class ClimbRateView extends Ui.SimpleDataField {

    hidden var rate20s;
    hidden var rate30s;
    hidden var rate40s;

    hidden var m_prev;

    function initialize() {
    SimpleDataField.initialize();
    label = "VAM 30\"";

    rate20s = new ClimbRate(20);
    rate30s = new ClimbRate(30);
    rate40s = new ClimbRate(40);
    }

    function compute(info) {

    if (info.altitude == null) {
    return "--";
    }

    if (m_prev == null) {
    m_prev = info.altitude;
    }

    // calculate the delta since the previous call
    var delta = info.altitude - m_prev;
    m_prev = info.altitude;

    // this is the expensive part, adding the sample and creating
    // the sums of all of the values
    rate20s.add_sample(delta);
    rate30s.add_sample(delta);
    rate40s.add_sample(delta);

    var ascent20s = rate20s.ascent() * 180;
    var ascent30s = rate30s.ascent() * 120;
    var ascent40s = rate40s.ascent() * 90;

    // average of the delta values
    return (ascent20s + ascent30s + ascent40s) / 3.0;
    }
    }
    [/code]
  • I would be interested in this data field as well. Did you publish it eventually?
  • Hello Travis,

    I have the same question just a year later. Have you posted it? so far I could not find any 30 sec vertical speed data field displayed in m/h.

    On my 910XT there is a native one, but on my Fenix 3HR only the instant vertical speed with no use for me.