Commit 738d4ec6 authored by Ievgen Strepkov's avatar Ievgen Strepkov
Browse files

Added the model for testing purposes

parent 6405b393
package montiarc;
import montiarc.atomic.*;
<<Type = "SubSystem">> component Constant_velocity {
port
in (0km/h : 250km/h) velocity,
in Double 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;
connect constant3.out1 -> steering;
connect switchBlock.out1 -> acceleration;
connect relationalOperator.out1 -> switchBlock.cond;
connect constant2.out1 -> switchBlock.in1;
connect constant1.out1 -> switchBlock.in3;
connect time -> relationalOperator.in1;
connect constant.out1 -> relationalOperator.in2;
}
package montiarc.atomic;
component Constant<T>(T value) {
port
out T out1;
}
\ No newline at end of file
package montiarc.atomic;
component Less<T> {
port
in T in1,
in T in2,
out Boolean out1;
}
\ No newline at end of file
package montiarc.atomic;
component SwitchB<T> {
port
in T in1,
in Boolean cond,
in T in3,
out T out1;
}
\ No newline at end of file
package visualization.basics;
component And {
port
in Boolean in1,
in Boolean in2,
out Boolean out1;
}
\ No newline at end of file
package visualization.basics;
component Constant<T>(T value) {
port
out T out1;
}
\ No newline at end of file
package visualization.basics;
component Equals<T> {
port
in T in1,
in T in2,
out Boolean out1;
}
\ No newline at end of file
package visualization.basics;
component Greater<T> {
port
in T in1,
in T in2,
out Boolean out1;
}
\ No newline at end of file
package visualization.basics;
component GreaterEquals<T> {
port
in T in1,
in T in2,
out Boolean out1;
}
\ No newline at end of file
package visualization.basics;
component Less<T> {
port
in T in1,
in T in2,
out Boolean out1;
}
\ No newline at end of file
package visualization.basics;
component Mod<T> {
port
in T in1,
in T in2,
out T out1;
}
\ No newline at end of file
package visualization.basics;
component Not<T> {
port
in T in1,
out T out1;
}
\ No newline at end of file
package visualization.basics;
component Or<T> {
port
in Boolean in1,
in Boolean in2,
out Boolean out1;
}
\ No newline at end of file
package visualization.basics;
component PlusMinus<T> {
port
in T in1,
in T in2,
out T out1;
}
\ No newline at end of file
package visualization.basics;
component Sum<T> {
port
in T in1,
in T in2,
out T out1;
}
\ No newline at end of file
package visualization.basics;
component SwitchB<T> {
port
in T in1, //if
in Boolean cond, // condition
in T in3, //else
out T out1;
}
\ No newline at end of file
package visualization.doors;
import visualization.basics.Constant;
import visualization.basics.Equals;
import visualization.basics.Less;
component DoorStatus {
port
in (0km/h : 250km/h) velocity,
out Boolean status;
instance Constant<Double>(0.1) idle;
instance Less<Double> less;
//if the velocity of the car is less than idle than doorStatus is true
connect velocity -> less.in1;
connect idle.out1 -> less.in2;
connect less.out1 -> status;
}
\ No newline at end of file
package visualization.feature;
import visualization.basics.Constant;
import visualization.basics.Greater;
import visualization.basics.Less;
import visualization.basics.Or;
component GameOverTrigger {
port
in N x,
in N y,
out Boolean status;
// The boundaries of the 3D world
instance Constant<Double>(-150) leftBoundary;
instance Constant<Double>(150) rightBoundary;
instance Constant<Double>(200) aboveBoundary;
instance Constant<Double>(-200) belowBoundary;
instance Greater<Double> greater1;
instance Greater<Double> greater2;
instance Less<Double> less1;
instance Less<Double> less2;
instance Or<Boolean> or1;
instance Or<Boolean> or2;
instance Or<Boolean> or3;
// if the car drives out of the world than the Trigger Status is true
connect x -> greater1.in1;
connect aboveBoundary.out1 -> greater1.in2;
connect x -> less1.in1;
connect belowBoundary.out1 -> less1.in2;
connect greater1.out1 -> or1.in1;
connect less1.out1 -> or1.in2;
connect y -> greater2.in1;
connect rightBoundary.out1 -> greater2.in2;
connect y -> less2.in1;
connect leftBoundary.out1 -> less2.in2;
connect greater2.out1 -> or2.in1;
connect less2.out1 -> or2.in2;
connect or1.out1 -> or3.in1;
connect or2.out1 -> or3.in2;
connect or3.out1 -> status;
}
\ No newline at end of file
package visualization.lights;
import visualization.basics.Constant;
import visualization.basics.Greater;
component BrakelightControl {
port
in Double time,
out Boolean status;
instance Constant<Double>(1.0) timeout;
instance Greater<Double> greater;
// Turn brake lights on after 1 second
connect time -> greater.in1;
connect timeout.out1 -> greater.in2;
connect greater.out1 -> status;
}
\ No newline at end of file
package visualization.lights;
import visualization.basics.Constant;
import visualization.basics.Mod;
import visualization.basics.Less;
component IndicatorStatus {
port
in Double time,
out Boolean status;
instance Constant<Double>(2.0) divisor;
instance Constant<Double>(1.0) condition;
instance Mod<Double> mod;
instance Less<Double> less;
connect time -> mod.in1;
connect divisor.out1 -> mod.in2;
connect mod.out1 -> less.in1;
connect condition.out1 -> less.in2;
connect less.out1 -> status;
}
\ 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