Unable to create a script which optimises the orientation of buildings for solar gain

I’ve been trying to utilise existing scripts to optimise the orientation of my 5 terraced houses to optimise how much sun they would get. I wanted it to be shown with visual graphs, as its for an assignment regarding passive housing.
Please let me know if any of y’all can help. Ive attached a thumbnail of the 5 rowhouses.

Here is the definition with internalised data. Was unable to attach the file above.
Link to Definition