The One - 2020-09-20

Hey everyone,
I am trying to find the temperature of steam, given pressure and entropy. I have used the following code in order to achieve so:
tmp = Flowsheet.PropertyPackages.Values.ToList()[1]
S = tmp.CalculateEquilibrium2(FlashCalculationType.PressureEntropy, PeHE, S1, 0)
Property Package Steam Tables is stored in the tmp variable which is subsequently used in following line. The error that it returns is: "Object Reference not set to an instance of an object".
As a corrective measure, I tried the code:
S = feed[0].PropertyPackage.CalculateEquilibrium2(FlashCalculationType.PressureEntropy, PeHE, S1, 0)
This code worked. But feed[0].PropertyPackage returns property package which i do not want to use in this particular section of code, but want to use in the material stream feed[0] as a whole.
On comparing the data type of both codes, it turned out that both have the same data type, only differing in value (property package) stored.
I am unable to understand what went wrong in my first code and what should be done to correct it.
Thank you, Regards