fnicolo

25 Reputation

2 Badges

7 years, 312 days

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are questions asked by fnicolo

Hello,

I use MapleSim to model the dynamics of motorcycles.
I have been at MapleSim2018 for a few months and I have a problem of simplifying the equations generated by MapleSim from my model.
In MapleSim2018, he tells me:

Processing Equations...
SelectCompiler: Check for installed compiler successful
Simplifying system with 8919 equations
DSN/ix1lite: Warning, equation size increased past 100000 while performing equation simplification. Model will be simulated in partially unsimplified form
Simplification removed 8428 equations. Remaining equations: 491
Generating simulation code

 

the same model (exactly the same) in MapleSim2016, he tells me :

Processing Equations...
Simplifying system with 8942 equations
Simplification removed 8494 equations. Remaining equations: 448
Generating simulation code

When I generate code from two versions of Maple (2016 and 2018) and compile it into an executable, the MapleSim 2018 executable runs 20% slower than the MapleSim 2016 version of the executable (the results and the behavior of both models are equivalent)

It is very strange that a new version of MapleSim generates a slower code than the old version. it may be due to the limitation of DSN / ix1lite in MapleSim2018 ... while MapleSim2016 does not have this limitation (with more equations to simplify!).

I need help, if it is possible to activate the complete simplification in DSN / ix1lite?

it is a big problem for me, the use of MapleSim2018 is not possible because of that. My model does not pass in real time.

thanks.

 

Hello,

I'm writting a Modelica External component which use a C function, like this :

model SAMS.BlockUdpReceiver
    parameter Integer relativeSockId = 0 "Relative socket id (0..10)";
    parameter Integer stateUdp = 2 "state of receiver 1=receive data from udp ; 2=state from recorder config file";
    parameter Real step_time = 0.05 "sample time in second";
    parameter Integer nbDouble = 3 "number of double value to send";

    function udpReceiveDataMapleSim
        input Integer relativeSockId;
        input Integer stateUdp;
        input Real step_time;
        input Real currentTime;
        input Integer nbDouble;
        output Real dataToReceived[nbDouble];
    external "C"udpReceiveDataMapleSim(SAMS.BlockUdpReceiver.udpReceiveDataMapleSim.relativeSockId, SAMS.BlockUdpReceiver.udpReceiveDataMapleSim.stateUdp, SAMS.BlockUdpReceiver.udpReceiveDataMapleSim.step_time, SAMS.BlockUdpReceiver.udpReceiveDataMapleSim.currentTime, SAMS.BlockUdpReceiver.udpReceiveDataMapleSim.nbDouble, SAMS.BlockUdpReceiver.udpReceiveDataMapleSim.dataToReceived)
            annotation (
                Library = "F:/SAMSSVN/workspaceMaple/SamsLibrary/x64/Debug/SamsDll.dll",
                __Maplesoft_callconv = "stdcall");
    end udpReceiveDataMapleSim;

    Modelica.Blocks.Interfaces.RealOutput dataReceived[nbDouble] annotation (Placement(
        visible = true,
        transformation(
            origin = {120, 50},
            extent = {
                {-20, -20},
                {20, 20}},
            rotation = 0),
        iconTransformation(
            origin = {110, 50},
            extent = {
                {-10, -10},
                {10, 10}},
            rotation = 0)));
equation
    when {initial(), sample(0, step_time)} then
        dataReceived = udpReceiveDataMapleSim(relativeSockId, stateUdp, step_time, time, nbDouble);
    end when;

    annotation (
        Diagram(coordinateSystem(extent = {
            {-100, -100},
            {100, 100}})),
        Icon,
        experiment(__Maplesoft_engine = 2),
        __Maplesoft_none);
end SAMS.BlockUdpReceiver;

I want MapleSim to call C function at initial() time and with a sampled period of step_time.

But, the function is called at each simulation step (here at 0.4 ms)

for demonstrate it, I print a log file each time the function is called.
this is a part of the result :

id Receiver =11 ; CurrentTime = 0.151200 while t_step=0.002000
id Receiver =11 ; CurrentTime = 0.151200 while t_step=0.002000
id Receiver =11 ; CurrentTime = 0.151200 while t_step=0.002000

id Receiver =11 ; CurrentTime = 0.151600 while t_step=0.002000
id Receiver =11 ; CurrentTime = 0.151600 while t_step=0.002000
id Receiver =11 ; CurrentTime = 0.151600 while t_step=0.002000

id Receiver =11 ; CurrentTime = 0.152000 while t_step=0.002000
id Receiver =11 ; CurrentTime = 0.152000 while t_step=0.002000
id Receiver =11 ; CurrentTime = 0.152000 while t_step=0.002000

Why C function is called so many time (3 times in a step), and why is called for each simulation step (0.4ms) instead of each 2 ms ?

Maybe I make a bug in my Modelica code ? or not ?

thanks for any reply.

 

Page 1 of 1