MapleSim Questions and Posts

These are Posts and Questions associated with the product, MapleSim

The Examples section on the help page of a command is important for learning, but cannot cover all uses. This is especially true for general purpose commands like "solve" or "simplify". Searching all help pages that contain the word "solve" results in too many irrelevant hits that do not contain examples.

Why does adding a bracket to a command not filter for help pages with examples using the command?

Inside a help page Find/Replace finds such strings.

Inverse kinematics can be done in several ways (this webinar gives a very good overview https://www.youtube.com/watch?v=X0OZ9EM6dns). A effective and simple method is to run a model in reverse direction. This can’t be done with causal modeling tools, where information flow is fixed by design (https://de.maplesoft.com/support/help/MapleSim/view.aspx?path=MapleSimUserGuide/Chapter01).

Inverse kinematics, which is possible with acausal modeling tools, is only an example for running a model in the reverse (i.e., inverted) direction.

Without success, I tried to find a reference who first came up with that elegant approach.

Anyone knows more?

MapleSim is a mature product. The rich component library leaves little room for improvement for wide range of applications. It is understandable that latest product releases focused on specialized toolboxes and performance improvements.

Here is what I think could be beneficial for many users, which is not related to performance, but can help improve the user experience:

  1. Crossing connection lines: A view option to render a crossing connection line with an arc at the crossing point of two connection lines of the same type. Right-click on a connection line might be enough.
     

    -> To avoid misinterpretations of routing in crowded model diagrams
     
  2. Parameters: An option to populate or reset changes in the parameter pane to the parameter default settings view and vice versa

    -> When testing or optimizing a model, sometimes changed parameters should become default values or be reset. Doing this manually is error prone and takes time.
     
  3. Component flip: Selecting more than one component including connection lines and applying a flip to all of them

    -> When building a model, it can happen that a nicely laid out arrangement of components needs to be mirrored or rotated in its entirety. Doing this component by component and connection by connection is a lot of work that can be saved by this option.
     
  4. Initial conditions: An option in the view menu to highlight components where ICs have been changed from ignore to treat as guess or to strictly enforce
     

    -> ICs are set for many purposes. In addition to defining ICs needed for simulations, this can include extracting equations, testing different model states, or temporarily "immobilizing" a model during assembly, to name a few. Undoing a tentative change can easily be forgotten. Combining existing models that work on their own into a new more complex model often results in an overly constrained model that either cannot be assembled or does not simulate.
    In debugging a model, ICs of all components must be individually inspected. This takes time. A quick overview that shows components where ICs are not set to ignore would be very helpful in debugging models.
     
  5. Undo Create subsystem: A reverse operation that inserts the contents of a subsystem into a parent subsystem.

    -> With the evolution of a model it is sometimes useful to exclude or include existing components from or to a subsystem. For this purpose, an undo create subsystem operation should preserve existing connections. A time saver.
     
  6. Subsystem ports: An option to align a subsystem port to the drawing grid to remove “micro” steps in connection lines
     

    -> For perfectionists who do not have the time to learn (and remember) how to fine-tune at the component level

    Update: MapleSim 2022.2 has subtantially improved on this. This item could be removed from the list.
     
  7. A history or log function of user actions changing a model, its parametrization or internal state.

    -> Often a model does not simulate at all or as desired after modifications. Restoring to a configuration that worked by undo only goes back to the last simulation performed. In such a situation, only reloading the latest file version and redoing modifications may restore the desired model, parametrization, or state. This takes time and migth be unsuccessful. A record of user actions would be a great help.
    History or log information in file format could also help MapleSim support to reproduce an error.

For me personally, reducing errors (4. > 7. > 2.) would improve the use experience much more than layouting aids (3. > 1., 5., 6.).

Hi there!

I'm attempting to develop a custom library in MapleSim (a Modelica solver engine) that can use convolution integrals to model the hydrodynamic behaviour of floating bodies. The convolution integral is mathematically represented as follows:

a general form of a convolution integral, spanning from negative to positive infinity in time

And the equation I'm particularly interested in solving is as follows:

Cummins equation to determine the motion of a floating body in waves

I'm trying to solve this convolution integral in Modelica using a model that can be imported to MapleSim. So far, I've had no luck in implementing this convolution for continuous functions symbolically. I have used a numerical approach on 2 arrays using the following approach in Modelica:

// Modelica function
function convIntegral
  input Real simTime;  // Simulation time
  input Real f[:];     // Kernel function array
  input Real g[:];     // Second function array

  output Real h[(2*simTime) - 1];    // Output the convolution integral in the form of an array
  
  // Define the algorithm to numerically compute the convolution integral of 2 arrays
  algorithm
    // Initialize the output array with zeroes
    for i in 1:((2*simTime) - 1) loop
      h[i] := 0;
    end for;
    
    // Iterate over the simulation time
    // Recursively increment the convolution array with the pointwise product of the 2 functions
    for i in 1:simTime loop
      for j in 1:simTime loop
        h[i+j-1] := (f[i] * g[j]) + h[i+j-1];
      end for;
    end for;
end convIntegral;
// End of function to compute the convolution integral

This works perfectly for discrete samples and I have verified it with output from Matlab's inbuilt function

conv(A,B)  % For 2 arrays A and B

However, I would like to implement this on 2 continuous functions and this numerical approach does not work since MapleSim does not support conversion between discrete and continuous signals.

I understand that convolution is essentially an operation between two functions, where we time-flip one of the functions (kernel) and then slide it across the other function while measuring the bounded area and outputting that as the result of the convolution. I include this image from Wikipedia that sums up convolution: (Not including links as they mark questions as spam)

I've tried implementing this in Modelica using the following code:

// Model to perform convolution on 2 continuous functions
model ConvolutionalIntegral

  extends Modelica.Blocks.Icons.Block;

  // Define model variables
  Real kernelFunction = (e ^ (-0.5 * time)) * cos(0.5 * time);  // I've taken an example of a function I might use
  Real kernelFunctionFlipped = (e ^ (-0.5 * (T_sim - time))) * cos(0.5 * (T_sim - time));  // I've flipped the kernel function about the vertical axis by converting the (time) variable to (T_sim - time) where (T_sim) is a variable storing the simulation duration
  Real secondFunction;  // The other function for the convolution
  Real convolutionIntegralOutput;  // Function to store the output
  
  equation
    // Convolution implementation
    der(convolutionIntegralOutput) = kernelFunctionFlipped * secondFunction;

    // Final equation to solve
    der(secondFunction) + convolutionIntegralOutput = 0;
    // An example of a differential equation I'd like to solve involving the convolution integral
    
end ConvolutionIntegral;

I had hoped that this would yield the output of the convolution since I'm essentially multiplying the time-flipped kernel and the other function and then integrating them over time. However, the output does not provide the expected result and it appears that Modelica interprets my code to mean that I'm integrating the pointwise product of these 2 functions over time instead of sliding the kernel over the other function.

I'd appreciate it if you could take a look at my code and my approach to solving the convolution integral symbolically, and point out where I'm making a mistake and what a possible fix might be.

Thank you!

We are happy to announce that we released MapleSim 2022 today.

The MapleSim 2022 family of products offers improvements in modeling and connectivity, including many that are in direct response to customer requests. Improvements include:

  • Reduce diagram clutter by using “wireless” To-From blocks for a larger variety of signals
  • Easily create, customize, and fine-tune control valves with new components and tools in the hydraulics library
  • Expand modeling scope with improvements to several specialized libraries and toolboxes, including the MapleSim add-on products for Battery, Heat Transfer, and Web Handling
  • New productivity and connectivity features in MapleSim Insight,  a standalone product in the MapleSim family that gives machine builders powerful simulation-based debugging and 3-D visualization capabilities that connect directly to your automation tools

 

See What’s New in MapleSim 2022 for more information about these and other improvements.

Hi there!

I'm working on implementing a custom Modelica Library in MapleSim 2021. I have Maple 2021 installed and my software is up to date. The library I have developed is in a single file (extension ".mo") which I developed on an IDE for Modelica i.e., I did not create the library using MapleSim. During the import into MapleSim, no errors appear in the system logs. All my components and models have been imported except for an "expandable connector". It appears that the problem is with the term "expandable".

Since this expandable connector does not appear among my library components, I attempted to create a custom component using the Modelica code editor in MapleSim. However, the file cannot be saved while I prefix the term "expandable" to "connector". The software allows me to save the file with the new code after dropping the "expandable" term.

I know that expandable connectors are used by Modelica. Here are the references I used during development:

https://mbe.modelica.university/components/architectures/expandable/

Working with Expandable Connectors - Claytex

However, there does not seem to be any information on expandable connectors in MapleSim. I'd appreciate it if any of you could throw some light on why I'm not able to import this component into MapleSim and fixes/suggestions on what I might be doing wrong. If any further information on my question is required, please do let me know.

example.msim

I want to get an adjustable parameter in maplesim. For example, here is a pulse voltage source, i  want to make its amplitude controlled by another voltage output (doesn't exist in this .msim).

ac-dc-dc1.msim

When i click off the "Plot events", the figure of Probe2 is pretty different comparing with "Plot events" is turned on. Here is my assumption: the simulation duration is 500 seconds and the plot points are 2000. Considering the frequency of sine current is 40HZ, many points cannot be ploted in the figure. So it is not a big deal for curve like Probe1 and Probe5 because  they tend to be a constant and Probe2 just reflect the tendency.

MapleSim is a fantastic tool to model multi-domain physical systems at a level that was unthinkable not so long ago. This post is about a simple problem that can be solved by hand, but where I failed with MapleSim using online resources.

For some time, I have been looking for answers to two questions:

  • How to control which variables (and parameters) are included in MapleSims equation exports? This question is crucial to derive forward and inverse kinematics.
  • Can the Equation Extraction App (in principle) provide a similar set of equations than the Multibody Analysis App? This question is rather academic until multidomain exports are desired (which the Multibody Analysis can’t provide).

The attached model helped me to clarify a few things and discover a real hidden secret (at least it was for me). I hope it can help others.

The model is a rather simple 3DOF mechanism. The task was to get a set of equations to derive the two rotations and the one displacement of the mechanism as a function of x,y,z coordinates.

After watching videos and inspecting models from the model gallery on inverse kinematics, I placed motion drivers for the input variables, added sensors for the output variables and wrapped the mechanism into a subsystem. However, as explained in more detail in the attachment, the set of exported variables was incomplete in both apps (AEs exports in the Equation Extraction Export and Position Constraints in the Multibody Analysis Export). Furthermore, the number of extracted equations did not match the three degrees of freedom.

After numerous trials it turned out that in addition to the motion drivers and sensors, initial conditions (ICs) had to be set. This is the hidden secret.  The crucial initial conditions (detailed in the attachment) are not required to assemble and run the model. So, introducing them temporarily for equation extraction is not obvious and never came to my mind. Setting ICs is, if I am not completely mistaken, also not highlighted in the documentation. This little trick of additionally setting initial conditions answered the above questions positively (at least for this 3DOF mechanism). In fact, it worked so well that all other failed attempts of conditioning the model for equations extraction worked immediately:

  • Immobilizing the assembly with a Fixed Frame (using parameters for the fixed frame position to represent input variables; the fixed frame can be inside or outside the subsystem model).
  • Using one Prescribed Translation component Instead of 3 motion drivers
  • Using variables to pass motion signals into the model subsystem instead of using signals and ports (using From variable and To Variable components)

These attempts underline the effort and the time spend to get the relevant equations for that simple problem. As it turned out, all approaches work but are not even required for the mechanism. The key to success was setting the ICs of the joints.  One can even strip the model down to its skeleton (removing all motion drivers and sensors as in the screen shot bellow) and still get the desired simple set of equations, provided the ICs are set.

 

It has to be noted, that the mechanically coupled (highlighted in yellow) prismatic joints contributed to the problems: MapleSim does not seem to take this mechanical constraint into account (as I would have expected). The ICs of both coupled components must be set to get the three equations containing all desired in and output variables.

If my finding is correct and of general relevance, I like to suggest including such kind of tips and tricks in training or reference material.  From an application engineer or developers’ perspective, knowing the underlying algorithms, its probably obvious what has to be done. But from a user’s perspective MaplsSim is a black box that works magically well in most cases. If it does not, trial and error is often the only alternative to make it work, because models are either too complex or too confidential to be shared with others.   

What I am addressing here is only the initial step of getting the desired equations. There is more to master. Save manipulation of equations too big to be inspected visually is also important. This has been well covered in several videos. Unfortunately, the quality of some of the footage does not allow to capture details of Maple commands. If possible, such material should be updated or replaced.

Overall, a collection of tips&tricks and dos&don’ts could establish some kind of best practice in deriving kinematics. If others would share their experience and findings, we all could save allot of time. A collection of valuable posts, questions, models, videos, and webinars could be a start. This collection not necessarily has to meet the high Maple standards of mathematical exactness and consistency. Engineers also accept pragmatic solutions to solve a problem.

If my findings are incorrect or you have better advise, please let us know.

MBA_and_equation_extraction.msim

piezoelectric_equivalent_with_ac-dc_(1).msim

I try to build a piezoelectric equivalent circuit (a sine current source, a capacitor and a resistor), but it doesn't act as a voltage source. I also try to change the forward voltage of the ideal diode in full-bridge rectifier and find that the output voltage of piezoelectric equivalent circuit cannot exceed forward voltage.

By the way, the parameters of piezoelectric equivalent circuit are well set according to a paper.

Could you give me some advice?

v2i2v_circuit.msim

I try to design a circuit to make a voltage-current-voltage translation. In my assumption, probe1.v is equal to probe2.v and it will generate a current(probe2.v / R4) through NMOS. The NMOS acts as a closed switch. Probe3.v is equal to CV3 and i can get "Probe4.v = CV1 + CV3". However, when the circuit operates, probe3.v isn't equal to CV3 and probe1.v isn't equal to probe2.v. I have tried to rise the differential input resistance and differential amplifier to make the Uin+ close to Uin- in op amp, but it doesn"t work effectively.
In addition, the closed resisitance of NMOS is also taken into consideration and i try to make it pretty below Kohm.

Could you help me fix the problem? 

battery_charging_circuit.msim

I am trying to design a charge circuit for Li battery, but i don't think it is a good idea to discharge the battery by a resistor or a cuurent source. So, how can i set the parameters to make the battery discharged initially?

I try to design a half rectifier circuit in MapleSim, but the simulation is so slow and the console output says "Warning: many small integration steps are being taken at a very small proportion of integration range at t=2.9653230e-006, absolute/relative tolerance may be too tight for problem, or problem may require a stiff solver". So how should i improve the circuit to make the simulation faster?

By the way, i don't want to change the basic design of the circuit, so the circuit should consist of both diode and op amp. I know the diode only circuit can achieve the same goal.

half_rectifier.msim

current_mirror.msim

I try to simulate a current mirror model, but it doesn't work and say "cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up". Maybe some incorrect parameters are set there, could you fix it? 

In a multibody assembly I have three instances of identically connected prismatic joints (flanges not conneted and identical componets at the frames)

In the simulation results the joints are listed with the following variables:

Why are the variables not the same for three identical components and what do the Fi and Mi stand for?

Is there any documentation on variables listed in the simulation results? It seems that more variables can be available than listed in the component documentation.

1 2 3 4 5 6 7 Last Page 3 of 40