Aufgrund einer Wartung wird GitLab am 18.01. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 18.01. between 8:00 and 9:00 am.

Commit d73fc35b authored by Sascha Niklas Schneiders's avatar Sascha Niklas Schneiders
Browse files

improved model and updated test method

parent 03f66082
package de.monticore.lang.monticar.generator;
import de.monticore.lang.monticar.generator.order.simulator.AbstractSymtab;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import org.junit.Assert;
import org.junit.Test;
import java.nio.file.*;
......@@ -7,16 +9,13 @@ import de.monticore.lang.monticar.generator.cpp.resolver.ResolverFactory;
import de.monticore.lang.monticar.generator.cpp.resolver.Resolver;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
public class SimulatorTSTest {
public class SimulatorTSTest extends AbstractSymtab{
@Test
public void resolveModel() {
Path modelPath = Paths.get("src/test/resources/simulator-ts");
ResolverFactory resolverFactory = new ResolverFactory(modelPath);
Resolver resolver = resolverFactory.get();
TaggingResolver symtab = createSymTabAndTaggingResolver("src/test/resources/simulator-ts");
ExpandedComponentInstanceSymbol instanceSymbol =
resolver.getExpandedComponentInstanceSymbol("montiarc.Constant_velocity").orElse(null);
symtab.<ExpandedComponentInstanceSymbol>resolve("montiarc.constant_velocity",ExpandedComponentInstanceSymbol.KIND).orElse(null);
Assert.assertNotNull(instanceSymbol);
}
......
......@@ -5,23 +5,19 @@ import montiarc.atomic.*;
component Constant_velocity {
port
in (0km/h : 250km/h) velocity,
in Double time,
in (-oo:oo) time,
out (-2m/s^2:2m/s^2) acceleration,
out (-180°:180°) steering;
instance Constant<Double>(1) constant;
instance Constant<Double>(0) constant1;
instance Constant<Double>(2) constant2;
instance Constant<Double>(0) constant3;
instance Less<Double> relationalOperator;
instance SwitchB<Double> switchBlock;
instance Less<N1> relationalOperator;
instance SwitchB<N1> switchBlock;
connect constant3.out1 -> steering;
connect 0 /*Constant3*/-> steering;
connect switchBlock.out1 -> acceleration;
connect relationalOperator.out1 -> switchBlock.cond;
connect constant2.out1 -> switchBlock.in1;
connect constant1.out1 -> switchBlock.in3;
connect 2/*Constant2*/ -> switchBlock.in1;
connect 0/*Constant1*/ -> switchBlock.in3;
connect time -> relationalOperator.in1;
connect constant.out1 -> relationalOperator.in2;
connect 1/*Constant*/ -> relationalOperator.in2;
}
package montiarc.atomic;
component Constant<T>(T value) {
port
out T out1;
}
\ No newline at end of file
......@@ -4,5 +4,15 @@ component Less<T> {
port
in T in1,
in T in2,
out Boolean out1;
out B out1;
implementation Math{
if in1 < in2{
out1 = true;
}
else{
out1 = false;
}
end
}
}
\ No newline at end of file
......@@ -3,7 +3,17 @@ package montiarc.atomic;
component SwitchB<T> {
port
in T in1,
in Boolean cond,
in B cond,
in T in3,
out T out1;
implementation Math{
if cond{
out1 = in1;
}
else {
out1 = in2;
}
end
}
}
\ No newline at end of file
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