C_R

3412 Reputation

21 Badges

5 years, 312 days

MaplePrimes Activity


These are answers submitted by C_R

Because there is an infinite number of solutions. Try

solve({sin(x)/x = 0}, AllSolutions = true)

to get the general solution.

For the plot of g, try increasing the number of ploted points with the plot option numpoints.


 

The unit issue is simple to solve once you know it, but less simple to understand (at least it was for me).

I had the same intention to convert a result of the form magnitude_name=value*unit as you.

Cr = (2.532634930*10^(-7))*Unit('F')

Cr = 0.2532634930e-6*Units:-Unit(F)

(1)

This input

convert(Cr = 0.2532634930e-6*Units:-Unit(F), 'units', F, nF)

1000000000*Cr = 253.2634930*Units:-Unit(F)

(2)

converts only the value by the ratio of F/nF=10^9 but leaves the units untouched. This is equivalent to

10^9*(Cr = 0.2532634930e-6*Units[Unit](F))

1000000000*Cr = 253.2634930*Units:-Unit(F)

(3)


If you try instead

convert(Cr = 0.2532634930e-6*Units[Unit](F), 'units', 'nF')

Error, (in convert/units) unable to convert `1` to `nF`

 

Maple throws an error because it can't find on the left hand side a unit to a) compute the ratio to change the value and b) substitute F by nF.
Conversion has to be done piece by piece as you have seen in Tom's answer.

convert(rhs(Cr = 0.2532634930e-6*Units[Unit](F)), 'units', 'nF')

253.2634930*Units:-Unit(nF)

(4)

In other words Maple currently cannot convert a result in the form of an equation.
If you try the context panel (Convert Output Units) on the Output (1) you will get an error. If you try it on

rhs(Cr = 0.2532634930e-6*Units[Unit](F))

0.2532634930e-6*Units:-Unit(F)

(5)

it will work (the right click context menu did not work on my installation 2022.2).

I have already suggested to Maplesoft to make a conversion of such simple equations possible with a simpler command structure and hopefully also with the context panel.

Deriving results in the form of an equation is not uncommon in science and technology.
Good to see that there is annother Maple user who want's to do it.


 

Download Unit_convertion_of_results.mw

I have rewritten your worksheet with equations to see what is substituted in the RMS expression. As you can see, value is not effective and convert,unit_free throws the same error you are encountering. This does not look good either.

Attached is a simple example where piecewise integration of constant functions worked well with units. Test wise, instead of constant functions I tried to integrate squared cosine functions and took the square root of it. This is equivalent to your RMS calculation and worked well. So, it is really strange what you are encountering.

I hope my additional observations can give a clue what is going on.  Or you can use my file to start from scratch.

restart

 

Definition of current functions

eq1 := i__1(t) = piecewise(t < 0.1e-1*Unit('s'), 0*Unit('A'), t >= 0.1e-1*Unit('s'), 3*Unit('A')*cos(2*Pi*t/T))

eq2 := i__2(t) = 3*Unit('A')*cos(2*Pi*t/T)

eq3 := i__3(t) = piecewise(t < 0.1e-1*Unit('s'), 0*Unit('A'), t >= 0.1e-1*Unit('s'), 3*Unit('A')*cos(2*Pi*t/T__3))

param := T = 0.2e-1*Unit('s')

plot(subs(eq1, eq2, param, [i__1(t), i__2(t)]), t = 0 .. .1*Unit('s'), color = [blue, red], legend = [i__1, i__2])

 

Calculation of RMS values

RMS__1 = sqrt((int(i__1(t)^2, t = 0 .. T))/T)

RMS__1 = ((int(i__1(t)^2, t = 0 .. T))/T)^(1/2)

(1)

value(subs(eq1, param, RMS__1 = ((int(i__1(t)^2, t = 0 .. T))/T)^(1/2)))

RMS__1 = 7.071067812*((int(piecewise(t < 0.1e-1*Units:-Unit(s), 0, 0.1e-1*Units:-Unit(s) <= t, 3*Units:-Unit(A)*cos(314.1592654*t/Units:-Unit(s)))^2, t = 0 .. 0.2e-1*Units:-Unit(s)))/Units:-Unit(s))^(1/2)

(2)

convert(rhs(RMS__1 = 7.071067812*((int(piecewise(t < 0.1e-1*Units:-Unit(s), 0, 0.1e-1*Units:-Unit(s) <= t, 3*Units:-Unit(A)*cos(314.1592654*t/Units:-Unit(s)))^2, t = 0 .. 0.2e-1*Units:-Unit(s)))/Units:-Unit(s))^(1/2)), units_free)

Error, (in Tools:-IntegrateExpression) units problem, can't make expression piecewise(t < .1e-1*Units:-Unit(s),0,.1e-1*Units:-Unit(s) <= t,3*Units:-Unit(A)*cos(314.1592654*t/Units:-Unit(s)))^2 unit-free with units [t::Units:-Unit(s)]

 

RMS__2 = sqrt((int(i__2(t)^2, t = 0 .. T))/T)

RMS__2 = ((int(i__2(t)^2, t = 0 .. T))/T)^(1/2)

(3)

simplify(subs(eq2, param, RMS__2 = ((int(i__2(t)^2, t = 0 .. T))/T)^(1/2)))

RMS__2 = 2.121320344*Units:-Unit(A)

(4)

NULL

Download UnitProblem_with_eqs.mw

simple_piecewise_integration_with_units.mw

I missed dharr's answer. Anyway, here is a less specific way that checks for any other function.

expr:=(sin(x)*EllipticF(k, y)/(BesselI(z, l)*arctan(y, x)))^WhittakerW(mu, nu, z) - my_funct(alpha);

(sin(x)*EllipticF(k, y)/(BesselI(z, l)*arctan(y, x)))^WhittakerW(mu, nu, z)-my_funct(alpha)

(1)

indets(expr, function);

{BesselI(z, l), arctan(y, x), sin(x), EllipticF(k, y), WhittakerW(mu, nu, z), my_funct(alpha)}

(2)

el_funct := {FunctionAdvisor(elementary)[]};

The 26 functions in the "elementary" class are:

 

{arccos, arccosh, arccot, arccoth, arccsc, arccsch, arcsec, arcsech, arcsin, arcsinh, arctan, arctanh, cos, cosh, cot, coth, csc, csch, exp, ln, sec, sech, sin, sinh, tan, tanh}

(3)

all_funct := {op(subs({seq(i = op(0, i), i in indets(expr, function))}, indets(expr, function)))};

{BesselI, arctan, sin, EllipticF, WhittakerW, my_funct}

(4)

oth_funct:=(el_funct union all_funct) minus el_funct;

{BesselI, EllipticF, WhittakerW, my_funct}

(5)

If the set is not empty, there are other than elementary functions in the expression

is(oth_funct = {});

false

(6)

NULL

Download check_for_other_than_elementary_functions_1D.mw

Mapleflow allows you to enter Maple commands.

Try the Maple command convert(expr, units, 'N/m^3') on the expression expr with kg/m2s2

For sind:

Try help(Degrees,sind) and open the help page in a worksheet (Crtl O). Then execute the commands to see if sind works.

 

For RPMs:

Why should the unit be meter per second?

Have you considered using the unwrap option of help(SignalProcessing[Phase])

for your application?

The last statement is the problem. Do not assign a value to wx (which is used in GainQ1). This changes the definition of GainQ1 and thus the output (if you execute the last line again)

 

I assume that the state equations you posted correspond to the linearization point for the "initial configuration" (see linearization options of the linearisation app of MapleSim).

If you choose a different linearization point (see yellow highlight below), the zeros disappear.

You might find more on the equation export here: help(DynamicSystems[Linearize])

(Update: I could not find a description on the option  "format=all")

If you are interesed in the nonlinear differential equations you can also use the equation extraction app of MapleSim.

Update2:

If you change the initial conditions of the angular velocity of the revolute joint R_1 to a non zero value you will get accelerating terms in the state equations also for the inital configuration.

So to answer your question: The inital accelation you see in the result window comes from the integration process that uses a linearized model having no "accelerating terms".

 

Couldn't you use the sampler component to discretize the continuous functions (signals in MapleSim, I assume) and use your working Modellica code?

The general problem I see is that MapleSim does not provide means/components that allow us to see/simulate into the future (e.g. there are no infinite impulse response filters). At which point in time (MapleSim simulation time) do you want to perform the convolution?

What you tried is basically correct. You should have added simply rad to omega1

omega1 := 2*f1*Pi*Unit('rad')

Note that the unit of rad is 1, which is the reason for the inconsistencies in your worksheet

Alternatively, as I would do it, the same without assignemt statement (":="), which requires re-execution of the whole document every time you change parameters.

vel1 = (acc1*arm1)^(1/2)

vel1 = (acc1*arm1)^(1/2)

(1)

circ1 = 2*Pi*arm1

circ1 = 2*Pi*arm1

(2)

T1 = circ1/vel1

T1 = circ1/vel1

(3)

f1 = 1/T1

f1 = 1/T1

(4)

omega1 = 2*f1*Pi*Unit('rad')

omega1 = 2*f1*Pi*Units:-Unit(rad)

(5)

General solution

subs(f1 = 1/T1, T1 = circ1/vel1, circ1 = 2*Pi*arm1, vel1 = (acc1*arm1)^(1/2), omega1 = 2*f1*Pi*Units:-Unit(rad))

omega1 = (acc1*arm1)^(1/2)*Units:-Unit(rad)/arm1

(6)

Parameters

acc1 = 9.0*Unit('gn'), arm1 = 10.0*Unit('ft')

acc1 = 9.0*Units:-Unit(gn), arm1 = 10.0*Units:-Unit(ft)

(7)

subs(acc1 = 9.0*Units:-Unit(gn), arm1 = 10.0*Units:-Unit(ft), omega1 = (acc1*arm1)^(1/2)*Units:-Unit(rad)/arm1)

omega1 = .9486832980*(Units:-Unit(gn)*Units:-Unit(ft))^(1/2)*Units:-Unit(rad)/Units:-Unit(ft)

(8)

simplify(omega1 = 5.381137768*Units:-Unit(rad/s))

omega1 = 5.381137768*Units:-Unit(m/(s*m(radius)))

(9)

Convert to rad/s (does not work on equations -> complicated command required)

lhs(omega1 = 5.381137768*Units:-Unit(m/(s*m(radius)))) = convert(rhs(omega1 = 5.381137768*Units:-Unit(m/(s*m(radius)))), units, rad/s)

omega1 = 5.381137768*Units:-Unit(rad/s)

(10)

NULL


Download Conversion_to_rad_per_s.mw

works in Maple 22.

At the first click you get: Waring computation interrupted. At the second click evaluation stops and Maple returns to ready (lower left corner)

If you are using a high resolution screen: Try adjusting the compatibility settings (High dpi) under the properties of maplew.exe (try different settings).

I have done this and Maple In and Output display excellent on a 4K screen (much better than Word and other office applications).

If you are still running a Maple 2020 version: Is the quality as bad? I noticed a difference between the current JDK Java platform and the earlier Java platform.

Note: In high res mode Maple 2022 menus are still a mix of low and high renderings. Changing the display within a session can also degrade the rendering of In and Output

Interesting question and topic!

Reading

help(tasks, simulating, advancedSimulationSettings)

I interpreted "plot events" equals 2000 events plotted.

But if you turn on: Solver Diagnostics you will find much more events. (Whatever such events might be?!?)

Zoom into the two plots to find the 40Hz

I would have expected that the "plot without plot events" would match the mean amplitude of the plot "with plot events".

If this your question/assumption: It seems not to be a sampling issue.

If you increase the number of plot point to 20000, plot 2 changes completely.

At this point would inspect the circuit for electronic modeling issues, which is beyond my field of expertise.

On a related topic, I stumbled across this question. You are correct in your assumption. A more realistic IK should alternate between the two solutions. However, with the input variables Tx and Ty, I don't see a simple switching condition as one can guess from the animation.
I would be interested in a better IK as well.

 

First 14 15 16 17 Page 16 of 17