@@ -541,21 +541,48 @@ oms_status_enu_t oms::AlgLoop::fixPointIteration(System& syst, DirectedGraph& gr
541541 for (int i=0 ; i<size; ++i)
542542 {
543543 int output = SCC.connections [i].first ;
544- if (oms_status_ok != syst. getReal ( graph.getNodes ()[output].getName (), res[i]) )
544+ if (graph.getNodes ()[output].getType () == oms_signal_type_real )
545545 {
546- delete[] res;
547- return oms_status_error;
546+ if (oms_status_ok != syst.getReal (graph.getNodes ()[output].getName (), res[i]))
547+ {
548+ delete[] res;
549+ return oms_status_error;
550+ }
551+ }
552+ // check for boolean types in discrete connections
553+ else if (graph.getNodes ()[output].getType () == oms_signal_type_boolean)
554+ {
555+ bool value;
556+ if (oms_status_ok != syst.getBoolean (graph.getNodes ()[output].getName (), value))
557+ {
558+ delete[] res;
559+ return oms_status_error;
560+ }
561+ res[i] = value ? 1.0 : 0.0 ;
548562 }
549563 }
550564
565+
551566 // update inputs
552567 for (int i=0 ; i<size; ++i)
553568 {
554569 int input = SCC.connections [i].second ;
555- if (oms_status_ok != syst. setReal ( graph.getNodes ()[input].getName (), res[i]) )
570+ if (graph.getNodes ()[input].getType () == oms_signal_type_real )
556571 {
557- delete[] res;
558- return oms_status_error;
572+ if (oms_status_ok != syst.setReal (graph.getNodes ()[input].getName (), res[i]))
573+ {
574+ delete[] res;
575+ return oms_status_error;
576+ }
577+ }
578+ // check for boolean types in discrete connections
579+ else if (graph.getNodes ()[input].getType () == oms_signal_type_boolean)
580+ {
581+ if (oms_status_ok != syst.setBoolean (graph.getNodes ()[input].getName (), res[i] > 0.1 ))
582+ {
583+ delete[] res;
584+ return oms_status_error;
585+ }
559586 }
560587 }
561588
@@ -577,12 +604,27 @@ oms_status_enu_t oms::AlgLoop::fixPointIteration(System& syst, DirectedGraph& gr
577604 for (int i=0 ; i<size; ++i)
578605 {
579606 int output = SCC.connections [i].first ;
580- if (oms_status_ok != syst.getReal (graph.getNodes ()[output].getName (), value))
607+ if (graph.getNodes ()[output].getType () == oms_signal_type_real)
608+ {
609+ if (oms_status_ok != syst.getReal (graph.getNodes ()[output].getName (), value))
610+ {
611+ delete[] res;
612+ return oms_status_error;
613+ }
614+ res[i] -= value;
615+ }
616+ // check for boolean types in discrete connections
617+ else if (graph.getNodes ()[output].getType () == oms_signal_type_boolean)
581618 {
582- delete[] res;
583- return oms_status_error;
619+ bool _value;
620+ if (oms_status_ok != syst.getBoolean (graph.getNodes ()[output].getName (), _value))
621+ {
622+ delete[] res;
623+ return oms_status_error;
624+ }
625+ value = _value ? 1.0 : 0.0 ;
626+ res[i] -= value;
584627 }
585- res[i] -= value;
586628
587629 if (Flags::DumpAlgLoops ())
588630 ss << " " << graph.getNodes ()[output].getName ().c_str () << " : " << value << std::endl;
0 commit comments