×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

[femap][api][Function...][how to define function ie. vs Frequency]

[femap][api][Function...][how to define function ie. vs Frequency]

[femap][api][Function...][how to define function ie. vs Frequency]

(OP)
Hi!

Do anyone have some expirence how to define some function in femap? I mean do same with femap api like doing [main menu] Model -> Function (Define Time or Temperature Dependencies).

I have some data of accleration spectral density ASD that i want to put it to function vs Frequency in femap using femap api. How could i define that function using Femap Api?

ps:
When i have accleration function vs Time with usnits: (m/s^2)/s what digits will i get when transforming it to ASD? Will it be: f(t)[m^2/s] in time domain --> 2*FFT

And how will this transformation schema look? Will it be (with python code):

CODE --> python

def fFFT_of_time_to_freq_domain(Ui,dt):
    import numpy as np, numexpr as ne 
    #Ui[m/s^2]; dt[s]
    freqs = np.fft.fftfreq(len(Ui), dt); ipos = np.where(freqs>0) #frequences in [Hz]
    freqs_plus = freqs[ipos] #positive part of freqs [Hz+]
    pi=np.pi
    pulses_plus=ne.evaluate('2*pi*freqs_plus') #pulse [rad/s]
    dpulses_plus=np.mean(np.diff(pulses_plus)) #derivative of pulses, delta pulse [rad/s]
    Nfft=len(freqs) #number of freqs
    amp = 2*abs(np.fft.fft(Ui,Nfft)[ipos])/Nfft #amplitudes[m/s^2]
    PSD = (amp**2)/(2*dpulses_plus) #power spectral density, [m/s^2]^2[rad/s]^(-1)
    return [freqs_plus,PSD] 

RE: [femap][api][Function...][how to define function ie. vs Frequency]

(OP)
damn, i made a mistake, and dont know how to edit post:
that:
"f(t)[m^2/s] in time domain --> 2*FFT"
should be:
f(t)[m^2/s] in time domain --> (2*FFT(f(t)))^2 / (dPulse) = F(pulse)[m/s^2]^2[rad/s]^(-1); where Pulse=[rad/s]"

RE: [femap][api][Function...][how to define function ie. vs Frequency]

Hello,
Perhaps this will help. This create a FEMAP function (which you can then see and use in Model > Function)

AP



Const pi = 4*Atn(1)

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

'set size (ex: 10 below)
Dim freq(10) As Double, PSD(10) As Double

Dim f As femap.Function
Set f = App.feFunction

For i = 0 To UBound(freq)
freq(i) =
PSD(i) =
Next

f.type = 3 'vs. Freq
f.PutFunctionList(UBound(freq)+1,freq,PSD)
End Sub

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources