Overview
Comment:Fixed bug with vector components --NB takes geometric info from _rbg.fig
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 47c45949d9fac3ed281d86fcc148600638377f5243261ef2a1191c759639f13f
User & Date: gawthrop@users.sourceforge.net on 2001-03-23 11:20:20
Other Links: branch diff | manifest | tags
Context
2001-03-23
11:21:29
Show -pdf oprion in help list check-in: 159cfa1d10 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:20:20
Fixed bug with vector components --NB takes geometric info from _rbg.fig check-in: 47c45949d9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2001-03-21
03:24:59
Calculate inputs before outputs (.cc). check-in: e15a0f99ae user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/cbg2fig.m from [0b169241cf] to [cbb4e19511].

9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25



26
27
28
29
30
31
32
  ##     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  ##
  ## Matlab function  cbg_m2fig Causal bond graph:  mfile format to fig
  ## file format The resultant fig file is the original _abg.fig with
  ## additional causal strokes superimposed. cbg2fig(system_name, ...
  ## system_type, full_name, ... stroke_length, stroke_thickness,
  ## stroke_colour, ... comp_font, comp_colour_u, comp_colour_o)
  


  ## P.J.Gawthrop May 1996
  ## Copyright (c) P.J.Gawthrop, 1996.

  ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  ## %% Version control history
  ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  ## %% $Id$
  ## %% $Log$



  ## %% Revision 1.13  2000/09/14 09:12:19  peterg
  ## %% Fixed stroke orientation bug with bent bonds
  ## %% Uses new info from the _rbg.m file - 4 new cols in rbonds
  ## %%
  ## %% Revision 1.12  2000/09/14 08:07:00  peterg
  ## %% Reformated as an Octave function
  ## %%







|
>









>
>
>







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
34
35
36
  ##     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  ##
  ## Matlab function  cbg_m2fig Causal bond graph:  mfile format to fig
  ## file format The resultant fig file is the original _abg.fig with
  ## additional causal strokes superimposed. cbg2fig(system_name, ...
  ## system_type, full_name, ... stroke_length, stroke_thickness,
  ## stroke_colour, ... comp_font, comp_colour_u, comp_colour_o)
  ## Note this uses geometric info from _rbg.fig - so don't use with
  ## -abg switch.  

  ## P.J.Gawthrop May 1996
  ## Copyright (c) P.J.Gawthrop, 1996.

  ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  ## %% Version control history
  ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  ## %% $Id$
  ## %% $Log$
  ## %% Revision 1.14  2000/09/14 12:07:15  peterg
  ## %% Fixed overwriting of ports.
  ## %%
  ## %% Revision 1.13  2000/09/14 09:12:19  peterg
  ## %% Fixed stroke orientation bug with bent bonds
  ## %% Uses new info from the _rbg.m file - 4 new cols in rbonds
  ## %%
  ## %% Revision 1.12  2000/09/14 08:07:00  peterg
  ## %% Reformated as an Octave function
  ## %%
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

141

142

143
144
145
146
147
148
149
    return
  end;

  ## Setup file - append to the fig file
  filenum = fopen(fig_name, 'a');

  ## Get the raw and the processed bonds
  eval(['[rbonds,rstrokes,rcomponents] = ', system_type, '_rbg;']);
  eval(["ABG = ", system_type, "_abg;"]);
  bonds=ABG.bonds;

  ## Original number of bonds
  [n_bonds,junk] = size(rbonds);

  ## Get the causal bonds
  #eval(['[cbonds,status]=', full_name, '_cbg;']);
  eval(["CBG = ", full_name, "_cbg;"]);
  cbonds=CBG.bonds;

  ## Check sizes
  [Rows,Columns] = size(rcomponents);
  if (Columns ~= 13)
    error('Incorrect rcomponents matrix: must have 13 columns');
  end;
  M_components = Columns;



  [N_components, Columns] = size(CBG.subsystemlist);


  if struct_contains(CBG,'portlist')
    [N_ports, Columns] = size(CBG.portlist);
  else
    N_ports = 0;
  end








|

















>

>
|
>







120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
    return
  end;

  ## Setup file - append to the fig file
  filenum = fopen(fig_name, 'a');

  ## Get the raw and the processed bonds
  eval(['[rbonds,rstrokes,rcomponents,port_coord,port_name,port_list] = ', system_type, '_rbg;']);
  eval(["ABG = ", system_type, "_abg;"]);
  bonds=ABG.bonds;

  ## Original number of bonds
  [n_bonds,junk] = size(rbonds);

  ## Get the causal bonds
  #eval(['[cbonds,status]=', full_name, '_cbg;']);
  eval(["CBG = ", full_name, "_cbg;"]);
  cbonds=CBG.bonds;

  ## Check sizes
  [Rows,Columns] = size(rcomponents);
  if (Columns ~= 13)
    error('Incorrect rcomponents matrix: must have 13 columns');
  end;
  M_components = Columns;
  N_rcomponents = Rows;		# Number of raw components

  [N_rports,junk] = size(port_list);
  [N_components, Columns] = size(CBG.subsystemlist); # Number of derived
						     # components

  if struct_contains(CBG,'portlist')
    [N_ports, Columns] = size(CBG.portlist);
  else
    N_ports = 0;
  end

235
236
237
238
239
240
241

242

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
      fprintf(filenum, '	%4.0f %4.0f %4.0f %4.0f \n', ...
	      stroke_end_1(1), stroke_end_1(2), ...
	      stroke_end_2(1), stroke_end_2(2) );
    end;
  end;

  ## Print all the components - coloured acording to causality.

  for i = 1+N_ports:N_ports+N_components

    if i>N_ports			# Subsystem
      comp_name = CBG.subsystemlist(i-N_ports,:);
      eval(["comp_status = CBG.subsystems.", comp_name, ".status;"]);
    else
      comp_name = CBG.portlist(i,:);
      eval(["comp_status = CBG.ports.", comp_name, ".status;"]);
    end
    

    fig_params = rcomponents(i,3:M_components);
    coords = rcomponents(i,1:2);
    
    if comp_status==-1		# Then under causal
      fig_params(3) = comp_colour_u;
      fig_params(6) = comp_font;
    end;







>
|
>








|







242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
      fprintf(filenum, '	%4.0f %4.0f %4.0f %4.0f \n', ...
	      stroke_end_1(1), stroke_end_1(2), ...
	      stroke_end_2(1), stroke_end_2(2) );
    end;
  end;

  ## Print all the components - coloured acording to causality.
  ## Miss out the ports
  
  for i = N_rports+1:N_rcomponents
    if i>N_ports			# Subsystem
      comp_name = CBG.subsystemlist(i-N_ports,:);
      eval(["comp_status = CBG.subsystems.", comp_name, ".status;"]);
    else
      comp_name = CBG.portlist(i,:);
      eval(["comp_status = CBG.ports.", comp_name, ".status;"]);
    end
    
   i,comp_name,N_rcomponents,N_rports
    fig_params = rcomponents(i,3:M_components);
    coords = rcomponents(i,1:2);
    
    if comp_status==-1		# Then under causal
      fig_params(3) = comp_colour_u;
      fig_params(6) = comp_font;
    end;


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