Ejemplo n.º 1
0
    def test_step(self):
        from pysd.py_backend.functions import step

        self.assertEqual(step(lambda: 5, 1, 10), 0)

        self.assertEqual(step(lambda: 15, 1, 10), 1)

        self.assertEqual(step(lambda: 10, 1, 10), 1)
Ejemplo n.º 2
0
def selling_price_of_afv():
    """
    Real Name: b'Selling Price of AFV'
    Original Eqn: b'1200-Step(200,12)'
    Units: b'Euros'
    Limits: (None, None)
    Type: component

    b''
    """
    return 1200 - functions.step(200, 12)
Ejemplo n.º 3
0
def travel_range_max():
    """
    Real Name: b'travel range max'
    Original Eqn: b'50+Step(50,100)'
    Units: b'Miles/charge'
    Limits: (None, None)
    Type: component

    b''
    """
    return 50 + functions.step(50, 100)
Ejemplo n.º 4
0
def travel_range_max():
    """
    Real Name: b'travel range max'
    Original Eqn: b'50+Step(50,100)'
    Units: b'Miles/charge'
    Limits: (None, None)
    Type: component

    b''
    """
    return 50 + functions.step(50, 100)
Ejemplo n.º 5
0
def selling_price_of_afv():
    """
    Real Name: b'Selling Price of AFV'
    Original Eqn: b'1200-Step(200,12)'
    Units: b'Euros'
    Limits: (None, None)
    Type: component

    b''
    """
    return 1200 - functions.step(200, 12)
Ejemplo n.º 6
0
def r_customer_orders():
    """
    Real Name: b'R Customer Orders'
    Original Eqn: b'100+1*step(100,10)'
    Units: b''
    Limits: (None, None)
    Type: component

    b''
    """
    return 100 + 1 * functions.step(100, 10)
Ejemplo n.º 7
0
def gpv_65():
    """
    Real Name: b'"GPV 65+"'
    Original Eqn: b'IF THEN ELSE(Extra Demand Flag=1,10+STEP(2,2020),10)'
    Units: b'1/Year'
    Limits: (None, None)
    Type: component

    b''
    """
    return functions.if_then_else(extra_demand_flag() == 1, 10 + functions.step(2, 2020), 10)
Ejemplo n.º 8
0
def r_customer_orders():
    """
    Real Name: b'R Customer Orders'
    Original Eqn: b'100+1*step(100,10)'
    Units: b''
    Limits: (None, None)
    Type: component

    b''
    """
    return 100 + 1 * functions.step(100, 10)
Ejemplo n.º 9
0
def gpv_65():
    """
    Real Name: b'"GPV 65+"'
    Original Eqn: b'IF THEN ELSE(Extra Demand Flag=1,10+STEP(2,2020),10)'
    Units: b'1/Year'
    Limits: (None, None)
    Type: component

    b''
    """
    return functions.if_then_else(extra_demand_flag() == 1,
                                  10 + functions.step(2, 2020), 10)
Ejemplo n.º 10
0
def required_output():
    """
    Required Output

    Units/week

    component

    The required level of output.  Set by the user; begins at the reference 
        value, and can be increased by a certain amount, or follow a linear ramp 
        with a user-determined slope.
    """
    return initial_required_output() * (1 + functions.step(step_in_required_output(), 0)
                                        ) + functions.ramp(ramp_in_required_output(), 0, 6)
Ejemplo n.º 11
0
def authorized_labor():
    """
    Authorized Labor

    People

    component

    Authorized Labor can be increased or decreased by a certain amount at time 
        zero, or follow a linear ramp with slope "Ramp in Labor".
    """
    return np.maximum(0,
                      initial_labor() *
                      (1 + functions.step(fractional_change_in_labor(), time_to_change_labor()) +
                       functions.ramp(ramp_in_labor(), 0, 6)))
Ejemplo n.º 12
0
@cache('run')
def time_step():
    """
    Real Name: b'TIME STEP'
    Original Eqn: b'0.125'
    Units: b'day'
    Limits: (0.0, None)
    Type: constant

    b'The time step for the simulation.'
    """
    return 0.125


_smooth_functionsstep__datatime_potential_isolation_effectiveness_import_time_isolation_reaction_time_functionsstep__datatime_potential_isolation_effectiveness_import_time_3 = functions.Smooth(
    lambda: functions.step(__data['time'], potential_isolation_effectiveness(),
                           import_time()), lambda: isolation_reaction_time(),
    lambda: functions.step(__data['time'], potential_isolation_effectiveness(),
                           import_time()), lambda: 3)

_smooth_1functionsstep__datatime_behavioral_risk_reduction_import_time_behavior_reaction_time_1functionsstep__datatime_behavioral_risk_reduction_import_time_3 = functions.Smooth(
    lambda: 1 - functions.step(__data['time'], behavioral_risk_reduction(),
                               import_time()),
    lambda: behavior_reaction_time(), lambda: 1 - functions.step(
        __data['time'], behavioral_risk_reduction(), import_time()), lambda: 3)

_integ_deaths = functions.Integ(lambda: dying(), lambda: 0)

_integ_exposed = functions.Integ(lambda: infecting() - advancing(), lambda: 0)

_integ_recovered = functions.Integ(lambda: recovering(), lambda: 0)