301{
302 if (m_syncGenerator) {
304 data.name = m_textCtrlName->GetValue();
305
306 if (!m_syncGenerator->
DoubleFromString(m_parent, m_textCtrlnominalPower->GetValue(), data.nominalPower,
307 _("Value entered incorrectly in the field \"Nominal power\".")))
308 return false;
309 switch (m_choiceNominalPower->GetSelection()) {
310 case 0:
312 break;
313 case 1:
315 break;
316 case 2:
318 break;
319 }
320
321 if (!m_syncGenerator->
DoubleFromString(m_parent, m_textCtrlActivePower->GetValue(), data.activePower,
322 _("Value entered incorrectly in the field \"Active power\".")))
323 return false;
324 switch (m_choiceActivePower->GetSelection()) {
325 case 0:
327 break;
328 case 1:
330 break;
331 case 2:
333 break;
334 case 3:
336 break;
337 }
338
339 if (!m_syncGenerator->
DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
340 _("Value entered incorrectly in the field \"Reactive power\".")))
341 return false;
342 switch (m_choiceReactivePower->GetSelection()) {
343 case 0:
345 break;
346 case 1:
348 break;
349 case 2:
351 break;
352 case 3:
354 break;
355 }
356
357 data.haveMaxReactive = m_checkBoxMaxReactive->GetValue();
358 if (data.haveMaxReactive) {
359 if (!m_syncGenerator->
DoubleFromString(m_parent, m_textCtrlMaxRectivePower->GetValue(), data.maxReactive,
360 _("Value entered incorrectly in the field \"Max reactive power\".")))
361 return false;
362 switch (m_choiceMaxRectivePower->GetSelection()) {
363 case 0:
365 break;
366 case 1:
368 break;
369 case 2:
371 break;
372 case 3:
374 break;
375 }
376 }
377
378 data.haveMinReactive = m_checkBoxMinReactive->GetValue();
379 if (data.haveMinReactive) {
380 if (!m_syncGenerator->
DoubleFromString(m_parent, m_textCtrlMinRectivePower->GetValue(), data.minReactive,
381 _("Value entered incorrectly in the field \"Min reactive power\".")))
382 return false;
383 switch (m_choiceMinRectivePower->GetSelection()) {
384 case 0:
386 break;
387 case 1:
389 break;
390 case 2:
392 break;
393 case 3:
395 break;
396 }
397 }
398
399 data.useMachineBase = m_checkBoxUseMachinePower->GetValue();
400
401 if (!m_syncGenerator->
DoubleFromString(m_parent, m_textCtrlPosResistance->GetValue(), data.positiveResistance,
402 _("Value entered incorrectly in the field \"Positive resistance\".")))
403 return false;
404
405 if (!m_syncGenerator->
DoubleFromString(m_parent, m_textCtrlPosReactance->GetValue(), data.positiveReactance,
406 _("Value entered incorrectly in the field \"Positive reactance\".")))
407 return false;
408
409 if (!m_syncGenerator->
DoubleFromString(m_parent, m_textCtrlNegResistance->GetValue(), data.negativeResistance,
410 _("Value entered incorrectly in the field \"Negative resistance\".")))
411 return false;
412
413 if (!m_syncGenerator->
DoubleFromString(m_parent, m_textCtrlNegReactance->GetValue(), data.negativeReactance,
414 _("Value entered incorrectly in the field \"Negative reactance\".")))
415 return false;
416
417 if (!m_syncGenerator->
DoubleFromString(m_parent, m_textCtrlZeroResistance->GetValue(), data.zeroResistance,
418 _("Value entered incorrectly in the field \"Zero resistance\".")))
419 return false;
420
421 if (!m_syncGenerator->
DoubleFromString(m_parent, m_textCtrlZeroReactance->GetValue(), data.zeroReactance,
422 _("Value entered incorrectly in the field \"Zero reactance\".")))
423 return false;
424
425 if (!m_syncGenerator->
DoubleFromString(m_parent, m_textCtrlGrdResistance->GetValue(), data.groundResistance,
426 _("Value entered incorrectly in the field \"Ground resistance\".")))
427 return false;
428
429 if (!m_syncGenerator->
DoubleFromString(m_parent, m_textCtrlGrdReactance->GetValue(), data.groundReactance,
430 _("Value entered incorrectly in the field \"Ground reactance\".")))
431 return false;
432
433 data.groundNeutral = m_checkBoxGroundNeutral->GetValue();
434
435 m_syncGenerator->SetElectricalData(data);
436 }
437 else if (m_syncMotor) {
439 data.name = m_textCtrlName->GetValue();
440
441 if (!m_syncMotor->
DoubleFromString(m_parent, m_textCtrlnominalPower->GetValue(), data.nominalPower,
442 _("Value entered incorrectly in the field \"Nominal power\".")))
443 return false;
444 switch (m_choiceNominalPower->GetSelection()) {
445 case 0:
447 break;
448 case 1:
450 break;
451 case 2:
453 break;
454 }
455
456 if (!m_syncMotor->
DoubleFromString(m_parent, m_textCtrlActivePower->GetValue(), data.activePower,
457 _("Value entered incorrectly in the field \"Active power\".")))
458 return false;
459 switch (m_choiceActivePower->GetSelection()) {
460 case 0:
462 break;
463 case 1:
465 break;
466 case 2:
468 break;
469 case 3:
471 break;
472 }
473
474 if (!m_syncMotor->
DoubleFromString(m_parent, m_textCtrlReactivePower->GetValue(), data.reactivePower,
475 _("Value entered incorrectly in the field \"Reactive power\".")))
476 return false;
477 switch (m_choiceReactivePower->GetSelection()) {
478 case 0:
480 break;
481 case 1:
483 break;
484 case 2:
486 break;
487 case 3:
489 break;
490 }
491
492 data.haveMaxReactive = m_checkBoxMaxReactive->GetValue();
493 if (data.haveMaxReactive) {
494 if (!m_syncMotor->
DoubleFromString(m_parent, m_textCtrlMaxRectivePower->GetValue(), data.maxReactive,
495 _("Value entered incorrectly in the field \"Max reactive power\".")))
496 return false;
497 switch (m_choiceMaxRectivePower->GetSelection()) {
498 case 0:
500 break;
501 case 1:
503 break;
504 case 2:
506 break;
507 case 3:
509 break;
510 }
511 }
512
513 data.haveMinReactive = m_checkBoxMinReactive->GetValue();
514 if (data.haveMinReactive) {
515 if (!m_syncMotor->
DoubleFromString(m_parent, m_textCtrlMinRectivePower->GetValue(), data.minReactive,
516 _("Value entered incorrectly in the field \"Min reactive power\".")))
517 return false;
518 switch (m_choiceMinRectivePower->GetSelection()) {
519 case 0:
521 break;
522 case 1:
524 break;
525 case 2:
527 break;
528 case 3:
530 break;
531 }
532 }
533
534 data.useMachineBase = m_checkBoxUseMachinePower->GetValue();
535
536 if (!m_syncMotor->
DoubleFromString(m_parent, m_textCtrlPosResistance->GetValue(), data.positiveResistance,
537 _("Value entered incorrectly in the field \"Positive resistance\".")))
538 return false;
539
540 if (!m_syncMotor->
DoubleFromString(m_parent, m_textCtrlPosReactance->GetValue(), data.positiveReactance,
541 _("Value entered incorrectly in the field \"Positive reactance\".")))
542 return false;
543
544 if (!m_syncMotor->
DoubleFromString(m_parent, m_textCtrlNegResistance->GetValue(), data.negativeResistance,
545 _("Value entered incorrectly in the field \"Negative resistance\".")))
546 return false;
547
548 if (!m_syncMotor->
DoubleFromString(m_parent, m_textCtrlNegReactance->GetValue(), data.negativeReactance,
549 _("Value entered incorrectly in the field \"Negative reactance\".")))
550 return false;
551
552 if (!m_syncMotor->
DoubleFromString(m_parent, m_textCtrlZeroResistance->GetValue(), data.zeroResistance,
553 _("Value entered incorrectly in the field \"Zero resistance\".")))
554 return false;
555
556 if (!m_syncMotor->
DoubleFromString(m_parent, m_textCtrlZeroReactance->GetValue(), data.zeroReactance,
557 _("Value entered incorrectly in the field \"Zero reactance\".")))
558 return false;
559
560 if (!m_syncMotor->
DoubleFromString(m_parent, m_textCtrlGrdResistance->GetValue(), data.groundResistance,
561 _("Value entered incorrectly in the field \"Ground resistance\".")))
562 return false;
563
564 if (!m_syncMotor->
DoubleFromString(m_parent, m_textCtrlGrdReactance->GetValue(), data.groundReactance,
565 _("Value entered incorrectly in the field \"Ground reactance\".")))
566 return false;
567
568 data.groundNeutral = m_checkBoxGroundNeutral->GetValue();
569
570 m_syncMotor->SetElectricalData(data);
571 }
572 return true;
573}
static bool DoubleFromString(wxWindow *parent, wxString strValue, double &value, wxString errorMsg)
Get a double value from a string. Show a error message if the conversion fail.