diff --git a/simulator/compiler/parser/grammar/rdoevn.yx b/simulator/compiler/parser/grammar/rdoevn.yx index 475cfb35c..528c86318 100644 --- a/simulator/compiler/parser/grammar/rdoevn.yx +++ b/simulator/compiler/parser/grammar/rdoevn.yx @@ -9520,11 +9520,9 @@ smr_main { #PASS2 { - PARSER->error().error(@1, @3, "Невозможно изменить параметр ресурса до запуска модели"); - // TODO вернуть возможность изменить параметр ресурса во вкладке SMR - // LPRDOFUNArithm pArithm = PARSER->stack().pop($5); - // ASSERT(pArithm); - // PARSER->getSMR()->setResParValue(PARSER->stack().pop($1)->src_info(), PARSER->stack().pop($3)->src_info(), pArithm); + LPRDOFUNArithm pArithm = PARSER->stack().pop($5); + ASSERT(pArithm); + PARSER->getSMR()->setResParValue(PARSER->stack().pop($1)->src_info(), PARSER->stack().pop($3)->src_info(), pArithm); } } | RDO_IDENTIF '.' RDO_Seed '=' RDO_INT_CONST diff --git a/simulator/compiler/parser/rdoparser.cpp b/simulator/compiler/parser/rdoparser.cpp index b9750067f..0b823e227 100644 --- a/simulator/compiler/parser/rdoparser.cpp +++ b/simulator/compiler/parser/rdoparser.cpp @@ -346,7 +346,7 @@ Context::LPFindResult RDOParser::onFindContext(const std::string& method, const } } } - + } return rdo::Factory::create(); @@ -531,6 +531,12 @@ void RDOParser::runRSSPost() void RDOParser::runSMRPost() { + //! Калки, созданные в SMR + const std::vector calcList = m_pSMR->getCalcList(); + for (const rdo::runtime::LPRDOCalc& initCalc: calcList) + { + runtime()->addInitCalc(initCalc); + } //! Планирование событий, описанных в SMR for (const LPRDOPATPattern& pattern: getPATPatterns()) { diff --git a/simulator/compiler/parser/rdosmr.cpp b/simulator/compiler/parser/rdosmr.cpp index 4e49baef9..a12ae3329 100644 --- a/simulator/compiler/parser/rdosmr.cpp +++ b/simulator/compiler/parser/rdosmr.cpp @@ -3,8 +3,8 @@ \file rdosmr.cpp \authors Барс Александр \authors Урусов Андрей (rdo@rk9.bmstu.ru) - \date - \brief + \date + \brief \indent 4T */ @@ -124,7 +124,7 @@ void RDOSMR::setConstValue(const RDOParserSrcInfo& const_info, LPRDOFUNArithm& p ASSERT(pArithm); pArithm->checkParamType(pConstant->getTypeInfo()); rdo::runtime::LPRDOCalc pCalc = pArithm->createCalc(pConstant->getTypeInfo()); - RDOParser::s_parser()->runtime()->addInitCalc(rdo::Factory::create(pConstant->getNumber(), pCalc)); + this->addCalc(rdo::Factory::create(pConstant->getNumber(), pCalc)); RDOParser::s_parser()->insertChanges(pConstant->src_text(), pArithm->src_text()); } @@ -147,7 +147,7 @@ void RDOSMR::setResParValue(const RDOParserSrcInfo& res_info, const RDOParserSrc pArithm->checkParamType(pParam->getTypeInfo()); const std::size_t parNumb = pResource->getType()->getRTPParamNumber(par_info.src_text()); rdo::runtime::LPRDOCalc pCalc = pArithm->createCalc(pParam->getTypeInfo()); - RDOParser::s_parser()->runtime()->addInitCalc(rdo::Factory::create(pResource->getID(), parNumb, pCalc)); + this->addCalc(rdo::Factory::create(pResource->getID(), parNumb, pCalc)); RDOParser::s_parser()->insertChanges(res_info.src_text() + "." + par_info.src_text(), pArithm->src_text()); } diff --git a/simulator/compiler/parser/rdosmr.h b/simulator/compiler/parser/rdosmr.h index 4fdcb776b..4f3f815ab 100644 --- a/simulator/compiler/parser/rdosmr.h +++ b/simulator/compiler/parser/rdosmr.h @@ -70,6 +70,8 @@ DECLARE_FACTORY(RDOSMR); void setSeed (const RDOParserSrcInfo& seq_info, int base); void insertBreakPoint(const RDOParserSrcInfo& src_info, LPRDOFUNLogic& pLogic); + std::vector getCalcList() const { return m_SMRCalcList; } + private: RDOSMR(); @@ -95,6 +97,10 @@ DECLARE_FACTORY(RDOSMR); YYLTYPE m_traceEndTime_pos; LPRDOFUNLogic m_pTerminateIf; BreakPointList m_breakPointList; + + void addCalc(const rdo::runtime::LPRDOCalc pCalc) { m_SMRCalcList.push_back(pCalc); } + + std::vector m_SMRCalcList; }; CLOSE_RDO_PARSER_NAMESPACE