Simulation Output
If you run a simulation
data = simulate(my_model, T = T)the object data will contain all relevant simulation output as a NamedTuple.
Fields
The output object mimics the structure of the respective model and has the following fields.
Model information:
model_idthe integer ID assigned to the modelΔtthe sampling time of the model, ornothingfor pure continuous-time models
Continuous-time output:
tcsvector of time values at which the continuous-time state was recordedxcsstate trajectory produced byfc.nothingif the model has no continuous-time dynamics.ycsoutput trajectory produced bygc.nothingif the model has no continuous-time output function.
Discrete-time output:
tdsvector of time values at which the discrete-time state was recordedxdsstate trajectory produced byfd.nothingif the model has no discrete-time dynamics.ydsoutput trajectory produced bygd.nothingif the model has no discrete-time output function.wdsrandom draw trajectory produced bywd.nothingif the model has no random draw function.
Submodels:
modelscontains the outputs of all submodels, mirroring the structure of themodelsfield in the original model definition.
Time-Series Format
If a state or output is an AbstractVector of numbers (the common case), SimpleSim.jl stacks all time steps into a matrix after the simulation finishes. Each row corresponds to one time step and each column corresponds to one state or output dimension.
data.tcs # Vector of length N
data.xcs # Matrix of size N × nx
data.ycs # Matrix of size N × nyIf the state or output is a scalar or a non-numeric type it is returned as a plain vector with one entry per time step.
Accessing Submodel Output
Output of submodels can be accessed via the models field. For example, if the top-level model has a continuous-time submodel called my_submodel, then its output can be accessed via
data.models.my_submodel.ycs