NetworkLoader
- class sharpy.io.network_interface.NetworkLoader[source]
SHARPy UDP data input and output interface.
The settings of this interface are to be used as the dictionary to the setting
network_settingin theDynamicCoupledsolver, which is the only one that is currently supported.This interface allows for SHARPy to receive and send simulation data over the network using an UDP protocol.
The setting
variables_filenameis a filename to aYAMLfile that contains a list of the input or output variables. The example below shows an acceptable input--- - name: 'control_surface_deflection' # variable name. those in the timestep_info are supported var_type: 'control_surface' inout: 'in' # either `in`, `out` or `inout` position: 0 # control surface index - name: 'pos' # variable name var_type: 'node' # type of variable. In this case a node variable. Others: `panel`, `control_surface` inout: 'out' position: 5 # node number index: 2 # vector index, in this case a 3d vector where the desired index is number 2 - name: 'gamma' inout: 'out' position: [0, 1, 2] # [i_surf, i_chordwise, i_spanwise] var_type: 'panel' - name: 'psi' # CRV inout: 'out' var_type: 'node' position: 3 # node id index: 2 # dimension index ...
All variables in the aero and structural timestep info classes
datastructuresare supported, with the addition ofdtfor the time increment andntfor the current time step number.Note
If using a control surface input, make sure this control surface is given
control_surface_type = 2in the the case.aero.h5file. Otherwise, the control surface will not move!The relevant settings for the input and output sockets can be found in
InNetworkandOutNetwork, respectively.If the setting
send_output_to_all_clientsisTrue, then the clients from which the input signal is received will also be added to the destination client address book.The input and output messages follow the example set by X-Plane
RREF0protocol. Thus, a message consists of a 5-byte header containingRREF0followed by 8-bytes per variable, where the first 4-bytes correspond to the variable number (as ordered in the YAML file) as an integer and the latter 4-bytes correspond to the value of the variable in single precision float. The byte ordering is specified by the user.A specific network log is created to detail the ins and outs of the communication protocol. The level of messages that are shown can be set in the settings.
See also
Endianness: https://docs.python.org/3/library/struct.html#byte-order-size-and-alignment
Note
The SHARPy input and output sockets do not time out.
Note
The first time step in a simulation with UDP inputs takes particularly long. Make sure your client has a sufficient time out time to avoid issues. After the first time step, the UDP should not delay the simulation.
Warning
There is a limitation, for the moment, on just one control surface being supported for UDP input.
The
NetworkLoadertakes the following settings:Name
Type
Description
Default
variables_filenamestrPath to YAML file containing input/output variables
Nonebyte_orderingstrDesired endianness byte ordering
littleinput_network_settingsdictSettings for the input network.:class:~sharpy.io.network_interface.InNetwork.
{}output_network_settingsdictSettings for the output network
OutNetwork.{}send_output_to_all_clientsboolSend output to all clients, including those from where the input is received.
Falsereceived_data_filenamestrIf not empty, writes received input data to the specified file.
log_namestrNetwork log file name
./network_output.logconsole_log_levelstrMinimum logging level in console.
infofile_log_levelstrMinimum logging level in log file.
debug