clipC = Compile[{{x, _Real, 1}, {bounds, _Real, 1}},
Table[Max[Min[i, bounds[[2]]], bounds[[1]]], {i, x}]
];
demC = With[{clip = clipC, Vf = 100, cap = 2500},
Compile[{{a, _Real, 0}, {p1, _Real, 1}, {p2, _Real, 1}},
clip[(clip[p1 Vf, {0, a cap}] - p2), {0, a cap}],
Parallelization -> True, RuntimeAttributes -> {Listable},
CompilationOptions -> {"InlineCompiledFunctions" -> True}]
]