clear all;

%% Make some test objects
fs    = 1;
nsecs = 3600;
chan  = 'channelZ';

a1 = ao(plist('tsfcn', 'sin(2*pi*0.003*t)', 'fs', fs, 'nsecs', nsecs, 'name', chan));
a1.setT0(time('2009-01-01 00:00:00'));

% split into parts of 10 minutes length
as = a1.split(plist('split_type', 'chunks', 'N', 6));

% set name of all back to channelZ
as.setName(plist('name', chan));


%% Submit these
import utils.const.*;
hostname = 'btlab.science.unitn.it';
database_name = 'ltpda_test';

conn = utils.mysql.connect(hostname, database_name);

sinfo.conn                   = conn;
sinfo.username               = conn.username;
sinfo.experiment_title       = 'A series of AOs';
sinfo.experiment_description = ['A set of AOs which are contiguous in time.'...
                                'These can be used for testing high-level queries.'];
sinfo.analysis_description   = 'No analysis yet';
sinfo.quantity               = 'Simulated sine-wave at 0.003Hz';
sinfo.keywords               = 'series';
sinfo.reference_ids          = '';
sinfo.additional_comments    = 'none';
sinfo.additional_authors     = 'no one';

% Submit AOs
[ids, cid] = submit(as, sinfo);

% Close connection
close(conn);

