- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Unable to recreate optimization...

## Unable to recreate optimization example: 14.1.6 Example 2 / Example 3

### Unable to recreate optimization example: 14.1.6 Example 2 / Example 3

Hi everyone,

I am kind of new to OpenModelica and am trying to recreate example 2/3 from chapter 14.1.6 : Hybrid vehicle minimum consumption, in the OpenModelicaUserGuide.

I am, however, unable to do so, and was wondering if anyone has the complete model working and would be so kind to share it.

Thanks

### Re: Unable to recreate optimization example: 14.1.6 Example 2 / Example 3

somehow I got it working, but results look different; nevertheless, hopefully a first and helpful step...

think the key is to add

__OpenModelica_simulationFlags(s="optimization", optimizerNP="1"),

__OpenModelica_commandLineOptions="+g=Optimica");

to the model annotation.

(see: https://www.openmodelica.org/doc/OpenMo … imization)

fuel consumption map will need some finetuning.

Example-14-1-6-2.mo

simulation settings: start time: 0

stop time: 20

number of steps: 100

integration method: optimization

**Edited by:**glang - Mar-31-22 07:59:08

- glang
- 9 Posts

### Re: Unable to recreate optimization example: 14.1.6 Example 2 / Example 3

following bsfc map (toGperkWh) should be quite close to the map used in the example from the manual;

except I've dismissed gain1, and factored it into the map

Interpolation = ContinuousDerivative

load bsfc

0.00 750

0.04 500

0.20 350

0.40 290

0.60 230

0.77 210

0.80 212

0.90 223

1.00 300

[0, 750; 0.04, 500; 0.2, 350; 0.4, 290; 0.6, 230; 0.77, 210; 0.8, 212; 0.9, 223; 1, 300]

bsfc-map.mo

**Edited by:**glang - Mar-31-22 09:37:03

- glang
- 9 Posts

- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Unable to recreate optimization...