/* Génère le design d'un PDU en openscad */ #include #include #include #include #include #include #include #include using namespace std; static double rail_position; static double prise_position; enum ELEMENT_TYPE { TYPE_BORNIER_30A, TYPE_BORNIER_50A, TYPE_CAP_50A, TYPE_BORNIER_100A, TYPE_CAP_100A, TYPE_DISJONCTEUR_2P40A, TYPE_BORNE_MASSE, TYPE_FINBLOC, TYPE_PRISEC13, TYPE_CAVALIER_50A, TYPE_CAVALIER_100A, TYPE_RAIL, TYPE_ESPACE }; static double fromUS(double val) { return val * 1.27; } /* Semble tout avoir avec site web utile. https://www.automationdirect.com/adc/shopping/catalog/terminal_blocks/dinnector_din-rail_terminal_blocks/single-level_feed-through_terminal_blocks/dn-t8 */ // Cette table correspond directement à ELEMENT_TYPE. On ne peut pas changer l'ordre. static struct SPECS{ const char *name; unsigned thick; unsigned width; unsigned height; unsigned nbcon; const char *url; const char *comment; double prix; // Prix de la boite unsigned itemspaquet; // Nombre d'item par boite } specs[]={ {"bornier30A",5,45,35,1 #if 1 ,"https://www.automationdirect.com/adc/shopping/catalog/terminal_blocks/dinnector_din-rail_terminal_blocks/single-level_feed-through_terminal_blocks/dn-t10red-a","DN-T10" ,fromUS(55.00),100 #else ,"","" ,fromUS(00),1 #endif }, {"bornier50A",5,45,35,1 #if 1 ,"https://www.automationdirect.com/adc/shopping/catalog/terminal_blocks/dinnector_din-rail_terminal_blocks/single-level_feed-through_terminal_blocks/dn-t8red","DN-T8" ,fromUS(44.50),50 #else ,"https://www.automationdirect.com/adc/shopping/catalog/terminal_blocks/konnect-it_din-rail_terminal_blocks/single-level_feed-through_terminal_blocks/kn-t8red","KN-T8", ,fromUS(53.00),100 #endif }, {"cap50A",2,25,35,0 ,"https://www.automationdirect.com/adc/shopping/catalog/terminal_blocks/dinnector_din-rail_terminal_blocks/end_covers/dn-ec86mn","DN-EC86MN" ,fromUS(9.50),25}, {"bornier100A",7,50,45,1 #if 1 ,"https://www.automationdirect.com/adc/shopping/catalog/terminal_blocks/dinnector_din-rail_terminal_blocks/single-level_feed-through_terminal_blocks/dn-t1-z-0b","DN-T1/0" ,fromUS(67.00),25 #else ,"https://www.automationdirect.com/adc/shopping/catalog/terminal_blocks/konnect-it_din-rail_terminal_blocks/single-level_feed-through_terminal_blocks/kn-t2blu","KN-T2" ,fromUS(54.00),40 #endif }, {"cap100A",2,30,45,0 ,"https://www.automationdirect.com/adc/shopping/catalog/terminal_blocks/dinnector_din-rail_terminal_blocks/end_covers/dn-ec1-z-0mn","DN-EC1/0MN" ,fromUS(4.50),10}, {"disjoncteur_2P40A",36,81,60,2 ,"https://www.automationdirect.com/adc/shopping/catalog/circuit_protection_-z-_fuses_-z-_disconnects/ul_489_miniature_circuit_breakers/gladiator_miniature_circuit_breakers_(gmcbu_series)/2-pole_(1a-63a)/gmcbu-2d-40","GMCBU-2D-40" ,fromUS(26.00),1}, {"masse",5,35,35,1,"https://www.amazon.ca/-/fr/USLKG2-5N-Lot-bornes-connexion-rail/dp/B07VRM1Y8W/ref=pd_di_sccai_4?pd_rd_w=PRCdu&pf_rd_p=e92f388e-b766-4f7f-aac1-ee1d0056e8fb&pf_rd_r=36X72EBG93SRKT546DR4&pd_rd_r=16001ce4-6508-4567-8e40-ff3edc8be2ce&pd_rd_wg=K5wFG&pd_rd_i=B07VRM1Y8W&psc=1","",15.99,10}, {"bloc",5,35,30,0 ,"https://www.amazon.ca/-/fr/Dinkle-SS2-Rail-bornier-Extr%C3%A9mit%C3%A9-Bracket/dp/B00R1WTZ56/ref=pd_di_sccai_4?pd_rd_w=EE77E&pf_rd_p=e92f388e-b766-4f7f-aac1-ee1d0056e8fb&pf_rd_r=VWWBH06NACDYBZ9F2HWQ&pd_rd_r=515ca842-38be-44cc-844f-12b09fcfd6fa&pd_rd_wg=bZUBr&pd_rd_i=B00R1WTZ56&psc=1","" ,27.09,50}, {"prisec13",36,33,29,3,"","digi-key 715W-15/01",2.49,1}, {"cavalier 50A",0,0,0,0 ,"https://www.automationdirect.com/adc/shopping/catalog/terminal_blocks/dinnector_din-rail_terminal_blocks/jumpers_-a-_tools/dn-24j8","DN-24J8" ,fromUS(28.00),5*24/3}, {"cavalier 100A",0,0,0,0,"","",0,1}, {"rail",0,0,0,0 ,"https://www.automationdirect.com/adc/shopping/catalog/enclosures_-z-_subpanels_-z-_thermal_management_-z-_lighting/enclosure_parts_-a-_accessories/din_rails/dn-r35s1","DN-R35S1" ,fromUS(32.50),20}, // 1 mètre chaque, on les coupe en 2. {"espace",60,0,0,0,0,0} }; struct ELEMENT{ double position=0; string name; ELEMENT_TYPE type; string color; unsigned thick = 0; int wireoff=-4; // Pour les espaces, les fils sont décalés les uns des autres void setpos(unsigned _thick){ thick = _thick; if (type == TYPE_PRISEC13){ position = prise_position; prise_position += thick != 0 ? thick : specs[type].thick; prise_position += 10; }else{ position = rail_position; rail_position += thick != 0 ? thick : specs[type].thick; rail_position += 0.5; } } ELEMENT (vector &elements, const char *_name, ELEMENT_TYPE _type) : name(_name),type(_type),color("pink"){ setpos(0); elements.push_back(this); if (type == TYPE_BORNE_MASSE) color = "green"; } ELEMENT (vector &elements, const char *_name, ELEMENT_TYPE _type, const char *_color) : name(_name),type(_type), color(_color){ setpos(0); elements.push_back(this); } ELEMENT (vector &elements, const char *_name, ELEMENT_TYPE _type, unsigned _thick) : name(_name),type(_type){ setpos(_thick); elements.push_back(this); } void print() const { auto &sp = specs[type]; if (sp.height != 0){ unsigned offx = sp.width/2; double offz = 7.5; if (type == TYPE_PRISEC13){ offx += 100; offz = 20; } printf ("translate([-%u,%lf,%lf]) %s(\"%s\",%u,%u,%u,\"%s\");\n" ,offx,position,offz,sp.name,name.c_str(),sp.thick,sp.width,sp.height,color.c_str()); } } const char *getname() const { return name.c_str(); } double getposition() const { return position; } unsigned getwidth() const { return specs[type].width; } unsigned getthick() const { return thick != 0 ? thick : specs[type].thick; } unsigned getnbcon() const { return specs[type].nbcon; } const char *getcolor() const { return color.c_str(); } }; static float default_wireray=1; struct CONNECT{ float wireray = default_wireray; ELEMENT *e1; ELEMENT *espace = nullptr; ELEMENT *e2; bool conside1,conside2; unsigned connum1,connum2; CONNECT (ELEMENT &_e1, bool _conside1, unsigned _connum1, ELEMENT &_e2, bool _conside2, unsigned _connum2){ e1 = &_e1; conside1 = _conside1; connum1 = _connum1; e2 = &_e2; conside2 = _conside2; connum2 = _connum2; } CONNECT (ELEMENT &_e1, bool _conside1, unsigned _connum1, ELEMENT &_espace, ELEMENT &_e2, bool _conside2, unsigned _connum2){ espace = &_espace; if (espace->type != TYPE_ESPACE){ tlmp_error ("Connexion invalide entre element %s et element %s, l'élément %s n'est pas un espace\n" ,e1->getname(),e2->getname(),espace->getname()); } e1 = &_e1; conside1 = _conside1; connum1 = _connum1; e2 = &_e2; conside2 = _conside2; connum2 = _connum2; } // Print the vertical wire coming from a component. // Return the Y position of the wire float print_v(ELEMENT *e, unsigned connum, bool conside, unsigned z, unsigned dist, unsigned &offx, unsigned &offz) const{ offx = e->getwidth()/2; unsigned nbcon = e->getnbcon(); float offy = e->getposition(); if (e->type == TYPE_ESPACE){ offy += (float)e->getthick()/2+e->wireoff; }else{ //fprintf (stderr,"thick=%u connum=%u nbcon=%u res=%f\n",e->getthick(),connum,nbcon,e->getthick()*(float)(connum+1)/(nbcon+1)); offy += (float)e->getthick()*(float)(connum+1)/(nbcon+1); } offz = 7+z; unsigned outl = dist-offx; if (e->type == TYPE_PRISEC13){ outl = 100-dist-offx; offx -= 100; printf (" translate([%d,%f,%u]) ",offx,offy,offz); printf ("rotate([0,90,0]) cylinder (r=%f,h=%u,$fn=20);\n",wireray,outl); offx += outl; }else if (conside){ printf (" translate([%d,%f,%u]) ",offx,offy,offz); printf ("rotate([0,90,0]) cylinder (r=%f,h=%u,$fn=20);\n",wireray,outl); offx += outl; }else{ offx = -offx; printf (" translate([%d,%f,%u]) ",offx,offy,offz); printf ("rotate([0,-90,0]) cylinder (r=%f,h=%u,$fn=20);\n",wireray,outl); offx -= outl; } return offy; } unsigned print_v(ELEMENT *e, unsigned connum, bool conside, unsigned z, unsigned dist) const{ unsigned offx,offz; return print_v (e,connum,conside,z,dist,offx,offz); } void print () const { unsigned nbcon1 = e1->getnbcon(); unsigned nbcon2 = e2->getnbcon(); if (nbcon1 == 0 || nbcon2 == 0){ tlmp_error ("Connexion invalide entre element %s et element %s: un des éléments n'a pas de connecteurs.\n" ,e1->getname(),e2->getname()); }else{ static unsigned raisez = 10; static unsigned distance = 45; const char *color = e1->getcolor(); if (strcmp(color,"pink")==0) color = e2->getcolor(); printf ("color(\"%s\"){\n",color); if (conside1 != conside2){ if (espace == nullptr){ tlmp_error ("Connexions aux éléments %s et %s pas du même bord, un espace est requis.\n",e1->getname(),e2->getname()); }else{ unsigned offx1,offz1,offx2,offz2; float offy1 = print_v(e1,connum1,conside1,raisez,distance,offx1,offz1); float offy2 = print_v(espace,0,conside1,raisez,distance); float len = offy2-offy1; printf (" translate([%d,%f,%u]) rotate([%d,0,0]) cylinder(r=%f,h=%f,$fn=20);\n" ,offx1,offy1,offz1,len < 0 ? 90 : -90, wireray,fabs(len)); print_v(espace,0,conside2,raisez,distance,offx2,offz2); float offy3 = print_v(e2,connum2,conside2,raisez,distance); len = offy3-offy2; printf (" translate([%d,%f,%u]) rotate([%d,0,0]) cylinder(r=%f,h=%f,$fn=20);\n" ,offx2,offy2,offz2,len < 0 ? 90 : -90, wireray,fabs(len)); espace->wireoff += 2; } }else{ unsigned offx1,offz1; float offy1 = print_v(e1,connum1,conside1,raisez,distance,offx1,offz1); float offy2 = print_v(e2,connum2,conside2,raisez,distance); float len = offy2-offy1; printf (" translate([%d,%f,%u]) rotate([%d,0,0]) cylinder(r=%f,h=%f,$fn=20);\n" ,offx1,offy1,offz1,len < 0 ? 90 : -90, wireray,fabs(len)); } printf ("}\n"); raisez += 1; distance += 1; } } }; static void pdu_print (const vector &elements) { for (auto p:elements){ p->print(); } } static void connect_print (const vector &connects) { for (auto c:connects){ c.print(); } } static void pdu_report (bool parts, unsigned nbprise, unsigned nbpdu, vector &elements, vector &connects) { if (parts){ // Imprime la liste de pièce map,unsigned> count; for (auto e:elements) if (e->type != TYPE_ESPACE) count[tuple(specs[e->type].name,e->getcolor(),e->type)] += nbpdu; double total = 0, total_com = 0; printf ("%-20s\t%-10s\t%5s\t%6s\t%6s\t%10s\t%10s\t%10s\n","Item","Couleur","Quant","Prix","Total","Commande","Prix com","Boites de"); int max_comment = 0; for (auto &c:count){ auto &sp = specs[get<2>(c.first)]; int len = strlen(sp.comment); if (len > max_comment) max_comment = len; } for (auto &c:count){ auto &sp = specs[get<2>(c.first)]; const char *color = get<1>(c.first).c_str(); double prix_unite = sp.prix/sp.itemspaquet; unsigned quantite = c.second; double prix = quantite*prix_unite; unsigned quantite_commande = quantite; string boites; if (sp.itemspaquet > 1){ quantite_commande = quantite/sp.itemspaquet; if (quantite % sp.itemspaquet != 0) quantite_commande++; boites = string_f("%u",sp.itemspaquet); } double prix_com = quantite_commande * sp.prix; printf ("%-20s\t%-10s\t%5u\t%6.2lf\t%6.2lf\t%10u\t%10.2lf\t%10s\t%-*s\t%s\n" ,sp.name,color,c.second,prix_unite,prix,quantite_commande,prix_com,boites.c_str(),max_comment,sp.comment,sp.url); total += prix; total_com += prix_com; } printf ("%20s\t\t\t\t\t------\t\t\t----------\n",""); printf ("%20s\t\t\t\t\t%6.2lf\t\t\t%10.2lf\n","",total,total_com); }else{ const unsigned sidesup=10; printf ("sidesup=%u;\n",sidesup); printf ("nbprise=%u;\n",nbprise); printf ("pdu_height=60;\n"); printf ("pdu_width=%u;\n",nbprise*42+2*sidesup); printf ("pdu_depth=150;\n"); printf ("module pdugen(){\n"); pdu_print (elements); connect_print (connects); printf ("}\n"); } } int main (int argc, char *argv[]) { glocal int ret = -1; glocal bool triphase = false; glocal bool grosfils = false; glocal bool group1 = false; glocal bool group2 = false; glocal bool group3 = false; glocal bool parts = false; glocal unsigned nbpdu = 1; glocal.ret = (argc,argv); setproginfo ("","0.0" ,"pdu12-7: 12 prises, 7 ampères par prise\n" "pdu4-7: 4 prises, 7 ampères par prise\n" ); setgrouparg ("Design"); setarg ('t',"triphase","Configuration pour triphasé",glocal.triphase,false); setarg (' ',"group1","Fils connectant les borniers 50A aux premier groupe de prises C13",glocal.group1,false); setarg (' ',"group2","Fils connectant les borniers 50A aux second groupe de prises C13",glocal.group2,false); setarg (' ',"group3","Fils connectant les borniers 50A aux trousième groupe de prises C13",glocal.group3,false); setarg ('F',"grosfils","Gros fils alimentant les 3 groupes de prises",glocal.grosfils,false); setgrouparg ("Pièces"); setarg ('p',"parts","liste des pièces",glocal.parts,false); setarg (' ',"nbpdu","Nombre de PDU requis",glocal.nbpdu,false); int ret = -1; if (argc != 1){ usage(); }else if(strcmp(argv[0],"pdu12-7")==0){ rail_position += 20; prise_position += 50; vector elements; vector connects; ELEMENT bloc1 (elements,"bloc1",TYPE_FINBLOC); ELEMENT masse0 (elements,"gnd_0",TYPE_BORNE_MASSE); ELEMENT cap_1 (elements,"cap_1",TYPE_CAP_100A,"white"); ELEMENT b100_1_1 (elements,"b100_1_1",TYPE_BORNIER_100A,"red"); ELEMENT b100_1_2 (elements,"b100_1_2",TYPE_BORNIER_100A,"red"); ELEMENT cav1_1 (elements,"cav1_1",TYPE_CAVALIER_100A,""); ELEMENT b100_2_1 (elements,"b100_2_1",TYPE_BORNIER_100A,"black"); ELEMENT b100_2_2 (elements,"b100_2_2",TYPE_BORNIER_100A,"black"); ELEMENT cav2_1 (elements,"cav2_1",TYPE_CAVALIER_100A,""); ELEMENT b100_3_1 (elements,"b100_3_1",TYPE_BORNIER_100A,"blue"); ELEMENT b100_3_2 (elements,"b100_3_2",TYPE_BORNIER_100A,"blue"); ELEMENT cav3_1 (elements,"cav3_1",TYPE_CAVALIER_100A,""); ELEMENT bloc2 (elements,"bloc1",TYPE_FINBLOC); ELEMENT espace1 (elements,"",TYPE_ESPACE,10); ELEMENT bloc3 (elements,"bloc1",TYPE_FINBLOC); ELEMENT cap_2 (elements,"cap_2",TYPE_CAP_50A,"white"); ELEMENT b50_1a_1 (elements,"b50_1_1",TYPE_BORNIER_50A,"red"); ELEMENT b50_1a_2 (elements,"b50_1_2",TYPE_BORNIER_50A,"red"); ELEMENT b50_1a_3 (elements,"b50_1_3",TYPE_BORNIER_50A,"red"); ELEMENT cav1a_1 (elements,"cav1a_1",TYPE_CAVALIER_50A,""); ELEMENT cav1a_2 (elements,"cav1a_2",TYPE_CAVALIER_50A,""); ELEMENT masse1_1 (elements,"gnd_1_1",TYPE_BORNE_MASSE); ELEMENT disj1 (elements,"disj1",TYPE_DISJONCTEUR_2P40A); ELEMENT masse1_2 (elements,"gnd_1_2",TYPE_BORNE_MASSE); ELEMENT b50_1b_1 (elements,"b50_1_1",TYPE_BORNIER_50A,"black"); ELEMENT b50_1b_2 (elements,"b50_1_2",TYPE_BORNIER_50A,"black"); ELEMENT b50_1b_3 (elements,"b50_1_3",TYPE_BORNIER_50A,"black"); ELEMENT cav1b_1 (elements,"cav1b_1",TYPE_CAVALIER_50A,""); ELEMENT cav1b_2 (elements,"cav1b_2",TYPE_CAVALIER_50A,""); ELEMENT bloc4 (elements,"bloc1",TYPE_FINBLOC); ELEMENT espace2 (elements,"",TYPE_ESPACE,80); ELEMENT bloc5 (elements,"bloc1",TYPE_FINBLOC); ELEMENT cap_3 (elements,"cap_3",TYPE_CAP_50A,"white"); ELEMENT b50_2a_1 (elements,"b50_2a_1",TYPE_BORNIER_50A,"red"); ELEMENT b50_2a_2 (elements,"b50_2a_2",TYPE_BORNIER_50A,"red"); ELEMENT b50_2a_3 (elements,"b50_2a_3",TYPE_BORNIER_50A,"red"); ELEMENT cav2a_1 (elements,"cav2a_1",TYPE_CAVALIER_50A,""); ELEMENT cav2a_2 (elements,"cav2a_2",TYPE_CAVALIER_50A,""); ELEMENT masse2_1 (elements,"gnd_2_1",TYPE_BORNE_MASSE); ELEMENT disj2 (elements,"disj1",TYPE_DISJONCTEUR_2P40A); ELEMENT masse2_2 (elements,"gnd_2_2",TYPE_BORNE_MASSE); ELEMENT b50_2b_1 (elements,"b50_2b_1",TYPE_BORNIER_50A,"blue"); ELEMENT b50_2b_2 (elements,"b50_2b_2",TYPE_BORNIER_50A,"blue"); ELEMENT b50_2b_3 (elements,"b50_2b_3",TYPE_BORNIER_50A,"blue"); ELEMENT cav2b_1 (elements,"cav2b_1",TYPE_CAVALIER_50A,""); ELEMENT cav2b_2 (elements,"cav2b_2",TYPE_CAVALIER_50A,""); ELEMENT bloc6 (elements,"bloc1",TYPE_FINBLOC); ELEMENT espace3 (elements,"",TYPE_ESPACE,90); ELEMENT bloc7 (elements,"bloc1",TYPE_FINBLOC); ELEMENT cap_4 (elements,"cap_4",TYPE_CAP_50A,"white"); ELEMENT b50_3a_1 (elements,"b50_3a_1",TYPE_BORNIER_50A,"black"); ELEMENT b50_3a_2 (elements,"b50_3a_2",TYPE_BORNIER_50A,"black"); ELEMENT b50_3a_3 (elements,"b50_3a_3",TYPE_BORNIER_50A,"black"); ELEMENT cav3a_1 (elements,"cav3a_1",TYPE_CAVALIER_50A,""); ELEMENT cav3a_2 (elements,"cav3a_2",TYPE_CAVALIER_50A,""); ELEMENT masse3_1 (elements,"gnd_3_2",TYPE_BORNE_MASSE); ELEMENT disj3 (elements,"disj1",TYPE_DISJONCTEUR_2P40A); ELEMENT masse3_2 (elements,"gnd_3_2",TYPE_BORNE_MASSE); ELEMENT b50_3b_1 (elements,"b50_3b_1",TYPE_BORNIER_50A,"blue"); ELEMENT b50_3b_2 (elements,"b50_3b_2",TYPE_BORNIER_50A,"blue"); ELEMENT b50_3b_3 (elements,"b50_3b_3",TYPE_BORNIER_50A,"blue"); ELEMENT cav3b_1 (elements,"cav3b_1",TYPE_CAVALIER_50A,""); ELEMENT cav3b_2 (elements,"cav3b_2",TYPE_CAVALIER_50A,""); ELEMENT bloc8 (elements,"bloc1",TYPE_FINBLOC); ELEMENT espace4 (elements,"",TYPE_ESPACE,10); ELEMENT prise0 (elements,"prise0",TYPE_PRISEC13); ELEMENT prise1 (elements,"prise1",TYPE_PRISEC13); ELEMENT prise2 (elements,"prise2",TYPE_PRISEC13); ELEMENT prise3 (elements,"prise3",TYPE_PRISEC13); ELEMENT prise4 (elements,"prise4",TYPE_PRISEC13); ELEMENT prise5 (elements,"prise5",TYPE_PRISEC13); ELEMENT prise6 (elements,"prise6",TYPE_PRISEC13); ELEMENT prise7 (elements,"prise7",TYPE_PRISEC13); ELEMENT prise8 (elements,"prise8",TYPE_PRISEC13); ELEMENT prise9 (elements,"prise9",TYPE_PRISEC13); ELEMENT prise10 (elements,"prise10",TYPE_PRISEC13); ELEMENT prise11 (elements,"prise11",TYPE_PRISEC13); ELEMENT rail(elements,"rail",TYPE_RAIL); if (glocal.triphase){ // Connection triphasé if (glocal.grosfils){ default_wireray=1.5; connects.push_back(CONNECT(b100_1_1,false,0,disj1,false,0)); connects.push_back(CONNECT(disj1,true,0,b50_1a_3,true,0)); connects.push_back(CONNECT(b100_1_2,false,0,disj2,false,0)); connects.push_back(CONNECT(disj2,true,0,b50_2a_3,true,0)); connects.push_back(CONNECT(b100_2_1,false,0,disj1,false,1)); connects.push_back(CONNECT(disj1,true,1,b50_1b_1,true,0)); connects.push_back(CONNECT(b100_2_2,false,0,disj3,false,0)); connects.push_back(CONNECT(disj3,true,0,b50_3a_3,true,0)); connects.push_back(CONNECT(b100_3_1,false,0,disj2,false,1)); connects.push_back(CONNECT(disj2,true,1,b50_2b_1,true,0)); connects.push_back(CONNECT(b100_3_2,false,0,disj3,false,1)); connects.push_back(CONNECT(disj3,true,1,b50_3b_1,true,0)); } if (glocal.group1){ default_wireray=0.5; connects.push_back(CONNECT(b50_1a_1,true,0,espace1,prise0,false,0)); connects.push_back(CONNECT(masse1_1,true,0,espace1,prise0,false,1)); connects.push_back(CONNECT(b50_1b_2,true,0,espace1,prise0,false,2)); connects.push_back(CONNECT(b50_1a_1,false,0,prise1,false,0)); connects.push_back(CONNECT(masse1_1,false,0,prise1,false,1)); connects.push_back(CONNECT(b50_1b_1,false,0,prise1,false,2)); connects.push_back(CONNECT(b50_1a_2,false,0,prise2,false,0)); connects.push_back(CONNECT(masse1_2,false,0,prise2,false,1)); connects.push_back(CONNECT(b50_1b_2,false,0,prise2,false,2)); connects.push_back(CONNECT(b50_1a_3,false,0,prise3,false,0)); connects.push_back(CONNECT(masse1_2,true,0,espace2,prise3,false,1)); connects.push_back(CONNECT(b50_1b_3,false,0,prise3,false,2)); } if (glocal.group2){ default_wireray=0.5; connects.push_back(CONNECT(b50_2a_1,true,0,espace2,prise4,false,0)); connects.push_back(CONNECT(masse2_1,true,0,espace2,prise4,false,1)); connects.push_back(CONNECT(b50_2b_2,true,0,espace2,prise4,false,2)); connects.push_back(CONNECT(b50_2a_1,false,0,prise5,false,0)); connects.push_back(CONNECT(masse2_1,false,0,prise5,false,1)); connects.push_back(CONNECT(b50_2b_1,false,0,prise5,false,2)); connects.push_back(CONNECT(b50_2a_2,false,0,prise6,false,0)); connects.push_back(CONNECT(masse2_2,false,0,prise6,false,1)); connects.push_back(CONNECT(b50_2b_2,false,0,prise6,false,2)); connects.push_back(CONNECT(b50_2a_3,false,0,prise7,false,0)); connects.push_back(CONNECT(masse2_2,true,0,espace3,prise7,false,1)); connects.push_back(CONNECT(b50_2b_3,false,0,prise7,false,2)); } if (glocal.group3){ default_wireray=0.5; connects.push_back(CONNECT(b50_3a_1,true,0,espace3,prise8,false,0)); connects.push_back(CONNECT(masse3_1,true,0,espace3,prise8,false,1)); connects.push_back(CONNECT(b50_3b_2,true,0,espace3,prise8,false,2)); connects.push_back(CONNECT(b50_3a_1,false,0,prise9,false,0)); connects.push_back(CONNECT(masse3_1,false,0,prise9,false,1)); connects.push_back(CONNECT(b50_3b_1,false,0,prise9,false,2)); connects.push_back(CONNECT(b50_3a_2,false,0,prise10,false,0)); connects.push_back(CONNECT(masse3_2,false,0,prise10,false,1)); connects.push_back(CONNECT(b50_3b_2,false,0,prise10,false,2)); connects.push_back(CONNECT(b50_3a_3,false,0,prise11,false,0)); connects.push_back(CONNECT(masse3_2,true,0,espace4,prise11,false,1)); connects.push_back(CONNECT(b50_3b_3,false,0,prise11,false,2)); } }else{ } pdu_report (glocal.parts,12,glocal.nbpdu,elements,connects); ret = 0; }else if(strcmp(argv[0],"pdu4-7")==0){ rail_position += 20; prise_position += 50; vector elements; vector connects; ELEMENT espace1 (elements,"",TYPE_ESPACE,10); ELEMENT bloc1 (elements,"bloc1",TYPE_FINBLOC); ELEMENT masse0 (elements,"gnd_0",TYPE_BORNE_MASSE); ELEMENT cap_2 (elements,"cap_2",TYPE_CAP_50A,"white"); ELEMENT b50_1a_1 (elements,"b50_1_1",TYPE_BORNIER_50A,"red"); ELEMENT b50_1a_2 (elements,"b50_1_2",TYPE_BORNIER_50A,"red"); ELEMENT b50_1a_3 (elements,"b50_1_3",TYPE_BORNIER_50A,"red"); ELEMENT cav1a_1 (elements,"cav1a_1",TYPE_CAVALIER_50A,""); ELEMENT cav1a_2 (elements,"cav1a_2",TYPE_CAVALIER_50A,""); ELEMENT masse1_1 (elements,"gnd_1_1",TYPE_BORNE_MASSE); ELEMENT disj1 (elements,"disj1",TYPE_DISJONCTEUR_2P40A); ELEMENT masse1_2 (elements,"gnd_1_2",TYPE_BORNE_MASSE); ELEMENT b50_1b_1 (elements,"b50_1_1",TYPE_BORNIER_50A,"black"); ELEMENT b50_1b_2 (elements,"b50_1_2",TYPE_BORNIER_50A,"black"); ELEMENT b50_1b_3 (elements,"b50_1_3",TYPE_BORNIER_50A,"black"); ELEMENT cav1b_1 (elements,"cav1b_1",TYPE_CAVALIER_50A,""); ELEMENT cav1b_2 (elements,"cav1b_2",TYPE_CAVALIER_50A,""); ELEMENT bloc4 (elements,"bloc1",TYPE_FINBLOC); ELEMENT espace2 (elements,"",TYPE_ESPACE,10); ELEMENT prise0 (elements,"prise0",TYPE_PRISEC13); ELEMENT prise1 (elements,"prise1",TYPE_PRISEC13); ELEMENT prise2 (elements,"prise2",TYPE_PRISEC13); ELEMENT prise3 (elements,"prise3",TYPE_PRISEC13); if (glocal.group1){ default_wireray=0.5; connects.push_back(CONNECT(b50_1a_1,true,0,espace1,prise0,false,0)); connects.push_back(CONNECT(masse1_1,true,0,espace1,prise0,false,1)); connects.push_back(CONNECT(b50_1b_2,true,0,espace1,prise0,false,2)); connects.push_back(CONNECT(b50_1a_1,false,0,prise1,false,0)); connects.push_back(CONNECT(masse1_1,false,0,prise1,false,1)); connects.push_back(CONNECT(b50_1b_1,false,0,prise1,false,2)); connects.push_back(CONNECT(b50_1a_2,false,0,prise2,false,0)); connects.push_back(CONNECT(masse1_2,false,0,prise2,false,1)); connects.push_back(CONNECT(b50_1b_2,false,0,prise2,false,2)); connects.push_back(CONNECT(b50_1a_3,false,0,prise3,false,0)); connects.push_back(CONNECT(masse1_2,true,0,espace2,prise3,false,1)); connects.push_back(CONNECT(b50_1b_3,false,0,prise3,false,2)); } pdu_report (glocal.parts,4,glocal.nbpdu,elements,connects); ret = 0; }else{ usage(); } return ret; return glocal.ret; }