FileNotFoundException Traceback (most recent call last)
<ipython-input-2-dcea9bdaa6b6> in <module>
7 from_dt = System.DateTime(2014, 7, 12, 10, 45, 0)
8 to_dt = System.DateTime(2014, 7, 12, 10, 55, 0)
----> 9 simulator.PrepareSimulation(from_dt, to_dt)
10 print(simulator.SimulationStart.Date)
FileNotFoundException: Could not load file or assembly 'Antlr4.Runtime, Version=4.4.0.0, Culture=neutral, PublicKeyToken=bb1075973a9370c4' or one of its dependencies. The system cannot find the file specified.
at DHI.Math.Expression.MathExpression.Compile()
at DHI.Mike1D.ControlModule.ControlData.Initialize(Diagnostics parentDiagnostics)
at DHI.Mike1D.Mike1DDataAccess.Mike1DController.0(Diagnostics A_0)
at DHI.Mike1D.Mike1DDataAccess.Mike1DController.DoInitialize(IDiagnostics diagnostics)
at DHI.Mike1D.Mike1DDataAccess.AbstractMike1DController.Initialize(IDiagnostics diagnostics)
at DHI.M1DSimulator.M1DSimulatorRunner.PrepareSimulation(DateTime from, DateTime to)
at DHI.M1DSimulator.M1DSimulator.PrepareSimulation(DateTime from, DateTime to)
I have C:\Program Files (x86)\DHI\2020\bin\DHI.Math.Expression.dll - version 18.1.0.14122. According to NuGet, this dll depends on Antlr4.Runtime.Standard (>= 4.7.2). I have C:\Program Files (x86)\DHI\2020\bin\x64\Antlr4.Runtime.Standard.dll - version 4.7.2.
Have you had any issues with Antlr4.Runtime?
import sys
# specify path to the DHI assemblies
MIKE_SDK_path = 'C:\\Program Files (x86)\\DHI\\2020\\bin\\'
sys.path.append(MIKE_SDK_path)
sys.path.append(r'C:\Users\eclark\Documents\GitHub\Mike1D-SDK-examples\mike1d-rtc-simulator-example\Release')
import clr
clr.AddReference('DHI.M1DSimulator')
clr.AddReference('DHI.Mike.Install')
clr.AddReference('System')
# import functions from dlls, etc
from DHI.Mike.Install import MikeImport
import System
import DHI.M1DSimulator
MikeImport.SetupLatest()
# initialize simulator with example case
modelFilePath = r'.\MU\RTCExampleBase.m1dx'
simulator = DHI.M1DSimulator.M1DSimulatorRtc(modelFilePath)
# Add water volume to result file
simulator.SetQuantitiesOfResultSpecification(System.Array[str](['WaterVolume', 'Discharge']))
# Set simulation start and end, print before and after to make sure it worked
print(simulator.SimulationStart.Date)
print(simulator.SimulationEnd.Date)
from_dt = System.DateTime(2014, 7, 12, 10, 45, 0)
to_dt = System.DateTime(2014, 7, 12, 10, 55, 0)
simulator.PrepareSimulation(from_dt, to_dt)
print(simulator.SimulationStart.Date)
print(simulator.SimulationEnd.Date)