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')] }]
def WRECKS_Point(lookup_type, name): return [{ 'rules': MSCompare('VALSOU', '30', MSCompare.OP.GT), 'instruction': SY('DANGER02') }, { 'rules': MSHasValue('VALSOU'), 'instruction': SY('DANGER01') }, { 'rules': MSCompare('CATWRK', '1') & MSCompare('WATLEV', '3'), 'instruction': SY('WRECKS04') }, { 'rules': MSCompare('CATWRK', '2') & MSCompare('WATLEV', '3'), 'instruction': SY('WRECKS05') }, { 'rules': (MSCompare('CATWRK', '4') | MSCompare('CATWRK', '5') | MSCompare('WATLEV', '1') | MSCompare('WATLEV', '2') | MSCompare('WATLEV', '3') | MSCompare('WATLEV', '4')), 'instruction': SY('WRECKS01') }, { 'rules': MSNoRules(), 'instruction': SY('WRECKS05') }]
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'), }]
def RESARE(lookup_type, name): includes = MSStrCompare.includes return (Lookup(id='-CS(RESARE)', rules=includes( 'RESTRN', 7, 8, 14)) @ RESARE_continuation_A() + Lookup(id='-CS(RESARE)', rules=includes( 'RESTRN', 1, 2)) @ RESARE_continuation_B() + Lookup(id='-CS(RESARE)', rules=includes( 'RESTRN', 3, 4, 5, 6, 24)) @ RESARE_continuation_C() + Lookup(id='-CS(RESARE)', rules=includes('RESTRN', 13, 16, 17, 23, 25, 26, 27)) @ RESARE_continuation_D() + Lookup(id='-CS(RESARE)', rules=MSHasValue('RESTRN')) @ RESARE_no_continuation() + Lookup(id='-CS(RESARE)') @ RESARE_continuation_E())
def OBSTRN_point(name): common_rule = [{ 'rules': MSCompare('VALSOU', '30', MSCompare.OP.GT), 'instruction': SY('DANGER02') }] if name == 'UWTROC': return common_rule + [{ 'rules': (MSHasValue('VALSOU') & (MSCompare('WATLEV', '4') | MSCompare('WATLEV', '5'))), 'instruction': SY('UWTROC04') }, { 'rules': MSHasValue('VALSOU'), 'instruction': SY('DANGER01') }, { 'rules': MSCompare('WATLEV', '3'), 'instruction': SY('UWTROC03') }, { 'rules': MSNoRules(), 'instruction': SY('UWTROC04') }] else: return common_rule + [ { 'rules': MSHasValue('VALSOU') & MSCompare('CATOBS', '6'), 'instruction': SY('DANGER01') }, { 'rules': (MSHasValue('VALSOU') & (MSCompare('WATLEV', '1') | MSCompare('WATLEV', '2'))), 'instruction': SY('OBSTRN11') }, { 'rules': (MSHasValue('VALSOU') & (MSCompare('WATLEV', '4') | MSCompare('WATLEV', '5'))), 'instruction': SY('DANGER03') }, { 'rules': MSHasValue('VALSOU'), 'instruction': SY('DANGER01') }, { 'rules': MSCompare('CATOBS', '6'), 'instruction': SY('OBSTRN01') }, { 'rules': MSCompare('WATLEV', '1') | MSCompare('WATLEV', '2'), 'instruction': SY('OBSTRN11') }, { 'rules': MSCompare('WATLEV', '4') | MSCompare('WATLEV', '5'), 'instruction': SY('OBSTRN03') }, { 'rules': MSNoRules(), 'instruction': SY('OBSTRN01') } ]
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') ])
def TOPMAR(lookup_type, name): if os.environ.get('TOPMAR_FLOAT'): sy_getter = itemgetter(0) else: sy_getter = itemgetter(1) return [{ 'instruction': SY(sy), 'rules': MSCompare('TOPSHP', shp) } for shp, floating, rigid in topshp_to_sy for sy in [sy_getter([floating, rigid])] ] + [{ 'instruction': SY(sy_getter(('TMARDEF2', 'TMARDEF1'))), 'rules': MSHasValue('TOPSHP') }, { 'instruction': SY('QUESMRK1'), 'rules': MSNoRules(), }]
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')] }]