int main(int argc, char *argv[]) { // Variables // Default CSS char CSSFILE[12]="style.css"; // Pointers to filenames char *infofilename = INFO; char *logfilename = LOG; // Handle arguments int opt; while ((opt=getopt_long(argc, argv, "dvhm", main_options, NULL)) != EOF) { switch (opt) { case 'h': help(); exit(0); case 'd': debug(); exit(0); case 'v': printf("%s (v%s) by MS3FGX\n", APPNAME, VERSION); exit(0); break; case 'm': strcpy(CSSFILE, "mobile.css"); mobile = 1; break; default: printf("Unknown option.\n"); exit(0); } } // Bail out if we are root, except on WRT #ifndef OPENWRT if(getuid() == 0) { syslog(LOG_ERR,"CGI module refusing to run as root!"); printf("Server attempting to run CGI module as root, bailing out!\n"); printf("Check your web server configuration and try again.\n"); exit(1); } #endif // Read in environment variable // Comment this to fix compiler warning until ready to implement //char* env_string; //env_string=getenv("QUERY_STRING"); // Print HTML head print_header(CSSFILE); //print_html(CSSFILE); // Start container div if (!mobile) puts("<div id=\"container\">\n"); // Open files if ((infofile = fopen(infofilename, "r")) == NULL) { syslog(LOG_ERR,"Error while opening %s!",infofilename); puts("<div id=\"content\">"); printf("Error while opening %s!\n",infofilename); puts("</body></html>"); exit(1); } if ((logfile = fopen(logfilename, "r")) == NULL) { syslog(LOG_ERR,"Error while opening %s!",logfilename); puts("<div id=\"content\">"); printf("Error while opening %s!\n",logfilename); puts("</body></html>"); exit(1); } // Draw sidebar\topbar read_log(); if (!mobile) SideBar(); else TopBar(); // Content window puts("<div id=\"content\">"); if (device_index > 0) { // Print results setup_table(); print_devices(); puts("</table>\n"); } // Close content, body, and HTML puts("</div></body></html>"); // Close files and exit shut_down(); return 0; }
TabulationHashing() { setup_table(); set_seed(0); }
TabulationHashing( uint64_t s ) { setup_table(); set_seed(s); }
void WindingWizardWidget::on_pb_search_clicked(){ setup_table(); int Qmin = ui->sp_Q_from->value()/3*3; int Qmax = ui->sp_Q_to->value()/3*3; int pmin = ui->sp_2p_from->value()/2*2;// poles!!! int pmax = ui->sp_2p_to->value()/2*2; double kwmin = ui->sp_kw_from->value(); double kwmax = ui->sp_kw_to->value(); mPhaseWinding W; StarOfSlot SS; id_column id; int i=0; //!< index for the various windings for (int q=Qmin; q<=Qmax; q+=3){ for (int p=pmin; p<=pmax; p+=2){ // Check if the winding is feasible SS = StarOfSlot(3, q, p/2); SS.CreateStar(); SS.CreateSectors(); int t = SS.get_t(); double yq = SS.get_yq(); if (t>0){// The winding is feasible int _Ncpg = q/3/abs(q-p); double Ncpg = (double)q/3.0/(q-p); // Compute the winding W.ComputeWinding(3, q, p/2, false); W.setData(); if (W.windings[0].get_kw() < kwmin ) continue; if (W.windings[0].get_kw() > kwmax ) continue; if (ui->cb_coil_group_ON->isChecked()&& fabs(Ncpg - _Ncpg)>1e-5 ) continue; if (ui->cb_coil_group->isChecked()&& ui->sp_coil_group->value()!=_Ncpg) continue; if (ui->cb_yq->isChecked()&& ui->sp_yq->value()!=yq) continue; if (ui->cb_Q_mult->isChecked()&& q%ui->sp_Q_mult->value()!=0) continue; // Data for permanent magnet double k = 1; double a = 4.2; double b = 0.00017; double g = 1e-3; double mu = 1.05; double sigma = 1e6; int N = 100; int f = 50; double RLindex = W.get_RL_index(k,a,b,g,mu,sigma,N,f); // insert a row in the table ui->tw_winding->insertRow(i); // insert the number of slots QTableWidgetItem *item = new QTableWidgetItem(QString("%1").arg(q)); ui->tw_winding->setItem(i,id.id_Q, item); // insert the number of poles item = new QTableWidgetItem(QString("%1").arg(p)); ui->tw_winding->setItem(i,id.id_2p, item); // insert the winding factor item = new QTableWidgetItem(QString("%1").arg(W.windings[0].get_kw())); ui->tw_winding->setItem(i,id.id_kw, item); // insert the machine periodicity t item = new QTableWidgetItem(QString("%1").arg(t)); ui->tw_winding->setItem(i,id.id_t, item); // insert the number of groups item = new QTableWidgetItem(QString("%1").arg(Ncpg)); ui->tw_winding->setItem(i,id.id_Group, item); // insert the coil throw item = new QTableWidgetItem(QString("%1").arg(yq)); ui->tw_winding->setItem(i,id.id_yq, item); // insert the RL index item = new QTableWidgetItem(QString("%1").arg(RLindex)); ui->tw_winding->setItem(i,id.id_RL, item); ++i;} } } ui->tw_winding->resizeColumnsToContents(); ui->tw_winding->resizeRowsToContents(); ui->lb_found_item->setText(QString("%1 items").arg(ui->tw_winding->rowCount())); ui->tw_winding->selectAll(); export_table_to_clipboard(); }