From b2cb1033aef864c1ba7aaa2c76fd54cbe5295c2e Mon Sep 17 00:00:00 2001 From: Datseris Date: Wed, 13 Mar 2024 09:50:20 +0000 Subject: [PATCH] restore usage of `t` in the error messages --- docs/src/index.md | 12 ++++++------ src/make.jl | 15 +++++++-------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index adcbba5..876884d 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -111,10 +111,10 @@ telling us exactly which variable is missing, and because of which processes it model = processes_to_mtkmodel(processes[[1, 3]]) ``` ``` -ERROR: ArgumentError: Variable x was introduced in process of variable z(t). -However, a process for x was not provided, -there is no default process for x, and x doesn't have a default value. -Please provide a process for variable x. +ERROR: ArgumentError: Variable x(t) was introduced in process of variable z(t). +However, a process for x(t) was not provided, +there is no default process for x(t), and (t)x doesn't have a default value. +Please provide a process for variable x(t). ``` If instead we "forgot" the ``y`` process, **PBM** will not error, but warn, and make ``y`` equal to a named parameter, since ``y`` has a default value: @@ -129,8 +129,8 @@ parameters(model) and the warning thrown was: ```julia -┌ Warning: Variable y was introduced in process of variable x(t). -│ However, a process for y was not provided, +┌ Warning: Variable y(t) was introduced in process of variable x(t). +│ However, a process for y(t) was not provided, │ and there is no default process for it either. │ Since it has a default value, we make it a parameter by adding a process: │ `ParameterProcess(y)`. diff --git a/src/make.jl b/src/make.jl index 136545a..77b1424 100644 --- a/src/make.jl +++ b/src/make.jl @@ -61,24 +61,23 @@ function processes_to_mtkmodel(_processes, _default = []; append_incomplete_variables!(incomplete, introduced, lhs_vars, def_proc) else def_val = default_value(added_var) # utilize default value (if possible) - varstr = ModelingToolkit.getname(added_var) if !isnothing(def_val) @warn(""" - Variable $(varstr) was introduced in process of variable $(introduced[added_var]). - However, a process for $(varstr) was not provided, + Variable $(added_var) was introduced in process of variable $(introduced[added_var]). + However, a process for $(added_var) was not provided, and there is no default process for it either. Since it has a default value, we make it a parameter by adding a process: - `ParameterProcess($(varstr))`. + `ParameterProcess($(ModelingToolkit.getname(added_var)))`. """) parproc = ParameterProcess(added_var) push!(eqs, lhs(parproc) ~ rhs(parproc)) push!(lhs_vars, added_var) else throw(ArgumentError(""" - Variable $(varstr) was introduced in process of variable $(introduced[added_var]). - However, a process for $(varstr) was not provided, - there is no default process for $(varstr), and $(varstr) doesn't have a default value. - Please provide a process for variable $(varstr). + Variable $(added_var) was introduced in process of variable $(introduced[added_var]). + However, a process for $(added_var) was not provided, + there is no default process for $(added_var), and $(added_var) doesn't have a default value. + Please provide a process for variable $(added_var). """)) end end