Skip to content

Latest commit

 

History

History
113 lines (92 loc) · 2.07 KB

structure.md

File metadata and controls

113 lines (92 loc) · 2.07 KB

Data I/O

The data exchange flow is depicted as below:

Alt text

Data IO from HTB to LTB is converted by a linear function:

$$ y = htb_{s}\cdot x + htb_{b} $$

where $x$ is the data from HTB (converted from HEX to DEC), $y$ is the output,$htb_{s}$ is the scale factor, and $htb_{b}$ is the bias.

In contrast, data IO from LTB to HTB is converted by a linear function:

$$ y = htb_{s}\cdot x $$

where $x$ is the data from LTB, $y$ is the data to HTB, $htb_{s}$ is the scale factor.

Data IO configuration is stored in a dict io_configlocated in dataio.py:

"""
Configurations
--------------
k_df: int
    default counter value
p_df: float
    default active power
q_df: float
    default reactive power
k_pu: float
    scaler of p.u., convert data from HTB base to LTB base
"""

Co-Simulation

Counter generated by HTB is a loop of integers from 11 to 199.

Counter is calculated by a linear function:

$$ k = k_{s}\cdot k_r + k_{b} $$

where $k_r$ is the counter read from HTB, $k$ is the actual counter, $k_{s}$ is the scale factor, and $k_{b}$ is the bias.

Co-simulation status are stored in a dict cs_stat:

"""
Status
------
iter_total: int
    Number of total iterations
iter_fail: int
    Number of failed iterations
ks: int
    Counter base
kb: int
    Counter bias
"""

Co-simulation configurations are stored in a dict cs_config:

"""
Configurations
--------------
ti: float
    Starting point of TDS
t_step: float
    Time step of co-simulation
t_total: float
    Time length of co-simulation
itermax_io: int
    Maximum iteration number of data IO
load_switch: bool
    Switch of load, True for HTB load on, False for load off
"""

Co-simulation timeseries data are stored in a pandas DataFrame csdata:

"""
Data
----
ks: int
    Counter base
kb: int
    Counter bias
kr: int
    Read counter
freq: float
    Frequency from LTB
volt: float
    Voltage from LTB
p: float
    Active power from HTB
q: float
    Reactive power from HTB
tw: float
    Time to write
tr: float
    Time to read
"""