I am curently working on hydraulics task using Thermocycle library.
Is there a way to connect the Outflow flange of a CellConst module to the Inflow flange of a Cell1Dim module and vice versa?
I do not want any calculation to be done.
I just want to intersect a CellConst block between two Cell1Dim blocks.
This cannot be achieved by their default flanges.
Thank you in advance for your time.
Related
Specifically, my group is working on thermal modeling of EVs i.e cabin cooling and battery cooling. We have used most elements from the two-phase-fluid sub-library of simscape. But at two connections we want a controlled separation of the refrigerant flow. For that, there is an element called flow divider but it's in the hydraulics sub-library. So how do I use these libraries simultaneously? I'm trying since yesterday but nothings seem to work. Thank you.
I am currently working with multibody mechanical systems using the MultiBody library included in the standard Modelica distribution.
I need to implement a switch between flanges, in order to select position or force control for a given joint.
model FlangeSwitch "Switch between flanges"
Modelica.Mechanics.Translational.Interfaces.Flange_a flange_a_1;
Modelica.Mechanics.Translational.Interfaces.Flange_b flange_b_1;
Modelica.Mechanics.Translational.Interfaces.Flange_a flange_a_2;
Modelica.Mechanics.Translational.Interfaces.Flange_b flange_b_2;
Modelica.Mechanics.Translational.Interfaces.Flange_a flange_a_exit;
Modelica.Mechanics.Translational.Interfaces.Flange_b flange_b_exit;
Modelica.Blocks.Interfaces.BooleanInput u;
equation
if u then
flange_a_exit = flange_a_2;
flange_b_exit = flange_b_2;
else
flange_a_exit = flange_a_1;
flange_b_exit = flange_b_1;
end if;
end FlangeSwitch;
But this approach does not work, the system is not balanced: 10 equations and 12 variables.
Is there any way to do this?
I don't think a Modelica tool will allow this operation (even if you have a balanced model), as it would potentially result in a variable structure system. Which is something Modelica does not support at the moment. See a nice introduction here: https://www.modelica.org/events/modelica2017/proceedings/html/submissions/ecp17132291_Stuber.pdf
Without fully knowing the application you could try two approaches:
Use a model that emulates a rotational clutch, like the Modelica.Mechanics.Translational.Components.Brake with an activated parameter useSupport. This way you can generate a "controllable mechanical connection" for connecting either of the flanges to the support connector. If I read your code correctly you should connect flange_a_2 to the support and the flange_a_exit to either flange_a or flange_b. When activating the brake via the RealInput there will be a mechanical connection.
The second thing you can try is to measure either position or force (which of both you want to apply by a sensor Modelica.Mechanics.Translational.Sensors.PositionSensor and then apply it using the respective source, which in this case would be Modelica.Mechanics.Translational.Sources.Position. Switching between the sources could then be done by switching the Real signals instead of the physical connectors. Mind that is could generate jumps in positions when applying positions directly.
The link you posted is related to non-phyiscal connectors, which are less restrictive compared to the physical connectors. So comparing the two solutions should be done very carefully.
Switching from position as an input to force as an input would require the system of equations to be rebuilt when executing this switch. This will not be possible with current generation Modelica. You will need to find a solution that is based on the same input for the whole simulation.
Would it be enough to initialize position in a way that the system starts the simulation in the point where you want to move it to first (using the Position Source)? What you loose is the movement of the system to this position.
I have two simulink models (say X and Y), I should first run X, and after few seconds(lets say 10sec), I need to run Y when X is already in execution phase. And this has to be done from matlab command line. I have tried using set_param(), but unable to do the simulations as expected.
Can someone help with that?
One solution could be to include both models as part of a supermodel using model blocks and put the model block that is to be delayed inside an enabled subsystem that is switched on after 10 seconds (using a delay mechanism for the enable).
Depending on what you want to do, you could also execute separate matlab processes and implement some sort of shared trigger (file, socket communication, etc.), but then that's kind of outside the realm of simulink, and you will get asynchronism.
I have download wind turbine project from math work. In generator block they used Asynchronous Machine SI Units. when i try to change Asynchronous Machine SI Units with Asynchronous Machine pu Units.
I got the following error:
The following SimPowerSystem block is not allowed with the Phasor simulation method:
Block : Wind_Turbine/Nacelle/Generator/Full/Asynchronous Machine pu Units
Type : Asynchronous Machine Wound Rotor
can anyone help me to solve this problem?
It sounds like you can't use the pu units version of the asynchronous machine block with a phasor simulation. Either use SI units or change the simulation type to something else other than phasor.
I assume you are referring to the Wind Turbine model on the File Exchange. You might have better luck either leaving a comment on the Wind Turbine page on the FEX, or asking the author.
I am implementing some head tracking and I get 2 matrices of horizontal velocities. (A vector field decomposed into vertical and horizontal velocities). For each of these matrices I do some math to calculate the actual head tracking.
My question is, is there a way to do that math (which is a set of blocks) on both matrices without copying the math blocks onto each signal?
It's hard to explain so here's a screen shot of my model:
You can see that the "complex to real-imag" block has 2 outputs (this is the little one in the middle). The mean block and the integrator circuit then calculate the head velocity and position for the real matrix (horizontal position). I want to do exactly the same routine on the imaginary matrix (vertical direction). Obviously I can just copy the blocks, but surely there must be a better way of doing it? In a way I'm looking for an analogue of a loop in "normal programming" like C or something, where a block of code is executed several times on different inputs.
You can create a Library in Simulink that contains code you can reference multiple times.
Go to File -> New -> Library. In the model window that opens, you can create any number of subsystems with whatever code you want. Then, just drag a subsystem from the library into your model. The subsystem will now appear in your model with a little arrow icon in the lower left. This indicates that the subsystem in the model is a link. You can drag as many instances of the library subsystem into your model as you wish, just as you can call a function as many times as you wish in any other programming language.
If you right-click on the subsystem in your model, you can select "Link Options -> Go To Library Block" to get back to the library. You can make changes in your model and propogate them back to the library as well.
One way to easily reuse a set of blocks is to create a subsystem out of them. In your case, you can create a subsystem by grouping existing blocks, then simply copy and paste your subsystem to use it for your imaginary output.
Although potentially more complicated, you could also look into using mux signals to avoid having to copy parts of your model.