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
|
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,:));
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,:);
# ## 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
# 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,:)
# ## 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_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
# ]
# 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, ...
|