Differences From Artifact [53138c6ea2]:

To Artifact [3462a7ac23]:


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  endif

  ## Is output same causality as junction?
  same_type = outsig(2)==i_jun_type;


  ## LHS 
  eqn = sprintf("%s(%i,%i) :=", Name, abs(outsig(1)), cause2index(outsig(2)));

  ## Find the input bond of the same causality as junction
  one = ones(N,1);
  inport = find(insigs(:,2)==i_jun_type*one);

  ##RHS
  if same_type
    insig = insigs(inport,:);
    inname = innames(inport,:);
    eqn = sprintf("%s\n\t%s(%i,%i)", eqn, Name, abs(insigs(inport,1)),cause2index(i_jun_type));
  else
    insig=[];
    inname="";
    inports = [];
    out_dir = sign(insigs(inport,1));
    for i=1:N
      if i!=inport
	in_dir = sign(insigs(i,1));
	plusminus = sign2name(-in_dir*out_dir);
	eqn = sprintf("%s\n\t%s%s(%i,%i)", eqn, plusminus, Name, \
		      abs(insigs(i,1)), cause2index(-i_jun_type));
	insig = [insig; insigs(i,:)];
	inname = [inname; innames(i,:)];
      endif
    endfor
  endif
  eqn = sprintf("%s;", eqn);
  insigs = insig;







|









|









|
|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  endif

  ## Is output same causality as junction?
  same_type = outsig(2)==i_jun_type;


  ## LHS 
  eqn = sprintf("%s :=", varname(Name, abs(outsig(1)), outsig(2)));

  ## Find the input bond of the same causality as junction
  one = ones(N,1);
  inport = find(insigs(:,2)==i_jun_type*one);

  ##RHS
  if same_type
    insig = insigs(inport,:);
    inname = innames(inport,:);
    eqn = sprintf("%s\n\t%s", eqn, varname(Name, abs(insigs(inport,1)),i_jun_type));
  else
    insig=[];
    inname="";
    inports = [];
    out_dir = sign(insigs(inport,1));
    for i=1:N
      if i!=inport
	in_dir = sign(insigs(i,1));
	plusminus = sign2name(-in_dir*out_dir);
	eqn = sprintf("%s\n\t%s%s", eqn, plusminus, varname(Name, \
		      abs(insigs(i,1)), -i_jun_type));
	insig = [insig; insigs(i,:)];
	inname = [inname; innames(i,:)];
      endif
    endfor
  endif
  eqn = sprintf("%s;", eqn);
  insigs = insig;

MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]