Kappa-Dev/KappaTools

Trace, final print

Opened this issue · 0 comments

Given the model

%agent: timer(s{tik,tok})   %init: 1 timer()
%token: tiks                %init: 0 tiks, toks
%token: toks

timer(s{tik}) -> timer(s{tok}) | 1 toks @ 1
timer(s{tok}) -> timer(s{tik}) | 1 tiks @ 1

%mod: [T] > 3.97 do $SNAPSHOT "snap_KaSim.ka" ; $STOP ;

I'm seeing the trace produced has

{
"uuid" : "545436964",
"dict":{"agent":{"id":0,"type":1},"binding_type":{"type":0,"site":1},"quark":{"agent":0,"site":1},"test":["Is_here","Has_Internal","Is_Free","Is_Bound","Has_Binding_type","Is_Bound_to"],"actions":["Create","Mod_internal","Bind","Bind_to","Free","Remove"],"binding_state":["ANY","FREE","BOUND","BOUND_TYPE","BOUND_to"],"event":{"tests":0,"actions":1,"side_effect_src":2,"side_effect_dst":3,"connectivity_tests":4},"simulation_info":{"id":0,"time":1,"event":2,"profiling":3},"step":["Subs","Rule","Pert","Init","Obs","Dummy"]},
"model":{"filenames":["","tests/unit/tokens_in_snapshots/model.ka"],"update":{"signatures":[{"name":"timer","decl":[{"name":"s","decl":[[{"name":"tik","decl":null},{"name":"tok","decl":null}],null,null]}]}],"single_agents":[null],"elementaries":[[[[[[[1,0],0],1],2],[[[[1,0],0],0],1],[[[[1,0],0],null],3]]]],"dag":[{"content":null,"roots":null,"deps":[],"sons":[]},{"content":{"sorts":[null,0],"nodes":[null,[[false,0]]]},"roots":[[1],0],"deps":[["RULE",0]],"sons":[]},{"content":{"sorts":[null,0],"nodes":[null,[[false,1]]]},"roots":[[1],0],"deps":[["RULE",1]],"sons":[]},{"content":{"sorts":[null,0],"nodes":[null,[[true,null]]]},"roots":null,"deps":[],"sons":[]}],"id_by_type":[[1]],"max_obs":4},"tokens":[{"name":"tiks","decl":null},{"name":"toks","decl":null}],"algs":[],"observables":["[T]"],"ast_rules":[[null,{"mixture":[{"type":0,"bindings":[[{"val":null},"Maintained"]],"states":[[0,1]],"erased":false}],"created":[],"delta_tokens":[{"val":{"val":1,"loc":{"file":1,"bline":5,"bchr":33,"echr":34}},"tok":1}],"rate":{"val":1,"loc":{"file":1,"bline":5,"bchr":42,"echr":43}},"unary_rate":null,"editStyle":false}],[null,{"mixture":[{"type":0,"bindings":[[{"val":null},"Maintained"]],"states":[[1,0]],"erased":false}],"created":[],"delta_tokens":[{"val":{"val":1,"loc":{"file":1,"bline":6,"bchr":33,"echr":34}},"tok":0}],"rate":{"val":1,"loc":{"file":1,"bline":6,"bchr":42,"echr":43}},"unary_rate":null,"editStyle":false}]],"elementary_rules":[{"rate":{"val":1,"loc":{"file":1,"bline":5,"bchr":42,"echr":43}},"connected_components":[1],"removed":[{"NegativeInternalized":[{"Existing":[{"agent":[1,0]},{"type":0}]},0]}],"inserted":[{"PositiveInternalized":[{"Existing":[{"agent":[1,0]},{"type":0}]},0,1]}],"delta_tokens":[{"val":{"val":1,"loc":{"file":1,"bline":5,"bchr":33,"echr":34}},"tok":1}],"syntactic_rule":1,"instantiations":[[[[1,[{"Existing":[{"agent":[1,0]},{"type":0}]},0],0],[0,{"Existing":[{"agent":[1,0]},{"type":0}]}]]],[[1,[{"Existing":[{"agent":[1,0]},{"type":0}]},0],1]],[],[],[]]},{"rate":{"val":1,"loc":{"file":1,"bline":6,"bchr":42,"echr":43}},"connected_components":[2],"removed":[{"NegativeInternalized":[{"Existing":[{"agent":[1,0]},{"type":0}]},0]}],"inserted":[{"PositiveInternalized":[{"Existing":[{"agent":[1,0]},{"type":0}]},0,0]}],"delta_tokens":[{"val":{"val":1,"loc":{"file":1,"bline":6,"bchr":33,"echr":34}},"tok":0}],"syntactic_rule":2,"instantiations":[[[[1,[{"Existing":[{"agent":[1,0]},{"type":0}]},0],1],[0,{"Existing":[{"agent":[1,0]},{"type":0}]}]]],[[1,[{"Existing":[{"agent":[1,0]},{"type":0}]},0],0]],[],[],[]]}],"contact_map":[[[[1,0],[]]]],"interventions":[{"alarm":null,"condition":{"val":[">",{"val":"[T]","loc":{"file":1,"bline":8,"bchr":6,"echr":9}},{"val":3.97,"loc":{"file":1,"bline":8,"bchr":12,"echr":16}}],"loc":{"file":1,"bline":8,"bchr":6,"echr":16}},"effect":[{"action":"SNAPSHOT","raw":false,"file":[{"val":"snap_KaSim.ka","loc":{"file":1,"bline":8,"bchr":30,"echr":45}}]},{"action":"STOP"}],"repeat":{"val":false},"needs_backtrack":true}],"dependencies_in_time":[["MODIF",0]],"dependencies_in_event":[],"algs_reverse_dependencies":[],"tokens_reverse_dependencies":[[],[]]},
"trace":[
    [3,[[0,[0,0],[[0,0]]],[4,[[0,0],0]],[1,[[0,0],0],0]]],
    [3,[]],
    [1,0,[[[[0,[0,0]],[1,[[0,0],0],0]]],[[1,[[0,0],0],1]],[],[],[]],[-1,1.7935983629643002,1,null]],
    [1,1,[[[[0,[0,0]],[1,[[0,0],0],1]]],[[1,[[0,0],0],0]],[],[],[]],[-1,1.8292313230569146,2,null]]]
}

And the snapshot produces is

// Snapshot [Event: 2]
// "uuid" : "545436964"
%def: "T0" "3.9882686236387492"

%init: 1 /*1 agents*/ timer(s{tik}[.])
%init: 1 tiks
%init: 1 toks

The snapshot ends at a time that is not present in the trace, at 3.9882686236387492; is the trace missing the final event?

It seems the snapshot has the time of what would have been event 3. Do snapshots print before that step's mixture transformations?