# user-defined a model to calculate rocof

Hello everyone! I want to define a model to calculate the rate of frequency or rocof, but I don't know how to realize the frequency deviation at this moment minus the frequency deviation at the previous moment.When I define the model, psse can get the frequency deviation at this time through speed (I), but I don't know how to get the deviation at the last time.Similarly, I don't know how to introduce the concept of time into the model. Can someone help me solve the problem? Thanks a lot