How to get the defined nominal_value of component?

hi everyone,

I would like to develop a function which enables to get the nominal_value defined for a certain component. For example the normal_value of a transformer.
I tried that but the I didn’t get the result desired.

I’m thankful for any help.

Hi Jess,

honestly, I do not really get your question. The nominal_value is defined by you and then available as an attribute of the corresponding Flow. Maybe, you can give some lines of example code to illustrate what you are looking for?

1 Like

Hi Patrik,
thanks for your reply!

yes exactly this is defined by the user or by me! but I want save step every time to check to component manually! for example I have this component in the system and it has the following code:

  pv_component =    solph.Source(label='pv', outputs={electricity_bus: solph.Flow( fix=pv _feedin_series, nominal_value=1000)})

if I want to know the label I just can type:

  pv_component.label 

I was wondering how can I do that to get the nominal_value?
To do it in the same way does not work because the nominal_value is referred to the Flow object .

  pv_component.nominal_value

Sorry for confusing you!

The nominal_value is a flow attribute and not an attribute of the component. We used to define the Flow nested inside the component, because it kind of belongs to the component.
Nevertheless, there are different ways to get the value.

date_time_index = pd.date_range("1/1/2022", periods=3, freq="H")
energysystem = solph.EnergySystem(timeindex=date_time_index)

electricity_bus = solph.Bus("electricity")

pv_flow = solph.Flow(fix=[1, 2, 3], nominal_value=1000)
pv_component = solph.Source(
    label="pv",
    outputs={electricity_bus: pv_flow},
)

Now you can get the value right away:

print(pv_flow.nominal_value)

The object is connected to the outputs attribute of the Source. So you can always find it there (even if you define the Flow nested. You also have to define where the output is targeting to, because this works also if you have more than one outputs.

electricity_bus = solph.Bus("electricity")
pv_component = solph.Source(
    label="pv",
    outputs={electricity_bus: solph.Flow(fix=[1, 2, 3], nominal_value=1000)},
)
print(pv_component.outputs[electricity_bus].nominal_value)

If you added the object to the energysystem you will find all flows there. The flows attribute of the EnergySystem class stores all flows in a dictionary. The keys are tuple: (source, target). In your case the source is the pv_component and the target the e-bus.

energysystem.add(electricity_bus, pv_component)
print(energysystem.flows()[pv_component, electricity_bus].nominal_value)

I hope this helps.

2 Likes

Hi Uwe,

I got it! thank you so much for the examples!

I appreciate it:-)