plotRootLoci(modelName, modelParams, simulationOptions, position, useLegend, grid, markerStyle, markerColorMin, markerColorMax)
This function linearizes Modelica model, calculates its eigenvalues and
plots root loci for variants of selected model parameter modelParams[1].parName
.
Optionally, the model will be simulated before linearization.
This is reasonable e.g. if the model is initially not at equilibrium and it
contains nonlinearities.
The end time of the simulation is simulationOptions.t_linearize
.
The linearization will be performed for the states of model at that time.
Therefore, this process can generally be very time-consuming.
On the contrary, if the linearization time simulationOptions.t_linearize = 0
the linearization is performed at once for various parameter values.
This is efficient and sufficient for most cases.
Calling this function with default setup the following root loci plot will be generated.
function plotRootLoci import Simulator = DymolaCommands.SimulatorAPI; import Modelica_LinearSystems2; import Modelica_LinearSystems2.StateSpace; input String modelName = "Modelica.Mechanics.Rotational.Examples.First" "Name of the Modelica model" annotation( Dialog(__Dymola_translatedModel)); input Boolean simulate = false "Linearize model after simulation (time-consuming!), otherwise linearization of all parameter variants at once" annotation( Dialog(__Dymola_compact = false), choices(checkBox = true)); input Modelica_LinearSystems2.WorkInProgress.Internal.ModelParameters modelParams[:] = {Modelica_LinearSystems2.WorkInProgress.Internal.ModelParameters(parName = "Jload", parMin = 1, parMax = 6, nVar = 10)} annotation( Dialog(__Dymola_label = "Model parameters", __Dymola_importDsin(button = "Select model parameter" "Select parameters to be optimized", onlyStart = true, fields(parName = initialName, parValue = initialValue.value, parMin = initialValue.minimum, parMax = initialValue.maximum, parUnit = initialValue.unit)))); input Modelica_LinearSystems2.WorkInProgress.Internal.LinearizationOptions simulationOptions = Modelica_LinearSystems2.WorkInProgress.Internal.LinearizationOptions(method = "Dassl", tolerance = 0.0001) annotation( Dialog(__Dymola_label = "Simulation setup")); input Integer position[4] = {5, 5, 600, 450} "Window Position" annotation( Dialog(group = "Plot settings")); input Boolean useLegend = true "Use legend" annotation( Dialog(group = "Plot settings", __Dymola_compact = true, __Dymola_descriptionLabel = true), choices(checkBox = true)); input Boolean grid = true "Use grid" annotation( Dialog(group = "Plot settings", __Dymola_compact = true, __Dymola_descriptionLabel = true), choices(checkBox = true)); input MarkerStyle markerStyle = MarkerStyle.Square "Style of marker" annotation( Dialog(group = "Plot settings")); input Integer markerColorMin[3] = {0, 0, 255} "Color of marker for minimum parameter value" annotation( Dialog(group = "Plot settings", colorSelector = true)); input Integer markerColorMax[3] = {255, 0, 0} "Color of marker for maximum parameter value" annotation( Dialog(group = "Plot settings", colorSelector = true)); input Boolean deleteResult = false "Delete result files of linearization" annotation( Dialog(__Dymola_compact = false), choices(checkBox = true)); end plotRootLoci;