图1是一个智能加工系统的示意图,由8台计算机数控机床(Computer Number Controller,CNC)、1辆轨道式自动引导车(Rail Guide Vehicle,RGV)、1条RGV直线轨道、1条上料传送带、1条下料传送带等附属设备组成。RGV是一种无人驾驶、能在固定轨道上自由运行的智能车。它根据指令能自动控制移动方向和距离,并自带一个机械手臂、两只机械手爪和物料清洗槽,能够完成上下料及清洗物料等作业任务(参见附件1)。
图1:智能加工系统示意图
针对下面的三种具体情况:
(1)一道工序的物料加工作业情况,每台CNC安装同样的刀具,物料可以在任一台CNC上加工完成;
(2)两道工序的物料加工作业情况,每个物料的第一和第二道工序分别由两台不同的CNC依次加工完成;
(3)CNC在加工过程中可能发生故障(据统计:故障的发生概率约为1%)的情况,每次故障排除(人工处理,未完成的物料报废)时间介于10~20分钟之间,故障排除后即刻加入作业序列。要求分别考虑一道工序和两道工序的物料加工作业情况。
请你们团队完成下列两项任务:
任务1:对一般问题进行研究,给出RGV动态调度模型和相应的求解算法;
任务2:利用表1中系统作业参数的3组数据分别检验模型的实用性和算法的有效性,给出RGV的调度策略和系统的作业效率,并将具体的结果分别填入附件2的EXCEL表中。
表1:智能加工系统作业参数的3组数据表 时间单位:秒
系统作业参数 |
第1组 |
第2组 |
第3组 |
RGV移动1个单位所需时间 |
20 |
23 |
18 |
RGV移动2个单位所需时间 |
33 |
41 |
32 |
RGV移动3个单位所需时间 |
46 |
59 |
46 |
CNC加工完成一个一道工序的物料所需时间 |
560 |
580 |
545 |
CNC加工完成一个两道工序物料的第一道工序所需时间 |
400 |
280 |
455 |
CNC加工完成一个两道工序物料的第二道工序所需时间 |
378 |
500 |
182 |
RGV为CNC1#,3#,5#,7#一次上下料所需时间 |
28 |
30 |
27 |
RGV为CNC2#,4#,6#,8#一次上下料所需时间 |
31 |
35 |
32 |
RGV完成一个物料的清洗作业所需时间 |
25 |
30 |
25 |
注:每班次连续作业8小时。
--------------------- 本文来自 佛系喵 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/abc1498880402/article/details/82745031?utm_source=copy
运行平台:VS2017
本程序全部采用C++编写,正确运行程序请在VS平台新建一个Windows控制台应用程序,附录代码用“/**/”分割,存储成不同类型文件。
①第一种情况(无故障):
/*---------------------------------------stdafx.h----------------------------------*/
#pragma once
#include "targetver.h"
#include
#include
#include
#include
#include
#include
/*--------------------------------------targetver.h--------------------------------*/
#pragma once
#include
/*-----------------------------------------CNC.h-----------------------------------*/
#pragma once
class CNC
{
private:
int number; //CNC编号
int position; //CNC位置
int count; //CNC剩余工作时间
int n; //加工物序列号
public:
CNC(int num, int pos);
void countdown(int tem);
friend class RGV;
};
/*----------------------------------------CNC.cpp----------------------------------*/
#include "stdafx.h"
#include "CNC.h"
using namespace std;
CNC::CNC( int num, int pos)
{
number = (num > 0) ? num : ERROR;
position = (pos >= 0) ? pos : ERROR;
count = 0;
n = 0;
}
void CNC::countdown(int temp)
{
if (count > temp) {
count -= temp;
}
else {
count = 0;}
}
/*--------------------------------------RVG.h--------------------------------------*/
#pragma once
#include "CNC.h"
class RGV
{
private:
int position; //rgv当前位置
int now_cnc; //当前目标
int rgv_flag; //rgv_flag,1有熟料,0无
public:
int time; //总用时
int sum; //加工熟料总数
RGV();
void Init(CNC *p); //第一轮初始化
int posCalculate(int pos1, int pos2); //计算RGV移动时间
void move(CNC *p); //RGV移动
void load(CNC *p); //RGV上下料
void clean(CNC *p);//RGV清洗
void wait(CNC *p);//RGV等待
};
/*--------------------------------------RVG.cpp------------------------------------*/
#include "stdafx.h"
#include "RGV.h"
#define STEP1 20
#define STEP2 33
#define STEP3 46
#define CNC_WORKTIME 560
#define CNC1 28
#define CNC0 31
#define CLEAN 25
#define CNCNUMBER 8
using namespace std;
int n = 0; //加工物序列号
RGV::RGV()
{
position = 0;
now_cnc = 1;
rgv_flag = 0;
time = 0;
sum = 0;
}
void RGV::Init(CNC *p)
{
CNC* ptr = p;
for (int i = 0; i < CNCNUMBER; i++, now_cnc++) {
int temp = posCalculate(position, (p + now_cnc - 1)->position);
if (temp) {
time += temp;
CNC*ptr1 = p;
for (int i = 0; i < CNCNUMBER; i++, ptr1++) {
ptr1->countdown(temp);
}
}
load(p);
position = (p + now_cnc - 1)->position;
}
}
int RGV::posCalculate(int pos1, int pos2)//RGV移动时间计算
{
switch (abs(pos1 - pos2))
{
case 3: return STEP3;
case 2: return STEP2;
case 1: return STEP1;
case 0: return 0;
default: return ERROR;
}
}
void RGV::move(CNC *p)//RGV移动
{
CNC* ptr = p;
int time1 = 10000;//最少时间
int time2 = 0; //当前时间
int next_cnc = 1; //最优解
for (int i = 0; i < CNCNUMBER; i++, ptr++)
{
int postime = posCalculate(position, ptr->position);
time2 = ptr->count + postime;//CNC工作剩余时间 + RGV移动到当前位置时间
if (time1 > time2) {
time1 = time2;
next_cnc = ptr->number;
}
else continue;
}
if (now_cnc != next_cnc) {//当前对象不是最优对象,移动
int temp = posCalculate(position, (p + next_cnc - 1)->position);
if (temp) {
time += temp;
CNC*ptr1 = p;
for (int i = 0; i < CNCNUMBER; i++, ptr1++) //所有CNC剩余时间 - rgv移动时间
{
ptr1->countdown(temp);
}
}
position = (p + next_cnc - 1)->position;
now_cnc = next_cnc;
}
//cout << "position" << position << '\t' << "now_cnc" << now_cnc << endl; //test
wait(p);
}
void RGV::load(CNC *p)//RGV上下料
{
CNC* ptr = p + now_cnc - 1; //此处数组下标和CNC编号要注意!
int temp = 0;
cout << time << '\t' << '\t' << ptr->n << '\t' << '\t' << ++n << '\t' << now_cnc << endl;
if ((ptr->number % 2) == 1) {
temp = CNC1;
}
else {
temp = CNC0;
}
time += temp;
CNC*ptr1 = p;
for (int i = 0; i < CNCNUMBER; i++, ptr1++) //所有CNC剩余时间 - rgv移动时间
{
ptr1->countdown(temp);
}
ptr->n = n;
ptr->count = CNC_WORKTIME;
rgv_flag = 1;
}
void RGV::clean(CNC* p)//RGV清洗
{
sum++;
int temp = CLEAN;
time += temp;
CNC*ptr1 = p;
for (int i = 0; i < CNCNUMBER; i++, ptr1++) //所有CNC剩余时间 - rgv移动时间
{
ptr1->countdown(temp);
}
}
void RGV::wait(CNC* p)
{
CNC* ptr = p + now_cnc - 1;
if (ptr->count) {
int temp = ptr->count;
time += temp;
CNC*ptr1 = p;
for (int i = 0; i < CNCNUMBER; i++, ptr1++) //所有CNC剩余时间 - rgv移动时间
{
ptr1->countdown(temp);
}
ptr->count = 0;
}
else return;
}
/*--------------------------main.cpp----------------------------------*/
#include "stdafx.h"
#include "RGV.h"
#include "CNC.h"
#define CNCNUMBER 8
#define TIME 28800
using namespace std;
int main()
{
RGV rgv;
CNC cnc[CNCNUMBER] = {
CNC(1,0), CNC(2,0), CNC(3,1), CNC(4,1),
CNC(5,2), CNC(6,2), CNC(7,3), CNC(8,3) };
CNC *pCNC = cnc;
cout <<"时间" << '\t' << "下料开始" << '\t' << "上料开始" << '\t' << "CNC#" << endl;
/*第一轮
仅需考虑RGV“移动”和“上下料”动作*/
rgv.Init(pCNC);
/*第(n+1)轮
RGV循环“移动”,“上下料”和“清洗”动作*/
while (rgv.time <= TIME)
{
rgv.move(pCNC);
rgv.load(pCNC);
rgv.clean(pCNC);
}
cout << "生成熟料总数:" << rgv.sum << endl;
system("pause");
return 0;
}