The role of storage and flexibility in the energy transition: Substitution effect of resources with application to the Portuguese electricity system | Synapse