diff --git a/docs/src/model_creation/dsl_advanced.md b/docs/src/model_creation/dsl_advanced.md index 3aeb468132..83e7ba9d2d 100644 --- a/docs/src/model_creation/dsl_advanced.md +++ b/docs/src/model_creation/dsl_advanced.md @@ -159,6 +159,33 @@ plot(sol) ``` Please note that `X₀` is still a parameter of the system, and as such its value must still be designated to simulate the model (even if it is not actually used). +### [Accessing species and parameter names](@id species_and_parameter_names) +Sometimes you may need to access the name for a part of a model as a `Symbol` (which you could then convert to a `String`). +This can be done with `ModelingToolkit.getname`. + +```@example species_and_parameter_names +rn = @reaction_network begin + @species X(t) + @parameters k + k, X --> 0 +end +``` + +```@example species_and_parameter_names +rn.X + +ModelingToolkit.getname(rn.X) + +rn.k + +ModelingToolkit.getname(rn.k) +``` + +For parameters you can also use `nameof` +```@example species_and_parameter_names +nameof(rn.k) +``` + ### [Designating metadata for species and parameters](@id dsl_advanced_options_species_and_parameters_metadata) Catalyst permits the user to define *metadata* for species and parameters. This permits the user to assign additional information to these, which can be used for a variety of purposes. Some Catalyst features depend on using metadata (with each such case describing specifically how this is done). Here we will introduce how to set metadata, and describe some common metadata types.