CalculateEngineAndBrakes.emam 1.12 KB
Newer Older
Bernhard Rumpe's avatar
BR-sy    
Bernhard Rumpe committed
1
/* (c) https://github.com/MontiCore/monticore */
Jean-Marc Ronck's avatar
Jean-Marc Ronck committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package de.rwth.armin.modeling.autopilot.motion;

import de.rwth.armin.modeling.autopilot.common.*;

component CalculateEngineAndBrakes {
  port
    in Q currentVelocity,
    in Q desiredVelocity,
    out Q engine,
    out Q brakes;

  instance CalculatePidParameters pidParams;
  instance CalculatePidError pidError;
  instance Abs abs1;
  instance PID pid;
  instance DecideEngineOrBrakes engineOrBrakes;

  connect currentVelocity -> pidParams.currentVelocity;
  connect desiredVelocity -> pidParams.desiredVelocity;

  connect currentVelocity -> pidError.currentVelocity;
  connect desiredVelocity -> pidError.desiredVelocity;

  connect pidParams.paramP -> pid.paramP;
  connect pidParams.paramI -> pid.paramI;
  connect pidParams.paramD -> pid.paramD;
  connect pidParams.paramDecayCoefficient -> pid.paramDecayCoefficient;

  connect pidError.error -> abs1.input;
  connect abs1.output -> pid.error;

  connect pidError.error -> engineOrBrakes.error;
  connect pid.control -> engineOrBrakes.controlSignal;

  connect engineOrBrakes.engine -> engine;
  connect engineOrBrakes.brakes -> brakes;
}