Jump to content

Livio Mariano

  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Livio Mariano

  1. Hi Taohid, were you facing an algebraic loop problem hence you were trying to fix it with a 1/z block? if yes, please try to use a low pass filter instead with a properly high cut-off frequency (you need to use a transfer function block to design the filter). You could try also the memory or the last input blocks as second option and see if performance gets better. Also, you could try to use a fixed step solver like Backward Euler if not yet tested... Regards, Liv
  2. Attached also a video that shows how to install and use Simport Library Best Liv SimportInstalling.mp4
  3. RoKet is right switch/case is not allowed but... You can get exactly what you need with MathExpression block in a much easier way. Please look the attached model. Trick: - You set your condition between round brackets, if condition is true, it is like having 1 otherwise 0. You can use & symbol for "and" and | symbol for "or" in the formulation of you condition. - You multiply the condition by the associated operation that you want to perform when the condition is true (=1). - When the condition is false it will return 0 and you will not consider the operation associated to it. - You sum the other conditions multiplied by the associated operations. This way of using the MathExpression block is really powerful and flexible, I use it a lot. Case1.scm
  4. Let me add another approach that I've just learned. There are many options to perform it but I’ve found this method very simple, flexible and self-explanatory. Summary: In the example, watertank.oml is the master file. It: changes the input parameters (controller gains) runs (repeatedly) the file Watertank_parm.scm (slave) collects results doing post-processing (plot) at the end. I’ve created a quick video to summarize how to run the demo. Present working directory must be where you save the files (the video shows how to select the pwd). Otherwise use an absolute path in the oml file. Liv ParameterSweeping.mp4 watertank.oml watertank_param.scm
  5. Hi Andy, I don't know how to do it with a command... "overlay" isn't an option like you wrote but "new" (and then at the end you save scopes manually) should be a workaround to get what you want. Liv
  6. With the last Activate version 2019.2, under Model we have the new “Finalization” tab where we can type an oml script that is executed at the end of the simulation. I’ve found this capability extremely useful for frequency analyses... I’ve created a simple model where we run a co-simulation between Activate & Motion (the approach works also using Activate in standalone mode but with the Motion integration is definitely more interesting). All the related files and the video are enclosed. In the example, we have a system of 2 masses: mass1 and mass2. The input to the Multi-body System is the force on mass2 while the output is the displacement of mass1. Force and displacement are respectively passed as Input1 and Input2 to the FrequencyWorld superblock in the Activate diagram. When you run the Activate model a dialog box appears. Here you can set the sampling frequency (be careful to aliasing issues since the value will affect the Nyquist frequency) and the type of analysis: Turn 0 to 1 the options if you want to analyse in frequency input 1, input 2 and/or the Transfer Function input1/input2. When you turn 1 the last option, the file TF.mat with the transfer function information is generated in the same model folder to be used for further analyses in Compose (e.g. LTI ROM generation…). For each input, the model calculates the fft together with the PSD. The calculation is made in Model-Finalization where we also handle the various options. The script is a bit articulated to properly handle every scenario (even/odd number of the sampling data, leakage, normalization…) Scripts and FrequencyWorld superblock can obviously be re-used for other applications (and easily improved e.g adding filters ...). Best, Liv FFT_PSD_TF.mp4 FFT_PSD_TF.zip
  7. Ciao Rocket, modifications should have effect on all units => you create a library with your basic units. When you do so, if you change anything in the library, this will affect all the models which are using that library => you get what you want (if I've well understood). Supermodel of unit, that may be stored in a library (no common update of model possible): you are probably speaking about superblocks here, if you mask them then they can be placed into a library. Common update is possible in libraries. It is not possible when you create a Palette which is slightly different. the interface ports of my drive unit should be Activate signal ports and Modelica ports: no problem for this I would use a library rather than an include diagram. Liv
  8. Ciao Minoru, I'm not able to download your examples. Anyway, in Activate there are many options to reach your goal, I've chosen the below one: Enclosed the file. Note that variable threshold is set under Model-> initialization Regards, Liv threshold_trigger.scm
  9. Hi Minoru, to know in which directory you are you can use command pwd. To change working directory command cd.
  10. Hi Yugang, of course it is possible ;-)! You need to create a Modelica Custom Component for it. This component allows you to leverage the existing modelica components by creating your own customization. Enclosed you find an example with the component you ar looking for. I'm switching the mass between 1 and 2 kg according to the displacement. Best Regards, Liv Mechanical_VariableMass.scm
  11. Ciao Saurya, Please here you find a possible solution implemented using Activate 2019. 1- Open Activate2019 go under tools->oml editor and load Master2019.oml. This file is the master that will generate a new input file (input2019.csv) for the Activate model (Slave2019.scm) at any iteration of the for cycle and will run in batch mode the Activate model Slave2019.scm. 2- Slave2019.scm will generate a different csv file for each run (authomatically named run1.csv, run2.csv... so that it is easy for You to identify which run the data refers at) 3- To run the example just remember to adjust the paths according to your installation (also inside the *.bat file). 4- Unfortunately for the moment isn't possible to append the data in the same .csv. A possible solution for that may be to do only 1 run longer (final time= time for a run * runs number) and change input when (simulation time) / (time for a run)=integer number. Best Regards, Liv Master2019.oml runActivate2019.bat Slave2019.scm
  12. Ciao Yubuchi-san, "I guess that it was caused because the MathExpression block provides zero as a stiffness value in the first step, but I don't know how to avoid it." Yes, the problem is that in the MathExpression block you divide a number by 0 at the beginning of the simulation. Remember that even if the condition isn't satisfied the block perform the calculation anyway (it is similar but different from an if.. else statement where if the condition isn't satisfied you do not process the script inside) . Enclosed 2 possible solutions... Regards, Liv NLSpring_DispForcev1.scm NLSpring_DispForcev2.scm
  13. Ciao, is there any way to extract the string vector of the elements ID when quering a *.h3d file? Thanks Liv
  14. Ciao Yubichi-san, enclosed another solution for what you are looking for. Note: In Activate, you need to correct the absolute path in initialization "to tell" Activate where the csv file is. Best Regards, Liv Mechanical_VariableSpring_bis.csv Mechanical_VariableSpring_bis.scm
  15. Hi Yubuchi-san. "we have to customize the Modelica code of the linear spring" Yes and we do it using the modelica custom component. Please find enclosed the model you are looking for together with other examples related to other physics. Best Regards, Liv Electrical_VariableResistance.scm Mechanical_VariableSpring.scm Thermal_VariableCapacitor.scm Thermal_VariableConductor.scm
  16. From: Yubichi-San An Activate user would like to model a nonlinear spring in Activate using Modelica, where the nonlinearity simply come from nonlinear relationship between force and displacement. In my understanding, the Modelica library in Activate has only linear spring. If we would like to introduce such a nonlinear spring, we have to customize the Modelica code of the linear spring, don't we? Are there anyone who has developed such a nonlinear Modelica spring?
  • Create New...