Ejemplo n.º 1
0
def F16(dir_placement=None,yn=0,force_download=False,split_data=True):
    '''The F-16 Ground Vibration Test benchmark features a high order system with clearance and friction nonlinearities at the mounting interface of the payloads.

    The experimental data made available to the Workshop participants were acquired on a full-scale F-16 aircraft on the occasion of the Siemens LMS Ground Vibration Testing Master Class, held in September 2014 at the Saffraanberg military basis, Sint-Truiden, Belgium.

    During the test campaign, two dummy payloads were mounted at the wing tips to simulate the mass and inertia properties of real devices typically equipping an F-16 in flight. The aircraft structure was instrumented with accelerometers. One shaker was attached underneath the right wing to apply input signals. The dominant source of nonlinearity in the structural dynamics was expected to originate from the mounting interfaces of the two payloads. These interfaces consist of T-shaped connecting elements on the payload side, slid through a rail attached to the wing side. A preliminary investigation showed that the back connection of the right-wing-to-payload interface was the predominant source of nonlinear distortions in the aircraft dynamics, and is therefore the focus of this benchmark study.

    A detailed formulation of the identification problem can be found here. All the provided files and information on the F-16 aircraft benchmark system are available for download here. This zip-file contains a detailed system description, the estimation and test data sets, and some pictures of the setup. The data is available in the .csv and .mat file format.

    Please refer to the F16 benchmark as:

    J.P. Noël and M. Schoukens, F-16 aircraft benchmark based on ground vibration test data, 2017 Workshop on Nonlinear System Identification Benchmarks, pp. 19-23, Brussels, Belgium, April 24-26, 2017.

    Previously published results on the F-16 Ground Vibration Test benchmark are listed in the history section of this webpage.

    Special thanks to Bart Peeters (Siemens Industry Software) for his help in creating this benchmark.'''
    #todo this is still broken for some mat files
    # assert False, 'this is still broken for some files where y has many more dimensions than expected'
    # url = 'http://www.nonlinearbenchmark.org/FILES/BENCHMARKS/F16/F16GVT_Files.zip'
    url = 'https://data.4tu.nl/ndownloader/files/24675560'
    download_size=148455295
    save_dir = cashed_download(url,'F16',zip_name='F16GVT_Files.zip',dir_placement=dir_placement,download_size=download_size,force_download=force_download)
    save_dir = os.path.join(save_dir,'F16GVT_Files/BenchmarkData') #matfiles location
    matfiles = [os.path.join(save_dir,a).replace('\\','/') for a in os.listdir(save_dir) if a.split('.')[-1]=='mat']
    datasets = []
    for file in sorted(matfiles):
        out = loadmat(file)
        Force, Voltage, (y1,y2,y3),Fs = out['Force'][0], out['Voltage'][0], out['Acceleration'], out['Fs'][0,0]
        #u = Force
        #y = one of the ys, multi objective regression?
        name = file.split('/')[-1]
        if 'SpecialOddMSine' not in name:
            datasets.append(System_data(u=Force,y=[y1,y2,y3][yn]))
    datasets = System_data_list(datasets)
    return datasets if not split_data else datasets.train_test_split()
Ejemplo n.º 2
0
def BoucWen(dir_placement=None, force_download=False, split_data=True):

    #todo: dot p file integration as system for training data
    #generate more data
    # url = 'http://www.nonlinearbenchmark.org/FILES/BENCHMARKS/BOUCWEN/BoucWenFiles.zip'
    url = 'https://data.4tu.nl/ndownloader/files/24703124'
    download_size = 5284363
    save_dir = cashed_download(url,
                               'BoucWen',
                               zip_name='BoucWenFiles.zip',
                               dir_placement=dir_placement,
                               download_size=download_size,
                               force_download=force_download)
    save_dir = os.path.join(
        save_dir,
        'BoucWenFiles/Test signals/Validation signals')  #matfiles location

    datafiles = []

    out = loadmat(os.path.join(save_dir, 'uval_multisine.mat'))
    u_multisine = out['uval_multisine'][0]
    out = loadmat(os.path.join(save_dir, 'yval_multisine.mat'))
    y_multisine = out['yval_multisine'][0]
    datafiles.append(System_data(u=u_multisine, y=y_multisine))

    out = loadmat(os.path.join(save_dir, 'uval_sinesweep.mat'))
    u_sinesweep = out['uval_sinesweep'][0]
    out = loadmat(os.path.join(save_dir, 'yval_sinesweep.mat'))
    y_sinesweep = out['yval_sinesweep'][0]
    datafiles.append(System_data(u=u_sinesweep, y=y_sinesweep))
    datafiles = System_data_list(datafiles)
    if not split_data:
        return datafiles
    else:
        return datafiles.train_test_split()
Ejemplo n.º 3
0
def erie_all(dir_placement=None, force_download=False, split_data=True):
    out = System_data_list([
        erie(dir_placement=dir_placement,
             force_download=force_download,
             split_data=False,
             noise=n) for n in [0, 10, 20, 30]
    ])
    return out.train_test_split() if split_data else out
Ejemplo n.º 4
0
def CD_player_arm(
        dir_placement=None,
        force_download=False,
        split_data=True,
        data_set=0):  #todo: check this function if column are correct
    '''
    This data set has two data sets which can be selected by setting the data_set argument to either 0 or 1
    Contributed by:
        Favoreel
        KULeuven
        Departement Electrotechniek ESAT/SISTA
    Kardinaal Mercierlaan 94
    B-3001 Leuven
    Belgium
        [email protected]
    Description:
        Data from the mechanical construction of a CD player arm.  
        The inputs are the forces of the mechanical actuators
        while the outputs are related to the tracking accuracy of the arm.
        The data was measured in closed loop, and then through a two-step
        procedure converted to open loop equivalent data
            The inputs are highly colored.
    Sampling:
    Number:
        2048
    Inputs:
        u: forces of the mechanical actuators
    Outputs:
        y: tracking accuracy of the arm
    References:
        We are grateful to R. de Callafon of the
            Mechanical Engineering Systems and Control group of Delft, who
            provided us with these data.
        
        - Van Den Hof P., Schrama R.J.P., An Indirect Method for Transfer 
          Function Estimation From Closed Loop Data. Automatica, Vol. 29, 
          no. 6, pp. 1523-1527, 1993.

    Properties: 
    Columns:
        Column 1: input u1
        Column 2: input u2
        Column 1: output y1
        Column 2: output y2
    Category:
        mechanical systems

    '''
    url = 'ftp://ftp.esat.kuleuven.ac.be/pub/SISTA/data/mechanical/CD_player_arm.dat.gz'
    data = daisydata_download(url,
                              dir_placement=dir_placement,
                              force_download=force_download)
    data0 = System_data(u=data[:, 0], y=data[:, 2])
    data1 = System_data(u=data[:, 1], y=data[:, 3])
    data_sets = System_data_list([data0, data1])
    return data_sets.train_test_split() if split_data else data_sets
Ejemplo n.º 5
0
def ParWHF(dir_placement=None, force_download=False, split_data=True):
    '''Parallel Wienner-Hammerstein'''
    # url = 'http://www.nonlinearbenchmark.org/FILES/BENCHMARKS/PARWH/ParWHFiles.zip'
    url = 'https://data.4tu.nl/ndownloader/files/24666227'
    download_size = 58203304
    save_dir = cashed_download(url,
                               'ParWHF',
                               zip_name='ParWHFiles.zip',
                               dir_placement=dir_placement,
                               download_size=download_size,
                               force_download=force_download)
    save_dir = os.path.join(save_dir, 'ParWHFiles')  #matfiles location

    out = loadmat(os.path.join(save_dir, 'ParWHData.mat'))
    # print(out.keys())
    # print(out['amp'][0]) #5 values
    # print(out['fs'][0,0])
    # print(out['lines'][0]) #range 2:4096
    # print('uEst',out['uEst'].shape) #(16384, 2, 20, 5), (N samplees, P periods, M Phase changes, nAmp changes)
    # print('uVal',out['uVal'].shape) #(16384, 2, 1, 5)
    # print('uValArr',out['uValArr'].shape) #(16384, 2)
    # print('yEst',out['yEst'].shape) #(16384, 2, 20, 5)
    # print('yVal',out['yVal'].shape) #(16384, 2, 1, 5)
    # print('yValArr',out['yValArr'].shape) #(16384, 2)

    datafiles = []
    datafiles_test = []
    #todo split train, validation and test
    uEst = out['uEst'].reshape((16384, -1))
    yEst = out['yEst'].reshape((16384, -1))
    datafiles.extend(
        [System_data(u=ui, y=yi) for ui, yi in zip(uEst.T, yEst.T)])

    uVal = out['uVal'].reshape((16384, -1))
    yVal = out['yVal'].reshape((16384, -1))
    data = [System_data(u=ui, y=yi) for ui, yi in zip(uVal.T, yVal.T)]
    datafiles_test.extend(data) if split_data else datafiles.extend(data)

    uValArr = out['uValArr'].reshape((16384, -1))
    yValArr = out['yValArr'].reshape((16384, -1))
    data = [System_data(u=ui, y=yi) for ui, yi in zip(uValArr.T, yValArr.T)]
    datafiles_test.extend(data) if split_data else datafiles.extend(data)

    datafiles = System_data_list(datafiles)
    if split_data:
        datafiles_test = System_data_list(datafiles_test)
        return (datafiles, datafiles_test)
    else:
        return datafiles
Ejemplo n.º 6
0
def CED(dir_placement=None, force_download=False, split_data=True):
    '''The coupled electric drives consists of two electric motors that drive a pulley using a flexible belt. 
    The pulley is held by a spring, resulting in a lightly damped dynamic mode. The electric drives can
    be individually controlled allowing the tension and the speed of the belt to be simultaneously controlled. 
    The drive control is symmetric around zero, hence both clockwise and counter clockwise movement is possible.
    The focus is only on the speed control system. The angular speed of the pulley is measured as an output with
    a pulse counter and this sensor is insensitive to the sign of the velocity. The available data sets are short,
    which constitute a challenge when performing identification.

    The provided data is part of a technical note available online through this link. 
    The provided Coupled Electric Drives datasets are available for download here. 
    This zip-file contains the system description and available data sets, both in 
    the .csv and .mat file format.

    Please refer to the Coupled Electric Drives dataset as:

    T. Wigren and M. Schoukens, Coupled Electric Drives Data Set and Reference Models, 
    Technical Report, Department of Information Technology, Uppsala University, 
    Department of Information Technology, Uppsala University, 2017.

    Previously published results on the Coupled Electric Drives benchmark are listed in 
    the history section of this webpage.

    Special thanks to Torbjön Wigren for making this dataset available.

    NOTE: We are re-evaluating the continuous-time models reported in the technical note. 
    For now, the discrete-time model reported in eq. (9) of the technical note can be used 
    in combination of PRBS dataset with amplitude 1.'''

    #http://www.it.uu.se/research/publications/reports/2017-024/2017-024-nc.pdf
    url = 'http://www.it.uu.se/research/publications/reports/2017-024/CoupledElectricDrivesDataSetAndReferenceModels.zip'
    download_size = 278528
    save_dir = cashed_download(url,
                               'CED',
                               dir_placement=dir_placement,
                               download_size=download_size,
                               force_download=force_download)

    # there is something not right with this data set.
    # datasets = []
    # d = 'DATAPRBS.MAT'
    # # for d in [,'DATAUNIF.MAT']:
    # matfile = loadmat(os.path.join(save_dir,d))
    # u1,u2,u3,z1,z2,z3 = [matfile[a][:,0] for a in ['u1','u2','u3','z1','z2','z3']]
    # datasets.extend([System_data(u=u,y=y) for (u,y) in [(u1,z1),(u2,z2),(u3,z3)]])

    d = 'DATAUNIF.MAT'
    matfile = loadmat(os.path.join(save_dir, d))
    u11, u12, z11, z12 = [
        matfile[a][:, 0] for a in ['u11', 'u12', 'z11', 'z12']
    ]
    datasets = System_data_list(
        [System_data(u=u11, y=z11),
         System_data(u=u12, y=z12)])
    return datasets if not split_data else datasets.sdl
Ejemplo n.º 7
0
def Industrial_robot(dir_placement=None,force_download=False, split_data=True):
    '''An identification benchmark dataset for a full robot movement with a KUKA KR300 R2500 
    ultra SE industrial robot is presented. It is a robot with a nominal payload capacity of
    300 kg, a weight of 1120 kg, and a reach of 2500mm. It exhibits 12 states accounting for
    position and velocity for each of the 6 joints. The robot encounters backlash in all 
    joints, pose-dependent inertia, pose-dependent gravitational loads, pose-dependent
    hydraulic forces, pose- and velocity-dependent centripetal and Coriolis forces as well 
    as nonlinear friction, which is temperature-dependent and therefore potentially 
    time-varying. Prepared datasets for black-box identification of the forward or the 
    inverse robot dynamics are provided. Additional to the data for the black-box modeling, 
    we supply high-frequency raw data and videos of each experiment. A baseline and figures
    of merit are defined to make results comparable across different identification methods.

    A detailed formulation of the identification problem can be found here. All the provided 
    files and information on the industrial robot dataset can be found here. 

    https://kluedo.ub.uni-kl.de/frontdoor/index/index/docId/6731

    https://fdm-fallback.uni-kl.de/TUK/FB/MV/WSKL/0001/

    https://fdm-fallback.uni-kl.de/TUK/FB/MV/WSKL/0001/Robot_Identification_Benchmark_Without_Raw_Data.rar

    Special thanks to Jonas Weigand and co-authors for creating and sharing this benchmark!'''
    url = 'https://fdm-fallback.uni-kl.de/TUK/FB/MV/WSKL/0001/Robot_Identification_Benchmark_Without_Raw_Data.rar'

    download_size=12717003 
    save_dir = cashed_download(url, 'Industrial_robot', zip_name='Robot_Identification_Benchmark_Without_Raw_Data.rar',\
        dir_placement=dir_placement, download_size=download_size, force_download=force_download)
    # save_dir = os.path.join(save_dir,'forward_identification_without_raw_data') #matfiles location

    out = loadmat(os.path.join(save_dir,'forward_identification_without_raw_data.mat'))

    K = 606 
    trains = [System_data(y=out['y_train'][:,n*K:(n+1)*K].T,u = out['u_train'][:,n*K:(n+1)*K].T) \
            for n in range(out['y_train'].shape[1]//K)]
    train = System_data_list(trains)
    tests = [System_data(y=out['y_test'][:,n*K:(n+1)*K].T,u = out['u_test'][:,n*K:(n+1)*K].T) \
            for n in range(out['y_test'].shape[1]//K)]
    test = System_data_list(tests)

    return train, test
Ejemplo n.º 8
0
def Cascaded_Tanks(dir_placement=None,force_download=False,split_data=True):
    # url = 'http://www.nonlinearbenchmark.org/FILES/BENCHMARKS/CASCADEDTANKS/CascadedTanksFiles.zip'
    url = 'https://data.4tu.nl/ndownloader/files/24686327'
    download_size = 7520592
    save_dir = cashed_download(url,'Cascaded_Tanks',zip_name='CascadedTanksFiles.zip',dir_placement=dir_placement,download_size=download_size,force_download=force_download)
    save_dir = os.path.join(save_dir,'CascadedTanksFiles')

    out = loadmat(os.path.join(save_dir,'dataBenchmark.mat'))

    uEst, uVal, yEst, yVal, Ts = out['uEst'][:,0],out['uVal'][:,0],out['yEst'][:,0],out['yVal'][:,0],out['Ts'][0,0]
    datasets = [System_data(u=uEst,y=yEst),System_data(u=uVal,y=yVal)]
    datasets = System_data_list(datasets)
    return datasets if not split_data else (datasets.sdl[0], datasets.sdl[1])
Ejemplo n.º 9
0
def WienerHammerstein_Process_Noise(dir_placement=None,
                                    force_download=False,
                                    split_data=True):
    '''Warning this is a quite a bit of data'''
    # url = 'http://www.nonlinearbenchmark.org/FILES/BENCHMARKS/WIENERHAMMERSTEINPROCESS/WienerHammersteinFiles.zip'
    url = 'https://data.4tu.nl/ndownloader/files/24671987'
    download_size = 423134764
    save_dir = cashed_download(url,
                               'WienHammer',
                               zip_name='WienerHammersteinFiles.zip',
                               dir_placement=dir_placement,
                               download_size=download_size,
                               force_download=force_download)
    save_dir = os.path.join(save_dir,
                            'WienerHammersteinFiles')  #matfiles location
    matfiles = [
        os.path.join(save_dir, a).replace('\\', '/')
        for a in os.listdir(save_dir) if a.split('.')[-1] == 'mat'
    ]
    dataset = []
    dataset_test = []

    #file = 'WH_CombinedZeroMultisineSinesweep.mat' #'WH_Triangle_meas.mat'
    for file in matfiles:
        out = loadmat(os.path.join(save_dir, file))
        r, u, y, fs = out['dataMeas'][0, 0]
        fs = fs[0, 0]
        data = [System_data(u=ui, y=yi) for ui, yi in zip(u.T, y.T)]
        if split_data and 'Test' in file:
            dataset_test.extend(data)
        else:
            dataset.extend(data)

    dataset = System_data_list(dataset)
    return (dataset, System_data_list(dataset_test)
            ) if split_data else dataset  #brackets required if before ,
Ejemplo n.º 10
0
def Silverbox(dir_placement=None,force_download=False, split_data=True):
    '''The Silverbox system can be seen as an electronic implementation of the Duffing oscillator. It is build as a 
    2nd order linear time-invariant system with a 3rd degree polynomial static nonlinearity around it in feedback. 
    This type of dynamics are, for instance, often encountered in mechanical systems.

    The provided data is part of a previously published ECC paper available online. A technical note describing the 
    Silverbox benchmark can be found here. All the provided data (.mat file format) on the Silverbox system is available
    for download here. This .zip file contains the Silverbox dataset as specified in the benchmark document (V1 is the
    input record, while V2 is the measured output), extended with .csv version of the same data and an extra data record 
    containing a Schroeder phase multisine measurement.

    Please refer to the Silverbox benchmark as:

    T. Wigren and J. Schoukens. Three free data sets for development and benchmarking in nonlinear system identification. 
    2013 European Control Conference (ECC), pp.2933-2938 July 17-19, 2013, Zurich, Switzerland.

    Previously published results on the Silverbox benchmark are listed in the history section of this webpage.

    Special thanks to Johan Schoukens for creating this benchmark, and to Torbjörn Wigren for hosting this benchmark.
    '''
    # url = 'http://www.nonlinearbenchmark.org/FILES/BENCHMARKS/SILVERBOX/SilverboxFiles.zip' #old
    url = 'https://drive.google.com/file/d/17iS-6oBUUgrmiAcrZoG9S5sOaljZnDSy/view'
    download_size=5793999
    save_dir = cashed_download(url, 'Silverbox', zip_name='SilverboxFiles.zip',\
        dir_placement=dir_placement, download_size=download_size, force_download=force_download)
    save_dir = os.path.join(save_dir,'SilverboxFiles') #matfiles location


    out = loadmat(os.path.join(save_dir,'Schroeder80mV.mat'))

    u,y = out['V1'][0], out['V2'][0]
    data1 = System_data(u=u,y=y)
    out = loadmat(os.path.join(save_dir,'SNLS80mV.mat')) #train test
    u,y = out['V1'][0], out['V2'][0]
    data2 = System_data(u=u,y=y)


    if split_data:
        data_out = System_data(u=data2.u[40650:127400],y=data2.y[40650:127400])
        return data_out.train_test_split()
    return System_data_list([data1, data2])
Ejemplo n.º 11
0
    def apply_experiment(self, sys_data, save_state=False): #can put this in apply controller
        '''Does an experiment with for given a system data (fixed u)

        Parameters
        ----------
        sys_data : System_data or System_data_list (or list or tuple)
            The experiment which should be applied

        Notes
        -----
        This will initialize the state using self.init_state if sys_data.y (and u)
        is not None and skip the appropriate number of steps associated with it.
        If either is missing than self.reset_state() is used to initialize the state. 
        Afterwards this state is advanced using sys_data.u and the output is saved at each step.
        Lastly, the number of skipped/copied steps in init_state is saved as sys_data.cheat_n such 
        that it can be accounted for later.
        '''
        if isinstance(sys_data,(tuple,list,System_data_list)):
            return System_data_list([self.apply_experiment(sd, save_state=save_state) for sd in sys_data])
        #check if sys_data.x holds the 
        #u = (Ns)
        #x = (Ns, C, H, W) or (Ns, H, W)
        #y = (Ns, Np, C), (Ns, Np, C)
        #h = (Ns, Np)
        #w = (Ns, Np)
        if not (hasattr(sys_data,'h') and hasattr(sys_data,'w')):
            return super(SS_encoder_shotgun_MLP, self).apply_experiment(sys_data, save_state=save_state)
        h, w = sys_data.h, sys_data.w

        Y = []
        sys_data.x, sys_data.y = sys_data.y, sys_data.x #move image to y
        sys_data_norm = self.norm.transform(sys_data) #transform image if needed
        sys_data.x, sys_data.y = sys_data.y, sys_data.x #move image back to x
        sys_data_norm.x, sys_data_norm.y = sys_data_norm.y, sys_data_norm.x #move image back to x
        sys_data_norm.h, sys_data_norm.w = h, w #set h and w on the normed version

        U = sys_data_norm.u #get the input
        Images = sys_data_norm.x #get the images

        assert sys_data_norm.y is not None, 'not implemented' #if y is not None than init state
        obs, k0 = self.init_state(sys_data_norm) #normed obs in the shape of y in the last step. 
        Y.extend(sys_data_norm.y[:k0]) #h(x_{k0-1})

        if save_state:
            X = [self.get_state()]*(k0+1)

        for k in range(k0,len(U)):
            Y.append(obs)
            if k < len(U)-1: #skip last step
                obs = self.step(U[k], h=h[k+1], w=w[k+1])
                if save_state:
                    X.append(self.get_state())

        #how the norm? the Y need to be transformed from (Ns, Np, C) with the norm
        #norm.y0 has shape (C, W, H) or (C, 1, 1) or similar
        Y = np.array(Y) #(Ns, Np, C)
        # if self.norm.y0 is 1:
            # return System_data(u=sys_data.u, y=Y, x=np.array(X) if save_state else None,normed=False,cheat_n=k0)
        #has the shape of a constant or (1, 1) or (C, 1, 1) the possiblity of (C, H, W) I will exclude for now. 
        from copy import deepcopy
        norm_sampler = deepcopy(self.norm)
        if isinstance(self.norm.y0,(int,float)):
            pass
        elif self.norm.y0.shape==(1,1):
            norm_sampler.y0 = norm_sampler.y0[0,0]
            norm_sampler.ystd = norm_sampler.ystd[0,0] #ystd to a float
        elif self.norm.y0.shape==(sys_data.x.shape[0],1,1):
            norm_sampler.y0 = norm_sampler.y0[:,0,0]
            norm_sampler.ystd = norm_sampler.ystd[:,0,0] #ystd to (C,) such that it can divide #(Ns, Np, C)
        else:
            raise NotImplementedError(f'norm of {self.norm} is not yet implemented for sampled simulations')
        sys_data_sim =  norm_sampler.inverse_transform(System_data(u=np.array(U),y=np.array(Y),x=np.array(X) if save_state else None,normed=True,cheat_n=k0))
        sys_data_sim.h, sys_data_sim.w = sys_data.h, sys_data.w
        return sys_data_sim