Skip to content

Commit 666b6ba

Browse files
authored
Merge pull request #844 from mimiframework/unit-checking
Only verify connection units if both are provided
2 parents e1ff9c5 + ee28448 commit 666b6ba

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/core/connections.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,14 @@ Try calling:
313313
backup_param_name = nothing
314314
end
315315

316-
# Check the units, if provided
317-
if ! ignoreunits && ! verify_units(variable_unit(src_comp_def, src_var_name),
318-
parameter_unit(dst_comp_def, dst_par_name))
319-
error("Units of $src_comp_path:$src_var_name do not match $dst_comp_path:$dst_par_name.")
316+
# Check the units, if both are provided
317+
var_unit = variable_unit(src_comp_def, src_var_name)
318+
par_unit = parameter_unit(dst_comp_def, dst_par_name)
319+
320+
if !ignoreunits && var_unit !== "" && par_unit !== ""
321+
if ! verify_units(var_unit, par_unit)
322+
error("Units of $src_comp_path:$src_var_name ($var_unit) do not match $dst_comp_path:$dst_par_name ($par_unit).")
323+
end
320324
end
321325

322326
conn = InternalParameterConnection(src_comp_path, src_var_name, dst_comp_path, dst_par_name,

0 commit comments

Comments
 (0)