SystemModelCalibrate

SystemModelCalibrate[data,smodel,pars]

calibrates the parameters pars in the system model smodel according to data.

SystemModelCalibrate[data,{smodel,cons},pars]

calibrates the parameters pars subject to the constraints cons.

SystemModelCalibrate[,spec]

calibrates following the specification spec.

SystemModelCalibrate[,"prop"]

gives the value of the property "prop".

Details and Options

  • SystemModelCalibrate is used to calibrate parameter values in a system model to match simulation results with real-world data.
  • Given measured data from the real-world system, the goal is to calibrate parameters pars in the smodel to produce simulated data that is as close as possible to the measured data.
  • The calibrated parameters are , where are non-negative weights and is a loss function with typical form , which is approximated by the sampled data as .
  • Several quality measures of how well data and calibrated model agree can be computed as properties.
  • The system model smodel can have the following forms:
  • SystemModel[]general system model
    StateSpaceModel[]state-space model
    TransferFunctionModel[]transfer function model
    AffineStateSpaceModel[]affine state-space model
    NonlinearStateSpaceModel[]nonlinear state-space model
    DiscreteInputOutputModel[]discrete input-output model
  • data is an association of the form <|x1data1,|>, where xi is a variable in smodel and datai is its corresponding data.
  • pars is a list of tunable parameters in smodel. It can have the following forms:
  • {θ1,}calibration parameters starting from values in smodel
    {{θ1,},}calibration parameter θi starting from point
  • spec is an Association that allows the following keys:
  • "SimulationInterval"{tmin,tmax}simulate from time tmin to tmax
    "ParameterValues"{p1val1,}parameter pi has value vali
    "InitialValues"{x1val1,}variable xi has initial value vali
    "Inputs"{in1fun1,}input ini has value funi[t] at time t
    "CalibratedModelName"namename for calibrated SystemModel
    "ExtendModel"Falsewhether the calibrated SystemModel extends smodel
    "Weights"{w1,}positive multi-objective sum weights wi for each calibration variable in data
  • The "CalibratedModelName" name can have the following forms:
  • Automaticautomatically generate a model name (default)
    "name"name calibrated model "name"
    Noneset calibrated values in place in smodel
  • By default, SystemModelCalibrate[data,smodel,pars,spec] returns a model with parameters set to the calibrated values.
  • Properties
  • SystemModelCalibrate[,"CalibratedSystemModel"] returns a CalibratedSystemModel object csmodel that can be used to extract additional properties using the form csmodel["prop"].
  • SystemModelCalibrate[,"prop"] can be used to directly get the value of csmodel["prop"].
  • Typical properties that can be retrieved with SystemModelCalibrate[,"prop"] include:
  • "CalibratedModel"new model with calibrated parameters
    "CalibratedParameters"parameter estimates
    "ParameterConfidence"parameter confidence information
    "MeanPredictionBandsPlot"mean predictions confidence bands plot with calibration data
    "SinglePredictionBandsPlot"plot of confidence bands based on single observations with calibration data
  • Properties related to data and the calibrated model include:
  • "CalibratedSimulationData"calibrated model simulation results
    "CalibrationData"calibration data in data
    "ValidationData"validation set data
    "CalibratedModelName"model name of new model with calibrated parameters
    "CalibrationDataResponse"response values in the calibration data
    "ValidationDataResponse"response values in the validation data
    "CalibratedDataResponse"calibrated model values for the calibration data
    "CalibratedValidationDataResponse"calibrated model values for the validation data
  • Types of residuals include:
  • "CalibrationDataResiduals"difference between actual and predicted responses
    "ValidationDataResiduals"difference between validation and predicted responses
    "StandardizedResiduals"residuals for calibration data divided by the standard error for each residual
  • Properties of predicted values include:
  • "CorrelationMatrix"asymptotic parameter correlation matrix
    "MeanPredictionBands"confidence bands for mean predictions
    "MeanPredictionConfidence"confidence information for the mean predictions of calibration data
    "SinglePredictionBands"confidence bands based on single observations
    "SinglePredictionConfidence"confidence information for the predicted response of single observations of calibration data
  • Properties that measure goodness of calibration include:
  • "MSE"mean squared error for each calibration variable, i.e.
    "RMSE"root mean squared error for each calibration variable, i.e.
    "RRMSE"relative root mean squared error for each calibration variable, i.e.
  • Properties that store calibration details include:
  • "CalibrationParameterConstraints"calibration parameter constraints cons
    "CalibrationVariables"calibration variables in data
    "InitialCalibrationParameters"calibration parameters pars and their calibration start values
    "InputModel"model smodel
    "InputModelName"model name of SystemModel smodel
    "SimulationInterval"simulation interval used in calibration
  • Options
  • The following options can be given:
  • ConfidenceLevel 95/100confidence level for parameters and predictions
    FitRegularization Noneregularization for pars
    Method Automaticwhat simulation and calibration methods to use
    NormFunction Normthe norm to minimize
    ProgressReporting $ProgressReportingcontrol display of progress
    ValidationSet Nonevalidation data
    VarianceEstimatorFunction Automaticfunction for estimating the error variance
  • With ConfidenceLevel->p, probability-p confidence intervals are computed for parameter and prediction intervals.
  • FitRegularization and NormFunction can be used to change the calibration target into , where is a regularization function, e.g. g(theta)=lambda TemplateBox[{theta, 2}, Norm2]^2 (Tikhonov) or g(theta)=lambda TemplateBox[{theta, 1}, Norm2] (Lasso), and the loss function is given by , where is the norm function.
  • The following settings for ValidationSet can be given:
  • Noneuse only the existing calibration data to measure quality (default)
    datavalidation set in the same form as calibration data data
    Scaled[frac]reserve a specified fraction of the calibration data for validation
  • With the setting VarianceEstimatorFunction->f, the common variance is estimated by f[res,w], where res is the list of residuals and w is the list of weights.
  • Method settings take the form Method <|"sub1"val1,|>.
  • Method suboptions "subi" include:
  • "CalibrationMethod"Automaticcalibration method
    "SimulationMethod"Automaticsimulation method
  • "CalibrationMethod" settings are the same as the Method settings in FindMinimum.
  • "SimulationMethod" settings are the same as the Method settings in SystemModelSimulate.
  • Distributional assumptions are based on an unconstrained model calibrated by minimizing the default loss function.

Examples

open allclose all

Basic Examples  (2)

Use data of the angular velocity of a component to calibrate a model of a hybrid motor:

Calibrate the values of the resistance and the damping:

Simulate with the calibrated parameters and compare with the data:

Use data of an output of a NonlinearStateSpaceModel to calibrate the model:

Calibrate a parameter value:

Compute the single prediction bands and plot them together with the data and the calibrated simulation response:

Scope  (14)

Data  (3)

Provide data for as many variables as you want to calibrate:

Calibrate a parameter value:

Simulate with the calibrated parameter and compare with the data:

Use data with units to calibrate a model of a hybrid motor:

Calibrate the values of the resistance and the damping:

Use the time-value pairs of a time series as data to calibrate a model:

Calibrate the values of two parameters:

Models  (4)

Use data generated with an input signal to calibrate a DiscreteInputOutputModel:

Specify the input signal to calibrate a parameter value:

Compute the single prediction bands and plot them together with the data and the calibrated simulation response:

Use data generated with an input signal to calibrate a TransferFunctionModel:

Specify the input signal to calibrate a parameter value:

Compute the single prediction bands and plot them together with the data and the calibrated simulation response:

Use data generated with an input signal to calibrate a StateSpaceModel:

Specify the input signal to calibrate parameter values:

Compute the single prediction bands and plot them together with the data and the calibrated simulation response:

Use data of the output of an AffineStateSpaceModel to calibrate the model:

Calibrate a parameter value:

Compute the single prediction bands and plot them together with the data and the calibrated simulation response:

Parameters and Constraints  (2)

Indicate initial guess values for the calibration parameters:

Calibrate two parameter values:

Introduce constraints for the calibration parameters:

Calibrate two parameter values:

Confidence intervals are computed assuming an unconstrained model:

Specification  (4)

Specify a model name for the calibrated model:

Calibrate the value of the damping parameter, specifying the calibrated model name:

Create a calibrated model that extends the input model:

Use data generated with an input signal to calibrate a model:

Specify the input signal to calibrate parameter values:

Specify a fixed value for a parameter to calibrate another:

Specify initial values and a simulation interval to calibrate a model:

Calibrate a parameter value:

Provide weights for the calibration of several variables:

Calibrate a parameter value:

Compute the single prediction bands and plot them together with the data and the calibrated simulation response:

Properties  (1)

Find the list of available properties:

These can be extracted more conveniently from the CalibratedSystemModel:

Extract the single prediction bands plot:

Extract the single prediction bands plot with a custom confidence level:

Extract the single prediction bands plot with a custom variance estimator function:

Extract the calibrated model and the calibrated parameters:

Extract the single prediction bands:

Extract the single prediction bands evaluated at time t:

Extract the root mean squared error for each calibration variable:

Extract the root mean squared error for each calibration variable providing a validation set:

Extract parameter confidence information, including estimates, standard errors, confidence intervals,

  • -statistics for parameter estimates
  • , and values for parameter statistics:

    Options  (8)

    ConfidenceLevel  (1)

    Use data of the states of a model to calibrate a parameter:

    Use the default confidence level:

    Specify a custom confidence level of 0.5:

    FitRegularization  (1)

    Use data of an output to calibrate a model:

    Use a loss function with no regularization to calibrate parameters:

    Use a Lasso regularization to calibrate parameters:

    Use a Tikhonov regularization to calibrate parameters:

    Method  (2)

    Use data of the angular velocity of a component to calibrate a model of a hybrid motor:

    Use the default simulation method to calibrate the value of the damping parameter:

    Calibrate, specifying a number of interpolation points for simulation:

    Use data of an output to calibrate a model:

    Use the default fitting method to calibrate parameters:

    Use the conjugate gradient method to calibrate parameters:

    NormFunction  (1)

    Use data of an output to calibrate a model:

    Use the default norm in the loss function to calibrate parameters:

    Use the -norm in the loss function to calibrate parameters:

    Use the 1-norm in the loss function to calibrate parameters

    ProgressReporting  (1)

    Use data of the angular velocity of a component to calibrate a model of a hybrid motor:

    Calibrate the values of the resistance and the damping with the default progress reporting:

    Calibrate without progress reporting:

    ValidationSet  (1)

    Use data of an output to calibrate a model:

    Calibrate parameters using no validation data:

    Calibrate parameters by reserving a fraction of the calibration data for validation:

    Use a particular random seed in the selection of validation data to ensure predictable results:

    Use a custom validation set to calibrate parameters:

    VarianceEstimatorFunction  (1)

    Use data of the states of a model to calibrate a parameter:

    Use the default estimate of error variance:

    Estimate the variance by the mean absolute error:

    Applications  (5)

    Closed-Flow Heating System  (1)

    Use temperature data to estimate the heat flow rate for a burner in a model of a heating system:

    Compute the single prediction bands and plot them together with the data and the calibrated simulation response:

    Plot the residuals against time:

    Model Simplification  (1)

    Recreate the behavior of a speaker by calibrating a simpler circuit using simulation results as input data:

    Compare the behavior of both models before calibration:

    Retrieve simulation results as data and use them for calibration:

    Compare the calibrated model with the speaker:

    Conveyor Belt Friction  (1)

    Calibrate the viscous contribution to friction in a model of a body held by a spring on top of an accelerating conveyor belt:

    The total kinetic friction can be modeled as a combination of viscous, Coulomb and Stribeck components:

    The equations of motion must include the event-generating effect of the static friction, which holds the body static with respect to the belt until an upper bound is breached by external forces:

    Set initial values for the position and velocity of the body and the discrete variable tracking the impact of static friction:

    Set parameter values and create the system model:

    Calibrate the contribution of the viscous term with data for the position of the body:

    Find the 95% confidence interval for the viscous friction factor:

    Compute the single prediction bands and plot them together with the data and the calibrated simulation response:

    Compute the extremes of the position and velocity for the calibrated simulation data:

    Reverse Engineering of Controller  (1)

    Deduce the controller parameters in a controlled system for which you have step response data:

    Connect the plant model to a controller with symbolic parameters:

    Calibrate the parameters in the model with the step response data of the controlled system:

    Compare the simulation results of the calibrated model with the reverse-engineered model:

    Reduced Three-Body Problem  (1)

    Estimate the mass of a planet that orbits a star from the trajectory of one of its moons in a reduced three-body planetary system:

    The dynamics of the moon are dictated by Newtonian gravity:

    Set parameter values for the system and initial values for the trajectory of the moon:

    Create a model from the equations, parameters and initial values:

    Simulate the model before calibration and plot the trajectories of the three bodies:

    Calibrate a model with data for the trajectory of the moon:

    Retrieve the simulation data and plot the trajectories for the calibrated model:

    Compare the data with the calibrated trajectory:

    Wolfram Research (2023), SystemModelCalibrate, Wolfram Language function, https://reference.wolfram.com/language/ref/SystemModelCalibrate.html.

    Text

    Wolfram Research (2023), SystemModelCalibrate, Wolfram Language function, https://reference.wolfram.com/language/ref/SystemModelCalibrate.html.

    CMS

    Wolfram Language. 2023. "SystemModelCalibrate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SystemModelCalibrate.html.

    APA

    Wolfram Language. (2023). SystemModelCalibrate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SystemModelCalibrate.html

    BibTeX

    @misc{reference.wolfram_2024_systemmodelcalibrate, author="Wolfram Research", title="{SystemModelCalibrate}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/SystemModelCalibrate.html}", note=[Accessed: 15-October-2024 ]}

    BibLaTeX

    @online{reference.wolfram_2024_systemmodelcalibrate, organization={Wolfram Research}, title={SystemModelCalibrate}, year={2023}, url={https://reference.wolfram.com/language/ref/SystemModelCalibrate.html}, note=[Accessed: 15-October-2024 ]}