These questions are best answered by inspecting the code for the simulation, which will explicitly show the built in assumptions:
That said, quick answers to your questions are:
No, you can only say what you want the charge to be at the next time step. If it is greater than the current charge, the battery charges. If it is less than the current charge the battery discharges.
Energy can only be sold to the grid if there is a net surplus when balancing consumption and production (directly from PV or from the battery).
Yes, that is correct.
As you will see in the code, you can only control what you want the future state of the battery to be. For this task, you do not have any other explicit controls over the system.
You said that “Energy can only be sold to the grid if there is a net surplus when balancing consumption and production (directly from PV or from the battery)”
So if (production > consumption), we can sell energy from PV or battery to the grid? what if (production + battery > consumption)?
Again, this is explicitly calculated in the code so look there when you need answers. As mentioned, you can only change the battery state. You cannot decide when to buy or sell so the answers to the questions are built into the problem, and these are not decisions that can be made by a given solution. I recommend you review that code and then come back if there are questions.
As stated above:
Energy can only be sold to the grid if there is a net surplus when balancing consumption and production (directly from PV or from the battery).
Production is from PV and discharging the battery, and there must be a net surplus.