forked from kdavies4/FCSys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload.mos
53 lines (45 loc) · 2.69 KB
/
load.mos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Script to load the FCSys library in Dymola, with custom settings
// ------------
// Settings
// ------------
// Note: Dymola's list() function lists all possible settings.
// The settings below are all the non-default ones. Comment the lines to use
// the defaults.
// Options to (possibly) increase simulation performance
Advanced.GuardedSqrt = false "Generate error for sqrt of negative numbers";
Advanced.ImprovedPackageConstants = true "Improved code generation for package constants";
Advanced.IncludeLibrariesForSimulink = false "Also link with libraries in Simulink";
Advanced.SubstituteVariablesUsedOnce = true "Substitute variables used only once";
//Advanced.AllowNumericDifferentiation = true "Allow numeric differentiation for computing Jacobian for non-linear solver";
//Advanced.CancelFactors = true "Try to eliminate possible divisions by zero when solving equations";
// Warning: This makes translation very, very slow in Dymola 2014!
//Advanced.CompileWith64 = 0 "Compile the model as 64-bit; 0 only for dll/server if executable is 64-bit, 1 never, 2 always.";
//Advanced.Define.AutoRemoveAuxiliaries = true "Automatically remove code to compute auxilaries that are not needed";
// Warning: Don't use this in Dymola 2014. Modelica.Blocks.Sources.Ramp
// doesn't run correctly with it!
//Advanced.EvaluateParametersDuringSimulation = true "Generate code for evaluation of parameters during simulations";
//Advanced.GenerateAnalyticJacobian = true "Generate analytic Jacobian for the ODE problem";
//Advanced.ParameterExpressionTearing = true "Assume parameter expressions being non-zero at tearing";
//Advanced.ParameterTearing = true "Assume parameters being non-zero at tearing";
//Advanced.SmoothEvent = 0 "How smooth generates events (0 - never, 1 - smart, 2 always)";
//Evaluate = true "Evaluate parameters to reduce models (improves simulation speed).";
// Other options
//Advanced.DefaultSteadyStateInitialization = true "Initialize in steady state as default.";
// ------------
// Startup
// ------------
// Load the FCSys package.
Advanced.CheckUnits = false "Check unit consistency of equations";
openModel("FCSys 0.2.6/package.mo");
cd("..");
// Establish the unit system.
FCSys.Units.setup();
// Work in the directory above the FCSys package.
cd("..")
// Save a static, translated copy of the values of all the constants and units.
// The constants and units will be available in the workspace, but only until
// the next model is simulated. To load the and retain the variables until
// Dymola is closed, translate a model besides Units.Evaluate and then run
// "units.mos" as a script.
translateModel("FCSys.Units.Examples.Evaluate");
Modelica.Utilities.Files.copy("dsmodel.mof", "units.mos", true);