LTPDA Toolbox™ | contents |
The statespace models in LTPDA have two types of parameters: configuration parameters, like 'DIM', 'VERSION', which are common to all ssm models, and system parameters which are model specific. These system parameters represent symbolic entries in the underlying statespace matrices. By default, when you build a ssm object, the system parameters are replaced by their numerical values and the model is returned in a fully numeric state. The numerical values that were substituted are stored in the 'numparams' field of the object. This field is a plist where each key represents the parameter name, and the corresponding value is the parameter value.
For example, suppose we build the LTP model like this:
% Build the default version of the LTP model ltp = ssm(plist('built-in', 'LTP'));
% Check if the model is numeric
ltp.isnumerical
% List the numerical parameters
ltp.numparams
% View the 'numparams' plist in MATLAB's documentation browser
ltp.numparams.tohtml
% Get the TM1 stiffness along x w1 = ltp.numparams.find('EOM_TM1_STIFF_XX');
% Search for all stiffness values subsetPlist = ltp.numparams.regexp('stiffness');
% Search for all stiffness values subsetPlist = ltp.numparams.regexp('stiffness').regexp('TM1');
You can override the default system parameters at build time by specifying the parameter name and a value in the configuration plist used for building the model. For example, let's set the stiffness of TM1 to a different value when building our LTP model:
% Build the default version of the LTP model modelPlist = plist(... 'built-in', 'LTP', ... 'EOM_TM1_STIFF_XX', 1e-6 ... ); % Build the LTP model with our configuration plist ltp = ssm(modelPlist);
Note: In the current version of the LPF models, stiffness terms are specified as positive. This will likely change in future versions. |
% Get the TM1 stiffness along x w1Used = ltp.numparams.find('EOM_TM1_STIFF_XX')
The default is to build models completely numeric, but you can also build symbolic models. One limitation of doing this is that the model needs to be built continuous rather than discrete. This imposes further constraints on the models you are able to build, especially when it comes to the version of the DFACS model that you build because we don't have continuous versions of the DFACS for all versions.
To build the 'Standard' version of LTP continuous and with some symbolic parameters, you can do:
% Build the default version of the LTP model modelPlist = plist(... 'built-in', 'LTP', ... 'SYMBOLIC PARAMS', {'EOM_TM1_STIFF_XX', 'EOM_TM2_STIFF_XX'}, ... 'continuous', true ... ); % Build the symbolic LTP model with our configuration plist ltp = ssm(modelPlist);
% Check if the model is numeric ltp.isnumerical % Check if the model is continuous ltp.timestep
% List the symbolic parameters
ltp.params
Once you have a symbolic model, you can change the values of those symbolic parameters by using the ssm/setParameters method. For example, let's set the two stiffness values we kept symbolic in the model we built above:
% Set the values of the two stiffness parameters ltp.setParameters('EOM_TM1_STIFF_XX', 1e-6, 'EOM_TM2_STIFF_XX', 3e-6); % Check the values were set ltp.params % View the 'params' plist in MATLAB's documentation browser ltp.params.tohtml
Note: by calling setParameters with no outputs, we modify our existing model. If we did give an output variable, then the original model would be copied, the parameters set on the copy, and then the copy returned, leaving the original model untouched. |
Before we can simulate with this symbolic model, we have to make the model discrete. Before we can do that, we have to make the model numeric. Making the model numeric means substituting all symbolic parameters with their numeric values. To do that, we use the ssm/subsParameters method like this:
% Substitute all symbolic parameters with their numeric values numericLTP = ltp.subsParameters; % Confirm there are no symbolic parameters remaining numericLTP.params
% Define a plist for bode bodePlist = plist(... 'inputs', 'SIGNAL_TM12.x', ... 'outputs', 'DELAY_IFO.x1', ... 'f', logspace(-4, log10(0.5), 1000) ... % from 0.1mHz to 0.5Hz ); % Compute system response out = numericLTP.bode(bodePlist); % Plot response iplot(out);
Now we can go ahead and discretize the model using ssm/modifyTimeStep. On-board LPF the DFACS controllers are discretized at 10Hz, so we'll do the same here:
% Modify the time-step of the model to 0.1s (10Hz) dLTP = numericLTP.modifyTimeStep(0.1); % Confirm the model has this timestep dLTP.timestep
% Compute system response dout = dLTP.bode(bodePlist); % Get the continuous response and set its name contResp = out.unpack; contResp.setName('Force->displacement (Continuous)'); % Get the discrete response and set its name discResp = dout.unpack; discResp.setName('Force->displacement (Discrete)'); % Compare the two bode plots iplot(contResp, discResp)
Since the model is now numerical and discrete, we can simulate the noise of the system just as we did earlier.
Simulating LPF noise | Simulate LPF with matched stiffness |
©LTP Team