渐 变

private:
 int ColorR;
 int ColorG;

 

// vcB1View.cpp : implementation of the CVcB1View class
//

#include "stdafx.h"
#include "vcB1.h"

#include "vcB1Doc.h"
#include "vcB1View.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CVcB1View

IMPLEMENT_DYNCREATE(CVcB1View, CView)

BEGIN_MESSAGE_MAP(CVcB1View, CView)
//{{AFX_MSG_MAP(CVcB1View)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CVcB1View construction/destruction

CVcB1View::CVcB1View()
{
 // TODO: add construction code here
 // TODO: add construction code here
 ColorR = 255;
 ColorG = 255;
 
}

CVcB1View::~CVcB1View()
{
}

BOOL CVcB1View::PreCreateWindow(CREATESTRUCT& cs)
{
 // TODO: Modify the Window class or styles here by modifying
 //  the CREATESTRUCT cs
 
 return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CVcB1View drawing

void CVcB1View::OnDraw(CDC* pDC)
{
 CVcB1Doc* pDoc = GetDocument();
 ASSERT_VALID(pDoc);
 // TODO: add draw code for native data here
 
 
 // TODO: add draw code for native data here
 CRect m_rcClient;
 
 // file://得到客户区域的填充矩形
 GetClientRect(&m_rcClient);
 int nWidth = m_rcClient.Width();
 int nHeight = m_rcClient.Height();
 CRect rectangle;
 //file://分割客户区域成小矩形,逐个填充
 for(int i = 0;i < nWidth;i++ )
 {
  rectangle.SetRect(i, 0, i+1, nHeight);
  pDC->FillSolidRect(&rectangle, RGB(ColorR, ColorG, 255-MulDiv(i, 255, nWidth)));
 }
 
}

/////////////////////////////////////////////////////////////////////////////
// CVcB1View printing

BOOL CVcB1View::OnPreparePrinting(CPrintInfo* pInfo)
{
 // default preparation
 return DoPreparePrinting(pInfo);
}

void CVcB1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
 // TODO: add extra initialization before printing
}

void CVcB1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
 // TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CVcB1View diagnostics

#ifdef _DEBUG
void CVcB1View::AssertValid() const
{
 CView::AssertValid();
}

void CVcB1View::Dump(CDumpContext& dc) const
{
 CView::Dump(dc);
}

CVcB1Doc* CVcB1View::GetDocument() // non-debug version is inline
{
 ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CVcB1Doc)));
 return (CVcB1Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CVcB1View message handlers

void CVcB1View::OnLButtonDown(UINT nFlags, CPoint point)
{
 // TODO: Add your message handler code here and/or call default
 //生成小于255的随机数,给ColorR和ColorG赋值
 int nRand = rand();

 float fMap = (float)255/RAND_MAX;
 ColorR = (UINT)(float)nRand*fMap + 0.5f;
 nRand = rand();

 fMap = (float)255/RAND_MAX;

 ColorG = (UINT)(float)nRand*fMap + 0.5f;
 //更新界面
 Invalidate();
 
 CView::OnLButtonDown(nFlags, point);
}

【SCI复现】含可再生能源与储能的区域微电网最优运行:应对不确定性的解鲁棒性与非预见性研究(Matlab代码实现)内容概要:本文围绕含可再生能源与储能的区域微电网最优运行展开研究,重点探讨应对不确定性的解鲁棒性与非预见性策略,通过Matlab代码实现SCI论文复现。研究涵盖多阶段鲁棒调度模型、机会约束规划、需求响应机制及储能系统优化配置,结合风电、光伏等可再生能源出力的不确定性建模,提出兼顾系统经济性与鲁棒性的优化运行方案。文中详细展示了模型构建、算法设计(如C&CG算法、大M法)及仿真验证全过程,适用于微电网能量管理、电力系统优化调度等领域的科研与工程实践。; 适合人群:具备一定电力系统、优化理论和Matlab编程基础的研究生、科研人员及从事微电网、能源管理相关工作的工程技术人员。; 使用场景及目标:①复现SCI级微电网鲁棒优化研究成果,掌握应对风光负荷不确定性的建模与求解方法;②深入理解两阶段鲁棒优化、分布鲁棒优化、机会约束规划等先进优化方法在能源系统中的实际应用;③为撰写高水平学术论文或开展相关课题研究提供代码参考和技术支持。; 阅读建议:建议读者结合文档提供的Matlab代码逐模块学习,重点关注不确定性建模、鲁棒优化模型构建与求解流程,并尝试在不同场景下调试与扩展代码,以深化对微电网优化运行机制的理解。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值