SIENTIAPDE-1312
SIENTIAPDE-1312: Update build_tag_config to calculate subscription_period_ms based on minimum frequency from tags. Enhance test_build_tag_config to include frequency and validate subscription_period_ms.
This commit is contained in:
@@ -280,4 +280,10 @@ def build_tag_config(
|
|||||||
**tag,
|
**tag,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frequencies = [x['frequency'] for x in slot_config[f'{i}'][server_name]['tags'].values()]
|
||||||
|
|
||||||
|
min_frequency = min(frequencies) if frequencies else 500
|
||||||
|
|
||||||
|
slot_config[f"{i}"][server_name]['subscription_period_ms'] = min_frequency/2
|
||||||
|
|
||||||
return slot_config
|
return slot_config
|
||||||
|
|||||||
@@ -249,8 +249,8 @@ def test_gather_read_tags():
|
|||||||
|
|
||||||
|
|
||||||
def test_build_tag_config():
|
def test_build_tag_config():
|
||||||
tag = {'server_id': '1', 'server_name': 'test_server_name', 'tag_address': 'test_tag_address'}
|
tag = {'server_id': '1', 'server_name': 'test_server_name', 'tag_address': 'test_tag_address', 'frequency': 1000}
|
||||||
opc_servers = {'1': {'server_name': 'test_server_name', 'url': 'test_url', 'uri': 'test_uri'}}
|
opc_servers = {'1': {'server_name': 'test_server_name', 'url': 'test_url', 'uri': 'test_uri', 'subscription_period_ms': 1000}}
|
||||||
slot_config: dict = {'1': {}}
|
slot_config: dict = {'1': {}}
|
||||||
i = 1
|
i = 1
|
||||||
result = build_tag_config(tag, slot_config, opc_servers, i)
|
result = build_tag_config(tag, slot_config, opc_servers, i)
|
||||||
@@ -264,11 +264,13 @@ def test_build_tag_config():
|
|||||||
'cert_path': None,
|
'cert_path': None,
|
||||||
'private_key_path': None,
|
'private_key_path': None,
|
||||||
'server_cert_path': None,
|
'server_cert_path': None,
|
||||||
|
'subscription_period_ms': 500,
|
||||||
'tags': {
|
'tags': {
|
||||||
'test_tag_address': {
|
'test_tag_address': {
|
||||||
'server_id': '1',
|
'server_id': '1',
|
||||||
'server_name': 'test_server_name',
|
'server_name': 'test_server_name',
|
||||||
'tag_address': 'test_tag_address',
|
'tag_address': 'test_tag_address',
|
||||||
|
'frequency': 1000,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user