Advanced capstone

Can someone please help me with the 2.4 question.

**2.4. Augment .f1.checkSensor to check if the mysensor parameter has received one of
the acceptable options and do:**

  

Hi  what problem / error are you seeing? I can better advise if you explain what you have tried or add a code snippet and some screenshots of any errors.

.f1.checkSensor:{[raceTab;lapTab;mysensor]dict:temptyrewindall!(“temp*”;“tyre*”;“wind*”;“*e*”);if[0b=mysensor in dict;.Q.trp[{ `$(mysensor)," is not a valid option for mysensor - valid options include `temp`tyre`wind`all" }]];benchmark: ?[lapTab;enlist(like;`sensorId;dict[mysensor])enlist[`sensorId]!enlist(`sensorId);enlist[`benchmarkValue]!enlist(avg;`sensorValue)];chk: ?[raceTab;enlist(like;`sensorId;dict[mysensor]);enlist[`sensorId]!enlist(`sensorId);`avgValue`stdDevValue!((avg;`sensorValue);(dev;`sensorValue))];chk: update diffValue:“F”$.Q.f’[5;abs[benchmarkValue-avgValue]] from benchmark lj chk;chk: update diffFlag:?[(diffValue>1);0b;1b], stdFlag:?[(stdDevValue>1.5);0b;1b] from chk;chk}

 

This is what I have done. Just added if and .Q.trp function to the 2.3 function.

Hi   this looks great - just possibly one missing ; in your line defining benchmark - see end of second parameter

You have:

benchmark: ?[lapTab; enlist(like;sensorId;dict[mysensor]) enlist[sensorId]!enlist(sensorId); enlist[benchmarkValue]!enlist(avg;`sensorValue)];

versus

benchmark: ?[lapTab; enlist(like;sensorId;dict[mysensor]); enlist[sensorId]!enlist(sensorId); enlist[benchmarkValue]!enlist(avg;`sensorValue)];

 

Did your logic for input validation work? i.e temperature throws error? I am struggling with the logic