Aspen Plus variables access through Active X

22 views (last 30 days)
Muhammad Tauha Ali
Muhammad Tauha Ali on 16 Apr 2024 at 15:17
Edited: Muhammad Tauha Ali on 16 Apr 2024 at 15:19
I am trying to access stream results of Aspen Plus simulation through active x but can't access the fields within the results tables although the variables call is available on the 'variable explorer'. My access method is:
Aspen.Tree.FindNode("\Data\Results Summary\Stream-Sum\Stream-Sum\Table")
i get an interface object which contains a 'elements' field which is also an interface object. However, the findnode function doesn't work on that COM object.
I found a python code on "kitchingroup" under aspen tag that shows how to access all the variables:
import os
import win32com.client as win32
aspen = win32.Dispatch('Apwn.Document')
aspen.InitFromArchive2(os.path.abspath('data\Flash_Example.bkp'))
def print_elements(obj, level=0):
if hasattr(obj, 'Elements'):
print ' '*level + obj.Name
for o in obj.Elements:
print_elements(o, level + 1)
else:
print ' '*level, obj.Name, ' = ', obj.Value
print_elements(aspen.Tree)
aspen.Close
can somebody provide a MATLAB equivalent for this code? the AI translated code didn't work.

Answers (0)

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!