04 UsingAPI
04 UsingAPI
Module 1 Introduction
Module 2 Overview and Context
Module 3 Custom Definition Records
Module 4 Using the API
Module 5 Server Based Processing
Module 6 Summaries and Logs
Module 7 Dot.NET Applications
• Remote programs
– Link to InfoPlus21_api.lib
– Reference configuration file (setcimrpc.cfg) for list of servers
– Most access routines require Node ID in addition to record ID
De-initialize
(ENDSETC)
• Short program
example in “C”
• Function ENDSETC
– Local Application Mode
• Unmaps program from shared memory
– Remote Application Mode
• Disconnects all Server Nodes
• Destroys the Server List Functions
• Releases resources (for example, memory)
source
• Use Visual Studio to write source code in “C++”
compile
• Visual Studio is used to convert to binary object
• Binary object is LINKED to Aspen InfoPlus.21 object
libraries to produce executable program
• Supplied Visual Studio solution file link
– AspenTech\InfoPlus.21\shared\samples\infoplus21_api\Test_Decodnam
process
©2009 AspenTech. All Rights Reserved. Slide 24
Running and Stopping User
Scheduled Tasks
• To start tasks that run on local
server node automatically, can
include in Aspen InfoPlus.21
Manager
– Remember not to
check “External Task” or “Auto
restart” box if program will
complete!
• Alternatives:
– Make a Windows service
to start tasks automatically
– Provide a Command file to
start task
• Run command manually
• Have Aspen InfoPlus.21 run the
command via SQLplus or
CommandDef record
External External
Task (sometimes) Task
Record e.g., TSK_IQ1
e.g., TSK_IQ1 Definition
Record Wake up!
e.g., QueryDef And here’s
a message
“Activation”
OK,
Data I’ll read SQL from record.
Record Perform Processing.
e.g., Query1 Then Back to sleep.
©2009 AspenTech. All Rights Reserved. Slide 33
Record Activation
last_update timestamp
tanklevel real
• step
– TRUE or FALSE: if true, returns extra values for use in step plots
• outsiders
– Reserved for future enhancements – set it to 0
• recid
– Record ID of the record that contains the history repeat area
• ft
– Field tag of any field in the history repeat area
– Or tag of repeat area sizing field for the area
• RHIS21DATA (mode, step, outsiders, recid, ft, timeold, timenew,
numfts, fts, datatypes, maxoccs, keylevels, keytimes, ptdatas,
ptoccsok, ftsok, error)
• timeold
– Start time for occurrences to read from history
– Timestamp of oldest occurrence required (microseconds)
• timenew
– End time for reading occurrences from history
– Timestamp of most recent occurrence required (microseconds)
trendtime timestamp
trendquality integer
trendtime timestamp
trendquality integer
Results