Package org.geppetto.core.model.quantities

Examples of org.geppetto.core.model.quantities.PhysicalQuantity


  {
    if(_timeSeries.size() == 0)
    {
      return null;
    }
    PhysicalQuantity first = _timeSeries.get(0);
    _timeSeries.remove(0);
    return first;
  }
View Full Code Here


      }
    }

    String commonProperties = this.commonProperties(node);

    PhysicalQuantity quantity = node.consumeFirstValue();

    if (quantity != null) {
      AValue value = quantity.getValue();
      String unit = null, scale = null;

      if (quantity.getUnit() != null) {
        unit = "\"" + quantity.getUnit() + "\"";
      }
      if (quantity.getScalingFactor() != null) {
        scale = "\"" + quantity.getScalingFactor() + "\"";
      }
      _serialized.append("\"" + node.getId() + "\":{\"value\":" + value
          + ",\"unit\":" + unit + ",\"scale\":" + scale + ","
          + commonProperties + "},");
    } else {
View Full Code Here

  }

  public boolean visitDynamicsSpecificationNode(DynamicsSpecificationNode node) {
    String commonProperties = this.commonProperties(node);

    PhysicalQuantity quantity = node.getInitialConditions();
    FunctionNode functionNode = node.getDynamics();

    String specs = "", function = "";

    if (quantity != null) {
      AValue value = quantity.getValue();
      String unit = null, scale = null;

      if (quantity.getUnit() != null) {
        unit = quantity.getUnit();
      }
      if (quantity.getScalingFactor() != null) {
        scale = "\"" + quantity.getScalingFactor() + "\"";
      }
      specs = "\"value\":" + "\"" + value + "\",\"unit\":" + "\"" + unit
          + "\",\"scale\":" + scale + ",";
    }
View Full Code Here

  public boolean visitParameterSpecificationNode(
      ParameterSpecificationNode node) {
    String commonProperties = this.commonProperties(node);

    PhysicalQuantity quantity = node.getValue();

    if (quantity != null) {
      AValue value = quantity.getValue();
      String unit = null, scale = null;

      if (quantity.getUnit() != null) {
        unit = "\"" + quantity.getUnit() + "\"";
      }
      if (quantity.getScalingFactor() != null) {
        scale = "\"" + quantity.getScalingFactor() + "\"";
      }
      _serialized.append("\"" + node.getId() + "\":{\"value\":" + "\""
          + value + "\",\"unit\":" + unit + ",\"scale\":" + scale
          + "," + commonProperties + "},");
    } else {
View Full Code Here

      try
      {
        value = v.read(start, lenght);
        Type type = Type.fromValue(v.getDataType().toString());

        PhysicalQuantity quantity = new PhysicalQuantity();
        AValue readValue = null;
        switch(type)
        {
          case DOUBLE:
            readValue = ValuesFactory.getDoubleValue(value.getDouble(0));
            break;
          case FLOAT:
            readValue = ValuesFactory.getFloatValue(value.getFloat(0));
            break;
          case INTEGER:
            readValue = ValuesFactory.getIntValue(value.getInt(0));
            break;
          default:
            break;
        }
        quantity.setValue(readValue);
        node.addPhysicalQuantity(quantity);
      }
      catch(IOException | InvalidRangeException e)
      {
        _errorMessage = e.getMessage();
View Full Code Here

    _runtime += timestep;
    ACompositeNode timeStepsNode = new CompositeNode("time tree");
    {
      VariableNode time = new VariableNode("time");
      timeStepsNode.addChild(time);
      PhysicalQuantity t = new PhysicalQuantity();
      t.setUnit(_timeStepUnit);
    }
    ATimeSeriesNode leafNode = (ATimeSeriesNode) timeStepsNode.getChildren().get(0);
    PhysicalQuantity runTime = new PhysicalQuantity();
    runTime.setValue(ValuesFactory.getDoubleValue(_runtime));
    leafNode.addPhysicalQuantity(runTime);
  }
View Full Code Here

                    try
                    {
                      value = hdfVariable.read(start, lenght);
                      Type type = Type.fromValue(hdfVariable.getDataType().toString());

                      PhysicalQuantity quantity = new PhysicalQuantity();
                      AValue readValue = null;
                      switch(type)
                      {
                        case DOUBLE:
                          readValue = ValuesFactory.getDoubleValue(value.getDouble(0));
                          break;
                        case FLOAT:
                          readValue = ValuesFactory.getFloatValue(value.getFloat(0));
                          break;
                        case INTEGER:
                          readValue = ValuesFactory.getIntValue(value.getInt(0));
                          break;
                        default:
                          break;
                      }
                      quantity.setValue(readValue);
                      newNode.addPhysicalQuantity(quantity);
                      node.addChild(newNode);
                    }
                    catch(IOException | InvalidRangeException e)
                    {
View Full Code Here

    group.setLowSpectrumColor("yellow");
    group.setType("group");
   
    VisualGroupElementNode soma = new VisualGroupElementNode("soma");
    soma.setDefaultColor("orange");
    PhysicalQuantity quantity = new PhysicalQuantity();
    quantity.setScalingFactor("ms");
    quantity.setValue(new DoubleValue(12));
    soma.setParameter(quantity);
   
    VisualGroupElementNode synapse = new VisualGroupElementNode("synapse");
    synapse.setDefaultColor("orange");
    PhysicalQuantity quantity2 = new PhysicalQuantity();
    quantity2.setScalingFactor("ms");
    quantity2.setValue(new DoubleValue(12));
    synapse.setParameter(quantity2);
   
    group.getVisualGroupElements().add(soma);
    group.getVisualGroupElements().add(synapse);
   
View Full Code Here

    model.setModified(true);

    DynamicsSpecificationNode dynamics = new DynamicsSpecificationNode(
        "Dynamics");

    PhysicalQuantity value = new PhysicalQuantity();
    value.setScalingFactor("10");
    value.setUnit("ms");
    value.setValue(new DoubleValue(10));
    dynamics.setInitialConditions(value);

    FunctionNode function = new FunctionNode("Function");
    function.setExpression("y=x+2");
    List<String> argumentsF = new ArrayList<String>();
    argumentsF.add("1");
    argumentsF.add("2");
    function.setArgument(argumentsF);

    dynamics.setDynamics(function);

    ParameterSpecificationNode parameter = new ParameterSpecificationNode(
        "Parameter");

    PhysicalQuantity value1 = new PhysicalQuantity();
    value1.setScalingFactor("10");
    value1.setUnit("ms");
    value1.setValue(new DoubleValue(10));

    parameter.setValue(value1);

    FunctionNode functionNode = new FunctionNode("FunctionNode");
    functionNode.setExpression("y=x^2");
    List<String> arguments = new ArrayList<String>();
    arguments.add("1");
    functionNode.setArgument(arguments);

    AspectSubTreeNode visualization = new AspectSubTreeNode(
        AspectTreeType.VISUALIZATION_TREE);
    visualization.setModified(true);

    SphereNode sphere = new SphereNode("sphere");
    Point p = new Point();
    p.setX(new Double(3.3));
    p.setY(new Double(4));
    p.setZ(new Double(-1.444));
    sphere.setPosition(p);
    sphere.setRadius(new Double(33));

    CylinderNode cylinder = new CylinderNode("cylinder");
    Point p2 = new Point();
    p2.setX(new Double(6.3));
    p2.setY(new Double(8));
    p2.setZ(new Double(-3.999));
    cylinder.setPosition(p2);
    Point p3 = new Point();
    p3.setX(new Double(6.3));
    p3.setY(new Double(8));
    p3.setZ(new Double(-3.999));
    cylinder.setDistal(p3);
    cylinder.setRadiusBottom(new Double(34.55));
    cylinder.setRadiusTop(new Double(34.55));

    CylinderNode cylinder2 = new CylinderNode("cylinder");
    cylinder2.setPosition(p2);
    cylinder2.setDistal(p3);
    cylinder2.setRadiusBottom(new Double(34.55));
    cylinder2.setRadiusTop(new Double(34.55));

    CylinderNode cylinder3 = new CylinderNode("cylinder");
    cylinder3.setPosition(p2);
    cylinder3.setDistal(p3);
    cylinder3.setRadiusBottom(new Double(34.55));
    cylinder3.setRadiusTop(new Double(34.55));

    CylinderNode cylinder4 = new CylinderNode("cylinder");
    cylinder4.setPosition(p2);
    cylinder4.setDistal(p3);
    cylinder4.setRadiusBottom(new Double(34.55));
    cylinder4.setRadiusTop(new Double(34.55));

    CylinderNode cylinder5 = new CylinderNode("cylinder");
    cylinder5.setPosition(p2);
    cylinder5.setDistal(p3);
    cylinder5.setRadiusBottom(new Double(34.55));
    cylinder5.setRadiusTop(new Double(34.55));

    CompositeNode vg = new CompositeNode("vg");
    vg.addChild(sphere);
    vg.addChild(cylinder);
    vg.addChild(cylinder2);
    vg.addChild(cylinder3);
    vg.addChild(cylinder4);
    vg.addChild(cylinder5);

    CompositeNode vg2 = new CompositeNode("vg2");
    vg2.addChild(cylinder);
    vg2.addChild(cylinder2);
    vg2.addChild(cylinder3);
    vg2.addChild(cylinder4);
    vg2.addChild(cylinder5);
    vg2.addChild(sphere);

    AspectSubTreeNode simulation = new AspectSubTreeNode(
        AspectTreeType.WATCH_TREE);
    simulation.setModified(true);

    CompositeNode hhpop = new CompositeNode("hhpop[0]");

    VariableNode v = new VariableNode("v");
    PhysicalQuantity quantity = new PhysicalQuantity();
    quantity.setValue(ValuesFactory.getDoubleValue(20d));

    PhysicalQuantity quantity2 = new PhysicalQuantity();
    quantity2.setValue(ValuesFactory.getDoubleValue(100d));

    v.addPhysicalQuantity(quantity);
    v.addPhysicalQuantity(quantity2);

    ParameterNode a1 = new ParameterNode("a");
View Full Code Here

    model.setModified(true);

    DynamicsSpecificationNode dynamics = new DynamicsSpecificationNode(
        "Dynamics");

    PhysicalQuantity value = new PhysicalQuantity();
    value.setScalingFactor("10");
    value.setUnit("ms");
    value.setValue(new DoubleValue(10));
    dynamics.setInitialConditions(value);

    FunctionNode function = new FunctionNode("Function");
    function.setExpression("y=x+2");
    List<String> argumentsF = new ArrayList<String>();
    argumentsF.add("1");
    argumentsF.add("2");
    function.setArgument(argumentsF);

    dynamics.setDynamics(function);

    ParameterSpecificationNode parameter = new ParameterSpecificationNode(
        "Parameter");

    PhysicalQuantity value1 = new PhysicalQuantity();
    value1.setScalingFactor("10");
    value1.setUnit("ms");
    value1.setValue(new DoubleValue(10));

    parameter.setValue(value1);

    FunctionNode functionNode = new FunctionNode("FunctionNode");
    functionNode.setExpression("y=x^2");
    List<String> arguments = new ArrayList<String>();
    arguments.add("1");
    functionNode.setArgument(arguments);

    AspectSubTreeNode visualization = new AspectSubTreeNode(
        AspectTreeType.VISUALIZATION_TREE);
    visualization.setModified(true);

    SphereNode sphere = new SphereNode("sphere");
    Point p = new Point();
    p.setX(new Double(3.3));
    p.setY(new Double(4));
    p.setZ(new Double(-1.444));
    sphere.setPosition(p);
    sphere.setRadius(new Double(33));

    CylinderNode cylinder = new CylinderNode("cylinder");
    Point p2 = new Point();
    p2.setX(new Double(6.3));
    p2.setY(new Double(8));
    p2.setZ(new Double(-3.999));
    cylinder.setPosition(p2);
    Point p3 = new Point();
    p3.setX(new Double(6.3));
    p3.setY(new Double(8));
    p3.setZ(new Double(-3.999));
    cylinder.setDistal(p3);
    cylinder.setRadiusBottom(new Double(34.55));
    cylinder.setRadiusTop(new Double(34.55));

    CylinderNode cylinder2 = new CylinderNode("cylinder");
    cylinder2.setPosition(p2);
    cylinder2.setDistal(p3);
    cylinder2.setRadiusBottom(new Double(34.55));
    cylinder2.setRadiusTop(new Double(34.55));

    CylinderNode cylinder3 = new CylinderNode("cylinder");
    cylinder3.setPosition(p2);
    cylinder3.setDistal(p3);
    cylinder3.setRadiusBottom(new Double(34.55));
    cylinder3.setRadiusTop(new Double(34.55));

    CylinderNode cylinder4 = new CylinderNode("cylinder");
    cylinder4.setPosition(p2);
    cylinder4.setDistal(p3);
    cylinder4.setRadiusBottom(new Double(34.55));
    cylinder4.setRadiusTop(new Double(34.55));

    CylinderNode cylinder5 = new CylinderNode("cylinder");
    cylinder5.setPosition(p2);
    cylinder5.setDistal(p3);
    cylinder5.setRadiusBottom(new Double(34.55));
    cylinder5.setRadiusTop(new Double(34.55));

    CompositeNode vg = new CompositeNode("vg");
    vg.addChild(sphere);
    vg.addChild(cylinder);
    vg.addChild(cylinder2);
    vg.addChild(cylinder3);
    vg.addChild(cylinder4);
    vg.addChild(cylinder5);

    CompositeNode vg2 = new CompositeNode("vg2");
    vg2.addChild(cylinder);
    vg2.addChild(cylinder2);
    vg2.addChild(cylinder3);
    vg2.addChild(cylinder4);
    vg2.addChild(cylinder5);
    vg2.addChild(sphere);

    AspectSubTreeNode simulation = new AspectSubTreeNode(
        AspectTreeType.WATCH_TREE);
    simulation.setModified(true);

    CompositeNode hhpop = new CompositeNode("hhpop[0]");

    VariableNode v = new VariableNode("v");
    PhysicalQuantity quantity = new PhysicalQuantity();
    quantity.setValue(ValuesFactory.getDoubleValue(20d));

    PhysicalQuantity quantity2 = new PhysicalQuantity();
    quantity2.setValue(ValuesFactory.getDoubleValue(100d));

    v.addPhysicalQuantity(quantity);
    v.addPhysicalQuantity(quantity2);

    ParameterNode a1 = new ParameterNode("a");
View Full Code Here

TOP

Related Classes of org.geppetto.core.model.quantities.PhysicalQuantity

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.