| package templates.m2m.hw |
| |
| import com.inchron.realtime.root.model.TimeUnit |
| import javax.inject.Inject |
| import org.eclipse.app4mc.amalthea.model.FrequencyDomain |
| import templates.AbstractAmaltheaInchronTransformer |
| import templates.m2m.utils.FrequencyTransformer |
| import templates.utils.AmltCacheModel |
| |
| class FrequencyDomainTransformer extends AbstractAmaltheaInchronTransformer { |
| |
| @Inject FrequencyTransformer frequencyTransformer |
| |
| def create inchronModelFactory.createClock createClock(FrequencyDomain amltFrequencyDomain) { |
| |
| it.name = amltFrequencyDomain.name |
| |
| var amltFrequency = amltFrequencyDomain.defaultValue |
| |
| if (amltFrequency !== null) { |
| it.frequency = frequencyTransformer.createFrequency(amltFrequency) |
| |
| // var amltFrequeny_Hz=AmaltheaServices.convertToHertz(amltFrequency) |
| // var amltTime=amaltheaFactory.createTime |
| // var BigDecimal result=BigDecimal.TEN.pow(12).divide(amltFrequeny_Hz) |
| // |
| // amltTime.value = result.toBigInteger |
| // amltTime.unit=TimeUnit.PS |
| } |
| |
| // TODO: This is only temporary. In future this will be a default value in Inchron model |
| var range = inchronModelFactory.createTime |
| range.unit = TimeUnit.S |
| range.value = 1 |
| it.range = range |
| |
| it.startTimeFixed = inchronModelFactory.createTime |
| it.startTimeMin = inchronModelFactory.createTime |
| it.startTimeMax = inchronModelFactory.createTime |
| it.startValue = inchronModelFactory.createTime |
| |
| // Caching model element |
| val AmltCacheModel cacheModel = customObjsStore.getInstance(AmltCacheModel) |
| cacheModel.addInchronClock(it) |
| } |
| |
| } |