wswain

200 Reputation

7 Badges

12 years, 130 days

MaplePrimes Activity


These are questions asked by wswain

has anyone tried to use Peter Fritzone's book with maplesim helloworld modelica??

 

The simple approach from Peter (creating a custom modelica component) is to getting started by running a simple simulation where x_dot(t) = - a*x,  where the normal form is x(t) = x^-a for logarithmic type decay.

plot of x(t) should be a decay curve.  

 

Maple Code

A:-LinkModel = fine, connects

 

SimData := A:-Simulate(outputs = x, returntype = datapoints, tf = 2);

Error, invalid input: Simulate expects value for keyword parameter [outputs, output] to be of type {list(algebraic), list(anyfunc(identical(t)))}, but received x
 

***********

Simcode

 

Model Main;

Imports

public HelloWorld HelloWorld1 annotation(Placement(transformation(origin={100.0,200.0},extent={{-20.0,-20.0},{20.0,20.0}},rotation=0)));
    annotation(
            Diagram(coordinateSystem(preserveAspectRatio=true, extent={{0,0},{200.0,200.0}}),graphics),
            Icon(coordinateSystem(preserveAspectRatio=true, extent={{0,0},{200.0,200.0}}),graphics={Rectangle(extent={{0,0},{200.0,200.0}}, lineColor={0,0,0})}),
            uses(Modelica(version="3.2.3")),
            experiment(
              StartTime = 0,
              StopTime = 2.0,
              __Maplesoft_solver = "ck45",
              __Maplesoft_adaptive = true,
              Tolerance = 0.1e-4,
              __Maplesoft_tolerance_abs = 0.1e-4,
              __Maplesoft_step_size = 0.1e-2,
              __Maplesoft_min_step_size = 0,
              __Maplesoft_max_step_size = 0,
              __Maplesoft_plot_points = 2000,
              __Maplesoft_numeric_jacobian = false,
              __Maplesoft_constraint_iterations = 50,
              __Maplesoft_event_iterations = 100,
              __Maplesoft_algebraic_error_control = false,
              __Maplesoft_algebraic_error_relaxation_factor = 1,
              __Maplesoft_rate_hysteresis = 0.1e-9,
              __Maplesoft_reduce_events = false,
              __Maplesoft_integration_diagnostics = false,
              __Maplesoft_compiler = true,
              __Maplesoft_compiler_optimize = true,
              __Maplesoft_scale_method = "none",
              __Maplesoft_plot_event_points = true
            )
    );

 

end Main;

class HelloWorld
    Real x (start =1);
    parameter Real a = 1;
equation
    der(x) = -a*x;
end HelloWorld;

Good Morning,

 

Can anyone help on an Excel linking problem (and in general DB, non-SQL data sets)  for data lookup.   

 

I have several static data sets stored in flat files like Excel (xls) format. 

 

I understand Maples connectivity via the import function to an array.  I also understand the export and use of Maple from within Excel vi the add-in..

 

When doing data lookups it is not convienet to import the entire database and is memory intensive for large data sets.  As such it is much more convienenit to open/attach like the old ODBC connectivity schemes.   The goal is to open/attach to the data file (xls), search a column and return other column's data as a subset for further analysis in maple.  An example would be a steel properties xls file.

My Maple worksheet is calculating the dynamic loads and stresses of an object.  With that answer of say stress, I want to link to my excel data file and search the Yield strength and return the material name and props for those grades of steel that have yield strength greater than 1.5 times my caclulated answer.

 

This can then be returned into a smaller array for further analysis using Maple with different properties of my retrieved subset.  The link would be closed after getting the subset.

 

I have read all the Maple document Excel help info and the excel add-in info which is the wrong direction.   I can easily code this search into a vlookup within excel - but completely defeats the purpose for using Maple in the first place.   Again, importing is not a method as these data sets are static and come from various sources like "AMS" which need to live outside maple.

 

I have looked into FileTools pakcage and old C type fopen, scanf, etc. without much luck on Maple implementation.   The fopen seems to be for text or csv data sets?   according to the documentation.  But, I'll keep looking while waiting any replies.

 

Any assistance very appreciated.

 

Bill

 

 

 

 

 

 

 

 

Hello,

 

   What is the best way to create and save a library file with things like constants, procs, etc.

 

My work domain is the physical atmosphere and get tired of calling the many different scientific packs, copying over standard variables, running initition procs to start a new work book.

 

I'd like a worksheet, or library that has the ~10-20 basic scientific properties of dry air, most air, the reynolds calcs as a proc, etc.   A second call would be to standard material props lib used in our aero business.

 

I have not yet used Maple library tools to create a library and the initial documentation is a bit thin about differences and best practices.  I have tried to put this into the startup code section but then it's copy paste from file to file.  The best would be to load the file that is maintianed in one location, but used by many worksheet/docs.

 

I'd like to just have a basic "Initiate proc()" that would call a lib, or multiple lib/packages data to set all my globals, establish my physical prorperties, set the units system, etc.  upon opening and file initialization.   

 

I am also confused about "lib", ".M", ".mla" differences and modules versus libraries.   I do think I understand packages as sort of a proc library - just called packages ??   am I correct.  I have never tried to create or establish one. 

 

The issue for me with packages vs lib, modules and some confusion on the method procedures to set them up and get them properly instantiated when called.. 

 

So, do these lib, packages, modules have instantiation / initiation specifics to make them available when creating the package/lib  to use the with() command? 

 

I tried save and read with limited success.

 

Any recomendations welcome.  The last time I created libs was in C.  

 

Sorry if this is possibly confusing the different methods.  Is there a really good book/tutorial on file management, especially libraries, proc, module definition and storage benefits.  Best practices for maple?

 

Regards,

Bill

 

 

I am using Scientific notations and it constatly reminds me of the units and conversion challenges of using Maple.  I am using 2018 and am an engineer where units are our life blood for calculations.

 

Ive attached the file in ref where the constants shows J/Kg-mol   but outputs in a converted base unit of m^2 kg / s^2 mol K.  This modifies the value normally used by tables or other references as verification (often without units except in a column header)

 

The real problem is without units the caculated value 34.52 (or 0.03452) is meaningless when the real value has to be 287.05 if used without units or has correction applied within the SW internally.   

Units is my singular frustration with Maple as a really useful tool.  2018 moved this forward in so many ways which is very benficial.  I am really wondering if it may be how I'm setting the session up, or it is what it is.

Units_conversion_issue.mw

 

I have training video that shows the visualization window "docked" below the main window.   Can this work space arrangement be done in sim2017 ??  

Also I push the anchor button and nothing seems to happen 

1 2 3 4 5 6 Page 5 of 6