diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-12-10 08:22:32 +0100 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-12-10 08:22:32 +0100 |
commit | 3d817963b3f76211714f421f6d94445ac3e32e57 (patch) | |
tree | 972baa76d2c9dfeaeed1bd61c8c13fb720379a27 /lib/automata.py | |
parent | d285be422c90851019a31bfe6c28aed3f3eb55fb (diff) |
make analyze-archive --export work without --hwmodel
Diffstat (limited to 'lib/automata.py')
-rwxr-xr-x | lib/automata.py | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/lib/automata.py b/lib/automata.py index 2c21389..d36acd7 100755 --- a/lib/automata.py +++ b/lib/automata.py @@ -914,17 +914,25 @@ class PTA: def update(self, static_model, param_model): for state in self.state.values(): if state.name != 'UNINITIALIZED': - state.power = static_model(state.name, 'power') - if param_model(state.name, 'power'): - state.power_function = param_model(state.name, 'power')['function'] + try: + state.power = static_model(state.name, 'power') + if param_model(state.name, 'power'): + state.power_function = param_model(state.name, 'power')['function'] + except KeyError: + print('[W] skipping model update of state {} due to missing data'.format(state.name)) + pass for transition in self.transitions: - transition.duration = static_model(transition.name, 'duration') - if param_model(transition.name, 'duration'): - transition.duration_function = param_model(transition.name, 'duration')['function'] - transition.energy = static_model(transition.name, 'energy') - if param_model(transition.name, 'energy'): - transition.energy_function = param_model(transition.name, 'energy')['function'] - if transition.is_interrupt: - transition.timeout = static_model(transition.name, 'timeout') - if param_model(transition.name, 'timeout'): - transition.timeout_function = param_model(transition.name, 'timeout')['function'] + try: + transition.duration = static_model(transition.name, 'duration') + if param_model(transition.name, 'duration'): + transition.duration_function = param_model(transition.name, 'duration')['function'] + transition.energy = static_model(transition.name, 'energy') + if param_model(transition.name, 'energy'): + transition.energy_function = param_model(transition.name, 'energy')['function'] + if transition.is_interrupt: + transition.timeout = static_model(transition.name, 'timeout') + if param_model(transition.name, 'timeout'): + transition.timeout_function = param_model(transition.name, 'timeout')['function'] + except KeyError: + print('[W] skipping model update of transition {} due to missing data'.format(state.name)) + pass
\ No newline at end of file |