Jump to content



Featured Articles

Check out the latest featured articles.

File Library

Check out the latest downloads available in the File Library.

New Article

Product Viscosity vs. Shear

Featured File

Vertical Tank Selection

New Blog Entry

Low Flow in Pipes- posted in Ankur's blog

Coding Required To Import Lhv Mass Basis From Aspen Hysys To Ms Excel


This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic
Share this topic:
| More

#1 MPasha

MPasha

    Brand New Member

  • Members
  • 1 posts

Posted 10 February 2016 - 02:35 AM

I am using following code to import LHV Mass Basis (Std) from Hysys to MS Excel interface.

 

Worksheets("Sheet1").Range("D9").Value = FEED1.LHVMassBasis("Std").GetValue("kJ/kg")   ' import data  LHV MASS BASIS (STD) from hysys streams

But i could not able to get the result. Can any body guide me what is the error in this code.



#2 serra

serra

    Gold Member

  • Members
  • 310 posts

Posted 10 February 2016 - 05:01 AM

make sure the names of methods (vba names) are correct, meaning the methods are exposed by your simulator to Excel interface,

easy to verify that debugging VBA in Excel,

with Excel one can simply calculate net calorific value  for mixtures from composition (which you should know) and a table of values for the different components, if you need to convert or estimate accuracy see std. as ISO 6976,

there are examples at cheresources...

As alternative, with Excel, you may adopt a process library (I have Prode Properties but there are several available) ,

a process library allows different ways to exchange data,

for example wiith Prode you can use the macro  = StrHC(stream) to calculate calorific value.



#3 Lucian Gomoescu

Lucian Gomoescu

    Veteran Member

  • Members
  • 44 posts

Posted 10 February 2016 - 03:35 PM

Hello,

Try this as in the xlsm file attached.

 

 

Option Explicit
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sub IMPORT_FROM_HYSYS()

Dim sPATH As String
Dim sSTREAM_NAME As String

Dim hyCASE As SimulationCase
Dim hyFLOWSHEET As Object
Dim hySTREAM As Object

Dim sgLHV As Single

Worksheets("Sheet1").Activate

sPATH = Range("D2").Value
sSTREAM_NAME = Range("B10").Value

Set hyCASE = GetObject(sPATH)
Set hyFLOWSHEET = hyCASE.Flowsheet
Set hySTREAM = hyFLOWSHEET.MaterialStreams.Item(sSTREAM_NAME)

sgLHV = hySTREAM.MassLowerHeatValue.GetValue("kJ/kg")

Range("C10").Value = sgLHV

End Sub

Attached Files



#4 Bobby Strain

Bobby Strain

    Gold Member

  • Members
  • 3,529 posts

Posted 10 February 2016 - 05:28 PM

And if you want to continue with Excel-HYSYS interaction, download the Stream Reporter from the AspenTech support site. You can then find the variable names and units for whatever properties you need. You will find other Automation applications, too.

 

Bobby






Similar Topics