- 浏览: 142585 次
- 性别:
- 来自: 青岛
-
最新评论
-
cloudfile:
谢谢分享
xmpp with openfire之五 插件-利用Broadcast实现群 -
feitianzi:
碰到这个问题了,我的web.xml 也不起作用
glassfish 重新加载web.xml的问题 -
moistrot:
将这个编译好的类,加入我的lib\openfire.jar,之 ...
xmpp with openfire之四 扩展的AuthProvider -
lookdd1:
hetylei 写道lookdd1 写道请问,整合现有数据库为 ...
xmpp with openfire之三 openfire扩展小试 整合现有系统用户 -
hetylei:
lookdd1 写道请问,整合现有数据库为oracle的时候如 ...
xmpp with openfire之三 openfire扩展小试 整合现有系统用户
上一篇中提到jdbcAuthProvider.passwordType提供了三种方式
如果你的密码加密规则不是这三种方式,可以自己进行扩充
首先,下载openfire的源码
http://www.igniterealtime.org/downloads/source.jsp
打开org.jivesoftware.openfire.auth.JDBCAuthProvider
看以看到通过读取PASSWORDTYPE配置
进行密码的验证
这样完全可以仿照JDBCAuthProvider重新构造
编译后将此class加入到lib/openfire.jar中即可
当然不要忘记 将系统属性中
provider.auth.className,改成你自已的Provider
*上述代码例子中是org.yxsoft.openfire.plugin.BFMPAuthProvider
jdbcAuthProvider.passwordType,改成你自己定义的枚举值
*上述代码例子中是bfmp
如果你的密码加密规则不是这三种方式,可以自己进行扩充
首先,下载openfire的源码
http://www.igniterealtime.org/downloads/source.jsp
打开org.jivesoftware.openfire.auth.JDBCAuthProvider
package org.jivesoftware.openfire.auth; import org.jivesoftware.database.DbConnectionManager; import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.openfire.user.UserAlreadyExistsException; import org.jivesoftware.openfire.user.UserManager; import org.jivesoftware.openfire.user.UserNotFoundException; import org.jivesoftware.util.JiveGlobals; import org.jivesoftware.util.Log; import org.jivesoftware.util.StringUtils; import java.sql.*; /** * The JDBC auth provider allows you to authenticate users against any database * that you can connect to with JDBC. It can be used along with the * {@link HybridAuthProvider hybrid} auth provider, so that you can also have * XMPP-only users that won't pollute your external data.<p> * * To enable this provider, set the following in the system properties: * <ul> * <li><tt>provider.auth.className = org.jivesoftware.openfire.auth.JDBCAuthProvider</tt></li> * </ul> * * You'll also need to set your JDBC driver, connection string, and SQL statements: * * <ul> * <li><tt>jdbcProvider.driver = com.mysql.jdbc.Driver</tt></li> * <li><tt>jdbcProvider.connectionString = jdbc:mysql://localhost/dbname?user=username&password=secret</tt></li> * <li><tt>jdbcAuthProvider.passwordSQL = SELECT password FROM user_account WHERE username=?</tt></li> * <li><tt>jdbcAuthProvider.passwordType = plain</tt></li> * <li><tt>jdbcAuthProvider.allowUpdate = true</tt></li> * <li><tt>jdbcAuthProvider.setPasswordSQL = UPDATE user_account SET password=? WHERE username=?</tt></li> * </ul> * * The passwordType setting tells Openfire how the password is stored. Setting the value * is optional (when not set, it defaults to "plain"). The valid values are:<ul> * <li>{@link PasswordType#plain plain} * <li>{@link PasswordType#md5 md5} * <li>{@link PasswordType#sha1 sha1} * </ul> * * @author David Snopek */ public class JDBCAuthProvider implements AuthProvider { private String connectionString; private String passwordSQL; private String setPasswordSQL; private PasswordType passwordType; private boolean allowUpdate; /** * Constructs a new JDBC authentication provider. */ public JDBCAuthProvider() { // Convert XML based provider setup to Database based JiveGlobals.migrateProperty("jdbcProvider.driver"); JiveGlobals.migrateProperty("jdbcProvider.connectionString"); JiveGlobals.migrateProperty("jdbcAuthProvider.passwordSQL"); JiveGlobals.migrateProperty("jdbcAuthProvider.passwordType"); JiveGlobals.migrateProperty("jdbcAuthProvider.setPasswordSQL"); JiveGlobals.migrateProperty("jdbcAuthProvider.allowUpdate"); // Load the JDBC driver and connection string. String jdbcDriver = JiveGlobals.getProperty("jdbcProvider.driver"); try { Class.forName(jdbcDriver).newInstance(); } catch (Exception e) { Log.error("Unable to load JDBC driver: " + jdbcDriver, e); return; } connectionString = JiveGlobals.getProperty("jdbcProvider.connectionString"); // Load SQL statements. passwordSQL = JiveGlobals.getProperty("jdbcAuthProvider.passwordSQL"); setPasswordSQL = JiveGlobals.getProperty("jdbcAuthProvider.setPasswordSQL"); allowUpdate = JiveGlobals.getBooleanProperty("jdbcAuthProvider.allowUpdate",false); passwordType = PasswordType.plain; try { passwordType = PasswordType.valueOf( JiveGlobals.getProperty("jdbcAuthProvider.passwordType", "plain")); } catch (IllegalArgumentException iae) { Log.error(iae); } } public void authenticate(String username, String password) throws UnauthorizedException { if (username == null || password == null) { throw new UnauthorizedException(); } username = username.trim().toLowerCase(); if (username.contains("@")) { // Check that the specified domain matches the server's domain int index = username.indexOf("@"); String domain = username.substring(index + 1); if (domain.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) { username = username.substring(0, index); } else { // Unknown domain. Return authentication failed. throw new UnauthorizedException(); } } String userPassword; try { userPassword = getPasswordValue(username); } catch (UserNotFoundException unfe) { throw new UnauthorizedException(); } // If the user's password doesn't match the password passed in, authentication // should fail. if (passwordType == PasswordType.md5) { password = StringUtils.hash(password, "MD5"); } else if (passwordType == PasswordType.sha1) { password = StringUtils.hash(password, "SHA-1"); } if (!password.equals(userPassword)) { throw new UnauthorizedException(); } // Got this far, so the user must be authorized. createUser(username); } public void authenticate(String username, String token, String digest) throws UnauthorizedException { if (passwordType != PasswordType.plain) { throw new UnsupportedOperationException("Digest authentication not supported for " + "password type " + passwordType); } if (username == null || token == null || digest == null) { throw new UnauthorizedException(); } username = username.trim().toLowerCase(); if (username.contains("@")) { // Check that the specified domain matches the server's domain int index = username.indexOf("@"); String domain = username.substring(index + 1); if (domain.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) { username = username.substring(0, index); } else { // Unknown domain. Return authentication failed. throw new UnauthorizedException(); } } String password; try { password = getPasswordValue(username); } catch (UserNotFoundException unfe) { throw new UnauthorizedException(); } String anticipatedDigest = AuthFactory.createDigest(token, password); if (!digest.equalsIgnoreCase(anticipatedDigest)) { throw new UnauthorizedException(); } // Got this far, so the user must be authorized. createUser(username); } public boolean isPlainSupported() { // If the auth SQL is defined, plain text authentication is supported. return (passwordSQL != null); } public boolean isDigestSupported() { // The auth SQL must be defined and the password type is supported. return (passwordSQL != null && passwordType == PasswordType.plain); } public String getPassword(String username) throws UserNotFoundException, UnsupportedOperationException { if (!supportsPasswordRetrieval()) { throw new UnsupportedOperationException(); } if (username.contains("@")) { // Check that the specified domain matches the server's domain int index = username.indexOf("@"); String domain = username.substring(index + 1); if (domain.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) { username = username.substring(0, index); } else { // Unknown domain. throw new UserNotFoundException(); } } return getPasswordValue(username); } public void setPassword(String username, String password) throws UserNotFoundException, UnsupportedOperationException { if (allowUpdate && setPasswordSQL != null) { setPasswordValue(username, password); } else { throw new UnsupportedOperationException(); } } public boolean supportsPasswordRetrieval() { return (passwordSQL != null && passwordType == PasswordType.plain); } /** * Returns the value of the password field. It will be in plain text or hashed * format, depending on the password type. * * @param username user to retrieve the password field for * @return the password value. * @throws UserNotFoundException if the given user could not be loaded. */ private String getPasswordValue(String username) throws UserNotFoundException { String password = null; Connection con = null; PreparedStatement pstmt = null; ResultSet rs = null; if (username.contains("@")) { // Check that the specified domain matches the server's domain int index = username.indexOf("@"); String domain = username.substring(index + 1); if (domain.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) { username = username.substring(0, index); } else { // Unknown domain. throw new UserNotFoundException(); } } try { con = DriverManager.getConnection(connectionString); pstmt = con.prepareStatement(passwordSQL); pstmt.setString(1, username); rs = pstmt.executeQuery(); // If the query had no results, the username and password // did not match a user record. Therefore, throw an exception. if (!rs.next()) { throw new UserNotFoundException(); } password = rs.getString(1); } catch (SQLException e) { Log.error("Exception in JDBCAuthProvider", e); throw new UserNotFoundException(); } finally { DbConnectionManager.closeConnection(rs, pstmt, con); } return password; } private void setPasswordValue(String username, String password) throws UserNotFoundException { Connection con = null; PreparedStatement pstmt = null; ResultSet rs = null; if (username.contains("@")) { // Check that the specified domain matches the server's domain int index = username.indexOf("@"); String domain = username.substring(index + 1); if (domain.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) { username = username.substring(0, index); } else { // Unknown domain. throw new UserNotFoundException(); } } try { con = DriverManager.getConnection(connectionString); pstmt = con.prepareStatement(setPasswordSQL); pstmt.setString(1, username); if (passwordType == PasswordType.md5) { password = StringUtils.hash(password, "MD5"); } else if (passwordType == PasswordType.sha1) { password = StringUtils.hash(password, "SHA-1"); } pstmt.setString(2, password); rs = pstmt.executeQuery(); } catch (SQLException e) { Log.error("Exception in JDBCAuthProvider", e); throw new UserNotFoundException(); } finally { DbConnectionManager.closeConnection(rs, pstmt, con); } } /** * Indicates how the password is stored. */ @SuppressWarnings({"UnnecessarySemicolon"}) // Support for QDox Parser public enum PasswordType { /** * The password is stored as plain text. */ plain, /** * The password is stored as a hex-encoded MD5 hash. */ md5, /** * The password is stored as a hex-encoded SHA-1 hash. */ sha1; } /** * Checks to see if the user exists; if not, a new user is created. * * @param username the username. */ private static void createUser(String username) { // See if the user exists in the database. If not, automatically create them. UserManager userManager = UserManager.getInstance(); try { userManager.getUser(username); } catch (UserNotFoundException unfe) { try { Log.debug("JDBCAuthProvider: Automatically creating new user account for " + username); UserManager.getUserProvider().createUser(username, StringUtils.randomString(8), null, null); } catch (UserAlreadyExistsException uaee) { // Ignore. } } } }
看以看到通过读取PASSWORDTYPE配置
JiveGlobals.migrateProperty("jdbcAuthProvider.passwordType"); 。。。。。 。。。。。 。。。。。 passwordType = PasswordType.plain; try { passwordType = PasswordType.valueOf( JiveGlobals.getProperty("jdbcAuthProvider.passwordType", "plain")); } catch (IllegalArgumentException iae) { Log.error(iae); }
进行密码的验证
if (passwordType == PasswordType.md5) { password = StringUtils.hash(password, "MD5"); } else if (passwordType == PasswordType.sha1) { password = StringUtils.hash(password, "SHA-1"); } if (!password.equals(userPassword)) { throw new UnauthorizedException(); }
这样完全可以仿照JDBCAuthProvider重新构造
package org.yxsoft.openfire.plugin; import org.jivesoftware.openfire.user.UserNotFoundException; import org.jivesoftware.openfire.auth.*; import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.util.JiveGlobals; import org.jivesoftware.util.Log; import org.jivesoftware.util.StringUtils; import org.jivesoftware.database.DbConnectionManager; import java.sql.*; import java.security.MessageDigest; /** * Created by cl * Date: 2008-9-4 * Time: 9:18:26 * 仿照JDBCAuthProvider * 在数据库连接上 支持user/password * 密码验证 使用bfmp的机制 */ public class BfmpAuthProvider implements AuthProvider { private String connectionString; private String user; private String password; private String passwordSQL; private String setPasswordSQL; private PasswordType passwordType; private boolean allowUpdate; /** * 初始化 * 比JDBCAuthProvider多支持 * JiveGlobals.migrateProperty("jdbcProvider.url"); JiveGlobals.migrateProperty("jdbcProvider.user"); JiveGlobals.migrateProperty("jdbcProvider.password"); */ public BfmpAuthProvider() { // Convert XML based provider setup to Database based JiveGlobals.migrateProperty("jdbcProvider.driver"); JiveGlobals.migrateProperty("jdbcProvider.url"); JiveGlobals.migrateProperty("jdbcProvider.user"); JiveGlobals.migrateProperty("jdbcProvider.password"); JiveGlobals.migrateProperty("jdbcAuthProvider.passwordSQL"); JiveGlobals.migrateProperty("jdbcAuthProvider.passwordType"); JiveGlobals.migrateProperty("jdbcAuthProvider.setPasswordSQL"); JiveGlobals.migrateProperty("jdbcAuthProvider.allowUpdate"); JiveGlobals.migrateProperty("jdbcAuthProvider.passwordType"); // Load the JDBC driver and connection string. String jdbcDriver = JiveGlobals.getProperty("jdbcProvider.driver"); try { Class.forName(jdbcDriver).newInstance(); } catch (Exception e) { Log.error("Unable to load JDBC driver: " + jdbcDriver, e); return; } connectionString = JiveGlobals.getProperty("jdbcProvider.url"); user = JiveGlobals.getProperty("jdbcProvider.user"); password = JiveGlobals.getProperty("jdbcProvider.password"); // Load SQL statements. passwordSQL = JiveGlobals.getProperty("jdbcAuthProvider.passwordSQL"); setPasswordSQL = JiveGlobals.getProperty("jdbcAuthProvider.setPasswordSQL"); allowUpdate = JiveGlobals.getBooleanProperty("jdbcAuthProvider.allowUpdate",false); passwordType = PasswordType.plain; try { passwordType = PasswordType.valueOf( JiveGlobals.getProperty("jdbcAuthProvider.passwordType", "plain")); Log.error("PasswordType:"+ passwordType); } catch (IllegalArgumentException iae) { Log.error(iae); } } public boolean isPlainSupported() { //default return true; } public boolean isDigestSupported() { //default return true; } public void authenticate(String username, String password) throws UnauthorizedException, ConnectionException, InternalUnauthenticatedException { if (username == null || password == null) { throw new UnauthorizedException(); } Log.error(username+":"+password); username = username.trim().toLowerCase(); if (username.contains("@")) { Log.error(username+":"+XMPPServer.getInstance().getServerInfo().getXMPPDomain()); // Check that the specified domain matches the server's domain int index = username.indexOf("@"); String domain = username.substring(index + 1); if (domain.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) { username = username.substring(0, index); } else { // Unknown domain. Return authentication failed. throw new UnauthorizedException(); } } else { Log.error("user name not contains "); } String userPassword; try { userPassword = getPasswordValue(username); } catch (UserNotFoundException unfe) { throw new UnauthorizedException(); } // If the user's password doesn't match the password passed in, authentication // should fail. if (passwordType == PasswordType.bfmp) { //这里BfmpMD5 就是自己的密码规则 password = BfmpMD5(password); } if (!password.equals(userPassword)) { throw new UnauthorizedException(); } // Got this far, so the user must be authorized. //createUser(username); } public void authenticate(String username, String token, String digest) throws UnauthorizedException, ConnectionException, InternalUnauthenticatedException { if (passwordType != PasswordType.plain) { throw new UnsupportedOperationException("Digest authentication not supported for " + "password type " + passwordType); } if (username == null || token == null || digest == null) { throw new UnauthorizedException(); } username = username.trim().toLowerCase(); if (username.contains("@")) { // Check that the specified domain matches the server's domain int index = username.indexOf("@"); String domain = username.substring(index + 1); if (domain.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) { username = username.substring(0, index); } else { // Unknown domain. Return authentication failed. throw new UnauthorizedException(); } } String password; try { password = getPasswordValue(username); } catch (UserNotFoundException unfe) { throw new UnauthorizedException(); } String anticipatedDigest = AuthFactory.createDigest(token, password); if (!digest.equalsIgnoreCase(anticipatedDigest)) { throw new UnauthorizedException(); } // Got this far, so the user must be authorized. //createUser(username); } public String getPassword(String username) throws UserNotFoundException, UnsupportedOperationException { if (!supportsPasswordRetrieval()) { throw new UnsupportedOperationException(); } if (username.contains("@")) { // Check that the specified domain matches the server's domain int index = username.indexOf("@"); String domain = username.substring(index + 1); if (domain.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) { username = username.substring(0, index); } else { // Unknown domain. throw new UserNotFoundException(); } } return getPasswordValue(username); } private String getPasswordValue(String username) throws UserNotFoundException { String password = null; Connection con = null; PreparedStatement pstmt = null; ResultSet rs = null; if (username.contains("@")) { // Check that the specified domain matches the server's domain int index = username.indexOf("@"); String domain = username.substring(index + 1); if (domain.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) { username = username.substring(0, index); } else { // Unknown domain. throw new UserNotFoundException(); } } try { con = DriverManager.getConnection(connectionString, user, this.password); pstmt = con.prepareStatement(passwordSQL); pstmt.setString(1, username); rs = pstmt.executeQuery(); // If the query had no results, the username and password // did not match a user record. Therefore, throw an exception. if (!rs.next()) { throw new UserNotFoundException(); } password = rs.getString(1); } catch (SQLException e) { Log.error("Exception in JDBCAuthProvider", e); throw new UserNotFoundException(); } finally { DbConnectionManager.closeConnection(rs, pstmt, con); } return password; } public void setPassword(String username, String password) throws UserNotFoundException, UnsupportedOperationException { // unsupport } public boolean supportsPasswordRetrieval() { return true; } /** * Indicates how the password is stored. */ @SuppressWarnings({"UnnecessarySemicolon"}) // Support for QDox Parser public enum PasswordType { /** * The password is stored as plain text. */ plain, /** * The password is stored as a bfmp passwrod. */ bfmp; } private String BfmpMD5 (String source) { //在这里实现你的加密机制,返回生成的密码 return ""; } }
编译后将此class加入到lib/openfire.jar中即可
当然不要忘记 将系统属性中
provider.auth.className,改成你自已的Provider
*上述代码例子中是org.yxsoft.openfire.plugin.BFMPAuthProvider
jdbcAuthProvider.passwordType,改成你自己定义的枚举值
*上述代码例子中是bfmp
发表评论
-
对不起,免费午餐现在只提供稀饭了-- MSN停止支持对第三方软件的登录请求
2009-01-14 12:36 1771MSN停止支持对第三方软件的登录请求在网络上引起一阵讨论。 ... -
WebQQ限量封测第二期开启
2009-01-14 11:01 1182刚才听说WebQQ限量封测第二期开启了 去申请了一下,还要通 ... -
推荐:iJab ajax jabber 客户端
2009-01-13 14:23 3787昨天在XMPP群里,iJab的成员自荐了一下他们的ajax j ... -
xmpp with openfire之五 插件-利用Broadcast实现群
2008-12-12 11:28 15356openfire提供了很好的插件支持,安装也非常方便。 下面 ... -
xmpp with openfire之三 openfire扩展小试 整合现有系统用户
2008-12-10 15:44 10884openfire服务器配置,先� ... -
xmpp with openfire之二 openfire安装
2008-12-10 13:14 6762windows下的安装 1.首先� ... -
xmpp with openfire之一 xmpp and openfire
2008-12-10 10:17 6491XMPP 百度百科 1、什么是XMPP ? XMP ...
相关推荐
先说一下为什么要写这篇博客,是因为本人在周末在研究XMPP和OpenFire,从网上下载了个Demo,但跑不起来,花了很长时间,经改造后,跑起来了,写个篇博文也是希望后边学习XMPP和OpenFire的同学下载后直接运行,少走...
Openfire的强大之处在于其高度可扩展的插件系统。通过安装插件,可以极大地增强服务器的功能。 ##### 3.1 KrakenIMGateway插件 - **功能**:支持MSNS、QQ等第三方即时通讯工具的登录。 - **配置**:通过插件配置...
XMPP的核心设计原则是分散式和可扩展性,使得开发者可以轻松地添加新功能。在多人聊天系统中,XMPP负责处理用户的登录、注销、消息传递、群组管理等核心功能。用户通过连接到XMPP服务器,发送和接收消息,建立和管理...
**XMPP与Openfire搭建详解** XMPP(Extensible Messaging and Presence Protocol)是一种基于XML的实时通讯协议,常用于构建即时通讯系统。它允许用户进行一对一、一对多的消息传输,同时还支持状态呈现、群组聊天...
本 MATLAB 程序对 6 自由度 Stewart 平台进行了仿真,成功求解了其正解和反解,并且开发了可视化的 GUI 界面。该程序可作为研究 Stewart 平台工作空间求解问题的参考。在正解的求解过程中,参考了文献 [Lee, Tae-Young, and Jae-Kyung Shim. "Forward kinematics of the general 6–6 Stewart platform using algebraic elimination." Mechanism and Machine Theory 36.9 (2001): 1073-1085.] 中的方法。需要说明的是,本程序来源于 Github。
在电子设计自动化(EDA)领域,Verilog HDL 是一种重要的硬件描述语言,广泛应用于数字系统的设计,尤其是在嵌入式系统、FPGA 设计以及数字电路教学中。本文将探讨如何利用 Verilog HDL 实现一个 16×16 点阵字符显示功能。16×16 点阵显示器由 16 行和 16 列的像素组成,共需 256 个二进制位来控制每个像素的亮灭,常用于简单字符或图形显示。 要实现这一功能,首先需要掌握基本的逻辑门(如与门、或门、非门、与非门、或非门等)和组合逻辑电路,以及寄存器和计数器等时序逻辑电路。设计的核心是构建一个模块,该模块接收字符输入(如 ASCII 码),将其转换为 16×16 的二进制位流,进而驱动点阵的 LED 灯。具体而言,该模块包含以下部分:一是输入接口,通常为 8 位的 ASCII 码输入,用于指定要显示的字符;二是内部存储,用于存储字符对应的 16×16 点阵数据,可采用寄存器或分布式 RAM 实现;三是行列驱动逻辑,将点阵数据转换为驱动 LED 矩阵的信号,包含 16 个行输出线和 16 个列使能信号,按特定顺序选通点亮对应 LED;四是时序控制,通过计数器逐行扫描,按顺序控制每行点亮;五是复用逻辑(可选),若点阵支持多颜色或亮度等级,则需额外逻辑控制像素状态。 设计过程中,需用 Verilog 代码描述上述逻辑,并借助仿真工具验证功能,确保能正确将输入字符转换为点阵显示。之后将设计综合到目标 FPGA 架构,通过配置 FPGA 实现硬件功能。实际项目中,“led_lattice”文件可能包含 Verilog 源代码、测试平台文件、配置文件及仿真结果。其中,测试平台用于模拟输入、检查输出,验证设计正确性。掌握 Verilog HDL 实现 16×16 点阵字符显示,涉及硬件描述语言基础、数字逻辑设计、字符编码和 FPGA 编程等多方面知识,是学习
cmd脚本-bat批处理-args.zip
内容概要:本文详细介绍了有源钳位型三电平(ANPC)逆变器采用羊角波空间矢量脉宽调制(SVPWM)进行闭环仿真的研究。文中首先阐述了ANPC逆变器的基本拓扑结构及其优势,特别是在解决传统NPC拓扑电压应力不均的问题上表现突出。接着,文章深入探讨了羊角波SVPWM的具体实现方法,包括扇区划分、Clarke变换的应用以及中点电位平衡的控制策略。此外,还讨论了电压电流双闭环控制的设计,特别是PI控制器和准PR控制器的参数设置。最后,通过对仿真结果的分析,验证了系统的稳定性和性能指标,如电压和电流的总谐波失真(THD)、中点电位波动等,均符合并网要求。 适用人群:从事电力电子、电机驱动、新能源发电等领域研究和技术开发的专业人士,尤其是对逆变器技术和调制方法感兴趣的工程师和研究人员。 使用场景及目标:适用于需要深入了解ANPC逆变器及其调制方法的研究人员和技术人员。主要目标是掌握羊角波SVPWM的实现细节,理解中点电位平衡和双闭环控制的作用,从而应用于实际工程设计和优化。 其他说明:文章提供了详细的MATLAB代码片段,帮助读者更好地理解和实现相关算法。同时,强调了一些关键的技术细节,如边界条件处理、电流极性检测、死区时间补偿等,确保仿真结果的准确性。
cmd-bat-批处理-脚本-5.WannaCry-Security-Reinforcement.zip
cmd脚本-bat批处理-7.system-env-variable.zip
内容概要:本文探讨了基于规则算法的功率跟随控制在燃料电池汽车能量管理中的应用,特别是在NEDC和UDDS工况下的表现。文章首先介绍了功率跟随控制的基本原理和技术背景,随后详细解释了如何通过规则算法优化车辆的能量管理策略,确保在不同工况下实现高效的能量利用。文中还展示了具体的MATLAB数据分析方法和示例代码,帮助读者理解如何通过实时数据监测和处理来制定最优的能量管理策略。 适合人群:从事新能源汽车研发的技术人员、研究人员及高校相关专业的学生。 使用场景及目标:适用于希望深入了解燃料电池汽车能量管理策略的研究人员和技术开发者,旨在提高能源利用效率、降低排放并改善驾驶体验。 其他说明:文章不仅提供了理论分析,还包括了实用的MATLAB代码示例,便于读者进行实际操作和验证。
本代码完整实现了ARMA模型的识别、参数估计与预测功能。其编写语言简洁明了,便于初学者理解和学习。
cmd-bat-批处理-脚本-callArgs.zip
内容概要:本文详细介绍了永磁同步电机(PMSM)双矢量模型预测电流控制(MPC)技术的研究进展及其仿真结果。首先指出了传统占空比模型预测电流控制存在的局限性,即电流波动较大,影响电机运行效率和稳定性。接着阐述了双矢量MPC方法的优势,该方法允许在每个采样周期中进行两次电压矢量选择,不仅可以选择任意方向和幅值的电压矢量,还在价值函数中考虑了作用时间的影响,使电压矢量选择更为精确,有效减小了电流波动。最后展示了仿真实验结果,表明双矢量MPC方法显著提升了电机的静动态性能,减少了电流波动,提高了运行效率和稳定性。文中还提到仿真技术的高度定制化,能够直接应用于实际电机控制器,支持实验验证。 适合人群:从事电机控制技术研发的专业人士,尤其是对永磁同步电机和模型预测控制感兴趣的科研人员和技术开发者。 使用场景及目标:适用于需要深入了解和掌握永磁同步电机先进控制技术的研究机构和企业。目标是提升电机控制系统的设计水平,优化现有控制策略,降低开发成本和缩短研发周期。 其他说明:本文不仅理论分析详尽,还提供了具体的仿真案例,有助于读者全面理解和应用双矢量MPC技术。
内容概要:本文详细介绍了如何使用基于瞬时无功功率理论的ip-iq谐波检测算法,在Matlab的Simulink环境中对三相三线制并联型有源电力滤波器(APF)控制系统进行建模与仿真。文章从绪论开始,逐步讲解了APF的工作原理及其重要性,重点阐述了ip-iq谐波检测算法的作用机制,并展示了具体的模型构建步骤,包括ip-iq谐波检测算法模块、APF控制系统模块和APF输出模块的设计。最后,通过对仿真结果的验证分析,证明了该算法的有效性和APF在抑制电网谐波方面的卓越表现。 适合人群:从事电力系统研究、电力电子技术开发的专业人士,尤其是对有源电力滤波器和MATLAB/Simulink仿真感兴趣的工程师和技术人员。 使用场景及目标:适用于希望深入了解并联型有源电力滤波器(APF)工作原理及其仿真方法的研究人员和工程师。目标是掌握基于瞬时无功功率理论的ip-iq谐波检测算法的应用,提升电力系统的电能质量和稳定性。 其他说明:文中附带了一个完整的Simulink模型和详细的12页说明文件,帮助读者更好地理解和复现仿真过程。
cmd-bat-批处理-脚本-jscript-ppt2pdf.zip
cmd脚本-bat批处理-activate.zip
cmd-bat-批处理-脚本-typeList.zip
内容概要:本文详细探讨了利用COMSOL软件对涂层剥离和脱落进行瞬态仿真,以及拉开法试验仿真,旨在预测和评估涂层在不同环境条件下的表现。同时,研究还涉及多体动力学中的接触和粘附问题,特别是罚函数的应用,以更精确地模拟和分析复杂系统的多体动力学行为。通过这些方法和技术,研究人员能够更好地理解材料在实际使用中的性能变化,从而优化设计方案。 适合人群:从事材料科学、工程领域的科研人员和工程师,尤其是那些关注涂层材料性能和多体动力学行为的研究者。 使用场景及目标:① 预测和评估涂层在不同环境条件下的表现,优化涂层设计方案;② 获取材料间的粘附力、剥离强度等参数,改进材料性能;③ 分析复杂系统中的多体动力学行为,为产品设计和优化提供支持。 其他说明:本文不仅介绍了具体的仿真技术和方法,还强调了这些技术在实际工程和科学研究中的应用价值,帮助读者深入理解相关理论和实践操作。
cmd-bat-批处理-脚本-字符串工具-toLowerCase.zip