Module helics.capi¶
Classes¶
HelicsBroker¶
class HelicsBroker(handle, cleanup=True)
Base classes¶
helics.capi._HelicsCHandle
Instance attributes¶
-
address Get the connection address for the broker.
-
identifier Get the local identification for the broker.
-
name Get the local identification for the broker.
Methods¶
def add_alias(self, interface_name: str, alias: str)
Create an alias for an interface.
Parameters
interfaceName
: The current name of an interface.alias
: The additional name to use for the given interface.
add_destination_filter_to_endpoint
def add_destination_filter_to_endpoint(self, filter: str, target: str)
Create a filter connection between a named filter and a named endpoint for destination processing.
Parameters
filter
: the name of the filter.target
: the name of the source target.
def add_source_filter_to_endpoint(self, filter: str, target: str)
Create a filter connection between a named filter and a named endpoint for messages coming from that endpoint.
Parameters
filter
: the name of the filter.
target
: the name of the source target.
def data_link(self, source: str, target: str)
Create a data link between a named publication and a named input.
Parameters
source
: the name of the publication.target
: the name of the input.
def disconnect(self)
Disconnect the broker from any other brokers and communications.
def global_error(self, error_code: int, error_string: str)
Generate a global error to terminate the federation.
Parameters
error_code
: an error code to give to the error.error_string
: a string message associated with the error.
def is_connected(self)
Check if the broker is connected.
def query(self, target: str, query: str, mode: HelicsSequencingMode = HelicsSequencingMode.FAST) -> JSONType
Make a query of the broker.
This call is blocking until the value is returned which may take some time depending on the size of the federation and the specific string being queried.
Parameters
target
: the target of the query can be “federation”, “federate”, “broker”, “core”, or a specific name of a federate, core, or broker.query
: a string with the query, see other documentation for specific properties to query, can be defined by the federate.
Returns: a string with the value requested. This is either going to be a vector of strings value or a JSON string stored in the first element of the vector. The string “#invalid” is returned if the query was not valid.
def set_global(self, name: str, value: str)
Set a federation global value.
This overwrites any previous value for this name. globals can be queried with a target of “global” and query of the value to Query.
Parameters
name
: the name of the global to set.value
: the value of the global.
def wait_for_disconnect(self, ms_to_wait: int = -1)
Waits in the current thread until the broker is disconnected.
Parameters
ms_to_wait
: the timeout to wait for disconnect (-1) implies no timeout
Returns: True
if the disconnect was successful false if it timed out
HelicsCallbackFederate¶
class HelicsCallbackFederate(handle)
Base classes¶
Instance attributes¶
-
core
-
current_time
-
n_endpoints
-
n_filters
-
n_inputs
-
n_pending_messages Returns the number of pending receives for all endpoints.
-
n_publications Get the number of publications in this federate.
-
n_subscriptions Get the number of inputs in this federate.
-
name
-
separator
-
state
HelicsCloningFilter¶
class HelicsCloningFilter(handle, cleanup=True)
Base classes¶
Instance attributes¶
-
info Get the interface information field of the filter.
-
name Get the name of the filter.
HelicsCombinationFederate¶
class HelicsCombinationFederate(handle)
Base classes¶
Instance attributes¶
-
core
-
current_time
-
n_endpoints
-
n_filters
-
n_inputs
-
n_pending_messages Returns the number of pending receives for all endpoints.
-
n_publications Get the number of publications in this federate.
-
n_subscriptions Get the number of inputs in this federate.
-
name
-
separator
-
state
HelicsCore¶
class HelicsCore(handle, cleanup=True)
Base classes¶
helics.capi._HelicsCHandle
Instance attributes¶
-
address Get the connection network or connection address for the core.
-
identifier Get an identifier string for the core.
Methods¶
def add_alias(self, interface_name: str, alias: str)
Create an alias for an interface.
Parameters
interface_name
: The current name of an interface.alias
: The additional name to use for the given interface.
def clone(self)
def disconnect(self)
Disconnect the core from its broker.
def global_error(self, error_code: int, error_string: str)
Generate a global error to terminate the federation.
Parameters
error_code
: an error code to give to the error.error_string
: a string message associated with the error.
def is_connected(self) -> bool
Check if the core is connected to the broker.
def is_valid(self) -> bool
Check if the core is valid.
def query(self, target: str, query: str, mode: HelicsSequencingMode = HelicsSequencingMode.FAST) -> JSONType
Make a query of the core.
This call is blocking until the value is returned which may take some time depending on the size of the federation and the specific string being queried
target
: the target of the query can be “federation”, “federate”, “broker”, “core”, or a specific name of a federate, core, or broker
query
: a string with the query, see other documentation for specific properties to query, can be defined by the federate
Returns: a string with the value requested. this is either going to be a vector of strings value or a JSON string stored in the first element of the vector. The string “#invalid” is returned if the query was not valid
def register_cloning_filter(self, delivery_endpoint: str) -> HelicsCloningFilter
Create a cloning Filter on the specified federate.
Cloning filters copy a message and send it to multiple locations source and destination can be added through other functions
Parameters
delivery_endpoint
: the specified endpoint to deliver the message
Returns: a helics.HelicsFilter
object.
def register_filter(self, kind: HelicsFilterType, name: str = "") -> HelicsFilter
Create a destination Filter on the specified federate.
Filters can be created through a federate or a core , linking through a federate allows a few extra features of name matching to function on the federate interface but otherwise equivalent behavior
kind
: the type of filter to create
name
: the name of the filter (can be NULL)
Returns: a helics.HelicsFilter
object.
def set_global(self, name: str, value: str)
Set a global federation value.
Parameters
name
: the name of the global value to set
value
: actual value of the global variable
def set_ready_to_init(self)
Set the core to ready to enter init.
This function only needs to be called for cores that don’t have any federates but may have filters for cores with federates it won’t do anything.
def wait_for_disconnect(self, ms_to_wait: int = -1) -> bool
Waits in the current thread until the broker is disconnected
Parameters
ms_to_wait
: the timeout to wait for disconnect (-1) implies no timeout
Returns: true if the disconnect was successful false if it timed out.
HelicsCoreFlag¶
class HelicsCoreFlag(*values)
Enum where members are also (and must be) ints
Base classes¶
enum.IntEnum
HelicsCoreType¶
class HelicsCoreType(*values)
- ****DEFAULT****
- ****TEST****
- ****INTERPROCESS****
- ****IPC****
- ****TCP****
- ****UDP****
- ****NNG****
- ****ZMQ_TEST****
- ****TCP_SS****
- ****HTTP****
- ****WEBSOCKET****
- ****INPROC****
- ****NULL****
Base classes¶
enum.IntEnum
HelicsDataBuffer¶
class HelicsDataBuffer(self, handle, cleanup=False)
Initialize self. See help(type(self)) for accurate signature.
Base classes¶
helics.capi._HelicsCHandle
HelicsDataType¶
class HelicsDataType(*values)
- ****STRING****
- ****DOUBLE****
- ****INT****
- ****COMPLEX****
- ****VECTOR****
- ****COMPLEX_VECTOR****
- ****NAMED_POINT****
- ****BOOLEAN****
- ****TIME****
- ****RAW****
- ****JSON****
- ****MULTI****
- ****ANY****
Base classes¶
enum.IntEnum
HelicsEndpoint¶
class HelicsEndpoint(handle, cleanup=True)
Base classes¶
helics.capi._HelicsCHandle
Instance attributes¶
-
default_destination Get the default destination for an endpoint.
-
info Get the interface information field of the filter.
-
n_pending_messages Returns the number of pending receives for endpoint.
-
name Get the name of the endpoint.
-
type Get the specified type of the endpoint.
Methods¶
def create_message(self) -> HelicsMessage
Create a message object.
def get_message(self) -> HelicsMessage
Get a packet from an endpoint.
def has_message(self) -> bool
Checks if endpoint has unread messages.
def is_valid(self) -> bool
Check if the input is valid.
def send_data(self, data: Union[bytes, HelicsMessage], destination: str = None, time=None)
def subscribe(self, name: str)
Subscribe an endpoint to a publication.
HelicsError¶
class HelicsError(*values)
- ****FATAL****
- ****EXTERNAL_TYPE****
- ****OTHER****
- ****INSUFFICIENT_SPACE****
- ****EXECUTION_FAILURE****
- ****INVALID_FUNCTION_CALL****
- ****INVALID_STATE_TRANSITION****
- ****WARNING****
- ****SYSTEM_FAILURE****
- ****DISCARD****
- ****INVALID_ARGUMENT****
- ****INVALID_OBJECT****
- ****CONNECTION_FAILURE****
- ****REGISTRATION_FAILURE****
- ****OK****
Base classes¶
enum.IntEnum
HelicsException¶
class HelicsException(self, *args, **kwargs)
Common base class for all non-exit exceptions.
Base classes¶
builtins.Exception
HelicsFederate¶
class HelicsFederate(self, handle, cleanup=True)
Initialize self. See help(type(self)) for accurate signature.
Base classes¶
helics.capi._HelicsCHandle
Instance attributes¶
-
core
-
current_time
-
n_endpoints
-
n_filters
-
n_inputs
-
n_pending_messages Returns the number of pending receives for all endpoints.
-
n_publications
-
name
-
separator
-
state
Methods¶
def add_alias(self, interface_name: str, alias: str)
Create an alias for an interface.
Parameters
interface_name
: The current name of an interface.alias
: The additional name to use for the given interface.
def add_dependency(self, federate_name)
Add a dependency for this federate.
Adds an additional internal time dependency for the federate.
Parameters
fed_name
: the name of the federate to add a dependency on.
def disconnect(self)
Terminate the simulation.
Call is will block until the disconnect has been acknowledged, no commands that interact with the core may be called after this function function.
def disconnect_async(self)
Terminate the simulation in a non-blocking call.
self.disconnect_complete()
must be called after this call to complete the disconnect procedure.
def disconnect_complete(self)
Complete the asynchronous terminate pair.
def enter_executing_mode(self, iterate: HelicsIterationRequest = HelicsIterationRequest.NO_ITERATION)
Enter the normal execution mode.
Call will block until all federates have entered this mode.
Parameters
iterate
: An optional flag indicating the desired iteration mode.
def enter_executing_mode_async(self, iterate: HelicsIterationRequest = HelicsIterationRequest.NO_ITERATION)
Enter the normal execution mode.
Call will return immediately but enter_executing_mode_complete
should be called to complete the operation.
Parameters
iterate
: An optional flag indicating the desired iteration mode.
def enter_executing_mode_complete(self)
Complete the async call for entering Execution state.
Call will not block but will return quickly.
The enter_initializing_mode_complete
must be called before doing other operations.
def enter_initializing_mode(self)
Enter the initialization mode after all interfaces have been defined.
The call will block until all federates have entered initialization mode.
def enter_initializing_mode_async(self)
Enter the initialization mode after all interfaces have been defined.
The call will not block but a call to enter_initializing_mode_complete
should be made to complete the call sequence.
enter_initializing_mode_complete
def enter_initializing_mode_complete(self)
Second part of the async process for entering initializationState call after a call to enter_initializing_mode_async
if call any other time it will throw an InvalidFunctionCall
exception
enter_initializing_mode_iterative
def enter_initializing_mode_iterative(self)
Trigger a blocking call and return to created state after all federates have either triggered an iteration or are waiting to enter initializing mode.
enter_initializing_mode_iterative_async
def enter_initializing_mode_iterative_async(self)
Non-blocking alternative to enter_initializing_mode_async
.
A call to enter_initializing_mode_iterative_complete
should be made to complete the call sequence.
enter_initializing_mode_iterative_complete
def enter_initializing_mode_iterative_complete(self)
Complete the call to enter initializing mode iterative that was initiated with enter_initializing_mode_iterative_async
.
def finalize(self)
Terminate the simulation.
Call is will block until the finalize has been acknowledged, no commands that interact with the core may be called after this function function.
DEPRECATED
def finalize_async(self)
Terminate the simulation in a non-blocking call.
self.finalize_complete()
must be called after this call to complete the finalize procedure.
DEPRECATED
def finalize_complete(self)
Complete the asynchronous terminate pair.
DEPRECATED
def get_filter_by_index(self, filter_index)
Get a filter by index.
Parameters
index
: the index of a filter.
Returns: A reference to a filter object which could be invalid if filter_name
is not valid.
def get_filter_by_name(self, filter_name)
Get the id of a source filter from the name of the endpoint.
Parameters
filter_name
: the name of the filter.
Returns: a reference to a filter object which could be invalid if filter_name
is not valid.
def global_error(self, error_code: int, error_string: str)
Generate a global error to terminate the federation.
Parameters
error_code
: an error code to give to the error.error_string
: a string message associated with the error.
def is_async_operation_completed(self)
Called after one of the async calls and will indicate true if an async operation has completed. Only call from the same thread as the one that called the initial async call and will return false if called when no aysnc operation is in flight
def local_error(self, error_code: int, error_string: str)
Generate a local federate error.
Parameters
error_code
: an error code to give to the error.error_string
: a string message associated with the error.
def log_message(self, message: str, level: HelicsLogLevel)
Log an message.
def query(self, target: str, query: str, mode: HelicsSequencingMode = HelicsSequencingMode.FAST) -> JSONType
Make a query of the federate.
This call is blocking until the value is returned which make take some time depending on the size of the federation and the specific string being queried.
Parameters
target
: the target of the query can be “federation”, “federate”, “broker”, “core”, or a specific name of a federate, core, or broker.query
: a string with the query see other documentation for specific properties to query, can be defined by the federate.
Returns: a string with the value requested. this is either going to be a vector of strings value or a JSON string stored in the first element of the vector. The string “#invalid” is returned if the query was not valid.
def register_cloning_filter(self, delivery_endpoint: str) -> HelicsCloningFilter
Create a HelicsCloningFilter
on the specified federate.
Cloning filters copy a message and send it to multiple locations source and destination can be added through other functions.
Parameters
delivery_endpoint
: the specified endpoint to deliver the message.
Returns: A HelicsCloningFilter
object.
def register_filter(self, kind: HelicsFilterType, filter_name: str) -> HelicsFilter
Define a filter interface.
A filter will modify messages coming from or going to target endpoints.
Parameters
kind
: the type of the filter to register.filter_name
: the name of the filter.
register_global_cloning_filter
def register_global_cloning_filter(self, delivery_endpoint: str) -> HelicsCloningFilter
Create a cloning Filter on the specified federate
Cloning filters copy a message and send it to multiple locations source and destination can be added through other functions.
Parameters
delivery_endpoint
: the specified endpoint to deliver the message.
Returns: A CloningFilter object.
def register_global_filter(self, kind: HelicsFilterType, filter_name: str) -> HelicsFilter
Define a filter interface.
A filter will modify messages coming from or going to target endpoints.
Parameters
kind
: the type of the filter to register.filter_name
: the name of the filter.
def register_interfaces(self, config)
Register a set of interfaces defined in a file.
Call is only valid in startup mode
Parameters
configString
: the location of the file or config String to load to generate the interfaces
def request_next_step(self) -> HelicsTime
Request a time advancement to the next allowed time.
Returns: The granted time step.
def request_time(self, time: HelicsTime) -> HelicsTime
Parameters
time
: the next requested time step.
Returns: The granted time step.
def request_time_advance(self, time_delta: HelicsTime) -> HelicsTime
Request a time advancement to the next allowed time.
Parameters
timeDelta
: The amount of time requested to advance.
Returns: The granted time step.
def request_time_async(self, time: HelicsTime)
Request a time advancement and return immediately for asynchronous function.
self.request_time_complete()
should be called to finish the operation and get the result.
Parameters
time
: the next requested time step
def request_time_complete(self) -> HelicsTime
Request a time advancement.
Returns: the granted time step.
def request_time_iterative(self, time: float, iterate: HelicsIterationRequest) -> Tuple[HelicsTime, HelicsIterationResult]
Request a time advancement.
Parameters
time
: the next requested time step.iterate
: a requested iteration mode.
Returns: The granted time step in a structure containing a return time and an iteration_result.
def request_time_iterative_async(self, time: float, iterate: HelicsIterationRequest)
Request a time advancement with iterative call and return for asynchronous function.
self.request_time_iterative_complete()
should be called to finish the operation and get the result.
Parameters
time
: the next requested time step.iterate
: a requested iteration level (none, require, optional).
request_time_iterative_complete
def request_time_iterative_complete(self) -> Tuple[HelicsTime, HelicsIterationResult]
Finalize the time advancement request.
Returns: the granted time step and iteration result.
def set_global(self, name: str, value: str)
Set a federation global value.
This overwrites any previous value for this name.
Parameters
name
: the name of the global to set.value
: the value of the global.
HelicsFederateFlag¶
class HelicsFederateFlag(*values)
- ****OBSERVER****
- ****UNINTERRUPTIBLE****
- ****INTERRUPTIBLE****
- ****SOURCE_ONLY****
- ****ONLY_TRANSMIT_ON_CHANGE****
- ****ONLY_UPDATE_ON_CHANGE****
- ****WAIT_FOR_CURRENT_TIME_UPDATE****
- ****RESTRICTIVE_TIME_POLICY****
- ****ROLLBACK****
- ****FORWARD_COMPUTE****
- ****REALTIME****
- ****SINGLE_THREAD_FEDERATE****
- ****MULTI_THREAD_CORE****
- ****SINGLE_THREAD_CORE****
- ****REENTRANT****
- ****IGNORE_TIME_MISMATCH_WARNINGS****
- ****STRICT_CONFIG_CHECKING****
- ****USE_JSON_SERIALIZATION****
- ****EVENT_TRIGGERED****
- ****LOCAL_PROFILING_CAPTURE****
- ****CALLBACK_FEDERATE****
- ****AUTOMATED_TIME_REQUEST****
Base classes¶
enum.IntEnum
HelicsFederateInfo¶
class HelicsFederateInfo(self, handle, cleanup=True)
Initialize self. See help(type(self)) for accurate signature.
Base classes¶
helics.capi._HelicsCHandle
Instance attributes¶
-
broker
-
broker_init
-
broker_key
-
broker_port
-
core_init
-
core_name
-
core_type
-
local_port
-
separator
HelicsFederateState¶
class HelicsFederateState(*values)
- ****STARTUP****
- ****INITIALIZATION****
- ****EXECUTION****
- ****FINALIZE****
- ****ERROR****
- ****PENDING_INIT****
- ****PENDING_EXEC****
- ****PENDING_TIME****
- ****PENDING_ITERATIVE_TIME****
- ****PENDING_FINALIZE****
- ****FINISHED****
Base classes¶
enum.IntEnum
HelicsFilter¶
class HelicsFilter(self, handle, cleanup=True)
Initialize self. See help(type(self)) for accurate signature.
Base classes¶
helics.capi._HelicsCHandle
Instance attributes¶
-
info Get the interface information field of the filter.
-
name Get the name of the filter.
Methods¶
def add_delivery_endpoint(self, delivery_endpoint: str)
Add a delivery destination from a filter.
Parameters
delivery_endpoint
- A string with the delivery endpoint to add.
def add_destination_target(self, destination: str)
Add a destination target to a cloning filter. All messages going to a destination are copied to the delivery address(es).
def add_source_target(self, source: str)
Add a source target to a cloning filter. All messages coming from a source are copied to the delivery address(es).
def remove_delivery_endpoint(self, delivery_endpoint: str)
Remove a delivery destination from a filter.
Parameters
delivery_endpoint
- A string with the delivery endpoint to remove.
def remove_destination_target(self, destination: str)
remove a destination target from a cloning filter.
def set(self, property: str, value: float)
Set a property on a filter.
HelicsFilterType¶
class HelicsFilterType(*values)
- ****CUSTOM****
- ****DELAY****
- ****RANDOM_DELAY****
- ****RANDOM_DROP****
- ****REROUTE****
- ****CLONE****
- ****FIREWALL****
Base classes¶
enum.IntEnum
HelicsFlag¶
class HelicsFlag(*values)
Enum where members are also (and must be) ints
Base classes¶
enum.IntEnum
HelicsHandleOption¶
class HelicsHandleOption(*values)
- ****CONNECTION_REQUIRED****
- ****CONNECTION_OPTIONAL****
- ****SINGLE_CONNECTION_ONLY****
- ****MULTIPLE_CONNECTIONS_ALLOWED****
- ****BUFFER_DATA****
- ****RECONNECTABLE****
- ****STRICT_TYPE_CHECKING****
- ****RECEIVE_ONLY****
- ****SOURCE_ONLY****
- ****IGNORE_UNIT_MISMATCH****
- ****ONLY_TRANSMIT_ON_CHANGE****
- ****ONLY_UPDATE_ON_CHANGE****
- ****IGNORE_INTERRUPTS****
- ****MULTI_INPUT_HANDLING_METHOD****
- ****INPUT_PRIORITY_LOCATION****
- ****CLEAR_PRIORITY_LIST****
- ****CONNECTIONS****
Base classes¶
enum.IntEnum
HelicsInput¶
class HelicsInput(self, handle)
Initialize self. See help(type(self)) for accurate signature.
Base classes¶
helics.capi._HelicsCHandle
Instance attributes¶
-
boolean Get the value as a boolean.
-
bytes Get a raw value as a character vector.
-
complex Get the value as a complex number.
-
complex_vector get the current value as a vector of complex.
-
double Get the value as a double.
-
info Get the interface information field of the filter.
-
injection_units Get the units associated with an inputs publication.
-
integer Get the current value as a 64 bit integer.
-
json Get a raw value as a character vector.
-
key Get the name/key for the input the name is the local name if given, key is the full key name.
DEPRECATED
-
name Get the name/key for the input the name is the local name if given, key is the full key name.
-
named_point Get the current value as a named point.
-
publication_type Get the units associated with a publication of an input.
-
string Get the current value as a string.
-
target Get the target of the input.
-
type Get the type of the input.
-
units Get the units associated with a input.
-
value
-
vector get the current value as a vector of doubles.
Methods¶
def add_target(self, target: str)
Add a publication target to the input.
def clear_update(self)
Clear the updated flag.
def get_last_update_time(self) -> HelicsTime
Get the last time an input was updated.
def is_updated(self) -> bool
Check if an input is updated.
def is_valid(self) -> bool
Check if the input is valid.
def set_default(self, data: Union[bytes, str, int, bool, float, complex, List[float], List[complex]])
Set the default value as a raw data Set the default value as a string Set the default value as an integer Set the default value as a bool Set the default value as a double Set the default value as a vector of doubles
HelicsIterationRequest¶
class HelicsIterationRequest(*values)
- ****NO_ITERATION****
- ****FORCE_ITERATION****
- ****ITERATE_IF_NEEDED****
Base classes¶
enum.IntEnum
HelicsIterationResult¶
class HelicsIterationResult(*values)
- ****NEXT_STEP****
- ****ERROR****
- ****HALTED****
- ****ITERATING****
Base classes¶
enum.IntEnum
HelicsLogLevel¶
class HelicsLogLevel(*values)
- ****NO_PRINT****
- ****ERROR****
- ****WARNING****
- ****SUMMARY****
- ****CONNECTIONS****
- ****INTERFACES****
- ****TIMING****
- ****DATA****
- ****DEBUG****
- ****TRACE****
Base classes¶
enum.IntEnum
HelicsMessage¶
class HelicsMessage(self, handle, cleanup=True)
Initialize self. See help(type(self)) for accurate signature.
Base classes¶
helics.capi._HelicsCHandle
Instance attributes¶
-
data
-
destination
-
message_id
-
original_dest
-
original_destination
-
original_source
-
raw_data
-
source
-
time
Methods¶
def append(self, data: bytes)
def is_valid(self) -> bool
HelicsMessageFederate¶
class HelicsMessageFederate(self, handle)
Initialize self. See help(type(self)) for accurate signature.
Base classes¶
Instance attributes¶
-
core
-
current_time
-
n_endpoints
-
n_filters
-
n_inputs
-
n_pending_messages Returns the number of pending receives for all endpoints.
-
n_publications
-
name
-
separator
-
state
Methods¶
def create_message(self) -> HelicsMessage
Create a message object.
def get_endpoint_by_index(self, index: int) -> HelicsEndpoint
Get an Endpoint from an index.
Parameters
index
: the index of the endpoint to retrieve index is 0 based
Return an Endpoint
def get_endpoint_by_name(self, name: str) -> HelicsEndpoint
Get an Endpoint from its name.
Parameters
name
: the name of the endpoint to retrieve.
Returns: an Endpoint
def get_message(self) -> HelicsMessage
Get a packet for any endpoints in the federate.
def has_message(self) -> bool
Checks if federate has any messages.
def register_endpoint(self, name: str, kind: str = "") -> HelicsEndpoint
Register an endpoint.
Call is only valid in startup mode
name
: the name of the endpointkind
: the defined type of the interface for endpoint checking if requested
Returns: an Endpoint Object
def register_global_endpoint(self, name: str, kind: str = "") -> HelicsEndpoint
Register an endpoint directly without prepending the federate name.
name
: the name of the endpointkind
: the defined type of the interface for endpoint checking if requested
Returns: an Endpoint Object
HelicsMultiInputMode¶
class HelicsMultiInputMode(*values)
- ****NO_OP****
- ****VECTORIZE_OPERATION****
- ****AND_OPERATION****
- ****OR_OPERATION****
- ****SUM_OPERATION****
- ****DIFF_OPERATION****
- ****MAX_OPERATION****
- ****MIN_OPERATION****
- ****AVERAGE_OPERATION****
Base classes¶
enum.IntEnum
HelicsProperty¶
class HelicsProperty(*values)
- ****TIME_DELTA****
- ****TIME_PERIOD****
- ****TIME_OFFSET****
- ****TIME_RT_LAG****
- ****TIME_RT_LEAD****
- ****TIME_RT_TOLERANCE****
- ****TIME_INPUT_DELAY****
- ****TIME_OUTPUT_DELAY****
- ****TIME_STOPTIME****
- ****TIME_GRANT_TIMEOUT****
- ****INT_CURRENT_ITERATION****
- ****INT_MAX_ITERATIONS****
- ****INT_LOG_LEVEL****
- ****INT_FILE_LOG_LEVEL****
- ****INT_CONSOLE_LOG_LEVEL****
- ****INT_LOG_BUFFER****
- ****INT_INDEX_GROUP****
Base classes¶
enum.IntEnum
HelicsPublication¶
class HelicsPublication(self, handle)
Initialize self. See help(type(self)) for accurate signature.
Base classes¶
helics.capi._HelicsCHandle
Instance attributes¶
-
info Get the interface information field of the publication.
-
key Get the key for the publication.
DEPRECATED
-
name Get the key for the publication.
-
type Get the type for the publication.
-
units Get the units of the publication.
Methods¶
def add_target(self, name: str)
Add a named input to the list of targets a publication publishes to.
def is_valid(self) -> bool
Check if the publication is valid.
def publish(self, data: Union[bytes, str, int, complex, float, List[complex], List[float], Tuple[str, float], bool])
publish raw bytes publish a string publish an int value publish a double publish a complex number publish a vector of doubles publish a named point with a string and double publish a boolean value
HelicsQuery¶
class HelicsQuery(self, handle, cleanup=False)
Initialize self. See help(type(self)) for accurate signature.
Base classes¶
helics.capi._HelicsCHandle
HelicsQueryBuffer¶
class HelicsQueryBuffer(self, handle, cleanup=False)
Initialize self. See help(type(self)) for accurate signature.
Base classes¶
helics.capi._HelicsCHandle
HelicsSequencingMode¶
class HelicsSequencingMode(*values)
Enumeration of sequencing modes for queries fast is the default, meaning the query travels along priority channels and takes precedence of over existing messages; ordered means it follows normal priority patterns and will be ordered along with existing messages
- ****FAST****
- ****ORDERED****
- ****DEFAULT****
Base classes¶
enum.IntEnum
HelicsTranslator¶
class HelicsTranslator(self, handle, cleanup=True)
Initialize self. See help(type(self)) for accurate signature.
Base classes¶
helics.capi._HelicsCHandle
HelicsTranslatorTypes¶
class HelicsTranslatorTypes(*values)
Rnumeration of the predefined translator types
A custom filter type that executes a user defined callback - ****CUSTOM**** A translator type that converts to and from JSON - ****JSON**** A translator type that just encodes the message again in binary - ****BINARY****
Base classes¶
enum.IntEnum
HelicsValueFederate¶
class HelicsValueFederate(self, handle)
Initialize self. See help(type(self)) for accurate signature.
Base classes¶
Instance attributes¶
-
core
-
current_time
-
n_endpoints
-
n_filters
-
n_inputs
-
n_pending_messages Returns the number of pending receives for all endpoints.
-
n_publications Get the number of publications in this federate.
-
n_subscriptions Get the number of inputs in this federate.
-
name
-
separator
-
state
Methods¶
def clear_updates(self)
Clear all the update flags from all federate inputs.
def get_publication_by_index(self, index: int) -> HelicsPublication
Get a publication by index.
Parameters
index
: a 0 based index of the publication to retrieve
Returns: a Publication object
def get_publication_by_name(self, name: str) -> HelicsPublication
Get publication by name.
def get_subscription_by_index(self, index: int) -> HelicsInput
Get a subscription by index.
def get_subscription_by_name(self, name: str) -> HelicsInput
Get an input by index.
def get_subscription_by_target(self, target: str) -> HelicsInput
Get an input by target.
def publish_json(self, data: Union[dict, str])
Publish data contained in a JSON file.
register_from_publication_json
def register_from_publication_json(self, data: Union[dict, str])
Register publications from a JSON output file or string.
Generates interface based on the data contained in a JSON file or string.
def register_global_input(self, name: str, kind: Union[str, HelicsDataType], units: str = "") -> HelicsInput
Register an input.
Call is only valid in startup mode.
Parameters
name
: the name of the inputkind
: a string defining the type of the inputunits
: a string defining the units of the input [optional]
Returns: an input object for use as an identifier.
def register_global_publication(self, name: str, kind: Union[str, HelicsDataType], units: str = "") -> HelicsPublication
Register a publication
Call is only valid in startup mode
Parameters
name
: the name of the publicationkind
: the type of the publicationunits
: a string defining the units of the publication [optional]
Returns: a publication object for use as an identifier
def register_input(self, name: str, kind: Union[str, HelicsDataType], units: str = "") -> HelicsInput
Register an input.
Call is only valid in startup mode.
Parameters
name
: the name of the inputkind
: the type of input to registerunits
: a string defining the units of the input [optional]
Returns: an input id object for use as an identifier
def register_publication(self, name: str, kind: Union[str, HelicsDataType], units: str = "", local: bool = True) -> HelicsPublication
Register a publication.
Call is only valid in startup mode.
Parameters
name
: the name of the publication.kind
: the type of the publication.units
: a string defining the units of the publication [optional]local
: a bool defining whether the publication is global or not [optional]
Returns: a publication id object for use as an identifier
def register_subscription(self, name: str, units: str = "") -> HelicsInput
Functions¶
cchar¶
def cchar(c: str) -> bytes
cdouble¶
def cdouble(d: float) -> float
cstring¶
def cstring(s: str) -> str
generate_cleanup_callback¶
def generate_cleanup_callback(obj)
helicsAbort¶
def helicsAbort(error_code: int, message: str)
helicsBrokerAddAlias¶
def helicsBrokerAddAlias(broker: HelicsBroker, interface_name: str, alias: str)
Create an alias for an interface.
Parameters
interface_name
: The current name of an interface.alias
: The additional name to use for the given interface.
helicsBrokerAddDestinationFilterToEndpoint¶
def helicsBrokerAddDestinationFilterToEndpoint(broker: HelicsBroker, filter_name: str, endpoint_name: str)
Link a named filter to a destination endpoint.
Parameters
broker
- The broker to generate the connection from.filter
- The name of the filter.endpoint
- The name of the endpoint to filter the data going to.
helicsBrokerAddSourceFilterToEndpoint¶
def helicsBrokerAddSourceFilterToEndpoint(broker: HelicsBroker, filter_name: str, endpoint_name: str)
Link a named filter to a source endpoint.
Parameters
broker
- The broker to generate the connection from.filter
- The name of the filter.endpoint
- The name of the endpoint to filter the data from.
helicsBrokerClearTimeBarrier¶
def helicsBrokerClearTimeBarrier(broker: HelicsBroker)
helicsBrokerClone¶
def helicsBrokerClone(broker: HelicsBroker) -> HelicsBroker
Create a new reference to an existing broker. This will create a new broker object that references the existing broker it must be freed as well.
Parameters
broker
- An existinghelics.HelicsBroker
.
Returns: helics.HelicsBroker
.
helicsBrokerDataLink¶
def helicsBrokerDataLink(broker: HelicsBroker, source_name: str, target_name: str)
Link a named publication and named input using a broker.
Parameters
broker
- The broker to generate the connection from.source_name
- The name of the publication.target_name
- The name of the target to send the publication data.
helicsBrokerDestroy¶
def helicsBrokerDestroy(broker: HelicsBroker)
Disconnect and free a broker.
helicsBrokerDisconnect¶
def helicsBrokerDisconnect(broker: HelicsBroker)
Disconnect a broker.
Parameters
broker
- The broker to disconnect.
helicsBrokerFree¶
def helicsBrokerFree(broker: HelicsBroker)
Release the memory associated with a broker.
helicsBrokerGetAddress¶
def helicsBrokerGetAddress(broker: HelicsBroker) -> str
Get the network address associated with a broker.
Parameters
broker
- The broker to query.
Returns: A string with the network address of the broker.
helicsBrokerGetIdentifier¶
def helicsBrokerGetIdentifier(broker: HelicsBroker) -> str
Get an identifier for the broker.
Parameters
broker
- The broker to query.
Returns: A string containing the identifier for the broker.
helicsBrokerGlobalError¶
def helicsBrokerGlobalError(broker: HelicsBroker, error_code: int, error_string: str)
helicsBrokerIsConnected¶
def helicsBrokerIsConnected(broker: HelicsBroker) -> bool
Check if a broker is connected. A connected broker implies it is attached to cores or cores could reach out to communicate.
Returns: True
if connected, False
if not connected.
helicsBrokerIsValid¶
def helicsBrokerIsValid(broker: HelicsBroker) -> bool
Check if a broker object is a valid object.
Parameters
broker
- Thehelics.HelicsBroker
object to test.
Returns: True
if valid, False
if not valid.
helicsBrokerMakeConnections¶
def helicsBrokerMakeConnections(broker: HelicsBroker, file: str)
Load a file containing connection information.
Parameters
broker
- The broker to generate the connections from.file
- A JSON or TOML file containing connection information.
helicsBrokerSendCommand¶
def helicsBrokerSendCommand(broker, target, command, err)
Send a command to another helics object through a broker using asynchronous(fast) messages.
broker
: The broker to send the command through.target
: The name of the object to send the command to.command
: The command to send.
helicsBrokerSendOrderedCommand¶
def helicsBrokerSendOrderedCommand(broker, target, command, err)
Send a command to another helics object through a broker using ordered sequencing.
broker
: The broker to send the command through.target
: The name of the object to send the command to.command
: The command to send.
helicsBrokerSetGlobal¶
def helicsBrokerSetGlobal(broker: HelicsBroker, name: str, value: str)
Set a federation global value. This overwrites any previous value for this name.
Parameters
broker
- The broker to set the global through.name
- The name of the global to set.value
- The value of the global.
helicsBrokerSetLogFile¶
def helicsBrokerSetLogFile(broker: HelicsBroker, log_file: str)
Set the log file on a broker.
Parameters
broker
- The broker to set the log file for.log_file
- The name of the file to log to.
helicsBrokerSetLoggingCallback¶
def helicsBrokerSetLoggingCallback(broker: HelicsBroker, logger, user_data)
Set the logging callback for a helics.HelicsBroker
Add a logging callback function for the C.
The logging callback will be called when a message flows from helics.HelicsBroker
or from the core.
Parameters¶
broker
: thehelics.HelicsBroker
that is created withhelics.helicsCreateBroker
logger
: a callback with signature void(int, const char *, const char *, void *); the function arguments are loglevel, an identifier string, and a message string, and a pointer to user datauser_data
: a pointer to user data that is passed to the function when executing
helicsBrokerSetTimeBarrier¶
def helicsBrokerSetTimeBarrier(broker: HelicsBroker, barrier_time: HelicsTime)
Set the broker time barrier
Parameters¶
broker
: thehelics.HelicsBroker
barrier_time
: the barrier time
helicsBrokerWaitForDisconnect¶
def helicsBrokerWaitForDisconnect(broker: HelicsBroker, ms_to_wait: int) -> bool
Wait for the broker to disconnect.
Parameters
broker
- The broker to wait for.ms_to_wait
- The time out in millisecond (<0 for infinite timeout).
helicsCallbackFederateInitializeCallback¶
def helicsCallbackFederateInitializeCallback(fed: HelicsFederate, initialize, user_data)
Set callback for initialization
This callback will be executed when computing whether to iterate in initialization mode
Parameters¶
fed
: The federate to set the callback for.initialize
: A callback with signature HelicsIterationRequest(void *user_data);user_data
: A pointer to user data that is passed to the function when executing.
helicsCallbackFederateNextTimeCallback¶
def helicsCallbackFederateNextTimeCallback(fed: HelicsFederate, time_update, user_data)
Set callback for the next time update
This callback will be triggered to compute the next time update for a callback federate
Parameters¶
fed
: The federate to set the callback for.time_update
: A callback with signature HelicsTime(HelicsTime time, void *user_data);user_data
: A pointer to user data that is passed to the function when executing.
helicsCallbackFederateNextTimeIterativeCallback¶
def helicsCallbackFederateNextTimeIterativeCallback(fed: HelicsFederate, time_update, user_data)
Set callback for the next time update with iteration capability
This callback will be triggered to compute the next time update for a callback federate
Parameters¶
fed
: The federate to set the callback for.time_update
: A callback with signature HelicsTime(HelicsTime time, void *user_data);user_data
: A pointer to user data that is passed to the function when executing.
helicsCleanupLibrary¶
def helicsCleanupLibrary()
Function to do some housekeeping work. This runs some cleanup routines and tries to close out any residual thread that haven’t been shutdown yet.
helicsClearSignalHandler¶
def helicsClearSignalHandler()
helicsCloseLibrary¶
def helicsCloseLibrary()
Call when done using the helics library. This function will ensure the threads are closed properly. If possible this should be the last call before exiting.
helicsCoreAddAlias¶
def helicsCoreAddAlias(core: HelicsCore, interface_name: str, alias: str)
Create an alias for an interface.
Parameters
interface_name
: The current name of an interface.alias
: The additional name to use for the given interface.
helicsCoreAddDestinationFilterToEndpoint¶
def helicsCoreAddDestinationFilterToEndpoint(core: HelicsCore, filter_name: str, endpoint_name: str)
Link a named filter to a destination endpoint.
Parameters
core
- The core to generate the connection from.filter
- The name of the filter.endpoint
- The name of the endpoint to filter the data going to.
helicsCoreAddSourceFilterToEndpoint¶
def helicsCoreAddSourceFilterToEndpoint(core: HelicsCore, filter_name: str, endpoint_name: str)
Link a named filter to a source endpoint.
Parameters
core
- The core to generate the connection from.filter
- The name of the filter.endpoint
- The name of the endpoint to filter the data from.
helicsCoreClone¶
def helicsCoreClone(core: HelicsCore) -> HelicsCore
Create a new reference to an existing core.
This will create a new helics.HelicsCore
that references the existing core.
The new helics.HelicsCore
must be freed as well.
Parameters
core
- An existinghelics.HelicsCore
.
Returns: helics.HelicsCore
.
helicsCoreConnect¶
def helicsCoreConnect(core: HelicsCore) -> bool
Connect a core to the federate based on current configuration.
Parameters
core
- The core to connect.
Returns: True
if core
is connected successfully, else False
.
helicsCoreDataLink¶
def helicsCoreDataLink(core: HelicsCore, source_name: str, target_name: str)
Link a named publication and named input using a core.
Parameters
core
- The core to generate the connection from.source_name
- The name of the publication.target_name
- The name of the target to send the publication data.
helicsCoreDestroy¶
def helicsCoreDestroy(core: HelicsCore)
Disconnect and free a core.
helicsCoreDisconnect¶
def helicsCoreDisconnect(core: HelicsCore)
Disconnect a core from the federation.
Parameters
core
- The core to query.
helicsCoreFree¶
def helicsCoreFree(core: HelicsCore)
Release the memory associated with a core.
helicsCoreGetAddress¶
def helicsCoreGetAddress(core: HelicsCore) -> str
Get the network address associated with a core.
Parameters
core
- The core to query.
Returns: A string with the network address of the broker.
helicsCoreGetIdentifier¶
def helicsCoreGetIdentifier(core: HelicsCore) -> str
Get an identifier for the core.
Parameters
core
- The core to query.
Returns: A string with the identifier of the core.
helicsCoreGlobalError¶
def helicsCoreGlobalError(core: HelicsCore, error_code: int, error_string: str)
helicsCoreIsConnected¶
def helicsCoreIsConnected(core: HelicsCore) -> bool
Check if a core is connected. A connected core implies it is attached to federates or federates could be attached to it.
Returns: True
if connected, False
if not connected.
helicsCoreIsValid¶
def helicsCoreIsValid(core: HelicsCore) -> bool
Check if a helics.HelicsCore
is a valid object.
Parameters
core
- Thehelics.HelicsCore
object to test.
Returns: True
if valid, False
if not valid.
helicsCoreMakeConnections¶
def helicsCoreMakeConnections(core: HelicsCore, file: str)
Load a file containing connection information.
Parameters
core
- The core to generate the connections from.file
- A JSON or TOML file containing connection information.
helicsCoreRegisterCloningFilter¶
def helicsCoreRegisterCloningFilter(core: HelicsCore, name: str) -> HelicsCloningFilter
Create a cloning Filter on the specified core. Cloning filters copy a message and send it to multiple locations, source and destination can be added through other functions.
Parameters
core
- The core to register through.name
- The name of the filter (can be NULL).
Returns: helics.HelicsFilter
.
helicsCoreRegisterFilter¶
def helicsCoreRegisterFilter(core: HelicsCore, type: HelicsFilterType, name: str) -> HelicsFilter
Create a source Filter on the specified core. Filters can be created through a federate or a core.handle, linking through a federate allows a few extra features of name matching to function on the federate interface but otherwise equivalent behavior.
Parameters
core
- The core to register through.type
- The type of filter to createhelics.HelicsFilterType
.name
- The name of the filter (can be NULL).
Returns: helics.HelicsFilter
.
helicsCoreRegisterTranslator¶
def helicsCoreRegisterTranslator(core: HelicsCore, type: HelicsTranslatorTypes, name: str) -> HelicsTranslator
Create a source Translator on the specified core.
Translators can be created through a federate or a core, linking through a federate allows a few extra features of name matching to function on the federate interface but otherwise equivalent behavior.
Parameters
core
- The core to register through.type
- The type of translator to create /ref HelicsTranslatorTypes.name
- The name of the translator (can be NULL).
Returns: helics.HelicsTranslator
.
helicsCoreSendCommand¶
def helicsCoreSendCommand(core, target, command, err)
Send a command to another helics object through a core using asynchronous(fast) messages.
core
: The broker to send the command through.target
: The name of the object to send the command to.command
: The command to send.
helicsCoreSendOrderedCommand¶
def helicsCoreSendOrderedCommand(core, target, command, err)
Send a command to another helics object through a core using ordered sequencing.
core
: The broker to send the command through.target
: The name of the object to send the command to.command
: The command to send.
helicsCoreSetGlobal¶
def helicsCoreSetGlobal(core: HelicsCore, name: str, value: str)
Set a global value in a core. This overwrites any previous value for this name.
Parameters
core
- The core to set the global through.name
- The name of the global to set.value
- The value of the global.
helicsCoreSetLogFile¶
def helicsCoreSetLogFile(core: HelicsCore, log_file: str)
Set the log file on a core.
Parameters
core
- The core to set the log file for.log_file
- The name of the file to log to.
helicsCoreSetLoggingCallback¶
def helicsCoreSetLoggingCallback(core: HelicsCore, logger, user_data)
Set the logging callback for a helics.HelicsCore
Add a logging callback function for the C.
The logging callback will be called when a message flows from helics.HelicsCore
or from the core.
Parameters¶
core
: thehelics.HelicsCore
that is created withhelics.helicsCreateCore
logger
: a callback with signature void(int, const char *, const char *, void *); the function arguments are loglevel, an identifier string, and a message string, and a pointer to user datauser_data
: a pointer to user data that is passed to the function when executing
helicsCoreSetReadyToInit¶
def helicsCoreSetReadyToInit(core: HelicsCore)
Set the core to ready for init. This function is used for cores that have filters but no federates so there needs to be a direct signal to the core to trigger the federation initialization.
Parameters
core
- Thehelics.HelicsCore
to enable init values for.
helicsCoreWaitForDisconnect¶
def helicsCoreWaitForDisconnect(core: HelicsCore, ms_to_wait: int) -> bool
Wait for the core to disconnect.
Parameters
core
- The core to wait for.ms_to_wait
- The time out in millisecond (<0 for infinite timeout).
helicsCreateBroker¶
def helicsCreateBroker(type: str, name: str = "", init_string: str = "") -> HelicsBroker
Create a broker object
Parameters
type
- The type of the broker to create.name
- The name of the broker. It can be a nullptr or empty string to have a name automatically assigned.init_string
- An initialization string to send to the core-the format is similar to command line arguments. Typical options include a broker address such as –broker=”XSSAF” if this is a subbroker, or the number of federates, or the address.
Returns: helics.HelicsBroker
.
helicsCreateBrokerFromArgs¶
def helicsCreateBrokerFromArgs(type: str, name: str, arguments: List[str]) -> HelicsBroker
Create a helics.HelicsCore
by passing command line arguments.
Parameters
type
- The type of the core to create.name
- The name of the core. It can be a nullptr or empty string to have a name automatically assigned.arguments
- The list of string values from a command line.
Returns: helics.HelicsBroker
.
helicsCreateCallbackFederate¶
def helicsCreateCallbackFederate(fed_name: str, fedInfo: HelicsFederateInfo = None) -> HelicsCallbackFederate
Create a callback federate from helics.HelicsFederateInfo
.
Callback federates are both value federates and message federates, objects can be used in all functions
that take a helics.HelicsFederate
object as an argument.
fed_name
- A string with the name of the federate, can be NULL or an empty string to pull the default name from fi.fedInfo
- The federate info object that contains details on the federate.
Returns: helics.HelicsCallbackFederate
.
helicsCreateCallbackFederateFromConfig¶
def helicsCreateCallbackFederateFromConfig(config_file: str) -> HelicsCallbackFederate
Create a callback federate from a JSON file or JSON string or TOML file.
Callback federates are both value federates and message federates, objects can be used in all functions
that take a helics.HelicsFederate
object as an argument.
Parameters
config_file
- A JSON file or a JSON string or TOML file that contains setup and configuration information.
Returns: helics.HelicsCallbackFederate
.
helicsCreateCombinationFederate¶
def helicsCreateCombinationFederate(fed_name: str, fedInfo: HelicsFederateInfo = None) -> HelicsCombinationFederate
Create a combination federate from helics.HelicsFederateInfo
.
Combination federates are both value federates and message federates, objects can be used in all functions
that take a helics.HelicsFederate
object as an argument.
Parameters
fed_name
- A string with the name of the federate, can be NULL or an empty string to pull the default name from fi.fedInfo
- The federate info object that contains details on the federate.
Returns: helics.HelicsCombinationFederate
.
helicsCreateCombinationFederateFromConfig¶
def helicsCreateCombinationFederateFromConfig(config_file: str) -> HelicsCombinationFederate
Create a combination federate from a JSON file or JSON string or TOML file.
Combination federates are both value federates and message federates, objects can be used in all functions
that take a helics.HelicsFederate
object as an argument.
Parameters
config_file
- A JSON file or a JSON string or TOML file that contains setup and configuration information.
Returns: helics.HelicsCombinationFederate
.
helicsCreateCore¶
def helicsCreateCore(type: str, name: str = "", init_string: str = "") -> HelicsCore
Create a helics.HelicsCore
.
Parameters
type
- The type of the core to create.name
- The name of the core. It can be a nullptr or empty string to have a name automatically assigned.init_string
- An initialization string to send to the core. The format is similar to command line arguments. Typical options include a broker name, the broker address, the number of federates, etc.
Returns: helics.HelicsCore
.
helicsCreateCoreFromArgs¶
def helicsCreateCoreFromArgs(type: str, name: str, arguments: List[str]) -> HelicsCore
Create a helics.HelicsCore
by passing command line arguments.
Parameters
type
- The type of the core to create.name
- The name of the core. It can be a nullptr or empty string to have a name automatically assigned.arguments
- The list of string values from a command line.
Returns: helics.HelicsCore
.
helicsCreateDataBuffer¶
def helicsCreateDataBuffer(initial_capacity: int) -> HelicsDataBuffer
Create a helics managed data buffer with initial capacity
helicsCreateFederateInfo¶
def helicsCreateFederateInfo() -> HelicsFederateInfo
Create helics.HelicsFederateInfo
for specifying federate information when constructing a federate.
Returns: helics.HelicsFederateInfo
.
helicsCreateMessageFederate¶
def helicsCreateMessageFederate(fed_name: str, fedInfo: HelicsFederateInfo = None) -> HelicsMessageFederate
Create helics.HelicsMessageFederate
from helics.HelicsFederateInfo
.
helics.HelicsMessageFederate
objects can be used in all functions that take a helics.HelicsFederate
as an argument.
Parameters
fed_name
- The name of the federate to create.fedInfo
- The federate info object that contains details on the federate.
Returns: helics.HelicsMessageFederate
.
helicsCreateMessageFederateFromConfig¶
def helicsCreateMessageFederateFromConfig(config_file: str) -> HelicsMessageFederate
Create helics.HelicsMessageFederate
from a JSON file or JSON string or TOML file.
helics.HelicsMessageFederate
objects can be used in all functions that take a helics.HelicsFederate
object as an argument.
Parameters
config_file
- A config (JSON,TOML) file or a JSON string that contains setup and configuration information.
Returns: helics.HelicsMessageFederate
.
helicsCreateQuery¶
def helicsCreateQuery(target_name: str, query_string: str) -> HelicsQuery
Create a query object. A query object consists of a target and query string.
Parameters
target_name
- The name of the target to query.query_string
- The query to make of the target.
Returns: helics.HelicsQuery
.
helicsCreateValueFederate¶
def helicsCreateValueFederate(fed_name: str, fedInfo: HelicsFederateInfo = None) -> HelicsValueFederate
Creation and destruction of Federates.
Create helics.HelicsValueFederate
from helics.HelicsFederateInfo
.
helics.HelicsValueFederate
objects can be used in all functions that take a helics.HelicsFederate
as an argument.
Parameters
fed_name
- The name of the federate to create, can NULL or an empty string to use the default name from fi or an assigned name.fedInfo
- The federate info object that contains details on the federate.
Returns: helics.HelicsValueFederate
.
helicsCreateValueFederateFromConfig¶
def helicsCreateValueFederateFromConfig(config_file: str) -> HelicsValueFederate
Create helics.HelicsValueFederate
from a JSON file, JSON string, or TOML file.
helics.HelicsValueFederate
objects can be used in all functions that take a helics.HelicsFederate
as an argument.
Parameters
config_file
- A JSON file or a JSON string or TOML file that contains setup and configuration information.
Returns: helics.HelicsValueFederate
.
helicsDataBufferCapacity¶
def helicsDataBufferCapacity(data: HelicsDataBuffer) -> int
helicsDataBufferClone¶
def helicsDataBufferClone(data: HelicsDataBuffer) -> HelicsDataBuffer
helicsDataBufferConvertToType¶
def helicsDataBufferConvertToType(data: HelicsDataBuffer, new_data_type: int)
helicsDataBufferData¶
def helicsDataBufferData(data: HelicsDataBuffer) -> bytes
helicsDataBufferFillFromBoolean¶
def helicsDataBufferFillFromBoolean(data: HelicsDataBuffer, value: bool) -> int
Convert a bool to serialized bytes
helicsDataBufferFillFromChar¶
def helicsDataBufferFillFromChar(data: HelicsDataBuffer, value: str) -> int
Convert a bool to serialized bytes
helicsDataBufferFillFromComplex¶
def helicsDataBufferFillFromComplex(data: HelicsDataBuffer, value: complex) -> int
Convert a complex to serialized bytes
helicsDataBufferFillFromComplexObject¶
def helicsDataBufferFillFromComplexObject(data: HelicsDataBuffer, value: complex) -> int
Convert a complex to serialized bytes
helicsDataBufferFillFromComplexVector¶
def helicsDataBufferFillFromComplexVector(data: HelicsDataBuffer, value: List[complex]) -> int
Convert a complex to serialized bytes
helicsDataBufferFillFromDouble¶
def helicsDataBufferFillFromDouble(data: HelicsDataBuffer, value: float) -> int
Convert a double to serialized bytes
helicsDataBufferFillFromInteger¶
def helicsDataBufferFillFromInteger(data: HelicsDataBuffer, value: int) -> int
Convert an integer to serialized bytes
helicsDataBufferFillFromNamedPoint¶
def helicsDataBufferFillFromNamedPoint(data: HelicsDataBuffer, name: str, value: float) -> int
Convert a named point to serialized bytes
helicsDataBufferFillFromRawString¶
def helicsDataBufferFillFromRawString(data: HelicsDataBuffer, string: bytes) -> int
Convert a raw string to serialized bytes
helicsDataBufferFillFromString¶
def helicsDataBufferFillFromString(data: HelicsDataBuffer, string: str) -> int
Convert a string to serialized bytes
helicsDataBufferFillFromTime¶
def helicsDataBufferFillFromTime(data: HelicsDataBuffer, value: HelicsTime)
Convert a bool to serialized bytes
helicsDataBufferFillFromVector¶
def helicsDataBufferFillFromVector(data: HelicsDataBuffer, value: List[float]) -> int
Convert a complex to serialized bytes
helicsDataBufferFree¶
def helicsDataBufferFree(data: HelicsDataBuffer)
helicsDataBufferIsValid¶
def helicsDataBufferIsValid(data: HelicsDataBuffer) -> bool
helicsDataBufferReserve¶
def helicsDataBufferReserve(data: HelicsDataBuffer, new_capacity) -> bool
helicsDataBufferSize¶
def helicsDataBufferSize(data: HelicsDataBuffer) -> int
helicsDataBufferStringSize¶
def helicsDataBufferStringSize(data: HelicsDataBuffer) -> int
helicsDataBufferToBoolean¶
def helicsDataBufferToBoolean(data: HelicsDataBuffer) -> bool
helicsDataBufferToChar¶
def helicsDataBufferToChar(data: HelicsDataBuffer) -> str
helicsDataBufferToComplex¶
def helicsDataBufferToComplex(data: HelicsDataBuffer) -> complex
helicsDataBufferToComplexObject¶
def helicsDataBufferToComplexObject(data: HelicsDataBuffer) -> complex
helicsDataBufferToComplexVector¶
def helicsDataBufferToComplexVector(data: HelicsDataBuffer) -> List[complex]
helicsDataBufferToDouble¶
def helicsDataBufferToDouble(data: HelicsDataBuffer) -> float
helicsDataBufferToInteger¶
def helicsDataBufferToInteger(data: HelicsDataBuffer) -> int
helicsDataBufferToNamedPoint¶
def helicsDataBufferToNamedPoint(data: HelicsDataBuffer) -> Tuple[str, float]
helicsDataBufferToRawString¶
def helicsDataBufferToRawString(data: HelicsDataBuffer) -> str
helicsDataBufferToString¶
def helicsDataBufferToString(data: HelicsDataBuffer) -> str
helicsDataBufferToTime¶
def helicsDataBufferToTime(data: HelicsDataBuffer) -> HelicsTime
helicsDataBufferToVector¶
def helicsDataBufferToVector(data: HelicsDataBuffer) -> List[float]
helicsDataBufferType¶
def helicsDataBufferType(data: HelicsDataBuffer) -> int
helicsDataBufferVectorSize¶
def helicsDataBufferVectorSize(data: HelicsDataBuffer) -> int
helicsEndpointAddDestinationFilter¶
def helicsEndpointAddDestinationFilter(endpoint: HelicsEndpoint, filter_name: str)
Add destination filter to endpoint
Parameters¶
endpoint
- The endpoint.filter_name
- The name of the filter.
helicsEndpointAddDestinationTarget¶
def helicsEndpointAddDestinationTarget(endpoint: HelicsEndpoint, destination_name: str)
Add a destination target to a endpoint. All messages coming from a source are copied to the delivery address(es).
Parameters¶
endpoint
- The given endpoint.source_name
- The name of the endpoint to add as a source target.
helicsEndpointAddSourceFilter¶
def helicsEndpointAddSourceFilter(endpoint: HelicsEndpoint, filter_name: str)
Add source filter to endpoint
Parameters¶
endpoint
- The endpoint.filter_name
- The name of the filter.
helicsEndpointAddSourceTarget¶
def helicsEndpointAddSourceTarget(endpoint: HelicsEndpoint, source_name: str)
Add a source target to a endpoint. All messages coming from a source are copied to the delivery address(es).
Parameters¶
endpoint
- The given endpoint.source_name
- The name of the endpoint to add as a source target.
helicsEndpointClearMessages¶
def helicsEndpointClearMessages(endpoint: HelicsEndpoint)
Clear all message from an endpoint.
_**Deprecated: Use helics.helicsFederateClearMessages
to free all messages, or helics.helicsMessageFree
to clear an individual message.
Parameters
endpoint
- The endpoint object to operate on.
DEPRECATED
helicsEndpointCreateMessage¶
def helicsEndpointCreateMessage(endpoint: HelicsEndpoint) -> HelicsMessage
Create a new empty message object. The message is empty and isValid will return false since there is no data associated with the message yet.
Parameters
endpoint
- The endpoint object to associate the message with.
helicsEndpointCreateMessageObject¶
def helicsEndpointCreateMessageObject(endpoint: HelicsEndpoint) -> HelicsMessage
Create a new empty message. The message is empty and isValid will return false since there is no data associated with the message yet.
Parameters
endpoint
- The endpoint object to associate the message with.
DEPRECATED
helicsEndpointGetDefaultDestination¶
def helicsEndpointGetDefaultDestination(endpoint: HelicsEndpoint) -> str
Get the default destination for an endpoint.
Parameters
endpoint
- The endpoint to set the destination for.
Returns: A string with the default destination.
helicsEndpointGetInfo¶
def helicsEndpointGetInfo(endpoint: HelicsEndpoint) -> str
Get the data in the info field of a filter.
Parameters
end
- The filter to query.
Returns: A string with the info field string.
helicsEndpointGetMessage¶
def helicsEndpointGetMessage(endpoint: HelicsEndpoint) -> HelicsMessage
Receive a packet from a particular endpoint.
Parameters
endpoint
- The identifier for the endpoint.
Returns: A message object.
helicsEndpointGetMessageObject¶
def helicsEndpointGetMessageObject(endpoint: HelicsEndpoint) -> HelicsMessage
Receive a packet from a particular endpoint.
Parameters
endpoint
- The identifier for the endpoint.
Returns: A message.
DEPRECATED
helicsEndpointGetName¶
def helicsEndpointGetName(endpoint: HelicsEndpoint) -> str
Get the name of an endpoint.
Parameters
endpoint
- The endpoint object in question.
Returns: The name of the endpoint.
helicsEndpointGetOption¶
def helicsEndpointGetOption(endpoint: HelicsEndpoint, option: HelicsHandleOption) -> int
Get the value of handle option on an endpoint.
Parameters
endpoint
- The endpoint to modify.option
- Integer code for the option to sethelics.HelicsHandleOption
.
Returns: the value of the option, for boolean options will be 0 or 1.
helicsEndpointGetTag¶
def helicsEndpointGetTag(endpoint: HelicsEndpoint, tagname: str)
Get the data in a specified tag of a endpoint.
Parameters
endpoint
: The endpoint object to query.tagname
: The name of the tag to query.
Returns
A string with the tag data.
helicsEndpointGetType¶
def helicsEndpointGetType(endpoint: HelicsEndpoint) -> str
Get the type specified for an endpoint.
Parameters
endpoint
- The endpoint object in question.
Returns: The defined type of the endpoint.
helicsEndpointHasMessage¶
def helicsEndpointHasMessage(endpoint: HelicsEndpoint) -> bool
Check if a given endpoint has any unread messages.
Parameters
endpoint
- The endpoint to check.
Returns: True
if the endpoint has a message, False
otherwise.
helicsEndpointIsValid¶
def helicsEndpointIsValid(endpoint: HelicsEndpoint) -> bool
Check if an endpoint is valid.
Parameters
endpoint
- The endpoint object to check.
Returns: True
if the Endpoint object represents a valid endpoint.
helicsEndpointPendingMessageCount¶
def helicsEndpointPendingMessageCount(endpoint: HelicsEndpoint) -> int
Returns the number of pending receives for all endpoints of a particular federate.
Parameters
endpoint
- The endpoint to query.
helicsEndpointPendingMessages¶
def helicsEndpointPendingMessages(endpoint: HelicsEndpoint) -> int
Returns the number of pending receives for all endpoints of a particular federate.
Parameters
endpoint
- The endpoint to query.
DEPRECATED
helicsEndpointRemoveTarget¶
def helicsEndpointRemoveTarget(endpoint: HelicsEndpoint, target: str)
Remove target from endpoint
Parameters¶
endpoint
- The given endpoint.target_name
- The name of the endpoint to remove.
helicsEndpointSendBytes¶
def helicsEndpointSendBytes(endpoint: HelicsEndpoint, data: bytes)
Send a message from a specific endpoint.
Parameters
endpoint
- The endpoint to send the data from.data
- The data to send
helicsEndpointSendBytesAt¶
def helicsEndpointSendBytesAt(endpoint: HelicsEndpoint, data: bytes, time: HelicsTime)
Send a message at a specific time to the targeted destinations
endpoint
: The endpoint to send the data from.data
: The data to send.time
: The time the message should be sent.
helicsEndpointSendBytesTo¶
def helicsEndpointSendBytesTo(endpoint: HelicsEndpoint, data: bytes, destination: str)
Send a message to the specified destination.
Parameters
endpoint
- The endpoint to send the data from.data
- The data to send.destination
- The target destination.
helicsEndpointSendBytesToAt¶
def helicsEndpointSendBytesToAt(endpoint: HelicsEndpoint, data: bytes, destination: str, time: HelicsTime)
Send a message at a specific time to the specified destination.
Parameters
endpoint
- The endpoint to send the data from.data
- The data to send.destination
- The target destination.time
- The time the message should be sent.
helicsEndpointSendEventRaw¶
def helicsEndpointSendEventRaw(
endpoint: HelicsEndpoint,
destination: str,
data: bytes,
time: HelicsTime,
)
Send a message at a specific time to the specified destination.
Parameters
endpoint
- The endpoint to send the data from.destination
- The target destination.data
- The data to send.time
- The time the message should be sent.
DEPRECATED
Use helicsEndpointSendBytesToAt
instead.
helicsEndpointSendMessage¶
def helicsEndpointSendMessage(endpoint: HelicsEndpoint, message: HelicsMessage)
Send a message object from a specific endpoint.
Parameters
endpoint
- The endpoint to send the data from.message
- The actual message to send which will be copied.
helicsEndpointSendMessageObject¶
def helicsEndpointSendMessageObject(endpoint: HelicsEndpoint, message: HelicsMessage)
Send a message object from a specific endpoint.
Parameters
endpoint
- The endpoint to send the data from.message
- The actual message to send which will be copied.
DEPRECATED
helicsEndpointSendMessageObjectZeroCopy¶
def helicsEndpointSendMessageObjectZeroCopy(endpoint: HelicsEndpoint, message: HelicsMessage)
Send a message object from a specific endpoint.
Parameters
endpoint
- The endpoint to send the data from.message
- The actual message to send which will be copied.
DEPRECATED
helicsEndpointSendMessageRaw¶
def helicsEndpointSendMessageRaw(endpoint: HelicsEndpoint, destination: str, data: bytes)
Send a message to the specified destination.
Parameters
endpoint
- The endpoint to send the data from.destination
- The target destination.data
- The data to send.
DEPRECATED
Use helicsEndpointSendBytesTo
instead
helicsEndpointSendMessageZeroCopy¶
def helicsEndpointSendMessageZeroCopy(endpoint: HelicsEndpoint, message: HelicsMessage)
Send a message object from a specific endpoint, the message will not be copied and the message object will no longer be valid after the call.
Parameters
endpoint
- The endpoint to send the data from.message
- The actual message to send which will be copied.
helicsEndpointSetDefaultDestination¶
def helicsEndpointSetDefaultDestination(endpoint: HelicsEndpoint, destination: str)
Set the default destination for an endpoint if no other endpoint is given.
Parameters
endpoint
- The endpoint to set the destination for.destination
- A string naming the desired default endpoint.
helicsEndpointSetInfo¶
def helicsEndpointSetInfo(endpoint: HelicsEndpoint, info: str)
Set the data in the info field for a filter.
Parameters
endpoint
- The endpoint to query.info
- The string to set.
helicsEndpointSetOption¶
def helicsEndpointSetOption(endpoint: HelicsEndpoint, option: HelicsHandleOption, value: int)
Set a handle option on an endpoint.
Parameters
endpoint
- The endpoint to modify.option
- Integer code for the option to sethelics.HelicsHandleOption
.value
- The value to set the option to.
helicsEndpointSetTag¶
def helicsEndpointSetTag(endpoint: HelicsEndpoint, tagname: str, tagvalue: str)
Set the data in a specific tag for a endpoint.
endpoint
: The endpoint object to set a tag for.
tagname
: The name of the tag to set.
tagvalue
: The string value to associate with a tag.
helicsEndpointSubscribe¶
def helicsEndpointSubscribe(endpoint: HelicsEndpoint, name: str)
Subscribe an endpoint to a publication.
Parameters
endpoint
- The endpoint to use.name
- The name of the publication.
helicsErrorClear¶
def helicsErrorClear(err: HelicsError)
Clear an error object.
helicsErrorInitialize¶
def helicsErrorInitialize()
Return an initialized error object.
helicsFederateAddAlias¶
def helicsFederateAddAlias(fed: HelicsFederate, interface_name: str, alias: str)
Create an alias for an interface.
Parameters
interface_name
: The current name of an interface.alias
: The additional name to use for the given interface.
helicsFederateAddDependency¶
def helicsFederateAddDependency(fed: HelicsFederate, name: str)
Add a time dependency for a federate. The federate will depend on the given named federate for time synchronization.
Parameters
fed
- The federate to add the dependency for.name
- The name of the federate to depend on.
helicsFederateClearMessages¶
def helicsFederateClearMessages(fed: HelicsFederate)
Clear all stored messages from a federate.
This clears messages retrieved through helics.helicsFederateGetMessage
or helics.helicsFederateGetMessageObject
.
Parameters
fed
- The federate to clear the message for.
helicsFederateClearUpdates¶
def helicsFederateClearUpdates(fed: HelicsFederate)
Clear all the update flags from a federates inputs.
Parameters
fed
- The valuehelics.HelicsFederate
for which to clear update flags.
helicsFederateClone¶
def helicsFederateClone(fed: HelicsFederate) -> HelicsFederate
Create a new reference to an existing federate.
This will create a new helics.HelicsFederate
object that references the existing federate.
The new object must be freed as well.
Parameters
fed
- An existinghelics.HelicsFederate
.
Returns: helics.HelicsFederate
.
helicsFederateCosimulationTerminationCallback¶
def helicsFederateCosimulationTerminationCallback(fed: HelicsFederate, cosim_termination, user_data)
Set callback for cosimulation termination
This callback will be executed once when the time advance of the federate/co-simulation has terminated. This may be called as part of the finalize operation, or when a maxTime signal is returned from requestTime or when an error is encountered
Parameters¶
fed
: The federate to set the callback for.cosim_termination
: A callback with signature void( void *user_data);user_data
: A pointer to user data that is passed to the function when executing.
helicsFederateCreateMessage¶
def helicsFederateCreateMessage(fed: HelicsFederate) -> HelicsMessage
Create a new empty message object. The message is empty and isValid will return false since there is no data associated with the message yet.
Parameters
fed
- thehelics.HelicsFederate
to associate the message with.
helicsFederateCreateMessageObject¶
def helicsFederateCreateMessageObject(fed: HelicsFederate) -> HelicsMessage
Create a new empty message object. The message is empty and isValid will return false since there is no data associated with the message yet.
Parameters
fed
- thehelics.HelicsFederate
to associate the message with.
DEPRECATED
helicsFederateDestroy¶
def helicsFederateDestroy(fed: HelicsFederate)
Disconnect and free a federate.
helicsFederateDisconnect¶
def helicsFederateDisconnect(fed: HelicsFederate)
Disconnect the federate. This function halts all communication in the federate and disconnects it from the core.
helicsFederateDisconnectAsync¶
def helicsFederateDisconnectAsync(fed: HelicsFederate)
Disconnect the federate in an async call.
helicsFederateDisconnectComplete¶
def helicsFederateDisconnectComplete(fed: HelicsFederate)
Complete the asynchronous disconnect call.
helicsFederateEnterExecutingMode¶
def helicsFederateEnterExecutingMode(fed: HelicsFederate)
Request that the federate enter the Execution mode.
This call is blocking until granted entry by the helics.HelicsCore
. On return from this call the federate will be at time 0. For an asynchronous alternative call see helics.helicsFederateEnterExecutingModeAsync
Parameters
fed
- A federate to change modes.
helicsFederateEnterExecutingModeAsync¶
def helicsFederateEnterExecutingModeAsync(fed: HelicsFederate)
Request that the federate enter the Execution mode.
This call is non-blocking and will return immediately. Call helics.helicsFederateEnterExecutingModeComplete
to finish the call sequence
Parameters
fed
- Thehelics.HelicsFederate
to complete the call.
helicsFederateEnterExecutingModeComplete¶
def helicsFederateEnterExecutingModeComplete(fed: HelicsFederate)
Complete the call to helics.helicsFederateEnterExecutingModeAsync
.
Parameters
fed
- Thehelics.HelicsFederate
to complete the call.
helicsFederateEnterExecutingModeIterative¶
def helicsFederateEnterExecutingModeIterative(fed: HelicsFederate, iterate: HelicsIterationRequest) -> HelicsIterationResult
Request an iterative time.
This call allows for finer grain control of the iterative process than helics.helicsFederateRequestTime
. It takes a time and iteration request, and returns a time and iteration status.
Parameters
fed
- The federate to make the request of.iterate
-helics.HelicsIterationRequest
, i.e. the requested iteration mode.
Returns: helics.HelicsIterationResult
.
helicsFederateEnterExecutingModeIterativeAsync¶
def helicsFederateEnterExecutingModeIterativeAsync(fed: HelicsFederate, iterate: HelicsIterationRequest)
Request an iterative entry to the execution mode.
This call allows for finer grain control of the iterative process than helics.helicsFederateRequestTime
. It takes a time and iteration request, and returns a time and iteration status.
Parameters
fed
- The federate to make the request of.iterate
-helics.HelicsIterationRequest
, i.e. the requested iteration mode.
helicsFederateEnterExecutingModeIterativeComplete¶
def helicsFederateEnterExecutingModeIterativeComplete(
fed: HelicsFederate,
) -> HelicsIterationResult
Complete the asynchronous iterative call into ExecutionMode.
Parameters
fed
- The federate to make the request of.
Returns: helics.HelicsIterationResult
.
helicsFederateEnterInitializingMode¶
def helicsFederateEnterInitializingMode(fed: HelicsFederate)
Initialization, execution, and time requests. Enter the initialization state of a federate. The initialization state allows initial values to be set and received if the iteration is requested on entry to the execution state. This is a blocking call and will block until the core allows it to proceed.
Parameters
fed
- The federate to operate on.
helicsFederateEnterInitializingModeAsync¶
def helicsFederateEnterInitializingModeAsync(fed: HelicsFederate)
Non blocking alternative to helics.helicsFederateEnterInitializingMode
.
The function helicsFederateEnterInitializationModeFinalize must be called to finish the operation.
Parameters
fed
- The federate to operate on.
helicsFederateEnterInitializingModeComplete¶
def helicsFederateEnterInitializingModeComplete(fed: HelicsFederate)
Finalize the entry to initialize mode that was initiated with helics.helicsFederateEnterInitializingModeAsync
.
Parameters
fed
- The federate desiring to complete the initialization step.
helicsFederateEnterInitializingModeIterative¶
def helicsFederateEnterInitializingModeIterative(fed: HelicsFederate)
Trigger a blocking call and return to created state after all federates have either triggered an iteration or are waiting to enter initializing mode.
Parameters
fed
- The federate to operate on.
helicsFederateEnterInitializingModeIterativeAsync¶
def helicsFederateEnterInitializingModeIterativeAsync(fed: HelicsFederate)
Non-blocking alternative to helics.helicsFederateEnterInitializingModeIterative
.
A call to helics.helicsFederateEnterInitializingModeIterativeComplete
should be made to complete the call sequence.
Parameters
fed
- The federate to operate on.
helicsFederateEnterInitializingModeIterativeComplete¶
def helicsFederateEnterInitializingModeIterativeComplete(fed: HelicsFederate)
Complete the call to enter initializing mode iterative that was initiated with helics.helicsFederateEnterInitializingModeIterativeAsync
.
Parameters
fed
- The federate to operate on.
helicsFederateErrorHandlerCallback¶
def helicsFederateErrorHandlerCallback(fed: HelicsFederate, error_handler, user_data)
Set callback for error handling
This callback will be when a federate error is encountered
Parameters¶
fed
: The federate to set the callback for.error_handler
: A callback with signature void(int errorCode, const char *errorString, void *user_data);user_data
A pointer to user data that is passed to the function when executing.
helicsFederateExecutingEntryCallback¶
def helicsFederateExecutingEntryCallback(fed: HelicsFederate, executing_entry, user_data)
Set callback for the entry to ExecutingMode.
This callback will be executed once on first entry to executing Mode
Parameters¶
fed
: The federate to set the callback for.executing_entry
: A callback with signature void( void *user_data);user_data
: A pointer to user data that is passed to the function when executing.
helicsFederateFinalize¶
def helicsFederateFinalize(fed: HelicsFederate)
Finalize the federate. This function halts all communication in the federate and disconnects it from the core.
DEPRECATED
helicsFederateFinalizeAsync¶
def helicsFederateFinalizeAsync(fed: HelicsFederate)
Finalize the federate in an async call.
DEPRECATED
helicsFederateFinalizeComplete¶
def helicsFederateFinalizeComplete(fed: HelicsFederate)
Complete the asynchronous disconnect call.
DEPRECATED
helicsFederateFree¶
def helicsFederateFree(fed: HelicsFederate)
Release the memory associated with a federate.
helicsFederateGetCommand¶
def helicsFederateGetCommand(fed: HelicsFederate) -> str
helicsFederateGetCommandSource¶
def helicsFederateGetCommandSource(fed: HelicsFederate) -> str
helicsFederateGetCore¶
def helicsFederateGetCore(fed: HelicsFederate) -> HelicsCore
Get the helics.HelicsCore
associated with a federate.
Parameters
fed
-helics.HelicsFederate
.
Returns: helics.HelicsCore
.
helicsFederateGetCoreObject¶
def helicsFederateGetCoreObject(fed: HelicsFederate) -> HelicsCore
Get the helics.HelicsCore
associated with a federate.
Parameters
fed
-helics.HelicsFederate
.
Returns: helics.HelicsCore
.
DEPRECATED
helicsFederateGetCurrentTime¶
def helicsFederateGetCurrentTime(fed: HelicsFederate) -> HelicsTime
Get the current time of the federate.
Parameters
fed
- Thehelics.HelicsFederate
to query.
Returns: helics.HelicsTime
.
helicsFederateGetEndpoint¶
def helicsFederateGetEndpoint(fed: HelicsFederate, name: str) -> HelicsEndpoint
Get an endpoint object from a name.
Parameters
fed
- The messagehelics.HelicsFederate
to use to get the endpoint.name
- The name of the endpoint.
Returns: helics.HelicsEndpoint
.
helicsFederateGetEndpointByIndex¶
def helicsFederateGetEndpointByIndex(fed: HelicsFederate, index: int) -> HelicsEndpoint
Get an endpoint by its index, typically already created via registerInterfaces file or something of that nature.
Parameters
fed
- Thehelics.HelicsFederate
in which to create a publication.index
- The index of the publication to get.
Returns: helics.HelicsEndpoint
.
helicsFederateGetEndpointCount¶
def helicsFederateGetEndpointCount(fed: HelicsFederate) -> int
Get the number of endpoints in a federate.
Parameters
fed
- The message federate to query.
Returns: (-1) if fed was not a valid federate, otherwise returns the number of endpoints.
helicsFederateGetFilter¶
def helicsFederateGetFilter(fed: HelicsFederate, name: str) -> HelicsFilter
Get a filter by its name, typically already created via registerInterfaces file or something of that nature.
Parameters
fed
- Thehelics.HelicsFederate
to use to get the filter.name
- The name of the filter.
Returns: helics.HelicsFilter
.
helicsFederateGetFilterByIndex¶
def helicsFederateGetFilterByIndex(fed: HelicsFederate, index: int) -> HelicsFilter
Get a filter by its index, typically already created via registerInterfaces file or something of that nature.
Parameters
fed
- Thehelics.HelicsFederate
in which to create a publication.index
- The index of the publication to get.
Returns: helics.HelicsFilter
.
helicsFederateGetFilterCount¶
def helicsFederateGetFilterCount(fed: HelicsFederate) -> int
Get the number of filters registered through a federate.
Parameters
fed
- Thehelics.HelicsFederate
to use to get the filter.
Returns: A count of the number of filters registered through a federate.
helicsFederateGetFlagOption¶
def helicsFederateGetFlagOption(fed: HelicsFederate, flag: Union[int, HelicsFederateFlag, HelicsFlag]) -> bool
Get a flag value for a federate.
Parameters
fed
- The federate to get the flag for.flag
- Thehelics.HelicsFederateFlag
to query.
helicsFederateGetInput¶
def helicsFederateGetInput(fed: HelicsFederate, name: str) -> HelicsInput
Get an input object from a name.
Parameters
fed
- The valuehelics.HelicsFederate
to use to get the publication.name
- The name of the input.
Returns: helics.HelicsInput
.
helicsFederateGetInputByIndex¶
def helicsFederateGetInputByIndex(fed: HelicsFederate, index: int) -> HelicsInput
Get an input by its index, typically already created via registerInterfaces file or something of that nature.
Parameters
fed
- Thehelics.HelicsFederate
in which to create a publication.index
- The index of the publication to get.
Returns: helics.HelicsInput
helicsFederateGetInputByTarget¶
def helicsFederateGetInputByTarget(fed: HelicsFederate, target: str) -> HelicsInput
Get an input object from a target.
Parameters
fed
- The valuehelics.HelicsFederate
to use to get the input.target
- The name of the publication that an input is targeting.
Returns: helics.HelicsInput
helicsFederateGetInputCount¶
def helicsFederateGetInputCount(fed: HelicsFederate) -> int
Get the number of subscriptions in a federate.
Returns: (-1) if fed was not a valid federate otherwise returns the number of subscriptions.
helicsFederateGetIntegerProperty¶
def helicsFederateGetIntegerProperty(fed: HelicsFederate, property: HelicsProperty) -> int
Get the current value of an integer property (such as a logging level).
Parameters
fed
- The federate to get the flag for.property
- A code for the property to sethelics.HelicsProperty
.
helicsFederateGetMessage¶
def helicsFederateGetMessage(fed: HelicsFederate) -> HelicsMessage
Receive a communication message for any endpoint in the federate. The return order will be in order of endpoint creation. So all messages that are available for the first endpoint.handle, then all for the second, and so on. Within a single endpoint.handle, the messages are ordered by time, then source_id, then order of arrival.
Returns: A helics.HelicsMessage
which references the data in the message.
helicsFederateGetMessageObject¶
def helicsFederateGetMessageObject(fed: HelicsFederate) -> HelicsMessage
Receive a communication message for any endpoint in the federate. The return order will be in order of endpoint creation. So all messages that are available for the first endpoint.handle, then all for the second, and so on. Within a single endpoint.handle, the messages are ordered by time, then source_id, then order of arrival.
Returns: A helics.HelicsMessage
which references the data in the message.
DEPRECATED
helicsFederateGetName¶
def helicsFederateGetName(fed: HelicsFederate) -> str
Get the name of the federate.
Parameters
fed
- Thehelics.HelicsFederate
to query.
Returns: A string with the name.
helicsFederateGetPublication¶
def helicsFederateGetPublication(fed: HelicsFederate, name: str) -> HelicsPublication
Get a helics.HelicsPublication
from a name.
Parameters
fed
- The valuehelics.HelicsFederate
to use to get the publication.name
- The name of the publication.
Returns: helics.HelicsPublication
.
helicsFederateGetPublicationByIndex¶
def helicsFederateGetPublicationByIndex(fed: HelicsFederate, index: int) -> HelicsPublication
Get a publication by its index, typically already created via registerInterfaces file or something of that nature.
Parameters
fed
- Thehelics.HelicsFederate
in which to create a publication.index
- The index of the publication to get.
Returns: helics.HelicsPublication
.
helicsFederateGetPublicationCount¶
def helicsFederateGetPublicationCount(fed: HelicsFederate) -> int
Get the number of publications in a federate.
Returns: (-1) if fed was not a valid federate otherwise returns the number of publications.
helicsFederateGetState¶
def helicsFederateGetState(fed: HelicsFederate) -> HelicsFederateState
Get the current state of a federate.
Parameters
fed
- The federate to query.
Returns: helics.HelicsFederateState
.
helicsFederateGetSubscription¶
def helicsFederateGetSubscription(fed: HelicsFederate, name: str) -> HelicsInput
Get an input object from a subscription target.
Parameters
fed
- The valuehelics.HelicsFederate
to use to get the publication.name
- The name of the publication that a subscription is targeting.
Returns: helics.HelicsInput
DEPRECATED
helicsFederateGetTag¶
def helicsFederateGetTag(fed: HelicsFederate, tagname: str)
Get the data in a specified tag of a federate.
Parameters
fed
: The federate object to query.tagname
: The name of the tag to query.
Returns
A string with the tag data.
helicsFederateGetTimeProperty¶
def helicsFederateGetTimeProperty(fed: HelicsFederate, time_property: int) -> HelicsTime
Get the current value of a time based property in a federate.
Parameters
fed
- The federate query.time_property
- The property to query.
Returns: helics.HelicsTime
.
helicsFederateGetTranslator¶
def helicsFederateGetTranslator(fed: HelicsFederate, name: str) -> HelicsTranslator
Get a translator by its name, typically already created via registerInterfaces file or something of that nature.
fed
The federate object to use to get the translator.name
The name of the translator.
Returns: A helics.HelicsTranslator
object
helicsFederateGetTranslatorByIndex¶
def helicsFederateGetTranslatorByIndex(fed: HelicsFederate, index: int) -> HelicsTranslator
Get a translator by its name, typically already created via registerInterfaces file or something of that nature.
fed
The federate object to use to get the translator.index
The index of the translator.
Returns: A helics.HelicsTranslator
object
helicsFederateGetTranslatorCount¶
def helicsFederateGetTranslatorCount(fed: HelicsFederate) -> int
Get the number of translators registered through a federate.
Parameters
fed
- The federate object to use to get the translator.
Returns: A count of the number of translators registered through a federate.
helicsFederateGlobalError¶
def helicsFederateGlobalError(fed: HelicsFederate, error_code: int, error_string: str)
Generate a global error from a federate. A global error halts the co-simulation completely.
Parameters
fed
- The federate to create an error in.error_code
- The integer code for the error.error_string
- A string describing the error.
helicsFederateHasMessage¶
def helicsFederateHasMessage(fed: HelicsFederate) -> bool
Check if the federate has any outstanding messages.
Parameters
fed
- The federate to check.
Returns: True
if the federate has a message waiting, False
otherwise.
helicsFederateInfoClone¶
def helicsFederateInfoClone(fedInfo: HelicsFederateInfo) -> HelicsFederateInfo
Create helics.HelicsFederateInfo
from an existing one and clone the information.
Parameters
fedInfo
- A federateInfo object to duplicate.
Returns: helics.HelicsFederateInfo
.
helicsFederateInfoFree¶
def helicsFederateInfoFree(fedInfo: HelicsFederateInfo)
Delete the memory associated with helics.HelicsFederateInfo
.
helicsFederateInfoLoadFromArgs¶
def helicsFederateInfoLoadFromArgs(fedInfo: HelicsFederateInfo, arguments: List[str])
Load federate info from command line arguments.
Parameters
fedInfo
- A federateInfo object.argc
- The number of command line arguments.argv
- An array of strings from the command line.
helicsFederateInfoLoadFromString¶
def helicsFederateInfoLoadFromString(fedInfo: HelicsFederateInfo, arguments: str)
Load federate info from command line arguments contained in a string.
Parameters
fedInfo
- A federateInfo object.arguments
- Command line argument specified in a string
helicsFederateInfoSetBroker¶
def helicsFederateInfoSetBroker(fedInfo: HelicsFederateInfo, broker_string: str)
Set the name or connection information for a broker. This is only used if the core is automatically created, the broker information will be transferred to the core for connection.
Parameters
fedInfo
- The federate info object to alter.broker_string
- A string which defines the connection information for a broker either a name or an address.
helicsFederateInfoSetBrokerInitString¶
def helicsFederateInfoSetBrokerInitString(fedInfo: HelicsFederateInfo, broker_init_string: str)
Set the initialization string that a core will pass to a generated broker usually in the form of command line arguments.
Parameters
fedInfo
- The federate info object to alter.broker_init_string
- A string with command line arguments for a generated broker.
helicsFederateInfoSetBrokerKey¶
def helicsFederateInfoSetBrokerKey(fedInfo: HelicsFederateInfo, broker_key: str)
Set the key for a broker connection. This is only used if the core is automatically created, the broker information will be transferred to the core for connection.
Parameters
fedInfo
- The federate info object to alter.broker_key
- A string containing a key for the broker to connect.
helicsFederateInfoSetBrokerPort¶
def helicsFederateInfoSetBrokerPort(fedInfo: HelicsFederateInfo, broker_port: Union[int, str])
Set the port to use for the broker. This is only used if the core is automatically created, the broker information will be transferred to the core for connection. This will only be useful for network broker connections.
Parameters
fedInfo
- The federate info object to alter.broker_port
- The integer port number to use for connection with a broker.
helicsFederateInfoSetCoreInitString¶
def helicsFederateInfoSetCoreInitString(fedInfo: HelicsFederateInfo, core_init_string: str)
Set the initialization string for the core usually in the form of command line arguments.
Parameters
fedInfo
- The federate info object to alter.core_init_string
- A string containing command line arguments to be passed to the core.
helicsFederateInfoSetCoreName¶
def helicsFederateInfoSetCoreName(fedInfo: HelicsFederateInfo, core_name: str)
Set the name of the core to link to for a federate.
Parameters
fedInfo
- The federate info object to alter.core_name
- The identifier for a core to link to.
helicsFederateInfoSetCoreType¶
def helicsFederateInfoSetCoreType(fedInfo: HelicsFederateInfo, core_type: HelicsCoreType)
Set the core type by integer code.
Valid values available by definitions in api-data.h
.
Parameters
fedInfo
- The federate info object to alter.core_type
- An numerical code for a core type seehelics.HelicsCoreType
.
helicsFederateInfoSetCoreTypeFromString¶
def helicsFederateInfoSetCoreTypeFromString(fedInfo: HelicsFederateInfo, core_type: str)
Set the core type from a string.
Parameters
fedInfo
- The federate info object to alter.core_type
- A string naming a core type.
helicsFederateInfoSetFlagOption¶
def helicsFederateInfoSetFlagOption(fedInfo: HelicsFederateInfo, flag: Union[int, HelicsFederateFlag, HelicsFlag], value: bool)
Set a flag in the info structure
Valid flags are available helics.HelicsFederateFlag
.
Parameters
fedInfo
- The federate info object to alter.flag
- A numerical index for a flag.value
- The desired value of the flagTrue
orFalse
.
helicsFederateInfoSetIntegerProperty¶
def helicsFederateInfoSetIntegerProperty(fedInfo: HelicsFederateInfo, property: HelicsProperty, value: int)
Set an integer property for a federate. Set known properties.
Parameters
fedInfo
- The federateInfo object to alter.property
-helics.HelicsProperty
.value
- The value to set the property to.
helicsFederateInfoSetLocalPort¶
def helicsFederateInfoSetLocalPort(fedInfo: HelicsFederateInfo, local_port: Union[int, str])
Set the local port to use. This is only used if the core is automatically created, the port information will be transferred to the core for connection.
Parameters
fedInfo
- The federate info object to alter.local_port
- A string with the port information to use as the local server port can be a number or “auto” or “os_local”.
helicsFederateInfoSetSeparator¶
def helicsFederateInfoSetSeparator(fedInfo: HelicsFederateInfo, separator: str)
Set the separator character in the info structure. The separator character is the separation character for local publications/endpoints in creating their global name. For example if the separator character is ‘/’ then a local endpoint would have a globally reachable name of fedName/localName.
Parameters
fedInfo
- The federate info object to alter.separator
- The character to use as a separator.
helicsFederateInfoSetTimeProperty¶
def helicsFederateInfoSetTimeProperty(fedInfo: HelicsFederateInfo, time_property: HelicsProperty, value: HelicsTime)
Set the output delay for a federate.
Parameters
fedInfo
- The federate info object to alter.time_property
- An integer representation of the time based property to set seehelics.HelicsProperty
.propertyValue
- The value of the property to set the timeProperty to.
helicsFederateInitializingEntryCallback¶
def helicsFederateInitializingEntryCallback(fed: HelicsFederate, initializing_entry, user_data)
Set callback for the entry to initializingMode.
This callback will be executed when the initializingMode is entered
Parameters¶
fed
: The federate to set the callback for.initializing_entry
: A callback with signature void(HelicsBool iterating, void *user_data); the bool parameter is set to true if the entry is iterative, therefore the first time this is called the bool is false. all subsequent times it is false.user_data
: A pointer to user data that is passed to the function when executing.
helicsFederateIsAsyncOperationCompleted¶
def helicsFederateIsAsyncOperationCompleted(fed: HelicsFederate) -> bool
Check if the current Asynchronous operation has completed.
Parameters
fed
- The federate to operate on.
Returns: True
if current operation has completed, else False
.
helicsFederateIsProtected¶
def helicsFederateIsProtected(fed_name: str) -> bool
Checks if an existing federate is protected
Parameters
fedName
: The name of an existing HelicsFederate.
Returns: boolean if existing federate is protected
helicsFederateIsValid¶
def helicsFederateIsValid(fed: HelicsFederate) -> bool
Check if a helics.HelicsFederate
is valid.
Returns: True
if the federate is a valid active federate, False
otherwise.
helicsFederateLocalError¶
def helicsFederateLocalError(fed: HelicsFederate, error_code: int, error_string: str)
Generate a local error in a federate. This will propagate through the co-simulation but not necessarily halt the co-simulation, it has a similar effect to finalize but does allow some interaction with a core for a brief time.
Parameters
fed
- The federate to create an error in.error_code
- The integer code for the error.error_string
- A string describing the error.
helicsFederateLogDebugMessage¶
def helicsFederateLogDebugMessage(fed: HelicsFederate, log_message: str)
Log a debug message through a federate.
Parameters
fed
- The federate to log the debug message through.log_message
- The message to put in the log.
helicsFederateLogErrorMessage¶
def helicsFederateLogErrorMessage(fed: HelicsFederate, log_message: str)
Log an error message through a federate.
Parameters
fed
- The federate to log the error message through.log_message
- The message to put in the log.
helicsFederateLogInfoMessage¶
def helicsFederateLogInfoMessage(fed: HelicsFederate, log_message: str)
Log an info message through a federate.
Parameters
fed
- The federate to log the info message through.log_message
- The message to put in the log.
helicsFederateLogLevelMessage¶
def helicsFederateLogLevelMessage(fed: HelicsFederate, log_level: HelicsLogLevel, log_message: str)
Log a message through a federate.
Parameters
fed
- The federate to log the message through.log_level
- The level of the message to log seehelics.HelicsLogLevel
.log_message
- The message to put in the log.
helicsFederateLogWarningMessage¶
def helicsFederateLogWarningMessage(fed: HelicsFederate, log_message: str)
Log a warning message through a federate.
Parameters
fed
- The federate to log the warning message through.log_message
- The message to put in the log.
helicsFederatePendingMessageCount¶
def helicsFederatePendingMessageCount(fed: HelicsFederate) -> int
Returns the number of pending receives for the specified destination endpoint.
Parameters
fed
- The federate to get the number of waiting messages from.
helicsFederatePendingMessages¶
def helicsFederatePendingMessages(fed: HelicsFederate) -> int
Returns the number of pending receives for the specified destination endpoint.
Parameters
fed
- The federate to get the number of waiting messages from.
DEPRECATED
helicsFederateProcessCommunications¶
def helicsFederateProcessCommunications(fed: HelicsFederate, period: HelicsTime)
Tell helics to process internal communications for a period of time.
Parameters
fed
: The federate to tell to process.period
: The length of time to process communications and then return control.
helicsFederateProtect¶
def helicsFederateProtect(fed_name: str)
Protect a federate from finalizing and closing if all references go out of scope
This function allows a federate to be retrieved on demand, it must be explicitly close later otherwise it will be destroyed when the library is closed
Parameters
fedName
: The name of an existing HelicsFederate.
helicsFederatePublishJSON¶
def helicsFederatePublishJSON(fed: HelicsFederate, json: str)
Publish data contained in a JSON file or string.
Parameters
fed
- The valuehelics.HelicsFederate
through which to publish the data.json
- The publication file name or literal JSON data string.
helicsFederateRegisterCloningFilter¶
def helicsFederateRegisterCloningFilter(fed: HelicsFederate, name: str) -> HelicsCloningFilter
Create a cloning Filter on the specified federate. Cloning filters copy a message and send it to multiple locations, source and destination can be added through other functions.
Parameters
fed
- The federate to register through.name
- The name of the filter (can be NULL).
Returns: helics.HelicsCloningFilter
.
helicsFederateRegisterEndpoint¶
def helicsFederateRegisterEndpoint(fed: HelicsFederate, name: str, type: str = "") -> HelicsEndpoint
MessageFederate Calls. Create an endpoint. The endpoint becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for endpoints.
Parameters
fed
- Thehelics.HelicsFederate
in which to create an endpoint must have been created with helicsCreateMessageFederate or helicsCreateCombinationFederate.name
- The identifier for the endpoint. This will be prepended with the federate name for the global identifier.type
- A string describing the expected type of the publication (optional).
Returns: helics.HelicsEndpoint
.
helicsFederateRegisterFilter¶
def helicsFederateRegisterFilter(fed: HelicsFederate, type: HelicsFilterType, name: str) -> HelicsFilter
Create a source Filter on the specified federate. Filters can be created through a federate or a core.handle, linking through a federate allows a few extra features of name matching to function on the federate interface but otherwise equivalent behavior.
Parameters
fed
- The federate to register through.type
- The type of filter to createhelics.HelicsFilterType
.name
- The name of the filter (can be NULL).
Returns: helics.HelicsFilter
.
helicsFederateRegisterFromPublicationJSON¶
def helicsFederateRegisterFromPublicationJSON(fed: HelicsFederate, json: str)
Register the publications via JSON publication string.
Parameters
fed
- The valuehelics.HelicsFederate
to use to register the publications.json
- The JSON publication string.
helicsFederateRegisterGlobalCloningFilter¶
def helicsFederateRegisterGlobalCloningFilter(fed: HelicsFederate, name: str) -> HelicsCloningFilter
Create a global cloning Filter on the specified federate. Cloning filters copy a message and send it to multiple locations, source and destination can be added through other functions.
Parameters
fed
- The federate to register through.name
- The name of the filter (can be NULL).
Returns: helics.HelicsFilter
.
helicsFederateRegisterGlobalEndpoint¶
def helicsFederateRegisterGlobalEndpoint(fed: HelicsFederate, name: str, type: str = "") -> HelicsEndpoint
Create an endpoint. The endpoint becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for endpoints.
Parameters
fed
- Thehelics.HelicsFederate
in which to create an endpoint must have been created with helicsCreateMessageFederate or helicsCreateCombinationFederate.name
- The identifier for the endpoint.handle, the given name is the global identifier.type
- A string describing the expected type of the publication (optional).
Returns: helics.HelicsEndpoint
.
helicsFederateRegisterGlobalFilter¶
def helicsFederateRegisterGlobalFilter(fed: HelicsFederate, type: HelicsFilterType, name: str) -> HelicsFilter
Create a global source filter through a federate. Filters can be created through a federate or a core.handle, linking through a federate allows a few extra features of name matching to function on the federate interface but otherwise equivalent behavior.
Parameters
fed
- The federate to register through.type
- The type of filter to createhelics.HelicsFilterType
.name
- The name of the filter (can be NULL).
Returns: helics.HelicsFilter
.
helicsFederateRegisterGlobalInput¶
def helicsFederateRegisterGlobalInput(fed: HelicsFederate, name: str, type: HelicsDataType, units: str = "") -> HelicsInput
Register a global named input. The publication becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for subscriptions and publications.
Parameters
fed
- Thehelics.HelicsFederate
in which to create a publication.name
- The identifier for the publication.type
- A code identifying the type of the input seehelics.HelicsDataType
for available options.units
- A string listing the units of the subscription (optional).
Returns: helics.HelicsPublication
.
helicsFederateRegisterGlobalPublication¶
def helicsFederateRegisterGlobalPublication(fed: HelicsFederate, name: str, type: HelicsDataType, units: str = "") -> HelicsPublication
Register a global named publication with an arbitrary type. The publication becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for subscriptions and publications.
Parameters
fed
- Thehelics.HelicsFederate
in which to create a publication.name
- The identifier for the publication.type
- A code identifying the type of the input seehelics.HelicsDataType
for available options.units
- A string listing the units of the subscription (optional).
Returns: helics.HelicsPublication
.
helicsFederateRegisterGlobalTargetedEndpoint¶
def helicsFederateRegisterGlobalTargetedEndpoint(fed: HelicsFederate, name: str, type: str = "")
Create a globally targeted endpoint. The endpoint becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for endpoints.
Parameters¶
fed
- Thehelics.HelicsFederate
in which to create an endpoint must have been created with helicsCreateMessageFederate or helicsCreateCombinationFederate.name
- The identifier for the endpoint. This will be prepended with the federate name for the global identifier.type
- A string describing the expected type of the publication (optional). Returns:helics.HelicsEndpoint
.
helicsFederateRegisterGlobalTranslator¶
def helicsFederateRegisterGlobalTranslator(fed: HelicsFederate, type: HelicsTranslatorTypes, name: str) -> HelicsTranslator
Create a source Translator on the specified federate.
Translators can be created through a federate or a core, linking through a federate allows a few extra features of name matching to function on the federate interface but otherwise equivalent behavior
Parameters
fed
- The federate to register through.type
- The type of translator to create /ref HelicsTranslatorTypes.name
- The name of the translator (can be NULL).
Returns: helics.HelicsTranslator
.
helicsFederateRegisterGlobalTypeInput¶
def helicsFederateRegisterGlobalTypeInput(fed: HelicsFederate, name: str, type: str, units: str = "") -> HelicsInput
Register a global publication with an arbitrary type. The publication becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for subscriptions and publications.
Parameters
fed
- Thehelics.HelicsFederate
in which to create a publication.name
- The identifier for the publication.type
- A string defining the type of the input.units
- A string listing the units of the subscription (optional).
Returns: helics.HelicsPublication
.
helicsFederateRegisterGlobalTypePublication¶
def helicsFederateRegisterGlobalTypePublication(fed: HelicsFederate, name: str, type: str, units: str = "") -> HelicsPublication
Register a global publication with a defined type. The publication becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for subscriptions and publications.
Parameters
fed
- Thehelics.HelicsFederate
in which to create a publication.name
- The identifier for the publication.type
- A string describing the expected type of the publication.units
- A string listing the units of the subscription (optional).
Returns: helics.HelicsPublication
.
helicsFederateRegisterInput¶
def helicsFederateRegisterInput(fed: HelicsFederate, name: str, type: HelicsDataType, units: str = "") -> HelicsInput
Register a named input. The input becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for subscriptions, inputs, and publications.
Parameters
fed
- Thehelics.HelicsFederate
in which to create an input.name
- The identifier for the publication the global input name will be prepended with the federate name.type
- A code identifying the type of the input seehelics.HelicsDataType
for available options.units
- A string listing the units of the input (optional).
Returns: helics.HelicsInput
.
helicsFederateRegisterInterfaces¶
def helicsFederateRegisterInterfaces(fed: HelicsFederate, file: str)
Load interfaces from a file.
Parameters
fed
- The federate to which to load interfaces.file
- The name of a file to load the interfaces from either JSON, or TOML.
helicsFederateRegisterPublication¶
def helicsFederateRegisterPublication(fed: HelicsFederate, name: str, type: HelicsDataType, units: str = "") -> HelicsPublication
Register a publication with a known type. The publication becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for subscriptions and publications.
Parameters
fed
- Thehelics.HelicsFederate
in which to create a publication.name
- The identifier for the publication the global publication name will be prepended with the federate name.type
- A code identifying the type of the input seehelics.HelicsDataType
for available options.units
- A string listing the units of the subscription (optional).
Returns: helics.HelicsPublication
.
helicsFederateRegisterSubscription¶
def helicsFederateRegisterSubscription(fed: HelicsFederate, name: str, units: str = "") -> HelicsInput
Functions related to value federates for the C api. Create a subscription. The subscription becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for subscriptions and publications.
Parameters
fed
- Thehelics.HelicsFederate
in which to create a subscription, must have been created withhelics.helicsCreateValueFederate
orhelics.helicsCreateCombinationFederate
.name
- The identifier matching a publication to get a subscription for.units
- A string listing the units of the subscription (optional).
Returns: helics.HelicsSubscription
.
helicsFederateRegisterTargetedEndpoint¶
def helicsFederateRegisterTargetedEndpoint(fed: HelicsFederate, name: str, type: str = "")
Create an targeted endpoint. The endpoint becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for endpoints.
Parameters¶
fed
- Thehelics.HelicsFederate
in which to create an endpoint must have been created with helicsCreateMessageFederate or helicsCreateCombinationFederate.name
- The identifier for the endpoint. This will be prepended with the federate name for the global identifier.type
- A string describing the expected type of the publication (optional). Returns:helics.HelicsEndpoint
.
helicsFederateRegisterTranslator¶
def helicsFederateRegisterTranslator(fed: HelicsFederate, type: HelicsTranslatorTypes, name: str) -> HelicsTranslator
Create a source Translator on the specified federate.
Translators can be created through a federate or a core, linking through a federate allows a few extra features of name matching to function on the federate interface but otherwise equivalent behavior
Parameters
fed
- The federate to register through.type
- The type of translator to create /ref HelicsTranslatorTypes.name
- The name of the translator (can be NULL).
Returns: helics.HelicsTranslator
.
helicsFederateRegisterTypeInput¶
def helicsFederateRegisterTypeInput(fed: HelicsFederate, name: str, type: str, units: str = "") -> HelicsInput
Register an input with a defined type. The input becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for subscriptions, inputs, and publications.
Parameters
fed
- Thehelics.HelicsFederate
in which to create an input.name
- The identifier for the input.type
- A string describing the expected type of the input.units
- A string listing the units of the input (optional).
Returns: helics.HelicsPublication
.
helicsFederateRegisterTypePublication¶
def helicsFederateRegisterTypePublication(fed: HelicsFederate, name: str, type: str, units: str = "") -> HelicsPublication
Register a publication with a defined type. The publication becomes part of the federate and is destroyed when the federate is freed so there are no separate free functions for subscriptions and publications.
Parameters
fed
- Thehelics.HelicsFederate
in which to create a publication.name
- The identifier for the publication.type
- A string labeling the type of the publication.units
- A string listing the units of the subscription (optional).
Returns: helics.HelicsPublication
.
helicsFederateRequestNextStep¶
def helicsFederateRequestNextStep(fed: HelicsFederate) -> HelicsTime
Request the next time step for federate execution.
Feds should have setup the period or minDelta
for this to work well but it will request the next time step which is the current time plus the minimum time step.
Parameters
fed
- The federate to make the request of.
Returns: helics.HelicsTime
.
helicsFederateRequestTime¶
def helicsFederateRequestTime(fed: HelicsFederate, request_time: HelicsTime) -> HelicsTime
Request the next time for federate execution.
Parameters
fed
- The federate to make the request of.request_time
- The next requested time.
Returns: helics.HelicsTime
.
helicsFederateRequestTimeAdvance¶
def helicsFederateRequestTimeAdvance(fed: HelicsFederate, time_delta: HelicsTime) -> HelicsTime
Request the next time for federate execution.
Parameters
fed
- The federate to make the request of.time_delta
- The requested amount of time to advance.
Returns: helics.HelicsTime
.
helicsFederateRequestTimeAsync¶
def helicsFederateRequestTimeAsync(fed: HelicsFederate, request_time: HelicsTime)
Request the next time for federate execution in an asynchronous call.
Call helics.helicsFederateRequestTimeComplete
to finish the call.
Parameters
fed
- The federate to make the request of.request_time
- The next requested time.
helicsFederateRequestTimeComplete¶
def helicsFederateRequestTimeComplete(fed: HelicsFederate) -> HelicsTime
Complete an asynchronous requestTime call.
Parameters
fed
- The federate to make the request of.
helicsFederateRequestTimeIterative¶
def helicsFederateRequestTimeIterative(
fed: HelicsFederate, request_time: HelicsTime, iterate: HelicsIterationRequest
) -> Tuple[HelicsTime, HelicsIterationResult]
Request an iterative time.
This call allows for finer grain control of the iterative process than helics.helicsFederateRequestTime
. It takes a time and iteration request, and returns a time and iteration status.
Parameters
fed
- The federate to make the request of.request_time
- The next desired time.iterate
-helics.HelicsIterationRequest
, i.e. the requested iteration mode.
Returns: (helics.HelicsTime, helics.HelicsIterationResult)
.
helicsFederateRequestTimeIterativeAsync¶
def helicsFederateRequestTimeIterativeAsync(fed: HelicsFederate, request_time: HelicsTime, iterate: HelicsIterationRequest)
Request an iterative time through an asynchronous call.
This call allows for finer grain control of the iterative process than helics.helicsFederateRequestTime
. It takes a time and iteration request, and returns a time and iteration status. Call helics.helicsFederateRequestTimeIterativeComplete
to finish the process.
Parameters
fed
- The federate to make the request of.request_time
- The next desired time.iterate
-helics.HelicsIterationRequest
, i.e. the requested iteration mode.
helicsFederateRequestTimeIterativeComplete¶
def helicsFederateRequestTimeIterativeComplete(fed: HelicsFederate) -> Tuple[HelicsTime, HelicsIterationResult]
Complete an iterative time request asynchronous call.
Parameters
fed
- The federate to make the request of.
Returns: The iteration specification of the result.
helicsFederateSendCommand¶
def helicsFederateSendCommand(fed: HelicsFederate, target: str, command: str)
helicsFederateSetFlagOption¶
def helicsFederateSetFlagOption(fed: HelicsFederate, flag: Union[int, HelicsFederateFlag, HelicsFlag], value: bool)
Set a flag for the federate.
Parameters
fed
- The federate to alter a flag for.flag
- The flag to change.value
- The new value of the flag. 0 for false, !=0 for true.
helicsFederateSetGlobal¶
def helicsFederateSetGlobal(fed: HelicsFederate, name: str, value: str)
Set a federation global value through a federate. This overwrites any previous value for this name.
Parameters
fed
- The federate to set the global through.name
- The name of the global to set.value
- The value of the global.
helicsFederateSetIntegerProperty¶
def helicsFederateSetIntegerProperty(fed: HelicsFederate, property: HelicsProperty, value: int)
Set an integer based property of a federate.
Parameters
fed
- The federate to change the property for.property
-helics.HelicsProperty
.value
- The value of the property.
helicsFederateSetLogFile¶
def helicsFederateSetLogFile(fed: HelicsFederate, log_file: str)
Set the logging file for a federate (actually on the core associated with a federate).
Parameters
fed
- The federate to set the log file for.log_file
- The name of the log file.
helicsFederateSetLoggingCallback¶
def helicsFederateSetLoggingCallback(fed: HelicsFederate, logger, user_data)
Set the logging callback for a helics.HelicsFederate
Add a logging callback function for the C.
The logging callback will be called when a message flows into a helics.HelicsFederate
from the core or from a federate.
Parameters¶
fed
: thehelics.HelicsFederate
that is created withhelics.helicsCreateValueFederate
,helics.helicsCreateMessageFederate
orhelics.helicsCreateCombinationFederate
logger
: a callback with signature void(int, const char *, const char *, void *); the function arguments are loglevel, an identifier string, and a message string, and a pointer to user datauser_data
: a pointer to user data that is passed to the function when executing
helicsFederateSetQueryCallback¶
def helicsFederateSetQueryCallback(fed: HelicsFederate, query, user_data)
Set the callback for queries executed against a helics.HelicsFederate
Add a logging callback function for the C.
The logging callback will be called when a message flows from helics.HelicsBroker
or from the core.
Parameters¶
fed
: thehelics.HelicsFederate
that is created withhelics.helicsCreateValueFederate
query
: a callback with signature const char *(const char *query, int querySize, HelicsQueryBuffer buffer, void *user_data); The function arguments include the query string requesting an answer along with its size; the string is not guaranteed to be null terminated. HelicsQueryBuffer is the buffer intended to filled out by the userCallback. The buffer can be empty if the query is not recognized and HELICS will generate the appropriate response. The buffer is used to ensure memory ownership separation between user code and HELICS code. The HelicsQueryBufferFill method can be used to load a string into the buffer.user_data
: a pointer to user data that is passed to the function when executing
helicsFederateSetSeparator¶
def helicsFederateSetSeparator(fed: HelicsFederate, separator: str)
Set the separator character in a federate. The separator character is the separation character for local publications/endpoints in creating their global name. For example if the separator character is ‘/’ then a local endpoint would have a globally reachable name of fedName/localName.
Parameters
fed
- The federate info object to alter.separator
- The character to use as a separator.
helicsFederateSetStateChangeCallback¶
def helicsFederateSetStateChangeCallback(fed: HelicsFederate, state_changer, user_data)
Set the callback for a helics.HelicsFederate
state change
Add a logging callback function for the C.
The logging callback will be called when a message flows into a helics.HelicsFederate
from the core or from a federate.
Parameters¶
fed
: thehelics.HelicsFederate
that is created withhelics.helicsCreateValueFederate
,helics.helicsCreateMessageFederate
orhelics.helicsCreateCombinationFederate
state_changer
: a callback with signature void(HelicsFederateState newState, HelicsFederateState oldState, void *user_data);user_data
: a pointer to user data that is passed to the function when executing
helicsFederateSetTag¶
def helicsFederateSetTag(fed: HelicsFederate, tagname: str, tagvalue: str)
Set the data in a specific tag for a federate.
fed
: The federate object to set a tag for.
tagname
: The name of the tag to set.
tagvalue
: The string value to associate with a tag.
helicsFederateSetTimeProperty¶
def helicsFederateSetTimeProperty(fed: HelicsFederate, time_property: int, time: HelicsTime)
Set a time based property for a federate.
Parameters
fed
- Thehelics.HelicsFederate
to set the property for.time_property
- A integer code for a time property.time
- The requested value of the property.
helicsFederateSetTimeRequestEntryCallback¶
def helicsFederateSetTimeRequestEntryCallback(fed: HelicsFederate, request_time, user_data)
Set the callback for the time request
This callback will be executed when a valid time request is made. It is intended for the possibility of embedded data grabbers in a callback to simplify user code.
Parameters¶
fed
: thehelics.HelicsFederate
that is created withhelics.helicsCreateValueFederate
request_time
: a callback with signature void(HelicsTime currentTime, HelicsTime requestTime, bool iterating, void *user_data); The function arguments are the current time value, the requested time value, a bool indicating that the time is iterating, and pointer to the user_datauser_data
: a pointer to user data that is passed to the function when executing
helicsFederateSetTimeRequestReturnCallback¶
def helicsFederateSetTimeRequestReturnCallback(fed: HelicsFederate, request_time_return, user_data)
Set the callback for the time request
This callback will be executed when a valid time request is made. It is intended for the possibility of embedded data grabbers in a callback to simplify user code.
Parameters¶
fed
: thehelics.HelicsFederate
that is created withhelics.helicsCreateValueFederate
request_time_return
: a callback with signature void(HelicsTime newTime, bool iterating, void *user_data); The function arguments are the current time value, the requested time value, a bool indicating that the time is iterating, and pointer to the user_datauser_data
: a pointer to user data that is passed to the function when executing
helicsFederateSetTimeUpdateCallback¶
def helicsFederateSetTimeUpdateCallback(fed: HelicsFederate, time_update, user_data)
Set the callback for the time request
This callback will be executed when a valid time request is made. It is intended for the possibility of embedded data grabbers in a callback to simplify user code.
Parameters¶
fed
: thehelics.HelicsFederate
that is created withhelics.helicsCreateValueFederate
update_time
: a callback with signature void(HelicsTime newTime, bool iterating, void *user_data); The function arguments are the current time value, the requested time value, a bool indicating that the time is iterating, and pointer to the user_datauser_data
: a pointer to user data that is passed to the function when executing
helicsFederateUnProtect¶
def helicsFederateUnProtect(fed_name: str)
Remove the protection of an existing federate
This function allows a federate to be retrieved on demand, it must be explicitly close later otherwise it will be destroyed when the library is closed
Parameters
fedName
: The name of an existing HelicsFederate.
helicsFederateWaitCommand¶
def helicsFederateWaitCommand(fed: HelicsFederate) -> str
helicsFilterAddDeliveryEndpoint¶
def helicsFilterAddDeliveryEndpoint(filter: HelicsFilter, delivery_endpoint: str)
Clone filter functions. Functions that manipulate cloning filters in some way. Add a delivery endpoint to a cloning filter. All cloned messages are sent to the delivery address(es).
Parameters
filter
- The given filter.delivery_endpoint
- The name of the endpoint to deliver messages to.
helicsFilterAddDestinationTarget¶
def helicsFilterAddDestinationTarget(filter: HelicsFilter, destination: str)
Add a destination target to a filter. All messages going to a destination are copied to the delivery address(es).
Parameters
filter
- The given filter to add a destination target to.destination
- The name of the endpoint to add as a destination target.
helicsFilterAddSourceTarget¶
def helicsFilterAddSourceTarget(filter: HelicsFilter, source_name: str)
Add a source target to a filter. All messages coming from a source are copied to the delivery address(es).
Parameters
filter
- The given filter.source_name
- The name of the endpoint to add as a source target.
helicsFilterGetInfo¶
def helicsFilterGetInfo(filter: HelicsFilter) -> str
Get the data in the info field of a filter.
Parameters
filter
- The given filter.
Returns: A string with the info field string.
helicsFilterGetName¶
def helicsFilterGetName(filter: HelicsFilter) -> str
Get the name of the filter and store in the given string.
Parameters
filter
- The given filter.
Returns: A string with the name of the filter.
helicsFilterGetOption¶
def helicsFilterGetOption(filter: HelicsFilter, option: HelicsHandleOption) -> int
Get a handle option for the filter.
Parameters
filter
- The given filter to query.option
- The option to queryhelics.HelicsHandleOption
.
Returns: int
.
helicsFilterGetTag¶
def helicsFilterGetTag(filter: HelicsFilter, tagname: str)
Get the data in a specified tag of a filter.
Parameters
filter
: The filter object to query.tagname
: The name of the tag to query.
Returns
A string with the tag data.
helicsFilterIsValid¶
def helicsFilterIsValid(filter: HelicsFilter) -> bool
Check if a filter is valid.
Parameters
filter
- The filter object to check.
Returns: True
if the Filter object represents a valid filter.
helicsFilterRemoveDeliveryEndpoint¶
def helicsFilterRemoveDeliveryEndpoint(filter: HelicsFilter, delivery_endpoint: str)
Remove a delivery destination from a cloning filter.
Parameters
filter
- The given filter (must be a cloning filter).delivery_endpoint
- A string with the delivery endpoint to remove.
helicsFilterRemoveTarget¶
def helicsFilterRemoveTarget(filter: HelicsFilter, target_name: str)
Remove a destination target from a filter.
Parameters
filter
- The given filter.target_name
- The named endpoint to remove as a target.
helicsFilterSet¶
def helicsFilterSet(filter: HelicsFilter, property: str, value: float)
Set a property on a filter.
Parameters
filter
- The filter to modify.property
- A string containing the property to set.value
- A numerical value for the property.
helicsFilterSetCustomCallback¶
def helicsFilterSetCustomCallback(filter: HelicsFilter, callback, user_data)
helicsFilterSetInfo¶
def helicsFilterSetInfo(filter: HelicsFilter, info: str)
Set the data in the info field for a filter
Parameters
filter
- The given filter.info
- The string to set.
helicsFilterSetOption¶
def helicsFilterSetOption(filter: HelicsFilter, option: HelicsHandleOption, value: int)
Set the data in the info field for a filter.
Parameters
filter
- The given filter.option
- The option to sethelics.HelicsHandleOption
.value
- The value of the option commonly 0 for false 1 for true.
helicsFilterSetString¶
def helicsFilterSetString(filter: HelicsFilter, property: str, value: str)
Set a string property on a filter.
Parameters
filter
- The filter to modify.property
- A string containing the property to set.value
- A string containing the new value.
helicsFilterSetTag¶
def helicsFilterSetTag(filter: HelicsFilter, tagname: str, tagvalue: str)
Set the data in a specific tag for a filter.
filter
: The filter object to set a tag for.
tagname
: The name of the tag to set.
tagvalue
: The string value to associate with a tag.
helicsGetBuildFlags¶
def helicsGetBuildFlags() -> str
Get the build flags used to compile HELICS.
helicsGetCompilerVersion¶
def helicsGetCompilerVersion() -> str
Get the compiler version used to compile HELICS.
helicsGetDataType¶
def helicsGetDataType(value: str) -> int
Get the data type for use in helics.helicsFederateRegisterPublication
, helics.helicsFederateRegisterInput
, helics.helicsFilterSetOption
.
Parameters
value
: A string representing a data type.
Returns: An int with the data type or HELICS_DATA_TYPE_UNKNOWN(-1) if not a valid value.
helicsGetFederateByName¶
def helicsGetFederateByName(fed_name: str) -> HelicsFederate
Get an existing helics.HelicsFederate
from a core by name.
The federate must have been created by one of the other functions and at least one of the objects referencing the created federate must still be active in the process.
Parameters
fed_name
- The name of the federate to retrieve.
Returns: helics.HelicsFederate
.
helicsGetFlagIndex¶
def helicsGetFlagIndex(value: str) -> Union[HelicsFlag, HelicsFederateFlag]
Get a property index for use in helics.helicsFederateInfoSetFlagOption
, helics.helicsFederateSetFlagOption
.
Parameters
value
- A string with the option name.
Returns: An int with the property code or (-1) if not a valid property.
helicsGetOptionIndex¶
def helicsGetOptionIndex(value: str) -> HelicsHandleOption
Get an option index for use in helics.helicsPublicationSetOption
, helics.helicsInputSetOption
, helics.helicsEndpointSetOption
,
helics.helicsFilterSetOption
, and the corresponding get functions
Parameters
value
- A string with the option name
Returns: An int with the option index or (-1) if not a valid property.
helicsGetOptionValue¶
def helicsGetOptionValue(value: str) -> int
Get an option value for use in helics.helicsPublicationSetOption
, helics.helicsInputSetOption
, helics.helicsEndpointSetOption
,
helics.helicsFilterSetOption
.
Parameters
value
- A string representing the value
Returns: An int with the option value or (-1) if not a valid value.
helicsGetPropertyIndex¶
def helicsGetPropertyIndex(value: str) -> HelicsProperty
Get a property index for use in helics.helicsFederateInfoSetFlagOption
, helics.helicsFederateInfoSetTimeProperty
, or helics.helicsFederateInfoSetIntegerProperty
.
Parameters
value
- A string with the property name.
Returns: An int with the property code or (-1) if not a valid property.
helicsGetSystemInfo¶
def helicsGetSystemInfo() -> JSONType
Get a Python dictionary from JSON string containing version info. The object contains fields with system information like cpu, core count, operating system, and memory, as well as information about the HELICS build. Used for debugging reports and gathering other information.
helicsGetVersion¶
def helicsGetVersion() -> str
Get a version string for HELICS.
helicsInputAddTarget¶
def helicsInputAddTarget(ipt: HelicsInput, target_name: str)
Add a publication to the list of data that an input subscribes to.
Parameters
ipt
- The named input to modify.target_name
- The name of a publication that an input should subscribe to.
helicsInputClearUpdate¶
def helicsInputClearUpdate(ipt: HelicsInput)
Clear the updated flag from an input.
helicsInputGetBoolean¶
def helicsInputGetBoolean(ipt: HelicsInput) -> bool
Get a boolean value from a subscription.
Parameters
ipt
- The input to get the data for.
Returns: A boolean value of current input value.
helicsInputGetByteCount¶
def helicsInputGetByteCount(ipt: HelicsInput) -> int
Data can be returned in a number of formats, for instance if data is published as a double it can be returned as a string and vice versa, not all translations make that much sense but they do work. Get the size of the raw value for subscription.
Returns: The size of the raw data/string in bytes.
helicsInputGetBytes¶
def helicsInputGetBytes(ipt: HelicsInput) -> bytes
Get the raw data for the latest value of a subscription.
Parameters
ipt
- The input to get the data for.
Returns: Raw string data.
helicsInputGetChar¶
def helicsInputGetChar(ipt: HelicsInput) -> str
Get a single character value from an input.
Parameters
ipt
- The input to get the data for.
Returns: The resulting character value.
helicsInputGetComplex¶
def helicsInputGetComplex(ipt: HelicsInput) -> complex
Get a pair of double forming a complex number from a subscriptions.
Parameters
ipt
- The input to get the data for.
Returns: a pair of floating point values that represent the real and imag values
helicsInputGetComplexObject¶
def helicsInputGetComplexObject(ipt: HelicsInput) -> complex
Get a complex object from an input object.
Parameters
ipt
- The input to get the data for.
Returns: complex
.
helicsInputGetComplexVector¶
def helicsInputGetComplexVector(ipt: HelicsInput) -> List[complex]
Get a vector of complex from a subscription.
Parameters
ipt
- The input to get the result for.
Returns: a list of floating point values
helicsInputGetDataBuffer¶
def helicsInputGetDataBuffer(ipt: HelicsInput) -> HelicsDataBuffer
Get the size of a value for subscription assuming return as a string.
Returns: The size of the string.
helicsInputGetDouble¶
def helicsInputGetDouble(ipt: HelicsInput) -> float
Get a double value from a subscription..
Parameters
ipt
- The input to get the data for.
Returns: The double value of the input.
helicsInputGetExtractionUnits¶
def helicsInputGetExtractionUnits(ipt: HelicsInput) -> str
Get the units of an input.
The same as helics.helicsInputGetUnits
.
Parameters
ipt
- The input to query.
Returns: A string with the units information.
helicsInputGetInfo¶
def helicsInputGetInfo(ipt: HelicsInput) -> str
Get the data in the info field of an input.
Parameters
ipt
- The input to query.
Returns: A string with the info field string.
helicsInputGetInjectionUnits¶
def helicsInputGetInjectionUnits(ipt: HelicsInput) -> str
Get the units of the publication that an input is linked to.
Parameters
ipt
- The input to query.
Returns: A string with the units information.
helicsInputGetInteger¶
def helicsInputGetInteger(ipt: HelicsInput) -> int
Get an integer value from a subscription.
Parameters
ipt
- The input to get the data for.
Returns: An int64_t value with the current value of the input.
helicsInputGetKey¶
def helicsInputGetKey(ipt: HelicsInput) -> str
Get the name of an input.
Parameters
ipt
- The input to query
Returns: A string with the name information.
DEPRECATED
helicsInputGetName¶
def helicsInputGetName(ipt: HelicsInput) -> str
Get the name of an input.
Parameters
ipt
- The input to query
Returns: A string with the name information.
helicsInputGetNamedPoint¶
def helicsInputGetNamedPoint(ipt: HelicsInput) -> Tuple[str, float]
Get a named point from a subscription.
Parameters
ipt
- The input to get the result for.
Returns: a string and a double value for the named point
helicsInputGetOption¶
def helicsInputGetOption(ipt: HelicsInput, option: HelicsHandleOption) -> int
Get the current value of an input handle option.
Parameters
ipt
- The input to query.option
- Integer representation of the option in question seehelics.HelicsHandleOption
.
Returns: An integer value with the current value of the given option.
helicsInputGetPublicationDataType¶
def helicsInputGetPublicationDataType(ipt: HelicsInput) -> int
Get the data type the publisher to an input is sending.
Parameters
ipt
- The input to query
Returns: An int containing the enumeration value of the publication type.
helicsInputGetPublicationType¶
def helicsInputGetPublicationType(ipt: HelicsInput) -> str
Get the type the publisher to an input is sending.
Parameters
ipt
- The input to query
Returns: A string with the type information.
helicsInputGetRawValue¶
def helicsInputGetRawValue(ipt: HelicsInput) -> bytes
Get the raw data for the latest value of a subscription.
Parameters
ipt
- The input to get the data for.
Returns: Raw string data.
DEPRECATED
helicsInputGetRawValueSize¶
def helicsInputGetRawValueSize(ipt: HelicsInput) -> int
Data can be returned in a number of formats, for instance if data is published as a double it can be returned as a string and vice versa, not all translations make that much sense but they do work. Get the size of the raw value for subscription.
Returns: The size of the raw data/string in bytes.
DEPRECATED
helicsInputGetString¶
def helicsInputGetString(ipt: HelicsInput) -> str
Get a string value from a subscription.
Parameters
ipt
- The input to get the data for.
Returns: A string data
helicsInputGetStringSize¶
def helicsInputGetStringSize(ipt: HelicsInput) -> int
Get the size of a value for subscription assuming return as a string.
Returns: The size of the string.
helicsInputGetTag¶
def helicsInputGetTag(input: HelicsInput, tagname: str)
Get the data in a specified tag of a input.
Parameters
input
: The input object to query.tagname
: The name of the tag to query.
Returns
A string with the tag data.
helicsInputGetTarget¶
def helicsInputGetTarget(ipt: HelicsInput) -> str
Get the target of an input.
Parameters
ipt
- The input to query
Returns: A string with the input target.
helicsInputGetTime¶
def helicsInputGetTime(ipt: HelicsInput) -> HelicsTime
Get a time value from a subscription.
Parameters
ipt
- The input to get the data for.
Returns: The resulting time value.
helicsInputGetType¶
def helicsInputGetType(ipt: HelicsInput) -> str
Get the type of an input.
Parameters
ipt
- The input to query
Returns: A string with the type information.
helicsInputGetUnits¶
def helicsInputGetUnits(ipt: HelicsInput) -> str
Get the units of an input.
Parameters
ipt
- The input to query.
Returns: A string with the units information.
helicsInputGetVector¶
def helicsInputGetVector(ipt: HelicsInput) -> List[float]
Get a vector of doubles from a subscription.
Parameters
ipt
- The input to get the result for.
Returns: a list of floating point values
helicsInputGetVectorSize¶
def helicsInputGetVectorSize(ipt: HelicsInput) -> int
Get the size of a value for subscription assuming return as an array of doubles.
Returns: The number of doubles in a returned vector.
helicsInputIsUpdated¶
def helicsInputIsUpdated(ipt: HelicsInput) -> bool
Check if a particular subscription was updated.
Returns: True
if it has been updated since the last value retrieval.
helicsInputIsValid¶
def helicsInputIsValid(ipt: HelicsInput) -> bool
Check if an input is valid.
Parameters
ipt
- The input to check
Returns: True
if the Input object represents a valid input.
helicsInputLastUpdateTime¶
def helicsInputLastUpdateTime(ipt: HelicsInput) -> HelicsTime
Get the last time a subscription was updated.
helicsInputSetDefaultBoolean¶
def helicsInputSetDefaultBoolean(ipt: HelicsInput, value: bool)
Set the default as a boolean.
Parameters
ipt
- The input to set the default for.value
- The default boolean value.
helicsInputSetDefaultBytes¶
def helicsInputSetDefaultBytes(ipt: HelicsInput, data: bytes)
Default Value functions. These functions set the default value for a subscription. That is the value returned if nothing was published from elsewhere. Set the default as a raw data array.
Parameters
ipt
- The input to set the default for.data
- A pointer to the raw data to use for the default.
helicsInputSetDefaultChar¶
def helicsInputSetDefaultChar(ipt: HelicsInput, value: str)
Set the default as a char.
Parameters
ipt
- The input to set the default for.value
- The default char value.
helicsInputSetDefaultComplex¶
def helicsInputSetDefaultComplex(ipt: HelicsInput, real: float, imag: float = 0)
Set the default as a complex number.
Parameters
ipt
- The input to set the default for.real
- The default real value.imag
- The default imaginary value.
helicsInputSetDefaultComplexVector¶
def helicsInputSetDefaultComplexVector(ipt: HelicsInput, vectorInput: List[complex])
Set the default as a vector of doubles.
Parameters
ipt
- The input to set the default for.vectorInput
- A pointer to an array of double data.
helicsInputSetDefaultDouble¶
def helicsInputSetDefaultDouble(ipt: HelicsInput, value: float)
Set the default as a double.
Parameters
ipt
- The input to set the default for.value
- The default double value.
helicsInputSetDefaultInteger¶
def helicsInputSetDefaultInteger(ipt: HelicsInput, value: int)
Set the default as an integer.
Parameters
ipt
- The input to set the default for.value
- The default integer.
helicsInputSetDefaultNamedPoint¶
def helicsInputSetDefaultNamedPoint(ipt: HelicsInput, string: str, value: float)
Set the default as a NamedPoint
.
Parameters
ipt
- The input to set the default for.string
- A pointer to a string representing the name.value
- A double value for the value of the named point.
helicsInputSetDefaultRaw¶
def helicsInputSetDefaultRaw(ipt: HelicsInput, data: bytes)
Default Value functions. These functions set the default value for a subscription. That is the value returned if nothing was published from elsewhere. Set the default as a raw data array.
Parameters
ipt
- The input to set the default for.data
- A pointer to the raw data to use for the default.
DEPRECATED
helicsInputSetDefaultString¶
def helicsInputSetDefaultString(ipt: HelicsInput, string: str)
Set the default as a string.
Parameters
ipt
- The input to set the default for.string
- A pointer to the default string.
helicsInputSetDefaultTime¶
def helicsInputSetDefaultTime(ipt: HelicsInput, value: HelicsTime)
Set the default as a time.
Parameters
ipt
- The input to set the default for.value
- The default time value.
helicsInputSetDefaultVector¶
def helicsInputSetDefaultVector(ipt: HelicsInput, vectorInput: List[float])
Set the default as a vector of doubles.
Parameters
ipt
- The input to set the default for.vectorInput
- A pointer to an array of double data.
helicsInputSetInfo¶
def helicsInputSetInfo(ipt: HelicsInput, info: str)
Set the data in the info field for an input.
Parameters
ipt
- The input to query.info
- The string to set.
helicsInputSetMinimumChange¶
def helicsInputSetMinimumChange(ipt: HelicsInput, tolerance: float)
Set the minimum change detection tolerance.
Parameters
ipt
- The input to modify.tolerance
- The tolerance level for registering an update, values changing less than this value will not show asbeing updated.
helicsInputSetOption¶
def helicsInputSetOption(ipt: HelicsInput, option: HelicsHandleOption, value: int)
Set an option on an input.
Parameters
ipt
- The input to query.option
- The option to set for the inputhelics.HelicsHandleOption
.value
- The value to set the option to.
helicsInputSetTag¶
def helicsInputSetTag(input: HelicsInput, tagname: str, tagvalue: str)
Set the data in a specific tag for a input.
input
: The input object to set a tag for.
tagname
: The name of the tag to set.
tagvalue
: The string value to associate with a tag.
helicsIsCoreTypeAvailable¶
def helicsIsCoreTypeAvailable(type: str) -> bool
Returns True
if core/broker type specified is available in current compilation.
Parameters
type
- A string representing a core type. Options include “zmq”, “udp”, “ipc”, “interprocess”, “tcp”, “default”, “mpi”.
Returns: True
if type
is available, False
if type
is not available.
helicsLoadSignalHandler¶
def helicsLoadSignalHandler()
Load a signal handler that handles Ctrl-C and shuts down the library
helicsLoadSignalHandlerCallback¶
def helicsLoadSignalHandlerCallback()
helicsLoadSignalHandlerCallbackNoExit¶
def helicsLoadSignalHandlerCallbackNoExit()
helicsLoadThreadedSignalHandler¶
def helicsLoadThreadedSignalHandler()
Load a threaded signal handler that handles Ctrl-C and shuts down the library
helicsMessageAppendData¶
def helicsMessageAppendData(message: HelicsMessage, data: bytes)
Append data to the payload.
Parameters
message
- The message object in question.data
- A string containing the message data to append.
helicsMessageCheckFlag¶
def helicsMessageCheckFlag(message: HelicsMessage, flag: int) -> bool
Check if a flag is set on a message.
Parameters
message
- The message object in question.flag
- The flag to check should be between [0,15].
Returns: The flags associated with a message.
DEPRECATED
helicsMessageClear¶
def helicsMessageClear(message: HelicsMessage)
Reset message to empty state
Parameters
message
- The message object in question.
helicsMessageClearFlags¶
def helicsMessageClearFlags(message: HelicsMessage)
Clear the flags of a message.
Parameters
message
- The message object in question.
helicsMessageClone¶
def helicsMessageClone(message: HelicsMessage) -> HelicsMessage
Clone a message object.
Parameters
message
- The message object to copy from.
Returns: helics.HelicsMessage
.
helicsMessageCopy¶
def helicsMessageCopy(source_message: HelicsMessage, destination_message: HelicsMessage)
Copy a message object.
Parameters
source_message
- The message object to copy from.destination_message
- The message object to copy to.
helicsMessageDataBuffer¶
def helicsMessageDataBuffer(message: HelicsMessage) -> HelicsDataBuffer
Get a data buffer to the message object.
Parameters
message
- A message object to get the dataBuffer for.
Returns: A HelicsDataBuffer object to the data in a message. Modifying the buffer will directly modify the message contents.
helicsMessageFree¶
def helicsMessageFree(message: HelicsMessage)
Free a message object from memory. Memory for message is managed so not using this function does not create memory leaks, this is an indication to the system that the memory for this message is done being used and can be reused for a new message.
helics.helicsFederateClearMessages
can also be used to clear up all stored messages at once.
helicsMessageGetByteCount¶
def helicsMessageGetByteCount(message: HelicsMessage) -> int
Get the size of the data payload in bytes.
Parameters
message
- The message object in question.
Returns: The size of the data payload.
helicsMessageGetBytes¶
def helicsMessageGetBytes(message: HelicsMessage) -> bytes
Get the raw data for a message object.
Parameters
message
- A message object to get the data for.
Returns: Raw string data.
helicsMessageGetBytesPointer¶
def helicsMessageGetBytesPointer(message: HelicsMessage) -> pointer
Get a pointer to the raw data of a message.
Parameters
message
- A message object to get the data for.
Returns: A pointer to the raw data in memory, the pointer may be NULL if the message is not a valid message.
helicsMessageGetDestination¶
def helicsMessageGetDestination(message: HelicsMessage) -> str
Get the destination endpoint of a message.
Parameters
message
- The message object in question.
Returns: A string with the destination endpoint.
helicsMessageGetFlagOption¶
def helicsMessageGetFlagOption(message: HelicsMessage, flag: int) -> bool
Get flag on a message.
Parameters
message
- The message object in question.flag
- The flag to check should be between [0,15].
Returns: The flags associated with a message.
helicsMessageGetMessageID¶
def helicsMessageGetMessageID(message: HelicsMessage) -> int
Get the messageID of a message.
Parameters
message
- The message object in question.
Returns: The messageID.
helicsMessageGetOriginalDestination¶
def helicsMessageGetOriginalDestination(message: HelicsMessage) -> str
Get the original destination endpoint of a message, the destination may have been modified by filters or other actions.
Parameters
message
- The message object in question.
Returns: A string with the original destination of a message.
helicsMessageGetOriginalSource¶
def helicsMessageGetOriginalSource(message: HelicsMessage) -> str
Get the original source endpoint of a message, the source may have been modified by filters or other actions.
Parameters
message
- The message object in question.
Returns: A string with the source of a message.
helicsMessageGetRawData¶
def helicsMessageGetRawData(message: HelicsMessage) -> bytes
Get the raw data for a message object.
Parameters
message
- A message object to get the data for.
Returns: Raw string data.
DEPRECATED
helicsMessageGetRawDataPointer¶
def helicsMessageGetRawDataPointer(message: HelicsMessage) -> pointer
Get a pointer to the raw data of a message.
Parameters
message
- A message object to get the data for.
Returns: A pointer to the raw data in memory, the pointer may be NULL if the message is not a valid message.
DEPRECATED
helicsMessageGetRawDataSize¶
def helicsMessageGetRawDataSize(message: HelicsMessage) -> int
Get the size of the data payload in bytes.
Parameters
message
- The message object in question.
Returns: The size of the data payload.
DEPRECATED
helicsMessageGetSource¶
def helicsMessageGetSource(message: HelicsMessage) -> str
Message operation functions. Functions for working with helics message envelopes. Get the source endpoint of a message.
Parameters
message
- The message object in question.
Returns: A string with the source endpoint.
helicsMessageGetString¶
def helicsMessageGetString(message: HelicsMessage) -> str
Get the payload of a message as a string.
Parameters
message
- The message object in question.
Returns: A string representing the payload of a message.
helicsMessageGetTime¶
def helicsMessageGetTime(message: HelicsMessage) -> HelicsTime
Get the helics time associated with a message.
Parameters
message
- The message object in question.
Returns: The time associated with a message.
helicsMessageIsValid¶
def helicsMessageIsValid(message: HelicsMessage) -> bool
A check if the message contains a valid payload.
Parameters
message
- The message object in question.
Returns: True
if the message contains a payload.
helicsMessageReserve¶
def helicsMessageReserve(message: HelicsMessage, reserve_size: int)
Reserve space in a buffer but don’t actually resize. The message data buffer will be reserved but not resized.
Parameters
message
- The message object in question.reserve_size
- The number of bytes to reserve in the message object.
helicsMessageResize¶
def helicsMessageResize(message: HelicsMessage, new_size: int)
Resize the data buffer for a message. The message data buffer will be resized. There are no guarantees on what is in the buffer in newly allocated space. If the allocated space is not sufficient new allocations will occur
Parameters
message
- The message object in question.new_size
- The new size in bytes of the buffer.
helicsMessageSetData¶
def helicsMessageSetData(message: HelicsMessage, data: bytes)
Set the data payload of a message as raw data.
Parameters
message
- The message object in question.data
- A string containing the message data.
helicsMessageSetDataBuffer¶
def helicsMessageSetDataBuffer(message: HelicsMessage, data: HelicsDataBuffer)
Set the data payload of a message from a HelicsDataBuffer Object.
Parameters
message
- The message object in question.data
- The dataBuffer containing the appropriate data, if null will clear the message payload.
helicsMessageSetDestination¶
def helicsMessageSetDestination(message: HelicsMessage, destination: str)
Set the destination of a message.
Parameters
message
- The message object in question.destination
- A string containing the new destination.
helicsMessageSetFlagOption¶
def helicsMessageSetFlagOption(message: HelicsMessage, flag: int, value: bool)
Set a flag on a message.
Parameters
message
- The message object in question.flag
- An index of a flag to set on the message.value
- The desired value of the flag.
helicsMessageSetMessageID¶
def helicsMessageSetMessageID(message: HelicsMessage, message_id: int)
Set the message ID for the message. Normally this is not needed and the core of HELICS will adjust as needed.
Parameters
message
- The message object in question.message_id
- A new message ID.
helicsMessageSetOriginalDestination¶
def helicsMessageSetOriginalDestination(message: HelicsMessage, destination: str)
Set the original destination of a message.
Parameters
message
- The message object in question.destination
- A string containing the new original source.
helicsMessageSetOriginalSource¶
def helicsMessageSetOriginalSource(message: HelicsMessage, source: str)
Set the original source of a message.
Parameters
message
- The message object in question.source
- A string containing the new original source.
helicsMessageSetSource¶
def helicsMessageSetSource(message: HelicsMessage, source: str)
Set the source of a message.
Parameters
message
- The message object in question.source
- A string containing the source.
helicsMessageSetString¶
def helicsMessageSetString(message: HelicsMessage, string: str)
Set the data payload of a message as a string.
Parameters
message
- The message object in question.string
- A string containing the message data.
helicsMessageSetTime¶
def helicsMessageSetTime(message: HelicsMessage, time: HelicsTime)
Set the delivery time for a message.
Parameters
message
- The message object in question.time
- The time the message should be delivered.
helicsPublicationAddTarget¶
def helicsPublicationAddTarget(pub: HelicsPublication, target_name: str)
Add a named input to the list of targets a publication publishes to.
Parameters
pub
- The publication to add the target for.target_name
- The name of an input that the data should be sent to.
helicsPublicationGetInfo¶
def helicsPublicationGetInfo(pub: HelicsPublication) -> str
Get the data in the info field of an publication.
Parameters
pub
- The publication to query.
Returns: A string with the info field string.
helicsPublicationGetKey¶
def helicsPublicationGetKey(pub: HelicsPublication) -> str
Get the name of a publication. This will be the global name used to identify the publication to the federation.
Parameters
pub
- The publication to query.
Returns: A string with the units information.
DEPRECATED
helicsPublicationGetName¶
def helicsPublicationGetName(pub: HelicsPublication) -> str
Get the name of a publication. This will be the global name used to identify the publication to the federation.
Parameters
pub
- The publication to query.
Returns: A string with the units information.
helicsPublicationGetOption¶
def helicsPublicationGetOption(pub: HelicsPublication, option: HelicsHandleOption) -> int
Get the value of an option for a publication.
Parameters
pub
- The publication to query.option
- The value to query seehelics.HelicsHandleOption
.
Returns: A string with the info field string.
helicsPublicationGetTag¶
def helicsPublicationGetTag(pub: HelicsPublication, tagname: str)
Get the data in a specified tag of a publication.
Parameters
pub
: The publication object to query.tagname
: The name of the tag to query.
Returns
A string with the tag data.
helicsPublicationGetType¶
def helicsPublicationGetType(pub: HelicsPublication) -> str
Get the type of a publication.
Parameters
pub
- The publication to query
Returns: A string with the publication type information.
helicsPublicationGetUnits¶
def helicsPublicationGetUnits(pub: HelicsPublication) -> str
Get the units of a publication.
Parameters
pub
- The publication to query.
Returns: A string with the units information.
helicsPublicationIsValid¶
def helicsPublicationIsValid(pub: HelicsPublication) -> bool
Publication functions. Functions for publishing data of various kinds. The data will get translated to the type specified when the publication was constructed automatically regardless of the function used to publish the data. Check if a publication is valid.
Parameters
pub
- The publication to check
Returns: True
if the publication is a valid publication.
helicsPublicationPublishBoolean¶
def helicsPublicationPublishBoolean(pub: HelicsPublication, value: bool)
Publish a Boolean Value.
Parameters
pub
- The publication to publish for.value
- The boolean value to publish.
helicsPublicationPublishBytes¶
def helicsPublicationPublishBytes(pub: HelicsPublication, data: bytes)
Publish raw data from a char * and length.
Parameters
pub
- The publication to publish for.data
- A pointer to the raw data.
helicsPublicationPublishChar¶
def helicsPublicationPublishChar(pub: HelicsPublication, value: str)
Publish a single character.
Parameters
pub
- The publication to publish for.value
- The numerical value to publish.
helicsPublicationPublishComplex¶
def helicsPublicationPublishComplex(pub: HelicsPublication, real: float, imag: float = 0)
Publish a complex value (or pair of values).
Parameters
pub
- The publication to publish for.real
-float
number orcomplex
numberimag
-float
number
helicsPublicationPublishComplexVector¶
def helicsPublicationPublishComplexVector(pub: HelicsPublication, vectorInput: List[complex])
Publish a vector of complexes.
Parameters
pub
- The publication to publish for.vectorInput
- A list of complex data.
helicsPublicationPublishDataBuffer¶
def helicsPublicationPublishDataBuffer(pub: HelicsPublication, buffer: HelicsDataBuffer)
Publish a data buffer.
Parameters
pub
- The publication to publish for.buffer
- A HelicsDataBuffer to publish.
helicsPublicationPublishDouble¶
def helicsPublicationPublishDouble(pub: HelicsPublication, value: float)
Publish a double floating point value.
Parameters
pub
- The publication to publish for.value
- The numerical value to publish.
helicsPublicationPublishInteger¶
def helicsPublicationPublishInteger(pub: HelicsPublication, value: int)
Publish an integer value.
Parameters
pub
- The publication to publish for.value
- The numerical value to publish.
helicsPublicationPublishNamedPoint¶
def helicsPublicationPublishNamedPoint(pub: HelicsPublication, string: str, value: float)
Publish a named point.
Parameters
pub
- The publication to publish for.string
- A string for the name to publish.value
- A double for the value to publish.
helicsPublicationPublishRaw¶
def helicsPublicationPublishRaw(pub: HelicsPublication, data: bytes)
Publish raw data from a char * and length.
Parameters
pub
- The publication to publish for.data
- A pointer to the raw data.
DEPRECATED
helicsPublicationPublishString¶
def helicsPublicationPublishString(pub: HelicsPublication, string: str)
Publish a string.
Parameters
pub
- The publication to publish for.string
- The string to publish.
helicsPublicationPublishTime¶
def helicsPublicationPublishTime(pub: HelicsPublication, value: HelicsTime)
Publish a time value.
Parameters
pub
- The publication to publish for.value
- The numerical value to publish.
helicsPublicationPublishVector¶
def helicsPublicationPublishVector(pub: HelicsPublication, vectorInput: List[float])
Publish a vector of doubles.
Parameters
pub
- The publication to publish for.vectorInput
- A list of double data.
helicsPublicationSetInfo¶
def helicsPublicationSetInfo(pub: HelicsPublication, info: str)
Set the data in the info field for a publication.
Parameters
pub
- The publication to set the info field for.info
- The string to set.
helicsPublicationSetMinimumChange¶
def helicsPublicationSetMinimumChange(pub: HelicsPublication, tolerance: float)
Set the minimum change detection tolerance.
Parameters
pub
- The publication to modify.tolerance
- The tolerance level for publication, values changing less than this value will not be published.
helicsPublicationSetOption¶
def helicsPublicationSetOption(pub: HelicsPublication, option: HelicsHandleOption, value: int)
Set the value of an option for a publication.
Parameters
pub
- The publication to query.option
- Integer code for the option to sethelics.HelicsHandleOption
.value
- The value to set the option to.
helicsPublicationSetTag¶
def helicsPublicationSetTag(pub: HelicsPublication, tagname: str, tagvalue: str)
Set the data in a specific tag for a publication.
pub
: The publication object to set a tag for.
tagname
: The name of the tag to set.
tagvalue
: The string value to associate with a tag.
helicsQueryBrokerExecute¶
def helicsQueryBrokerExecute(query: HelicsQuery, broker: HelicsBroker) -> JSONType
Execute a query directly on a broker. The call will block until the query finishes which may require communication or other delays.
Parameters
query
- The query object to use in the query.broker
- The broker to send the query to.
Returns: String that contains the result of the query that was executed.
helicsQueryBufferFill¶
def helicsQueryBufferFill(buffer: HelicsQueryBuffer, string: str)
Set the data for a query callback.
There are many queries that HELICS understands directly, but it is occasionally useful to have a federate be able to respond to specific queries with answers specific to a federate.
buffer
: The buffer received in a helicsQueryCallback.string
: Pointer to the data to fill the buffer with.
helicsQueryCoreExecute¶
def helicsQueryCoreExecute(query: HelicsQuery, core: HelicsCore) -> JSONType
Execute a query directly on a core. The call will block until the query finishes which may require communication or other delays.
Parameters
query
- The query object to use in the query.core
- The core to send the query to.
Returns: String that contains the result of the query that was executed.
helicsQueryExecute¶
def helicsQueryExecute(query: HelicsQuery, fed: HelicsFederate) -> JSONType
Execute a query. The call will block until the query finishes which may require communication or other delays.
Parameters
query
- The query object to use in the query.fed
- A federate to send the query through.
Returns: String that contains the result of the query that was executed.
helicsQueryExecuteAsync¶
def helicsQueryExecuteAsync(query: HelicsQuery, fed: HelicsFederate)
Execute a query in a non-blocking call.
Parameters
query
- The query object to use in the query.fed
- A federate to send the query through.
helicsQueryExecuteComplete¶
def helicsQueryExecuteComplete(query: HelicsQuery) -> JSONType
Complete the return from a query called with helics.helicsExecuteQueryAsync
.
The function will block until the query completes isQueryComplete
can be called to determine if a query has completed or not.
Parameters
query
- The query object to complete execution of.
Returns: String that contains the result of the query that was executed.
helicsQueryFree¶
def helicsQueryFree(query: HelicsQuery)
Free the memory associated with a query object.
helicsQueryIsCompleted¶
def helicsQueryIsCompleted(query: HelicsQuery) -> bool
Check if an asynchronously executed query has completed. This function should usually be called after a QueryExecuteAsync function has been called.
Parameters
query
- The query object to check if completed
Returns: Will return True
if an asynchronous query has completed or a regular query call was made with a result, and false if an asynchronous query has not completed or is invalid.
helicsQuerySetOrdering¶
def helicsQuerySetOrdering(query: HelicsQuery, mode: int)
Update the ordering mode of the query, fast runs on priority channels, ordered goes on normal channels but goes in sequence
Parameters¶
query
: The query object to change the order for.mode
: 0 for fast, 1 for ordered.
helicsQuerySetQueryString¶
def helicsQuerySetQueryString(query: HelicsQuery, query_string: str)
Update the queryString of a query.
Parameters
query
- The query object to change the target of.query_string
- the new queryString.
helicsQuerySetTarget¶
def helicsQuerySetTarget(query: HelicsQuery, target_name: str)
Update the target of a query.
Parameters
query
- The query object to change the target of.target_name
- the name of the target to query.
helicsSubscriptionGetKey¶
def helicsSubscriptionGetKey(ipt: HelicsInput) -> str
Get the name of a subscription.
Parameters
ipt
- The input to query
Returns: A string with the subscription name.
DEPRECATED
helicsSubscriptionGetTarget¶
def helicsSubscriptionGetTarget(ipt: HelicsInput) -> str
Get the target of a subscription.
Parameters
ipt
- The input to query
Returns: A string with the subscription target.
DEPRECATED
helicsTranslatorAddDestinationEndpoint¶
def helicsTranslatorAddDestinationEndpoint(translator: HelicsTranslator, destination: str)
Add a destination target to a translator. All messages coming from a source are copied to the delivery address(es).
Parameters¶
translator
- The given translator.destination
- The name of the translator to add as a source target.
helicsTranslatorAddInputTarget¶
def helicsTranslatorAddInputTarget(translator: HelicsTranslator, input: str)
Add an input to send a translator output.
All messages going to a destination are copied to the delivery address(es).
Parameters¶
translator
- The given translator to add a input target to.input
- The name of the endpoint to add as a input target.
helicsTranslatorAddPublicationTarget¶
def helicsTranslatorAddPublicationTarget(translator: HelicsTranslator, publication: str)
Add a source publication target to a translator.
All messages coming from a source are copied to the delivery address(es).
translator
- The given translator.publication
- The name of the endpoint to add as a publication target.
helicsTranslatorAddSourceEndpoint¶
def helicsTranslatorAddSourceEndpoint(translator: HelicsTranslator, source: str)
Add a source endpoint target to a translator.
All messages coming from a source are copied to the delivery address(es).
trans
- The given translator.- `source`` - The name of the endpoint to add as a source target.
helicsTranslatorGetInfo¶
def helicsTranslatorGetInfo(translator: HelicsTranslator) -> str
Get the data in the info field of an translator.
Parameters
translator
- The translator to query.
Returns: A string with the info field string.
helicsTranslatorGetName¶
def helicsTranslatorGetName(translator: HelicsTranslator) -> str
Get the name of a translator.
Parameters
translator
- The translator to query.
Returns: A string with the name of the translator.
helicsTranslatorGetOption¶
def helicsTranslatorGetOption(translator: HelicsTranslator, option: HelicsHandleOption) -> int
Get the current value of an translator handle option.
Parameters
translator
- The translator to query.option
- Integer representation of the option in question seehelics.HelicsHandleOption
.
Returns: An integer value with the current value of the given option.
helicsTranslatorGetTag¶
def helicsTranslatorGetTag(translator: HelicsTranslator) -> str
Get the data in the tag for an translator.
Parameters
translator
- The translator to query.
Returns: A string with the info field string.
helicsTranslatorIsValid¶
def helicsTranslatorIsValid(translator: HelicsTranslator) -> bool
Check if a translator is valid.
translator
The translator object to check.
Returns: True if the Translator object represents a valid translator.
helicsTranslatorRemoveTarget¶
def helicsTranslatorRemoveTarget(translator: HelicsTranslator, target: str)
Remove target from translator
Parameters¶
translator
- The given translator.target_name
- The name of the translator to remove.
helicsTranslatorSet¶
def helicsTranslatorSet(translator: HelicsTranslator, property: str, value: float)
Set a property on a translator.
translator
: The translator to modify.prop
: A string containing the property to set.val
: A numerical value for the property.
helicsTranslatorSetCustomCallback¶
def helicsTranslatorSetCustomCallback(translator, to_message_call, to_value_call, user_data)
Set a general callback for a custom translator.
Add a pair of custom callbacks for running a translator operation in the C shared library.
Parameters
translator
: The translator object to set the callbacks for.to_message_call
: A callback with signature void(HelicsDataBuffer, HelicsMessage, void *); The function arguments are raw Value data, the messageObject to fill out and a pointer to user data.to_value_call
: A callback with signature void(HelicsMessage, HelicsDataBuffer, void *); The function arguments are a message object, the data buffer to fill out and a pointer to user data.user_data
: A pointer to user data that is passed to the functions when executing.
helicsTranslatorSetInfo¶
def helicsTranslatorSetInfo(translator: HelicsTranslator, info: str)
Set the data in the info field for an translator.
Parameters
translator
- The translator to query.info
- The string to set.
helicsTranslatorSetOption¶
def helicsTranslatorSetOption(translator: HelicsTranslator, option: HelicsHandleOption, value: int)
Set an option on an translator.
Parameters
translator
- The translator to query.option
- The option to set for the translatorhelics.HelicsHandleOption
.value
- The value to set the option to.
helicsTranslatorSetString¶
def helicsTranslatorSetString(translator: HelicsTranslator, property: str, value: str)
Set string property on a translator.
Parameters
translator
- The translator to modifyproperty
: A string containing the property to set.value
: A string value for the property.
helicsTranslatorSetTag¶
def helicsTranslatorSetTag(translator: HelicsTranslator, tag: str)
Set the data in the tag for an translator.
Parameters
translator
- The translator to query.tag
- The string to set.
helicsWrapDataInBuffer¶
def helicsWrapDataInBuffer(data: bytes, data_capacity: int) -> HelicsDataBuffer
Wrap user data in a buffer object
loadSym¶
def loadSym(s)