next up previous contents index
Next: VI.4 An Excel workbook Up: VI. FeResPost Examples with Previous: VI.2 CLA analyses in   Contents   Index

Subsections


VI.3 Extraction and manipulation of Results with excel

In directory ``COMEX/EX09'', one gives an excel workbook ``PostXdbRandom.xls'' devoted to the post-processing of finite element Results. More precisely, the excel workbook allows to access randomly Nastran XDB results attached to a NastranDb DataBase.

This spreadsheet is not very different than the one presented in Chapter VI.4. Indeed the global organization of the workbook is more or less the same with spreadsheets and modules devoted to specific tasks:

The excel workbook makes use of the FeResPost COM component. This means that the component must be registered and referenced in the workbook. More information on this subject is given in section VI.3.1.

A Samcef version of the workbook is also given in directory ``COMEX/EX09'' (file ``PostDesFacRandom.xls''). Its functionalities and principles are very similar to those of Nastran version.


VI.3.1 Preparing the application

Before using the excel workbook, the FeResPost COM component must be referenced. This is done as follows:

Once this has been done, you may save the excel workbook so that the references to FeResPost library shall be ``remembered'' the next time you open the workbook.

If a FeResPost COM server is already referenced in the workbook when you open it the first time. (As it probably will be the case with the workbook you download from FeResPost web site.) You must first un-select the old reference to FeResPost server, before selecting the new one. You will have to perform this operation each time you install a new version of FeResPost COM server on your computer.

When you change the version of FeResPost, you will also have to modify the variable ``appName'' in the VBA code associated to ``FemDbIds'' spreadsheet of the workbook. (More information on this subject is given in section VI.3.1.)


VI.3.2 Accessing the FEM and Results

The spreadsheet is devoted to the management of finite element model and finite element Results. Several buttons can be used:

Note that the reading of a model and Results must be performed before using the other spreadsheets.


VI.3.3 Accessing the FEM and Results

This spreadsheet allows to manipulate the Groups stored in current DataBase. In columns ``A'' to ``G'', one presents several automation buttons that allow to manipulate directly the entities stored in a Group:

Four buttons allow to build new Groups by topological operations on existing Groups. The operations correspond to the four topological operators defined in ``Group'' class. The ``Group1'' and ``Group2'' operands must be existing Groups of the current DataBase. The resulting ``Group3'' can be already existing in the current DataBase or a new Group set manually.


VI.3.4 Simple extraction of Results

This spreadsheet is used to perform simple extraction of Results but nothing more. (Except that modification of coordinate systems are also done.) Several ComboBoxes allow to define the parameters for the extraction:

When all the parameters have been defined, the ``Extract'' button performs the extraction and fills cells in the spreadsheet starting at line 15. More precisely, the following operations are done in the corresponding VBA subroutine:
  1. The current NastranDb DataBase is retrieved using method ``getDb'' of FemDbIds spreadsheet.
  2. The names of selected load case, sub case and result type are used to import Results into the current DataBase. (The XDB file name has been selected in ``FemDbIds'' spreadsheet.)
  3. The Group corresponding to the selected Group Name is retrieved from the current DataBase. (``getGroupCopy'' method of NastranDb class.)
  4. This Group, the selected location and the names of load case, sub-case and result type are used to retrieve a Result from the DataBase using ``getResultCopy'' method.
  5. The Results stored in the DataBase are removed by calling method ``removeAllResults''.
  6. If necessary, the components of the Result are expressed in a new coordinate system by calling ``modifyRefCoordSys'' of ``Result'' class.
  7. The previous results are erased.
  8. The data are extracted from the Result and pasted into the spreadsheet starting at line 16.
  9. A title line is added at line 15.
At different steps, an Error message is defined. This error message is printed at line 15 of the spreadsheet is an Error occurs during execution. In most cases, this error is related to inconsistencies in the definition of data. Then the error message should help the user to correct his data.

Note that this spreadsheet should work for real as well as complex Results.


VI.3.5 Extraction of linear combinations Results

The ``ResExtractedCombili'' worksheet allows the extraction of linear combinations of Results instead of elementary Results. In the VBA programming of the extraction this is simply done by calling method ``getXdbAttachmentResultsCombili''. In this example, the linear combinations of Results extracted from the XDB files are limited to:


VI.3.6 Calculation of criteria

The spreadsheet ``WorstResExtract'' is very similar to ``ResExtract''. It is used to illustrate the possibility of writing small post-processing spreadsheets.

In this case, no coordinate system can be specified. Instead, one can select a criterion among a small predefined selection, and an integer number between 1 and 100 corresponding to the number of values that shall be extracted.

When the ``Extract'' button is clicked, the following operations are performed:

  1. First, the same steps 1 to 5 as in section VI.3.4 are performed. The extracted Result is stored in ``res'' variable.
  2. The selected criterion is calculated by calling among the methods ``deriveScalToScal'', ``deriveVectorToScal'' and ``deriveTensorToScal'' the of ``Result'' class the one that is appropriate. A ``tmpRes'' Result is created.
  3. One extracts the nbrVals largest values of this ``tmpRes'' Result by calling ``extractResultForNbrVals'' method.
  4. Correspondingly, one also extracts the critical values of ``res'' Result using ``extractResultOnResultKeys'' method.
  5. Finally, the data are printed in spreadsheet cells with appropriate title lines.
Instead of simply extracting FeResPost pre-defined scalar derived criteria, it should not be very difficult calculated more specific criteria by modifying the spreadsheet and associated VBA code. For example, you can try to modify the spreadsheet and calculate minimum reserve factors instead of maximum Von Mises stress.

The spreadsheet works with real Results only.


VI.3.7 Extraction of dynamic response Results

In this example, one shows how it is possible to use the COM component to investigate the Results of Nastran dynamic response analyses.

The main difference between this example and the simple result extraction of section VI.3.4, is that one no-longer selects a sub-case for Result extraction. Instead, the extraction is done for all the sub-cases corresponding to the specified load case. When Results are printed in the cells, each line corresponds to one sub-case (i.e. to one frequency).

The different entities are sorted in the columns of the spreadsheet. This limits somewhat the number of FE entities for which the Results can be retrieved. This is why the Group in this case is specified directly by defining the integer IDs of their elements and nodes. The Group is also defined by the specification of the type of entities that are inserted (``EntityTypeSelector'' ComboBox).

One also decided to extract only one component for each value.

When all the parameters have been defined, the ``Extract'' button performs the following operations in the corresponding VBA subroutine:

  1. The current NastranDb DataBase is retrieved using method ``getDb'' of FemDbIds spreadsheet.
  2. The names of the different sub-cases found in the XDB file are retrieved by method ``getXdbScNames'' of ``NastranDb'' class and stored in an Array of Strings. This list of sub-case is used for the reading of Results from XDB file.
  3. The names of selected load case, sub case and result type are used to import Results into the current DataBase. (One imports the Results for one load case, one Result type and all the sub-cases.)
  4. The Group corresponding to the type of entities and the list of integers defined at left part of the spreadsheet is created. This Group shall be used to extract Results from the DataBase.
  5. One uses method ``getXdbLcInfos'' of ``NastranDb'' class to obtain information on the load cases and sub-cases defined in the XDB file. The advantage of this method is that it provides the Results by increasing order of frequency and allows to retrieve easily the sub-case names, and their associated frequencies.
  6. Then a loop is done on the difference sub-cases. For each sub-case:
    1. One extracts the Result on the selected Group.
    2. One modifies the reference coordinate system if necessary.
    3. One extract the selected component.
    4. One retrieves the magnitude and phase for the different entities.
    An Array with the data is build. The lines of the Array correspond to the sub-cases. The columns correspond to the different entities and to the magnitude and phase. This Array is stored in variable ``ret''.
  7. The previous spreadsheet results are erased.
  8. The content of ``ret'' Array is pasted into the spreadsheet starting at line 51.
  9. The Results stored in the DataBase are removed by calling method ``removeAllResults''.
  10. The two graphics are updated to plot the magnitude and phase for the different entities.
The spreadsheet works with complex Results only.


VI.3.8 Current limitations

It is possible to modify the different spreadsheets described above in order to perform more complicated operations. For example:

(See also the Samcef version of the workbook is also given in directory ``COMEX/EX09'' and file ``PostDesFacRandom.xls''.)


next up previous contents index
Next: VI.4 An Excel workbook Up: VI. FeResPost Examples with Previous: VI.2 CLA analyses in   Contents   Index
FeResPost 2017-05-28