Macros for Accessing the Simulation Structure
The following macros are used to access some global variables or information such as simulator current time or error tolerances. These variables are available on the simulator structure.
- GetFinalTime(block): Get the final time of the simulation.
- GetHmax(block): Get the (maximum) step-size provided by the user (Note that this value can be auto). If the solver is fixed-step, this value will be the step-size of the solver.
- GetHmaxUsed(block): Get the (maximum) step-size actually used by the simulator.
- GetAtol(block): Get the absolute error tolerance used by the simulator.
- GetRtol(block): Get the relative error tolerance used by the simulator.
- GetVssInitialTime(block): Get the start time of the simulation used by the simulator.
- GetTtol(block): Get the error tolerance in time provided by the user (Note that this value can be auto).
- GetTtolUsed(block): Get the error tolerance in time actually used by the simulator.
- GetAtolptr(block): Get the absolute error tolerance vector used by the simulator.
- GetBlockNum(block): Get the ordering number of the block defined by the simulator.
- GetSQRU(block): Get the square-root of the machine epsilon used by the simulator.
- GetNeq(block): Get the number of continuous-time state of the model used by the simulator.
- GetNzero(block): Get the number of zero-crossing surfaces of the model used by the simulator.
- GetInitialX(block): Get initial value of continuous-time states of the model used by the simulator.
- GetInitialXd(block): Get initial value of the derivative of continuous-time states of the model used by the simulator.
- IsHotReStart(block): Indicates if the block is called while the solver is just being reinitialized after a discrete event. 0 means that the solver is just being restarted.
- isColdRestart(block): Same as IsHotReStart, but 1 means that the solver is just being restarted.
- DoColdRestart(block): Force the solver to reinitialize.
- GetVssTime(block): Get the current time in the simulator.
- GetSimulationPhase(block): Get the phase of the simulation used by the simulator.
- GetMeshPoint(block): Get the last mesh-point time instant taken by the solver.
- GetLastStepSize(block): Get the last step-size successfully taken by the solver.
- GetNextTryStepSize(block): Get the next step-size being tried by the solver.
- GetSimulatorInitiated(block): indicates if the simulator has finished the initialization of the model.
- isStopRequested(block): Indicates if the user has pressed the stop button to terminate the simulation.
- StopSimulation(block,val): Force the simulator to finish the simulation.
- isZeroCrossingEnabled(block): Indicates if the zero-crossing option is enabled in the simulator.
- isModeEnabled(block): Indicates if handling mode is enabled by the simulator.
- GetXpropPtr(block): Get the vector of the xproperty assigned to the block by the simulator. This vector is used to define if a continuous-state is differential or algebraic.
- GetAlphaPt(block): Get the actual value of alpha (α) when computing the Jacobian. Note that the Jacobian of the DAe is computed as follows: .
- GetBetaPt(block): Get the actual value of beta (β) when computing the Jacobian.
- isinTryPhase(block): Indicates if the block is being called by the numerical solver. In this case, the value given to the block is not a definitive value.
- areModesFixed(block): Indicates that if the block is being called with mode values fixed or relaxed (can be changed/updated by the block).
- isZeroCrossing(block): Indicates if the block is being called at a zero-crossing event.
- isDiscreteEvent(block): Indicates if the block is being called at a discrete event.
- isMeshPoint(block): Indicates if the block is being called at a mesh-point.
- isDiscreteLeftLimit(block): Indicates if the block is being called at a left-limit of a discrete event.
- isZeroCrossingLeftLimit(block): Indicates if the block is being called at a left-limit of a zero-crossing event.
- isExitInitialization(block): Indicates if the block is being called at the end of the initialization.
- isSimulatorInInitializationPhase(block): Indicates if the simulator is still in the initialization stage.
- isSimulatorInTerminationPhase(block): Indicates if the simulator is in the termination stage.
- Coserror(block,msg,...): Emits an error message. This message usually follows an error in the block and is followed by a return from the block.
- Coswarning(block,msg,...): Emits a warning message.
- Cosmessage(block,msg,...): Emits a purely informative message.
- GetSimulatedModelName(block): returns the name of the model being simulated.
- GetSimulatedModelFilePath(block): returns the path of the model being simulated.
- GetSimulatedModelTempDir(block): returns the path of the temporary folder for the current model.
- isInDebugMode(block): Indicates if the simulation is done in the debug mode.
- Discard(block): This block can indicate to the numerical solver that the state derivative cannot be computed and the solver should take smaller step size. This feature is used in flag= VssFlag_Derivatives, when the situation is treated as an error.
- isinRepeatEventBlock(block): Indicates if this call to the block is the repetition of a previous event.