oemof / DHNx

District heating system optimisation and simulation models
MIT License
27 stars 12 forks source link

Define __repr__() method #34

Closed jnnr closed 4 years ago

jnnr commented 4 years ago

This PR adds a __repr__() method to the ThermalNetwork class. This allows you to print() a ThermalNetwork and get the following:

thermal_network = dhnx.network.ThermalNetwork()

print(thermal_network)

# empty dhnx.network.ThermalNetwork object containing no components

thermal_network.add('Producer', id=0)

print(thermal_network)

# dhnx.network.ThermalNetwork object with these components
#  * 1 producers