Algorithm

If you want to track solar, I would just assume that you want to position an array of solar panels.

Rather than trying to reverse engineer a script to an algorithm, that you want to modify anyway, it would be better if you provide an algorithm of what you want.

What do you want to do?
What equipment (hardware) do you already have for the project, and what will be needed?

It could be a rewarding project.