public abstract class AbstractPluginController extends java.lang.Object implements IPluginController
INVALID_INDEX
Constructor and Description |
---|
AbstractPluginController() |
Modifier and Type | Method and Description |
---|---|
void |
addPreSimulatableComponent(java.lang.String key,
com.velasolaris.plugin.controller.spi.IPreSimulatable component)
Adds an IPreSimulatable component.
|
void |
build(com.velasolaris.plugin.controller.spi.PolysunSettings polysunSettings,
java.util.Map<java.lang.String,java.lang.Object> parameters)
Method to pass Polysun properties to this plugin controller.
|
void |
closeResources()
Closes resources and cleans up.
|
java.lang.String |
exportResource(java.lang.String resourceName,
java.lang.String destFolder,
boolean onlyFile)
Export a resource embedded into a Jar file to the local file path.
|
com.velasolaris.plugin.controller.spi.PluginControllerConfiguration.ControlSignal |
getControlSignal(java.lang.String controlSignalName)
Returns the control signal setting for a control signal name.
|
int |
getControlSignalIndex(java.lang.String controlSignalName)
Returns the array index for the control signal name.
|
java.util.List<com.velasolaris.plugin.controller.spi.PluginControllerConfiguration.ControlSignal> |
getControlSignals()
Returns all control signals (configured and generic).
|
java.util.List<java.lang.String> |
getControlSignalsToHide(com.velasolaris.plugin.controller.spi.PolysunSettings polysunSettings,
java.util.Map<java.lang.String,java.lang.Object> parameters)
Determines the controlSignals which must be hidden in the current configuration.
|
boolean[] |
getControlSignalsUsed()
Returns an boolean array for control signals where
true at i
if this control signal is used in Polysun. |
java.lang.String |
getCreator()
The creator of this plugin controller.
|
int |
getCSIdx(java.lang.String controlSignalName)
Returns the array index for the control signal name.
|
java.lang.String |
getDescription()
A short description of this plugin controller.
|
java.lang.String |
getDocumentation()
Documentation of this plugin controller.
|
int |
getFixedTimestep(java.util.Map<java.lang.String,java.lang.Object> parameters)
Fixed timestep.
|
java.lang.String |
getId()
Returns the technical ID of the plugin controller, i.e.
|
java.util.List<com.velasolaris.plugin.controller.spi.PluginControllerConfiguration.Log> |
getLogs()
Returns all logs.
|
com.velasolaris.plugin.controller.spi.PolysunSettings.PropertyValue |
getProp(java.lang.String propertyName)
Returns the property value for a given name Convenience method with a
shorter method name.
|
java.util.List<java.lang.String> |
getPropertiesToHide(com.velasolaris.plugin.controller.spi.PolysunSettings polysunSettings,
java.util.Map<java.lang.String,java.lang.Object> parameters)
Determines the GUI properties which must be hidden in the current configuration.
|
com.velasolaris.plugin.controller.spi.PolysunSettings.PropertyValue |
getProperty(java.lang.String propertyName)
Returns the property value for a given name
|
int |
getPropertyIndex(java.lang.String propertyName)
Gets the index of a property in the property array method.
|
com.velasolaris.plugin.controller.spi.PolysunSettings.PropertyValue |
getPropertyValue(int index)
Gets the property value for a property name as set by the user in the
plugin controller GUI.
|
com.velasolaris.plugin.controller.spi.PolysunSettings.PropertyValue |
getPropertyValue(java.lang.String propertyName)
Gets the property value for a property name as set by the user in the
plugin controller GUI.
|
com.velasolaris.plugin.controller.spi.PluginControllerConfiguration.Sensor |
getSensor(java.lang.String sensorName)
Returns the sensor setting for a sensor name.
|
float |
getSensor(java.lang.String sensorName,
float[] sensors)
Returns the value of a sensor given by name.
|
int |
getSensorIndex(java.lang.String sensorName)
Returns the array index for the sensor name.
|
java.util.List<com.velasolaris.plugin.controller.spi.PluginControllerConfiguration.Sensor> |
getSensors()
Returns the all sensors (configured and generic).
|
java.util.List<java.lang.String> |
getSensorsToHide(com.velasolaris.plugin.controller.spi.PolysunSettings polysunSettings,
java.util.Map<java.lang.String,java.lang.Object> parameters)
Determines the sensors which must be hidden in the current configuration.
|
int |
getSnIdx(java.lang.String sensorName)
Returns the array index for the sensor name.
|
java.lang.String |
getVersion()
The version of this plugin controller.
|
void |
initialiseSimulation(java.util.Map<java.lang.String,java.lang.Object> parameters)
This method is called once before the simulation starts.
|
boolean |
isEnabled(java.util.Map<java.lang.String,java.lang.Object> parameters)
Is this plugin controller enabled?
|
boolean |
isPreSimulatableComponentAvailable(java.lang.String key)
Checks the availability of a pre-simulatable component.
|
void |
setControlSignal(java.lang.String controlSignalName,
float value,
float[] controlSignals)
Sets the control signal given by name with the given value to the control
signal array.
|
void |
terminateSimulation(java.util.Map<java.lang.String,java.lang.Object> parameters)
This method is called once after the simulation.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
control, getConfiguration, getName
public java.lang.String getId()
public void build(com.velasolaris.plugin.controller.spi.PolysunSettings polysunSettings, java.util.Map<java.lang.String,java.lang.Object> parameters) throws com.velasolaris.plugin.controller.spi.PluginControllerException
IPluginController
build
in interface IPluginController
polysunSettings
- The properties and settings of Polysunparameters
- Generic parameterscom.velasolaris.plugin.controller.spi.PluginControllerException
- if there is a problem creating the plugin controller configuration.public com.velasolaris.plugin.controller.spi.PluginControllerConfiguration.ControlSignal getControlSignal(java.lang.String controlSignalName)
controlSignalName
- the name of the control signalnull
if not foundpublic int getControlSignalIndex(java.lang.String controlSignalName)
controlSignalName
- the name of the signal namegetCSIdx(String)
public java.util.List<com.velasolaris.plugin.controller.spi.PluginControllerConfiguration.ControlSignal> getControlSignals()
IPluginController.control(int, boolean, float[], float[], float[], boolean, Map)
.PolysunSettings.getControlSignals()
public java.util.List<java.lang.String> getControlSignalsToHide(com.velasolaris.plugin.controller.spi.PolysunSettings polysunSettings, java.util.Map<java.lang.String,java.lang.Object> parameters)
IPluginController
getControlSignalsToHide
in interface IPluginController
polysunSettings
- The configuration Polysun, user settings of propertiesparameters
- Generic parameterspublic boolean[] getControlSignalsUsed()
true
at i
if this control signal is used in Polysun.public java.lang.String getCreator()
IPluginController
getCreator
in interface IPluginController
null
if there is creator.public int getCSIdx(java.lang.String controlSignalName)
controlSignalName
- the name of the signal namegetControlSignalIndex(String)
public java.lang.String getDescription()
IPluginController
getDescription
in interface IPluginController
null
if there is no descriptionpublic java.lang.String getDocumentation()
IPluginController
getDocumentation
in interface IPluginController
null
if there is no descriptionpublic java.util.List<com.velasolaris.plugin.controller.spi.PluginControllerConfiguration.Log> getLogs()
PolysunSettings.getLogs()
public com.velasolaris.plugin.controller.spi.PolysunSettings.PropertyValue getProp(java.lang.String propertyName)
propertyName
- name of the propertynull
if not foundpublic java.util.List<java.lang.String> getPropertiesToHide(com.velasolaris.plugin.controller.spi.PolysunSettings polysunSettings, java.util.Map<java.lang.String,java.lang.Object> parameters)
IPluginController
getPropertiesToHide
in interface IPluginController
polysunSettings
- The configuration Polysun, user settings of propertiesparameters
- Generic parameterspublic com.velasolaris.plugin.controller.spi.PolysunSettings.PropertyValue getProperty(java.lang.String propertyName)
propertyName
- name of the propertynull
if not foundgetProp(String)
public com.velasolaris.plugin.controller.spi.PolysunSettings.PropertyValue getPropertyValue(int index)
index
- index of the property as name given in
PluginControllerConfiguration.null
if not foundpublic com.velasolaris.plugin.controller.spi.PolysunSettings.PropertyValue getPropertyValue(java.lang.String propertyName)
propertyName
- name of the property as name given in
PluginControllerConfiguration. Generic properties
are named with PolysunSettings.GENERIC_PROPERTY_PREFIX
+ number where
the number starts with 1, e.g. PluginControllerProperty1.null
if not foundpublic int getPropertyIndex(java.lang.String propertyName)
propertyName
- name of the property as name given in
PluginControllerConfiguration. Generic properties
are named with PolysunSettings.GENERIC_PROPERTY_PREFIX
+ number where
the number starts with 1, e.g. PluginControllerProperty1.public com.velasolaris.plugin.controller.spi.PluginControllerConfiguration.Sensor getSensor(java.lang.String sensorName)
sensorName
- the name of the sensornull
if not foundpublic float getSensor(java.lang.String sensorName, float[] sensors)
sensorName
- the name of the sensorsensors
- the sensor arraygetSnIdx(String)
public int getSensorIndex(java.lang.String sensorName)
sensorName
- the name of the sensorpublic java.util.List<com.velasolaris.plugin.controller.spi.PluginControllerConfiguration.Sensor> getSensors()
IPluginController.control(int, boolean, float[], float[], float[], boolean, Map)
.PolysunSettings.getSensors()
public java.util.List<java.lang.String> getSensorsToHide(com.velasolaris.plugin.controller.spi.PolysunSettings polysunSettings, java.util.Map<java.lang.String,java.lang.Object> parameters)
IPluginController
getSensorsToHide
in interface IPluginController
polysunSettings
- The configuration Polysun, user settings of propertiesparameters
- Generic parameterspublic int getSnIdx(java.lang.String sensorName)
sensorName
- the name of the sensorgetSensorIndex(String)
public java.lang.String getVersion()
IPluginController
getVersion
in interface IPluginController
null
if there is no versionpublic int getFixedTimestep(java.util.Map<java.lang.String,java.lang.Object> parameters)
IPluginController
getFixedTimestep
in interface IPluginController
parameters
- General parameterspublic void initialiseSimulation(java.util.Map<java.lang.String,java.lang.Object> parameters) throws com.velasolaris.plugin.controller.spi.PluginControllerException
IPluginController
initialiseSimulation
in interface IPluginController
parameters
- Generic parameterscom.velasolaris.plugin.controller.spi.PluginControllerException
- if there is a problempublic boolean isEnabled(java.util.Map<java.lang.String,java.lang.Object> parameters)
IPluginController
isEnabled
in interface IPluginController
parameters
- Generic parameterstrue
if enabled, otherwise false
public void setControlSignal(java.lang.String controlSignalName, float value, float[] controlSignals)
controlSignalName
- the name of the control siganlvalue
- the value to setcontrolSignals
- the array to changepublic void terminateSimulation(java.util.Map<java.lang.String,java.lang.Object> parameters)
IPluginController
terminateSimulation
in interface IPluginController
parameters
- Generic parameterspublic java.lang.String exportResource(java.lang.String resourceName, java.lang.String destFolder, boolean onlyFile) throws java.io.FileNotFoundException, java.io.IOException
resourceName
- ie.: "/control.m"destFolder
- the destination folderonlyFile
- should the only the file without resource path be exported?java.io.FileNotFoundException
- if file not foundjava.io.IOException
- for I/O problemspublic void closeResources()
IPluginController
closeResources
in interface IPluginController
public void addPreSimulatableComponent(java.lang.String key, com.velasolaris.plugin.controller.spi.IPreSimulatable component)
IPluginController
addPreSimulatableComponent
in interface IPluginController
AbstractPluginController
,
IPreSimulatable
public boolean isPreSimulatableComponentAvailable(java.lang.String key)
IPluginController
IPluginController.initialiseSimulation(Map)
method is called.
Thus, this method will only return true during the simulation.isPreSimulatableComponentAvailable
in interface IPluginController
true
if the component is available, false
otherwise.IPreSimulatable