This paper introduces three novel approaches to size geothermal energy piles in a MILP, offering fresh perspectives and potential solutions. The research overlooks MILP models that incorporate the sizing of a geothermal borefield. Therefore, this paper presents a new model utilizing a g-function model to regulate the power limits. Geothermal energy is an essential renewable source, particularly for heating and cooling. Complex energy systems, with their diverse sources of heating and cooling and intricate interactions, are crucial for a climate-neutral energy system. This work significantly contributes to the integration of geothermal energy as a vital energy source into the modelling of such complex systems. Borehole heat exchangers help generate heat in low-temperature energy systems. However, optimizing these exchangers using mixed-integer-linear programming (MILP), which only allows for linear equations, is complex. The current research only uses R-C, reservoir, or g-function models for pre-sized borefields. As a result, borehole heat exchangers are often represented by linear factors such as 50 W/m for extraction or injection limits. A breakthrough in the accuracy of borehole heat exchanger sizing has been achieved with the development of a new model, which has been rigorously compared to two simpler models. The geothermal system was configured for three energy systems with varying ground and bore field parameters. The results were then compared with existing geothermal system tools. The new model provides more accurate depth sizing with an error of less than 5 % compared to simpler models with an error higher than 50 %, although it requires more calculation time. The new model can lead to more accurate borefield sizing in MILP applications to optimize energy systems. This new model is especially beneficial for large-scale projects that are highly dependent on borefield size.