Does anyone know how to access specific outputs of the Dymola built-in function getExperiment();? Unfortunately it only returns the Real scalar StartTime. The function seems to be defined as follows:
function getExperiment "Get current experiment setting"
output Real StartTime := 0.0 "Start of simulation";
output Real StopTime := 1.0 "End of simulation";
output Integer NumberOfIntervals := 0 "Number of output points";
output Real OutputInterval := 0.0 "Distance between output points";
output String Algorithm := "" "Integration method";
output Real Tolerance := 0.0001 "Tolerance of integration";
output Real FixedStepSize := 0.0 "Fixed step size for Euler";
end getExperiment;
My test model is:
model GetExpTest
Real staTime;
Real outInterval;
equation
(staTime,outInterval)=receiveInfo();
end GetExpTest;code here
With the function:
function receiveInfo
output Real startT;
output Real outputInterv;
algorithm
(startT,,,outputInterv,,,):=getExperiment();
end receiveInfo;
And the error message I get is:
Compiling and linking the model (Visual C++).
dsmodel.c dsmodel.c(32) : error C2079: 'dummy_mult_' uses undefined struct 'getExperiment_struct' dsmodel.c(32) : warning C4013: 'getExperiment' undefined; assuming extern returning int dsmodel.c(33) : error C2224: left of '.StartTime0_0_0member' must have struct/union type dsmodel.c(34) : error C2224: left of '.OutputInterval0_0_0member' must have struct/union type
Error generating Dymosim.
Thank you in Advance for help!
If I do: getExperiment()
, the following is returned:
= 0.0, 1.0, 500, 0.0, "dassl", 0.0001, 0.0
So you can access the values using a regular assignment taking multiple outputs. For example:
(StartTime,,NumberOfIntervals) := getExperiment()
Which returns:
Declaring variable: Real StartTime ;
Declaring variable: Integer NumberOfIntervals ;
StartTime
= 0.0
NumberOfIntervals
= 500