Closed tbeu closed 10 years ago
Thomas,
Thanks! It is great that you had a look at this. One thing to keep in mind is that I deliberately left experiment
annotations out of most models simply because I didn't want them cluttering up the source code listings in the book. The experimental conditions are stored in a script called text/specs.py
. You'll notice at the end of that script a call to generate
. Currently, that call generates input files for OpenModelica. But what it could also do (I just haven't had time to add it) is create a special package that creates a version of each simulation with an experiment annotation, e.g.
package Experiments
model FO
extends ModelicaByExample.BasicEquations.SimpleExample.FirstOrder;
annotation(experiment(stopTime=10));
end FO;
model FOI
extends ModelicaByExample.BasicEquations.SimpleExample.FirstOrderInitial;
annotation(experiment(stopTime=10));
end FOI;
...
end Experiments;
The add_case
function in specs.py
collects/infers all the information necessary to know exactly what model should be run and under what conditions. For the OpenModelica output, I use a Jinja2 based code generation scheme. It would be quite easy to add additional code to generate the Experiments
package I describe above. I will do it at some point. But if you want to take a shot at it, feel free. This is how I managed to get the integrated Javascript into the web version of the book, BTW. (same information was required)
What I would need is a plain text file where each line is one model to be simulated. Thus I use default experiment settings if there is no experiment annotation. Maybe this is easier for you to generate from the add_case
.
ModelicaByExample.Architectures.SensorComparison.Examples.BaseSystem
ModelicaByExample.Architectures.SensorComparison.Examples.FlatSystem
ModelicaByExample.Architectures.SensorComparison.Examples.FlatSystem_Variation1
ModelicaByExample.Architectures.SensorComparison.Examples.HierarchicalSystem
ModelicaByExample.Architectures.SensorComparison.Examples.HierarchicalSystem_Variant1
ModelicaByExample.Architectures.SensorComparison.Examples.SystemArchitecture
ModelicaByExample.Architectures.SensorComparison.Examples.SystemArchitecture_WithDefaults
ModelicaByExample.Architectures.SensorComparison.Examples.Variant1
ModelicaByExample.Architectures.SensorComparison.Examples.Variant1_unstable
ModelicaByExample.Architectures.SensorComparison.Examples.Variant2
ModelicaByExample.Architectures.SensorComparison.Examples.Variant2_tuned
ModelicaByExample.Architectures.ThermalControl.Examples.BaseModel
ModelicaByExample.Architectures.ThermalControl.Examples.ExpandableModel
ModelicaByExample.Architectures.ThermalControl.Examples.HysteresisVariant
ModelicaByExample.Architectures.ThermalControl.Examples.OnOffVariant
ModelicaByExample.ArrayEquations.StateSpace.Examples.FirstOrder
ModelicaByExample.ArrayEquations.StateSpace.Examples.FirstOrder_Compact
ModelicaByExample.ArrayEquations.StateSpace.Examples.LotkaVolterra
ModelicaByExample.ArrayEquations.StateSpace.Examples.NewtonCooling
ModelicaByExample.ArrayEquations.StateSpace.Examples.RLC
ModelicaByExample.ArrayEquations.StateSpace.Examples.RotationalSMD
ModelicaByExample.ArrayEquations.StateSpace.Examples.RotationalSMD_Concat
ModelicaByExample.Components.BlockDiagrams.Examples.ControlledCooling
ModelicaByExample.Components.BlockDiagrams.Examples.MultiDomainControl
ModelicaByExample.Components.BlockDiagrams.Examples.NewtonCooling
ModelicaByExample.Components.ChemicalReactions.Examples.ABX_System
ModelicaByExample.Components.Electrical.Examples.SwitchedRLC
ModelicaByExample.Components.HeatTransfer.Examples.Adiabatic
ModelicaByExample.Components.HeatTransfer.Examples.ComplexNetwork
ModelicaByExample.Components.HeatTransfer.Examples.Cooling
ModelicaByExample.Components.HeatTransfer.Examples.CoolingToAmbient
ModelicaByExample.Components.LotkaVolterra.Examples.ClassicLotkaVolterra
ModelicaByExample.Components.LotkaVolterra.Examples.ThirdSpecies
ModelicaByExample.Components.LotkaVolterra.Examples.ThreeSpecies_Quiescent
ModelicaByExample.Components.Rotational.Examples.SMD
ModelicaByExample.Components.Rotational.Examples.SMD_ConfigurableGear
ModelicaByExample.Components.Rotational.Examples.SMD_GearComparison
ModelicaByExample.Components.Rotational.Examples.SMD_WithBacklash
ModelicaByExample.Components.Rotational.Examples.SMD_WithGroundedGear
ModelicaByExample.Components.SpeedMeasurement.Examples.Plant
ModelicaByExample.Components.SpeedMeasurement.Examples.PlantWithIntervalMeasure
ModelicaByExample.Components.SpeedMeasurement.Examples.PlantWithPulseCounter
ModelicaByExample.Components.SpeedMeasurement.Examples.PlantWithSampleHold
ModelicaByExample.PackageExamples.NewtonCooling
ModelicaByExample.PackageExamples.RLC
ModelicaByExample.PackageExamples.SecondOrderSystem
ModelicaByExample.Subsystems.GearSubsystemModel.Examples.BacklashExample
ModelicaByExample.Subsystems.GearSubsystemModel.Examples.FlatSystemWithBacklash
ModelicaByExample.Subsystems.HeatTransfer.Examples.FlatRod
ModelicaByExample.Subsystems.HeatTransfer.Examples.OneHundredSegmentRod
ModelicaByExample.Subsystems.HeatTransfer.Examples.SegmentComparison
ModelicaByExample.Subsystems.HeatTransfer.Examples.SixSegmentRod
ModelicaByExample.Subsystems.HeatTransfer.Examples.TenSegmentRod
ModelicaByExample.Subsystems.HeatTransfer.Examples.ThreeSegmentRod
ModelicaByExample.Subsystems.HeatTransfer.Examples.TwoHundredSegmentRod
ModelicaByExample.Subsystems.LotkaVolterra.Examples.InitiallyDifferent
ModelicaByExample.Subsystems.LotkaVolterra.Examples.UnconnectedPopulations
ModelicaByExample.Subsystems.LotkaVolterra.Examples.WithMigration
ModelicaByExample.Subsystems.Pendula.Pendulum
ModelicaByExample.Subsystems.Pendula.System
ModelicaByExample.Subsystems.PowerSupply.Examples.AdditionalLoad
ModelicaByExample.Subsystems.PowerSupply.Examples.FlatCircuit
ModelicaByExample.Subsystems.PowerSupply.Examples.SubsystemCircuit
ModelicaByExample.Functions.Polynomials.Differentiation1
ModelicaByExample.Functions.Polynomials.Differentiation2
ModelicaByExample.Functions.Polynomials.EvaluationTest1
ModelicaByExample.Functions.Nonlinearities.ExplicitEvaluation
ModelicaByExample.Functions.ImpureFunctions.HysteresisEmbeddedControl
ModelicaByExample.Functions.Nonlinearities.ImplicitEvaluation
ModelicaByExample.Functions.Interpolation.IntegrateInterpolatedExternalVector
ModelicaByExample.Functions.Interpolation.IntegrateInterpolatedVector
ModelicaByExample.BasicEquations.SimpleExample.FirstOrderSteady
ModelicaByExample.BasicEquations.SimpleExample.FirstOrderInitial
ModelicaByExample.BasicEquations.SimpleExample.FirstOrderExperiment
ModelicaByExample.BasicEquations.SimpleExample.FirstOrderDocumented
ModelicaByExample.BasicEquations.SimpleExample.FirstOrder
ModelicaByExample.BasicEquations.CoolingExample.NewtonCoolingWithDefaults
Thomas,
Just to be clear, the default experiment settings won't be correct for these models. The specs.py file includes the experimental information (not the Modelica models). So if you only have a list of the models, you won't simulate for the right amount of time or the right tolerance.
So far I was only interested in the symbolic analysis (= translation) and initialization but not the simulation (results).
I'm not sure how to "resolve" this issue. I'm going to mark it as a duplicate of issue #6. So any additional commentary should be added there.
Hm, I thought you would care about missing start value warnings (like in model 45) or missing parameters (e.g. model 24). Furthermore, model 6 an 18 give warnings about missing equations.
Sorry, I overlooked those issue. I got too focused on the issue of generating the list of models and how to run them. My mistake. I'll probably split those out into individual issues and then close this ticket. Sound reasonable?
Yes, fine for me. I should have done it this way but was too lazy.
I don't understand the problem with model 6. It is partial. Why is there an error here?
Why is model 18 reporting an issue. It looks like SimulationX is adding initial equations. But that model already has initial equations?
Mike, can't check the models right now but will do so later.
I don't understand the issue with model 59. That is a component model so I don't see why those checks are being done. I realize that without an "experiment" annotation, it is hard to know which ones to check for "simulatability". It doesn't look like 59 should be on that list. Correct me if I'm wrong.
Model 6 is indeed partial and is not intended to run as simulation model. It should be removed from my list.
From looking at ABCD.mo of model 18: Shouldn't it be?
parameter Real x0[nx](fixed=false)=fill(0,nx);
I need to run some tests on it.
Model 59 should also be removed from the list of runnable models.
About model 18: SimulationX has some problem with those empty vectors and matrices. Workaround: If I increase dimensions of ny and nu from 0 to 1 and change the model it runs as expected.
model LotkaVolterra "Lotka-Volterra model in state space form"
parameter Real alpha=0.1;
parameter Real beta=0.02;
parameter Real gamma=0.4;
parameter Real delta=0.02;
parameter Real x_init=10;
parameter Real y_init=10;
extends ABCD(nx=2, nu=1, ny=1, x0={x_init, y_init});
equation
A = [alpha-beta*x[2], 0; 0, -gamma+delta*x[1]];
B = zeros(nx, nu);
C = zeros(ny, nx);
D = zeros(ny, nu);
u = zeros(nu);
end LotkaVolterra;
I will file a ticket for SimulationX here.
About model 59: Maybe you should move: Subsystems.Pendula.Pendulum -> Subsystems.Pendula.Components.Pendulum Subsystems.Pendula.System -> Subsystems.Pendula.Examples.System
I added my list of identified examples to Examples.txt.
I think all the issues discussed in this ticket have been either dealt with or given their own ticket. So I'm closing this now.
I run the 77 example models I could identify in SimulationX Modelica simulator. Please find below the output (informationals, warnings and errors). Beside some obvious issues of the example models there are probably some issues in SimulationX as well.
I need to check what happens with the Pendula models.