comparison m-toolbox/test/test_ssm_ssm2dot.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % A Test file that builds a fairly complicated SSM and writes a DOT file.
2 %
3 % M Hewitson
4
5 mc
6
7
8 %% Controller
9
10 C = ssm(plist('built-in', 'DFACS_5_Science_Mode_1_All_Optical_Readouts', ...
11 'dim', 1, ...
12 'withParams', true))
13
14 %% Actuators
15
16 Thrusters = ssm(plist('built-in', 'MPS', ...
17 'dim', 1, ...
18 'withParams', true))
19
20 %% ES actuators
21
22 ESS = ssm(plist('built-in', 'TMActuation_xcpl', ...
23 'dim', 1, ...
24 'withParams', true))
25
26 %% Dynamics
27
28 D = ssm(plist('built-in', 'LPF_Dynamics', ...
29 'dim', 1, ...
30 'withParams', true))
31
32
33 %% IFO
34
35 % I = ssm(plist('built-in', 'Interferometer_readout_xcpl', ...
36 % 'dim', 1, ...
37 % 'withParams', true))
38
39 % build a simple IFO with the two cross-couplings we want
40 I = ssm(plist('name', 'IFO-1D-Xcpl', 'timestep', 0, 'paramnames', {'delta112', 'delta121'}, ...
41 'paramvalues', [-1e-4 0], 'inputnames', { 'SC_TM_attitude' 'Dist_Ifo_readout' }, ...
42 'inputvarnames', { { 'rx1_H1' 'rx2_H2' } { 'Dist_x1_Ifo_ro' 'Dist_dx_Ifo_ro' } }, ...
43 'outputnames', { 'Ifo_readout_delayed' }, ...
44 'outputvarnames', { { 'rx1_H1_Ifo' 'dx_Ifo' } }, ...
45 'amats', cell(0,0), ...
46 'bmats', cell(0,2), ...
47 'cmats', cell(1,0), ...
48 'dmats', {[1 sym('delta112'); sym('delta121') 1], [1 sym('delta112'); sym('delta121') 1]}, ...
49 'ssnames', cell(1,0)));
50
51 %% IFO sensing noise
52
53 ifo_sense_noise = ssm(plist('built-in', 'NSF_Interferometer_readout', 'dim', 1, ...
54 'withParams', true));
55
56 %% Thrust noise
57
58 pzm = pzmodel(1000e-6, {[1e-4], 1e-4}, {1e-2, 1e-2});
59 thrust_noise = ssm(pzm);
60 thrust_noise.modify(plist('commands', {'outputnames = {''Dist_F_solar''}', 'inputvarnames = {{''thrust_noise_in''}}'}));
61 thrust_noise.setName('thrust noise');
62
63 %% TM noise
64
65 tm_noise = ssm(plist('built-in', 'NSF_TM', 'dim', 1, ...
66 'withParams', true));
67
68 %% Build loop
69
70 % -- attach continuous parts
71 % Cparts = assemble(D, thrust_noise);
72 Cparts = assemble(Thrusters, ESS, D, I, ifo_sense_noise, thrust_noise, tm_noise);
73
74 % Set parameter values
75 pl = plist('KEEP_PARAM_NAMES', {}, ...
76 'KEEP_PARAM_ORDER', 'ALL', ...
77 'SET_PARAM_NAMES', {'delta112'}, ...
78 'SET_PARAM_VALUES', 2e-6);
79
80 Cparts.modifparams(pl);
81
82 % Go numeric
83 Cparts.modifparams;
84
85 % -- discretize
86 Cparts.modiftimestep(plist('newtimestep', 0.1));
87
88
89 %% -- attach discrete parts
90
91 loop = assemble(Cparts, C);
92
93 loop.ssm2dot(plist('filename', 'loop.dot'));