7.13. DAE Tools Simulator

7.13.1. Overview

7.13.2. Classes

class daeSimulator(app, **kwargs)[source]

Bases: PyQt5.QtWidgets.QDialog

done(status)[source]
run(showExplorer)[source]
showMessage(msg)[source]
slotExportSparseMatrixAsMatrixMarketFormat()[source]
slotOpenSparseMatrixImage()[source]
slotPause()[source]
slotResume()[source]
slotRun()[source]
slotShowExplorerAndRun()[source]
class daeSimulationExplorer(qt_app, simulation, **kwargs)[source]

Bases: PyQt5.QtWidgets.QDialog

generateCode(language)[source]
static generateHTMLForm(simulation, htmlOutputFile, find_files_dir='.')[source]
static generateJSONSettings(simulation)[source]
jsonRuntimeSettings
reject()[source]
runtimeSettings
static saveJSONSettings(simulation, filename)[source]
updateSimulation(verbose=False)[source]
class daeSimulationInspector(simulation)[source]

Bases: object

categoryActiveStates = '___ACTIVE_STATES___'
categoryDOFs = '___DOFS___'
categoryDomains = '___DOMAINS___'
categoryInitialConditions = '___INITIAL_CONDITIONS___'
categoryParameters = '___PARAMETERS___'
categoryVariablesToReport = '___VARIABLES_TO_REPORT___'

7.13.3. Web service classes

daeWebService() The base class for web applications/web services.
daeSimulationWebService()
daeFMI2_CoS_WebService()
class BadRequest[source]

Bases: RuntimeError

Results in: 400 Bad Request response

class ServerError[source]

Bases: RuntimeError

Results in: 500 Internal Server Error response

class NoLoggingWSGIRequestHandler(request, client_address, server)[source]

Bases: wsgiref.simple_server.WSGIRequestHandler

Request handler that suppresses logging to the stderr.

log_message(format, *args)[source]
class daeWebService[source]

Bases: object

The base class for web applications/web services. Performs the low level tasks such as parsing the query to get its arguments and sending responses with results to the clients.

getQueryArguments(environ)[source]

Returns the query arguments’ values as a dictionary object. Can process both GET and POST requests (double check this).

jsonBadRequest(reason, start_response, simulationID)[source]

Returns the bad request error status to the client. The argument reason is a string with the exception description. It is not a fatal error, thus DO NOT delete the current object identified by its simulationID.

jsonError(reason, start_response, simulationID)[source]

Returns the error status to the client. The argument reason is a string with the exception description. In case of errors always deletes the current object identified by its simulationID.

jsonResult(result, start_response)[source]

Returns the success status and the data to the client.

jsonSuccess(start_response)[source]

Returns the success status to the client and no results.

keepRunning()[source]

Server will stop if at least one request has been processed and no activeObjects exist (all active objects finished with the simulation). Therefore, the server can serve multiple clients but will shutdown after all objects freed their resources and the number of active objects goes to zero.

static startWebService(application, address, port, serveForever=False)[source]

Start the web application.

static tryConnectWebService(address, port, timeout=10)[source]

Try to connect to the above server (timeout is 10s). If successful, the server has successfully been started and the subsequent clients can connect to it.

class daeSimulationWebService[source]

Bases: daetools.dae_simulator.web_service.daeWebService

static runSimulationsAsWebService(availableSimulations, address='127.0.0.1', port=8001)[source]

Starts the daetools web service providing the simulation via their names. Argument ‘simulations’ is a dictionary: {name: callable}

class fmi2Component(simulation, instanceName, guid)[source]

Bases: object

fmi2CancelStep()[source]
fmi2DoStep(currentCommunicationPoint, communicationStepSize, noSetFMUStatePriorToCurrentPoint)[source]
fmi2EnterInitializationMode()[source]
fmi2ExitInitializationMode()[source]
fmi2FreeInstance()[source]
fmi2GetBoolean(valReferences)[source]
fmi2GetInteger(valReferences)[source]
fmi2GetReal(valReferences)[source]
fmi2GetString(valReferences)[source]
static fmi2Instantiate(instanceName, guid, resourceLocation)[source]
fmi2Reset()[source]
fmi2SetBoolean(valReferences, values)[source]
fmi2SetInteger(valReferences, values)[source]
fmi2SetReal(valReferences, values)[source]
fmi2SetString(valReferences, values)[source]
fmi2SetupExperiment(toleranceDefined, tolerance, startTime, stopTimeDefined, stopTime)[source]
fmi2Terminate()[source]
class daeFMI2_CoS_WebService[source]

Bases: daetools.dae_simulator.web_service.daeWebService

class daeWebServiceClient(webServiceName, address, port)[source]

Bases: object

getResponse()[source]
sendRequest(args, method='POST')[source]
class fmi2Component_ws(webServiceName='daetools_fmi_ws', server='127.0.0.1', port=8002)[source]

Bases: daetools.dae_simulator.web_service_client.daeWebServiceClient

fmi2CancelStep()[source]
fmi2DoStep(currentCommunicationPoint, communicationStepSize, noSetFMUStatePriorToCurrentPoint)[source]
fmi2EnterInitializationMode()[source]
fmi2ExitInitializationMode()[source]
fmi2FreeInstance()[source]
fmi2GetBoolean(valReferences)[source]
fmi2GetInteger(valReferences)[source]
fmi2GetReal(valReferences)[source]
fmi2GetString(valReferences)[source]
fmi2Instantiate(instanceName, guid, resourceLocation)[source]
fmi2Reset()[source]
fmi2SetBoolean(valReferences, values)[source]
fmi2SetInteger(valReferences, values)[source]
fmi2SetReal(valReferences, values)[source]
fmi2SetString(valReferences, values)[source]
fmi2SetupExperiment(toleranceDefined, tolerance, startTime, stopTimeDefined, stopTime)[source]
fmi2Terminate()[source]

7.13.4. Web service JavaScript classes

daeWebService
daeDataReporter
daeDAESolver
daeSimulation
daeFMI2Simulation
class daeWebService(address, port, webServiceName, method)
ServerStatus
ClearServer()
onSuccess(httpRequest, path, args)
onError(httpRequest, path, args)
onConnectionFailure(path, error)
getResponse(httpRequest)
createHTTPRequest()
executeFun(functionName, parameters)
class daeSimulation(webService)
LoadSimulation(pythonFile, loadCallable, args)
LoadTutorial(tutorialName)
LoadSimulationByName(simulationName, args)
AvailableSimulations()
Finalize()
ModelInfo
Name
DataReporter
DAESolver
CurrentTime
TimeHorizon
ReportingInterval
Run()
SolveInitial()
Reinitialize()
Reset()
ReportData()
Integrate(stopAtDiscontinuity, reportDataAroundDiscontinuities)
IntegrateForTimeInterval(timeInterval, stopAtDiscontinuity, reportDataAroundDiscontinuities)
IntegrateUntilTime(time, stopAtDiscontinuity, reportDataAroundDiscontinuities)
GetParameterValue(name)
GetVariableValue(name)
GetActiveState(stnName)
SetParameterValue(name, value)
ReAssignValue(name, value)
ReSetInitialCondition(name, value)
SetActiveState(stnName, activeState)
create_daetools_ws()
class daeDataReporter(simulation)
Value(variableName)
AllValues()
class daeDAESolver(simulation)
RelativeTolerance
class daeFMI2Simulation(webService)
fmi2Instantiate(instanceName, guid, resourceLocation)
fmi2Terminate()
fmi2FreeInstance()
fmi2SetupExperiment(toleranceDefined, tolerance, startTime, stopTimeDefined, stopTime)
fmi2EnterInitializationMode()
fmi2ExitInitializationMode()
fmi2Reset()
fmi2DoStep(currentCommunicationPoint, communicationStepSize, noSetFMUStatePriorToCurrentPoint)
fmi2CancelStep()
fmi2GetReal(valReferences)
fmi2SetReal(valReferences, values)
fmi2GetString(valReferences)
fmi2SetString(valReferences, values)
fmi2GetBoolean(valReferences)
fmi2SetBoolean(valReferences, values)
fmi2GetInteger(valReferences)
fmi2SetInteger(valReferences, values)