Skip to content

Commit

Permalink
Merge pull request #844 from mimiframework/unit-checking
Browse files Browse the repository at this point in the history
Only verify connection units if both are provided
  • Loading branch information
lrennels authored Sep 28, 2021
2 parents e1ff9c5 + ee28448 commit 666b6ba
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/core/connections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,14 @@ Try calling:
backup_param_name = nothing
end

# Check the units, if provided
if ! ignoreunits && ! verify_units(variable_unit(src_comp_def, src_var_name),
parameter_unit(dst_comp_def, dst_par_name))
error("Units of $src_comp_path:$src_var_name do not match $dst_comp_path:$dst_par_name.")
# Check the units, if both are provided
var_unit = variable_unit(src_comp_def, src_var_name)
par_unit = parameter_unit(dst_comp_def, dst_par_name)

if !ignoreunits && var_unit !== "" && par_unit !== ""
if ! verify_units(var_unit, par_unit)
error("Units of $src_comp_path:$src_var_name ($var_unit) do not match $dst_comp_path:$dst_par_name ($par_unit).")
end
end

conn = InternalParameterConnection(src_comp_path, src_var_name, dst_comp_path, dst_par_name,
Expand Down

0 comments on commit 666b6ba

Please sign in to comment.