多路电梯的电梯系统算法

beyond2002171 2003-11-25 09:22:05
最近来了一个活是多路电梯的电梯模拟系统,由于经验不足感到无从下手,希望得到高人的指点,深表感谢!
...全文
108 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2003-12-03
  • 打赏
  • 举报
回复
文件还在

用ftp://ann:ann@202.38.79.191访问后
进入子目录

新文件夹 (30)/
h2plus0 2003-12-03
  • 打赏
  • 举报
回复
谢谢了, 原来在
ftp://202.38.79.191/NeuralNetwork/新文件夹%20(30)/lift.zip
以后好好研究以下!
h2plus0 2003-12-02
  • 打赏
  • 举报
回复

Hi Raceman35(伏地魔),
ftp://ann:ann@202.38.79.191 上文件被删掉了
不知能否发给我一份, 谢谢! chenzero@netease.com



「已注销」 2003-12-01
  • 打赏
  • 举报
回复
刚才的FTP仅仅借了十分钟就被踢出去了

又找了一个地方,冒充学生作业

ftp://ann:ann@202.38.79.191/%D0%C2%CE%C4%BC%FE%BC%D0%20(30)/

也就是:

ftp://ann:ann@202.38.79.191/新文件夹(30)/

只有一个文件:Lift.zip
「已注销」 2003-12-01
  • 打赏
  • 举报
回复
放在了这里

ftp://137.189.32.219/incoming/


不知何时会被删除
comeonstuding 2003-12-01
  • 打赏
  • 举报
回复
up
h2plus0 2003-11-30
  • 打赏
  • 举报
回复
up, 可惜我没有 ftp, 不过
202.114.10.249
是可以上载的
「已注销」 2003-11-30
  • 打赏
  • 举报
回复
那位帮忙找个地方,我把程序FTP上去
「已注销」 2003-11-28
  • 打赏
  • 举报
回复
这是核心部分

void CLiftCar::CarWork(void)
{

if(--this->m_iCarTime>0){
return;
}
if(this->m_iCarFor==NONE){
if(theLevel[this->m_iCurrentLevel].m_bUpButtonPressed==TRUE){
this->m_iCarFor=UP;
this->Told("上开");
} else if(theLevel[this->m_iCurrentLevel].m_bDownButtonPressed==TRUE){
this->m_iCarFor=DOWN;
this->Told("下开");
} else {//智能移动
this->Told("智能");
this->m_iCarFor=CarJudge();
this->Told((this->m_iCarFor==UP)?("上"):((this->m_iCarFor==DOWN)?"下":"停"));
}
this->m_bCarGateOpen=TRUE;
this->m_bCarAtLevel=TRUE;
this->m_iCarTime=WAITSECOND;
this->CarOut();
// return;
}
else if(this->m_bCarAtLevel){
// STOP At Level
if(this->m_bCarGateOpen==TRUE){
if(this->m_iCarFor==DOWN){
if(this->m_iCurrentLevel==this->m_iCarBottom){
this->m_iCarFor=UP;
this->Told("底关");
} else {
this->DownCarIn();
this->Told("下关");
}
} else {//(this->m_iCarFor==UP){
if(this->m_iCurrentLevel==this->m_iCarTop){
this->m_iCarFor=DOWN;
this->Told("顶关");
} else {
this->UpCarIn();
this->Told("上关");
}
}
this->m_bCarAtLevel=FALSE;
this->m_bCarGateOpen=FALSE;
this->m_iCarTime=RUNNINGSECOND;
// return;
} else {//(this->m_bCarGateOpen==GATECLOSEED){
// Start to go
if(this->m_iCarFor==DOWN){
// Internal Same Button, Go!
if (this->CarBelowButton()) {
this->m_bCarAtLevel=FALSE;
this->m_iCarTime=RUNNINGSECOND;
this->Told("下行");
} else {
// No SameDIR REQ, Stop Wait
this->m_iCarFor=NONE;
this->m_bCarGateOpen=TRUE;
this->m_iCarTime=WAITSECOND;
this->Told("停止");
}
// return;
} else {//(this->m_iCarFor==UP){
// Internal Same Button, Go!
if(this->CarAboveButton()){
this->m_bCarAtLevel=FALSE;
this->m_iCarTime=RUNNINGSECOND;
this->Told("上行");
} else {
// No SameDIR REQ, Stop Wait
this->m_iCarFor=NONE;
this->m_bCarGateOpen=TRUE;
this->m_iCarTime=WAITSECOND;
this->Told("停止");
}
// return;
}
// return;
}
// return;
}
else {// if(!this->m_bCarAtLevel){
// Car is Moving to a new Level
if(this->m_iCarFor==UP){
if(this->m_iCurrentLevel<this->m_iCarTop)
this->m_iCurrentLevel++;
if(this->m_cButton[this->m_iCurrentLevel].m_bNonStop) {
// NonStop Level
this->m_iCarTime=RUNNINGSECOND;
this->Told("禁停");
}

else if(this->m_cButton[this->m_iCurrentLevel].m_bPushed) {
if(this->m_iCurrentLevel==this->m_iCarTop){
this->m_iCarFor=DOWN;
this->Told("顶开");
} else {
this->m_iCarFor=UP;
this->Told("上开");
}
this->m_bCarAtLevel=TRUE;
this->m_bCarGateOpen=TRUE;
this->m_iCarTime=WAITSECOND;
// Internal Person want to go Out
this->CarOut();
}

else if (this->m_iCarCapacity>MAXCARPERSON-1) {
//Car Full, NonStop
this->m_iCarTime=RUNNINGSECOND;
this->Told("满员");
}

else if (theLevel[this->m_iCurrentLevel].m_bUpButtonPressed==TRUE){
// Level Same Request, Open Door
this->m_bCarAtLevel=TRUE;
this->m_bCarGateOpen=TRUE;
this->m_iCarTime=WAITSECOND;
this->m_iCarFor=UP;
this->Told("开上");
}

// Internal Up Request, Keep Going
else if(this->CarAboveButton()){
this->m_iCarTime=RUNNINGSECOND;
this->Told("不停");
}

// Upper Up, Keep Going
else if(LevelAboveUp(this->m_iCurrentLevel)){
this->m_iCarTime=RUNNINGSECOND;
this->Told("聚集");
}
// Upper Down, Keep Going
else if(LevelAboveDown(this->m_iCurrentLevel)){
this->m_iCarTime=RUNNINGSECOND;
this->Told("聚集");
} else {
// No Upper Request, Sleep ?
this->m_bCarAtLevel=TRUE;
this->m_bCarGateOpen=TRUE;
this->m_iCarTime=WAITSECOND;
this->m_iCarFor=NONE;
this->Told("停");
}
// return;
} else {//(this->m_iCarFor==DOWN){
if(this->m_iCurrentLevel>this->m_iCarBottom)
this->m_iCurrentLevel--;
if(this->m_cButton[this->m_iCurrentLevel].m_bNonStop) {
// NonStop Level
this->m_iCarTime=RUNNINGSECOND;
this->Told("禁停");
}

else if (this->m_cButton[this->m_iCurrentLevel].m_bPushed){
if(this->m_iCurrentLevel==0){
this->m_iCarFor=UP;
this->Told("底开");
} else {
this->m_iCarFor=DOWN;
this->Told("下开");
}
this->m_bCarAtLevel=TRUE;
this->m_bCarGateOpen=TRUE;
this->m_iCarTime=WAITSECOND;
// Internal Person want to go Out
this->CarOut();
}

else if (this->m_iCarCapacity>MAXCARPERSON-1) {
//Car Full, NonStop
this->m_iCarTime=RUNNINGSECOND;
this->Told("满员");
}

else if (theLevel[this->m_iCurrentLevel].m_bDownButtonPressed==TRUE){
// Level Same Request, Open Door
this->m_bCarAtLevel=TRUE;
this->m_bCarGateOpen=TRUE;
this->m_iCarFor=DOWN;
this->m_iCarTime=WAITSECOND;
this->Told("开下");
}

else if (this->CarBelowButton()) {
// Internal Down Request, Keep Going
this->m_iCarTime=RUNNINGSECOND;
this->Told("不停");
}

// Lower Down, Keep Going
else if(LevelBelowDown(this->m_iCurrentLevel)){
this->m_iCarTime=RUNNINGSECOND;
this->Told("聚集");
}
// Lower Down, Keep Going
else if(LevelBelowUp(this->m_iCurrentLevel)){
this->m_iCarTime=RUNNINGSECOND;
this->Told("聚集");
} else {
// No Lower Request, Sleep ?
this->m_bCarAtLevel=TRUE;
this->m_bCarGateOpen=TRUE;
this->m_iCarTime=WAITSECOND;
this->m_iCarFor=NONE;
this->Told("睡眠");
}
// return;
}
// return;
}
return;
}
fryboy 2003-11-28
  • 打赏
  • 举报
回复
不懂,帮你顶
「已注销」 2003-11-28
  • 打赏
  • 举报
回复
这是电梯类
class CLiftCar : public CObject
{
DECLARE_DYNCREATE(CLiftCar)

CLiftCar(); // protected constructor used by dynamic creation

// Attributes
public:
int m_iCarIndex; // the car number
int m_iCurrentLevel; // Which Level the car is

BOOL m_bCarGateOpen; // Car Gate is Open?
BOOL m_bCarAtLevel; // Car is just on a level?
int m_iCarFor; // Car Direction? UP,DOWN,NONE

int m_iCarTime; // Car Tick
int m_iSleepLevel; // Not Availabale

int m_iCarInfoDispX; // Debug Information
int m_iCarInfoDispY;

int m_iCarTop; // The Top Level of the Car
int m_iCarBottom; // The Bottom Level of the Car

int m_iCarCapacity; // How many psn in the car
int m_iCarHold[MAXCARPERSON]; // Who is in the car

struct CarPanel{ // Car Internal Panel
BOOL m_bPushed; // Someone Push for Out
BOOL m_bNonStop; // Car will not stop here
CRect m_rPosition; // For USer Click
} m_cButton[MAXLEVEL]; // Each Level has One Panel

private:
void Told(CString str); // Debug Tool

// Operations
public:
void InitCar(void); // As the Name
void CarOut(void); // "You'v got your Level, Out!!"
void UpCarIn(void); // "Going Up, Please Come In"
void DownCarIn(void); // "Going Down, Please Come In"
BOOL CarBelowButton(void); // Any Internal Below Button Pressed
BOOL CarAboveButton(void); // Any Internal Above Button Pressed
int CarJudge(void); // How to move for a idle Car
void CarWork(void); // MainLoop
void DrawDoor(void); // As the Name
void EraseDoor(void); // As the Name
void DrawCarIndicator(void); // Draw Car Status
void CarButtonInit(int lvl);
void CarButtonPress(int lvl, BOOL Press); // Press Car Button of the Lvl

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CLiftCar)
//}}AFX_VIRTUAL

// Implementation
protected:
virtual ~CLiftCar();

// Generated message map functions
//{{AFX_MSG(CLiftCar)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG

};




CLiftCar theCar[MAXELEVATOR];


panda2fw2 2003-11-28
  • 打赏
  • 举报
回复
要是给点注释就好了
「已注销」 2003-11-26
  • 打赏
  • 举报
回复
我有一程序,当初学MFC时写的,可执行文件压缩后392k, VC6.0 MFC 的。
想给各位看看,不知道如何上载。

如果大家有兴趣,也可以把源程序上载(50K)。
panda2fw2 2003-11-26
  • 打赏
  • 举报
回复
楼上的兄弟真厉害,正好小弟我也需要这个,最好是c++版本的,希望能够得到大家的帮忙。

33,029

社区成员

发帖
与我相关
我的任务
社区描述
数据结构与算法相关内容讨论专区
社区管理员
  • 数据结构与算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧