@@ -2116,6 +2116,138 @@ class ModelicaSystem(ModelicaSystemOMC):
21162116 Compatibility class.
21172117 """
21182118
2119+ def __init__ (
2120+ self ,
2121+ fileName : Optional [str | os .PathLike | pathlib .Path ] = None ,
2122+ modelName : Optional [str ] = None ,
2123+ lmodel : Optional [list [str | tuple [str , str ]]] = None ,
2124+ commandLineOptions : Optional [list [str ]] = None ,
2125+ variableFilter : Optional [str ] = None ,
2126+ customBuildDirectory : Optional [str | os .PathLike ] = None ,
2127+ omhome : Optional [str ] = None ,
2128+ omc_process : Optional [OMCSessionLocal ] = None ,
2129+ build : bool = True ,
2130+ ) -> None :
2131+ super ().__init__ (
2132+ command_line_options = commandLineOptions ,
2133+ work_directory = customBuildDirectory ,
2134+ omhome = omhome ,
2135+ session = omc_process ,
2136+ )
2137+ self .model (
2138+ model_name = modelName ,
2139+ model_file = fileName ,
2140+ libraries = lmodel ,
2141+ variable_filter = variableFilter ,
2142+ build = build ,
2143+ )
2144+ self ._getconn = self ._session
2145+
2146+ def setCommandLineOptions (self , commandLineOptions : str ):
2147+ super ().set_command_line_options (command_line_option = commandLineOptions )
2148+
2149+ def setContinuous ( # type: ignore[override]
2150+ self ,
2151+ cvals : str | list [str ] | dict [str , Any ],
2152+ ) -> bool :
2153+ if isinstance (cvals , dict ):
2154+ return super ().setContinuous (** cvals )
2155+ raise ModelicaSystemError ("Only dict input supported for setContinuous()" )
2156+
2157+ def setParameters ( # type: ignore[override]
2158+ self ,
2159+ pvals : str | list [str ] | dict [str , Any ],
2160+ ) -> bool :
2161+ if isinstance (pvals , dict ):
2162+ return super ().setParameters (** pvals )
2163+ raise ModelicaSystemError ("Only dict input supported for setParameters()" )
2164+
2165+ def setOptimizationOptions ( # type: ignore[override]
2166+ self ,
2167+ optimizationOptions : str | list [str ] | dict [str , Any ],
2168+ ) -> bool :
2169+ if isinstance (optimizationOptions , dict ):
2170+ return super ().setOptimizationOptions (** optimizationOptions )
2171+ raise ModelicaSystemError ("Only dict input supported for setOptimizationOptions()" )
2172+
2173+ def setInputs ( # type: ignore[override]
2174+ self ,
2175+ name : str | list [str ] | dict [str , Any ],
2176+ ) -> bool :
2177+ if isinstance (name , dict ):
2178+ return super ().setInputs (** name )
2179+ raise ModelicaSystemError ("Only dict input supported for setInputs()" )
2180+
2181+ def setSimulationOptions ( # type: ignore[override]
2182+ self ,
2183+ simOptions : str | list [str ] | dict [str , Any ],
2184+ ) -> bool :
2185+ if isinstance (simOptions , dict ):
2186+ return super ().setSimulationOptions (** simOptions )
2187+ raise ModelicaSystemError ("Only dict input supported for setSimulationOptions()" )
2188+
2189+ def setLinearizationOptions ( # type: ignore[override]
2190+ self ,
2191+ linearizationOptions : str | list [str ] | dict [str , Any ],
2192+ ) -> bool :
2193+ if isinstance (linearizationOptions , dict ):
2194+ return super ().setLinearizationOptions (** linearizationOptions )
2195+ raise ModelicaSystemError ("Only dict input supported for setLinearizationOptions()" )
2196+
2197+ def getContinuous (
2198+ self ,
2199+ names : Optional [str | list [str ]] = None ,
2200+ ):
2201+ retval = super ().getContinuous (names = names )
2202+ if self ._simulated :
2203+ return retval
2204+
2205+ if isinstance (retval , dict ):
2206+ retval2 : dict = {}
2207+ for key , val in retval .items ():
2208+ if np .isnan (val ):
2209+ retval2 [key ] = None
2210+ else :
2211+ retval2 [key ] = str (val )
2212+ return retval2
2213+ if isinstance (retval , list ):
2214+ retval3 : list [str | None ] = []
2215+ for val in retval :
2216+ if np .isnan (val ):
2217+ retval3 .append (None )
2218+ else :
2219+ retval3 .append (str (val ))
2220+ return retval3
2221+
2222+ raise ModelExecutionException ("Invalid data!" )
2223+
2224+ def getOutputs (
2225+ self ,
2226+ names : Optional [str | list [str ]] = None ,
2227+ ):
2228+ retval = super ().getOutputs (names = names )
2229+ if self ._simulated :
2230+ return retval
2231+
2232+ if isinstance (retval , dict ):
2233+ retval2 : dict = {}
2234+ for key , val in retval .items ():
2235+ if np .isnan (val ):
2236+ retval2 [key ] = None
2237+ else :
2238+ retval2 [key ] = str (val )
2239+ return retval2
2240+ if isinstance (retval , list ):
2241+ retval3 : list [str | None ] = []
2242+ for val in retval :
2243+ if np .isnan (val ):
2244+ retval3 .append (None )
2245+ else :
2246+ retval3 .append (str (val ))
2247+ return retval3
2248+
2249+ raise ModelExecutionException ("Invalid data!" )
2250+
21192251
21202252class ModelicaDoEABC (metaclass = abc .ABCMeta ):
21212253 """
0 commit comments