Reviewed PID calculation with Long and Period value