00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <KooFilter.h>
00035 #include <Filter.h>
00036 #include <classTags.h>
00037
00038
00039 KooFilter::KooFilter(int tag, double period, double dampingRatio)
00040 :Filter(tag,FILTER_standardLinearOscillator)
00041 {
00042 double pi = 3.14159265358979;
00043 wn = 2*pi/period;
00044 xi = dampingRatio;
00045 }
00046
00047 KooFilter::~KooFilter()
00048 {
00049 }
00050
00051 double
00052 KooFilter::getAmplitude(double time)
00053 {
00054 if (time<0.0) {
00055
00056 return 0.0;
00057
00058 }
00059 else {
00060
00061 double mysqrt = sqrt(1.0-pow(xi,2.0));
00062
00063 double wd = wn * mysqrt;
00064
00065 double term1 = wn/mysqrt * sin(wd*time);
00066
00067 double term2 = 2.0*xi*wn*cos(wd*time);
00068
00069 double theWholeThing = -(term1+term2)*exp(-xi*wn*time);
00070
00071 return theWholeThing;
00072 }
00073 }
00074
00075 double
00076 KooFilter::getMaxAmplitude()
00077 {
00078 double wd = wn * sqrt(1.0-pow(xi,2.0));
00079
00080 double result = wd/(xi*wn*sqrt((xi*xi*wn*wn+wd*wd)/(xi*xi*wn*wn)))
00081 *exp(-xi*wn*(atan(wd/(xi*wn))/wd));
00082
00083 return result;
00084 }
00085
00086 double
00087 KooFilter::getTimeOfMaxAmplitude()
00088 {
00089
00090 double wd = wn * sqrt(1.0-pow(xi,2.0));
00091
00092 return (atan(wd/(xi*wn))/wd);
00093 }
00094
00095 void
00096 KooFilter::Print(OPS_Stream &s, int flag)
00097 {
00098 }