Read Stream Properties using IronPython

This code-snippet in IronPython shows how to read stream properties.

import clr
#Add CC-API .NET Interface 
clr.AddReferenceToFileAndPath('F:\CGC.CC-API.dll')
import CCAPI
from CCAPI import *

#Put your .NET Interface license key
license_key='......'

#Start CHEMCAD Server
chemcad=Server(license_key) 

#Path to the flowsheet
path='C:\cc\Deisobutanizer.cc7'

chemcad.LoadFlowsheet(path)
flowsheet=chemcad.CurrentFlowsheet
#Get Streams Collection
streamsCollection=flowsheet.StreamsInCurUnits

#Get Flowsheet Engineering units
unitsCollection=flowsheet.UnitsCurrent

#Get first stream in the flowsheet
streamFirst=streamsCollection.GetStreamAt(0)
componentCollection=flowsheet.Components

#Get first component from the flowsheet
firstComponent=componentCollection.GetComponentAt(0)
#Print stream Information
print('Stream ID is '+ streamFirst.Id.ToString())

print('Stream Name is '+ streamFirst.Name)
print('Temperature '+streamFirst.Temperature.ToString()+' '+unitsCollection.TemperatureUnit)
print('Pressure '+streamFirst.Pressure.ToString()+' '+unitsCollection.PressureUnit)

print('Molar flowrate of '+firstComponent.Name+ ' is '+ streamFirst.CompFlow[0].MolarFlow.ToString()+' '+unitsCollection.MolarFlowRate )

#Close CHEMCAD Server
chemcad.Release()
name = raw_input("Press Enter to exit")

Output:

Files:
Download Deisobutanizer.cc7