main content

design exploration using parameter sampling (gui) -凯发k8网页登录

this example shows how to sample and explore a design space using the sensitivity analyzer. you explore the design of a continuously stirred tank reactor (cstr) to minimize product concentration variation and production cost. the design must also account for the uncertainty in the temperature and concentration of the input feed to the reactor.

you explore the cstr design by characterizing model parameters using probability distributions. you use the distributions to generate random samples and perform monte-carlo evaluation of the design at these sample points. you then create plots to visualize the design space and select the best design. you then use the best design as an initial guess for optimization of the design.

continuously stirred tank reactor (cstr) model

continuously stirred tank reactors (cstrs) are common in the process industry. the simulink® model, sdocstr, models a jacketed diabatic (i.e., non-adiabatic) tank reactor described in [1]. the cstr is assumed to be perfectly mixed, with a single first-order exothermic and irreversible reaction, . , the reactant, is converted to , the product.

in this example, you use the following two-state cstr model, which uses basic accounting and energy conservation principles:

  • , and - concentrations of a in the cstr and in the feed [kgmol/m^3]

  • , , and - cstr, feed, and coolant temperatures [k]

  • and - volumetric flow rate [m^3/h] and the density of the material in the cstr [1/m^3]

  • and - height [m] and heated cross-sectional area [m^2] of the cstr.

  • - pre-exponential non-thermal factor for reaction [1/h]

  • and - activation energy and heat of reaction for [kcal/kgmol]

  • - boltzmann's gas constant [kcal/(kgmol * k)]

  • and - heat capacity [kcal/k] and heat transfer coefficients [kcal/(m^2 * k * h)]

open the simulink model.

open_system('sdocstr');

cstr design problem

assume that the cstr is cylindrical, with the coolant applied to the base of the cylinder. tune the cstr cross-sectional area, , and cstr height, , to meet the following design goals:

  • minimize the variation in residual concentration, . variations in the residual concentration negatively affect the quality of the cstr product. minimizing the variations also improves cstr profit.

  • minimize the mean coolant temperature . heating or cooling the jacket coolant is expensive. minimizing the mean coolant temperature improves cstr profit.

the quality of the feed to the reactor can differ among suppliers. thus, the design must allow for variations in the supply feed concentration, , and feed temperature, . the quality of the feed differs from supplier to supplier and also varies within each supply batch.

specify design variables

open the sensitivity analyzer. in the simulink model from the apps tab, click sensitivity analyzer under control systems. the app opens with an empty sensitivity analysis session.

create a parameter set that includes the cstr design variables a and h and the feed variation parameters feedconc0 and feedtemp0. you randomly generate multiple values for these parameters to evaluate the cstr design.

  • in the sensitivity analysis tab, in the select parameters drop-down menu, select new.

  • in the dialog box, select a, feedcon0, feedtemp0, and h.

  • click ok. an empty parameter set, paramset is created in the parameter set area of the app browser.

specify the parameter distributions and correlations. paramset will be populate with parameter values selected randomly from the specified distributions:

  • sample a from a uniform distribution with lower bound 0.2 m^2 and upper bound 2 m^2.

  • sample h from a uniform distribution with lower bound 0.5 m and upper bound 3 m.

  • sample feedconc0 from a normal distribution with mean 10 kgmol/m^3 and standard deviation 0.5 kgmol/m^3.

  • sample feedtemp0 from a normal distribution with mean 295 k and standard deviation 3 k.

  • specify feedcon0 and feedtemp0 as negatively correlated with covariance 0.6.

to generate 100 parameter values using the above distribution and correlation information, click generate values, and select generate random values. for repeatability of the example reset the random number generator.

rng('default')

in the generate random parameter values dialog box, specify the following:

  • set the number of samples to 100

  • for parameter a select uniform distribution, set the lower bound to 0.2 and upper bound to 2.

  • for parameter feedcon0 select normal distribution, set mu to 10 and sigma to 0.5, and check cross-correlated.

  • for parameter feedtemp0 select normal distribution, set mu to 295 and sigma to 3, and check cross-correlated.

  • for parameter h select uniform distribution, set the lower bound to 0.5 and upper bound to 3.

  • in the correlation matrix tab, set the feedcon0, feedtemp0 covariance to -0.6.

  • click ok to generate the parameter values.

the paramset table is updated with the generated parameter values. note that you can manually edit the generated parameter values in the paramset table.

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 plots gallery. the plot shows the histogram of the generated parameters on the diagonal and pair-wise parameter values on the off-diagonal.

note that due to the random number generator the specific values in the plots and tables below may differ from what you get when running the example.

each marker on the plot represents one row of the paramset table, with each row being simultaneously displayed on all the plots. the correlation between feedcon0 and feedtemp0 can be seen on the plot.

specify requirements for evaluation

the cstr design is required to minimize the variation in residual concentration and minimize the mean coolant temperature. select new requirement and click signal property to create a requirement to minimize the residual concentration variation.

in the create requirement dialog box, specify the following fields:

  • in the property drop-down list, select signal variance.

  • in the type drop-down list, select minimize.

  • in the select signals area, select a logged signal to apply the requirement to. to do so click . a create signal set dialog box opens where you specify the logged signal. in the simulink model, click the signal at the ca output of the cstr block. the dialog box now displays this signal. add the signal to the signal set and click ok.

  • close the signal property requirement dialog by clicking the x in the upper right dialog corner.

close the create requirement dialog box. a new requirement, signalproperty is listed in the requirements area of the app browser

  • right-click signalproperty, select rename; rename the requirement to concvar.

select new requirement and click signal property to create a requirement to minimize the coolant mean (output of block sdocstr/controller) temperature.

in the create requirement dialog box, specify the following fields:

  • in the property drop-down list, select signal mean.

  • in the type drop-down list, select minimize.

  • in the select signals area, add the sdocstr/controller signal to the requirement.

close the create requirement dialog box. a new requirement, signalproperty is created in the requirements area of the app browser. rename the requirement coolmean.

evaluate

in the sensitivity analysis tab, click select for evaluation. by default, all requirements are selected to be evaluated. click evaluate model to evaluate the concvar and coolmean 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 (tm), or by using fast restart. for more information, see "use parallel computing for sensitivity analysis" and "use fast restart mode during sensitivity analysis" in the simulink design optimization™ documentation.

a results scatter plot showing each parameter vs each requirement is updated during model evaluation. at the end of evaluation a table with the evaluation results is created, each row in the evaluation result table contains values for a, feedcon0, feedtemp0, h and the resulting requirement values concvar and coolmean. the evaluation results are stored in the evalresult variable in the results area of the app.

analyze the evaluation results

the results scatter plot for evalresult shows that coolmean is inversely correlated with h (increasing h decreases coolmean) and that low values of h can result in high values for concvar. the plot shows that low values of a can result in high values for concvar, but it is not clear from the plot how a is correlated with concvar or coolmean or which parameter influences concvar the most. to investigate further, in the statistics tab, select all the analysis methods and types and click compute statistics. this performs analysis on the evaluation results and creates a tornado plot. the tornado plot shows the influence of each parameter on each requirement:

  • h is inversely correlated with coolmean, and is the parameter that influences coolmean the most.

  • a is inversely correlated with coolmean.

  • feedcon0 and feedtemp0 are inversely correlated with coolmean.

  • a is inversely correlated with concvar, and is the parameter that influences concvar the most.

  • h is inversely correlated with concvar.

  • feedcon0 and feedtemp0 have mixed correlation with convar, but have minimal correlation with concvar.

the analysis shows that choosing a large h, to reduce coolmean and choosing a large a to reduce coolvar would appear to be a good design choice. you can confirm this by creating a contour plot of coolmean and coolvar versus h and a. select evalresult from the results area of the app browser, and in the plots tab, in the plots gallery click contour plot. on the contour plot select h for the y parameter, note that large h medium values of a give low values for both concvar and coolmean.

choose an initial guess for optimization

sort the evaluation result table by decreasing h, and select a row that has low concvar and coolmean values. right-click the selected row and click extract parameter values. the extracted parameter values are saved in the paramvalues variable in the results area of the app browser. these parameter values are used as the initial guess for optimization.

optimize

use the data in the sensitivity analyzer to create an optimization problem to optimize a and h. in the sensitivity analysis tab click optimize, and select create response optimization session. this opens a dialog to import data from sensitivity analysis to response optimizer.

  • select both the concvar and coolmean requirements to import.

  • select paramvalues to import as design variables for optimization.

  • select evalresult to import as uncertain variables to use during optimization.

  • click ok to import the data to the response optimizer

configure the response optimizer to optimize the cstr design:

  • click the pencil icon to edit the paramvalues design variable set, and remove the feedcon0 and feedtemp0 variables from the design variable set.

  • select evalresult as the uncertain variable set, click the pencil icon to edit evalresult, and remove a and h from the uncertain variable set.

add iteration plots to see how the variables paramvalues (a and h), and optimization requirements concvar and coolmean change during optimization.

  • select the variables in the data to plot drop-down list, and select iteration plot in the add plot drop-down list.

  • click optimize.

the optimization minimizes coolmean and concvar in the presence of varying feedcon0 and feedtemp0.

related examples

to learn how to explore the cstr design space using the sdo.evaluate command, see .

references

[1] bequette, b.w. process dynamics: modeling, analysis and simulation. 1st ed. upper saddle river, nj: prentice hall, 1998.

close the model

bdclose('sdocstr')

related topics

网站地图