4 allow for conditional events#17
Conversation
…PDL effects propagate only when their trigger condition is met fix(tick_writer): correct enabled flag refactor(agents): remove dead capacity_factor parameter
| """ | ||
| arg_scale = self.model.environment.get_shock_scale("farm_capacity_arg") | ||
| farm_capacity = 1.0 + arg_scale * (self.scenario.farm_capacity_arg - 1.0) | ||
| farm_capacity = self.model.environment.get_effective_value("farm_capacity_arg") |
There was a problem hiding this comment.
why is this call different to the other ones?
Above env.get_effective_value is called, here it's self.model.environment.get_effective_value. What am I missing?
|
|
||
|
|
||
| def _move_split(self, upstream_list, share: float, capacity_factor: float = 1.0, shock_param: str = "", exclude_arg=False, exclude_usa=False): | ||
| def _move_split(self, upstream_list, share: float, param_name: str = "", exclude_arg=False, exclude_usa=False): |
There was a problem hiding this comment.
explicit excludes need to be removed in the future
| # ------------------------------------------------------------------ | ||
|
|
||
| def _move(self, upstream, capacity_factor: float = 1.0, shock_param: str = ""): | ||
| def _move(self, upstream, param_name: str = ""): |
There was a problem hiding this comment.
param_name is too vague imo.
Should be a more descriptive name
|
|
||
| # drought severity: use racker value if available | ||
| bra_scale = self.shock_scales.get("farm_capacity_bra", 0.0) | ||
| bra_value = self.get_effective_value("farm_capacity_bra") |
There was a problem hiding this comment.
explicit bra values should be made dynamic in the future
|
|
||
|
|
||
| # --- Aggregation constants --- | ||
| _CAPACITY_PARAMS = { |
| edef = self._events.get(eid) | ||
| if edef is None: | ||
| continue | ||
| if self._evaluate_condition(edef.condition, day): |
There was a problem hiding this comment.
isn't it possible that a conditional event activates on the same simulation step as it's condition activated with this implementation?
| if mapped is not None: | ||
| pct = _parse_percent(str(raw)) | ||
| param = mapped | ||
| value = round(1.0 + pct / 100.0, 6) |
There was a problem hiding this comment.
why the 1.0 + pct? doesn't this just add 1 % to all values?
feat(events): finalize conditional event resolution + tests