explore design reliability using parameter sampling (gui) -凯发k8网页登录
this example shows how to use the sensitivity analyzer to explore the behavior of a pi controller for a dc motor. the controller is susceptible to variations caused by component tolerances, and the impact on controller reliability is explored.
you explore the controller reliability by characterizing the components using probability distributions. you use the distributions to generate random samples and perform monte-carlo evaluation of the controller design at these sample points. you evaluate the impact of the component tolerances on the controller behavior, and use statistical analysis to determine which components have the most influence on whether the controller meets its requirements. this analysis guides the selection of component tolerances.
this example requires statistics and machine learning toolbox™.
implementation of controller for dc motor
the controller enables the dc motor's angular position to match a desired reference value. the load on the motor is subject to disturbances, and the controller needs to reject these disturbances. the simulink® model can be used to probe how well the controller rejects a step disturbance at 1 second.
open_system('sdomotorposition');
the gains of the pi controller, kp
and ki
, are set using resistors in the circuit below:
the resistances r1
through r4
are 47 kohm, 180 kohm, 10 kohm and 10 kohm respectively. these were chosen to set kp
and ki
to values that enable the controller to meet the requirements for disturbance rejection. however, in practice the actual resistor values will differ from the nominal ones, within a tolerance. this raises concern about whether the actual controller will still satisfy the requirements. to explore the effect of different resistance values, use the sensitivity analyzer. in the simulink model from the apps tab, click sensitivity analyzer under control systems to open the app.
design requirements
the controller needs to maintain the motor at a reference position in the presence of disturbances. if a step disturbance occurs, the motor needs to deviate no more than 20 degrees, and needs to settle back to within 5 degrees of the reference position by 4 seconds after the disturbance.
load previously specified design requirements for disturbance rejection. in the app, click open session and select open from model workspace in the drop-down menu.
you can plot the requirements and verify that they are met when the resistances have the nominal values. in the requirements area in the data browser, right-click on the lowerbound
requirement, and select plot and simulate. do the same for the upperbound
requirement.
parameter sampling
the motor position satisfies the disturbance rejection requirements, when the resistances are at their nominal values. however, in practice the actual resistor values will differ from the nominal ones, and we need to determine whether the controller will still meet the requirements. click select parameters and make a new parameter set. this creates paramset
in the parameter sets area of the app. specify that r1
, r2
, r3
, and r4
are in the parameter set, and click ok.
click generate values and generate random values. for repeatable results, reset the state of the random number generator in matlab®.
rng('default')
in the generate random parameters dialog box, specify 500 samples to generate.
specify the probability distribution for each parameter. standard precision resistors match their nominal component value within a tolerance of 5%. this could be modeled using a uniform probability distribution. however, because resistors that measure within 1% of the nominal value are separated out and sold as higher-priced precision resistors, the 5% resistors can be more accurately modeled by a probability distribution with a well that excludes values within 1% of nominal. this can be modeled using a piecewise linear probability distribution if statistics and machine learning toolbox™ is available.
specify the distribution of r1
as piecewise linear with 4 points. specify the x values as [0.95 0.99 1.01 1.05] times 47 (the nominal value of the resistor). specify the fx values as [0 0.5 0.5 1]; these are the values of the cumulative distribution function corresponding to each x value. similarly, set the distributions of r2
, r3
and r4
to piecewise linear with 4 points, the x values as [0.95 0.99 1.01 1.05] times the nominal values (180, 10, and 10, respectively), and the fx values as [0 0.5 0.5 1].
click ok to generate parameter values. the generated values are stored in the paramset
variable in the parameter set area of the app. (note that due to the random number generator, the specific values in the table below may differ from what you get when running the example.)
to plot the parameter set click paramset
in the parameter sets area of the app browser. in the plots tab, select scatter plot in the plot gallery. the plot shows the histogram of the generated parameters on the diagonal and pair-wise parameter scatter plots off the diagonal. each marker on the plot represents one row of the paramset
table, with each row being simultaneously displayed on all the scatter plots. you can use the view tab to arrange the layout of the table and plot so they are both visible.
evaluate requirements with 5% components
evaluate the requirements for each row of parameter values in the table to see if the requirements are satisfied. in the sensitivity analysis tab, click select for evaluation. by default, all requirements are selected to be evaluated. click evaluate model to evaluate the upperbound
and lowerbound
requirements for each row of parameter values in paramset
. note you can speed up evaluation by using parallel computing if you have the parallel computing toolbox™, or by using fast restart. for more information, see use parallel computing for sensitivity analysis and .
a results scatter plot showing each requirement vs. each parameter is updated during model evaluation. at the end of evaluation a table with the evaluation results is shown. each row in the evaluation result table contains values for r1
, r2
, r3
, r4
and the resulting requirement values upperbound
and lowerbound
. the evaluation results are stored in the evalresult
variable in the results area of the app. you can use the view tab to arrange the layout of the table and plot so they are both visible.
you can sort the evaluation results table by clicking on the column headers in the table. the lowerbound
requirement is still met, as indicated by the fact that all evaluation results for the signal bound requirement are negative. that is not the case for the upperbound
requirement, which has several positive values. by selecting the rows of the table with these positive values, you can also see the corresponding points highlighted in the scatter plot.
analyze the evaluation results
using 5% tolerance components resulted in violation of the upperbound
requirement. precision components with 1% tolerance would satisfy the design requirements, but they are more costly, so it is desirable to use only as many as necessary. you can use statistical analysis to identify the components that most influence the design requirements.
in the statistics tab, select a variety of analyses to be done, including correlation and standardized regression methods, and linear and ranked types of processing. click compute statistics. the analysis result is stored in statsresult
in the results area of the app, and a tornado plot shows the analysis results. for each requirement, the tornado plot shows the most influential parameters at the top, and the others in decreasing order of the magnitude of their influence on the requirement. for the upperbound
requirement, r3
and r4
have the most influence, so we will try replacing these by higher precision 1% components.
evaluate requirements with mixed components
explore the use of 1% component tolerances only for resistors r3
and r4
. in the sensitivity analysis tab, click generate values and generate gridded values. for r1
and r2
, specify that the nominal value is to be perturbed by plus-and-minus 5%. for r3
and r4
, specify that the nominal value is to be perturbed by plus-and-minus 1%.
click overwrite to generate the new parameter values. to plot the parameter set click paramset
in the parameter sets area of the app browser. in the plots tab, select scatter plot in the plot gallery.
in the sensitivity analysis tab, click evaluate model. the requirements are evaluated for each row in the table of parameter values, and results are stored in evalresults_1
shown in the results area of the app. the evaluation results scatter plot and the evaluation results table show that both requirements are met for all combinations of component values.
the sensitivity analyzer was used to explore the effect of standard precision components on the design requirements of a pi controller. with standard precision components, some requirements were found to be violated. statistical analysis was used to identify which parameters most influence the requirements. the analysis resulted in replacement of only two of the four components with most costly high-precision components.
close the model.
bdclose('sdomotorposition')