| /** |
| * ******************************************************************************* |
| * Copyright (c) 2019 Robert Bosch GmbH and others. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Robert Bosch GmbH - initial API and implementation |
| * ******************************************************************************* |
| */ |
| |
| package templates.m2m.hw |
| |
| import com.inchron.realtime.root.model.TimeUnit |
| import org.eclipse.app4mc.amalthea.model.FrequencyDomain |
| import templates.AbstractAmaltheaInchronTransformer |
| import templates.m2m.utils.FrequencyTransformer |
| import com.google.inject.Inject |
| import com.google.inject.Singleton |
| |
| @Singleton |
| 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 |
| |
| } |
| |
| } |