Skip to content

Commit

Permalink
Merge pull request #243 from arkedge/feature/add_asset_to_coge_gen
Browse files Browse the repository at this point in the history
[code-generator] max_tlm_num のアサーションを追加
  • Loading branch information
meltingrabbit authored Dec 18, 2023
2 parents 105dc1d + 17f3039 commit b00e0e3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

### Enhancements
- [#240](https://github.com/arkedge/c2a-core/pull/240): code-generator の出力コードに,設定情報を残すようにする
- [#243](https://github.com/arkedge/c2a-core/pull/243): code-generator に max_tlm_num のアサーションを追加

### Migration Guide
- [#240](https://github.com/arkedge/c2a-core/pull/240): user 側でのコードレベルでの対応は不要
Expand Down
22 changes: 16 additions & 6 deletions code-generator/my_mod/load_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,27 @@ def LoadOtherObcTlm(settings):
other_obc_dbs = {}

for i in range(len(settings["other_obc_data"])):
if not settings["other_obc_data"][i]["is_enable"]:
other_obc_settings = settings["other_obc_data"][i]
if not other_obc_settings["is_enable"]:
continue
tlm_db_path = settings["other_obc_data"][i]["path_to_db"] + r"TLM_DB/calced_data/"

# max_tlm_num のアサーション
if other_obc_settings["max_tlm_num"] <= int(other_obc_settings["tlm_id_range"][1], 0):
print(
"Error: max_tlm_num is invalid at " + other_obc_settings["name"] + " DB.",
file=sys.stderr,
)
sys.exit(1)

tlm_db_path = other_obc_settings["path_to_db"] + r"TLM_DB/calced_data/"

tlm_db = LoadTlmCSV_(
tlm_db_path,
settings["other_obc_data"][i]["db_prefix"],
settings["other_obc_data"][i]["tlm_id_range"],
settings["other_obc_data"][i]["input_file_encoding"],
other_obc_settings["db_prefix"],
other_obc_settings["tlm_id_range"],
other_obc_settings["input_file_encoding"],
)
other_obc_dbs[settings["other_obc_data"][i]["name"]] = tlm_db
other_obc_dbs[other_obc_settings["name"]] = tlm_db

# pprint.pprint(other_obc_dbs)
return other_obc_dbs

0 comments on commit b00e0e3

Please sign in to comment.