Well, I do resent your idea that I'm trolling. I was sincere about seeing how you would approach the simulation.
I can wait until you cure your compatibility problem.
It's not that simple. The battery with a simple internal resistor will snap between the charging and non-charging voltage instantly. That is not what a battery does. After charging, the terminal voltage relaxes to a lower value over some time. Similarly, upon charging the terminal voltage does not rise to the desired value instantly. There is a time constant both ways. It is a chemical thing. Spice that. It makes a difference in your bang-bang switching.
The solar panel is more like a voltage-limited current source. When open circuited and at low light levels, it works very well as a light detector by reading its terminal voltage but it won't produce much current. At high insolation, it becomes a current source. This is not the same as sweeping the source from from 0 to 22V. When attached to a battery it becomes a variable current source depending on the amount of insolation. Spice that.
You really are in the dark on this, aren't you?
Insinuate that I am a troll again and I'll go away.