Program: 72560
Project: 72560
Buggy source:
/** 
 * Configure the QSS integrator's input variable models. <p>This cannot be done during initialization stage, because did not yet have all the information needed.</p>
 * @param currentTime The current simulation time.
 */
private final void _initializeQSSIntegratorInputVariables(final Time currentTime) throws IllegalActionException {
  if (_debugging) {
    _debugToStdOut(String.format("String_Node_Str",System.identityHashCode(this),currentTime.toString()));
  }
  final int ivCt=_qssSolver.getInputVariableCount();
  if (ivCt > 0) {
    _inputVariableModels=new ModelPolynomial[ivCt];
  }
  final int ivMdlOrder=_qssSolver.getStateModelOrder();
  for (int ii=0; ii < ivCt; ++ii) {
    final Input input=_inputs.get(ii);
    if (!input.port.isKnown(0)) {
      throw new IllegalActionException(this,String.format("String_Node_Str",input.port.getName()));
    }
    final ModelPolynomial ivMdl=new ModelPolynomial(ivMdlOrder);
    _inputVariableModels[ii]=ivMdl;
    ivMdl.claimWriteAccess();
    _qssSolver.addInputVariableModel(ii,ivMdl);
  }
  for (int ii=0; ii < ivCt; ++ii) {
    final Input input=_inputs.get(ii);
    double initialValue;
    if (input.port.hasToken(0)) {
      final Token token=input.port.get(0);
      if (token instanceof QSSToken) {
        final QSSToken qssTok=(QSSToken)token;
        initialValue=qssTok.valueAndDerivatives()[0];
      }
 else       if (token instanceof DoubleToken) {
        initialValue=((DoubleToken)token).doubleValue();
      }
 else {
        throw new IllegalActionException(this,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",input.port.getName()));
      }
    }
 else {
      initialValue=input.start;
      if (_debugging) {
        _debugToStdOut(String.format("String_Node_Str",System.identityHashCode(this),ii,initialValue));
      }
    }
    final ModelPolynomial ivMdl=_inputVariableModels[ii];
    ivMdl.coeffs[0]=initialValue;
    ivMdl.tMdl=currentTime;
  }
  final String failMsg=_qssSolver.validate();
  if (null != failMsg) {
    throw new IllegalActionException(this,failMsg);
  }
  _triggerQuantizationEvents(currentTime,false);
  try {
    _qssSolver.triggerRateEvent();
  }
 catch (  Exception ee) {
    throw new IllegalActionException(this,ee,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Configure the QSS integrator's input variable models. <p>This cannot be done during initialization stage, because did not yet have all the information needed.</p>
 * @param currentTime The current simulation time.
 */
private final void _initializeQSSIntegratorInputVariables(final Time currentTime) throws IllegalActionException {
  if (_debugging) {
    _debugToStdOut(String.format("String_Node_Str",System.identityHashCode(this),currentTime.toString()));
  }
  final int ivCt=_qssSolver.getInputVariableCount();
  if (ivCt > 0) {
    _inputVariableModels=new ModelPolynomial[ivCt];
  }
  final int ivMdlOrder=_qssSolver.getStateModelOrder();
  for (int ii=0; ii < ivCt; ++ii) {
    final Input input=_inputs.get(ii);
    if (!input.port.isKnown(0)) {
      throw new IllegalActionException(this,String.format("String_Node_Str",input.port.getName()));
    }
    final ModelPolynomial ivMdl=new ModelPolynomial(ivMdlOrder);
    _inputVariableModels[ii]=ivMdl;
    ivMdl.claimWriteAccess();
    _qssSolver.addInputVariableModel(ii,ivMdl);
  }
  for (int ii=0; ii < ivCt; ++ii) {
    final Input input=_inputs.get(ii);
    double initialValue;
    if (input.port.hasToken(0)) {
      final Token token=input.port.get(0);
      if (token instanceof QSSToken) {
        final QSSToken qssTok=(QSSToken)token;
        initialValue=qssTok.doubleValue();
      }
 else       if (token instanceof DoubleToken) {
        initialValue=((DoubleToken)token).doubleValue();
      }
 else {
        throw new IllegalActionException(this,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",input.port.getName()));
      }
    }
 else {
      initialValue=input.start;
      if (_debugging) {
        _debugToStdOut(String.format("String_Node_Str",System.identityHashCode(this),ii,initialValue));
      }
    }
    final ModelPolynomial ivMdl=_inputVariableModels[ii];
    ivMdl.coeffs[0]=initialValue;
    ivMdl.tMdl=currentTime;
  }
  final String failMsg=_qssSolver.validate();
  if (null != failMsg) {
    throw new IllegalActionException(this,failMsg);
  }
  _triggerQuantizationEvents(currentTime,false);
  try {
    _qssSolver.triggerRateEvent();
  }
 catch (  Exception ee) {
    throw new IllegalActionException(this,ee,"String_Node_Str");
  }
}