Example #1
0
def graph_ltltrans(pair, opts):
    # input: TGBA
    # output: results{'graph', ''}
    #     
    results = {'mp-prop-pair':[]}
    # temp
    ltl = pair[0]
    mplist = pair[1]
    cmd_ltltrans = './translator/ltltrans -f ' + '\'' +tmtc.ltl_out_trans(ltl)+ '\''
    st = time.time()
    ltltrans = subprocess.Popen(cmd_ltltrans,shell=True,close_fds=True,stdout=subprocess.PIPE)
    out = ltltrans.stdout
    graph = gg.ltltrans2graph(out, st, opts)
    if graph:
        props = []
        for mp in mplist:
            results['mp-prop-pair'].append({'mp':tltl._simplify_all_term_in_mp(mp), 'prop':tltl.get_proplist(mp)})
        results['graph'] = graph
        # results['mplist'] = copy.deepcopy(mplist)
        # results['mpprops'] = props
        if opts.pdebug:
            print "    props:",props
        en = time.time()
        tctime = str(en-st)+'  -- ltl2tgba -> Graph  Conversion Time '
        print tctime
        results['time'] = tctime
        return results
    else:
        return False
Example #2
0
        def _make_graph_by_opts(self):
            ltl = self.pair[0]

            if opts.tgba:
                print "-- TGBA!"
                cmd_ltl2tgba = 'ltl2tgba --low -f ' + '\'' + tmtc.ltl_out(ltl) + '\''
                ltl2tgba = subprocess.Popen(cmd_ltl2tgba, shell=True, close_fds=True, stdout=subprocess.PIPE)
                out = ltl2tgba.stdout
                graph = gg.tgba2graph(out, time.time(), self.opts)
            elif opts.ltltrans:
                cmd_ltltrans = './translator/ltltrans -f ' + '\'' + tmtc.ltl_out_trans(ltl) + '\''
                ltltrans = subprocess.Popen(cmd_ltltrans, shell=True, close_fds=True, stdout=subprocess.PIPE)
                out = ltltrans.stdout
                graph = gg.ltltrans2graph(out, time.time(), self.opts)
            else:
                print "-- BA!"
                cmd_ltl3ba = './translator/ltl3ba -f ' + "'" + tmtc.ltl_out(ltl) + "'"
                ltl3ba = subprocess.Popen(cmd_ltl3ba, shell=True, close_fds=True, stdout=subprocess.PIPE)
                out = ltl3ba.stdout
                graph = gg.nvc2graph(out, time.time(), self.opts)

            return graph