Skip to content

Commit

Permalink
Merge branch 'master' into bid2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pnallin authored Nov 21, 2022
2 parents a29cce8 + ed50e86 commit 9e9dd61
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 197 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: Sphinx docs
on:
push:
branches:
- master
- dict-update
- v2

jobs:
deploy:
Expand Down
11 changes: 11 additions & 0 deletions bench.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from timeit import timeit

setup = """
import pydrs
drs = pydrs.EthDRS('10.0.6.56', 5000)
drs.slave_addr = 5"""

for i in range(0, 10):
print(
timeit("drs.read_vars_fbp(); drs.read_vars_common();", setup=setup, number=100)
)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ dev = [
"pyflakes==2.5.0",
"types-setuptools",
"pytest==7.1.2"
]
]
Binary file added scripts-dev/input.xlsx
Binary file not shown.
16 changes: 15 additions & 1 deletion src/pydrs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,7 @@ def _read_vars_generic(
if length is None:
length = 255 + sum([data["size"] for data in template.values()])


# Dynamically obtaining transfer sizes incurs a 70 uS penalty per execution

vals = self._transfer(
Expand Down Expand Up @@ -1835,6 +1836,7 @@ def read_vars_fac_acdc(self, iib: bool = True) -> dict:
vars_dict["iib_is_alarms_raw"] = vars_dict.pop("iib_alarms_is")
vars_dict["iib_is_interlocks_raw"] = vars_dict.pop("iib_interlocks_is")


vars_dict["iib_is_interlocks"] = self.decode_interlocks(
vars_dict["iib_is_interlocks_raw"],
fac.list_acdc_iib_is_interlocks,
Expand All @@ -1854,9 +1856,9 @@ def read_vars_fac_acdc(self, iib: bool = True) -> dict:
vars_dict["iib_cmd_alarms_raw"],
fac.list_acdc_iib_cmd_alarms,
)

return vars_dict


def read_vars_fac_dcdc(self, iib: bool = True) -> dict:
"""Reads FAC DCDC power supply variables
Expand Down Expand Up @@ -2179,6 +2181,7 @@ def read_vars_fac_2p_dcdc_imas(self, com_add=1) -> dict:
"""
Read FAC 2P DCDC IMAS specific power supply variables
Returns
-------
dict
Expand All @@ -2191,6 +2194,7 @@ def read_vars_fac_2p_dcdc_imas(self, com_add=1) -> dict:
)

def check_param_bank(self, param_file: str):

ps_param_list = []

# max_sampling_freq = 600000
Expand Down Expand Up @@ -2253,6 +2257,14 @@ def calc_pi(self, r_load, l_load, f_bw, v_dclink, send_drs=0, dsp_id=0):
self.set_dsp_coeffs(3, dsp_id, [kp, ki, 0.95, -0.95])
return {"kp": kp, "ki": ki}

def store_dsp_modules_bank_csv(self, bank):
filename = input("Digite o nome do arquivo: ")
with open(filename + ".csv", "w", newline="") as f:
writer = csv.writer(f, delimiter=",")
for dsp_module, values in bank.items():
for i, coef in enumerate(values["coeffs"]):
writer.writerow([dsp_module, values["class"], i] + coef)

def config_dsp_modules_drs_fap_tests(self):
kp_load = 0
ki_load = 20.95
Expand Down Expand Up @@ -2330,6 +2342,7 @@ def get_dsp_modules_bank(
dsp_coeffs
)


return dsp_modules_bank

def set_dsp_modules_bank(
Expand Down Expand Up @@ -2386,6 +2399,7 @@ def read_csv_dsp_modules_bank(dsp_modules_file_csv: str):
Returns
-------
dict[dsp_class_name] = {"class":int, "coeffs":[float]}
"""
dsp_coeffs_from_csv = {}
Expand Down
Empty file removed tests/bsmp/__init__.py
Empty file.
36 changes: 0 additions & 36 deletions tests/bsmp/test_commands.py

This file was deleted.

26 changes: 0 additions & 26 deletions tests/bsmp/test_interface.py

This file was deleted.

26 changes: 0 additions & 26 deletions tests/integration/test_act.py

This file was deleted.

25 changes: 0 additions & 25 deletions tests/integration/test_perm.py

This file was deleted.

48 changes: 0 additions & 48 deletions tests/integration/test_read.py

This file was deleted.

32 changes: 0 additions & 32 deletions tests/integration/test_set.py

This file was deleted.

0 comments on commit 9e9dd61

Please sign in to comment.