Differences From Artifact [827c2f1efc]:

To Artifact [2217509088]:


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  delim = "__";
  N = mtt_check_sigs (outsig,insigs);

  state_index=3;
  
  i_cause = outsig(2);		# Extract causality

  state_equation=((i_cause==1)&&strcmp(comp_type,"C"))\
      ||((i_cause==-1)&&strcmp(comp_type,"I"));

  ## Create the equation
  if state_equation			# output/state
    LHS = varname(Name, outsig(1,1), state_index);
    RHS = sprintf("MTTx_%s%s%s", Name, delim, name);
    eqn_1 = sprintf("%s := %s;", LHS, RHS);
    
    inports = [1:N]; 
    comp_type_str=sprintf("""%s""", comp_type);
    eqn_2 = equation(comp_type_str,Name,cr,arg,outsig(1),outsig(2),outsig(3),\
	     insigs(:,1),state_index,inports);
    
    eqn = sprintf("%s\n%s", eqn_1, eqn_2);
  else			# state derivative
    RHS = varname(Name, insigs(1,1), insigs(1,2));
    LHS = sprintf("MTTdx_%s%s%s", Name, delim, name);
    eqn = sprintf("%s := %s;", LHS, RHS);







|










|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  delim = "__";
  N = mtt_check_sigs (outsig,insigs);

  state_index=3;
  
  i_cause = outsig(2);		# Extract causality

  state_equation=((i_cause==1)&&strcmp(comp_type,"C")) ...
      ||((i_cause==-1)&&strcmp(comp_type,"I"));

  ## Create the equation
  if state_equation			# output/state
    LHS = varname(Name, outsig(1,1), state_index);
    RHS = sprintf("MTTx_%s%s%s", Name, delim, name);
    eqn_1 = sprintf("%s := %s;", LHS, RHS);
    
    inports = [1:N]; 
    comp_type_str=sprintf("""%s""", comp_type);
    eqn_2 = equation(comp_type_str,Name,cr,arg,outsig(1),outsig(2),outsig(3), ...
	     insigs(:,1),state_index,inports);
    
    eqn = sprintf("%s\n%s", eqn_1, eqn_2);
  else			# state derivative
    RHS = varname(Name, insigs(1,1), insigs(1,2));
    LHS = sprintf("MTTdx_%s%s%s", Name, delim, name);
    eqn = sprintf("%s := %s;", LHS, RHS);

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