diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-08-14 15:03:28 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-08-14 15:03:28 +0200 |
commit | 830705b59483181eb5577173318c2df6255518af (patch) | |
tree | a20713527b61c213163ef3a325434a8d80b46f21 /lib/automata.py | |
parent | 680e7498a128c752e6eb43156ee990807c042769 (diff) |
add support for a posteriori parameters (e.g. TX success / retry count)
Diffstat (limited to 'lib/automata.py')
-rwxr-xr-x | lib/automata.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/automata.py b/lib/automata.py index de40eb4..d26c0bc 100755 --- a/lib/automata.py +++ b/lib/automata.py @@ -185,6 +185,10 @@ class Transition: self.set_param = set_param self.return_value_handlers = return_value_handlers + for handler in self.return_value_handlers: + if 'formula' in handler: + handler['formula'] = NormalizationFunction(handler['formula']) + def get_duration(self, param_dict: dict = {}, args: list = []) -> float: u""" Return transition duration in µs. @@ -310,6 +314,11 @@ class PTA: if not 'UNINITIALIZED' in state_names: self.state['UNINITIALIZED'] = State('UNINITIALIZED') + if self.parameter_normalization: + for normalization_spec in self.parameter_normalization.values(): + if 'formula' in normalization_spec: + normalization_spec['formula'] = NormalizationFunction(normalization_spec['formula']) + def normalize_parameters(self, param_dict): if self.parameter_normalization is None: return param_dict.copy() @@ -319,7 +328,7 @@ class PTA: if 'enum' in self.parameter_normalization[parameter] and value in self.parameter_normalization[parameter]['enum']: normalized_param[parameter] = self.parameter_normalization[parameter]['enum'][value] if 'formula' in self.parameter_normalization[parameter]: - normalization_formula = NormalizationFunction(self.parameter_normalization[parameter]['formula']) + normalization_formula = self.parameter_normalization[parameter]['formula'] normalized_param[parameter] = normalization_formula.eval(value) return normalized_param |