Skip to content

create(name, size, trans, marker)

creates an automaton model of DES (a .DES file)

Parameters

Name Type Description Default
name string DES model name required
size int number of state required
trans TransList transition tuple.
For more information, please see TransList Type.
required
marker list marker state list required

TransList Type

There are several ways to write a Transition Tuple.

  1. Number only (Classic TCT)

    (exit state: int, event: int, enter_state: int)

    Note

    Odd number event is controllable and even number event is uncontrollable.

    trans: TransList = [
        (0, 11, 1),
        (1, 10, 0),
        (1, 12, 2),
    ]
    
  2. String Event (PyTCT Original)

    (exit state: int, event: string, enter_state: int, 'u'[uncontrollable] or 'c'[controllable])

    Note

    String events and int events cannot be mixed.

    trans: TransList = [
        (0, 'run', 1, 'c'),
        (1, 'finish', 0, 'u'),
        (1, 'broken', 2, 'u'),
    ]
    
  3. String State (PyTCT Original)

    (exit state: string, event: string, enter_state: string, 'u'[uncontrollable] or 'c'[controllable])

    Note

    it will not be able to be displayed on AutomatonDisplay after processing such as sync.

    trans: TransList = [
        ('idle', 'run', 'working', 'c'),
        ('working', 'finish', 'idle', 'u'),
        ('working', 'broken', 'repairing', 'u'),
    ]
    

Example

sample 1
delta = [
    (0, 11, 1),
    (1, 10, 0),
    (1, 12, 2),
    (2, 13, 0),
    (0, 15, 3)
]
Qm = [0, 1]
pytct.create("model", 4, delta, Qm)
sample 2
delta = [
    (0, "run", 1, "c"),
    (1, "finish", 0, "u"),
    (1, "broken", 2, "u"),
    (2, "repaired", 0, "c"),
    (0, "sold", 3, "c")
]
Qm = [0,1]
pytct.create("model", 4, delta, Qm)
sample 3
delta = [
    ("idle", "run", "running", "c"),
    ("running", "finish", "idle", "u"),
    ("running", "broken", "broken", "u"),
    ("broken", "repaired", "idle", "c"),
    ("idle", "sold", "sold", "c")
]
Qm = ["idle", "running"]
pytct.create("model", 4, delta, Qm)