Package org.ptolemy.fmi
Class FMIScalarVariable
- java.lang.Object
-
- org.ptolemy.fmi.FMIScalarVariable
-
public class FMIScalarVariable extends java.lang.Object
An object that represents the ScalarVariable element of a modelDescription.xml file contained within a Functional Mock-up Interface .fmu XML file.A Functional Mock-up Unit file is a .fmu file in zip format that contains a .xml file named "modelDescription.xml". In that file, the ModelVariables element may contain elements such as ScalarVariable.
FMI documentation may be found at http://www.modelisar.com/fmi.html.
- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Christopher Brooks
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (cxh)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FMIScalarVariable.Alias
Acceptable values for the alias xml attribute.static class
FMIScalarVariable.Causality
Acceptable values for the causality xml attribute.static class
FMIScalarVariable.Initial
Acceptable values for the initial xml attribute.static class
FMIScalarVariable.Variability
Acceptable values for the variability xml attribute.
-
Field Summary
Fields Modifier and Type Field Description FMIScalarVariable.Alias
alias
The value of the alias xml attribute.FMIScalarVariable.Causality
causality
The value of the causality xml attribute.java.lang.String
description
The value of the description xml attribute.java.util.Set<java.lang.String>
directDependency
The input ports on which an output has a direct dependence.FMIModelDescription
fmiModelDescription
The Model Description for this variable.boolean
hasChanged
The boolean attribute for variable value changed.FMIScalarVariable.Initial
initial
The value of the initial xml attribute.java.util.List<FMIScalarVariable>
inputStateDependentScalarVariables
The input and state variables on which an output has a direct dependence.boolean
isState
The boolean attribute for state variable.java.lang.String
name
The value of the name xml attribute.FMIType
type
The value of the type xml attribute.long
valueReference
The value of the valueReference xml attribute.FMIScalarVariable.Variability
variability
The value of the variability xml attribute.
-
Constructor Summary
Constructors Constructor Description FMIScalarVariable()
Create an empty ScalarVariable.FMIScalarVariable(FMIModelDescription fmiModelDescription, org.w3c.dom.Element element)
Create a ScalarVariable from an XML Element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getBoolean(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as a boolean.Token
getBooleanHybrid(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as a boolean.double
getDouble(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as a double.Token
getDoubleHybrid(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as a double.int
getInt(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as an int.Token
getIntHybrid(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as an int.java.lang.String
getString(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as a String.Token
getStringHybrid(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as a String.void
setBoolean(com.sun.jna.Pointer fmiComponent, boolean value)
Set the value of this variable as a boolean.void
setBooleanHybrid(com.sun.jna.Pointer fmiComponent, boolean value, boolean isAbsent)
Set the value of this variable as a boolean.void
setDouble(com.sun.jna.Pointer fmiComponent, double value)
Set the value of this variable as a double.void
setDoubleHybrid(com.sun.jna.Pointer fmiComponent, java.lang.Double value, boolean isAbsent)
Set the value of this variable as a double.void
setInt(com.sun.jna.Pointer fmiComponent, int value)
Set the value of this variable as an integer.void
setIntHybrid(com.sun.jna.Pointer fmiComponent, java.lang.Integer value, boolean isAbsent)
Set the value of this variable as an integer.void
setString(com.sun.jna.Pointer fmiComponent, java.lang.String value)
Set the value of this variable as a String.void
setStringHybrid(com.sun.jna.Pointer fmiComponent, java.lang.String value, boolean isAbsent)
Set the value of this variable as a String.
-
-
-
Field Detail
-
alias
public FMIScalarVariable.Alias alias
The value of the alias xml attribute.
-
causality
public FMIScalarVariable.Causality causality
The value of the causality xml attribute.
-
description
public java.lang.String description
The value of the description xml attribute.
-
directDependency
public java.util.Set<java.lang.String> directDependency
The input ports on which an output has a direct dependence.
-
fmiModelDescription
public FMIModelDescription fmiModelDescription
The Model Description for this variable.
-
hasChanged
public boolean hasChanged
The boolean attribute for variable value changed.
-
initial
public FMIScalarVariable.Initial initial
The value of the initial xml attribute.
-
inputStateDependentScalarVariables
public java.util.List<FMIScalarVariable> inputStateDependentScalarVariables
The input and state variables on which an output has a direct dependence.
-
isState
public boolean isState
The boolean attribute for state variable.
-
name
public java.lang.String name
The value of the name xml attribute.
-
type
public FMIType type
The value of the type xml attribute.
-
valueReference
public long valueReference
The value of the valueReference xml attribute. In FMI 1.0, a valueReference is typically 32-bits or an unsigned int. Java does not have an unsigned int, so we use a long.
-
variability
public FMIScalarVariable.Variability variability
The value of the variability xml attribute.
-
-
Constructor Detail
-
FMIScalarVariable
public FMIScalarVariable()
Create an empty ScalarVariable.
-
FMIScalarVariable
public FMIScalarVariable(FMIModelDescription fmiModelDescription, org.w3c.dom.Element element)
Create a ScalarVariable from an XML Element.- Parameters:
fmiModelDescription
- the Model Description for this variable.element
- The XML Element that contains attributes.
-
-
Method Detail
-
getBoolean
public boolean getBoolean(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as a boolean.- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.- Returns:
- the value of this variable as boolean.
- See Also:
setBoolean(Pointer, boolean)
-
getDouble
public double getDouble(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as a double. If the variable is of type FMIIntegerType, the the integer value is cast to a double.- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.- Returns:
- the value of this variable as double.
- See Also:
setDouble(Pointer, double)
-
getInt
public int getInt(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as an int.- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.- Returns:
- the value of this variable as an int.
- See Also:
setInt(Pointer, int)
-
getString
public java.lang.String getString(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as a String.- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.- Returns:
- the value of this variable as a String.
- See Also:
setString(Pointer, String)
-
setBoolean
public void setBoolean(com.sun.jna.Pointer fmiComponent, boolean value)
Set the value of this variable as a boolean.- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.value
- The value of this variable.- See Also:
getBoolean(Pointer fmiComponent)
-
setDouble
public void setDouble(com.sun.jna.Pointer fmiComponent, double value)
Set the value of this variable as a double.- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.value
- The value of this variable.- See Also:
getDouble(Pointer)
-
setInt
public void setInt(com.sun.jna.Pointer fmiComponent, int value)
Set the value of this variable as an integer.- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.value
- The value of this variable.- See Also:
getInt(Pointer)
-
setString
public void setString(com.sun.jna.Pointer fmiComponent, java.lang.String value)
Set the value of this variable as a String. This method allocates memory, the caller should eventually call FMIModelDescription.dispose().- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.value
- The value of this variable.- See Also:
getString(Pointer)
-
getBooleanHybrid
public Token getBooleanHybrid(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as a boolean. This is an experimental method. It handles absent values.- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.- Returns:
- the value of this variable as Token.
- See Also:
setBooleanHybrid(Pointer, boolean, boolean)
-
getDoubleHybrid
public Token getDoubleHybrid(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as a double. This is an experimental method. It handles absent values. If the variable is of type FMIIntegerType, the the integer value is cast to a double.- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.- Returns:
- the value of this variable as Token.
- See Also:
setDoubleHybrid(Pointer, Double, boolean)
-
getIntHybrid
public Token getIntHybrid(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as an int.- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.- Returns:
- the value of this variable as a Token.
- See Also:
setIntHybrid(Pointer, Integer, boolean)
-
getStringHybrid
public Token getStringHybrid(com.sun.jna.Pointer fmiComponent)
Return the value of this variable as a String. This is an experimental method. It handles absent values.- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.- Returns:
- the value of this variable as a Token.
- See Also:
setStringHybrid(Pointer, String, boolean)
-
setBooleanHybrid
public void setBooleanHybrid(com.sun.jna.Pointer fmiComponent, boolean value, boolean isAbsent)
Set the value of this variable as a boolean. This is an experimental method that also handle absent tokens- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.value
- The value of this variable.isAbsent
- True if the variable can have the value of absent.- See Also:
getBooleanHybrid(Pointer fmiComponent)
-
setDoubleHybrid
public void setDoubleHybrid(com.sun.jna.Pointer fmiComponent, java.lang.Double value, boolean isAbsent)
Set the value of this variable as a double. This is an experimental method that also handle absent tokens- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.value
- The value of this variable.isAbsent
- True if the variable can have the value of absent.- See Also:
getDoubleHybrid(Pointer)
-
setIntHybrid
public void setIntHybrid(com.sun.jna.Pointer fmiComponent, java.lang.Integer value, boolean isAbsent)
Set the value of this variable as an integer. This is an experimental method that also handle absent tokens- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.value
- The value of this variable.isAbsent
- True if the variable can have the value of absent.- See Also:
getIntHybrid(Pointer)
-
setStringHybrid
public void setStringHybrid(com.sun.jna.Pointer fmiComponent, java.lang.String value, boolean isAbsent)
Set the value of this variable as a String. This is an experimental method that also handle absent tokens This method allocates memory, the caller should eventually call FMIModelDescription.dispose().- Parameters:
fmiComponent
- The Functional Mock-up Interface (FMI) component that contains a reference to the variable.value
- The value of this variable.isAbsent
- True if the variable can have the value of absent.- See Also:
getStringHybrid(Pointer)
-
-