KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums KX Academy Advanced Capstone 2.3

  • Advanced Capstone 2.3

    Posted by anduhau on October 30, 2023 at 12:00 am

    Hello! I have checked previous posts on this question, but still have not managed to figure out the issue, as I get the mismatched type error on the function and 3/4 tests failed. My guess is that the error is due to the wrong datatype for the 3rd sensor parameter, but I worked both with symbol and string and got the same error (a screenshot of the code and error is attached – the whole code can be seen inside the spoiler tag).

     

    .f1.checkSensor{[raceTab; lapTab; mySensor]     
            sensorFilter:`temp`tyre`wind`all!("temp*";"tyre*";"wind*";"*e*");     
            // Get avg benchmark values from historical lap data     
            benchmark: ?[lapTab;                 
                        enlist(in;`sensorId;(sensorFilter;enlist mysensor));                 
                        (enlist `sensorId)!enlist `sensorId;                 
                        (enlist `benchmarkValue)!enlist (avg;`sensorValue)];     
            chk: ?[raceTab;             
                    (enlist(in;`sensorId;(sensorFilter;enlist mysensor)));             
                    (enlist `sensorId)! enlist `sensorId;             
                    `avgValue`stdDevValue!((avg;`sensorValue);(dev;`sensorValue))];          
            // Join historical benchmarks to new data and calculate diff      
            chk:update diffValue:"F"$.Q.f'[5;abs[benchmarkValue-avgValue]]          
                   from benchmark lj chk;     
           // Add flags if difference between old vs new data >1 and if standard deviation>1.5     
            chk:update diffFlag:?[(diffValue>1);0b;1b],                
                     stdFlag:?[(stdDevValue>1.5);0b;1b]         
                from chk;     
            chk     
    }

     

     

    anduhau replied 9 months, 3 weeks ago 2 Members · 2 Replies
  • 2 Replies
  • Laura

    Administrator
    October 30, 2023 at 12:00 am

    Hi  ,

    Are you running this within the markdown file itself?

    I would suggest copying your code into the scratchpad as you’re able to run the code line-by-line and see more clearly what is going wrong.

    When you click the “play” button under the code blocks in the markdown file, it is running the entire code block, so you are not able to pinpoint which line is breaking.

    Let me know how you get on.

    Laura

  • anduhau

    Member
    October 30, 2023 at 12:00 am

    Thank you for your help!! I have figured it out and the tests for 2.3 and 2.4 work

Log in to reply.