Sie sind auf Seite 1von 78

Advanced Post-Processing with the FEMAP API

Patrick Kriengsiri, Femap Development

Unrestricted Siemens AG 2013 All rights reserved.

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

Unrestricted Siemens AG 2013 All rights reserved.


Page 2

Siemens PLM Software

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

About your presenter Patrick Kriengsiri is a FEMAP developer based out


of Atlanta. Prior to joining the FEMAP team, he was a consulting engineer
for a Siemens PLM VAR. His background is in aircraft stress analysis.
Email: patrick.kriengsiri@siemens.com
Phone: 404-353-6596

Unrestricted Siemens AG 2013 All rights reserved.


Page 3

Siemens PLM Software

How Output is Stored in the FEMAP Database


Output is stored in the FEMAP database using a combination of Output Set
(OutputSet) and Output (Output) objects. All result quantities are stored in the
Output objects and reference an OutputSet object.
OutputSet
ID = Output Set ID
Set ID = 1

Attributes

FEMAP
Database

Output
ID = Output Vector ID
Set ID = Output Set ID
Attributes
.Value(Entity) = result

Unrestricted Siemens AG 2013 All rights reserved.


Page 4

Siemens PLM Software

Attached vs. Internalized Results


FEMAP v11.0 introduced the option to store results data internally within the
database or access the results externally.
When results are stored internally, the database size grows accordingly:

External Results File

External Results File

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

Unrestricted Siemens AG 2013 All rights reserved.


Page 5

Siemens PLM Software

Attached vs. Internalized Results


With attached results, an index is created and stored within the FEMAP database
that references locations within the external results file.

External Results File

External Results File

Info

Index

FEMAP
Model
Data

Index

Translator

Translator

Any number of results files may be referenced. Additionally, internalized


and attached results may be mixed, even within a single output set.

Unrestricted Siemens AG 2013 All rights reserved.


Page 6

Siemens PLM Software

Attached vs. Internalized Results


Pros vs. Cons

Result Type

Pros

Cons

Internalized Results

Simple file management


May be marginally faster
with smaller result files

Increased database size;


can impact overall FEMAP
performance

Attached Results

Greatly improved
performance for large
results files
Greatly improved
performance for transient
results

When transmitting model,


results file must be
transmitted with the model

Info

Caution

Programmatically, there is no difference between accessing internalized results or


attached results. All the management is transparently handled by FEMAP

When exporting a model to a pre-v11 neutral file, attached results will not
be translated; they must be internalized first.

Unrestricted Siemens AG 2013 All rights reserved.


Page 7

Siemens PLM Software

Accessing Results via the API


Selecting Results through the GUI
Output selection through the API can be done through the use of the Set
selection methods, however its much more efficient to use the
feSelectOutput and feSelectOutputSets (v11+) application object
methods.
feSelectOutputSets used to select output sets
feSelectOutputSets
( dlgTITLE, pOutputSets )
STRING dlgTitle

Dialog title

OUT OBJECT pOutputSets

Set objects containing selected sets

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)

Unrestricted Siemens AG 2013 All rights reserved.


Page 8

Siemens PLM Software

Accessing Results via the API


Selecting Results through the GUI
feSelectOutput used to select output sets and vectors
feSelectOutput
( dlgTITLE, nBaseOutputSetID, limitOutputType, limitComplex,
limitToEntity, includeCorner, pOutputSets, pOutputVecs )
STRING dlgTitle

Dialog title

INT4 nBaseOutputSetID

Output set used to populate vectors

INT4 limitOutputType

All / displacement / stress / strain / etc.

INT4 limitComplex

Magnitude / Phase / Real / Imaginary / Any

INT4 limitToEntity

Nodes / Elements / Any

BOOL includeCorner

Include corner values

OUT OBJECT pOutputSets

Set objects containing selected sets

OUT OBJECT pOutputVecs

Set objects containing selected vectors

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)

Unrestricted Siemens AG 2013 All rights reserved.


Page 9

Siemens PLM Software

Accessing Results via the API


Selecting Results through the GUI
feSelectOutput

Info

feSelectOutputSets

The feSelectOutput method is available in all recent versions of the FEMAP


API, however it was re-written in v11 to be easier to use and more robust.

Unrestricted Siemens AG 2013 All rights reserved.


Page 10

Siemens PLM Software

Accessing Results via the API


Selecting Results through the GUI
Example: feSelectOutput()
Sub Main
Dim App As femap.model
Set App = feFemap()
Dim
Dim
Set
Set

fsO
fsV
fsO
fsV

As femap.Set
As femap.Set
= App.feSet
= App.feSet

App.feSelectOutput( "Select Vectors", App.feOutputSet.Active, _


FOT_ANY, FOC_ANY, 0, True, fsO, fsV )
End Sub
Info

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.

*
*

Unrestricted Siemens AG 2013 All rights reserved.


Page 11

Siemens PLM Software

Accessing Results via the API


Output data may be accessed via one of two methods:
OutputSet (output) and Output (vector) objects
provides access to results data either directly through
the database or via a combination of helper methods.
This method is (and will always be) supported by all
versions of FEMAP.

Output
Sets

Output
Vectors

FEMAP Results Browsing Object new object


(feResults) introduced in FEMAP v11.0 that allows
for tabular access to results data. When potentially
randomly accessing large amounts of result data, this
method is often faster than using the OutputSet /
Output objects.

Unrestricted Siemens AG 2013 All rights reserved.


Page 12

Siemens PLM Software

Accessing Results via the API


Output Set and Output Vector Objects
The relationship between OutputSet objects and Output objects is maintained
through the .ID property of the OutputSet object and the .SetID property of
the Output object; the reference is purely notional.
Like all other FEMAP objects, Output data can be get from the database and
put with a new ID/SetID. A new relationship between the output vector and
output set is automatically created.
OutputSet1
ID = Output Set ID

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

Unrestricted Siemens AG 2013 All rights reserved.


Page 13

Siemens PLM Software

Output Set Object


Using the OutputSet Object
The OutputSet object contains data relevant to a given output set / time step /
etc. and can also be used to create output vector objects
Creation:
Dim fOS As femap.OutputSet
Set fOS = app.feOutputSet

Properties:
Property

Description

STRING .title

Output set title

REAL8 .value

Output set value time step, frequency, etc.

STRING notes

Output set notes date, run info, etc

Unrestricted Siemens AG 2013 All rights reserved.


Page 14

Siemens PLM Software

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

Unrestricted Siemens AG 2013 All rights reserved.


Page 15

Siemens PLM Software

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

Unrestricted Siemens AG 2013 All rights reserved.


Page 16

Siemens PLM Software

Output Vector (Output) Object


Results data is stored in the database in Output objects and can be accessed
through these objects. There is no difference in the usage of the objects between
attached results or internalized results.
The ID property of the Output object is the vector ID; the SetID property is
equal to the output set. Output objects can be get from the database in one of
two ways:
Manual:
Dim fOV As femap.Output
Set fOV = App.feOutput
fOV.setID = 1
fOV.Get( 7033 )

' output set 1


' plate top stress

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

Siemens PLM Software

Output Vector (Output) Object


Via OutputSet Method (preferred):
Dim fOS As femap.OutputSet
Dim fOV As femap.Output
Set fOS = App.feOutputSet
Set fOS = fOS.Vector( 7033 )

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.

Unrestricted Siemens AG 2013 All rights reserved.


Page 18

Siemens PLM Software

Output Object
Properties
Properties:
Property

Description

BOOL nonlinear

Flag indicating vector is nonlinear

REAL8 maxval

Maximum value in vector

REAL8 minval

Minimum value in vector

REAL8 absmaxval

Max absolute

INT4 maxvalID

ID of maximum value

INT4 minvalID

ID of minimum value

REAL8 Value[1..n]

Result quantity; array index is the ID of


the node or element

Unrestricted Siemens AG 2013 All rights reserved.


Page 19

Siemens PLM Software

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

ID of FEMAP Set that contains entity IDs

REAL8 defaultVal[n]

Array of default values; specify null to use 0.

OUT REAL8 value[n]

Result values

Info

The methods GetScalarAtNode and GetScalarAtElem exist and are functionally


identical to GetOutputListAtSet, however there is no default value argument.

Tip

Similar methods exist for specifying entity IDs via arrays, however the use
of the set method will work best with other API calls.

Unrestricted Siemens AG 2013 All rights reserved.


Page 20

Siemens PLM Software

Output Object
Helper Methods
GetVectorAtNodeSet:
GetOutputListAtSet ( idSET, x, y, z )
INT4 idSET

ID of FEMAP Set that contains entity IDs

OUT - REAL8 x[n], y[n], z[n]

Vector values at node

GetElemWithCornerSet:
GetOutputListAtSet ( idSET, maxcorner, centroid, c1, c2, c3,
c4, c5, c6, c7, c8 )
INT4 idSET

ID of FEMAP Set that contains entity IDs

OUT INT4 maxcorner

ID of the max corner for this vector type

OUT REAL8 centroid[n]

Centroidal values

OUT REAL8 c1[n] c8[n]

Corner values 1-8. See maxcorner for


highest corner used

Info

In nearly all cases, nodal result data returned, regardless of the method
used, will be in the global rectangular coordinate system.

Unrestricted Siemens AG 2013 All rights reserved.


Page 21

Siemens PLM Software

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

Set fOS = App.feOutputSet


Set fsElem = App.feSet

Unrestricted Siemens AG 2013 All rights reserved.


Page 22

Siemens PLM Software

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

Unrestricted Siemens AG 2013 All rights reserved.


Page 23

Siemens PLM Software

Accessing Results via the API


FEMAP Results Browsing Object
The FEMAP Results Browsing Object was introduced in v11.0 as a way to
quickly access large amounts of data for output processing.
Notionally, the Results Browsing Object is very similar to the FEMAP Data Table:

Unrestricted Siemens AG 2013 All rights reserved.


Page 24

Siemens PLM Software

Accessing Results via the API


FEMAP Results Browsing Object
The FEMAP Results Browsing Object is a read-only object. Its primary function is
to access a table of data, however it can also replicate many of the output set /
vector querying methods of the OutputSet and Output objects. Unlike the Output
object, the Results Browsing Object allows for access to results from many
different output sets and vectors via a single API call.
Methods are grouped into three categories:
- Setup & population
- Results set / vector information
- Results access / manipulation
Info

Caution

In most cases, the Results Browsing Object can be used as a direct


replacement for the OutputSet and Output objects

Except in rare circumstances, the Results Browsing Object SHOULD NOT


be used to access results one-at-a-time; performance may be poor.

Unrestricted Siemens AG 2013 All rights reserved.


Page 25

Siemens PLM Software

FEMAP Results Browsing Object


Setup Flowchart
Object Creation:
Dim fRB As femap.Results
Set fRB = app.feResults

Populate

Add
Columns

Specify
Required
Data /
Entities

Create
Results
Browsing
Object

Unrestricted Siemens AG 2013 All rights reserved.


Page 26

Siemens PLM Software

FEMAP Results Browsing Object


Results Set and Result Vector Information Query
The info query methods of the Results Browsing Object are similar to the
properties of the OutputSet and Output objects.
Output Set Methods:
.NumberOfSets() returns the number of output sets available
.SetExists( nSetID ) returns true / false if a set ID exists
INT4 nSetID

Output set ID

.SetInfo( nSetID, nAnalysisProgram, nAnalysisType, dSetValue )


INT4 nSetID

Output set ID

OUT INT4 nAnalysisProgram

Equivalent to OutputSet.program

OUT INT4 nAnalysisType

Equivalent to OutputSet.analysis

OUT REAL8 dSetValue

Equivalent to OutputSet.value

.Sets( nSetSetID, bClear ) populates Set object with available OS


INT4 nSetSetID

ID of FEMAP Set object

BOOL bClear

Clear set before populating

Unrestricted Siemens AG 2013 All rights reserved.


Page 27

Siemens PLM Software

FEMAP Results Browsing Object


Results Set and Result Vector Information Query
Output Vector Methods:
.VectorExists( nSetID, nVector ) returns true / false if a vector exists
INT4 nSetID

Output set ID

INT4 nVectorID

Output vector ID

.VectorInfo( nSetID, nVectorID, nDataType, nOutputType,


bCentroidTotal, bCalcWarn, nCompDir )
INT4 nSetID

Output set ID

INT4 nVectorID

Output set ID

OUT INT4 nDataType

Equivalent to Output.location

OUT INT4 nOutputType

Equivalent to Output.category

OUT BOOL bCentroidTotal

Equivalent to Output.centroidtotal

OUT BOOL bCalcWarn

Equivalent to Output.nonlinear

OUT INT4 nCompDir

Equivalent to Output.hascomponent

Info

If using the Results Browsing Object to query information regarding an


output set out output vector, it none of the setup methods need to be called.

Unrestricted Siemens AG 2013 All rights reserved.


Page 28

Siemens PLM Software

FEMAP Results Browsing Object


Results Set and Result Vector Information Query
Output Vector Methods (cont):
.Vectors( nSetID, nVectorSetID, bClear ) returns available vectors
in a given output set
INT4 nSetID

Output set ID

INT4 nVectorSetID

FEMAP Set ID

BOOL bClear

Clear set prior to population

Miscellaneous Methods:
.Clear() clears all data from a Results Browsing Object

Info

Any number of Results Browsing Objects may be used, or a single object


can be reused.

Unrestricted Siemens AG 2013 All rights reserved.


Page 29

Siemens PLM Software

FEMAP Results Browsing Object


Results Set and Result Vector Information Query
Example Printing output set values to the message window (cont)
Sub Main
Dim App As femap.model
Set App = feFemap()
Dim fsOut As femap.Set
Dim fr As femap.Results
Dim enAP As femap.zAnalysisProgram
Dim enAT As femap.zAnalysisType
Dim dVal As Double
Set fsOut = App.feSet
Set fr = App.feResults()
App.feSelectOutputSets( "Select output sets to list", fsOut )
If fsOut.Count < 1 Then
Exit Sub
End If

Unrestricted Siemens AG 2013 All rights reserved.


Page 30

Siemens PLM Software

FEMAP Results Browsing Object


Results Set and Result Vector Information Query
Example Printing output set values to the message window
fsOut.Reset()
While fsOut.Next()
fr.SetInfo( fsOut.CurrentID, enAP, enAT, dVal )
App.feAppMessage( FCM_COMMAND, "Output Set Value: " + _
Format$(dVal, "0.00") )
Wend
End Sub

Unrestricted Siemens AG 2013 All rights reserved.


Page 31

Siemens PLM Software

FEMAP Results Browsing Object


Setup Methods
If using the Results Browsing Object to query actual output data, the object must
be fist set up to receive the data this involves specifying the output sets and
vectors as well as specifying where data should be recovered.
Adding Columns:
.AddColumn( nSetID, nVectorID, bAddComponentsCorners,
nColumnsAdded, nColumnIndices )

INT4 nSetID

Output set ID

INT4 nVectorID

Vector ID

BOOL bAddComponentsCorners

Add related vectors to specified vector

OUT INT4 nColumnsAdded

Number of columns added to RBO

OUT INT4 nColumnIndices[n]

Column indexes of added columns

RETURN FE_INVALID

Populate has already been called

RETURN FE_NOT_EXIST

Specified output set / vector does not exist

RETURN FE_BAD_TYPE

Specified vector is of an incompatible type

RETURN FE_FAIL

Column can not be added

Unrestricted Siemens AG 2013 All rights reserved.


Page 32

Siemens PLM Software

FEMAP Results Browsing Object


Setup Methods
Specifying Entities:
.DataNeeded( nDataType, nEntitySetID )
INT4 nDataType

FT_NODE or FT_ELEM

INT4 nEntitySetID

ID of Femap Set object containing entity list

Info

Indices for rows and columns are zero-based.

Info

Caution

Entities may only be added to a results browsing object once.


When a Results Browsing Object is Populated, unless the DataNeeded() method is called,
results for all entities are added. With large amounts of data, this can result in reduced
performance, so limit the data when possible.

Unrestricted Siemens AG 2013 All rights reserved.


Page 33

Siemens PLM Software

FEMAP Results Browsing Object


Populating the Results Browsing Object
Once the Results Browsing Object has been set up with columns containing
output sets and output vectors and rows containing entity IDs, the Populate
method needs to be called to load the object with results data.
Populate Methods:
.Populate()
RETURN FE_INVALID

Object has already been populated

RETURN FE_NOT_AVAILABLE

No columns have been added to the RBO

RETURN FE_BAD_DATA

Unable to populate with given entities / vecs

.IsPopulated() returns true / false if RBO is populated

Info

After a table has been populated, additional columns cannot be added.


Additionally, it may not be repopulated; to reuse the object, call .Clear()

Unrestricted Siemens AG 2013 All rights reserved.


Page 34

Siemens PLM Software

FEMAP Results Browsing Object


Data Access Methods
Once populated, results can be extracted from the RBO:
Indivudally via row/column indices:
.GetValue( nID, nColumnIndex, dVal )
INT4 nID

Entity ID

INT4 nColumnIndex

Column index

OUT REAL8 dVal

Value at specified row/column

.GetInRow( nRowIndex, nColumnIndex, nID, dVal ) similar to


GetValue, but specify row index (entity ID) rather than row ID
INT4 nRowIndex

FT_NODE or FT_ELEM

INT4 nColumnIndex

ID of Femap Set object containing entity list

OUT INT4 nID


OUT REAL8 dVal
Tip

By default, the value returned for non-existing values is 0.0. This value
can be customized using the .ValueForNonExisting RBO property.

Unrestricted Siemens AG 2013 All rights reserved.


Page 35

Siemens PLM Software

FEMAP Results Browsing Object


Data Access Methods
Accessing data from the RBO via individual row/column methods can be slow
due to the number of calls possible and the related COM overhead. For best
performance, its advised to use one of the bulk data extraction methods: entire
row, subset of a row, or multiple rows
Entire Row:
.GetRow( nRowIndex, nID, dVals )
INT4 nRowIndex

Entity ID

OUT INT4 nID

Entity ID at given row index

OUT REAL8 dVals[nCol]

Array containing row values

.GetRowByID( nID, dVals )


INT4 nID

Row ID

OUT REAL8 dVals[nCol]

Array containing row values

Unrestricted Siemens AG 2013 All rights reserved.


Page 36

Siemens PLM Software

FEMAP Results Browsing Object


Data Access Methods
Row Subset:
.GetMultipleInRow( nRowIndex, nNumCol, nColIndices, nID,
dVals )
INT4 nRowIndex

Row index

INT4 nNumCol

Number of columns to retrieve

INT4 nColIndices[nNumCol]

Array containing column indices to retrieve

OUT INT4 nID

Entity ID of given row

OUT REAL8 dVals[nNumCol]

Array of results

Multiple Rows:
.GetRows( nNumRow, nRowIndices, nIDs, dVals )
INT4 nNumRow

Number of rows to retrieve

INT4 nRowIndices[nNumRow]

Array of row indices to retrieve

OUT INT4 nIDs [nNumRow]

Entity ID of each row retrieved

OUT REAL8
dVals[nNumRow*nNumCol]

Array of values

Unrestricted Siemens AG 2013 All rights reserved.


Page 37

Siemens PLM Software

FEMAP Results Browsing Object


Data Access Methods
Multiple Rows (cont):
.GetRowsByID( nEntitySetID, dVals )
INT4 nEntitySetID

ID of FEMAP Set containing row IDs to


retrieve

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

Unrestricted Siemens AG 2013 All rights reserved.


Page 38

Siemens PLM Software

FEMAP Results Browsing Object


Data Access Methods
Example: Get plate top VM stress for output set 1 and 2 for selected elements
Sub Main
Dim App As femap.model
Set App = feFemap()
Dim fr As femap.Results
Dim fsElem As femap.Set
Dim nCol As Long
Dim nColIDs As Variant
Dim vals As Variant
Set fr = App.feResults
Set fsElem = App.feSet
fr.AddColumn( 1, 7033, False, nCol, nColIDs )
fr.AddColumn( 2, 7033, False, nCol, nColIDs )

Unrestricted Siemens AG 2013 All rights reserved.


Page 39

Siemens PLM Software

FEMAP Results Browsing Object


Data Access Methods
Example: Get plate top VM stress for output set 1 and 2 for selected elements (cont)
fsElem.Select( FT_ELEM, True, "Select Elements" )
fr.DataNeeded( FT_ELEM, fsElem.ID )
fr.Populate()
fr.GetRowsByID( fsElem.ID, vals )

End Sub

Unrestricted Siemens AG 2013 All rights reserved.


Page 40

Siemens PLM Software

FEMAP Results Browsing Object


Data Access Methods
Additionally, the min/max values in a given column can also be retrieved:
Column min/max:
.GetColumnMinMax( nColumnIndex, nLimitToSet, nMinID, nMaxID,
dMinVal, dMaxVal )
INT4 nColumnIndex

Column index

INT4 nLimitToSet

FEMAP Set ID containing entity IDs to limit


min/max search; 0 to search all rows

OUT INT4 nMinID

Row ID where min value is found

OUT INT4 nMaxID

Row ID where max value is found

OUT REAL8 dMinVal

Min value

OUT REAL8 dMaxVal

Max value

Unrestricted Siemens AG 2013 All rights reserved.


Page 41

Siemens PLM Software

FEMAP Results Browsing Object


Data Access Methods
Example: Get max plate vonMises stress in Output Set 1
Sub Main
Dim App As femap.model
Set App = feFemap()
Dim fr As femap.Results
Dim fsElem As femap.Set
Dim nCol As Long
Dim nColIDs As Variant
Dim
Dim
Dim
Dim

nMinID As Long
nMaxID As Long
dMinVal As Double
dMaxVal As Double

Set fr = App.feResults
Set fsElem = App.feSet

Unrestricted Siemens AG 2013 All rights reserved.


Page 42

Siemens PLM Software

FEMAP Results Browsing Object


Data Access Methods
Example: Get max plate vonMises stress in Output Set 1
fr.AddColumn( 1, 7033, False, nCol, nColIDs )
fsElem.AddAll( FT_ELEM )
fr.DataNeeded( FT_ELEM, fsElem.ID )
fr.Populate()
fr.GetColumnMinMax( 0, 0, nMinID, nMaxID, dMinVal, dMaxVal )
App.feAppMessage( FCM_NORMAL, "Max plate top VM stress: " + _
Str$(dMaxVal) + " at element " + Str$(nMaxID) )

End Sub

Unrestricted Siemens AG 2013 All rights reserved.


Page 43

Siemens PLM Software

FEMAP Results Browsing Object


Memory and Performance Considerations
Ideally, a single Results Browsing Object could be used to access all required
results, however in large models or models with lots of results, it is possible to
load so much data that performance is degraded.
FEMAP will attempt to keep the entire Results Browsing Object in memory,
however once a threshold of available system memory is passed, the object will
spill to disk.

RBO

OK

RBO

+
AVOID

Unrestricted Siemens AG 2013 All rights reserved.


Page 44

Siemens PLM Software

FEMAP Results Browsing Object


Memory and Performance Considerations
What defines too much data? Its very machine dependent. Things to keep in
mind:
- Each Results Browsing Object has overhead (although not much)
- Each result value (essentially each cell in the table) requires 8 bytes
Example:
1000 elements * 20 output sets * 6 vectors = 120,000 cells =~ 910KB
100k elements * 2000 output sets * 6 vectors = 1.2 billion cells =~ 9.1GB

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.

Unrestricted Siemens AG 2013 All rights reserved.


Page 45

Siemens PLM Software

FEMAP Results Browsing Object


Memory and Performance Considerations
What to do when too much memory is used:
- Do I need this much data?
- Make sure to call the DataNeeded() method unless all result quantities
are actually needed
- Only add columns for a limited number of output sets and loop
- Split the single populate into multiple populate calls
- Load data in groups
Splitting a Results Browsing Object into several objects has no real advantages /
disadvantages over recycling a single RBO, however using them concurrently
will not alleviate the memory issues. If using a single RBO, remember to call the
Clear() method prior to repopulating the RBO.
Tip

If reusing a single RBO, consider reusing code that add columns to the
RBO by separating it into a different function.

Unrestricted Siemens AG 2013 All rights reserved.


Page 46

Siemens PLM Software

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

1 Available through manipulation of results data after population of the RBO

Unrestricted Siemens AG 2013 All rights reserved.


Page 47

Siemens PLM Software

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

Results persist within the


database
Calculation only needs to be
performed a single time

Output processing is done in


memory and no results are written
to the database
Much faster for enveloping

When processing large


amounts of data,
performance can heavily
depend on disk IO speeds

Not all conversions are available


Results are not persistent

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.

Unrestricted Siemens AG 2013 All rights reserved.


Page 48

Siemens PLM Software

Results Processing
Application Methods
Copy:
.feOutputProcessCopy( bFullSet, from_setID, from_vectorID,
to_setID )
BOOL bFullSet

Copy the entire set

INT4 from_setID

Source Set ID

INT4 from_vectorID

Source vector; ignored if bFullSet = TRUE

INT4 to_setID

Target set; ignored if bFullSet = TRUE

Merge:
.feOutputProcessMerge( bFullSet, bOverwrite, nCount,
from_setID, from_vectorID, to_setID)
BOOL bFullSet

Copy the entire set

BOOL bOverwrite

Overwrite existing results in the target set

INT4 nCount

Number of output sets to process

INT4 from_setID[nCount]

Array of output sets

INT4 from_vectorID[nCount]

Array of vector IDs, paired with set array

INT4 to_setID

Target set; ignored if bFullSet = TRUE

Unrestricted Siemens AG 2013 All rights reserved.


Page 49

Siemens PLM Software

Results Processing
Application Methods
Combine:
.feOutputProcessLinearCombination( bFullSet, nApproach, nCount,
nScale, from_setID, from_vectorID, to_setID) /
.feOutputProcessRSSCombination
BOOL bFullSet

Copy the entire set

INT4 nApproach

All vectors in all sets / All vectors in each set


/ Each vector in all sets (default if
bFullSet)

INT4 nCount

Number of output set s

REAL8 nScale[nCount]

Scale factor for each output set / vector

INT4 from_setID[nCount]

Array of source set IDs

INT4 from_vectorID

Array of vector IDs; pairs with


from_SetID. Ignored if bFullset

INT4 to_setID

Target set; ignored if bFullSet = TRUE

Unrestricted Siemens AG 2013 All rights reserved.


Page 50

Siemens PLM Software

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

Source vector; ignored if bFullSet = TRUE

INT4 to_setID

Not Used

INT4 to_vectorID

Not Used

INT4 groupID

ID of group to limit processing. 0 to ignore

Unrestricted Siemens AG 2013 All rights reserved.


Page 51

Siemens PLM Software

Results Processing
Application Methods
Envelope:
.feOutputProcessEnvelope( bFullSet, nType, nApproach,
bEnvelopeInSets, bEnvelopeAcrossSets, bSetInfo, nCount,
from_setID, from_vectorID, to_setID )
BOOL bFullSet

Envelope all vectors in all sets

INT4 nType

Max / Min / Max Absolute

INT4 nApproach

All vectors / All locations / Individual vectors

BOOL bEnvelopeInSets

Store envelope in original set. Ignored if


envelope approach is individual vectors

BOOL bEnvelopeAcrossSets

Envelope similar vectors across sets.


Ignored if approach is individual vectors

BOOL bSetInfo

Create additional vectors to store


information about source set / location

INT4 nCount

Number of output sets

INT4 from_setID[nCount]

Array of output set IDs

INT4 from_vectorID[nCount]

Array of vector IDs; used with from_setID

INT4 to_setID

Output set ID

Unrestricted Siemens AG 2013 All rights reserved.


Page 52

Siemens PLM Software

Results Processing
Application Methods
Transform:
.feOutputTransform( option, allSets, outSet, outVec, csysID,
elemSetID, alignMode, alignX, alignY, alignZ)
INT4 option

Transformation option

BOOL allSets

Transform all output sets

INT4 outSet

Output set for transformation if not


allSets

INT4 outVec

Output vector to transform

INT4 csysID

Target coordinate system ID

INT4 elemSetID

ID of Femap Set containing elements to


process

INT4 alignMode

Axis for alignment if transforming to an


element axis

REAL8 alignX, alignY, alignZ

Alignment vectors if alignment option is


vector

Unrestricted Siemens AG 2013 All rights reserved.


Page 53

Siemens PLM Software

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

Unrestricted Siemens AG 2013 All rights reserved.


Page 54

Siemens PLM Software

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

Average / max / min / include corners / etc.

OUT INT4 nColumnIndex

Index of added conversion column

Info

Caution

Process columns of the RBO need to be added prior to calling


Populate().
DataNeeded() must be called when using the AddConversionColumn method unless converting
results for the entire mode. Regardless of if the conversion is node->element or element->node
elements are specified.

Unrestricted Siemens AG 2013 All rights reserved.


Page 55

Siemens PLM Software

Results Processing
FEMAP Results Browsing Object
Transformation:
.SetNodalTransform( nTransformTo, nCsysID )

INT4 nTransformTo

None (default), CSYS, Nodal Output Csys

INT4 nCSysID

Coordinate system for CSYS

.SetPlateTransform( nTransformTo, nCsysID, nCSysAxis, dVecX,


dVecY, dVecZ, dToleranceAngle )
INT4 nTransformTo

None (default), Material CS, CSYS, Vector

INT4 nCSysID

Coordinate for CSYS

INT4 nCSysAxis

Axis for transformation direction

REAL8 dVecX, dVecY, dVecZ

Vector components

REAL8 dToleranceAngle

Maximum angle between element plane to


avoid projections

.SetSolidTransform( nTransformTo, nCsysID )


INT4 nTransformTo

None (default), CSYS, Mat CSYS

INT4 nCSysID

Coordinate system for CSYS

Unrestricted Siemens AG 2013 All rights reserved.


Page 56

Siemens PLM Software

Results Processing
FEMAP Results Browsing Object
Envelope:
.AddEnvelopeColumn( nEnvelopeType, nDataColumnIndex,
nColumnIndex ) adds a pair of columns for enveloping
INT4 nEnvelopeType

Max (0) / Min (1) / Max Absolute (2)

OUT - INT4 nDataColumnIndex

Vector ID

OUT INT4 nColumnIndex

Add related vectors to specified vector

Unrestricted Siemens AG 2013 All rights reserved.


Page 57

Siemens PLM Software

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

Siemens PLM Software

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

Unrestricted Siemens AG 2013 All rights reserved.


Page 59

Siemens PLM Software

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)

Unrestricted Siemens AG 2013 All rights reserved.


Page 60

Siemens PLM Software

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

Unrestricted Siemens AG 2013 All rights reserved.


Page 61

Siemens PLM Software

Results Processing
Benchmark
Application object transform vs RBO Transform
-

Sample model: 244 elements


500 output sets
Transform plate Nxx (7206) into material CS
Model size: ~400mb
1600

Results:
Application Method: < 1 sec.
RBO Method: ~1500 sec.

1400
1200
1000

800
600
400
200
0
RBO Method

Application Method

Unrestricted Siemens AG 2013 All rights reserved.


Page 62

Siemens PLM Software

Creating Custom Output


The Output Set and Output Vector Objects can be used to create custom output
data. This output data can then be for post like output data created by FEMAP.
Data can be stored in either existing output sets or in new output sets. When
using an existing output set, take care in not overwriting existing result data
unless that is the actual intent.
Arbitrary Results
Location

Info

Result
Data

Output
Set

Result
Data

Output
Set

Result
Data

FEMAP
Model Data

Output
Set

API Translator

Remember that the FEMAP Results browsing object is a read-only object;


output data must be created directly with the output set and vector objects.

Unrestricted Siemens AG 2013 All rights reserved.


Page 63

Siemens PLM Software

Creating Custom Output


Vector ID Ranges
There is no limitation to the vector ID used for user data, however keep the
following considerations in mind:
Vector Range

Type

1 2,999

Nodal Output

3,000 5,999

Line Element Output

6,000 59,999

Plate Element Output

60,000 79,999

Solid Element Output

80,000 89,999

Output on any Element

90,000 99,999

Patran Element Output

100,000 299,999

Plate Corner Output

1,000,000 to 6,000,000

Laminate Ply Output

9,000,000 to 9,999,999

User Defined Output

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.

Unrestricted Siemens AG 2013 All rights reserved.


Page 64

Siemens PLM Software

Creating Custom Output


Creating Results Data
Like with reading results data directly with the Output object, writing results data
may also be done with the .Value property.
Example:
Dim fOV As femap.Output
Set fOV = App.feOutput
fOV.setID = 1
fOV.Value( 100 ) = 2222.2
fOV.Put ( 9000001 )

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.

Unrestricted Siemens AG 2013 All rights reserved.


Page 65

Siemens PLM Software

Creating Custom Output


Output Helper Methods
The output creation helper methods come in pairs an Init* method and a
Put* method. The initialization method will set up all required vector objects and
the put method will load data into the object, however the .Put() entity
method still needs to be called on the parent Output object.
Initialization Methods:
.InitScalarAtNode( outputSET, vec, vecTitle, category,
nonlinear) / .InitScalarAtElem
INT4 outputSET

Output Set ID

INT4 vec

Vector ID

STRING vecTitle

Add related vectors to specified vector

INT4 category

Output type: disp. / force / stress / etc.

BOOL nonlinear

Results can be linearly combined

Unrestricted Siemens AG 2013 All rights reserved.


Page 66

Siemens PLM Software

Creating Custom Output


Output Helper Methods
Initialization Methods (cont):
.InitVectorAtNode( outputSET, vec, vecX, vecY, vecZ, vecTitle,
category, nonlinear)
INT4 outputSET

Output Set ID

INT4 vec

Vector ID for resultant vector

INT4 vecX, vecY, vecX

Vector IDs X, Y and Z components

STRING vecTitle

Add related vectors to specified vector

INT4 category

Output type: disp. / force / stress / etc.

BOOL nonlinear

Results can be linearly combined

Unrestricted Siemens AG 2013 All rights reserved.


Page 67

Siemens PLM Software

Creating Custom Output


Output Helper Methods
Initialization Methods (cont):
.InitElemWithCorner( outputSet, vec, vec1, vec2, vec3, vec4,
vec5, vec6, vec7, vec8, vecTitle, category, nonlinear)
INT4 outputSET

Output Set ID

INT4 vec

Centroidal vector ID

INT4 vec1..vec8

Corner vector IDs

STRING vecTitle

Add related vectors to specified vector

INT4 category

Output type: disp. / force / stress / etc.

BOOL nonlinear

Results can be linearly combined

Unrestricted Siemens AG 2013 All rights reserved.


Page 68

Siemens PLM Software

Creating Custom Output


Output Helper Methods
Put Methods:
.PutScalarAtNode( listcount, ID, value ) / .PutScalarAtElem
INT4 listcount

Number of entities to add

INT4 ID[listcount]

Array of entity IDs

REAL8 value[listcount]

Array of values

.PutVectorAtNode( listcount, ID, x, y, z)


INT4 listcount

Number of entities to add

INT4 ID[listcount]

Array of entity IDs

REAL8 x[listcount]
y[listcount]
z[listcount]

Arrays of values

Info

When using the PutVectorAtNode() method, the resultant value is not


specified; it is calculated automatically and stored in the specified vector ID.

Unrestricted Siemens AG 2013 All rights reserved.


Page 69

Siemens PLM Software

Creating Custom Output


Output Helper Methods
Put Methods (cont):
.PutElemWithCorner( listcount, maxcorner, ID, centroid, c1, c2,
c3, c4, c5, c6, c7, c8 )
INT4 listcount

Number of element IDs in ID array

INT4 maxcorner

Maximum number of corners used

INT4 ID[listcount]

Array of element IDs

REAL8 centroid[listcount]

Array containing centroidal values

REAL8
c1[listcount]..c8[listcount]

Arrays containing corner values

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

Unrestricted Siemens AG 2013 All rights reserved.


Page 70

Siemens PLM Software

Creating Custom Output


Output Orientation
When storing custom output, its important to be
aware of output orientation. There is no requirement
to store any output relative to a particular coordinate
system, however FEMAP visualization and output
processing tools may be useless unless the following
conditions are met:
- Nodal output must be stored in the global
rectangular coordinate system
- Elemental data must be stored according to the
output orientation specified in the FEMAP GUI

Info

Elemental data orientation is specified via preferences for output objects; for RBOs
methods exist to specify orientations that differ from the preferences.

Unrestricted Siemens AG 2013 All rights reserved.


Page 71

Siemens PLM Software

Creating Custom Output


Output Helper Methods
Example: storing max value of top/ bottom vonMises stress
Sub Main
Dim App As femap.model
Set App = feFemap()
Dim fr As femap.Results
Dim fs As femap.Set
Dim fOV As femap.Output
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim

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

Siemens PLM Software

Creating Custom Output


Output Helper Methods
Example: storing max value of top/ bottom vonMises stress (cont)
Set fr = App.feResults
Set fs = App.feSet()
Set fOV = App.feOutput
fr.AddColumn( 1, 7033, False, nCol, nColIDs )
fr.AddColumn( 1, 7433, False, nCol, nColIDs )
fr.AddEnvelopeColumn( FOPE_MAXABS, nCol, nColID )
fs.AddAll( FT_ELEM )
fr.DataNeeded( FT_ELEM, fs.ID )
fr.Populate()
fr.GetRowsByID( fs.ID, dVals )

Unrestricted Siemens AG 2013 All rights reserved.


Page 73

Siemens PLM Software

Creating Custom Output


Output Helper Methods
Example: storing max value of top/ bottom vonMises stress (cont)
fs.GetArray( nID, idArr )
ReDim dMax( 0 To fs.Count - 1 )
For i = 0 To nID - 1 Step 1
dMax( i ) = dVals( i * 4 + 2 )
Next
fOV.InitScalarAtElem( 1, 9000001, "Max VM, plate top and bottom", _
FOT_STRESS, False )
fOV.PutScalarAtNode( nID, idArr, dMax )
fOV.Put( fOV.ID )
End Sub

Unrestricted Siemens AG 2013 All rights reserved.


Page 74

Siemens PLM Software

Importing Custom Output Data


Custom output data may be created on the fly but there are also various methods
for importing data from an external source:
-

FEMAP ReadFile object


FEMAP Neutral file
OLE/COM into external source (ie Excel)
Language native file read objects (ie VB Read)

Info

The format of the FEMAP Neutral file can be found in


<FEMAP root directory>\pdf\neutral.pdf

Info

The ReadFile object is designed for reading data formatted in rows /


columns and is capable of reading both ASCII and binary data

Unrestricted Siemens AG 2013 All rights reserved.


Page 75

Siemens PLM Software

Result Visualization
FEMAP View Object
Output visualization is controlled, for the most part, through the FEMAP View
(feView) Object.
Property

Description

INT4 Deformed

Deformed view style

INT4 Contour

Contour view style

INT4 ContourGroup

Contour group

INT4 OutputSet

Output set for display

INT4 FinalOutputSet

Final output set, used in animated plots

INT4 DeformData

Vector ID for deformation plot

INT4 ContourData

Vector ID for contour plot

BOOL Draw[]

Draw array

INT4 Label[]

Label array

INT4 ColorMode[]

ColorMode array

INT4 Color[]

Color array

Unrestricted Siemens AG 2013 All rights reserved.


Page 76

Siemens PLM Software

Result Visualization
FEMAP View Object
Draw / Label / Color / ColorMode values:

Draw Boolean

Label integer

ColorMode

Array index (FVI_* enum)


Ref. API Manual, Section 5.59.1.2

Color

Additional View Properties

View Options Dialog


Unrestricted Siemens AG 2013 All rights reserved.
Page 77

Siemens PLM Software

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!

Thank you for attending!

Unrestricted Siemens AG 2013 All rights reserved.


Page 78

Siemens PLM Software

Das könnte Ihnen auch gefallen