Salome HOME
Debug for SwitchNodes in SomeDataReady ( see comments)
authorrahuel <rahuel@opencascade.com>
Tue, 15 Feb 2005 13:18:18 +0000 (13:18 +0000)
committerrahuel <rahuel@opencascade.com>
Tue, 15 Feb 2005 13:18:18 +0000 (13:18 +0000)
Traces and Comments
Debug : some CORBA types was missing for InLinesNodes in DataReady_ExecuteAction
Debugs for SwitchNodes (see comments)

src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx

index b33fa38e40da9634d376e03872d1a9a5ce7ed8ae..82b66fee41ce56c763f833aa187c76fa87995bfc 100644 (file)
@@ -800,20 +800,23 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
   bool SwitchFinished = false ;
 
   if ( IsLoopNode() ) {
-    GraphBase::OutPort * anOutLoopPort = GetChangeNodeInLoop()->GetOutPort() ;
+    GraphBase::OutPort * anOutLoopPort = GetChangeNodeInLoop()->GetOutPort() ; // DoLoop Port
     if ( anOutLoopPort && anOutLoopPort->BoolValue() ) {
       LoopBeginning = true ; // Beginning of Loop
     }
   }
   if ( IsEndLoopNode() ) {
-    GraphBase::OutPort * anOutLoopPort = GetChangeNodeInLoop()->GetOutPort() ;
+    GraphBase::OutPort * anOutLoopPort = GetChangeNodeInLoop()->GetOutPort() ; // DoLoop Port
     if ( anOutLoopPort && !anOutLoopPort->BoolValue() ) {
       LoopFinished = true ; // End of Loop
     }
   }
-  if ( IsEndSwitchNode() ) {
-    GraphBase::OutPort * anOutGateSwitchPort = GetChangeNodeInGate()->GetOutPort() ;
+  if ( IsEndSwitchNode() && strcmp( GOTONode()->CoupledNode()->Name() , DataFromNode() ) ) {
+    GraphBase::OutPort * anOutGateSwitchPort = GetChangeNodeInGate()->GetOutPort() ; // Default Port
+//JR 09.02.2005 : SomeDataReady is not from the SwitchNode
     if ( anOutGateSwitchPort && !anOutGateSwitchPort->BoolValue() ) {
+//JR 09.02.2005 : the OutPort of the SwitchNode connected to the default port is closed ===>
+// Here after we consider that that DefaultPort is Ready (even if it's value is false)
       SwitchFinished = true ; // End of Switch
     }
   }
@@ -829,7 +832,8 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
       cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " "
              << anInPort->PortName() << " ControlPort inactive." << endl ;
     }
-// That InPort get its value from an other node
+// That InPort get its value from an other node : the node of anOutPort linked to that anInPort is
+// different from the sender of SomeDataReady (DataFromNode)
     else if ( strcmp( DataFromNode() , anOutPort->NodeName() ) ) {
       if ( anInPort->State() == SUPERV::ReadyState ) {
         InReady += 1 ;
@@ -914,7 +918,7 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
                << LoopBeginning << endl ;
       }
     }
-// That InPort get its value from the sending node
+// That InPort get its value from the sending node (DataFromNode)
     else if ( anInPort->IsGate() ) {
       const CORBA::Any * theValue = anOutPort->Value() ;
       long GateOpened ;
@@ -962,8 +966,9 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
     else if ( anOutPort->Done() ) {
       InReady += 1 ;
       anInPort->State( SUPERV::ReadyState ) ;
-      cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " "
-             << anInPort->PortName() << " " << anInPort->PortStatus() << " is Done from Node "
+      cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort "
+             << anInPort->PortName() << " " << anInPort->PortStatus() << " "
+             << Automaton()->StateName( anInPort->State() ) << " is Done from Node "
              << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") "
              << anOutPort->PortStatus() << " " ;
 #ifdef _DEBUG_
@@ -1018,10 +1023,11 @@ int GraphExecutor::InNode::DataUndef_AllDataReadyAction() {
 //         << " CreateNewThreadIf " << CreateNewThreadIf() << " IsLockedDataWait "
 //         << IsLockedDataWait() ;
   if ( IsLockedDataWait() ) {
-    cdebug << "DataUndef_AllDataReadyAction() WOULD DEAD-LOCK" << endl ;
+    cdebug << "DataUndef_AllDataReadyAction() " << Name() << "WOULD DEAD-LOCK" << endl ;
     return 0 ; // ==> DataUndef_AllDataReadyAction() after UnLockDataWait()
   }
-//  cdebug << endl ;
+  cdebug << "InNode::DataUndef_AllDataReadyAction CreateNewThread( CreateNewThreadIf() ) "
+         << CreateNewThreadIf() << endl ;
   CreateNewThread( CreateNewThreadIf() ) ;
   if ( !CreateNewThread() ) {
 //    cdebug << "Thread " << ThreadNo() << "-->" << pthread_self() << endl ;
@@ -1315,12 +1321,26 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                              << InParametersList[i].Name.c_str()
                              << " Value(string) " << t << endl ;
                       break ;
-                    case CORBA::tk_double :
-                      double d;
-                      InParametersList[i].Value >>= d;
+                    case CORBA::tk_boolean:
+                      bool b ;
+                      InParametersList[i].Value >>= (CORBA::Any::to_boolean ) b;
                       cdebug << "ArgOut->In" << i << " : "
                              << InParametersList[i].Name.c_str()
-                             << " Value(double) " << d << endl ;
+                             << " Value(boolean) " << b << endl ;
+                      break ;
+                    case CORBA::tk_char:
+                      unsigned char c ;
+                      InParametersList[i].Value >>= (CORBA::Any::to_char ) c;
+                      cdebug << "ArgOut->In" << i << " : "
+                             << InParametersList[i].Name.c_str()
+                             << " Value(char) " << c << endl ;
+                      break ;
+                    case CORBA::tk_short:
+                      short s ;
+                      InParametersList[i].Value >>= s;
+                      cdebug << "ArgOut->In" << i << " : "
+                             << InParametersList[i].Name.c_str()
+                             << " Value(short) " << s << endl ;
                       break ;
                     case CORBA::tk_long :
                       long l;
@@ -1329,6 +1349,20 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                              << InParametersList[i].Name.c_str()
                              << " Value(long) " << l << endl ;
                       break ;
+                    case CORBA::tk_float :
+                      float f;
+                      InParametersList[i].Value >>= f;
+                      cdebug << "ArgOut->In" << i << " : "
+                             << InParametersList[i].Name.c_str()
+                             << " Value(float) " << f << endl ;
+                      break ;
+                    case CORBA::tk_double :
+                      double d;
+                      InParametersList[i].Value >>= d;
+                      cdebug << "ArgOut->In" << i << " : "
+                             << InParametersList[i].Name.c_str()
+                             << " Value(double) " << d << endl ;
+                      break ;
                     case CORBA::tk_objref :
                       CORBA::Object_ptr obj ;
                       char * retstr ;
@@ -1466,10 +1500,22 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                          << " Value(string) "
                          << OutParametersList[argout0 + i].Name.c_str() << endl ;
                   break ;
-                case CORBA::tk_double :
+                case CORBA::tk_boolean:
                   cdebug << "ArgOut->In" << argin0 + i << " : "
                          << InParametersList[argin0 + i].Name.c_str()
-                         << " Value(double) "
+                         << " Value(boolean) "
+                         << OutParametersList[argout0 + i].Name.c_str() << endl ;
+                  break ;
+                case CORBA::tk_char:
+                  cdebug << "ArgOut->In" << argin0 + i << " : "
+                         << InParametersList[argin0 + i].Name.c_str()
+                         << " Value(char) "
+                         << OutParametersList[argout0 + i].Name.c_str() << endl ;
+                  break ;
+                case CORBA::tk_short:
+                  cdebug << "ArgOut->In" << argin0 + i << " : "
+                         << InParametersList[argin0 + i].Name.c_str()
+                         << " Value(short) "
                          << OutParametersList[argout0 + i].Name.c_str() << endl ;
                   break ;
                 case CORBA::tk_long :
@@ -1478,6 +1524,12 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                          << " Value(long) "
                          << OutParametersList[argout0 + i ].Name.c_str() << endl ;
                   break ;
+                case CORBA::tk_double :
+                  cdebug << "ArgOut->In" << argin0 + i << " : "
+                         << InParametersList[argin0 + i].Name.c_str()
+                         << " Value(double) "
+                         << OutParametersList[argout0 + i].Name.c_str() << endl ;
+                  break ;
                 case CORBA::tk_objref :
                   cdebug << "ArgOut->In" << argin0 + i << " : "
                          << InParametersList[argin0 + i].Name.c_str()
@@ -1826,6 +1878,7 @@ void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) {
   int j ;
   bool docdebug = false ;
   State( GraphExecutor::DataWaitingState ) ;
+  cdebug << "SetWaitingStates " << Name() << " " << Automaton()->StateName( State() ) << endl ;
   for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
     GraphBase::InPort * anInPort = GetChangeNodeInPort( i ) ;
     cdebug << "SetWaitingStates InPort " << Name() << "( " << anInPort->PortName() << " ) "
@@ -1914,6 +1967,7 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
     return 1;
   }
 
+//JR 09.02.2005 : That complicated part of the code manages LOOPS and GOTO
   if ( IsGOTONode() ||
        ( IsEndLoopNode() && GetNodeInLoop()->GetOutPort()->BoolValue() ) ) {
     cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name()
@@ -2037,6 +2091,7 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
     }
   }
 
+// JR 09.02.2005 : this is not a EndLoop or a GOTO :
   else {
     cdebug << ThreadNo() << " Successed_SuccessAction of " << Name()
            << " with " << LinkedNodesSize() << " linked nodes :" ;
@@ -2048,13 +2103,19 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
     }
     cdebug << endl;
     for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
+// If this is a LoopNode and if DoLoopPort == false, we go directly to the EndOfLoopNode and
+// we do not activate Nodes within the loop
       bool IgnoreForEndLoop = false ;
+// If this is a SwitchNode and if DefaultOutPort == true, we may activate Nodes within Switch
+// or we may activate directly the EnSwitch
+// BUT the NotSwitchBranch(es) are NOT activated :
+      bool IgnoreForDefaultSwitch = false ;
       GraphBase::ComputingNode * aComputingNode ;
       aComputingNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
       toNode = (GraphExecutor::InNode *) aComputingNode->GetInNode() ;
       cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction of " << Name()
-             << " [" << i << "] " << LinkedNodes( i )->Name() << " toNode " << toNode << " IgnoreForEndLoop "
-             << IgnoreForEndLoop ;
+             << " [" << i << "] " << LinkedNodes( i )->Name() << " toNode " << toNode
+             << " IgnoreForEndLoop " << IgnoreForEndLoop ;
       if ( toNode ) {
         cdebug << " " << toNode->Kind() << endl ;
       }
@@ -2086,6 +2147,10 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
        }
       }
       else if ( toNode && IsSwitchNode() ) {
+        const GraphBase::OutPort * anOutGatePort = GetNodeOutGate() ;
+        if ( anOutGatePort->BoolValue() && anOutGatePort->InPortsSize() ) { // DefaultPort is activated
+          IgnoreForDefaultSwitch = true ;
+       }
       }
       else if ( toNode && toNode->IsInLineNode() ) {
         int j ;
@@ -2109,40 +2174,125 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
             toNode->GetChangeNodeInPort( j )->InitialOutPort() ;
          }
         }
-        cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << toNode->Name() << "->SendSomeDataReady( "
-               << Name() << " )" << endl ;
-        res = toNode->SendSomeDataReady( Name() ) ;
-        if ( res ) {
-          if ( firsttoNode == NULL &&
-               toNode->ThreadNo() == pthread_self() ) {
-            firsttoNode = toNode ;
-            cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction firsttoNode "
-                   << toNode->Name() << endl ;
-          }
-          else if ( firstzeroNode == NULL &&
-                    toNode->ThreadNo() == 0 ) {
-            firstzeroNode = toNode ;
+// If the DefaultPort of that SwitchNode is connected to the DefaultPort od the EndSwitchNode
+// the NotSwitchBranch(es) are NOT activated :
+// If the DefaultPort of that SwitchNode is connected to SwitchBranch(es)
+// the NotSwitchBranch(es) are NOT activated :
+        bool activatetoNode = true ;
+        if ( IgnoreForDefaultSwitch ) {
+          cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction search "
+                 << toNode->Name() << " among linked nodes to DefaultPort of " << Name() << endl ;
+          activatetoNode = false ;
+          const GraphBase::OutPort * anOutGatePort = GetNodeOutGate() ;
+          const GraphBase::InPort * anInPort = NULL ;
+          int j ;
+          for ( j = 0 ; j < anOutGatePort->InPortsSize() ; j++ ) {
+            anInPort = anOutGatePort->InPorts( j ) ;
+            const GraphBase::ComputingNode * aNode ;
+            aNode = _OutNode->Graph()->GetGraphNode( anInPort->NodeName() ) ;
+            if ( aNode ) {
+              cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction try "
+                     << aNode << " " << aNode->Name() << " == " << toNode << " " << toNode->Name()
+                     << endl ;
+           }
+            if ( aNode && (const GraphBase::ComputingNode * ) toNode->ComputingNode() == aNode ) {
+// toNode is connected to the DefaultPort of that SwitchNode :
+              activatetoNode = true ;
+              break ;
+           }
+         }
+          if ( activatetoNode ) {
+            cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction found "
+                   << toNode->Name() << " among linked nodes to DefaultPort of " << Name()
+                   << endl ;
          }
           else {
-            SomeDataNodes.push_back( toNode ) ;
-            cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " push "
-                   << toNode->Name() << " " << SomeDataNodes.size() << endl ;
+            cdebug << pthread_self() << "/" << ThreadNo()
+                   << " Successed_SuccessAction does NOT found "
+                   << toNode->Name() << " among linked nodes to DefaultPort of " << Name()
+                   << endl ;
+         }
+       }
+        if ( activatetoNode ) {
+          cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction "
+                 << toNode->Name() << "->SendSomeDataReady( " << Name() << " )" << endl ;
+          res = toNode->SendSomeDataReady( Name() ) ;
+          if ( res ) {
+            if ( firsttoNode == NULL &&
+                 toNode->ThreadNo() == pthread_self() ) {
+              firsttoNode = toNode ;
+              cdebug << pthread_self() << "/" << ThreadNo()
+                     << " Successed_SuccessAction firsttoNode " << toNode->Name() << endl ;
+            }
+            else if ( firstzeroNode == NULL &&
+                      toNode->ThreadNo() == 0 ) {
+              firstzeroNode = toNode ;
+           }
+            else {
+              SomeDataNodes.push_back( toNode ) ;
+              cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction "
+                     << Name() << " push "
+                     << toNode->Name() << " " << SomeDataNodes.size() << endl ;
+           }
          }
        }
       }
     }
   }
 
+//JR 10.02.2005 : Debug at the end of execution of a SwitchNode :
+// Here after we may start execution of only one SwitchBranch or of the Default
+// But with activation of only one SwitchBranch we may activate several nodes of that SwitchBranch and
+// we may activate several nodes of NotSwitchBranch ( a NotSwitchBranch is a Branch of the Switch
+// where GatePorts of Nodes are not connected ; that Branches are always executed for each of SwitchBranch
+// BUT are not executed when Default is activated).
+// So the bug is that all input ports of the corresponding EndSwitchNode must have the status NOTDONE !
+// (Only if Default OutPort is closed and Default InPort is closed)
+  if ( IsSwitchNode() ) {
+    GraphBase::InLineNode * anEndSwitchNode = GOTONode()->CoupledNode() ;
+    if ( !GetNodeOutGate()->BoolValue() && anEndSwitchNode->GetNodeInGate()->GetOutPort() &&
+         !anEndSwitchNode->GetNodeInGate()->GetOutPort()->BoolValue() ) {
+      cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << anEndSwitchNode->Name()
+             << " reset of InPort()->OutPort()->Done flag in EndSwitch" << endl ;
+      int i ;
+      for ( i = 0 ; i < anEndSwitchNode->GetNodeInPortsSize() ; i++ ) {
+        GraphBase::OutPort * anOutPort = anEndSwitchNode->GetChangeNodeInPort( i )->GetOutPort() ;
+        if ( anOutPort && strcmp( anOutPort->NodeName() , Name() ) ) {
+          cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction "
+                 << anEndSwitchNode->Name() << " InPort "
+                 << anEndSwitchNode->GetChangeNodeInPort( i )->PortName() << " NOTDONE from "
+                 << anOutPort->NodeName() << " " << anOutPort->PortName() << endl ;
+          anEndSwitchNode->GetChangeNodeInPort( i )->State( SUPERV::WaitingState ) ;
+          anEndSwitchNode->GetChangeNodeInPort( i )->GetOutPort()->Done( false ) ;
+        }
+        else {
+          cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction "
+                 << anEndSwitchNode->Name() << " InPort "
+                 << anEndSwitchNode->GetChangeNodeInPort( i )->PortName() << " NOT Changed : directly from "
+                 << anOutPort->NodeName() << " " << anOutPort->PortName() << endl ;
+       }
+      }
+    }
+    else {
+      cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name()
+             << " " << Kind() << " OutGate->Value " << GetNodeOutGate()->BoolValue()
+             << " NO reset of InPort()->OutPort()->Done flag in EndSwitch" << endl ;
+    }
+  }
+
+// firsttoNode : node that has the same ThreadNo() as the current node and that have to be activated
+// firstzeroNode : node that has a null ThreadNo() and that have to be activated
   if ( firsttoNode == NULL && firstzeroNode ) {
     firsttoNode = firstzeroNode ;
     cdebug << pthread_self() << "/" << ThreadNo()
-           << " Successed_SuccessAction firsttoNode = firstzeroNode "
+           << " Successed_SuccessAction firsttoNode = firstzeroNode " << firsttoNode->Name()
            << endl ;
   }
   else if ( firsttoNode && firstzeroNode ) {
     SomeDataNodes.push_back( firstzeroNode ) ;
     cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " push firstzeroNode "
            << firstzeroNode->Name() << " " << SomeDataNodes.size() << endl ;
+    firstzeroNode = NULL ;
   }
   else {
     cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " firsttoNode " << firsttoNode
@@ -2152,10 +2302,12 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
   while ( SomeDataNodes.size() ) {
     GraphExecutor::InNode *aNode = SomeDataNodes.front() ;
     SomeDataNodes.pop_front() ;
-//    cdebug << pthread_self() << "/" << ThreadNo()
-//           << " Successed_SuccessAction pop "
-//           << SomeDataNodes.size() << " " << aNode->Name() << endl ;
+    cdebug << pthread_self() << "/" << ThreadNo()
+           << " Successed_SuccessAction pop size "
+           << SomeDataNodes.size() << " " << aNode->Name() << endl ;
     if ( aNode->State() == GraphExecutor::DataReadyState ) {
+      cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction pop CreateNewThreadIf( true )"
+             << endl ;
       aNode->CreateNewThreadIf( true ) ;
       aNode->UnLockDataWait() ;
       res = aNode->DataUndef_AllDataReadyAction() ;
@@ -2826,6 +2978,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
   int i ;
   GraphBase::OutPort * aGateOutPort = NULL ;
   bool OrSwitch = false ;
+  bool DefaultSwitch = false ;
   cdebug_in << "OutParametersSet " << Name() << " nOutParams " << nOutParams << " NewState "
             << NewState << endl ;
 //  cout << "OutParametersSet " << Name() << " nOutParams " << nOutParams << " NewState " << NewState << endl ;
@@ -2838,7 +2991,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
         anOutPort->Done( true ) ;
       }
       else {
-        cdebug << ThreadNo() << " " << "Out" << i << " " << Name() << " "
+        cdebug << ThreadNo() << "OutParametersSet " << "Out" << i << " " << Name() << " "
                << anOutPort->PortName() << " " << anOutPort->Kind() ;
         ServicesAnyData D = OutParametersList[i] ;
         switch (D.Value.type()->kind()) { // { string , long , double , objref }
@@ -2928,17 +3081,27 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
             cdebug << " Switch " ;
             anOutPort->Value( OutParametersList[i].Value );
             if ( anOutPort->InPortsSize() && anOutPort->ChangeInPorts( 0 )->IsGate() ) {
+//JR 09.02.2005 : OrSwitch is the OR of all SwitchBranches :
+//It controls that there is only one SwitchBranch activated
+//If it's final value is false ==> activation of the Default to GOTO to EndSwitchNode
+//DefaultSwitch is true if a SwitchPort is linked to the DefaultPort of the EndSwitchNode
               if ( OrSwitch && anOutPort->BoolValue() ) {
                 cdebug << "GraphExecutor::InNodeThreads::OutParameters more than one switch is true ERROR"
                        << endl ;
                 RetVal = false ;
              }
-              else {
-                OrSwitch = OrSwitch | anOutPort->BoolValue() ;
-                cdebug << "InNodeThreads::OutParameters OrSwitch = true" << endl ;
+              else if ( anOutPort->BoolValue() ) {
+//JR 09.02.2005 Debug : case of a SwitchPort linked to the DefaultPort of the EndSwitchNode :
+                if ( !strcmp( anOutPort->ChangeInPorts( 0 )->NodeName() , GOTONode()->CoupledNodeName() ) ) {
+                  DefaultSwitch = anOutPort->BoolValue() ;
+               }
+                else {
+                  OrSwitch = OrSwitch | anOutPort->BoolValue() ;
+               }
+                cdebug << "InNodeThreads::OutParameters OrSwitch " << OrSwitch << "DefaultSwitch "
+                       << DefaultSwitch << endl ;
              }
            }
-            cdebug << "OutParametersSet OrSwitch " << OrSwitch ;
           }
           else {
             cdebug << " Param " ;
@@ -2947,8 +3110,15 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
           anOutPort->State( NewState ) ;
           anOutPort->Done( true ) ;
        }
+        cdebug << "OutParametersSet OrSwitch " << OrSwitch << "DefaultSwitch "
+               << DefaultSwitch << endl ;
         int j ;
         for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) {
+          cdebug << ThreadNo() << "OutParametersSet " << "Out" << i << " " << Name() << " "
+                 << anOutPort->PortName() << " " << anOutPort->Kind() << " --> "
+                 << anOutPort->ChangeInPorts( j )->NodeName() << "( "
+                 << anOutPort->ChangeInPorts( j )->PortName() << anOutPort->ChangeInPorts( j )->Kind()
+                 << " )" << endl ;
           bool fromGOTO = false ;
           const char * ToNodeName = anOutPort->ChangeInPorts( j )->NodeName() ;
           if ( !strcmp( ToNodeName , _OutNode->Graph()->Name() ) && _OutNode->Graph()->GraphMacroLevel() != 0 ) {
@@ -2972,12 +3142,13 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
               if ( anOutPort->ChangeInPorts( j )->IsEndSwitch() || fromGOTO ) {
                 cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "("
                        << anOutPort->ChangeInPorts( j )->PortName() << ","
-                       << anOutPort->ChangeInPorts( j )->Kind() << ") WILL BE changed from "
+                       << anOutPort->ChangeInPorts( j )->Kind() << ") CHANGED from "
                        << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName()
                        << "("
                        << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName()
-                       << ") to " << anOutPort->NodeName() << "("
-                       << anOutPort->PortName() << ")" << endl ;
+                       << " to " << anOutPort->ChangeInPorts( j )->GetOutPort()->Kind()
+                       << ") : Done " << anOutPort->Done() << " State "
+                       << Automaton()->StateName( anOutPort->ChangeInPorts( j )->State() ) << endl ;
                 anOutPort->ChangeInPorts( j )->ChangeOutPort( anOutPort ) ;
              }
               else {
@@ -2987,8 +3158,8 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
                        << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName()
                        << "("
                        << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName()
-                       << ") to " << anOutPort->NodeName() << "("
-                       << anOutPort->PortName() << ")" << endl ;
+                       << " " << anOutPort->ChangeInPorts( j )->GetOutPort()->Kind()
+                       << ") " << endl ;
              }
            }
          }
@@ -3052,24 +3223,43 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
       }
     }
     if ( aGateOutPort && IsSwitchNode() ) {
-      if ( OrSwitch ) {
+//JR 09.02.2005 : OrSwitch is the OR of all SwitchBranches :
+//It controls that there is only one SwitchBranch activated
+//If it's final value is false ==> activation of the Default to GOTO to EndSwitchNode
+//DefaultSwitch is true if a SwitchPort (SwitchBranch) is linked to the DefaultPort of the EndSwitchNode
+      if ( !OrSwitch && !DefaultSwitch ) {
+        if ( aGateOutPort->InPortsSize() && aGateOutPort->ChangeInPorts( 0 ) ) {
+          cdebug << ThreadNo() << " " << "Out0 " << Name() << " Open of "
+                 << aGateOutPort->PortName() << " " << aGateOutPort->Kind() << " WITH DefaultPort" << endl ;
+          long l = 1;
+          OutParametersList[0].Value <<= l ;
+          aGateOutPort->Value( OutParametersList[0].Value ) ;
+       }
+        else {
+          cdebug << ThreadNo() << " " << "Out0 " << Name() << " "
+                 << aGateOutPort->PortName() << " " << aGateOutPort->Kind() << " NOT CONNECTED ERROR" << endl ;
+          RetVal = false ;
+       }
+      }
+      else {
         cdebug << ThreadNo() << " " << "Out0 " << Name() << " Close of "
-               << aGateOutPort->PortName() << " " << aGateOutPort->Kind() ;
+               << aGateOutPort->PortName() << " " << aGateOutPort->Kind() << " NO DefaultPort" << endl ;
         long l = 0;
         OutParametersList[0].Value <<= l ;
         aGateOutPort->Value( OutParametersList[0].Value ) ;
       }
-      else {
-        cdebug << ThreadNo() << " " << "Out0 " << Name() << " Open of "
-               << aGateOutPort->PortName() << " " << aGateOutPort->Kind() ;
-        long l = 1;
-        OutParametersList[0].Value <<= l ;
-        aGateOutPort->Value( OutParametersList[0].Value ) ;
+      if ( !OrSwitch || DefaultSwitch ) { // DefaultPort or DefaultSwitch
         int i ;
         for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
           GraphBase::InPort * anInPort ;
           anInPort = CoupledNode()->GetChangeInPort( GetNodeOutPort( i )->PortName() ) ;
-          if ( anInPort ) {
+//JR 09.02.2005 Debug : Change except if it is the DefaultPort
+          if ( anInPort && !anInPort->IsGate() ) {
+            cdebug << "OutParametersSet " << Name() << " " << anInPort->NodeName() << "( "
+                   << anInPort->PortName() << " ) linked from " << anInPort->GetOutPort()->NodeName()
+                   << "( " << anInPort->GetOutPort()->PortName() << " ) CHANGED TO linked from "
+                   << GetChangeNodeOutPort( i )->NodeName() << "( "
+                   << GetChangeNodeOutPort( i )->PortName() << " )" << endl ;
             anInPort->ChangeOutPort( GetChangeNodeOutPort( i ) ) ;
          }
         }