Let's talk about when to drop into the bars and when to sit upright on the trainer.
You train to race. So how do you train the muscle groups required to push power in an aero position on the bike for 2+ hours?
Sitting up in your bars on the trainer allows for 2 things: 1) more oxygen is able to get to your muscles in an upright vs horizontal position and 2) you're able to more easily activate your major glute muscles to push power and climb. But you're going to more than cross cancel any power gains from an upright position by reducing aerodynamics. So, how do you train to race?
Deciding when to ride in aero on the trainer is pretty straightforward. When in doubt, drop down into your TT position when you're in Z1-3, and ride upright when you're riding Z4-6 when you're looking to push big power. [Combined with riding outside] this will give you enough time developing the appropriate muscle groups and capabilities that you'll need to hold an aero position for long periods of time.
Most of the time you're only going to access Z4+ watts while climbing a hill in a race anyways, where the aerodynamic gains decrease exponentially with lower speeds.
As a general rule of thumb, once you go under 12 mph, the gains you get from being in aero are outweighed by the increased power and comfort of riding upright. So... train like your race. Endurance watts = aero. Big power = upright.