Package ca.nengo.model

Examples of ca.nengo.model.SimulationException


                String originName = stateName.substring(0,stateName.length()-4);
                try {
                    DecodedOrigin o = (DecodedOrigin) getOrigin(originName);
                    result = o.getSTPHistory();
                } catch (StructuralException e) {
                    throw new SimulationException(e);
                }
    } else {
        result = super.getHistory(stateName);
    }
View Full Code Here


   * @param noises New output noise model for each dimension of output
   * @throws SimulationException
   */
  public void setNoises(Noise[] noises) throws SimulationException {
    if(noises.length != getDimensions()) {
      throw new SimulationException("Provided noises do not match dimension of origin");
    }
    myNoise = noises[0];
    myNoises = new Noise[getDimensions()];
    for (int i = 0; i < myNoises.length; i++) {
      myNoises[i] = noises[i];
View Full Code Here

   * @throws SimulationException If the given state is not of the expected dimension (ie the input
   *     dimension of the functions provided in the constructor)
   */
  public void run(float[] state, float startTime, float endTime) throws SimulationException {
    if (state != null && state.length != myFunctions[0].getDimension()) {
      throw new SimulationException("Origin dimension is " + myFunctions[0].getDimension() +
          " but state dimension is " + state.length);
    }

    float[] values = new float[myFunctions.length];
    float stepSize = endTime - startTime;

    mySTPHistory = new float[myNodes.length];
    if (myMode == SimulationMode.DIRECT) {
      for (int i = 0; i < values.length; i++) {
        values[i] = myFunctions[i].map(state);
      }
    } else if (myMode == SimulationMode.EXPRESS) {
      for (int i = 0; i < values.length; i++) {
        values[i] = myFunctions[i].map(state);
      }
     
      //create default ExpressModel if necessary ...
      if (myExpressModel == null) {
        myExpressModel = new DefaultExpressModel(this);
      }
     
      values = myExpressModel.getOutput(startTime, state, values);
    } else {
      for (int i = 0; i < myNodes.length; i++) {
        try {
          InstantaneousOutput o = myNodes[i].getOrigin(myNodeOrigin).getValues();

          float val = 0;
          if (o instanceof SpikeOutput) {
            val = ((SpikeOutput) o).getValues()[0] ? 1f / stepSize : 0f;
          } else if (o instanceof RealOutput) {
            val = ((RealOutput) o).getValues()[0];
          } else {
            throw new Error("Node output is of type " + o.getClass().getName()
              + ". DecodedOrigin can only deal with RealOutput and SpikeOutput, so it apparently has to be updated");
          }

          float[] decoder = getDynamicDecoder(i, val, startTime, endTime);
          for (int j = 0; j < values.length; j++) {
            values[j] += val * decoder[j];
          }
        } catch (StructuralException e) {
          throw new SimulationException(e);
        }
      }
    }
   
    if (myNoise != null) {
View Full Code Here

TOP

Related Classes of ca.nengo.model.SimulationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.