I don't know what value i is.
Assuming you want to put the code here:
status->amotion = cap_value(amotion,pc_maxaspd(sd),2000);
Then adding below something like...
if (sc->data[SC_EDP]) {
if (sc->data[SC_EDP]->val1 == 5)
status->amotion = cap_value(amotion,pc_maxaspd(sd)+20,2000);
else if (sc->data[SC_EDP]->val1 == 4)
status->amotion = cap_value(amotion,pc_maxaspd(sd)+10,2000);
}
should do the trick.