diff --git a/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/alarmGeneratePlugin.cpp b/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/alarmGeneratePlugin.cpp
new file mode 100644
index 00000000..30e63c3c
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/alarmGeneratePlugin.cpp
@@ -0,0 +1,26 @@
+#include "alarmGeneratePlugin.h"
+
+alarmGeneratePlugin::alarmGeneratePlugin(): CBlock()
+{
+ addInPort( CPort(this, "I1", E_PORTDATA_STRING) );
+ addInPort( CPort(this, "I2", E_PORTDATA_BOOL) );
+ setInPortShowName("I1",tr("测点标签"));
+ setInPortShowName("I2",tr("使能"));
+
+ this->setProperty( C_PROPERTY_SHOWNAME, showName() );
+ //this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("Format")).toStdString().c_str(), E_VALUEEDIT_LINEEDIT );
+
+ //Format = tr("%1 失败");
+}
+
+alarmGeneratePlugin::~alarmGeneratePlugin()
+{
+}
+
+QString alarmGeneratePlugin::propertyShowName( QString sPropertyName )
+{
+ //if ( sPropertyName == "Format" )
+ // return tr("告警内容格式");
+ return sPropertyName;
+}
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/alarmGeneratePlugin.h b/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/alarmGeneratePlugin.h
new file mode 100644
index 00000000..151b43be
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/alarmGeneratePlugin.h
@@ -0,0 +1,27 @@
+#ifndef TEMPLATEPLUGIN_H
+#define TEMPLATEPLUGIN_H
+
+#include "CBlock.h"
+
+class alarmGeneratePlugin : public CBlock
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA( IID Block_iid ) // Q_PLUGIN_METADATA 宏用于描述插件元数据
+ Q_INTERFACES( CBlock ) // Q_INTERFACES 宏用于告诉Qt该类实现的接口
+
+ //IMPL_PROPERTY( QString, Format )
+
+ //Q_PROPERTY( QString Format READ get_Format WRITE set_Format USER true DESIGNABLE true )
+
+public:
+ Q_INVOKABLE alarmGeneratePlugin();
+ Q_INVOKABLE ~alarmGeneratePlugin();
+
+public:
+ QString name() { return "alarmGenerate"; }
+ QString showName() { return QObject::tr("告警生成"); }
+ QString propertyShowName( QString sPropertyName );
+ QIcon getIcon() { return QIcon(":/icon/"+name()+".png"); }
+};
+
+#endif // TEMPLATEPLUGIN_H
diff --git a/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/alarmGeneratePlugin.pro b/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/alarmGeneratePlugin.pro
new file mode 100644
index 00000000..84479c10
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/alarmGeneratePlugin.pro
@@ -0,0 +1,38 @@
+TARGET = alarmGeneratePlugin
+QT = core gui widgets xml sql
+CONFIG += dll
+TEMPLATE = lib
+CONFIG += qt
+
+SOURCES += \
+ alarmGeneratePlugin.cpp \
+
+HEADERS += \
+ alarmGeneratePlugin.h \
+
+INCLUDEPATH += \
+ ../../fbd_block \
+ ../../fbd_tree \
+
+LIBS += \
+ -lfbd_block \
+ -lfbd_tree \
+
+RESOURCES += \
+ icon.qrc
+
+!include( ../../../../idl_files/idl_files.pri){
+ error(the file idl_files.pri is not exist!!)
+}
+
+!include( ../../../../common.pri ){
+ error(the file common.pri is not exist!!)
+}
+
+#fbd_plugins插件的统一规则
+FBD_PLUGINS_PRI=$$PWD/../fbd_plugins.pri
+exists($$FBD_PLUGINS_PRI) {
+ include($$FBD_PLUGINS_PRI)
+}else {
+ error("FATAL error: can not find fbd_plugins.pri")
+}
diff --git a/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/icon.qrc b/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/icon.qrc
new file mode 100644
index 00000000..012749eb
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/icon.qrc
@@ -0,0 +1,5 @@
+
+
+ icon/alarmGenerate.png
+
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/icon/alarmGenerate.png b/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/icon/alarmGenerate.png
new file mode 100644
index 00000000..9ce412ab
Binary files /dev/null and b/product/src/tools/fbd_designer/fbd_plugins/alarmGeneratePlugin/icon/alarmGenerate.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/alarmdelayplugin/icon/alarmdelay.png b/product/src/tools/fbd_designer/fbd_plugins/alarmdelayplugin/icon/alarmdelay.png
index 0d5edf9c..b47b3ac8 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/alarmdelayplugin/icon/alarmdelay.png and b/product/src/tools/fbd_designer/fbd_plugins/alarmdelayplugin/icon/alarmdelay.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/alarmpushplugin/icon/alarmpush.png b/product/src/tools/fbd_designer/fbd_plugins/alarmpushplugin/icon/alarmpush.png
index c0b1369b..c0435155 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/alarmpushplugin/icon/alarmpush.png and b/product/src/tools/fbd_designer/fbd_plugins/alarmpushplugin/icon/alarmpush.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/alarmsplitplugin/icon/alarmsplit.png b/product/src/tools/fbd_designer/fbd_plugins/alarmsplitplugin/icon/alarmsplit.png
index 1134bfbd..0c58a077 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/alarmsplitplugin/icon/alarmsplit.png and b/product/src/tools/fbd_designer/fbd_plugins/alarmsplitplugin/icon/alarmsplit.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/alarmsubscribeplugin/alarmsubscribeplugin.cpp b/product/src/tools/fbd_designer/fbd_plugins/alarmsubscribeplugin/alarmsubscribeplugin.cpp
index 12358248..93534152 100644
--- a/product/src/tools/fbd_designer/fbd_plugins/alarmsubscribeplugin/alarmsubscribeplugin.cpp
+++ b/product/src/tools/fbd_designer/fbd_plugins/alarmsubscribeplugin/alarmsubscribeplugin.cpp
@@ -17,6 +17,7 @@ alarmSubscribePlugin::alarmSubscribePlugin() : CBlock()
addOutPort( CPort(this, "O1", E_PORTDATA_ALARM) );
addOutPort( CPort(this, "O2", E_PORTDATA_BOOL) );
+ addOutPort( CPort(this, "O3", E_PORTDATA_INT) );
QStringList listTmp;
listTmp<<"0-NO"<<"1-YES";
diff --git a/product/src/tools/fbd_designer/fbd_plugins/alarmsubscribeplugin/icon/alarmsubscribe.png b/product/src/tools/fbd_designer/fbd_plugins/alarmsubscribeplugin/icon/alarmsubscribe.png
index d9e15d69..9ce412ab 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/alarmsubscribeplugin/icon/alarmsubscribe.png and b/product/src/tools/fbd_designer/fbd_plugins/alarmsubscribeplugin/icon/alarmsubscribe.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/ApcPdPCSPlugin.cpp b/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/ApcPdPCSPlugin.cpp
new file mode 100644
index 00000000..14ca4689
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/ApcPdPCSPlugin.cpp
@@ -0,0 +1,405 @@
+#include "ApcPdPCSPlugin.h"
+
+#define CN_MAX_UNIT_COUNT 300 //最大机组数量
+
+#define CN_WIDTH 230 // 图元宽度
+#define CN_HEIGHTSPACE 40 // 输入(输出、文字)上下之间的间隔
+#define CN_FIRSTHEIGHT (m_nCustomPortSpace-14)/2 // 第一个输入(输出、文字)与顶的距离
+//#define CN_PCSLINEARHEADINPUTNUM 7 // PCSLinear顶框输入个数
+//#define CN_PCSLINEARHEADOUTPUTNUM 6 // PCSLinear顶框输出个数
+#define CN_PCSLINEARINPUTNUM 6 // PCS机组框输入个数
+#define CN_PCSLINEAROUTPUTNUM 4 // PCS机组框输出个数
+#define CN_MAXPCSLINEARHEADNUM (m_nTopInPortNum>=m_nTopOutPortNum ? m_nTopInPortNum : m_nTopOutPortNum)
+#define CN_MAXPCSLINEARNUM (CN_PCSLINEARINPUTNUM>=CN_PCSLINEAROUTPUTNUM ? CN_PCSLINEARINPUTNUM : CN_PCSLINEAROUTPUTNUM)
+#define CN_PCSLINEARHEADHEIGHT CN_MAXPCSLINEARHEADNUM*m_nCustomPortSpace // PCSLinear顶框的高度
+#define CN_PCSLINEARHEIGHT CN_MAXPCSLINEARNUM*m_nCustomPortSpace // PCSLinear框的高度
+
+ApcPdPCSPlugin::ApcPdPCSPlugin(): CBlock()
+{
+ m_nPCSNum = 0;
+ m_nCustomPortSpace = CN_HEIGHTSPACE;
+ m_fCommPrecision = 0.01f;
+ m_fRegulatePrecision = 50;
+ m_fMinAllocP = 50;
+ m_nRegulateCycle = 0;
+ m_nWaitRespTimeout = 3000;
+
+ initPropertyMAP();
+
+ setPortShowNameFunctionEnable( false );
+
+ addInPort( CPort(this, "TotalRegulateEnable", E_PORTDATA_BOOL) );
+ setInPortShowName( "TotalRegulateEnable", tr("总调节使能") );
+
+ addInPort( CPort(this, "TotalTargetP", E_PORTDATA_FLOAT) );
+ setInPortShowName( "TotalTargetP", tr("AGC目标值") );
+
+ //addInPort( CPort(this, "TotalTargetPUpperLimit", E_PORTDATA_FLOAT) );
+ //setInPortShowName( "TotalTargetPUpperLimit", tr("总有功上限") );
+ //addInPort( CPort(this, "TotalTargetPLowerLimit", E_PORTDATA_FLOAT) );
+ //setInPortShowName( "TotalTargetPLowerLimit", tr("总有功下限") );
+
+ addInPort( CPort(this, "ULSoc", E_PORTDATA_FLOAT) );
+ setInPortShowName( "ULSoc", tr("SOC上限(单位:%)") );
+ addInPort( CPort(this, "LLSoc", E_PORTDATA_FLOAT) );
+ setInPortShowName( "LLSoc", tr("SOC下限(单位:%)") );
+
+ addInPort( CPort(this, "TotalDeadband", E_PORTDATA_FLOAT) );
+ setInPortShowName( "TotalDeadband", tr("调节死区") );
+ addInPort( CPort(this, "Step", E_PORTDATA_FLOAT) );
+ setInPortShowName( "Step", tr("最大调节步进") );
+ addInPort( CPort(this, "Interval", E_PORTDATA_FLOAT) );
+ setInPortShowName( "Interval", tr("最小调节周期(ms)") );
+ m_nTopInPortNum = getInPortSize();
+
+ addOutPort( CPort(this, "TotalSetP", E_PORTDATA_FLOAT));
+ setOutPortShowName( "TotalSetP", tr("总分配功率") );
+ addOutPort(CPort(this, "TotalTargetP", E_PORTDATA_FLOAT));
+ setOutPortShowName("TotalTargetP", tr("总目标功率"));
+ addOutPort( CPort(this, "TotalRealP", E_PORTDATA_FLOAT));
+ setOutPortShowName( "TotalRealP", tr("总实时功率") );
+ addOutPort( CPort(this, "Total SOC", E_PORTDATA_FLOAT) );
+ setOutPortShowName( "Total SOC", tr("总SOC(单位:%)") );
+ addOutPort( CPort(this, "TotalMaxChargeP", E_PORTDATA_FLOAT));
+ setOutPortShowName( "TotalMaxChargeP", tr("总最大充电功率") );
+ addOutPort( CPort(this, "TotalMaxDischargeP", E_PORTDATA_FLOAT));
+ setOutPortShowName( "TotalMaxDischargeP", tr("总最大放电功率") );
+ addOutPort( CPort(this, "TotalUpMarginPower", E_PORTDATA_FLOAT) );
+ setOutPortShowName( "TotalUpMarginPower", tr("总可增有功") );
+ addOutPort( CPort(this, "TotalDownMarginPower", E_PORTDATA_FLOAT) );
+ setOutPortShowName( "TotalDownMarginPower", tr("总可减有功") );
+ addOutPort(CPort(this, "TotalNonRegulatePower", E_PORTDATA_FLOAT));
+ setOutPortShowName("TotalNonRegulatePower", tr("总不可调功率"));
+ addOutPort( CPort(this, "StatusCode", E_PORTDATA_INT) );
+ setOutPortShowName( "StatusCode", tr("状态码") );
+ addOutPort( CPort(this, "ErrorCode", E_PORTDATA_INT) );
+ setOutPortShowName( "ErrorCode", tr("错误码") );
+ m_nTopOutPortNum = getOutPortSize();
+
+ this->setProperty( C_PROPERTY_SHOWNAME, showName() );
+ //< 端口间隔
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("PortSpace")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+ //< 机组数量
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("UnitCnt")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+
+ //< 功率分配算法
+ QStringList listTmp;
+ listTmp<
setProperty( (C_PREFIX_VALUEEDITTYPE+QString("AllocALG")).toStdString().c_str(), E_VALUEEDIT_COMBOBOX );
+ this->setProperty( (C_PREFIX_COMBOBOXITEM+QString("AllocALG")).toStdString().c_str(), listTmp);
+ AllocALG = listTmp.at(0);
+
+ //< 反馈超时时间
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("WaitRespTimeout")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+ //< 稳定时定时分配间隔
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("RegulateCycle")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+
+ //< 机组参数
+ //< 最小分配功率
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("MinAllocP")).toStdString().c_str(), E_VALUEEDIT_DOUBLESPINBOX );
+ //< 通讯精度
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("CommPrecision")).toStdString().c_str(), E_VALUEEDIT_DOUBLESPINBOX );
+ //< 调节精度
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("RegulatePrecision")).toStdString().c_str(), E_VALUEEDIT_DOUBLESPINBOX );
+
+}
+
+ApcPdPCSPlugin::~ApcPdPCSPlugin()
+{
+
+}
+
+void ApcPdPCSPlugin::initPropertyMAP()
+{
+ m_mapProperty["UnitCnt"] = tr("机组个数");
+ m_mapProperty["PortSpace"] = tr("端口间隔");
+ m_mapProperty["AllocALG"] = tr("功率分配算法");
+ m_mapProperty["CommPrecision"] = tr("通讯精度");
+ m_mapProperty["RegulatePrecision"] = tr("调节精度");
+ m_mapProperty["WaitRespTimeout"] = tr("调节反馈超时时间(单位:ms)");
+ m_mapProperty["RegulateCycle"] = tr("稳定时调节周期(单位:s)");
+ m_mapProperty["MinAllocP"] = tr("最小分配功率");
+}
+
+QString ApcPdPCSPlugin::propertyShowName( QString sPropertyName )
+{
+ auto iter = m_mapProperty.find(sPropertyName);
+ if(iter != m_mapProperty.end())
+ {
+ return iter.value();
+ }
+
+ return sPropertyName;
+}
+
+QPointF ApcPdPCSPlugin::getInputTextPos(const int nInputIndex, const int nInputTextWidth)
+{
+ Q_UNUSED(nInputTextWidth);
+
+ int nY = getInputHeight(nInputIndex);
+ return QPointF(1,nY);
+}
+
+QPointF ApcPdPCSPlugin::getOutputTextPos(const int nOutputIndex, const int nOutputTextWidth)
+{
+ return QPointF( CN_WIDTH - nOutputTextWidth, getOutputHeight(nOutputIndex) );
+}
+
+int ApcPdPCSPlugin::getInputHeight(const int nIndex, const int nPortSize, const int nPortHeight)
+{
+ Q_UNUSED(nPortHeight);
+ Q_UNUSED(nPortSize);
+
+ return getInputHeight(nIndex + 1);
+}
+
+int ApcPdPCSPlugin::getOutputHeight(const int nIndex, const int nPortSize, const int nPortHeight)
+{
+ Q_UNUSED(nPortHeight);
+ Q_UNUSED(nPortSize);
+
+ return getOutputHeight(nIndex + 1);
+}
+
+int ApcPdPCSPlugin::getFirstHeight()
+{
+ return CN_FIRSTHEIGHT;
+}
+
+QString ApcPdPCSPlugin::getOutputRealValueSep()
+{
+ return "\n";
+}
+
+QPointF ApcPdPCSPlugin::getIconPos(const QSize &pixmapSize)
+{
+ int nX = (CN_WIDTH - pixmapSize.width()) / 2;
+ return QPointF(nX,5);
+}
+
+QPolygonF ApcPdPCSPlugin::getPolygon(const int nWidth, const int nHeight)
+{
+ // Set Polygon Top-Left: 0/0
+ QPolygonF polygon;
+ polygon << QPointF(0, 0) << QPointF( nWidth, 0)
+ << QPointF(nWidth, nHeight) << QPointF(0, nHeight)
+ << QPointF(0, 0);
+
+ const int nPCSLinearNum = this->property("UnitCnt").toInt();
+ for ( int i=0; iproperty("UnitCnt").toInt();
+ if ( nUnitCount == 0 )
+ {
+ this->setProperty("UnitCnt",1);
+ }
+}
+
+int ApcPdPCSPlugin::getInputHeight(const int nIndex)
+{
+ int nRet = CN_FIRSTHEIGHT;
+ if ( nIndex < m_nTopInPortNum )
+ nRet += nIndex * m_nCustomPortSpace;
+ else
+ {
+ nRet += CN_PCSLINEARHEADHEIGHT+
+ (nIndex-m_nTopInPortNum)/CN_PCSLINEARINPUTNUM*CN_PCSLINEARHEIGHT+
+ (nIndex-m_nTopInPortNum)%CN_PCSLINEARINPUTNUM*m_nCustomPortSpace;
+ }
+ return nRet;
+}
+
+int ApcPdPCSPlugin::getOutputHeight(const int nIndex)
+{
+ int nRet = CN_FIRSTHEIGHT;
+ if ( nIndex < m_nTopOutPortNum )
+ nRet += nIndex * m_nCustomPortSpace;
+ else
+ {
+ nRet += CN_PCSLINEARHEADHEIGHT+
+ (nIndex-m_nTopOutPortNum)/CN_PCSLINEAROUTPUTNUM*CN_PCSLINEARHEIGHT+
+ (nIndex-m_nTopOutPortNum)%CN_PCSLINEAROUTPUTNUM*m_nCustomPortSpace;
+ }
+ return nRet;
+}
+
+void ApcPdPCSPlugin::setPCSNum( int nPCSNum )
+{
+ if ( nPCSNum < 0 )
+ {
+ emit signalErrorDisplay(tr("PCS个数不能小于0个!!!"));
+ return;
+ }
+ if ( nPCSNum > CN_MAX_UNIT_COUNT )
+ {
+ emit signalErrorDisplay(tr("PCS个数不能大于300个!!!"));
+ return;
+ }
+
+ QString sPortName = "";
+ QString sPortDesc = "";
+ for ( int i=nPCSNum+1; i<=m_nPCSNum; i++ )
+ {
+ // 删除输入端口
+ removeInPort(QString("Unit %1 TargetP").arg(i));
+ removeInPort(QString("Unit %1 RealP").arg(i));
+ removeInPort(QString("Unit %1 SOC").arg(i));
+ removeInPort(QString("Unit %1 MaxDischargeP").arg(i));
+ removeInPort(QString("Unit %1 MaxChargeP").arg(i));
+ removeInPort(QString("Unit %1 RegulateEnable").arg(i));
+
+ // 删除输出端口
+ removeOutPort(QString("Unit %1 DistributionPower").arg(i));
+ removeOutPort(QString("Unit %1 RegulateEnable").arg(i));
+ removeOutPort(QString("Unit %1 StatusCode").arg(i));
+ removeOutPort(QString("Unit %1 ErrorCode").arg(i));
+
+ // 删除动态属性
+
+ }
+ for ( int i=m_nPCSNum+1; i<=nPCSNum; i++ )
+ {
+ // 增加输入端口
+ sPortName = QString("Unit %1 TargetP").arg(i);
+ sPortDesc = QString(tr("机组%1有功目标值")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setInPortShowName( sPortName, sPortDesc );
+
+ sPortName = QString("Unit %1 RealP").arg(i);
+ sPortDesc = QString(tr("机组%1有功实际值")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setInPortShowName( sPortName, sPortDesc );
+
+ sPortName = QString("Unit %1 SOC").arg(i);
+ sPortDesc = QString(tr("机组%1 SOC(单位:%)")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setInPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 MaxDischargeP").arg(i);
+ sPortDesc = QString(tr("机组%1最大放电功率")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setInPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 MaxChargeP").arg(i);
+ sPortDesc = QString(tr("机组%1最大充电功率")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setInPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 RegulateEnable").arg(i);
+ sPortDesc = QString(tr("机组%1调节使能")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_BOOL) );
+ setInPortShowName( sPortName, sPortDesc );
+
+ // 增加输出端口
+ sPortName = QString("Unit %1 DistributionPower").arg(i);
+ sPortDesc = QString(tr("机组%1分配有功")).arg(i);
+ addOutPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setOutPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 RegulateEnable").arg(i);
+ sPortDesc = QString(tr("机组%1调节使能")).arg(i);
+ addOutPort( CPort(this, sPortName, E_PORTDATA_BOOL) );
+ setOutPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 StatusCode").arg(i);
+ sPortDesc = QString(tr("机组%1状态码")).arg(i);
+ addOutPort( CPort(this, sPortName, E_PORTDATA_INT) );
+ setOutPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 ErrorCode").arg(i);
+ sPortDesc = QString(tr("机组%1错误码")).arg(i);
+ addOutPort( CPort(this, sPortName, E_PORTDATA_INT) );
+ setOutPortShowName( sPortName, sPortDesc );
+
+ // 增加动态属性
+
+ }
+ m_nPCSNum = nPCSNum;
+ emit signalPortSizeChanged();
+}
+
+void ApcPdPCSPlugin::setSpace(int nValue)
+{
+ if (nValue > 100)
+ {
+ emit signalErrorDisplay(tr("端口间隔不能大于100"));
+ return;
+ }
+
+ if(nValue < 20)
+ {
+ emit signalErrorDisplay(tr("端口间隔不能小于20"));
+ return;
+ }
+
+ m_nCustomPortSpace = nValue;
+ emit signalPortSizeChanged();
+}
+
+void ApcPdPCSPlugin::setWaitRespTimeout(int nWaitRespTimeout)
+{
+ if(nWaitRespTimeout <= 0)
+ {
+ emit signalErrorDisplay(tr("【调节反馈超时时间】值错误,合法值:大于0"));
+ return;
+ }
+
+ m_nWaitRespTimeout = nWaitRespTimeout;
+}
+
+void ApcPdPCSPlugin::setRegulateCycle(int nRegulateCycle)
+{
+ if(nRegulateCycle < 0)
+ {
+ emit signalErrorDisplay(tr("【稳定时调节周期】值错误,合法值:大于等于0"));
+ return;
+ }
+
+ m_nRegulateCycle = nRegulateCycle;
+}
+
+void ApcPdPCSPlugin::setMinAllocP(float fMinAllocP)
+{
+ if(fMinAllocP <= 0)
+ {
+ emit signalErrorDisplay(tr("【最小分配功率】值错误,合法值:大于0"));
+ return;
+ }
+
+ m_fMinAllocP = fMinAllocP;
+}
+
+void ApcPdPCSPlugin::setCommPrecision(float fCommPrecision)
+{
+ if(fCommPrecision < 0)
+ {
+ emit signalErrorDisplay(tr("【通讯精度】值错误,合法值:大于0"));
+ return;
+ }
+
+ m_fCommPrecision = fCommPrecision;
+}
+
+void ApcPdPCSPlugin::setRegulatePrecision(float fRegulatePrecision)
+{
+ if(fRegulatePrecision < 0)
+ {
+ emit signalErrorDisplay(tr("【调节精度】值错误,合法值:大于0"));
+ return;
+ }
+
+ m_fRegulatePrecision = fRegulatePrecision;
+}
diff --git a/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/ApcPdPCSPlugin.h b/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/ApcPdPCSPlugin.h
new file mode 100644
index 00000000..258bd4c6
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/ApcPdPCSPlugin.h
@@ -0,0 +1,99 @@
+#ifndef TEMPLATEPLUGIN_H
+#define TEMPLATEPLUGIN_H
+
+#include "CBlock.h"
+#include
+
+class ApcPdPCSPlugin : public CBlock
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA( IID Block_iid ) // Q_PLUGIN_METADATA 宏用于描述插件元数据
+ Q_INTERFACES( CBlock ) // Q_INTERFACES 宏用于告诉Qt该类实现的接口
+
+public:
+ Q_INVOKABLE ApcPdPCSPlugin();
+ Q_INVOKABLE ~ApcPdPCSPlugin();
+
+public:
+ QString name() { return "apc_pd_pcs"; }
+ QString showName() { return QObject::tr("储能机组有功分配器V2"); }
+ QString propertyShowName( QString sPropertyName );
+ QIcon getIcon() { return QIcon(":/icon/"+name()+".png"); }
+
+ //< 获取图元输入端口文本的位置坐标,nInputTextWidth是文字边框的宽度
+ QPointF getInputTextPos(const int nInputIndex,const int nInputTextWidth) override;
+ QPointF getOutputTextPos(const int nOutputIndex,const int nOutputTextWidth) override;
+ //< 获取输入端口高度
+ int getInputHeight(const int nIndex, const int nPortSize, const int nPortHeight) override;
+ int getOutputHeight(const int nIndex, const int nPortSize, const int nPortHeight) override;
+ // 第一个输入(输出、文字)与顶的距离
+ int getFirstHeight() override;
+ //< 输出值显示分隔符
+ QString getOutputRealValueSep() override;
+
+ QPointF getIconPos(const QSize &pixmapSize) override;
+ //< 用于画图元外边框的折线
+ QPolygonF getPolygon(const int nWidth,const int nHeight) override;
+ bool isCustomItemPos() override;
+
+ void setDefaultIconSize() override;
+ //< 初始化后执行的操作,可以图元自定义一些特殊操作
+ void afterInitialize() override;
+
+private:
+ int getInputHeight(const int nIndex);
+ int getOutputHeight(const int nIndex );
+ void initPropertyMAP();
+
+public:
+ int getPCSNum () { return m_nPCSNum; }
+ void setPCSNum ( int nPCSNum );
+ int getSpace() { return m_nCustomPortSpace; }
+ void setSpace( int nValue );
+
+ void setWaitRespTimeout(int nWaitRespTimeout);
+ int getWaitRespTimeout() {return m_nWaitRespTimeout;}
+ void setRegulateCycle(int nRegulateCycle);
+ int getRegulateCycle() {return m_nRegulateCycle;}
+
+ void setMinAllocP(float fMinAllocP);
+ float getMinAllocP() {return m_fMinAllocP;}
+
+ void setCommPrecision(float fCommPrecision);
+ float getCommPrecision() {return m_fCommPrecision;}
+ void setRegulatePrecision(float fRegulatePrecision);
+ float getRegulatePrecision() {return m_fRegulatePrecision;}
+
+private:
+ QMap m_mapProperty;
+ int m_nTopInPortNum; //< 顶框中输入端口个数
+ int m_nTopOutPortNum; //< 顶框中输出端口个数
+
+ int m_nCustomPortSpace;
+ Q_PROPERTY(int PortSpace READ getSpace WRITE setSpace USER true DESIGNABLE true)
+
+ int m_nPCSNum; // PCS个数 机组个数
+ Q_PROPERTY( int UnitCnt READ getPCSNum WRITE setPCSNum USER true DESIGNABLE true )
+
+ IMPL_PROPERTY( QString, AllocALG ) // 功率分配算法 allocation algorithm
+ Q_PROPERTY( QString AllocALG READ get_AllocALG WRITE set_AllocALG USER true DESIGNABLE true )
+
+ int m_nWaitRespTimeout; //< 等待调节反馈超时时间
+ Q_PROPERTY( int WaitRespTimeout READ getWaitRespTimeout WRITE setWaitRespTimeout USER true DESIGNABLE true )
+
+ int m_nRegulateCycle; //< 稳定时定时调节周期
+ Q_PROPERTY( int RegulateCycle READ getRegulateCycle WRITE setRegulateCycle USER true DESIGNABLE true )
+
+ float m_fMinAllocP; //< 最小分配功率
+ Q_PROPERTY( float MinAllocP READ getMinAllocP WRITE setMinAllocP USER true DESIGNABLE true )
+
+ //< 作用:1、若读回来的机组功率设定值与下发的目标值差值的绝对值小于该值,则认为通讯成功。2、下发功率是此值的倍数
+ float m_fCommPrecision;
+ Q_PROPERTY( float CommPrecision READ getCommPrecision WRITE setCommPrecision USER true DESIGNABLE true )
+
+ //< 作用:若机组的功率实际值与设定值差值的绝对值小于该值,则认为成功。
+ float m_fRegulatePrecision;
+ Q_PROPERTY( float RegulatePrecision READ getRegulatePrecision WRITE setRegulatePrecision USER true DESIGNABLE true )
+};
+
+#endif // TEMPLATEPLUGIN_H
diff --git a/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/apc_pd_pcsplugin.pro b/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/apc_pd_pcsplugin.pro
new file mode 100644
index 00000000..5fc86b9a
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/apc_pd_pcsplugin.pro
@@ -0,0 +1,33 @@
+TARGET = apc_pd_pcsplugin
+QT = core gui widgets
+CONFIG += dll
+TEMPLATE = lib
+
+SOURCES += \
+ ApcPdPCSPlugin.cpp
+
+HEADERS += \
+ ApcPdPCSPlugin.h
+
+INCLUDEPATH += \
+ ../.. \
+ ../../fbd_block \
+ ../../include
+
+LIBS += \
+ -lfbd_block
+
+RESOURCES += \
+ icon.qrc
+
+!include( ../../../../common.pri ){
+ error(the file common.pri is not exist!!)
+}
+
+#fbd_plugins插件的统一规则
+FBD_PLUGINS_PRI=$$PWD/../fbd_plugins.pri
+exists($$FBD_PLUGINS_PRI) {
+ include($$FBD_PLUGINS_PRI)
+}else {
+ error("FATAL error: can not find fbd_plugins.pri")
+}
diff --git a/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/icon.qrc b/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/icon.qrc
new file mode 100644
index 00000000..7f50d9fc
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/icon.qrc
@@ -0,0 +1,5 @@
+
+
+ icon/apc_pd_pcs.png
+
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/icon/apc_pd_pcs.png b/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/icon/apc_pd_pcs.png
new file mode 100644
index 00000000..61f527f9
Binary files /dev/null and b/product/src/tools/fbd_designer/fbd_plugins/apc_pd_pcsplugin/icon/apc_pd_pcs.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/batchActionAOplugin.cpp b/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/batchActionAOplugin.cpp
new file mode 100644
index 00000000..55acb6fb
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/batchActionAOplugin.cpp
@@ -0,0 +1,175 @@
+#include "batchActionAOplugin.h"
+
+batchActionAOplugin::batchActionAOplugin(): CBlock()
+{
+ m_nInputNum = 0;
+ m_nControlTimeout=10;
+ m_nSendingInterval=50;
+ addInPort( CPort(this, "I1", E_PORTDATA_BOOL) );
+ setInPortShowName("I1",tr("使能"));
+
+ this->setProperty( C_PROPERTY_SHOWNAME, showName() );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("ActionName")).toStdString().c_str(), E_VALUEEDIT_LINEEDIT );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("SendingInterval")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("PortSpace")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("Width")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("InputNum")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("ControlTimeout")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+
+
+ ActionName = "bactchActionAO";
+
+}
+
+batchActionAOplugin::~batchActionAOplugin()
+{
+}
+
+QString batchActionAOplugin::propertyShowName( QString sPropertyName )
+{
+ if ( sPropertyName == "ActionName" )
+ return tr("动作名称");
+ else if ( sPropertyName == "SendingInterval" )
+ return tr("发送周期(单位:s)");
+ else if ( sPropertyName == "PortSpace" )
+ return tr("端口间距");
+ else if ( sPropertyName == "Width" )
+ return tr("图元宽度");
+ else if ( sPropertyName == "InputNum" )
+ return tr("输入个数");
+ else if ( sPropertyName == "ControlTimeout" )
+ return tr("命令超时时间(单位:ms)");
+ else if ( sPropertyName.startsWith("InputRtu") )
+ return tr("输入")+sPropertyName.remove( "InputRtu" )+tr("Rtu标识");
+ else if ( sPropertyName.startsWith("InputFlag") )
+ return tr("输入")+sPropertyName.remove( "InputFlag" )+tr("控制点标识");
+ else if ( sPropertyName.startsWith("CtrlStr") )
+ return tr("输入")+sPropertyName.remove( "CtrlStr" )+tr("控制测点串");
+ return sPropertyName;
+}
+
+void batchActionAOplugin::setWidth(int nValue)
+{
+ if (nValue > 1000)
+ {
+ emit signalErrorDisplay(tr("宽度不能大于1000"));
+ return;
+ }
+ if (nValue < 40)
+ {
+ emit signalErrorDisplay(tr("宽度不能小于40"));
+ return;
+ }
+ if (nValue == getIconWidth())
+ {
+ emit signalErrorDisplay(tr("输入值与现值相同"));
+ return;
+ }
+ setIconWidth( nValue );
+ emit signalPortSizeChanged();
+}
+
+void batchActionAOplugin::setSpace(int nValue)
+{
+ if (nValue > 400)
+ {
+ emit signalErrorDisplay(tr("端口间隔不能大于400"));
+ return;
+ }
+ if (nValue < 16)
+ {
+ emit signalErrorDisplay(tr("端口间隔不能小于16"));
+ return;
+ }
+ if (nValue == getPortSpace())
+ {
+ emit signalErrorDisplay(tr("输入值与现值相同"));
+ return;
+ }
+ setPortSpace( nValue );
+ emit signalPortSizeChanged();
+}
+
+void batchActionAOplugin::setCustomInputNum(int value)
+{
+
+ if (value < 0)
+ {
+ emit signalErrorDisplay(tr("输入值不能小于0"));
+ return;
+ }
+ if (value == m_nInputNum )
+ {
+ emit signalErrorDisplay(tr("输入值与现值相同"));
+ return;
+ }
+
+ int oldvalue = m_nInputNum;
+ QString PortName;
+ for (int i = value; i < oldvalue; i++)
+ {
+ PortName = QString("I%1").arg(i+1);
+ removeInPort(PortName);
+
+ m_bChangeDynamicProperty = false;
+ QString sPropertyNameRtu = QString("InputRtu%1").arg(i+1);
+ QString sPropertyNameParam = QString("InputFlag%1").arg(i+1);
+ QString sPropertyNameCtrlStr = QString("CtrlStr%1").arg(i+1);
+ this->setProperty( sPropertyNameRtu.toStdString().c_str(), QVariant::Invalid );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+sPropertyNameRtu).toStdString().c_str(), QVariant::Invalid );
+ this->setProperty( sPropertyNameParam.toStdString().c_str(), QVariant::Invalid );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+sPropertyNameParam).toStdString().c_str(), QVariant::Invalid );
+ this->setProperty( sPropertyNameCtrlStr.toStdString().c_str(), QVariant::Invalid );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+sPropertyNameCtrlStr).toStdString().c_str(), QVariant::Invalid );
+
+ m_bChangeDynamicProperty = true;
+ }
+ for (int i = oldvalue; i < value; i++)
+ {
+ PortName = QString("I%1").arg(i+1);
+ addInPort( CPort(this, PortName, E_PORTDATA_FLOAT) );
+
+ m_bChangeDynamicProperty = false;
+ QString sPropertyNameRtu = QString("InputRtu%1").arg(i+1);
+ QString sPropertyNameParam = QString("InputFlag%1").arg(i+1);
+ QString sPropertyNameCtrlStr = QString("CtrlStr%1").arg(i+1);
+
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+sPropertyNameRtu).toStdString().c_str(), E_VALUEEDIT_LINEEDIT );
+ this->setProperty( sPropertyNameRtu.toStdString().c_str(), "" );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+sPropertyNameParam).toStdString().c_str(), E_VALUEEDIT_LINEEDIT );
+ this->setProperty( sPropertyNameParam.toStdString().c_str(), "");
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+sPropertyNameCtrlStr).toStdString().c_str(), E_VALUEEDIT_LINEEDIT );
+ this->setProperty( sPropertyNameCtrlStr.toStdString().c_str(), "");
+
+ m_bChangeDynamicProperty = true;
+ }
+ emit signalPortSizeChanged();
+ m_nInputNum = value;
+
+}
+
+void batchActionAOplugin::setSendingInterval(int nValue)
+{
+ m_nSendingInterval=nValue;
+}
+
+void batchActionAOplugin::setControlTimeout(int nValue)
+{
+ m_nControlTimeout=nValue;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/batchActionAOplugin.h b/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/batchActionAOplugin.h
new file mode 100644
index 00000000..3d9278f5
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/batchActionAOplugin.h
@@ -0,0 +1,56 @@
+#ifndef TEMPLATEPLUGIN_H
+#define TEMPLATEPLUGIN_H
+
+#include "CBlock.h"
+
+class batchActionAOplugin : public CBlock
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA( IID Block_iid ) // Q_PLUGIN_METADATA 宏用于描述插件元数据
+ Q_INTERFACES( CBlock ) // Q_INTERFACES 宏用于告诉Qt该类实现的接口
+
+ IMPL_PROPERTY( QString, ActionName )
+ IMPL_PROPERTY( int, ControlTimeout )
+ IMPL_PROPERTY( int, RedoTimes )
+
+ Q_PROPERTY( QString ActionName READ get_ActionName WRITE set_ActionName USER true DESIGNABLE true )
+ Q_PROPERTY( int SendingInterval READ getSendingInterval WRITE setSendingInterval USER true DESIGNABLE true )
+ Q_PROPERTY( int PortSpace READ getSpace WRITE setSpace USER true DESIGNABLE true )
+ Q_PROPERTY( int Width READ getWidth WRITE setWidth USER true DESIGNABLE true )
+ Q_PROPERTY( int InputNum READ getCustomInputNum WRITE setCustomInputNum USER true DESIGNABLE true )
+ Q_PROPERTY( int ControlTimeout READ getControlTimeout WRITE setControlTimeout USER true DESIGNABLE true )
+
+public:
+ Q_INVOKABLE batchActionAOplugin();
+ Q_INVOKABLE ~batchActionAOplugin();
+
+public:
+ QString name() { return "batchActionAO"; }
+ QString showName() { return QObject::tr("AO批量控制"); }
+ QString propertyShowName( QString sPropertyName );
+ QIcon getIcon() { return QIcon(":/icon/"+name()+".png"); }
+
+ int getWidth() { return (int)getIconWidth(); }
+ void setWidth( int nValue );
+ int getSpace() { return getPortSpace(); }
+ void setSpace( int nValue );
+ int getCustomInputNum() { return m_nInputNum; }
+ void setCustomInputNum(int nValue);
+ int getSendingInterval() { return m_nSendingInterval; }
+ void setSendingInterval(int nValue);
+ int getControlTimeout() { return m_nControlTimeout; }
+ void setControlTimeout(int nValue);
+protected:
+
+
+private:
+
+
+private:
+ int m_nInputNum;
+ int m_nSendingInterval;
+ bool m_bChangeDynamicProperty;
+ int m_nControlTimeout;
+};
+
+#endif // TEMPLATEPLUGIN_H
diff --git a/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/batchActionAOplugin.pro b/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/batchActionAOplugin.pro
new file mode 100644
index 00000000..b3788302
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/batchActionAOplugin.pro
@@ -0,0 +1,39 @@
+TARGET = batchActionAOplugin
+QT = core gui widgets xml sql
+CONFIG += dll
+TEMPLATE = lib
+CONFIG += qt
+
+SOURCES += \
+ batchActionAOplugin.cpp \
+
+HEADERS += \
+ batchActionAOplugin.h \
+
+INCLUDEPATH += \
+ ../../fbd_block \
+ ../../fbd_tree \
+ ../../fbd_property \
+
+LIBS += \
+ -lfbd_block \
+ -lfbd_tree \
+
+RESOURCES += \
+ icon.qrc
+
+!include( ../../../../idl_files/idl_files.pri){
+ error(the file idl_files.pri is not exist!!)
+}
+
+!include( ../../../../common.pri ){
+ error(the file common.pri is not exist!!)
+}
+
+#fbd_plugins插件的统一规则
+FBD_PLUGINS_PRI=$$PWD/../fbd_plugins.pri
+exists($$FBD_PLUGINS_PRI) {
+ include($$FBD_PLUGINS_PRI)
+}else {
+ error("FATAL error: can not find fbd_plugins.pri")
+}
diff --git a/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/icon.qrc b/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/icon.qrc
new file mode 100644
index 00000000..bf3f885b
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/icon.qrc
@@ -0,0 +1,5 @@
+
+
+ icon/batchActionAO.png
+
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/icon/batchActionAO.png b/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/icon/batchActionAO.png
new file mode 100644
index 00000000..ff84c225
Binary files /dev/null and b/product/src/tools/fbd_designer/fbd_plugins/batchActionAOplugin/icon/batchActionAO.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/demandcontrolplugin.cpp b/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/demandcontrolplugin.cpp
new file mode 100644
index 00000000..aa432d74
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/demandcontrolplugin.cpp
@@ -0,0 +1,163 @@
+#include "demandcontrolplugin.h"
+#include
+
+DemandControlPlugin::DemandControlPlugin(): CBlock()
+{
+ m_fDemandDeadband = 50.0f;
+ m_fReverseDeadband = 50.0f;
+ m_fMaxDischargePower = 0.0f;
+ m_fMaxChargingPower = 0.0f;
+ m_nMinAdjustPeriod = 5000; //默认5秒
+
+ setPortShowNameFunctionEnable( false );
+ //输入端口
+ addInPort( CPort(this, "EnableRegulate", E_PORTDATA_BOOL) );
+ setInPortShowName( "EnableRegulate", tr("调节使能") );
+
+ addInPort( CPort(this, "MeterRealPower", E_PORTDATA_FLOAT) );
+ setInPortShowName( "MeterRealPower", tr("总实时功率") );
+
+ addInPort( CPort(this, "StorageRealPower", E_PORTDATA_FLOAT) );
+ setInPortShowName( "StorageRealPower", tr("储能实时功率") );
+
+ addInPort( CPort(this, "PlanPower", E_PORTDATA_FLOAT) );
+ setInPortShowName( "PlanPower", tr("储能计划功率") );
+
+ addInPort( CPort(this, "DemandSetValue", E_PORTDATA_FLOAT) );
+ setInPortShowName( "DemandSetValue", tr("需量设定值") );
+
+ addInPort( CPort(this, "ReversePowerSetValue", E_PORTDATA_FLOAT) );
+ setInPortShowName( "ReversePowerSetValue", tr("逆流功率设定值") );
+
+ //输出端口
+ addOutPort( CPort(this, "OutTargetPower", E_PORTDATA_FLOAT) );
+ setOutPortShowName( "OutTargetPower", tr("目标功率") );
+
+ addOutPort( CPort(this, "EnableOut", E_PORTDATA_BOOL) );
+ setOutPortShowName( "EnableOut", tr("输出使能") );
+
+ //属性
+ this->setProperty( C_PROPERTY_SHOWNAME, showName() );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("EnableDemandCtrl")).toStdString().c_str(), E_VALUEEDIT_COMBOBOX );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("DemandDeadband")).toStdString().c_str(), E_VALUEEDIT_DOUBLESPINBOX );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("MaxDischargePower")).toStdString().c_str(), E_VALUEEDIT_DOUBLESPINBOX );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("EnableReverseCtrl")).toStdString().c_str(), E_VALUEEDIT_COMBOBOX );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("ReverseDeadband")).toStdString().c_str(), E_VALUEEDIT_DOUBLESPINBOX );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("MaxChargingPower")).toStdString().c_str(), E_VALUEEDIT_DOUBLESPINBOX );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("MinAdjustPeriod")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+
+ QStringList listDemandTmp;
+ listDemandTmp<setProperty( (C_PREFIX_COMBOBOXITEM+QString("EnableDemandCtrl")).toStdString().c_str(), listDemandTmp);
+ EnableDemandCtrl = listDemandTmp.at(1);
+
+ QStringList listReverseTmp;
+ listReverseTmp<
setProperty( (C_PREFIX_COMBOBOXITEM+QString("EnableReverseCtrl")).toStdString().c_str(), listReverseTmp);
+ EnableReverseCtrl = listReverseTmp.at(1);
+
+ setPortSpace(40);
+ setIconWidth(60);
+}
+
+DemandControlPlugin::~DemandControlPlugin()
+{
+}
+
+QString DemandControlPlugin::propertyShowName( QString sPropertyName )
+{
+ if ( sPropertyName == "EnableDemandCtrl" )
+ return tr("是否启用需量控制");
+ else if ( sPropertyName == "DemandDeadband" )
+ return tr("需量调节死区");
+ else if ( sPropertyName == "MaxDischargePower" )
+ return tr("超需时最大放电功率");
+ else if ( sPropertyName == "EnableReverseCtrl" )
+ return tr("是否启用防逆流控制");
+ else if ( sPropertyName == "MaxChargingPower" )
+ return tr("逆流时最大充电功率");
+ else if ( sPropertyName == "ReverseDeadband" )
+ return tr("逆流调节死区");
+ else if ( sPropertyName == "MinAdjustPeriod" )
+ return tr("最小调节间隔(单位:ms)");
+
+ return sPropertyName;
+}
+
+void DemandControlPlugin::setDemandDeadband( float fDemandDeadband )
+{
+ if ( fDemandDeadband <= 0 )
+ {
+ emit signalErrorDisplay(tr("【需量调节死区】值错误,合法值:大于0"));
+ return;
+ }
+ m_fDemandDeadband = fDemandDeadband;
+}
+
+void DemandControlPlugin::setMaxDischargePower(float fMaxDischargePower)
+{
+ if (fMaxDischargePower < 0)
+ {
+ emit signalErrorDisplay(tr("【最大放电功率】值错误,合法值:大于等于0"));
+ return;
+ }
+ m_fMaxDischargePower = fMaxDischargePower;
+}
+
+void DemandControlPlugin::setReverseDeadband(float fReverseDeadband)
+{
+ if ( fReverseDeadband <= 0 )
+ {
+ emit signalErrorDisplay(tr("【逆流调节死区】值错误,合法值:大于0"));
+ return;
+ }
+ m_fReverseDeadband = fReverseDeadband;
+}
+
+void DemandControlPlugin::setMaxChargingPower(float fMaxChargingPower)
+{
+ if (fMaxChargingPower > 0)
+ {
+ emit signalErrorDisplay(tr("【最大充电功率】值错误,合法值:小于等于0"));
+ return;
+ }
+ m_fMaxChargingPower = fMaxChargingPower;
+}
+
+void DemandControlPlugin::setMinAdjustPeriod(int nMinAdjustPeriod)
+{
+ if (nMinAdjustPeriod < 0)
+ {
+ emit signalErrorDisplay(tr("【最小调节间隔】值错误,合法值:大于等于0"));
+ return;
+ }
+ m_nMinAdjustPeriod = nMinAdjustPeriod;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/demandcontrolplugin.h b/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/demandcontrolplugin.h
new file mode 100644
index 00000000..0cd96b95
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/demandcontrolplugin.h
@@ -0,0 +1,74 @@
+#ifndef TEMPLATEPLUGIN_H
+#define TEMPLATEPLUGIN_H
+
+#include "CBlock.h"
+
+class DemandControlPlugin : public CBlock
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA( IID Block_iid ) // Q_PLUGIN_METADATA 宏用于描述插件元数据
+ Q_INTERFACES( CBlock ) // Q_INTERFACES 宏用于告诉Qt该类实现的接口
+
+public:
+ Q_INVOKABLE DemandControlPlugin();
+ Q_INVOKABLE ~DemandControlPlugin();
+
+public:
+ QString name() { return "demandcontrol"; }
+ QString showName() { return QObject::tr("需量/逆流控制策略"); }
+ QString propertyShowName( QString sPropertyName );
+ QIcon getIcon() { return QIcon(":/icon/"+name()+".png"); }
+
+public:
+ float getDemandDeadband() { return m_fDemandDeadband; }
+ void setDemandDeadband( float fDemandDeadband );
+
+ float getMaxDischargePower() {return m_fMaxDischargePower;}
+ void setMaxDischargePower(float fMaxDischargePower);
+
+ float getReverseDeadband() { return m_fReverseDeadband; }
+ void setReverseDeadband( float fReverseDeadband );
+
+ float getMaxChargingPower() {return m_fMaxChargingPower;}
+ void setMaxChargingPower(float fMaxChargingPower);
+
+ int getMinAdjustPeriod() {return m_nMinAdjustPeriod;}
+ void setMinAdjustPeriod(int nMinAdjustPeriod);
+
+private:
+ IMPL_PROPERTY( QString, EnableDemandCtrl) // 是否启用需量控制
+ Q_PROPERTY( QString EnableDemandCtrl READ get_EnableDemandCtrl WRITE set_EnableDemandCtrl USER true DESIGNABLE true )
+
+ float m_fDemandDeadband; // 需量调节死区
+ Q_PROPERTY( float DemandDeadband READ getDemandDeadband WRITE setDemandDeadband USER true DESIGNABLE true )
+
+ float m_fMaxDischargePower; // 超需时最大放电功率
+ Q_PROPERTY( float MaxDischargePower READ getMaxDischargePower WRITE setMaxDischargePower USER true DESIGNABLE true )
+
+ IMPL_PROPERTY( QString, EnableReverseCtrl) // 是否启用逆流控制
+ Q_PROPERTY( QString EnableReverseCtrl READ get_EnableReverseCtrl WRITE set_EnableReverseCtrl USER true DESIGNABLE true )
+
+ float m_fReverseDeadband; // 逆流调节死区
+ Q_PROPERTY( float ReverseDeadband READ getReverseDeadband WRITE setReverseDeadband USER true DESIGNABLE true )
+
+ float m_fMaxChargingPower; // 逆流时最大充电功率
+ Q_PROPERTY( float MaxChargingPower READ getMaxChargingPower WRITE setMaxChargingPower USER true DESIGNABLE true )
+
+ int m_nMinAdjustPeriod; // 最小调节间隔,单位:ms
+ Q_PROPERTY( int MinAdjustPeriod READ getMinAdjustPeriod WRITE setMinAdjustPeriod USER true DESIGNABLE true )
+};
+
+#endif // TEMPLATEPLUGIN_H
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/demandcontrolplugin.pro b/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/demandcontrolplugin.pro
new file mode 100644
index 00000000..3b01c758
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/demandcontrolplugin.pro
@@ -0,0 +1,33 @@
+TARGET = demandcontrolplugin
+QT = core gui widgets
+CONFIG += dll
+TEMPLATE = lib
+
+SOURCES += \
+ demandcontrolplugin.cpp
+
+HEADERS += \
+ demandcontrolplugin.h
+
+INCLUDEPATH += \
+ ../.. \
+ ../../fbd_block \
+ ../../include
+
+LIBS += \
+ -lfbd_block
+
+RESOURCES += \
+ icon.qrc
+
+!include( ../../../../common.pri ){
+ error(the file common.pri is not exist!!)
+}
+
+#fbd_plugins插件的统一规则
+FBD_PLUGINS_PRI=$$PWD/../fbd_plugins.pri
+exists($$FBD_PLUGINS_PRI) {
+ include($$FBD_PLUGINS_PRI)
+}else {
+ error("FATAL error: can not find fbd_plugins.pri")
+}
diff --git a/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/icon.qrc b/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/icon.qrc
new file mode 100644
index 00000000..796ba96f
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/icon.qrc
@@ -0,0 +1,5 @@
+
+
+ icon/demandcontrol.png
+
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/icon/demandcontrol.png b/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/icon/demandcontrol.png
new file mode 100644
index 00000000..e2b87598
Binary files /dev/null and b/product/src/tools/fbd_designer/fbd_plugins/demandcontrolplugin/icon/demandcontrol.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/fbd_plugins.pro b/product/src/tools/fbd_designer/fbd_plugins/fbd_plugins.pro
index 2faf0a6d..5c3410d3 100644
--- a/product/src/tools/fbd_designer/fbd_plugins/fbd_plugins.pro
+++ b/product/src/tools/fbd_designer/fbd_plugins/fbd_plugins.pro
@@ -15,4 +15,10 @@ SUBDIRS += \
alarmsplitplugin \
multimapplugin \
timetriggerplugin \
- videocontrolplugin
+ videocontrolplugin \
+ alarmGeneratePlugin \
+ demandcontrolplugin \
+ powercontrolreactiveplugin \
+ powerOutputCtrlplugin \
+ apc_pd_pcsplugin \
+ batchActionAOplugin
diff --git a/product/src/tools/fbd_designer/fbd_plugins/fmttextplugin/FmtCfgDialog.cpp b/product/src/tools/fbd_designer/fbd_plugins/fmttextplugin/FmtCfgDialog.cpp
index b8bae29a..4a98acbf 100644
--- a/product/src/tools/fbd_designer/fbd_plugins/fmttextplugin/FmtCfgDialog.cpp
+++ b/product/src/tools/fbd_designer/fbd_plugins/fmttextplugin/FmtCfgDialog.cpp
@@ -6,15 +6,14 @@
#define VAR_TOKEN_BEGIN "{"
#define VAR_TOKEN_END "}"
-FmtCfgDialog::FmtCfgDialog(QWidget *parent, CFmtTextPlugin *pTextPlugin) :
- QDialog(parent),
- ui(new Ui::FmtCfgDialog),
- m_pFmtTextPlugin(pTextPlugin)
+FmtCfgDialog::FmtCfgDialog(QWidget *parent, CFmtTextPlugin *pTextPlugin) : QDialog(parent),
+ ui(new Ui::FmtCfgDialog),
+ m_pFmtTextPlugin(pTextPlugin)
{
ui->setupUi(this);
- setWindowTitle( tr("格式化文本配置") );
+ setWindowTitle(tr("格式化文本配置"));
- connect(ui->textEdit_text,&QTextEdit::textChanged,this,&FmtCfgDialog::previewLoad);
+ connect(ui->textEdit_text, &QTextEdit::textChanged, this, &FmtCfgDialog::previewLoad);
}
void FmtCfgDialog::setText(const QString &srcText)
@@ -41,63 +40,92 @@ FmtCfgDialog::~FmtCfgDialog()
void FmtCfgDialog::previewLoad()
{
- QString text = ui->textEdit_text->toPlainText(),previewText;
- int begin_index,end_index;
- while(text.size() != 0 )
+ QString text = ui->textEdit_text->toPlainText(), previewText;
+ int begin_index, end_index;
+
+
+ while (text.size() != 0)
{
- if( ( begin_index = text.indexOf(VAR_TOKEN_BEGIN)) != -1)
+ if ((end_index = text.indexOf(VAR_TOKEN_END)) != -1)
{
- previewText += text.left(begin_index);
- if( ( end_index = text.indexOf(VAR_TOKEN_END)) != -1)
+ QString var;
+ if ((begin_index = text.lastIndexOf(VAR_TOKEN_BEGIN,end_index)) != -1)
{
- auto var = text.mid(begin_index + 1,end_index - begin_index - 1);
-// qDebug() << "----------------------";
-// qDebug() << "var is |" << var;
-// qDebug() << VAR_TOKEN_BEGIN << " begin_index is |" << QString::number(begin_index);
-// qDebug() << VAR_TOKEN_END << " end_index is |" << QString::number(end_index);
-// qDebug() << "text is |" << text;
-// qDebug() << "previewText is |" << previewText;
-
- if(m_pFmtTextPlugin->getInPort(var).dataType() == E_PORTDATA_INT)
+ var = text.mid(begin_index + 1, end_index - begin_index - 1);
+ bool isInt = false;
+ int nVar = var.mid(1).toInt(&isInt);
+ if (var[0] == 'I' && isInt && nVar < m_pFmtTextPlugin->getInPortSize() && nVar > 0)
{
- previewText += "23";
- }else if(m_pFmtTextPlugin->getInPort(var).dataType() == E_PORTDATA_STRING){
- previewText += "sample";
- }else if(m_pFmtTextPlugin->getInPort(var).dataType() == E_PORTDATA_FLOAT){
- previewText += "23.3";
- }else if(m_pFmtTextPlugin->getInPort(var).dataType() == E_PORTDATA_BOOL){
- previewText += tr("真");
- }else { previewText += tr("未知类型"); }
- text = text.mid(end_index + 1);
+ if (m_pFmtTextPlugin->getInPort(var).dataType() == E_PORTDATA_INT)
+ {
+ var = "23";
+ }
+ else if (m_pFmtTextPlugin->getInPort(var).dataType() == E_PORTDATA_STRING)
+ {
+ var = "sample";
+ }
+ else if (m_pFmtTextPlugin->getInPort(var).dataType() == E_PORTDATA_FLOAT)
+ {
+ var = "23.3";
+ }
+ else if (m_pFmtTextPlugin->getInPort(var).dataType() == E_PORTDATA_BOOL)
+ {
+ var = tr("真");
+ }
+ else
+ {
+ var = QString(VAR_TOKEN_BEGIN) + var + VAR_TOKEN_END;
+ }
+ }
+ else
+ {
+ var = QString(VAR_TOKEN_BEGIN) + var + VAR_TOKEN_END;
+ }
}
- else{ previewText += tr("后续语法有误"); break;}
-
- }else{
+ else
+ {
+ begin_index = end_index;
+ var = VAR_TOKEN_END;
+ }
+// qDebug() << "----------------------";
+// qDebug() << "var :" << var;
+// qDebug() << "begin_index:" << QString::number(begin_index);
+// qDebug() << "end_index:" << QString::number(end_index);
+// qDebug() << "text:" << text;
+// qDebug() << "previewText before:" << previewText;
+ previewText += text.left(begin_index) + var;
+// qDebug() << "previewText after:" << previewText;
+ text = text.mid(end_index + 1);
+ }
+ else
+ {
+ // 找不到{ 停止解析
previewText += text;
text = "";
}
+
}
ui->textEdit_preview->setPlainText(previewText);
-
}
void FmtCfgDialog::varLoad()
{
- if(m_pFmtTextPlugin->getInPortSize() == 1){
+ if (m_pFmtTextPlugin->getInPortSize() == 1)
+ {
ui->groupBox_var->setHidden(true);
return;
}
auto layout = new QVBoxLayout;
ui->groupBox_var->setLayout(layout);
- for(int i = 1; i < m_pFmtTextPlugin->getInPortSize(); i++) //< 从1开始,0是使能输入端口
+ for (int i = 1; i < m_pFmtTextPlugin->getInPortSize(); i++) //< 从1开始,0是使能输入端口
{
- QPushButton * tmpBtn = new QPushButton( m_pFmtTextPlugin->getInPortShowName(i) + tr("[")+ m_pFmtTextPlugin->getInPort(m_pFmtTextPlugin->getInPortName(i)).dataTypeName() + "]" );
- tmpBtn->setProperty("name",m_pFmtTextPlugin->getInPortName(i));
- connect(tmpBtn,&QPushButton::clicked, [=]( ) { ui->textEdit_text->insertPlainText( VAR_TOKEN_BEGIN + tmpBtn->property("name").toString() + VAR_TOKEN_END); } );
+ QPushButton *tmpBtn = new QPushButton(m_pFmtTextPlugin->getInPortShowName(i) + tr("[") + m_pFmtTextPlugin->getInPort(m_pFmtTextPlugin->getInPortName(i)).dataTypeName() + "]");
+ tmpBtn->setProperty("name", m_pFmtTextPlugin->getInPortName(i));
+ connect(tmpBtn, &QPushButton::clicked, [=]()
+ { ui->textEdit_text->insertPlainText(VAR_TOKEN_BEGIN + tmpBtn->property("name").toString() + VAR_TOKEN_END); });
layout->addWidget(tmpBtn); // TYPE 变量名
}
layout->addStretch();
-
}
diff --git a/product/src/tools/fbd_designer/fbd_plugins/fmttextplugin/icon/fmttext.png b/product/src/tools/fbd_designer/fbd_plugins/fmttextplugin/icon/fmttext.png
index e47c22d3..a7dbb69b 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/fmttextplugin/icon/fmttext.png and b/product/src/tools/fbd_designer/fbd_plugins/fmttextplugin/icon/fmttext.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/icon/multimap.png b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/icon/multimap.png
index c42df397..2f00ac77 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/icon/multimap.png and b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/icon/multimap.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/delete.png b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/delete.png
index 8915b42c..5b6875fe 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/delete.png and b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/delete.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/export.png b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/export.png
index 640a5e65..2dad17db 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/export.png and b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/export.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/import.png b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/import.png
index 1d169c5b..680135f6 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/import.png and b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/import.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/save.png b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/save.png
index 4214b3bb..222639de 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/save.png and b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/save.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/undo.png b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/undo.png
index 4d3602f4..dabd132c 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/undo.png and b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/image/undo.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/mapcfgdlg.cpp b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/mapcfgdlg.cpp
index 7ae4b31b..efb2fbc2 100644
--- a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/mapcfgdlg.cpp
+++ b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/mapcfgdlg.cpp
@@ -22,12 +22,13 @@
#include "pub_utility_api/CharUtil.h"
#include
-
MapCfgDlg::MapCfgDlg(QWidget *parent) :
- QDialog(parent),
+ CustomUiDialog(parent),
ui(new Ui::MapCfgDlg)
{
ui->setupUi(this);
+ this->setWindowTitle(tr("映射配置"));
+
ui->tableWidget->setAcceptDrops(true);
ui->tableWidget->setDropIndicatorShown(true);
ui->tableWidget->setDragEnabled(true);
@@ -41,6 +42,8 @@ MapCfgDlg::MapCfgDlg(QWidget *parent) :
connect(ui->search,&QLineEdit::textChanged,this,&MapCfgDlg::searchData);
connect(ui->ok,&QPushButton::clicked,this,&MapCfgDlg::okClicked);
connect(ui->cancle,&QPushButton::clicked,this,&MapCfgDlg::cancleClicked);
+
+ CustomUiDialog::setAutoLayout(true);
}
MapCfgDlg::~MapCfgDlg()
diff --git a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/mapcfgdlg.h b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/mapcfgdlg.h
index 372a15d1..2ea4c105 100644
--- a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/mapcfgdlg.h
+++ b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/mapcfgdlg.h
@@ -6,12 +6,13 @@
#include
#include "model_excel/xlsx/xlsxdocument.h"
#include "model_excel/xlsx/xlsxformat.h"
+#include "pub_widget/CustomDialog.h"
namespace Ui {
class MapCfgDlg;
}
-class MapCfgDlg : public QDialog
+class MapCfgDlg : public CustomUiDialog
{
Q_OBJECT
diff --git a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/multimapplugin.pro b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/multimapplugin.pro
index aedfa049..faa6b8e4 100644
--- a/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/multimapplugin.pro
+++ b/product/src/tools/fbd_designer/fbd_plugins/multimapplugin/multimapplugin.pro
@@ -30,6 +30,7 @@ LIBS += \
-lmodel_excel \
-lpub_logger_api \
-llog4cplus \
+ -lpub_widget
RESOURCES += \
icon.qrc
diff --git a/product/src/tools/fbd_designer/fbd_plugins/phonecallplugin/icon/phonecall.png b/product/src/tools/fbd_designer/fbd_plugins/phonecallplugin/icon/phonecall.png
index 8e19047a..3924e51b 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/phonecallplugin/icon/phonecall.png and b/product/src/tools/fbd_designer/fbd_plugins/phonecallplugin/icon/phonecall.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/icon.qrc b/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/icon.qrc
new file mode 100644
index 00000000..dcf96a8d
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/icon.qrc
@@ -0,0 +1,5 @@
+
+
+ icon/powerOutputCtrl.png
+
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/icon/powerOutputCtrl.png b/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/icon/powerOutputCtrl.png
new file mode 100644
index 00000000..ff84c225
Binary files /dev/null and b/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/icon/powerOutputCtrl.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/powerCtrlplugin.cpp b/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/powerCtrlplugin.cpp
new file mode 100644
index 00000000..ebda8207
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/powerCtrlplugin.cpp
@@ -0,0 +1,74 @@
+#include "powerCtrlplugin.h"
+
+powerCtrlplugin::powerCtrlplugin(): CBlock()
+{
+ // CtrlStr属性会因为InPortCtrlStr属性显示或隐藏,所以作为动态属性
+ this->setProperty( QString("CtrlStr").toStdString().c_str(), "" );
+
+ addInPort( CPort(this, "I1", E_PORTDATA_FLOAT) );
+ addInPort( CPort(this, "I2", E_PORTDATA_BOOL) );
+ setInPortShowName("I1",tr("目标值"));
+ setInPortShowName("I2",tr("使能"));
+
+ this->setProperty( C_PROPERTY_SHOWNAME, showName() );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("ActionName")).toStdString().c_str(), E_VALUEEDIT_LINEEDIT );
+
+ QStringList listTmp2;
+ listTmp2<setProperty( (C_PREFIX_COMBOBOXITEM+QString("InPortCtrlStr")).toStdString().c_str(), listTmp2 );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("InPortCtrlStr")).toStdString().c_str(), E_VALUEEDIT_COMBOBOX );
+
+
+ ActionName = "powerCtrl";
+ InPortCtrlStr = listTmp2.at(0);
+}
+
+powerCtrlplugin::~powerCtrlplugin()
+{
+}
+
+QString powerCtrlplugin::propertyShowName( QString sPropertyName )
+{
+ if ( sPropertyName == "ActionName" )
+ return tr("动作名称");
+ else if ( sPropertyName == "CtrlStr" )
+ return tr("控制测点串");
+ else if ( sPropertyName == "InPortCtrlStr" )
+ return tr("输入控制测点串");
+ return sPropertyName;
+}
+
+QString powerCtrlplugin::get_InPortCtrlStr()
+{
+ return InPortCtrlStr;
+}
+
+void powerCtrlplugin::set_InPortCtrlStr( QString sValue )
+{
+ if ( sValue.startsWith("0") )
+ {
+ this->setProperty( QString("CtrlStr").toStdString().c_str(), "" );
+ removeInPort( "I0" );
+ }
+ else
+ {
+ this->setProperty( QString("CtrlStr").toStdString().c_str(), QVariant::Invalid );
+ insertInPort( 0, CPort(this, "I0", E_PORTDATA_STRING) );
+ setInPortShowName("I0",tr("测点"));
+ }
+ emit signalPortSizeChanged();
+
+ InPortCtrlStr = sValue;
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/powerCtrlplugin.h b/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/powerCtrlplugin.h
new file mode 100644
index 00000000..7ebce883
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/powerCtrlplugin.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#include "CBlock.h"
+
+class powerCtrlplugin : public CBlock
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA( IID Block_iid ) // Q_PLUGIN_METADATA 宏用于描述插件元数据
+ Q_INTERFACES( CBlock ) // Q_INTERFACES 宏用于告诉Qt该类实现的接口
+
+ IMPL_PROPERTY( QString, ActionName )
+
+
+ Q_PROPERTY( QString ActionName READ get_ActionName WRITE set_ActionName USER true DESIGNABLE true )
+ Q_PROPERTY( QString InPortCtrlStr READ get_InPortCtrlStr WRITE set_InPortCtrlStr USER true DESIGNABLE true )
+
+public:
+ Q_INVOKABLE powerCtrlplugin();
+ Q_INVOKABLE ~powerCtrlplugin();
+
+public:
+ QString name() { return "powerOutputCtrl"; }
+ QString showName() { return QObject::tr("功率输出控制"); }
+ QString propertyShowName( QString sPropertyName );
+ QIcon getIcon() { return QIcon(":/icon/"+name()+".png"); }
+
+private:
+ QString get_InPortCtrlStr();
+ void set_InPortCtrlStr( QString sValue );
+
+private:
+ QString InPortCtrlStr;
+};
+
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/powerOutputCtrlplugin.pro b/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/powerOutputCtrlplugin.pro
new file mode 100644
index 00000000..36c1d773
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/powerOutputCtrlplugin/powerOutputCtrlplugin.pro
@@ -0,0 +1,39 @@
+TARGET = powerCtrlplugin
+QT = core gui widgets xml sql
+CONFIG += dll
+TEMPLATE = lib
+CONFIG += qt
+
+SOURCES += \
+ powerCtrlplugin.cpp \
+
+HEADERS += \
+ powerCtrlplugin.h \
+
+INCLUDEPATH += \
+ ../../fbd_block \
+ ../../fbd_tree \
+ ../../fbd_property \
+
+LIBS += \
+ -lfbd_block \
+ -lfbd_tree \
+
+RESOURCES += \
+ icon.qrc
+
+!include( ../../../../idl_files/idl_files.pri){
+ error(the file idl_files.pri is not exist!!)
+}
+
+!include( ../../../../common.pri ){
+ error(the file common.pri is not exist!!)
+}
+
+#fbd_plugins插件的统一规则
+FBD_PLUGINS_PRI=$$PWD/../fbd_plugins.pri
+exists($$FBD_PLUGINS_PRI) {
+ include($$FBD_PLUGINS_PRI)
+}else {
+ error("FATAL error: can not find fbd_plugins.pri")
+}
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrolgenplugin/powercontrolgenplugin.cpp b/product/src/tools/fbd_designer/fbd_plugins/powercontrolgenplugin/powercontrolgenplugin.cpp
index 4893933c..5348cf5e 100644
--- a/product/src/tools/fbd_designer/fbd_plugins/powercontrolgenplugin/powercontrolgenplugin.cpp
+++ b/product/src/tools/fbd_designer/fbd_plugins/powercontrolgenplugin/powercontrolgenplugin.cpp
@@ -2,6 +2,18 @@
#define CN_MAX_UNIT_COUNT 50 //最大机组数量
+#define CN_WIDTH 360 // 图元宽度
+#define CN_HEIGHTSPACE 70 // 输入(输出、文字)上下之间的间隔
+#define CN_FIRSTHEIGHT (CN_HEIGHTSPACE-14)/2 // 第一个输入(输出、文字)与顶的距离
+#define CN_GENHEADINPUTNUM 4 // GEN顶框输入个数
+#define CN_GENHEADOUTPUTNUM 5 // GEN顶框输出个数
+#define CN_GENINPUTNUM 5 // GEN框输入个数
+#define CN_GENOUTPUTNUM 4 // GEN框输出个数
+#define CN_MAXGENHEADNUM (CN_GENHEADINPUTNUM>=CN_GENHEADOUTPUTNUM ? CN_GENHEADINPUTNUM : CN_GENHEADOUTPUTNUM)
+#define CN_MAXGENNUM (CN_GENINPUTNUM>=CN_GENOUTPUTNUM ? CN_GENINPUTNUM : CN_GENOUTPUTNUM)
+#define CN_GENHEADHEIGHT CN_MAXGENHEADNUM*CN_HEIGHTSPACE // GEN顶框的高度
+#define CN_GENHEIGHT CN_MAXGENNUM*CN_HEIGHTSPACE // GEN框的高度
+
PowerControlGENPlugin::PowerControlGENPlugin(): CBlock()
{
m_nGENNum = 0;
@@ -85,6 +97,117 @@ QString PowerControlGENPlugin::propertyShowName( QString sPropertyName )
return sPropertyName;
}
+QPointF PowerControlGENPlugin::getInputTextPos(const int nInputIndex, const int nInputTextWidth)
+{
+ Q_UNUSED(nInputTextWidth);
+
+ int nY = getInputHeight(nInputIndex);
+ return QPointF(1,nY);
+}
+
+QPointF PowerControlGENPlugin::getOutputTextPos(const int nOutputIndex, const int nOutputTextWidth)
+{
+ return QPointF(CN_WIDTH-nOutputTextWidth, getOutputHeight(nOutputIndex));
+}
+
+int PowerControlGENPlugin::getInputHeight(const int nIndex, const int nPortSize, const int nPortHeight)
+{
+ Q_UNUSED(nPortHeight);
+ Q_UNUSED(nPortSize);
+
+ return getInputHeight(nIndex + 1);
+}
+
+int PowerControlGENPlugin::getOutputHeight(const int nIndex, const int nPortSize, const int nPortHeight)
+{
+ Q_UNUSED(nPortHeight);
+ Q_UNUSED(nPortSize);
+
+ return getOutputHeight(nIndex + 1);
+}
+
+int PowerControlGENPlugin::getFirstHeight()
+{
+ return CN_FIRSTHEIGHT;
+}
+
+QString PowerControlGENPlugin::getOutputRealValueSep()
+{
+ return "\n";
+}
+
+QPointF PowerControlGENPlugin::getIconPos(const QSize &pixmapSize)
+{
+ int nX = (CN_WIDTH - pixmapSize.width()) / 2;
+ return QPointF(nX,5);
+}
+
+QPolygonF PowerControlGENPlugin::getPolygon(const int nWidth, const int nHeight)
+{
+ // Set Polygon Top-Left: 0/0
+ QPolygonF polygon;
+ polygon << QPointF(0, 0) << QPointF( nWidth, 0)
+ << QPointF(nWidth, nHeight) << QPointF(0, nHeight)
+ << QPointF(0, 0);
+
+ const int nGENNum = this->property("UnitCnt").toInt();
+ for ( int i=0; iproperty("UnitCnt").toInt();
+ if ( nUnitCount == 0 )
+ {
+ this->setProperty("UnitCnt",1);
+ }
+}
+
+int PowerControlGENPlugin::getInputHeight(const int nIndex)
+{
+ int nRet = CN_FIRSTHEIGHT;
+ if ( nIndex < CN_GENHEADINPUTNUM )
+ nRet += nIndex * CN_HEIGHTSPACE;
+ else
+ {
+ nRet += CN_GENHEADHEIGHT+
+ (nIndex-CN_GENHEADINPUTNUM)/CN_GENINPUTNUM*CN_GENHEIGHT+
+ (nIndex-CN_GENHEADINPUTNUM)%CN_GENINPUTNUM*CN_HEIGHTSPACE;
+ }
+ return nRet;
+}
+
+int PowerControlGENPlugin::getOutputHeight(const int nIndex)
+{
+ int nRet = CN_FIRSTHEIGHT;
+ if ( nIndex < CN_GENHEADOUTPUTNUM )
+ nRet += nIndex * CN_HEIGHTSPACE;
+ else
+ {
+ nRet += CN_GENHEADHEIGHT+
+ (nIndex-CN_GENHEADOUTPUTNUM)/CN_GENOUTPUTNUM*CN_GENHEIGHT+
+ (nIndex-CN_GENHEADOUTPUTNUM)%CN_GENOUTPUTNUM*CN_HEIGHTSPACE;
+ }
+
+ return nRet;
+}
+
void PowerControlGENPlugin::setGENNum( int nGENNum )
{
if ( nGENNum < 0 )
@@ -255,30 +378,3 @@ void PowerControlGENPlugin::setCommRecovDelay( int nCommRecovDelay )
}
m_nCommRecovDelay = nCommRecovDelay;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrolgenplugin/powercontrolgenplugin.h b/product/src/tools/fbd_designer/fbd_plugins/powercontrolgenplugin/powercontrolgenplugin.h
index 02a92b60..173c5043 100644
--- a/product/src/tools/fbd_designer/fbd_plugins/powercontrolgenplugin/powercontrolgenplugin.h
+++ b/product/src/tools/fbd_designer/fbd_plugins/powercontrolgenplugin/powercontrolgenplugin.h
@@ -19,6 +19,30 @@ public:
QString propertyShowName( QString sPropertyName );
QIcon getIcon() { return QIcon(":/icon/"+name()+".png"); }
+ //< 获取图元输入端口文本的位置坐标,nInputTextWidth是文字边框的宽度
+ QPointF getInputTextPos(const int nInputIndex,const int nInputTextWidth) override;
+ QPointF getOutputTextPos(const int nOutputIndex,const int nOutputTextWidth) override;
+ //< 获取输入端口高度
+ int getInputHeight(const int nIndex, const int nPortSize, const int nPortHeight) override;
+ int getOutputHeight(const int nIndex, const int nPortSize, const int nPortHeight) override;
+ // 第一个输入(输出、文字)与顶的距离
+ int getFirstHeight() override;
+ //< 输出值显示分隔符
+ QString getOutputRealValueSep() override;
+
+ QPointF getIconPos(const QSize &pixmapSize) override;
+ //< 用于画图元外边框的折线
+ QPolygonF getPolygon(const int nWidth,const int nHeight) override;
+ bool isCustomItemPos() override;
+
+ void setDefaultIconSize() override;
+ //< 初始化后执行的操作,可以图元自定义一些特殊操作
+ void afterInitialize() override;
+
+private:
+ int getInputHeight(const int nIndex);
+ int getOutputHeight(const int nIndex );
+
public:
int getGENNum() { return m_nGENNum; }
void setGENNum( int nGENNum );
@@ -51,16 +75,3 @@ private:
};
#endif // TEMPLATEPLUGIN_H
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/icon.qrc b/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/icon.qrc
new file mode 100644
index 00000000..1671947a
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/icon.qrc
@@ -0,0 +1,5 @@
+
+
+ icon/powercontrollinear.png
+
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/icon/powercontrollinear.png b/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/icon/powercontrollinear.png
new file mode 100644
index 00000000..61f527f9
Binary files /dev/null and b/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/icon/powercontrollinear.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/powercontrollinearplugin.cpp b/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/powercontrollinearplugin.cpp
new file mode 100644
index 00000000..e2ce38d3
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/powercontrollinearplugin.cpp
@@ -0,0 +1,266 @@
+#include "powercontrollinearplugin.h"
+
+#define CN_MAX_UNIT_COUNT 200 //最大机组数量
+
+#define CN_WIDTH 360 // 图元宽度
+#define CN_HEIGHTSPACE 70 // 输入(输出、文字)上下之间的间隔
+#define CN_FIRSTHEIGHT (CN_HEIGHTSPACE-14)/2 // 第一个输入(输出、文字)与顶的距离
+#define CN_PCSLINEARHEADINPUTNUM 7 // PCSLinear顶框输入个数
+#define CN_PCSLINEARHEADOUTPUTNUM 3 // PCSLinear顶框输出个数
+#define CN_PCSLINEARINPUTNUM 5 // PCSLinear框输入个数
+#define CN_PCSLINEAROUTPUTNUM 4 // PCSLinear框输出个数
+#define CN_MAXPCSLINEARHEADNUM (CN_PCSLINEARHEADINPUTNUM>=CN_PCSLINEARHEADOUTPUTNUM ? CN_PCSLINEARHEADINPUTNUM : CN_PCSLINEARHEADOUTPUTNUM)
+#define CN_MAXPCSLINEARNUM (CN_PCSLINEARINPUTNUM>=CN_PCSLINEAROUTPUTNUM ? CN_PCSLINEARINPUTNUM : CN_PCSLINEAROUTPUTNUM)
+#define CN_PCSLINEARHEADHEIGHT CN_MAXPCSLINEARHEADNUM*CN_HEIGHTSPACE // PCSLinear顶框的高度
+#define CN_PCSLINEARHEIGHT CN_MAXPCSLINEARNUM*CN_HEIGHTSPACE // PCSLinear框的高度
+
+PowerControlLinearPlugin::PowerControlLinearPlugin(): CBlock()
+{
+ m_nPCSNum = 0;
+
+
+
+ setPortShowNameFunctionEnable( false );
+
+ addInPort( CPort(this, "TotalPowerTargetValue", E_PORTDATA_FLOAT) );
+ setInPortShowName( "TotalPowerTargetValue", tr("AGC设定值") );
+ addInPort( CPort(this, "Tolerance", E_PORTDATA_FLOAT) );
+ setInPortShowName( "Tolerance", tr("误差允许") );
+
+ addInPort( CPort(this, "TotalRegulateEnable", E_PORTDATA_BOOL) );
+ setInPortShowName( "TotalRegulateEnable", tr("总调节使能") );
+ addInPort( CPort(this, "ULSoc", E_PORTDATA_FLOAT) );
+ setInPortShowName( "ULSoc", tr("SOC上限") );
+ addInPort( CPort(this, "LLSoc", E_PORTDATA_FLOAT) );
+ setInPortShowName( "LLSoc", tr("SOC下限") );
+ addInPort( CPort(this, "Step", E_PORTDATA_FLOAT) );
+ setInPortShowName( "Step", tr("调节步进") );
+ addInPort( CPort(this, "Interval", E_PORTDATA_FLOAT) );
+ setInPortShowName( "Interval", tr("调节周期(s)") );
+
+ addOutPort( CPort(this, "TotalPower", E_PORTDATA_FLOAT));
+ setOutPortShowName( "TotalPower", tr("总输出有功") );
+ addOutPort( CPort(this, "StatusCode", E_PORTDATA_INT) );
+ setOutPortShowName( "StatusCode", tr("状态码") );
+ addOutPort( CPort(this, "ErrorCode", E_PORTDATA_INT) );
+ setOutPortShowName( "ErrorCode", tr("错误码") );
+
+ this->setProperty( C_PROPERTY_SHOWNAME, showName() );
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("UnitCnt")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+
+
+
+}
+
+PowerControlLinearPlugin::~PowerControlLinearPlugin()
+{
+
+}
+
+QString PowerControlLinearPlugin::propertyShowName( QString sPropertyName )
+{
+ if ( sPropertyName == "UnitCnt" )
+ return tr("机组个数");
+ return sPropertyName;
+}
+
+QPointF PowerControlLinearPlugin::getInputTextPos(const int nInputIndex, const int nInputTextWidth)
+{
+ Q_UNUSED(nInputTextWidth);
+
+ int nY = getInputHeight(nInputIndex);
+ return QPointF(1,nY);
+}
+
+QPointF PowerControlLinearPlugin::getOutputTextPos(const int nOutputIndex, const int nOutputTextWidth)
+{
+ return QPointF( (CN_WIDTH*0.6) - nOutputTextWidth, getOutputHeight(nOutputIndex) );
+}
+
+int PowerControlLinearPlugin::getInputHeight(const int nIndex, const int nPortSize, const int nPortHeight)
+{
+ Q_UNUSED(nPortHeight);
+ Q_UNUSED(nPortSize);
+
+ return getInputHeight(nIndex + 1);
+}
+
+int PowerControlLinearPlugin::getOutputHeight(const int nIndex, const int nPortSize, const int nPortHeight)
+{
+ Q_UNUSED(nPortHeight);
+ Q_UNUSED(nPortSize);
+
+ return getOutputHeight(nIndex + 1);
+}
+
+int PowerControlLinearPlugin::getFirstHeight()
+{
+ return CN_FIRSTHEIGHT;
+}
+
+QString PowerControlLinearPlugin::getOutputRealValueSep()
+{
+ return "\n";
+}
+
+QPointF PowerControlLinearPlugin::getIconPos(const QSize &pixmapSize)
+{
+ int nX = (CN_WIDTH*0.6 - pixmapSize.width()) / 2;
+ return QPointF(nX,5);
+}
+
+QPolygonF PowerControlLinearPlugin::getPolygon(const int nWidth, const int nHeight)
+{
+ // Set Polygon Top-Left: 0/0
+ QPolygonF polygon;
+ polygon << QPointF(0, 0) << QPointF( nWidth, 0)
+ << QPointF(nWidth, nHeight) << QPointF(0, nHeight)
+ << QPointF(0, 0);
+
+ const int nPCSLinearNum = this->property("UnitCnt").toInt();
+ for ( int i=0; iproperty("UnitCnt").toInt();
+ if ( nUnitCount == 0 )
+ {
+ this->setProperty("UnitCnt",1);
+ }
+}
+
+int PowerControlLinearPlugin::getInputHeight(const int nIndex)
+{
+ int nRet = CN_FIRSTHEIGHT;
+ if ( nIndex < CN_PCSLINEARHEADINPUTNUM )
+ nRet += nIndex * CN_HEIGHTSPACE;
+ else
+ {
+ nRet += CN_PCSLINEARHEADHEIGHT+
+ (nIndex-CN_PCSLINEARHEADINPUTNUM)/CN_PCSLINEARINPUTNUM*CN_PCSLINEARHEIGHT+
+ (nIndex-CN_PCSLINEARHEADINPUTNUM)%CN_PCSLINEARINPUTNUM*CN_HEIGHTSPACE;
+ }
+ return nRet;
+}
+
+int PowerControlLinearPlugin::getOutputHeight(const int nIndex)
+{
+ int nRet = CN_FIRSTHEIGHT;
+ if ( nIndex < CN_PCSLINEARHEADOUTPUTNUM )
+ nRet += nIndex * CN_HEIGHTSPACE;
+ else
+ {
+ nRet += CN_PCSLINEARHEADHEIGHT+
+ (nIndex-CN_PCSLINEARHEADOUTPUTNUM)/CN_PCSLINEAROUTPUTNUM*CN_PCSLINEARHEIGHT+
+ (nIndex-CN_PCSLINEARHEADOUTPUTNUM)%CN_PCSLINEAROUTPUTNUM*CN_HEIGHTSPACE;
+ }
+ return nRet;
+}
+
+void PowerControlLinearPlugin::setPCSNum( int nPCSNum )
+{
+ if ( nPCSNum < 0 )
+ {
+ emit signalErrorDisplay(tr("PCS个数不能小于0个!!!"));
+ return;
+ }
+ if ( nPCSNum > CN_MAX_UNIT_COUNT )
+ {
+ emit signalErrorDisplay(tr("PCS个数不能大于200个!!!"));
+ return;
+ }
+
+ QString sPortName = "";
+ QString sPortDesc = "";
+ for ( int i=nPCSNum+1; i<=m_nPCSNum; i++ )
+ {
+ // 删除输入端口
+ sPortName = QString("Unit %1 MaxDischargeP").arg(i);
+ removeInPort(sPortName);
+ sPortName = QString("Unit %1 MaxChargeP").arg(i);
+ removeInPort(sPortName);
+ sPortName = QString("Unit %1 Actual value of active power").arg(i);
+ removeInPort(sPortName);
+ sPortName = QString("Unit %1 SOC").arg(i);
+ removeInPort(sPortName);
+ sPortName = QString("Unit %1 RegulateEnable").arg(i);
+ removeInPort(sPortName);
+
+ // 删除输出端口
+ sPortName = QString("Unit %1 DistributionPower").arg(i);
+ removeOutPort(sPortName);
+ sPortName = QString("Unit %1 RegulateEnable").arg(i);
+ removeOutPort(sPortName);
+ sPortName = QString("Unit %1 StatusCode").arg(i);
+ removeOutPort(sPortName);
+ sPortName = QString("Unit %1 ErrorCode").arg(i);
+ removeOutPort(sPortName);
+
+ // 删除动态属性
+
+ }
+ for ( int i=m_nPCSNum+1; i<=nPCSNum; i++ )
+ {
+ // 增加输入端口
+ sPortName = QString("Unit %1 MaxDischargeP").arg(i);
+ sPortDesc = QString(tr("机组%1最大放电功率")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setInPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 MaxChargeP").arg(i);
+ sPortDesc = QString(tr("机组%1最大充电功率")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setInPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 Actual value of active power").arg(i);
+ sPortDesc = QString(tr("机组%1有功实际值")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setInPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 SOC").arg(i);
+ sPortDesc = QString(tr("机组%1 SOC")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setInPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 RegulateEnable").arg(i);
+ sPortDesc = QString(tr("机组%1调节使能")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_BOOL) );
+ setInPortShowName( sPortName, sPortDesc );
+
+ // 增加输出端口
+ sPortName = QString("Unit %1 DistributionPower").arg(i);
+ sPortDesc = QString(tr("机组%1分配有功")).arg(i);
+ addOutPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setOutPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 RegulateEnable").arg(i);
+ sPortDesc = QString(tr("机组%1调节使能")).arg(i);
+ addOutPort( CPort(this, sPortName, E_PORTDATA_BOOL) );
+ setOutPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 StatusCode").arg(i);
+ sPortDesc = QString(tr("机组%1状态码")).arg(i);
+ addOutPort( CPort(this, sPortName, E_PORTDATA_INT) );
+ setOutPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 ErrorCode").arg(i);
+ sPortDesc = QString(tr("机组%1错误码")).arg(i);
+ addOutPort( CPort(this, sPortName, E_PORTDATA_INT) );
+ setOutPortShowName( sPortName, sPortDesc );
+
+ // 增加动态属性
+
+ }
+ m_nPCSNum = nPCSNum;
+ emit signalPortSizeChanged();
+}
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/powercontrollinearplugin.h b/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/powercontrollinearplugin.h
new file mode 100644
index 00000000..49328384
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/powercontrollinearplugin.h
@@ -0,0 +1,57 @@
+#ifndef TEMPLATEPLUGIN_H
+#define TEMPLATEPLUGIN_H
+
+#include "CBlock.h"
+
+class PowerControlLinearPlugin : public CBlock
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA( IID Block_iid ) // Q_PLUGIN_METADATA 宏用于描述插件元数据
+ Q_INTERFACES( CBlock ) // Q_INTERFACES 宏用于告诉Qt该类实现的接口
+
+public:
+ Q_INVOKABLE PowerControlLinearPlugin();
+ Q_INVOKABLE ~PowerControlLinearPlugin();
+
+public:
+ QString name() { return "powercontrollinear"; }
+ QString showName() { return QObject::tr("储能机组线性有功分配器"); }
+ QString propertyShowName( QString sPropertyName );
+ QIcon getIcon() { return QIcon(":/icon/"+name()+".png"); }
+
+ //< 获取图元输入端口文本的位置坐标,nInputTextWidth是文字边框的宽度
+ QPointF getInputTextPos(const int nInputIndex,const int nInputTextWidth) override;
+ QPointF getOutputTextPos(const int nOutputIndex,const int nOutputTextWidth) override;
+ //< 获取输入端口高度
+ int getInputHeight(const int nIndex, const int nPortSize, const int nPortHeight) override;
+ int getOutputHeight(const int nIndex, const int nPortSize, const int nPortHeight) override;
+ // 第一个输入(输出、文字)与顶的距离
+ int getFirstHeight() override;
+ //< 输出值显示分隔符
+ QString getOutputRealValueSep() override;
+
+ QPointF getIconPos(const QSize &pixmapSize) override;
+ //< 用于画图元外边框的折线
+ QPolygonF getPolygon(const int nWidth,const int nHeight) override;
+ bool isCustomItemPos() override;
+
+ void setDefaultIconSize() override;
+ //< 初始化后执行的操作,可以图元自定义一些特殊操作
+ void afterInitialize() override;
+
+private:
+ int getInputHeight(const int nIndex);
+ int getOutputHeight(const int nIndex );
+
+public:
+ int getPCSNum () { return m_nPCSNum; }
+ void setPCSNum ( int nPCSNum );
+
+
+private:
+ int m_nPCSNum; // PCS个数 机组个数
+ Q_PROPERTY( int UnitCnt READ getPCSNum WRITE setPCSNum USER true DESIGNABLE true )
+
+};
+
+#endif // TEMPLATEPLUGIN_H
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/powercontrollinearplugin.pro b/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/powercontrollinearplugin.pro
new file mode 100644
index 00000000..0c54bc17
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/powercontrollinearplugin/powercontrollinearplugin.pro
@@ -0,0 +1,33 @@
+TARGET = powercontrollinearplugin
+QT = core gui widgets
+CONFIG += dll
+TEMPLATE = lib
+
+SOURCES += \
+ powercontrollinearplugin.cpp
+
+HEADERS += \
+ powercontrollinearplugin.h
+
+INCLUDEPATH += \
+ ../.. \
+ ../../fbd_block \
+ ../../include
+
+LIBS += \
+ -lfbd_block
+
+RESOURCES += \
+ icon.qrc
+
+!include( ../../../../common.pri ){
+ error(the file common.pri is not exist!!)
+}
+
+#fbd_plugins插件的统一规则
+FBD_PLUGINS_PRI=$$PWD/../fbd_plugins.pri
+exists($$FBD_PLUGINS_PRI) {
+ include($$FBD_PLUGINS_PRI)
+}else {
+ error("FATAL error: can not find fbd_plugins.pri")
+}
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrolpcsplugin/icon/powercontrolpcs.png b/product/src/tools/fbd_designer/fbd_plugins/powercontrolpcsplugin/icon/powercontrolpcs.png
index 1b950e11..61f527f9 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/powercontrolpcsplugin/icon/powercontrolpcs.png and b/product/src/tools/fbd_designer/fbd_plugins/powercontrolpcsplugin/icon/powercontrolpcs.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrolpcsplugin/powercontrolpcsplugin.cpp b/product/src/tools/fbd_designer/fbd_plugins/powercontrolpcsplugin/powercontrolpcsplugin.cpp
index 88e2aac3..71b5f5dd 100644
--- a/product/src/tools/fbd_designer/fbd_plugins/powercontrolpcsplugin/powercontrolpcsplugin.cpp
+++ b/product/src/tools/fbd_designer/fbd_plugins/powercontrolpcsplugin/powercontrolpcsplugin.cpp
@@ -2,6 +2,20 @@
#define CN_MAX_UNIT_COUNT 50 //最大机组数量
+#define CN_WIDTH 360 // 图元宽度
+#define CN_HEIGHTSPACE 70 // 输入(输出、文字)上下之间的间隔
+#define CN_PCSHEADINPUTNUM 8 // PCS顶框输入个数
+#define CN_PCSHEADOUTPUTNUM 6 // PCS顶框输出个数
+#define CN_PCSINPUTNUM 4 // PCS框输入个数
+#define CN_PCSOUTPUTNUM 4 // PCS框输出个数
+#define CN_MAXPCSHEADNUM (CN_PCSHEADINPUTNUM>=CN_PCSHEADOUTPUTNUM ? CN_PCSHEADINPUTNUM : CN_PCSHEADOUTPUTNUM)
+#define CN_MAXPCSNUM (CN_PCSINPUTNUM>=CN_PCSOUTPUTNUM ? CN_PCSINPUTNUM : CN_PCSOUTPUTNUM)
+#define CN_PCSHEADHEIGHT CN_MAXPCSHEADNUM*CN_HEIGHTSPACE // PCS顶框的高度
+#define CN_PCSHEIGHT CN_MAXPCSNUM*CN_HEIGHTSPACE // PCS框的高度
+#define CN_PCSOUTPUTNUM 4 // PCS框输出个数
+#define CN_FIRSTHEIGHT (CN_HEIGHTSPACE-14)/2 // 第一个输入(输出、文字)与顶的距离
+#define CN_WIDTH 360 // 图元宽度
+
PowerControlPCSPlugin::PowerControlPCSPlugin(): CBlock()
{
m_nPCSNum = 0;
@@ -114,6 +128,119 @@ QString PowerControlPCSPlugin::propertyShowName( QString sPropertyName )
return sPropertyName;
}
+int PowerControlPCSPlugin::getInputHeight(const int nIndex)
+{
+ int nY = CN_FIRSTHEIGHT;
+ if ( nIndex < CN_PCSHEADINPUTNUM )
+ {
+ nY += nIndex * CN_HEIGHTSPACE;
+ }
+ else
+ {
+ nY += CN_PCSHEADHEIGHT+
+ (nIndex-CN_PCSHEADINPUTNUM)/CN_PCSINPUTNUM*CN_PCSHEIGHT+
+ (nIndex-CN_PCSHEADINPUTNUM)%CN_PCSINPUTNUM*CN_HEIGHTSPACE;
+ }
+
+ return nY;
+}
+
+int PowerControlPCSPlugin::getOutputHeight(const int nIndex)
+{
+ int nRet = CN_FIRSTHEIGHT;
+ if ( nIndex < CN_PCSHEADOUTPUTNUM )
+ nRet += nIndex * CN_HEIGHTSPACE;
+ else
+ {
+ nRet += CN_PCSHEADHEIGHT+
+ (nIndex-CN_PCSHEADOUTPUTNUM)/CN_PCSOUTPUTNUM*CN_PCSHEIGHT+
+ (nIndex-CN_PCSHEADOUTPUTNUM)%CN_PCSOUTPUTNUM*CN_HEIGHTSPACE;
+ }
+ return nRet;
+}
+
+QPointF PowerControlPCSPlugin::getInputTextPos(const int nInputIndex, const int nInputTextWidth)
+{
+ Q_UNUSED(nInputTextWidth);
+
+ int nY = getInputHeight(nInputIndex);
+ return QPointF(1,nY);
+}
+
+QPointF PowerControlPCSPlugin::getOutputTextPos(const int nOutputIndex, const int nOutputTextWidth)
+{
+ return QPointF(CN_WIDTH-nOutputTextWidth, getOutputHeight(nOutputIndex));
+}
+
+QPointF PowerControlPCSPlugin::getIconPos(const QSize &pixmapSize)
+{
+ int nX = (CN_WIDTH - pixmapSize.width()) / 2;
+ return QPointF(nX,5);
+}
+
+int PowerControlPCSPlugin::getInputHeight(const int nIndex, const int nPortSize, const int nPortHeight)
+{
+ Q_UNUSED(nPortHeight);
+ Q_UNUSED(nPortSize);
+
+ return getInputHeight(nIndex + 1);
+}
+
+int PowerControlPCSPlugin::getOutputHeight(const int nIndex, const int nPortSize, const int nPortHeight)
+{
+ Q_UNUSED(nPortHeight);
+ Q_UNUSED(nPortSize);
+
+ return getOutputHeight(nIndex + 1);
+}
+
+int PowerControlPCSPlugin::getFirstHeight()
+{
+ return CN_FIRSTHEIGHT;
+}
+
+void PowerControlPCSPlugin::setDefaultIconSize()
+{
+ setIconSize( CN_WIDTH, CN_MAXPCSHEADNUM*CN_HEIGHTSPACE );
+}
+
+bool PowerControlPCSPlugin::isCustomItemPos()
+{
+ return true;
+}
+
+void PowerControlPCSPlugin::afterInitialize()
+{
+ int nUnitCount = this->property("UnitCnt").toInt();
+ if ( nUnitCount == 0 )
+ {
+ this->setProperty("UnitCnt",1);
+ }
+}
+
+QString PowerControlPCSPlugin::getOutputRealValueSep()
+{
+ return "\n";
+}
+
+QPolygonF PowerControlPCSPlugin::getPolygon(const int nWidth, const int nHeight)
+{
+ // Set Polygon Top-Left: 0/0
+ QPolygonF polygon;
+ polygon << QPointF(0, 0) << QPointF( nWidth, 0)
+ << QPointF(nWidth, nHeight) << QPointF(0, nHeight)
+ << QPointF(0, 0);
+
+ const int nPCSNum = this->property("UnitCnt").toInt();
+ for ( int i=0; i < nPCSNum; i++ )
+ {
+ polygon << QPointF(0, CN_PCSHEADHEIGHT+i*CN_PCSHEIGHT+2) << QPointF(CN_WIDTH, CN_PCSHEADHEIGHT+i*CN_PCSHEIGHT+2)
+ << QPointF(0, CN_PCSHEADHEIGHT+i*CN_PCSHEIGHT+2);
+ }
+
+ return polygon;
+}
+
void PowerControlPCSPlugin::setPCSNum( int nPCSNum )
{
if ( nPCSNum < 0 )
@@ -321,29 +448,3 @@ void PowerControlPCSPlugin::setCommRecovDelay( int nCommRecovDelay )
// m_fMinSoc = fMinSoc;
//}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrolpcsplugin/powercontrolpcsplugin.h b/product/src/tools/fbd_designer/fbd_plugins/powercontrolpcsplugin/powercontrolpcsplugin.h
index b5e9f25d..8bf045fd 100644
--- a/product/src/tools/fbd_designer/fbd_plugins/powercontrolpcsplugin/powercontrolpcsplugin.h
+++ b/product/src/tools/fbd_designer/fbd_plugins/powercontrolpcsplugin/powercontrolpcsplugin.h
@@ -19,6 +19,30 @@ public:
QString propertyShowName( QString sPropertyName );
QIcon getIcon() { return QIcon(":/icon/"+name()+".png"); }
+ //< 获取图元输入端口文本的位置坐标,nInputTextWidth是文字边框的宽度
+ QPointF getInputTextPos(const int nInputIndex,const int nInputTextWidth) override;
+ QPointF getOutputTextPos(const int nOutputIndex,const int nOutputTextWidth) override;
+ //< 获取输入端口高度
+ int getInputHeight(const int nIndex, const int nPortSize, const int nPortHeight) override;
+ int getOutputHeight(const int nIndex, const int nPortSize, const int nPortHeight) override;
+ // 第一个输入(输出、文字)与顶的距离
+ int getFirstHeight() override;
+ //< 输出值显示分隔符
+ QString getOutputRealValueSep() override;
+
+ QPointF getIconPos(const QSize &pixmapSize) override;
+ //< 用于画图元外边框的折线
+ QPolygonF getPolygon(const int nWidth,const int nHeight) override;
+ bool isCustomItemPos() override;
+
+ void setDefaultIconSize() override;
+ //< 初始化后执行的操作,可以图元自定义一些特殊操作
+ void afterInitialize() override;
+
+private:
+ int getInputHeight(const int nIndex);
+ int getOutputHeight(const int nIndex );
+
public:
int getPCSNum () { return m_nPCSNum; }
void setPCSNum ( int nPCSNum );
@@ -67,26 +91,3 @@ private:
};
#endif // TEMPLATEPLUGIN_H
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/icon.qrc b/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/icon.qrc
new file mode 100644
index 00000000..5baba2ff
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/icon.qrc
@@ -0,0 +1,5 @@
+
+
+ icon/powercontrolreactive.png
+
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/icon/powercontrolreactive.png b/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/icon/powercontrolreactive.png
new file mode 100644
index 00000000..61f527f9
Binary files /dev/null and b/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/icon/powercontrolreactive.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/powercontrolreactiveplugin.cpp b/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/powercontrolreactiveplugin.cpp
new file mode 100644
index 00000000..b8247925
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/powercontrolreactiveplugin.cpp
@@ -0,0 +1,401 @@
+#include "powercontrolreactiveplugin.h"
+
+#define CN_MAX_UNIT_COUNT 300 //最大机组数量
+
+#define CN_WIDTH 230 // 图元宽度
+#define CN_HEIGHTSPACE 50 // 输入(输出、文字)上下之间的间隔
+#define CN_FIRSTHEIGHT (CN_HEIGHTSPACE-14)/2 // 第一个输入(输出、文字)与顶的距离
+#define CN_PCSREACTIVEHEADINPUTNUM 4 // PCSREACTIVE顶框输入个数
+#define CN_PCSREACTIVEHEADOUTPUTNUM 3 // PCSREACTIVE顶框输出个数
+#define CN_PCSREACTIVEINPUTNUM 4 // PCSREACTIVE框输入个数
+#define CN_PCSREACTIVEOUTPUTNUM 4 // PCSREACTIVE框输出个数
+#define CN_MAXPCSREACTIVEHEADNUM (m_nTopInPortNum>=m_nTopOutPortNum ? m_nTopInPortNum : m_nTopOutPortNum)
+#define CN_MAXPCSREACTIVENUM (CN_PCSREACTIVEINPUTNUM>=CN_PCSREACTIVEOUTPUTNUM ? CN_PCSREACTIVEINPUTNUM : CN_PCSREACTIVEOUTPUTNUM)
+#define CN_PCSREACTIVEHEADHEIGHT CN_MAXPCSREACTIVEHEADNUM*CN_HEIGHTSPACE // PCSREACTIVE顶框的高度
+#define CN_PCSREACTIVEHEIGHT CN_MAXPCSREACTIVENUM*CN_HEIGHTSPACE // PCSREACTIVE框的高度
+
+PowerControlReactivePlugin::PowerControlReactivePlugin(): CBlock()
+{
+ m_nPCSNum = 0;
+ m_nCustomPortSpace = CN_HEIGHTSPACE;
+ m_fCommPrecision = 0.01f;
+ m_fRegulatePrecision = 50;
+ m_fMinAllocP = 50;
+ m_nRegulateCycle = 0;
+ m_nWaitRespTimeout = 3000;
+
+ initPropertyMAP();
+
+ setPortShowNameFunctionEnable( false );
+
+ addInPort( CPort(this, "TotalRegulateEnable", E_PORTDATA_BOOL) );
+ setInPortShowName( "TotalRegulateEnable", tr("总调节使能") );
+
+ addInPort( CPort(this, "TotalPowerTargetValue", E_PORTDATA_FLOAT) );
+ setInPortShowName( "TotalPowerTargetValue", tr("AVC设定值") );
+
+ addInPort( CPort(this, "TotalDeadband", E_PORTDATA_FLOAT) );
+ setInPortShowName( "TotalDeadband", tr("调节死区") );
+ addInPort( CPort(this, "Step", E_PORTDATA_FLOAT) );
+ setInPortShowName( "Step", tr("最大调节步进") );
+ addInPort( CPort(this, "Interval", E_PORTDATA_FLOAT) );
+ setInPortShowName( "Interval", tr("最小调节周期(ms)") );
+ m_nTopInPortNum = getInPortSize();
+
+ addOutPort( CPort(this, "TotalSetP", E_PORTDATA_FLOAT));
+ setOutPortShowName( "TotalSetP", tr("总分配无功") );
+ addOutPort(CPort(this, "TotalTargetP", E_PORTDATA_FLOAT));
+ setOutPortShowName("TotalTargetP", tr("总目标无功"));
+ addOutPort( CPort(this, "TotalRealP", E_PORTDATA_FLOAT));
+ setOutPortShowName( "TotalRealP", tr("总实时无功") );
+ addOutPort( CPort(this, "TotalUpMarginPower", E_PORTDATA_FLOAT) );
+ setOutPortShowName( "TotalUpMarginPower", tr("总可增无功") );
+ addOutPort( CPort(this, "TotalDownMarginPower", E_PORTDATA_FLOAT) );
+ setOutPortShowName( "TotalDownMarginPower", tr("总可减无功") );
+ addOutPort(CPort(this, "TotalNonRegulatePower", E_PORTDATA_FLOAT));
+ setOutPortShowName("TotalNonRegulatePower", tr("总不可调功率"));
+ addOutPort( CPort(this, "StatusCode", E_PORTDATA_INT) );
+ setOutPortShowName( "StatusCode", tr("状态码") );
+ addOutPort( CPort(this, "ErrorCode", E_PORTDATA_INT) );
+ setOutPortShowName( "ErrorCode", tr("错误码") );
+ m_nTopOutPortNum = getOutPortSize();
+
+
+ this->setProperty( C_PROPERTY_SHOWNAME, showName() );
+ //< 端口间隔
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("PortSpace")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+ //< 机组数量
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("UnitCnt")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+
+ //< 功率分配算法
+ QStringList listTmp;
+ listTmp<setProperty( (C_PREFIX_VALUEEDITTYPE+QString("AllocALG")).toStdString().c_str(), E_VALUEEDIT_COMBOBOX );
+ this->setProperty( (C_PREFIX_COMBOBOXITEM+QString("AllocALG")).toStdString().c_str(), listTmp);
+ AllocALG = listTmp.at(0);
+
+ //< 反馈超时时间
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("WaitRespTimeout")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+ //< 稳定时定时分配间隔
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("RegulateCycle")).toStdString().c_str(), E_VALUEEDIT_SPINBOX );
+
+ //< 机组参数
+ //< 最小分配功率
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("MinAllocP")).toStdString().c_str(), E_VALUEEDIT_DOUBLESPINBOX );
+ //< 通讯精度
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("CommPrecision")).toStdString().c_str(), E_VALUEEDIT_DOUBLESPINBOX );
+ //< 调节精度
+ this->setProperty( (C_PREFIX_VALUEEDITTYPE+QString("RegulatePrecision")).toStdString().c_str(), E_VALUEEDIT_DOUBLESPINBOX );
+
+
+}
+
+PowerControlReactivePlugin::~PowerControlReactivePlugin()
+{
+
+}
+
+void PowerControlReactivePlugin::initPropertyMAP()
+{
+ m_mapProperty["UnitCnt"] = tr("机组个数");
+ m_mapProperty["PortSpace"] = tr("端口间隔");
+ m_mapProperty["AllocALG"] = tr("功率分配算法");
+ m_mapProperty["CommPrecision"] = tr("通讯精度");
+ m_mapProperty["RegulatePrecision"] = tr("调节精度");
+ m_mapProperty["WaitRespTimeout"] = tr("调节反馈超时时间(单位:ms)");
+ m_mapProperty["RegulateCycle"] = tr("稳定时调节周期(单位:s)");
+ m_mapProperty["MinAllocP"] = tr("最小分配功率");
+}
+
+QString PowerControlReactivePlugin::propertyShowName( QString sPropertyName )
+{
+ auto iter = m_mapProperty.find(sPropertyName);
+ if(iter != m_mapProperty.end())
+ {
+ return iter.value();
+ }
+
+ return sPropertyName;
+}
+
+QPointF PowerControlReactivePlugin::getInputTextPos(const int nInputIndex, const int nInputTextWidth)
+{
+ Q_UNUSED(nInputTextWidth);
+
+ int nY = getInputHeight(nInputIndex);
+ return QPointF(1,nY);
+}
+
+QPointF PowerControlReactivePlugin::getOutputTextPos(const int nOutputIndex, const int nOutputTextWidth)
+{
+ return QPointF( CN_WIDTH - nOutputTextWidth, getOutputHeight(nOutputIndex) );
+}
+
+int PowerControlReactivePlugin::getInputHeight(const int nIndex, const int nPortSize, const int nPortHeight)
+{
+ Q_UNUSED(nPortHeight);
+ Q_UNUSED(nPortSize);
+
+ return getInputHeight(nIndex + 1);
+}
+
+int PowerControlReactivePlugin::getOutputHeight(const int nIndex, const int nPortSize, const int nPortHeight)
+{
+ Q_UNUSED(nPortHeight);
+ Q_UNUSED(nPortSize);
+
+ return getOutputHeight(nIndex + 1);
+}
+
+int PowerControlReactivePlugin::getFirstHeight()
+{
+ return CN_FIRSTHEIGHT;
+}
+
+QString PowerControlReactivePlugin::getOutputRealValueSep()
+{
+ return "\n";
+}
+
+QPointF PowerControlReactivePlugin::getIconPos(const QSize &pixmapSize)
+{
+ int nX = (CN_WIDTH - pixmapSize.width()) / 2;
+ return QPointF(nX,5);
+}
+
+QPolygonF PowerControlReactivePlugin::getPolygon(const int nWidth, const int nHeight)
+{
+ // Set Polygon Top-Left: 0/0
+ QPolygonF polygon;
+ polygon << QPointF(0, 0) << QPointF( nWidth, 0)
+ << QPointF(nWidth, nHeight) << QPointF(0, nHeight)
+ << QPointF(0, 0);
+
+ const int nPCSLinearNum = this->property("UnitCnt").toInt();
+ for ( int i=0; iproperty("UnitCnt").toInt();
+ if ( nUnitCount == 0 )
+ {
+ this->setProperty("UnitCnt",1);
+ }
+}
+
+int PowerControlReactivePlugin::getInputHeight(const int nIndex)
+{
+ int nRet = CN_FIRSTHEIGHT;
+ if ( nIndex < m_nTopInPortNum )
+ nRet += nIndex * m_nCustomPortSpace;
+ else
+ {
+ nRet += CN_PCSREACTIVEHEADHEIGHT+
+ (nIndex-m_nTopInPortNum)/CN_PCSREACTIVEINPUTNUM*CN_PCSREACTIVEHEIGHT+
+ (nIndex-m_nTopInPortNum)%CN_PCSREACTIVEINPUTNUM*m_nCustomPortSpace;
+ }
+ return nRet;
+}
+
+int PowerControlReactivePlugin::getOutputHeight(const int nIndex)
+{
+ int nRet = CN_FIRSTHEIGHT;
+ if ( nIndex < m_nTopOutPortNum )
+ nRet += nIndex * m_nCustomPortSpace;
+ else
+ {
+ nRet += CN_PCSREACTIVEHEADHEIGHT+
+ (nIndex-m_nTopOutPortNum)/CN_PCSREACTIVEOUTPUTNUM*CN_PCSREACTIVEHEIGHT+
+ (nIndex-m_nTopOutPortNum)%CN_PCSREACTIVEOUTPUTNUM*m_nCustomPortSpace;
+ }
+ return nRet;
+}
+
+
+void PowerControlReactivePlugin::setPCSNum( int nPCSNum )
+{
+ if ( nPCSNum < 0 )
+ {
+ emit signalErrorDisplay(tr("PCS个数不能小于0个!!!"));
+ return;
+ }
+ if ( nPCSNum > CN_MAX_UNIT_COUNT )
+ {
+ emit signalErrorDisplay(tr("PCS个数不能大于200个!!!"));
+ return;
+ }
+
+ QString sPortName = "";
+ QString sPortDesc = "";
+ for ( int i=nPCSNum+1; i<=m_nPCSNum; i++ )
+ {
+ // 删除输入端口
+ sPortName = QString("Unit %1 Set value of reactive power").arg(i);
+ removeInPort(sPortName);
+
+ sPortName = QString("Unit %1 Actual value of reactive power").arg(i);
+ removeInPort(sPortName);
+
+ sPortName = QString("Unit %1 UpperLimitP").arg(i);
+ removeInPort(sPortName);
+ sPortName = QString("Unit %1 LowerLimitP").arg(i);
+ removeInPort(sPortName);
+ sPortName = QString("Unit %1 RegulateEnable").arg(i);
+ removeInPort(sPortName);
+
+ // 删除输出端口
+ sPortName = QString("Unit %1 DistributionPower").arg(i);
+ removeOutPort(sPortName);
+ sPortName = QString("Unit %1 RegulateEnable").arg(i);
+ removeOutPort(sPortName);
+ sPortName = QString("Unit %1 StatusCode").arg(i);
+ removeOutPort(sPortName);
+ sPortName = QString("Unit %1 ErrorCode").arg(i);
+ removeOutPort(sPortName);
+
+ // 删除动态属性
+
+ }
+ for ( int i=m_nPCSNum+1; i<=nPCSNum; i++ )
+ {
+ // 增加输入端口
+ sPortName = QString("Unit %1 Set value of reactive power").arg(i);
+ sPortDesc = QString(tr("机组%1无功设定值")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setInPortShowName( sPortName, sPortDesc );
+
+ sPortName = QString("Unit %1 Actual value of reactive power").arg(i);
+ sPortDesc = QString(tr("机组%1无功实际值")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setInPortShowName( sPortName, sPortDesc );
+
+ sPortName = QString("Unit %1 UpperLimitP").arg(i);
+ sPortDesc = QString(tr("机组%1无功功率可调上限")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setInPortShowName( sPortName, sPortDesc );
+
+ sPortName = QString("Unit %1 LowerLimitP").arg(i);
+ sPortDesc = QString(tr("机组%1无功功率可调下限")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setInPortShowName( sPortName, sPortDesc );
+
+
+ sPortName = QString("Unit %1 RegulateEnable").arg(i);
+ sPortDesc = QString(tr("机组%1调节使能")).arg(i);
+ addInPort( CPort(this, sPortName, E_PORTDATA_BOOL) );
+ setInPortShowName( sPortName, sPortDesc );
+
+ // 增加输出端口
+ sPortName = QString("Unit %1 DistributionPower").arg(i);
+ sPortDesc = QString(tr("机组%1分配无功")).arg(i);
+ addOutPort( CPort(this, sPortName, E_PORTDATA_FLOAT) );
+ setOutPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 RegulateEnable").arg(i);
+ sPortDesc = QString(tr("机组%1调节使能")).arg(i);
+ addOutPort( CPort(this, sPortName, E_PORTDATA_BOOL) );
+ setOutPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 StatusCode").arg(i);
+ sPortDesc = QString(tr("机组%1状态码")).arg(i);
+ addOutPort( CPort(this, sPortName, E_PORTDATA_INT) );
+ setOutPortShowName( sPortName, sPortDesc );
+ sPortName = QString("Unit %1 ErrorCode").arg(i);
+ sPortDesc = QString(tr("机组%1错误码")).arg(i);
+ addOutPort( CPort(this, sPortName, E_PORTDATA_INT) );
+ setOutPortShowName( sPortName, sPortDesc );
+
+ // 增加动态属性
+
+ }
+ m_nPCSNum = nPCSNum;
+ emit signalPortSizeChanged();
+}
+void PowerControlReactivePlugin::setSpace(int nValue)
+{
+ if (nValue > 100)
+ {
+ emit signalErrorDisplay(tr("端口间隔不能大于100"));
+ return;
+ }
+
+ if(nValue < 20)
+ {
+ emit signalErrorDisplay(tr("端口间隔不能小于20"));
+ return;
+ }
+
+ m_nCustomPortSpace = nValue;
+ emit signalPortSizeChanged();
+}
+
+void PowerControlReactivePlugin::setWaitRespTimeout(int nWaitRespTimeout)
+{
+ if(nWaitRespTimeout <= 0)
+ {
+ emit signalErrorDisplay(tr("【调节反馈超时时间】值错误,合法值:大于0"));
+ return;
+ }
+
+ m_nWaitRespTimeout = nWaitRespTimeout;
+}
+
+void PowerControlReactivePlugin::setRegulateCycle(int nRegulateCycle)
+{
+ if(nRegulateCycle < 0)
+ {
+ emit signalErrorDisplay(tr("【稳定时调节周期】值错误,合法值:大于等于0"));
+ return;
+ }
+
+ m_nRegulateCycle = nRegulateCycle;
+}
+
+void PowerControlReactivePlugin::setMinAllocP(float fMinAllocP)
+{
+ if(fMinAllocP <= 0)
+ {
+ emit signalErrorDisplay(tr("【最小分配功率】值错误,合法值:大于0"));
+ return;
+ }
+
+ m_fMinAllocP = fMinAllocP;
+}
+
+void PowerControlReactivePlugin::setCommPrecision(float fCommPrecision)
+{
+ if(fCommPrecision < 0)
+ {
+ emit signalErrorDisplay(tr("【通讯精度】值错误,合法值:大于0"));
+ return;
+ }
+
+ m_fCommPrecision = fCommPrecision;
+}
+
+void PowerControlReactivePlugin::setRegulatePrecision(float fRegulatePrecision)
+{
+ if(fRegulatePrecision < 0)
+ {
+ emit signalErrorDisplay(tr("【调节精度】值错误,合法值:大于0"));
+ return;
+ }
+
+ m_fRegulatePrecision = fRegulatePrecision;
+}
+
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/powercontrolreactiveplugin.h b/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/powercontrolreactiveplugin.h
new file mode 100644
index 00000000..e60e33a0
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/powercontrolreactiveplugin.h
@@ -0,0 +1,98 @@
+#ifndef TEMPLATEPLUGIN_H
+#define TEMPLATEPLUGIN_H
+
+#include "CBlock.h"
+
+class PowerControlReactivePlugin : public CBlock
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA( IID Block_iid ) // Q_PLUGIN_METADATA 宏用于描述插件元数据
+ Q_INTERFACES( CBlock ) // Q_INTERFACES 宏用于告诉Qt该类实现的接口
+
+public:
+ Q_INVOKABLE PowerControlReactivePlugin();
+ Q_INVOKABLE ~PowerControlReactivePlugin();
+
+public:
+ QString name() { return "powercontrolreactive"; }
+ QString showName() { return QObject::tr("储能无功分配器"); }
+ QString propertyShowName( QString sPropertyName );
+ QIcon getIcon() { return QIcon(":/icon/"+name()+".png"); }
+
+ //< 获取图元输入端口文本的位置坐标,nInputTextWidth是文字边框的宽度
+ QPointF getInputTextPos(const int nInputIndex,const int nInputTextWidth) override;
+ QPointF getOutputTextPos(const int nOutputIndex,const int nOutputTextWidth) override;
+ //< 获取输入端口高度
+ int getInputHeight(const int nIndex, const int nPortSize, const int nPortHeight) override;
+ int getOutputHeight(const int nIndex, const int nPortSize, const int nPortHeight) override;
+ // 第一个输入(输出、文字)与顶的距离
+ int getFirstHeight() override;
+ //< 输出值显示分隔符
+ QString getOutputRealValueSep() override;
+
+ QPointF getIconPos(const QSize &pixmapSize) override;
+ //< 用于画图元外边框的折线
+ QPolygonF getPolygon(const int nWidth,const int nHeight) override;
+ bool isCustomItemPos() override;
+
+ void setDefaultIconSize() override;
+ //< 初始化后执行的操作,可以图元自定义一些特殊操作
+ void afterInitialize() override;
+
+private:
+ int getInputHeight(const int nIndex);
+ int getOutputHeight(const int nIndex );
+ void initPropertyMAP();
+
+public:
+ int getPCSNum () { return m_nPCSNum; }
+ void setPCSNum ( int nPCSNum );
+ int getSpace() { return m_nCustomPortSpace; }
+ void setSpace( int nValue );
+
+ void setWaitRespTimeout(int nWaitRespTimeout);
+ int getWaitRespTimeout() {return m_nWaitRespTimeout;}
+ void setRegulateCycle(int nRegulateCycle);
+ int getRegulateCycle() {return m_nRegulateCycle;}
+
+ void setMinAllocP(float fMinAllocP);
+ float getMinAllocP() {return m_fMinAllocP;}
+
+ void setCommPrecision(float fCommPrecision);
+ float getCommPrecision() {return m_fCommPrecision;}
+ void setRegulatePrecision(float fRegulatePrecision);
+ float getRegulatePrecision() {return m_fRegulatePrecision;}
+
+private:
+ QMap m_mapProperty;
+ int m_nTopInPortNum; //< 顶框中输入端口个数
+ int m_nTopOutPortNum; //< 顶框中输出端口个数
+
+ int m_nCustomPortSpace;
+ Q_PROPERTY(int PortSpace READ getSpace WRITE setSpace USER true DESIGNABLE true)
+
+ int m_nPCSNum; // PCS个数 机组个数
+ Q_PROPERTY( int UnitCnt READ getPCSNum WRITE setPCSNum USER true DESIGNABLE true )
+
+ IMPL_PROPERTY( QString, AllocALG ) // 功率分配算法 allocation algorithm
+ Q_PROPERTY( QString AllocALG READ get_AllocALG WRITE set_AllocALG USER true DESIGNABLE true )
+
+ int m_nWaitRespTimeout; //< 等待调节反馈超时时间
+ Q_PROPERTY( int WaitRespTimeout READ getWaitRespTimeout WRITE setWaitRespTimeout USER true DESIGNABLE true )
+
+ int m_nRegulateCycle; //< 稳定时定时调节周期
+ Q_PROPERTY( int RegulateCycle READ getRegulateCycle WRITE setRegulateCycle USER true DESIGNABLE true )
+
+ float m_fMinAllocP; //< 最小分配功率
+ Q_PROPERTY( float MinAllocP READ getMinAllocP WRITE setMinAllocP USER true DESIGNABLE true )
+
+ //< 作用:1、若读回来的机组功率设定值与下发的目标值差值的绝对值小于该值,则认为通讯成功。2、下发功率是此值的倍数
+ float m_fCommPrecision;
+ Q_PROPERTY( float CommPrecision READ getCommPrecision WRITE setCommPrecision USER true DESIGNABLE true )
+
+ //< 作用:若机组的功率实际值与设定值差值的绝对值小于该值,则认为成功。
+ float m_fRegulatePrecision;
+ Q_PROPERTY( float RegulatePrecision READ getRegulatePrecision WRITE setRegulatePrecision USER true DESIGNABLE true )
+};
+
+#endif // TEMPLATEPLUGIN_H
diff --git a/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/powercontrolreactiveplugin.pro b/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/powercontrolreactiveplugin.pro
new file mode 100644
index 00000000..f34a68b3
--- /dev/null
+++ b/product/src/tools/fbd_designer/fbd_plugins/powercontrolreactiveplugin/powercontrolreactiveplugin.pro
@@ -0,0 +1,33 @@
+TARGET = powercontrolreactiveplugin
+QT = core gui widgets
+CONFIG += dll
+TEMPLATE = lib
+
+SOURCES += \
+ powercontrolreactiveplugin.cpp
+
+HEADERS += \
+ powercontrolreactiveplugin.h
+
+INCLUDEPATH += \
+ ../.. \
+ ../../fbd_block \
+ ../../include
+
+LIBS += \
+ -lfbd_block
+
+RESOURCES += \
+ icon.qrc
+
+!include( ../../../../common.pri ){
+ error(the file common.pri is not exist!!)
+}
+
+#fbd_plugins插件的统一规则
+FBD_PLUGINS_PRI=$$PWD/../fbd_plugins.pri
+exists($$FBD_PLUGINS_PRI) {
+ include($$FBD_PLUGINS_PRI)
+}else {
+ error("FATAL error: can not find fbd_plugins.pri")
+}
diff --git a/product/src/tools/fbd_designer/fbd_plugins/sendsmsplugin/icon/sendsms.png b/product/src/tools/fbd_designer/fbd_plugins/sendsmsplugin/icon/sendsms.png
index c33ffb65..a916429c 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/sendsmsplugin/icon/sendsms.png and b/product/src/tools/fbd_designer/fbd_plugins/sendsmsplugin/icon/sendsms.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/smtpmailplugin/icon/smtpmail.png b/product/src/tools/fbd_designer/fbd_plugins/smtpmailplugin/icon/smtpmail.png
index ef256f5a..15fcc4fc 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/smtpmailplugin/icon/smtpmail.png and b/product/src/tools/fbd_designer/fbd_plugins/smtpmailplugin/icon/smtpmail.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/timetriggerplugin/icon/timetrigger.png b/product/src/tools/fbd_designer/fbd_plugins/timetriggerplugin/icon/timetrigger.png
index ac39c6df..da6cb3f9 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/timetriggerplugin/icon/timetrigger.png and b/product/src/tools/fbd_designer/fbd_plugins/timetriggerplugin/icon/timetrigger.png differ
diff --git a/product/src/tools/fbd_designer/fbd_plugins/videocontrolplugin/icon/videocontrol.png b/product/src/tools/fbd_designer/fbd_plugins/videocontrolplugin/icon/videocontrol.png
index 7fcc3ec1..18de7a53 100644
Binary files a/product/src/tools/fbd_designer/fbd_plugins/videocontrolplugin/icon/videocontrol.png and b/product/src/tools/fbd_designer/fbd_plugins/videocontrolplugin/icon/videocontrol.png differ