thermferm/rdconfig.c

changeset 363
468ec0d96cce
parent 362
c92651a54969
child 370
843dc511c877
equal deleted inserted replaced
362:c92651a54969 363:468ec0d96cce
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *****************************************************************************/ 21 *****************************************************************************/
22 22
23 #include "rdconfig.h" 23 #include "rdconfig.h"
24 #include "thermferm.h" 24 #include "thermferm.h"
25 #include "pid.h"
25 #include "futil.h" 26 #include "futil.h"
26 #include "xutil.h" 27 #include "xutil.h"
27 28
28 int debug = FALSE; 29 int debug = FALSE;
29 static char *mypath; 30 static char *mypath;
514 } 515 }
515 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_INPUT", "%.2f", tmp3->PID_cool->Input)) < 0) { 516 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_INPUT", "%.2f", tmp3->PID_cool->Input)) < 0) {
516 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 517 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
517 return 1; 518 return 1;
518 } 519 }
519 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_INPUTD", "%.2f", tmp3->PID_cool->InputD)) < 0) {
520 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
521 return 1;
522 }
523 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_INPUTLAST", "%.2f", tmp3->PID_cool->InputLast)) < 0) {
524 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
525 return 1;
526 }
527 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_ERR", "%.2f", tmp3->PID_cool->Err)) < 0) { 520 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_ERR", "%.2f", tmp3->PID_cool->Err)) < 0) {
528 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 521 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
529 return 1; 522 return 1;
530 } 523 }
531 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_ERRLAST", "%.2f", tmp3->PID_cool->ErrLast)) < 0) { 524 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_ERRLAST", "%.2f", tmp3->PID_cool->ErrLast)) < 0) {
532 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 525 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
533 return 1; 526 return 1;
534 } 527 }
535 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_ERRLASTLAST", "%.2f", tmp3->PID_cool->ErrLastLast)) < 0) { 528 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_ISTATE", "%.2f", tmp3->PID_cool->iState)) < 0) {
536 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 529 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
537 return 1; 530 return 1;
538 } 531 }
539 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_SETP", "%.2f", tmp3->PID_cool->SetP)) < 0) { 532 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDC_SETP", "%.2f", tmp3->PID_cool->SetP)) < 0) {
540 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 533 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
576 } 569 }
577 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_INPUT", "%.2f", tmp3->PID_heat->Input)) < 0) { 570 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_INPUT", "%.2f", tmp3->PID_heat->Input)) < 0) {
578 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 571 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
579 return 1; 572 return 1;
580 } 573 }
581 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_INPUTD", "%.2f", tmp3->PID_heat->InputD)) < 0) {
582 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
583 return 1;
584 }
585 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_INPUTLAST", "%.2f", tmp3->PID_heat->InputLast)) < 0) {
586 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
587 return 1;
588 }
589 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_ERR", "%.2f", tmp3->PID_heat->Err)) < 0) { 574 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_ERR", "%.2f", tmp3->PID_heat->Err)) < 0) {
590 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 575 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
591 return 1; 576 return 1;
592 } 577 }
593 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_ERRLAST", "%.2f", tmp3->PID_heat->ErrLast)) < 0) { 578 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_ERRLAST", "%.2f", tmp3->PID_heat->ErrLast)) < 0) {
594 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 579 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
595 return 1; 580 return 1;
596 } 581 }
597 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_ERRLASTLAST", "%.2f", tmp3->PID_heat->ErrLastLast)) < 0) { 582 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_ISTATE", "%.2f", tmp3->PID_heat->iState)) < 0) {
598 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 583 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
599 return 1; 584 return 1;
600 } 585 }
601 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_SETP", "%.2f", tmp3->PID_heat->SetP)) < 0) { 586 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PIDH_SETP", "%.2f", tmp3->PID_heat->SetP)) < 0) {
602 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 587 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
1245 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1230 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1246 if (sscanf((const char *)key, "%f", &val) == 1) 1231 if (sscanf((const char *)key, "%f", &val) == 1)
1247 unit->PID_cool->Input = val; 1232 unit->PID_cool->Input = val;
1248 xmlFree(key); 1233 xmlFree(key);
1249 } 1234 }
1250 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_INPUTD"))) {
1251 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1252 if (sscanf((const char *)key, "%f", &val) == 1)
1253 unit->PID_cool->InputD = val;
1254 xmlFree(key);
1255 }
1256 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_INPUTLAST"))) {
1257 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1258 if (sscanf((const char *)key, "%f", &val) == 1)
1259 unit->PID_cool->InputLast = val;
1260 xmlFree(key);
1261 }
1262 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_ERR"))) { 1235 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_ERR"))) {
1263 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1236 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1264 if (sscanf((const char *)key, "%f", &val) == 1) 1237 if (sscanf((const char *)key, "%f", &val) == 1)
1265 unit->PID_cool->Err = val; 1238 unit->PID_cool->Err = val;
1266 xmlFree(key); 1239 xmlFree(key);
1269 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1242 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1270 if (sscanf((const char *)key, "%f", &val) == 1) 1243 if (sscanf((const char *)key, "%f", &val) == 1)
1271 unit->PID_cool->ErrLast = val; 1244 unit->PID_cool->ErrLast = val;
1272 xmlFree(key); 1245 xmlFree(key);
1273 } 1246 }
1274 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_ERRLASTLAST"))) { 1247 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_ISTATE"))) {
1275 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1248 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1276 if (sscanf((const char *)key, "%f", &val) == 1) 1249 if (sscanf((const char *)key, "%f", &val) == 1)
1277 unit->PID_cool->ErrLastLast = val; 1250 unit->PID_cool->iState = val;
1278 xmlFree(key); 1251 xmlFree(key);
1279 } 1252 }
1280 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_SETP"))) { 1253 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_SETP"))) {
1281 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1254 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1282 if (sscanf((const char *)key, "%f", &val) == 1) 1255 if (sscanf((const char *)key, "%f", &val) == 1)
1333 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1306 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1334 if (sscanf((const char *)key, "%f", &val) == 1) 1307 if (sscanf((const char *)key, "%f", &val) == 1)
1335 unit->PID_heat->Input = val; 1308 unit->PID_heat->Input = val;
1336 xmlFree(key); 1309 xmlFree(key);
1337 } 1310 }
1338 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_INPUTD"))) {
1339 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1340 if (sscanf((const char *)key, "%f", &val) == 1)
1341 unit->PID_heat->InputD = val;
1342 xmlFree(key);
1343 }
1344 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_INPUTLAST"))) {
1345 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1346 if (sscanf((const char *)key, "%f", &val) == 1)
1347 unit->PID_heat->InputLast = val;
1348 xmlFree(key);
1349 }
1350 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_ERR"))) { 1311 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_ERR"))) {
1351 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1312 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1352 if (sscanf((const char *)key, "%f", &val) == 1) 1313 if (sscanf((const char *)key, "%f", &val) == 1)
1353 unit->PID_heat->Err = val; 1314 unit->PID_heat->Err = val;
1354 xmlFree(key); 1315 xmlFree(key);
1357 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1318 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1358 if (sscanf((const char *)key, "%f", &val) == 1) 1319 if (sscanf((const char *)key, "%f", &val) == 1)
1359 unit->PID_heat->ErrLast = val; 1320 unit->PID_heat->ErrLast = val;
1360 xmlFree(key); 1321 xmlFree(key);
1361 } 1322 }
1362 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_ERRLASTLAST"))) { 1323 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_ISTATE"))) {
1363 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1324 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1364 if (sscanf((const char *)key, "%f", &val) == 1) 1325 if (sscanf((const char *)key, "%f", &val) == 1)
1365 unit->PID_heat->ErrLastLast = val; 1326 unit->PID_heat->iState = val;
1366 xmlFree(key); 1327 xmlFree(key);
1367 } 1328 }
1368 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_SETP"))) { 1329 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDH_SETP"))) {
1369 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1330 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1370 if (sscanf((const char *)key, "%f", &val) == 1) 1331 if (sscanf((const char *)key, "%f", &val) == 1)

mercurial