Changeset 13095 for branches/devmj1626/Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo
 Timestamp:
 Jul 9, 2019 3:08:30 PM (5 months ago)
 Location:
 branches/devmj1626
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

branches/devmj1626
 Property svn:externals

old new 1 1 https://svn.jmodelica.org/assimulo/tags/Assimulo3.0@875 external/Assimulo 2 https://svn.jmodelica.org/PyFMI/tags/PyFMI2.5 /src/common@12158Python/src/common2 https://svn.jmodelica.org/PyFMI/tags/PyFMI2.5.3/src/common@13067 Python/src/common 3 3 https://github.com/chria/casadi/branches/tested_mod@11366 ThirdParty/CasADi/CasADi 4 4 https://svn.jmodelica.org/FMILibrary/trunk@10948 external/FMILibrary/FMILibrary 5 https://svn.jmodelica.org/PyFMI/tags/PyFMI2.5. 1@12984external/PyFMI5 https://svn.jmodelica.org/PyFMI/tags/PyFMI2.5.3@13069 external/PyFMI

 Property svn:mergeinfo changed
 Property svn:externals

branches/devmj1626/Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo
r12934 r13095 15 15 */ 16 16 17 within; 17 18 18 19 package ExpandableConnectors … … 21 22 expandable connector EC 22 23 end EC; 23 24 connector C = Real; 25 24 25 connector C = Real; 26 26 27 EC ec1, ec2, ec3; 27 28 C c1, c2; … … 58 59 expandable connector EC 59 60 end EC; 60 61 61 62 connector C 62 63 Real a; … … 123 124 end ExpandableConnectors.Expandable2; 124 125 ")}))); 125 126 end Expandable2; 126 127 127 128 … … 129 130 expandable connector EC 130 131 end EC; 131 132 132 133 connector C = Real[2]; 133 134 134 135 model M 135 136 EC ec1, ec2, ec3; … … 141 142 connect(ec3.a, c2); 142 143 end M; 143 144 144 145 M m[2]; 145 146 … … 188 189 expandable connector EC 189 190 end EC; 190 191 connector C = Real; 192 193 EC ec[3]; 194 C c1, c2; 195 equation 196 connect(c1, ec[1].a); 197 connect(ec[1], ec[2]); 198 connect(ec[2], ec[3]); 199 connect(ec[3].a, c2); 200 201 annotation(__JModelica(UnitTesting(tests={ 202 FlatteningTestCase( 203 name="Expandable4", 204 description="Array of expandable connectors", 205 flatModel=" 206 fclass ExpandableConnectors.Expandable4 207 Real ec[1].a; 208 Real ec[2].a; 209 Real ec[3].a; 210 Real c1; 211 Real c2; 212 equation 213 c1 = c2; 214 c2 = ec[1].a; 215 ec[1].a = ec[2].a; 216 ec[2].a = ec[3].a; 217 end ExpandableConnectors.Expandable4; 218 ")}))); 219 end Expandable4; 220 221 222 model Expandable5 223 expandable connector EC 224 end EC; 225 226 connector C = Real; 227 228 model M 229 C c; 230 end M; 231 232 parameter Integer n = 4; 233 234 EC ec[n]; 235 M m[n]; 236 equation 237 for i in 1:(n2) loop 238 connect(ec[i], ec[i+2]); 239 connect(ec[i].a, m[i].c); 240 end for; 241 connect(ec[end1].a, m[end1].c); 242 connect(ec[end].a, m[end].c); 243 244 annotation(__JModelica(UnitTesting(tests={ 245 FlatteningTestCase( 246 name="Expandable5", 247 description="Connecting to expandable connector in for loop", 248 flatModel=" 249 fclass ExpandableConnectors.Expandable5 250 structural parameter Integer n = 4 /* 4 */; 251 Real ec[1].a; 252 Real ec[2].a; 253 Real ec[3].a; 254 Real ec[4].a; 255 Real m[1].c; 256 Real m[2].c; 257 Real m[3].c; 258 Real m[4].c; 259 equation 260 ec[1].a = ec[3].a; 261 ec[3].a = m[1].c; 262 m[1].c = m[3].c; 263 ec[2].a = ec[4].a; 264 ec[4].a = m[2].c; 265 m[2].c = m[4].c; 266 end ExpandableConnectors.Expandable5; 267 ")}))); 268 end Expandable5; 269 270 271 model Expandable7 272 expandable connector EC 273 end EC; 274 275 model A 276 replaceable EC ec; 277 end A; 278 279 connector C = Real; 280 281 A a1(redeclare EC ec); 191 192 model A 193 replaceable EC ec; 194 end A; 195 196 connector C = Real; 197 198 A a1(redeclare EC ec); 282 199 A a2(redeclare EC ec); 283 200 A a3(redeclare EC ec); … … 291 208 annotation(__JModelica(UnitTesting(tests={ 292 209 FlatteningTestCase( 293 name="Expandable 7",210 name="Expandable4", 294 211 description="Added support for redeclaring expandable connectors", 295 212 flatModel=" 296 fclass ExpandableConnectors.Expandable 7213 fclass ExpandableConnectors.Expandable4 297 214 Real a1.ec.b; 298 215 Real a2.ec.b; … … 305 222 a3.ec.b = c1; 306 223 c1 = c2; 307 end ExpandableConnectors.Expandable 7;308 ")}))); 309 end Expandable7;310 311 312 model Expandable 8313 expandable connector EC 314 end EC; 315 316 connector C = Real; 317 224 end ExpandableConnectors.Expandable4; 225 ")}))); 226 end Expandable4; 227 228 229 model Expandable5 230 expandable connector EC 231 end EC; 232 233 connector C = Real; 234 318 235 EC ec1, ec2, ec3; 319 236 C c1 = 1; … … 327 244 annotation(__JModelica(UnitTesting(tests={ 328 245 FlatteningTestCase( 329 name="Expandable 8",246 name="Expandable5", 330 247 description="Adding to expandable connectors from var with binding exp", 331 248 flatModel=" 332 fclass ExpandableConnectors.Expandable 8249 fclass ExpandableConnectors.Expandable5 333 250 Real ec1.a; 334 251 Real ec2.a; … … 341 258 ec1.a = ec2.a; 342 259 ec2.a = ec3.a; 343 end ExpandableConnectors.Expandable 8;344 ")}))); 345 end Expandable8;346 347 348 model Expandable 8b349 expandable connector EC 350 end EC; 351 260 end ExpandableConnectors.Expandable5; 261 ")}))); 262 end Expandable5; 263 264 265 model Expandable5b 266 expandable connector EC 267 end EC; 268 352 269 connector C 353 354 355 356 270 Real x; 271 Real y; 272 end C; 273 357 274 EC ec1, ec2, ec3; 358 275 C c1(x = 1, y = 2); … … 366 283 annotation(__JModelica(UnitTesting(tests={ 367 284 FlatteningTestCase( 368 name="Expandable 8b",285 name="Expandable5b", 369 286 description="Adding to expandable connectors from composite with binding exps", 370 287 flatModel=" 371 fclass ExpandableConnectors.Expandable 8b288 fclass ExpandableConnectors.Expandable5b 372 289 Real ec1.a.x; 373 290 Real ec1.a.y; … … 389 306 ec1.a.y = ec2.a.y; 390 307 ec2.a.y = ec3.a.y; 391 end ExpandableConnectors.Expandable 8b;392 ")}))); 393 end Expandable 8b;394 395 396 model Expandable 9397 expandable connector EC 398 end EC; 399 308 end ExpandableConnectors.Expandable5b; 309 ")}))); 310 end Expandable5b; 311 312 313 model Expandable6 314 expandable connector EC 315 end EC; 316 400 317 connector C = Real; 401 318 … … 410 327 annotation(__JModelica(UnitTesting(tests={ 411 328 FlatteningTestCase( 412 name="Expandable 9",329 name="Expandable6", 413 330 description="Expandable connectors: connect to single element in array", 414 331 flatModel=" 415 fclass ExpandableConnectors.Expandable 9332 fclass ExpandableConnectors.Expandable6 416 333 Real ec1.a; 417 334 Real ec2.a; … … 423 340 ec1.a = ec2.a; 424 341 ec2.a = ec3.a; 425 end ExpandableConnectors.Expandable 9;426 ")}))); 427 end Expandable9;428 429 430 model Expandable 10431 expandable connector EC 432 end EC; 433 434 connector C = Real; 435 342 end ExpandableConnectors.Expandable6; 343 ")}))); 344 end Expandable6; 345 346 347 model Expandable7 348 expandable connector EC 349 end EC; 350 351 connector C = Real; 352 436 353 EC ec1, ec2, ec3; 437 354 C c[4]; … … 444 361 annotation(__JModelica(UnitTesting(tests={ 445 362 FlatteningTestCase( 446 name="Expandable 10",363 name="Expandable7", 447 364 description="Expandable connectors: connect to slice", 448 365 flatModel=" 449 fclass ExpandableConnectors.Expandable 10366 fclass ExpandableConnectors.Expandable7 450 367 Real ec1.a[2]; 451 368 Real ec2.a[2]; … … 461 378 ec1.a[2] = ec2.a[2]; 462 379 ec2.a[2] = ec3.a[2]; 463 end ExpandableConnectors.Expandable 10;464 ")}))); 465 end Expandable 10;466 467 468 model Expandable 11469 expandable connector EC 470 end EC; 471 472 connector C = Real; 473 380 end ExpandableConnectors.Expandable7; 381 ")}))); 382 end Expandable7; 383 384 385 model Expandable8 386 expandable connector EC 387 end EC; 388 389 connector C = Real; 390 474 391 EC ec1, ec2, ec3; 475 392 C c1, c2, c3, c4; … … 484 401 annotation(__JModelica(UnitTesting(tests={ 485 402 FlatteningTestCase( 486 name="Expandable 11",403 name="Expandable8", 487 404 description="Connecting to cell of array in expandable connector", 488 405 flatModel=" 489 fclass ExpandableConnectors.Expandable 11406 fclass ExpandableConnectors.Expandable8 490 407 Real ec1.a[2]; 491 408 Real ec2.a[2]; … … 504 421 ec1.a[2] = ec2.a[2]; 505 422 ec2.a[2] = ec3.a[2]; 506 end ExpandableConnectors.Expandable11; 507 ")}))); 508 end Expandable11; 509 510 511 model Expandable12 512 expandable connector EC 513 end EC; 514 515 connector C = Real; 516 423 end ExpandableConnectors.Expandable8; 424 ")}))); 425 end Expandable8; 426 427 428 model Expandable9 429 connector C = Real; 430 431 expandable connector EC 432 C x; 433 end EC; 434 435 EC ec1, ec2; 436 C x = time; 437 equation 438 connect(ec1.x, ec2.x); 439 connect(ec1.x, x); 440 441 annotation(__JModelica(UnitTesting(tests={ 442 FlatteningTestCase( 443 name="Expandable9", 444 description="Connecting two declared members of expandable connectors", 445 flatModel=" 446 fclass ExpandableConnectors.Expandable9 447 Real ec1.x; 448 Real ec2.x; 449 Real x = time; 450 equation 451 ec1.x = ec2.x; 452 ec2.x = x; 453 end ExpandableConnectors.Expandable9; 454 ")}))); 455 end Expandable9; 456 457 458 model Expandable10 459 expandable connector EC 460 end EC; 461 462 connector C = Real; 463 517 464 EC ec1, ec2, ec3; 518 465 C c1[5], c2[5]; … … 527 474 annotation(__JModelica(UnitTesting(tests={ 528 475 FlatteningTestCase( 529 name="Expandable1 2",476 name="Expandable10", 530 477 description="Connecting to slice of array in expandable connector", 531 478 flatModel=" 532 fclass ExpandableConnectors.Expandable1 2479 fclass ExpandableConnectors.Expandable10 533 480 Real ec1.a[4]; 534 481 Real ec2.a[4]; … … 553 500 ec1.a[4] = ec2.a[4]; 554 501 ec2.a[4] = ec3.a[4]; 555 end ExpandableConnectors.Expandable1 2;556 ")}))); 557 end Expandable12;558 559 560 model Expandable1 3561 expandable connector EC 562 end EC; 563 564 connector C = Real; 565 502 end ExpandableConnectors.Expandable10; 503 ")}))); 504 end Expandable10; 505 506 507 model Expandable11 508 expandable connector EC 509 end EC; 510 511 connector C = Real; 512 566 513 EC ec1, ec2; 567 568 514 C c1[2], c2[2,2]; 515 equation 569 516 connect(ec1, ec2); 570 517 connect(ec1.a[1,:], c1); … … 573 520 annotation(__JModelica(UnitTesting(tests={ 574 521 FlatteningTestCase( 575 name="Expandable1 3",522 name="Expandable11", 576 523 description="Connecting to slice with colon of array in expandable connector", 577 524 flatModel=" 578 fclass ExpandableConnectors.Expandable1 3525 fclass ExpandableConnectors.Expandable11 579 526 Real ec1.a[1,2]; 580 527 Real ec1.b[2,2]; … … 596 543 c2[2,2] = ec1.b[2,2]; 597 544 ec1.b[2,2] = ec2.b[2,2]; 598 end ExpandableConnectors.Expandable1 3;599 ")}))); 600 end Expandable1 3;601 602 603 model Expandable1 4604 expandable connector EC 605 end EC; 606 607 connector C = Real; 608 545 end ExpandableConnectors.Expandable11; 546 ")}))); 547 end Expandable11; 548 549 550 model Expandable12 551 expandable connector EC 552 end EC; 553 554 connector C = Real; 555 609 556 EC ec1; 610 557 C c1[3], c2; … … 615 562 annotation(__JModelica(UnitTesting(tests={ 616 563 FlatteningTestCase( 617 name="Expandable1 4",564 name="Expandable12", 618 565 description="Connecting to entire array and to single element", 619 566 flatModel=" 620 fclass ExpandableConnectors.Expandable1 4567 fclass ExpandableConnectors.Expandable12 621 568 Real ec1.a[3]; 622 569 Real c1[3]; … … 627 574 c1[3] = c2; 628 575 c2 = ec1.a[3]; 629 end ExpandableConnectors.Expandable1 4;630 ")}))); 631 end Expandable1 4;632 633 634 model Expandable1 5635 expandable connector EC 636 637 638 end EC; 639 640 connector C = Real; 641 642 643 644 645 646 647 annotation(__JModelica(UnitTesting(tests={ 648 FlatteningTestCase( 649 name="Expandable1 5",576 end ExpandableConnectors.Expandable12; 577 ")}))); 578 end Expandable12; 579 580 581 model Expandable13 582 expandable connector EC 583 Real x; 584 Real y; 585 end EC; 586 587 connector C = Real; 588 589 EC ec; 590 C c; 591 equation 592 connect(c, ec.x); 593 594 annotation(__JModelica(UnitTesting(tests={ 595 FlatteningTestCase( 596 name="Expandable13", 650 597 description="Expandable connector with members", 651 598 flatModel=" 652 fclass ExpandableConnectors.Expandable1 5599 fclass ExpandableConnectors.Expandable13 653 600 Real ec.x; 654 601 Real c; 655 602 equation 656 603 c = ec.x; 657 end ExpandableConnectors.Expandable1 5;658 ")}))); 659 end Expandable1 5;660 661 662 model Expandable1 6604 end ExpandableConnectors.Expandable13; 605 ")}))); 606 end Expandable13; 607 608 609 model Expandable14 663 610 expandable connector EC 664 611 Real a[3]; 665 612 end EC; 666 667 connector C = Real; 668 613 614 connector C = Real; 615 669 616 EC ec; 670 617 C c[3]; … … 674 621 annotation(__JModelica(UnitTesting(tests={ 675 622 FlatteningTestCase( 676 name="Expandable1 6",623 name="Expandable14", 677 624 description="Expandable connector with members: array", 678 625 flatModel=" 679 fclass ExpandableConnectors.Expandable1 6626 fclass ExpandableConnectors.Expandable14 680 627 Real ec.a[3]; 681 628 Real c[3]; … … 684 631 c[2] = ec.a[2]; 685 632 c[3] = ec.a[3]; 686 end ExpandableConnectors.Expandable1 6;687 ")}))); 688 end Expandable1 6;689 690 691 model Expandable1 7633 end ExpandableConnectors.Expandable14; 634 ")}))); 635 end Expandable14; 636 637 638 model Expandable15 692 639 expandable connector EC 693 640 C a; 694 641 end EC; 695 642 696 643 connector C 697 644 Real x; 698 645 Real y; 699 646 end C; 700 647 701 648 EC ec; 702 649 C c; … … 706 653 annotation(__JModelica(UnitTesting(tests={ 707 654 FlatteningTestCase( 708 name="Expandable1 7",655 name="Expandable15", 709 656 description="Expandable connector with members: composite", 710 657 flatModel=" 711 fclass ExpandableConnectors.Expandable1 7658 fclass ExpandableConnectors.Expandable15 712 659 Real ec.a.x; 713 660 Real ec.a.y; … … 717 664 c.x = ec.a.x; 718 665 c.y = ec.a.y; 719 end ExpandableConnectors.Expandable1 7;720 ")}))); 721 end Expandable1 7;722 723 724 model Expandable1 8666 end ExpandableConnectors.Expandable15; 667 ")}))); 668 end Expandable15; 669 670 671 model Expandable16 725 672 expandable connector EC 726 673 Real x; 727 674 end EC; 728 729 730 731 675 676 connector C = Real; 677 678 C c; 732 679 EC ec; 733 680 Real y; 734 681 equation 735 682 connect(c, ec.x); 736 683 y = ec.x; 737 684 738 685 annotation(__JModelica(UnitTesting(tests={ 739 686 FlatteningTestCase( 740 name="Expandable1 8",687 name="Expandable16", 741 688 description="Using member of expandable connector that is connected to", 742 689 flatModel=" 743 fclass ExpandableConnectors.Expandable1 8690 fclass ExpandableConnectors.Expandable16 744 691 Real c; 745 692 Real ec.x; … … 748 695 y = ec.x; 749 696 c = ec.x; 750 end ExpandableConnectors.Expandable1 8;751 ")}))); 752 end Expandable1 8;753 754 755 model Expandable1 9697 end ExpandableConnectors.Expandable16; 698 ")}))); 699 end Expandable16; 700 701 702 model Expandable17 756 703 expandable connector EC 757 704 Real x; … … 768 715 annotation(__JModelica(UnitTesting(tests={ 769 716 FlatteningTestCase( 770 name="Expandable1 9",717 name="Expandable17", 771 718 description="Using member of expandable connector that is connected to", 772 719 flatModel=" 773 fclass ExpandableConnectors.Expandable1 9720 fclass ExpandableConnectors.Expandable17 774 721 Real c; 775 722 Real ec.x; … … 777 724 equation 778 725 c = ec.x; 779 end ExpandableConnectors.Expandable1 9;780 ")}))); 781 end Expandable1 9;782 783 784 model Expandable 20726 end ExpandableConnectors.Expandable17; 727 ")}))); 728 end Expandable17; 729 730 731 model Expandable18 785 732 expandable connector EC 786 733 Real x; … … 801 748 annotation(__JModelica(UnitTesting(tests={ 802 749 FlatteningTestCase( 803 name="Expandable 20",750 name="Expandable18", 804 751 description="Using member of expandable connector that is connected to", 805 752 flatModel=" 806 fclass ExpandableConnectors.Expandable 20753 fclass ExpandableConnectors.Expandable18 807 754 Real c; 808 755 Real ec.x; … … 810 757 equation 811 758 c = ec.x; 759 end ExpandableConnectors.Expandable18; 760 ")}))); 761 end Expandable18; 762 763 764 model Expandable19 765 expandable connector EC1 766 Real x; 767 end EC1; 768 769 expandable connector EC2 770 end EC2; 771 772 connector C = Real; 773 774 C c; 775 EC1 ec1a, ec1b; 776 EC2 ec2; 777 Real y; 778 equation 779 connect(ec1a, ec1b); 780 connect(ec1b, ec2); 781 connect(c, ec2.x); 782 y = ec1b.x; 783 784 annotation(__JModelica(UnitTesting(tests={ 785 FlatteningTestCase( 786 name="Expandable19", 787 description="Using member of expandable connector that is connected to", 788 flatModel=" 789 fclass ExpandableConnectors.Expandable19 790 Real c; 791 Real ec1a.x; 792 Real ec1b.x; 793 Real ec2.x; 794 Real y; 795 equation 796 y = ec1b.x; 797 c = ec1a.x; 798 ec1a.x = ec1b.x; 799 ec1b.x = ec2.x; 800 end ExpandableConnectors.Expandable19; 801 ")}))); 802 end Expandable19; 803 804 805 model Expandable20 806 expandable connector EC1 807 Real x; 808 end EC1; 809 810 expandable connector EC2 811 end EC2; 812 813 connector C = Real; 814 815 C c; 816 EC1 ec1a, ec1b; 817 EC2 ec2; 818 Real y = ec1b.x; 819 equation 820 connect(ec1a, ec1b); 821 connect(ec1b, ec2); 822 connect(c, ec2.x); 823 824 annotation(__JModelica(UnitTesting(tests={ 825 FlatteningTestCase( 826 name="Expandable20", 827 description="Using member of expandable connector that is connected to", 828 flatModel=" 829 fclass ExpandableConnectors.Expandable20 830 Real c; 831 Real ec1a.x; 832 Real ec1b.x; 833 Real ec2.x; 834 Real y = ec1b.x; 835 equation 836 c = ec1a.x; 837 ec1a.x = ec1b.x; 838 ec1b.x = ec2.x; 812 839 end ExpandableConnectors.Expandable20; 813 840 ")}))); 814 841 end Expandable20; 815 816 842 843 817 844 model Expandable21 818 845 expandable connector EC1 819 846 Real x; 820 847 end EC1; 821 848 822 849 expandable connector EC2 823 850 end EC2; 824 825 connector C = Real; 826 851 852 model A 853 Real y; 854 end A; 855 856 connector C = Real; 857 827 858 C c; 828 859 EC1 ec1a, ec1b; 829 860 EC2 ec2; 830 Real y;861 A a(y = ec1b.x); 831 862 equation 832 863 connect(ec1a, ec1b); 833 864 connect(ec1b, ec2); 834 865 connect(c, ec2.x); 835 y = ec1b.x;836 866 837 867 annotation(__JModelica(UnitTesting(tests={ … … 845 875 Real ec1b.x; 846 876 Real ec2.x; 847 Real y; 848 equation 849 y = ec1b.x; 877 Real a.y = ec1b.x; 878 equation 850 879 c = ec1a.x; 851 880 ec1a.x = ec1b.x; … … 854 883 ")}))); 855 884 end Expandable21; 856 857 885 886 858 887 model Expandable22 859 expandable connector EC1 860 Real x; 861 end EC1; 862 863 expandable connector EC2 864 end EC2; 865 866 connector C = Real; 867 868 C c; 869 EC1 ec1a, ec1b; 870 EC2 ec2; 871 Real y = ec1b.x; 872 equation 873 connect(ec1a, ec1b); 874 connect(ec1b, ec2); 875 connect(c, ec2.x); 876 877 annotation(__JModelica(UnitTesting(tests={ 878 FlatteningTestCase( 879 name="Expandable22", 880 description="Using member of expandable connector that is connected to", 881 flatModel=" 882 fclass ExpandableConnectors.Expandable22 883 Real c; 884 Real ec1a.x; 885 Real ec1b.x; 886 Real ec2.x; 887 Real y = ec1b.x; 888 equation 889 c = ec1a.x; 890 ec1a.x = ec1b.x; 891 ec1b.x = ec2.x; 892 end ExpandableConnectors.Expandable22; 893 ")}))); 894 end Expandable22; 895 896 897 model Expandable23 898 expandable connector EC1 899 Real x; 900 end EC1; 901 902 expandable connector EC2 903 end EC2; 904 905 model A 906 Real y; 907 end A; 908 909 connector C = Real; 910 911 C c; 912 EC1 ec1a, ec1b; 913 EC2 ec2; 914 A a(y = ec1b.x); 915 equation 916 connect(ec1a, ec1b); 917 connect(ec1b, ec2); 918 connect(c, ec2.x); 919 920 annotation(__JModelica(UnitTesting(tests={ 921 FlatteningTestCase( 922 name="Expandable23", 923 description="Using member of expandable connector that is connected to", 924 flatModel=" 925 fclass ExpandableConnectors.Expandable23 926 Real c; 927 Real ec1a.x; 928 Real ec1b.x; 929 Real ec2.x; 930 Real a.y = ec1b.x; 931 equation 932 c = ec1a.x; 933 ec1a.x = ec1b.x; 934 ec1b.x = ec2.x; 935 end ExpandableConnectors.Expandable23; 936 ")}))); 937 end Expandable23; 938 939 940 model Expandable24 941 expandable connector EC 942 end EC; 943 944 connector C = Real; 945 888 expandable connector EC 889 end EC; 890 891 connector C = Real; 892 946 893 EC ec; 947 894 C c; … … 951 898 annotation(__JModelica(UnitTesting(tests={ 952 899 FlatteningTestCase( 953 name="Expandable2 4",900 name="Expandable22", 954 901 description="Expandable connectors: Connecting to only some elements of array", 955 902 flatModel=" 956 fclass ExpandableConnectors.Expandable2 4903 fclass ExpandableConnectors.Expandable22 957 904 Real ec.x[2]; 958 905 Real c; … … 960 907 c = ec.x[2]; 961 908 ec.x[1] = 0.0; 962 end ExpandableConnectors.Expandable2 4;963 ")}))); 964 end Expandable2 4;965 966 967 model Expandable25 909 end ExpandableConnectors.Expandable22; 910 ")}))); 911 end Expandable22; 912 913 914 model Expandable23 968 915 expandable connector EC 969 916 Real x[3]; 970 917 end EC; 971 972 973 974 975 976 977 978 979 annotation(__JModelica(UnitTesting(tests={ 980 FlatteningTestCase( 981 name="Expandable2 5",918 919 connector C = Real; 920 921 EC ec; 922 C c; 923 equation 924 connect(c, ec.x[2]); 925 926 annotation(__JModelica(UnitTesting(tests={ 927 FlatteningTestCase( 928 name="Expandable23", 982 929 description="Expandable connectors: Connecting to only some elements of array", 983 930 flatModel=" 984 fclass ExpandableConnectors.Expandable2 5931 fclass ExpandableConnectors.Expandable23 985 932 Real ec.x[3]; 986 933 Real c; … … 989 936 ec.x[1] = 0.0; 990 937 ec.x[3] = 0.0; 991 end ExpandableConnectors.Expandable2 5;992 ")}))); 993 end Expandable25;938 end ExpandableConnectors.Expandable23; 939 ")}))); 940 end Expandable23; 994 941 995 942 996 model Expandable2 6997 expandable connector EC 998 end EC; 999 943 model Expandable24 944 expandable connector EC 945 end EC; 946 1000 947 connector C 1001 948 Real x; 1002 949 Real y; 1003 950 end C; 1004 951 1005 952 EC ec; 1006 953 C c; … … 1010 957 annotation(__JModelica(UnitTesting(tests={ 1011 958 FlatteningTestCase( 1012 name="Expandable2 6",959 name="Expandable24", 1013 960 description="Expandable connectors: Connecting to only some elements of array", 1014 961 flatModel=" 1015 fclass ExpandableConnectors.Expandable2 6962 fclass ExpandableConnectors.Expandable24 1016 963 Real ec.x[1].x; 1017 964 Real ec.x[1].y; … … 1025 972 ec.x[1].x = 0.0; 1026 973 ec.x[1].y = 0.0; 1027 end ExpandableConnectors.Expandable2 6;1028 ")}))); 1029 end Expandable2 6;1030 1031 1032 model Expandable2 7974 end ExpandableConnectors.Expandable24; 975 ")}))); 976 end Expandable24; 977 978 979 model Expandable25 1033 980 expandable connector EC 1034 981 C x[3]; 1035 982 end EC; 1036 983 1037 984 connector C 1038 1039 1040 1041 985 Real x; 986 Real y; 987 end C; 988 1042 989 EC ec; 1043 990 C c; … … 1047 994 annotation(__JModelica(UnitTesting(tests={ 1048 995 FlatteningTestCase( 1049 name="Expandable2 7",996 name="Expandable25", 1050 997 description="Expandable connectors: Connecting to only some elements of array", 1051 998 flatModel=" 1052 fclass ExpandableConnectors.Expandable2 7999 fclass ExpandableConnectors.Expandable25 1053 1000 Real ec.x[1].x; 1054 1001 Real ec.x[1].y; … … 1066 1013 ec.x[3].x = 0.0; 1067 1014 ec.x[3].y = 0.0; 1068 end ExpandableConnectors.Expandable2 7;1069 ")}))); 1070 end Expandable2 7;1071 1072 1073 model Expandable2 81015 end ExpandableConnectors.Expandable25; 1016 ")}))); 1017 end Expandable25; 1018 1019 1020 model Expandable26 1074 1021 expandable connector EC1 1075 1022 EC2 ec2; 1076 1023 end EC1; 1077 1024 1078 1025 expandable connector EC2 1079 1026 end EC2; 1080 1081 1082 1083 1027 1028 connector C = Real; 1029 1030 EC1 ec1; 1084 1031 C c; 1085 1086 1087 1088 annotation(__JModelica(UnitTesting(tests={ 1089 FlatteningTestCase( 1090 name="Expandable2 8",1032 equation 1033 connect(c, ec1.ec2.a); 1034 1035 annotation(__JModelica(UnitTesting(tests={ 1036 FlatteningTestCase( 1037 name="Expandable26", 1091 1038 description="Nested declared expandable connectors: basic test", 1092 1039 flatModel=" 1093 fclass ExpandableConnectors.Expandable2 81040 fclass ExpandableConnectors.Expandable26 1094 1041 Real ec1.ec2.a; 1095 1042 Real c; 1096 1043 equation 1097 1044 c = ec1.ec2.a; 1098 end ExpandableConnectors.Expandable2 8;1099 ")}))); 1100 end Expandable28;1101 1102 1103 model Expandable 301045 end ExpandableConnectors.Expandable26; 1046 ")}))); 1047 end Expandable26; 1048 1049 1050 model Expandable27 1104 1051 expandable connector EC1 1105 1052 C1 c1; 1106 1053 end EC1; 1107 1054 1108 1055 connector C1 1109 1056 EC2 ec2; 1110 1057 Real x; 1111 1058 end C1; 1112 1059 1113 1060 expandable connector EC2 1114 1061 end EC2; 1115 1062 1116 1063 connector C2 = Real; 1117 1064 1118 1065 EC1 ec1; 1119 1066 C2 c2; … … 1121 1068 annotation(__JModelica(UnitTesting(tests={ 1122 1069 FlatteningTestCase( 1123 name="Expandable 30",1070 name="Expandable27", 1124 1071 description="Nested declared expandable connectors: not connected to", 1125 1072 flatModel=" 1126 fclass ExpandableConnectors.Expandable 301073 fclass ExpandableConnectors.Expandable27 1127 1074 Real c2; 1128 end ExpandableConnectors.Expandable 30;1129 ")}))); 1130 end Expandable 30;1131 1132 1133 model Expandable 311075 end ExpandableConnectors.Expandable27; 1076 ")}))); 1077 end Expandable27; 1078 1079 1080 model Expandable28 1134 1081 expandable connector EC1 1135 1082 EC2 ec2; 1136 1083 end EC1; 1137 1084 1138 1085 expandable connector EC2 1139 1086 EC3 ec3; 1140 1087 end EC2; 1141 1088 1142 1089 expandable connector EC3 1143 1090 end EC3; 1144 1145 connector C = Real; 1146 1091 1092 connector C = Real; 1093 1147 1094 EC1 ec1; 1148 1095 C c; … … 1152 1099 annotation(__JModelica(UnitTesting(tests={ 1153 1100 FlatteningTestCase( 1154 name="Expandable 31",1101 name="Expandable28", 1155 1102 description="Nested declared expandable connectors: three deep", 1156 1103 flatModel=" 1157 fclass ExpandableConnectors.Expandable 311104 fclass ExpandableConnectors.Expandable28 1158 1105 Real ec1.ec2.ec3.a; 1159 1106 Real c; 1160 1107 equation 1161 1108 c = ec1.ec2.ec3.a; 1162 end ExpandableConnectors.Expandable 31;1163 ")}))); 1164 end Expandable 31;1165 1166 1167 model Expandable 321109 end ExpandableConnectors.Expandable28; 1110 ")}))); 1111 end Expandable28; 1112 1113 1114 model Expandable29 1168 1115 expandable connector EC1 1169 1116 EC2 ec2; 1170 1117 end EC1; 1171 1118 1172 1119 expandable connector EC2 1173 1120 end EC2; 1174 1175 connector C = Real; 1176 1121 1122 connector C = Real; 1123 1177 1124 EC1 ec1; 1178 1125 C c1, c2; … … 1183 1130 annotation(__JModelica(UnitTesting(tests={ 1184 1131 FlatteningTestCase( 1185 name="Expandable 32",1132 name="Expandable29", 1186 1133 description="Nested declared expandable connectors: adding members to both levels", 1187 1134 flatModel=" 1188 fclass ExpandableConnectors.Expandable 321135 fclass ExpandableConnectors.Expandable29 1189 1136 Real ec1.b; 1190 1137 Real ec1.ec2.a; … … 1194 1141 c1 = ec1.ec2.a; 1195 1142 c2 = ec1.b; 1196 end ExpandableConnectors.Expandable 32;1197 ")}))); 1198 end Expandable 32;1199 1200 1201 model Expandable3 31143 end ExpandableConnectors.Expandable29; 1144 ")}))); 1145 end Expandable29; 1146 1147 1148 model Expandable30 1202 1149 expandable connector EC1 1203 1150 EC2 a; 1204 1151 end EC1; 1205 1152 1206 1153 expandable connector EC2 1207 1154 end EC2; 1208 1209 connector C = Real; 1210 1155 1156 connector C = Real; 1157 1211 1158 EC1 ec1_1, ec1_2; 1212 1159 EC2 ec2_1, ec2_2; … … 1221 1168 annotation(__JModelica(UnitTesting(tests={ 1222 1169 FlatteningTestCase( 1223 name="Expandable3 3",1170 name="Expandable30", 1224 1171 description="Connect expandable connectors containing other expandable connectors", 1225 1172 flatModel=" 1226 fclass ExpandableConnectors.Expandable3 31173 fclass ExpandableConnectors.Expandable30 1227 1174 Real ec1_1.a.b; 1228 1175 Real ec1_1.a.c; … … 1244 1191 ec1_2.a.c = ec2_1.c; 1245 1192 ec2_1.c = ec2_2.c; 1246 end ExpandableConnectors.Expandable3 3;1247 ")}))); 1248 end Expandable3 3;1249 1250 1251 model Expandable3 41252 expandable connector EC 1253 end EC; 1254 1255 connector C = Real; 1256 1193 end ExpandableConnectors.Expandable30; 1194 ")}))); 1195 end Expandable30; 1196 1197 1198 model Expandable31 1199 expandable connector EC 1200 end EC; 1201 1202 connector C = Real; 1203 1257 1204 model A 1258 1205 EC ec; 1259 1206 end A; 1260 1207 1261 1208 A a; 1262 1209 EC ec; … … 1269 1216 annotation(__JModelica(UnitTesting(tests={ 1270 1217 FlatteningTestCase( 1271 name="Expandable3 4",1218 name="Expandable31", 1272 1219 description="Make sure that extra equations aren't added for combinations of inner/outer connections", 1273 1220 flatModel=" 1274 fclass ExpandableConnectors.Expandable3 41221 fclass ExpandableConnectors.Expandable31 1275 1222 Real a.ec.b1[2]; 1276 1223 Real a.ec.b2[2]; … … 1288 1235 a.ec.b2[2] = c2[2]; 1289 1236 c2[2] = ec.b2[2]; 1290 end ExpandableConnectors.Expandable34; 1291 ")}))); 1292 end Expandable34; 1293 1294 1295 model Expandable35 1296 connector C = Real; 1297 1298 expandable connector EC 1299 C x; 1300 end EC; 1301 1302 EC ec1, ec2; 1303 C x = time; 1304 equation 1305 connect(ec1.x, ec2.x); 1306 connect(ec1.x, x); 1307 1308 annotation(__JModelica(UnitTesting(tests={ 1309 FlatteningTestCase( 1310 name="Expandable35", 1311 description="Connecting two declared members of expandable connectors", 1312 flatModel=" 1313 fclass ExpandableConnectors.Expandable35 1314 Real ec1.x; 1315 Real ec2.x; 1316 Real x = time; 1317 equation 1318 ec1.x = ec2.x; 1319 ec2.x = x; 1320 end ExpandableConnectors.Expandable35; 1321 ")}))); 1322 end Expandable35; 1323 1324 1325 model Expandable36 1237 end ExpandableConnectors.Expandable31; 1238 ")}))); 1239 end Expandable31; 1240 1241 model Expandable32 1326 1242 connector C = Real[2]; 1327 1328 expandable connector EC 1329 end EC; 1330 1243 1244 expandable connector EC 1245 end EC; 1246 1331 1247 EC ec1, ec2; 1332 1248 C x = { time, 2 * time }; … … 1337 1253 annotation(__JModelica(UnitTesting(tests={ 1338 1254 FlatteningTestCase( 1339 name="Expandable3 6",1255 name="Expandable32", 1340 1256 description="Array in nested expandable connector", 1341 1257 flatModel=" 1342 fclass ExpandableConnectors.Expandable3 61343 ExpandableConnectors.Expandable3 6.C ec1.x[2];1344 ExpandableConnectors.Expandable3 6.C ec2.ec.x[2];1345 ExpandableConnectors.Expandable3 6.C x[2] = {time, 2 * time};1258 fclass ExpandableConnectors.Expandable32 1259 ExpandableConnectors.Expandable32.C ec1.x[2]; 1260 ExpandableConnectors.Expandable32.C ec2.ec.x[2]; 1261 ExpandableConnectors.Expandable32.C x[2] = {time, 2 * time}; 1346 1262 equation 1347 1263 ec1.x[1] = ec2.ec.x[1]; … … 1351 1267 1352 1268 public 1353 type ExpandableConnectors.Expandable36.C = Real; 1354 end ExpandableConnectors.Expandable36; 1355 ")}))); 1356 end Expandable36; 1357 1358 model Expandable37 1269 type ExpandableConnectors.Expandable32.C = Real; 1270 end ExpandableConnectors.Expandable32; 1271 ")}))); 1272 end Expandable32; 1273 1274 1275 model Expandable33 1359 1276 expandable connector EC 1360 1277 end EC; … … 1362 1279 EC ec1; 1363 1280 C c1; 1281 1364 1282 equation 1365 1283 connect(c1, ec1.a) annotation (Line( … … 1371 1289 annotation(__JModelica(UnitTesting(tests={ 1372 1290 FlatteningTestCase( 1373 name="Expandable3 7",1291 name="Expandable33", 1374 1292 description="Test expandable connector and connect equation with annotation, caused crash bug", 1375 1293 flatModel=" 1376 fclass ExpandableConnectors.Expandable3 71294 fclass ExpandableConnectors.Expandable33 1377 1295 Real ec1.a; 1378 1296 Real c1; … … 1380 1298 c1 = time; 1381 1299 c1 = ec1.a; 1382 end ExpandableConnectors.Expandable37; 1383 ")}))); 1384 end Expandable37; 1385 1386 1387 1300 end ExpandableConnectors.Expandable33; 1301 ")}))); 1302 end Expandable33; 1303 1304 1305 model ExpandableWithInputOutput1 1306 connector CI = input Real; 1307 connector CO = output Real; 1308 connector C = Real; 1309 1310 expandable connector EC 1311 end EC; 1312 1313 EC ec; 1314 CI ci1; 1315 CO co1; 1316 input C ci2; 1317 output C co2; 1318 equation 1319 connect(ci1, ec.ci1); 1320 connect(ci2, ec.ci2); 1321 connect(co1, ec.co1); 1322 connect(co2, ec.co2); 1323 1324 annotation(__JModelica(UnitTesting(tests={ 1325 FlatteningTestCase( 1326 name="ExpandableWithInputOutput1", 1327 description="Created variables in expandable connectors shouldn't be considered toplevel input/outputs", 1328 flatModel=" 1329 fclass ExpandableConnectors.ExpandableWithInputOutput1 1330 ExpandableConnectors.ExpandableWithInputOutput1.CI ec.ci1; 1331 Real ec.ci2; 1332 ExpandableConnectors.ExpandableWithInputOutput1.CO ec.co1; 1333 Real ec.co2; 1334 input ExpandableConnectors.ExpandableWithInputOutput1.CI ci1; 1335 output ExpandableConnectors.ExpandableWithInputOutput1.CO co1; 1336 input Real ci2; 1337 output Real co2; 1338 equation 1339 ci1 = ec.ci1; 1340 ci2 = ec.ci2; 1341 co1 = ec.co1; 1342 co2 = ec.co2; 1343 1344 public 1345 type ExpandableConnectors.ExpandableWithInputOutput1.CI = Real; 1346 type ExpandableConnectors.ExpandableWithInputOutput1.CO = Real; 1347 end ExpandableConnectors.ExpandableWithInputOutput1; 1348 ")}))); 1349 end ExpandableWithInputOutput1; 1350 1351 1352 model FlowInExpandable1 1353 connector C 1354 Real p; 1355 flow Real f; 1356 end C; 1357 1358 expandable connector EC 1359 end EC; 1360 1361 model A 1362 B b; 1363 EC ec; 1364 equation 1365 connect(b.c, ec.c); 1366 end A; 1367 1368 model B 1369 C c; 1370 end B; 1371 1372 A a; 1373 B b; 1374 EC ec; 1375 equation 1376 connect(a.ec, ec); 1377 connect(b.c, ec.c); 1378 1379 annotation(__JModelica(UnitTesting(tests={ 1380 FlatteningTestCase( 1381 name="FlowInExpandable1", 1382 description="Check that flow variables in expandable connectors get zero equations as needed", 1383 flatModel=" 1384 fclass ExpandableConnectors.FlowInExpandable1 1385 Real a.b.c.p; 1386 Real a.b.c.f; 1387 Real a.ec.c.p; 1388 Real a.ec.c.f; 1389 Real b.c.p; 1390 Real b.c.f; 1391 Real ec.c.p; 1392 Real ec.c.f; 1393 equation 1394 a.b.c.f  a.ec.c.f = 0.0; 1395 a.ec.c.f + b.c.f  ec.c.f = 0.0; 1396 a.ec.c.p = b.c.p; 1397 b.c.p = ec.c.p; 1398 a.b.c.p = a.ec.c.p; 1399 ec.c.f = 0.0; 1400 end ExpandableConnectors.FlowInExpandable1; 1401 ")}))); 1402 end FlowInExpandable1; 1403 1404 1405 package Error 1406 1388 1407 model ExpandableErr1 1389 1408 expandable connector EC 1390 1409 end EC; 1391 1392 connector C = Real; 1393 1410 1411 connector C = Real; 1412 1394 1413 EC ec1; 1395 1414 C c[3]; … … 1408 1427 ")}))); 1409 1428 end ExpandableErr1; 1410 1411 1429 1430 1412 1431 model ExpandableErr2 1413 1432 expandable connector EC 1414 1433 end EC; 1415 1434 1416 1435 connector C = Real; 1417 1436 … … 1432 1451 ")}))); 1433 1452 end ExpandableErr2; 1434 1435 1453 1454 1436 1455 model ExpandableErr3 1437 1456 expandable connector EC 1438 1457 end EC; 1439 1440 connector C = Real; 1441 1458 1459 connector C = Real; 1460 1442 1461 EC ec1; 1443 1462 C c[3,3]; … … 1456 1475 ")}))); 1457 1476 end ExpandableErr3; 1458 1459 1477 1478 1460 1479 model ExpandableErr3b 1461 1480 expandable connector EC 1462 1481 end EC; 1463 1464 connector C = Real; 1465 1482 1483 connector C = Real; 1484 1466 1485 EC ec1; 1467 1486 C c[3,3]; … … 1480 1499 ")}))); 1481 1500 end ExpandableErr3b; 1482 1483 1501 1502 1484 1503 model ExpandableErr4 1485 1504 expandable connector EC 1486 1505 end EC; 1487 1488 connector C = Real; 1489 1506 1507 connector C = Real; 1508 1490 1509 EC ec1; 1491 1510 C c1[3], c2; … … 1505 1524 ")}))); 1506 1525 end ExpandableErr4; 1507 1508 1526 1527 1509 1528 model ExpandableErr5 1510 1529 expandable connector EC 1511 1530 end EC; 1512 1513 connector C = Real; 1514 1531 1532 connector C = Real; 1533 1515 1534 EC ec1; 1516 1535 C c1[3], c2; … … 1530 1549 ")}))); 1531 1550 end ExpandableErr5; 1532 1533 1551 1552 1534 1553 model ExpandableErr6 1535 1554 expandable connector EC 1536 1555 end EC; 1537 1538 connector C = Real; 1539 1556 1557 connector C = Real; 1558 1540 1559 EC ec1; 1541 1560 C c1[3], c2; … … 1555 1574 ")}))); 1556 1575 end ExpandableErr6; 1557 1558 1576 1577 1559 1578 model ExpandableErr7 1560 1579 expandable connector EC 1561 1580 end EC; 1562 1563 connector C = Real; 1564 1581 1582 connector C = Real; 1583 1565 1584 EC ec1; 1566 1585 C c1[3], c2; … … 1580 1599 ")}))); 1581 1600 end ExpandableErr7; 1582 1583 1601 1602 1584 1603 model ExpandableErr8 1585 1604 expandable connector EC 1586 1605 end EC; 1587 1588 connector C = Real; 1589 1606 1607 connector C = Real; 1608 1590 1609 EC ec1; 1591 1610 C c1[3], c2[4]; … … 1605 1624 ")}))); 1606 1625 end ExpandableErr8; 1607 1608 1609 1610 expandable connector EC 1611 end EC; 1612 1626 1627 1628 model ExpandableErr9 1629 expandable connector EC 1630 end EC; 1631 1613 1632 connector C1 1614 1633 Real x; 1615 1634 end C1; 1616 1635 1617 1636 connector C2 1618 1637 Real y; 1619 1638 end C2; 1620 1639 1621 1640 EC ec; 1622 1641 C1 c1; 1623 1624 1642 C2 c2; 1643 equation 1625 1644 connect(c1, ec.a); 1626 1645 connect(c2, ec.a); … … 1636 1655 Type of component introduced to external connector does not match other connections to same name in connection set or component declared in connector 1637 1656 ")}))); 1638 1639 1640 1657 end ExpandableErr9; 1658 1659 1641 1660 model ExpandableErr10 1642 1661 expandable connector EC 1643 1662 end EC; 1644 1663 1645 1664 connector C1 = Real; 1646 1665 1647 1666 connector C2 = Boolean; 1648 1667 1649 1668 EC ec; 1650 1669 C1 c1; … … 1665 1684 ")}))); 1666 1685 end ExpandableErr10; 1667 1668 1686 1687 1669 1688 model ExpandableErr11 1670 1689 expandable connector EC 1671 1690 Real a; 1672 1691 end EC; 1673 1692 1674 1693 connector C = Boolean; 1675 1694 1676 1695 EC ec; 1677 1696 C c; … … 1690 1709 ")}))); 1691 1710 end ExpandableErr11; 1692 1693 1711 1712 1694 1713 model ExpandableErr12 1695 1714 expandable connector EC 1696 1715 Real a[3]; 1697 1716 end EC; 1698 1699 connector C = Real; 1700 1717 1718 connector C = Real; 1719 1701 1720 EC ec; 1702 1721 C c[3]; … … 1715 1734 ")}))); 1716 1735 end ExpandableErr12; 1717 1718 1736 1737 1719 1738 model ExpandableErr13 1720 1739 expandable connector EC1 1721 1740 Real a; 1722 1741 end EC1; 1723 1742 1724 1743 expandable connector EC2 1725 1744 end EC2; 1726 1745 1727 1746 connector C = Boolean; 1728 1747 1729 1748 EC1 ec1; 1730 1749 EC2 ec2; … … 1745 1764 ")}))); 1746 1765 end ExpandableErr13; 1747 1748 1766 1767 1749 1768 model ExpandableErr14 1750 1769 expandable connector EC1 1751 1770 Real a; 1752 1771 end EC1; 1753 1772 1754 1773 expandable connector EC2 1755 1774 Boolean a; 1756 1775 end EC2; 1757 1776 1758 1777 EC1 ec1; 1759 1778 EC2 ec2; … … 1772 1791 ")}))); 1773 1792 end ExpandableErr14; 1774 1775 1793 1794 1776 1795 model ExpandableErr15 1777 1796 expandable connector EC1 1778 1797 Real a[3]; 1779 1798 end EC1; 1780 1799 1781 1800 expandable connector EC2 1782 1801 Real a[4]; 1783 1802 end EC2; 1784 1803 1785 1804 EC1 ec1; 1786 1805 EC2 ec2; … … 1799 1818 ")}))); 1800 1819 end ExpandableErr15; 1801 1802 1820 1821 1803 1822 model ExpandableErr16 1804 1823 expandable connector EC1 1805 1824 Real a; 1806 1825 end EC1; 1807 1826 1808 1827 expandable connector EC2 1809 1828 end EC2; 1810 1829 1811 1830 expandable connector EC3 1812 1831 Boolean a; 1813 1832 end EC3; 1814 1815 connector C = Real; 1816 1833 1834 connector C = Real; 1835 1817 1836 EC1 ec1; 1818 1837 EC2 ec2; 1819 1838 EC3 ec3; 1820 1839 C c; 1821 1840 equation 1822 1841 connect(ec1, ec2); 1823 1842 connect(ec2, ec3); 1824 1843 connect(c, ec1.a); 1825 1844 1826 1845 annotation(__JModelica(UnitTesting(tests={ … … 1835 1854 ")}))); 1836 1855 end ExpandableErr16; 1837 1838 1856 1857 1839 1858 model ExpandableErr17 1840 1859 expandable connector EC1 1841 1860 Real a[3]; 1842 1861 end EC1; 1843 1862 1844 1863 expandable connector EC2 1845 1864 end EC2; 1846 1865 1847 1866 expandable connector EC3 1848 1867 Real a[4]; 1849 1868 end EC3; 1850 1851 connector C = Real; 1852 1869 1870 connector C = Real; 1871 1853 1872 EC1 ec1; 1854 1873 EC2 ec2; … … 1871 1890 ")}))); 1872 1891 end ExpandableErr17; 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1892 1893 1894 model ExpandableErr18 1895 expandable connector EC 1896 Real x; 1897 end EC; 1898 1899 connector C 1900 Real x; 1901 end C; 1902 1903 EC ec; 1904 C c; 1905 equation 1906 connect(ec, c); 1888 1907 1889 1908 annotation(__JModelica(UnitTesting(tests={ … … 1894 1913 1 errors found: 1895 1914 1896 Error at line 13, column 3, in file 'Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo', CONNECT_EXPANDABLE_AND_NON_EXPANDABLE_TYPE:1915 Error at line 13, column 9, in file 'Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo', CONNECT_EXPANDABLE_AND_NON_EXPANDABLE_TYPE: 1897 1916 Connecting an expandable connector to a nonexpandable connector is not allowed 1898 1917 ")}))); 1899 1900 1901 1918 end ExpandableErr18; 1919 1920 1902 1921 model ExpandableErr19 1903 1922 expandable connector EC … … 1921 1940 ")}))); 1922 1941 end ExpandableErr19; 1923 1924 1942 1943 1925 1944 model ExpandableErr20 1926 1945 expandable connector EC … … 1942 1961 ")}))); 1943 1962 end ExpandableErr20; 1944 1945 1963 1964 1946 1965 model ExpandableErr21 1947 1966 expandable connector EC 1948 1967 Real x; 1949 1968 end EC; 1950 1951 1952 1953 1954 1969 1970 model A 1971 Real y; 1972 end A; 1973 1955 1974 EC ec; 1956 1975 A a(y = ec.x); … … 1968 1987 end ExpandableErr21; 1969 1988 1989 1970 1990 model ExpandableErr22 1971 1991 connector A 1972 1992 Real x; 1973 1993 end A; 1974 1994 1975 1995 connector B 1976 1996 Real x; 1977 1997 Real y; 1978 1998 end B; 1979 1999 1980 2000 expandable connector C 1981 2001 end C; … … 2002 2022 2003 2023 2004 model ExpandableCompliance3 2005 expandable connector EC 2006 end EC; 2007 2008 connector C = Real; 2009 2024 end Error; 2025 2026 2027 2028 package Compliance 2029 2030 model ExpandableCompliance1 2031 expandable connector EC 2032 end EC; 2033 2034 connector C = Real; 2035 2010 2036 EC ec; 2011 2012 2037 C c; 2038 equation 2013 2039 connect(c, ec.a1.a2); 2014 2040 connect(ec.b1.b2, c); 2015 2041 2016 2042 annotation(__JModelica(UnitTesting(tests={ 2017 2043 ComplianceErrorTestCase( 2018 name="ExpandableCompliance 3",2044 name="ExpandableCompliance1", 2019 2045 description="Nested expandable connectors: connecting with more than one unknown name", 2020 2046 errorMessage=" … … 2024 2050 Nested expandable connectors where some of the intermediate expandable connectors are neither connected to or declared are not supported 2025 2051 2026 Compliance error at line 11, column 1 1, in file 'Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo':2052 Compliance error at line 11, column 17, in file 'Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo': 2027 2053 Nested expandable connectors where some of the intermediate expandable connectors are neither connected to or declared are not supported 2028 2054 ")}))); 2029 end ExpandableCompliance 3;2030 2031 2032 model ExpandableCompliance 42033 expandable connector EC 2034 end EC; 2035 2055 end ExpandableCompliance1; 2056 2057 2058 model ExpandableCompliance2 2059 expandable connector EC 2060 end EC; 2061 2036 2062 connector C 2037 2063 EC ec; 2038 2064 end C; 2039 2065 2040 2066 EC ec; 2041 2067 C c; … … 2045 2071 annotation(__JModelica(UnitTesting(tests={ 2046 2072 ComplianceErrorTestCase( 2047 name="ExpandableCompliance 4",2073 name="ExpandableCompliance2", 2048 2074 description="Adding normal connector containing expandable connector to expandable connector", 2049 2075 errorMessage=" … … 2053 2079 Expandable connectors containing a nonexpandable connector component, that in turn contains an expandable connector, is not supported 2054 2080 ")}))); 2055 end ExpandableCompliance4; 2056 2081 end ExpandableCompliance2; 2082 2083 end Compliance; 2084 2085 2086 2087 package Nested 2057 2088 2058 2089 model NestedExpandable1 2059 2090 expandable connector EC 2060 2091 end EC; 2061 2062 connector C = Real; 2063 2092 2093 connector C = Real; 2094 2064 2095 EC ec1; 2065 2096 EC ec2; … … 2074 2105 description="Adding expandable connector member to expandable connector, member of parent first", 2075 2106 flatModel=" 2076 fclass ExpandableConnectors.Nested Expandable12107 fclass ExpandableConnectors.Nested.NestedExpandable1 2077 2108 Real ec1.sub1.c; 2078 2109 Real ec2.c; … … 2081 2112 c = ec1.sub1.c; 2082 2113 ec1.sub1.c = ec2.c; 2083 end ExpandableConnectors.Nested Expandable1;2114 end ExpandableConnectors.Nested.NestedExpandable1; 2084 2115 ")}))); 2085 2116 end NestedExpandable1; … … 2089 2120 expandable connector EC 2090 2121 end EC; 2091 2092 connector C = Real; 2093 2122 2123 connector C = Real; 2124 2094 2125 EC ec1; 2095 2126 EC ec2; … … 2104 2135 description="Adding expandable connector member to expandable connector, member of child first", 2105 2136 flatModel=" 2106 fclass ExpandableConnectors.Nested Expandable22137 fclass ExpandableConnectors.Nested.NestedExpandable2 2107 2138 Real ec1.sub1.c; 2108 2139 Real ec2.c; … … 2111 2142 c = ec1.sub1.c; 2112 2143 ec1.sub1.c = ec2.c; 2113 end ExpandableConnectors.Nested Expandable2;2144 end ExpandableConnectors.Nested.NestedExpandable2; 2114 2145 ")}))); 2115 2146 end NestedExpandable2; … … 2119 2150 expandable connector EC 2120 2151 end EC; 2121 2122 connector C = Real; 2123 2152 2153 connector C = Real; 2154 2124 2155 EC ec1_1, ec1_2; 2125 2156 EC ec2_1, ec2_2; … … 2137 2168 description="Adding expandable connector member to expandable connector, more complicated test", 2138 2169 flatModel=" 2139 fclass ExpandableConnectors.Nested Expandable32170 fclass ExpandableConnectors.Nested.NestedExpandable3 2140 2171 Real ec1_1.a.b; 2141 2172 Real ec1_1.a.c; … … 2157 2188 ec1_2.a.c = ec2_1.c; 2158 2189 ec2_1.c = ec2_2.c; 2159 end ExpandableConnectors.Nested Expandable3;2190 end ExpandableConnectors.Nested.NestedExpandable3; 2160 2191 ")}))); 2161 2192 end NestedExpandable3; … … 2165 2196 expandable connector EC 2166 2197 end EC; 2167 2198 2168 2199 connector C = Real; 2169 2200 … … 2180 2211 description="Adding expandable connector member to expandable connector, several levels", 2181 2212 flatModel=" 2182 fclass ExpandableConnectors.Nested Expandable42213 fclass ExpandableConnectors.Nested.NestedExpandable4 2183 2214 Real ec1.ec2.ec3.a; 2184 2215 Real ec2.ec3.a; … … 2189 2220 ec1.ec2.ec3.a = ec2.ec3.a; 2190 2221 ec2.ec3.a = ec3.a; 2191 end ExpandableConnectors.Nested Expandable4;2222 end ExpandableConnectors.Nested.NestedExpandable4; 2192 2223 ")}))); 2193 2224 end NestedExpandable4; … … 2197 2228 expandable connector EC 2198 2229 end EC; 2199 2200 connector C = Real; 2201 2230 2231 connector C = Real; 2232 2202 2233 EC ec1, ec2, ec3; 2203 2234 C c; … … 2212 2243 description="Adding expandable connector member to expandable connector, several levels, members first", 2213 2244 flatModel=" 2214 fclass ExpandableConnectors.Nested Expandable52245 fclass ExpandableConnectors.Nested.NestedExpandable5 2215 2246 Real ec1.ec2.ec3.a; 2216 2247 Real ec2.ec3.a; … … 2221 2252 ec1.ec2.ec3.a = ec2.ec3.a; 2222 2253 ec2.ec3.a = ec3.a; 2223 end ExpandableConnectors.Nested Expandable5;2254 end ExpandableConnectors.Nested.NestedExpandable5; 2224 2255 ")}))); 2225 2256 end NestedExpandable5; … … 2229 2260 expandable connector EC 2230 2261 end EC; 2231 2262 2232 2263 connector C1 2233 2264 C2 a; 2234 2265 end C1; 2235 2266 2236 2267 connector C2 = Real; 2237 2268 2238 2269 EC ec; 2239 2270 C1 c1; … … 2248 2279 description="Connecting to existing member of normal connector in expandable connector", 2249 2280 flatModel=" 2250 fclass ExpandableConnectors.Nested Expandable62281 fclass ExpandableConnectors.Nested.NestedExpandable6 2251 2282 Real ec.sub1.a; 2252 2283 Real c1.a; … … 2255 2286 c1.a = c2; 2256 2287 c2 = ec.sub1.a; 2257 end ExpandableConnectors.Nested Expandable6;2288 end ExpandableConnectors.Nested.NestedExpandable6; 2258 2289 ")}))); 2259 2290 end NestedExpandable6; … … 2263 2294 expandable connector EC 2264 2295 end EC; 2265 2296 2266 2297 connector C 2267 2298 Real p; 2268 2299 flow Real f; 2269 2300 end C; 2270 2301 2271 2302 EC ec1, ec2; 2272 2303 C c1[2], c2[2]; … … 2294 2325 expandable connector EC 2295 2326 end EC; 2296 2327 2297 2328 EC ec1, ec2, ec3; 2298 2329 equation … … 2339 2370 description="Same expandable connector added as nested connector in two separate expandable connectors", 2340 2371 flatModel=" 2341 fclass ExpandableConnectors.Nested Expandable92372 fclass ExpandableConnectors.Nested.NestedExpandable9 2342 2373 Real ec1.c3; 2343 2374 Real ec1.ec.c1; … … 2358 2389 ec2.ec.c2 = ec3.c2; 2359 2390 c3 = ec1.c3; 2360 end ExpandableConnectors.Nested Expandable9;2391 end ExpandableConnectors.Nested.NestedExpandable9; 2361 2392 ")}))); 2362 2393 end NestedExpandable9; … … 2368 2399 2369 2400 connector C = Real; 2370 2401 2371 2402 EC ec1, ec2, ec3, ec4, ec5; 2372 2403 C c1, c2, c3; … … 2385 2416 description="", 2386 2417 flatModel=" 2387 fclass ExpandableConnectors.Nested Expandable102418 fclass ExpandableConnectors.Nested.NestedExpandable10 2388 2419 Real ec1.c3; 2389 2420 Real ec1.ec.c1; … … 2416 2447 ec3.c2 = ec4.c2; 2417 2448 ec4.c2 = ec5.ec.c2; 2418 end ExpandableConnectors.Nested Expandable10;2449 end ExpandableConnectors.Nested.NestedExpandable10; 2419 2450 ")}))); 2420 2451 end NestedExpandable10; … … 2425 2456 EC2[1] ec2; 2426 2457 end EC1; 2427 2458 2428 2459 expandable connector EC2 2429 2460 end EC2; 2430 2431 connector C = Real; 2432 2461 2462 connector C = Real; 2463 2433 2464 EC1 ec1; 2434 2465 model M … … 2448 2479 description="Nested with for index on last part", 2449 2480 flatModel=" 2450 fclass ExpandableConnectors.Nested Expandable112481 fclass ExpandableConnectors.Nested.NestedExpandable11 2451 2482 Real ec1.ec2[1].a; 2452 2483 Real c; … … 2455 2486 c = ec1.ec2[1].a; 2456 2487 ec1.ec2[1].a = m[1].ec2.a; 2457 end ExpandableConnectors.Nested Expandable11;2488 end ExpandableConnectors.Nested.NestedExpandable11; 2458 2489 ")}))); 2459 2490 end NestedExpandable11; 2460 2491 2492 2493 package NestedError 2494 2461 2495 model NestedExpandableError1 2462 2496 expandable connector EC 2463 2497 end EC; 2464 2498 2465 2499 connector C1 2466 2500 C2 c2; 2467 2501 end C1; 2468 2502 2469 2503 connector C2 = Real; 2470 2504 2471 2505 EC ec; 2472 2506 C1 c1; … … 2492 2526 expandable connector EC 2493 2527 end EC; 2494 2528 2495 2529 connector C1 2496 2530 C2 c2; 2497 2531 end C1; 2498 2532 2499 2533 connector C2 2500 2534 C3 c3; 2501 2535 end C2; 2502 2536 2503 2537 connector C3 = Real; 2504 2538 2505 2539 EC ec; 2506 2540 C1 c1; … … 2522 2556 end NestedExpandableError2; 2523 2557 2524 model ArrayIndexationType1 2525 type E = enumeration(a,b,c); 2526 2527 expandable connector EC 2528 Real x[3]; 2529 Real y[Boolean]; 2530 Real z[E]; 2531 end EC; 2532 2533 connector A = Real; 2534 2535 EC ec; 2536 A a[3]; 2537 equation 2538 connect(a[1], ec.x[1]); 2539 connect(a[2], ec.y[true]); 2540 connect(a[3], ec.z[E.a]); 2541 2542 annotation(__JModelica(UnitTesting(tests={ 2543 FlatteningTestCase( 2544 name="ArrayIndexationType1", 2545 description="Indexing with enums and bools in expandable connector, declared.", 2546 flatModel=" 2547 fclass ExpandableConnectors.ArrayIndexationType1 2548 Real ec.x[3]; 2549 Real ec.y[2]; 2550 Real ec.z[3]; 2551 Real a[3]; 2552 equation 2553 a[1] = ec.x[1]; 2554 a[2] = ec.y[2]; 2555 a[3] = ec.z[1]; 2556 ec.x[2] = 0.0; 2557 ec.x[3] = 0.0; 2558 ec.y[1] = 0.0; 2559 ec.z[2] = 0.0; 2560 ec.z[3] = 0.0; 2561 2562 public 2563 type ExpandableConnectors.ArrayIndexationType1.E = enumeration(a, b, c); 2564 2565 end ExpandableConnectors.ArrayIndexationType1; 2566 ")}))); 2567 end ArrayIndexationType1; 2568 2569 model ArrayIndexationType2 2570 type E = enumeration(a,b,c); 2571 2572 expandable connector EC 2573 Real x[3]; 2574 Real y[Boolean]; 2575 Real z[E]; 2576 end EC; 2577 2578 connector A = Real; 2579 2580 EC ec; 2581 A a[6]; 2582 equation 2583 connect(a[1], ec.x[E.a]); 2584 connect(a[2], ec.x[true]); 2585 connect(a[3], ec.y[E.a]); 2586 connect(a[4], ec.y[1]); 2587 connect(a[5], ec.z[1]); 2588 connect(a[6], ec.z[true]); 2589 2590 annotation(__JModelica(UnitTesting(tests={ 2591 ErrorTestCase( 2592 name="ArrayIndexationType2", 2593 description="Indexing with enums and bools in expandable connector, declared.", 2594 errorMessage=" 2595 6 errors found: 2596 2597 Error at line 15, column 24, in file 'Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo': 2598 Expected array index of type 'Integer' found 'ExpandableConnectors.ArrayIndexationType2.E' 2599 2600 Error at line 16, column 24, in file 'Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo': 2601 Expected array index of type 'Integer' found 'Boolean' 2602 2603 Error at line 17, column 24, in file 'Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo': 2604 Expected array index of type 'Boolean' found 'ExpandableConnectors.ArrayIndexationType2.E' 2605 2606 Error at line 18, column 24, in file 'Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo': 2607 Expected array index of type 'Boolean' found 'Integer' 2608 2609 Error at line 19, column 24, in file 'Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo': 2610 Expected array index of type 'ExpandableConnectors.ArrayIndexationType2.E' found 'Integer' 2611 2612 Error at line 20, column 24, in file 'Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo': 2613 Expected array index of type 'ExpandableConnectors.ArrayIndexationType2.E' found 'Boolean' 2614 ")}))); 2615 end ArrayIndexationType2; 2616 2617 model ArrayIndexationType3 2618 type E = enumeration(a,b,c); 2619 2620 expandable connector EC 2621 end EC; 2622 2623 connector A = Real; 2624 2625 EC ec; 2626 A a[6]; 2627 equation 2628 connect(a[1], ec.x[1]); 2629 connect(a[2], ec.y[true]); 2630 connect(a[3], ec.z[E.a]); 2631 connect(a[4], ec.x[3]); 2632 connect(a[5], ec.y[false]); 2633 connect(a[6], ec.z[E.b]); 2634 2635 annotation(__JModelica(UnitTesting(tests={ 2636 FlatteningTestCase( 2637 name="ArrayIndexationType3", 2638 description="Indexing with enums and bools in expandable connector, undeclared.", 2639 flatModel=" 2640 fclass ExpandableConnectors.ArrayIndexationType3 2641 Real ec.x[3]; 2642 Real ec.y[2]; 2643 Real ec.z[2]; 2644 Real a[6]; 2645 equation 2646 a[1] = ec.x[1]; 2647 a[2] = ec.y[2]; 2648 a[3] = ec.z[1]; 2649 a[4] = ec.x[3]; 2650 a[5] = ec.y[1]; 2651 a[6] = ec.z[2]; 2652 ec.x[2] = 0.0; 2653 2654 public 2655 type ExpandableConnectors.ArrayIndexationType3.E = enumeration(a, b, c); 2656 2657 end ExpandableConnectors.ArrayIndexationType3; 2658 ")}))); 2659 end ArrayIndexationType3; 2660 2661 model ArrayIndexationType4 2662 type E = enumeration(a,b,c); 2663 2664 expandable connector EC 2665 end EC; 2666 2667 connector A = Real; 2668 2669 EC ec; 2670 A a[6]; 2671 equation 2672 connect(a[1], ec.x[E.a]); 2673 connect(a[2], ec.x[true]); 2674 connect(a[3], ec.y[E.a]); 2675 connect(a[4], ec.y[1]); 2676 connect(a[5], ec.z[1]); 2677 connect(a[6], ec.z[true]); 2678 2679 annotation(__JModelica(UnitTesting(tests={ 2680 ErrorTestCase( 2681 name="ArrayIndexationType4", 2682 description="Indexing with enums and bools in expandable connector, undeclared.", 2683 errorMessage=" 2684 3 errors found: 2685 2686 Error at line 13, column 5, in file 'Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo': 2687 Array index type of component introduced to external connector does not match other connections to same name in connection set 2688 2689 Error at line 15, column 5, in file 'Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo': 2690 Array index type of component introduced to external connector does not match other connections to same name in connection set 2691 2692 Error at line 17, column 5, in file 'Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo': 2693 Array index type of component introduced to external connector does not match other connections to same name in connection set 2694 ")}))); 2695 end ArrayIndexationType4; 2558 end NestedError; 2559 2560 end Nested; 2561 2696 2562 2697 2563 … … 2699 2565 expandable connector EC 2700 2566 end EC; 2701 2567 2702 2568 connector C = Real; 2703 2569 2704 2570 model A 2705 2571 extends D; … … 2709 2575 connect(b.c, ec.c); 2710 2576 end A; 2711 2577 2712 2578 model B 2713 2579 C c = time; 2714 2580 end B; 2715 2581 2716 2582 model D 2717 2583 EC ec; 2718 2584 end D; 2719 2585 2720 2586 A a; 2721 2587 … … 2738 2604 expandable connector EC 2739 2605 end EC; 2740 2606 2741 2607 connector C = Real; 2742 2608 2743 2609 model A 2744 2610 extends D; … … 2748 2614 connect(b.c, ec.c); 2749 2615 end A; 2750 2616 2751 2617 model B 2752 2618 C c = time; 2753 2619 end B; 2754 2620 2755 2621 model D 2756 2622 EC ec; … … 2759 2625 connect(b2.c, ec.c2); 2760 2626 end D; 2761 2627 2762 2628 A a; 2763 2629 … … 2779 2645 end DuplicatedExpandable2; 2780 2646 2647 2648 model AddToNestedAndConnectTopLevel 2649 expandable connector EC 2650 end EC; 2651 2652 expandable connector EC2 2653 EC ec; 2654 end EC2; 2655 2656 connector C = Real; 2657 2658 EC ec1; 2659 EC2 ec2; 2660 C c; 2661 equation 2662 connect(ec1, ec2); 2663 connect(ec2.ec.c, c); 2664 2665 annotation(__JModelica(UnitTesting(tests={ 2666 FlatteningTestCase( 2667 name="AddToNestedAndConnectTopLevel", 2668 description="Make sure that nested connectors that are only declared to work correctly.", 2669 flatModel=" 2670 fclass ExpandableConnectors.AddToNestedAndConnectTopLevel 2671 Real ec1.ec.c; 2672 Real ec2.ec.c; 2673 Real c; 2674 equation 2675 c = ec1.ec.c; 2676 ec1.ec.c = ec2.ec.c; 2677 end ExpandableConnectors.AddToNestedAndConnectTopLevel; 2678 ")}))); 2679 end AddToNestedAndConnectTopLevel; 2680 2681 2682 package ConnectorArrays 2781 2683 2782 2684 model ConnectorArray1 … … 2800 2702 description="Connecting to array of connectors", 2801 2703 flatModel=" 2802 fclass ExpandableConnectors.ConnectorArray 12704 fclass ExpandableConnectors.ConnectorArrays.ConnectorArray1 2803 2705 input Real c[1].a[1]; 2804 2706 input Real c[1].b; … … 2813 2715 ec.x.a[1:1] = zeros(1); 2814 2716 ec.x.b = 0.0; 2815 end ExpandableConnectors.ConnectorArray 1;2717 end ExpandableConnectors.ConnectorArrays.ConnectorArray1; 2816 2718 ")}))); 2817 2719 end ConnectorArray1; … … 2838 2740 description="Connecting to array of connectors", 2839 2741 flatModel=" 2840 fclass ExpandableConnectors.ConnectorArray 22742 fclass ExpandableConnectors.ConnectorArrays.ConnectorArray2 2841 2743 input Real c[1].a[1]; 2842 2744 input Real c[1].b; … … 2862 2764 ec.x[2].a[1:1] = zeros(1); 2863 2765 ec.x[2].b = 0.0; 2864 end ExpandableConnectors.ConnectorArray 2;2766 end ExpandableConnectors.ConnectorArrays.ConnectorArray2; 2865 2767 ")}))); 2866 2768 end ConnectorArray2; … … 2887 2789 description="Connecting to array of connectors", 2888 2790 flatModel=" 2889 fclass ExpandableConnectors.ConnectorArray 32791 fclass ExpandableConnectors.ConnectorArrays.ConnectorArray3 2890 2792 input Real c[1].a[1]; 2891 2793 input Real c[1].b; … … 2914 2816 ec.x[2].a[1:1] = zeros(1); 2915 2817 ec.x[2].b = 0.0; 2916 end ExpandableConnectors.ConnectorArray 3;2818 end ExpandableConnectors.ConnectorArrays.ConnectorArray3; 2917 2819 ")}))); 2918 2820 end ConnectorArray3; … … 2940 2842 description="Connecting to array of connectors", 2941 2843 flatModel=" 2942 fclass ExpandableConnectors.ConnectorArray 42844 fclass ExpandableConnectors.ConnectorArrays.ConnectorArray4 2943 2845 input Real c1.a[1]; 2944 2846 input Real c1.b; … … 2972 2874 ec.x[3].a[1:1] = zeros(1); 2973 2875 ec.x[3].b = 0.0; 2974 end ExpandableConnectors.ConnectorArray 4;2876 end ExpandableConnectors.ConnectorArrays.ConnectorArray4; 2975 2877 ")}))); 2976 2878 end ConnectorArray4; … … 2997 2899 description="Structural parameters in connector", 2998 2900 flatModel=" 2999 fclass ExpandableConnectors.ConnectorArray 52901 fclass ExpandableConnectors.ConnectorArrays.ConnectorArray5 3000 2902 structural parameter Integer c[1].n = 2 /* 2 */; 3001 2903 input Real c[1].a[2]; … … 3017 2919 ec.x[1].a[1:2] = zeros(2); 3018 2920 ec.x[2].a[1:3] = zeros(3); 3019 end ExpandableConnectors.ConnectorArray 5;2921 end ExpandableConnectors.ConnectorArrays.ConnectorArray5; 3020 2922 ")}))); 3021 2923 end ConnectorArray5; … … 3043 2945 description="Array of stream connectors, with gap", 3044 2946 flatModel=" 3045 fclass ExpandableConnectors.ConnectorArray 62947 fclass ExpandableConnectors.ConnectorArrays.ConnectorArray6 3046 2948 input Real c1.a; 3047 2949 Real c1.b; … … 3074 2976 ec.x[2].a = 0.0; 3075 2977 ec.x[3].a = 0.0; 3076 end ExpandableConnectors.ConnectorArray 6;2978 end ExpandableConnectors.ConnectorArrays.ConnectorArray6; 3077 2979 ")}))); 3078 2980 end ConnectorArray6; … … 3103 3005 description="Modicication on connected component referring to parameter outside of it", 3104 3006 flatModel=" 3105 fclass ExpandableConnectors.ConnectorArray 73007 fclass ExpandableConnectors.ConnectorArrays.ConnectorArray7 3106 3008 parameter Real a.p = 1 /* 1 */; 3107 3009 Real a.c.a(start = a.p); … … 3113 3015 a.c.b = ec.c.b; 3114 3016 ec.c.a = 0.0; 3115 end ExpandableConnectors.ConnectorArray 7;3017 end ExpandableConnectors.ConnectorArrays.ConnectorArray7; 3116 3018 ")}))); 3117 3019 end ConnectorArray7; … … 3120 3022 expandable connector EC 3121 3023 end EC; 3122 3024 3123 3025 connector C = Real; 3124 3026 3125 3027 EC ec1; 3126 3028 C c[2]; … … 3135 3037 description="Expandable connector with for index", 3136 3038 flatModel=" 3137 fclass ExpandableConnectors.ConnectorArray 83039 fclass ExpandableConnectors.ConnectorArrays.ConnectorArray8 3138 3040 Real ec1.a[2]; 3139 3041 Real c[2]; … … 3141 3043 c[1] = ec1.a[1]; 3142 3044 c[2] = ec1.a[2]; 3143 end ExpandableConnectors.ConnectorArray 8;3045 end ExpandableConnectors.ConnectorArrays.ConnectorArray8; 3144 3046 ")}))); 3145 3047 end ConnectorArray8; … … 3148 3050 expandable connector EC 3149 3051 end EC; 3150 3052 3151 3053 connector C = Real; 3152 3054 3153 3055 EC ec1; 3154 3056 C c[2]; … … 3163 3065 description="Expandable connector with for index", 3164 3066 flatModel=" 3165 fclass ExpandableConnectors.ConnectorArray 93067 fclass ExpandableConnectors.ConnectorArrays.ConnectorArray9 3166 3068 Real ec1.a[2]; 3167 3069 Real c[2]; … … 3169 3071 c[1] = ec1.a[1]; 3170 3072 c[2] = ec1.a[2]; 3171 end ExpandableConnectors.ConnectorArray 9;3073 end ExpandableConnectors.ConnectorArrays.ConnectorArray9; 3172 3074 ")}))); 3173 3075 end ConnectorArray9; 3174 3076 3175 3077 3176 model ExpandableWithInputOutput1 3177 connector CI = input Real; 3178 connector CO = output Real; 3179 connector C = Real; 3180 3181 expandable connector EC 3182 end EC; 3183 3184 EC ec; 3185 CI ci1; 3186 CO co1; 3187 input C ci2; 3188 output C co2; 3189 equation 3190 connect(ci1, ec.ci1); 3191 connect(ci2, ec.ci2); 3192 connect(co1, ec.co1); 3193 connect(co2, ec.co2); 3194 3195 annotation(__JModelica(UnitTesting(tests={ 3196 FlatteningTestCase( 3197 name="ExpandableWithInputOutput1", 3198 description="Created variables in expandable connectors shouldn't be considered toplevel input/outputs", 3199 flatModel=" 3200 fclass ExpandableConnectors.ExpandableWithInputOutput1 3201 ExpandableConnectors.ExpandableWithInputOutput1.CI ec.ci1; 3202 Real ec.ci2; 3203 ExpandableConnectors.ExpandableWithInputOutput1.CO ec.co1; 3204 Real ec.co2; 3205 input ExpandableConnectors.ExpandableWithInputOutput1.CI ci1; 3206 output ExpandableConnectors.ExpandableWithInputOutput1.CO co1; 3207 input Real ci2; 3208 output Real co2; 3209 equation 3210 ci1 = ec.ci1; 3211 ci2 = ec.ci2; 3212 co1 = ec.co1; 3213 co2 = ec.co2; 3214 3215 public 3216 type ExpandableConnectors.ExpandableWithInputOutput1.CI = Real; 3217 type ExpandableConnectors.ExpandableWithInputOutput1.CO = Real; 3218 end ExpandableConnectors.ExpandableWithInputOutput1; 3219 ")}))); 3220 end ExpandableWithInputOutput1; 3221 3222 3223 model FlowInExpandable1 3224 connector C 3225 Real p; 3226 flow Real f; 3227 end C; 3228 3229 expandable connector EC 3230 end EC; 3231 3232 model A 3233 B b; 3234 EC ec; 3235 equation 3236 connect(b.c, ec.c); 3237 end A; 3238 3239 model B 3240 C c; 3241 end B; 3242 3243 A a; 3244 B b; 3245 EC ec; 3246 equation 3247 connect(a.ec, ec); 3248 connect(b.c, ec.c); 3249 3250 annotation(__JModelica(UnitTesting(tests={ 3251 FlatteningTestCase( 3252 name="FlowInExpandable1", 3253 description="Check that flow variables in expandable connectors get zero equations as needed", 3254 flatModel=" 3255 fclass ExpandableConnectors.FlowInExpandable1 3256 Real a.b.c.p; 3257 Real a.b.c.f; 3258 Real a.ec.c.p; 3259 Real a.ec.c.f; 3260 Real b.c.p; 3261 Real b.c.f; 3262 Real ec.c.p; 3263 Real ec.c.f; 3264 equation 3265 a.b.c.f  a.ec.c.f = 0.0; 3266 a.ec.c.f + b.c.f  ec.c.f = 0.0; 3267 a.ec.c.p = b.c.p; 3268 b.c.p = ec.c.p; 3269 a.b.c.p = a.ec.c.p; 3270 ec.c.f = 0.0; 3271 end ExpandableConnectors.FlowInExpandable1; 3272 ")}))); 3273 end FlowInExpandable1; 3078 end ConnectorArrays; 3079 3080 3274 3081 3275 3082 end ExpandableConnectors;
Note: See TracChangeset
for help on using the changeset viewer.