19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
## Structure matrix [states,nonstates,inputs,outputs,zero_outputs]
## ###############################################################
## ## Version control history
## ###############################################################
## ## $Id$
## ## $Log$
## ## Revision 1.44 2001/11/11 18:12:30 geraint
## ## Moved fflush(structure_file) out of loop.
## ##
## ## Revision 1.43 2001/11/11 08:32:00 geraint
## ## fflush (structure_file).
## ##
## ## Revision 1.42 2001/04/23 16:23:30 gawthrop
|
>
>
>
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
## Structure matrix [states,nonstates,inputs,outputs,zero_outputs]
## ###############################################################
## ## Version control history
## ###############################################################
## ## $Id$
## ## $Log$
## ## Revision 1.45 2002/05/22 09:15:03 gawthrop
## ## Non-repetitive components no longer use _1 in names
## ##
## ## Revision 1.44 2001/11/11 18:12:30 geraint
## ## Moved fflush(structure_file) out of loop.
## ##
## ## Revision 1.43 2001/11/11 08:32:00 geraint
## ## fflush (structure_file).
## ##
## ## Revision 1.42 2001/04/23 16:23:30 gawthrop
|
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
|
printf("\n\t%s Equations linking up subsystem %s (%s)\n\n",\
pc, comp_name, subsystem.type);
u_index = 0; y_index = 0; ## Count the inputs and outputs
for port_number=1:length(bond_list)
port_bond_number = bond_list(port_number);
this_bond_effort_unit = \
deblank(bond_effort_unit(port_bond_number,:));
this_bond_flow_unit = \
deblank(bond_flow_unit(port_bond_number,:));
## Extract the unit/domain stuff
this_port_name = subABG.portlist(port_number,:);
eval(sprintf("this_port = subABG.ports.%s;", \
this_port_name));
if struct_contains(this_port,"units")
eval(["effort_unit = \
subABG.ports.",this_port_name,".units.effort;"]);
eval(["flow_unit = \
subABG.ports.",this_port_name,".units.flow;"]);
else
effort_unit = "none";
flow_unit = "none";
endif
## and check consistency
## Efforts
if strcmp(this_bond_effort_unit,"null") # set
bond_effort_unit = \
[bond_effort_unit(1:port_bond_number-1,:)
effort_unit
bond_effort_unit(port_bond_number+1:n_bonds,:)
]
elseif (!strcmp(this_bond_effort_unit,"none") && !strcmp(effort_unit,"none")) # check
mtt_info(sprintf(unit_info,full_name, effort_unit, \
this_bond_effort_unit), infofilenum);
if !strcmp(this_bond_effort_unit,effort_unit)
error_string = sprintf(unit_error, full_name,\
effort_unit, \
this_bond_effort_unit);
mtt_error(error_string);
endif
endif
## Flows
if strcmp(this_bond_flow_unit,"null") # set
bond_flow_unit = \
[bond_flow_unit(1:port_bond_number-1,:)
flow_unit
bond_flow_unit(port_bond_number+1:n_bonds,:)
]
elseif (!strcmp(this_bond_flow_unit,"none") && !strcmp(flow_unit,"none")) # check
mtt_info(sprintf(unit_info,full_name, flow_unit, \
this_bond_flow_unit), infofilenum);
if !strcmp(this_bond_flow_unit,flow_unit)
error_string = sprintf(unit_error, full_name,\
flow_unit, \
this_bond_flow_unit);
mtt_error(error_string);
endif
endif
## Effort
if comp_bonds(port_number,1)==1 # Source
u_index = u_index + 1;
fprintf(ese_file, "%s_MTTu%d := %s;\n", ...
name_comp_name, u_index, varname(name_r, ...
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
>
|
|
|
|
|
|
|
|
|
|
|
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
|
printf("\n\t%s Equations linking up subsystem %s (%s)\n\n",\
pc, comp_name, subsystem.type);
u_index = 0; y_index = 0; ## Count the inputs and outputs
for port_number=1:length(bond_list)
repetition,port_number
port_bond_number = bond_list(port_number)
# this_bond_effort_unit = \
# deblank(bond_effort_unit(port_bond_number,:))
# this_bond_flow_unit = \
# deblank(bond_flow_unit(port_bond_number,:));
# ## Extract the unit/domain stuff
# this_port_name = subABG.portlist(port_number,:);
# eval(sprintf("this_port = subABG.ports.%s;", \
# this_port_name));
# if struct_contains(this_port,"units")
# eval(["effort_unit = \
# subABG.ports.",this_port_name,".units.effort;"]);
# eval(["flow_unit = \
# subABG.ports.",this_port_name,".units.flow;"]);
# else
# effort_unit = "none";
# flow_unit = "none";
# endif
# ## and check consistency
# ## Efforts
# if strcmp(this_bond_effort_unit,"null") # set
# bond_effort_unit = \
# [bond_effort_unit(1:port_bond_number-1,:)
# effort_unit
# bond_effort_unit(port_bond_number+1:n_bonds,:)
# ]
# elseif (!strcmp(this_bond_effort_unit,"none") && !strcmp(effort_unit,"none")) # check
# mtt_info(sprintf(unit_info,full_name, effort_unit, \
# this_bond_effort_unit), infofilenum);
# if !strcmp(this_bond_effort_unit,effort_unit)
# error_string = sprintf(unit_error, full_name,\
# effort_unit, \
# this_bond_effort_unit);
# mtt_error(error_string);
# endif
# endif
# ## Flows
# if strcmp(this_bond_flow_unit,"null") # set
# bond_flow_unit = \
# [bond_flow_unit(1:port_bond_number-1,:)
# flow_unit
# bond_flow_unit(port_bond_number+1:n_bonds,:)
# ]
# elseif (!strcmp(this_bond_flow_unit,"none") && !strcmp(flow_unit,"none")) # check
# mtt_info(sprintf(unit_info,full_name, flow_unit, \
# this_bond_flow_unit), infofilenum);
# if !strcmp(this_bond_flow_unit,flow_unit)
# error_string = sprintf(unit_error, full_name,\
# flow_unit, \
# this_bond_flow_unit);
# mtt_error(error_string);
# endif
# endif
## Effort
if comp_bonds(port_number,1)==1 # Source
u_index = u_index + 1;
fprintf(ese_file, "%s_MTTu%d := %s;\n", ...
name_comp_name, u_index, varname(name_r, ...
|