Solar panel to battery, dc to dc converter question
the Solar panel has a max voltage of 40V and the battery that is going to be charged is around 100V, the most easy thing would be to use a Boost converter


Correct


  but from what i understand, an MPPT changes the duty cycle of the dc-dc converter according to de current and voltage of the panel, so it couldn't produce a stable output voltage to charge the battery


To charge a battery you don't need a voltage source, you need a voltage-limited current source. Current should be set to the battery's specified charging current. Max voltage to the final charging voltage. This gives you a nice CC-CV characteristic.


  is this a bad idea?, why?


Yes, too complicated, inefficient, expensive. Why use two DC-DCs when you need one?


  what would be a better solution? 


Use one boost DC-DC acting as a current source, controlling output current. Look at boost LED drivers for inspiration. Or you can use a boost current sink, controlling input current.



Pick a FET and inductor that will not smoke if the FET is ON continuously and shorts the solar panel. Also use the minimum input capacitance, so it does not store enough energy to explode the FET if it is continuously ON and shorts the cap. This will make debugging cheaper.

In this boost converter, output voltage is fixed: it is the battery voltage. The converter can't change that, so first thing you have to do is forget that the duty cycle acts on the output voltage. Here duty cycle controls current, not voltage.

Higher duty cycle (FET ON longer) increases input current. Lower duty cycle decreases input current. If output voltage is kept constant by the battery, this translates to output current.

So it's quite simple.

Measure output voltage to determine if battery is charged or still needs charging. If it is charged, set PWM to zero and do nothing. If it needs charging, you can be subtle and calculate the charging current required depending on its state of charge, using a lower current when it is almost full... or you can be not subtle and set current to maximum then stop when output voltage reaches the "charged" target. In both cases, you have a "desired output current" setpoint. Do a bit of math to translate this into a "desired input current" setpoint.

Continuously measure input current. Adjust PWM until the desired input current is reached.

Continuously measure input voltage. Multiply with current, you get power.

Wiggle the PWM value around its set point while measuring input power. Adjust PWM in the direction that increases power, while not going over the input current set point, because that would exceed the desired battery charging current.

And... repeat.

Personally I'd use a hardware comparator to stop the PWM immediately if the output voltage goes over a certain limit (because the battery disconnected) and also perhaps if the FET current goes over a limit (but that entails measuring the FET current, which means a resistor which will reduce efficiency). This will make debugging cheaper.