-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update decision state for OnVariable and ActivePowerVariable #1232
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -309,7 +309,6 @@ function update_decision_state!( | |||||||||||||
event_ocurrence_data = | ||||||||||||||
get_decision_state_data(state, AvailableStatusChangeParameter(), T) | ||||||||||||||
state_data = get_decision_state_data(state, key) | ||||||||||||||
@warn "State data for AvailableStatusParameter decision before any updates: $state_data" | ||||||||||||||
#column_names = get_column_names(key, state_data)[1] | ||||||||||||||
model_resolution = get_resolution(model_params) | ||||||||||||||
state_resolution = get_data_resolution(state_data) | ||||||||||||||
|
@@ -343,18 +342,6 @@ function update_decision_state!( | |||||||||||||
end | ||||||||||||||
end | ||||||||||||||
end | ||||||||||||||
#= offset = resolution_ratio - 1 | ||||||||||||||
result_time_index = axes(store_data)[2] | ||||||||||||||
set_update_timestamp!(state_data, simulation_time) | ||||||||||||||
for t in result_time_index | ||||||||||||||
state_range = state_data_index:(state_data_index + offset) | ||||||||||||||
for name in column_names, i in state_range | ||||||||||||||
state_data.values[name, i] = store_data[name, t] | ||||||||||||||
end | ||||||||||||||
set_last_recorded_row!(state_data, state_range[end]) | ||||||||||||||
state_data_index += resolution_ratio | ||||||||||||||
end =# | ||||||||||||||
@warn "AvailableStatusParameter decision state after update: $state_data" | ||||||||||||||
|
||||||||||||||
return | ||||||||||||||
|
@@ -368,9 +355,11 @@ function update_decision_state!( | |||||||||||||
simulation_time::Dates.DateTime, | ||||||||||||||
model_params::ModelStoreParams, | ||||||||||||||
) where {T <: VariableType, U <: PSY.Component} | ||||||||||||||
event_ocurrence_data = get_decision_state_data(state, AvailableStatusParameter(), U) | ||||||||||||||
@error "UPDATE DECISION STATE $key" | ||||||||||||||
event_ocurrence_data = get_decision_state_data(state, AvailableStatusChangeParameter(), U) | ||||||||||||||
event_status_data = get_decision_state_data(state, AvailableStatusParameter(), U) | ||||||||||||||
|
||||||||||||||
state_data = get_decision_state_data(state, key) | ||||||||||||||
column_names = get_column_names(key, state_data)[1] | ||||||||||||||
model_resolution = get_resolution(model_params) | ||||||||||||||
state_resolution = get_data_resolution(state_data) | ||||||||||||||
resolution_ratio = model_resolution ÷ state_resolution | ||||||||||||||
|
@@ -388,20 +377,23 @@ function update_decision_state!( | |||||||||||||
else | ||||||||||||||
state_data_index = find_timestamp_index(state_timestamps, simulation_time) | ||||||||||||||
end | ||||||||||||||
#= | ||||||||||||||
offset = resolution_ratio - 1 | ||||||||||||||
result_time_index = axes(store_data)[2] | ||||||||||||||
set_update_timestamp!(state_data, simulation_time) | ||||||||||||||
for t in result_time_index | ||||||||||||||
state_range = state_data_index:(state_data_index + offset) | ||||||||||||||
for name in column_names, i in state_range | ||||||||||||||
state_data.values[name, i] = store_data[name, t] | ||||||||||||||
end | ||||||||||||||
set_last_recorded_row!(state_data, state_range[end]) | ||||||||||||||
state_data_index += resolution_ratio | ||||||||||||||
for name in column_names | ||||||||||||||
if event_ocurrence_data.values[name, state_data_index] == 1.0 | ||||||||||||||
outage_index = state_data_index + 1 #outage occurs at the following timestep | ||||||||||||||
while true | ||||||||||||||
if event_status_data.values[name, outage_index] == 0.0 | ||||||||||||||
state_data.values[name, outage_index] = 0.0 | ||||||||||||||
Comment on lines
+384
to
+385
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||||||||
@info "forcing $key to zero at index $outage_index because status was zero for $name" | ||||||||||||||
else | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||||||||
break | ||||||||||||||
end | ||||||||||||||
if outage_index == length(state_data.values[name, :]) | ||||||||||||||
Comment on lines
+389
to
+390
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||||||||
break | ||||||||||||||
end | ||||||||||||||
outage_index += 1 | ||||||||||||||
end | ||||||||||||||
Comment on lines
+392
to
+394
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||||||||
end | ||||||||||||||
=# | ||||||||||||||
end | ||||||||||||||
return | ||||||||||||||
end | ||||||||||||||
|
||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶