OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm::controls::ControlEngine Class Reference

#include <Controls.hpp>

Collaboration diagram for openswmm::controls::ControlEngine:

Classes

struct  PremiseSoA
 Pre-sorted premise index for batch evaluation. More...
 

Public Member Functions

void init (const std::vector< Rule > &rules)
 
int evaluate (SimulationContext &ctx, double current_time, double dt)
 Evaluate all control rules and set link target settings.
 
int parseRuleText (const std::string &text, SimulationContext &ctx)
 
void addNamedVariable (const std::string &name, ConditionVar var, int idx)
 
int addExpression (const std::string &name, const std::string &formula)
 
std::vector< Rule > & rules ()
 
int lastActionCount () const
 Number of actions taken in the last evaluate() call.
 
void resetRuleStep ()
 
void buildPremiseSoA ()
 Build SoA index from rules. Called once at init().
 
void batchEvaluateGroup (PremiseSoA &group, const SimulationContext &ctx, double current_time, double half_step)
 Batch evaluate all premises of one variable type.
 

Member Function Documentation

◆ addExpression()

int openswmm::controls::ControlEngine::addExpression ( const std::string &  name,
const std::string &  formula 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addNamedVariable()

void openswmm::controls::ControlEngine::addNamedVariable ( const std::string &  name,
ConditionVar  var,
int  idx 
)
Here is the caller graph for this function:

◆ batchEvaluateGroup()

void openswmm::controls::ControlEngine::batchEvaluateGroup ( PremiseSoA group,
const SimulationContext ctx,
double  current_time,
double  half_step 
)

Batch evaluate all premises of one variable type.

Here is the caller graph for this function:

◆ buildPremiseSoA()

void openswmm::controls::ControlEngine::buildPremiseSoA ( )

Build SoA index from rules. Called once at init().

Here is the caller graph for this function:

◆ evaluate()

int openswmm::controls::ControlEngine::evaluate ( SimulationContext ctx,
double  current_time,
double  dt 
)

Evaluate all control rules and set link target settings.

Implements:

  • Short-circuit AND evaluation
  • Time-aware EQ/NE comparison with half-step tolerance
  • Priority-based action deduplication per link
  • Curve/timeseries/PID modulated control
  • ControlValue tracking for modulated actions
Parameters
ctxSimulation context.
current_timeCurrent simulation time (seconds).
dtRouting timestep (seconds).
Returns
Number of setting changes made.
Here is the call graph for this function:

◆ init()

void openswmm::controls::ControlEngine::init ( const std::vector< Rule > &  rules)
Here is the call graph for this function:

◆ lastActionCount()

int openswmm::controls::ControlEngine::lastActionCount ( ) const
inline

Number of actions taken in the last evaluate() call.

◆ parseRuleText()

int openswmm::controls::ControlEngine::parseRuleText ( const std::string &  text,
SimulationContext ctx 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetRuleStep()

void openswmm::controls::ControlEngine::resetRuleStep ( )
inline

Reset the RULE_STEP timer; called when a new run begins so the first call to evaluate() always runs.

See also
Legacy: routing.c:286-290 (RuleStep gating)

◆ rules()

std::vector< Rule > & openswmm::controls::ControlEngine::rules ( )
inline
Here is the caller graph for this function:

The documentation for this class was generated from the following files: