Esempio n. 1
0
def QUALIN(lookuptype, name):
    common_rule = [{
        'instruction':
        LC('LOWACC21'),
        'rules': (
            # QUAPOS only has values 1 to 11. QUAPOS not in 1, 10, 11 is
            # equivalent to the below rules
            MSCompare('QUAPOS', '1', MSCompare.OP.GT)
            & MSCompare('QUAPOS', '10', MSCompare.OP.LT))
    }]

    if name == 'COALNE':
        return common_rule + [{
            'instruction': LS('SOLD', 1, 'CSTLN'),
            'rules': MSNoRules()
        }]
    else:
        return common_rule + [
            {
                'instruction':
                [LS('SOLD', 3, 'CHMGF'),
                 LS('SOLD', 1, 'CSTLN')],
                'rules': MSCompare('CONRAD', '1')
            },
            {
                # CONRAD missing and CONRAD != 1 both lead here
                'instruction': LS('SOLD', 1, 'CSTLN'),
                'rules': MSNoRules()
            }
        ]
Esempio n. 2
0
def DEPCNT(lookup_type, name):
    return [{
        'rules': (MSCompare('QUAPOS', '1', MSCompare.OP.GT)
                  & MSCompare('QUAPOS', '10', MSCompare.OP.LT)),
        'instruction':
        LS('DASH', 1, 'DEPCN'),
    }, {
        'rules': MSNoRules(),
        'instruction': LS('SOLD', 1, 'DEPCN'),
    }]
Esempio n. 3
0
def OBSTRN_line(name):
    return [
        {
            'rules': MSCompare('VALSOU', '30', MSCompare.OP.GT),
            'instruction': LS('DASH', 2, 'CHBLK')
        },
        {
            # VALSOU missing and <= SAFETY_DEPTH both lead here
            'rules': MSNoRules(),
            'instruction': LS('DOTT', 2, 'CHBLK')
        }
    ]
Esempio n. 4
0
def LEGLIN(lookup_type, name):
    plnspd = TE("'%d kt'", 'plnspd', 3, 2, 2, '15110', 0, 0, 'CHBLK', 50)

    return [{
        'rules': MSCompare('select', '1') & MSHasValue('plnspd'),
        'instruction': [LC('PLNRTE03'), SY('PLNSPD03'), plnspd],
    }, {
        'rules': MSCompare('select', '1'),
        'instruction': LC('PLNRTE03'),
    }, {
        'rules': MSHasValue('plnspd'),
        'instruction': [LS('DOTT', 2, 'APLRT'),
                        SY('PLNSPD04'), plnspd],
    }, {
        'rules': MSNoRules(),
        'instruction': LS('DOTT', 2, 'APLRT'),
    }]
Esempio n. 5
0
def RESARE_no_continuation():
    return LookupCollection([
        Lookup(rules=MSStrCompare.includes('RESTRN', 9, 10, 11, 12, 15, 18, 19,
                                           20, 21, 22),
               instruction=SY('INFARE51')),
        Lookup(rules=MSNoRules(), instruction=SY('RSRDEF51'))
    ]) @ LookupCollection([
        Lookup(instruction=LS('DASH', 2, 'CHMGD'), table='Plain'),
        Lookup(instruction=LC('CTYARE51'), table='Symbolized')
    ])
Esempio n. 6
0
def SYMINS(lookup_type, name):
    instructions = {
        'Point': SY('NEWOBJ01'),
        'Line': LC('NEWOBJ01'),
        'Area': [SY('NEWOBJ01'), LS('DASH', 2, 'CHMGD')],
    }

    return [{
        'rules': MSNoRules(),
        'instruction': instructions[lookup_type],
    }]
Esempio n. 7
0
def RESARE_continuation_D():
    includes = MSStrCompare.includes
    return LookupCollection([
        Lookup(rules=(includes('RESTRN', 9, 10, 11, 12, 15, 18, 19, 20, 21, 22)
                      | includes('CATREA', 4, 5, 6, 7, 10, 20, 22, 23)),
               instruction=SY('CTYARE71')),
        Lookup(instruction=SY('CTYARE51'))
    ]) @ LookupCollection([
        Lookup(instruction=LS('DASH', 2, 'CHMGD'), table='Plain'),
        Lookup(instruction=LC('CTYARE51'), table='Symbolized')
    ])
Esempio n. 8
0
def WRECKS_other(lookup_type, name):
    # TODO: add rules for background
    return [{
        'rules': (MSCompare('QUAPOS', '1', MSCompare.OP.GT)
                  & MSCompare('QUAPOS', '10', MSCompare.OP.LT)),
        'instruction':
        LC('LOWACC41')
    }, {
        'rules': MSCompare('VALSOU', '30', MSCompare.OP.GT),
        'instruction': LS('DASH', 2, 'CHBLK')
    }, {
        'rules': MSHasValue('VALSOU'),
        'instruction': LS('DOTT', 2, 'CHBLK')
    }, {
        'rules': MSCompare('WATLEV', '1') | MSCompare('WATLEV', '2'),
        'instruction': [LS('SOLD', 2, 'CSTLN'),
                        AC('CHBRN')]
    }, {
        'rules': MSCompare('WATLEV', '4'),
        'instruction': [LS('DASH', 2, 'CSTLN'),
                        AC('DEPIT')]
    }, {
        'rules': MSCompare('WATLEV', '3') | MSCompare('WATLEV', '5'),
        'instruction': [LS('DOTT', 2, 'CSTLN'),
                        AC('DEPVS')]
    }, {
        'rules': MSNoRules(),
        'instruction': [LS('DOTT', 2, 'CSTLN'),
                        AC('DEPVS')]
    }]
Esempio n. 9
0
def SLCONS(lookup_type, name):
    return [
        {
            'instruction':
            SY('LOWACC01'),
            'rules': (
                # QUAPOS only has values 1 to 11. QUAPOS not in 1, 10, 11 is
                # equivalent to the below rules
                MSCompare('QUAPOS', '1', MSCompare.OP.GT)
                & MSCompare('QUAPOS', '10', MSCompare.OP.LT))
        },
        {
            'instruction':
            LC('LOWACC21'),
            'rules': (
                # QUAPOS only has values 1 to 11. QUAPOS not in 1, 10, 11 is
                # equivalent to the below rules
                MSCompare('QUAPOS', '1', MSCompare.OP.GT)
                & MSCompare('QUAPOS', '10', MSCompare.OP.LT))
        },
        {
            'instruction': LS('DASH', 1, 'CSTLN'),
            'rules': MSCompare('CONDTN', '1') | MSCompare('CONDTN', '2')
        },
        {
            'instruction':
            LS('SOLD', 4, 'CSTLN'),
            'rules': (MSCompare('CATSLC', '6')
                      | MSCompare('CATSLC', '15')
                      | MSCompare('CATSLC', '16'))
        },
        {
            'instruction': LS('DASH', 2, 'CSTLN'),
            'rules': MSCompare('WATLEV', '3') | MSCompare('WATLEV', '4')
        },
        {
            'instruction': LS('SOLD', 2, 'CSTLN'),
            'rules': MSNoRules()
        }
    ]
Esempio n. 10
0
def RESARE_continuation_E():
    rule_a = MSStrCompare.includes('CATREA', 1, 8, 9, 12, 14, 18, 19, 21, 24,
                                   25, 26)
    rule_b = MSStrCompare.includes('CATREA', 4, 5, 6, 7, 10, 20, 22, 23)

    return LookupCollection([
        Lookup(rules=rule_a & rule_b, instruction=SY('CTYARE71')),
        Lookup(rules=rule_a, instruction=SY('CTYARE51')),
        Lookup(rules=MSHasValue('CATREA') & rule_b,
               instruction=SY('INFARE51')),
        Lookup(instruction=SY('RSRDEF51'))
    ]) @ LookupCollection([
        Lookup(instruction=LS('DASH', 2, 'CHMGD'), table='Plain'),
        Lookup(instruction=LC('CTYARE51'), table='Symbolized')
    ])
Esempio n. 11
0
def RESARE_continuation_C():
    includes = MSStrCompare.includes
    return LookupCollection([
        Lookup(rules=(includes('RESTRN', 13, 16, 17, 23, 24, 25, 26, 27)
                      | includes('CATREA', 1, 8, 9, 12, 14, 18, 19, 21, 24, 25,
                                 26)),
               instruction=SY('FSHRES61')),
        Lookup(rules=(includes('RESTRN', 9, 10, 11, 12, 15, 18, 19, 20, 21, 22)
                      | includes('CATREA', 4, 5, 6, 7, 10, 20, 22, 23)),
               instruction=SY('FSHRES71')),
        Lookup(instruction=SY('FSHRES51'))
    ]) @ LookupCollection([
        Lookup(instruction=LS('DASH', 2, 'CHMGD'), table='Plain'),
        Lookup(instruction=LC('FSHRES51'), table='Symbolized')
    ])
Esempio n. 12
0
def OBSTRN_area(name):
    return [{
        'rules': MSCompare('VALSOU', '30', MSCompare.OP.GT),
        'instruction': LS('DASH', 2, 'CHGRD')
    }, {
        'rules': MSHasValue('VALSOU'),
        'instruction': LS('DOTT', 2, 'CHBLK')
    }, {
        'rules': MSCompare('CATOBS', '6'),
        'instruction': [AP('FOULAR01'), LS('DOTT', 2, 'CHBLK')]
    }, {
        'rules': MSCompare('WATLEV', '1') | MSCompare('WATLEV', '2'),
        'instruction': [AC('CHBRN'), LS('SOLD', 2, 'CSTLN')]
    }, {
        'rules': MSCompare('WATLEV', '4'),
        'instruction': [AC('DEPIT'), LS('DASH', 2, 'CSTLN')]
    }, {
        'rules': MSNoRules(),
        'instruction': [AC('DEPVS'), LS('DOTT', 2, 'CHBLK')]
    }]