The smell of ammonia comes from nitrates in urine. Nitrates have a lot of nitrogen. This nitrogen binds with hydrogen to form ammonia. The diluted urine does not smell. When you are dehydrated, the urine becomes concentrated and the smell of ammonia is noticeable.
Another source of ammonia is urea in urine, which in acidic pH breaks down to ammonia. Some bacteria in urine too break urea into ammonia. You could be having urine infection with the bacteria breaking the urea into ammonia.
I think you should consult your doctor and get the urine examined for infection, ketones etc. Hope this helps. Please let me know if there is any thing else and do keep me posted.