Commit f3ad1eb8 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Randomly send TC for selected inputs

parent a733a79e
......@@ -642,11 +642,9 @@ class sdlHandler(QObject):
def random_step(self):
''' One step of random simulation '''
if self.sim_param['state'] != 'random':
return
for name, asn1_ty in self.sim_param['periodic']:
def send_random_tc(name, asn1_ty=None):
if name not in self.active_tc:
continue
return
if name in self.buttons:
# paramless TC
self.buttons[name].click()
......@@ -658,6 +656,23 @@ class sdlHandler(QObject):
argpy = vn.fromValueNotationToPySide(name, arg)
vals['editor'].updateVariable(argpy)
vals['send_btn'].click()
if self.sim_param['state'] != 'random':
return
for name, asn1_ty in self.sim_param['periodic']:
send_random_tc(name, asn1_ty)
# Select randomly an active TC and call it
random_tc = random.choice(list(self.active_tc))
ty = None
for inp in self.proc.input_signals:
if inp['name'].lower() == random_tc.lower():
sort = inp.get('type', None)
if sort:
typename = sort.ReferencedTypeName.replace('-', '_')
ty = self.proc.dataview[sort.ReferencedTypeName]
break
send_random_tc(random_tc, ty)
QTimer().singleShot(1000, self.random_step)
def random_simulation(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment