SystemModelSurrogateTrain[sys,spec]
creates a reduced model from the system model sys according to spec.
SystemModelSurrogateTrain[…,"prop"]
gives the value of the property "prop".
SystemModelSurrogateTrain
SystemModelSurrogateTrain[sys,spec]
creates a reduced model from the system model sys according to spec.
SystemModelSurrogateTrain[…,"prop"]
gives the value of the property "prop".
Details and Options
- SystemModelSurrogateTrain is typically used to create a faster model that focuses on specific outputs and input ranges.
- Given a system sys with model parameters and initial values θ, SystemModelSurrogateTrain creates a function f[θ,t] that replicates the system behavior for different parameter values over time.
- SystemModelSurrogateTrain produces a reservoir and learned weights that are assembled in a continuous-time echo state network that reproduces the selected outputs.
- By default, SystemModelSurrogateTrain[sys,spec] returns a SystemModelSurrogate object sms that can be used to extract additional properties using the form sms["prop"].
- The system model sys 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 - spec is an Association that allows the following keys:
-
"InitialValues" {v1val1,…} variable vi has initial value vali "Inputs" {in1fun1,…} input ini has value funi "Outputs" {v1,…} variables to preserve "ParameterValues" {p1val1,…} parameter pi has value vali "SimulationCount" 200 target number of simulations "SimulationInterval" {tmin,tmax} simulate and plot from time tmin to tmax - When multiple parameter sampling sources are provided, simulations are performed covering their combinations, using the target number of simulations as an upper bound.
- The values vali in "ParameterValues" and "InitialValues" can take the following forms:
-
{pval1,…} custom list of values randomly sampled int an Interval or CenteredInterval uniformly sampled dist an Around or a distribution to sample reg a region to sample uniformly - Multidimensional regions and distributions vald for sets of d variables can be set with {v1,…,vd}vald.
- The inputs funi in "Inputs" can take the following forms:
-
f a single function f[t] at time t {f1,…} a custom list of functions randomly sampled rproc a random process to sample - Vector-valued functions and processes fund for sets of d inputs can be set with {in1,…,ind}fund.
- SystemModelSurrogateTrain[…,"prop"] can be used to directly get the value of sms["prop"].
- Typical properties that can be retrieved with SystemModelSurrogateTrain[…,"prop"] include:
-
"Net" surrogate model as a neural net "ParametricFunction" surrogate model as a parametric function "SystemModel" surrogate model as a system model - Properties that validate the training include:
-
"MAEPlot" plot of maximum absolute error for each output, i.e. ![MAE_i= TemplateBox[{{{{y, _, i}, (, {t, _, j}, )}, -, {{f, _, i}, (, {{theta, ^, ^}, ,, {t, _, j}}, )}}, infty}, Norm2] MAE_i= TemplateBox[{{{{y, _, i}, (, {t, _, j}, )}, -, {{f, _, i}, (, {{theta, ^, ^}, ,, {t, _, j}}, )}}, infty}, Norm2]](Files/SystemModelSurrogateTrain.en/2.png)
"RMSEPlot" plot of root mean squared error for each output, i.e. 
"RRMSEPlot" plot of relative root mean squared error for each output, i.e. 
- The following options can be given:
-
Method Automatic what simulation method to use NormFunction Norm norm used to compute loss ProgressReporting $ProgressReporting control display of progress SamplingPeriod Automatic sample period for random processes ValidationSet Automatic validation data - The following settings for ValidationSet can be given:
-
Scaled[frac] reserve a fraction frac of the data for validation {k,Scaled[frac]} Monte Carlo cross-validation using k subsets and a fraction frac of the data
Examples
open all close allBasic Examples (1)
Estimate the angular velocity of a component for a specific range of the resistance in a model of a motor:
model = \!\(\*GraphicsBox[«8»]\);surrogate = SystemModelSurrogateTrain[model, <|"Outputs" -> "Inertia2.w", "ParameterValues" -> {"Resistor1.R" -> CenteredInterval[0.5, 0.1]}|>]Compare the surrogate with the original model for a specific value of the resistance:
Show[SystemModelPlot[model, "Inertia2.w", <|"ParameterValues" -> {"Resistor1.R" -> 0.45}|>], SystemModelPlot[surrogate, "Inertia2.w", <|"ParameterValues" -> {"Resistor1.R" -> 0.45}|>, PlotStyle -> StandardRed]]Scope (13)
Systems (3)
Estimate the output in an AffineStateSpaceModel as a function of the initial value of a state:
SystemModelSurrogateTrain[AffineStateSpaceModel[{{2*Cos[Subscript[x, 2]] - Cos[Subscript[x, 1]*Subscript[x, 2]],
-Cos[1 + Subscript[x, 2]] + Subscript[x, 1]}, {{1}, {0}}, {Subscript[x, 1]}, {{0}}},
{Subscript[x, 1], Subscript[x, 2]}, {{u, 0}}, {Automatic}, Automatic, SamplingPeriod -> None], <|"InitialValues" -> {Subscript[x, 2] -> Interval[{1, 2}]}|>]Estimate the output in a TransferFunctionModel as a function of a parameter using a fixed input:
SystemModelSurrogateTrain[TransferFunctionModel[{{{2*(1 - a*s)}}, 2*(1 + s/2 + s^2)}, s], <|"Outputs" -> Subscript[, 1], "Inputs" -> {1 -> UnitStep}, "ParameterValues" -> {a -> NormalDistribution[]}|>]Estimate the output in a DiscreteInputOutputModel as a function of a parameter using a fixed input:
SystemModelSurrogateTrain[DiscreteInputOutputModel[Association["SampledSeries" -> TemporalData[TimeSeries,
{{{{a + u[0]}, {(u[0] + a*u[1])/2}, {(u[0] + a*u[1] + 2*a*u[2])/3}}}, {{0, 2, 1}}, 1,
{"Discrete", 1}, {"Discrete", 1}, {1}, {MissingDataMethod -> None,
... ime", "LastValue", "OutputCount", "OutputVariables", "Path",
"PathComponent", "PathComponents", "PathFunction", "PathLength", "SamplingPeriod", "StateCount",
"TemporalData", "TimePath", "Times", "TimeSeries", "TimeValues", "Type", "Values"}], <|"Outputs" -> y, "Inputs" -> {u -> TimeSeries[Sin[Range[-5, 5]]]}, "ParameterValues" -> {a -> NormalDistribution[4, 0.5]}|>]Specifications (3)
Select outputs to estimate with "Outputs":
surrogate = SystemModelSurrogateTrain[AffineStateSpaceModel[{{2*Cos[Subscript[x, 2]] - Cos[Subscript[x, 1]*Subscript[x, 2]],
-Cos[1 + Subscript[x, 2]] + Subscript[x, 1]}, {{1}, {0}}, {Subscript[x, 1]}, {{0}}},
{Subscript[x, 1], Subscript[x, 2]}, {{u, 0}}, {Automatic}, Automatic, SamplingPeriod -> None], <|"Outputs" -> {Subscript[x, 1], Subscript[x, 2]}, "InitialValues" -> {Subscript[x, 2] -> Interval[{1, 2}]}|>]surrogate["Variables"]Retrieve the parametric function for each output:
surrogate["ParametricFunction"]Select a number of simulations to perform with "SimulationCount" when parameters, initial values or inputs have uncertainty:
surrogate = SystemModelSurrogateTrain[AffineStateSpaceModel[{{2*Cos[Subscript[x, 2]] - Cos[Subscript[x, 1]*Subscript[x, 2]],
-Cos[1 + Subscript[x, 2]] + Subscript[x, 1]}, {{1}, {0}}, {Subscript[x, 1]}, {{0}}},
{Subscript[x, 1], Subscript[x, 2]}, {{u, 0}}, {Automatic}, Automatic, SamplingPeriod -> None], <|"SimulationCount" -> 50, "InitialValues" -> {Subscript[x, 2] -> Interval[{1, 2}]}|>]Retrieve the number of simulations:
surrogate["SimulationCount"]Select a simulation interval to use in validation with "SimulationInterval":
surrogate = SystemModelSurrogateTrain[AffineStateSpaceModel[{{2*Cos[Subscript[x, 2]] - Cos[Subscript[x, 1]*Subscript[x, 2]],
-Cos[1 + Subscript[x, 2]] + Subscript[x, 1]}, {{1}, {0}}, {Subscript[x, 1]}, {{0}}},
{Subscript[x, 1], Subscript[x, 2]}, {{u, 0}}, {Automatic}, Automatic, SamplingPeriod -> None], <|"SimulationInterval" -> {0, 3}, "InitialValues" -> {Subscript[x, 2] -> Interval[{1, 2}]}|>]Retrieve the simulation interval:
surrogate["SimulationInterval"]Uncertainty in Values (5)
Estimate an output by sampling a list of values for a parameter:
SystemModelSurrogateTrain[TransferFunctionModel[{{{2*(1 - a*s)}}, 2*(1 + s/2 + s^2)}, s], <|"ParameterValues" -> {a -> {1, 1.2, 1.5, 1.6}}|>]Estimate an output by sampling an interval for a parameter value:
SystemModelSurrogateTrain[TransferFunctionModel[{{{2*(1 - a*s)}}, 2*(1 + s/2 + s^2)}, s], <|"ParameterValues" -> {a -> CenteredInterval[0.5, 0.1]}|>]Estimate an output by sampling a distribution for a parameter value:
SystemModelSurrogateTrain[TransferFunctionModel[{{{2*(1 - a*s)}}, 2*(1 + s/2 + s^2)}, s], <|"ParameterValues" -> {a -> NormalDistribution[1, 1]}|>]Estimate an output by sampling a geometric region for a parameter value:
SystemModelSurrogateTrain[TransferFunctionModel[{{{2*(1 - a*s)}}, 2*(1 + s/2 + s^2)}, s], <|"ParameterValues" -> {a -> MeshRegion[{{0}, {1}, {2}}, Line[{1, 2, 3}]]}|>]Estimate an output by sampling a Circle for two parameter values:
SystemModelSurrogateTrain[TransferFunctionModel[{{{2*(1 + b - a*s)}}, 2*(1 + s/2 + s^2)}, s], <|"ParameterValues" -> {{a, b} -> Circle[{1, 1}, 0.2]}|>]Properties (2)
Estimate an output in a model by sampling a parameter value:
model = TransferFunctionModel[{{{2*(1 - a*s)}}, 2*(1 + s/2 + s^2)}, s];spec = <|"Outputs" -> Subscript[, 1], "ParameterValues" -> {a -> NormalDistribution[1, 0.1]}, "Inputs" -> {1 -> UnitStep}|>;Create a SystemModelSurrogate:
sur = SystemModelSurrogateTrain[model, spec]Retrieve the parametric function:
sur["ParametricFunction"]sur["Net"]Create a SystemModel:
sur["SystemModel"]Extract the root mean squared error plot:
sur["RMSEPlot"]Estimate an output in a model by sampling a parameter value:
model = TransferFunctionModel[{{{2*(1 - a*s)}}, 2*(1 + s/2 + s^2)}, s];spec = <|"Outputs" -> Subscript[, 1], "ParameterValues" -> {a -> NormalDistribution[1, 0.1]}, "Inputs" -> {1 -> UnitStep}|>;Retrieve the parametric function:
SystemModelSurrogateTrain[model, spec, "ParametricFunction"]net = SystemModelSurrogateTrain[model, spec, "Net"]ListLinePlot[net[{1}, WorkingPrecision -> "Real64"], PlotRange -> All]Options (6)
Method (1)
Set a custom simulation method with Method:
surrogate = SystemModelSurrogateTrain[[image], <|"Outputs" -> "R2.p.v", "ParameterValues" -> {"l1" -> CenteredInterval[1.5, 0.1]}|>, Method -> {Automatic, "InterpolationPoints" -> 50}]Extract the parametric function and plot it:
surrogate["ParametricFunction"][1.5]//ListPlotNormFunction (1)
Use Norm as loss function:
model = TransferFunctionModel[{{{2*(1 - a*s)}}, 2*(1 + s/2 + s^2)}, s];spec = <|"Outputs" -> Subscript[, 1], "ParameterValues" -> {a -> NormalDistribution[1, 0.1]}, "Inputs" -> {1 -> UnitStep}|>;SystemModelSurrogateTrain[model, spec, "MeanLoss"]SystemModelSurrogateTrain[model, spec, "MeanLoss", NormFunction -> (Norm[#, 1]&)]ProgressReporting (1)
Control progress reporting with ProgressReporting:
SystemModelSurrogateTrain[[image], <|"Outputs" -> "R2.p.v", "SimulationCount" -> 20, "ParameterValues" -> {"l1" -> CenteredInterval[1.5, 0.1]}|>, ProgressReporting -> False]SamplingPeriod (1)
Validate a requirement with uncertainty generated when an ARIMAProcess is used for an input:
unc = <|"Inputs" -> {"T" -> ARIMAProcess[{-.01}, 1, {.01}, 10 ^ -6]}, "ParameterValues" -> {"syse.sys.ms" -> CenteredInterval[0.05, 0.01]}|>;Specify a simulation interval and a number of simulations:
sim = <|"Outputs" -> "syse.sys.rs", "SimulationInterval" -> {0, 10}, "SimulationCount" -> 50|>;surrogate = SystemModelSurrogateTrain[[image], Join[sim, unc], SamplingPeriod -> 5]Extract the parametric function and plot it:
surrogate["ParametricFunction"][1.5]//ListPlot//QuietValidationSet (2)
Use 20% of the data to validate:
model = TransferFunctionModel[{{{2*(1 - a*s)}}, 2*(1 + s/2 + s^2)}, s];spec = <|"Outputs" -> Subscript[, 1], "ParameterValues" -> {a -> NormalDistribution[1, 0.1]}, "Inputs" -> {1 -> UnitStep}|>;SystemModelSurrogateTrain[model, spec, "RMSEPlot"]Use 1% of the data to validate:
SystemModelSurrogateTrain[model, spec, "RMSEPlot", ValidationSet -> Scaled[0.01]]Use 5-fold Monte Carlo cross-validation:
model = TransferFunctionModel[{{{2*(1 - a*s)}}, 2*(1 + s/2 + s^2)}, s];spec = <|"Outputs" -> Subscript[, 1], "ParameterValues" -> {a -> NormalDistribution[1, 0.1]}, "Inputs" -> {1 -> UnitStep}|>;surrogate = SystemModelSurrogateTrain[model, spec, ValidationSet -> {5, Scaled[0.2]}]The best-performing model is picked:
surrogate["MeanLosses"]surrogate["MeanLoss"]Applications (5)
Optimization in Automotive Transportation (1)
Maximize the energy output while keeping the average temperature close to the required value in a simple model of an electric vehicle:
model = \!\(\*GraphicsBox[«8»]\);Select temperature and power as outputs:
simulation = <|"Outputs" -> {"T", "sensor.power"}|>;Choose the resistance in the battery as the parameter for the surrogate and an interval as sampling region:
uncertainty = <|"ParameterValues" -> {"cellData.Ri" -> CenteredInterval[7, 0.2]}|>;Compute the surrogate parametric function:
{tempFun, powerFun} = SystemModelSurrogateTrain[model, Join[simulation, uncertainty], "ParametricFunction"]Compute the energy output from the power as a function of the resistance:
energy[r_ ? NumericQ] := NIntegrate[powerFun[r][t], {t, 0, 3600}, PrecisionGoal -> 3];ListPlot[Table[{r, energy[r]}, {r, 6.8, 7.2, 0.01}], PlotRange -> All]Compute the average temperature in the battery as a function of the resistance:
tempAvg[r_ ? NumericQ] := NIntegrate[tempFun[r][t], {t, 0, 3600}, PrecisionGoal -> 3] / 3600;ListPlot[Table[{r, tempAvg[r]}, {r, 6.8, 7.2, 0.01}], PlotRange -> All]Compute two reward functions, one from the energy output and another that discourages deviations from the required battery temperature of 299.8 K:
energyReward[r_ ? NumericQ] := (energy[r] - energy[7.2]/energy[6.8] - energy[7.2]);tempAvgReward[r_ ? NumericQ] := -((tempAvg[r] - 299.8)^2/(tempAvg[6.8] - 299.8)^2);Explore the rewards for different values of the resistance:
rewards = Table[{energyReward[r], tempAvgReward[r]}, {r, 6.8, 7.2, 0.001}];Find some maxima in this sample using a scalarization parameter γ:
maxPoints = DeleteDuplicates[Table[First[MaximalBy[rewards, #[[1]] + γ#[[2]]&]], {γ, 0.01, 2.40, 0.01}]];Plot the rewards with this subset of the Pareto front to see the tradeoff between the two targets:
ListPlot[{rewards, maxPoints}, ...]Find the parameter that maximizes the reward for a specific value of γ:
γreward[γ_ ? NumericQ, r_ ? NumericQ] := energyReward[r] + γ tempAvgReward[r];max = FindMaximum[γreward[1.2, r], {r, 7.0, 6.8, 7.2}, MaxIterations -> 20]//QuietPlot the temperature and power in the model with the optimal value:
sim = SystemModelSimulate[model, <|"ParameterValues" -> {"cellData.Ri" -> max[[2, 1, 2]]}|>]SystemModelPlot[sim, "T"]SystemModelPlot[sim, "sensor.power"]Optimization in Space Engineering (1)
Use a surrogate of a model of a satellite launch to minimize the oscillations around the final altitude:
model = \!\(\*GraphicsBox[«8»]\);Choose the gain in the controller as the parameter for the surrogate and an interval as sampling region:
uncertainty = <|"ParameterValues" -> {"forwardController_k" -> Interval[{0.01, 1}]}|>;Choose the height as output and set a simulation interval:
simulation = <|"Outputs" -> "distance.distance", "SimulationInterval" -> {0, 20000}, "InterpolationPoints" -> 1000|>;Compute the surrogate parametric function:
heightFun = SystemModelSurrogateTrain[model, Join[uncertainty, simulation], "ParametricFunction"]Estimate the average final height as a function of the controller gain:
finalHeight[k_ ? NumericQ] := NIntegrate[heightFun[k][t], {t, 15000, 20000}, PrecisionGoal -> 3] / 5000;Get a measure of the deviations from the final height as a function of the controller gain:
deviation[k_ ? NumericQ] := NIntegrate[Abs[heightFun[k][t] - finalHeight[k]], {t, 15000, 20000}, PrecisionGoal -> 3];Explore the deviations from the final height in the parameter space:
deviations = Table[{k, deviation[k]}, {k, 0.01, 1, 0.01}];ListPlot[deviations, PlotRange -> All]Find the parameter that minimizes the deviations:
min = FindMinimum[deviation[k], {k, MinimalBy[deviations, Last][[1, 1]], 0.01, 1}, MaxIterations -> 20]//QuietPlot the satellite height in the model with the optimal value:
SystemModelPlot[model, "distance.distance", 20000, <|"ParameterValues" -> {"forwardController_k" -> min[[2, 1, 2]]}|>, PlotRange -> All]Optimization in Heating Systems (1)
Minimize overshoot in the temperature of a pipe when heat flow switches directions in a heating system while keeping its cost low:
model = \!\(\*GraphicsBox[«8»]\);Select temperature and specify the simulation interval:
simulation = <|"Outputs" -> "pipe9.mediums[1].T", "SimulationInterval" -> 100|>;Choose the diameter of a pipe as the parameter for the surrogate and an interval as sampling region:
uncertainty = <|"ParameterValues" -> {"pipe8.diameter" -> Interval[{0.012, 0.070}]}|>;Compute the surrogate parametric function:
pipeT = SystemModelSurrogateTrain[model, Join[simulation, uncertainty], "ParametricFunction"]Compute the overshoot in the temperature as a function of the pipe diameter:
overshoot[d_ ? NumericQ] := Quiet[Max[0, (First[FindMaximum[pipeT[d][t], {t, 60, 50, 75}, MaxIterations -> 20]] - pipeT[d][100]) / (pipeT[d][100] - pipeT[d][50])]];Explore the overshoots in the parameter space:
Table[{d, overshoot[d]}, {d, 0.012, 0.070, 0.0005}]//ListPlotCompute a second loss function that discourages manufacture costs proportional to the square of the pipe diameter:
cost[d_ ? NumericQ] := d^2;Explore losses for different values of the diameter:
losses = Table[{overshoot[d], cost[d]}, {d, 0.012, 0.070, 0.0005}];Find some minima in this sample using a scalarization parameter γ:
minPoints = DeleteDuplicates[Table[First[MinimalBy[losses, #[[1]] + γ#[[2]]&]], {γ, 0, 30, 5}]];Plot the losses with this subset of the Pareto front to see the tradeoff between the two targets:
ListPlot[{losses, minPoints}, ...]Find the parameter that minimizes the loss for a specific value of γ:
loss[γ_ ? NumericQ, d_ ? NumericQ] := overshoot[d] + γ cost[d];min = FindMinimum[loss[10, d], {d, 0.06, 0.012, 0.070}, MaxIterations -> 20]//QuietSimulate and plot the temperature in the model with the optimal value:
sim = SystemModelSimulate[model, {"pipe9.mediums[1].T"}, {0, 100}, <|"ParameterValues" -> {"pipe8.diameter" -> min[[2, 1, 2]]}|>]SystemModelPlot[sim, {"pipe9.mediums[1].T"}, PlotRange -> All]Compute the maximum overshoot when heat flow switches directions:
SystemModelMeasurements[<|"Model" -> sim, "Outputs" -> "pipe9.mediums[1].T", "SimulationInterval" -> {50, 100}|>, "MaxOvershootPercent"]Optimization in Robotics (1)
Minimize the overshoot and the target angle error in a time-constrained motion of an industrial robot carrying a load of 300 kg:
model = SystemModel[\!\(\*GraphicsBox[«8»]\), <|...|>];Select the angle and specify the simulation interval:
simulation = <|"Outputs" -> "mechanics.r1.angle", "SimulationInterval" -> 1.856, "InterpolationPoints" -> 500|>;Choose the gain in a controller as the parameter for the surrogate and an interval as sampling region:
uncertainty = <|"ParameterValues" -> {"kp1" -> Interval[{1, 30}]}|>;Compute the surrogate parametric function:
angle = SystemModelSurrogateTrain[model, Join[simulation, uncertainty], "ParametricFunction"]Compute the overshoot in the angle as a function of the controller gain:
overshoot[k_ ? NumericQ] := Quiet[Max[0, (First[NMaximize[{angle[k][t], 1 ≤ t ≤ 1.856}, t, MaxIterations -> 20]] - angle[k][1.856]) / (angle[k][1.856] - angle[k][0])]];Explore the overshoots in the parameter space:
Table[{k, overshoot[k]}, {k, 1, 30}]//ListPlotEstimate the average final angle as a function of the controller gain:
finalAngle[k_ ? NumericQ] := NIntegrate[angle[k][t], {t, 1.5, 1.856}, PrecisionGoal -> 3] / (1.856 - 1.5);Compute a second loss that discourages deviations from the final target angle of
rad:
angleError[k_ ? NumericQ] := Abs[finalAngle[k] - π / 3];Explore losses for different values of the gain:
losses = Table[{overshoot[k], angleError[k]}, {k, 1, 30, 0.1}];Find some minima in this sample using a scalarization parameter γ:
minPoints = DeleteDuplicates[Table[First[MinimalBy[losses, #[[1]] + γ#[[2]]&]], {γ, 0, 30, 0.01}]];Plot the losses with this subset of the Pareto front to see the tradeoff between the two targets:
ListPlot[{losses, minPoints}, ...]Find the parameter that minimizes the loss for a specific value of γ:
loss[γ_ ? NumericQ, k_ ? NumericQ] := overshoot[k] + γ angleError[k];min = FindMinimum[loss[0.1, k], {k, 5, 1, 30}, MaxIterations -> 20]//QuietSimulate and plot the angle in the model with the optimal value:
sim = SystemModelSimulate[model, {"mechanics.r1.angle"}, {0, 1.856}, <|"ParameterValues" -> {"kp1" -> min[[2, 1, 2]]}|>]SystemModelPlot[sim, {"mechanics.r1.angle"}, PlotRange -> All]Compute the maximum overshoot:
SystemModelMeasurements[<|"Model" -> sim, "Outputs" -> "mechanics.r1.angle"|>, "MaxOvershootPercent"]Calibration of an Orbital Maneuver (1)
Calibrate parameters in a model of an orbiting spacecraft to perform a Hohmann transfer using minimal fuel. A Hohmann transfer uses two engine burns to move a spacecraft from one circular trajectory to a new one. Start by creating a model that produces the boosts:
maneuverBoost = CreateSystemModel["ManeuverBoost", {y[t] == Piecewise[{{f1, t < tp}, {f2, tn + tp < t < tn + 2tp}}, 0]}, t, ...]Plot the magnitudes of the boosts:
SystemModelPlot[maneuverBoost, y, 4250]Connect the maneuver boosts to a model of a spacecraft in a circular trajectory:
maneuverComponents = {"orbit"∈[image], "zero"∈[image], "boost"∈maneuverBoost};maneuverConnections = {"orbit.fr""zero.y", "orbit.fphi""boost.y"};maneuverModel = ConnectSystemModelComponents["ManeuverModel", maneuverComponents, maneuverConnections, IconizedObject[«model settings»]]Without calibration, the boosts just break the circular trajectory of the spacecraft:
SystemModelPlot[maneuverModel]Plot the distance to the center of force to see it changing in time:
SystemModelPlot[maneuverModel, "orbit.r"]Generate artificial data for a change in distance that roughly approximates a change from one fixed radius to another:
data = Table[{t, Piecewise[{{0.381 + (0.65 - 0.381) t / 4320, t < 4320}}, 0.65]}, {t, 0, 36000, 36000 / 1500}];
dataPlot = ListPlot[data, PlotStyle -> StandardGreen, Rule[...]]Select orbit radius as the output of a surrogate model:
simulation = <|"Outputs" -> "orbit.r"|>;Choose the magnitude of the boosts as the parameters for the surrogate and intervals as sampling region:
uncertainty = <|"ParameterValues" -> {"boost.f1" -> Interval[{80, 120}], "boost.f2" -> Interval[{80, 120}]}|>;Compute the surrogate parametric function:
radius = SystemModelSurrogateTrain[maneuverModel, Join[simulation, uncertainty], "ParametricFunction"]Compute a loss function from the data and surrogate output:
residualsNorm[f1_ ? NumericQ, f2_ ? NumericQ] := Norm[data[[All, 2]] - radius[f1, f2][data[[All, 1]]]];Compute a second loss function that discourages fuel consumption proportional to the squared magnitude of the boosts:
fuel[f1_ ? NumericQ, f2_ ? NumericQ] := f1^2 + f2^2;Explore losses for different values of the boosts:
losses = Flatten[Table[{residualsNorm[f1, f2], fuel[f1, f2]}, {f1, 90, 120}, {f2, 80, 110}], 1];Find some minima in this sample using a scalarization parameter γ:
minPoints = DeleteDuplicates[Table[First[MinimalBy[losses, #[[1]] + γ#[[2]]&]], {γ, 0, 3.×10^-4, 5.×10^-5}]];Plot the losses with this subset of the Pareto front to see the tradeoff between the two targets:
ListPlot[{losses, minPoints}, ...]Find the parameters that minimize the loss for a specific value of γ:
loss[γ_ ? NumericQ, f1_ ? NumericQ, f2_ ? NumericQ] := residualsNorm[f1, f2] + γ fuel[f1, f2];FindMinimum[loss[5.×10^-5, f1, f2], {{f1, 100, 90, 120}, {f2, 100, 80, 110}}, MaxIterations -> 20]//QuietAlternatively, calibrate the original model using Tikhonov regularization. This adds a term proportional to the squared magnitude of the boosts to the loss function, equivalent to the fuel consumption cost previously considered:
csmodel = SystemModelCalibrate[<|"orbit.r" -> data|>, {maneuverModel, 90 < "boost.f1" < 120, 80 < "boost.f2" < 110}, {{"boost.f1", 100}, {"boost.f2", 100}},
"CalibratedSystemModel", FitRegularization -> {"Tikhonov", 5.×10^-5}, MaxIterations -> 20]//QuietThe greater the regularization effect, the larger the deviation of the fit from the data:
Show[SystemModelPlot[csmodel["CalibratedSimulationData"], "orbit.r", ...], dataPlot, PlotRange -> All]See the trajectory of the Hohmann transfer:
SystemModelPlot[csmodel["CalibratedSimulationData"]]Tech Notes
Related Guides
Related Links
History
Text
Wolfram Research (2026), SystemModelSurrogateTrain, Wolfram Language function, https://reference.wolfram.com/language/ref/SystemModelSurrogateTrain.html.
CMS
Wolfram Language. 2026. "SystemModelSurrogateTrain." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SystemModelSurrogateTrain.html.
APA
Wolfram Language. (2026). SystemModelSurrogateTrain. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SystemModelSurrogateTrain.html
BibTeX
@misc{reference.wolfram_2026_systemmodelsurrogatetrain, author="Wolfram Research", title="{SystemModelSurrogateTrain}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/SystemModelSurrogateTrain.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_systemmodelsurrogatetrain, organization={Wolfram Research}, title={SystemModelSurrogateTrain}, year={2026}, url={https://reference.wolfram.com/language/ref/SystemModelSurrogateTrain.html}, note=[Accessed: 13-June-2026]}