Lempel-Ziv Algorithm's Implementation

博客提供了简单LZ77算法的C代码资源,包含了相关的.c和.h文件的链接,分别为http://www.lrdev.com/lr/c/simple-lz77.c和http://www.lrdev.com/lr/c/simple-lz77.h,可用于信息技术领域的开发。

http://www.lrdev.com/lr/c/simple-lz77.c

http://www.lrdev.com/lr/c/simple-lz77.h

/* simple-lz77.c -- Simple LZ77 (Ziv-Lempel) encoding [compression] with
** fixed offset/legth sizes [fixed size window of 4096 {2**12} bytes,
** match lengths of 15 {2**4-1} bytes] and alternating pointers into the
** window dictionary and new symbols [characters].
** The implementation is not optimized for speed [but for simplicity of
** code and data structures].
**
** Copyright (C) 1992,2004 Eric Laroche.  All rights reserved.
**
** @author Eric Laroche <laroche@lrdev.com>, www.lrdev.com
** @version @(#)$Id: simple-lz77.c,v 1.1 2004/05/06 13:27:28 laroche Exp $
**
** Patents may apply to algorithms implemented by this code;
** you need to ensure that your use of such algorithms is legal.
**
** This program is free software;
** you can redistribute it and/or modify it.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**
*/


/* [implemented interface] */
#include "simple-lz77.h"


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <assert.h>


/** OFFSETBITS+LENGTHBITS.
* POINTERBITS%8 must be 0 to have the encoding output byte-aligned.
*/
#define POINTERBITS 16

/** Number of bits used in encoding offsets into the dictionary window.
* The window size will be 1<<OFFSETBITS.
* Since OFFSETBITS+LENGTHBITS==POINTERBITS [to have byte-aligned bits] and
* LENGTHBITS<=OFFSETBITS [larger strings than window size can't be found
* {if lookahead-self-referencing matches are not considered}] and
* LENGTHBITS>=2 [very short matches don't compress], OFFSETBITS ranges
* from 8 to 14.
*/
#define OFFSETBITS 12

/** Number of bits used to encode lengths of string matches.
* OFFSETBITS+LENGTHBITS are a multiple of 8 to have byte-aligned bits.
*/
#define LENGTHBITS (POINTERBITS - OFFSETBITS)  /* 4 */

#define WINDOWSIZE (1 << OFFSETBITS)  /* 4096 */
#define LOOKAHEADSIZE ((1 << LENGTHBITS) - 1)  /* 15 */
#define POINTERBYTES (POINTERBITS / 8)  /* 2 */


/* typedef struct lz77_st lz77; */

/** A simple Ziv-Lempel 77 dictionary.
*/
struct lz77_st
{
	/** Dictionary window.
	*/
	char window[WINDOWSIZE];
};


/* [local functions] */
static void decodeByDictionary(lz77*, char const*, int, int*, char*, int, int*);
static void encodeByDictionary(lz77*, char const*, int, int*, char*, int, int*);
static int fillBuffer(char*, int, FILE*);
static void findLargest(char const*, int, char const*, int, int*, int*);
static int gcd(int, int);
static int matchLength(char const*, int, char const*, int);
static int maxDictionaryDecodingIn(void);
static int maxDictionaryDecodingOut(void);
static int maxDictionaryEncodingIn(void);
static int maxDictionaryEncodingOut(void);
static void* memrot(void*, int, int);
static int putN(char const*, int, FILE*);
static void updateDictionary(lz77*, char const*, int);


/** Get a lz77 encoder.
* Initiates encoder's state (its dictionary).
* Returns NULL if memory allocation failed.
*/
lz77* lz77_new(void)
{
	lz77* p;

	p = (lz77*)malloc(sizeof(*p));
	if (p == NULL) {
		return NULL;
	}

	assert(WINDOWSIZE > 0);

	/* initialize {en/de}coder/dictionary state */
	memset(p->window, 0, WINDOWSIZE);  /* zeroed dictionary */

	return p;
}


/** Dispose a lz77 encoder.
*/
void lz77_delete(lz77* p)
{
	if (p == NULL) {  /* NULL is ok as argument */
		return;
	}

	free(p);
}


/** Encode a file stream with a lz77 encoder.
* Does not initiate encoder's state (its dictionary).
*/
void lz77_encode(lz77* p, FILE* in, FILE* out)
{
	int bufferSize, bufferLength, consumed, produced, n;
	char* lookAheadBuffer;
	char outBuffer[2];

	/* have one spare byte besides the look-ahead, for the symbol */
	bufferSize = maxDictionaryEncodingIn() + 1;  /* 15+1 */

	lookAheadBuffer = (char*)malloc(bufferSize);
	if (lookAheadBuffer == NULL) {
		return;
	}

	assert(sizeof(outBuffer) >= maxDictionaryEncodingOut());
	assert(sizeof(outBuffer) == POINTERBYTES);

	bufferLength = 0;

	/* encode */
	for (;;) {

		assert(bufferSize - bufferLength >= 0);

		/* Try to fill the look-ahead buffer.
		* Note: this will check for end-of-input-file-stream more than once.
		*/
		bufferLength += fillBuffer(
			&lookAheadBuffer[bufferLength],
			bufferSize - bufferLength,
			in);

		assert(bufferLength >= 0);
		assert(bufferLength <= bufferSize);

		/* check if all input is done */
		if (bufferLength == 0) {  /* fillBuffer above only caught EOF */
			break;
		}

		/* encode and output pointers */

		consumed = 0;
		produced = 0;
		encodeByDictionary(
			p,
			lookAheadBuffer,
			bufferLength - 1,  /* spare one for the new symbol */
			&consumed,
			outBuffer,
			sizeof(outBuffer),
			&produced);

		assert(consumed >= 0);
		assert(consumed < bufferLength);
		assert(produced == POINTERBYTES);
		assert(POINTERBYTES == 2);

		n = putN(outBuffer, 2, out);
		if (n < 2) {  /* output error */
			break;
		}

		/* update dictionary */
		updateDictionary(p, lookAheadBuffer, consumed);

		assert(bufferLength - consumed >= 0);

		memmove(lookAheadBuffer, &lookAheadBuffer[consumed], bufferLength - consumed);
		bufferLength -= consumed;

		/* output new-symbol */

		assert(bufferLength >= 1);

		n = putN(lookAheadBuffer, 1, out);
		if (n < 1) {  /* output error */
			break;
		}

		/* update dictionary */
		updateDictionary(p, lookAheadBuffer, 1);

		memmove(lookAheadBuffer, &lookAheadBuffer[1], bufferLength - 1);
		bufferLength--;
	}

	free(lookAheadBuffer);
}


/** Try to fill a buffer.
*/
static int fillBuffer(char* buffer, int size, FILE* in)
{
	int i;
	int c;

	assert(buffer != NULL);
	assert(size >= 0);
	assert(in != NULL);

	i = 0;
	while (i < size) {

		c = getc(in);
		if (c == EOF) {
			break;
		}

		buffer[i++] = (char)c;
	}

	return i;
}


/** Try to write a buffer.
*/
static int putN(char const* buffer, int size, FILE* out)
{
	int i;
	int s;

	assert(buffer != NULL);
	assert(size >= 0);
	assert(out != NULL);

	i = 0;
	while (i < size) {

		s = putc(buffer[i], out);
		if (s == EOF) {  /* output error */
			break;
		}

		i++;
	}

	return i;
}


/** Decode a file stream with a lz77 decoder.
* Does not initiate decoder's state (its dictionary).
*/
void lz77_decode(lz77* p, FILE* in, FILE* out)
{
	int bufferSize, n, consumed, produced;
	char* decodeBuffer;
	char inBuffer[2];
	char cc;

	bufferSize = maxDictionaryDecodingOut();  /* 15 */

	decodeBuffer = (char*)malloc(bufferSize);
	if (decodeBuffer == NULL) {
		return;
	}

	assert(sizeof(inBuffer) >= maxDictionaryDecodingIn());
	assert(sizeof(inBuffer) == POINTERBYTES);

	/* decode */
	for (;;) {

		/* fill in-buffer */
		n = fillBuffer(inBuffer, 2, in);
		if (n == 0) {  /* done */
			break;
		}

		if (n < 2) {  /* done at an unexpected position -- partial pointer */
			break;
		}

		/* decode and output */

		consumed = 0;
		produced = 0;
		decodeByDictionary(
			p,
			inBuffer,
			POINTERBYTES,
			&consumed,
			decodeBuffer,
			bufferSize,
			&produced);

		assert(consumed == POINTERBYTES);
		assert(POINTERBYTES == 2);
		assert(produced >= 0);
		assert(produced <= bufferSize);

		n = putN(decodeBuffer, produced, out);
		if (n < produced) {  /* output error */
			break;
		}

		/* update dictionary */
		updateDictionary(p, decodeBuffer, produced);

		/* output new-symbol */

		n = fillBuffer(&cc, 1, in);
		if (n == 0) {  /* done at an unexpected position -- missing last new symbol */
			break;
		}

		n = putN(&cc, 1, out);
		if (n == 0) {  /* output error */
			break;
		}

		/* update dictionary */
		updateDictionary(p, &cc, 1);
	}

	free(decodeBuffer);
}


/** Maximal input size that can be encoded by dictionary, in bytes, not
* depending on [current] dictionary state.
*/
static int maxDictionaryEncodingIn(void)
{
	/* Note: we do not consider current dictionary state, e.g. adjust
	* for current dictionary length [possibly smaller than size], etc.
	*/

	assert(LOOKAHEADSIZE > 0);

	/* 15 bytes (2**4-1, where 4 is the number of bits in length encoding) */
	return LOOKAHEADSIZE;
}


/** Maximal output size in encoding by-dictionary, in bytes, not
* depending on [current] dictionary state.
*/
static int maxDictionaryEncodingOut(void)
{
	assert(POINTERBYTES > 0);

	/* 12 bits dictionary offset encoding, 4 bits length encoding */
	return POINTERBYTES;  /* 2 */
}


/** Encode by-dictionary.
* Note: LZ77 won't encode anything by-dictionary if no match is found
* [in which case inUsed will be 0 and outUsed 2]; this requires
* additional encoding steps, e.g. sending plain symbols [either
* alternating with dictionary encoding or as an alternative].
* Note: inSize=0 is explicitly allowed, to allow zero/non-match encoding
* possibly needed by encoder to spare a last byte as new symbol output.
*/
static void encodeByDictionary(
	lz77* p,
	char const* in,  /* input */
	int inSize,  /* input size, in bytes */
	int* inUsed,  /* returns the number of input bytes consumed after coding */
	char* out,  /* output buffer */
	int outSize,  /* output buffer size, bytes */
	int* outUsed  /* returns the number of output bytes generated by coding */
)
{
	int offset, length;

	assert(inUsed != NULL);
	assert(outUsed != NULL);

	*inUsed = 0;
	*outUsed = 0;

	assert(LOOKAHEADSIZE > 0);

	/* can't encode more than LOOKAHEADSIZE */
	if (inSize > LOOKAHEADSIZE) {
		inSize = LOOKAHEADSIZE;
	}

	/* [already check here that we'll be able to code this length later] */
	assert(inSize < (1 << LENGTHBITS));

	assert(POINTERBYTES > 0);
	assert(outSize >= POINTERBYTES);

	/* [sanity check] */
	if (outSize < POINTERBYTES) {
		return;
	}

	assert(p != NULL);

	/* search for a convenient substring in the window */
	offset = 0;
	length = 0;
	findLargest(in, inSize, p->window, WINDOWSIZE, &offset, &length);

	*inUsed = length;
	*outUsed = POINTERBYTES;

	if (length == 0) {
		offset = 0;  /* [should already be so] */
	}

	assert(POINTERBITS == 2 * 8);
	assert(POINTERBYTES == 2);
	assert(OFFSETBITS + LENGTHBITS == POINTERBITS);
	assert(OFFSETBITS - 8 >= 0);
	assert(LENGTHBITS >= 0);

	assert(offset >= 0);
	assert(offset < (1 << OFFSETBITS));
	assert(length >= 0);
	assert(length < (1 << LENGTHBITS));

	assert(out != NULL);

	/* encode offset and length */
	out[0] = (char)(offset >> (OFFSETBITS - 8));  /* high order offset */
	out[1] = (char)((offset << LENGTHBITS) | length);  /* low order offset and length */
}


/** Greedy search for largest substring [from beginning of string] in a
* window.
* Search forward and start at relative offset 0.
* Note: size may be 0.
*/
static void findLargest(
	char const* s,
	int size,
	char const* window,
	int windowSize,
	int* offset,
	int* length
)
{
	int r, m;

	assert(length != NULL);
	assert(offset != NULL);

	*length = 0;  /* maximal match length so far */
	*offset = 0;  /* match offset associated to length */

	for (r = 0; r < windowSize; r++) {  /* offset */
		m = matchLength(&window[r], windowSize - r, s, size);  /* [not considering the window as circular] */
		if (m > *length) {  /* prefer earlier matches [i.e. further from current position in this case] */
			*length = m;
			*offset = r;
		}
	}

	assert((*length == 0 && *offset == 0) || *length != 0);
}


/** Return length of a possible match.
* Note: the lengths may be zero.
*/
static int matchLength(char const* a, int an, char const* b, int bn)
{
	int n;

	assert(a != NULL);
	assert(b != NULL);

	n = 0;  /* match length */
	while (an-- > 0 && bn-- > 0 && *a++ == *b++) {
		n++;
	}

	return n;
}


/** Maximal input size that can be decoded by dictionary, in bytes, not
* depending on [current] dictionary state.
*/
static int maxDictionaryDecodingIn(void)
{
	/* decode-in size is the same as encode-out */
	return maxDictionaryEncodingOut();
}


/** Maximal output size in decoding by-dictionary, in bytes, not
* depending on [current] dictionary state.
*/
static int maxDictionaryDecodingOut(void)
{
	/* decode-out size is the same as encode-in */
	return maxDictionaryEncodingIn();
}


/** Decode by-dictionary.
*/
static void decodeByDictionary(
	lz77* p,
	char const* in,  /* input */
	int inSize,  /* input size, in bytes */
	int* inUsed,  /* returns the number of input bytes consumed after coding */
	char* out,  /* output buffer */
	int outSize,  /* output buffer size, bytes */
	int* outUsed  /* returns the number of output bytes generated by coding */
)
{
	int offset, length;

	assert(inUsed != NULL);
	assert(outUsed != NULL);

	*inUsed = 0;
	*outUsed = 0;

	assert(POINTERBITS == 2 * 8);
	assert(POINTERBYTES == 2);
	assert(OFFSETBITS + LENGTHBITS == POINTERBITS);
	assert(OFFSETBITS - 8 >= 0);
	assert(LENGTHBITS >= 0);
	assert(8 - LENGTHBITS >= 0);

	assert(in != NULL);

	assert(POINTERBYTES > 0);
	assert(inSize >= POINTERBYTES);

	/* [sanity check] */
	if (inSize < POINTERBYTES) {
		return;
	}

	/* decode offset and length */
	offset =
		((unsigned char)in[0] << (OFFSETBITS - 8)) |
		((unsigned char)in[1] >> LENGTHBITS);
	length = in[1] & ((unsigned char)0xff >> (8 - LENGTHBITS));

	assert(offset >= 0);
	assert(offset < (1 << OFFSETBITS));
	assert(length >= 0);
	assert(length < (1 << LENGTHBITS));

	assert(out != NULL);

	assert(outSize >= length);

	/* [sanity check] */
	if (outSize < length) {
		return;
	}

	assert(p != NULL);

	memmove(out, &p->window[offset], length);

	*inUsed = POINTERBYTES;
	*outUsed = length;
}


/** Update dictionary [model] with [some] input.
* Typically called after codeing, with inSize being equal to that inUsed.
*/
static void updateDictionary(
	lz77* p,
	char const* in,  /* input considered for model update, may not overlap with p->window */
	int inSize  /* size, bytes */
)
{
	/* Update dictionary [model] with [some] input. */

	assert(inSize >= 0);
	assert(in != NULL);

	assert(p != NULL);

	if (inSize >= WINDOWSIZE) {  /* new data fills whole window, old data [and possibly some new data] is discarded */
		assert(inSize - WINDOWSIZE >= 0);
		memmove(p->window, &in[inSize - WINDOWSIZE], WINDOWSIZE);
	} else if (inSize > 0) {  /* some old data needs to be discarded */
		/* Note: in order to support overlapping window and in,
		* we move in to the beginning of window first and then
		* rotate the window.
		*/
		assert(inSize <= WINDOWSIZE);
		memmove(p->window, in, inSize);
		memrot(p->window, WINDOWSIZE, inSize);
	}  /* else: inSize==0: nothing to do */
}


/** Rotate a memory buffer of specified size by n bytes to the left.
* Right-rotation is achieved by rotating it size-n.
* Element size can be a divisor of gcd(size,n).
*/
static void* memrot(void* p, int size, int n)
{
	int rounds;
	char *q, *e;

	if (size == 0) {  /* nothing to do; %size below would fail */
		return p;
	}

	n %= size;  /* adjust n to be 0<=n<size */
	if (n < 0) {  /* consider a possible negative n */
		n += size;
	}

	if (n == 0) {  /* nothing to do; rounds below would be large */
		return p;
	}

	q = (char*)p;  /* starting point for a round */
	e = q + size;  /* end of buffer, to wrap-adjust */
	rounds = gcd(size, n);  /* number of rounds needed to move memory */

	for (; rounds > 0; q++, rounds--) {
		char* r = q;
		char c = *r;  /* the one temporary location needed for moving the whole buffer */
		for (;;) {

			char* s = r + n;  /* next location to be moved */
			if (s >= e) {  /* consider wrap */
				s -= size;
			}

			if (s == q) {
				break;  /* done */
			}

			*r = *s;  /* move */
			r = s;  /* next */
		}
		*r = c;
	}

	return p;
}


/** Greatest common divisor of two integers.
* gcd(a,b) == gcd(b,a), gcd(a,0) == a.
*/
static int gcd(int a, int b)
{
	/* it is more convenient to have a>b
	* [otherwise the first remainder calculation just swaps them]
	*/

	while (b != 0) {
		int c = a % b;
		a = b;
		b = c;
	}

	return a;
}
Following is Header File:
/* simple-lz77.h -- Simple LZ77 (Ziv-Lempel) encoding [compression] with
** fixed offset/legth sizes [fixed size window of 4096 {2**12} bytes,
** match lengths of 15 {2**4-1} bytes] and alternating pointers into the
** window dictionary and new symbols [characters].
** The implementation is not optimized for speed [but for simplicity of
** code and data structures].
**
** Copyright (C) 1992,2004 Eric Laroche.  All rights reserved.
**
** @author Eric Laroche <laroche@lrdev.com>, www.lrdev.com
** @version @(#)$Id: simple-lz77.h,v 1.1 2004/05/06 13:27:28 laroche Exp $
**
** Patents may apply to algorithms implemented by this code;
** you need to ensure that your use of such algorithms is legal.
**
** This program is free software;
** you can redistribute it and/or modify it.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**
*/


#ifndef SIMPLE_LZ77_H  /* multiple inclusion guard */
#define SIMPLE_LZ77_H


#include <stdio.h>  /* needed for FILE* */


/* opaque type, externally only used as pointer */
typedef struct lz77_st lz77;


/** Get a lz77 encoder.
* Initiates encoder's state (its dictionary).
* Returns NULL if memory allocation failed.
*/
lz77* lz77_new(void);


/** Dispose a lz77 encoder.
*/
void lz77_delete(lz77* p);


/** Encode a file stream with a lz77 encoder.
* Does not initiate encoder's state (its dictionary).
*/
void lz77_encode(lz77* p, FILE* in, FILE* out);


/** Decode a file stream with a lz77 decoder.
* Does not initiate decoder's state (its dictionary).
*/
void lz77_decode(lz77* p, FILE* in, FILE* out);


#endif

源码下载地址: https://pan.quark.cn/s/a4b39357ea24 在电磁模拟技术中,CST(Computer Simulation Technology)是一种被广泛采纳的软件工具,它主要用于电磁场、微波、天线以及射频系统的设计工作。本资料将详细分析CST软件中离散端口的具体配置方法,这些方法对于提升仿真结果的精确度和专业水准具有决定性作用。离散端口在CST软件中扮演着模拟信号输入或输出的重要角色,它们构成了仿真模型不可或缺的部分。在配置离散端口时,一个核心的原则是保证端口的方向与网格线保持一致,这是因为这样做能够有效降低计算过程中产生的误差,并确保仿真数据的有效性。如果未能遵循这一指导原则,可能会引发未知的计算问题,进而导致仿真结果失去可靠性。 在CST软件中配置离散端口,通常需要借助“Pick Points”这一功能。通过选择“Pick Edge Center”选项,端口将被设定在模型边缘的中心位置上。然而,这种做法并不总是能够确保端口与网格线保持平行。在某些特定情形下,模型的几何构造可能不允许直接选取一个与网格线平行的边作为端口的安装位置。 为了克服这一挑战,可以采用多种不同的策略。如果模型本身已经包含一条与馈电口平行的边,那么可以直接利用这条边来建立端口,此时CST软件会自动调整端口使其与网格线对齐。另一种可选的方法是,当模型不具备现成的平行边时,用户可以手动构建一个几何结构,比如一个立方体,并使其边缘与馈电口平行。通过这种方式,新建立的几何结构的边缘就可以作为端口的位置,从而确保端口与网格线的平行关系。 在实施上述操作时,必须关注端口尺寸的合理性和物理意义的一致性。端口的尺寸应当依据实际天线馈电部分的尺寸进行适当调整,过大的端口或...
代码下载链接: https://pan.quark.cn/s/a4b39357ea24 【使用TensorFlow进行图像识别】 图像识别作为计算机视觉领域的关键任务之一,其核心在于通过算法解析和理解图像所包含的信息。在此资源中,我们将集中探讨如何借助功能强大的深度学习框架TensorFlow来执行手写数字识别。手写数字识别构成了众多实际应用的基础,例如自动支票处理、光学字符识别(OCR)等场景。 TensorFlow是由Google创建的一个开源库,它主要用于数值运算和机器学习,尤其在深度学习方面表现卓越。其核心优势在于可以构建并训练复杂的神经网络架构,并且在多种硬件环境中实现高效执行,涵盖CPU和GPU平台。 在此实践项目中,我们将运用TensorFlow来构建一个卷积神经网络(CNN)模型,这种架构是处理图像数据的理想选择。CNNs通过模仿人脑视觉皮层的运作机制,能够自主地提取图像中的关键特征,进而达成识别目标。在手写数字识别的特定情境下,这些特征可能涉及笔画的几何形态、走向以及相互间的连接模式。 对于CNN的基础结构,我们需要具备相应的认知,其通常由卷积层、池化层、全连接层以及激活函数等部分组成。卷积层借助滤波器(亦称卷积核)对图像进行扫描,以捕捉局部特征;池化层则用于降低数据维度,同时保留核心信息;全连接层将特征向量映射至各类别的概率分布;而激活函数如ReLU则通过引入非线性元素,使模型能够学习更为复杂的模式。 在此案例中,建议采用MNIST数据集,这是一个广泛用于手写数字识别的标准测试集。该数据集包含60,000个训练样本和10,000个测试样本,每个样本均为28x28像素的灰度图像,代表0到9这十个数字中的某一个。为了训练模型,必须首先加载数据,并...
代码转载自:https://pan.quark.cn/s/a4b39357ea24 《建伍TM-481车台中文使用说明书》提供了详尽的说明 建伍TM-481是一款专门为车载通信目的而研发的专业对讲机,其在无线电通信领域具有普遍的应用。该设备凭借其优异的性能、可靠的品质以及便捷的操作,赢得了业余无线电发烧友和专业使用者的青睐。接下来我们将深入分析TM-481的核心特性与操作方法。 一、产品概述 建伍TM-481车台具备紧凑的结构,能够适应各种车辆安装条件。它拥有宽频带覆盖功能,支持多种通信方式,包括模拟FM、数字FDMA等,能够应对不同环境下的通信需求。同时,TM-481还拥有出色的抗干扰性能,保障在复杂的电磁环境下也能进行稳定通信。 二、功能特性 1. 多频段支持:TM-481覆盖了多个UHF频段,可以实现VHF和UHF之间的转换,适合不同的通信范围。 2. 数字与模拟兼容性:除了常规的模拟通信,TM-481还支持数字通信方式,提供更清晰的语音传输效果和更优化的信道利用效率。 3. 高效的扫描功能:内置多种扫描模式,例如频率扫描、记忆扫描等,能够迅速定位可用的频道。 4. 自动电平控制(ALC):保证发射功率的稳定,避免过强信号对其他用户造成干扰。 5. 紧急报警系统:配备紧急报警装置,可以在紧急情况下迅速向其他用户发出警示。 6. 高亮度显示屏:采用大尺寸屏幕显示,即使在强光照射下也能清楚查看信息。 三、操作指南 1. 安装与连接:将TM-481固定在车内合适的部位,连接电源线、天线及麦克风,确保所有连接点正确且牢固。 2. 频道设置:通过菜单界面或直接按键设定所需的通信频道,可以保存在内存中以便随时调用。 3. 通信模式选择:依据需求在模拟和数字模式之间...
代码转载自:https://pan.quark.cn/s/dfe8a2c7bf25 Qt被视为一个跨平台的C++图形用户界面应用程序框架,它为应用程序开发者提供了构建艺术级图形用户界面所需的所有功能。Qt最初是在1991年由奇趣科技创建的,随后在1996年进入商业化运作。得益于其完全面向对象的特性,Qt展现出高度的扩展性,并且支持真正的组件化编程。当前,Qt能够支持多种操作系统平台,涵盖了Windows系列、UNIX/X11系列(包括Linux、SunSolaris等)、Macintosh以及嵌入式平台。依据授权模式的不同,Qt被划分为商业版和开源版。商业版为商业软件的开发提供了环境支持,同时包含了免费升级服务和技术支持,而开源版则是在GNU通用公共许可证下提供的免费开放源码软件。 在Qt的开发与实例部分,阐述了如何安装Qt及其开发环境,并通过一个计算圆面积的实例来演示Qt的开发流程,以此帮助读者对GUI应用程序开发形成初步认识。Qt的跨平台特性允许开发者在多种操作系统上编写和构建应用程序,而Qt Creator是Qt提供的集成开发环境(IDE),它整合了代码编辑器、调试器、分析工具等多种开发工具。 Qt还引入了信号和槽机制,这是一种用于事件管理的机制,使得开发者能够通过信号(Signal)和槽(Slot)来关联对象,一旦信号被触发,相应的槽函数便会执行。这种机制在开发图形用户界面程序时显得尤为重要,比如,当用户点击一个按钮时可以触发一个信号,该信号可以连接到一个槽函数来执行点击后的相应操作。 Qt Creator的界面得到了详尽的描述,涵盖了各种常用的窗口和面板。通过本书提供的源代码,读者可以开展实践操作,从而更深入地理解Qt的应用程序开发流程。源代码中包...
内容概要:本文档围绕“光伏并网逆变器序阻抗建模、扫频辨识与弱电网交互稳定性分析”展开,提供基于Matlab和Simulink的完整代码与仿真模型,复现了相关博士论文的核心研究成果。内容聚焦于新能源发电系统接入弱电网时的稳定性问题,系统阐述了光伏逆变器的正负序阻抗建模方法、小信号扫频辨识技术、锁相环与电流环的动态耦合效应、LCL滤波器的作用机制以及系统宽频带振荡的失稳机理。通过构建精确的序阻抗模型并结合扫频法进行稳定性判据分析,深入揭示并网逆变器与弱电网间的交互特性,为实际工程中振荡问题的预测、诊断与抑制提供坚实的理论支撑与有效的技术路径。; 适合人群:具备电力电子、自动控制理论及新能源发电系统基础知识,正在从事相关领域研究的硕士/博士研究生、高校科研人员以及电力系统行业的工程师。; 使用场景及目标:①复现并验证博士论文中关于光伏逆变器序阻抗建模与弱电网交互稳定性的关键结论;②作为科研项目或学位论文的技术蓝本,开展弱电网环境下并网系统稳定性仿真与机理研究;③深入掌握Matlab/Simulink在电力系统小信号稳定性分析、特别是阻抗建模与扫频法应用方面的高级仿真技能。; 阅读建议:学习者应结合所提供的Matlab代码与Simulink仿真模型,亲手运行并调试扫频辨识程序,细致分析序阻抗建模的每一步推导与实现过程,重点关注锁相环动态特性对系统稳定裕度的影响,通过调整控制器参数与电网强度观察系统响应变化,从而深刻理解交互失稳的内在机理,实现从理论到实践的融会贯通。
下载代码方式:https://pan.quark.cn/s/26e9fe14ad1e 在Android应用设计过程中,`SwitchButton`(亦称作开关控件或切换控件)是一种常用的界面组件,它允许用户在两种不同的状态之间进行选择。 这种控件通常以滑动开关的形式呈现,用户可以通过滑动操作来改变其状态,例如开启或关闭某个特定的功能。 本文将深入探讨`SwitchButton`的多种实现途径,以及如何通过自定义`CompoundButton`来满足个性化的需求。 `SwitchButton`作为Android软件开发工具包(SDK)的一部分,属于`CompoundButton`类的一个子类。 `CompoundButton`是`CheckBox`和`RadioButton`的父级,它提供了一种可以包含文本和图像的复选或单选按钮的功能。 `SwitchButton`的默认外观和行为可以通过XML布局文件进行直接设置,例如可以设定开关的颜色、大小、文字等属性。 在XML文件中,开发者可以使用`<android.widget.Switch>`标签来构建一个开关按钮,并且通过`android:textOn`和`android:textOff`属性来设定开关开启和关闭时显示的文字内容。 然而,在某些情况下,开发者可能需要更具个性化的开关样式或功能,这时就需要对`CompoundButton`进行定制。 在提供的文件`CompoundButtonView`中,展示了一个自定义控件的使用范例,这个自定义控件可能扩展了`CompoundButton`类,以便增加额外的属性或调整原有的行为。 自定义控件的开发通常包括以下几个步骤: 1. 建立一个新的Java类,该类应继承自`CompoundB...
内容概要:本文档由一支专业的科研辅导团队整理,系统汇集了多个前沿科研领域的仿真项目资源,涵盖智能优化算法、机器学习与深度学习、图像处理、路径规划、无人机应用、通信技术、信号处理、电力系统管理、元胞自动机模拟、雷达追踪及车间调度等方向。资源以Matlab/Simulink/Python为主要实现工具,提供了大量高水平期刊论文(如IEEE、EI、顶刊)的复现代码与仿真模型,典型案例包括风光储与电解制氢系统仿真、微电网优化调度、无人机三维路径规划、轴承故障诊断、电力系统稳定性分析等。文档倡导科研工作中“借力”成熟代码以提升效率,强调在扎实掌握算法原理基础上实现创新突破。所有资源可通过指定公众号或百度网盘获取。; 适合人群:具备一定编程基础和科研背景的硕士、博士研究生、高校教师及企业研发人员,尤其适合从事电气工程、自动化、控制科学、计算机应用、新能源系统等相关领域的科研工作者。; 使用场景及目标:① 快速复现高水平期刊论文中的算法与模型,加速科研进程;② 获取实际科研项目中的仿真代码和技术方案作为研究参考;③ 提升在优化调度、智能控制、信号处理、能源系统等方向的研究效率与创新能力,助力论文撰写与课题攻关。; 阅读建议:建议读者按照目录结构系统浏览,优先选择与自身研究方向匹配的内容进行深入学习和代码实践,充分利用提供的复现资源降低科研门槛,同时注重理解算法原理与应用场景,避免仅停留在代码使用层面。
内容概要:本文围绕网型T型三电平逆变器的低电压穿越(LVRT)能力及综合控制策略开展深入的仿真研究,重点探讨了在电网故障等恶劣工况下逆变器的稳定运行控制方法。研究系统性地整合了改进电流环控制、中点电位平衡控制等核心技术,通过Matlab/Simulink平台搭建高保真度的系统仿真模型,对控制策略的有效性进行了全面的验证与分析。该研究不仅关注算法层面的创新,更强调理论分析与工程实践的紧密结合,旨在提升三电平逆变器在弱电网环境下的动态响应性能、故障穿越能力与运行稳定性,是电力电子与新能源并网技术领域的一项重要实践。; 适合人群:具备电力电子、自动控制、电气工程或新能源等相关专业背景,熟悉Simulink仿真工具,从事科研或工程开发1-3年的研究生及研发人员。; 使用场景及目标:①深入掌握三电平逆变器在低电压穿越过程中的综合控制策略设计原理与实现方法;②学习并实践改进电流环与中点电位平衡控制等关键技术的具体应用路径;③通过动手搭建和调试Simulink仿真模型,深刻理解并网逆变器在电网故障等动态工况下的非线性行为与调控机制,提升解决复杂工程问题的能力。; 阅读建议:建议读者在学习过程中,务必结合文中所述的控制算法与Simulink仿真模型进行同步实操,通过边仿真、边调试、边分析的方式,重点关注控制器参数的整定过程、关键信号的波形变化及其物理意义,从而深化对控制逻辑的理解,达到理论与实践融会贯通的学习效果。
代码转载自:https://pan.quark.cn/s/a4b39357ea24 在研究计算机系统中字体大小、磅数与实际尺寸的关联时,我们应当首先明确这些术语的基本定义以及它们之间的相互转换方式。这份文档中包含了一张详尽的字体大小、磅数与尺寸的对应参考表,对于从事设计、排版以及任何与文本呈现相关的任务来说,具有极高的参考价值。通过细致研究这张参考表,可以更加深入地理解字体大小与磅数之间的内在联系。 ### 字体大小、磅数与尺寸的定义 - **字体大小**:在中国传统的排版环境中,字体大小通常指汉字的等级划分,例如初号、小初号、一号等,这些等级代表了不同层级的文字尺寸。 - **磅(pt)**:磅作为国际通用的度量单位,广泛应用于印刷和电子文档中用于衡量字体的大小,其中1磅大约等于0.35毫米,磅数越高则字体显得越大。 - **尺寸(mm)**:尺寸采用毫米作为计量单位,能够直观地展示字体的实际物理大小,从而便于进行尺寸上的比较分析。 ### 字体大小与磅数的对应关系 通过查阅提供的表格,我们可以看到从“大特号”至“八号”的一系列字体大小,以及它们各自对应的磅数和尺寸数据。例如,“大特号”与63磅相等,其尺寸大约为22.142毫米;而“七号”则对应5.5磅,尺寸约为1.925毫米。这种对应关系不仅有助于人们理解和记忆不同字体大小的差异,同时也为将字体大小转换为更为直观的物理尺寸提供了有效途径。 ### 实际应用中的重要性 明确字体大小、磅数与尺寸之间的关联性,对于多个专业领域具有显著的作用: 1. **平面视觉艺术**:在创作海报、宣传单页或书籍封面时,选用适宜的字体大小和磅数能够确保文本呈现既美观又便于阅读。 2. **网络视觉设计**:在网络页面的布局中...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值