public class OpenModelica extends TypedAtomicActor
One actor provided in the Vergil, MoreLibraries Under OpenModelica. It is called OpenModelica; To view or edit its Modelica script, look inside the actor.
OpenModelica actor starts the OpenModelica Compiler(OMC) server listening on the CORBA interface in initialize(). In fire(), upon modifying the value of variable(s) and parameter(s) by input port or actor's parameter, the Modelica model is built in non-interactive or interactive mode.
Upon building the model in an interactive mode, client and servers are created, IP and ports of the servers are set and streams for transferring information between client and servers are set up. Afterwards, the simulation result is sent from the Transfer Server to the Ptolemy II. The simulation result is displayed step by step according to the parameters of the OpenModelica actor. The formula for calculating the step time is step time = (stop time - start time) / number of intervals. There is one issue, the simulation does not stop automatically at the stop time that is selected as one of the OpenModelica actors' parameters. So during fetching the result back from Transfer server, stop time should be checked, this checking is occurred in OMIThread. The simulation result is sent in the string format to the output port of the OpenModelica actor to be displayed by Display actor.
In case of building the model in a non-interactive mode, it's not possible to have the result step by step, the whole simulation result is displayed according to the start and stop time of simulation that are set as OpenModelica actors' parameters.
In the final phase, wrapup(), the OMC server is stopped.
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
StringParameter |
baseModel
The base-model that should be built.
|
FileParameter |
dependencies
The file that the base-model should be loaded from.
|
FileParameter |
fileName
The file that the (sub-)model should be loaded from.
|
StringParameter |
initialValue
New value for changing the current value of variable(s) and parameter(s) prior to running the model.
|
TypedIOPort |
input
Input port of the OpenModelica actor, that gets input from Ramp.
|
Parameter |
numberOfIntervals
Number of intervals in the result file.
|
TypedIOPort |
output
Output port sends the simulation result from Ptolemy II
to other actors.
|
StringParameter |
outputFormat
Format of the generated result file.
|
StringParameter |
parameter
Parameter(s) and variable(s) of the Modelica model.
|
StringParameter |
processingMode
Type of processing for running the executable result file of building the Modelica model.
|
Parameter |
simulationStartTime
The start time of the simulation.
|
Parameter |
simulationStopTime
The stop time of the simulation.
|
StringParameter |
subModel
The (sub-)model that should be built.
|
StringParameter |
variableFilter
Filter for displaying result of simulation.
|
_typesValid
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
OpenModelica(CompositeEntity container,
java.lang.String name)
Construct an actor with the given container and name.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace.
|
void |
fire()
Invoke the fire() of the super class.
|
void |
initialize()
Invoke the initialize() of the super class.
|
void |
wrapup()
Invoke the wrapup() of the super class.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
addInitializable, preinitialize, removeInitializable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public StringParameter baseModel
public FileParameter dependencies
public FileParameter fileName
public StringParameter initialValue
public TypedIOPort input
public Parameter numberOfIntervals
public TypedIOPort output
public StringParameter outputFormat
public StringParameter parameter
public StringParameter processingMode
public Parameter simulationStartTime
public Parameter simulationStopTime
public StringParameter subModel
public StringParameter variableFilter
public OpenModelica(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name of this actor.IllegalActionException
- If the actor cannot be contained
by the proposed container.NameDuplicationException
- If the container already has an
actor with this name.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class TypedAtomicActor
workspace
- The workspace for the cloned object.java.lang.CloneNotSupportedException
- Not thrown in this base classNamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void fire() throws IllegalActionException
After building the model in an interactive mode, the simulation result is calculated step by step according to the parameters of the OpenModelica actor. The result is sent in the string format to the output port of the OpenModelica actor to be displayed by Display actor.
fire
in interface Executable
fire
in class AtomicActor<TypedIOPort>
IllegalActionException
- If the evaluation of the expression
triggers it, or the evaluation yields a null result, or the evaluation
yields an incompatible type, or if there is no director.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class AtomicActor<TypedIOPort>
IllegalActionException
- If OMC server is unable to start.public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class AtomicActor<TypedIOPort>
IllegalActionException
- If OMC server is unable to stop.