Beispiel #1
0
        2, 5, weight=weight)  # best model, when noise weighting is used
    linmodel.optimize(weight=weight)
    print(f"Best subspace model, n, r: {linmodel.n}, {linmodel.r}")

linmodel = deepcopy(linmodel_orig)

# estimate PNLSS
# transient: Add one period before the start of each realization. Note that
# this is for the signal averaged over periods
T1 = np.r_[npp * Ptr, np.r_[0:(Rest - 1) * npp + 1:npp]]

# select nonlinear functions
nly = None
pnlss1 = Pnlss(degree=[2, 3], structure='full')
w = [0, 1]
tahn1 = Tanhdryfriction(eps=0.01, w=w)
if nlfunc.casefold() == 'pnlss':
    nlx = NLS([pnlss1])
    nly = NLS([pnlss1])
elif nlfunc.casefold() == 'tahn':
    nlx = NLS([pnlss1, tahn1])
    nlx = NLS([tahn1])

model = NLSS(linmodel)
model.add_nl(nlx=nlx, nly=nly)
model.set_signal(sig)
model.transient(T1)
model.optimize(lamb=100, weight=weight, nmax=25)

#raise SystemExit(0)
Beispiel #2
0
Ffull = np.array([[-0.00867042, -0.00636662]])
Efull = np.array([[1.88130305e-01, -2.70291900e-01],
                  [-5.35196110e-01, -3.66250013e-01]])

if p == 1:
    Wy = [1]
    Wt = [1]
elif p == 2:
    Wt = [0, 1]

F = np.array([])
nly = None

# for identification
tahn1 = Tanhdryfriction(eps=0.1, w=Wt)
nlx = [tahn1]
E = 1e0 * Efull[:, :len(nlx)]

true_model = FNSI(A, B, C, D, E, F)
true_model.add_nl(nlx=nlx, nly=nly)

# excitation signal
RMSu = 0.05  # Root mean square value for the input signal
npp = 2048  # Number of samples
R = 3  # Number of phase realizations (one for validation and one for
# testing)
P = 3  # Number of periods
kind = 'Odd'  # 'Full','Odd','SpecialOdd', or 'RandomOdd': kind of multisine
m = D.shape[1]  # number of inputs
p = C.shape[0]  # number of outputs
Beispiel #3
0
K = data['K']
muN = data['muN'].item()
eps = data['eps_reg'].item()
T_tip = data['T_tip'].squeeze().astype(int)
Fex1 = data['Fex1'].squeeze().astype(int)
w = data['w'].squeeze().astype(int)
fdof = np.argwhere(Fex1).item()
nldof = np.argwhere(w).item()
ndof = M.shape[0]
# Fixed contact and free natural frequencies (rad/s).
om_fixed = data['om_fixed'].squeeze()
om_free = data['om_free'].squeeze()

eps = 0.1
wd = [0, 0, 0, 0, 0, 1]
nlx = NLS(Tanhdryfriction(eps=eps, w=wd))

muN = 1e9
exponent = 3
wd = [0, 0, 1, 0, 0, 0]
wd = w
nlx = NLS(Polynomial(exponent=exponent, w=wd))
# nlx = None
nly = None
epsf = f'{eps}'.replace('.', '')

# cont time
a, b, c, d = mkc2ss(M, K, C)
fact = 1
# include velocity in output
if len(wd) == 6:
# estimate model from data
res1 = identify(data1, nlx, nly, nmax=nmax, info=info)
figs = plot(res1, data1, p=1)

# Duffing like
F = np.array([])
nlx = [Pnl(degree=[3], structure='statesonly')]
nly = None
true_model = NLSS(A, B, C, D, E, F)
true_model.add_nl(nlx=nlx, nly=nly)
true_model.E = 0.1 * Efull[:, :true_model.nlx.n_nl]
data2 = simulate(true_model)
res2 = identify(data2, nlx, nly, nmax=nmax, info=info)
figs = plot(res2, data2, p=1)
"""Output-based nonlinearity"""
tahn1 = Tanhdryfriction(eps=0.1, w=[0, 1])
nlx = [tahn1]
F = np.array([])
nly = None

# We get good identification using BLA
E = 1e-1 * Efull[:, :len(nlx)]
true_model = NLSS(A, B, C, D, E, F)
true_model.add_nl(nlx=nlx, nly=nly)
data3 = simulate(true_model, npp=2048, Ntr=2)
res3 = identify(data3, nlx, nly, nmax=nmax, info=info)
figs = plot(res3, data3, p=1)
figs = plot_bla(res3, data3, p=1)

# changing the coefficients by a factor of 10, bla is a poor starting guess
# now enter FNSI. FNSI can only use 1 realization
Beispiel #5
0
bd_method = 'explicit'
bd_method = 'nr'
bd_method = 'opt'

nldof = 2
subscan = False
stype = 'discrete'
stype = 'nm'
#stype = 'cont'

Avec = [700]
fname = 'ms'
upsamp = 70
w = [0, 0, 0, 1]
eps = 0.1
tahn1 = Tanhdryfriction(eps=eps, w=w)
nlx = tahn1

Avec = [700]
fname = 'pol'
upsamp = 70
eps = 0.1
w = [0,0,1]
nlx = Polynomial(exponent=3, w=w)
cr_true = 1e9

#nlx = None
nly = None

if len(w) == 3:
    include_vel = False