- Index
- » Users
- » bogey
- » Profile
Posts
Posts
Dear Colleagues,
I am finding out that some parameters are not changeable in the OMEdit Variable Browser. I'm quite sure I am using them all consistently. Is there a way to diagnose what is going on with my parameters?
For example,
Code:
// ===============
// Case definition
// ===============
parameter Integer propLoad = 50 "percentage propellant load: 0 for dry, 100 for full";
parameter Integer antennaConfig = 0 "percentage deployed: 0 for stowed, 100 for deployed";
propLoad is changeable in the Variable Browser while antenaConfig is not. They are employed the same way in the model.
I am using OpenModelica v1.16.0-dev.03 (64-bit) on Windows 10.
Thank you!
B
I fixed it by dragging and dropping instances of the component instead of duplicating it.
B
Dear Colleagues,
I have somehow introduced a bug in my model and I cannot figure out how to fix it. All work is in OM 1.16 on Windows 10.
The following error shows after compilation with Simulate with Animation
Code:
[1] 20:28:26 Scripting Error
Unknown type DUMMY, we make a capsule.
and at each step of the animation with an increasing index between the square brackets.
I was able to find a shape declaration that uses DUMMY in a file called XXX_visual.xml. It looked like some derivative(?) of a revolute joint.
Is there a way to fix this?
Bedankt!
B
Code:
<shape>
<ident>$DER.cmg3.reactionWheelBearing</ident>
<type>DUMMY</type>
<T> <exp>-1.0</exp>
<exp>-1.0</exp>
<exp>-1.0</exp>
<exp>-1.0</exp>
<exp>-1.0</exp>
<exp>-1.0</exp>
<exp>-1.0</exp>
<exp>-1.0</exp>
<exp>-1.0</exp></T>
<r> <exp>-1.0</exp>
<exp>-1.0</exp>
<exp>-1.0</exp></r>
<r_shape> <exp>-1.0</exp>
<exp>-1.0</exp>
<exp>-1.0</exp></r_shape>
<lengthDir> <exp>-1.0</exp>
<exp>-1.0</exp>
<exp>-1.0</exp></lengthDir>
<widthDir> <exp>-1.0</exp>
<exp>-1.0</exp>
<exp>-1.0</exp></widthDir>
<length> <exp>-1.0</exp></length>
<width> <exp>-1.0</exp></width>
<height> <exp>-1.0</exp></height>
<extra> <exp>-1.0</exp></extra>
<color> <exp>-1.0</exp>
<exp>-1.0</exp>
<exp>-1.0</exp></color>
<specCoeff> <exp>-1.0</exp></specCoeff>
</shape>
Dear Colleagues,
I have set up two OpenModelica models to simulate the attitude dynamics of a spacecraft with one single gimbal Variable Speed Control Moment Gyroscope (VSCMG). One model uses equations that closely follow those described by Schaub and Junkins (Schaub, H., and Junkins, J. L. Analytical Mechanics of Space Systems: AIAA, 2018, pp. 211-220.). The second model uses components from the multibody library to simulate the same dynamics.
I have noticed an interesting difference between simulation results generated with two models that I cannot explain on my own. Hence, I am posting the results here to ask the community for hints and advice.
The setup of the simulations is as follows: 1) input torques for the gimbal and reaction wheel are null; 2) the initial angular velocity (deg/s) of the spacecraft is (0,0,180) with respect to an inertial reference frame; 3) there is no gravitational acceleration. I have used the DASSL integrator with a tolerance of 1e-6 and the default settings in OMEdit. I have also spent a reasonable amount of time making sure that I cleared bugs and that the models have the same inertial properties, etc, etc.
This is what I have observed.
If the Center of Mass (CoM) of the VSCMG is placed at the CoM of the spacecraft then the rotational Kinetic Energy (KE) for both models if constant, within some 1e-8J after 100s. I have been pleasantly surprised to notice that the rotational KE of the model with components is rock steady constant while the one of the model with equations is somewhat noisy.
If the CoM of the VSCMG is offset from the CoM of the spacecraft then the rotational Kinetic Energy (KE) of the model with components is oscillating a little, third decimal place in the example I am posting.
From what I can tell energy is conserved. Assuming that I got rid of all the bugs the only explanation is that in the model with components the rotational KE is converted back and forth between components. However, I have not been able to determine if my intuition is correct, where this conversion might take place, and how to avoid it. I am curious if anyone has experienced anything similar. Is there a simple initial equation setting that I am missing or something subtle in setting up the multibody components?
For some reason I can only load PDF attachments. Please see below.
VSCMG-CoM-offset-from-spacecraft-CoM.pdf
VSCMG-CoM-at-spacecraft-CoM.pdf
Thank you. Mit gruessen.
Bogdan
I have slightly modified the code by adding a couple of lines to extract parameters as well and cleaned up a bit for consistency. Tested with MATLAB R2019b Update 5.
Code:
function omimport( resultFile )
%
% Read OpenModelica Result File into Workspace
%
% SYNTAX: omimport( resultFile )
% z.B. omimport('package.model')
%
% Feedback/problems: Christian Schaad, ingenieurbuero@christian-schaad.de
%
% BU added a few lines to extract parameters and cleaned up the clear
% statement. Note that the function now clears OpenModelica variables
% BC0_1 BC0_2 BC0_3 $cse1 $STATESET1. If you need them remove their names
% from the clear command on the last line.
load( resultFile ); %#ok<LOAD>
% sort out double times
deltat0 = find( diff( data_2(1,:) ) == 0 ); %#ok<*USENS>
disp( ['Removed same time values: ', ...
num2str( length( deltat0 ) ), '/', ...
num2str( length( data_2(1, :) ) )] )
% assignments to base workspace
assignin( 'base', 'deltat0', deltat0 );
name = name.'; %#ok<*NODEF>
% replaces round and square parantheses with underscore and $ with D
for i = 1 : size( name, 1 )
name(i, :) = strrep( name(i, :), '[', '_' );
name(i, :) = strrep( name(i, :), ']', '_' );
name(i, :) = strrep( name(i, :), '(', '_' );
name(i, :) = strrep( name(i, :), ')', '_' );
name(i, :) = strrep( name(i, :), '$', 'D' );
end
% loops over all outputs
for i = 1 : size( name, 1 )
if ( dataInfo(1, i ) == 1 ) % extracts parameters
try
assignin( 'base', 'temp', data_1( dataInfo(2, i), : ) );
evalin( 'base', ...
([num2str( name(i, 1 : nonchars(1) - 1)), '=temp;']) );
catch
end
else % extracts variables
% does not extract (time) derivatives of variables
if ( ~contains( name(i, :), 'der_' ) ) % BU change for consistency
nonchars = strfind( name(i,:), char(0) );
if ( dataInfo(2, i) < 0 ) % if dataInfo negative then changes sign
try
assignin( 'base', 'temp', -data_2(-dataInfo(2, i), :) );
catch
end
else
try
assignin( 'base', 'temp', data_2(dataInfo(2, i), :) );
catch
end
end % if ( dataInfo(2, i) < 0 )
try
% removes variable if it is same time
evalin( 'base', ('temp(deltat0) = [];') );
% assigns variable
evalin( 'base', ...
([num2str( name(i, 1 : nonchars(1) - 1)), '=temp;']) );
catch
end % try
end % if ( ~contains( name(i, :), 'der_' ) )
end % if ( dataInfo(1, i ) == 1 )
end % for i
evalin( 'base',('clear deltat0 BC0_1 BC0_2 BC0_3 Dcse1 DSTATESET1') );
Dear Colleagues,
I am using OpenModelica to generate the model of a spacecraft with a variety of actuators as a multibody system. I would like to determine the inertia tensor of the spacecraft as a function of time to verify the results of the simulation.
I haven't been able to find a function that outputs the inertia tensor of the multibody system. Does OpenModelica have such a function? If it does would you please point me to the manual or tutorial?
Thank you!
Bogdan
- Index
- » Users
- » bogey
- » Profile