Introduction to DirectWrite

基于AT32F421的紧凑型无刷电机FOC驱动板设计 矢量控制(FOC)作为无刷电机的主流控制策略,通过坐标变换与SVPWM调制实现对电机转矩和转速的精确控制。电流环作为FOC的核心,其性能直接决定系统的动态响应和稳定性,因此对MCU的运算能力与硬件资源提出严苛要求。在云台、机器人关节等紧凑应用场景中,如何在有限PCB面积内平衡控制性能与硬件复杂度,成为电机驱动设计的关键挑战。本文从工程实践角度,介绍一款基于AT32F421的紧凑型无刷电机FOC驱动方案:通过选用Cortex-M4内核、216MHz主频且带硬件浮点的MCU,配合合理的栅极驱动、低边采样及PCB 阅读详情

http://www.nuonsoft.com/blog/2009/05/27/introduction-to-directwrite/

Microsoft has added two interesting new API’s to Windows 7: Direct2D and DirectWrite. Direct2D replaces GDI and GDI+. It can render more accurate results and has support for hardware acceleration on your graphics hardware. DirectWrite is a new API to render text. It makes it easy to render paragraphs of text that can contain different formatting, coloring, fonts etc. It supports horizontal and vertical alignments, even vertical centering of a paragraph with multiple lines which was not possible with the old text API, etc. This article will give an introduction to the new DirectWrite API.

DirectWrite Benefits

Let me summarize first a few of the benefits of the DirectWrite API:

  • More advanced anti-aliasing: horizontally this is done using cleartype, vertically this is done using standard anti-aliasing techniques.
  • Subpixel accurate rendering and positioning. This allows for much smoother animation of moving or rotating text. If you would use GDI or GDI+ to draw animated rotated text, you would notice severe artefacts and jumping of pixels. With DirectWrite, the rotation will be very smooth. See example below.
  • Handling of different formatting (bold, italic…), coloring, fonts and so on in a single paragraph.
  • Hit testing support for multi formatted text.
  • Full support for Unicode.
  • Full support for left-to-right or right-to-left languages.
  • Full DPI Aware.
  • Support for advanced typographic features embedded in certain fonts.
  • Support for font files conformant to the OpenType specification version 1.5.
    Basically, it supports font files with extension TTF, OTF or TTC.
  • Support for application local (= not installed) font files.
  • Independent of any rendering technology. DirectWrite is designed to work well
    with Direct2D, but you could also use DirectWrite in combination with GDI, GDI+, Direct3D or your own render engine.
  • When used in combination with Direct2D, you get hardware acceleration.

Currently, DirectWrite is being developed for Windows 7. Once Windows 7 ships, DirectWrite will also be made available for Windows Vista. At the moment there are no plans to support Windows XP.

As you can see, it looks like a powerful API. So let’s get started with it.

Below you can find a screenshot of the demo application that comes with this article. Everything you see in that screenshot is pretty easy to accomplish with the Direct2D and DirectWrite combination.

Note: Pay special attention to the different ways of how the letter “y” is rendered in the “Fancy Typography Rendering”. The way the “y” is rendered depends on where in the word the letter occurs.

Starting With DirectWrite

Before we can start using the DirectWrite and Direct2D features we need to get the latest Microsoft SDK for Windows 7 . See more about this SDK and Visual Studio 2010 Beta 1 in the last section of this article. Once the SDK is installed we can start using it. The first thing we need is to include the Direct2D and DirectWrite header files as follows:

#include <d2d1.h>
#include <dwrite.h>

You also need to link to the Direct2D and DirectWrite libraries:

#pragma comment(lib, "d2d1.lib")
#pragma comment(lib, "dwrite.lib")

Both Direct2D and DirectWrite are implemented as COM objects and thus we will need to work with quite a few COM interface pointers. To make this easier I will use the _com_ptr_t smart COM interface pointer. To use this we need the following include:

#include <comdef.h>

This smart COM interface pointer is used by using the _COM_SMARTPTR_TYPEDEF macro, for example:

_COM_SMARTPTR_TYPEDEF(IMyInterface, __uuidof(IMyInterface));
IMyInterfacePtr pMyPointer;

The macro creates a type that has the same name as the interface with a suffix of Ptr.

In my code I will use the following helper macro to check the results of function calls.

#ifndef IFR
#define IFR(expr) do {hr = (expr); _ASSERT(SUCCEEDED(hr)); if (FAILED(hr)) return(hr);} while(0)
#endif

Direct2D and DirectWrite work with two kind of resources. There are device indepedent and device dependent resources. The device dependent resources might need to be recreated when for example display settings change.

Factories and Device Independent Resources

Both Direct2D and DirectWrite work with a factory that is used to create other resources. Those factories are device indepedent and stay valid during the execution of the program. The following code creates those two factories:

HRESULT hr = S_OK;
// Create a Direct2D factory.
IFR(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &g_pD2DFactory));

// Create a DirectWrite factory.
IFR(DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory),
	reinterpret_cast<IUnknown**>(&g_pDWriteFactory)));

Now that we have our factories we can start creating other objects. First lets create a text format object. A text format object is used to layout text and contains among others settings a font, font size and font style.

IFR(g_pDWriteFactory->CreateTextFormat(L"Arial", NULL, DWRITE_FONT_WEIGHT_REGULAR,
	DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL,
	ConvertPointSizeToDIP(12.0f), L"en-us", &g_pTextFormat));

The above text format is created with the font “Arial” and a point size of 12. Note that we have to convert font point sizes into DIP units. A DIP is a Device Independent Pixel unit. 1 DIP = 1/96 inch. And 1 inch = 72 points, so conversion can be done with the following helper function:

FLOAT ConvertPointSizeToDIP(FLOAT points)
{
	return (points/72.0f)*96.0f;
}

The IDWriteTextFormat interface contains methods to setup flow direction, line spacing, paragraph alignment (= vertical alignment), reading direction, text alignment (= horizontal alignment), trimming, word wrapping and so on. For example, use the following to set the text alignment to align the text to the leading edge:

IFR(g_pTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING));

NOTE: Since DirectWrite supports both left-to-right and right-to-left languages, it does not use DWRITE_TEXT_ALIGNMENT_LEFT and DWRITE_TEXT_ALIGNMENT_RIGHT, but instead it uses DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_TEXT_ALIGNMENT_TRAILING and DWRITE_TEXT_ALIGNMENT_CENTER.

Device Dependent Resources

Now that we have our device independent resources we can start writing a function that will create all device dependent resources. An important device depedent resource is the render target. Since my example will render text to the screen, a HWND Render Target is created as follows:

IFR(g_pD2DFactory->CreateHwndRenderTarget(D2D1::RenderTargetProperties(),
	D2D1::HwndRenderTargetProperties(g_hWnd, size), &g_pRT));

Brushes are also device dependent. As an example, the following creates a solid black brush that will be used as the brush for rendering text unless a piece of text already has another brush attached to it.

IFR(g_pRT->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Black),
	&g_pSolidBrush));

Text Layout Object

Now we are ready to start creating objects for the actual text layouting, instances of IDWriteTextLayout. Three text layouts will be created. The first layout will render some English text with some simple formatting. The second layout will render some Arabic text to demonstrate the use of mixed left-to-right and right-to-left paragraphs. The third layout will use special typographic features to render some fancy text including a different text alignment. If you want different text alignment as demonstrated, you need different text layout objects because functions like SetTextAlignment do not accept character ranges and thus are applied to the entire text in the text layout. The same is valid for the text direction. If you want to mix left-to-right and right-to-left text you need a different text layout for each. Other things like font size, typographic features, formatting, coloring etc can be applied to ranges of a specific text layout. The following piece of code demonstrates how to create a text layout:

IFR(g_pDWriteFactory->CreateTextLayout(pStr, _tcslen(pStr), g_pTextFormat,
	sizeRT.width, sizeRT.height, &g_pTextLayout));

It accepts the text that needs to be rendered, a pointer to a text format object used as default formatting and the width and height of the layout rectangle. Once you have a text layout, you can apply formatting to parts of it. The following will put the range starting at character position 28 with a length of 4 characters in bold:

DWRITE_TEXT_RANGE range = {28, 4};
IFR(g_pTextLayout->SetFontWeight(DWRITE_FONT_WEIGHT_BOLD, range));

Some of the more frequently used functions on text layouts (IDWriteTextLayout) are:

  • SetFontFamilyName: sets the name of the font to use for the range. For example:
    IFR(g_pFancyTextLayout->SetFontFamilyName(L”Gabriola”, range));
  • SetFontSize: sets the size of the font for the range. For example:
    IFR(g_pFancyTextLayout->SetFontSize(ConvertPointSizeToDIP(36.0f), range));
  • SetFontStyle: sets the style (normal, italic, oblique) of the font for the range. For example:
    IFR(g_pTextLayout->SetFontStyle(DWRITE_FONT_STYLE_ITALIC, range));
  • SetFontWeight: sets whether the font is bold and how much for the range. For example:
    IFR(g_pTextLayout->SetFontWeight(DWRITE_FONT_WEIGHT_BOLD, range));
  • SetStrikethrough: sets whether the font is striked through for the range. For example:
    IFR(g_pTextLayout->SetStrikethrough(TRUE, range));
  • SetTypography: sets typographic features of the font for the range. See the attached demo for an example on how to do this.
  • SetUnderline: sets whether the font is underlined for the range. For example:
    IFR(g_pTextLayout->SetUnderline(TRUE, range));

To change the color of text ranges, use the SetDrawingEffect function. The following example creates a blue brush and then applies it to a range of text.

_COM_SMARTPTR_TYPEDEF(ID2D1SolidColorBrush, __uuidof(ID2D1SolidColorBrush));
ID2D1SolidColorBrushPtr pBrush = NULL;
IFR(g_pRT->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Blue),&pBrush));
DWRITE_TEXT_RANGE range = {115, 4};
IFR(g_pTextLayout->SetDrawingEffect(pBrush, range));
if (pBrush)
	pBrush.Release();

Note: If you are going to use some colors a lot of time, it is better to create those brushes once in the CreateDevDependentResources() function.

The demo contains a paragraph with some Arabic text. This is accomplished by creating a text layout and setting the reading direction to right-to-left, as in:

IFR(g_pDWriteFactory->CreateTextLayout(pArabic, _tcslen(pArabic), g_pTextFormat,
	sizeRT.width, sizeRT.height, &g_pArabicTextLayout));
// Set reading direction to right-to-left
IFR(g_pArabicTextLayout->SetReadingDirection(DWRITE_READING_DIRECTION_RIGHT_TO_LEFT));

The Draw Function

Now that we have setup all device independent and device dependent resources, we can start working on the Draw function that will do the actual rendering. The first thing the Draw function does is calling the CreateDevDependentResources function to make sure that the device dependent resources are still valid. This will usually be a no-operation unless those resources are invalidated and need to be recreated. Drawing of one frame in Direct2D should always start with a call to BeginDraw and end with a call to EndDraw on the render target object as follows:

g_pRT->BeginDraw();
// ... The actual drawing code comes here ...
HRESULT hr = g_pRT->EndDraw();

The next thing we will do is to reset the transformation matrix to the identity matrix, meaning no translation nor rotation. We will also clear the entire background of the frame to white.

g_pRT->SetTransform(D2D1::IdentityMatrix());
g_pRT->Clear(D2D1::ColorF(D2D1::ColorF::White));

We are now ready to render the first piece of text. First we define the upper-left corner of where rendering will start in the frame, this is at position (g_siMargin, g_siMargin). The demo application contains some code to rotate the text based on a timer. So if rotation is enabled, we apply a rotation transformation matrix to the render target. Finally we call the DrawTextLayout function to do the actual rendering of the text.

D2D1_POINT_2F origin = D2D1::Point2F(static_cast<FLOAT>(g_siMargin),
	static_cast<FLOAT>(g_siMargin));
if (g_bRotate)
{
	g_pRT->SetTransform(D2D1::Matrix3x2F::Rotation(g_fAngle,
		D2D1::Point2F(0.0f,0.0f)));
}
g_pRT->DrawTextLayout(origin, g_pTextLayout, g_pSolidBrush);

The next paragraph is the one with the Arabic text. We want this to be positioned exactly below the previously rendered text, so we will first calculate the height of the previously rendered text using GetMetrics:

DWRITE_TEXT_METRICS textMetrics = {0};
IFR(g_pTextLayout->GetMetrics(&textMetrics));
FLOAT fArabicTextTop = textMetrics.top + textMetrics.height;

The actual rendering of the Arabic text is exactly the same as how the first piece of text was rendered, but instead of using g_pTextLayout you use g_pArabicTextLayout.

The last paragraph is the one with the “Fancy” text. Again, first we will calculate where to start rendering this paragraph as follows:

IFR(g_pArabicTextLayout->GetMetrics(&textMetrics));
FLOAT fFancyTypographTop = fArabicTextTop + textMetrics.height;

The “Fancy” text has some special typgraphic features enabled and will use a linear gradient brush instead of a solid brush. We start by setting up the linear gradient brush. For this, we need to know the width of the text. This can be calculated with GetMetrics as follows:

IFR(g_pFancyTextLayout->GetMetrics(&textMetrics));

The values in the textMetrics are used in the following piece of code to setup the properties of the linear gradient brush:

D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES props;
props.startPoint.x = textMetrics.left;
props.startPoint.y = 0.0f;
props.endPoint.x = textMetrics.left + textMetrics.width;
props.endPoint.y = 0.0f;

A second thing we need for a linear gradient brush is an array of stops. Stops are positions in the gradient for which you specify the color. The position is a value between 0.0f and 1.0f where 0.0f is completely left and 1.0f is complete right. The color of positions in between stops is interpolated. The following example creates a gradient stop collection with 3 stops. The gradient will go from red on the left to blue in the middle to red on the right.

D2D1_GRADIENT_STOP stops[3];
stops[0].color = D2D1::ColorF(D2D1::ColorF::Red);
stops[0].position = 0.0f;
stops[1].color = D2D1::ColorF(D2D1::ColorF::Blue);
stops[1].position = 0.5f;
stops[2].color = D2D1::ColorF(D2D1::ColorF::Red);
stops[2].position = 1.0f;

With the above array of gradient stops, we can now create our Direct2D stop collection object ID2D1GradientStopCollection:

_COM_SMARTPTR_TYPEDEF(ID2D1GradientStopCollection, __uuidof(ID2D1GradientStopCollection));
ID2D1GradientStopCollectionPtr pStopCollection = NULL;
IFR(g_pRT->CreateGradientStopCollection(stops, 3, D2D1_GAMMA_2_2,
	D2D1_EXTEND_MODE_CLAMP, &pStopCollection));

The following step is to create the actual linear gradient brush object ID2D1LinearGradientBrush, assign it to the range of text and release resources:

_COM_SMARTPTR_TYPEDEF(ID2D1LinearGradientBrush, __uuidof(ID2D1LinearGradientBrush));
ID2D1LinearGradientBrushPtr pGradientBrush = NULL;
IFR(g_pRT->CreateLinearGradientBrush(&props, NULL, pStopCollection, &pGradientBrush));
DWRITE_TEXT_RANGE range = {0, 27};
IFR(g_pFancyTextLayout->SetDrawingEffect(pGradientBrush, range));
if (pGradientBrush)
	pGradientBrush.Release();
if (pStopCollection)
	pStopCollection.Release();

After this, rendering happens as usual:

origin.y = fFancyTypographTop;
if (g_bRotate)
{
	g_pRT->SetTransform(D2D1::Matrix3x2F::Rotation(g_fAngle,
		D2D1::Point2F(0.0f,0.0f)));
}
// Draw our text.
g_pRT->DrawTextLayout(origin, g_pFancyTextLayout, g_pSolidBrush);

The last thing in the Draw function is the following:

hr = g_pRT->EndDraw();
if (FAILED(hr))
	ReleaseDevDependentResources();

If the EndDraw call returned an error code, we release device dependent resources to force them to be recreated on the next call to Draw.

Handling WM_PAINT, WM_DISPLAYCHANGE and WM_SIZE

In the window procedure, we handle WM_PAINT and WM_DISPLAYCHANGE messages to call our Draw function:

case WM_PAINT:
case WM_DISPLAYCHANGE:
	hdc = BeginPaint(hWnd, &ps);
	Draw();
	EndPaint(hWnd, &ps);
	break;

We also need to handle WM_SIZE messages to update the size of our render target and our text layouts.

case WM_SIZE:
{
	if (g_pRT)
		g_pRT->Resize(D2D1::SizeU(LOWORD(lParam), HIWORD(lParam)));
	// For sizing the text layouts, ask the Render Target what his
	// size is instead of using the lParam. Asking the Render Target
	// will automatically bring system DPI into account.
	D2D1_SIZE_F sizeRT = g_pRT->GetSize();
	// Take margin into account.
	sizeRT.height -= 2*g_siMargin;
	sizeRT.width -= 2*g_siMargin;
	if (g_pTextLayout)
	{
		g_pTextLayout->SetMaxWidth(sizeRT.width);
		g_pTextLayout->SetMaxHeight(sizeRT.height);
	}
	if (g_pFancyTextLayout)
	{
		g_pFancyTextLayout->SetMaxWidth(sizeRT.width);
		g_pFancyTextLayout->SetMaxHeight(sizeRT.height);
	}
	if (g_pArabicTextLayout)
	{
		g_pArabicTextLayout->SetMaxWidth(sizeRT.width);
		g_pArabicTextLayout->SetMaxHeight(sizeRT.height);
	}
	break;
}

Hit Testing

DirectWrite also comes with support for hit testing which can be used to create links inside rendered text, to implement caret positioning and to implement highlight selection. The attached example contains sample code for embedding a link inside rendered text. To implement this link, we handle the WM_MOUSEMOVE message to perform hit testing on the text layout using the HitTestPoint function:

BOOL bIsTrailingHit = FALSE;
BOOL bIsInside = FALSE;
DWRITE_HIT_TEST_METRICS hit = {0};
HRESULT hr = g_pTextLayout->HitTestPoint(static_cast<FLOAT>(LOWORD(lParam)-g_siMargin),
	static_cast<FLOAT>(HIWORD(lParam)-g_siMargin), &bIsTrailingHit, &bIsInside, &hit);
if (SUCCEEDED(hr) && bIsInside)
{
	// NOTE: link position is hardcoded for demonstration purposes.
	BOOL bOverLink = (hit.textPosition >= 129 && hit.textPosition < 129+11);
	if (bOverLink != g_bOverLink)
	{
		g_bOverLink = bOverLink;
		// Force a recreate of the textlayouts.
		// NOTE: In a real world application, you should just update the formatting
		// of the parts you need instead of recreating the whole layout. This is
		// now just for demonstration purposes.
		CreateTextLayouts();
		InvalidateRect(hWnd, NULL, TRUE);
		MessageBeep(-1);
	}
}

The CreateTextLayouts function will then apply the proper formatting to the link. When the mouse is hovering the link, it will be rendered in blue and underlined.

DPI Awareness

The DirectWrite API is DPI aware, therefor I recommend you to make your DirectWrite application DPI aware by using a manifest. This can be done by making a file with the following contents:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
	<asmv3:application>
		<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
			<dpiAware>true</dpiAware>
		</asmv3:windowsSettings>
	</asmv3:application>
</assembly>

Save the file as for example DPIAware.manifest. Next, in Visual Studio, go to the properties of your project, then click on “Manifest Tool”, go to “Input and Output” and add the DPIAware.manifest file to the “Additional Manifest Files” setting. When you now recompile your application, you might get the following warning:

DPIAware.manifest : manifest authoring warning 81010002:
	Unrecognized Element "application" in namespace "urn:schemas-microsoft-com:asm.v3".

You can safely ignore this warning. It is just that the manifest tool doesn’t yet recognize it but it will work correctly.

Demo Application

The attached example demonstrates all of the above, including the fancy typographic text, Arabic right-to-left text, linear gradient filled text, active hyperlink using hit testing and rotation. To activate rotation go to the Options menu and click on Rotate. All the text will be rotated around the upper-left corner. Pay special attention to the quality of the rendering during rotation. Everything is rendered using sub-pixel perfect positioning and anti-aliasing resulting in no jumps whatsoever during the rotation. If the same would be implemented in plain GDI which can only position text on pixel boundaries, you will see a lot of jumping of the individual characters making it basically useless for these kind of animations. On the other hand, the results obtained using DirectWrite are very smooth.

A few notes on the attached demo application. The source code contains hard coded character positions and text lengths used for formatting and hit testing. Obviously this should not be hard coded in a production quality application. It is done just for demonstration purposes. The demo also uses a few global variables. Again, this is something you should avoid in production quality code.

Download demo application.

Download demo application source code.

Requirements

The above explanation and the demo application require Windows 7 RC and the latest Windows 7 RC SDK. There were some breaking changes in the Direct2D and DirectWrite APIs between Windows 7 Beta and Windows 7 RC, so an older version of the SDK will not work properly.

If you want to use this latest SDK with Visual Studio 2010 Beta 1, please read the following information: Using the Windows 7 RC SDK in Visual C++ 2010 Beta 1.

Windows 7 is still in development, so is Direct2D and DirectWrite. Keep this in mind as all the documentation of those APIs is still marked as preliminary and subject to changes.

( This article is also posted on CodeGuru. )

基于Java17、SpringBoot、vue3、antdv-next、uniapp等主流技术构建的全场景极速开发平台 MDP内置3个web端、1个移动端 重点解决用户中心、开发者平台、管理后台3个应 MDP-主数据平台,后端项目。专注于单点登录解决方案。内置用户中心、开发者平台、管理后台3个应用。包含:单点登录、Oauth2 登录、用户身份管理、应用申请、应用接入、主数据维护、主数据订阅、主数据广播、应用接口调用、接口管理管理和查看、系统配置等功能。 立即下载

相关推荐

Win7时间修复(时间错误修复文件)

运行方法:解压后运行reg文件即可。 支持的Win7版本: 1. Windows 7 Starter(入门版 / 初级版) 2. Windows 7 Home Basic(家庭普通版) 3. Windows 7 Home Premium(家庭高级版) 4. Windows 7 Professional(专业版) 5. Windows 7 Enterprise(企业版) 6. Windows 7 Ultimate(旗舰版) 7. Windows 7 Professional for Embedded Systems(嵌入式专业版) 8. Windows 7 Ultimate for Embedded Systems(嵌入式旗舰版)

Win10系列:VC++绘制文本

20.7.2小节介绍了如何使用Direct2D在应用窗口中绘制图片,本小节将基于20.7.2小节的项目进一步介绍如何实现文本的绘制。打开D2DBasicAnimation.h头文件,并在D2DBasicAnimation类中添加如下的代码: private:     //声明成员变量textLayout     Microsoft::WRL::ComPtr&lt;IDWriteTextLay...

weixin_34292287的博客 241

YOLO26算法行人行走检测+训练好的模型+102张数据集+pyqt可视化界面.zip

附训练好的 YOLO 权重与 PyQt 可视化检测界面,页面底部含可视化效果预览,毕设/课设开箱即用。 【数据集概况】 · 检测类别(中文):[行走的人(person walking)] 【训练曲线与评估图】 【模型训练配置】 参数 | 值 模型 | yolo26n 训练轮数 | 100 epochs 输入尺寸 | 640x640 批次大小 | 24 优化器 | auto 初始学习率 | 0.01 训练设备 【关键指标汇总】 训练了 67 个 epoch,最终轮指标: 指标 | 数值 mAP50 | **0.8000** mAP50-95 | 0.5620 Precision | 0.5795 Recall | 0.8235 train/box_loss | 0.9538 train/cls_loss | 1.9897 val/box_loss | 0.9034 val/cls_loss | 2.7344 【训练过程分析】 进入训练阶段后,模型一开始的 mAP50 和 mAP50-95 均为 0.8000 和 0.5620,表明在开始阶段模型的收敛情况良好。从第 30 轮起,训练集的 mAP50 值稳定在了 0.8000,这说明模型在这之前能够迅速捕捉到主要目标,但精度提升的余地已然不大。同时,mAP50-95 在训练集上表现略差,从第 50 轮开始慢慢往上走至 0.5620。这反映出模型在检测更小、更远的目标上还存在一定差距,精度成为瓶颈。 随着训练深入,模型在验证集上的表现开始分化。从第 60 轮开始,验证集的 mAP50 和 mAP50-95 值分别为 0.7500 和 0.4500,相比训练集下降明显,表明模型存在一定程度的过拟合现象。训练集上的 box loss 和 cls loss 值分别为 ... 使用场景:毕业设计、课程设计、深度学习入门、工业场景落地验证。

[DX11] Introduction

http://www.cnblogs.com/clayman/archive/2011/10/18/2216889.html The Beauty of DirectX 11 转载于:https://www.cnblogs.com/kylegui/p/3854185.html

weixin_33700350的博客 187

科技中介服务机构想要提升服务效率,需要哪些数智工具支持?.docx

科技中介服务机构想要提升服务效率,需要哪些数智工具支持?

usb 扩容盘检测修复工具源码,编译产物

usb 扩容盘检测修复工具源码,编译产物

基于多元宇宙优化算法的微电网日前经济调度模型研究(Matlab代码实现)

内容概要:文档《Plecs全桥LLC谐振变换器仿真模型.txt》虽以“Plecs全桥LLC谐振变换器仿真模型”为名,实则是一份涵盖电力电子、电力系统、电机控制、新能源并网、微电网优化调度、储能系统、电动汽车调度、无人机路径规划、信号处理、雷达与状态估计等多个技术方向的综合性仿真资源汇编。内容依托Matlab/Simulink、PLECS、PSCAD等主流仿真平台,聚焦于现代优化算法(如粒子群、遗传算法、多目标差分进化、多元宇宙算法等)在能源系统建模、参数优化与控制策略设计中的应用。文档不仅提供了丰富的仿真案例和研究主题,还附带大量可下载的仿真代码、模型及参考文献,构成一个服务于科研与教学的资源集合。; 适合人群:具备电力电子、电力系统、自动化、控制工程或相关专业背景的研究生、科研人员及工程技术人员,尤其适合熟悉Matlab/Simulink、PLECS或PSCAD等仿真工具并从事相关领域研究的人员。; 使用场景及目标:①为电力系统动态分析、微电网能量管理、电机驱动控制、无人机路径规划等课题提供仿真建模思路与实例参考;②学习和复现先进智能优化算法在复杂工程问题(如经济调度、参数辨识、故障诊断)中的实现方法;③获取可用于学术论文撰写、毕业设计或科研项目申报的完整仿真资源与技术支持。; 阅读建议:此文档为典型的资源聚合型文本,建议读者根据自身研究方向有针对性地选择相关章节进行深入研读,优先关注与自己课题契合度高的仿真模型和算法实现,并结合所提供的代码与模型进行实践验证与二次开发,注意区分不同研究主题的边界,避免信息混淆。

政府科技管理者在推动科技成果转化时,如何解决政策对接不精准导致的项目落地难?.docx

政府科技管理者在推动科技成果转化时,如何解决政策对接不精准导致的项目落地难?

隔离型全桥LLC谐振变化器建模及参数设计资料【仿真+设计报告+计算书】

内容概要:本文档系统性地介绍了隔离型全桥LLC谐振变换器的建模、参数设计与控制策略研究,配套提供Simulink闭环仿真模型、详细设计报告及Mathcad计算书等全套技术资料。内容涵盖变频与移相混合控制、谐振参数优化、软启动过程分析、恒压恒流双闭环控制等核心技术,并延伸至2.5kW双向全桥LLC、多相交错LLC等多种典型应用场景。此外,资料还整合了PFC、DAB、CLLC、三电平变换器等相关电力电子拓扑的仿真与控制设计资源,辅以PPT说明、参考文献与程序代码,构建了一个面向科研与工程实践的完整技术解决方案。; 适合人群:具备电力电子与电力系统基础知识,从事新能源变换器、高频开关电源、车载充电机、储能系统等方向研究的研究生、工程师及科研人员。; 使用场景及目标:① 掌握LLC谐振变换器的小信号建模方法与谐振腔参数匹配设计流程;② 学习高频软开关电路的闭环控制策略与稳定性分析方法;③ 借助仿真模型快速验证不同工况下的系统动态性能,支撑科研项目开发、论文撰写与产品原型设计。; 阅读建议:建议结合Mathcad计算书与Simulink仿真模型同步调试,重点剖析谐振元件选型依据、控制环路动态响应特性及闭环系统稳定性判据,强化理论与实践的深度融合,全面提升高频隔离变换器的工程设计能力。

融合UWB和IMU割草机定位EKF研究(Matlab代码实现)

内容概要:本文主要介绍了一个名为“Plecs全桥LLC谐振变换器仿真模型”的技术资源,该资源聚焦于电力电子领域中的LLC谐振变换器建模与仿真,涵盖开环、闭环控制、软启动设计及参数优化等核心内容。文档不仅提供了LLC变换器的详细建模方法与仿真案例,还系统梳理了其在高效电源转换系统中的应用,包括隔离型全桥拓扑结构的设计与性能分析。此外,资源汇总了大量Matlab/Simulink仿真模型及相关科研方向,涉及新能源并网、储能控制、电机驱动等多个前沿领域,全面展示LLC谐振变换器在现代电力系统中的关键技术实现路径。同时,文档附带多种学习资料获取途径,如网盘链接和公众号资源,便于研究人员深入实践与拓展研究。; 适合人群:具备扎实的电力电子、自动控制理论基础,从事新能源发电、开关电源设计、电力系统仿真等相关领域的研究生、工程师及科研人员。; 使用场景及目标:①深入理解LLC谐振变换器的工作原理、建模方法与控制策略;②开展电力电子变换器的仿真验证与参数优化设计;③支撑科研项目、学位论文或工程项目的系统仿真与方案验证; 阅读建议:建议结合所提供的仿真模型与参考文献,使用Plecs或Simulink软件进行动手实践,重点掌握LLC谐振变换器的建模流程、闭环控制设计、软启动机制及参数调试技巧,以全面提升在实际工程中的应用与创新能力。

基于变频控制的多相交错LLC谐振变换器闭环仿真(Simulink仿真实现)

基于变频控制的多相交错LLC谐振变换器闭环仿真(Simulink仿真实现)内容概要:本文主要介绍了基于Plecs的全桥LLC谐振变换器仿真模型,涵盖变频控制下的多相交错LLC谐振变换器闭环仿真、V2G电动汽车ACDC整流与双向CLLC谐振变换器充放电仿真、LLC谐振变换器的开环与闭环软启动设计,以及储能系统中双向Buck-Boost变换器结合模型预测电流控制和电压下垂控制的仿真研究。同时,文档列举了多种电力电子系统与控制策略的Simulink/Plecs仿真案例,涉及三相交错并联Buck变换器、三电平Buck直流变换器、单相Boost PFC电路等,展示了丰富的电力变换器建模与控制技术。此外,还包括参数设计报告、计算书及相关参考文献,适用于从事电力电子、新能源发电、电动汽车充放电系统等领域的研究人员和技术开发人员。; 适合人群:具备电力电子、自动控制理论基础,从事新能源、电动汽车、电力系统等相关领域研究的研发人员、高校研究生及高年级本科生。; 使用场景及目标:① 学习和掌握LLC谐振变换器及其他典型电力电子变换器的工作原理与建模方法;② 实现闭环控制策略如变频控制、软启动、模型预测控制、下垂控制等的仿真验证;③ 支持科研项目、毕业设计或工程开发中的系统仿真与优化设计。; 阅读建议:建议结合文中提供的仿真模型、设计报告与参考文献,逐步搭建并调试相应系统,重点关注控制策略的实现细节与参数整定过程,以深入理解系统动态响应特性与控制性能。

三电平Buck直流变换器双闭环、单闭环、开环仿真【附参考文献】(Simulink仿真实现)

内容概要:本文提供了一套关于三电平Buck直流变换器的Simulink仿真资源,系统地实现了开环、单闭环与双闭环三种控制模式的建模与仿真,并附有参考文献支持。资源重点展示了不同控制策略下变换器在动态响应、稳定性和抗干扰能力方面的性能差异,尤其突出了双闭环控制在提升系统响应速度、抑制负载扰动和增强电压调节精度方面的显著优势。通过对比分析三种控制结构的仿真结果,帮助使用者深入理解反馈控制机制对电力电子系统性能的影响,适用于高精度电源管理和新能源系统等对电能质量要求较高的应用场景。; 适合人群:电力电子、自动化、电气工程等相关专业的本科生、研究生及科研人员,以及从事开关电源设计、新能源变换器开发、工业电源系统优化等方向的工程技术人员。; 使用场景及目标:①学习三电平Buck变换器的工作原理及其建模方法;②掌握电压模式控制与电流模式控制的基本设计思路;③对比分析开环、单闭环与双闭环控制系统的动态与稳态性能;④开展电力电子变换器控制器的设计、优化与验证,支撑课程实验、毕业设计或科研项目中的控制系统研究。; 阅读建议:建议结合提供的Simulink仿真模型与参考文献进行同步学习,动手搭建并调试不同控制结构,观察输出电压、电感电流等关键波形的变化,深入理解PI参数调节、反馈环路设计对系统性能的影响,从而全面提升对现代电力电子控制系统的设计与分析能力。

独立储能的现货电能量与调频辅助服务市场出清协调机制(Matlab代码实现)

内容概要:本文标题为“Plecs全桥LLC谐振变换器仿真模型”,但实际内容严重偏离主题,文档中混杂了大量来自优快云博客平台的无关信息,涵盖多个不同领域的Matlab/Simulink仿真项目,如电力系统优化、无人机路径规划、机器学习预测、微电网调度、卡尔曼滤波、无线能量传输等,导致核心内容缺失。文档未能提供关于Plecs平台下全桥LLC谐振变换器的建模方法、电路结构、参数设计、控制策略或仿真结果等关键技术细节,实质信息与标题完全不符,不具备作为该主题参考资料的有效性。; 适合人群:从事电力电子变换器研究、电源系统设计及相关领域的工程师、高校研究生与科研人员,尤其是希望掌握LLC谐振变换器建模与仿真的专业技术人员。; 使用场景及目标:① 学习并掌握全桥LLC谐振变换器的工作原理与Plecs仿真建模技术;② 开展高效电源转换器的研发与性能优化;③ 作为教学或科研项目中电力电子电路仿真的参考资料。; 阅读建议:鉴于文档内容与标题严重不符,建议读者谨慎甄别,优先选择专业书籍、学术论文或官方仿真软件教程等权威资源进行学习,避免被无效信息误导。

上一篇: Direct2D中的DirectWrite
下一篇: MFC子窗口和父窗口(SetParent,SetOwner)
Augusdi
博客等级 码龄19年 1万+粉丝 1016原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值