Skip to content

Support for event detection #42

@RemDelaporteMathurin

Description

@RemDelaporteMathurin

Pathsim supports event detection. Each event is defined by an event function, and an action.

We could investigate supporting some pre-made events, for example:

  • When the storage inventory reaches zero, turn the plasma off
  • When the storage inventory reaches some value, turn the plasma on

In the Pathsim model we define these as:

# EVENTS ================================================================================

def func_evt_down(t):
    *_, x = storage()
    return x  

def func_act_down(t):
    fusion_reaction_rate.off()

def func_evt_up(t):
    *_, x = storage()
    return x - startup_inventory

def func_act_up(t):
    fusion_reaction_rate.on()

E1 = ZeroCrossingDown(func_act=func_act_down, func_evt=func_evt_down, tolerance=1e-8)
E2 = ZeroCrossingUp(func_act=func_act_up, func_evt=func_evt_up, tolerance=1e-8)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions