question
stringlengths 19
6.88k
| answer
stringlengths 38
33.3k
|
---|---|
Problem Statement: When adding a database link in Aspen SQLplus, after successfully setting up ODBC datasource to a remote database the following error is returned
Modify Link. Access Denied. | Solution: If SQLplus has been added as application security component in Aspen Framework(AFW) / Aspen Local Security(ALS), then:-
In order to add a database link, the Aspen SQLplus System Command privilege must be granted to the user who attempts to add the link through the Aspen SQLplus Query Writer.
Check also that the connection to Aspen SQLplus is not Read Only, as this will also produce this type of error.- SeeSolution 103155
Keywords: System Command
Modify Link
Access Denied
Modified
References: None |
Problem Statement: This knowledge base article describes the cause of the error message:
ORA-12154: TNS:could not resolve the connect identifier specified
Cause: A connection to a database or other service was requested using a connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming methods configured. For example, if the type of connect identifier used was a net service name then the net service name could not be found in a naming method repository, or the repository could not be located or reached.
When Aspen SQLplus is run on a 64 bit version of Windows with a 32 bit version of the Oracle ODBC driver. | Solution: This is due to a defect in the Oracle database/driver that is encountered when a 32bit Oracle driver is installed on a 64 bit operating system. The root cause is that 32 bit programs are installed in a directory that has (x86) in the path. The Oracle driver does not handle the parentheses in the path. The Oracle defect number is 3807408. A fix can be obtained from Oracle.
Keywords: bug
64bit
32bit
OS
References: None |
Problem Statement: What are the additional software requirements for Aspen Custom Modeler (ACM)? | Solution: In Aspen Custom Modeler, you may need to install additional software in the following two categories:
1) Fortran Compiler: Required for customer development of Fortran procedures
2) Visual C/C++: Required for customer development of C/C++ procedures, or to export models for use in Aspen Plus or Aspen HYSYS.
The following table lists additional software requirements for all versions of Aspen Custom Modeler:
Aspen Custom Modeler Version Information
Visual Studio/Fortran Compiler
10.1
Microsoft Visual C++ version 5.0 or 6.0/ Digital? Visual Fortran version 5.0C, 5.0D or 6.0A
12.1
Microsoft Visual C++ 6.0,
.NET 2002 or .NET 2003/ Compaq Visual Fortran 6.6
2004/2004.1
Microsoft Visual C++ 6.0, .NET 2002 or .NET 2003/
Compaq Visual Fortran 6.6
2006
Microsoft Visual C++ .NET 2003/ Intel Fortran 9.0 or 9.1
2006.5
Microsoft Visual C++ .NET 2005/ Intel Fortran 9.0 or 9.1
V 7.0
Microsoft Visual C++ .NET 2005/ Intel Fortran 9.0 or 9.1
V 7.1
Microsoft Visual C++ 2008/ Intel Fortran 9.0 or 9.1
V 7.2/ V 7.3 Higher
Microsoft Visual C++ 2008/ Intel Fortran 9.0, 9.1, 10.0, 10.1, 11.0 or 11.1
Keywords: Visual Studio, Intel Fortran Compiler, compatibility
References: None |
Problem Statement: In Aspen SQLplus reporting, when an SQL Procedure section type is added to the report, the following error message can be seen. | Solution: In order to use SQL Procedure section type, the last line in the procedure must be a SELECT statement such that a table is returned.
For example, the below procedure Proc performs some calculations and writes out the result.
PROCEDURE Proc
LOCAL T REAL;
LOCAL B REAL;
LOCAL PCT REAL;
FOR (SELECT DISTINCT(IP_Plant_Area) AS area FROM IP_AnalogDef) DO
T = (SELECT COUNT(*) FROM IP_AnalogDef);
B = (SELECT COUNT(*) FROM IP_AnalogDef WHERE IP_Plant_Area = area);
PCT = (B/T)*100;
WRITE 'TOTAL: ' || T;
WRITE 'Count: ' || B;
WRITE 'PCT: ' || PCT;
END;
END;
The above procedure will produce the mentioned error when used since the result is not a table.
In this case, the issue can be resolved by using a Temporary Table. The previous procedure after modification to include a temporary table, is usable in the SQL Procedure section type without any issue.
PROCEDURE Proc
LOCAL T REAL;
LOCAL B REAL;
LOCAL PCT REAL;
DECLARE LOCAL TEMPORARY TABLE MODULE.X
(TOTAL INT, Count REAL, PCT REAL);
FOR (SELECT DISTINCT(IP_Plant_Area) AS area FROM IP_AnalogDef) DO
T = (SELECT COUNT(*) FROM IP_AnalogDef);
B = (SELECT COUNT(*) FROM IP_AnalogDef WHERE IP_Plant_Area = area);
PCT = (B/T)*100;
INSERT INTO MODULE.X (TOTAL, Count, PCT) VALUES (T, B, PCT);
END;
SELECT * FROM MODULE.X;
END;
Keywords: Cannot find table 0
SQLplus Reporting
SQL Procedure
An unhandled exception occurred
References: None |
Problem Statement: This knowledge base article provides troubleshooting suggestions for the following error message that is generated when the user attempts to make an Aspen SQLplus connection to a Microsoft Access database.
Failed to connect to link XXXX
[Microsoft][ODBC Microsoft Access Driver]'(unknown)' is not a valid path. Please make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
When ODBC tracing is enabled the following is logged in the ODBC trace log:
WCHAR * 0x0012C700 [201] [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data. | Solution: If your MS Access database resides on a Remote machine, then a few unique steps are needed...
Create a 'Sharename' for the directory where the .mdb file exists
However, when creating the ODBC Datasource for Microsoft Access Driver do NOT use a Mapped Drive.
From the first screen click on Select
Then on the next screen click on Network.
From the Drive box drop-down choose (none).
Then use the Browse button to search for the Remote Share
Clicking OK a couple of times will show the Database as a \\server\share
? The final steps are to ensure that the Account has permissions to the MS Access Database
The Account in question is the Account that starts the Aspen InfoPlus.21 Task Service on the IP.21 Server
Permissions for that account should be given to
The 'Share' configuration for the .mdb file
The Directory being Shared
The .mdb file itself
Ensure the MS Access database is not password protected. Then, if either your MS Access ODBC data source or your SQLplus ODBC database link has a user name and password associated with them, try removing the username and password. Also, make sure there are no hidden characters in the username and password fields by highlighting and deleting anything that may be in the fields.
Ensure that the MS Access database isn't opened by any other processes. If you cannot determine whether or not the MS Access database is in use by another process then reboot the machine on which the MS Access database resides. Rebooting will close any open connections.
When using the Aspen SQLplus Query Writer, it will attempt to connect to the remote database as the account which starts the InfoPlus.21 Task service. Please make sure this account has full permissions on the folder/database you're trying to read.
Another way to see if the problem is due to a permissions issue on this particular server is to try to connect to another database (or even the same database) on a different remote machine.
Grant 'everyone' full control to the folder in which the MS Access database resides.
Try to make a remote ADO connection to this database through a Visual Basic (VB) program. See if you can connect through the VB program when you specify the account which starts the IP.21 Task service in the ADO connection properties. As of v2004.1 Aspen SQLplus supports the use of the UID & PWD ODBC connection parameters. So you could append the following parameters to your connection string when connecting through ADO:
HOST=hostname; UID=mydomain\myuser;PWD=mypassword;
Keywords: Refused
Failed
Deny
References: None |
Problem Statement: Applications such as RDS can set a timeout that is hard to override. | Solution: A new TIMEOUT option has been added to the connection property to allow users to override any timeout specified by an application such as RDS. Adding an F to the start of the TIMEOUT value means that it cannot be overridden by the ODBC client program.
For example:
DRIVER={AspenTech SQLplus};HOST=myhost;TIMEOUT=F100
This forces a timeout of 100 seconds.
Keywords:
References: None |
Problem Statement: I want to model a PID controller which limits the rate of change (move) of the manipulated variable. How can I do that? | Solution: The PIDincr controller in Modeler (and Dynamics) library is a simple PID controller, using the continuous form of the velocity based (or incremental) algorithm. The user can access the code of this PIDincr controller, and customize it if needed (you will need to enable the Custom Modeling license in Aspen Dynamics).
ThisSolution shows the required changes to implement the rate limitation. The PIDincr works in the following way: it calculates the rate of change of the manipulated varaible, dOP, using the specified gain, integral time and derivative time, as well as the setpoint and process variable values. This variable dOP is then integrated to give the value of the manipulated variable, OPman.
The file attached contains a modified PIDincr controller where the rate of change of the output variable is limited
added new variable declarations
dOPc as control_signal (0, description:Change in output clipped);
dOPmaxpos as control_signal (fixed, 1, description:max positive rate);
dOPmaxneg as control_signal (fixed, -1, description:max negative rate);
-
calculated a clipped rate of change dOPc from the calculated rate of change dOP
// clip the rate of change of OP
call (dOPc) = pLimit (dOP, dOPmaxneg, dOPmaxpos);
-
modified the equations near the end of the model (e.g. replaced dOP with dOPc)
// Calculate unscaled, unclipped output allowing for Deadbanding
If OP.IsConnectedAsOutput Then
If ((SPs-PVsf)<DBlow and (PVsf-SPs)<DBhi) Then
$OPman = 0;
Else
$OPman 3600/TimeScaler 100/(OPmax-OPmin) = dOPc;
Endif
Else
If (Abs(SolMode-1)>tol) Then // Not a steady state run
If ((SPs-PVsf)<DBlow and (PVsf-SPs)<DBhi) Then
$OPman = 0;
Else
$OPman 3600/TimeScaler 100/(OPmax-OPmin) = dOPc;
Endif
Else // a steady state run
OP = (OPmax + OPmin)/2;
Endif
Endif
If you run the attached simulation, at time 0.1 the set point of B3 is changed. You can see on the plot plotdemo that dOP becomes greater than the dOPmaxpos, the max rate of change (1). This causes OP to be following a linear ramp (slope = dOPmaxpos). Once dOP becomes smaller than the maximum rate, then the normal PIDincr algorithm is applied.
Keywords:
References: None |
Problem Statement: SQLplus Installation Problems: While adding the components Web Server and Web Service for Aspen SQLplus, user is getting an archive extraction error (Error: 1334). | Solution: Remove Aspen SQLplus and re-install it to solve the problem. Run a second install to then add the Web Service (only if needed, for example if you are using the InfoPlus.21 Health Monitor, which has a dependency on the Web Service.)
To prevent this installation problem, install only:
- SQLplus
- SQLplus Client
- SQLplus ODBC
Keywords: Error 1334, SQLplus
References: None |
Problem Statement: Say I have a structure type:
Structure struct
struct_var as realvariable (fixed);
End
and a model:
Model test
x as realvariable;
s as external struct;
x = s.struct_var;
End
I want to create a model script to access the value of the variable struct_var in the structure. How can I do that? | Solution: The trick is to use the Application object to go back up to the flowsheet, and use the Resolve method to get the structure instance referred to by the external structure declaration.
st = Application.Simulation.Flowsheet.Resolve(s.value)
MsgBox st.struct_var.value
Keywords:
References: None |
Problem Statement: I am trying to customize the stage model as used by Radfrac from the Dynamics library.
copy RadFrac model from Dynamics, Columns to Custom Modeling, Models
copy Stage model from Dynamics, Submodels to Custom Modeling, Models
save the file
When I re-open the file I just saved I get a lot of errors
How can I avoid that? | Solution: The problem is that the Stage model code is placed in the acmf file after the Radfrac code.
When the file is saved the custom model Radfrac is still using the Stage model from the library so when it is saved it does not see a dependency and writes models out in the wrong order. There are several ways you can trap yourself like this. For example if you change a sub model without compiling the model that uses it save and restore it will fail to load if there are any compilation problems.
Note that this applies not only to models copied from the Dynamics library but also from any other library.
Users are encouraged to do a rebuild on custom modeling whenever they change or add sub models.
Keywords: CQ00163847
References: None |
Problem Statement: Is there an automation method or property to display the current units set name? | Solution: You can use application.simulation.options.CurrentUOMSet. It returns the name of the UOMSet.
Example (flowsheet script)
msgbox application.simulation.options.CurrentUOMSet
Keywords:
References: None |
Problem Statement: Installation error on a Windows 2003 operating system:
Unable to create Mif File. The filename, directory name, or volume label syntax is incorrect.
Error : 123 | Solution: Unfortunately, Aspen Manufacturing Suite v6.0.1 (and previous) products are not supported on Windows 2003 server.
Keywords:
References: None |
Problem Statement: When using a program or command in an Operating System command from within an Aspen SQLplus query and an error occurs or a dialog window requiring input to continue appears, the TSK_IQ task will hang.
This has been observed when using a .vbs script running various commands, such as sending email, for instance. If such an error occurs or a dialog window, like OK or Cancel, pops up requiring input to continue, the TSK_IQ task hangs and one needs to reboot the system to make the external task work again. | Solution: What you may consider doing is preventing the application from creating this dialog requiring input, so that Aspen TSK_IQ task will not hang.
You may be able to use a command line argument in the program or command executed in the Operating System command window to prevent it from creating the dialog requiring input, or redirect it to a file instead.
If you can't prevent the application from creating the dialog requiring input and it doesn't allow to redirect errors to a file, you may want to explore using Windows redirection to prevent the creation of the dialog requiring input; search in Windows Web site or the Internet for Windows redirection to get more information on how to us this feature.
One can run the command as follows:
command > NUL 2>&1
or
command > %TEMP%\file.out 2>&1
When you run the command like this, it redirects both Standard Output and Standard Error to the NUL device or to the file.out, which may stop the creation of the dialog requiring input.
If these suggestions don't work, then the only other way this has been handled in the past was to kill the cmd. The only problem is knowing which cmd to kill. The best way to find this out is to use the procexp.exe tool from Microsoft sysinternals.
You can download it from:
http://www.microsoft.com/technet/sysinternals/utilities/processexplorer.mspx
You can then run procexp.exe and find the sqlplus_server.exe or iqtask.exe processes. If one of these has a child that has a cmd that has run for a long time, you can right-click on the cmd process and select Kill Process Tree.
Keywords: None
References: None |
Problem Statement: This knowledge base article explains what happens when a real value is converted to an integer value using a CAST statement. | Solution: When a real value is cast as an integer the decimal portion of the number is truncated. This is illustrated by the following query:
Write 'Real Value: ' || (Select IP_Input_Value from atcai);
Write 'Cast as Integer: ' || CAST((Select IP_Input_Value from atcai) as Integer);
When this query is executed several times in succession the following results are returned:
Real Value: 6.34
Cast as Integer: 6
Real Value: 5.89
Cast as Integer: 5
Real Value: 10.55
Cast as Integer: 10
Keywords: None
References: None |
Problem Statement: Open NLP solvers for optimization always seem to default to open NLP - reduced space, whereas in previous versions they defaulted to open NLP - full space. Is there an automation method to allow control over the open NLP - reduced space or open NLP - full space options? | Solution: You can do this to select the full space open NLP:
application.simulation.options.optimizer = 7 'Full space
The list below shows the other possible values:
1 -- FEASOPT
2 -- FEASOPT
3 -- Nelder-Mead
4 -- SRQP
5 -- not allowed
6 -- reduced open NLP
7 -- full space open NLP
8 -- Hypsqp
9 -- DMO
We will, in a future version, set this up as an enumeration.
Keywords: CQ00198460
References: None |
Problem Statement: Where can I find Aspen SQLplus query examples to update the IO_TAGNAME for specified tags in multiple Get records? | Solution: QUERY EXECUTION PRE-REQUISITES:
Recommended pre-requisites that AspenTech Support suggests be completed before running any of the example queries provided below are as follows:
1. Save a backup copy of your Aspen InfoPlus.21 database snapshot before running any of the example queries provided below in this knowledge base article.
2. Review the Aspen SQLplus help file regarding the TRIM command and the examples provided in the TRIM help file, as it may not do what you expect depending on how you use it, and two of the examples provided below include the TRIM command.
The TRIM function will remove characters from the start, end, or both of a character value by truncating characters
from the value based on whether or not you specify one of the three trim types (LEADING, TRAILING, or BOTH),
and BOTH is assumed if no trim type is specified. Also, if the string of specified trim characters to trim from the
value contains more than one character, TRIM will then remove any of the specified characters in whatever order
they appear until it finds the first character in the value to be trimmed that does not match any of the specified trim
characters.
3. AspenTech ALWAYS recommends that you first turn OFF the IO_RECORD_PROCESSING for each of the selected Get records to be updated BEFORE actually making any changes to those selected Get records, and reasons for this recommendation are provided in KBSolutions 103395, 119108, 119241, which are linked to this article. Some additional Support articles you may want to review in regards to Aspen SQLplus queries that can be used to modify transfer records are KB Articles 103780, 108764, and 124935.
NOTE: The queries below already include commands to toggle the IO_RECORD_PROCESSING during the
query execution. The IO_RECORD_PROCESSING toggle commands (OFF / ON) can be removed from the
queries but as stated above doing so is NOT recommended by AspenTech Support.
IO_TAGNAME CHARACTER LIMIT REMINDER:
Each I/O transfer record type has 3 sizes that are based on the Maximum Length of the I/O tag name that will be used to reference the device data point. This is mentioned in KB Article 116004.
Definition Record (Type)
Type Size Description
Character limitation
IoGetDef
Regular
39 character tag names
IoLongTagGetDef
Long (IoLongTag definition records)
79 character tag names
IoLLTagGetDef
LongLong (IoLLTag definition records)
255 character tag names
_____________________________________________________________________________
Three example queries have been provided below, which can be modified and used as needed to accomplish the task of updating the IO_TAGNAME for specified tags in one or multiple Get records.
The examples (#1) show how existing IO_TAGNAME values can be updated by simply replacing part of the existing name with a different text string using the REPLACE Command, and (#2, #3) when using the REPLACE command is not a suitable option then how the IO_TAGNAME values can be updated using a concatenation of strings including suffixes and prefixes when the associated Aspen InfoPlus.21 record name is required as part of the IO_TAGNAME.
NOTE: The items highlighted in Yellow in the example queries indicate the text strings to search for and/or replace in regards to the specified Get record and corresponding IO_TAGNAME values to be updated, and also indicate the allowed character lengths for the local variables used.
EXAMPLE #1:
This query allows you to Automatically Update IO_TAGNAME values in all or specified Get records by using the REPLACE command to substitute into each IO_TAGNAME value a new text string to replace an existing specified text string, where the IO_TAGNAME values to be updated are located ONLY in the Get records where the associated Aspen InfoPlus.21 record (tag) name defined for one or more of the IO_TAGNAME values is similar to or includes in the name the text string as specified by the user in the query by using the LIKE command.
--Update the String Length as needed for the CHAR Variables based on your IO_TAGNAME lengths
--and also modify the remaining query lines as needed before executing.
LOCAL CurrentTag CHAR(40);
LOCAL NewTag CHAR(40);
LOCAL UpdateCount INTEGER;
LOCAL intIOGETCount INTEGER;
LOCAL x, arrIOGETDEF;
UpdateCount = 0;
intIOGETCount = 0;
FOR (SELECT NAME as IOGETREC, OCCNUM as Occurrence, IO_TAGNAME as IOTAG,
IO_VALUE_RECORD&&FLD -> NAME as RECNAME FROM IOGETDEF WHERE NAME LIKE 'Get_%') DO
IF RECNAME LIKE 'TagPrefix.%' THEN
--NOTE: RECNAME can also be replaced with IOTAG in the above IF THEN LIKE Statement,
--which would then make the update execution be based on the existing IO_TAGNAME itself
--rather than the update being based on the associated IP.21 Record (tag) Name.
--Set IO_RECORD_PROCESSING to OFF.
--Again, this step is Optional BUT ALWAYS Recommended BEFORE making any Transfer Record Changes.
IF (SELECT IO_RECORD_PROCESSING FROM IOGETDEF WHERE NAME = IOGETREC) = 'ON' THEN
UPDATE IOGETDEF SET IO_RECORD_PROCESSING = 'OFF' WHERE NAME = IOGETREC;
redim (arrIOGETDEF, intIOGETCount);
arrIOGETDEF[intIOGETCount] = IOGETREC;
intIOGETCount = intIOGETCount + 1;
END;
--Use the REPLACE command on Current IO_TAGNAME to Set the New IO_TAGNAME, then display
--the Old and New (replacement) IO_TAGNAMES then execute the UPDATE.
CurrentTag = IOTAG;
NewTag = REPLACE('TagPrefix.' WITH 'ABC123.' IN CurrentTag);
WRITE 'Selected Get Record and IOTAG# (i.e., Occurrence) to Update = ' || IOGETREC ||
' and IOTAG# ' || Occurrence;
WRITE 'Old IO_TAGNAME = ' || CurrentTag;
WRITE 'New IO_TAGNAME = ' || NewTag;
UPDATE IOGETDEF SET IO_TAGNAME = NewTag WHERE
NAME = IOGETREC AND OCCNUM = Occurrence;
WRITE ' ';
UpdateCount = UpdateCount + 1;
END;
END;
--Set IO_RECORD_PROCESSING back to ON for Each IOGETDEF that was Updated.
FOR EACH x IN arrIOGETDEF DO
UPDATE IOGETDEF SET IO_RECORD_PROCESSING = 'ON', IO_ACTIVATE? = 'YES' WHERE NAME = x;
END;
--Write out a Final combined Summary Table of the IOTAGNAME Updates completed.
IF UpdateCount > 0 THEN
WRITE 'The Get Records should now be Updated with the New IO_TAGNAME values as follows:';
WRITE ' ';
SELECT NAME as GETREC NAME, OCCNUM IOTAG OCCNUM, IO_TAGNAME as NEW IO_TAGNAME
FROM IOGETDEF WHERE NAME LIKE 'Get_%' AND IO_TAGNAME LIKE '%ABC123.%';
ELSE
WRITE 'IO_TAGNAME Updates Completed = 0';
END;
_____________________________________________________________________________
NOTE: The next two example queries provided below both use the UPDATE statement instead of the REPLACE statement in order to update the IO_TAGNAME values using a different naming method and to show an alternative way of writing the query. In both cases though, the included SELECT statements and command lines in the queries below could be modified as needed and used in conjunction with a REPLACE statement as well in order to provide the same functionality, rather than using the SELECT statement as shown in the examples, such that in the examples shown below the desired REPLACE statement would be placed in between the Prefix and Suffix concatenation strings instead of the SELECT statement used in both examples.
EXAMPLE #2:
This query also allows you to automatically search all or specified Get records and update ONLY the IO_TAGNAME values in each Get record as needed by searching for and using the actual record names defined in Aspen InfoPlus.21 for the Get record tags in order to then specify and limit which IO_TAGNAME values to update based on those tags that are associated with Aspen InfoPlus.21 records that are defined with names that start with a specified text string as identified using the LIKE command. Essentially this query serves the same purpose as the query provided in Example #1, except that instead of replacing part of the existing IO_TAGNAME with a new text string this query builds a new tag name altogether including a part of the associated Aspen InfoPlus.21 record (tag) name combined with a user defined prefix and suffix.
LOCAL UpdateCount INTEGER;
LOCAL intIOGETCount INTEGER;
LOCAL x, arrIOGETDEF;
UpdateCount = 0;
intIOGETCount = 0;
FOR (SELECT NAME as IOGETREC, OCCNUM as Occurence_Number, IO_TAGNAME as IOTAG,
IO_VALUE_RECORD&&FLD -> NAME as IORECORD FROM IOGETDEF WHERE NAME LIKE 'Get_%') DO;
--For each IOTAGNAME selected, Check to verify if it meets the required criteria, and if so, then update.
IF IORECORD LIKE 'ABCXYZ123_%' THEN
--NOTE: IORECORD can also be replaced with IOTAG in the above IF THEN LIKE Statement,
--which would then make the update execution be based on the existing IO_TAGNAME itself
--rather than the update being based on the associated IP.21 Record (tag) Name.
--Set IO_RECORD_PROCESSING to OFF.
--Again, this step is Optional BUT ALWAYS Recommended BEFORE making any Transfer Record Changes.
IF (SELECT IO_RECORD_PROCESSING FROM IOGETDEF WHERE NAME = IOGETREC) = 'ON' THEN
UPDATE IOGETDEF SET IO_RECORD_PROCESSING = 'OFF' WHERE NAME = IOGETREC;
redim (arrIOGETDEF, intIOGETCount);
arrIOGETDEF[intIOGETCount] = IOGETREC;
intIOGETCount = intIOGETCount + 1;
END;
WRITE 'Existing Record to be Updated:';
WRITE ' ';
SELECT NAME as GETREC NAME, OCCNUM as IOTAG OCCNUM, IO_TAGNAME,
IO_VALUE_RECORD&&FLD -> NAME
FROM IOGETDEF WHERE NAME = IOGETREC AND OCCNUM = Occurence_Number;
WRITE ' ';
--Update the Existing selected IOTAGNAME based on the following Concatenation of Strings:
--User Defined Tag Prefix + Selected Portion of Associated IP.21 Record Name + User Defined Tag Suffix
--Then Write out the Update Results to display the New IOTAGNAME.
UPDATE IOGETDEF SET IO_TAGNAME = 'TagPrefix.' ||
(SELECT TRIM(LEADING 'ABCXYZ123_' FROM IO_VALUE_RECORD&&FLD -> NAME)
FROM IOGETDEF WHERE NAME = IOGETREC AND OCCNUM = Occurence_Number) || '.TagSuffix'
WHERE NAME = IOGETREC AND OCCNUM = Occurence_Number;
WRITE 'Updated Record with New IO_TAGNAME = ' || (SELECT IO_TAGNAME FROM IOGETDEF
Where NAME = IOGETREC AND OCCNUM = Occurence_Number);
Write ' ';
WRITE ' ';
UpdateCount = UpdateCount + 1;
END;
END;
--Set IO_RECORD_PROCESSING back to ON for Each IOGETDEF that was Updated.
FOR EACH x IN arrIOGETDEF DO
UPDATE IOGETDEF SET IO_RECORD_PROCESSING = 'ON', IO_ACTIVATE? = 'YES' WHERE NAME = x;
END;
--Write out a Final combined Summary Table of the IOTAGNAME Updates completed.
IF UpdateCount > 0 THEN
WRITE 'The Get Records should now be updated with the New IO_TAGNAME values as follows:';
WRITE ' ';
SELECT NAME as GETREC NAME, OCCNUM IOTAG OCCNUM, IO_TAGNAME as NEW IO_TAGNAME
FROM IOGETDEF WHERE NAME LIKE 'Get_%' AND IO_TAGNAME LIKE 'TagPrefix.%.TagSuffix';
ELSE
WRITE 'IO_TAGNAME Updates Completed = 0';
END;
ADDITIONAL NOTE: The SELECT statement used inside the Update statement shown in the query example above that is located in between the Tag Prefix and Suffix Concatenation Strings could also be removed and replaced with a REPLACE statement to provide similar functionality if you wish instead for the new IO_TAGNAME to include as part of the new name, the name as it previously existed based on the original IO Tag Name or the corresponding Aspen InfoPlus.21 Record Name but with a replacement of a specified string found in that name with a new string, and the modified UPDATE statement including the substituted REPLACE statement to be used instead of the SELECT statement would look like the example provided here below:
UPDATE IOGETDEF SET IO_TAGNAME = 'TagPrefix.' ||
REPLACE('OLD_STRING' WITH 'NEW_STRING' IN IORECORD) || '.TagSuffix'
Where NAME = IOGETREC AND OCCNUM = Occurence_Number;
And Likewise, again IOTAG could be used in the above statement instead of IORECORD if the replacement is to be based on the Existing IO_TAGNAME itself and not the corresponding Aspen InfoPlus.21 Record, but in that case the update statement in this example would assume that you also want to change the Tag Prefix and Suffix on the Existing IO_TAGNAME or add both if they did not previously exist; otherwise, if you are basing the replacement command for the tag update on the existing IO_TAGNAME and you want to keep as is any current Tag Prefix and/or Suffix that exits then the concatenation would not be needed and you could then simply use example query #1 provided above.
_____________________________________________________________________________
EXAMPLE #3:
This query allows the user to manually specify the Get record name and number of occurrences to update, i.e., the TAGCOUNT for the number of IO_TAGNAME values to be updated per the specified Get record, and per the command lines included to build the new tag name(s) and the update statement also provided in the query the user can then use and modify as needed the example query below to update the IO_TAGNAME values in the specified Get record with the new tag name values. This manual query essentially executes the same update as the automated query provided in Example #2, except ONLY for the one specified Get record.
LOCAL TAGCOUNT INTEGER;
LOCAL EXISTING_IOTAG CHAR(40);
LOCAL NEW_IOTAG CHAR(40);
LOCAL IOGETRECNAME CHAR(40);
LOCAL IPVALRECFLD_NAME CHAR(40);
--Verify and Update the required TAGCOUNT Range and Get Record NAME,
--and also modify the remaining query lines as needed before executing.
IOGETRECNAME = 'Get_IOCOMM_TestTags';
--Set IO_RECORD_PROCESSING to OFF.
--Again, this step is optional BUT ALWAYS recommended BEFORE making any Transfer Record changes.
IF (SELECT IO_RECORD_PROCESSING FROM IOGETDEF WHERE NAME = IOGETRECNAME) = 'ON' THEN
UPDATE IOGETDEF SET IO_RECORD_PROCESSING = 'OFF' WHERE NAME = IOGETRECNAME;
END;
WRITE 'IO_TAGNAME Update Results for Get Record = ' || IOGETRECNAME;
WRITE ' ';
FOR TAGCOUNT = 1 TO 20 DO
--Select Existing IOTAGNAME
EXISTING_IOTAG = (SELECT IO_TAGNAME FROM IOGETDEF WHERE NAME = IOGETRECNAME
AND OCCNUM = TAGCOUNT);
IPVALRECFLD_NAME = (SELECT IO_VALUE_RECORD&&FLD-> NAME FROM IOGETDEF
WHERE NAME = IOGETRECNAME AND OCCNUM = TAGCOUNT);
IF EXISTING_IOTAG <> '' AND IPVALRECFLD_NAME LIKE 'ABCXYZ123_%' THEN
--NOTE: IPVALRECFLD_NAME can also be replaced with EXISTING_IOTAG after the AND in the above
--IF THEN LIKE Statement, which would then make the update execution be based ONLY on the existing
--IO_TAGNAME itself rather than the update being based also on the associated IP.21 Record (tag) Name.
--Build the New IOTAGNAME based on the following Concatenation of Strings:
--User Defined Tag Prefix + Selected Portion of Associated IP.21 Record Name + User Defined Tag Suffix
NEW_IOTAG = 'TagPrefix.' ||
(SELECT TRIM(LEADING 'ABCXYZ123_' FROM IO_VALUE_RECORD&&FLD-> NAME)
FROM IOGETDEF WHERE NAME = IOGETRECNAME AND OCCNUM = TAGCOUNT) || '.TagSuffix';
--Update IOTAGNAME field with New IOTAGNAME and Write out Results
UPDATE IOGETDEF SET IO_TAGNAME = NEW_IOTAG WHERE NAME = IOGETRECNAME
AND OCCNUM = TAGCOUNT;
WRITE 'Occurrence Tag ' || TAGCOUNT || ': IO_TAGNAME Changed from ' || EXISTING_IOTAG ||
' to ' || NEW_IOTAG;
WRITE ' ';
END;
END;
--Set IO_RECORD_PROCESSING back to ON for Each IOGETDEF that was Updated.
UPDATE IOGETDEF SET IO_RECORD_PROCESSING = 'ON', IO_ACTIVATE? = 'YES'
WHERE NAME = IOGETRECNAME;
Keywords: Get Records
IOGetDef
IO_TAGNAME
SQLplus
Update
Query
References: None |
Problem Statement: Is it possible to call a Visual Basic version 6 program from a procedure? | Solution: Yes, it is possible but a bit technical. The key issue is that Visual Basic programs are not directly callable by C++. ThisSolution applies to version 6 of Visual Basic and Visual C++, not to .NET.
Firstly, your Visual Basic program must be an ActiveX executable or ActiveX DLL. We can then use COM to create an instance of your Visual Basic component in a procedure written in C++.
Secondly, the issue to consider is that ACM is multithreaded. It''s not so complicated as we have only two treads, one for the server and one for the solver, but this means we need to be careful when creating and invoking the COM object. It is this trick that is the motivation of thisSolution. Please refer to Microsoft documentation for details about COM.
The attached example illustrates how this can be done. A readme.txt file is included in the zip file with further instructions.
This can be done with other versions of ACM, but the files attached are for version 2004. A very similar technique could also be used for invoking the Visual Basic program from SAX.
Keywords:
References: None |
Problem Statement: As explained in KB article 124176, increasing the Desktop Heap Size can help when failures are seen running SYSTEM commands (Windows Operating System level commands) within Aspen SQLplus.
This new article illustrates how to monitor the Desktop Heap Size by using a tool from Microsoft to make sure and confirm that the heap size is no longer growing to a dangerous level. | Solution: One of the reasons that the SYSTEM commands fail in Aspen SQLplus occasionally is because the default desktop heap size that was allocated to the machine may be too small. For more information on how to increase the desktop heap size please refer to the KBSolution 124176
KBSolution 124176
It is recommended that the user monitors the usage of the desktop heap for a while to see if it keeps growing or not. In order to observe the trends on how the desktop heap size varies, you can download a free tool from Microsoft called Desktop Heap Monitor.
Desktop Heap Monitor Tool
For example you may see that just by starting Aspen InfoPlus.21 the desktop heap usage goes up to about 70%. Continual use of the Desktop Heap Monitor will let you see if desktop heap usage approaches 99% at which time you may see Aspen SQLplus SYSTEM command failures as described above.
Please note that because desktops heaps are allocated for each account used to start services, one way to alleviate the problem could be to move any non-Aspentech services to a different account.
Keywords: System
Fails
Heap
References: None |
Problem Statement: How to select multiple time stamps for a tag and display results in columns by time stamp | Solution: Formating a query using the Group By clause allows the output to display is columns.
In order to use the Group By clause one of the Set functions must be included in the select statement. In the example below the MIN function is used on the value which does not appear to impact the actual value because there is only one value returned at a given time. (Example Below)
Example Query:
select name, min(ip_trend_value) by ip_trend_time from ip_analogdef
where name = 'atcai'
and (ip_trend_time = '11-jul-08 15:15:25.4'
or ip_trend_time = '11-jul-08 15:15:20.4'
or ip_trend_Time = '11-jul-08 15:15:15.4')
group by name;
Sample Output:
name 11-JUL-08 15:15:15.4 11-JUL-08 15:15:20.4 11-JUL-08 15:15:25.4
------------------------ -------------------- -------------------- --------------------
ATCAI 5.19681 1.75609 9.97006
Keywords: None
References: None |
Problem Statement: I just did a run that uses ACM Homotopy for initialization. Each homotopy step solved fine in 2 iterations, but the step size did not increase. Why is this? Note that I had set the Step Size Increment factor to 2. | Solution: The help for Step Size Increment factor in Homotopy solver options is incorrect. Here is what the help should be.
Step Size Increment Factor
In the Step Size Increment Factor box, you can specify the factor by which a homotopy step increases or decreases following a successful step. The range is any positive number greater than or equal to 1, and the default is 10.
If the maximum number of iterations over all non-linear groups in the decomposition is > Step Size Increment Factor, then the homotopy step is increased by an amount inversely proportional to the number of steps; otherwise the step size is reduced by a factor of Step_Size / (maximum number of iterations).
The documentation will be updated in a future version of ACM.
Keywords: CQ00189975
References: None |
Problem Statement: The error
Unknown function : XXX at line X
(where XXX is the name of the function or procedure) will be returned if the user attempts to access a function or procedure which has just been loaded from an .rld file. This article describes how to make Aspen SQLplus recognize the newly loaded function or procedure. | Solution: If the procedure is run from the Aspen SQLplus Query Writer then restart TSK_SQL_SERVER in the Aspen InfoPlus.21 Manager after the .rld file is loaded into the new snapshot.
If the procedure is run from a CompQueryDef record then restart the TSK_IQ# task which processes the query.
Keywords: Unknown function;
SQL Plus;
Aspen SQL Plus;
References: None |
Problem Statement: When I run a Shell & Tube Exchanger case, the calculation stops and gives error message Input Error 1124 - The data input for Number of tube passes is unacceptable. Where does this error come from and how can it be resolved? | Solution: This error due to the user specifying an odd numbers of tube pass combined with a U-tube rear head type. These inputs can be found either on the Input | Exchanger Geometry | Geometry Summary | Geometry tab, Input | Exchanger Geometry | Shell/Heads/Flanges/Tubesheets/Shell/Heads tab or the Input | Exchanger Geometry | Bundle layout | Layout Parameters tab.
A U-bend rear head type makes it compulsory to have the tubeside inlet and outlet nozzles located on the front head of the exchanger, which means the number of tube pass must be an even number. If the tube pass is specified as an odd number such as 3, 5, 7... then the above error will occur and the calculation can not continue. Re-setting the tube pass number to an even number will resolve the error.
Keywords: Error 1124, Number of tube passes, U rear head type, U bend, Unacceptable
References: None |
Problem Statement: This knowledge base article describes how to connect to an Aspen SQLplus server without using a data source name. In other words, through a DSN-less connection. | Solution: You can connect to Aspen SQLplus without using the typical System Data Source Name (DSN) configured in
Control Panel | Administrative Tools | Data Sources (ODBC)
Instead use a File DSN. This is a .dsn file located at:
<drive> :\Program Files\Common Files\ODBC\Data Sources
This file contains the connection string information required to make the connection. The .dsn file needs to be created on the Aspen InfoPlus.21 server machine. Then copy the file to the necessary client PC(s). From the client machine go to ODBC Data Source administrator | File-DSN tab and add the file copied from the server.
The connection string must contain a drive specification and either an ADSA Data Source Name or a host name and port number. By default the connection to the Aspen SQLplus server is done using the current logged-in user. You can connect as a different user by specifying the UID (user ID) and the PWD (password) to the connection string. For example:
DRIVER={AspenTech SQLplus};HOST=hostname; UID=mydomain\myuser;PWD=mypassword
For More information refer to Aspen Desktop ODBC User's Guide (page30)
Keywords: DSN-Less
User name
Password
usr
pwd
References: None |
Problem Statement: How to list the time parameters of a History Repository using Aspen SQLplus. | Solution: While these parameters are easily viewable from within the Aspen InfoPlus.21 Administrator, there may arise the need to list the Repository time parameters by use of an Aspen SQL Plus query.
Past Time specifies the length of time in the past that values with timestamps prior to the current time can be inserted or changed in the Aspen InfoPlus.21 database.
Query 1 demonstrates how to list the Past Time Parameter of a History Repository along with the results. The results in this example show a Past Time Parameter of 4800 hours. (200 days)
Future Time specifies the length of time into the future that values can be inserted into the Aspen InfoPlus.21 database.
Query 2 demonstrates how to list the Future Time Parameter of a History Repository along with the results. The results in this example show a Future Time Parameter of 24 hours (1 day)
Keywords: History;
Time Parameter;
Past Time;
Future Time;
Historian;
Repository;
References: None |
Problem Statement: What is tearing for procedures? How is it used? | Solution: It is an advanced technique that can be used with procedures. It may improve model robustness and calculation speed. It is used in Aspen Dynamics for the implementation of the local properties models.
In general it is best to avoid using tearing, unless you have enough experience in using ACM.
When tearing is enabled, the group decomposition (the way the equations are grouped together for the reSolution of the full system) contains two levels. When a group of equations contain a torn procedure, we see a second level of decomposition. You can see on the screen capture below that the group 24 is torn.
Let's assume that our simulation contains 3 groups (shown below in a matrix form). The second group contains the equations generated by the torn procedure that returns Xh and Xi.
The reSolution of the system is working through the following steps:
- Solve group 1 : gives Xa, Xb, Xc
- Call torn procedure with current variable values
(Xh, Xi) = pProc (Xd, Xe, Xf, Xg) TEAR
Output variables Xh and Xi are temporarily fixed
- Solve subgroup 2
- Solve subgroup 3
- Call procedure again
- Compare new output variables Xh and Xi to previous values
- If difference larger than tolerance - repeat with new Xh and Xi (using Direct substitution or Weigstein)
- Solve group 4
Note that the loop is only done for initialization and steady state runs.
The conclusion is that the way the equations are solved is dramatically different when tearing is enabled. In some cases, this change may give better convergence properties to the system, in which case using tearing may be advantageous.
Tearing applies only to procedures. You specify that you want to tear a procedure by putting the TEAR keyword after the call to the procedure in the model or stream type. Tearing is active only when enabled in the Run, Solver Options, Tearing.
A common way to use tearing is to have a procedure that takes one input argument and one output argument, and simply sets the output argument equal to the input value.
The source code for the procedure and one example is attached (see example-decomposition-tear.acmf). You can just run the simulation and look in the Diagnostics folder for the decomposition display.
A second example is provided. This is based on the ssmeth example (steady state methanol process production process). We have added a model to tear the recycle stream (S7, S8).
The TearBlock model is:
Model TearBlock
In_F as Input Material;
Out_P as Output Material;
Flow_slack(componentlist) as realvariable (0, fixed);
Tearing as yesno (no);
if Tearing == no then
out_p.Flow = in_f.Flow + Flow_slack;
else
for i in componentlist do
call (out_p.Flow(i)) = pCopyVal (in_f.Flow(i)) tear;
endfor
endif
End
You can see that when tearing is enabled, the largest group solved contains 13 equations. When tearing is not enabled, the largest group contains 71 equations. The tearing option allows the simulation to be solved in smaller groups, which may help convergence and speed. However attractive it looks, tearing should only be considered after careful consideration as it also has some side effects that may be difficult to troubleshoot.
Keywords:
References: None |
Problem Statement: Executing a query that searches for the last x number of values in the sequence, based on the actual sequence number may produce unexpected results. The problem is that when the history sequence number (histseqnum) reaches its maximum number, it then resets to 0.
What is the maximum value for histseqnum? What are the consequences of using histseqnum in custom applications? | Solution: The maximum value for histseqnum (history sequence number) is 2147483647. Here is a brief history of its usage.
Many years ago, the SETCIM product did use HISTSEQNUM to determine the order of occurrences in history. However, the current real-time database product, InfoPlus.21, does not use this number for ordering occurrences. In fact, the HISTSEQNUM is only provided as a hold-over for customers who have upgraded from SETCIM. Typically, the engineers and developers who use HISTSEQNUM learned to do this in the SETCIM days and have not updated their technique to match the current product.
The situation, where HISTSEQNUM is rolling-over and starting again at zero, is a normal and expected operation of the HISTSEQNUM.
In order to retrieve the most recent occurrence in history using your custom program, there are three options:
1. Change your program to take the possibility of a HISTSEQNUM rollover into account. This is not recommended.
2. Change your program to select the occurrence with the most recent date.
3. Change your program to select the first occurrence (OCCNUM) in the repeat area. The first occurrence is always the most recent. This is the preferred and most efficient method for finding the most recent value in history.
4. In case you wanted the most recent 10 values for example, you could not use OCCNUM. The recommendation in that case would be to use the actual history system keys (key timestamps) and the appropriate API calls, such as RHIS21DAT, for example.
Keywords:
References: None |
Problem Statement: What can be done with multiports in VB scripts or Visual Basic (VBA)? | Solution: A Multport is very similar to a regular port.
Properties of ports in the modeling language are exposed as properties of the port object. For example, to access the Flow variable of the Feed port of a block M1 in the flowsheet you can write:
FlowVar = Simulation.Flowsheet.M1.Feed.Flow
For a Multiport you need to specify the name of the connected stream for which you wish to access a property. For example, to access the Flow variable of the stream S1 attached to the Feed port of block M1 in the flowsheet you can write:
FlowVar = Simulation.Flowsheet.M1.Feed.Connection(S1).Flow
The Connection property of the multiport is an array of the connected ports.
You can also use the following additional methods for port objects:
Method Description
Name() The name of the object relative to its parent model
GetPath() The full path to an object from the flowsheet
TypeName() The name of the type of an object
Resolve() Convert a string path to an object
Below is an example Aspen Custom Modeler VBScript that shows how to access and print details of a stream attached to a port called Feed, and of all of the streams attached to a multiport called FeedM:
p = M1.Feed
application.msg Name of attached stream is + cstr(p.Name)
application.msg Path of attached stream is + cstr(p.GetPath)
application.msg Type of attached stream is + cstr(p.TypeName)
application.msg Flow in attached stream is + cstr(p.Flow.Value)
application.msg Number of connected streams = + _
cstr(M1.FeedM.connection.Count)
for each p in M1.FeedM.connection
application.msg Name of attached stream is + cstr(p.Name)
application.msg Path of attached stream is + cstr(p.GetPath)
application.msg Type of attached stream is + cstr(p.TypeName)
application.msg Flow in attached stream is + cstr(p.Flow.Value)
next
This description will be added to the on-line help of V7.0.
Keywords: None
References: None |
Problem Statement: Error : 1114. Failed to Connect to Link IP21: Specified Driver could not be loaded due to system error 114
What is the meaning of error number 1114, while configuring ODBC OAM Connection through Aspen SQplus? | Solution: This error is returned by Aspen SQLplus, while creating new ODBC OAM Connection to Oracle database, if the system environment variable path was not defined properly.
To resolve this issue, open the system environment variable path' on the computer and update the location of BIN folder appropriately.
This issue is related to ORACLE and it is documented in the Oracle Documentation.
Keywords: 1114
system error
ODBC
SQL
References: None |
Problem Statement: This knowledge base article explains how to select values from multiple Aspen InfoPlus.21 databases through a single Aspen SQLplus query. | Solution: TheSolution is to create an ODBC data source and corresponding external link in Aspen SQLplus for each Aspen InfoPlus.21 database to be included in the query. Include references to those links in the query and the user can select data from multiple databases from within one query. External links to other ODBC compliant databases such as Microsoft SQL Server or Oracle can also be included in the same query along with connections to one or several Aspen InfoPlus.21 databases.
? Create an ODBC data source for each Aspen ADSA data source.
1. Go to Start | Settings | Control Panel | Administrative Tools | Data Sources ODBC.
Click Add.
2. In the Create New Data Source dialogue box select AspenTech SQLplus as the driver and Click Finish. This opens up SQLplus Setup window.
3. Create an ODBC data source IP21DB_No1 and referencing to the correct Aspen ADSA data source in the Aspen Data Source field.
4. Create an ODBC data source for IP21DB_No2 in the same way.
? Create External Links for each ODBC data source in Aspen SQLplus Query Writer Database Wizard. Click Add Link to begin.
Create External Link for IP21DB_No1 referencing the IP21DB_No1 ODBC data source
? Create External Link for IP21DB_No2 referencing the IP21DB_No2 ODBC data source
? Use Wizard to build query. Start by expanding the External Link
Scroll to IP_AnalogDef and select desired columns. Paste query after selecting field names.
Edit query adding a simple Where clause. This query returns values from two different Aspen InfoPlus.21 databases. More data sources could be added to this query if more External Links were configured.
Note: If the user had External Links configured to Oracle or MS SQL Server databases, they could be included side by side with connections to multiple Aspen InfoPlus.21 databases as well.
Keywords: ODBC
Database links
References: None |
Problem Statement: Is it possible to delete and insert repeat area occurrences? | Solution: Two commands, DELOCCS and INSOCCS, allow users to delete occurrences from and insert occurrences into Aspen InfoPlus.21 normal repeat areas.
DELOCCS can be used to delete occurrences from a repeat area. This function takes three parameters.
1. A field pointer to a field in the repeat area.
2. The starting occurrence number.
3. The number of occurrences (defaults to 1)
INSOCCS inserts occurrences into a repeat area. This function takes three parameters.
1. A field pointer to a field in the repeat area.
2. The starting occurrence number.
3. The number of occurrences (defaults to 1)
Below is a sample query with results.
SELECT OCCNUM, IO_TAGNAME from TEST_GET.1
OCCNUM IO_TAGNAME
----------
Keywords: None
References: None |
Problem Statement: How do you get the date and time of the oldest data in history for a given tag? | Solution: The following select statement returns the oldest timestamp recorded in history for the tag atcai:
SELECT MIN(IP_TREND_TIME) as Start Time from atcai.1;
Keywords: beginning
earliest
References: None |
Problem Statement: How to do a SELECT statement in Aspen SQLplus on a column in Oracle declared as NUMBER(*,0).
In this example the column LRSDATAPOINTID is used as index for the data in the table RSDATAPOINT and is declared as NUMBER(*,0) to represent the largest number field available in Oracle.
This shows how the data is represented within Oracle:
This shows how the table is defined in Oracle:
Issuing a simple SELECT statement to view the data in this table within Aspen SQLplus, the value is returned in Scientific Notation. | Solution: In order to get the data to be represented in the same format that Oracle uses, in Aspen SQLplus you should use the CAST function
Keywords: None
References: None |
Problem Statement: What is the purpose of the PRECALL and POSTCALL options in a procedure? | Solution: By default, a procedure is called when ACM requires the calculation of the output variables for new input variables, during the reSolution of the equations of the simulation.
Sometimes you may want to initialize the internal variables of your procedure before the simulation is actually solved. Symmetrically, you may also want the procedure to be called once the simulation is solved, for example to create report files or release resources that would have been allocated by the subroutines.
This can be done by using the PRECALL and POSTCALL options.
The code of the subroutine is as follows:
SUBROUTINE DEMOPROC(x,y,ifail,icall)
IMPLICIT NONE
DOUBLE PRECISION x,y
INTEGER ifail, icall
INTEGER IOK, IWARN, ISEVERE, IFATAL
C Possible values for Ifail return flag
PARAMETER(IOK=1,IWARN=2,ISEVERE=3,IFATAL=4)
INTEGER IOutputs, IPreCall, IPostCall
C Values for ICall:
PARAMETER (IOutputs=0, IPreCall=1, IPostCall=2)
INTEGER IDerivs, IBoth
PARAMETER(IDerivs=3, IBoth=4)
C
IF ( ICALL .EQ. IPreCall ) THEN
C PreCall code here
call acm_print(0, pre call x=%g y=%g, x,y,0,0,0)
Ifail = IOK
ENDIF
C
IF ( ICALL .EQ. IPostCall ) THEN
C PostCall code here
call acm_print(0,post call x=%g y=%g,x,y,0,0,0)
Ifail = IOK
ENDIF
C
IF ( ICALL .EQ. IOutputs ) THEN
C code to calculate output value(s) here
y = x
Ifail = IOK
ENDIF
RETURN
END
When we do a steady state run, we see the following messages in the simulation messages window:
Starting run at 11:27:27
pre call x=1 y=1
Solving steady state ...
Steady stateSolution complete
post call x=1 y=1
Run complete at 11:27:27
When we do an initialization run:
Starting run at 11:28:17
pre call x=1 y=1
Initializing at time 0
post call x=1 y=1
Run complete at 11:28:17
For a dynamic run paused at 0.05 hr, we get the following messages:
Starting run at 11:31:15
pre call x=1 y=1
Initializing at time 0
Integrating from 0 to 0.01
Restarting integrator at 0
Step 1: Time = 0.005, step = 0.005 accepted, error/tol = 0
Step 2: Time = 0.0125, step = 0.0075 accepted, error/tol = 0
Integrating from 0.01 to 0.02
Step 3: Time = 0.02375, step = 0.01125 accepted, error/tol = 0
Integrating from 0.02 to 0.03
Step 4: Time = 0.040625, step = 0.016875 accepted, error/tol = 0
Run complete at 11:31:15
You can see that the post call message is not displayed. The post call will occur only if we change the run mode, or modify the simulation structure, or close the simulation. It will not happen if we just restart the simulation. This is because the dynamic run mode does not end for ACM strictly speaking. It merely pauses. The run ends only if you modify the simulation, or you close it. This is because when a dynamic run is paused, ACM cannot anticipate what the user will do next: will he continue the run or do something else. This is why the dynamic run mode behaves differently from initialization and steady state modes.
When ACM loads in a DLL, it first looks for a function called DLLINITIALIZE, and if it exists, it call it once (only once, until the DLL is loaded again).
This is a good place to put all your initialization code that has to be done for several routines (otherwise you could use the PRECALL). This is the best place to initialize shared common blocks (ie data read from external files).
Conversely, if there is a DLLFINALIZE function in the dll, it will be called when the simulation is complete.
For a steady state and an initialization run:
- user clicks run button:
-- if dll not already loaded, call DLLINITIALIZE (if existing)
-- procedures with PRECALL are called
-- simulation is solved
-- procedures with POSTCALL are called
- user unloads dll (from Run menu) or closes ACM
-- DLLFINALIZE is called (if existing)
For a dynamic run:
- user clicks run button:
-- if dll not already loaded, call DLLINITIALIZE (if existing)
-- procedures with PRECALL are called
-- simulation is integrated
- simulation run mode is changed, or simulation structure is modified, or simulation is closed
-- procedures with POSTCALL are called
- user unloads dll (from Run menu) or closes ACM
-- DLLFINALIZE is called (if existing)
There are multiple applications for these features, although most procedures will actually not require them. You will use the PRECALL option when you need to set up data in your subroutine, for example if you need to read data from a file (it would be excessively slow if this was done at each call to the procedure). We use PRECALL for instance in the DMCplus interface, where we need to initialize the connection with the DMCplus on-line software. Another application is for the performance curves of compressors, where we use internally a curve fitting algorithm. Repeating the curve fitting algorithm during the run would be slow, so we apply it only once (in PRECALL) and store the processed data to handle the calculations more efficiently during the dynamic run.
You can also use the POSTCALL feature if you wish to analyze the simulation results after a steady state run, to report to the user any problem (such as a variable outside of the expected range of applicability of the model). We use the POSTCALL option in our interface to DMCplus to release the resources allocated during the run, and terminate the connection to the DMCplus on-line software.
DLLINITIALIZE function is an alternative to the PRECALL. It is convenient when you need to initialize data (e.g. read from a file) that will be shared by different subroutines. Using a PRECALL would not be as convenient as you would have to check in each subroutine if the data are initialized (as you don't not in which order the procedures will be called by the models).
The example attached can be used with version 12.1 and illustrates the sequence of calls. For higher versions, go to Tools, Generate Procedure Code, generate the Makefile if you want to rebuild the dll. You can use the dll attached with any version.
Keywords:
References: None |
Problem Statement: How can I have a script invoked automatically when I run the simulation or step the simulation? | Solution: This is possible in version 2004 and 2004.1, even though it is not documented in the on-line help. The mechanism used is similar to the OnLoadSimulation script (which is invoked automatically when you load a simulation in ACM).
When present, the script OnStartRun is invoked when you click on the Run button. The script is then responsible for actually running the simulation (e.g. you need to invoke the Application.Simulation.Run(True) or Application.Simulation.Run(False) method, depending on whether you want to do a synchronous or asynchronous run). The script must be located in the Flowsheet folder (not in the Scripts folder in Custom Modeling).
When present, the script OnStepRun is invoked when you click on the Step button. The script is then responsible for actually stepping the simulation (e.g. you need to invoke the Application.Simulation.Step(True) or Application.Simulation.Step(False) method, depending on whether you want to do a synchronous step or asynchronous step). The script must be located in the Flowsheet folder.
These event-based scripts can be useful when you want to perform some actions automatically upon running the simulation (e.g. check specifications, send data to an external application, etc).
Keywords: script
References: None |
Problem Statement: How to get a list of all selector records? | Solution: select name from all_records where definition like 'select%'
Here is some additional information from the Aspen SQLPus help file.
The word ALL_RECORDS can be used in the FROM clause of a query. It implies that all records in the database are viewed as a single table. You can use a wildcard in a LIKE clause if you want to specify a pattern match for a character string.
Wildcards:
? _ (underscore): Matches a single character
% (percent): Matches any number of characters, including no characters.
You must enclose the string that you want to match in single quotation marks ( ' ' ).
Keywords:
References: None |
Problem Statement: How do Aspen SQLplus and IQ tasks work in multi-threaded mode? What is the difference between single and multi-threaded configurations? | Solution: If you have queries containing WAIT statements, you can set the mode of execution of external query tasks (e.g. TSK_IQ1) to allow multi-threaded query execution so that an external query task can process another query during the wait. Otherwise, one query waiting for minutes or hours would prevent other queries from executing. You can enable the multi-threaded mode of execution by specifying /m in the Command line parameters box of the external task in the Aspen InfoPlus.21 Manager.
Keywords: Multi-thread
SQLplus Query Writer
IQtask
References: None |
Problem Statement: Aspen SQLPlus queries can be structured to insert data sorted by time so that all data points for a time period are inserted into all tags before inserting data for the next time period. Queries can also be structured to insert data sorted by tag name so that all data points for a tag are inserted before inserting data for the next tag. Tests have shown that inserting data sorted by tag name is significantly faster than inserting data sorted by time. | Solution: Here are a couple reasons why inserting large amounts of data into Aspen InfoPlus.21 using Aspen SQLPlus is faster when data is sorted by tag name.
Inserting data sorted by tag name allows the query to function more efficiently because is only has to translate the tag names into record id's once per statement. It also reduces the number of function calls to whis21dat() which checks for the prior existence of a history event with the same key timestamp. Also Queuing a large number of events at once for the same tag could place much of the data in the history event queue for faster inserts.
Keywords: sql
script
References: None |
Problem Statement: How to filter tags that have IP_TREND_VALUEs with a difference between two consecutive IP_TREND_VALUEs is larger than 50.
For instance, you want to find out which tagshave IP_TREND_VALUEs between 1000 and 10000 and have a difference in value between two consecutive IP_TREND_VALUEs that is larger than 50. | Solution: 1. Run the following Aspen SQLplus script in the Query Writer to get all IP_TREND_VALUE (range of 1000~10000) of all tags.
Select name, value from HISTORY
where value >1000 and value < 10000;
2. Copy results to Microsoft Excel as shown in the following:
3. In column C, set the function to get the difference between two consecutive IP_TREND_VALUE.
4. In column D, set the function to get tag names: :
Keywords: Aspen SQLplus
select
IP_TREND_VALUE
RANGE
Excel
References: None |
Problem Statement: How can SQLplus query output be written directly to an EXCEL spreadsheet using a COM object? | Solution: Below are two examples showing how to write to Excel using a COM object.
Example 1: Get an array from Excel - change elements in the array - write the array to Excel.
Keywords: None
References: None |
Problem Statement: An Aspen SQLplus Generic Query is a Query record that can service the needs of many data records.
In other words when any of a series of data records are activated they will cause the Generic Query to be activated.
The Online Aspen SQLplus Help files give an excellent example of the setup, as does the Web Support Knowledge-base article 110276.
Part of the configuration is that the data record not only has to point to the Generic Query, it also has to point to an External Task (such as TSK_IQ5) configured to execute iqtask.exe
However, as with all SQLplus Query records, the Generic Query record itself also has a pointer to an External Task executing iqtask.exe.
The question is, with an example of the data record pointing to TSK_IQ5 and the Generic Query record pointing to TSK_IQ2, which of the tasks is the one that actually executes the Generic Query. | Solution: When a Query record is activated normally it will be processed by the external task it references.
When a Query record is activated as a Generic Query it will be processed by the external task passed down by the data record. (TSK_IQ5 in the example above).
As stated, a Generic Query can service many data records. Therefore, the benefit is that if necessary, the load can be shared between multiple external tasks simply by configuring different data records to use different external tasks but for the same Generic Query.
Keywords:
References: None |
Problem Statement: Aggregate values, such as Average, Maximum, Minimum, are assigned a status of either Good, Bad, or Suspect by Process Data. If more than 1% of the data points in the aggregate time period are bad, the status of the aggregate is marked as suspect. If more than 50% of the data points are bad, the status of the aggregate is marked bad.
How can one determine the exact percentage of good values in the aggregate period? | Solution: select ((good/(good + ng))*100) AS percent good from aggregates
where name = 'Machine State'
and request =0
and ts between '14-oct-05 12:00:00' and '14:00:00'
and period = 2:00;
In this case, the query calculates the good points divided by the total points (good + not good) from the aggregates table where the tag is Machine State and the time period is between noon and 2 pm today. The request = 0 means it will look at actual data.
Keywords:
References: None |
Problem Statement: When selecting history data from the repeat area of a record, Aspen SQLplus returns the error:
Disk history not running at line <number>
where <number> is the line number of the query executing the select statement.
For example, the following query:
select ip_trend_time, ip_trend_value from tag1 where ip_trend_time > '01-jan-10 12:00:00'
may produce the error:
Disk history not running at line 1
even though Aspen Process Explorer and the Aspen InfoPlus.21 Administrator both show correct data from history. | Solution: The most likely cause of this error is either a corrupt Aspen InfoPlus.21 archive file set or the history repository contains two or more file sets which have overlapping dates. Use the Aspen InfoPlus.21 Administrator to verify there are no overlapping file sets in the repository.
If there are no overlapping file sets, then one or more of the file sets may be corrupt. It may be possible to determine which file set needs to be repaired by looking at the files (arc.dat, arc.byte, arc.key) within the file set folder. In some cases, this behavior has been seen when the arc.key file is missing or has a zero size.
In order to rebuild file sets, start the Aspen InfoPlus.21 Manager and select Actions->Repair Archive
At this point, you will be able to select a repository and file sets in the repository to repair. If you have file sets with overlapping dates, rebuild each overlapping file set. If necessary, the H21 Archive Check Wizard will adjust the ending dates of file sets to prevent overlaps.
The wizard performs the same functions as the utility C:\Program Files\AspenTech\InfoPlus.21\c21\h21\bin\h21arcck. For instructions on running h21arcck, see the knowledge base article 108428.
What if all of the file sets look OK? It is then time to consider running H21 Archive Check Wizard on all file sets. Why? Aspen Process Explorer and the Aspen InfoPlus.21 Administrator use a history function called RHIS21DATA whereas SQLplus uses RHISDATAUSTS. RHISDATAUSTS uses history sequence numbers, while RHIS21DATA uses timestamps. When Aspen Process Explorer or the Aspen InfoPlus.21 Administrator makes a request for data, it is based strictly on the key timestamps. Only the data in the time frame requested is interrogated by the history function call. When RHISDATAUSTS makes a request for data, it requests 800 occurrences of data starting at current time looking backwards. If it finds the data requested by the Aspen SQLplus query in those 800 occurrences, it displays the data. If it does not find the data, Aspen SQLplus requests 800 more occurrences. And so on. If there is some problem in the 800 occurrences, the query results could be skewed or the SQLplus query returns the error: Disk history is not running. Most often this is seen when querying tags that do not update very frequently - such as once per day. In this case, a request for data 3 days ago could illuminate a problem with history in filesets from 2 years ago. Whereas with Process Explorer, a request for data 3 days ago only requests data from 3 days ago - no matter how many occurrences are involved.
Keywords: h21arcck
References: None |
Problem Statement: Assignments not processed after structural change
See the attached example to illustrate the problem in version 2004.1.
The model TestModel uses the following syntax:
Model TestModel
in_f as input multiport of Fport;
feedset as stringset;
FeedConven(feedset) as yesno;
F as flow_mass (fixed);
for i in FeedSet do
if FeedConven(i) == Yes then
In_F.connection(i).F = F;
endif
endfor
End
We have connected 3 streams to the input multiport in_f, S1, S2 and S4. The FeedSet is [S1, S2, S4]. As a result, the simulation is square and ready to run. However, if we rename the stream S4 to S5, then the simulation becomes incomplete. This is correct because it refers to the variable in_f.Connection(S5).F which does not exist. However, we also observe that if we rename back the stream to S4, the simulation remains incomplete. That requires an explanation. Some structural conditions are not reevaluated. Why?
Note also that the incomplete status is cleared if you save and reload the file or if you rebuild the Custom Modeling folder. | Solution: Something to be aware of when modelling is that the language is not reprocessed when parameters or sets change unless a dependency is set up. In other words, in our example, the condition is not dependent on ConnectionSet, which is the set that is modified, but only on FeedSet, which is not modified. Hence, the condition is not reprocessed. The condition is not reprocessed when ConnectionSet is modified because ConnectionSet is not used explicitly in the model.
To avoid this issue we need to add a dependency on ConnectionSet. The correct model is therefore:
Model TestModelOK
in_f as input multiport of Fport;
feedset as stringset;
FeedConven(feedset) as yesno;
F as flow_mass (fixed);
for i in FeedSet * in_f.connectionset do
if FeedConven(i) == Yes then
In_F.connection(i).F = F;
endif
endfor
End
FeedSet * in_f.ConnectionSet takes the intersection of the FeedSet and ConnectionSet. This has two effects: firstly we have now a dependency on ConnectionSet, which will handle correctly the renaming of the stream. Secondly, the new model is more correct as it will no longer make references to non-existing variables. Strictly, the model leading to incomplete status would be
if in_f.ConnectionSet <> [] then
for i in FeedSet do
if FeedConven(i) == Yes then
In_F.connection(i).F = F;
endif
endfor
endif
It is difficult to foresee a case where an incomplete status would be useful.
Rebuilding the Custom Modeling folder or reloading the simulation forces all assignments to be reevaluated, which is why the incomplete status is cleared after these operations.
Keywords:
References: None |
Problem Statement: The standard aggregate function MAX will return the max value but the time stamp will represent the start or end of the aggregate period and not the time associated with the actual value. | Solution: Sample query to return MAX value and time stamp for value using SQLplus.
If you save the sample function below as a proceduredef you will be able to call this function from any SQLplus script.
-- Get_Max_ValueAndTime(Tag Name , StartTime , EndTime , Period)
function Get_Max_ValueAndTime(n1, StartTime timestamp, EndTime timestamp, P1 integer)
local temp1 timestamp;
temp1 = StartTime;
write 'ts value';
write '-------------------- --------------';
set COLUMN_HEADERS = 0;
for (select max, ts_end from aggregates where name = n1 and ts between StartTime and EndTime and period = P1 and request = 0) do
-- write max || ' ' || temp1 || ' '|| ts_end;
select ts, value from History where name=n1 and ROUND(value, 3) >= ROUND(max,3) and ts between temp1 AND ts_end AND request = 4;
temp1 = ts_end;
end;
end;
Get_Max_ValueAndTime ('atctic301', '07-aug-06 00:00:00', '15-aug-06 00:00:00', 24:00);
Keywords:
References: None |
Problem Statement: Sometimes you want to know which bounds have been modified by the user from the default values of the variable types. Is there a way to list the variables for which bounds have been modified? | Solution: The first option is to create a table with all variables and look for the bounds printed in black. Values in black are those differing from the default value.
The second option is to use a script, with the code shown below, to list the variables in the simulation messages window. The script uses the reset method to work out the default value of the bound, and then compares this with the current value of the bound. It repeats this operation for all variables in the simulation.
private vars, v, lb, up, lbd, upd
set vars = findmatchingvariables(~)
for each v in vars
if not v.isparameter then
lb = v.lower
up = v.upper
v.reset(lower)
v.reset(upper)
lbd = v.lower
upd = v.upper
if lb <> lbd then
application.msg v.name & .lower : & lb & ; // default : & lbd
v.lower = lb
end if
if up <> upd then
application.msg v.name & .upper : & up & ; // default : & upd
v.upper = up
end if
end if
next
Keywords:
References: None |
Problem Statement: Customers use different OPC servers to collect plant data. Is it possible to view OPC server tables and tags using Aspen SQLplus? | Solution: Yes, it is. Download and install an ODBC driver for your specific OPC server (follow the installation procedure supplied by the driver's vendor) and then use the Query Writer to create an ODBC link to the OPC server's database. Please consult Aspen SQLplus help for specific steps needed to create an ODBC link to a remote database.
Keywords:
References: None |
Problem Statement: Can you explain step by step how to create a procedure in FORTRAN and use it in a model in ACM? | Solution: A procedure is a way to perform some calculations and integrate those in the equation oriented model of the simulation. Unlike equations which ACM handles in any direction of information (starting from fixed variables, trying to solve the free variables), the procedure code is implemented in a sequential language such as FORTRAN or C++. This code is called a procedure because ACM executes these calculations in a sequential way, sending the input arguments ot the procedure to the external code, giving it the control of the execution to return the value of the calculated variables (or output arguments). ACM integrates these to the equation oriented model by adding new equations with residuals equal to the current value of the output variable minus the value returned by the procedure. You can find the reference information in ACM on-line help.
ThisSolution illustrates the process of creating a procedure to be used in ACM.
Problem statement
We want to create a procedure.
Input arguments
- SIZE: an array of real values
- FRAC: an array of real values
- LIMIT: a real value
Output argument
- SLIM: a real value
The procedure will be used to evaluate the median of the array. The median of an array or distribution with cumulative distribution function D(x) is the value x such D(x) = 1/2. In our case, SIZE(i) is used to represent the sizes of a particle size distribution (similar to the x variable in the definition above) and FRAC(i) is the mass fraction of the particle distribution of sizes between SIZE(i) and SIZE(i+1). The median will be returned by setting LIMIT to 0.5.
Declare the procedure
You need to go to the Custom Modeling folder, Procedures. Click on Add Procedure. You need then to enter a name for the procedure. The convention is to start the name of each procedure with the letter p (as in procedure), but feel free to use your own convention.
You then get a text editor window in which you can type in the specification of the procedure, i.e. tell ACM what the procedure will be called, what will be the subroutine name in the source code, the location of the source code, the language and the list of input and output arguments.
Procedure pSizeLimit
Library: sizelimit.dll;
Call: sizelimit;
Implementation: subroutine sizelimit.f;
language: fortran;
Inputs: real(*), real(*), real;
Outputs: realvariable;
End
This means our procedure will be in the source file sizelimit.f. This will be implemented in a fortran subroutine. The subroutine name will be sizelimit. The object code once compiled and linked will be in the dynamic link library sizelimit.dll.
The input arguments will be an array of real, another array of real, and a real value. By use real instead of realvariable as the argument type, we allow the user to specify constant values or realparameter, as well as realvariable. The output must be of a variable type.
It is a good practice to add some comments to the procedure, so that the user will know which argument is which, as the order is very important. So a better procedure definition is:
Procedure pSizeLimit
Library: sizelimit.dll;
Call: sizelimit;
Implementation: subroutine sizelimit.f;
language: fortran;
Inputs: real(*), // size array
real(*), // fraction array
real; // limit
Outputs: realvariable; // fraction
End
You need to compile the procedure code (do a right mouse click) so that ACM updates the simulation types.
Write the source code of the procedure
Now we need to write the actual code of the subroutine. This could be left as an exercise for the reader. You can get some help from ACM for that. Go to the Tools menu, Generate procedure code. Check the option Generate template. This will generate the following file:
C Code for Procedure Definition pSizeLimit
C
SUBROUTINE SIZELIMIT(
& InArg1, InArg1Dim1,
& InArg2, InArg2Dim1,
& InArg3,
& OutArg1,
& Ifail
& )
IMPLICIT NONE
C
C Declaration of input arguments
INTEGER InArg1Dim1
DOUBLE PRECISION InArg1(InArg1Dim1)
INTEGER InArg2Dim1
DOUBLE PRECISION InArg2(InArg2Dim1)
DOUBLE PRECISION InArg3
C
C Declaration of output arguments
DOUBLE PRECISION OutArg1
C
INTEGER Ifail, IOK, IWARN, ISEVERE, IFATAL
C Possible values for Ifail return flag
PARAMETER(IOK=1,IWARN=2,ISEVERE=3,IFATAL=4)
C
C ************** Put your FORTRAN code here **************
C
C TODO: Put your code to calculate output value(s) here
C Remember to change IFATAL to IOK
Ifail = IFATAL
C
C *************** End of User FORTRAN Code ***************
RETURN
END
As you can see the code is showing you the list of arguments to the subroutine. This is simply the list of input arguments (for array, an integer argument is specifying the size of the array), followed by the list of output arguments. The argument Ifail is added for the communication between your subroutine and ACM. This is the way your procedure can tell ACM whether the calculations went ok or not.
The actual code is:
SUBROUTINE SIZELIMIT(SIZE,NS,FRAC,NF,LIMIT,SMED,IFAIL)
IMPLICIT NONE
INTEGER NS, NF, IFAIL
DOUBLE PRECISION SIZE(NS), FRAC(NF), LIMIT, SMED
INTEGER I
DOUBLE PRECISION FCUM
IFAIL=2
C set a default value in case something goes wrong
SMED=SIZE(1)
C fail if sizes don't match
IF(NS.NE.NF)THEN
CALL ACM_PRINT(0,STAT1 error: array sizes don't match,
* 0,0,0,0,0)
C this is a fatal error!
IFAIL = 4
RETURN
ENDIF
C accumulate fractions until we've reached 50%
FCUM=0d0
DO I=1, NS
FCUM=FCUM + FRAC(I)
IF(FCUM.GE.LIMIT)THEN
C back track the median via interpolation
IF(I.LT.NS)THEN
SMED=SIZE(I) + (SIZE(I+1)-SIZE(I))*(FCUM-LIMIT)
ELSE
C last interval
SMED=SIZE(I)
ENDIF
IFAIL=1
GOTO 999
ENDIF
ENDDO
999 RETURN
END
Note we check that the sizes of SIZE array and FRAC are the same. If not, we print a message (using ACM_PRINT) and we return a fatal error. A fatal error should be returned when it is impossible to continue the calculations. This stops the simulation. In some cases, it is better to return an error. In this case, the non-linear solver will cut the steps and attempt to recover. A warning status only prints a message to the simulation messages window.
The purpose of the wrapper
ACM is essentially written in C++. To interface Fortran code to ACM, we had to use some intermediate code, the wrapper, which handles the plumbery of transferring data between C++ code and fortran. This wrapper is written automatically by ACM, and all you need to do is to let ACM create it (that's done by default) and not tamper with it.
Compile and link the source code into a dynamic link library
Once you have written the code, you can compile it. The easiest way is to let ACM do this job by letting it generate a makefile (which is simply a file with the commands to compile and link the source code, in a special language for the NMAKE utility that is delivered with the development tool such as Visual Studio) and invoke the commands.
To do this, go to Tools, Generate Procedure code and check the option Generate makefile and Execute makefile.
You should see some messages in the simulation messages window. If there is a problem you need to check your source code. One typical mistake that is printed during the link step is some missing symbols. Check that you have included all the source code in your source file.
How to call the procedure in a model
Writing a complete crystallizer model will be left as an exercise for the reader (hint: there is an example delivered with ACM). We can illustrate how to call the procedure with the following model.
Model demo
n as integerparameter (20);
sizes([1:n]) as realparameter;
frac([1:n]) as realvariable;
mu as realvariable (fixed, 12);
std as realvariable (fixed, 4);
pie as realvariable;
for i in [1:n] do
sizes(i) : i;
endfor
for i in [1:n] do
frac(i) = exp(-((mu - sizes(i))/2/std)^2)/ pie;
endfor
sigma(frac) = 1;
median as realvariable;
call (median) = pSizeLimit(sizes, frac, 0.5);
End
To call a procedure you need to specify the list of output variables (in the same order as in the procedure definition), and on the right hand size the list of input variables (again, in the same order as in the procedure definition). This example generates a particle size distribution using the normal distribution with two parameters (mu and std). In theory the median for a normal distribution should be equal to the mean, but in practice we see a difference due to the fact we have discretized the distribution.
The files for this example are attached.
Keywords:
References: None |
Problem Statement: When updating a field which is a record pointer (the field which has beside the field name) through an SQL statement, it could receive the following error message as below.
Error writing to <recordName> <record pointer field>: Field is not changeable | Solution: 1. The record needs to be made to UNUSABLE state (USABLE = 0).
2. Updating the state of a record from UNUSABLE to USABLE cannot be done with updating the record pointer field in one statement.
UPDATE IOGetDef SET IO_MAIN_TASK = 'TSK_MSIM', USABLE = 1
WHERE name = 'GetRec';
The reason is the record will be updated to be USABLE before the updating of the record pointer field. By rewriting the statement into two statements as below, the updates will be executed with no error encounter.
UPDATE IOGetDef SET IO_MAIN_TASK = 'TSK_MSIM' WHERE name = 'GetRec';
UPDATE IOGetDef SET USABLE = 1 WHERE name = 'GetRec';
Note: This issue will not be encountered if you are updating the record pointer field together with updating the state of a record from USABLE to UNUSABLE since it is updated to UNUSABLE first before updating the record pointer field.
There is no difference in the result of the below two statements as the positioning of the USABLE = 0 does not affect the observed behavior.
UPDATE IOGetDef SET USABLE = 0, IO_MAIN_TASK = 'TSK_MSIM' WHERE name = 'GetRec';
UPDATE IOGetDef SET IO_MAIN_TASK = 'TSK_MSIM', USABLE = 0 WHERE name = 'GetRec';
Keywords: UPDATE
USABLE
Record pointer
Field is not changeable
References: None |
Problem Statement: A query which selects values directly from Aspen InfoPlus.21 can take a long time if a lot of history values are returned and if the data is sufficiently old so that it does not reside in memory. This knowledge base article provides some suggestions to make the query results return more quickly. | Solution: 1. Apply the ORDER BY (ascending) statement to the time stamp column in your query. Due to the way Aspen SQLplus requests the history data, this may make your query a little faster when data is requested directly from history.
2. Query the Aspen SQLplus 'History table' instead of querying the history occurrences directly. The History table is a lot faster because it uses newer Aspen InfoPlus.21 access functions (RHIS21DATA rather than RHISDATAUSTS).
There is an existing enhancement request (CQ00192861) to create a new Aspen InfoPlus.21 API that Aspen SQLplus can use to retrieve data from history more quickly. This enhancement request is currently targeted for v2006.5.
Keywords: None
References: None |
Problem Statement: What is the meaning of the integration tolerance for the Implicit Euler variable step integration method? | Solution: The absolute and relative integration error tolerance controls the step size. The algorithm controls the step size to keep the integration error within this specified tolerance. The actual integration error is not known for general systems. The absolute and relative tolerances control an estimate of the local truncation error, i.e. difference between predicted and corrected values.
To illustrate the effect of the tolerance settings, we can use a system for which we can evaluate the analyticalSolution and compare it with theSolution found by numerical integration. The syntax for adding complex equations and code samples to yourSolution body is:
Model example
x as realvariable (initial, 0, description:numericalSolution);
xa as realvariable (description:analyticalSolution);
error as realvariable (description:integration error);
// first order lag
$x = 1 - x;
xa = 1 - exp(-time);
error = xa - x;
End
Results
tolerance error steps
1.00E-05 8.64E-04 224
1.00E-06 2.75E-04 704
1.00E-07 8.69E-05 2222
1.00E-08 2.75E-05 7015
1.00E-09 8.70E-06 22177
1.00E-10 2.75E-06 70112
In ACM, the tolerance is a measure of the square root of the integration error. You can see that a decrease of the integration tolerance by a factor of 100 leads only to a reduction of the actual integration error by a factor of 10. Note also that the number of steps is increased by a factor of 10. The number of steps is proportional to the inverse of the error. This is expected since Euler is first order (error = O(h) = O(1/steps) if we take h = 1/steps as a rough approximation).
Missing out some detail of the integration algorithm, the step size is proportional to 1/sqrt(2*E) where E is some RMS measure of the integration error based on the relative and absolute tolerance, so this is why the square root factor of 10 comes from as found in the experiment above.
In general, no one knows the trueSolution, but the tolerance vs error issue may be important to consider in the context of optimization or estimation as done by ACM. The integration error must be a few orders of magnitude smaller than the optimization or estimation tolerance - this means that you should reduce the integration tolerance by twice the order of decrease of error to see the expected improvement in accuracy.
Another fact is that you can see the Implicit Euler method requires a fair amount of calculation effort to get accurate results. Higher order methods, such as Gear, are capable of giving higher accuracy with smaller effort (less time steps), at least when the systems are well behaved (not too many discontinuities - otherwise Gear does not actually use a high order). Therefore it may be worth considering using the Gear algorithm.
Keywords:
References: None |
Problem Statement: This knowledge base article provides an example of how to extract data from Aspen InfoPlus.21 then write the data to a relational database. The relational database used in this example is Oracle. | Solution: 1. Create a database link to your Oracle database.
a) In the Aspen SQLplus Query Writer click on the 'Tables' icon
b) Click the 'Add Link' button
c) Enter the link name, data source name, user & password
2. Expand the database link that you just created so that it points to the relational database table you wish to update. Highlight the column you wish to modify then press 'Paste Query'. This will paste a select statement into the Aspen SQLplus Query Writer. Verify that this select statement returns data. This will show whether or not there are any problems connecting to the remote database. The pasted statement for the example query in step #3 is:
SELECT Tag FROM DBName.ADVISOR3.OLOUSERS
3. You can use a query like the one below to read data from Aspen InfoPlus.21 then write it to Oracle.
FOR (SELECT IP_Description from Atcai) DO
UPDATE DBName.ADVISOR3.OLOUSERS SET Tag = local.IP_Description;
END
In this query:
IP_Description is the database field in Aspen InfoPlus.21 to read
Atcai is the Aspen InfoPlus.21 record to read
DBName is the database link name
ADVISOR3 is the username in Oracle
OLOUSERS is the table name
Tag is the column to update
Keywords: Remote
Query
Store
Table
ORA
SQL Server
SQLServer
DB2
MSAccess
Access
References: None |
Problem Statement: When an Aspen SQLplus web report is run, the results window does not appear. The status bar of the original window displays something to the effect that pop-ups have been blocked. | Solution: Ensure that internet browsers, such as Internet Explorer are set to allow pop-up windows.
Keywords: pop up
block
blocked
References: None |
Problem Statement: How can I prevent a user from seeing the code of my models? | Solution: One way is to use the PRIVATE keyword and create a library. The PRIVATE keyword applies only when the models are in a library, not when they are in the custom modeling folder. The effect of the PRIVATE keyword is to make the model or stream type no longer visible, which means the user cannot see its code. The instructions below illustrate how to use this keyword.
- Open the simulation models-demo.acmf
- Edit the model Mixer and put in front of the keyword Model the keyword Private
- Compile the model
- Save the file as a library
- Save the file as acmf
- Create a new simulation file
- File, Open Library
The code of the Mixer model can no longer be seen because it is private.
This approach is fine for submodels, but it needs one additional trick to make it usable for models that can be placed on the flowsheet. The technique can also be useful for submodels. The trick is to create a wrapper model, which uses the private model:
- Open the file models-demo.acmf after having done the change explained above
- Create a new model MixerPublic
- Enter the code and compile it:
Model MixerPublic Uses Mixer
End
- Copy and paste the icons of the Mixer model to the MixerPublic model
- Copy and paste any script you wish to make visible from the Mixer model to the MixerPublic model
- Select the default form for the MixerPublic model (forms are inherited, but not the default selection)
- Create the library
When the user of the library will wish to create a block, he will drag&drop the MixerPublic model on the flowsheet.
Note that the PRIVATE keyword can be used in the same way for stream types.
Keywords:
References: None |
Problem Statement: A model for a tank with internal weir will be used to illustrate some convergence problems.
The code of the model is as follows.
Model TankWithWeir
Fi as flow_vol (fixed, 5);
Fo as flow_vol;
V as volume (initial, 4);
kweir as realvariable (fixed, 1);
Vweir as volume (fixed, 1);
$V = Fi - Fo;
if V > Vweir then
Fo = kweir * (V- Vweir)^(3/2);
else
Fo = 0;
endif
End
This simulation seems to run fine, but in steady state run mode, some convergence problems are observed:
Newton iteration 89: The following variable was arbitrarily perturbed:
B1.V
Newton iteration 90: Var. Norm=0.000e+000,Eqn. Norm=5.000e+000 (best 5.000e+000, 9 iter. ago)
Newton iteration 90: The following equation was ignored due to singularity:
B1.AM_If1.Row(1)
Newton iteration 90: The following variable was arbitrarily perturbed:
B1.V
Newton iteration 91: Var. Norm=0.000e+000,Eqn. Norm=5.000e+000 (best 5.000e+000, 10 iter. ago)
Newton iteration 91: No norm reduction over last 10 iterations
Newton: No norm reduction after 10 step reductions
Non-linear solver failed to converge. Cannot converge below specified tolerance.
Group 2: Non-linear solver failed to converge. Cannot converge below specified tolerance.
Nonlinear group 2 failed to solve
A sub-group in the decomposition failed to solve
Steady state | Solution: failure
Solution
The problem is caused by the run time condition when the preset value of V is lower than Vweir. In this case, the solver is stuck on the THEN branch, which causes Fo to be equal to zero. This is not right, as for the steady state case, the outlet flowrate must be equal to the inlet flowrate. This is a hidden singularity which is not really readily detected by the solver. You can see that Vnorm is equal to zero, so the solver is unable to move away from the starting point.
OneSolution is to rewrite the model to take the run mode in consideration. For the steady state case, the equation is modified to avoid raising a negative number (V-Vweir) to a fraction power.
Model TankWithWeir
Fi as flow_vol (fixed, 5);
Fo as flow_vol;
V as volume (initial, 4);
kweir as realvariable (fixed, 1);
Vweir as volume (fixed, 1);
SolMode as hidden notype; //Solution mode :
// 1 = Steady state, 2 = Initialization
// 3 = Re-Initialization, 4 = Dynamic
// GetSolution mode
Call (SolMode) = pSolMode();
$V = Fi - Fo;
If Abs(SolMode-1.0)<0.1 Then // Steady state run
Fo = kweir * (V- Vweir)^(3/2);
else
if V > Vweir then
Fo = kweir * (V- Vweir)^(3/2);
else
Fo = 0;
endif
endif
End
You can also use a technique exposed in anotherSolution to handle the power limitations (replace x^y with (abs(x) + eps)^(y-1) * x).
Model TankWithWeir
Fi as flow_vol (fixed, 5);
Fo as flow_vol;
V as volume (initial, 4);
kweir as realvariable (fixed, 1);
Vweir as volume (fixed, 1);
SolMode as hidden notype; //Solution mode :
// 1 = Steady state, 2 = Initialization
// 3 = Re-Initialization, 4 = Dynamic
// GetSolution mode
Call (SolMode) = pSolMode();
$V = Fi - Fo;
if V > Vweir or Abs(SolMode-1.0)<0.1 then
Fo = kweir * (abs(V- Vweir) + 1e-5)^(3/2-1) * (V-Vweir);
else
Fo = 0;
endif
End
Keywords:
References: None |
Problem Statement: When writing query output to a text file, it doesn't contain any formating, so if the file is opened in a web page the columns do not line up correctly. | Solution: The example below uses HTML formating to create a text file with a table.
Keywords: None
References: None |
Problem Statement: How to run a query that is activated by a change of state record (COS) query on system startup?
COS queries look at tag values for changes in order to execute, BUT you might need to execute them when the system starts up to ensure the data integrity of the tags they write to. | Solution: 1. Create an sql query that activates the Change of State (COS) querie(s): this query will have the following syntax: ACTTSK 'queryname'
2. Save it as an sql file (my_query.sql)
3. Add a record/TSK in IP.21 Manager to run the sql file: To do this:
a. Using IP.21 administrator, create an external task record (defined by ExternalTskDef), called something like TSK_STUP.
b. In IP.21 Manager, add a task named TSK_STUP, configure this task to have the executable=%SETCIMCODE%\iq.exe and the Command Line Parameter = my_query.sql
4. Be sure to move this new task so it's the last item in the IP.21 Manager
5. You do not need External Task checked as this runs and finishes.
6. Every time you start the database, this task will run and activate your COS record once.
Keywords: COS
System startup
References: None |
Problem Statement: SQLplus does not run on schedule or occassionally skips a scheduled execution. | Solution: Check to see how many queries are scheduled to run under the query task (such as TSK_IQ1). If you have too many queries trying to execute or if you have one or more queries that take a long time to execute, this could cause other queries not to be activated on schedule. If the query runs on schedule most of the time, the you can look for a query or queries that run infrequently as the source of the problem.
To correct the problem, create one or more new tasks for executing queries, such as TSK_IQ2, TSK_IQ3, or TSK_ABC. You can divide your queries to have critical, high frequency tasks running on one task, with lower importance or lower frequency queries running on other tasks.
Keywords: schedule
miss
skip
skipped
missed
References: None |
Problem Statement: How do I assign a value to a variable using a mathematical expression? | Solution: When defining a variable, it is possible to assign a value to it directly in the variable definition statement. In addition, an expression can be used to determine the assignment value.
For example:
Model Tank
Vol as Volume;
K as Constant(Fixed, 2);
H as Length;
XSArea as Area(Fixed, K*1.5+SQRT(2));
.
.
.
Keywords: modeling language
References: None |
Problem Statement: This | Solution: provides additional details on how AVG, SUM, MAX and MIN statistics in the AGGREGATES table are calculated. It does not replace any information already available in the SQLplus Help files.
Solution
To run this example, insert the following values (using a current date) into a new tag.Solution 100949 describes the procedure.
IP_TREND_TIME IP_TREND_VALUE
-------------------- --------------
27-OCT-04 12:00:00.0 1.000
27-OCT-04 12:00:30.0 2.000
27-OCT-04 12:00:50.0 5.000
27-OCT-04 12:00:55.0 100.000
27-OCT-04 12:01:00.0 0.000
27-OCT-04 12:02:00.0 1.000
27-OCT-04 12:02:30.0 2.000
27-OCT-04 12:02:50.0 5.000
27-OCT-04 12:02:55.0 100.000
27-OCT-04 12:03:10.0 10.000
Run the script below on the aggregates table:
select min, max, avg, sum from aggregates where name like '<tagname>'
AND ts between '27-OCT-04 12:00' AND '27-OCT-04 12:03'
AND period = 0:01 and request=0;
write ' ';
select min, max, avg, sum from aggregates where name like '<tagname>'
AND ts between '27-OCT-04 12:00' AND '27-OCT-04 12:03'
AND period = 0:01 and request=1;
RESULTS
Request=0 (Actual Values)
Period
MIN
MAX
AVG
SUM
#1
(12:00-12:01)
1
100
27
108
#2
(12:01-12:02)
0
0
0
0
#3
(12:02-12:03)
1
100
27
108
Request=1 (Time-Weighted Values)
Period
MIN
MAX
AVG
SUM
#1
(12:00-12:01)
0
100
10.4583
627.5
#2
(12:01-12:02)
0
1
0.5
30
#3
(12:02-12:03)
1
100
13.375
802.5
=================================================================================
Specific MIN/MAX differences between the two options
In determining min and max for a given period the actual-values option (Request=0) looks at the period from start (e.g. 12:00:00.0) to end (12:00:59.999999). However the time-weighted-values option (Request=1) includes the rounded ending value in its search (e.g. 12:01:00.0). This is seen in the MIN values for Period 1 and MAX values for Period 2 above.
=================================================================================
Period 1
Data values exist at the exact start of this period and the start of the following period, simplifying calculations.
Calculation of an actual-values AVERAGE:
Calculation of an actual-values SUM for this period:
Calculation of a time-weighted-values AVERAGE:
Calculation of a time-weighted-values SUM for this period:
=================================================================================
Period 2
Calculation of an actual-values AVERAGE:
Calculation of an actual-values SUM for this period:
Calculation of a time-weighted-values AVERAGE:
Calculation of a time-weighted-values SUM for this period:
=================================================================================
Period 3
The period does not end on a data point, so an interpolated value is required at the end of the period for aggregate calculations.
Calculation of an actual-values AVERAGE:
[same as Run 1]
Calculation of the actual-values SUM for this period:
[same as Run 1]
Calculation of a time-weighted-values AVERAGE:
We first need to determine the interpolated value at the end of the period.
Calculation of a time-weighted-values SUM for this period:
Note that if the Period 3 data had been spread across a full hour, and the aggregate period set to 1 hour, e.g.:
27-OCT-04 12:00:00.0 1.000
27-OCT-04 12:30:00.0 2.000
27-OCT-04 12:50:00.0 5.000
27-OCT-04 12:55:00.0 100.000
27-OCT-04 13:10:00.0 10.000
The time-weighted-values SUM calculation would change to:
All other SUM and AVERAGE statistics would remain the same.
Keywords:
References: None |
Problem Statement: How do I accumulate (or sum) a tag over a long period of time, such as one day? How do I accumulate a tag over a period other than the defined accumulation periods. | Solution: This sample query sums the value for Unit1Flow over the period from the beginning of Aug. 1 to the end of Aug 2. The summation is based on thirty minute aggregate values. In fact, any aggregate period could be used. However, it is best to use the largest value that fits evenly within your time range. For example, you wouldn't use an hourly aggregate for a 2.5 hour time period as one hour does not fit evenly into a 2.5 hour period. In this case, a 30 minute aggregate should be used.
select sum(avg), sum(Good), sum (NG)
from aggregates
where name like 'Unit1Flow1'
and ts between '01-Aug-04 00:00:00.0' and '02-Aug-04 00:00:00.0' and period = 0:30;
Keywords: aggregate
sum
summation
totalize
total
accumulate
accumulated
References: None |
Problem Statement: How to activate ODBC Tracing to diagnose ODBC problems. | Solution: ODBC Tracing can assist in diagnosing ODBC problems. Tracing enables continuous dynamic tracing, whether or not a connection has been made, as long as the ODBC Data Source Administrator dialog box is displayed or until you click Stop Tracing Now.
To generate the ODBC trace:
Open Data Sources (ODBC). Go to the Tracing tab in the Data Source Administrator and click Start Tracing Now. When the query runs messages are generated in the file identified in the Log File Path. Click Stop Tracing to turn off logging.
Keywords:
References: None |
Problem Statement: This article describes how to use 3rd party COM objects to access a computer's com ports (ie. com1, com2, etc.) through SQLplus. | Solution: There are a variety of tools available on the internet which allow a programmer to access a computer's com ports through Visual Basic. One of the requirements of a COM object for use with SQLplus is that the COM object called through SQLplus must also be available through VBScript. One such product which installs compatible COM objects that allow com port manipulation is called Activecomport. This product can be found at the following link.
http://www.activexperts.com/activcomport/samples/
Once you have installed Activecomport add a reference to the 'Activecomport 2.1 Type Library' in View |
Keywords:
References: s... Once the reference has been added here, you should then be able to view the objects in View | Object Browser...
Next, write a SQLplus script which uses these objects. The following sample code will read the com port number, the baud rate, and will tell the user whether or not the com port is open.
local PortObj;
PortObj = CreateObject('ActiveXperts.ComPort');
write 'Com port ' || PortObj.PortID || ' has baud rate ' || PortObj.BaudRate || ' IsOpen is set to ' || PortObj.IsOpened;
Similar output should be returned from this script:
Com port 1 has baud rate 9600 IsOpen is set to 0 |
Problem Statement: How does Aspen Exchanger Design & Rating (EDR) program evaluate the recirculation rate for Kettle (K) type heat exchangers? | Solution: For Recirculation rate; the basis of circulation model is that the internal circulation of the fluid in the tube bundle is driven by the density difference between the liquid in the pool around the tube bundle and the two phase fluid in the tube bundle.
Recirculation ratio will depend upon the pressure drop in shell side fluid from bottom of the bundle to the immersion level (weir height) of the liquid level. The bundle pressure drop is considered to be composed of frictional, gravitational & acceleration components. A single average circulation rate is calculated for the tube bundle.
The validity of the assumption and validation of the circulation model is provided in AspenTech Research Report RS1050 - The K Shell re-circulation model in TASC: Description and Validation. You can also refer to Design Report DR12: TASC-Shell and Tube Heat Exchanger Program available on HTFS Research Network website http://htfs.aspentech.com/
So, all the parameters that would affect the pressure drop for shell side fluid across the bundle would be indirectly accountable for affecting the recirculation rate for the heat exchanger e.g. Tube Layout, tube pitch or pattern, bundle diameter, weir height above bundle etc.
Keywords:
References: None |
Problem Statement: After successfully running an Aspen Shell&Tube Exchanger or Air Cooled Exchanger case, plots of various thermal parameters can be viewed in the results. For example, in the Shell&Tube Exchanger, the plots can be found on Results | Calculation Details | Analysis along shell/Tubes | Plots tab. This | Solution: describes how to customize the format of these plots.Solution
On the plot diagram, if the user applies right-mouse click, then a menu list will appear, where ''Plotting options'' can be selected to customize the format of the plotting output.
A new window - ''Preferences'' will show up, where users can customize the looks of the plots from different perspectives, i.e. Graph, Axes, Data series, Frame and Advanced tabs. Users are able to change titles, plot colours etc.
After customizations are implemented, user can click the ''Apply'' button to preview the customized plot. Finally click the ''OK'' button. The ''Preferences'' window will be closed.
Please be aware that the customization will be lost if the simulation is re-run or the input file is closed and re-opened.
Keywords: Plot options, Plot customization
References: None |
Problem Statement: This knowledge base article provides an example which shows how to insert old data into existing records using a record name returned from a SELECT inside a FOR loop. The repeat area already contains existing history data. | Solution: Use the INSERT INTO history method as outlined in the following example.
A text file name data.txt is created in the C:\ drive. This file contains whitespace-separated data in the format shown below:
IPAnalog_t 14-DEC-06 09:00:00 20.0
IPAnalog_t1 14-DEC-06 09:01:00 4.0
Below is the Aspen SQLplus query that will read from the text file and insert into history.
local tagname char(24);
local timestmp char(24);
local value real;
for (select line as ln from 'c:\data.txt') do
tagname = substring(1of ln between ' ');
timestmp = substring(2 of ln between ' ')||' '||substring(3 of ln between ' ');
value = substring(5 of ln between ' ');
insert into tagname as IP_AnalogDef(ip_trend_time, ip_trend_value)
values (timestmp, value);
end;
Keywords: None
References: None |
Problem Statement: This knowledge base article outlines the general steps you can take if you need to write an Oracle query which reads data from an Aspen InfoPlus.21 database. | Solution: Oracle queries are run in the Oracle database server environment. You must use an Oracle gateway in order to run a query within an Oracle environment which accesses a remote, non-Oracle database. Information regarding the available Oracle gateways for non-Oracle databases can be found here:
http://www.oracle.com/technology/products/gateways/index.html
Oracle does not have a special gateway for Aspen InfoPlus.21. However, Oracle does have a Generic Connectivity gateway which can be used to connect to non-Oracle databases for which Oracle does not have a specific gateway.
Important: Instead of reading Aspen InfoPlus.21 data from an Oracle environment, it is possible to push the data from Aspen InfoPlus.21 to Oracle using a simple Aspen SQLplus query. This method does not require the use of an Oracle gateway. Please see knowledge base article 118285 for an example of such a query.
Keywords: Transfer
Relational
Gate
Way
Gate-Way
References: None |
Problem Statement: This knowledge base article describes how to work around the error
Microsoft.Data.Odbc.OdbcException: ERROR [HY000] [AspenTech][SQLplus] Error reading definition record (ID=1) fixed fields: Access Denied
which is generated when reading data from an Aspen InfoPlus.21 database through an application or web service which uses an ODBC connection to connect to Aspen InfoPlus.21. | Solution: This error message is due to a security restriction either through Aspen InfoPlus.21 database security or through Aspen SQLplus security. To resolve this error please follow these suggestions.
1. If Aspen InfoPlus.21 database security is used, ensure that the account under which the application or web service runs is in a role which has privileges to access the Aspen InfoPlus.21 server. For a detailed description of how Aspen InfoPlus.21 verifies Aspen FrameWork security please see KB article 113221.
2. A quick workaround to eliminate Aspen SQLplus-related security problems is to add the following to the command line of TSK_SQL_SERVER within the Aspen InfoPlus.21 Manager
-n
you will need to restart TSK_SQL_SERVER in order for this change to take effect. The -n parameter bypasses Aspen SQLplus security. If this test shows that the problem is due to Aspen SQLplus security please see KB article 113222 for detailed information and troubleshooting steps regarding the process Aspen SQLplus uses to verify Aspen FrameWork security.
3. If further tests are necessary to elucidate the cause of the problem try to run the application or web service under the account which starts the Aspen InfoPlus.21 Task Service. This is the account which starts both the Aspen InfoPlus.21 database and Aspen SQLplus and therefore should have full privileges within Aspen InfoPlus.21 and Aspen SQLplus. If the connection is successful using this account then please verify the differences in privileges between the account which works and the account which doesn't work.
Keywords: Permission
Refused
Refusal
Deny
Denial
References: None |
Problem Statement: This knowledge base article describes how to select an extrapolated value using Aspen SQLplus. | Solution: Select from the History table with Stepped =1 and Request = 6 to request extrapolated data values.
Sample data set:
10-Oct-07 16:00:00.0 999
10-Oct-07 15:00:00.0 888
10-Oct-07 14:00:00.0 777
Local t Timestamp;
t='11-oct-07 09:59';
Select TS, Value From History Where name = 'TestRec' and TS between t and t + 00:01
and Stepped = 1 and Request = 6
? When t = 10-Oct-07 17:00 (time > last value in history) Value = 999
When t = 10-Oct-07 15:30 (time between two historized values) Value = 888, previously saved value not an interpolated value because Stepped = 1.
Stepped Parameter
Integer 0 is the default and means that the data is treated as analog or continuous.1 means that the data is treated as discrete or stepped.
Request Parameter
REQUEST is an integer column that is used to specify the type of data returned. REQUEST can take the following values:
1 = TIMES request (evenly spaced data).
2 = TIMES2 request (evenly spaced data plus a data point for the end of the time range).
3 = FITS request (The FITS request reduces the number of actual data points, while retaining the shape of the overall plot. The time period is divided into equally spaced intervals. The maximum, minimum, first, last, and first bad values in each interval are returned.)
4 = VALUES request (actual recorded data).
5 = ACTUALS AND CURRENT request (actual recorded data plus a data point for the current value).
6 = TIMES_EXTENDED request (same as TIMES but can return data for time periods after the most recent data point. This only applies if STEPPED=1.)
7 = TIMES2_EXTENDED request (sames as TIMES2 but can return data for time periods after the most recent data point).
Keywords: None
References: None |
Problem Statement: New in version 2004, it is possible to copy the specifications (free/fixed/initial/rateinitial) and the value of parameters stored in a snapshot or a result. How can I do this with the automation, i.e. the CopyValues method? | Solution: The documentation of the automation method CopyValues didn't get updated for version 2004.
Application.Simulation.Results.CopyValues has two forms:
CopyValues aResult
This copies the values of all the variables in the same way as the CopyValues button on the Snapshot Management dialog, and does not copy the parameters, and is the same as:
CopyValues aResult, True, True, True, True, True, True, , ~, False, False
The second form takes the following arguments:
Argument
Type (Default if available)
Result
Variant a variant returned by the GetSnapshot or GetResult methods
SourceFixed
Boolean (True)
SourceFree
Boolean (True)
SourceInitial
Boolean (True)
DestinationFixed
Boolean (True)
DestinationFree
Boolean (True)
DestinationInitial
Boolean (True)
SourcePath
Text String ()
DestinationPattern
Text String (~)
SourceStructural
Boolean (False)
DestinationStructural
Boolean (False)
Note: The last two arguments are optional, and only have meaning for results containing structural parameters that cause structural changes. If both arguments are TRUE, then structural changes will be applied.
Keywords:
References: None |
Problem Statement: The REPLACE command does not replace the string as expected if using variables for A,B,C..
REPLACE(A [WITH B] IN C) | Solution: The replace command is CASE SENSITIVE so make sure the values used are the correct case.
Keywords:
References: None |
Problem Statement: How to monitor different clients connections that are connected to SQLplus Server (TSK_SQL_SERVER in Aspen InfoPlus.21)? | Solution: The SQLplus Query Writer provides a mechanism to monitor the client connections to the SQLplus Server. This tool can only be used with multi-threaded SQLplus server which means that TSK_SQL_SERVER should run the sqlplus_server.exe executable.
Following is the notes from Aspen SQLplus help file that gives a description of each field and detailed procedure on how to use this Monitor function :
To monitor connections, start the SQLplus Query Writer and select the Query|Monitor? menu option. A dialog is displayed that list the following details for each connection:
ID - The unique connection number starting at one.
State - The state of the connection.
Timeout - The current query timeout.
Exec Time - The execution time for the current query. This is blank if there is no current query.
Mem Usage - The current virtual memory usage for the connection in kilobytes.
Executed - The number of statements executed on the connection.
User - The client user in the format domain/user. This is blank if security is disabled.
Computer - The client computer name. This is blank if security is disabled.
Program - The client program command line. This is blank if security is disabled.
You can click on a connection to display the current query on the connection in the area below the list of connections. If there is no current query, this is blank.
The State is one of the following possible values:
Idle - There is no query executing on the connection.
Wait - The current query is executing a WAIT statement.
Prompt - The current query is executing a PROMPT statement.
Debug - The current query is being debugged and is waiting for the next debug command.
Fetch - Data is being fetched from the current statement by an ODBC application.
Execute - The current statement is being executed.
You can click on columns to sort the list of connections. The initial sort is in descending order. You can click the column again to sort in ascending order. The State column is sorted according to the order shown above rather than alphabetic order. So, sorting by State lists Execute first and Idle last.
This Query|Monitor... option is a secured action. If you use SQLplus application security, you need to add this secured action. To do this:
1) Start the AFW Security Manager.
2) In the tree, expand AFW Security Manager.
3) Expand Applications.
4) Right-click on SQLplus and select Properties.
5) Select the Permission Properties tab.
6) Enter Monitor in the Name: field.
7) Select 0x00000020 in the Value: field.
8) Click the Add button.
9) Click the OK button.
You can then grant the Monitor action to the desired roles.
1) Expand the SQLplus application.
2) Click on Servers.
3) Right-click the server and select Properties.
4) Select the Role.
5) Check the Monitor box.
Click OK
Keywords: Monitor
SQLplus query writer
TSK_SQL_SERVER
References: None |
Problem Statement: Is there an implementation in Aspen Custom Modeler (ACM) of flux limiters, such as used for strongly hyperbolic partial differential equation systems? | Solution: The example shows how one can use flux limiters such as van Leer, Superbee, Smart, minmod for a single dimension domain. Note however that the formulation in this example is rigorous only for linear systems (constant coefficient).
The files attached contains a model of fluid flow (1D) through a heated pipe.
The flux limiter is implemented in a procedure for performance reasons. It is possible to write it directly in ACM language, but the solver convergence is much slower. (The procedure hides the non-linearity of the flux limiter).
The flux limiter is handling the distributed variable element by element, instead of the entire array. This is again for performance, as passing the entire array would cause numerical derivatives to be very slow, and analytical derivatives to require a massive dense matrix.
The example is derived from
http://www.lehigh.edu/~wes1/apci/28apr00.pdf
created by Prof William Schiesser, which is acknowledged.
An introduction to flux limiter can be found on books on partial differential equations, for example: Finite volume methods for hyperbolic problems by Randall J. Leveque, 2002, Cambridge University Press, ISBN 0 521 00924 3 (chapter 6, High reSolution methods).
Your feedback will be appreciated.
Keywords:
References: None |
Problem Statement: How to avoid indeterminate variables? | Solution: You may check if you really need to do it, for example if you observe convergence problems which you can trace back to indeterminate variables. A symptom of this is solver messages referring to indeterminate variables. This is because the modified model will be less obvious for the casual user.
TheSolution is to use run time conditions.
A very common case is when there is no flow rate, because intensive variables are undetermined. The example of a instantaneous mixer will be used to illustrate the technique. To keep the models simple, only the issue of material balances will be considered.
The streams can be characterized with 2 quantities: the flow rate (F) and the composition given in terms of mole fractions (z(componentlist)). This works well when the flow rate is zero, as there is still a composition, which can be used for example for property calculations. (This would not be the case of partial flow rates). The choice of mole fractions instead of partial flow rates is also dictated by the fact that property procedures are written in terms of mole fractions.
The port definition can be as follows:
Port FZPort
F as flow_mol;
z(componentlist) as molefraction;
end
The stream definition can be as follows:
Stream FZStream
FR as input flow_mol (fixed);
zR(componentlist) as input molefraction (fixed, 1/size(componentlist));
z(componentlist) as output molefraction;
F as output flow_mol;
in_f as input FZPort;
out_p as output FZPort;
// material balance
in_f.F = out_p.F;
in_f.z = out_p.z;
out_p.F = F;
out_p.z = z;
// specifications
if not in_f.isconnected then
F = FR;
z * sigma(zR) = zR; // normalize specifications
endif
end
Now we are ready for the mixer model. A first model would be as follows:
Model FZMixer_ss_1
in_f as input multiport of FZPort;
out_p as output FZPort;
// material balance
for c in componentlist do
out_p.F * out_p.z(c) = sigma(in_f.connection.F * in_f.connection.z(c));
endfor
sigma(out_p.z) = 1;
End
This is an instantaneous mixer (e.g. no volume). It can be readily extended to a dynamic model:
Model FZMixer_d_1
in_f as input multiport of FZPort;
out_p as output FZPort;
Mc(componentlist) as holdup_mol (initial);
M as holdup_mol;
// material balance
for c in componentlist do
$Mc(c) = sigma(in_f.connection.F * in_f.connection.z(c)) - out_p.F * out_p.z(c);
endfor
M = sigma(Mc);
Mc = M * out_p.z;
End
These models are correct, but they can cause a failure if the sum of the feed flowrates is zero. In this case, it is not possible to determine the outlet composition (out_p.z(componentlist) is indeterminate). In practice, the simulation only fails to converge when the outlet flow is preset to zero, and the sum of the mole fractions out_p.z does not add to 1.
Another formulation for the instantaneous case is as follows:
Model FZMixer_ss_2
in_f as input multiport of FZPort;
out_p as output FZPort;
// material balance
out_p.F = sigma(in_f.connection.F);
for c in componentlist do
out_p.F * out_p.z(c) = sigma(in_f.connection.F * in_f.connection.z(c));
endfor
End
This still does not avoid the indetermination, but it is more robust.
The following formulation for the instantaneous case avoids the indetermination:
Model FZMixer_ss_3
in_f as input multiport of FZPort;
out_p as output FZPort;
eps as realparameter (1e-6);
nc as integerparameter;
nc : size(in_f.connectionset);
out_p.F = sigma(in_f.connection.F);
for c in componentlist do
if out_p.F > eps then
out_p.F * out_p.z(c) = sigma(in_f.connection.F * in_f.connection.z(c));
else
nc * out_p.z(c) = sigma(in_f.connection.z(c));
endif
endfor
End
How does it work? When the flow is smaller than eps, the mole fractions are arbitrarily set to the average of the inlet compositions. If a feed flow is ramped up, this provides a continuousSolution.
For the dynamic case, the easiest approach is to avoid fully emptying the tank, for example stop the outlet flowrate to prevent the level to go down to zero and stop. In this case, there is always aSolution which is not indeterminate.
Keywords:
References: None |
Problem Statement: How can one use the SYSTEM command in SQLplus to start and stop Windows OS services? | Solution: Utilize the following syntax:
SYSTEM 'net start servicename';
SYSTEM 'net stop servicename';
where servicename is the name of the service.
--- Examples ---
To stop the AspenTech Calculator Engine service:
SYSTEM 'net stop AspenTech Calculator Engine';
To start the Print Spooler service:
SYSTEM 'net start spooler';
--- Note ---
In some instances one will need to include the service name in double quotes if it is more than a single word.
Keywords: None
References: None |
Problem Statement: Usually I can write the following to inititalise the derivative of a variable to a certain value in a model:
V.spec: rateinitial;
V.derivative: 0.0;
What is the appropriate syntax to set the rateinitial condition for a distrubtion? | Solution: The syntax is the distribution name followed by value, followed by derivative, e.g. T.value.derivative. The syntax T.derivative is not correct.
The example below shows the heat conduction in a rod. The boundary conditions are on the left side is of Neumann type (boundary condition that specifies the values of the first-order spatial derivatives on the boundary), e.g. a heat transfer flux due to convection. On the right side, the boundary condition is of Dirichlet type (boundary condition that specifies the values of the dependent variables at the boundary points as a function of time), e.g. a variable temperature.
For the subject of thisSolution, the relevant part is the specification of the initial condition, which in this case is a steady state initial temperature profile.
Model test
x as domain (highestorderderivative:2, spacingpreference: 0.01, discretizationmethod: CFD4);
T as distribution1D (xdomain is x);
TL as realvariable (fixed, 10);
TR as realvariable (fixed, 20);
cp as realvariable (fixed, 10);
h as realvariable (fixed, 10);
for ix in x.interior do
cp * $T(ix) = T.d2dx2(ix);
endfor
// initial condition
for ix in x.interior do
T(ix) : rateinitial;
T(ix).value.derivative : 0;
endfor
// BC
T(0).ddx = -h * (TL - T(0));
T(x.endnode) = TR + sin(time * 10) * 40;
End
Keywords: CQ00035199
References: None |
Problem Statement: How to set the reschedule interval with the D option using Aspen SQLplus? | Solution: Use a minus - sign before the interval time. The minus - sign has a special meaning when used for this field and sets the D flag. Here is an example.
UPDATE ScheduledActdef
SET reschedule_interval = -10:00
WHERE name = 'testsch';
Keywords: None
References: None |
Problem Statement: How much memory is required to run a simulation in ACM? | Solution: The memory usage for ACM is a complex function of the number of variables, the number of equations, the density of the problem (the number of non-zero elements) and on whether physical property procedures are being used, amongst other factors.
As a rough approximation, the total memory required to run a simulation is about 1.9 * (number of equations) + 73000 in kB. For a machine with 1 Gb of RAM, a simulation of 300,000 equations should load ok. Please remember that this is a rough approximation (for a simulation having 5 non-zero elements per equation). The best way to know for sure is to load the simulation with smaller size (e.g. fewer nodes in partial differential equations, etc) and do some extrapolation for your specific case. The memory is used by the simulation server process (sim_server) and the user interface (aspenmodeler.exe). You can check the actual memory being used for a specific simulation in the Windows Task manager.
Note that Windows operating system allows processes for up to 2 Gb with default settings. If you wish to use more physical memory, you need to install a version of Windows that supports processes up to 3 Gb and configure it correctly (there is a setting that needs to be changed in the boot initialization file - you need to consult your IT specialist or your Windows operating system manual to know exactly how to proceed). This memory limitation is due to the 32 bit nature of Windows. Once your machine is configured to use up to 3 Gb, ACM will make use of that possibility automatically.
Keywords:
References: None |
Problem Statement: What is controlling the value of the report date in Aspen SQLplus Reporting? | Solution: When creating a new report using Aspen SQLplus Reporting, normally a title section would be created. Below is an example of a simple definition of this title section.
Using the Layout drop down window you are presented with several options: Text, Title with End Time, Title with Start Time, Title with Time Range, and Title. For this example we will be using Title with Start Time. This next display shows the opening page of the report definition.
Note the field Time Range in the Report Properties section. Different selections for this field will affect the report date as follows:
1. None
Output generated - uses default value of current time (now) - 24 hours.
2. Relative with Start Offset set to -1 (day)
Output generated - returns now - 1 day.
3. Relative with Start Offset set to 0 (days)
Output generated - returns now.
4. Absolute with fixed Start Time
Output generated - the actual start time entered.
Keywords: time range
absolute
relative
report date
References: None |
Problem Statement: This | Solution: explains the way to compute Median for a set of values and for a specific tags with sample script using Aspen SQL+ .Solution
median is described as the number separating the higher half of a sample from the lower half.
The median of a finite list of numbers can be found by arranging all the observations from lowest value to highest value and picking the middle one.
The attached Aspen SQL+ script calculates the Median, for a given tag and for a given time period.
Median calculation in this example is implemented in the form of Function, using Aspen SQL+.
This function require three inputs such as one tag name and start and end time period for sample data from a Historian.
Function name : CAL_MEDIAN()
Usage : CAL_MEDIAN ( 'ATCAI', '10-OCT-08 00:00:00.0', '10-OCT-08 06:00:00.0')
Keywords: MEDIAN
AGGREGATES
FUNCTION
References: None |
Problem Statement: This knowledge base article explains how the SQLplus ODBC driver fetches data from the SQLplus server. | Solution: The SQLplus ODBC driver fetches data from the SQLplus server in 4k byte messages. So, if a row of data was 40 bytes, the fetch of the first row actually reads 100 rows from the server. The fetch of the next 99 rows doesn't cause a read from the server. Moreover, the SQLplus ODBC driver reads data from the SQLplus server in 4k messages regardless of the SQL_ATTR_ROW_ARRAY_SIZE setting.
The SQLplus REMOTE_ROWS_PER_FETCH option applies only when SQLplus reads from a remote database using the ODBC OAM. It does not apply to reading data using the SQLplus ODBC driver.
Keywords:
References: None |
Problem Statement: Can I model the horizontal thermosyphon reboiler with a K shell? | Solution: No, you cannot model the horizontal thermosyphon reboiler with a K shell. The reason why a K Shell is not supported in Thermosyphon mode is because the Aspen Shell & Tube Exchanger thermosyphon option assumes that the vapor and liquid leave from the same nozzle and flow via pipe work to the column. In K-shells it is assumed (in Aspen Shell & Tube Exchanger) that the vapor and liquid leave via separate nozzles, so the Aspen Shell & Tube Exchanger K shell model and the thermosyphon option are not compatible with each other.
The thermosyphon in Aspen Shell & Tube Exchanger is essentially a simulation calculation wherein the flowrate around the cold circuit is calculated such that there is a zero pressure drop in the loop.
Note that a K shell is not a thermosyphon reboiler and it cannot be used to model one. Although Aspen Shell & Tube Exchanger does not limit the user to the listed choices, thermosyphon reboilers are usually either:
1. Vertical E type with the cold (boiling) fluid on the tube side
2. Horizontal G, H or X type with the boiling (cold) fluid on the shell side
Keywords: k shell, thermosyphon, reboiler
References: None |
Problem Statement: How can I test the syntax of a query before I execute it against an Aspen InfoPlus.21 database? | Solution: Enclose the whole query within a dummy function. When you are satisfied that there are no errors, remove the Function definition.
Example:
Function Test
UPDATE IP_AnalogDef
SETA IP_Value_Format = 'F7.2'
WHERE Name LIKE 'Test%';
END;
Execute the query. No updates will be made to the database.When you have no errors, remove the first and last lines, then re-execute the query.
Keywords: query
rollback
read only
undo
verify
References: None |
Problem Statement: How can you tell the exact number of tags in a repository? | Solution: Use a query for each definition type: select count(*) from ip_analogdef where ip_repository like 'tsk_dhis';
========================================================
local myTotal int;
myTotal = (select count(*) from ip_analogdef where ip_repository like 'tsk_dhis') +
(select count(*) from ip_discretedef where ip_repository like 'tsk_dhis');
write 'Total tags = ' || myTotal;
========================================================
Keywords: None
References: None |
Problem Statement: Is there a list of the variable types defined in Modeler library? | Solution: Yes, please see the file attached.
Keywords:
References: None |
Problem Statement: This knowledge base article explains how to resolve the following error message which is encountered when attempting to use a SELECT statement on a temporary table.
SELECT...INTO table is not a local table at line X | Solution: The INTO clause on the SELECT statement will write the results of the query to a record which means that the record must be available in the Aspen InfoPlus.21 database. However, a temporary table only exists in memory and is local to the process executing the query. The temporary table will only exist as long as the query executes.
Use the INSERT INTO instead to have the result of the query inserted into the temporary table. Instead of
SELECT column_list FROM table_name
INTO MODULE.table_name(column_list);
use
INSERT INTO MODULE.table_name(column_list)
SELECT column_list FROM table_name;
Keywords: None
References: None |
Problem Statement: Using ACM 12.1 to try to export a model as Model installation package (.msi file), the following error message is issued in ACM:
Compiling REACTOR.cpp
REACTOR.cpp
C:\Program Files\AspenTech\AMSystem 12.1\bin\..\Procedures\ambasicexports.h(35) : fatal error C1083: Cannot open include file: 'fstream.h': No such file or directory
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
nmake -f MakeREACTOR command failed (return code 2)
and the export fails. | Solution: This happens if you have .NET 2003 compiler installed on your machine. You have to install the most recent ACM cumulative hot fix., as this problem has been addressed (see Item 12.1.1.15 in list of problem fixed in CH)
Keywords: CQ135742
Visual C++
msi
References: None |
Problem Statement: I would like to create a very simple Excel interface to ACM. The spreadsheet will consist in one sheet with two columns where the user can set the value of selected fixed variables, and another two columns where selected variables will be displayed after the run. Can you give me a simple example of how to do this? | Solution: There are three things we need to do:
open the simulation file
run the simulation
access variables
To open the simulation, we can use the GetObject method. It returns an object which gives access to the ACM application automation methods. Once we get this object we can invoke ACM automation methods and properties, such as to run the simulation (Run() method) and access variables values. In this specific case, we want to write the name of the variables in the spreadsheet instead of directly in the VBA code. We can use the Resolve() method to convert the string to a variable so that we can access the value of the variable.
The following automation example shows how to read the name of a variable from an Excel sheet and write the value in the next cell.
Private Sub CommandButton1_Click()
Dim var As Object
Set acmObj = GetObject(d:\FiveTanks.acmf)
acmObj.Application.Visible = True
Set oFlowsheet = acmObj.Application.Simulation.Flowsheet
On Error Resume Next
For i = 1 To 10
Set var = oFlowsheet.Resolve(Sheet1.Cells(i + 1, 1).Value) If Err.Number <> 0 Then
Err.Clear ' clear error
Sheet1.Cells(i + 1, 2).Value = N/A
Else
Sheet1.Cells(i + 1, 2).Value = var.Value
End If
Next
End Sub
The attached spreadsheet gives a full implementation of the example described above.
Keywords:
References: None |
Problem Statement: REFPROP is an acronym for REFerence fluid PROPerties. This model, developed by the National Institute of Standards and Technology (NIST), provides thermodynamic and transport properties of industrially important fluids and their mixtures with an emphasis on refrigerants and hydrocarbons, especially natural gas systems.
REFPROP is based on the most accurate pure fluid and mixture models currently available. It implements three models for the thermodynamic properties of pure fluids: equations of state explicit in Helmholtz energy, the modified Benedict-Webb-Rubin equation of state, and an extended corresponding states (ECS) model. Mixture calculations employ a model that applies mixing rules to the Helmholtz energy of the mixture components; it uses a departure function to account for the departure from ideal mixing. Viscosity and thermal conductivity are modelled with either fluid-specific correlations, an ECS method, or in some cases the friction theory method.
The REFPROP Aspen property method is available in Aspen EDR, from the Property Methods tab when the Aspen Properties has been specified as the Physical Property Package for either the Hot/Cold stream compositions.
This | Solution: describes when the property method may be used.Solution
REFPROP in the Aspen Physical Property System includes 84 pure fluids:
? The typical natural gas constituents methane, ethane, propane, butane, isobutane, pentane, isopentane, hexane, isohexane, heptane, octane,nonane, decane, dodecane, carbon dioxide, carbon monoxide, hydrogen, nitrogen, and water
The hydrocarbons acetone, benzene, butene, cis-butene, cyclohexane, cyclopropane, ethylene, isobutene, neopentane, propyne, trans-butene, and toluene
The HFCs R23, R32, R41, R125, R134a, R143a, R152a, R227ea, R236ea, R236fa, R245ca, R245fa, and R365mfc
The HCFCs R21, R22, R123, R124, R141b, and R142b
The traditional CFCs R11, R12, R13, R113, R114, and R115
The fluorocarbons R14, R116, R218, C4F10, C5F12, and RC318
The natural refrigerants ammonia, carbon dioxide, propane, isobutane, and propylene
The main air constituents nitrogen, oxygen, and argon
The noble elements helium, argon, neon, krypton, and xenon
The cryogens argon, carbon monoxide, deuterium, krypton, neon, nitrogen trifluoride, nitrogen, fluorine, helium, methane, oxygen, normal hydrogen, and parahydrogen
Water (as a pure fluid)
Miscellaneous substances including carbonyl sulfide, dimethyl ether, ethanol, heavy water, hydrogen sulfide, methanol, nitrous oxide, sulphur hexafluoride, sulfur dioxide, and trifluoroiodomethane
Important: For components that are not included in the valid REFPROP component list, the Aspen Physical Property System will ignore these components and calculate the physical properties for the remaining components that are on the list. Pure component properties of the non-REFPROP components will be missing. For mixture properties, the mole fractions used in the calculations will be re-normalized.
Caution: Viscosity and thermal conductivity models are not available for some fluids. Therefore, REFPROP will not be able to return meaningful values for pure or mixture properties of systems that contain one or more of these fluids. These fluids are: SO2 (sulfur dioxide), SF6 (sulfur hexafluoride), Propyne, NF3 (nitrogen trifluoride), Fluorine, Deuterium, cyclopropane, carbonyl sulfide, C5F12 (dodecafluoropentane), C4F10 (decafluorobutane), benzene, toluene, acetone, R21 (dichlorofluoromethane), R236ea (1,1,1,2,3,3-hexafluoropropane).
Further information on REFPROPS can be found from the following link on the Aspen Support website: http://support.aspentech.com/webteamasp/My/FrameDef.asp?/webteamasp/AllDocsDB.asp
From here select ?Process Engineering Products? then ?Aspen Properties? and download from
Keywords: None
References: ?Aspen Physical Property System V7.x Physical Properties Methods?
From this document detailed listings of the components and valid temperature and pressure ranges can be obtained. |
Problem Statement: Why did my kettle dry up?
What do I do about the 'Results Warning 1382'?
Results Warning 1382: The heat load for the kettle reboiler or flooded evaporator is too high for specified flow, and evaporation to dryness.... | Solution: The warning pretty much explains what is happening. You can take the following action(s) to solve the problem.
1. Force the outlet vapor fraction of cold stream to be less than 1 (0.999, for example).
2. Reduce hot side flow rate and/or increase outlet temperature / vapor fraction.
3. Increase cold stream flowrate etc.
Keywords: kettle, flooded evaporator
References: None |
Problem Statement: Why does my U-bundle exchanger have a bigger area then expected? | Solution: Aspen Shell & Tube Exchanger includes by default the U-bend in the heat transfer area. To not consider this area, the user can change the default setting from Program Options | Thermal Analysis | Heat Transfer datasheet by setting the value for field U-bend area will be considered effective for heat transfer to No.
Keywords: U-Bundle, U-bend, Area
References: None |
Problem Statement: For both the Hot and Cold streams, the Application flag can be set to either; Liquid, no phases change, Gas no phase change or Vaporization/Condensation. The online help for the input item (reached by pressing F1 when the item is selected) explains that the item is used to specify some of the default geometric items, where for example, vertical baffle cuts would be used for a condenser. It also states that this does not cause any property data to be disregarded, which is correct if stream data is used (tabulated property data supplied at different temperatures for a given pressure). However, when the physical properties are generated using one of the physical property packages; Aspen Properties, COMThermo or B-JAC then you need to take care.
This | Solution: describes the consequences of using the flag with properties generated from one of the internal physical property databases.Solution
When a Physical property package is used to select component(s) then property data can be calculated as given in the Input | Property Data | Hot/Cold Stream Properties | Properties tab for a set temperature range and pressure by clicking on the ?Get Properties? button.
With the COMThermo property package, regardless of the setting of the Application flag, if the pressure and temperatures mean that the fluid is two phase then two-phase data is generated in the property table.
However, with the Aspen Properties or B-JAC property packages, only physical property data for the given phase type set are generated. Therefore, when generating properties you may notice that the stream should be two phases, but only one phase is given, then the Application flag is likely to have been set.
Keywords:
References: None |
Problem Statement: Why does the Actual Baffle Cut reported differs (does not corresponds to its Nominal cut value) with specified Baffle Cut in Input | Exchanger Geometry | Baffles? | Solution: Selected option (YES or NO) for Input parameter Align Baffle Cut with tubes in Input | Exchanger Geometry | Baffles affects actual Baffle Cut reported by the program and as a result it can also affect the tube layout.
Selecting Yes will result in the program adjusting the baffle cut % so that the baffle cut either passes through the centerline of a line of tubes or in through the centerline between two lines of tubes.
Selecting No will result in the program using the value entered for the baffle cut %.
Keywords: Baffle Cut, Baffle, Tube Layout, Actual Cut
References: None |
Problem Statement: How do I select tube materials for Aspen Shell & Tube Exchanger? | Solution: The tube and shell materials can be specified from Input > Construction Specifications > Materials of Construction. See the screenshot below.
The material specifications can also be found from Databank Search.
If the materials of construction is not available in the databank then the users can select User Defined Properties for Tubesheet as below and enter the properties under Tube Properties
Note that there is no heat loss from the shell side. It is therefore not necessary to have the exact material for the shell.A
Keywords: Tube Material, User Defined Properties
References: None |
Problem Statement: Sometimes, Aspen Shell & Tube Exchanger (Aspen TASC) can not match the results with your manufacturer data. If you have condensing curve data from manufacturer, you could use it to calibrate your results. | Solution: In order to use your own data, you have to make sure that User Specified option is chosen.
First, you need convert your heat duty into specific enthalpy. As we know, the heat duty is the difference of two points' enthalpy. We can always calculate the enthalpy from the same reference point. You can choose any reference point. However, it is always convenience to use the starting point of heat duty, which you know. So you can get the enthalpy directly from your hysys file or you can create a stream with the temperature, pressure and flowrate. Use the heat duty getting specific enthalpy of other points. You can use those data to regress the polynomial or linear equations. The polynomial is better when you have strong nonlinear curve.
Now you can interpolate and extrapolate all points according to Aspen Shell & Tube Exchanger (Aspen TASC) datasheet (25) using your equation. Copy those data into Aspen Shell & Tube Exchanger (Aspen TASC) and replace all values from Aspen HYSYS.
You can get the vapor fraction, or other properties using the same procedure.
Attached MS Excel file shows a example how to calculate data.
Keywords: Hysys, Tasc, condensing curve
References: None |
Problem Statement: How to populate a variable based on the result of an oracle function. | Solution: The EXECUTE command executes a general statement against a linked relational database. The statement does not need to be supported by Aspen SQLplus and can be specific to the particular relational database type being linked to. For example:
EXECUTE statement ON link_name;
The EXEC command executes a general statement on a link AND returns a result set. For example:
EXEC 'SELECT MixedCaseCol FROM MyTable' ON MyOracle;
The command selects columns with mixed case from an Oracle database.
So, to populate a local variable within Aspen SQLplus using values from an Oracle database table, you would use the following syntax:
y = EXEC 'SELECT myseq.nextval FROM sys.dual' ON r;
This command selects the next value from an Oracle sequence and assigns it to the variable y.
Keywords: Oracle
Populate
References: None |
Problem Statement: Some customer have expressed an interest in displaying an ISO date/timestamp string into an IP.21 date/timestamp format | Solution: Here's an example script:
--cast an ISO format timestamp to an infoplus.21 timestamp.
Local myiptime timestamp;
myiptime = cast('2005-03-18T07:30:31' as timestamp format 'YYYY-MM-DD HH:MI:SS');
write myiptime;
Keywords: ISO
References: None |
Problem Statement: How do I create user-defined Excel templates? | Solution: EDR provides the user with a flexibility to create Excel templates from blank files.
Open Excel to create a new .xltm file. Drag and drop the results from the EDR file.
Drag and Drop function can be customized from Tools-> Program Settings.
Keywords: Drag and drop, Excel template, EDR
References: None |
Problem Statement: When trying to use bookmarks on a SQLplus connection, the following message can be returned:
800AOCB3 - Current Recordset does not support bookmarks | Solution: The way around this is to specify the the cursor type as adOpenStatic and the CursorLocation property of the recordset as adUseClient.
Here is an example program which works with bookmarks:
Option Explicit
Private Sub Command1_Click()
Dim rs, rowcount
Set rs = CreateObject(adodb.recordset)
rs.cursortype = adopenstatic
rs.CursorLocation = adUseClient
rs.pagesize = 5
rs.Open SELECT name FROM definitiondef, SQLplus on localhost, adopenstatic
Debug.Print rs.supports(adBookmark)
Debug.Print rs.cursortype
rs.AbsolutePage = 10
rowcount = 0
Do While Not rs.EOF And rowcount < rs.pagesize
Debug.Print rs.Fields(0)
rowcount = rowcount + 1
rs.MoveNext
Loop
End Sub
Keywords:
References: None |
Problem Statement: This sample program shows how to create a simple ASP.NET Web application that uses the .NET OdbcDataAdapter object to read data from InfoPlus.21 using SQLplus. | Solution: Follow the steps below to create the application. The code is also attached to the knowledge base article.
Launch Microsoft Visual Studio .NET
Select File | New | Project
Select a Project type of Visual C# Projects
Select the ASP.NET Web Application Template
Type a Project Name and click OK
An empty WebForm will be displayed.
Open the Toolbox from the View | Toolbox menu
From the ToolBox, drag a TextBox, a Button and a DataGrid object onto the form
Double click the button to define the event code
Copy the following to the EventButton_Click() block
private void Button1_Click(object sender, System.EventArgs e)
{
System.Data.Odbc.OdbcDataAdapter oAdapter = new
System.Data.Odbc.OdbcDataAdapter
// Specify the name of the ODBC data source which uses the AspenTech SQLplus driver
// Substitute the IP21 portion of the string to the data source name configured on your system
(TextBox1.Text, dsn=IP21);
System.Data.DataSet oDs = new System.Data.DataSet();
oAdapter.Fill(oDs);
DataGrid1.DataSource = oDs;
DataGrid1.DataBind();
}
View the application in a web browser. Type in a query to the text box and click the button. The query results will be displayed.
Keywords:
References: None |
Problem Statement: This query:
local a timestamp;
a = (select ip_trend_time using 'ts25' from atcai.1);
write a;
Returns:
09-MAR-04 07:33:35.3
The 'TS25' part of the query is ignored as local variables do not remember a format.
This query works in version 6.0.1 but not in 5.0.1:
local a timestamp;
a = (select ip_trend_time using 'ts25' from atcai.1);
write a using 'ts25';
Support for the USING clause in the WRITE statement is a side effect of some work done for ODBC in version 6.0. | Solution: --------
local a timestamp;
a = (select ip_trend_time using 'ts25' from atcai.1);
write cast(a as char using 'ts25');
Returns:
09-MAR-04 07:33:05.300000
This works in 5.0.1 as well as 6.0.x.
Keywords:
References: None |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.