def myFunc(): """ Runs train analysis """ # Define system to analyse bridge_sys = modalsys.ModalSys() bridge_sys.AddOutputMtrx() """ Determine reasonable time step to use for results presentation Note: only influences time interval at which results are output Scipy's solver determines its own time step for solving ODEs """ max_fn = numpy.max(bridge_sys.fn) dt_reqd = 0.01 #(1/max_fn)/2 # sampling freq to be 10x maximum modal freq - rule of thumb for accurately capturing peaks ## Run moving load analysis for specified speed speed_kmph = 450 loading_obj = loading.LoadTrain(fName="train_defs/trainA6.csv", name="trainA6") ML_analysis = dyn_analysis.MovingLoadAnalysis( modalsys_obj=bridge_sys, dt=dt_reqd, max_dt=dt_reqd, loadVel=speed_kmph * 1000 / 3600, loadtrain_obj=loading_obj, tEpilogue=1.0, writeResults2File=True, results_fName="my_results.csv") results_obj = ML_analysis.run() return results_obj
return T_vals, Se_vals # ********************** TEST ROUTINE **************************************** if __name__ == "__main__": testRoutine=5 if testRoutine==1: import modalsys modal_sys = modalsys.ModalSys(isSparse=False) modal_sys.AddOutputMtrx(fName="outputs.csv") def sine(t): return numpy.sin(5*t) loading_obj = loading.LoadTrain(loadX=0.0,loadVals=100.0, intensityFunc=sine, name="Sine test") #loading_obj = loading.LoadTrain() ML_analysis = MovingLoadAnalysis(modalsys_obj=modal_sys, dt=0.01, loadVel=20, loadtrain_obj=loading_obj,
""" Script to illustrate walkers/joggers pedestrian dynamics analyses to UK NA to BS EN 1991-2 """ # DynSys package imports import modalsys from ped_dyn import UKNA_BSEN1991_2_walkers_joggers from ped_dyn import PedestrianDynamics_transientAnalyses #%% bridgeClass = 'b' # Define modal system my_sys = modalsys.ModalSys(name="Bridge example") #my_sys.PrintSystemMatrices() # Add output matrix my_sys.AddOutputMtrx() #%% # Define single walkers/joggers analysis my_analysis = UKNA_BSEN1991_2_walkers_joggers(modalsys_obj=my_sys, mode_index=4, analysis_type="joggers", bridgeClass=bridgeClass) results_obj = my_analysis.run() tstep_obj = results_obj.tstep_obj
""" Example to demonstrate (and test) use of constraints """ import matplotlib.pyplot as plt plt.close('all') # dynsys library imports import modalsys from damper import TMD from ped_dyn import UKNA_BSEN1991_2_walkers_joggers #%% # Define a modal system my_modal_sys = modalsys.ModalSys(name="my_modal_sys") my_modal_sys.AddOutputMtrx(fName='accn_outputs.csv') my_modal_sys.AddOutputMtrx(fName='vel_outputs.csv') my_modal_sys.AddOutputMtrx(fName='disp_outputs.csv') #%% # Define some TMD systems TMD1 = TMD(sprung_mass=10, nat_freq=1.0, damping_ratio=0.1, name='TMD1') TMD2 = TMD(sprung_mass=20, nat_freq=1.2, damping_ratio=0.15, name='TMD2') #%% # Append TMDs to modal system my_modal_sys.AppendSystem(child_sys=TMD1, Xpos_parent=30.0, DOF_child=0) my_modal_sys.AppendSystem(child_sys=TMD2, Xpos_parent=50.0, DOF_child=0)
""" # Python dist imports import numpy import matplotlib.pyplot as plt # DynSys package imports import modalsys from ped_dyn import UKNA_BSEN1991_2_crowd #%% bridgeClass = 'b' # Define modal system my_sys = modalsys.ModalSys(name="Bridge example", fname_modeshapes=None) # Add output matrix my_sys.AddOutputMtrx() #%% # Define files to define modeshapes along edges of deck strips mshape_fnames = [["modeshapes_edge_MS_NSS.csv", "modeshapes_CL_MS_NSS.csv"], ["modeshapes_CL_MS_SSS.csv", "modeshapes_edge_MS_SSS.csv"], ["modeshapes_CL_NSS_SSS.csv", "modeshapes_edge_NSS_SSS.csv"]] mshape_fnames = numpy.array(mshape_fnames) # Define functions to define how wdith varies with chainage in each region
import matplotlib.pyplot as plt # DynSys imports import modalsys from damper import TMD plt.close('all') #%% # Define modal system, based on input files modal_params = {} modal_params['Mass'] = 362000 modal_params['Freq'] = 0.88 modal_params['DampingRatio'] = 0.007 modal_sys = modalsys.ModalSys(name='Main system', modalParams_dict=modal_params) modal_sys.add_outputs() # Get frequency response of systems without TMDs freq_response_rslts = modal_sys.calc_freq_response(fmax=2.0) # Get maximum ordinate of frequency response relating modal force to modal disp max_Gf_noTMD = npy.abs(npy.max(freq_response_rslts.Gf[0, 0])) #%% def RRF_given_TMDs(M=[5000, 4800], f=[0.88, 0.92], eta=[0.15, 0.05], Xpos=[50.0, 60.0],
# -*- coding: utf-8 -*- """ Runs train analysis """ import numpy import matplotlib.pyplot as plt import os import dyn_analysis import loading import modalsys #%% # Define system to analyse bridge_sys = modalsys.ModalSys(name='My Bridge') bridge_sys.AddOutputMtrx() """ Determine reasonable time step to use for results presentation Note: only influences time interval at which results are output Scipy's solver determines its own time step for solving ODEs """ max_fn = numpy.max(bridge_sys.modalParams_dict['Freq']) dt_reqd = 0.01 #(1/max_fn)/2 # sampling freq to be 10x maximum modal freq - rule of thumb for accurately capturing peaks #%% ## Run moving load analysis for specified speed train_code = 'trainA6' speed_kmph = 450 loading_obj = loading.LoadTrain(fName="train_defs/%s.csv" % train_code,
# Standard imports import numpy import matplotlib.pyplot as plt # DynSys imports import modalsys import damper import ped_dyn plt.close('all') #%% # Define modal system bridge_sys = modalsys.ModalSys(name="Stockton Infinity Footbridge", fname_modeshapes='deck_modeshapes.csv', fname_modalParams='modal_params.csv') #%% # Define TMD systems and append to bridge system damper.append_TMDs(modal_sys=bridge_sys, fname="TMD_defs.csv", append=True, verbose=True) fig = bridge_sys.PlotModeshapes()[0] fig.savefig('modeshapes.png') #%%