예제 #1
0
  /** Initialize state-holding variables */
  public void initialize() throws IllegalActionException {
    super.initialize();

    // OST por aqui
    lastFired = inputreq[0];

    for (int i = 0; i < 5; i++) {
      state[i] = 0;
    }

    for (int i = 0; i < 5; i++) {
      freeoutput[i] = true;
    }

    for (int i = 0; i < 5; i++) {
      txack[i] = false;
    }

    // check whether requesting ports have connections
    // if positive, set state to REQUESTING

    for (int i = 0; i < 5; i++) {
      if (inputreq[i].getWidth() > 0) {
        state[i] = REQUESTING;
      }
    }
  }
예제 #2
0
 /**
  * Initialize.
  *
  * @exception IllegalActionException If a derived class throws it.
  */
 public void initialize() throws IllegalActionException {
   super.initialize();
   _readThread = null;
   _postfireReturns = true;
   // Force reinitialization of the pool.
   attributeChanged(initialPool);
 }
예제 #3
0
  /**
   * Initialize the integrator. Check for the existence of a director and an ODE solver. Set the
   * state to the value given by <i>initialState</i>.
   *
   * @exception IllegalActionException If there is no director, or the director has no ODE solver,
   *     or the initialState parameter does not contain a valid token, or the superclass throws it.
   */
  public void initialize() throws IllegalActionException {
    ContinuousDirector dir = (ContinuousDirector) getDirector();

    if (dir == null) {
      throw new IllegalActionException(this, " no director available");
    }

    ContinuousODESolver solver = dir._getODESolver();

    if (solver == null) {
      throw new IllegalActionException(this, " no ODE solver available");
    }

    super.initialize();
    _lastRound = -1;
    _tentativeState = ((DoubleToken) initialState.getToken()).doubleValue();
    _state = _tentativeState;

    if (_debugging) {
      _debug("Initialize: initial state = " + _tentativeState);
    }

    // The number of auxiliary variables that are used depends on
    // the solver.
    int n = solver.getIntegratorAuxVariableCount();
    if ((_auxVariables == null) || (_auxVariables.length != n)) {
      _auxVariables = new double[n];
    }
  }
예제 #4
0
파일: GRActor.java 프로젝트: sf577/Project
  /**
   * Check whether the current director is a GRDirector. If not, throw an illegal action exception.
   *
   * @exception IllegalActionException If the current director is not a GRDirector.
   */
  public void initialize() throws IllegalActionException {
    super.initialize();
    _isSceneGraphInitialized = false;

    /*
     * if (!(getDirector() instanceof GRDirector)) { throw new
     * IllegalActionException(this,
     * "GR Actors can only be used under a GR Director"); }
     */
  }
예제 #5
0
 /** Initialize the component and connect to the ORB. */
 public void initialize() throws IllegalActionException {
   try {
     super.initialize();
     _orb = new Orb(StringToken.convert(orbname.getToken()).stringValue(), "r");
     _orb.select(StringToken.convert(srcname.getToken()).stringValue());
     _orb.after(0);
   } catch (Exception e) {
     throw new IllegalActionException(
         this, "Couldn't connect to Orb." + " (" + e.getMessage() + ")");
   }
 }
예제 #6
0
  public void initialize() throws IllegalActionException {
    super.initialize();

    init_tim = ((DoubleToken) initial_time.getToken()).doubleValue();

    current_time = getDirector().getModelTime();

    firstSend = current_time.add(init_tim);

    getDirector().fireAt(this, firstSend);

    // Get the simulation Stop time
    DEstop_time = getDirector().getModelStopTime();
    stop_time = DEstop_time.getDoubleValue();

    if (_debugging) _debug("GET STOP TIME: ");
  }
예제 #7
0
  public void initialize() throws IllegalActionException {
    super.initialize();

    IntToken it = (IntToken) LS0Bytes.getToken();
    _LS0Bytes = it.intValue();

    BooleanToken _bt = (BooleanToken) LS0Map.getToken();
    _LS0Map = _bt.booleanValue();

    it = (IntToken) S.getToken();
    _S = it.intValue();

    _fastReg = 0;
    _interReg = 0;
    _frameCounter = 0;

    _checkParameters();
  }
예제 #8
0
  /**
   * Initialize allocates the socket and makes use of default parameters for the remote address and
   * socket to which datagrams will be sent.
   *
   * @exception IllegalActionException If the default remote socket number is outside the range
   *     0..65535, the local socket number is outside the range 0..65535, the local socket cannot be
   *     created with the given socket number (such as because that number is already in use), or
   *     translation of remote address fails to make an IP address from the given address string
   *     (i.e. InetAddress.getByName() fails in the address lookup attempt.
   */
  public void initialize() throws IllegalActionException {
    super.initialize();
    _localSocketNumber = ((IntToken) (localSocketNumber.getToken())).intValue();

    if ((_localSocketNumber < 0) || (_localSocketNumber > 65535)) {
      throw new IllegalActionException(
          this, "Local socket number " + _localSocketNumber + " must be between 0 and 65535.");
    }

    try {
      if (_debugging) {
        _debug("PI Try create socket number " + _localSocketNumber);
      }

      _socket = new DatagramSocket(_localSocketNumber);

      if (_debugging) {
        _debug("PI A socket is created!!");
      }
    } catch (SocketException ex) {
      throw new IllegalActionException(
          this, ex, "Cannot create socket on " + "the specified local socket number");
    }

    String address = ((StringToken) defaultRemoteAddress.getToken()).stringValue();

    try {
      _address = InetAddress.getByName(address);
    } catch (UnknownHostException ex) {
      throw new IllegalActionException(
          this, ex, "The default remote " + "address specifies an unknown host");
    }

    _remoteSocketNumber = ((IntToken) defaultRemoteSocketNumber.getToken()).intValue();

    if ((_remoteSocketNumber < 0) || (_remoteSocketNumber > 65535)) {
      _remoteSocketNumber &= 65535; // Truncate to 16 bits.
      throw new IllegalActionException(
          this,
          "defaultRemoteSocketNumber"
              + _remoteSocketNumber
              + " is out of range, must be between 0 and 65535.");
    }
  }
예제 #9
0
 /**
  * Initialize this actor.
  *
  * @exception IllegalActionException If a derived class throws it.
  */
 public void initialize() throws IllegalActionException {
   super.initialize();
   _terminate = false;
 }
예제 #10
0
 /**
  * Initialize this actor so that the <i>falseOutput</i> is written to until a token arrives on the
  * <i>control</i> input.
  *
  * @exception IllegalActionException If the parent class throws it.
  */
 public void initialize() throws IllegalActionException {
   super.initialize();
   _control = false;
 }
예제 #11
0
 public void initialize() throws IllegalActionException {
   super.initialize();
   _reset();
 }
예제 #12
0
 /**
  * Initialize this actor. Derived classes should extend this method to initialize the appropriate
  * audio resource.
  *
  * @exception IllegalActionException If there is a problem beginning audio playback.
  */
 public void initialize() throws IllegalActionException {
   super.initialize();
   _isExecuting = true;
 }
예제 #13
0
 /** Set the incial state */
 public void initialize() throws IllegalActionException {
   super.initialize();
   state = RECEIVING_ADD;
 }
예제 #14
0
 /**
  * Initialize the private variables.
  *
  * @exception IllegalActionException If thrown by the base class.
  */
 public void initialize() throws IllegalActionException {
   super.initialize();
   _totalPower = 0.0;
   _receptions.clear();
 }
예제 #15
0
파일: Sequence.java 프로젝트: blickly/ptii
 /**
  * Initialize the actor by resetting to the first output value.
  *
  * @exception IllegalActionException If there is no director.
  */
 public void initialize() throws IllegalActionException {
   // Note that this will default to null if there is no initialValue set.
   _currentIndex = 0;
   _outputProduced = false;
   super.initialize();
 }