Commit ec5e82fe authored by Pierre Haessig's avatar Pierre Haessig

Add standalone test subpackage

parent b568e158
Pipeline #6664 canceled with stages
within CarProject.Tests;
model TestController "Standalone test for the speed controller"
extends Modelica.Icons.Example;
CarProject.Components.Controller controller1 annotation(
Placement(visible = true, transformation(origin = {-10, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Continuous.Integrator integrator1(k = 1e-3, y(fixed = true)) annotation(
Placement(visible = true, transformation(origin = {50, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Pulse pulse1(amplitude = 10, offset = 40, period = 200) annotation(
Placement(visible = true, transformation(origin = {-90, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(pulse1.y, controller1.v_sp) annotation(
Line(points = {{-79, 30}, {-40, 30}, {-40, 14}, {-22, 14}}, color = {0, 0, 127}));
connect(integrator1.y, controller1.v) annotation(
Line(points = {{62, 10}, {80, 10}, {80, -20}, {-40, -20}, {-40, 6}, {-22, 6}}, color = {0, 0, 127}));
connect(controller1.f, integrator1.u) annotation(
Line(points = {{2, 10}, {36, 10}, {36, 10}, {38, 10}}, color = {0, 0, 127}));
annotation(
experiment(StopTime=300),
Diagram(graphics = {Text(origin = {-45, 54}, extent = {{-35, 6}, {45, -14}}, textString = "Controller\nunder test"), Text(origin = {39, 53}, extent = {{-45, 7}, {61, -13}}, textString = "Dummy model\nof car's inertia")}, coordinateSystem(initialScale = 0.1)));
end TestController;
\ No newline at end of file
within CarProject;
package Tests "Tests for some components"
extends Modelica.Icons.ExamplesPackage;
end Tests;
\ No newline at end of file
......@@ -4,3 +4,4 @@ Road
Air
Components
Interfaces
Tests
......@@ -2,15 +2,18 @@
The CarProject is a minimal simulation of car on a road, with a speed control.
Author: Pierre Haessig
The code is organized in the `CarProject` package which contains:
* the simulation model `CarTest`
* the main components of the simulation : `Car`, `Road` and `Air`
* a subpackage `Components` for the subcomponents of the car: `Engine` and `Controller`
* a subpackage `Interfaces` for Connectors and partial classes,
for illustration purpose only since it is empty.
for illustration purpose only since it is empty
* a subpackage `Tests` for standalone testing of some complex components
like `TestController`
Author: Pierre Haessig
## Design principles
......
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