diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 29d730a7c..432a83ac1 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -178,10 +178,12 @@ namespace Opm { double orat = record->getItem("ORAT")->getSIDouble(0); double wrat = record->getItem("WRAT")->getSIDouble(0); double grat = record->getItem("GRAT")->getSIDouble(0); - WellProducer::ControlModeEnum control = WellProducer::ControlModeFromString( record->getItem("CMODE")->getString(0)); WellCommon::StatusEnum status = WellCommon::StatusFromString( record->getItem("STATUS")->getString(0)); - well->setProducerControlMode( currentStep , control ); + if (status != WellCommon::SHUT) { + WellProducer::ControlModeEnum control = WellProducer::ControlModeFromString( record->getItem("CMODE")->getString(0)); + well->setProducerControlMode( currentStep , control ); + } well->setStatus( currentStep , status ); well->setOilRate(currentStep, orat); well->setWaterRate(currentStep, wrat); diff --git a/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp b/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp index 0c0c258f7..1e18cf695 100644 --- a/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp +++ b/opm/parser/eclipse/IntegrationTests/ScheduleCreateFromDeck.cpp @@ -60,6 +60,16 @@ BOOST_AUTO_TEST_CASE(CreateSchedule_Comments_After_Keywords) { } +BOOST_AUTO_TEST_CASE(WCONPROD_MissingCmode) { + ParserPtr parser(new Parser()); + boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_MISSING_CMODE"); + DeckPtr deck = parser->parseFile(scheduleFile.string()); + + BOOST_CHECK_NO_THROW( new Schedule(deck) ); +} + + + BOOST_AUTO_TEST_CASE(WellTesting) { ParserPtr parser(new Parser()); boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2"); diff --git a/testdata/integration_tests/SCHEDULE/SCHEDULE_MISSING_CMODE b/testdata/integration_tests/SCHEDULE/SCHEDULE_MISSING_CMODE new file mode 100644 index 000000000..5d627b2dd --- /dev/null +++ b/testdata/integration_tests/SCHEDULE/SCHEDULE_MISSING_CMODE @@ -0,0 +1,13 @@ +START + 10 MAI 2007 / + +SCHEDULE + +WELSPECS + 'D-4H' 'OP' 30 37 3.33 'OIL' 7* / +/ + + +WCONPROD + 'D-4H' 'SHUT' 15* / +/