Message Boards Message Boards

6
|
6791 Views
|
60 Replies
|
14 Total Likes
View groups...
Share
Share this post:

[WSG24] Daily Study Group: Guiding Principles for Systems Modeling and Simulation

Posted 9 months ago

A Wolfram U Daily Study Group focusing on modeling principles applicable to dynamic systems begins on the 9th of April.

Join @Vedat Senol, @Sergio Vargas, me and a group of fellow learners to learn modeling principles that will help you in creating models of real-world systems. We'll explore a variety of examples, from simulating the spread of infectious diseases, analyzing the cash flow dynamics of subscription-based businesses, to creating music with a model of an analog synthesizer.

No prior Wolfram System Modeler or Wolfram Language experience is required to join the study group.

Please feel free to use this thread to collaborate and share ideas, materials and links to other resources with fellow learners.

We look forward to seeing you: April 9th-19th, 2024, 11am-12pm CT (4-5pm GMT)

REGISTER HERE

enter image description here

POSTED BY: Ankit Naik
60 Replies

Hello Ankit,

I am surprised not to have gotten any reply to my questions. Is this community group still active?

Carl

POSTED BY: Carl Hahn

Hey Ankit, Did I miss this? How do you save things in a Session in System Modeler / Simulation Center so that you can close them and reopen and pick up where you left off? Is there a way to do that? Carl Also, where can you go to get easy to use Modelica models for electronic components and subsystems like microwave components that can be loaded into System Modeler? Like Couplers, mixers, amplifiers etc? Do they even exist?

POSTED BY: Carl Hahn

Hi Carl,

Sorry for the late reply. This post is currently inactive. You can create a new post in the System Modeler group for future queries.

  1. I don't think you can save a session. For Simulation Center: If you are analyzing a plot by creating measurements or updating plot legends then you can save the plot as a Model Plot. This will save the updates in the model and you can resume later. You can also try to export the results as a Simulation Executable (I covered this on Thursday 18th April) and reload the simulation results later.
  2. Unfortunately, I am not aware of a library that has microwave components. The only relevant library that comes to mind is Modelica.Electrical.Analog.
POSTED BY: Ankit Naik

How do you save things in a Session in System Modeler / Simulation Center so that you can close them and reopen and pick up where you left off? I thought I knew how... but alas...

POSTED BY: Carl Hahn

While reviewing the "Different Models" session I would like to try the creation and simulation of the model based upon the business library. By chance do you have a list of parameters for those components? Thank you, John

POSTED BY: John Burgers

Hi John,

I created the model for demonstration and I didn't calibrate the parameters. If time permits then I will calibrate it next week and get back

POSTED BY: Ankit Naik

... continuing on these are the parameters I chose to when investigating the model behaviour, by simulating and then plotting the energy stored in the material stock components and on a second plot the power passing through the proportionalTransition components. It almost makes sense. My engineering sense is that the proportionalTransition components daisy chain the inertia so the electrical output appears to ramp up after the gear box comes up to speed, where as in reality the gearbox and generator come to speed at the same rate. Given that most energy would be generated at controlled rotor speed the small proportion of energy generation during speed transition is insignificant for this business model.

see the attached file for the Component Names, BaseType, OutputType and Parameters. The component models types can be seen on the class video recording.

Attachments:
POSTED BY: John Burgers

I agree with your observation John. For the business model, the energy difference during speed transition is not significant and not required.

POSTED BY: Ankit Naik

In the April 19 Files posted there is a "Readme" file. What is that?

POSTED BY: Carl Hahn

Not sure. That file was not used in the sessions. I will ask the our team to remove it.

POSTED BY: Ankit Naik

Hello, Ankit especially you and for sure the team must be exhausted by these sessions. Thanks a lot.

My question today is,

In the CriticalToData session I unfortunately overwrote the "inf" symbol in the totalVoters component. I wrote inf into the field but that seems to be an error. Can you say how to put infinity into a field?

Thanks, John.

POSTED BY: John Burgers

You can use the following to represent infinity: Modelica.Constants.inf

Type it in the parameters field. You can also find all the other type of constants in the package: Modelica.Constants

POSTED BY: Ankit Naik
Posted 9 months ago

In regard of the mass of CO2 in the atmosphere in the year 2002:

rs1 = Solve[
   Eliminate[{xCO2 == nCO2/nAir, mAir == nAir*MAir, 
     mCO2 == nCO2*MCO2}, {nCO2, nAir}], mCO2][[1]]

gives

{mCO2 -> (mAir MCO2 xCO2)/MAir}

With data from Wolfram Alpha and Mathematica:

UnitConvert[
mCO2 //. 
Join[rs1, {mAir -> 
WolframAlpha[
"mass of atmosphere", {{"Result", 1}, "ComputableData"}], 
MCO2 -> ChemicalData["CO2", "MolarMass"], 
MAir -> ChemicalData["Air", "MolarMass"], 
xCO2 -> UnitConvert[
WolframAlpha[
"global carbon dioxide concentration 2002", {{"Result", 4}, 
"ComputableData"}][[2, 3]]]}], "MetricGigatons"]

gives

Quantity[2915.77, "MetricGigatons"]
POSTED BY: Ulf Schmidt

Right. And if you divide it by 3.67 i.e. (44/12) you get around 794 gigatons of Carbon.

POSTED BY: Ankit Naik
Posted 9 months ago

After the study group's end, for how long would we still be able to re-watch the videos?

POSTED BY: Nicholas Lima

The recordings will be hosted in Wolfram U as on-demand videos after the study group is over.

POSTED BY: Ankit Naik
Posted 9 months ago

Hi Ankit,

Still no recording of yesterday's class is available (lol). I must study it before today's class. How can I do it?

POSTED BY: Soomi Cheong

Hi Soomi,

I have asked the Wolfram U team to look into it. Hopefully, they can send the recording in a few hours (when the US office opens).

POSTED BY: Ankit Naik
Posted 9 months ago

THANK YOU, Ankit!

You are the best instructor ever!

POSTED BY: Soomi Cheong
Posted 9 months ago

(Question) In Step 6 - Calibrate Parameters of Analyzing Models with Wolfram Language (the 2nd lecture),

  • Plot the experimental data: -> what are the measured data (= calibrated parameters)? data = {{0, 80}, {900, 45}, {1800, 25}} -> the name of the parameters? e.g., thermometer temperature? ambient temperature? i.e., 0 is the value of ? -> Likewise, 900 and 1800 are the values of ? (which parameter) 80 is the value of ? -> Likewise, 45 and 25 are the values of ? (which parameter)

-> as always, Vedat Senol asked that for us during the lecture. However, I still have the same question.

*** Vedat Senol always asked questions that I had, which I appreciate. I can't ask the questions during the lecture because I should focus on the lecture. While typing my question, I will get lost. BigMarker does not allow us to ask our questions verbally. Thus, Vedat Senol's questions are very important for me to study well. Could Vedat Senol come back to the Daily Study Group? Vedat Senol, could you please make time for us?

POSTED BY: Soomi Cheong

Hi Soomi,

We will cover SystemModelCalibrate in tomorrow's session.

@Vedat Senol was sick last week. If he feels better then he should join from tomorrow.

POSTED BY: Ankit Naik

Hi Ankit:

Has the recording from today's session (Monday, April 15th) been posted? If so, I haven't received the email link yet to view it. I usually receive it shortly after the on-line session ends, but it's now 1810 CDT (Houston). I'm trying to keep up, so I'd like to view today's session and work through the examples before tomorrow's session. Like another participant, I need to frequently pause the recording to ensure I'm making the correct entries in System Modeler and get a better understanding of what's going on. Thanks to you and all the other presenters/support staff for all the excellent content.

Regards,

Jim Kralik

POSTED BY: James Kralik

Hi James,

Thanks for reporting, I have asked our team to look into it.

POSTED BY: Ankit Naik

Hello Ankit,

So I am going back through the lectures slowly and running WL 14 and SM 14 and trying to replicate your steps to see what works and what does not. In lecture 2 when you got the the step where you entered

SystemModeler[modelName, ""]

Highlighting the quotes automatically gave you the options you could put in there - standard WL feature. But when I did that, nothing happened. When I typed it the word Diagram or Modeling the command worked as expected. I just did not get the list of options. When something like that happens, it often indicates the instructor is using a Beta of the next release of WL or SM. Are you? Or is something else going on you can help me with?

Carl

POSTED BY: Carl Hahn

Also the options like Frame->None are not recognized... The word "Frame" comes out in red font. Also if I use "false" same result...

OK so I answered my second question: The suggestion bar at the bottom of the graph is not creating a list of options. If I place the curly bracket like you did manually, it will accept the Frame->False or None options. I don't know if that's a bug with WL 14 or SM 14, but it's not working the way it should. I'm running both on a MAC.

POSTED BY: Carl Hahn

Hello Carl,
I'll try to help on this, if it continues not to work, please inform so Ankit can help further.

Starting from a fresh Kernel, ie Evalutation>Quit Kernel>StartKernel.
It works for me (WM 14, SM14) when I run this sequence of commands,

Text Line : Load the system modeling functionalities:

SystemModel;

Text LIne : Load the model diagram:

modelName = "ModelingPrinciples.Coffee.Exercises.Step1";

Now when you type the command below, on starting to type the Quotation mark, you will initially only see the leading Quote and the drop down menu of options to choose from. Once "Diagram" is selected the command is populated with "Diagram"

SystemModel[modelName, "]

Hope this was helpful,
John Burgers.

POSTED BY: John Burgers

Further to the above Carl, ...

You should also ensure the the lesson library is automatically loaded when SM starts,

Tools > Options > Global > Modelica Libraries > Add a library Then navigate to the directory that contains ModelingPrinciples.mo

John

POSTED BY: John Burgers

Thank you. Re-starting the kernel did the trick. Weird, that one. But the suggestions box is still generating the wrong syntax to remove the box. Is System Modeler is violating a Mathematica syntax rule? Or is the suggestion box violating a syntax rule? Have to come back the that...

POSTED BY: Carl Hahn

Perhaps @Sergio Vargas can respond to this tomorrow.

POSTED BY: Ankit Naik

K. Sorry about my own syntax violations there... I was cut and pasting my thoughts and I guess I cut when I should have pasted or something like that.

POSTED BY: Carl Hahn

Hello Ankit,

I had troubles during the steps in WM 14 in the Start simple session. The solutions.step5 model crashed. Was this a common experience? Edit - I went back to this and found the problem, no need to answer.

I have a question also. Can you show how to save parameter adjustments made in Simulate back to the model?

Thank you, John

POSTED BY: John Burgers

Hi John,

In Simulation Center, go to File -> Save Experiment Settings -> Ok

POSTED BY: Ankit Naik

This has been the best set of classes on System Modeler that I've seen so far, and it's opening my eyes to what is possible. I see cool examples out of mechanical engineer and other disciplines. I'd be curious to see some canonical problems in electrical engineering solved. You can do lumped elements but I think you could create boxes that have lumped elements inside of them. RLC circuits or microwave resonator cavities. It would be fun to build a garage of "stuff". Like measure the amplitude and phase pass-band response of a band-pass filter where you can add resonators to extend it's performance and equalize its phase response. Or computing the phase noise of an analog synthesizer with a phase locked loop. And a digital version too. Quantization spurs of an ADC. Intermodulation products of an amplifier operating near compression. That sort of thing. Or maybe a test bench, where you could have a vector signal analyzer that could plot the constellation and the eye diagram of a noisy QPSK signal.

POSTED BY: Carl Hahn

Hi Carl,

I think you will enjoy reading Leonardo's blogs. I will ask Leo to attend the session on Friday (19th). He might be able to show some analysis.

https://blog.wolfram.com/2021/12/29/digital-vintage-sound-modeling-analog-drums-with-the-wolfram-language-and-system-modeler/

https://blog.wolfram.com/2020/07/23/digital-vintage-sound-modeling-analog-synthesizers-with-the-wolfram-language-and-system-modeler/

Leo is currently working on an Electric Circuits course using System Modeler which should be LIVE in 2-3 months. He probably covers some of the topics that you mentioned.

POSTED BY: Ankit Naik

Thanks! And I will definitely be looking at that circuits course.

POSTED BY: Carl Hahn
Posted 9 months ago

I found "Modeling and Identification of Dynamic Systems" c2021 by Ljung et all available at adlibiris.com and biblio.com, though adlibirs only seems to ship to Sweden.

POSTED BY: Jerry Dimsdale
Posted 9 months ago

I installed System Modeler version 14 and then Mathematica version 14. After that, I started System Modeler and opened ModelingPrinciples. Then,

Unresolved dependency in ModelingPrinciples ModelingPrinciples has a declared dependency on BusinessSimulation version 2.2.0-wsm. No version of BusinessSimulation is currently loaded.

Would you tell me why it occurred and how to fix it? The day before, I installed System modeler only and started the System Modeler to open ModelingPrinciples. Then, the same error occurred. I though that it might be because I did not instsall Mathamatica. However, now I know that it was not the reason for it.

I opened the ModelingPrinciples. Then, only grided blank with Model 1 shows. The same error occurred - i.e., no difference of Mathematica installation.

If anyone knows about why it occurred and how to fix it, would you help me on it?

I posted the question during the class yesterday, but did not get the answer.

Am I the only one who has the strange error?

POSTED BY: Soomi Cheong

Hi,

That is because you don't have the Business Simulation library loaded. I will show you how to load it tomorrow.

If you don't want to wait, then you can already download it from this page: https://www.wolfram.com/system-modeler/libraries/business-simulation/

POSTED BY: Ankit Naik
Posted 9 months ago

I already found it soon after I posted the question :) Now I have the Businss Simulation Library installed in System Modeler. However, I can't change the name of Model. Your Model name is "ModelingPrinciples.Coffee.Exercises.Step1." My Model was named as "Model 1" when I opened "ModelingPrinciples." I have not been able to find how to change the Model's name. I even removed System Modeler, Mathematica, and models that I created to follow your lectures and started from the first beginning to downlod them. However, I still have the same issue. Why am I the only one who raises the issue? Am I the only one who has it? Or, am I the only one who asks about it?

POSTED BY: Soomi Cheong

I have the same questions but I am waiting for them to get there. I noticed in the live presentations that The models were displayed on their version System Modeler. I will make the suggestion that in the future the class presenters start with the same "virgin" copy of the System Modeler so that we don't have to deal with the differences between what they see and what we see when we try to replicate it. It's a little confusing and time consuming to catch up. Educational once you figure it out. But less structured than maybe would be helpful.

POSTED BY: Carl Hahn

I will try to cover this is today's session.

POSTED BY: Ankit Naik
Posted 9 months ago

Ankit,

I found all the answers to my questions by reviewing the first class with the recording. It was because some important steps for beginners were missed.

Thank you for your consideration of my inquiries.

See you soon.. :)

P.S. It was me to request Wolfram to teach us this and some other courses and daily study groups that Wolfram had not taught us before. I do need to learn the skills, which was one of the biggest reasons for me to have learned Wofram Language through the classes and daily study groups. THANK YOU!

POSTED BY: Soomi Cheong

Catching up with following along using my own System Modeler evaluation version.

When I first stored the plot, the text with the name of the new plot came out black in the top right hand corner, but when you did it it came out blue; and putting the cursor on the title no longer gave me any options to make changes to it, as it did when you did it live.

What is going on there?

POSTED BY: Carl Hahn

I guess the plot was already stored in the model and no new changes were made to it hence it is marked in black with no links.

  1. Try deleting the default plot listed under the "Model Plots" section on the left, or

  2. Add another variable to your plot, this will turn it blue with an option to "Update Plot in Model"

POSTED BY: Ankit Naik
Posted 9 months ago

Thanks for the trial version of SM 14 it permits easily to follow along.

Granted this question is most likely not part of this training, however I ask in case you can lead me to a good reference on structuring a new Media in Modelica. The media I'm interested in are range from in-compressible liquid, compressible single and multi-component gases, and refrigerants. I find it quite hard to work through the Modelica supplied documentation so am hoping someone on this forum can point out a more comprehensive explanation of how to create such media models (packages).

POSTED BY: Updating Name

I once created a Media with constant properties using the WL. You can find it below. I have not had the time to look into the case where the properties change as the thermodynamics states change.

POSTED BY: Ankit Naik

Hello Ankit, Thank you for sharing that file. Indeed, you created it after the most recent training session. It was sent to me then as well. Inspiring to say the least. At the time I was using version 13 of WM and SM so had to edited your file to work with those versions.

Still it's daunting to look through the Modelica files to understand how the equations of state were programmed, surely someone must have created a better documentation. I'll keep looking.

Great job, with this training. It's the best so far. John.

POSTED BY: John Burgers

Can you get energy flow diagrams out of System Modeler as you showed on page three the energy tab of the first lecture?

POSTED BY: Carl Hahn

Hi Carl,

Not from System Modeler, but you can create such diagrams (Sankey diagram) using the Wolfram Language.

Once you are done with the simulation, you can extract the results from your simulation in Wolfram Language. Then use the results to create such diagrams. Here are some implementations that might be useful:

https://mathematica.stackexchange.com/questions/166439/how-to-make-a-sankey-diagram https://resources.wolframcloud.com/FunctionRepository/resources/AlluvialChart/

POSTED BY: Ankit Naik

I think the fact that you used a Sankey diagram in your charts is evidence enough that Wolfram should implement a function or package to make good Sankey diagrams. I don't know why it's missing in an otherwise superb graphing capability. The code to do it myself is still a bit intimidating...

POSTED BY: Carl Hahn

I am aware of some work going on in that direction. Hopefully, in a future release.

POSTED BY: Ankit Naik

I would like to ask a question, it is not clear to me in any system or subsytems, how many variables are "inputs" and how many "outputs" and where is this defined. I understand in a simulation all variables are then calculated for the entre time span

The easiest way of recognising inputs and outputs, for example, in a give component, is by looking at the connectors that are available in the icon of the component. Depending on the physical quantity, the connectors have different graphical representations. These are usually triangles of different colours.

In a broader sense, if you write your models, you can make any variable and input, output or none. When you make a variable input or output, there are some restrictions applied to it. For example, you will get an error when trying to connect outputs to outputs. It’s like an extra level of safety when creating your model.

All the variables are calculated when simulation is running, and the inputs will be calculated based on the output that you have connected to it. There is a special case, a top-level input, which is an input in the highest hierarchy of your model. In that case, if left unconnected, it will take a default value of zero.

POSTED BY: Ankit Naik

Thank you Ankit, You are a good presenter. A couple of points I would like to ask about.

  1. I had opened the file Step 1 to create the Example 1 Coffee mug. Then saved it. Then reopened it, and using the right mouse button on it to open the class viewer. Although you had on your screen the assembled model as an icon, this was not on my screen. Can you explain why this happened?

  2. Will you be covering the create Ctrl-N , save Ctrl-S of a new model and the associated simulation (*.sme) file ? Is it customary to save the sme files in the same directory as the model files?

POSTED BY: John Burgers

Hi John,

Thank you!

  1. I am not able to follow the question. To view the icon of a model or a component, you can open the model by double-clicking on it then press Ctrl + 1 to view the Icon and Ctrl + 2 to get back to the diagram view. You can refer to Step 1 in the Solution folder to check if your Step 1 in the Exercises folder matches it.

  2. I will probably cover the new file creation and the .sme file on Thursday next week. No, there is no requirement to save the .sme file with the model files.

POSTED BY: Ankit Naik

Thank you Ankit,

To further clarify, you were showing us that the documentation centre automatically create an icon version of the model in the documentation head. That didn't happen for me as I was following along with you.

John

POSTED BY: John Burgers

Dear Ankit Naik

Great presentation today! I kind request. If there is the opportunity, please talk about taking advantage of the large amounts of models that have been developed in Modelica language that can be imported from Wolfram SystemModeler.

Best regards

Jesus

Sure, I will. I plan to talk about it in Friday's session.

For people following this post and new to Modelica, you can learn about the Modelica language here: https://www.wolfram.com/system-modeler/resources/what-is-modelica/

POSTED BY: Ankit Naik

How does Wolfram System Modeler compare to Matlab's SimuLink?

POSTED BY: Carl Hahn
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract