當前位置: 首頁>>代碼示例>>Python>>正文


Python BddFsm.from_filename方法代碼示例

本文整理匯總了Python中pynusmv.fsm.BddFsm.from_filename方法的典型用法代碼示例。如果您正苦於以下問題:Python BddFsm.from_filename方法的具體用法?Python BddFsm.from_filename怎麽用?Python BddFsm.from_filename使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pynusmv.fsm.BddFsm的用法示例。


在下文中一共展示了BddFsm.from_filename方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_init

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
 def test_init(self):
     init_nusmv()
     # Should not produce error
     fsm = BddFsm.from_filename("tests/pynusmv/models/admin.smv")
     reset_nusmv()
     # Should not produce error
     fsm = BddFsm.from_filename("tests/pynusmv/models/admin.smv")
     deinit_nusmv()
開發者ID:ancailliau,項目名稱:pynusmv,代碼行數:10,代碼來源:testInit.py

示例2: print_vars_and_trans

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
 def print_vars_and_trans(self, modelpath):
     fsm = BddFsm.from_filename(modelpath)
     self.assertIsNotNone(fsm)
     
     propDb = glob.prop_database()
     master = propDb.master
     
     print("MODEL:", modelpath)
     print("============================================================")
     
     sexpfsm_ptr = nsprop.Prop_get_scalar_sexp_fsm(master._ptr)
     var_list = nssexp.SexpFsm_get_vars_list(sexpfsm_ptr)
     
     var_list_length = nsutils.NodeList_get_length(var_list)
     print("var_list length:", var_list_length)
     
     var_list_iter = nsutils.NodeList_get_first_iter(var_list)
     while var_list_iter is not None:
         item = nsutils.NodeList_get_elem_at(var_list, var_list_iter)
         
         print(nsnode.sprint_node(item))
         print("--------------------------")
         
         var_init = nssexp.SexpFsm_get_var_init(sexpfsm_ptr, item)
         print(nsnode.sprint_node(var_init))
                     
         print("--------------------------")
         
         var_trans = nssexp.SexpFsm_get_var_trans(sexpfsm_ptr, item)
         print(nsnode.sprint_node(var_trans))
         
         print("--------------------------")
         print()
         
         var_list_iter = nsutils.ListIter_get_next(var_list_iter)
開發者ID:ancailliau,項目名稱:pynusmv,代碼行數:37,代碼來源:testPrintTransForVars.py

示例3: test_symb_table_new_layer

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
 def test_symb_table_new_layer(self):
     fsm = BddFsm.from_filename("tests/pynusmv/models/counters.smv")
     symb_table = fsm.bddEnc.symbTable
     
     self.assertIsNotNone(symb_table)
     self.assertTrue("translation" not in symb_table.layer_names)
     
     symb_table.create_layer("translation")
     self.assertTrue("translation" in symb_table.layer_names)
開發者ID:ancailliau,項目名稱:pynusmv,代碼行數:11,代碼來源:testFsm.py

示例4: test_count_inputs_no_in_model

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
    def test_count_inputs_no_in_model(self):
        fsm = BddFsm.from_filename("tests/pynusmv/models/modules.smv")
        self.assertIsNotNone(fsm)

        ni = evalSexp(fsm, "n.inmod")
        mi = evalSexp(fsm, "m.inmod")
        top = evalSexp(fsm, "top")
        true = evalSexp(fsm, "TRUE")

        self.assertEqual(0, fsm.count_inputs(ni))
開發者ID:ancailliau,項目名稱:pynusmv,代碼行數:12,代碼來源:testFsm.py

示例5: test_symb_table_layer_names

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
 def test_symb_table_layer_names(self):
     fsm = BddFsm.from_filename("tests/pynusmv/models/counters.smv")
     symb_table = fsm.bddEnc.symbTable
     
     self.assertIsNotNone(symb_table)
     self.assertIsNotNone(symb_table._ptr)
     
     self.assertEqual(len(symb_table.layer_names), 2)
     self.assertIn("model", symb_table.layer_names)
     self.assertIn("model_bool", symb_table.layer_names)
開發者ID:ancailliau,項目名稱:pynusmv,代碼行數:12,代碼來源:testFsm.py

示例6: test_pick_no_inputs

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
    def test_pick_no_inputs(self):
        fsm = BddFsm.from_filename("tests/pynusmv/models/modules.smv")
        self.assertIsNotNone(fsm)

        ni = evalSexp(fsm, "n.inmod")
        mi = evalSexp(fsm, "m.inmod")
        top = evalSexp(fsm, "top")
        true = evalSexp(fsm, "TRUE")

        with self.assertRaises(NuSMVBddPickingError):
            fsm.pick_all_inputs(ni)
開發者ID:ancailliau,項目名稱:pynusmv,代碼行數:13,代碼來源:testFsm.py

示例7: test_symb_table_declare_variable

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
 def test_symb_table_declare_variable(self):
     fsm = BddFsm.from_filename("tests/pynusmv/models/counters.smv")
     symb_table = fsm.bddEnc.symbTable
     
     self.assertIsNotNone(symb_table)
     
     var = node.Identifier.from_string("ran")
     type_ = node.Scalar(("rc1", "rc2"))
     
     self.assertTrue(symb_table.can_declare_var("model", var))
     symb_table.declare_state_var("model", var, type_)
     self.assertFalse(symb_table.can_declare_var("model", var))
開發者ID:ancailliau,項目名稱:pynusmv,代碼行數:14,代碼來源:testFsm.py

示例8: test_post_counters

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
 def test_post_counters(self):
     fsm = BddFsm.from_filename("tests/pynusmv/models/counters.smv")
     self.assertIsNotNone(fsm)
     
     c1c0 = evalSexp(fsm, "c1.c = 0")
     c1c1 = evalSexp(fsm, "c1.c = 1")
     c2c0 = evalSexp(fsm, "c2.c = 0")
     c2c1 = evalSexp(fsm, "c2.c = 1")
     rc1 = evalSexp(fsm, "run = rc1")
     rc2 = evalSexp(fsm, "run = rc2")
     
     self.assertEqual(fsm.post(c1c0 & c2c0), (c1c1 & c2c0) | (c1c0 & c2c1))
開發者ID:ancailliau,項目名稱:pynusmv,代碼行數:14,代碼來源:testFsm.py

示例9: test_fairness

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
 def test_fairness(self):
     fsm = BddFsm.from_filename("tests/pynusmv/models/counters-fair.smv")
     self.assertIsNotNone(fsm)
     
     false = BDD.false(fsm.bddEnc.DDmanager)
     true = BDD.true(fsm.bddEnc.DDmanager)
     rc1 = evalSexp(fsm, "run = rc1")
     rc2 = evalSexp(fsm, "run = rc2")
     
     fairBdds = fsm.fairness_constraints
     self.assertEqual(len(fairBdds), 2)
     for fair in fairBdds:
         self.assertTrue(fair == rc1 or fair == rc2)
開發者ID:ancailliau,項目名稱:pynusmv,代碼行數:15,代碼來源:testFsm.py

示例10: test_gc

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
    def test_gc(self):
        """
        This test should not produce a segfault due to freed memory after
        deiniting NuSMV. This is thanks to the PyNuSMV GC system that keeps
        track of all wrapped pointers and free them when deiniting NuSMV, if
        needed.
        """
        init_nusmv()

        fsm = BddFsm.from_filename("tests/pynusmv/models/admin.smv")
        init = fsm.init

        deinit_nusmv()
開發者ID:sbusard,項目名稱:pynusmv,代碼行數:15,代碼來源:testGC.py

示例11: test_fairness_from_nusmv

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
 def test_fairness_from_nusmv(self):
     fsm = BddFsm.from_filename("tests/pynusmv/models/counters-fair.smv")
     self.assertIsNotNone(fsm)
     
     from pynusmv.nusmv.fsm.bdd import bdd as nsbddfsm
     
     justiceList = nsbddfsm.BddFsm_get_justice(fsm._ptr)
     fairnessList = nsbddfsm.justiceList2fairnessList(justiceList)
     
     ite = nsbddfsm.FairnessList_begin(fairnessList)
     fairBdds = []
     while not nsbddfsm.FairnessListIterator_is_end(ite):
         fairBdds.append(nsbddfsm.JusticeList_get_p(justiceList, ite))
         ite = nsbddfsm.FairnessListIterator_next(ite)
     self.assertEqual(len(fairBdds), 2)
開發者ID:ancailliau,項目名稱:pynusmv,代碼行數:17,代碼來源:testFsm.py

示例12: do_read

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
 def do_read(self, arg):
     """
     Read file as SMV model to get FSM.
     usage: read FILEPATH
     """
     if len(arg) < 1:
         print("[ERROR] read command needs the SMV model path.")
     else:
         if self.fsm is not None:
             reset_nusmv()
         try:
             self.fsm = BddFsm.from_filename(arg)
             self.fsmpath = arg
         except Exception as e:
             print("[ERROR]", e)
開發者ID:ancailliau,項目名稱:pynusmv,代碼行數:17,代碼來源:trace.py

示例13: check_and_explain

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
def check_and_explain(allargs):
    """
    Check specs on the given NuSMV model and compute TLACEs when needed.
    
    Build the model from a given file, check every CTL spec in it
    and compute and store TLACEs when needed.
    
    allargs -- a sys.args-like arguments list, without script name.
    """
    
    # Parse arguments
    parser = argparse.ArgumentParser(description='CTL model checker '
                                                 'with TLACE generation.')
    # Populate arguments: for now, only the model
    parser.add_argument('model', help='the NuSMV model with specifications')
    args = parser.parse_args(allargs)
    
    # Initialize the model
    fsm = BddFsm.from_filename(args.model)
    propDb = glob.prop_database()
    
    # Check all CTL properties
    for prop in propDb:
        #  Check type
        if prop.type == propTypes['CTL']:
            spec = prop.exprcore
    
            (satisfied, cntex) = check_ctl_spec(fsm, spec)
            # Print the result and the TLACE if any
            print('Specification',str(spec), 'is', str(satisfied),
                  file=sys.stderr)
        
            if not satisfied:
                print(xml_representation(fsm, cntex, spec))
            
            print()
開發者ID:ancailliau,項目名稱:pynusmv,代碼行數:38,代碼來源:tlace.py

示例14: model

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
 def model(self, modelpath):
     fsm = BddFsm.from_filename(modelpath)
     self.assertIsNotNone(fsm)
     return fsm
開發者ID:ancailliau,項目名稱:pynusmv,代碼行數:6,代碼來源:testGetPartialTrans.py

示例15: cardgame_post_fair

# 需要導入模塊: from pynusmv.fsm import BddFsm [as 別名]
# 或者: from pynusmv.fsm.BddFsm import from_filename [as 別名]
 def cardgame_post_fair(self):
     fsm = BddFsm.from_filename("tests/pynusmv/models/"
                                "cardgame-post-fair.smv")
     self.assertIsNotNone(fsm)
     return fsm
開發者ID:xgillard,項目名稱:pynusmv,代碼行數:7,代碼來源:testEnc.py


注:本文中的pynusmv.fsm.BddFsm.from_filename方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。