-
Notifications
You must be signed in to change notification settings - Fork 3
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
Major addon rework #20
Conversation
@daschw (just pinging for after-the-dust-settles, to then go over that together) |
Awesome! |
Small update on the internal syntax, after most of it is cleaned up and (at least for the major parts) working: Templates now properly support dict-valued parameters ...... which allows configurations like this: my_component:
type: InvestableConversionTechnology
# other stuff ...
cost:
invest: 1000.0
om:
var: 0.5
fix:
rel: 0.05
lifetime: 25
rate: 0.07 Getting parameters from within a template ...... now works as follows (supporting getting/setting and also accessing time series data within the model): p_min = this.get("p_min", 0) # automatic support for defaults
p_max = this.get("p_max")
this.set("_cost_om_var_total", cost_om_var) and since the "wrapper" for these templates ( this.set("_ub_single", "100 + $(this.name).invest:value") Creating first-class math. model items ...... like expressions, etc., follows the same syntax as everywhere else, allowing the following directly in this.exp.flow = this.connection_pos.var.flow - this.connection_neg.var.flow where Automatic nested tagging ...... of asset:
type: Bar will be (internally) flattened all the way down to a
|
…es in 1.11 (will be reverted as soon as #20 is merged)
addons now properly check if they are already loaded (force_reload is now a general argument to all external model creation functions) addons are found in IESopt, but also as modules manually loaded into Main
…ing of a CoreComponent this is a workaround, and should be reverted as soon as possible, since REPL is not an actually necessary dependency
…model components" that are templates (and no real component)
…for Virtuals for now) small fix in how addons are called before the full refactoring
…to in during `finalize`, by calling `access("self")`
…with" (e.g., Dicts)
Note: After 7105938 the stack overflow in tests (which only happened in CI) magically vanished... Merging this since it passes everything locally and that change was disabling suppression in test sets. Which I hope indicates some weird bug somewhere else (and not in the actual examples). |
Alrighty... this is a first draft of the addon rework that we discussed, to be able to talk a bit about the specifics that we may want to change, before everything is set in stone.
Breaking changes for the outside world
REPL
is now a dependency)IESopt
, loaded inMain
force_reload = false
togenerate!
(or `run!).component = component(model, str)
was just... weird (and error prone)IESopt.get_components(model, tagged="foo")
; passing ["foo", "bar"] only returns components that have both tags; types (like "Unit" or "CHP") are automatically setShowcase
Assuming
using IESopt
was run.Working with
Virtual
sModifying a Virtual from within a template
Putting this into the
finalize
part of a templateallows doing
Within an addon
All of that allows also stuff like
where
chp
is the virtual. All of that can after optimizing be accessed.