Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SouthEndMusic committed Jul 14, 2023
1 parent 122f31b commit 9028332
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions core/src/create.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@ function parse_static(
# Index in the output vectors for this node ID
node_idx = 1

is_controllable = hasfield(static_type, :control_state)

for row in static
if node_id != row.node_id
node_idx += 1
node_id = row.node_id
end

# If this row is a control state, add it to the control mapping
if !ismissing(row.control_state)
if is_controllable && !ismissing(row.control_state)
control_values = NamedTuple{columnnames_variables}(values(row)[mask])
control_mapping[(row.node_id, row.control_state)] = control_values
end
Expand Down Expand Up @@ -169,15 +171,19 @@ end
function LevelBoundary(db::DB, config::Config)::LevelBoundary
static = load_structvector(db, config, LevelBoundaryStaticV1)
defaults = (; active = true)
static_parsed = parse_static(static, db, "Levelboundary", defaults)
static_parsed = parse_static(static, db, "LevelBoundary", defaults)
return LevelBoundary(static_parsed.node_id, static_parsed.active, static_parsed.level)
end

function FlowBoundary(db::DB, config::Config)::FlowBoundary
static = load_structvector(db, config, FlowBoundaryStaticV1)
defaults = (; active = true)
static_parsed = parse_static(static, db, "FlowBoundary", defaults)
return FlowBoundary(static_parsed.node_id, static_parse.active, static_parsed.flow_rate)
return FlowBoundary(
static_parsed.node_id,
static_parsed.active,
static_parsed.flow_rate,
)
end

function Pump(db::DB, config::Config)::Pump
Expand Down

0 comments on commit 9028332

Please sign in to comment.