Exemple #1
0
    def test_pulse(self):
        from pysd.py_backend.functions import pulse

        self.assertEqual(pulse(lambda: 0, 1, 3), 0)

        self.assertEqual(pulse(lambda: 1, 1, 3), 1)

        self.assertEqual(pulse(lambda: 2, 1, 3), 1)

        self.assertEqual(pulse(lambda: 4, 1, 3), 0)

        self.assertEqual(pulse(lambda: 5, 1, 3), 0)
def pulse_if_flood():
    """
    pulse if flood

    1

    component

    PULSE IF gives a value of 1 for one week at year 30
    """
    return functions.pulse(initial_time() + 7, 0.019231)
def importing_infected():
    """
    Real Name: b'Importing Infected'
    Original Eqn: b'N Imported Infections*PULSE(Import Time,TIME STEP)/TIME STEP'
    Units: b'people/day'
    Limits: (None, None)
    Type: component

    b'Import of infections into the region. This is a one-time introduction; \\n    \\t\\tthere is no repeated challenge from an outside reservoir.'
    """
    return n_imported_infections() * functions.pulse(
        __data['time'], import_time(), time_step()) / time_step()
def social_distancing_policy():
    """
    Real Name: b'social distancing policy'
    Original Eqn: b'1-PULSE(social distancing start, FINAL TIME-social distancing start+1)*social distancing effectiveness'
    Units: b'dmnl'
    Limits: (None, None)
    Type: component

    b''
    """
    return 1 - functions.pulse(__data['time'], social_distancing_start(),
                               final_time() - social_distancing_start() +
                               1) * social_distancing_effectiveness()
def self_quarantine_policy():
    """
    Real Name: b'self quarantine policy'
    Original Eqn: b'1-PULSE(self quarantine start, FINAL TIME-self quarantine start+1)*self quarantine effectiveness'
    Units: b'dmnl'
    Limits: (None, None)
    Type: component

    b''
    """
    return 1 - functions.pulse(__data['time'], self_quarantine_start(),
                               final_time() - self_quarantine_start() +
                               1) * self_quarantine_effectiveness()
def production_phase3():
    """
    Real Name: b'production phase3'
    Original Eqn: b'PULSE(production start phase3, FINAL TIME-production start phase3+1)*production volume phase3'
    Units: b'kit/Day'
    Limits: (None, None)
    Type: component

    b''
    """
    return functions.pulse(__data['time'], production_start_phase3(),
                           final_time() - production_start_phase3() +
                           1) * production_volume_phase3()
def production_phase1():
    """
    Real Name: b'production phase1'
    Original Eqn: b'PULSE(production start phase1, production start phase2-production start phase1)*production volume phase1'
    Units: b'kit/Day'
    Limits: (None, None)
    Type: component

    b''
    """
    return functions.pulse(
        __data['time'], production_start_phase1(),
        production_start_phase2() -
        production_start_phase1()) * production_volume_phase1()
Exemple #8
0
def change_in_required_improvement_effort():
    """
    Change in Required Improvement Effort

    Hours/(Year*week)

    component

    The time spent on capability development and improvement increases in 
        proportion to the output shortfall, with a gain determined by the 
        sensitivity of improvement to output.  The increase falls as the time 
        spent improving approaches the maximum workweek.  In addition, the time 
        for improvement can increase exogenously by a certain amount at time zero 
        as a test input (determined by the pulse function).
    """
    return time_spent_improving() * sensitivity_of_improvement_effort_to_output(
    ) * output_shortfall() * (maximum_workweek() - time_spent_improving()) / maximum_workweek() + (
        increase_in_time_spent_improving() / time_step()) * functions.pulse(0, time_step())
Exemple #9
0
def change_in_time_spent_working():
    """
    Change in Time Spent Working

    Hours/week/Year

    component

    The amount of time spent working on average changes in proportion to the 
        output shortfall.  Positive shortfalls lead to an increase in hours per 
        person spent working (vs. improvement and capability development); a 
        negative shortfall (more output than required) leads to a reduction of 
        hours spent working.  The time spent working cannot rise above the maximum 
        workweek, so the rate of increase falls to zero as the time spent working 
        approaches the maximum.  In addition, the time spent working can increase 
        by a fixed amount at time zero (the Increase in Time Spent Working), using 
        the pulse function.
    """
    return time_spent_working() * sensitivity_of_work_effort_to_output() * output_shortfall() * (
        maximum_workweek() - time_spent_working()) / maximum_workweek() + (
            increase_in_time_spent_working() / time_step()) * functions.pulse(0, time_step())