Beruflich Dokumente
Kultur Dokumente
Agenda
Advanced Post-Processing with the FEMAP API
Introduction
How Output is Accessed in the
FEMAP Database
Attached vs. Internalized Results
Accessing Results via the API
Output Processing
Creating Custom Output
Importing Custom Output Data
Controlling Output Display
Introduction
This presentation will cover post-processing using the FEMAP API; a working
knowledge of the FEMAP API workings is recommended. Topics covered in this
presentation do not represent the entire scope of what is capable for that, see
the FEMAP API Reference Manual.
If at any time you would like further expansion on a topic, please feel free to ask.
Info
Attributes
FEMAP
Database
Output
ID = Output Vector ID
Set ID = Output Set ID
Attributes
.Value(Entity) = result
Result Data
Output Set
Result Data
Output Set
Result Data
Output Set
Result Data
Translator
Output Set
Result Data
Output Set
Result Data
FEMAP
Model
Data
Output Set
Translator
Info
Index
FEMAP
Model
Data
Index
Translator
Translator
Result Type
Pros
Cons
Internalized Results
Attached Results
Greatly improved
performance for large
results files
Greatly improved
performance for transient
results
Info
Caution
When exporting a model to a pre-v11 neutral file, attached results will not
be translated; they must be internalized first.
Dialog title
Info
feSelectOutputSets will return failure codes if the user cancels out of the dialog
(FE_CANCEL) or no output sets are available for selection (FE_NOT_EXIST)
Info
These output selection methods return FEMAP Sets this is the preferred method for
dealing with multiple output sets / vectors (rather than with Arrays)
Dialog title
INT4 nBaseOutputSetID
INT4 limitOutputType
INT4 limitComplex
INT4 limitToEntity
BOOL includeCorner
Info
feSelectOutput will return failure codes if the user cancels out of the dialog
(FE_CANCEL) or no output sets are available for selection (FE_NOT_EXIST)
Info
feSelectOutputSets
fsO
fsV
fsO
fsV
As femap.Set
As femap.Set
= App.feSet
= App.feSet
When programming with VB6 / VBA, the Set instruction doesnt have to be used prior
to passing the set object to this method, however it doesnt hurt.
Info
Enums for the entity type argument can be either nodes (FT_NODE) or
elements (FT_ELEM). To avoid filtering the vectors, specify 0.
*
*
Output
Sets
Output
Vectors
Output
ID = Output
Vector ID
Output
SetID
ID==Output
Output
Set ID ID
Vector
Output
Set ID = 1
SetAttributes
ID==Output
OutputVector
Set IDID
ID
SetAttributes
ID = Output
.Value(Entity)
= resultSet ID
Attributes
Attributes
.Value(Entity)
= result
.Value(Entity) = result
Properties:
Property
Description
STRING .title
REAL8 .value
STRING notes
OutputSet Object
Example
Example Printing output set values to the message window
Sub Main
Dim App As femap.model
Set App = feFemap()
Dim fsOut As femap.Set
Dim fOS As femap.OutputSet
Set fsOut = App.feSet
Set fOS = App.feOutputSet
App.feSelectOutputSets( "Select output sets to list", fsOut )
If fsOut.Count < 1 Then
Exit Sub
End If
OutputSet Object
Example
Continued
fsOut.Reset()
While fsOut.Next()
fOS.Get( fsOut.CurrentID )
App.feAppMessage( FCM_COMMAND, "Output Set Value: " + _
Format$(fOS.Value, "0.00") )
Wend
End Sub
With this method the user must ensure that the output vector is in sync with the
output set.
Unrestricted Siemens AG 2013 All rights reserved.
Page 17
Accessing the output vector via the output set Vector method ensures that
vector data is always associated with the output set of interest. Note that when
using VBA, the Set instruction is used when using the vector method rather than
with the feOutput method.
Output Object
Properties
Properties:
Property
Description
BOOL nonlinear
REAL8 maxval
REAL8 minval
REAL8 absmaxval
Max absolute
INT4 maxvalID
ID of maximum value
INT4 minvalID
ID of minimum value
REAL8 Value[1..n]
Output Object
Helper Methods
Output data can be accessed directly through the Value property of the output
vector method, but generally speaking its much easier and faster to use the
helper methods to access the data in bulk. Output objects still need to be get
from the database prior to using these methods.
GetOutputListAtSet:
GetOutputListAtSet ( idSET, defaultVal, value )
INT4 idSET
REAL8 defaultVal[n]
Result values
Info
Tip
Similar methods exist for specifying entity IDs via arrays, however the use
of the set method will work best with other API calls.
Output Object
Helper Methods
GetVectorAtNodeSet:
GetOutputListAtSet ( idSET, x, y, z )
INT4 idSET
GetElemWithCornerSet:
GetOutputListAtSet ( idSET, maxcorner, centroid, c1, c2, c3,
c4, c5, c6, c7, c8 )
INT4 idSET
Centroidal values
Info
In nearly all cases, nodal result data returned, regardless of the method
used, will be in the global rectangular coordinate system.
Output Object
Example
Example: List plate top vonMises stress, elements 1 to 50
Sub Main
Dim App As femap.model
Set App = feFemap()
Dim fOS As femap.OutputSet
Dim fOV As femap.Output
Dim fsElem As femap.Set
Dim
Dim
Dim
Dim
Dim
nArr As Long
i As Long
values As Variant
ents As Variant
rc As Long
Output Object
Example
Example: List plate top vonMises stress, elements 1 to 50 (cont)
fOS.Get(1)
Set fOV = fOS.Vector( 7033 )
fsElem.AddRange( 1, 50, 1 )
fsElem.GetArray( nArr, ents)
rc = fOV.GetScalarAtElemSet( fsElem.ID, values)
For i = 0 To nArr - 1 Step 1
App.feAppMessage( FCM_NORMAL, "Element ID: " + Str$( ents(i) ) + _
", Top VM Stress: " + Str$( values(i) ) )
Next
End Sub
Caution
Populate
Add
Columns
Specify
Required
Data /
Entities
Create
Results
Browsing
Object
Output set ID
Output set ID
Equivalent to OutputSet.program
Equivalent to OutputSet.analysis
Equivalent to OutputSet.value
BOOL bClear
Output set ID
INT4 nVectorID
Output vector ID
Output set ID
INT4 nVectorID
Output set ID
Equivalent to Output.location
Equivalent to Output.category
Equivalent to Output.centroidtotal
Equivalent to Output.nonlinear
Equivalent to Output.hascomponent
Info
Output set ID
INT4 nVectorSetID
FEMAP Set ID
BOOL bClear
Miscellaneous Methods:
.Clear() clears all data from a Results Browsing Object
Info
INT4 nSetID
Output set ID
INT4 nVectorID
Vector ID
BOOL bAddComponentsCorners
RETURN FE_INVALID
RETURN FE_NOT_EXIST
RETURN FE_BAD_TYPE
RETURN FE_FAIL
FT_NODE or FT_ELEM
INT4 nEntitySetID
Info
Info
Caution
RETURN FE_NOT_AVAILABLE
RETURN FE_BAD_DATA
Info
Entity ID
INT4 nColumnIndex
Column index
FT_NODE or FT_ELEM
INT4 nColumnIndex
By default, the value returned for non-existing values is 0.0. This value
can be customized using the .ValueForNonExisting RBO property.
Entity ID
Row ID
Row index
INT4 nNumCol
INT4 nColIndices[nNumCol]
Array of results
Multiple Rows:
.GetRows( nNumRow, nRowIndices, nIDs, dVals )
INT4 nNumRow
INT4 nRowIndices[nNumRow]
OUT REAL8
dVals[nNumRow*nNumCol]
Array of values
OUT REAL8
dVals[nNumRow*nNumCol]
Array of values
Info
GetRowsByID() is the more common method for retrieving data from multiple rows. To
retrieve all requested data, use the same set used for the DataNeeded() method.
Info
Row IDs in the RBO will be in the same order as they are in the set specified in the
DataNeeded() method
End Sub
Column index
INT4 nLimitToSet
Min value
Max value
nMinID As Long
nMaxID As Long
dMinVal As Double
dMaxVal As Double
Set fr = App.feResults
Set fsElem = App.feSet
End Sub
RBO
OK
RBO
+
AVOID
Info
There may be enough memory available to populate the RBO, however keep in mind
theres also a memory footprint associated with retrieving the data.
If reusing a single RBO, consider reusing code that add columns to the
RBO by separating it into a different function.
Result Processing
Various methods of processing result data can be done either through
application object methods or through Results Browsing Object Methods.
Application Methods
RBO Methods
Copy Output
yes
Output Merge
yes
Linear Combination
yes
RSS Combination
yes
Convert
yes
yes
Envelope
yes
yes
Transform
yes
yes
Result Processing
When processing results with application methods, the new output sets and/or
vectors are created. When processing results with a Results Browsing Object,
calculations are performed on-the-fly. This can greatly impact performance.
Application Methods
Pros
Cons
Caution
RBO Methods
In FEMAP v11, the different types of results processors have been split into separate methods.
The old feOutputProcess() method is deprecated and should not be used.
Results Processing
Application Methods
Copy:
.feOutputProcessCopy( bFullSet, from_setID, from_vectorID,
to_setID )
BOOL bFullSet
INT4 from_setID
Source Set ID
INT4 from_vectorID
INT4 to_setID
Merge:
.feOutputProcessMerge( bFullSet, bOverwrite, nCount,
from_setID, from_vectorID, to_setID)
BOOL bFullSet
BOOL bOverwrite
INT4 nCount
INT4 from_setID[nCount]
INT4 from_vectorID[nCount]
INT4 to_setID
Results Processing
Application Methods
Combine:
.feOutputProcessLinearCombination( bFullSet, nApproach, nCount,
nScale, from_setID, from_vectorID, to_setID) /
.feOutputProcessRSSCombination
BOOL bFullSet
INT4 nApproach
INT4 nCount
REAL8 nScale[nCount]
INT4 from_setID[nCount]
INT4 from_vectorID
INT4 to_setID
Results Processing
Application Methods
Convert:
.feOutputProcessConvert( approach, from_setID, from_vectorID,
to_setID, to_vectorID, groupID )
INT4 approach
Average or Max
INT4 from_setID
Source Set ID
INT4 from_vectorID
INT4 to_setID
Not Used
INT4 to_vectorID
Not Used
INT4 groupID
Results Processing
Application Methods
Envelope:
.feOutputProcessEnvelope( bFullSet, nType, nApproach,
bEnvelopeInSets, bEnvelopeAcrossSets, bSetInfo, nCount,
from_setID, from_vectorID, to_setID )
BOOL bFullSet
INT4 nType
INT4 nApproach
BOOL bEnvelopeInSets
BOOL bEnvelopeAcrossSets
BOOL bSetInfo
INT4 nCount
INT4 from_setID[nCount]
INT4 from_vectorID[nCount]
INT4 to_setID
Output set ID
Results Processing
Application Methods
Transform:
.feOutputTransform( option, allSets, outSet, outVec, csysID,
elemSetID, alignMode, alignX, alignY, alignZ)
INT4 option
Transformation option
BOOL allSets
INT4 outSet
INT4 outVec
INT4 csysID
INT4 elemSetID
INT4 alignMode
Results Processing
Application Methods
Example: Transform Plate X-Membrane force into Material CS using application
object methods
Sub Main
Dim App As femap.model
Set App = feFemap()
Dim fs As femap.Set
Set fs = App.feSet
fs.AddAll( FT_ELEM )
App.feOutputTransform( FOD_PLATE_TO_MATL, False, 1, 7206, _
0, fs.ID, 0, 0., 0., 0. )
End Sub
Results Processing
FEMAP Results Browsing Object Methods
Convert:
.AddConversionColumn( nSetID, nVectorID, nConversionApproach,
nColumnIndex )
INT4 nSetID
Output Set ID
INT4 nVectorID
Output Vector ID
INT4 nConversionApproach
Info
Caution
Results Processing
FEMAP Results Browsing Object
Transformation:
.SetNodalTransform( nTransformTo, nCsysID )
INT4 nTransformTo
INT4 nCSysID
INT4 nCSysID
INT4 nCSysAxis
Vector components
REAL8 dToleranceAngle
INT4 nCSysID
Results Processing
FEMAP Results Browsing Object
Envelope:
.AddEnvelopeColumn( nEnvelopeType, nDataColumnIndex,
nColumnIndex ) adds a pair of columns for enveloping
INT4 nEnvelopeType
Vector ID
Results Processing
FEMAP Results Browsing Object
Example: Envelope and max/min using RBO
Sub Main
Dim App As femap.model
Set App = feFemap()
Dim fr As femap.Results
Dim fs As femap.Set
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
nCol As Long
nCol2 As Long
nColIDs As Variant
dVal As Double
i As Long
nMinID As Long
nMaxID As Long
dMinVal As Double
dMaxVal As Double
Set fr = App.feResults
Set fs = App.feSet
Unrestricted Siemens AG 2013 All rights reserved.
Page 58
Results Processing
FEMAP Results Browsing Object
Example: Envelope and max/min using RBO (cont)
fs.AddAll(FT_ELEM)
For i = 1 To 100 Step 1
fr.AddColumn( i, 7033,False , nCol, nColIDs )
fr.AddColumn( i, 7433,False , nCol, nColIDs )
Next
fr.AddEnvelopeColumn( FOPE_MAX, nCol, nCol2 )
fr.Populate()
fr.GetColumnMinMax( nCol, 0, nMinID, nMaxID, dMinVal, dMaxVal )
App.feAppMessage( FCM_NORMAL, "Max vonMises stress, sets 1 to 100")
App.feAppMessage( FCM_NORMAL, "Min val: " + Str$(dMinVal) )
App.feAppMessage( FCM_NORMAL, "Max val: " + Str$(dMaxVal) )
End Sub
Results Processing
FEMAP Results Browsing Object
Example: Transform plate data into material CSYS using Results Browsing
Object
Sub Main
Dim App As femap.model
Set App = feFemap()
Dim fr As femap.Results
Dim fs As femap.Set
Dim nCol As Long
Dim nColIDs As Variant
Dim dVal As Double
Set fr = App.feResults
Set fs = App.feSet
fs.AddAll(FT_ELEM)
Results Processing
FEMAP Results Browsing Object
Example: Transform plate data into material CSYS using Results Browsing
Object (cont )
fr.AddColumn( 1, 7206, False, nCol, nColIDs )
fr.SetPlateTransform( FOD_PLATE_TO_MATL, 0, 0, 0., 0., 0., 0. )
fr.Populate()
fr.GetValue( 464, 0, dVal )
App.feAppMessage( FCM_NORMAL, _
"Nxx in Material Coordinate System, Element 464: " + Str$( dVal ) )
End Sub
Results Processing
Benchmark
Application object transform vs RBO Transform
-
Results:
Application Method: < 1 sec.
RBO Method: ~1500 sec.
1400
1200
1000
800
600
400
200
0
RBO Method
Application Method
Info
Result
Data
Output
Set
Result
Data
Output
Set
Result
Data
FEMAP
Model Data
Output
Set
API Translator
Type
1 2,999
Nodal Output
3,000 5,999
6,000 59,999
60,000 79,999
80,000 89,999
90,000 99,999
100,000 299,999
1,000,000 to 6,000,000
9,000,000 to 9,999,999
Caution
Use care when creating output vectors < 9,000,000. Theres nothing in the
API to prevent you from doing this, but its generally not recommended.
Output Set 1
Output on element 100 = 2222.2
Store vector 9000001
While technically this works, like with reading it can incur a large number of calls, so the
use of the helper methods is recommended. Additionally, the use of the helper methods
will properly set up a results object for certain data types (ie nodal vector data) and can aid
in avoiding errors in manually setting the properties.
Output Set ID
INT4 vec
Vector ID
STRING vecTitle
INT4 category
BOOL nonlinear
Output Set ID
INT4 vec
STRING vecTitle
INT4 category
BOOL nonlinear
Output Set ID
INT4 vec
Centroidal vector ID
INT4 vec1..vec8
STRING vecTitle
INT4 category
BOOL nonlinear
INT4 ID[listcount]
REAL8 value[listcount]
Array of values
INT4 ID[listcount]
REAL8 x[listcount]
y[listcount]
z[listcount]
Arrays of values
Info
INT4 maxcorner
INT4 ID[listcount]
REAL8 centroid[listcount]
REAL8
c1[listcount]..c8[listcount]
Element Type
Corners
Tria
1, 2, 3
Quad
1, 2, 3, 4
Tet
1, 2, 3, 5
Hex
1, 2, 3, 4, 5, 6, 7, 8
Info
Elemental data orientation is specified via preferences for output objects; for RBOs
methods exist to specify orientations that differ from the preferences.
nCol As Long
nColIDs As Variant
nColID As Long
i As Long
dVals As Variant
dMax() As Double
idArr As Variant
nID As Long
Set fr = App.feResults
Set fs = App.feSet()
Set fOV = App.feOutput
Unrestricted Siemens AG 2013 All rights reserved.
Page 72
Info
Info
Result Visualization
FEMAP View Object
Output visualization is controlled, for the most part, through the FEMAP View
(feView) Object.
Property
Description
INT4 Deformed
INT4 Contour
INT4 ContourGroup
Contour group
INT4 OutputSet
INT4 FinalOutputSet
INT4 DeformData
INT4 ContourData
BOOL Draw[]
Draw array
INT4 Label[]
Label array
INT4 ColorMode[]
ColorMode array
INT4 Color[]
Color array
Result Visualization
FEMAP View Object
Draw / Label / Color / ColorMode values:
Draw Boolean
Label integer
ColorMode
Color
Conclusion
There are many different methods
available for output data access and
manipulation via the FEMAP API.
The best one for each circumstance
may depend on what is being
performed.
Additional functionality that has been
added over the years has often been
a result of user requests. If you see
something that you would like thats
not available, just ask!