The Heaviside function
y = 1 for x > 0
y = 0 for x < 0
doesn't have a derivative at 0. Therefore, it can't be used in a stochastic model splved by local (first or second order) approximation.
In deterministic model, Dynare may be able to compute a traectory, but there is no guarantee....
In general, you can define any function in a separate *.m file and call it from inside a Dynare *.mod file. But, again, for non trivial functions, it is your responsibility that you can apply local approximation if you work with a stochastic model.
Kind regards
Michel