"""
============
ads_template
============
ads_template model template The System Development Kit
Used as a template for all TheSyDeKick Entities.
Current docstring documentation style is Numpy
https://numpydoc.readthedocs.io/en/latest/format.html
This text here is to remind you that documentation is important.
However, youu may find it out the even the documentation of this
entity may be outdated and incomplete. Regardless of that, every day
and in every way we are getting better and better :).
Initially written by Marko Kosunen, marko.kosunen@aalto.fi, 2017.
"""
import os
import sys
if not (os.path.abspath('../../thesdk') in sys.path):
sys.path.append(os.path.abspath('../../thesdk'))
from thesdk import *
from ads import *
[docs]
class ads_template(ads, thesdk):
@property
def _classfile(self):
return os.path.dirname(os.path.realpath(__file__)) + "/"+__name__
def __init__(self,*arg):
#SyDeKick
self.print_log(type='I', msg='Inititalizing %s' %(__name__))
self.proplist = [ 'Rs' ]; # Properties that can be propagated from parent
self.Rs = 100e6; # Sampling frequency
self.IOS=Bundle() # Pointer for input data
self.IOS.Members['A']=IO() # Pointer for input data
self.IOS.Members['Z']= IO()
self.model='ads'; # Can be set externally, but is not propagated
self.par= False # By default, no parallel processing
self.queue= [] # By default, no parallel processing
if len(arg)>=1:
parent=arg[0]
self.copy_propval(parent,self.proplist)
self.parent =parent;
[docs]
def init(self):
pass #Currently nohing to add
[docs]
def main(self):
'''Guideline. Isolate python processing to main method.
To isolate the interna processing from IO connection assigments,
The procedure to follow is
1) Assign input data from input to local variable
2) Do the processing
3) Assign local variable to output
'''
pass
[docs]
def run(self,*arg):
'''Guideline: Define model depencies of executions in `run` method.
'''
if len(arg)>0:
self.par=True #flag for parallel processing
self.queue=arg[0] #multiprocessing.queue as the first argument
if self.model=='py':
self.main()
elif self.model == 'ads':
self.configure_ads()