Cancel
Showing results for 
Search instead for 
Did you mean: 

Random vibration definition through API problem

Experimenter
Experimenter

Hi all,

 

I've recently been attempting to automate the way some of my analysis definitions are created. Not to go into too much detail here, but at some point I was also looking into defining random vibration analyses according to a certain preset.

 

While doing this I discovered some unanticipated functionality with the .PutCorrelate2 object method (applicable to an AnalysisMgr object).

 

Below you'll find some api code which should define a random vibration analysis. For simplicity I've written out the numbers of the constraint set, the damping table, the load-set and the PSD definition function.

These are:

  • Constraint: set 5000
  • Damping table: function 5000
  • Load: set 5201
  • PSD definition: function 2

To try and run the API you will have to make sure data exists for these IDs, likewise you could modify these values in the script so they link to existing data in your model.

 

The odd functionality I'm experiencing is that it will re-use the ID number of the realFunc(0) parameter for the realInterp(0) parameter, eventhough a different value is defined for this array entry, and eventhough according to the API manual this is a separate entry field.

 

As such, when I put in a correlation table for function #2, it automatically also changes my interpolation setting to XLog, YLin, which is undesirable. I have tried to fix it in a number of ways, none of them yielded any success so far.

 

Sub Main
    Dim App As femap.model
    Set App = feFemap()

    Dim anID As Long
	anID = 1


	Dim anM As femap.AnalysisMgr
	Set anM = App.feAnalysisMgr

	anM.Solver = 36
	anM.AnalysisType = 6

	anM.title="Random test"

	anM.NasModeOn = True

	Dim fA(2) As Double
	fA(0) = 0
	fA(1) = 200

	anM.NasModeSolutionType=2 'modal
	anM.NasModeMethod=6 'lanczos
	anM.vNasModeFreqRange = fA

	anM.NasModeDesiredRoots = 0

	anM.NasDynOn = True
	anM.NasDynDampModalTbl = 5000 'some damping table

	anM.BCSet(0) = 5000 'ID of the constraint set

    anM.BCSet(2) = 5201 'ID of the loadset

    ReDim excitCase(0 To 0) As Long
    ReDim applCase(0 To 0) As Long
    ReDim realFn(0 To 0) As Long
    ReDim rlScl(0 To 0) As Double
    ReDim imScl(0 To 0) As Double
    ReDim rlInterp(0 To 0) As Long
    ReDim imInterp(0 To 0) As Long
    ReDim imFn(0 To 0) As Long

    rlInterp(0) = 0
    imInterp(0) = 0
    excitCase(0) = 0
    applCase(0) = 0
    realFn(0) = 2 'function which contains the PSDs
    imFn(0) = 0
    rlScl(0) = 1
    imScl(0) = 0

	rc = anM.PutCorrelate2(1, excitCase, applCase, rlScl, imScl, realFn, imFn, rlInterp, imInterp) 'works but doesn't put in proper realinterp


	rc = anM.Put(anID)


End Sub

I was wondering if anybody else has experienced this before, or if maybe someone has managed to find a workaround or managed to resolve it in any other way. Or maybe I'm doing something wrong and I'm overlooking it, or maybe it can't be reproduced on your system and it's a bug to do with my particular FEMAP setup. All help is very much welcome, I'm a bit in the dark here!

 

regards,

Arnoud