Cruise Control System

1 - System and Interacting System - System Object Model

System Requirements Statement - Cruise Control System
The Cruise Control Control System shall maintain a desired speed when engaged.  It shall receive control commands (on, set, compare, resume, brake, and off) from cruise control HW (Timer, Driver Buttons, and Brake Sensor).  It shall get the current speed from cruise control HW (Speedometer).  It shall send a throttle setting (released, increasing, no_change, decreasing) to cruise control HW (Throttle).




System Drawing - Cruise Control System


System Block Diagram (Inputs and Outputs) - Cruise Control System


System Diagram (OMT Notation) - Cruise Control System


System Table - Cruise Control System

System Name Attribute NamesSystem Operation Names
CruiseControlHWgetSpeed setThrottle releaseThrottle
CruiseControlSystemcurrentSpeed desiredSpeed throttleSetting on setDesiredSpeed compare brake resume off

System Specification Report - Cruise Control System

System Name: Cruise Control System

System Access: Public

System Imports: NA

Enclosing System: NA

System Description: The Cruise Control System controls an automotive throttle.

Data Dictionary - Cruise Control System

Entity Name Type of EntityEnclosing System
CruiseControlSystemSystem --
CruiseControlHWInteracting System --
currentSpeedSystem Attribute CruiseControlSystem
desiredSpeedSystem Attribute CruiseControlSystem
throttleSettingSystem Attribute CruiseControlSystem
getSpeedSystem Operation CruiseControlHW
setThrottleSystem Operation CruiseControlHW
releaseThrottleSystem Operation CruiseControlHW
onSystem OperationCruiseControlSystem
setDesiredSpeedSystem Operation CruiseControlSystem
compareSystem Operation CruiseControlSystem
brakeSystem Operation CruiseControlSystem
resumeSystem Operation CruiseControlSystem
offSystem Operation CruiseControlSystem

2 - System Input and Output Events - System Dynamic Model

System Use Case Diagram - Cruise Control System


NumberInitiating Actor Use Case/Subuse CaseUse Case Description
1UserOperate Cruise Control This use case has 6 sub-use cases
1.1UserTurn Cruise Control On Input Event on
1.2UserSet Desired Speed Input Event setDesiredSpeed - Output Event getSpeed
1.3UserCompare Desired and Current Speed Input Event compare - Output Events getSpeed setThrottle
1.4UserBrake and Release Cruise Control Input Event brake Output Event releaseThrottle
1.5UserResume Cruise Control Input Event resume
1.6UserTurn Cruise Control Off Input Event off Output Event releaseThrottle

System Interaction Diagram - Cruise Control System


System Interaction Scenario - Cruise Control System

Operate Cruise Control Use Case

Sequence

Number

Sender SystemReceiver System Invoked OperationDescription
1Cruise Control HWCruise Control System onInput Event
2Cruise Control HWCruise Control System setDesiredSpeedInput Event
3Cruise Control System Cruise Control HWgetSpeed Output Event
4Cruise Control HWCruise Control System compareInput Event
5Cruise Control System Cruise Control HWgetSpeed Output Event
6Cruise Control System Cruise Control HWsetThrottle Output Event
7Cruise Control HWCruise Control System brakeInput Event
8Cruise Control System Cruise Control HWreleaseThrottle Output Event
9Cruise Control HWCruise Control System resumeInput Event
10Cruise Control HWCruise Control System offInput Event
11Cruise Control System Cruise Control HWreleaseThrottle Output Event

System State Diagram - Cruise Control System


System State Transition Table - Cruise Control System

State NameEvent Name Transition ConditionTransition Action Transition Next State
OffStateon() ReadyState
OffStateoff() TerminalState
ReadyStatesetDesiredSpeed() getSpeedControllingState
ReadyStateoff() releaseThrottleTerminalState
ControllingStateoff() releaseThrottleTerminalState
ControllingStatecompare() getSpeed setThrottle ControllingState
ControllingStatebrake() releaseThrottleSuspendedState
SuspendedStateresume() ControllingState
SuspendedStateoff() releaseThrottleTerminalState

Creams (return aNumber) Returns number of creams

3 - System Operations - System Functional Model

System Operation Table - Cruise Control System

System Name System Operation NameInput Parameters TransformationReturn Type
CruiseControlSystemon void
CruiseControlSystemsetDesiredSpeed desiredSpeed = currentSpeed void
CruiseControlSystemcompare if (currentSpeed < desiredSpeed) throttleSetting = increasing;

if (currentSpeed == desiredSpeed) throttleSetting = no_change;

if (currentSpeed > desiredSpeed) throttleSetting = decreasing;

void
CruiseControlSystembrake throttleSetting = released void
CruiseControlSystemresume void
CruiseControlSystemoff throttleSetting = released void

4 - Classes and Relationships - Object Model

Class Diagram - Cruise Control System


Class Table - Cruise Control System

Class NameAttribute Names Relationship Traversal Path Names Operation Names
HWInterfaceResponses getSpeed setThrottle releaseThrottle
Throttlesetting getThrottleSetting
SpeeddesiredSpeed currentSpeed speedComparison setCurrentSpeed setDesiredSpeed currentSpeedComparison
CruiseControlstate theHWInterface theThrottle theSpeed on setDesiredSpeed compare brake resume off
HWInterfaceEventstheCruiseControl on setDesiredSpeed compare brake resume off

Data Dictionary - Cruise Control System

Entity Name Type of EntityEnclosing Class
HWInterfaceResponsesClass --
ThrottleClass--
SpeedClass--
CruiseControlClass--
HWInterfaceEventsClass --
settingAttributeThrottle
desiredSpeedAttribute Speed
currentSpeedAttribute Speed
speedComparisonAttribute Speed
stateAttributeCruiseControl
getSpeedOperationHWInterfaceResponses
setThrottleOperation HWInterfaceResponses
releaseThrottleOperation HWInterfaceResponses
getThrottleSettingOperation Throttle
setCurrentSpeedOperation Speed
setDesiredSpeedOperation Speed
currentSpeedComparisonOperation Speed
onOperationCruiseControl
setDesiredSpeedOperation CruiseControl
compareOperationCruiseControl
brakeOperationCruiseControl
resumeOperationCruiseControl
offOperationCruiseControl
onOperationHWInterfaceEvents
setDesiredSpeedOperation HWInterfaceEvents
compareOperationHWInterfaceEvents
brakeOperationHWInterfaceEvents
resumeOperationHWInterfaceEvents
offOperationHWInterfaceEvents
theHWInterfaceTraversal Path for 1:1 Aggregation CruiseControl
theThrottleTraversal Path for 1:1 Aggregation CruiseControl
theSpeedTraversal Path for 1:1 Aggregation CruiseControl
theCruiseControlTraversal Path for 1:1 Aggregation HWInterfaceEvents

5 - Objects and Messages - Dynamic Model

Object Interaction Diagram - Operate Cruise Control Use Case


Object Interaction Scenario - Operate Cruise Control Use Case

Sequence #Sender System/Object Receiver System/ObjectInvoked Operation Description
0Cruise Control HWtheHWInterfaceEvents onInput Event
1theHWInterfaceEvents theCruiseControlonMessage
2Cruise Control HWtheHWInterfaceEvents setDesiredSpeedInput Event
3theHWInterfaceEvents theCruiseControlsetDesiredSpeed Message
4theCruiseControltheHWInterfaceResponse getSpeedMessage
5theHWInterfaceResponse Cruise Control HWgetSpeed Output Event
6theCruiseControltheSpeed setDesiredSpeedMessage
7Cruise Control HWtheHWInterfaceEvents compareInput Event
8theHWInterfaceEvents theCruiseControlcompare Message
9theCruiseControltheHWInterfaceResponse getSpeedMessage
10theHWInterfaceResponse Cruise Control HWgetSpeed Output Event
11theCruiseControltheSpeed setDesiredSpeedMessage
12theCruiseControltheSpeed getSpeedComparisonMessage
13theCruiseControltheThrottle getThrottleSettingMessage
14theCruiseControltheHWInterfaceResponse setThrottleMessage
15theHWInterfaceResponse Cruise Control HWsetThrottle Output Event
16Cruise Control HWtheHWInterfaceEvents brakeInput Event
17theHWInterfaceEvents theCruiseControlbrakeMessage
18theCruiseControltheHWInterfaceResponse releaseThrottleMessage
19theHWInterfaceResponse Cruise Control HWreleaseThrottle Output Event
20Cruise Control HWtheHWInterfaceEvents offInput Event
21theHWInterfaceEvents theCruiseControloffMessage
22theCruiseControltheHWInterfaceResponse releaseThrottleMessage
23theHWInterfaceResponse Cruise Control HWreleaseThrottle Output Event

State Diagram for CruiseControl Class - Operate Cruise Control Use Case


State Transition Table for CruiseControl Class - Operate Cruise Control Use Case

State NameEvent Name Transition ConditionTransition Action Transition Next State
OffStateon() ReadyState
OffStateoff() TerminalState
ReadyStatesetDesiredSpeed() theHWInterface.getSpeed theSpeed.setDesiredSpeed ControllingState ReadyState
ControllingStateoff() theHWInterface.releaseThrottle TerminalState
ControllingStatecompare() theHWInterface.getSpeed theSpeed.setCurrentSpeed theSpeed.currentSpeedComparison theThrottle.getThrottleSetting theHWInterface.setThrottle ControllingState
ControllingStatebrake() theHWInterface.releaseThrottle SuspendedState
SuspendedStateoff() theHWInterface.releaseThrottle TerminalState
SuspendedStateresume() ControllingState

6 - Transformations and Correctness Assertions - Functional Model

Class NameOperation Name Input ParametersTransformation Return Type
CruiseControlon void
CruiseControlsetDesiredSpeed void
CruiseControlcompare void
CruiseControlbrake void
CruiseControlresume void
CruiseControloff void
HWInterfaceEventson void
HWInterfaceEventssetDesiredSpeed void
HWInterfaceEventscompare void
HWInterfaceEventsbrake void
HWInterfaceEventsresume void
HWInterfaceEventsoff void
HWInterfaceResponsesgetSpeed int
HWInterfaceResponsessetThrottle ThrottleSetting setting void
HWInterfaceResponsesreleaseThrottle void
SpeedsetCurrentSpeed int aSpeedcurrentSpeed = aSpeed; void
SpeedsetDesiredSpeed int aSpeeddesiredSpeed = aSpeed; void
SpeedcurrentSpeedComparison if (currentSpeed < desiredSpeed)

speedComparison = too_slow;

if (currentSpeed > desiredSpeed)

speedComparison = too_fast;

if (currentSpeed == desiredSpeed)

speedComparison = ok;

SpeedComparison
ThrottlegetThrottleSetting SpeedComparison speed_comparisonswitch (speed_comparison)

{ case too_slow : setting = increasing; break;

case ok : setting = no_change; break;

case too_fast : setting = decreasing; break;

default: cout << "\nUnknown speed comparison - try again";

}

return setting;

ThrottleSetting

C++ Source Code - Cruise Control System

(Generated code and main combined into a single file. State code modified to combine OffState and TerminationState into the OffState.)

//Cruise Control Application Prototype file cruise.cpp

//Single file C++ prototype for educational purposes

#include <stdio.h>

#include <iostream.h>

enum SpeedComparison {too_slow,ok,too_fast};

enum States {off_state,ready,controlling,suspended};

enum ThrottleSetting

{released,increasing,no_change,decreasing};

//-----------------------------------------------------------

class HWInterfaceResponses {

public:

HWInterfaceResponses () { }

int getSpeed () const ;

void setThrottle (ThrottleSetting setting);

void releaseThrottle ();

};

int HWInterfaceResponses::getSpeed () const

{ int currentSpeed; cout << "\nEnter the current speed ";

cin >> currentSpeed; return currentSpeed;}

void HWInterfaceResponses::setThrottle (ThrottleSetting setting)

{ cout << "The throttle setting is " << setting;

cout << "\n0 - released, 1 - increasing, 2 - no_change, 3 -decreasing";}

void HWInterfaceResponses::releaseThrottle ()

{ cout << "\nThe throttle is released\n";}

class Throttle {

private:

ThrottleSetting setting;

public:

Throttle();

ThrottleSetting getThrottleSetting (SpeedComparison speed_comparison);

};

Throttle::Throttle() { setting = released; }

ThrottleSetting Throttle::getThrottleSetting (SpeedComparison speed_comparison)

{ switch (speed_comparison)

{ case too_slow : setting = increasing; break;

case ok : setting = no_change; break;

case too_fast : setting = decreasing; break;

default: cout << "\nUnknown speed comparison - try again";

}

cout << "\nThrottle adjustment - current speed is " << speed_comparison;

cout << "\n0 - too slow, 1 - ok, 2 - too fast\n";

return setting;

}

//---------------------------------------------------------------

class Speed {

private:

int desiredSpeed;

int currentSpeed;

SpeedComparison speedComparison;

public:

Speed();

void setCurrentSpeed (int aSpeed);

void setDesiredSpeed(int aSpeed);

SpeedComparison currentSpeedComparison();

};

Speed::Speed()

{ desiredSpeed = 0; currentSpeed = 0; speedComparison = ok;

}

void Speed::setCurrentSpeed(int aSpeed)

{ currentSpeed = aSpeed; }

SpeedComparison Speed::currentSpeedComparison ()

{ if (currentSpeed < desiredSpeed)

speedComparison = too_slow;

if (currentSpeed > desiredSpeed)

speedComparison = too_fast;

if (currentSpeed == desiredSpeed)

speedComparison = ok;

return (speedComparison);

}

void Speed::setDesiredSpeed (int aSpeed)

{ desiredSpeed = aSpeed;

}

//---------------------------------------------------------------

class CruiseControl {

private:

HWInterfaceResponses theHWInterface;

States state;

Throttle theThrottle; //object theThrottle

Speed theSpeed; //object theSpeed

public:

CruiseControl ();

void on ();

void setDesiredSpeed ();

void compare ();

void brake ();

void resume ();

void off ();

};

CruiseControl::CruiseControl()

{ state=off_state;

}

void CruiseControl::on ()

{ cout <<"\nDriver pressed the on button";

switch (state)

{ case off_state:

state = ready; break;

default: cout <<"\nCannot respond to the command - try again";

}

}

void CruiseControl::setDesiredSpeed ()

{ cout <<"\nDriver pressed the set desired speed button";

switch (state)

{ case ready || controlling || suspended:

int aSpeed = theHWInterface.getSpeed();

theSpeed.setDesiredSpeed (aSpeed);

cout << "\nDesired Speed is " << aSpeed;

state = controlling; break;

default: cout <<"\nCannot respond to the command - try again";

}

}

void CruiseControl::compare ()

{ SpeedComparison aSpeedComparison;

cout <<"\nTimer sent compare command";

switch (state)

{case controlling:

int aSpeed = theHWInterface.getSpeed();

theSpeed.setCurrentSpeed (aSpeed);

cout << "The current speed is " << aSpeed;

aSpeedComparison = theSpeed.currentSpeedComparison();

ThrottleSetting aSetting = theThrottle.getThrottleSetting

(aSpeedComparison);

theHWInterface.setThrottle (aSetting);

state = controlling; break;

default: cout <<"\nCannot respond to the command - try again";

}

}

void CruiseControl::brake ()

{ cout <<"\nDriver pressed the brake";

switch (state)

{ case controlling:

theHWInterface.releaseThrottle();

state = suspended; break;

default: cout <<"\nCannot respond to the command - try again";

}

}

void CruiseControl::resume ()

{ cout <<"\nDriver pressed the resume button";

switch (state)

{ case suspended:

state = controlling; break;

default: cout <<"\nCannot respond to the command - try again";

}

}

void CruiseControl::off ()

{ cout <<"\nDriver pressed the off button.";

theHWInterface.releaseThrottle();

cout << "\nThe Cruise Control is OFF";

state = off_state;

}

//---------------------------------------------------------------

class HWInterfaceEvents {

CruiseControl theCruiseControl;

public:

void on ();

void setDesiredSpeed ();

void compare ();

void brake ();

void resume ();

void off ();

};

void HWInterfaceEvents::on () {theCruiseControl.on ();};

void HWInterfaceEvents::setDesiredSpeed ()

{theCruiseControl.setDesiredSpeed ();}

void HWInterfaceEvents::compare ()

{theCruiseControl.compare ();}

void HWInterfaceEvents::brake ()

{ theCruiseControl.brake ();}

void HWInterfaceEvents::resume ()

{theCruiseControl.resume ();}

void HWInterfaceEvents::off () {theCruiseControl.off ();}

//---------------------------------------------------------------------

int main ()

{ HWInterfaceEvents theHWInterfaceEvents;

theHWInterfaceEvents.on(); //an Event

theHWInterfaceEvents.setDesiredSpeed(); //an Event

theHWInterfaceEvents.compare(); //an Event

theHWInterfaceEvents.brake(); //an Event

theHWInterfaceEvents.resume (); //an Event

theHWInterfaceEvents.off(); //an Event

return 0;

}

//-----------------------Sample Output----------------------------------

/*Driver pressed the on button

Driver pressed the set desired speed button

Enter the current speed: 55

Timer sent compare command

Enter the current speed: 66

Throttle adjustment - current speed is: 2

0 - too slow, 1 - ok, 2 - too fast

The throttle setting is 3.

0 - released, 1 - increasing, 2 - no_change, 3 -decreasing

Driver pressed the brake

The throttle is released

Driver pressed the resume button

Driver pressed the off button

The throttle is released

The Cruise Control is OFF

*/

buy cialis cialisfunsurforg cialisfunsurforg onlinehtml site cialis and back pain cialis levitra vs combine viagra and cialis allowed black buy casino cialis diet gambling health jack phentermine poker tag viagra xhtml canada over the counter cialis viagra cialis generic viagra cialis viagra levitra prices women take cialis drug buy cialis tadalafil cialis drinking alcohol cialis online usa levitra vs cialis vs viagra brand name cialis cheapest soft cialis cialis get viagra cialis viagra taking cialis with viagra buy cialis where cialis drugs cialis over dose lowest price generic cialis buy cialis generic ciales web site marketing cialis interaction precautions cialis western open add cialis link new buying generic cialis cialis free cialis suggest url valium detox buy cialis pharmacy cialis experience cialis pills online cialis buy cialis dream pharmaceutical cialis and oral sex cialis lawyer columbus compare viagra cialis levitra viagra cialis levitra buy cialis shop tadalafil cialis fast heart rate cialis online pharmacy online pharmacy cialis seychelles buy cialis ebay find tadalafil cheap cialis cialis injury attorney cincinnati cialis uk similar drugs for cialis buy cialis online submit=buy cialis online cialis dose it work cialis no prescription needed generic cialis muncie indiana buy cialis genericf hostingcom link cialis cheap no prescription cialis injury attorney cleveland cialis versus viagra 20mg cialis canada cialis deals cialis forum cialis free consultation cialis sample price viagra cialis levitra buy cialis link onlineinttc cialis class action lawsuit cialis levitra combine cialis and levitra viagra allowed black buy casino cialis diet gambling jack low online order phentermine poker tag viagra xhtml can cialis and viagra be taken together cialis free sample coupon cialis soft tab online consultation purchase cialis buy cialis online us cialis commercial cialis line differences viagra cialis levitra allowed black casino cialis diet gambling health jack phentermine poker tag viagra xhtml can i get cialis in canada cialis free samples cialis samples sale without prescription cialis in detroit area buy cialis cialis drug prescription cialis on second attempt generic viagra cialis levitra best cialis price canadian perscription of cialis cialis free trial cialis site suggest samples of viagra cialis levitra buy cialis now cialis cheap cialis injury lawyer ohio cialis viagra vs valium buying online buy discount cialis cialis effects side cialis online discount cialis soft allowed black buy casino cialis diet gambling jack online order phentermine poker tag viagra xhtml by cialis comment post posted cialis for sale on line cialis prescription las posas de ciales buy canada cialis cheap generic cialis cialis generic price cialis soft tab prescription cialis on line buy cialis online viagra cialis compare levitra cialis link online suggest discount generic cialis . buy tadalafil cialis cialis for sale cialis open western lowest cialis levitra prices buy cialis dosage effects online side warning cheap cialis generic cialis free sample cialis soft tab online consultation usa side effects of cialis buy cialis link suggest cialis attorney columbus cialis information pamphlet cialis stories viagra cialis generica buy cialis viagra cialis compared to viagra cialis new viagra dangers of taking cialis allowed cialis tag viagra xhtml canada cialis cialis for woman cialis overnight hypertension treatment using cialis buy cheap cialis canadian cialis cialis for women cialis price order cialis submit=order cialis buy cialis in the uk cheapest cialis generic cialis generic cialis sale review cialis levitra viagra buy cialis link onlinenew pharminfo cialis and liver disease cialis how to avoid backache cialis soft tabs penis pump plus cialis buy cialis online cialis comparison levitra viagra cialis icos lily online cialis tadalafil swflash 1.cab buy cialis online dreampharmaceuticals cialis co drug eli impotence lilly cialis julilatiwaveprohostingcom link onlinehtml cialis samples submit=cialis samples mixing cialis and viagra buy cialis without prescription cheap cialis submit=cheap cialis cialis female view cialis review lawsuits involving blindness caused by cialis buy cialis generic online canada cialis line cialis female opinion cialis online submit=cialis online generic cialis submit=generic cialis buy cialis link onlinenettc can you mix cialis and viagra cialis fda approval cialis online buy generic cialis 20 mg best price cialis buy viagra cialis levitra cialis erectile dysfunction cialis official website erection does not go down after taking cialis black casino cialis diet followup gambling health jack phentermine poker post viagra cialis 20mg cialis generic link suggest cialis woman sitemap2 add cialis link buy generic cialis cialis dosage cialis melt packs buy generic cialis online